Gestionnaire de fichiers - Editer - /home/wwgoat/public_html/blog/codemirror.tar
Arrière
codemirror.min.css 0000644 00000037033 14720661433 0010221 0 ustar 00 /*! This file is auto-generated from CodeMirror - github:codemirror/CodeMirror#ee20357d279bf9edfed0047d3bf2a75b5f0a040f CodeMirror, copyright (c) by Marijn Haverbeke and others Distributed under an MIT license: http://codemirror.net/LICENSE This is CodeMirror (http://codemirror.net), a code editor implemented in JavaScript on top of the browser's DOM. You can find some technical background for some of the code below at http://marijnhaverbeke.nl/blog/#cm-internals . */.CodeMirror-Tern-tooltip,.CodeMirror-hints{-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2)}.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-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,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;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;overflow:auto}.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}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{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-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;white-space:pre;color:#000;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:#fff}.CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:#ffd;border:1px solid #000;border-radius:4px;color:#000;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark-error,.CodeMirror-lint-mark-warning{background-position:left bottom;background-repeat:repeat-x}.CodeMirror-lint-mark-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==)}.CodeMirror-lint-mark-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{background-position:center center;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{padding-left:18px;background-position:top left;background-repeat:no-repeat}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=)}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-multiple{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:right bottom;width:100%;height:100%}.CodeMirror-dialog{position:absolute;left:0;right:0;background:inherit;z-index:15;padding:.1em .8em;overflow:hidden;color:inherit}.CodeMirror-dialog-top{border-bottom:1px solid #eee;top:0}.CodeMirror-dialog-bottom{border-top:1px solid #eee;bottom:0}.CodeMirror-dialog input{border:none;outline:0;background:0 0;width:20em;color:inherit;font-family:monospace}.CodeMirror-dialog button{font-size:70%}.CodeMirror-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;height:auto;z-index:9}.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-folded,.CodeMirror-foldgutter-open{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}.CodeMirror-merge{position:relative;border:1px solid #ddd;white-space:pre}.CodeMirror-merge,.CodeMirror-merge .CodeMirror{height:350px}.CodeMirror-merge-2pane .CodeMirror-merge-pane{width:47%}.CodeMirror-merge-2pane .CodeMirror-merge-gap{width:6%}.CodeMirror-merge-3pane .CodeMirror-merge-pane{width:31%}.CodeMirror-merge-3pane .CodeMirror-merge-gap{width:3.5%}.CodeMirror-merge-pane{display:inline-block;white-space:normal;vertical-align:top}.CodeMirror-merge-pane-rightmost{position:absolute;right:0;z-index:1}.CodeMirror-merge-gap{z-index:2;display:inline-block;height:100%;-moz-box-sizing:border-box;box-sizing:border-box;overflow:hidden;border-left:1px solid #ddd;border-right:1px solid #ddd;position:relative;background:#f8f8f8}.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt,.CodeMirror-overlayscroll .CodeMirror-gutter-filler,.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler{display:none}.CodeMirror-merge-scrolllock-wrap{position:absolute;bottom:0;left:50%}.CodeMirror-merge-scrolllock{position:relative;left:-50%;cursor:pointer;color:#555;line-height:1}.CodeMirror-merge-copy,.CodeMirror-merge-copy-reverse{color:#44c;cursor:pointer;position:absolute}.CodeMirror-merge-copybuttons-left,.CodeMirror-merge-copybuttons-right{position:absolute;left:0;top:0;right:0;bottom:0;line-height:1}.CodeMirror-merge-copy{z-index:3}.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy{left:2px}.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy{right:2px}.CodeMirror-merge-l-inserted,.CodeMirror-merge-r-inserted{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==);background-position:bottom left;background-repeat:repeat-x}.CodeMirror-merge-l-deleted,.CodeMirror-merge-r-deleted{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==);background-position:bottom left;background-repeat:repeat-x}.CodeMirror-merge-r-chunk{background:#ffffe0}.CodeMirror-merge-r-chunk-start{border-top:1px solid #ee8}.CodeMirror-merge-r-chunk-end{border-bottom:1px solid #ee8}.CodeMirror-merge-r-connect{fill:#ffffe0;stroke:#ee8;stroke-width:1px}.CodeMirror-merge-l-chunk{background:#eef}.CodeMirror-merge-l-chunk-start{border-top:1px solid #88e}.CodeMirror-merge-l-chunk-end{border-bottom:1px solid #88e}.CodeMirror-merge-l-connect{fill:#eef;stroke:#88e;stroke-width:1px}.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk{background:#dfd}.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start{border-top:1px solid #4e4}.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end{border-bottom:1px solid #4e4}.CodeMirror-merge-collapsed-widget:before{content:"(...)"}.CodeMirror-merge-collapsed-widget{cursor:pointer;color:#88b;background:#eef;border:1px solid #ddf;font-size:90%;padding:0 3px;border-radius:4px}.CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%}.CodeMirror-search-match{background:gold;border-top:1px solid orange;border-bottom:1px solid orange;-moz-box-sizing:border-box;box-sizing:border-box;opacity:.5}.CodeMirror-Tern-completion{padding-left:22px;position:relative;line-height:1.5}.CodeMirror-Tern-completion:before{position:absolute;left:2px;bottom:2px;border-radius:50%;font-size:12px;font-weight:700;height:15px;width:15px;line-height:16px;text-align:center;color:#fff;-moz-box-sizing:border-box;box-sizing:border-box}.CodeMirror-Tern-completion-unknown:before{content:"?";background:#4bb}.CodeMirror-Tern-completion-object:before{content:"O";background:#77c}.CodeMirror-Tern-completion-fn:before{content:"F";background:#7c7}.CodeMirror-Tern-completion-array:before{content:"A";background:#c66}.CodeMirror-Tern-completion-number:before{content:"1";background:#999}.CodeMirror-Tern-completion-string:before{content:"S";background:#999}.CodeMirror-Tern-completion-bool:before{content:"B";background:#999}.CodeMirror-Tern-completion-guess{color:#999}.CodeMirror-Tern-tooltip{border:1px solid silver;border-radius:3px;color:#444;padding:2px 5px;font-size:90%;font-family:monospace;background-color:#fff;white-space:pre-wrap;max-width:40em;position:absolute;z-index:10;-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);transition:opacity 1s;-moz-transition:opacity 1s;-webkit-transition:opacity 1s;-o-transition:opacity 1s;-ms-transition:opacity 1s}.CodeMirror-Tern-hint-doc{max-width:25em;margin-top:-3px}.CodeMirror-Tern-fname{color:#000}.CodeMirror-Tern-farg{color:#70a}.CodeMirror-Tern-farg-current{text-decoration:underline}.CodeMirror-Tern-type{color:#07c}.CodeMirror-Tern-fhint-guess{opacity:.7} codemirror.min.js 0000644 00002167306 14720661433 0010056 0 ustar 00 /*! This file is auto-generated from CodeMirror - github:codemirror/CodeMirror#ee20357d279bf9edfed0047d3bf2a75b5f0a040f CodeMirror, copyright (c) by Marijn Haverbeke and others Distributed under an MIT license: http://codemirror.net/LICENSE This is CodeMirror (http://codemirror.net), a code editor implemented in JavaScript on top of the browser's DOM. You can find some technical background for some of the code below at http://marijnhaverbeke.nl/blog/#cm-internals . */ !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){var b=a.search(f);return b==-1?0:b}function c(a,b,c){return/\bstring\b/.test(a.getTokenTypeAt(g(b.line,0)))&&!/^[\'\"\`]/.test(c)}function d(a,b){var c=a.getMode();return c.useInnerComments!==!1&&c.innerMode?a.getModeAt(b):c}var e={},f=/[^\s\u00a0]/,g=a.Pos;a.commands.toggleComment=function(a){a.toggleComment()},a.defineExtension("toggleComment",function(a){a||(a=e);for(var b=this,c=1/0,d=this.listSelections(),f=null,h=d.length-1;h>=0;h--){var i=d[h].from(),j=d[h].to();i.line>=c||(j.line>=c&&(j=g(c,0)),c=i.line,null==f?b.uncomment(i,j,a)?f="un":(b.lineComment(i,j,a),f="line"):"un"==f?b.uncomment(i,j,a):b.lineComment(i,j,a))}}),a.defineExtension("lineComment",function(a,h,i){i||(i=e);var j=this,k=d(j,a),l=j.getLine(a.line);if(null!=l&&!c(j,a,l)){var m=i.lineComment||k.lineComment;if(!m)return void((i.blockCommentStart||k.blockCommentStart)&&(i.fullLines=!0,j.blockComment(a,h,i)));var n=Math.min(0!=h.ch||h.line==a.line?h.line+1:h.line,j.lastLine()+1),o=null==i.padding?" ":i.padding,p=i.commentBlankLines||a.line==h.line;j.operation(function(){if(i.indent){for(var c=null,d=a.line;d<n;++d){var e=j.getLine(d),h=e.slice(0,b(e));(null==c||c.length>h.length)&&(c=h)}for(var d=a.line;d<n;++d){var e=j.getLine(d),k=c.length;(p||f.test(e))&&(e.slice(0,k)!=c&&(k=b(e)),j.replaceRange(c+m+o,g(d,0),g(d,k)))}}else for(var d=a.line;d<n;++d)(p||f.test(j.getLine(d)))&&j.replaceRange(m+o,g(d,0))})}}),a.defineExtension("blockComment",function(a,b,c){c||(c=e);var h=this,i=d(h,a),j=c.blockCommentStart||i.blockCommentStart,k=c.blockCommentEnd||i.blockCommentEnd;if(!j||!k)return void((c.lineComment||i.lineComment)&&0!=c.fullLines&&h.lineComment(a,b,c));if(!/\bcomment\b/.test(h.getTokenTypeAt(g(a.line,0)))){var l=Math.min(b.line,h.lastLine());l!=a.line&&0==b.ch&&f.test(h.getLine(l))&&--l;var m=null==c.padding?" ":c.padding;a.line>l||h.operation(function(){if(0!=c.fullLines){var d=f.test(h.getLine(l));h.replaceRange(m+k,g(l)),h.replaceRange(j+m,g(a.line,0));var e=c.blockCommentLead||i.blockCommentLead;if(null!=e)for(var n=a.line+1;n<=l;++n)(n!=l||d)&&h.replaceRange(e+m,g(n,0))}else h.replaceRange(k,b),h.replaceRange(j,a)})}}),a.defineExtension("uncomment",function(a,b,c){c||(c=e);var h,i=this,j=d(i,a),k=Math.min(0!=b.ch||b.line==a.line?b.line:b.line-1,i.lastLine()),l=Math.min(a.line,k),m=c.lineComment||j.lineComment,n=[],o=null==c.padding?" ":c.padding;a:if(m){for(var p=l;p<=k;++p){var q=i.getLine(p),r=q.indexOf(m);if(r>-1&&!/comment/.test(i.getTokenTypeAt(g(p,r+1)))&&(r=-1),r==-1&&f.test(q))break a;if(r>-1&&f.test(q.slice(0,r)))break a;n.push(q)}if(i.operation(function(){for(var a=l;a<=k;++a){var b=n[a-l],c=b.indexOf(m),d=c+m.length;c<0||(b.slice(d,d+o.length)==o&&(d+=o.length),h=!0,i.replaceRange("",g(a,c),g(a,d)))}}),h)return!0}var s=c.blockCommentStart||j.blockCommentStart,t=c.blockCommentEnd||j.blockCommentEnd;if(!s||!t)return!1;var u=c.blockCommentLead||j.blockCommentLead,v=i.getLine(l),w=v.indexOf(s);if(w==-1)return!1;var x=k==l?v:i.getLine(k),y=x.indexOf(t,k==l?w+s.length:0);y==-1&&l!=k&&(x=i.getLine(--k),y=x.indexOf(t));var z=g(l,w+1),A=g(k,y+1);if(y==-1||!/comment/.test(i.getTokenTypeAt(z))||!/comment/.test(i.getTokenTypeAt(A))||i.getRange(z,A,"\n").indexOf(t)>-1)return!1;var B=v.lastIndexOf(s,a.ch),C=B==-1?-1:v.slice(0,a.ch).indexOf(t,B+s.length);if(B!=-1&&C!=-1&&C+t.length!=a.ch)return!1;C=x.indexOf(t,b.ch);var D=x.slice(b.ch).lastIndexOf(s,C-b.ch);return B=C==-1||D==-1?-1:b.ch+D,(C==-1||B==-1||B==b.ch)&&(i.operation(function(){i.replaceRange("",g(k,y-(o&&x.slice(y-o.length,y)==o?o.length:0)),g(k,y+t.length));var a=w+s.length;if(o&&v.slice(a,a+o.length)==o&&(a+=o.length),i.replaceRange("",g(l,w),g(l,a)),u)for(var b=l+1;b<=k;++b){var c=i.getLine(b),d=c.indexOf(u);if(d!=-1&&!f.test(c.slice(0,d))){var e=d+u.length;o&&c.slice(e,e+o.length)==o&&(e+=o.length),i.replaceRange("",g(b,d),g(b,e))}}}),!0)})})},{"../../lib/codemirror":59}],2:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(b){if(b.getOption("disableInput"))return a.Pass;for(var d,e=b.listSelections(),f=[],g=0;g<e.length;g++){var h=e[g].head;if(!/\bcomment\b/.test(b.getTokenTypeAt(h)))return a.Pass;var i=b.getModeAt(h);if(d){if(d!=i)return a.Pass}else d=i;var j=null;if(d.blockCommentStart&&d.blockCommentContinue){var k,l=b.getLine(h.line).slice(0,h.ch),m=l.indexOf(d.blockCommentEnd);if(m!=-1&&m==h.ch-d.blockCommentEnd.length);else if((k=l.indexOf(d.blockCommentStart))>-1){if(j=l.slice(0,k),/\S/.test(j)){j="";for(var n=0;n<k;++n)j+=" "}}else(k=l.indexOf(d.blockCommentContinue))>-1&&!/\S/.test(l.slice(0,k))&&(j=l.slice(0,k));null!=j&&(j+=d.blockCommentContinue)}if(null==j&&d.lineComment&&c(b)){var l=b.getLine(h.line),k=l.indexOf(d.lineComment);k>-1&&(j=l.slice(0,k),/\S/.test(j)?j=null:j+=d.lineComment+l.slice(k+d.lineComment.length).match(/^\s*/)[0])}if(null==j)return a.Pass;f[g]="\n"+j}b.operation(function(){for(var a=e.length-1;a>=0;a--)b.replaceRange(f[a],e[a].from(),e[a].to(),"+insert")})}function c(a){var b=a.getOption("continueComments");return!b||"object"!=typeof b||b.continueLineComment!==!1}for(var d=["clike","css","javascript"],e=0;e<d.length;++e)a.extendMode(d[e],{blockCommentContinue:" * "});a.defineOption("continueComments",null,function(c,d,e){if(e&&e!=a.Init&&c.removeKeyMap("continueComment"),d){var f="Enter";"string"==typeof d?f=d:"object"==typeof d&&d.key&&(f=d.key);var g={name:"continueComment"};g[f]=b,c.addKeyMap(g)}})})},{"../../lib/codemirror":59}],3:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a,b,c){var d,e=a.getWrapperElement();return d=e.appendChild(document.createElement("div")),c?d.className="CodeMirror-dialog CodeMirror-dialog-bottom":d.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof b?d.innerHTML=b:d.appendChild(b),d}function c(a,b){a.state.currentNotificationClose&&a.state.currentNotificationClose(),a.state.currentNotificationClose=b}a.defineExtension("openDialog",function(d,e,f){function g(a){if("string"==typeof a)l.value=a;else{if(j)return;j=!0,i.parentNode.removeChild(i),k.focus(),f.onClose&&f.onClose(i)}}f||(f={}),c(this,null);var h,i=b(this,d,f.bottom),j=!1,k=this,l=i.getElementsByTagName("input")[0];return l?(l.focus(),f.value&&(l.value=f.value,f.selectValueOnOpen!==!1&&l.select()),f.onInput&&a.on(l,"input",function(a){f.onInput(a,l.value,g)}),f.onKeyUp&&a.on(l,"keyup",function(a){f.onKeyUp(a,l.value,g)}),a.on(l,"keydown",function(b){f&&f.onKeyDown&&f.onKeyDown(b,l.value,g)||((27==b.keyCode||f.closeOnEnter!==!1&&13==b.keyCode)&&(l.blur(),a.e_stop(b),g()),13==b.keyCode&&e(l.value,b))}),f.closeOnBlur!==!1&&a.on(l,"blur",g)):(h=i.getElementsByTagName("button")[0])&&(a.on(h,"click",function(){g(),k.focus()}),f.closeOnBlur!==!1&&a.on(h,"blur",g),h.focus()),g}),a.defineExtension("openConfirm",function(d,e,f){function g(){j||(j=!0,h.parentNode.removeChild(h),k.focus())}c(this,null);var h=b(this,d,f&&f.bottom),i=h.getElementsByTagName("button"),j=!1,k=this,l=1;i[0].focus();for(var m=0;m<i.length;++m){var n=i[m];!function(b){a.on(n,"click",function(c){a.e_preventDefault(c),g(),b&&b(k)})}(e[m]),a.on(n,"blur",function(){--l,setTimeout(function(){l<=0&&g()},200)}),a.on(n,"focus",function(){++l})}}),a.defineExtension("openNotification",function(d,e){function f(){i||(i=!0,clearTimeout(g),h.parentNode.removeChild(h))}c(this,f);var g,h=b(this,d,e&&e.bottom),i=!1,j=e&&"undefined"!=typeof e.duration?e.duration:5e3;return a.on(h,"click",function(b){a.e_preventDefault(b),f()}),j&&(g=setTimeout(f,j)),f})})},{"../../lib/codemirror":59}],4:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,d){function e(){b.display.wrapper.offsetHeight?(c(b,d),b.display.lastWrapHeight!=b.display.wrapper.clientHeight&&b.refresh()):d.timeout=setTimeout(e,d.delay)}d.timeout=setTimeout(e,d.delay),d.hurry=function(){clearTimeout(d.timeout),d.timeout=setTimeout(e,50)},a.on(window,"mouseup",d.hurry),a.on(window,"keyup",d.hurry)}function c(b,c){clearTimeout(c.timeout),a.off(window,"mouseup",c.hurry),a.off(window,"keyup",c.hurry)}a.defineOption("autoRefresh",!1,function(a,d){a.state.autoRefresh&&(c(a,a.state.autoRefresh),a.state.autoRefresh=null),d&&0==a.display.wrapper.offsetHeight&&b(a,a.state.autoRefresh={delay:d.delay||250})})})},{"../../lib/codemirror":59}],5:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){var b=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:b.style.width,height:b.style.height},b.style.width="",b.style.height="auto",b.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function c(a){var b=a.getWrapperElement();b.className=b.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var c=a.state.fullScreenRestore;b.style.width=c.width,b.style.height=c.height,window.scrollTo(c.scrollLeft,c.scrollTop),a.refresh()}a.defineOption("fullScreen",!1,function(d,e,f){f==a.Init&&(f=!1),!f!=!e&&(e?b(d):c(d))})})},{"../../lib/codemirror":59}],6:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a,b,c,d){this.cm=a,this.node=b,this.options=c,this.height=d,this.cleared=!1}function c(a){var b=a.getWrapperElement(),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d=parseInt(c.height),e=a.state.panels={setHeight:b.style.height,heightLeft:d,panels:0,wrapper:document.createElement("div")};b.parentNode.insertBefore(e.wrapper,b);var f=a.hasFocus();e.wrapper.appendChild(b),f&&a.focus(),a._setSize=a.setSize,null!=d&&(a.setSize=function(b,c){if(null==c)return this._setSize(b,c);if(e.setHeight=c,"number"!=typeof c){var f=/^(\d+\.?\d*)px$/.exec(c);f?c=Number(f[1]):(e.wrapper.style.height=c,c=e.wrapper.offsetHeight,e.wrapper.style.height="")}a._setSize(b,e.heightLeft+=c-d),d=c})}function d(a){var b=a.state.panels;a.state.panels=null;var c=a.getWrapperElement();b.wrapper.parentNode.replaceChild(c,b.wrapper),c.style.height=b.setHeight,a.setSize=a._setSize,a.setSize()}function e(a,b){for(var c=b.nextSibling;c;c=c.nextSibling)if(c==a.getWrapperElement())return!0;return!1}a.defineExtension("addPanel",function(a,d){d=d||{},this.state.panels||c(this);var f=this.state.panels,g=f.wrapper,h=this.getWrapperElement();d.after instanceof b&&!d.after.cleared?g.insertBefore(a,d.before.node.nextSibling):d.before instanceof b&&!d.before.cleared?g.insertBefore(a,d.before.node):d.replace instanceof b&&!d.replace.cleared?(g.insertBefore(a,d.replace.node),d.replace.clear()):"bottom"==d.position?g.appendChild(a):"before-bottom"==d.position?g.insertBefore(a,h.nextSibling):"after-top"==d.position?g.insertBefore(a,h):g.insertBefore(a,g.firstChild);var i=d&&d.height||a.offsetHeight;return this._setSize(null,f.heightLeft-=i),f.panels++,d.stable&&e(this,a)&&this.scrollTo(null,this.getScrollInfo().top+i),new b(this,a,d,i)}),b.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var a=this.cm.state.panels;this.cm._setSize(null,a.heightLeft+=this.height),this.options.stable&&e(this.cm,this.node)&&this.cm.scrollTo(null,this.cm.getScrollInfo().top-this.height),a.wrapper.removeChild(this.node),0==--a.panels&&d(this.cm)}},b.prototype.changed=function(a){var b=null==a?this.node.offsetHeight:a,c=this.cm.state.panels;this.cm._setSize(null,c.heightLeft-=b-this.height),this.height=b}})},{"../../lib/codemirror":59}],7:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a){a.state.placeholder&&(a.state.placeholder.parentNode.removeChild(a.state.placeholder),a.state.placeholder=null)}function c(a){b(a);var c=a.state.placeholder=document.createElement("pre");c.style.cssText="height: 0; overflow: visible",c.className="CodeMirror-placeholder";var d=a.getOption("placeholder");"string"==typeof d&&(d=document.createTextNode(d)),c.appendChild(d),a.display.lineSpace.insertBefore(c,a.display.lineSpace.firstChild)}function d(a){f(a)&&c(a)}function e(a){var d=a.getWrapperElement(),e=f(a);d.className=d.className.replace(" CodeMirror-empty","")+(e?" CodeMirror-empty":""),e?c(a):b(a)}function f(a){return 1===a.lineCount()&&""===a.getLine(0)}a.defineOption("placeholder","",function(c,f,g){var h=g&&g!=a.Init;if(f&&!h)c.on("blur",d),c.on("change",e),c.on("swapDoc",e),e(c);else if(!f&&h){c.off("blur",d),c.off("change",e),c.off("swapDoc",e),b(c);var i=c.getWrapperElement();i.className=i.className.replace(" CodeMirror-empty","")}f&&!c.hasFocus()&&d(c)})})},{"../../lib/codemirror":59}],8:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b){b.state.rulerDiv.textContent="";var c=b.getOption("rulers"),d=b.defaultCharWidth(),e=b.charCoords(a.Pos(b.firstLine(),0),"div").left;b.state.rulerDiv.style.minHeight=b.display.scroller.offsetHeight+30+"px";for(var f=0;f<c.length;f++){var g=document.createElement("div");g.className="CodeMirror-ruler";var h,i=c[f];"number"==typeof i?h=i:(h=i.column,i.className&&(g.className+=" "+i.className),i.color&&(g.style.borderColor=i.color),i.lineStyle&&(g.style.borderLeftStyle=i.lineStyle),i.width&&(g.style.borderLeftWidth=i.width)),g.style.left=e+h*d+"px",b.state.rulerDiv.appendChild(g)}}a.defineOption("rulers",!1,function(a,c){a.state.rulerDiv&&(a.state.rulerDiv.parentElement.removeChild(a.state.rulerDiv),a.state.rulerDiv=null,a.off("refresh",b)),c&&c.length&&(a.state.rulerDiv=a.display.lineSpace.parentElement.insertBefore(document.createElement("div"),a.display.lineSpace),a.state.rulerDiv.className="CodeMirror-rulers",b(a),a.on("refresh",b))})})},{"../../lib/codemirror":59}],9:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:n[b]}function c(a){for(var b=0;b<a.length;b++){var c=a.charAt(b),e="'"+c+"'";p[e]||(p[e]=d(c))}}function d(a){return function(b){return i(b,a)}}function e(a){var b=a.state.closeBrackets;if(!b||b.override)return b;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function f(c){var d=e(c);if(!d||c.getOption("disableInput"))return a.Pass;for(var f=b(d,"pairs"),g=c.listSelections(),h=0;h<g.length;h++){if(!g[h].empty())return a.Pass;var i=k(c,g[h].head);if(!i||f.indexOf(i)%2!=0)return a.Pass}for(var h=g.length-1;h>=0;h--){var j=g[h].head;c.replaceRange("",o(j.line,j.ch-1),o(j.line,j.ch+1),"+delete")}}function g(c){var d=e(c),f=d&&b(d,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h<g.length;h++){if(!g[h].empty())return a.Pass;var i=k(c,g[h].head);if(!i||f.indexOf(i)%2!=0)return a.Pass}c.operation(function(){c.replaceSelection("\n\n",null),c.execCommand("goCharLeft"),g=c.listSelections();for(var a=0;a<g.length;a++){var b=g[a].head.line;c.indentLine(b,null,!0),c.indentLine(b+1,null,!0)}})}function h(b){var c=a.cmpPos(b.anchor,b.head)>0;return{anchor:new o(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new o(b.head.line,b.head.ch+(c?1:-1))}}function i(c,d){var f=e(c);if(!f||c.getOption("disableInput"))return a.Pass;var g=b(f,"pairs"),i=g.indexOf(d);if(i==-1)return a.Pass;for(var k,n=b(f,"triples"),p=g.charAt(i+1)==d,q=c.listSelections(),r=i%2==0,s=0;s<q.length;s++){var t,u=q[s],v=u.head,w=c.getRange(v,o(v.line,v.ch+1));if(r&&!u.empty())t="surround";else if(!p&&r||w!=d)if(p&&v.ch>1&&n.indexOf(d)>=0&&c.getRange(o(v.line,v.ch-2),v)==d+d&&(v.ch<=2||c.getRange(o(v.line,v.ch-3),o(v.line,v.ch-2))!=d))t="addFour";else if(p){if(a.isWordChar(w)||!l(c,v,d))return a.Pass;t="both"}else{if(!r||c.getLine(v.line).length!=v.ch&&!j(w,g)&&!/\s/.test(w))return a.Pass;t="both"}else t=p&&m(c,v)?"both":n.indexOf(d)>=0&&c.getRange(v,o(v.line,v.ch+3))==d+d+d?"skipThree":"skip";if(k){if(k!=t)return a.Pass}else k=t}var x=i%2?g.charAt(i-1):d,y=i%2?d:g.charAt(i+1);c.operation(function(){if("skip"==k)c.execCommand("goCharRight");else if("skipThree"==k)for(var a=0;a<3;a++)c.execCommand("goCharRight");else if("surround"==k){for(var b=c.getSelections(),a=0;a<b.length;a++)b[a]=x+b[a]+y;c.replaceSelections(b,"around"),b=c.listSelections().slice();for(var a=0;a<b.length;a++)b[a]=h(b[a]);c.setSelections(b)}else"both"==k?(c.replaceSelection(x+y,null),c.triggerElectric(x+y),c.execCommand("goCharLeft")):"addFour"==k&&(c.replaceSelection(x+x+x+x,"before"),c.execCommand("goCharRight"))})}function j(a,b){var c=b.lastIndexOf(a);return c>-1&&c%2==1}function k(a,b){var c=a.getRange(o(b.line,b.ch-1),o(b.line,b.ch+1));return 2==c.length?c:null}function l(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type)||m(b,c))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}function m(a,b){var c=a.getTokenAt(o(b.line,b.ch+1));return/\bstring/.test(c.type)&&c.start==b.ch}var n={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},o=a.Pos;a.defineOption("autoCloseBrackets",!1,function(d,e,f){f&&f!=a.Init&&(d.removeKeyMap(p),d.state.closeBrackets=null),e&&(c(b(e,"pairs")),d.state.closeBrackets=e,d.addKeyMap(p))});var p={Backspace:f,Enter:g};c(n.pairs+"`")})},{"../../lib/codemirror":59}],10:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],d):d(CodeMirror)}(function(a){function b(b){if(b.getOption("disableInput"))return a.Pass;for(var c=b.listSelections(),d=[],i=0;i<c.length;i++){if(!c[i].empty())return a.Pass;var j=c[i].head,k=b.getTokenAt(j),l=a.innerMode(b.getMode(),k.state),m=l.state;if("xml"!=l.mode.name||!m.tagName)return a.Pass;var n=b.getOption("autoCloseTags"),o="html"==l.mode.configuration,p="object"==typeof n&&n.dontCloseTags||o&&g,q="object"==typeof n&&n.indentTags||o&&h,r=m.tagName;k.end>j.ch&&(r=r.slice(0,r.length-k.end+j.ch));var s=r.toLowerCase();if(!r||"string"==k.type&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||1==k.string.length)||"tag"==k.type&&"closeTag"==m.type||k.string.indexOf("/")==k.string.length-1||p&&e(p,s)>-1||f(b,r,j,m,!0))return a.Pass;var t=q&&e(q,s)>-1;d[i]={indent:t,text:">"+(t?"\n\n":"")+"</"+r+">",newPos:t?a.Pos(j.line+1,0):a.Pos(j.line,j.ch+1)}}for(var i=c.length-1;i>=0;i--){var u=d[i];b.replaceRange(u.text,c[i].head,c[i].anchor,"+insert");var v=b.listSelections().slice(0);v[i]={head:u.newPos,anchor:u.newPos},b.setSelections(v),u.indent&&(b.indentLine(u.newPos.line,null,!0),b.indentLine(u.newPos.line+1,null,!0))}}function c(b,c){for(var d=b.listSelections(),e=[],g=c?"/":"</",h=0;h<d.length;h++){if(!d[h].empty())return a.Pass;var i=d[h].head,j=b.getTokenAt(i),k=a.innerMode(b.getMode(),j.state),l=k.state;if(c&&("string"==j.type||"<"!=j.string.charAt(0)||j.start!=i.ch-1))return a.Pass;var m;if("xml"!=k.mode.name)if("htmlmixed"==b.getMode().name&&"javascript"==k.mode.name)m=g+"script";else{if("htmlmixed"!=b.getMode().name||"css"!=k.mode.name)return a.Pass;m=g+"style"}else{if(!l.context||!l.context.tagName||f(b,l.context.tagName,i,l))return a.Pass;m=g+l.context.tagName}">"!=b.getLine(i.line).charAt(j.end)&&(m+=">"),e[h]=m}b.replaceSelections(e),d=b.listSelections();for(var h=0;h<d.length;h++)(h==d.length-1||d[h].head.line<d[h+1].head.line)&&b.indentLine(d[h].head.line)}function d(b){return b.getOption("disableInput")?a.Pass:c(b,!0)}function e(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function f(b,c,d,e,f){if(!a.scanForClosingTag)return!1;var g=Math.min(b.lastLine()+1,d.line+500),h=a.scanForClosingTag(b,d,null,g);if(!h||h.tag!=c)return!1;for(var i=e.context,j=f?1:0;i&&i.tagName==c;i=i.prev)++j;d=h.to;for(var k=1;k<j;k++){var l=a.scanForClosingTag(b,d,null,g);if(!l||l.tag!=c)return!1;d=l.to}return!0}a.defineOption("autoCloseTags",!1,function(c,e,f){if(f!=a.Init&&f&&c.removeKeyMap("autoCloseTags"),e){var g={name:"autoCloseTags"};("object"!=typeof e||e.whenClosing)&&(g["'/'"]=function(a){return d(a)}),("object"!=typeof e||e.whenOpening)&&(g["'>'"]=function(a){return b(a)}),c.addKeyMap(g)}});var g=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],h=["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"];a.commands.closeTag=function(a){return c(a)}})},{"../../lib/codemirror":59,"../fold/xml-fold":21}],11:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";var b=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,c=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,d=/[*+-]\s/;a.commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return a.Pass;for(var f=e.listSelections(),g=[],h=0;h<f.length;h++){var i=f[h].head,j=e.getStateAfter(i.line),k=j.list!==!1,l=0!==j.quote,m=e.getLine(i.line),n=b.exec(m);if(!f[h].empty()||!k&&!l||!n)return void e.execCommand("newlineAndIndent");if(c.test(m))/>\s*$/.test(m)||e.replaceRange("",{line:i.line,ch:0},{line:i.line,ch:i.ch+1}),g[h]="\n";else{var o=n[1],p=n[5],q=d.test(n[2])||n[2].indexOf(">")>=0?n[2].replace("x"," "):parseInt(n[3],10)+1+n[4];g[h]="\n"+o+q+p}}e.replaceSelections(g)}})},{"../../lib/codemirror":59}],12:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a,b,d){var e=a.getLineHandle(b.line),f=b.ch-1,i=d&&d.afterCursor;null==i&&(i=/(^| )cm-fat-cursor($| )/.test(a.getWrapperElement().className));var j=!i&&f>=0&&h[e.text.charAt(f)]||h[e.text.charAt(++f)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(d&&d.strict&&k>0!=(f==b.ch))return null;var l=a.getTokenTypeAt(g(b.line,f+1)),m=c(a,g(b.line,f+(k>0?1:0)),k,l||null,d);return null==m?null:{from:g(b.line,f),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function c(a,b,c,d,e){for(var f=e&&e.maxScanLineLength||1e4,i=e&&e.maxScanLines||1e3,j=[],k=e&&e.bracketRegex?e.bracketRegex:/[(){}[\]]/,l=c>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=c){var n=a.getLine(m);if(n){var o=c>0?0:n.length-1,p=c>0?n.length:-1;if(!(n.length>f))for(m==b.line&&(o=b.ch-(c<0?1:0));o!=p;o+=c){var q=n.charAt(o);if(k.test(q)&&(void 0===d||a.getTokenTypeAt(g(m,o+1))==d)){var r=h[q];if(">"==r.charAt(1)==c>0)j.push(q);else{if(!j.length)return{pos:g(m,o),ch:q};j.pop()}}}}}return m-c!=(c>0?a.lastLine():a.firstLine())&&null}function d(a,c,d){for(var e=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j<i.length;j++){var k=i[j].empty()&&b(a,i[j].head,d);if(k&&a.getLine(k.from.line).length<=e){var l=k.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";h.push(a.markText(k.from,g(k.from.line,k.from.ch+1),{className:l})),k.to&&a.getLine(k.to.line).length<=e&&h.push(a.markText(k.to,g(k.to.line,k.to.ch+1),{className:l}))}}if(h.length){f&&a.state.focused&&a.focus();var m=function(){a.operation(function(){for(var a=0;a<h.length;a++)h[a].clear()})};if(!c)return m;setTimeout(m,800)}}function e(a){a.operation(function(){i&&(i(),i=null),i=d(a,!1,a.state.matchBrackets)})}var f=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=a.Pos,h={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},i=null;a.defineOption("matchBrackets",!1,function(b,c,d){d&&d!=a.Init&&(b.off("cursorActivity",e),i&&(i(),i=null)),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",e))}),a.defineExtension("matchBrackets",function(){d(this,!0)}),a.defineExtension("findMatchingBracket",function(a,c,d){return(d||"boolean"==typeof c)&&(d?(d.strict=c,c=d):c=c?{strict:!0}:null),b(this,a,c)}),a.defineExtension("scanForBracket",function(a,b,d,e){return c(this,a,b,d,e)})})},{"../../lib/codemirror":59}],13:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],d):d(CodeMirror)}(function(a){"use strict";function b(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function c(c){c.state.failedTagMatch=!1,c.operation(function(){if(b(c),!c.somethingSelected()){var d=c.getCursor(),e=c.getViewport();e.from=Math.min(e.from,d.line),e.to=Math.max(d.line+1,e.to);var f=a.findMatchingTag(c,d,e);if(f){if(c.state.matchBothTags){var g="open"==f.at?f.open:f.close;g&&(c.state.tagHit=c.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var h="close"==f.at?f.open:f.close;h?c.state.tagOther=c.markText(h.from,h.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}}})}function d(a){a.state.failedTagMatch&&c(a)}a.defineOption("matchTags",!1,function(e,f,g){g&&g!=a.Init&&(e.off("cursorActivity",c),e.off("viewportChange",d),b(e)),f&&(e.state.matchBothTags="object"==typeof f&&f.bothTags,e.on("cursorActivity",c),e.on("viewportChange",d),c(e))}),a.commands.toMatchingTag=function(b){var c=a.findMatchingTag(b,b.getCursor());if(c){var d="close"==c.at?c.open:c.close;d&&b.extendSelection(d.to,d.from)}}})},{"../../lib/codemirror":59,"../fold/xml-fold":21}],14:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){a.defineOption("showTrailingSpace",!1,function(b,c,d){d==a.Init&&(d=!1),d&&!c?b.removeOverlay("trailingspace"):!d&&c&&b.addOverlay({token:function(a){for(var b=a.string.length,c=b;c&&/\s/.test(a.string.charAt(c-1));--c);return c>a.pos?(a.pos=c,null):(a.pos=b,"trailingspace")},name:"trailingspace"})})})},{"../../lib/codemirror":59}],15:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.registerHelper("fold","brace",function(b,c){function d(d){for(var h=c.ch,i=0;;){var j=h<=0?-1:g.lastIndexOf(d,h-1);if(j!=-1){if(1==i&&j<c.ch)break;if(e=b.getTokenTypeAt(a.Pos(f,j+1)),!/^(comment|string)/.test(e))return j+1;h=j-1}else{if(1==i)break;i=1,h=g.length}}}var e,f=c.line,g=b.getLine(f),h="{",i="}",j=d("{");if(null==j&&(h="[",i="]",j=d("[")),null!=j){var k,l,m=1,n=b.lastLine();a:for(var o=f;o<=n;++o)for(var p=b.getLine(o),q=o==f?j:0;;){var r=p.indexOf(h,q),s=p.indexOf(i,q);if(r<0&&(r=p.length),s<0&&(s=p.length),q=Math.min(r,s),q==p.length)break;if(b.getTokenTypeAt(a.Pos(o,q+1))==e)if(q==r)++m;else if(!--m){k=o,l=q;break a}++q}if(null!=k&&(f!=k||l!=j))return{from:a.Pos(f,j),to:a.Pos(k,l)}}}),a.registerHelper("fold","import",function(b,c){function d(c){if(c<b.firstLine()||c>b.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));if(/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"keyword"!=d.type||"import"!=d.string)return null;for(var e=c,f=Math.min(b.lastLine(),c+10);e<=f;++e){var g=b.getLine(e),h=g.indexOf(";");if(h!=-1)return{startCh:d.end,end:a.Pos(e,h)}}}var e,f=c.line,g=d(f);if(!g||d(f-1)||(e=d(f-2))&&e.end.line==f-1)return null;for(var h=g.end;;){var i=d(h.line+1);if(null==i)break;h=i.end}return{from:b.clipPos(a.Pos(f,g.startCh+1)),to:h}}),a.registerHelper("fold","include",function(b,c){function d(c){if(c<b.firstLine()||c>b.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));return/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"meta"==d.type&&"#include"==d.string.slice(0,8)?d.start+8:void 0}var e=c.line,f=d(e);if(null==f||null!=d(e-1))return null;for(var g=e;;){var h=d(g+1);if(null==h)break;++g}return{from:a.Pos(e,f+1),to:b.clipPos(a.Pos(g))}})})},{"../../lib/codemirror":59}],16:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.registerGlobalHelper("fold","comment",function(a){return a.blockCommentStart&&a.blockCommentEnd},function(b,c){var d=b.getModeAt(c),e=d.blockCommentStart,f=d.blockCommentEnd;if(e&&f){for(var g,h=c.line,i=b.getLine(h),j=c.ch,k=0;;){var l=j<=0?-1:i.lastIndexOf(e,j-1);if(l!=-1){if(1==k&&l<c.ch)return;if(/comment/.test(b.getTokenTypeAt(a.Pos(h,l+1)))&&(0==l||i.slice(l-f.length,l)==f||!/comment/.test(b.getTokenTypeAt(a.Pos(h,l))))){g=l+e.length;break}j=l-1}else{if(1==k)return;k=1,j=i.length}}var m,n,o=1,p=b.lastLine();a:for(var q=h;q<=p;++q)for(var r=b.getLine(q),s=q==h?g:0;;){var t=r.indexOf(e,s),u=r.indexOf(f,s);if(t<0&&(t=r.length),u<0&&(u=r.length),s=Math.min(t,u),s==r.length)break;if(s==t)++o;else if(!--o){m=q,n=s;break a}++s}if(null!=m&&(h!=m||n!=g))return{from:a.Pos(h,g),to:a.Pos(m,n)}}})})},{"../../lib/codemirror":59}],17:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,e,f,g){function h(a){var c=i(b,e);if(!c||c.to.line-c.from.line<j)return null;for(var d=b.findMarksAt(c.from),f=0;f<d.length;++f)if(d[f].__isFold&&"fold"!==g){if(!a)return null;c.cleared=!0,d[f].clear()}return c}if(f&&f.call){var i=f;f=null}else var i=d(b,f,"rangeFinder");"number"==typeof e&&(e=a.Pos(e,0));var j=d(b,f,"minFoldSize"),k=h(!0);if(d(b,f,"scanUp"))for(;!k&&e.line>b.firstLine();)e=a.Pos(e.line-1,0),k=h(!1);if(k&&!k.cleared&&"unfold"!==g){var l=c(b,f);a.on(l,"mousedown",function(b){m.clear(),a.e_preventDefault(b)});var m=b.markText(k.from,k.to,{replacedWith:l,clearOnEnter:d(b,f,"clearOnEnter"),__isFold:!0});m.on("clear",function(c,d){a.signal(b,"unfold",b,c,d)}),a.signal(b,"fold",b,k.from,k.to)}}function c(a,b){var c=d(a,b,"widget");if("string"==typeof c){var e=document.createTextNode(c);c=document.createElement("span"),c.appendChild(e),c.className="CodeMirror-foldmarker"}else c&&(c=c.cloneNode(!0));return c}function d(a,b,c){if(b&&void 0!==b[c])return b[c];var d=a.options.foldOptions;return d&&void 0!==d[c]?d[c]:e[c]}a.newFoldFunction=function(a,c){return function(d,e){b(d,e,{rangeFinder:a, widget:c})}},a.defineExtension("foldCode",function(a,c,d){b(this,a,c,d)}),a.defineExtension("isFolded",function(a){for(var b=this.findMarksAt(a),c=0;c<b.length;++c)if(b[c].__isFold)return!0}),a.commands.toggleFold=function(a){a.foldCode(a.getCursor())},a.commands.fold=function(a){a.foldCode(a.getCursor(),null,"fold")},a.commands.unfold=function(a){a.foldCode(a.getCursor(),null,"unfold")},a.commands.foldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();c<=d;c++)b.foldCode(a.Pos(c,0),null,"fold")})},a.commands.unfoldAll=function(b){b.operation(function(){for(var c=b.firstLine(),d=b.lastLine();c<=d;c++)b.foldCode(a.Pos(c,0),null,"unfold")})},a.registerHelper("fold","combine",function(){var a=Array.prototype.slice.call(arguments,0);return function(b,c){for(var d=0;d<a.length;++d){var e=a[d](b,c);if(e)return e}}}),a.registerHelper("fold","auto",function(a,b){for(var c=a.getHelpers(b,"fold"),d=0;d<c.length;d++){var e=c[d](a,b);if(e)return e}});var e={rangeFinder:a.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null),a.defineExtension("foldOption",function(a,b){return d(this,a,b)})})},{"../../lib/codemirror":59}],18:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],d):d(CodeMirror)}(function(a){"use strict";function b(a){this.options=a,this.from=this.to=0}function c(a){return a===!0&&(a={}),null==a.gutter&&(a.gutter="CodeMirror-foldgutter"),null==a.indicatorOpen&&(a.indicatorOpen="CodeMirror-foldgutter-open"),null==a.indicatorFolded&&(a.indicatorFolded="CodeMirror-foldgutter-folded"),a}function d(a,b){for(var c=a.findMarks(l(b,0),l(b+1,0)),d=0;d<c.length;++d)if(c[d].__isFold&&c[d].find().from.line==b)return c[d]}function e(a){if("string"==typeof a){var b=document.createElement("div");return b.className=a+" CodeMirror-guttermarker-subtle",b}return a.cloneNode(!0)}function f(a,b,c){var f=a.state.foldGutter.options,g=b,h=a.foldOption(f,"minFoldSize"),i=a.foldOption(f,"rangeFinder");a.eachLine(b,c,function(b){var c=null;if(d(a,g))c=e(f.indicatorFolded);else{var j=l(g,0),k=i&&i(a,j);k&&k.to.line-k.from.line>=h&&(c=e(f.indicatorOpen))}a.setGutterMarker(b,f.gutter,c),++g})}function g(a){var b=a.getViewport(),c=a.state.foldGutter;c&&(a.operation(function(){f(a,b.from,b.to)}),c.from=b.from,c.to=b.to)}function h(a,b,c){var e=a.state.foldGutter;if(e){var f=e.options;if(c==f.gutter){var g=d(a,b);g?g.clear():a.foldCode(l(b,0),f.rangeFinder)}}}function i(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){g(a)},c.foldOnChangeTimeSpan||600)}}function j(a){var b=a.state.foldGutter;if(b){var c=b.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function(){var c=a.getViewport();b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation(function(){c.from<b.from&&(f(a,c.from,b.from),b.from=c.from),c.to>b.to&&(f(a,b.to,c.to),b.to=c.to)})},c.updateViewportTimeSpan||400)}}function k(a,b){var c=a.state.foldGutter;if(c){var d=b.line;d>=c.from&&d<c.to&&f(a,d,d+1)}}a.defineOption("foldGutter",!1,function(d,e,f){f&&f!=a.Init&&(d.clearGutter(d.state.foldGutter.options.gutter),d.state.foldGutter=null,d.off("gutterClick",h),d.off("change",i),d.off("viewportChange",j),d.off("fold",k),d.off("unfold",k),d.off("swapDoc",i)),e&&(d.state.foldGutter=new b(c(e)),g(d),d.on("gutterClick",h),d.on("change",i),d.on("viewportChange",j),d.on("fold",k),d.on("unfold",k),d.on("swapDoc",i))});var l=a.Pos})},{"../../lib/codemirror":59,"./foldcode":17}],19:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,c){var d=b.getLine(c),e=d.search(/\S/);return e==-1||/\bcomment\b/.test(b.getTokenTypeAt(a.Pos(c,e+1)))?-1:a.countColumn(d,null,b.getOption("tabSize"))}a.registerHelper("fold","indent",function(c,d){var e=b(c,d.line);if(!(e<0)){for(var f=null,g=d.line+1,h=c.lastLine();g<=h;++g){var i=b(c,g);if(i==-1);else{if(!(i>e))break;f=g}}return f?{from:a.Pos(d.line,c.getLine(d.line).length),to:a.Pos(f,c.getLine(f).length)}:void 0}})})},{"../../lib/codemirror":59}],20:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.registerHelper("fold","markdown",function(b,c){function d(c){var d=b.getTokenTypeAt(a.Pos(c,0));return d&&/\bheader\b/.test(d)}function e(a,b,c){var e=b&&b.match(/^#+/);return e&&d(a)?e[0].length:(e=c&&c.match(/^[=\-]+\s*$/),e&&d(a+1)?"="==c[0]?1:2:f)}var f=100,g=b.getLine(c.line),h=b.getLine(c.line+1),i=e(c.line,g,h);if(i!==f){for(var j=b.lastLine(),k=c.line,l=b.getLine(k+2);k<j&&!(e(k+1,h,l)<=i);)++k,h=l,l=b.getLine(k+2);return{from:a.Pos(c.line,g.length),to:a.Pos(k,b.getLine(k).length)}}})})},{"../../lib/codemirror":59}],21:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){return a.line-b.line||a.ch-b.ch}function c(a,b,c,d){this.line=b,this.ch=c,this.cm=a,this.text=a.getLine(b),this.min=d?Math.max(d.from,a.firstLine()):a.firstLine(),this.max=d?Math.min(d.to-1,a.lastLine()):a.lastLine()}function d(a,b){var c=a.cm.getTokenTypeAt(m(a.line,b));return c&&/\btag\b/.test(c)}function e(a){if(!(a.line>=a.max))return a.ch=0,a.text=a.cm.getLine(++a.line),!0}function f(a){if(!(a.line<=a.min))return a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0}function g(a){for(;;){var b=a.text.indexOf(">",a.ch);if(b==-1){if(e(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),f=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,f?"selfClose":"regular"}a.ch=b+1}}}function h(a){for(;;){var b=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(b==-1){if(f(a))continue;return}if(d(a,b+1)){p.lastIndex=b,a.ch=b;var c=p.exec(a.text);if(c&&c.index==b)return c}else a.ch=b}}function i(a){for(;;){p.lastIndex=a.ch;var b=p.exec(a.text);if(!b){if(e(a))continue;return}{if(d(a,b.index+1))return a.ch=b.index+b[0].length,b;a.ch=b.index+1}}}function j(a){for(;;){var b=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(b==-1){if(f(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),e=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,e?"selfClose":"regular"}a.ch=b}}}function k(a,b){for(var c=[];;){var d,e=i(a),f=a.line,h=a.ch-(e?e[0].length:0);if(!e||!(d=g(a)))return;if("selfClose"!=d)if(e[1]){for(var j=c.length-1;j>=0;--j)if(c[j]==e[2]){c.length=j;break}if(j<0&&(!b||b==e[2]))return{tag:e[2],from:m(f,h),to:m(a.line,a.ch)}}else c.push(e[2])}}function l(a,b){for(var c=[];;){var d=j(a);if(!d)return;if("selfClose"!=d){var e=a.line,f=a.ch,g=h(a);if(!g)return;if(g[1])c.push(g[2]);else{for(var i=c.length-1;i>=0;--i)if(c[i]==g[2]){c.length=i;break}if(i<0&&(!b||b==g[2]))return{tag:g[2],from:m(a.line,a.ch),to:m(e,f)}}}else h(a)}}var m=a.Pos,n="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",o=n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+n+"]["+o+"]*)","g");a.registerHelper("fold","xml",function(a,b){for(var d=new c(a,b.line,0);;){var e,f=i(d);if(!f||d.line!=b.line||!(e=g(d)))return;if(!f[1]&&"selfClose"!=e){var h=m(d.line,d.ch),j=k(d,f[2]);return j&&{from:h,to:j.from}}}}),a.findMatchingTag=function(a,d,e){var f=new c(a,d.line,d.ch,e);if(f.text.indexOf(">")!=-1||f.text.indexOf("<")!=-1){var i=g(f),j=i&&m(f.line,f.ch),n=i&&h(f);if(i&&n&&!(b(f,d)>0)){var o={from:m(f.line,f.ch),to:j,tag:n[2]};return"selfClose"==i?{open:o,close:null,at:"open"}:n[1]?{open:l(f,n[2]),close:o,at:"close"}:(f=new c(a,j.line,j.ch,e),{open:o,close:k(f,n[2]),at:"open"})}}},a.findEnclosingTag=function(a,b,d,e){for(var f=new c(a,b.line,b.ch,d);;){var g=l(f,e);if(!g)break;var h=new c(a,b.line,b.ch,d),i=k(h,g.tag);if(i)return{open:g,close:i}}},a.scanForClosingTag=function(a,b,d,e){var f=new c(a,b.line,b.ch,e?{from:0,to:e}:null);return k(f,d)}})},{"../../lib/codemirror":59}],22:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";var b=/[\w$]+/,c=500;a.registerHelper("hint","anyword",function(d,e){for(var f=e&&e.word||b,g=e&&e.range||c,h=d.getCursor(),i=d.getLine(h.line),j=h.ch,k=j;k&&f.test(i.charAt(k-1));)--k;for(var l=k!=j&&i.slice(k,j),m=e&&e.list||[],n={},o=new RegExp(f.source,"g"),p=-1;p<=1;p+=2)for(var q=h.line,r=Math.min(Math.max(q+p*g,d.firstLine()),d.lastLine())+p;q!=r;q+=p)for(var s,t=d.getLine(q);s=o.exec(t);)q==h.line&&s[0]===l||l&&0!=s[0].lastIndexOf(l,0)||Object.prototype.hasOwnProperty.call(n,s[0])||(n[s[0]]=!0,m.push(s[0]));return{list:m,from:a.Pos(h.line,k),to:a.Pos(h.line,j)}})})},{"../../lib/codemirror":59}],23:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],d):d(CodeMirror)}(function(a){"use strict";var b={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};a.registerHelper("hint","css",function(c){function d(a){for(var b in a)j&&0!=b.lastIndexOf(j,0)||l.push(b)}var e=c.getCursor(),f=c.getTokenAt(e),g=a.innerMode(c.getMode(),f.state);if("css"==g.mode.name){if("keyword"==f.type&&0=="!important".indexOf(f.string))return{list:["!important"],from:a.Pos(e.line,f.start),to:a.Pos(e.line,f.end)};var h=f.start,i=e.ch,j=f.string.slice(0,i-h);/[^\w$_-]/.test(j)&&(j="",h=i=e.ch);var k=a.resolveMode("text/css"),l=[],m=g.state.state;return"pseudo"==m||"variable-3"==f.type?d(b):"block"==m||"maybeprop"==m?d(k.propertyKeywords):"prop"==m||"parens"==m||"at"==m||"params"==m?(d(k.valueKeywords),d(k.colorKeywords)):"media"!=m&&"media_parens"!=m||(d(k.mediaTypes),d(k.mediaFeatures)),l.length?{list:l,from:a.Pos(e.line,h),to:a.Pos(e.line,i)}:void 0}})})},{"../../lib/codemirror":59,"../../mode/css/css":61}],24:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],d):d(CodeMirror)}(function(a){"use strict";function b(a){for(var b in l)l.hasOwnProperty(b)&&(a.attrs[b]=l[b])}function c(b,c){var d={schemaInfo:k};if(c)for(var e in c)d[e]=c[e];return a.hint.xml(b,d)}var d="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),e=["_blank","_self","_top","_parent"],f=["ascii","utf-8","utf-16","latin1","latin1"],g=["get","post","put","delete"],h=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],i=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],j={attrs:{}},k={a:{attrs:{href:null,ping:null,type:null,media:i,target:e,hreflang:d}},abbr:j,acronym:j,address:j,applet:j,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:i,hreflang:d,type:null,shape:["default","rect","circle","poly"]}},article:j,aside:j,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:j,base:{attrs:{href:null,target:e}},basefont:j,bdi:j,bdo:j,big:j,blockquote:{attrs:{cite:null}},body:j,br:j,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:h,formmethod:g,formnovalidate:["","novalidate"],formtarget:e,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:j,center:j,cite:j,code:j,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:j,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:j,dir:j,div:j,dl:j,dt:j,em:j,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:j,figure:j,font:j,footer:j,form:{attrs:{action:null,name:null,"accept-charset":f,autocomplete:["on","off"],enctype:h,method:g,novalidate:["","novalidate"],target:e}},frame:j,frameset:j,h1:j,h2:j,h3:j,h4:j,h5:j,h6:j,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:j,hgroup:j,hr:j,html:{attrs:{manifest:null},children:["head","body"]},i:j,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:h,formmethod:g,formnovalidate:["","novalidate"],formtarget:e,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:j,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:j,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:d,media:i,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:j,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:f,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:j,noframes:j,noscript:j,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:j,param:{attrs:{name:null,value:null}},pre:j,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:j,rt:j,ruby:j,s:j,samp:j,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:f}},section:j,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:j,source:{attrs:{src:null,type:null,media:null}},span:j,strike:j,strong:j,style:{attrs:{type:["text/css"],media:i,scoped:null}},sub:j,summary:j,sup:j,table:j,tbody:j,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:j,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:j,time:{attrs:{datetime:null}},title:j,tr:j,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:d}},tt:j,u:j,ul:j,"var":j,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:j},l={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};b(j);for(var m in k)k.hasOwnProperty(m)&&k[m]!=j&&b(k[m]);a.htmlSchema=k,a.registerHelper("hint","html",c)})},{"../../lib/codemirror":59,"./xml-hint":28}],25:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){function b(a,b){for(var c=0,d=a.length;c<d;++c)b(a[c])}function c(a,b){if(!Array.prototype.indexOf){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}return a.indexOf(b)!=-1}function d(b,c,d,e){var f=b.getCursor(),g=d(b,f);if(!/\b(?:string|comment)\b/.test(g.type)){g.state=a.innerMode(b.getMode(),g.state).state,/^[\w$_]*$/.test(g.string)?g.end>f.ch&&(g.end=f.ch,g.string=g.string.slice(0,f.ch-g.start)):g={start:f.ch,end:f.ch,string:"",state:g.state,type:"."==g.string?"property":null};for(var h=g;"property"==h.type;){if(h=d(b,j(f.line,h.start)),"."!=h.string)return;if(h=d(b,j(f.line,h.start)),!k)var k=[];k.push(h)}return{list:i(g,k,c,e),from:j(f.line,g.start),to:j(f.line,g.end)}}}function e(a,b){return d(a,n,function(a,b){return a.getTokenAt(b)},b)}function f(a,b){var c=a.getTokenAt(b);return b.ch==c.start+1&&"."==c.string.charAt(0)?(c.end=c.start,c.string=".",c.type="property"):/^\.[\w$_]*$/.test(c.string)&&(c.type="property",c.start++,c.string=c.string.replace(/\./,"")),c}function g(a,b){return d(a,o,f,b)}function h(a,b){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var c=a;c;c=Object.getPrototypeOf(c))Object.getOwnPropertyNames(c).forEach(b);else for(var d in a)b(d)}function i(a,d,e,f){function g(a){0!=a.lastIndexOf(n,0)||c(j,a)||j.push(a)}function i(a){"string"==typeof a?b(k,g):a instanceof Array?b(l,g):a instanceof Function&&b(m,g),h(a,g)}var j=[],n=a.string,o=f&&f.globalScope||window;if(d&&d.length){var p,q=d.pop();for(q.type&&0===q.type.indexOf("variable")?(f&&f.additionalContext&&(p=f.additionalContext[q.string]),f&&f.useGlobalScope===!1||(p=p||o[q.string])):"string"==q.type?p="":"atom"==q.type?p=1:"function"==q.type&&(null==o.jQuery||"$"!=q.string&&"jQuery"!=q.string||"function"!=typeof o.jQuery?null!=o._&&"_"==q.string&&"function"==typeof o._&&(p=o._()):p=o.jQuery());null!=p&&d.length;)p=p[d.pop().string];null!=p&&i(p)}else{for(var r=a.state.localVars;r;r=r.next)g(r.name);for(var r=a.state.globalVars;r;r=r.next)g(r.name);f&&f.useGlobalScope===!1||i(o),b(e,g)}return j}var j=a.Pos;a.registerHelper("hint","javascript",e),a.registerHelper("hint","coffeescript",g);var k="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),l="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),m="prototype apply call bind".split(" "),n="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),o="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")})},{"../../lib/codemirror":59}],26:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){this.cm=a,this.options=b,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}function c(b,c){var d=a.cmpPos(c.from,b.from);return d>0&&b.to.ch-b.from.ch!=c.to.ch-c.from.ch}function d(a,b,c){var d=a.options.hintOptions,e={};for(var f in p)e[f]=p[f];if(d)for(var f in d)void 0!==d[f]&&(e[f]=d[f]);if(c)for(var f in c)void 0!==c[f]&&(e[f]=c[f]);return e.hint.resolve&&(e.hint=e.hint.resolve(a,b)),e}function e(a){return"string"==typeof a?a:a.text}function f(a,b){function c(a,c){var e;e="string"!=typeof c?function(a){return c(a,b)}:d.hasOwnProperty(c)?d[c]:c,f[a]=e}var d={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close},e=a.options.customKeys,f=e?{}:d;if(e)for(var g in e)e.hasOwnProperty(g)&&c(g,e[g]);var h=a.options.extraKeys;if(h)for(var g in h)h.hasOwnProperty(g)&&c(g,h[g]);return f}function g(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function h(b,c){this.completion=b,this.data=c,this.picked=!1;var d=this,h=b.cm,i=this.hints=document.createElement("ul");i.className="CodeMirror-hints",this.selectedHint=c.selectedHint||0;for(var j=c.list,k=0;k<j.length;++k){var n=i.appendChild(document.createElement("li")),o=j[k],p=l+(k!=this.selectedHint?"":" "+m);null!=o.className&&(p=o.className+" "+p),n.className=p,o.render?o.render(n,c,o):n.appendChild(document.createTextNode(o.displayText||e(o))),n.hintId=k}var q=h.cursorCoords(b.options.alignWithWord?c.from:null),r=q.left,s=q.bottom,t=!0;i.style.left=r+"px",i.style.top=s+"px";var u=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),v=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(b.options.container||document.body).appendChild(i);var w=i.getBoundingClientRect(),x=w.bottom-v,y=i.scrollHeight>i.clientHeight+1,z=h.getScrollInfo();if(x>0){var A=w.bottom-w.top,B=q.top-(q.bottom-w.top);if(B-A>0)i.style.top=(s=q.top-A)+"px",t=!1;else if(A>v){i.style.height=v-5+"px",i.style.top=(s=q.bottom-w.top)+"px";var C=h.getCursor();c.from.ch!=C.ch&&(q=h.cursorCoords(C),i.style.left=(r=q.left)+"px",w=i.getBoundingClientRect())}}var D=w.right-u;if(D>0&&(w.right-w.left>u&&(i.style.width=u-5+"px",D-=w.right-w.left-u),i.style.left=(r=q.left-D)+"px"),y)for(var E=i.firstChild;E;E=E.nextSibling)E.style.paddingRight=h.display.nativeBarWidth+"px";if(h.addKeyMap(this.keyMap=f(b,{moveFocus:function(a,b){d.changeActive(d.selectedHint+a,b)},setFocus:function(a){d.changeActive(a)},menuSize:function(){return d.screenAmount()},length:j.length,close:function(){b.close()},pick:function(){d.pick()},data:c})),b.options.closeOnUnfocus){var F;h.on("blur",this.onBlur=function(){F=setTimeout(function(){b.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(F)})}return h.on("scroll",this.onScroll=function(){var a=h.getScrollInfo(),c=h.getWrapperElement().getBoundingClientRect(),d=s+z.top-a.top,e=d-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return t||(e+=i.offsetHeight),e<=c.top||e>=c.bottom?b.close():(i.style.top=d+"px",void(i.style.left=r+z.left-a.left+"px"))}),a.on(i,"dblclick",function(a){var b=g(i,a.target||a.srcElement);b&&null!=b.hintId&&(d.changeActive(b.hintId),d.pick())}),a.on(i,"click",function(a){var c=g(i,a.target||a.srcElement);c&&null!=c.hintId&&(d.changeActive(c.hintId),b.options.completeOnSingleClick&&d.pick())}),a.on(i,"mousedown",function(){setTimeout(function(){h.focus()},20)}),a.signal(c,"select",j[this.selectedHint],i.childNodes[this.selectedHint]),!0}function i(a,b){if(!a.somethingSelected())return b;for(var c=[],d=0;d<b.length;d++)b[d].supportsSelection&&c.push(b[d]);return c}function j(a,b,c,d){if(a.async)a(b,d,c);else{var e=a(b,c);e&&e.then?e.then(d):d(e)}}function k(b,c){var d,e=b.getHelpers(c,"hint");if(e.length){var f=function(a,b,c){function d(e){return e==f.length?b(null):void j(f[e],a,c,function(a){a&&a.list.length>0?b(a):d(e+1)})}var f=i(a,e);d(0)};return f.async=!0,f.supportsSelection=!0,f}return(d=b.getHelper(b.getCursor(),"hintWords"))?function(b){return a.hint.fromList(b,{words:d})}:a.hint.anyword?function(b,c){return a.hint.anyword(b,c)}:function(){}}var l="CodeMirror-hint",m="CodeMirror-hint-active";a.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);var d={hint:b};if(c)for(var e in c)d[e]=c[e];return a.showHint(d)},a.defineExtension("showHint",function(c){c=d(this,this.getCursor("start"),c);var e=this.listSelections();if(!(e.length>1)){if(this.somethingSelected()){if(!c.hint.supportsSelection)return;for(var f=0;f<e.length;f++)if(e[f].head.line!=e[f].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var g=this.state.completionActive=new b(this,c);g.options.hint&&(a.signal(this,"startCompletion",this),g.update(!0))}});var n=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},o=window.cancelAnimationFrame||clearTimeout;b.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&a.signal(this.data,"close"),this.widget&&this.widget.close(),a.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(b,c){var d=b.list[c];d.hint?d.hint(this.cm,b,d):this.cm.replaceRange(e(d),d.from||b.from,d.to||b.to,"complete"),a.signal(b,"pick",d),this.close()},cursorActivity:function(){this.debounce&&(o(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch<this.startPos.ch||this.cm.somethingSelected()||a.ch&&this.options.closeCharacters.test(b.charAt(a.ch-1)))this.close();else{var c=this;this.debounce=n(function(){c.update()}),this.widget&&this.widget.disable()}},update:function(a){if(null!=this.tick){var b=this,c=++this.tick;j(this.options.hint,this.cm,this.options,function(d){b.tick==c&&b.finishUpdate(d,a)})}},finishUpdate:function(b,d){this.data&&a.signal(this.data,"update");var e=this.widget&&this.widget.picked||d&&this.options.completeSingle;this.widget&&this.widget.close(),b&&this.data&&c(this.data,b)||(this.data=b,b&&b.list.length&&(e&&1==b.list.length?this.pick(b,0):(this.widget=new h(this,b),a.signal(b,"shown"))))}},h.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus)),a.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(b,c){if(b>=this.data.list.length?b=c?this.data.list.length-1:0:b<0&&(b=c?0:this.data.list.length-1),this.selectedHint!=b){var d=this.hints.childNodes[this.selectedHint];d.className=d.className.replace(" "+m,""),d=this.hints.childNodes[this.selectedHint=b],d.className+=" "+m,d.offsetTop<this.hints.scrollTop?this.hints.scrollTop=d.offsetTop-3:d.offsetTop+d.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=d.offsetTop+d.offsetHeight-this.hints.clientHeight+3),a.signal(this.data,"select",this.data.list[this.selectedHint],d)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},a.registerHelper("hint","auto",{resolve:k}),a.registerHelper("hint","fromList",function(b,c){var d=b.getCursor(),e=b.getTokenAt(d),f=a.Pos(d.line,e.end);if(e.string&&/\w/.test(e.string[e.string.length-1]))var g=e.string,h=a.Pos(d.line,e.start);else var g="",h=f;for(var i=[],j=0;j<c.words.length;j++){var k=c.words[j];k.slice(0,g.length)==g&&i.push(k)}if(i.length)return{list:i,from:h,to:f}}),a.commands.autocomplete=a.showHint;var p={hint:a.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};a.defineOption("hintOptions",null)})},{"../../lib/codemirror":59}],27:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],d):d(CodeMirror)}(function(a){"use strict";function b(a){return"[object Array]"==Object.prototype.toString.call(a)}function c(b){var c=b.doc.modeOption;return"sql"===c&&(c="text/x-sql"),a.resolveMode(c).keywords}function d(b){var c=b.doc.modeOption;return"sql"===c&&(c="text/x-sql"),a.resolveMode(c).identifierQuote||"`"}function e(a){return"string"==typeof a?a:a.text}function f(a,c){return b(c)&&(c={columns:c}),c.text||(c.text=a),c}function g(a){var c={};if(b(a))for(var d=a.length-1;d>=0;d--){var g=a[d];c[e(g).toUpperCase()]=f(e(g),g)}else if(a)for(var h in a)c[h.toUpperCase()]=f(h,a[h]);return c}function h(a){return q[a.toUpperCase()]}function i(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function j(a,b){var c=a.length,d=e(b).substr(0,c);return a.toUpperCase()===d.toUpperCase()}function k(a,c,d,e){if(b(d))for(var f=0;f<d.length;f++)j(c,d[f])&&a.push(e(d[f]));else for(var g in d)if(d.hasOwnProperty(g)){var h=d[g];h=h&&h!==!0?h.displayText?{text:h.text,displayText:h.displayText}:h.text:g,j(c,h)&&a.push(e(h))}}function l(a){"."==a.charAt(0)&&(a=a.substr(1));for(var b=a.split(t+t),c=0;c<b.length;c++)b[c]=b[c].replace(new RegExp(t,"g"),"");return b.join(t)}function m(a){for(var b=e(a).split("."),c=0;c<b.length;c++)b[c]=t+b[c].replace(new RegExp(t,"g"),t+t)+t;var d=b.join(".");return"string"==typeof a?d:(a=i(a),a.text=d,a)}function n(a,b,c,d){for(var e=!1,f=[],g=b.start,j=!0;j;)j="."==b.string.charAt(0),e=e||b.string.charAt(0)==t,g=b.start,f.unshift(l(b.string)),b=d.getTokenAt(v(a.line,b.start)),"."==b.string&&(j=!0,b=d.getTokenAt(v(a.line,b.start)));var n=f.join(".");k(c,n,q,function(a){return e?m(a):a}),k(c,n,r,function(a){return e?m(a):a}),n=f.pop();var o=f.join("."),s=!1,u=o; if(!h(o)){var w=o;o=p(o,d),o!==w&&(s=!0)}var x=h(o);return x&&x.columns&&(x=x.columns),x&&k(c,n,x,function(a){var b=o;return 1==s&&(b=u),"string"==typeof a?a=b+"."+a:(a=i(a),a.text=b+"."+a.text),e?m(a):a}),g}function o(a,b){for(var c=a.split(/\s+/),d=0;d<c.length;d++)c[d]&&b(c[d].replace(/[,;]/g,""))}function p(a,b){for(var c=b.doc,d=c.getValue(),e=a.toUpperCase(),f="",g="",i=[],j={start:v(0,0),end:v(b.lastLine(),b.getLineHandle(b.lastLine()).length)},k=d.indexOf(u.QUERY_DIV);k!=-1;)i.push(c.posFromIndex(k)),k=d.indexOf(u.QUERY_DIV,k+1);i.unshift(v(0,0)),i.push(v(b.lastLine(),b.getLineHandle(b.lastLine()).text.length));for(var l=null,m=b.getCursor(),n=0;n<i.length;n++){if((null==l||w(m,l)>0)&&w(m,i[n])<=0){j={start:l,end:i[n]};break}l=i[n]}for(var p=c.getRange(j.start,j.end,!1),n=0;n<p.length;n++){var q=p[n];if(o(q,function(a){var b=a.toUpperCase();b===e&&h(f)&&(g=f),b!==u.ALIAS_KEYWORD&&(f=a)}),g)break}return g}var q,r,s,t,u={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},v=a.Pos,w=a.cmpPos;a.registerHelper("hint","sql",function(a,b){q=g(b&&b.tables);var e=b&&b.defaultTable,f=b&&b.disableKeywords;r=e&&h(e),s=c(a),t=d(a),e&&!r&&(r=p(e,a)),r=r||[],r.columns&&(r=r.columns);var i,j,l,m=a.getCursor(),o=[],u=a.getTokenAt(m);return u.end>m.ch&&(u.end=m.ch,u.string=u.string.slice(0,m.ch-u.start)),u.string.match(/^[.`"\w@]\w*$/)?(l=u.string,i=u.start,j=u.end):(i=j=m.ch,l=""),"."==l.charAt(0)||l.charAt(0)==t?i=n(m,u,o,a):(k(o,l,q,function(a){return a}),k(o,l,r,function(a){return a}),f||k(o,l,s,function(a){return a.toUpperCase()})),{list:o,from:v(m.line,i),to:v(m.line,j)}})})},{"../../lib/codemirror":59,"../../mode/sql/sql":74}],28:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,d){var e=d&&d.schemaInfo,f=d&&d.quoteChar||'"';if(e){var g=b.getCursor(),h=b.getTokenAt(g);h.end>g.ch&&(h.end=g.ch,h.string=h.string.slice(0,g.ch-h.start));var i=a.innerMode(b.getMode(),h.state);if("xml"==i.mode.name){var j,k,l=[],m=!1,n=/\btag\b/.test(h.type)&&!/>$/.test(h.string),o=n&&/^\w/.test(h.string);if(o){var p=b.getLine(g.line).slice(Math.max(0,h.start-2),h.start),q=/<\/$/.test(p)?"close":/<$/.test(p)?"open":null;q&&(k=h.start-("close"==q?2:1))}else n&&"<"==h.string?q="open":n&&"</"==h.string&&(q="close");if(!n&&!i.state.tagName||q){o&&(j=h.string),m=q;var r=i.state.context,s=r&&e[r.tagName],t=r?s&&s.children:e["!top"];if(t&&"close"!=q)for(var u=0;u<t.length;++u)j&&0!=t[u].lastIndexOf(j,0)||l.push("<"+t[u]);else if("close"!=q)for(var v in e)!e.hasOwnProperty(v)||"!top"==v||"!attrs"==v||j&&0!=v.lastIndexOf(j,0)||l.push("<"+v);r&&(!j||"close"==q&&0==r.tagName.lastIndexOf(j,0))&&l.push("</"+r.tagName+">")}else{var s=e[i.state.tagName],w=s&&s.attrs,x=e["!attrs"];if(!w&&!x)return;if(w){if(x){var y={};for(var z in x)x.hasOwnProperty(z)&&(y[z]=x[z]);for(var z in w)w.hasOwnProperty(z)&&(y[z]=w[z]);w=y}}else w=x;if("string"==h.type||"="==h.string){var A,p=b.getRange(c(g.line,Math.max(0,g.ch-60)),c(g.line,"string"==h.type?h.start:h.end)),B=p.match(/([^\s\u00a0=<>\"\']+)=$/);if(!B||!w.hasOwnProperty(B[1])||!(A=w[B[1]]))return;if("function"==typeof A&&(A=A.call(this,b)),"string"==h.type){j=h.string;var C=0;/['"]/.test(h.string.charAt(0))&&(f=h.string.charAt(0),j=h.string.slice(1),C++);var D=h.string.length;/['"]/.test(h.string.charAt(D-1))&&(f=h.string.charAt(D-1),j=h.string.substr(C,D-2)),m=!0}for(var u=0;u<A.length;++u)j&&0!=A[u].lastIndexOf(j,0)||l.push(f+A[u]+f)}else{"attribute"==h.type&&(j=h.string,m=!0);for(var E in w)!w.hasOwnProperty(E)||j&&0!=E.lastIndexOf(j,0)||l.push(E)}}return{list:l,from:m?c(g.line,null==k?h.start:k):g,to:m?c(g.line,h.end):g}}}}var c=a.Pos;a.registerHelper("hint","xml",b)})},{"../../lib/codemirror":59}],29:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.registerHelper("lint","css",function(b,c){var d=[];if(!window.CSSLint)return window.console&&window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run."),d;for(var e=CSSLint.verify(b,c),f=e.messages,g=null,h=0;h<f.length;h++){g=f[h];var i=g.line-1,j=g.line-1,k=g.col-1,l=g.col;d.push({from:a.Pos(i,k),to:a.Pos(j,l),message:g.message,severity:g.type})}return d})})},{"../../lib/codemirror":59}],30:[function(a,b,c){(function(d){!function(e){"object"==typeof c&&"object"==typeof b?e(a("../../lib/codemirror"),"undefined"!=typeof window?window.HTMLHint:"undefined"!=typeof d?d.HTMLHint:null):"function"==typeof define&&define.amd?define(["../../lib/codemirror","htmlhint"],e):e(CodeMirror,window.HTMLHint)}(function(a,b){"use strict";var c={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!1,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0};a.registerHelper("lint","html",function(d,e){var f=[];if(b&&!b.verify&&(b=b.HTMLHint),b||(b=window.HTMLHint),!b)return window.console&&window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run."),f;for(var g=b.verify(d,e&&e.rules||c),h=0;h<g.length;h++){var i=g[h],j=i.line-1,k=i.line-1,l=i.col-1,m=i.col;f.push({from:a.Pos(j,l),to:a.Pos(k,m),message:i.message,severity:i.type})}return f})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../lib/codemirror":59}],31:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){if(!window.JSHINT)return window.console&&window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run."),[];JSHINT(a,b,b.globals);var c=JSHINT.data().errors,d=[];return c&&f(c,d),d}function c(a){return d(a,h,"warning",!0),d(a,i,"error"),e(a)?null:a}function d(a,b,c,d){var e,f,g,h,i;e=a.description;for(var j=0;j<b.length;j++)f=b[j],g="string"==typeof f?f:f[0],h="string"==typeof f?null:f[1],i=e.indexOf(g)!==-1,(d||i)&&(a.severity=c),i&&h&&(a.description=h)}function e(a){for(var b=a.description,c=0;c<g.length;c++)if(b.indexOf(g[c])!==-1)return!0;return!1}function f(b,d){for(var e=0;e<b.length;e++){var f=b[e];if(f){var g,h;if(g=[],f.evidence){var i=g[f.line];if(!i){var j=f.evidence;i=[],Array.prototype.forEach.call(j,function(a,b){"\t"===a&&i.push(b+1)}),g[f.line]=i}if(i.length>0){var k=f.character;i.forEach(function(a){k>a&&(k-=1)}),f.character=k}}var l=f.character-1,m=l+1;f.evidence&&(h=f.evidence.substring(l).search(/.\b/),h>-1&&(m+=h)),f.description=f.reason,f.start=f.character,f.end=m,f=c(f),f&&d.push({message:f.description,severity:f.severity,from:a.Pos(f.line-1,l),to:a.Pos(f.line-1,m)})}}}var g=["Dangerous comment"],h=[["Expected '{'","Statement body should be inside '{ }' braces."]],i=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];a.registerHelper("lint","javascript",b)})},{"../../lib/codemirror":59}],32:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.registerHelper("lint","json",function(b){var c=[];if(!window.jsonlint)return window.console&&window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."),c;jsonlint.parseError=function(b,d){var e=d.loc;c.push({from:a.Pos(e.first_line-1,e.first_column),to:a.Pos(e.last_line-1,e.last_column),message:b})};try{jsonlint.parse(b)}catch(d){}return c})})},{"../../lib/codemirror":59}],33:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,c){function d(b){return e.parentNode?(e.style.top=Math.max(0,b.clientY-e.offsetHeight-5)+"px",void(e.style.left=b.clientX+5+"px")):a.off(document,"mousemove",d)}var e=document.createElement("div");return e.className="CodeMirror-lint-tooltip",e.appendChild(c.cloneNode(!0)),document.body.appendChild(e),a.on(document,"mousemove",d),d(b),null!=e.style.opacity&&(e.style.opacity=1),e}function c(a){a.parentNode&&a.parentNode.removeChild(a)}function d(a){a.parentNode&&(null==a.style.opacity&&c(a),a.style.opacity=0,setTimeout(function(){c(a)},600))}function e(c,e,f){function g(){a.off(f,"mouseout",g),h&&(d(h),h=null)}var h=b(c,e),i=setInterval(function(){if(h)for(var a=f;;a=a.parentNode){if(a&&11==a.nodeType&&(a=a.host),a==document.body)return;if(!a){g();break}}if(!h)return clearInterval(i)},400);a.on(f,"mouseout",g)}function f(a,b,c){this.marked=[],this.options=b,this.timeout=null,this.hasGutter=c,this.onMouseOver=function(b){r(a,b)},this.waitingFor=0}function g(a,b){return b instanceof Function?{getAnnotations:b}:(b&&b!==!0||(b={}),b)}function h(a){var b=a.state.lint;b.hasGutter&&a.clearGutter(s);for(var c=0;c<b.marked.length;++c)b.marked[c].clear();b.marked.length=0}function i(b,c,d,f){var g=document.createElement("div"),h=g;return g.className="CodeMirror-lint-marker-"+c,d&&(h=g.appendChild(document.createElement("div")),h.className="CodeMirror-lint-marker-multiple"),0!=f&&a.on(h,"mouseover",function(a){e(a,b,h)}),g}function j(a,b){return"error"==a?a:b}function k(a){for(var b=[],c=0;c<a.length;++c){var d=a[c],e=d.from.line;(b[e]||(b[e]=[])).push(d)}return b}function l(a){var b=a.severity;b||(b="error");var c=document.createElement("div");return c.className="CodeMirror-lint-message-"+b,"undefined"!=typeof a.messageHTML?c.innerHTML=a.messageHTML:c.appendChild(document.createTextNode(a.message)),c}function m(b,c,d){function e(){g=-1,b.off("change",e)}var f=b.state.lint,g=++f.waitingFor;b.on("change",e),c(b.getValue(),function(c,d){b.off("change",e),f.waitingFor==g&&(d&&c instanceof a&&(c=d),o(b,c))},d,b)}function n(b){var c=b.state.lint,d=c.options,e=d.options||d,f=d.getAnnotations||b.getHelper(a.Pos(0,0),"lint");if(f)if(d.async||f.async)m(b,f,e);else{var g=f(b.getValue(),e,b);if(!g)return;g.then?g.then(function(a){o(b,a)}):o(b,g)}}function o(a,b){h(a);for(var c=a.state.lint,d=c.options,e=k(b),f=0;f<e.length;++f){var g=e[f];if(g){for(var m=null,n=c.hasGutter&&document.createDocumentFragment(),o=0;o<g.length;++o){var p=g[o],q=p.severity;q||(q="error"),m=j(m,q),d.formatAnnotation&&(p=d.formatAnnotation(p)),c.hasGutter&&n.appendChild(l(p)),p.to&&c.marked.push(a.markText(p.from,p.to,{className:"CodeMirror-lint-mark-"+q,__annotation:p}))}c.hasGutter&&a.setGutterMarker(f,s,i(n,m,g.length>1,c.options.tooltips))}}d.onUpdateLinting&&d.onUpdateLinting(b,e,a)}function p(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){n(a)},b.options.delay||500))}function q(a,b){for(var c=b.target||b.srcElement,d=document.createDocumentFragment(),f=0;f<a.length;f++){var g=a[f];d.appendChild(l(g))}e(b,d,c)}function r(a,b){var c=b.target||b.srcElement;if(/\bCodeMirror-lint-mark-/.test(c.className)){for(var d=c.getBoundingClientRect(),e=(d.left+d.right)/2,f=(d.top+d.bottom)/2,g=a.findMarksAt(a.coordsChar({left:e,top:f},"client")),h=[],i=0;i<g.length;++i){var j=g[i].__annotation;j&&h.push(j)}h.length&&q(h,b)}}var s="CodeMirror-lint-markers";a.defineOption("lint",!1,function(b,c,d){if(d&&d!=a.Init&&(h(b),b.state.lint.options.lintOnChange!==!1&&b.off("change",p),a.off(b.getWrapperElement(),"mouseover",b.state.lint.onMouseOver),clearTimeout(b.state.lint.timeout),delete b.state.lint),c){for(var e=b.getOption("gutters"),i=!1,j=0;j<e.length;++j)e[j]==s&&(i=!0);var k=b.state.lint=new f(b,g(b,c),i);k.options.lintOnChange!==!1&&b.on("change",p),0!=k.options.tooltips&&"gutter"!=k.options.tooltips&&a.on(b.getWrapperElement(),"mouseover",k.onMouseOver),n(b)}}),a.defineExtension("performLint",function(){this.state.lint&&n(this)})})},{"../../lib/codemirror":59}],34:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","diff_match_patch"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){this.mv=a,this.type=b,this.classes="left"==b?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function c(b){b.diffOutOfDate&&(b.diff=z(b.orig.getValue(),b.edit.getValue(),b.mv.options.ignoreWhitespace),b.chunks=A(b.diff),b.diffOutOfDate=!1,a.signal(b.edit,"updateDiff",b.diff))}function d(b){function d(a){W=!0,p=!1,"full"==a&&(b.svg&&J(b.svg),b.copyButtons&&J(b.copyButtons),j(b.edit,m.marked,b.classes),j(b.orig,o.marked,b.classes),m.from=m.to=o.from=o.to=0),c(b),b.showDifferences&&(k(b.edit,b.diff,m,DIFF_INSERT,b.classes),k(b.orig,b.diff,o,DIFF_DELETE,b.classes)),"align"==b.mv.options.connect&&s(b),n(b),null!=b.needsScrollSync&&f(b,b.needsScrollSync),W=!1}function e(a){W||(b.dealigned=!0,g(a))}function g(a){W||p||(clearTimeout(l),a===!0&&(p=!0),l=setTimeout(d,a===!0?20:250))}function h(a,c){b.diffOutOfDate||(b.diffOutOfDate=!0,m.from=m.to=o.from=o.to=0),e(c.text.length-1!=c.to.line-c.from.line)}function i(){b.diffOutOfDate=!0,b.dealigned=!0,d("full")}var l,m={from:0,to:0,marked:[]},o={from:0,to:0,marked:[]},p=!1;return b.edit.on("change",h),b.orig.on("change",h),b.edit.on("swapDoc",i),b.orig.on("swapDoc",i),"align"==b.mv.options.connect&&(a.on(b.edit.state.trackAlignable,"realign",e),a.on(b.orig.state.trackAlignable,"realign",e)),b.edit.on("viewportChange",function(){g(!1)}),b.orig.on("viewportChange",function(){g(!1)}),d(),d}function e(a,b){a.edit.on("scroll",function(){f(a,!0)&&n(a)}),a.orig.on("scroll",function(){f(a,!1)&&n(a),b&&f(b,!0)&&n(b)})}function f(a,b){if(a.diffOutOfDate)return a.lockScroll&&null==a.needsScrollSync&&(a.needsScrollSync=b),!1;if(a.needsScrollSync=null,!a.lockScroll)return!0;var c,d,e=+new Date;if(b?(c=a.edit,d=a.orig):(c=a.orig,d=a.edit),c.state.scrollSetBy==a&&(c.state.scrollSetAt||0)+250>e)return!1;var f=c.getScrollInfo();if("align"==a.mv.options.connect)q=f.top;else{var h,i,j=.5*f.clientHeight,k=f.top+j,l=c.lineAtHeight(k,"local"),m=D(a.chunks,l,b),n=g(c,b?m.edit:m.orig),o=g(d,b?m.orig:m.edit),p=(k-n.top)/(n.bot-n.top),q=o.top-j+p*(o.bot-o.top);if(q>f.top&&(i=f.top/j)<1)q=q*i+f.top*(1-i);else if((h=f.height-f.clientHeight-f.top)<j){var r=d.getScrollInfo(),s=r.height-r.clientHeight-q;s>h&&(i=h/j)<1&&(q=q*i+(r.height-r.clientHeight-h)*(1-i))}}return d.scrollTo(f.left,q),d.state.scrollSetAt=e,d.state.scrollSetBy=a,!0}function g(a,b){var c=b.after;return null==c&&(c=a.lastLine()+1),{top:a.heightAtLine(b.before||0,"local"),bot:a.heightAtLine(c,"local")}}function h(a,b,c){a.lockScroll=b,b&&0!=c&&f(a,DIFF_INSERT)&&n(a),a.lockButton.innerHTML=b?"\u21db\u21da":"\u21db \u21da"}function i(a,b,c){for(var d=c.classLocation,e=0;e<d.length;e++)a.removeLineClass(b,d[e],c.chunk),a.removeLineClass(b,d[e],c.start),a.removeLineClass(b,d[e],c.end)}function j(b,c,d){for(var e=0;e<c.length;++e){var f=c[e];f instanceof a.TextMarker?f.clear():f.parent&&i(b,f,d)}c.length=0}function k(a,b,c,d,e){var f=a.getViewport();a.operation(function(){c.from==c.to||f.from-c.to>20||c.from-f.to>20?(j(a,c.marked,e),m(a,b,d,c.marked,f.from,f.to,e),c.from=f.from,c.to=f.to):(f.from<c.from&&(m(a,b,d,c.marked,f.from,c.from,e),c.from=f.from),f.to>c.to&&(m(a,b,d,c.marked,c.to,f.to,e),c.to=f.to))})}function l(a,b,c,d,e,f){for(var g=c.classLocation,h=a.getLineHandle(b),i=0;i<g.length;i++)d&&a.addLineClass(h,g[i],c.chunk),e&&a.addLineClass(h,g[i],c.start),f&&a.addLineClass(h,g[i],c.end);return h}function m(a,b,c,d,e,f,g){function h(b,c){for(var h=Math.max(e,b),i=Math.min(f,c),j=h;j<i;++j)d.push(l(a,j,g,!0,j==b,j==c-1));b==c&&h==c&&i==c&&(h?d.push(l(a,h-1,g,!1,!1,!0)):d.push(l(a,h,g,!1,!0,!1)))}for(var i=U(0,0),j=U(e,0),k=a.clipPos(U(f-1)),m=c==DIFF_DELETE?g.del:g.insert,n=0,o=!1,p=0;p<b.length;++p){var q=b[p],r=q[0],s=q[1];if(r==DIFF_EQUAL){var t=i.line+(C(b,p)?0:1);M(i,s);var u=i.line+(B(b,p)?1:0);u>t&&(o&&(h(n,t),o=!1),n=u)}else if(o=!0,r==c){var v=M(i,s,!0),w=P(j,i),x=O(k,v);Q(w,x)||d.push(a.markText(w,x,{className:m})),i=v}}o&&h(n,i.line+1)}function n(a){if(a.showDifferences){if(a.svg){J(a.svg);var b=a.gap.offsetWidth;K(a.svg,"width",b,"height",a.gap.offsetHeight)}a.copyButtons&&J(a.copyButtons);for(var c=a.edit.getViewport(),d=a.orig.getViewport(),e=a.mv.wrap.getBoundingClientRect().top,f=e-a.edit.getScrollerElement().getBoundingClientRect().top+a.edit.getScrollInfo().top,g=e-a.orig.getScrollerElement().getBoundingClientRect().top+a.orig.getScrollInfo().top,h=0;h<a.chunks.length;h++){var i=a.chunks[h];i.editFrom<=c.to&&i.editTo>=c.from&&i.origFrom<=d.to&&i.origTo>=d.from&&v(a,i,g,f,b)}}}function o(a,b){for(var c=0,d=0,e=0;e<b.length;e++){var f=b[e];if(f.editTo>a&&f.editFrom<=a)return null;if(f.editFrom>a)break;c=f.editTo,d=f.origTo}return d+(a-c)}function p(a,b,c){for(var d=a.state.trackAlignable,e=a.firstLine(),f=0,g=[],h=0;;h++){for(var i=b[h],j=i?c?i.origFrom:i.editFrom:1e9;f<d.alignable.length;f+=2){var k=d.alignable[f]+1;if(!(k<=e)){if(!(k<=j))break;g.push(k)}}if(!i)break;g.push(e=c?i.origTo:i.editTo)}return g}function q(a,b,c,d){var e=0,f=0,g=0,h=0;a:for(;;e++){var i=a[e],j=b[f];if(!i&&null==j)break;for(var k=i?i[0]:1e9,l=null==j?1e9:j;g<c.length;){var m=c[g];if(m.origFrom<=l&&m.origTo>l){f++,e--;continue a}if(m.editTo>k){if(m.editFrom<=k)continue a;break}h+=m.origTo-m.origFrom-(m.editTo-m.editFrom),g++}if(k==l-h)i[d]=l,f++;else if(k<l-h)i[d]=k+h;else{var n=[l-h,null,null];n[d]=l,a.splice(e,0,n),f++}}}function r(a,b){var c=p(a.edit,a.chunks,!1),d=[];if(b)for(var e=0,f=0;e<b.chunks.length;e++){for(var g=b.chunks[e].editTo;f<c.length&&c[f]<g;)f++;f!=c.length&&c[f]==g||c.splice(f++,0,g)}for(var e=0;e<c.length;e++)d.push([c[e],null,null]);return q(d,p(a.orig,a.chunks,!0),a.chunks,1),b&&q(d,p(b.orig,b.chunks,!0),b.chunks,2),d}function s(a,b){if(a.dealigned||b){if(!a.orig.curOp)return a.orig.operation(function(){s(a,b)});a.dealigned=!1;var d=a.mv.left==a?a.mv.right:a.mv.left;d&&(c(d),d.dealigned=!1);for(var e=r(a,d),f=a.mv.aligners,g=0;g<f.length;g++)f[g].clear();f.length=0;var h=[a.edit,a.orig],i=[];d&&h.push(d.orig);for(var g=0;g<h.length;g++)i.push(h[g].getScrollInfo().top);for(var j=0;j<e.length;j++)t(h,e[j],f);for(var g=0;g<h.length;g++)h[g].scrollTo(null,i[g])}}function t(a,b,c){for(var d=0,e=[],f=0;f<a.length;f++)if(null!=b[f]){var g=a[f].heightAtLine(b[f],"local");e[f]=g,d=Math.max(d,g)}for(var f=0;f<a.length;f++)if(null!=b[f]){var h=d-e[f];h>1&&c.push(u(a[f],b[f],h))}}function u(a,b,c){var d=!0;b>a.lastLine()&&(b--,d=!1);var e=document.createElement("div");return e.className="CodeMirror-merge-spacer",e.style.height=c+"px",e.style.minWidth="1px",a.addLineWidget(b,e,{height:c,above:d,mergeSpacer:!0,handleMouseEvents:!0})}function v(a,b,c,d,e){var f="left"==a.type,g=a.orig.heightAtLine(b.origFrom,"local",!0)-c;if(a.svg){var h=g,i=a.edit.heightAtLine(b.editFrom,"local",!0)-d;if(f){var j=h;h=i,i=j}var k=a.orig.heightAtLine(b.origTo,"local",!0)-c,l=a.edit.heightAtLine(b.editTo,"local",!0)-d;if(f){var j=k;k=l,l=j}var m=" C "+e/2+" "+i+" "+e/2+" "+h+" "+(e+2)+" "+h,n=" C "+e/2+" "+k+" "+e/2+" "+l+" -1 "+l;K(a.svg.appendChild(document.createElementNS(V,"path")),"d","M -1 "+i+m+" L "+(e+2)+" "+k+n+" z","class",a.classes.connect)}if(a.copyButtons){var o=a.copyButtons.appendChild(I("div","left"==a.type?"\u21dd":"\u21dc","CodeMirror-merge-copy")),p=a.mv.options.allowEditingOriginals;if(o.title=p?"Push to left":"Revert chunk",o.chunk=b,o.style.top=(b.origTo>b.origFrom?g:a.edit.heightAtLine(b.editFrom,"local")-d)+"px",p){var q=a.edit.heightAtLine(b.editFrom,"local")-d,r=a.copyButtons.appendChild(I("div","right"==a.type?"\u21dd":"\u21dc","CodeMirror-merge-copy-reverse"));r.title="Push to right",r.chunk={editFrom:b.origFrom,editTo:b.origTo,origFrom:b.editFrom,origTo:b.editTo},r.style.top=q+"px","right"==a.type?r.style.left="2px":r.style.right="2px"}}}function w(a,b,c,d){if(!a.diffOutOfDate){var e=d.origTo>c.lastLine()?U(d.origFrom-1):U(d.origFrom,0),f=U(d.origTo,0),g=d.editTo>b.lastLine()?U(d.editFrom-1):U(d.editFrom,0),h=U(d.editTo,0),i=a.mv.options.revertChunk;i?i(a.mv,c,e,f,b,g,h):b.replaceRange(c.getRange(e,f),g,h)}}function x(b){var c=b.lockButton=I("div",null,"CodeMirror-merge-scrolllock");c.title="Toggle locked scrolling";var d=I("div",[c],"CodeMirror-merge-scrolllock-wrap");a.on(c,"click",function(){h(b,!b.lockScroll)});var e=[d];if(b.mv.options.revertButtons!==!1&&(b.copyButtons=I("div",null,"CodeMirror-merge-copybuttons-"+b.type),a.on(b.copyButtons,"click",function(a){var c=a.target||a.srcElement;if(c.chunk)return"CodeMirror-merge-copy-reverse"==c.className?void w(b,b.orig,b.edit,c.chunk):void w(b,b.edit,b.orig,c.chunk)}),e.unshift(b.copyButtons)),"align"!=b.mv.options.connect){var f=document.createElementNS&&document.createElementNS(V,"svg");f&&!f.createSVGRect&&(f=null),b.svg=f,f&&e.push(f)}return b.gap=I("div",e,"CodeMirror-merge-gap")}function y(a){return"string"==typeof a?a:a.getValue()}function z(a,b,c){Y||(Y=new diff_match_patch);for(var d=Y.diff_main(a,b),e=0;e<d.length;++e){var f=d[e];(c?/[^ \t]/.test(f[1]):f[1])?e&&d[e-1][0]==f[0]&&(d.splice(e--,1),d[e][1]+=f[1]):d.splice(e--,1)}return d}function A(a){for(var b=[],c=0,d=0,e=U(0,0),f=U(0,0),g=0;g<a.length;++g){var h=a[g],i=h[0];if(i==DIFF_EQUAL){var j=!C(a,g)||e.line<c||f.line<d?1:0,k=e.line+j,l=f.line+j;M(e,h[1],null,f);var m=B(a,g)?1:0,n=e.line+m,o=f.line+m;n>k&&(g&&b.push({origFrom:d,origTo:l,editFrom:c,editTo:k}),c=n,d=o)}else M(i==DIFF_INSERT?e:f,h[1])}return(c<=e.line||d<=f.line)&&b.push({origFrom:d,origTo:f.line+1,editFrom:c,editTo:e.line+1}),b}function B(a,b){if(b==a.length-1)return!0;var c=a[b+1][1];return!(1==c.length&&b<a.length-2||10!=c.charCodeAt(0))&&(b==a.length-2||(c=a[b+2][1],(c.length>1||b==a.length-3)&&10==c.charCodeAt(0)))}function C(a,b){if(0==b)return!0;var c=a[b-1][1];return 10==c.charCodeAt(c.length-1)&&(1==b||(c=a[b-2][1],10==c.charCodeAt(c.length-1)))}function D(a,b,c){for(var d,e,f,g,h=0;h<a.length;h++){var i=a[h],j=c?i.editFrom:i.origFrom,k=c?i.editTo:i.origTo;null==e&&(j>b?(e=i.editFrom,g=i.origFrom):k>b&&(e=i.editTo,g=i.origTo)),k<=b?(d=i.editTo,f=i.origTo):j<=b&&(d=i.editFrom,f=i.origFrom)}return{edit:{before:d,after:e},orig:{before:f,after:g}}}function E(b,c,d){function e(){g.clear(),b.removeLineClass(c,"wrap","CodeMirror-merge-collapsed-line")}b.addLineClass(c,"wrap","CodeMirror-merge-collapsed-line");var f=document.createElement("span");f.className="CodeMirror-merge-collapsed-widget",f.title="Identical text collapsed. Click to expand.";var g=b.markText(U(c,0),U(d-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:f,clearOnEnter:!0});return a.on(f,"click",e),{mark:g,clear:e}}function F(a,b){function c(){for(var a=0;a<d.length;a++)d[a].clear()}for(var d=[],e=0;e<b.length;e++){var f=b[e],g=E(f.cm,f.line,f.line+a);d.push(g),g.mark.on("clear",c)}return d[0].mark}function G(a,b,c,d){for(var e=0;e<a.chunks.length;e++)for(var f=a.chunks[e],g=f.editFrom-b;g<f.editTo+b;g++){var h=g+c;h>=0&&h<d.length&&(d[h]=!1)}}function H(a,b){"number"!=typeof b&&(b=2);for(var c=[],d=a.editor(),e=d.firstLine(),f=e,g=d.lastLine();f<=g;f++)c.push(!0);a.left&&G(a.left,b,e,c),a.right&&G(a.right,b,e,c);for(var h=0;h<c.length;h++)if(c[h]){for(var i=h+e,j=1;h<c.length-1&&c[h+1];h++,j++);if(j>b){var k=[{line:i,cm:d}];a.left&&k.push({line:o(i,a.left.chunks),cm:a.left.orig}),a.right&&k.push({line:o(i,a.right.chunks),cm:a.right.orig});var l=F(j,k);a.options.onCollapse&&a.options.onCollapse(a,i,j,l)}}}function I(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function J(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild)}function K(a){for(var b=1;b<arguments.length;b+=2)a.setAttribute(arguments[b],arguments[b+1])}function L(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function M(a,b,c,d){for(var e=c?U(a.line,a.ch):a,f=0;;){var g=b.indexOf("\n",f);if(g==-1)break;++e.line,d&&++d.line,f=g+1}return e.ch=(f?0:e.ch)+(b.length-f),d&&(d.ch=(f?0:d.ch)+(b.length-f)),e}function N(a){this.cm=a,this.alignable=[],this.height=a.doc.height;var b=this;a.on("markerAdded",function(a,c){if(c.collapsed){var d=c.find(1);null!=d&&b.set(d.line,_)}}),a.on("markerCleared",function(a,c,d,e){null!=e&&c.collapsed&&b.check(e,_,b.hasMarker)}),a.on("markerChanged",this.signal.bind(this)),a.on("lineWidgetAdded",function(a,c,d){c.mergeSpacer||(c.above?b.set(d-1,$):b.set(d,Z))}),a.on("lineWidgetCleared",function(a,c,d){c.mergeSpacer||(c.above?b.check(d-1,$,b.hasWidgetBelow):b.check(d,Z,b.hasWidget))}),a.on("lineWidgetChanged",this.signal.bind(this)),a.on("change",function(a,c){var d=c.from.line,e=c.to.line-c.from.line,f=c.text.length-1,g=d+f;(e||f)&&b.map(d,e,f),b.check(g,_,b.hasMarker),(e||f)&&b.check(c.from.line,_,b.hasMarker)}),a.on("viewportChange",function(){b.cm.doc.height!=b.height&&b.signal()})}function O(a,b){return(a.line-b.line||a.ch-b.ch)<0?a:b}function P(a,b){return(a.line-b.line||a.ch-b.ch)>0?a:b}function Q(a,b){return a.line==b.line&&a.ch==b.ch}function R(a,b,c){for(var d=a.length-1;d>=0;d--){var e=a[d],f=(c?e.origTo:e.editTo)-1;if(f<b)return f}}function S(a,b,c){for(var d=0;d<a.length;d++){var e=a[d],f=c?e.origFrom:e.editFrom;if(f>b)return f}}function T(b,d){var e=null,f=b.state.diffViews,g=b.getCursor().line;if(f)for(var h=0;h<f.length;h++){var i=f[h],j=b==i.orig;c(i);var k=d<0?R(i.chunks,g,j):S(i.chunks,g,j);null==k||null!=e&&!(d<0?k>e:k<e)||(e=k)}return null==e?a.Pass:void b.setCursor(e,0)}var U=a.Pos,V="http://www.w3.org/2000/svg";b.prototype={constructor:b,init:function(b,c,d){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=a(b,L({value:c,readOnly:!this.mv.options.allowEditingOriginals},L(d))),"align"==this.mv.options.connect&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new N(this.edit)),this.orig.state.trackAlignable=new N(this.orig)),this.orig.state.diffViews=[this];var e=d.chunkClassLocation||"background";"[object Array]"!=Object.prototype.toString.call(e)&&(e=[e]),this.classes.classLocation=e,this.diff=z(y(c),y(d.value),this.mv.options.ignoreWhitespace),this.chunks=A(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=d.showDifferences!==!1},registerEvents:function(a){this.forceUpdate=d(this),h(this,!0,!1),e(this,a)},setShowDifferences:function(a){a=a!==!1,a!=this.showDifferences&&(this.showDifferences=a,this.forceUpdate("full"))}};var W=!1,X=a.MergeView=function(c,d){if(!(this instanceof X))return new X(c,d);this.options=d;var e=d.origLeft,f=null==d.origRight?d.orig:d.origRight,g=null!=e,h=null!=f,i=1+(g?1:0)+(h?1:0),j=[],k=this.left=null,l=this.right=null,m=this;if(g){k=this.left=new b(this,"left");var o=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");j.push(o),j.push(x(k))}var p=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(j.push(p),h){l=this.right=new b(this,"right"),j.push(x(l));var q=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");j.push(q)}(h?q:p).className+=" CodeMirror-merge-pane-rightmost",j.push(I("div",null,null,"height: 0; clear: both;"));var r=this.wrap=c.appendChild(I("div",j,"CodeMirror-merge CodeMirror-merge-"+i+"pane"));this.edit=a(p,L(d)),k&&k.init(o,e,d),l&&l.init(q,f,d),d.collapseIdentical&&this.editor().operation(function(){H(m,d.collapseIdentical)}),"align"==d.connect&&(this.aligners=[],s(this.left||this.right,!0)),k&&k.registerEvents(l),l&&l.registerEvents(k);var t=function(){k&&n(k),l&&n(l)};a.on(window,"resize",t);var u=setInterval(function(){for(var b=r.parentNode;b&&b!=document.body;b=b.parentNode);b||(clearInterval(u),a.off(window,"resize",t))},5e3)};X.prototype={constructor:X,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(a){this.right&&this.right.setShowDifferences(a),this.left&&this.left.setShowDifferences(a)},rightChunks:function(){if(this.right)return c(this.right),this.right.chunks},leftChunks:function(){if(this.left)return c(this.left),this.left.chunks}};var Y,Z=1,$=2,_=4;N.prototype={signal:function(){a.signal(this,"realign"),this.height=this.cm.doc.height},set:function(a,b){for(var c=-1;c<this.alignable.length;c+=2){var d=this.alignable[c]-a;if(0==d){if((this.alignable[c+1]&b)==b)return;return this.alignable[c+1]|=b,void this.signal()}if(d>0)break}this.signal(),this.alignable.splice(c,0,a,b)},find:function(a){for(var b=0;b<this.alignable.length;b+=2)if(this.alignable[b]==a)return b;return-1},check:function(a,b,c){var d=this.find(a);if(d!=-1&&this.alignable[d+1]&b&&!c.call(this,a)){this.signal();var e=this.alignable[d+1]&~b;e?this.alignable[d+1]=e:this.alignable.splice(d,2)}},hasMarker:function(a){var b=this.cm.getLineHandle(a);if(b.markedSpans)for(var c=0;c<b.markedSpans.length;c++)if(b.markedSpans[c].mark.collapsed&&null!=b.markedSpans[c].to)return!0;return!1},hasWidget:function(a){var b=this.cm.getLineHandle(a);if(b.widgets)for(var c=0;c<b.widgets.length;c++)if(!b.widgets[c].above&&!b.widgets[c].mergeSpacer)return!0;return!1},hasWidgetBelow:function(a){if(a==this.cm.lastLine())return!1;var b=this.cm.getLineHandle(a+1);if(b.widgets)for(var c=0;c<b.widgets.length;c++)if(b.widgets[c].above&&!b.widgets[c].mergeSpacer)return!0;return!1},map:function(a,b,c){for(var d=c-b,e=a+b,f=-1,g=-1,h=0;h<this.alignable.length;h+=2){var i=this.alignable[h];i==a&&this.alignable[h+1]&$&&(f=h),i==e&&this.alignable[h+1]&$&&(g=h),i<=a||(i<e?this.alignable.splice(h--,2):this.alignable[h]+=d)}if(f>-1){var j=this.alignable[f+1];j==$?this.alignable.splice(f,2):this.alignable[f+1]=j&~$}g>-1&&c&&this.set(a+c,$)}},a.commands.goNextDiff=function(a){return T(a,1)},a.commands.goPrevDiff=function(a){return T(a,-1)}})},{"../../lib/codemirror":59}],35:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],function(a){d(a,"amd")}):d(CodeMirror,"plain")}(function(b,c){function d(a,b){var c=b;return function(){0==--c&&a()}}function e(a,c){var e=b.modes[a].dependencies;if(!e)return c();for(var f=[],g=0;g<e.length;++g)b.modes.hasOwnProperty(e[g])||f.push(e[g]);if(!f.length)return c();for(var h=d(c,f.length),g=0;g<f.length;++g)b.requireMode(f[g],h)}b.modeURL||(b.modeURL="../mode/%N/%N.js");var f={};b.requireMode=function(d,g){if("string"!=typeof d&&(d=d.name),b.modes.hasOwnProperty(d))return e(d,g);if(f.hasOwnProperty(d))return f[d].push(g);var h=b.modeURL.replace(/%N/g,d);if("plain"==c){var i=document.createElement("script");i.src=h;var j=document.getElementsByTagName("script")[0],k=f[d]=[g];b.on(i,"load",function(){e(d,function(){for(var a=0;a<k.length;++a)k[a]()})}),j.parentNode.insertBefore(i,j)}else"cjs"==c?(a(h),g()):"amd"==c&&requirejs([h],g)},b.autoLoadMode=function(a,c){b.modes.hasOwnProperty(c)||b.requireMode(c,function(){a.setOption("mode",a.getOption("mode"))})}})},{"../../lib/codemirror":59}],36:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.multiplexingMode=function(b){ function c(a,b,c,d){if("string"==typeof b){var e=a.indexOf(b,c);return d&&e>-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}var d=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(f.innerActive){var g=f.innerActive,h=e.string;if(!g.close&&e.sol())return f.innerActive=f.inner=null,this.token(e,f);var i=g.close?c(h,g.close,e.pos,g.parseDelimiters):-1;if(i==e.pos&&!g.parseDelimiters)return e.match(g.close),f.innerActive=f.inner=null,g.delimStyle&&g.delimStyle+" "+g.delimStyle+"-close";i>-1&&(e.string=h.slice(0,i));var j=g.mode.token(e,f.inner);return i>-1&&(e.string=h),i==e.pos&&g.parseDelimiters&&(f.innerActive=f.inner=null),g.innerStyle&&(j=j?j+" "+g.innerStyle:g.innerStyle),j}for(var k=1/0,h=e.string,l=0;l<d.length;++l){var m=d[l],i=c(h,m.open,e.pos);if(i==e.pos)return m.parseDelimiters||e.match(m.open),f.innerActive=m,f.inner=a.startState(m.mode,b.indent?b.indent(f.outer,""):0),m.delimStyle&&m.delimStyle+" "+m.delimStyle+"-open";i!=-1&&i<k&&(k=i)}k!=1/0&&(e.string=h.slice(0,k));var n=b.token(e,f.outer);return k!=1/0&&(e.string=h),n},indent:function(c,d){var e=c.innerActive?c.innerActive.mode:b;return e.indent?e.indent(c.innerActive?c.inner:c.outer,d):a.Pass},blankLine:function(c){var e=c.innerActive?c.innerActive.mode:b;if(e.blankLine&&e.blankLine(c.innerActive?c.inner:c.outer),c.innerActive)"\n"===c.innerActive.close&&(c.innerActive=c.inner=null);else for(var f=0;f<d.length;++f){var g=d[f];"\n"===g.open&&(c.innerActive=g,c.inner=a.startState(g.mode,e.indent?e.indent(c.outer,""):0))}},electricChars:b.electricChars,innerMode:function(a){return a.inner?{state:a.inner,mode:a.innerActive.mode}:{state:a.outer,mode:b}}}}})},{"../../lib/codemirror":59}],37:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.overlayMode=function(b,c,d){return{startState:function(){return{base:a.startState(b),overlay:a.startState(c),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(d){return{base:a.copyState(b,d.base),overlay:a.copyState(c,d.overlay),basePos:d.basePos,baseCur:null,overlayPos:d.overlayPos,overlayCur:null}},token:function(a,e){return(a!=e.streamSeen||Math.min(e.basePos,e.overlayPos)<a.start)&&(e.streamSeen=a,e.basePos=e.overlayPos=a.start),a.start==e.basePos&&(e.baseCur=b.token(a,e.base),e.basePos=a.pos),a.start==e.overlayPos&&(a.pos=a.start,e.overlayCur=c.token(a,e.overlay),e.overlayPos=a.pos),a.pos=Math.min(e.basePos,e.overlayPos),null==e.overlayCur?e.baseCur:null!=e.baseCur&&e.overlay.combineTokens||d&&null==e.overlay.combineTokens?e.baseCur+" "+e.overlayCur:e.overlayCur},indent:b.indent&&function(a,c){return b.indent(a.base,c)},electricChars:b.electricChars,innerMode:function(a){return{state:a.base,mode:b}},blankLine:function(a){var e,f;return b.blankLine&&(e=b.blankLine(a.base)),c.blankLine&&(f=c.blankLine(a.overlay)),null==f?e:d&&null!=e?e+" "+f:f}}}})},{"../../lib/codemirror":59}],38:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){if(!a.hasOwnProperty(b))throw new Error("Undefined state "+b+" in simple mode")}function c(a,b){if(!a)return/(?:)/;var c="";return a instanceof RegExp?(a.ignoreCase&&(c="i"),a=a.source):a=String(a),new RegExp((b===!1?"":"^")+"(?:"+a+")",c)}function d(a){if(!a)return null;if(a.apply)return a;if("string"==typeof a)return a.replace(/\./g," ");for(var b=[],c=0;c<a.length;c++)b.push(a[c]&&a[c].replace(/\./g," "));return b}function e(a,e){(a.next||a.push)&&b(e,a.next||a.push),this.regex=c(a.regex),this.token=d(a.token),this.data=a}function f(a,b){return function(c,d){if(d.pending){var e=d.pending.shift();return 0==d.pending.length&&(d.pending=null),c.pos+=e.text.length,e.token}if(d.local){if(d.local.end&&c.match(d.local.end)){var f=d.local.endToken||null;return d.local=d.localState=null,f}var g,f=d.local.mode.token(c,d.localState);return d.local.endScan&&(g=d.local.endScan.exec(c.current()))&&(c.pos=c.start+g.index),f}for(var i=a[d.state],j=0;j<i.length;j++){var k=i[j],l=(!k.data.sol||c.sol())&&c.match(k.regex);if(l){k.data.next?d.state=k.data.next:k.data.push?((d.stack||(d.stack=[])).push(d.state),d.state=k.data.push):k.data.pop&&d.stack&&d.stack.length&&(d.state=d.stack.pop()),k.data.mode&&h(b,d,k.data.mode,k.token),k.data.indent&&d.indent.push(c.indentation()+b.indentUnit),k.data.dedent&&d.indent.pop();var m=k.token;if(m&&m.apply&&(m=m(l)),l.length>2){d.pending=[];for(var n=2;n<l.length;n++)l[n]&&d.pending.push({text:l[n],token:k.token[n-1]});return c.backUp(l[0].length-(l[1]?l[1].length:0)),m[0]}return m&&m.join?m[0]:m}}return c.next(),null}}function g(a,b){if(a===b)return!0;if(!a||"object"!=typeof a||!b||"object"!=typeof b)return!1;var c=0;for(var d in a)if(a.hasOwnProperty(d)){if(!b.hasOwnProperty(d)||!g(a[d],b[d]))return!1;c++}for(var d in b)b.hasOwnProperty(d)&&c--;return 0==c}function h(b,d,e,f){var h;if(e.persistent)for(var i=d.persistentStates;i&&!h;i=i.next)(e.spec?g(e.spec,i.spec):e.mode==i.mode)&&(h=i);var j=h?h.mode:e.mode||a.getMode(b,e.spec),k=h?h.state:a.startState(j);e.persistent&&!h&&(d.persistentStates={mode:j,spec:e.spec,state:k,next:d.persistentStates}),d.localState=k,d.local={mode:j,end:e.end&&c(e.end),endScan:e.end&&e.forceEnd!==!1&&c(e.end,!1),endToken:f&&f.join?f[f.length-1]:f}}function i(a,b){for(var c=0;c<b.length;c++)if(b[c]===a)return!0}function j(b,c){return function(d,e,f){if(d.local&&d.local.mode.indent)return d.local.mode.indent(d.localState,e,f);if(null==d.indent||d.local||c.dontIndentStates&&i(d.state,c.dontIndentStates)>-1)return a.Pass;var g=d.indent.length-1,h=b[d.state];a:for(;;){for(var j=0;j<h.length;j++){var k=h[j];if(k.data.dedent&&k.data.dedentIfLineStart!==!1){var l=k.regex.exec(e);if(l&&l[0]){g--,(k.next||k.push)&&(h=b[k.next||k.push]),e=e.slice(l[0].length);continue a}}}break}return g<0?0:d.indent[g]}}a.defineSimpleMode=function(b,c){a.defineMode(b,function(b){return a.simpleMode(b,c)})},a.simpleMode=function(c,d){b(d,"start");var g={},h=d.meta||{},i=!1;for(var k in d)if(k!=h&&d.hasOwnProperty(k))for(var l=g[k]=[],m=d[k],n=0;n<m.length;n++){var o=m[n];l.push(new e(o,d)),(o.indent||o.dedent)&&(i=!0)}var p={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:i?[]:null}},copyState:function(b){var c={state:b.state,pending:b.pending,local:b.local,localState:null,indent:b.indent&&b.indent.slice(0)};b.localState&&(c.localState=a.copyState(b.local.mode,b.localState)),b.stack&&(c.stack=b.stack.slice(0));for(var d=b.persistentStates;d;d=d.next)c.persistentStates={mode:d.mode,spec:d.spec,state:d.state==b.localState?c.localState:a.copyState(d.mode,d.state),next:c.persistentStates};return c},token:f(g,c),innerMode:function(a){return a.local&&{mode:a.local.mode,state:a.localState}},indent:j(g,h)};if(h)for(var q in h)h.hasOwnProperty(q)&&(p[q]=h[q]);return p}})},{"../../lib/codemirror":59}],39:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./runmode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./runmode"],d):d(CodeMirror)}(function(a){"use strict";function b(a,d){if(3==a.nodeType)return d.push(a.nodeValue);for(var e=a.firstChild;e;e=e.nextSibling)b(e,d),c.test(a.nodeType)&&d.push("\n")}var c=/^(p|li|div|h\\d|pre|blockquote|td)$/;a.colorize=function(c,d){c||(c=document.body.getElementsByTagName("pre"));for(var e=0;e<c.length;++e){var f=c[e],g=f.getAttribute("data-lang")||d;if(g){var h=[];b(f,h),f.innerHTML="",a.runMode(h.join(""),g,f),f.className+=" cm-s-default"}}}})},{"../../lib/codemirror":59,"./runmode":41}],40:[function(a,b,c){window.CodeMirror={},function(){"use strict";function a(a){return a.split(/\r?\n|\r/)}function b(a){this.pos=this.start=0,this.string=a,this.lineStart=0}b.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||null},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.start-this.lineStart},indentation:function(){return 0},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}},lookAhead:function(){return null}},CodeMirror.StringStream=b,CodeMirror.startState=function(a,b,c){return!a.startState||a.startState(b,c)};var c=CodeMirror.modes={},d=CodeMirror.mimeModes={};CodeMirror.defineMode=function(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),c[a]=b},CodeMirror.defineMIME=function(a,b){d[a]=b},CodeMirror.resolveMode=function(a){return"string"==typeof a&&d.hasOwnProperty(a)?a=d[a]:a&&"string"==typeof a.name&&d.hasOwnProperty(a.name)&&(a=d[a.name]),"string"==typeof a?{name:a}:a||{name:"null"}},CodeMirror.getMode=function(a,b){b=CodeMirror.resolveMode(b);var d=c[b.name];if(!d)throw new Error("Unknown mode: "+b);return d(a,b)},CodeMirror.registerHelper=CodeMirror.registerGlobalHelper=Math.min,CodeMirror.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),CodeMirror.defineMIME("text/plain","null"),CodeMirror.runMode=function(b,c,d,e){var f=CodeMirror.getMode({indentUnit:2},c);if(1==d.nodeType){var g=e&&e.tabSize||4,h=d,i=0;h.innerHTML="",d=function(a,b){if("\n"==a)return h.appendChild(document.createElement("br")),void(i=0);for(var c="",d=0;;){var e=a.indexOf("\t",d);if(e==-1){c+=a.slice(d),i+=a.length-d;break}i+=e-d,c+=a.slice(d,e);var f=g-i%g;i+=f;for(var j=0;j<f;++j)c+=" ";d=e+1}if(b){var k=h.appendChild(document.createElement("span"));k.className="cm-"+b.replace(/ +/g," cm-"),k.appendChild(document.createTextNode(c))}else h.appendChild(document.createTextNode(c))}}for(var j=a(b),k=e&&e.state||CodeMirror.startState(f),l=0,m=j.length;l<m;++l){l&&d("\n");var n=new CodeMirror.StringStream(j[l]);for(!n.string&&f.blankLine&&f.blankLine(k);!n.eol();){var o=f.token(n,k);d(n.current(),o,l,n.start,k),n.start=n.pos}}}}()},{}],41:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.runMode=function(b,c,d,e){var f=a.getMode(a.defaults,c),g=/MSIE \d/.test(navigator.userAgent),h=g&&(null==document.documentMode||document.documentMode<9);if(d.appendChild){var i=e&&e.tabSize||a.defaults.tabSize,j=d,k=0;j.innerHTML="",d=function(a,b){if("\n"==a)return j.appendChild(document.createTextNode(h?"\r":a)),void(k=0);for(var c="",d=0;;){var e=a.indexOf("\t",d);if(e==-1){c+=a.slice(d),k+=a.length-d;break}k+=e-d,c+=a.slice(d,e);var f=i-k%i;k+=f;for(var g=0;g<f;++g)c+=" ";d=e+1}if(b){var l=j.appendChild(document.createElement("span"));l.className="cm-"+b.replace(/ +/g," cm-"),l.appendChild(document.createTextNode(c))}else j.appendChild(document.createTextNode(c))}}for(var l=a.splitLines(b),m=e&&e.state||a.startState(f),n=0,o=l.length;n<o;++n){n&&d("\n");var p=new a.StringStream(l[n]);for(!p.string&&f.blankLine&&f.blankLine(m);!p.eol();){var q=f.token(p,m);d(p.current(),q,n,p.start,m),p.start=p.pos}}}})},{"../../lib/codemirror":59}],42:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){function c(a){clearTimeout(d.doRedraw),d.doRedraw=setTimeout(function(){d.redraw()},a)}this.cm=a,this.options=b,this.buttonHeight=b.scrollButtonHeight||a.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=a.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var d=this;a.on("refresh",this.resizeHandler=function(){clearTimeout(d.doUpdate),d.doUpdate=setTimeout(function(){d.computeScale()&&c(20)},100)}),a.on("markerAdded",this.resizeHandler),a.on("markerCleared",this.resizeHandler),b.listenForChanges!==!1&&a.on("change",this.changeHandler=function(){c(250)})}a.defineExtension("annotateScrollbar",function(a){return"string"==typeof a&&(a={className:a}),new b(this,a)}),a.defineOption("scrollButtonHeight",0),b.prototype.computeScale=function(){var a=this.cm,b=(a.getWrapperElement().clientHeight-a.display.barHeight-2*this.buttonHeight)/a.getScrollerElement().scrollHeight;if(b!=this.hScale)return this.hScale=b,!0},b.prototype.update=function(a){this.annotations=a,this.redraw()},b.prototype.redraw=function(a){function b(a,b){if(i!=a.line&&(i=a.line,j=c.getLineHandle(i)),j.widgets&&j.widgets.length||g&&j.height>h)return c.charCoords(a,"local")[b?"top":"bottom"];var d=c.heightAtLine(j,"local");return d+(b?0:j.height)}a!==!1&&this.computeScale();var c=this.cm,d=this.hScale,e=document.createDocumentFragment(),f=this.annotations,g=c.getOption("lineWrapping"),h=g&&1.5*c.defaultTextHeight(),i=null,j=null,k=c.lastLine();if(c.display.barWidth)for(var l,m=0;m<f.length;m++){var n=f[m];if(!(n.to.line>k)){for(var o=l||b(n.from,!0)*d,p=b(n.to,!1)*d;m<f.length-1&&!(f[m+1].to.line>k)&&(l=b(f[m+1].from,!0)*d,!(l>p+.9));)n=f[++m],p=b(n.to,!1)*d;if(p!=o){var q=Math.max(p-o,3),r=e.appendChild(document.createElement("div"));r.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(o+this.buttonHeight)+"px; height: "+q+"px",r.className=this.options.className,n.id&&r.setAttribute("annotation-id",n.id)}}}this.div.textContent="",this.div.appendChild(e)},b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}})},{"../../lib/codemirror":59}],43:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,d){a.changeEnd(d).line==b.lastLine()&&c(b)}function c(a){var b="";if(a.lineCount()>1){var d=a.display.scroller.clientHeight-30,e=a.getLineHandle(a.lastLine()).height;b=d-e+"px"}a.state.scrollPastEndPadding!=b&&(a.state.scrollPastEndPadding=b,a.display.lineSpace.parentNode.style.paddingBottom=b,a.off("refresh",c),a.setSize(),a.on("refresh",c))}a.defineOption("scrollPastEnd",!1,function(d,e,f){f&&f!=a.Init&&(d.off("change",b),d.off("refresh",c),d.display.lineSpace.parentNode.style.paddingBottom="",d.state.scrollPastEndPadding=null),e&&(d.on("change",b),d.on("refresh",c),c(d))})})},{"../../lib/codemirror":59}],44:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(b,c,d){function e(b){var c=a.wheelEventPixels(b)["horizontal"==f.orientation?"x":"y"],d=f.pos;f.moveTo(f.pos+c),f.pos!=d&&a.e_preventDefault(b)}this.orientation=c,this.scroll=d,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=b+"-"+c,this.inner=this.node.appendChild(document.createElement("div"));var f=this;a.on(this.inner,"mousedown",function(b){function c(){a.off(document,"mousemove",d),a.off(document,"mouseup",c)}function d(a){return 1!=a.which?c():void f.moveTo(h+(a[e]-g)*(f.total/f.size))}if(1==b.which){a.e_preventDefault(b);var e="horizontal"==f.orientation?"pageX":"pageY",g=b[e],h=f.pos;a.on(document,"mousemove",d),a.on(document,"mouseup",c)}}),a.on(this.node,"click",function(b){a.e_preventDefault(b);var c,d=f.inner.getBoundingClientRect();c="horizontal"==f.orientation?b.clientX<d.left?-1:b.clientX>d.right?1:0:b.clientY<d.top?-1:b.clientY>d.bottom?1:0,f.moveTo(f.pos+c*f.screen)}),a.on(this.node,"mousewheel",e),a.on(this.node,"DOMMouseScroll",e)}function c(a,c,d){this.addClass=a,this.horiz=new b(a,"horizontal",d),c(this.horiz.node),this.vert=new b(a,"vertical",d),c(this.vert.node),this.width=null}b.prototype.setPos=function(a,b){return a<0&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),!(!b&&a==this.pos)&&(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",!0)},b.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};var d=10;b.prototype.update=function(a,b,c){var e=this.screen!=b||this.total!=a||this.size!=c;e&&(this.screen=b,this.total=a,this.size=c);var f=this.screen*(this.size/this.total);f<d&&(this.size-=d-f,f=d),this.inner.style["horizontal"==this.orientation?"width":"height"]=f+"px",this.setPos(this.pos,e)},c.prototype.update=function(a){if(null==this.width){var b=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;b&&(this.width=parseInt(b.height))}var c=this.width||0,d=a.scrollWidth>a.clientWidth+1,e=a.scrollHeight>a.clientHeight+1;return this.vert.node.style.display=e?"block":"none",this.horiz.node.style.display=d?"block":"none",e&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0)),this.vert.node.style.bottom=d?c+"px":"0"),d&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft),this.horiz.node.style.right=e?c+"px":"0",this.horiz.node.style.left=a.barLeft+"px"),{right:e?c:0,bottom:d?c:0}},c.prototype.setScrollTop=function(a){this.vert.setPos(a)},c.prototype.setScrollLeft=function(a){this.horiz.setPos(a)},c.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node),a.removeChild(this.vert.node)},a.scrollbarModel.simple=function(a,b){return new c("CodeMirror-simplescroll",a,b)},a.scrollbarModel.overlay=function(a,b){return new c("CodeMirror-overlayscroll",a,b)}})},{"../../lib/codemirror":59}],45:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c,d,e){a.openDialog?a.openDialog(b,e,{value:d,selectValueOnOpen:!0}):e(prompt(c,d))}function c(a,b){var c=Number(b);return/^[-+]/.test(b)?a.getCursor().line+c:c-1}var d='Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>';a.commands.jumpToLine=function(a){var e=a.getCursor();b(a,d,"Jump to line:",e.line+1+":"+e.ch,function(b){if(b){var d;if(d=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(b))a.setCursor(c(a,d[1]),Number(d[2]));else if(d=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(b)){var f=Math.round(a.lineCount()*Number(d[1])/100);/^[-+]/.test(d[1])&&(f=e.line+f+1),a.setCursor(f-1,e.ch)}else(d=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(b))&&a.setCursor(c(a,d[1]),e.ch)}})},a.keyMap["default"]["Alt-G"]="jumpToLine"})},{"../../lib/codemirror":59,"../dialog/dialog":3}],46:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],d):d(CodeMirror)}(function(a){"use strict";function b(a){this.options={};for(var b in l)this.options[b]=(a&&a.hasOwnProperty(b)?a:l)[b];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function c(a){var b=a.state.matchHighlighter;(b.active||a.hasFocus())&&e(a,b)}function d(a){var b=a.state.matchHighlighter;b.active||(b.active=!0,e(a,b))}function e(a,b){clearTimeout(b.timeout),b.timeout=setTimeout(function(){h(a)},b.options.delay)}function f(a,b,c,d){var e=a.state.matchHighlighter;if(a.addOverlay(e.overlay=k(b,c,d)),e.options.annotateScrollbar&&a.showMatchesOnScrollbar){var f=c?new RegExp("\\b"+b+"\\b"):b;e.matchesonscroll=a.showMatchesOnScrollbar(f,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function g(a){var b=a.state.matchHighlighter;b.overlay&&(a.removeOverlay(b.overlay),b.overlay=null,b.matchesonscroll&&(b.matchesonscroll.clear(),b.matchesonscroll=null))}function h(a){a.operation(function(){var b=a.state.matchHighlighter;if(g(a),!a.somethingSelected()&&b.options.showToken){for(var c=b.options.showToken===!0?/[\w$]/:b.options.showToken,d=a.getCursor(),e=a.getLine(d.line),h=d.ch,j=h;h&&c.test(e.charAt(h-1));)--h;for(;j<e.length&&c.test(e.charAt(j));)++j;return void(h<j&&f(a,e.slice(h,j),c,b.options.style))}var k=a.getCursor("from"),l=a.getCursor("to");if(k.line==l.line&&(!b.options.wordsOnly||i(a,k,l))){var m=a.getRange(k,l);b.options.trim&&(m=m.replace(/^\s+|\s+$/g,"")),m.length>=b.options.minChars&&f(a,m,!1,b.options.style)}})}function i(a,b,c){var d=a.getRange(b,c);if(null!==d.match(/^\w+$/)){if(b.ch>0){var e={line:b.line,ch:b.ch-1},f=a.getRange(e,b);if(null===f.match(/\W/))return!1}if(c.ch<a.getLine(b.line).length){var e={line:c.line,ch:c.ch+1},f=a.getRange(c,e);if(null===f.match(/\W/))return!1}return!0}return!1}function j(a,b){return!(a.start&&b.test(a.string.charAt(a.start-1))||a.pos!=a.string.length&&b.test(a.string.charAt(a.pos)))}function k(a,b,c){return{token:function(d){return!d.match(a)||b&&!j(d,b)?(d.next(),void(d.skipTo(a.charAt(0))||d.skipToEnd())):c}}}var l={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};a.defineOption("highlightSelectionMatches",!1,function(e,f,i){if(i&&i!=a.Init&&(g(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",c),e.off("focus",d)),f){var j=e.state.matchHighlighter=new b(f);e.hasFocus()?(j.active=!0,h(e)):e.on("focus",d),e.on("cursorActivity",c)}})})},{"../../lib/codemirror":59,"./matchesonscrollbar":47}],47:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./searchcursor"),a("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c,d){this.cm=a,this.options=d;var e={listenForChanges:!1};for(var f in d)e[f]=d[f];e.className||(e.className="CodeMirror-search-match"),this.annotation=a.annotateScrollbar(e),this.query=b,this.caseFold=c,this.gap={from:a.firstLine(),to:a.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}function c(a,b,c){return a<=b?a:Math.max(b,a+c)}a.defineExtension("showMatchesOnScrollbar",function(a,c,d){return"string"==typeof d&&(d={className:d}),d||(d={}),new b(this,a,c,d)});var d=1e3;b.prototype.findMatches=function(){if(this.gap){for(var b=0;b<this.matches.length;b++){var c=this.matches[b];if(c.from.line>=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(b--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),f=this.options&&this.options.maxMatches||d;e.findNext();){var c={from:e.from(),to:e.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(b++,0,c),this.matches.length>f)break}this.gap=null}},b.prototype.onChange=function(b){var d=b.from.line,e=a.changeEnd(b).line,f=e-b.to.line;if(this.gap?(this.gap.from=Math.min(c(this.gap.from,d,f),b.from.line),this.gap.to=Math.max(c(this.gap.to,d,f),b.from.line)):this.gap={from:b.from.line,to:e+1},f)for(var g=0;g<this.matches.length;g++){var h=this.matches[g],i=c(h.from.line,d,f);i!=h.from.line&&(h.from=a.Pos(i,h.from.ch));var j=c(h.to.line,d,f);j!=h.to.line&&(h.to=a.Pos(j,h.to.ch))}clearTimeout(this.update);var k=this;this.update=setTimeout(function(){k.updateAfterChange()},250)},b.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},b.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}})},{"../../lib/codemirror":59,"../scroll/annotatescrollbar":42,"./searchcursor":49}],48:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("./searchcursor"),a("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){return"string"==typeof a?a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"gi":"g"):a.global||(a=new RegExp(a.source,a.ignoreCase?"gi":"g")),{token:function(b){a.lastIndex=b.pos;var c=a.exec(b.string);return c&&c.index==b.pos?(b.pos+=c[0].length||1,"searching"):void(c?b.pos=c.index:b.skipToEnd())}}}function c(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function d(a){return a.state.search||(a.state.search=new c)}function e(a){return"string"==typeof a&&a==a.toLowerCase()}function f(a,b,c){return a.getSearchCursor(b,c,{caseFold:e(b),multiline:!0})}function g(a,b,c,d,e){a.openDialog(b,d,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){o(a)},onKeyDown:e})}function h(a,b,c,d,e){a.openDialog?a.openDialog(b,e,{value:d,selectValueOnOpen:!0}):e(prompt(c,d))}function i(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function j(a){return a.replace(/\\(.)/g,function(a,b){return"n"==b?"\n":"r"==b?"\r":b})}function k(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],b[2].indexOf("i")==-1?"":"i")}catch(c){}else a=j(a);return("string"==typeof a?""==a:a.test(""))&&(a=/x^/),a}function l(a,c,d){c.queryText=d,c.query=k(d),a.removeOverlay(c.overlay,e(c.query)),c.overlay=b(c.query,e(c.query)),a.addOverlay(c.overlay),a.showMatchesOnScrollbar&&(c.annotate&&(c.annotate.clear(),c.annotate=null),c.annotate=a.showMatchesOnScrollbar(c.query,e(c.query)))}function m(b,c,e,f){var i=d(b);if(i.query)return n(b,c);var j=b.getSelection()||i.lastQuery;if(e&&b.openDialog){var k=null,m=function(c,d){a.e_stop(d),c&&(c!=i.queryText&&(l(b,i,c),i.posFrom=i.posTo=b.getCursor()),k&&(k.style.opacity=1),n(b,d.shiftKey,function(a,c){var d;c.line<3&&document.querySelector&&(d=b.display.wrapper.querySelector(".CodeMirror-dialog"))&&d.getBoundingClientRect().bottom-4>b.cursorCoords(c,"window").top&&((k=d).style.opacity=.4)}))};g(b,r,j,m,function(c,e){var f=a.keyName(c),g=b.getOption("extraKeys"),h=g&&g[f]||a.keyMap[b.getOption("keyMap")][f];"findNext"==h||"findPrev"==h||"findPersistentNext"==h||"findPersistentPrev"==h?(a.e_stop(c),l(b,d(b),e),b.execCommand(h)):"find"!=h&&"findPersistent"!=h||(a.e_stop(c),m(e,c))}),f&&j&&(l(b,i,j),n(b,c))}else h(b,r,"Search for:",j,function(a){a&&!i.query&&b.operation(function(){l(b,i,a),i.posFrom=i.posTo=b.getCursor(),n(b,c)})})}function n(b,c,e){b.operation(function(){var g=d(b),h=f(b,g.query,c?g.posFrom:g.posTo);(h.find(c)||(h=f(b,g.query,c?a.Pos(b.lastLine()):a.Pos(b.firstLine(),0)),h.find(c)))&&(b.setSelection(h.from(),h.to()),b.scrollIntoView({from:h.from(),to:h.to()},20),g.posFrom=h.from(),g.posTo=h.to(),e&&e(h.from(),h.to()))})}function o(a){a.operation(function(){var b=d(a);b.lastQuery=b.query,b.query&&(b.query=b.queryText=null,a.removeOverlay(b.overlay),b.annotate&&(b.annotate.clear(),b.annotate=null))})}function p(a,b,c){a.operation(function(){for(var d=f(a,b);d.findNext();)if("string"!=typeof b){var e=a.getRange(d.from(),d.to()).match(b);d.replace(c.replace(/\$(\d)/g,function(a,b){return e[b]}))}else d.replace(c)})}function q(a,b){if(!a.getOption("readOnly")){var c=a.getSelection()||d(a).lastQuery,e='<span class="CodeMirror-search-label">'+(b?"Replace all:":"Replace:")+"</span>";h(a,e+s,e,c,function(c){c&&(c=k(c),h(a,t,"Replace with:","",function(d){if(d=j(d),b)p(a,c,d);else{o(a);var e=f(a,c,a.getCursor("from")),g=function(){var b,j=e.from();!(b=e.findNext())&&(e=f(a,c),!(b=e.findNext())||j&&e.from().line==j.line&&e.from().ch==j.ch)||(a.setSelection(e.from(),e.to()),a.scrollIntoView({from:e.from(),to:e.to()}),i(a,u,"Replace?",[function(){h(b)},g,function(){p(a,c,d)}]))},h=function(a){e.replace("string"==typeof c?d:d.replace(/\$(\d)/g,function(b,c){return a[c]})),g()};g()}}))})}}var r='<span class="CodeMirror-search-label">Search:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',s=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',t='<span class="CodeMirror-search-label">With:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',u='<span class="CodeMirror-search-label">Replace?</span> <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>';a.commands.find=function(a){o(a),m(a)},a.commands.findPersistent=function(a){o(a),m(a,!1,!0)},a.commands.findPersistentNext=function(a){m(a,!1,!0,!0)},a.commands.findPersistentPrev=function(a){m(a,!0,!0,!0)},a.commands.findNext=m,a.commands.findPrev=function(a){m(a,!0)},a.commands.clearSearch=o,a.commands.replace=q,a.commands.replaceAll=function(a){q(a,!0)}})},{"../../lib/codemirror":59,"../dialog/dialog":3,"./searchcursor":49}],49:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){var b=a.flags;return null!=b?b:(a.ignoreCase?"i":"")+(a.global?"g":"")+(a.multiline?"m":"")}function c(a){return a.global?a:new RegExp(a.source,b(a)+"g")}function d(a){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(a.source)}function e(a,b,d){b=c(b);for(var e=d.line,f=d.ch,g=a.lastLine();e<=g;e++,f=0){b.lastIndex=f;var h=a.getLine(e),i=b.exec(h);if(i)return{from:p(e,i.index),to:p(e,i.index+i[0].length),match:i}}}function f(a,b,f){if(!d(b))return e(a,b,f);b=c(b);for(var g,h=1,i=f.line,j=a.lastLine();i<=j;){for(var k=0;k<h;k++){var l=a.getLine(i++);g=null==g?l:g+"\n"+l}h*=2,b.lastIndex=f.ch;var m=b.exec(g);if(m){var n=g.slice(0,m.index).split("\n"),o=m[0].split("\n"),q=f.line+n.length-1,r=n[n.length-1].length;return{from:p(q,r),to:p(q+o.length-1,1==o.length?r+o[0].length:o[o.length-1].length),match:m}}}}function g(a,b){for(var c,d=0;;){b.lastIndex=d;var e=b.exec(a);if(!e)return c;if(c=e,d=c.index+(c[0].length||1),d==a.length)return c}}function h(a,b,d){b=c(b);for(var e=d.line,f=d.ch,h=a.firstLine();e>=h;e--,f=-1){var i=a.getLine(e);f>-1&&(i=i.slice(0,f));var j=g(i,b);if(j)return{from:p(e,j.index),to:p(e,j.index+j[0].length),match:j}}}function i(a,b,d){b=c(b);for(var e,f=1,h=d.line,i=a.firstLine();h>=i;){for(var j=0;j<f;j++){var k=a.getLine(h--);e=null==e?k.slice(0,d.ch):k+"\n"+e}f*=2;var l=g(e,b);if(l){var m=e.slice(0,l.index).split("\n"),n=l[0].split("\n"),o=h+m.length,q=m[m.length-1].length; return{from:p(o,q),to:p(o+n.length-1,1==n.length?q+n[0].length:n[n.length-1].length),match:l}}}}function j(a,b,c,d){if(a.length==b.length)return c;for(var e=0,f=c+Math.max(0,a.length-b.length);;){if(e==f)return e;var g=e+f>>1,h=d(a.slice(0,g)).length;if(h==c)return g;h>c?f=g:e=g+1}}function k(a,b,c,d){if(!b.length)return null;var e=d?n:o,f=e(b).split(/\r|\n\r?/);a:for(var g=c.line,h=c.ch,i=a.lastLine()+1-f.length;g<=i;g++,h=0){var k=a.getLine(g).slice(h),l=e(k);if(1==f.length){var m=l.indexOf(f[0]);if(m==-1)continue a;var c=j(k,l,m,e)+h;return{from:p(g,j(k,l,m,e)+h),to:p(g,j(k,l,m+f[0].length,e)+h)}}var q=l.length-f[0].length;if(l.slice(q)==f[0]){for(var r=1;r<f.length-1;r++)if(e(a.getLine(g+r))!=f[r])continue a;var s=a.getLine(g+f.length-1),t=e(s),u=f[f.length-1];if(s.slice(0,u.length)==u)return{from:p(g,j(k,l,q,e)+h),to:p(g+f.length-1,j(s,t,u.length,e))}}}}function l(a,b,c,d){if(!b.length)return null;var e=d?n:o,f=e(b).split(/\r|\n\r?/);a:for(var g=c.line,h=c.ch,i=a.firstLine()-1+f.length;g>=i;g--,h=-1){var k=a.getLine(g);h>-1&&(k=k.slice(0,h));var l=e(k);if(1==f.length){var m=l.lastIndexOf(f[0]);if(m==-1)continue a;return{from:p(g,j(k,l,m,e)),to:p(g,j(k,l,m+f[0].length,e))}}var q=f[f.length-1];if(l.slice(0,q.length)==q){for(var r=1,c=g-f.length+1;r<f.length-1;r++)if(e(a.getLine(c+r))!=f[r])continue a;var s=a.getLine(g+1-f.length),t=e(s);if(t.slice(t.length-f[0].length)==f[0])return{from:p(g+1-f.length,j(s,t,s.length-f[0].length,e)),to:p(g,j(k,l,q.length,e))}}}}function m(a,b,d,g){this.atOccurrence=!1,this.doc=a,d=d?a.clipPos(d):p(0,0),this.pos={from:d,to:d};var j;"object"==typeof g?j=g.caseFold:(j=g,g=null),"string"==typeof b?(null==j&&(j=!1),this.matches=function(c,d){return(c?l:k)(a,b,d,j)}):(b=c(b),g&&g.multiline===!1?this.matches=function(c,d){return(c?h:e)(a,b,d)}:this.matches=function(c,d){return(c?i:f)(a,b,d)})}var n,o,p=a.Pos;String.prototype.normalize?(n=function(a){return a.normalize("NFD").toLowerCase()},o=function(a){return a.normalize("NFD")}):(n=function(a){return a.toLowerCase()},o=function(a){return a}),m.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(b){for(var c=this.matches(b,this.doc.clipPos(b?this.pos.from:this.pos.to));c&&0==a.cmpPos(c.from,c.to);)b?c.from.ch?c.from=p(c.from.line,c.from.ch-1):c=c.from.line==this.doc.firstLine()?null:this.matches(b,this.doc.clipPos(p(c.from.line-1))):c.to.ch<this.doc.getLine(c.to.line).length?c.to=p(c.to.line,c.to.ch+1):c=c.to.line==this.doc.lastLine()?null:this.matches(b,p(c.to.line+1,0));if(c)return this.pos=c,this.atOccurrence=!0,this.pos.match||!0;var d=p(b?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:d,to:d},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,c){if(this.atOccurrence){var d=a.splitLines(b);this.doc.replaceRange(d,this.pos.from,this.pos.to,c),this.pos.to=p(this.pos.from.line+d.length-1,d[d.length-1].length+(1==d.length?this.pos.from.ch:0))}}},a.defineExtension("getSearchCursor",function(a,b,c){return new m(this.doc,a,b,c)}),a.defineDocExtension("getSearchCursor",function(a,b,c){return new m(this,a,b,c)}),a.defineExtension("selectMatches",function(b,c){for(var d=[],e=this.getSearchCursor(b,this.getCursor("from"),c);e.findNext()&&!(a.cmpPos(e.to(),this.getCursor("to"))>0);)d.push({anchor:e.from(),head:e.to()});d.length&&this.setSelections(d,0)})})},{"../../lib/codemirror":59}],50:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){for(var b=0;b<a.state.activeLines.length;b++)a.removeLineClass(a.state.activeLines[b],"wrap",f),a.removeLineClass(a.state.activeLines[b],"background",g),a.removeLineClass(a.state.activeLines[b],"gutter",h)}function c(a,b){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}function d(a,d){for(var e=[],i=0;i<d.length;i++){var j=d[i],k=a.getOption("styleActiveLine");if("object"==typeof k&&k.nonEmpty?j.anchor.line==j.head.line:j.empty()){var l=a.getLineHandleVisualStart(j.head.line);e[e.length-1]!=l&&e.push(l)}}c(a.state.activeLines,e)||a.operation(function(){b(a);for(var c=0;c<e.length;c++)a.addLineClass(e[c],"wrap",f),a.addLineClass(e[c],"background",g),a.addLineClass(e[c],"gutter",h);a.state.activeLines=e})}function e(a,b){d(a,b.ranges)}var f="CodeMirror-activeline",g="CodeMirror-activeline-background",h="CodeMirror-activeline-gutter";a.defineOption("styleActiveLine",!1,function(c,f,g){var h=g!=a.Init&&g;f!=h&&(h&&(c.off("beforeSelectionChange",e),b(c),delete c.state.activeLines),f&&(c.state.activeLines=[],d(c,c.listSelections()),c.on("beforeSelectionChange",e)))})})},{"../../lib/codemirror":59}],51:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){a.state.markedSelection&&a.operation(function(){g(a)})}function c(a){a.state.markedSelection&&a.state.markedSelection.length&&a.operation(function(){e(a)})}function d(a,b,c,d){if(0!=j(b,c))for(var e=a.state.markedSelection,f=a.state.markedSelectionStyle,g=b.line;;){var k=g==b.line?b:i(g,0),l=g+h,m=l>=c.line,n=m?c:i(l,0),o=a.markText(k,n,{className:f});if(null==d?e.push(o):e.splice(d++,0,o),m)break;g=l}}function e(a){for(var b=a.state.markedSelection,c=0;c<b.length;++c)b[c].clear();b.length=0}function f(a){e(a);for(var b=a.listSelections(),c=0;c<b.length;c++)d(a,b[c].from(),b[c].to())}function g(a){if(!a.somethingSelected())return e(a);if(a.listSelections().length>1)return f(a);var b=a.getCursor("start"),c=a.getCursor("end"),g=a.state.markedSelection;if(!g.length)return d(a,b,c);var i=g[0].find(),k=g[g.length-1].find();if(!i||!k||c.line-b.line<=h||j(b,k.to)>=0||j(c,i.from)<=0)return f(a);for(;j(b,i.from)>0;)g.shift().clear(),i=g[0].find();for(j(b,i.from)<0&&(i.to.line-b.line<h?(g.shift().clear(),d(a,b,i.to,0)):d(a,b,i.from,0));j(c,k.to)<0;)g.pop().clear(),k=g[g.length-1].find();j(c,k.to)>0&&(c.line-k.from.line<h?(g.pop().clear(),d(a,k.from,c)):d(a,k.to,c))}a.defineOption("styleSelectedText",!1,function(d,g,h){var i=h&&h!=a.Init;g&&!i?(d.state.markedSelection=[],d.state.markedSelectionStyle="string"==typeof g?g:"CodeMirror-selectedtext",f(d),d.on("cursorActivity",b),d.on("change",c)):!g&&i&&(d.off("cursorActivity",b),d.off("change",c),e(d),d.state.markedSelection=d.state.markedSelectionStyle=null)});var h=8,i=a.Pos,j=a.cmpPos})},{"../../lib/codemirror":59}],52:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){var c=a.state.selectionPointer;(null==b.buttons?b.which:b.buttons)?c.mouseX=c.mouseY=null:(c.mouseX=b.clientX,c.mouseY=b.clientY),e(a)}function c(a,b){if(!a.getWrapperElement().contains(b.relatedTarget)){var c=a.state.selectionPointer;c.mouseX=c.mouseY=null,e(a)}}function d(a){a.state.selectionPointer.rects=null,e(a)}function e(a){a.state.selectionPointer.willUpdate||(a.state.selectionPointer.willUpdate=!0,setTimeout(function(){f(a),a.state.selectionPointer.willUpdate=!1},50))}function f(a){var b=a.state.selectionPointer;if(b){if(null==b.rects&&null!=b.mouseX&&(b.rects=[],a.somethingSelected()))for(var c=a.display.selectionDiv.firstChild;c;c=c.nextSibling)b.rects.push(c.getBoundingClientRect());var d=!1;if(null!=b.mouseX)for(var e=0;e<b.rects.length;e++){var f=b.rects[e];f.left<=b.mouseX&&f.right>=b.mouseX&&f.top<=b.mouseY&&f.bottom>=b.mouseY&&(d=!0)}var g=d?b.value:"";a.display.lineDiv.style.cursor!=g&&(a.display.lineDiv.style.cursor=g)}}a.defineOption("selectionPointer",!1,function(e,f){var g=e.state.selectionPointer;g&&(a.off(e.getWrapperElement(),"mousemove",g.mousemove),a.off(e.getWrapperElement(),"mouseout",g.mouseout),a.off(window,"scroll",g.windowScroll),e.off("cursorActivity",d),e.off("scroll",d),e.state.selectionPointer=null,e.display.lineDiv.style.cursor=""),f&&(g=e.state.selectionPointer={value:"string"==typeof f?f:"default",mousemove:function(a){b(e,a)},mouseout:function(a){c(e,a)},windowScroll:function(){d(e)},rects:null,mouseX:null,mouseY:null,willUpdate:!1},a.on(e.getWrapperElement(),"mousemove",g.mousemove),a.on(e.getWrapperElement(),"mouseout",g.mouseout),a.on(window,"scroll",g.windowScroll),e.on("cursorActivity",d),e.on("scroll",d))})})},{"../../lib/codemirror":59}],53:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c){var d=a.docs[b];d?c(F(a,d)):a.options.getFile?a.options.getFile(b,c):c(null)}function c(a,b,c){for(var d in a.docs){var e=a.docs[d];if(e.doc==b)return e}if(!c)for(var f=0;;++f)if(d="[doc"+(f||"")+"]",!a.docs[d]){c=d;break}return a.addDoc(c,b)}function d(b,d){return"string"==typeof d?b.docs[d]:(d instanceof a&&(d=d.getDoc()),d instanceof a.Doc?c(b,d):void 0)}function e(a,b,d){var e=c(a,b),g=a.cachedArgHints;g&&g.doc==b&&L(g.start,d.to)>=0&&(a.cachedArgHints=null);var h=e.changed;null==h&&(e.changed=h={from:d.from.line,to:d.from.line});var i=d.from.line+(d.text.length-1);d.from.line<h.to&&(h.to=h.to-(d.to.line-i)),i>=h.to&&(h.to=i+1),h.from>d.from.line&&(h.from=d.from.line),b.lineCount()>J&&d.to-h.from>100&&setTimeout(function(){e.changed&&e.changed.to-e.changed.from>100&&f(a,e)},200)}function f(a,b){a.server.request({files:[{type:"full",name:b.name,text:F(a,b)}]},function(a){a?window.console.error(a):b.changed=null})}function g(b,c,d){b.request(c,{type:"completions",types:!0,docs:!0,urls:!0},function(e,f){if(e)return D(b,c,e);var g=[],i="",j=f.start,k=f.end;'["'==c.getRange(H(j.line,j.ch-2),j)&&'"]'!=c.getRange(k,H(k.line,k.ch+2))&&(i='"]');for(var l=0;l<f.completions.length;++l){var m=f.completions[l],n=h(m.type);f.guess&&(n+=" "+I+"guess"),g.push({text:m.name+i,displayText:m.displayName||m.name,className:n,data:m})}var o={from:j,to:k,list:g},p=null;a.on(o,"close",function(){B(p)}),a.on(o,"update",function(){B(p)}),a.on(o,"select",function(a,c){B(p);var d=b.options.completionTip?b.options.completionTip(a.data):a.data.doc;d&&(p=A(c.parentNode.getBoundingClientRect().right+window.pageXOffset,c.getBoundingClientRect().top+window.pageYOffset,d),p.className+=" "+I+"hint-doc")}),d(o)})}function h(a){var b;return b="?"==a?"unknown":"number"==a||"string"==a||"bool"==a?a:/^fn\(/.test(a)?"fn":/^\[/.test(a)?"array":"object",I+"completion "+I+"completion-"+b}function i(a,b,c,d,e){a.request(b,d,function(c,d){if(c)return D(a,b,c);if(a.options.typeTip)var f=a.options.typeTip(d);else{var f=w("span",null,w("strong",null,d.type||"not found"));if(d.doc&&f.appendChild(document.createTextNode(" \u2014 "+d.doc)),d.url){f.appendChild(document.createTextNode(" "));var g=f.appendChild(w("a",null,"[docs]"));g.href=d.url,g.target="_blank"}}y(b,f,a),e&&e()},c)}function j(b,c){if(E(b),!c.somethingSelected()){var d=c.getTokenAt(c.getCursor()).state,e=a.innerMode(c.getMode(),d);if("javascript"==e.mode.name){var f=e.state.lexical;if("call"==f.info){for(var g,h=f.pos||0,i=c.getOption("tabSize"),j=c.getCursor().line,m=Math.max(0,j-9),n=!1;j>=m;--j){for(var o=c.getLine(j),p=0,q=0;;){var r=o.indexOf("\t",q);if(r==-1)break;p+=i-(r+p)%i-1,q=r+1}if(g=f.column-p,"("==o.charAt(g)){n=!0;break}}if(n){var s=H(j,g),t=b.cachedArgHints;return t&&t.doc==c.getDoc()&&0==L(s,t.start)?k(b,c,h):void b.request(c,{type:"type",preferFunction:!0,end:s},function(a,d){!a&&d.type&&/^fn\(/.test(d.type)&&(b.cachedArgHints={start:s,type:l(d.type),name:d.exprName||d.name||"fn",guess:d.guess,doc:c.getDoc()},k(b,c,h))})}}}}}function k(a,b,c){E(a);for(var d=a.cachedArgHints,e=d.type,f=w("span",d.guess?I+"fhint-guess":null,w("span",I+"fname",d.name),"("),g=0;g<e.args.length;++g){g&&f.appendChild(document.createTextNode(", "));var h=e.args[g];f.appendChild(w("span",I+"farg"+(g==c?" "+I+"farg-current":""),h.name||"?")),"?"!=h.type&&(f.appendChild(document.createTextNode(":\xa0")),f.appendChild(w("span",I+"type",h.type)))}f.appendChild(document.createTextNode(e.rettype?") ->\xa0":")")),e.rettype&&f.appendChild(w("span",I+"type",e.rettype));var i=b.cursorCoords(null,"page"),j=a.activeArgHints=A(i.right+1,i.bottom,f);setTimeout(function(){j.clear=z(b,function(){a.activeArgHints==j&&E(a)})},20)}function l(a){function b(b){for(var c=0,e=d;;){var f=a.charAt(d);if(b.test(f)&&!c)return a.slice(e,d);/[{\[\(]/.test(f)?++c:/[}\]\)]/.test(f)&&--c,++d}}var c=[],d=3;if(")"!=a.charAt(d))for(;;){var e=a.slice(d).match(/^([^, \(\[\{]+): /);if(e&&(d+=e[0].length,e=e[1]),c.push({name:e,type:b(/[\),]/)}),")"==a.charAt(d))break;d+=2}var f=a.slice(d).match(/^\) -> (.*)$/);return{args:c,rettype:f&&f[1]}}function m(a,b){function d(d){var e={type:"definition",variable:d||null},f=c(a,b.getDoc());a.server.request(u(a,f,e),function(c,d){if(c)return D(a,b,c);if(!d.file&&d.url)return void window.open(d.url);if(d.file){var e,g=a.docs[d.file];if(g&&(e=p(g.doc,d)))return a.jumpStack.push({file:f.name,start:b.getCursor("from"),end:b.getCursor("to")}),void o(a,f,g,e.start,e.end)}D(a,b,"Could not find a definition.")})}q(b)?d():x(b,"Jump to variable",function(a){a&&d(a)})}function n(a,b){var d=a.jumpStack.pop(),e=d&&a.docs[d.file];e&&o(a,c(a,b.getDoc()),e,d.start,d.end)}function o(a,b,c,d,e){c.doc.setSelection(d,e),b!=c&&a.options.switchToDoc&&(E(a),a.options.switchToDoc(c.name,c.doc))}function p(a,b){for(var c=b.context.slice(0,b.contextOffset).split("\n"),d=b.start.line-(c.length-1),e=H(d,(1==c.length?b.start.ch:a.getLine(d).length)-c[0].length),f=a.getLine(d).slice(e.ch),g=d+1;g<a.lineCount()&&f.length<b.context.length;++g)f+="\n"+a.getLine(g);if(f.slice(0,b.context.length)==b.context)return b;for(var h,i=a.getSearchCursor(b.context,0,!1),j=1/0;i.findNext();){var k=i.from(),l=1e4*Math.abs(k.line-e.line);l||(l=Math.abs(k.ch-e.ch)),l<j&&(h=k,j=l)}if(!h)return null;if(1==c.length?h.ch+=c[0].length:h=H(h.line+(c.length-1),c[c.length-1].length),b.start.line==b.end.line)var m=H(h.line,h.ch+(b.end.ch-b.start.ch));else var m=H(h.line+(b.end.line-b.start.line),b.end.ch);return{start:h,end:m}}function q(a){var b=a.getCursor("end"),c=a.getTokenAt(b);return!(c.start<b.ch&&"comment"==c.type)&&/[\w)\]]/.test(a.getLine(b.line).slice(Math.max(b.ch-1,0),b.ch+1))}function r(a,b){var c=b.getTokenAt(b.getCursor());return/\w/.test(c.string)?void x(b,"New name for "+c.string,function(c){a.request(b,{type:"rename",newName:c,fullDocs:!0},function(c,d){return c?D(a,b,c):void t(a,d.changes)})}):D(a,b,"Not at a variable")}function s(a,b){var d=c(a,b.doc).name;a.request(b,{type:"refs"},function(c,e){if(c)return D(a,b,c);for(var f=[],g=0,h=b.getCursor(),i=0;i<e.refs.length;i++){var j=e.refs[i];j.file==d&&(f.push({anchor:j.start,head:j.end}),L(h,j.start)>=0&&L(h,j.end)<=0&&(g=f.length-1))}b.setSelections(f,g)})}function t(a,b){for(var c=Object.create(null),d=0;d<b.length;++d){var e=b[d];(c[e.file]||(c[e.file]=[])).push(e)}for(var f in c){var g=a.docs[f],h=c[f];if(g){h.sort(function(a,b){return L(b.start,a.start)});for(var i="*rename"+ ++K,d=0;d<h.length;++d){var e=h[d];g.doc.replaceRange(e.text,e.start,e.end,i)}}}}function u(a,b,c,d){var e=[],f=0,g=!c.fullDocs;g||delete c.fullDocs,"string"==typeof c&&(c={type:c}),c.lineCharPositions=!0,null==c.end&&(c.end=d||b.doc.getCursor("end"),b.doc.somethingSelected()&&(c.start=b.doc.getCursor("start")));var h=c.start||c.end;if(b.changed)if(b.doc.lineCount()>J&&g!==!1&&b.changed.to-b.changed.from<100&&b.changed.from<=h.line&&b.changed.to>c.end.line){e.push(v(b,h,c.end)),c.file="#0";var f=e[0].offsetLines;null!=c.start&&(c.start=H(c.start.line- -f,c.start.ch)),c.end=H(c.end.line-f,c.end.ch)}else e.push({type:"full",name:b.name,text:F(a,b)}),c.file=b.name,b.changed=null;else c.file=b.name;for(var i in a.docs){var j=a.docs[i];j.changed&&j!=b&&(e.push({type:"full",name:j.name,text:F(a,j)}),j.changed=null)}return{query:c,files:e}}function v(b,c,d){for(var e,f=b.doc,g=null,h=null,i=4,j=c.line-1,k=Math.max(0,j-50);j>=k;--j){var l=f.getLine(j),m=l.search(/\bfunction\b/);if(!(m<0)){var n=a.countColumn(l,null,i);null!=g&&g<=n||(g=n,h=j)}}null==h&&(h=k);var o=Math.min(f.lastLine(),d.line+20);if(null==g||g==a.countColumn(f.getLine(c.line),null,i))e=o;else for(e=d.line+1;e<o;++e){var n=a.countColumn(f.getLine(e),null,i);if(n<=g)break}var p=H(h,0);return{type:"part",name:b.name,offsetLines:p.line,text:f.getRange(p,H(e,0))}}function w(a,b){var c=document.createElement(a);b&&(c.className=b);for(var d=2;d<arguments.length;++d){var e=arguments[d];"string"==typeof e&&(e=document.createTextNode(e)),c.appendChild(e)}return c}function x(a,b,c){a.openDialog?a.openDialog(b+": <input type=text>",c):c(prompt(b,""))}function y(b,c,d){function e(){j=!0,i||f()}function f(){b.state.ternTooltip=null,h.parentNode&&C(h),k()}b.state.ternTooltip&&B(b.state.ternTooltip);var g=b.cursorCoords(),h=b.state.ternTooltip=A(g.right+1,g.bottom,c),i=!1,j=!1;a.on(h,"mousemove",function(){i=!0}),a.on(h,"mouseout",function(b){a.contains(h,b.relatedTarget||b.toElement)||(j?f():i=!1)}),setTimeout(e,d.options.hintDelay?d.options.hintDelay:1700);var k=z(b,f)}function z(a,b){return a.on("cursorActivity",b),a.on("blur",b),a.on("scroll",b),a.on("setDoc",b),function(){a.off("cursorActivity",b),a.off("blur",b),a.off("scroll",b),a.off("setDoc",b)}}function A(a,b,c){var d=w("div",I+"tooltip",c);return d.style.left=a+"px",d.style.top=b+"px",document.body.appendChild(d),d}function B(a){var b=a&&a.parentNode;b&&b.removeChild(a)}function C(a){a.style.opacity="0",setTimeout(function(){B(a)},1100)}function D(a,b,c){a.options.showError?a.options.showError(b,c):y(b,String(c),a)}function E(a){a.activeArgHints&&(a.activeArgHints.clear&&a.activeArgHints.clear(),B(a.activeArgHints),a.activeArgHints=null)}function F(a,b){var c=b.doc.getValue();return a.options.fileFilter&&(c=a.options.fileFilter(c,b.name,b.doc)),c}function G(a){function c(a,b){b&&(a.id=++e,f[e]=b),d.postMessage(a)}var d=a.worker=new Worker(a.options.workerScript);d.postMessage({type:"init",defs:a.options.defs,plugins:a.options.plugins,scripts:a.options.workerDeps});var e=0,f={};d.onmessage=function(d){var e=d.data;"getFile"==e.type?b(a,e.name,function(a,b){c({type:"getFile",err:String(a),text:b,id:e.id})}):"debug"==e.type?window.console.log(e.message):e.id&&f[e.id]&&(f[e.id](e.err,e.body),delete f[e.id])},d.onerror=function(a){for(var b in f)f[b](a);f={}},this.addFile=function(a,b){c({type:"add",name:a,text:b})},this.delFile=function(a){c({type:"del",name:a})},this.request=function(a,b){c({type:"req",body:a},b)}}a.TernServer=function(a){var c=this;this.options=a||{};var d=this.options.plugins||(this.options.plugins={});d.doc_comment||(d.doc_comment=!0),this.docs=Object.create(null),this.options.useWorker?this.server=new G(this):this.server=new tern.Server({getFile:function(a,d){return b(c,a,d)},async:!0,defs:this.options.defs||[],plugins:d}),this.trackChange=function(a,b){e(c,a,b)},this.cachedArgHints=null,this.activeArgHints=null,this.jumpStack=[],this.getHint=function(a,b){return g(c,a,b)},this.getHint.async=!0},a.TernServer.prototype={addDoc:function(b,c){var d={doc:c,name:b,changed:null};return this.server.addFile(b,F(this,d)),a.on(c,"change",this.trackChange),this.docs[b]=d},delDoc:function(b){var c=d(this,b);c&&(a.off(c.doc,"change",this.trackChange),delete this.docs[c.name],this.server.delFile(c.name))},hideDoc:function(a){E(this);var b=d(this,a);b&&b.changed&&f(this,b)},complete:function(a){a.showHint({hint:this.getHint})},showType:function(a,b,c){i(this,a,b,"type",c)},showDocs:function(a,b,c){i(this,a,b,"documentation",c)},updateArgHints:function(a){j(this,a)},jumpToDef:function(a){m(this,a)},jumpBack:function(a){n(this,a)},rename:function(a){r(this,a)},selectName:function(a){s(this,a)},request:function(a,b,d,e){var f=this,g=c(this,a.getDoc()),h=u(this,g,b,e),i=h.query&&this.options.queryOptions&&this.options.queryOptions[h.query.type];if(i)for(var j in i)h.query[j]=i[j];this.server.request(h,function(a,c){!a&&f.options.responseFilter&&(c=f.options.responseFilter(g,b,h,a,c)),d(a,c)})},destroy:function(){E(this),this.worker&&(this.worker.terminate(),this.worker=null)}};var H=a.Pos,I="CodeMirror-Tern-",J=250,K=0,L=a.cmpPos})},{"../../lib/codemirror":59}],54:[function(a,b,c){function d(a,b){postMessage({type:"getFile",name:a,id:++g}),h[g]=b}function e(a,b,c){c&&importScripts.apply(null,c),f=new tern.Server({getFile:d,async:!0,defs:a,plugins:b})}var f;this.onmessage=function(a){var b=a.data;switch(b.type){case"init":return e(b.defs,b.plugins,b.scripts);case"add":return f.addFile(b.name,b.text);case"del":return f.delFile(b.name);case"req":return f.request(b.body,function(a,c){postMessage({id:b.id,body:c,err:a&&String(a)})});case"getFile":var c=h[b.id];return delete h[b.id],c(b.err,b.text);default:throw new Error("Unknown message type: "+b.type)}};var g=0,h={};this.console={log:function(a){postMessage({type:"debug",message:a})}}},{}],55:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c){for(var d=c.paragraphStart||a.getHelper(b,"paragraphStart"),e=b.line,f=a.firstLine();e>f;--e){var g=a.getLine(e);if(d&&d.test(g))break;if(!/\S/.test(g)){++e;break}}for(var h=c.paragraphEnd||a.getHelper(b,"paragraphEnd"),i=b.line+1,j=a.lastLine();i<=j;++i){var g=a.getLine(i);if(h&&h.test(g)){++i;break}if(!/\S/.test(g))break}return{from:e,to:i}}function c(a,b,c,d){for(var e=b;e<a.length&&" "==a.charAt(e);)e++;for(;e>0&&!c.test(a.slice(e-1,e+1));--e);for(var f=!0;;f=!1){var g=e;if(d)for(;" "==a.charAt(g-1);)--g;if(0!=g||!f)return{from:g,to:e};e=b}}function d(b,d,f,g){d=b.clipPos(d),f=b.clipPos(f);var h=g.column||80,i=g.wrapOn||/\s\S|-[^\.\d]/,j=g.killTrailingSpace!==!1,k=[],l="",m=d.line,n=b.getRange(d,f,!1);if(!n.length)return null;for(var o=n[0].match(/^[ \t]*/)[0],p=0;p<n.length;++p){var q=n[p],r=l.length,s=0;l&&q&&!i.test(l.charAt(l.length-1)+q.charAt(0))&&(l+=" ",s=1);var t="";if(p&&(t=q.match(/^\s*/)[0],q=q.slice(t.length)),l+=q,p){var u=l.length>h&&o==t&&c(l,h,i,j);u&&u.from==r&&u.to==r+s?(l=o+q,++m):k.push({text:[s?" ":""],from:e(m,r),to:e(m+1,t.length)})}for(;l.length>h;){var v=c(l,h,i,j);k.push({text:["",o],from:e(m,v.from),to:e(m,v.to)}),l=o+l.slice(v.to),++m}}return k.length&&b.operation(function(){for(var c=0;c<k.length;++c){var d=k[c];(d.text||a.cmpPos(d.from,d.to))&&b.replaceRange(d.text,d.from,d.to)}}),k.length?{from:k[0].from,to:a.changeEnd(k[k.length-1])}:null}var e=a.Pos;a.defineExtension("wrapParagraph",function(a,c){c=c||{},a||(a=this.getCursor());var f=b(this,a,c);return d(this,e(f.from,0),e(f.to-1),c)}),a.commands.wrapLines=function(a){a.operation(function(){for(var c=a.listSelections(),f=a.lastLine()+1,g=c.length-1;g>=0;g--){var h,i=c[g];if(i.empty()){var j=b(a,i.head,{});h={from:e(j.from,0),to:e(j.to-1)}}else h={from:i.from(),to:i.to()};h.to.line>=f||(f=h.from.line,d(a,h.from,h.to,{}))}})},a.defineExtension("wrapRange",function(a,b,c){return d(this,a,b,c||{})}),a.defineExtension("wrapParagraphsInRange",function(a,c,f){f=f||{};for(var g=this,h=[],i=a.line;i<=c.line;){var j=b(g,e(i,0),f);h.push(j),i=j.to}var k=!1;return h.length&&g.operation(function(){for(var a=h.length-1;a>=0;--a)k=k||d(g,e(h[a].from,0),e(h[a].to-1),f)}),k})})},{"../../lib/codemirror":59}],56:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b){return a.line==b.line&&a.ch==b.ch}function c(a){I.push(a),I.length>50&&I.shift()}function d(a){return I.length?void(I[I.length-1]+=a):c(a)}function e(a){return I[I.length-(a?Math.min(a,1):1)]||""}function f(){return I.length>1&&I.pop(),e()}function g(a,e,f,g,h){null==h&&(h=a.getRange(e,f)),g&&J&&J.cm==a&&b(e,J.pos)&&a.isClean(J.gen)?d(h):c(h),a.replaceRange("",e,f,"+delete"),J=g?{cm:a,pos:e,gen:a.changeGeneration()}:null}function h(a,b,c){return a.findPosH(b,c,"char",!0)}function i(a,b,c){return a.findPosH(b,c,"word",!0)}function j(a,b,c){return a.findPosV(b,c,"line",a.doc.sel.goalColumn)}function k(a,b,c){return a.findPosV(b,c,"page",a.doc.sel.goalColumn)}function l(a,b,c){for(var d=b.line,e=a.getLine(d),f=/\S/.test(c<0?e.slice(0,b.ch):e.slice(b.ch)),g=a.firstLine(),h=a.lastLine();;){if(d+=c,d<g||d>h)return a.clipPos(H(d-c,c<0?0:null));e=a.getLine(d);var i=/\S/.test(e);if(i)f=!0;else if(f)return H(d,0)}}function m(a,b,c){for(var d=b.line,e=b.ch,f=a.getLine(b.line),g=!1;;){var h=f.charAt(e+(c<0?-1:0));if(h){if(g&&/[!?.]/.test(h))return H(d,e+(c>0?1:0));g||(g=/\w/.test(h)),e+=c}else{if(d==(c<0?a.firstLine():a.lastLine()))return H(d,e);if(f=a.getLine(d+c),!/\S/.test(f))return H(d,e);d+=c,e=c<0?f.length:0}}}function n(a,c,d){var e;if(a.findMatchingBracket&&(e=a.findMatchingBracket(c,{strict:!0}))&&e.match&&(e.forward?1:-1)==d)return d>0?H(e.to.line,e.to.ch+1):e.to;for(var f=!0;;f=!1){var g=a.getTokenAt(c),h=H(c.line,d<0?g.start:g.end);if(!(f&&d>0&&g.end==c.ch)&&/\w/.test(g.string))return h;var i=a.findPosH(h,d,"char");if(b(h,i))return c;c=i}}function o(a,b){var c=a.state.emacsPrefix;return c?(w(a),"-"==c?-1:Number(c)):b?null:1}function p(a){var b="string"==typeof a?function(b){b.execCommand(a)}:a;return function(a){var c=o(a);b(a);for(var d=1;d<c;++d)b(a)}}function q(a,c,d,e){var f=o(a);f<0&&(e=-e,f=-f);for(var g=0;g<f;++g){var h=d(a,c,e);if(b(h,c))break;c=h}return c}function r(a,b){var c=function(c){c.extendSelection(q(c,c.getCursor(),a,b))};return c.motion=!0,c}function s(a,b,c){for(var d,e=a.listSelections(),f=e.length;f--;)d=e[f].head,g(a,d,q(a,d,b,c),!0)}function t(a){if(a.somethingSelected()){for(var b,c=a.listSelections(),d=c.length;d--;)b=c[d],g(a,b.anchor,b.head);return!0}}function u(a,b){return a.state.emacsPrefix?void("-"!=b&&(a.state.emacsPrefix+=b)):(a.state.emacsPrefix=b,a.on("keyHandled",v),void a.on("inputRead",x))}function v(a,b){a.state.emacsPrefixMap||K.hasOwnProperty(b)||w(a)}function w(a){a.state.emacsPrefix=null,a.off("keyHandled",v),a.off("inputRead",x)}function x(a,b){var c=o(a);if(c>1&&"+input"==b.origin){for(var d=b.text.join("\n"),e="",f=1;f<c;++f)e+=d;a.replaceSelection(e)}}function y(a){a.state.emacsPrefixMap=!0,a.addKeyMap(M),a.on("keyHandled",z),a.on("inputRead",z)}function z(a,b){("string"!=typeof b||!/^\d$/.test(b)&&"Ctrl-U"!=b)&&(a.removeKeyMap(M),a.state.emacsPrefixMap=!1,a.off("keyHandled",z),a.off("inputRead",z))}function A(a){a.setCursor(a.getCursor()),a.setExtending(!a.getExtending()),a.on("change",function(){a.setExtending(!1)})}function B(a){a.setExtending(!1),a.setCursor(a.getCursor())}function C(a,b,c){a.openDialog?a.openDialog(b+': <input type="text" style="width: 10em"/>',c,{bottom:!0}):c(prompt(b,""))}function D(a,b){var c=a.getCursor(),d=a.findPosH(c,1,"word");a.replaceRange(b(a.getRange(c,d)),c,d),a.setCursor(d)}function E(a){for(var b=a.getCursor(),c=b.line,d=b.ch,e=[];c>=a.firstLine();){for(var f=a.getLine(c),g=null==d?f.length:d;g>0;){var d=f.charAt(--g);if(")"==d)e.push("(");else if("]"==d)e.push("[");else if("}"==d)e.push("{");else if(/[\(\{\[]/.test(d)&&(!e.length||e.pop()!=d))return a.extendSelection(H(c,g))}--c,d=null}}function F(a){a.execCommand("clearSearch"),B(a)}function G(a){M[a]=function(b){u(b,a)},L["Ctrl-"+a]=function(b){u(b,a)},K["Ctrl-"+a]=!0}var H=a.Pos,I=[],J=null,K={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};a.emacs={kill:g,killRegion:t,repeated:p};for(var L=a.keyMap.emacs=a.normalizeKeyMap({"Ctrl-W":function(a){g(a,a.getCursor("start"),a.getCursor("end"))},"Ctrl-K":p(function(a){var b=a.getCursor(),c=a.clipPos(H(b.line)),d=a.getRange(b,c);/\S/.test(d)||(d+="\n",c=H(b.line+1,0)),g(a,b,c,!0,d)}),"Alt-W":function(a){c(a.getSelection()),B(a)},"Ctrl-Y":function(a){var b=a.getCursor();a.replaceRange(e(o(a)),b,b,"paste"),a.setSelection(b,a.getCursor())},"Alt-Y":function(a){a.replaceSelection(f(),"around","paste")},"Ctrl-Space":A,"Ctrl-Shift-2":A,"Ctrl-F":r(h,1),"Ctrl-B":r(h,-1),Right:r(h,1),Left:r(h,-1),"Ctrl-D":function(a){s(a,h,1)},Delete:function(a){t(a)||s(a,h,1)},"Ctrl-H":function(a){s(a,h,-1)},Backspace:function(a){t(a)||s(a,h,-1)},"Alt-F":r(i,1),"Alt-B":r(i,-1),"Alt-D":function(a){s(a,i,1)},"Alt-Backspace":function(a){s(a,i,-1)},"Ctrl-N":r(j,1),"Ctrl-P":r(j,-1),Down:r(j,1),Up:r(j,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":r(k,-1),"Ctrl-V":r(k,1),PageUp:r(k,-1),PageDown:r(k,1),"Ctrl-Up":r(l,-1),"Ctrl-Down":r(l,1),"Alt-A":r(m,-1),"Alt-E":r(m,1),"Alt-K":function(a){s(a,m,1)},"Ctrl-Alt-K":function(a){s(a,n,1)},"Ctrl-Alt-Backspace":function(a){s(a,n,-1)},"Ctrl-Alt-F":r(n,1),"Ctrl-Alt-B":r(n,-1),"Shift-Ctrl-Alt-2":function(a){var b=a.getCursor();a.setSelection(q(a,b,n,1),b)},"Ctrl-Alt-T":function(a){var b=n(a,a.getCursor(),-1),c=n(a,b,1),d=n(a,c,1),e=n(a,d,-1);a.replaceRange(a.getRange(e,d)+a.getRange(c,e)+a.getRange(b,c),b,d)},"Ctrl-Alt-U":p(E),"Alt-Space":function(a){for(var b=a.getCursor(),c=b.ch,d=b.ch,e=a.getLine(b.line);c&&/\s/.test(e.charAt(c-1));)--c;for(;d<e.length&&/\s/.test(e.charAt(d));)++d;a.replaceRange(" ",H(b.line,c),H(b.line,d))},"Ctrl-O":p(function(a){a.replaceSelection("\n","start")}),"Ctrl-T":p(function(a){a.execCommand("transposeChars")}),"Alt-C":p(function(a){D(a,function(a){var b=a.search(/\w/);return b==-1?a:a.slice(0,b)+a.charAt(b).toUpperCase()+a.slice(b+1).toLowerCase()})}),"Alt-U":p(function(a){D(a,function(a){return a.toUpperCase()})}),"Alt-L":p(function(a){D(a,function(a){return a.toLowerCase()})}),"Alt-;":"toggleComment","Ctrl-/":p("undo"),"Shift-Ctrl--":p("undo"),"Ctrl-Z":p("undo"),"Cmd-Z":p("undo"),"Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":F,"Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":p(function(a){a.replaceSelection("\n","end")}),Tab:"indentAuto","Alt-G G":function(a){var b=o(a,!0);return null!=b&&b>0?a.setCursor(b-1):void C(a,"Goto line",function(b){var c;b&&!isNaN(c=Number(b))&&c==(0|c)&&c>0&&a.setCursor(c-1)})},"Ctrl-X Tab":function(a){a.indentSelection(o(a,!0)||a.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(a){a.setSelection(a.getCursor("head"),a.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":p("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(a){g(a,a.getCursor(),m(a,a.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":p("insertTab"),"Ctrl-U":y}),M={"Ctrl-G":w},N=0;N<10;++N)G(String(N));G("-")})},{"../lib/codemirror":59}],57:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../lib/codemirror"),a("../addon/search/searchcursor"),a("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],d):d(CodeMirror)}(function(a){"use strict";function b(b,c,d){if(d<0&&0==c.ch)return b.clipPos(o(c.line-1));var e=b.getLine(c.line);if(d>0&&c.ch>=e.length)return b.clipPos(o(c.line+1,0));for(var f,g="start",h=c.ch,i=d<0?0:e.length,j=0;h!=i;h+=d,j++){var k=e.charAt(d<0?h-1:h),l="_"!=k&&a.isWordChar(k)?"w":"o";if("w"==l&&k.toUpperCase()==k&&(l="W"),"start"==g)"o"!=l&&(g="in",f=l);else if("in"==g&&f!=l){if("w"==f&&"W"==l&&d<0&&h--,"W"==f&&"w"==l&&d>0){f="w";continue}break}}return o(c.line,h)}function c(a,c){a.extendSelectionsBy(function(d){return a.display.shift||a.doc.extend||d.empty()?b(a.doc,d.head,c):c<0?d.from():d.to()})}function d(b,c){return b.isReadOnly()?a.Pass:(b.operation(function(){for(var a=b.listSelections().length,d=[],e=-1,f=0;f<a;f++){var g=b.listSelections()[f].head;if(!(g.line<=e)){var h=o(g.line+(c?0:1),0);b.replaceRange("\n",h,null,"+insertLine"),b.indentLine(h.line,null,!0), d.push({head:h,anchor:h}),e=g.line+1}}b.setSelections(d)}),void b.execCommand("indentAuto"))}function e(b,c){for(var d=c.ch,e=d,f=b.getLine(c.line);d&&a.isWordChar(f.charAt(d-1));)--d;for(;e<f.length&&a.isWordChar(f.charAt(e));)++e;return{from:o(c.line,d),to:o(c.line,e),word:f.slice(d,e)}}function f(a,b){for(var c=a.listSelections(),d=[],e=0;e<c.length;e++){var f=c[e],g=a.findPosV(f.anchor,b,"line"),h=a.findPosV(f.head,b,"line"),i={anchor:g,head:h};d.push(f),d.push(i)}a.setSelections(d)}function g(a,b,c){for(var d=0;d<a.length;d++)if(a[d].from()==b&&a[d].to()==c)return!0;return!1}function h(a){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d],f=e.head,g=a.scanForBracket(f,-1);if(!g)return!1;for(;;){var h=a.scanForBracket(f,1);if(!h)return!1;if(h.ch==u.charAt(u.indexOf(g.ch)+1)){c.push({anchor:o(g.pos.line,g.pos.ch+1),head:h.pos});break}f=o(h.pos.line,h.pos.ch+1)}}return a.setSelections(c),!0}function i(b,c){if(b.isReadOnly())return a.Pass;for(var d,e=b.listSelections(),f=[],g=0;g<e.length;g++){var h=e[g];if(!h.empty()){for(var i=h.from().line,j=h.to().line;g<e.length-1&&e[g+1].from().line==j;)j=e[++g].to().line;e[g].to().ch||j--,f.push(i,j)}}f.length?d=!0:f.push(b.firstLine(),b.lastLine()),b.operation(function(){for(var a=[],e=0;e<f.length;e+=2){var g=f[e],h=f[e+1],i=o(g,0),j=o(h),k=b.getRange(i,j,!1);c?k.sort():k.sort(function(a,b){var c=a.toUpperCase(),d=b.toUpperCase();return c!=d&&(a=c,b=d),a<b?-1:a==b?0:1}),b.replaceRange(k,i,j),d&&a.push({anchor:i,head:o(h+1,0)})}d&&b.setSelections(a,0)})}function j(b,c){b.operation(function(){for(var d=b.listSelections(),f=[],g=[],h=0;h<d.length;h++){var i=d[h];i.empty()?(f.push(h),g.push("")):g.push(c(b.getRange(i.from(),i.to())))}b.replaceSelections(g,"around","case");for(var j,h=f.length-1;h>=0;h--){var i=d[f[h]];if(!(j&&a.cmpPos(i.head,j)>0)){var k=e(b,i.head);j=k.from,b.replaceRange(c(k.word),k.from,k.to)}}})}function k(b){var c=b.getCursor("from"),d=b.getCursor("to");if(0==a.cmpPos(c,d)){var f=e(b,c);if(!f.word)return;c=f.from,d=f.to}return{from:c,to:d,query:b.getRange(c,d),word:f}}function l(a,b){var c=k(a);if(c){var d=c.query,e=a.getSearchCursor(d,b?c.to:c.from);(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):(e=a.getSearchCursor(d,b?o(a.firstLine(),0):a.clipPos(o(a.lastLine()))),(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):c.word&&a.setSelection(c.from,c.to))}}var m=a.keyMap.sublime={fallthrough:"default"},n=a.commands,o=a.Pos,p=a.keyMap["default"]==a.keyMap.macDefault,q=p?"Cmd-":"Ctrl-",r=p?"Ctrl-":"Alt-";n[m[r+"Left"]="goSubwordLeft"]=function(a){c(a,-1)},n[m[r+"Right"]="goSubwordRight"]=function(a){c(a,1)},p&&(m["Cmd-Left"]="goLineStartSmart");var s=p?"Ctrl-Alt-":"Ctrl-";n[m[s+"Up"]="scrollLineUp"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top+b.clientHeight,"local");a.getCursor().line>=c&&a.execCommand("goLineUp")}a.scrollTo(null,b.top-a.defaultTextHeight())},n[m[s+"Down"]="scrollLineDown"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,"local")+1;a.getCursor().line<=c&&a.execCommand("goLineDown")}a.scrollTo(null,b.top+a.defaultTextHeight())},n[m["Shift-"+q+"L"]="splitSelectionByLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)for(var e=b[d].from(),f=b[d].to(),g=e.line;g<=f.line;++g)f.line>e.line&&g==f.line&&0==f.ch||c.push({anchor:g==e.line?e:o(g,0),head:g==f.line?f:o(g)});a.setSelections(c,0)},m["Shift-Tab"]="indentLess",n[m.Esc="singleSelectionTop"]=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})},n[m[q+"L"]="selectLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d];c.push({anchor:o(e.from().line,0),head:o(e.to().line+1,0)})}a.setSelections(c)},m["Shift-Ctrl-K"]="deleteLine",n[m[q+"Enter"]="insertLineAfter"]=function(a){return d(a,!1)},n[m["Shift-"+q+"Enter"]="insertLineBefore"]=function(a){return d(a,!0)},n[m[q+"D"]="selectNextOccurrence"]=function(b){var c=b.getCursor("from"),d=b.getCursor("to"),f=b.state.sublimeFindFullWord==b.doc.sel;if(0==a.cmpPos(c,d)){var h=e(b,c);if(!h.word)return;b.setSelection(h.from,h.to),f=!0}else{var i=b.getRange(c,d),j=f?new RegExp("\\b"+i+"\\b"):i,k=b.getSearchCursor(j,d),l=k.findNext();if(l||(k=b.getSearchCursor(j,o(b.firstLine(),0)),l=k.findNext()),!l||g(b.listSelections(),k.from(),k.to()))return a.Pass;b.addSelection(k.from(),k.to())}f&&(b.state.sublimeFindFullWord=b.doc.sel)};var t=p?"Shift-Cmd":"Alt-Ctrl";n[m[t+"Up"]="addCursorToPrevLine"]=function(a){f(a,-1)},n[m[t+"Down"]="addCursorToNextLine"]=function(a){f(a,1)};var u="(){}[]";n[m["Shift-"+q+"Space"]="selectScope"]=function(a){h(a)||a.execCommand("selectAll")},n[m["Shift-"+q+"M"]="selectBetweenBrackets"]=function(b){if(!h(b))return a.Pass},n[m[q+"M"]="goToBracket"]=function(b){b.extendSelectionsBy(function(c){var d=b.scanForBracket(c.head,1);if(d&&0!=a.cmpPos(d.pos,c.head))return d.pos;var e=b.scanForBracket(c.head,-1);return e&&o(e.pos.line,e.pos.ch+1)||c.head})};var v=p?"Cmd-Ctrl-":"Shift-Ctrl-";n[m[v+"Up"]="swapLineUp"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.firstLine()-1,f=[],g=0;g<c.length;g++){var h=c[g],i=h.from().line-1,j=h.to().line;f.push({anchor:o(h.anchor.line-1,h.anchor.ch),head:o(h.head.line-1,h.head.ch)}),0!=h.to().ch||h.empty()||--j,i>e?d.push(i,j):d.length&&(d[d.length-1]=j),e=j}b.operation(function(){for(var a=0;a<d.length;a+=2){var c=d[a],e=d[a+1],g=b.getLine(c);b.replaceRange("",o(c,0),o(c+1,0),"+swapLine"),e>b.lastLine()?b.replaceRange("\n"+g,o(b.lastLine()),null,"+swapLine"):b.replaceRange(g+"\n",o(e,0),null,"+swapLine")}b.setSelections(f),b.scrollIntoView()})},n[m[v+"Down"]="swapLineDown"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,f=c.length-1;f>=0;f--){var g=c[f],h=g.to().line+1,i=g.from().line;0!=g.to().ch||g.empty()||h--,h<e?d.push(h,i):d.length&&(d[d.length-1]=i),e=i}b.operation(function(){for(var a=d.length-2;a>=0;a-=2){var c=d[a],e=d[a+1],f=b.getLine(c);c==b.lastLine()?b.replaceRange("",o(c-1),o(c),"+swapLine"):b.replaceRange("",o(c,0),o(c+1,0),"+swapLine"),b.replaceRange(f+"\n",o(e,0),null,"+swapLine")}b.scrollIntoView()})},n[m[q+"/"]="toggleCommentIndented"]=function(a){a.toggleComment({indent:!0})},n[m[q+"J"]="joinLines"]=function(a){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){for(var e=b[d],f=e.from(),g=f.line,h=e.to().line;d<b.length-1&&b[d+1].from().line==h;)h=b[++d].to().line;c.push({start:g,end:h,anchor:!e.empty()&&f})}a.operation(function(){for(var b=0,d=[],e=0;e<c.length;e++){for(var f,g=c[e],h=g.anchor&&o(g.anchor.line-b,g.anchor.ch),i=g.start;i<=g.end;i++){var j=i-b;i==g.end&&(f=o(j,a.getLine(j).length+1)),j<a.lastLine()&&(a.replaceRange(" ",o(j),o(j+1,/^\s*/.exec(a.getLine(j+1))[0].length)),++b)}d.push({anchor:h||f,head:f})}a.setSelections(d,0)})},n[m["Shift-"+q+"D"]="duplicateLine"]=function(a){a.operation(function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];d.empty()?a.replaceRange(a.getLine(d.head.line)+"\n",o(d.head.line,0)):a.replaceRange(a.getRange(d.from(),d.to()),d.from())}a.scrollIntoView()})},p||(m[q+"T"]="transposeChars"),n[m.F9="sortLines"]=function(a){i(a,!0)},n[m[q+"F9"]="sortLinesInsensitive"]=function(a){i(a,!1)},n[m.F2="nextBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){var c=b.shift(),d=c.find();if(d)return b.push(c),a.setSelection(d.from,d.to)}},n[m["Shift-F2"]="prevBookmark"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(;b.length;){b.unshift(b.pop());var c=b[b.length-1].find();if(c)return a.setSelection(c.from,c.to);b.pop()}},n[m[q+"F2"]="toggleBookmark"]=function(a){for(var b=a.listSelections(),c=a.state.sublimeBookmarks||(a.state.sublimeBookmarks=[]),d=0;d<b.length;d++){for(var e=b[d].from(),f=b[d].to(),g=a.findMarks(e,f),h=0;h<g.length;h++)if(g[h].sublimeBookmark){g[h].clear();for(var i=0;i<c.length;i++)c[i]==g[h]&&c.splice(i--,1);break}h==g.length&&c.push(a.markText(e,f,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},n[m["Shift-"+q+"F2"]="clearBookmarks"]=function(a){var b=a.state.sublimeBookmarks;if(b)for(var c=0;c<b.length;c++)b[c].clear();b.length=0},n[m["Alt-F2"]="selectBookmarks"]=function(a){var b=a.state.sublimeBookmarks,c=[];if(b)for(var d=0;d<b.length;d++){var e=b[d].find();e?c.push({anchor:e.from,head:e.to}):b.splice(d--,0)}c.length&&a.setSelections(c,0)},m["Alt-Q"]="wrapLines";var w=q+"K ";m[w+q+"Backspace"]="delLineLeft",n[m.Backspace="smartBackspace"]=function(b){return b.somethingSelected()?a.Pass:void b.operation(function(){for(var c=b.listSelections(),d=b.getOption("indentUnit"),e=c.length-1;e>=0;e--){var f=c[e].head,g=b.getRange({line:f.line,ch:0},f),h=a.countColumn(g,null,b.getOption("tabSize")),i=b.findPosH(f,-1,"char",!1);if(g&&!/\S/.test(g)&&h%d==0){var j=new o(f.line,a.findColumn(g,h-d,d));j.ch!=f.ch&&(i=j)}b.replaceRange("",i,f,"+delete")}})},n[m[w+q+"K"]="delLineRight"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange("",b[c].anchor,o(b[c].to().line),"+delete");a.scrollIntoView()})},n[m[w+q+"U"]="upcaseAtCursor"]=function(a){j(a,function(a){return a.toUpperCase()})},n[m[w+q+"L"]="downcaseAtCursor"]=function(a){j(a,function(a){return a.toLowerCase()})},n[m[w+q+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},n[m[w+q+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},n[m[w+q+"W"]="deleteToSublimeMark"]=function(b){var c=b.state.sublimeMark&&b.state.sublimeMark.find();if(c){var d=b.getCursor(),e=c;if(a.cmpPos(d,e)>0){var f=e;e=d,d=f}b.state.sublimeKilled=b.getRange(d,e),b.replaceRange("",d,e)}},n[m[w+q+"X"]="swapWithSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&(a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor()),a.setCursor(b))},n[m[w+q+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},m[w+q+"G"]="clearBookmarks",n[m[w+q+"C"]="showInCenter"]=function(a){var b=a.cursorCoords(null,"local");a.scrollTo(null,(b.top+b.bottom)/2-a.getScrollInfo().clientHeight/2)};var x=p?"Ctrl-Shift-":"Ctrl-Alt-";n[m[x+"Up"]="selectLinesUpward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c];d.head.line>a.firstLine()&&a.addSelection(o(d.head.line-1,d.head.ch))}})},n[m[x+"Down"]="selectLinesDownward"]=function(a){a.operation(function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c];d.head.line<a.lastLine()&&a.addSelection(o(d.head.line+1,d.head.ch))}})},n[m[q+"F3"]="findUnder"]=function(a){l(a,!0)},n[m["Shift-"+q+"F3"]="findUnderPrevious"]=function(a){l(a,!1)},n[m["Alt-F3"]="findAllUnder"]=function(a){var b=k(a);if(b){for(var c=a.getSearchCursor(b.query),d=[],e=-1;c.findNext();)d.push({anchor:c.from(),head:c.to()}),c.from().line<=b.from.line&&c.from().ch<=b.from.ch&&e++;a.setSelections(d,e)}},m["Shift-"+q+"["]="fold",m["Shift-"+q+"]"]="unfold",m[w+q+"0"]=m[w+q+"J"]="unfoldAll",m[q+"I"]="findIncremental",m["Shift-"+q+"I"]="findIncrementalReverse",m[q+"H"]="replace",m.F3="findNext",m["Shift-F3"]="findPrev",a.normalizeKeyMap(m)})},{"../addon/edit/matchbrackets":12,"../addon/search/searchcursor":49,"../lib/codemirror":59}],58:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../lib/codemirror"),a("../addon/search/searchcursor"),a("../addon/dialog/dialog"),a("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],d):d(CodeMirror)}(function(a){"use strict";var b=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],c=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],d=a.Pos,e=function(){function e(b){b.setOption("disableInput",!0),b.setOption("showCursorWhenSelecting",!1),a.signal(b,"vim-mode-change",{mode:"normal"}),b.on("cursorActivity",bb),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",bb),a.off(b.getInputField(),"paste",k(b)),b.state.vim=null}function g(b,c){this==a.keyMap.vim&&a.rmClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||f(b)}function h(b,c){this==a.keyMap.vim&&a.addClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||e(b)}function i(b,c){if(c){if(this[b])return this[b];var d=j(b);if(!d)return!1;var e=a.Vim.findKey(c,d);return"function"==typeof e&&a.signal(c,"vim-keypress",d),e}}function j(a){if("'"==a.charAt(0))return a.charAt(1);var b=a.split(/-(?!$)/),c=b[b.length-1];if(1==b.length&&1==b[0].length)return!1;if(2==b.length&&"Shift"==b[0]&&1==c.length)return!1;for(var d=!1,e=0;e<b.length;e++){var f=b[e];f in ib?b[e]=ib[f]:d=!0,f in jb&&(b[e]=jb[f])}return!!d&&(q(c)&&(b[b.length-1]=c.toLowerCase()),"<"+b.join("-")+">")}function k(a){var b=a.state.vim;return b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),Bb.enterInsertMode(a,{},b))}),b.onPasteFn}function l(a,b){for(var c=[],d=a;d<a+b;d++)c.push(String.fromCharCode(d));return c}function m(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function n(a){return/^[a-z]$/.test(a)}function o(a){return"()[]{}".indexOf(a)!=-1}function p(a){return kb.test(a)}function q(a){return/^[A-Z]$/.test(a)}function r(a){return/^\s*$/.test(a)}function s(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return!0;return!1}function t(a,b,c,d,e){if(void 0===b&&!e)throw Error("defaultValue is required unless callback is provided");if(c||(c="string"),sb[a]={type:c,defaultValue:b,callback:e},d)for(var f=0;f<d.length;f++)sb[d[f]]=sb[a];b&&u(a,b)}function u(a,b,c,d){var e=sb[a];d=d||{};var f=d.scope;if(!e)return new Error("Unknown option: "+a);if("boolean"==e.type){if(b&&b!==!0)return new Error("Invalid argument: "+a+"="+b);b!==!1&&(b=!0)}e.callback?("local"!==f&&e.callback(b,void 0),"global"!==f&&c&&e.callback(b,c)):("local"!==f&&(e.value="boolean"==e.type?!!b:b),"global"!==f&&c&&(c.state.vim.options[a]={value:b}))}function v(a,b,c){var d=sb[a];c=c||{};var e=c.scope;if(!d)return new Error("Unknown option: "+a);{if(!d.callback){var f="global"!==e&&b&&b.state.vim.options[a];return(f||"local"!==e&&d||{}).value}var f=b&&d.callback(void 0,b);if("global"!==e&&void 0!==f)return f;if("local"!==e)return d.callback()}}function w(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ub()}function x(a){return a.state.vim||(a.state.vim={inputState:new z,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),a.state.vim}function y(){vb={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:tb(),macroModeState:new w,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new D({}),searchHistoryController:new E,exCommandHistoryController:new E};for(var a in sb){var b=sb[a];b.value=b.defaultValue}}function z(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function A(b,c){b.state.vim.inputState=new z,a.signal(b,"vim-command-done",c)}function B(a,b,c){this.clear(),this.keyBuffer=[a||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!b,this.blockwise=!!c}function C(a,b){var c=vb.registerController.registers;if(!a||1!=a.length)throw Error("Register name must be 1 character");if(c[a])throw Error("Register already defined "+a);c[a]=b,rb.push(a)}function D(a){this.registers=a,this.unnamedRegister=a['"']=new B,a["."]=new B,a[":"]=new B,a["/"]=new B}function E(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}function F(a,b){zb[a]=b}function G(a,b){for(var c=[],d=0;d<b;d++)c.push(a);return c}function H(a,b){Ab[a]=b}function I(a,b){Bb[a]=b}function J(a,b,c){var e=Math.min(Math.max(a.firstLine(),b.line),a.lastLine()),f=X(a,e)-1;f=c?f+1:f;var g=Math.min(Math.max(0,b.ch),f);return d(e,g)}function K(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function L(a,b,c){return"object"==typeof b&&(c=b.ch,b=b.line),d(a.line+b,a.ch+c)}function M(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function N(a,b,c,d){for(var e,f=[],g=[],h=0;h<b.length;h++){var i=b[h];"insert"==c&&"insert"!=i.context||i.context&&i.context!=c||d.operator&&"action"==i.type||!(e=O(a,i.keys))||("partial"==e&&f.push(i),"full"==e&&g.push(i))}return{partial:f.length&&f,full:g.length&&g}}function O(a,b){if("<character>"==b.slice(-11)){var c=b.length-11,d=a.slice(0,c),e=b.slice(0,c);return d==e&&a.length>c?"full":0==e.indexOf(d)&&"partial"}return a==b?"full":0==b.indexOf(a)&&"partial"}function P(a){var b=/^.*(<[^>]+>)$/.exec(a),c=b?b[1]:a.slice(-1);if(c.length>1)switch(c){case"<CR>":c="\n";break;case"<Space>":c=" ";break;default:c=""}return c}function Q(a,b,c){return function(){for(var d=0;d<c;d++)b(a)}}function R(a){return d(a.line,a.ch)}function S(a,b){return a.ch==b.ch&&a.line==b.line}function T(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function U(a,b){return arguments.length>2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?a:b}function V(a,b){return arguments.length>2&&(b=V.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?b:a}function W(a,b,c){var d=T(a,b),e=T(b,c);return d&&e}function X(a,b){return a.getLine(b).length}function Y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Z(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function $(a,b,c){var e=X(a,b),f=new Array(c-e+1).join(" ");a.setCursor(d(b,e)),a.replaceRange(f,a.getCursor())}function _(a,b){var c=[],e=a.listSelections(),f=R(a.clipPos(b)),g=!S(b,f),h=a.getCursor("head"),i=ba(e,h),j=S(e[i].head,e[i].anchor),k=e.length-1,l=k-i>i?k:0,m=e[l].anchor,n=Math.min(m.line,f.line),o=Math.max(m.line,f.line),p=m.ch,q=f.ch,r=e[l].head.ch-p,s=q-p;r>0&&s<=0?(p++,g||q--):r<0&&s>=0?(p--,j||q++):r<0&&s==-1&&(p--,q++);for(var t=n;t<=o;t++){var u={anchor:new d(t,p),head:new d(t,q)};c.push(u)}return a.setSelections(c),b.ch=q,m.ch=p,m}function aa(a,b,c){for(var d=[],e=0;e<c;e++){var f=L(b,e,0);d.push({anchor:f,head:f})}a.setSelections(d,0)}function ba(a,b,c){for(var d=0;d<a.length;d++){var e="head"!=c&&S(a[d].anchor,b),f="anchor"!=c&&S(a[d].head,b);if(e||f)return d}return-1}function ca(a,b){var c=b.lastSelection,e=function(){var b=a.listSelections(),c=b[0],d=b[b.length-1],e=T(c.anchor,c.head)?c.anchor:c.head,f=T(d.anchor,d.head)?d.head:d.anchor;return[e,f]},f=function(){var b=a.getCursor(),e=a.getCursor(),f=c.visualBlock;if(f){var g=f.width,h=f.height;e=d(b.line+h,b.ch+g);for(var i=[],j=b.line;j<e.line;j++){var k=d(j,b.ch),l=d(j,e.ch),m={anchor:k,head:l};i.push(m)}a.setSelections(i)}else{var n=c.anchorMark.find(),o=c.headMark.find(),p=o.line-n.line,q=o.ch-n.ch;e={line:e.line+p,ch:p?e.ch:q+e.ch},c.visualLine&&(b=d(b.line,0),e=d(e.line,X(a,e.line))),a.setSelection(b,e)}return[b,e]};return b.visualMode?e():f()}function da(a,b){var c=b.sel.anchor,d=b.sel.head;b.lastPastedText&&(d=a.posFromIndex(a.indexFromPos(c)+b.lastPastedText.length),b.lastPastedText=null),b.lastSelection={anchorMark:a.setBookmark(c), headMark:a.setBookmark(d),anchor:R(c),head:R(d),visualMode:b.visualMode,visualLine:b.visualLine,visualBlock:b.visualBlock}}function ea(a,b,c){var e,f=a.state.vim.sel,g=f.head,h=f.anchor;return T(c,b)&&(e=c,c=b,b=e),T(g,h)?(g=U(b,g),h=V(h,c)):(h=U(b,h),g=V(g,c),g=L(g,0,-1),g.ch==-1&&g.line!=a.firstLine()&&(g=d(g.line-1,X(a,g.line-1)))),[h,g]}function fa(a,b,c){var d=a.state.vim;b=b||d.sel;var c=c||d.visualLine?"line":d.visualBlock?"block":"char",e=ga(a,b,c);a.setSelections(e.ranges,e.primary),cb(a)}function ga(a,b,c,e){var f=R(b.head),g=R(b.anchor);if("char"==c){var h=e||T(b.head,b.anchor)?0:1,i=T(b.head,b.anchor)?1:0;return f=L(b.head,0,h),g=L(b.anchor,0,i),{ranges:[{anchor:g,head:f}],primary:0}}if("line"==c){if(T(b.head,b.anchor))f.ch=0,g.ch=X(a,g.line);else{g.ch=0;var j=a.lastLine();f.line>j&&(f.line=j),f.ch=X(a,f.line)}return{ranges:[{anchor:g,head:f}],primary:0}}if("block"==c){for(var k=Math.min(g.line,f.line),l=Math.min(g.ch,f.ch),m=Math.max(g.line,f.line),n=Math.max(g.ch,f.ch)+1,o=m-k+1,p=f.line==k?0:o-1,q=[],r=0;r<o;r++)q.push({anchor:d(k+r,l),head:d(k+r,n)});return{ranges:q,primary:p}}}function ha(a){var b=a.getCursor("head");return 1==a.getSelection().length&&(b=U(b,a.getCursor("anchor"))),b}function ia(b,c){var d=b.state.vim;c!==!1&&b.setCursor(J(b,d.sel.head)),da(b,d),d.visualMode=!1,d.visualLine=!1,d.visualBlock=!1,a.signal(b,"vim-mode-change",{mode:"normal"}),d.fakeCursor&&d.fakeCursor.clear()}function ja(a,b,c){var d=a.getRange(b,c);if(/\n\s*$/.test(d)){var e=d.split("\n");e.pop();for(var f,f=e.pop();e.length>0&&f&&r(f);f=e.pop())c.line--,c.ch=0;f?(c.line--,c.ch=X(a,c.line)):c.ch=0}}function ka(a,b,c){b.ch=0,c.ch=0,c.line++}function la(a){if(!a)return 0;var b=a.search(/\S/);return b==-1?a.length:b}function ma(a,b,c,e,f){for(var g=ha(a),h=a.getLine(g.line),i=g.ch,j=f?lb[0]:mb[0];!j(h.charAt(i));)if(i++,i>=h.length)return null;e?j=mb[0]:(j=lb[0],j(h.charAt(i))||(j=lb[1]));for(var k=i,l=i;j(h.charAt(k))&&k<h.length;)k++;for(;j(h.charAt(l))&&l>=0;)l--;if(l++,b){for(var m=k;/\s/.test(h.charAt(k))&&k<h.length;)k++;if(m==k){for(var n=l;/\s/.test(h.charAt(l-1))&&l>0;)l--;l||(l=n)}}return{start:d(g.line,l),end:d(g.line,k)}}function na(a,b,c){S(b,c)||vb.jumpList.add(a,b,c)}function oa(a,b){vb.lastCharacterSearch.increment=a,vb.lastCharacterSearch.forward=b.forward,vb.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function pa(a,b,c,e){var f=R(a.getCursor()),g=c?1:-1,h=c?a.lineCount():-1,i=f.ch,j=f.line,k=a.getLine(j),l={lineText:k,nextCh:k.charAt(i),lastCh:null,index:i,symb:e,reverseSymb:(c?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:c,depth:0,curMoveThrough:!1},m=Cb[e];if(!m)return f;var n=Db[m].init,o=Db[m].isComplete;for(n&&n(l);j!==h&&b;){if(l.index+=g,l.nextCh=l.lineText.charAt(l.index),!l.nextCh){if(j+=g,l.lineText=a.getLine(j)||"",g>0)l.index=0;else{var p=l.lineText.length;l.index=p>0?p-1:0}l.nextCh=l.lineText.charAt(l.index)}o(l)&&(f.line=j,f.ch=l.index,b--)}return l.nextCh||l.curMoveThrough?d(j,l.index):f}function qa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?mb:lb;if(e&&""==h){if(f+=i,h=a.getLine(f),!m(a,f))return null;g=c?0:h.length}for(;;){if(e&&""==h)return{from:0,to:0,line:f};for(var k=i>0?h.length:-1,l=k,n=k;g!=k;){for(var o=!1,p=0;p<j.length&&!o;++p)if(j[p](h.charAt(g))){for(l=g;g!=k&&j[p](h.charAt(g));)g+=i;if(n=g,o=l!=n,l==b.ch&&f==b.line&&n==l+i)continue;return{from:Math.min(l,n+1),to:Math.max(l,n),line:f}}o||(g+=i)}if(f+=i,!m(a,f))return null;h=a.getLine(f),g=i>0?0:h.length}}function ra(a,b,c,e,f,g){var h=R(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;k<c;k++){var l=qa(a,b,e,g,j);if(!l){var m=X(a,a.lastLine());i.push(e?{line:a.lastLine(),from:m,to:m}:{line:0,from:0,to:0});break}i.push(l),b=d(l.line,e?l.to-1:l.from)}var n=i.length!=c,o=i[0],p=i.pop();return e&&!f?(n||o.from==h.ch&&o.line==h.line||(p=i.pop()),d(p.line,p.from)):e&&f?d(p.line,p.to-1):!e&&f?(n||o.to==h.ch&&o.line==h.line||(p=i.pop()),d(p.line,p.to)):d(p.line,p.from)}function sa(a,b,c,e){for(var f,g=a.getCursor(),h=g.ch,i=0;i<b;i++){var j=a.getLine(g.line);if(f=va(h,j,e,c,!0),f==-1)return null;h=f}return d(a.getCursor().line,f)}function ta(a,b){var c=a.getCursor().line;return J(a,d(c,b-1))}function ua(a,b,c,d){s(c,qb)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function va(a,b,c,d,e){var f;return d?(f=b.indexOf(c,a+1),f==-1||e||(f-=1)):(f=b.lastIndexOf(c,a-1),f==-1||e||(f+=1)),f}function wa(a,b,c,e,f){function g(b){return!a.getLine(b)}function h(a,b,c){return c?g(a)!=g(a+b):!g(a)&&g(a+b)}var i,j,k=b.line,l=a.firstLine(),m=a.lastLine(),n=k;if(e){for(;l<=n&&n<=m&&c>0;)h(n,e)&&c--,n+=e;return new d(n,0)}var o=a.state.vim;if(o.visualLine&&h(k,1,!0)){var p=o.sel.anchor;h(p.line,-1,!0)&&(f&&p.line==k||(k+=1))}var q=g(k);for(n=k;n<=m&&c;n++)h(n,1,!0)&&(f&&g(n)==q||c--);for(j=new d(n,0),n>m&&!q?q=!0:f=!1,n=k;n>l&&(f&&g(n)!=q&&n!=k||!h(n,-1,!0));n--);return i=new d(n,0),{start:i,end:j}}function xa(a,b,c,e){var f,g,h=b,i={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[c],j={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[c],k=a.getLine(h.line).charAt(h.ch),l=k===j?1:0;if(f=a.scanForBracket(d(h.line,h.ch+l),-1,null,{bracketRegex:i}),g=a.scanForBracket(d(h.line,h.ch+l),1,null,{bracketRegex:i}),!f||!g)return{start:h,end:h};if(f=f.pos,g=g.pos,f.line==g.line&&f.ch>g.ch||f.line>g.line){var m=f;f=g,g=m}return e?g.ch+=1:f.ch+=1,{start:f,end:g}}function ya(a,b,c,e){var f,g,h,i,j=R(b),k=a.getLine(j.line),l=k.split(""),m=l.indexOf(c);if(j.ch<m?j.ch=m:m<j.ch&&l[j.ch]==c&&(g=j.ch,--j.ch),l[j.ch]!=c||g)for(h=j.ch;h>-1&&!f;h--)l[h]==c&&(f=h+1);else f=j.ch+1;if(f&&!g)for(h=f,i=l.length;h<i&&!g;h++)l[h]==c&&(g=h);return f&&g?(e&&(--f,++g),{start:d(j.line,f),end:d(j.line,g)}):{start:j,end:j}}function za(){}function Aa(a){var b=a.state.vim;return b.searchState_||(b.searchState_=new za)}function Ba(a,b,c,d,e){a.openDialog?a.openDialog(b,d,{bottom:!0,value:e.value,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,""))}function Ca(a){var b=Da(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d<b.length;d++)"number"==typeof b[d]&&c.push(a.substring(b[d]+1,b[d+1]));return c}}function Da(a){for(var b=!1,c=[],d=0;d<a.length;d++){var e=a.charAt(d);b||"/"!=e||c.push(d),b=!b&&"\\"==e}return c}function Ea(a){for(var b="|(){",c="}",d=!1,e=[],f=-1;f<a.length;f++){var g=a.charAt(f)||"",h=a.charAt(f+1)||"",i=h&&b.indexOf(h)!=-1;d?("\\"===g&&i||e.push(g),d=!1):"\\"===g?(d=!0,h&&c.indexOf(h)!=-1&&(i=!0),i&&"\\"!==h||e.push(g)):(e.push(g),i&&"\\"!==h&&e.push("\\"))}return e.join("")}function Fa(a){for(var b=!1,c=[],d=-1;d<a.length;d++){var e=a.charAt(d)||"",f=a.charAt(d+1)||"";Eb[e+f]?(c.push(Eb[e+f]),d++):b?(c.push(e),b=!1):"\\"===e?(b=!0,p(f)||"$"===f?c.push("$"):"/"!==f&&"\\"!==f&&c.push("\\")):("$"===e&&c.push("$"),c.push(e),"/"===f&&c.push("\\"))}return c.join("")}function Ga(b){for(var c=new a.StringStream(b),d=[];!c.eol();){for(;c.peek()&&"\\"!=c.peek();)d.push(c.next());var e=!1;for(var f in Fb)if(c.match(f,!0)){e=!0,d.push(Fb[f]);break}e||d.push(c.next())}return d.join("")}function Ha(a,b,c){var d=vb.registerController.getRegister("/");if(d.setText(a),a instanceof RegExp)return a;var e,f,g=Da(a);if(g.length){e=a.substring(0,g[0]);var h=a.substring(g[0]);f=h.indexOf("i")!=-1}else e=a;if(!e)return null;v("pcre")||(e=Ea(e)),c&&(b=/^[^A-Z]*$/.test(e));var i=new RegExp(e,b||f?"i":void 0);return i}function Ia(a,b){a.openNotification?a.openNotification('<span style="color: red">'+b+"</span>",{bottom:!0,duration:5e3}):alert(b)}function Ja(a,b){var c='<span style="font-family: monospace; white-space: pre">'+(a||"")+'<input type="text"></span>';return b&&(c+=' <span style="color: #888">'+b+"</span>"),c}function Ka(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ja(b.prefix,b.desc);Ba(a,d,c,b.onClose,b)}function La(a,b){if(a instanceof RegExp&&b instanceof RegExp){for(var c=["global","multiline","ignoreCase","source"],d=0;d<c.length;d++){var e=c[d];if(a[e]!==b[e])return!1}return!0}return!1}function Ma(a,b,c,d){if(b){var e=Aa(a),f=Ha(b,!!c,!!d);if(f)return Oa(a,f),La(f,e.getQuery())?f:(e.setQuery(f),f)}}function Na(a){if("^"==a.source.charAt(0))var b=!0;return{token:function(c){if(b&&!c.sol())return void c.skipToEnd();var d=c.match(a,!1);if(d)return 0==d[0].length?(c.next(),"searching"):c.sol()||(c.backUp(1),a.exec(c.next()+d[0]))?(c.match(a),"searching"):(c.next(),null);for(;!c.eol()&&(c.next(),!c.match(a,!1)););},query:a}}function Oa(a,b){var c=Aa(a),d=c.getOverlay();d&&b==d.query||(d&&a.removeOverlay(d),d=Na(b),a.addOverlay(d),a.showMatchesOnScrollbar&&(c.getScrollbarAnnotate()&&c.getScrollbarAnnotate().clear(),c.setScrollbarAnnotate(a.showMatchesOnScrollbar(b))),c.setOverlay(d))}function Pa(a,b,c,e){return void 0===e&&(e=1),a.operation(function(){for(var f=a.getCursor(),g=a.getSearchCursor(c,f),h=0;h<e;h++){var i=g.find(b);if(0==h&&i&&S(g.from(),f)&&(i=g.find(b)),!i&&(g=a.getSearchCursor(c,b?d(a.lastLine()):d(a.firstLine(),0)),!g.find(b)))return}return g.from()})}function Qa(a){var b=Aa(a);a.removeOverlay(Aa(a).getOverlay()),b.setOverlay(null),b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}function Ra(a,b,c){return"number"!=typeof a&&(a=a.line),b instanceof Array?s(a,b):c?a>=b&&a<=c:a==b}function Sa(a){var b=a.getScrollInfo(),c=6,d=10,e=a.coordsChar({left:0,top:c+b.top},"local"),f=b.clientHeight-d+b.top,g=a.coordsChar({left:0,top:f},"local");return{top:e.line,bottom:g.line}}function Ta(a,b,c){if("'"==c){var d=a.doc.history.done,e=d[d.length-2];return e&&e.ranges&&e.ranges[0].head}var f=b.marks[c];return f&&f.find()}function Ua(b,c,d,e,f,g,h,i,j){function k(){b.operation(function(){for(;!p;)l(),m();n()})}function l(){var a=b.getRange(g.from(),g.to()),c=a.replace(h,i);g.replace(c)}function m(){for(;g.findNext()&&Ra(g.from(),e,f);)if(d||!q||g.from().line!=q.line)return b.scrollIntoView(g.from(),30),b.setSelection(g.from(),g.to()),q=g.from(),void(p=!1);p=!0}function n(a){if(a&&a(),b.focus(),q){b.setCursor(q);var c=b.state.vim;c.exMode=!1,c.lastHPos=c.lastHSPos=q.ch}j&&j()}function o(c,d,e){a.e_stop(c);var f=a.keyName(c);switch(f){case"Y":l(),m();break;case"N":m();break;case"A":var g=j;j=void 0,b.operation(k),j=g;break;case"L":l();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":n(e)}return p&&n(e),!0}b.state.vim.exMode=!0;var p=!1,q=g.from();return m(),p?void Ia(b,"No matches for "+h.source):c?void Ka(b,{prefix:"replace with <strong>"+i+"</strong> (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Va(b){var c=b.state.vim,d=vb.macroModeState,e=vb.registerController.getRegister("."),f=d.isPlaying,g=d.lastInsertModeChanges,h=[];if(!f){for(var i=g.inVisualBlock?c.lastSelection.visualBlock.height:1,j=g.changes,h=[],k=0;k<j.length;)h.push(j[k]),j[k]instanceof eb?k++:k+=i;g.changes=h,b.off("change",ab),a.off(b.getInputField(),"keydown",fb)}!f&&c.insertModeRepeat>1&&(gb(b,c,c.insertModeRepeat-1,!0),c.lastEditInputState.repeatOverride=c.insertModeRepeat),delete c.insertModeRepeat,c.insertMode=!1,b.setCursor(b.getCursor().line,b.getCursor().ch-1),b.setOption("keyMap","vim"),b.setOption("disableInput",!0),b.toggleOverwrite(!1),e.setText(g.changes.join("")),a.signal(b,"vim-mode-change",{mode:"normal"}),d.isRecording&&$a(d)}function Wa(a){b.unshift(a)}function Xa(a,b,c,d,e){var f={keys:a,type:b};f[b]=c,f[b+"Args"]=d;for(var g in e)f[g]=e[g];Wa(f)}function Ya(b,c,d,e){var f=vb.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Jb.processCommand(b,f.keyBuffer[0]),void(d.isPlaying=!1);var g=f.keyBuffer,h=0;d.isPlaying=!0,d.replaySearchQueries=f.searchQueries.slice(0);for(var i=0;i<g.length;i++)for(var j,k,l=g[i];l;)if(j=/<\w+-.+?>|<\w+>|./.exec(l),k=j[0],l=l.substring(j.index+k.length),a.Vim.handleKey(b,k,"macro"),c.insertMode){var m=f.insertModeChanges[h++].changes;vb.macroModeState.lastInsertModeChanges.changes=m,hb(b,m,1),Va(b)}d.isPlaying=!1}function Za(a,b){if(!a.isPlaying){var c=a.latestRegister,d=vb.registerController.getRegister(c);d&&d.pushText(b)}}function $a(a){if(!a.isPlaying){var b=a.latestRegister,c=vb.registerController.getRegister(b);c&&c.pushInsertModeChanges&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function _a(a,b){if(!a.isPlaying){var c=a.latestRegister,d=vb.registerController.getRegister(c);d&&d.pushSearchQuery&&d.pushSearchQuery(b)}}function ab(a,b){var c=vb.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){if(d.expectCursorActivityForChange=!0,"+input"==b.origin||"paste"==b.origin||void 0===b.origin){var e=b.text.join("\n");d.maybeReset&&(d.changes=[],d.maybeReset=!1),a.state.overwrite&&!/\n/.test(e)?d.changes.push([e]):d.changes.push(e)}b=b.next}}function bb(a){var b=a.state.vim;if(b.insertMode){var c=vb.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.maybeReset=!0}else a.curOp.isVimOp||db(a,b);b.visualMode&&cb(a)}function cb(a){var b=a.state.vim,c=J(a,R(b.sel.head)),d=L(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function db(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ia(b,!1):c.visualMode||c.insertMode||!b.somethingSelected()||(c.visualMode=!0,c.visualLine=!1,a.signal(b,"vim-mode-change",{mode:"visual"})),c.visualMode){var f=T(e,d)?0:-1,g=T(e,d)?-1:0;e=L(e,0,f),d=L(d,0,g),c.sel={anchor:d,head:e},ua(b,c,"<",U(e,d)),ua(b,c,">",V(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}function eb(a){this.keyName=a}function fb(b){function c(){return e.maybeReset&&(e.changes=[],e.maybeReset=!1),e.changes.push(new eb(f)),!0}var d=vb.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(f.indexOf("Delete")==-1&&f.indexOf("Backspace")==-1||a.lookupKey(f,"vim-insert",c))}function gb(a,b,c,d){function e(){h?yb.processAction(a,b,b.lastEditActionCommand):yb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;hb(a,d.changes,c)}}var g=vb.macroModeState;g.isPlaying=!0;var h=!!b.lastEditActionCommand,i=b.inputState;if(b.inputState=b.lastEditInputState,h&&b.lastEditActionCommand.interlaceInsertRepeat)for(var j=0;j<c;j++)e(),f(1);else d||e(),f(c);b.inputState=i,b.insertMode&&!d&&Va(a),g.isPlaying=!1}function hb(b,c,d){function e(c){return"string"==typeof c?a.commands[c](b):c(b),!0}var f=b.getCursor("head"),g=vb.macroModeState.lastInsertModeChanges.inVisualBlock;if(g){var h=b.state.vim,i=h.lastSelection,j=M(i.anchor,i.head);aa(b,f,j.line+1),d=b.listSelections().length,b.setCursor(f)}for(var k=0;k<d;k++){g&&b.setCursor(L(f,k,0));for(var l=0;l<c.length;l++){var m=c[l];if(m instanceof eb)a.lookupKey(m.keyName,"vim-insert",e);else if("string"==typeof m){var n=b.getCursor();b.replaceRange(m,n,n)}else{var o=b.getCursor(),p=L(o,0,m[0].length);b.replaceRange(m[0],o,p)}}}g&&b.setCursor(L(f,0,1))}a.defineOption("vimMode",!1,function(b,c,d){c&&"vim"!=b.getOption("keyMap")?b.setOption("keyMap","vim"):!c&&d!=a.Init&&/^vim/.test(b.getOption("keyMap"))&&b.setOption("keyMap","default")});var ib={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},jb={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},kb=/[\d]/,lb=[a.isWordChar,function(b){return b&&!a.isWordChar(b)&&!/\s/.test(b)}],mb=[function(a){return/\S/.test(a)}],nb=l(65,26),ob=l(97,26),pb=l(48,10),qb=[].concat(nb,ob,pb,["<",">"]),rb=[].concat(nb,ob,pb,["-",'"',".",":","/"]),sb={};t("filetype",void 0,"string",["ft"],function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}var c=""==a?"null":a;b.setOption("mode",c)}});var tb=function(){function a(a,b,h){function i(b){var e=++d%c,f=g[e];f&&f.clear(),g[e]=a.setBookmark(b)}var j=d%c,k=g[j];if(k){var l=k.find();l&&!S(l,b)&&i(b)}else i(b);i(h),e=d,f=d-c+1,f<0&&(f=0)}function b(a,b){d+=b,d>e?d=e:d<f&&(d=f);var h=g[(c+d)%c];if(h&&!h.find()){var i,j=b>0?1:-1,k=a.getCursor();do if(d+=j,h=g[(c+d)%c],h&&(i=h.find())&&!S(k,i))break;while(d<e&&d>f)}return h}var c=100,d=-1,e=0,f=0,g=new Array(c);return{cachedCursor:void 0,add:a,move:b}},ub=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=vb.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=vb.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var vb,wb,xb={buildKeyMap:function(){},getRegisterController:function(){return vb.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return vb},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:eb,map:function(a,b,c){Jb.map(a,b,c)},unmap:function(a,b){Jb.unmap(a,b)},setOption:u,getOption:v,defineOption:t,defineEx:function(a,b,c){if(b){if(0!==a.indexOf(b))throw new Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered')}else b=a;Ib[a]=c,Jb.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){var d=this.findKey(a,b,c);if("function"==typeof d)return d()},findKey:function(c,d,e){function f(){var a=vb.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Za(a,d)}}function g(){if("<Esc>"==d)return A(c),l.visualMode?ia(c):l.insertMode&&Va(c),!0}function h(b){for(var e;b;)e=/<\w+-.+?>|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,"mapping")}function i(){if(g())return!0;for(var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d,e=1==d.length,f=yb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=yb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return wb&&window.clearTimeout(wb),wb=window.setTimeout(function(){l.insertMode&&l.inputState.keyBuffer&&A(c)},v("insertModeEscKeysTimeout")),!e;if(wb&&window.clearTimeout(wb),e){for(var i=c.listSelections(),j=0;j<i.length;j++){var k=i[j].head;c.replaceRange("",L(k,0,-(a.length-1)),k,"+input")}vb.macroModeState.lastInsertModeChanges.changes.pop()}return A(c),f.command}function j(){if(f()||g())return!0;var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d;if(/^[1-9]\d*$/.test(a))return!0;var e=/^(\d*)(.*)$/.exec(a);if(!e)return A(c),!1;var h=l.visualMode?"visual":"normal",i=yb.matchCommand(e[2]||e[1],b,l.inputState,h);if("none"==i.type)return A(c),!1;if("partial"==i.type)return!0;l.inputState.keyBuffer="";var e=/^(\d*)(.*)$/.exec(a);return e[1]&&"0"!=e[1]&&l.inputState.pushRepeatDigit(e[1]),i.command}var k,l=x(c);return k=l.insertMode?i():j(),k===!1?void 0:k===!0?function(){return!0}:function(){return c.operation(function(){c.curOp.isVimOp=!0;try{"keyToKey"==k.type?h(k.toKeys):yb.processCommand(c,l,k)}catch(b){throw c.state.vim=void 0,x(c),a.Vim.suppressErrorLogging||console.log(b),b}return!0})}},handleEx:function(a,b){Jb.processCommand(a,b)},defineMotion:F,defineAction:I,defineOperator:H,mapCommand:Xa,_mapCommand:Wa,defineRegister:C,exitVisualMode:ia,exitInsertMode:Va};z.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)},z.prototype.getRepeat=function(){var a=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(a=1,this.prefixRepeat.length>0&&(a*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(a*=parseInt(this.motionRepeat.join(""),10))),a},B.prototype={setText:function(a,b,c){this.keyBuffer=[a||""],this.linewise=!!b,this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(ub(a))},pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},D.prototype={pushText:function(a,b,c,d,e){d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var f=this.isValidRegister(a)?this.getRegister(a):null;if(!f){switch(b){case"yank":this.registers[0]=new B(c,d,e);break;case"delete":case"change":c.indexOf("\n")==-1?this.registers["-"]=new B(c,d):(this.shiftNumericRegisters_(),this.registers[1]=new B(c,d))}return void this.unnamedRegister.setText(c,d,e)}var g=q(a);g?f.pushText(c,d):f.setText(c,d,e),this.unnamedRegister.setText(f.toString(),d)},getRegister:function(a){return this.isValidRegister(a)?(a=a.toLowerCase(),this.registers[a]||(this.registers[a]=new B),this.registers[a]):this.unnamedRegister},isValidRegister:function(a){return a&&s(a,rb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},E.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var e=this.iterator+d;b?e>=0:e<c.length;e+=d)for(var f=c[e],g=0;g<=f.length;g++)if(this.initialPrefix==f.substring(0,g))return this.iterator=e,f;return e>=c.length?(this.iterator=c.length,this.initialPrefix):e<0?a:void 0},pushInput:function(a){var b=this.historyBuffer.indexOf(a);b>-1&&this.historyBuffer.splice(b,1),a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var yb={matchCommand:function(a,b,c,d){var e=N(a,b,d,c);if(!e.full&&!e.partial)return{type:"none"};if(!e.full&&e.partial)return{type:"partial"};for(var f,g=0;g<e.full.length;g++){var h=e.full[g];f||(f=h)}if("<character>"==f.keys.slice(-11)){var i=P(a);if(!i)return{type:"none"};c.selectedCharacter=i}return{type:"full",command:f}},processCommand:function(a,b,c){switch(b.inputState.repeatOverride=c.repeatOverride,c.type){case"motion":this.processMotion(a,b,c);break;case"operator":this.processOperator(a,b,c);break;case"operatorMotion":this.processOperatorMotion(a,b,c);break;case"action":this.processAction(a,b,c);break;case"search":this.processSearch(a,b,c);break;case"ex":case"keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion,b.inputState.motionArgs=K(c.motionArgs),this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator)return d.motion="expandToLine",d.motionArgs={linewise:!0},void this.evalInput(a,b);A(a)}d.operator=c.operator,d.operatorArgs=K(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=K(c.operatorMotionArgs);e&&d&&e.visualLine&&(b.visualLine=!0),this.processOperator(a,b,c),d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,e=d.getRepeat(),f=!!e,g=K(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter),c.operator&&this.processOperator(a,b,c),c.motion&&this.processMotion(a,b,c),(c.motion||c.operator)&&this.evalInput(a,b),g.repeat=e||1,g.repeatIsExplicit=f,g.registerName=d.registerName,A(a),b.lastMotion=null,c.isEdit&&this.recordLastEdit(b,d,c),Bb[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){vb.searchHistoryController.pushInput(a),vb.searchHistoryController.reset();try{Ma(b,a,e,f)}catch(g){return Ia(b,"Invalid regex: "+a),void A(b)}yb.processMotion(b,c,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:d.searchArgs.toJumplist}})}function f(a){b.scrollTo(m.left,m.top),e(a,!0,!0);var c=vb.macroModeState;c.isRecording&&_a(c,a)}function g(c,d,e){var f,g,h=a.keyName(c);"Up"==h||"Down"==h?(f="Up"==h,g=c.target?c.target.selectionEnd:0,d=vb.searchHistoryController.nextMatch(d,f)||"",e(d),g&&c.target&&(c.target.selectionEnd=c.target.selectionStart=Math.min(g,c.target.value.length))):"Left"!=h&&"Right"!=h&&"Ctrl"!=h&&"Alt"!=h&&"Shift"!=h&&vb.searchHistoryController.reset();var j;try{j=Ma(b,d,!0,!0)}catch(c){}j?b.scrollIntoView(Pa(b,!i,j),30):(Qa(b),b.scrollTo(m.left,m.top))}function h(c,d,e){var f=a.keyName(c);"Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==d?(vb.searchHistoryController.pushInput(d),vb.searchHistoryController.reset(),Ma(b,l),Qa(b),b.scrollTo(m.left,m.top),a.e_stop(c),A(b),e(),b.focus()):"Up"==f||"Down"==f?a.e_stop(c):"Ctrl-U"==f&&(a.e_stop(c),e(""))}if(b.getSearchCursor){var i=d.searchArgs.forward,j=d.searchArgs.wholeWordOnly;Aa(b).setReversed(!i);var k=i?"/":"?",l=Aa(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=vb.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ka(b,{onClose:f,prefix:k,desc:Gb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=ma(b,!1,!0,!1,!0),q=!0;if(p||(p=ma(b,!1,!0,!1,!1),q=!1),!p)return;var o=b.getLine(p.start.line).substring(p.start.ch,p.end.ch);o=q&&j?"\\b"+o+"\\b":Z(o),vb.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){vb.exCommandHistoryController.pushInput(a),vb.exCommandHistoryController.reset(),Jb.processCommand(b,a)}function f(c,d,e){var f,g,h=a.keyName(c);("Esc"==h||"Ctrl-C"==h||"Ctrl-["==h||"Backspace"==h&&""==d)&&(vb.exCommandHistoryController.pushInput(d),vb.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==h||"Down"==h?(a.e_stop(c),f="Up"==h,g=c.target?c.target.selectionEnd:0,d=vb.exCommandHistoryController.nextMatch(d,f)||"",e(d),g&&c.target&&(c.target.selectionEnd=c.target.selectionStart=Math.min(g,c.target.value.length))):"Ctrl-U"==h?(a.e_stop(c),e("")):"Left"!=h&&"Right"!=h&&"Ctrl"!=h&&"Alt"!=h&&"Shift"!=h&&vb.exCommandHistoryController.reset()}"keyToEx"==d.type?Jb.processCommand(b,d.exArgs.input):c.visualMode?Ka(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ka(b,{onClose:e,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c,e,f,g=b.inputState,h=g.motion,i=g.motionArgs||{},j=g.operator,k=g.operatorArgs||{},l=g.registerName,m=b.sel,n=R(b.visualMode?J(a,m.head):a.getCursor("head")),o=R(b.visualMode?J(a,m.anchor):a.getCursor("anchor")),p=R(n),q=R(o);if(j&&this.recordLastEdit(b,g),f=void 0!==g.repeatOverride?g.repeatOverride:g.getRepeat(),f>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&0===f)&&(f=1,i.repeatIsExplicit=!1),g.selectedCharacter&&(i.selectedCharacter=k.selectedCharacter=g.selectedCharacter),i.repeat=f,A(a),h){var r=zb[h](a,n,i,b);if(b.lastMotion=zb[h],!r)return;if(i.toJumplist){var s=vb.jumpList,t=s.cachedCursor;t?(na(a,t,r),delete s.cachedCursor):na(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=R(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=J(a,c,b.visualBlock)),e&&(e=J(a,e,!0)),e=e||q,m.anchor=e,m.head=c,fa(a),ua(a,b,"<",T(e,c)?e:c),ua(a,b,">",T(e,c)?c:e)):j||(c=J(a,c),a.setCursor(c.line,c.ch))}if(j){if(k.lastSel){e=q;var u=k.lastSel,v=Math.abs(u.head.line-u.anchor.line),w=Math.abs(u.head.ch-u.anchor.ch);c=u.visualLine?d(q.line+v,q.ch):u.visualBlock?d(q.line+v,q.ch+w):u.head.line==u.anchor.line?d(q.line,q.ch+w):d(q.line+v,q.ch),b.visualMode=!0,b.visualLine=u.visualLine,b.visualBlock=u.visualBlock,m=b.sel={anchor:e,head:c},fa(a)}else b.visualMode&&(k.lastSel={anchor:R(m.anchor),head:R(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=U(m.head,m.anchor),y=V(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=ga(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;E<D.length;E++)D[E].head.ch=X(a,D[E].head.line);else"line"==B&&(D[0].head=d(D[0].head.line+1,0))}}else{if(x=R(e||q),y=R(c||p),T(y,x)){var F=x;x=y,y=F}z=i.linewise||k.linewise,z?ka(a,x,y):i.forward&&ja(a,x,y),B="char";var G=!i.inclusive||z;C=ga(a,{anchor:x,head:y},B,G)}a.setSelections(C.ranges,C.primary),b.lastMotion=null,k.repeat=f,k.registerName=l,k.linewise=z;var H=Ab[j](a,k,C.ranges,q,c);b.visualMode&&ia(a,null!=H),H&&a.setCursor(H)}},recordLastEdit:function(a,b,c){var d=vb.macroModeState;d.isPlaying||(a.lastEditInputState=b,a.lastEditActionCommand=c,d.lastInsertModeChanges.changes=[],d.lastInsertModeChanges.expectCursorActivityForChange=!1)}},zb={moveToTopLine:function(a,b,c){var e=Sa(a).top+c.repeat-1;return d(e,la(a.getLine(e)))},moveToMiddleLine:function(a){var b=Sa(a),c=Math.floor(.5*(b.top+b.bottom));return d(c,la(a.getLine(c)))},moveToBottomLine:function(a,b,c){var e=Sa(a).bottom-c.repeat+1;return d(e,la(a.getLine(e)))},expandToLine:function(a,b,c){var e=b;return d(e.line+c.repeat-1,1/0)},findNext:function(a,b,c){var d=Aa(a),e=d.getQuery();if(e){var f=!c.forward;return f=d.isReversed()?!f:f,Oa(a,e),Pa(a,f,e,c.repeat)}},goToMark:function(a,b,c,d){var e=Ta(a,d,c.selectedCharacter);return e?c.linewise?{line:e.line,ch:la(a.getLine(e.line))}:e:null},moveToOtherHighlightedEnd:function(a,b,c,e){if(e.visualBlock&&c.sameLine){var f=e.sel;return[J(a,d(f.anchor.line,f.head.ch)),J(a,d(f.head.line,f.anchor.ch))]}return[e.sel.head,e.sel.anchor]},jumpToMark:function(a,b,c,e){for(var f=b,g=0;g<c.repeat;g++){var h=f;for(var i in e.marks)if(n(i)){var j=e.marks[i].find(),k=c.forward?T(j,h):T(h,j);if(!(k||c.linewise&&j.line==h.line)){var l=S(h,f),m=c.forward?W(h,j,f):W(f,j,h);(l||m)&&(f=j)}}}return c.linewise&&(f=d(f.line,la(a.getLine(f.line)))),f},moveByCharacters:function(a,b,c){var e=b,f=c.repeat,g=c.forward?e.ch+f:e.ch-f;return d(e.line,g)},moveByLines:function(a,b,c,e){var f=b,g=f.ch;switch(e.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:g=e.lastHPos;break;default:e.lastHPos=g}var h=c.repeat+(c.repeatOffset||0),i=c.forward?f.line+h:f.line-h,j=a.firstLine(),k=a.lastLine();return i<j&&f.line==j?this.moveToStartOfLine(a,b,c,e):i>k&&f.line==k?this.moveToEol(a,b,c,e):(c.toFirstChar&&(g=la(a.getLine(i)),e.lastHPos=g),e.lastHSPos=a.charCoords(d(i,g),"div").left,d(i,g))},moveByDisplayLines:function(a,b,c,e){var f=b;switch(e.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:e.lastHSPos=a.charCoords(f,"div").left}var g=c.repeat,h=a.findPosV(f,c.forward?g:-g,"line",e.lastHSPos);if(h.hitSide)if(c.forward)var i=a.charCoords(h,"div"),j={top:i.top+8,left:e.lastHSPos},h=a.coordsChar(j,"div");else{var k=a.charCoords(d(a.firstLine(),0),"div");k.left=e.lastHSPos,h=a.coordsChar(k,"div")}return e.lastHPos=h.ch,h},moveByPage:function(a,b,c){var d=b,e=c.repeat;return a.findPosV(d,c.forward?e:-e,"page")},moveByParagraph:function(a,b,c){var d=c.forward?1:-1;return wa(a,b,c.repeat,d)},moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),f=null,g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,"local");c.repeat=g;var f=zb.moveByDisplayLines(a,b,c,d);if(!f)return null;var i=a.charCoords(f,"local");return a.scrollTo(null,e.top+i.top-h.top),f},moveByWords:function(a,b,c){return ra(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=sa(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return oa(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return oa(0,c),sa(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return pa(a,d,c.forward,c.selectedCharacter)||b},moveToColumn:function(a,b,c,d){var e=c.repeat;return d.lastHPos=e-1,d.lastHSPos=a.charCoords(b,"div").left,ta(a,e)},moveToEol:function(a,b,c,e){var f=b;e.lastHPos=1/0;var g=d(f.line+c.repeat-1,1/0),h=a.clipPos(g);return h.ch--,e.lastHSPos=a.charCoords(h,"div").left,g},moveToFirstNonWhiteSpaceCharacter:function(a,b){var c=b;return d(c.line,la(a.getLine(c.line)))},moveToMatchedSymbol:function(a,b){for(var c,e=b,f=e.line,g=e.ch,h=a.getLine(f);g<h.length;g++)if(c=h.charAt(g),c&&o(c)){var i=a.getTokenTypeAt(d(f,g+1));if("string"!==i&&"comment"!==i)break}if(g<h.length){var j=a.findMatchingBracket(d(f,g));return j.to}return e},moveToStartOfLine:function(a,b){return d(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){var e=c.forward?a.lastLine():a.firstLine(); return c.repeatIsExplicit&&(e=c.repeat-a.getOption("firstLineNumber")),d(e,la(a.getLine(e)))},textObjectManipulation:function(a,b,c,d){var e={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},f={"'":!0,'"':!0},g=c.selectedCharacter;"b"==g?g="(":"B"==g&&(g="{");var h,i=!c.textObjectInner;if(e[g])h=xa(a,b,g,i);else if(f[g])h=ya(a,b,g,i);else if("W"===g)h=ma(a,i,!0,!0);else if("w"===g)h=ma(a,i,!0,!1);else{if("p"!==g)return null;if(h=wa(a,b,c.repeat,0,i),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{var j=d.inputState.operatorArgs;j&&(j.linewise=!0),h.end.line--}}return a.state.vim.visualMode?ea(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=vb.lastCharacterSearch,e=c.repeat,f=c.forward===d.forward,g=(d.increment?1:0)*(f?-1:1);a.moveH(-g,"char"),c.inclusive=!!f;var h=sa(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},Ab={change:function(b,c,e){var f,g,h=b.state.vim;if(vb.macroModeState.lastInsertModeChanges.inVisualBlock=h.visualBlock,h.visualMode){g=b.getSelection();var i=G("",e.length);b.replaceSelections(i),f=U(e[0].head,e[0].anchor)}else{var j=e[0].anchor,k=e[0].head;g=b.getRange(j,k);var l=h.lastEditInputState||{};if("moveByWords"==l.motion&&!r(g)){var m=/\s+$/.exec(g);m&&l.motionArgs&&l.motionArgs.forward&&(k=L(k,0,-m[0].length),g=g.slice(0,-m[0].length))}var n=new d(j.line-1,Number.MAX_VALUE),o=b.firstLine()==b.lastLine();k.line>b.lastLine()&&c.linewise&&!o?b.replaceRange("",n,k):b.replaceRange("",j,k),c.linewise&&(o||(b.setCursor(n),a.commands.newlineAndIndent(b)),j.ch=Number.MAX_VALUE),f=j}vb.registerController.pushText(c.registerName,"change",g,c.linewise,e.length>1),Bb.enterInsertMode(b,{head:f},b.state.vim)},"delete":function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=G("",c.length);a.replaceSelections(h),e=c[0].anchor}else{var i=c[0].anchor,j=c[0].head;b.linewise&&j.line!=a.firstLine()&&i.line==a.lastLine()&&i.line==j.line-1&&(i.line==a.firstLine()?i.ch=0:i=d(i.line-1,X(a,i.line-1))),f=a.getRange(i,j),a.replaceRange("",i,j),e=i,b.linewise&&(e=zb.moveToFirstNonWhiteSpaceCharacter(a,i))}return vb.registerController.pushText(b.registerName,"delete",f,b.linewise,g.visualBlock),J(a,e)},indent:function(a,b,c){var d=a.state.vim,e=c[0].anchor.line,f=d.visualBlock?c[c.length-1].anchor.line:c[0].head.line,g=d.visualMode?b.repeat:1;b.linewise&&f--;for(var h=e;h<=f;h++)for(var i=0;i<g;i++)a.indentLine(h,b.indentRight);return zb.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},changeCase:function(a,b,c,d,e){for(var f=a.getSelections(),g=[],h=b.toLower,i=0;i<f.length;i++){var j=f[i],k="";if(h===!0)k=j.toLowerCase();else if(h===!1)k=j.toUpperCase();else for(var l=0;l<j.length;l++){var m=j.charAt(l);k+=q(m)?m.toLowerCase():m.toUpperCase()}g.push(k)}return a.replaceSelections(g),b.shouldMoveCursor?e:!a.state.vim.visualMode&&b.linewise&&c[0].anchor.line+1==c[0].head.line?zb.moveToFirstNonWhiteSpaceCharacter(a,d):b.linewise?d:U(c[0].anchor,c[0].head)},yank:function(a,b,c,d){var e=a.state.vim,f=a.getSelection(),g=e.visualMode?U(e.sel.anchor,e.sel.head,c[0].head,c[0].anchor):d;return vb.registerController.pushText(b.registerName,"yank",f,b.linewise,e.visualBlock),g}},Bb={jumpListWalk:function(a,b,c){if(!c.visualMode){var d=b.repeat,e=b.forward,f=vb.jumpList,g=f.move(a,e?d:-d),h=g?g.find():void 0;h=h?h:a.getCursor(),a.setCursor(h)}},scroll:function(a,b,c){if(!c.visualMode){var d=b.repeat||1,e=a.defaultTextHeight(),f=a.getScrollInfo().top,g=e*d,h=b.forward?f+g:f-g,i=R(a.getCursor()),j=a.charCoords(i,"local");if(b.forward)h>j.top?(i.line+=(h-j.top)/e,i.line=Math.ceil(i.line),a.setCursor(i),j=a.charCoords(i,"local"),a.scrollTo(null,j.top)):a.scrollTo(null,h);else{var k=h+a.getScrollInfo().clientHeight;k<j.bottom?(i.line-=(j.bottom-k)/e,i.line=Math.floor(i.line),a.setCursor(i),j=a.charCoords(i,"local"),a.scrollTo(null,j.bottom-a.getScrollInfo().clientHeight)):a.scrollTo(null,h)}}},scrollToCursor:function(a,b){var c=a.getCursor().line,e=a.charCoords(d(c,0),"local"),f=a.getScrollInfo().clientHeight,g=e.top,h=e.bottom-g;switch(b.position){case"center":g=g-f/2+h;break;case"bottom":g=g-f+h}a.scrollTo(null,g)},replayMacro:function(a,b,c){var d=b.selectedCharacter,e=b.repeat,f=vb.macroModeState;for("@"==d&&(d=f.latestRegister);e--;)Ya(a,c,f,d)},enterMacroRecordMode:function(a,b){var c=vb.macroModeState,d=b.selectedCharacter;vb.registerController.isValidRegister(d)&&c.enterMacroRecordMode(a,d)},toggleOverwrite:function(b){b.state.overwrite?(b.toggleOverwrite(!1),b.setOption("keyMap","vim-insert"),a.signal(b,"vim-mode-change",{mode:"insert"})):(b.toggleOverwrite(!0),b.setOption("keyMap","vim-replace"),a.signal(b,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(b,c,e){if(!b.getOption("readOnly")){e.insertMode=!0,e.insertModeRepeat=c&&c.repeat||1;var f=c?c.insertAt:null,g=e.sel,h=c.head||b.getCursor("head"),i=b.listSelections().length;if("eol"==f)h=d(h.line,X(b,h.line));else if("charAfter"==f)h=L(h,0,1);else if("firstNonBlank"==f)h=zb.moveToFirstNonWhiteSpaceCharacter(b,h);else if("startOfSelectedArea"==f)e.visualBlock?(h=d(Math.min(g.head.line,g.anchor.line),Math.min(g.head.ch,g.anchor.ch)),i=Math.abs(g.head.line-g.anchor.line)+1):h=g.head.line<g.anchor.line?g.head:d(g.anchor.line,0);else if("endOfSelectedArea"==f)e.visualBlock?(h=d(Math.min(g.head.line,g.anchor.line),Math.max(g.head.ch+1,g.anchor.ch)),i=Math.abs(g.head.line-g.anchor.line)+1):h=g.head.line>=g.anchor.line?L(g.head,0,1):d(g.anchor.line,0);else if("inplace"==f&&e.visualMode)return;b.setOption("disableInput",!1),c&&c.replace?(b.toggleOverwrite(!0),b.setOption("keyMap","vim-replace"),a.signal(b,"vim-mode-change",{mode:"replace"})):(b.toggleOverwrite(!1),b.setOption("keyMap","vim-insert"),a.signal(b,"vim-mode-change",{mode:"insert"})),vb.macroModeState.isPlaying||(b.on("change",ab),a.on(b.getInputField(),"keydown",fb)),e.visualMode&&ia(b),aa(b,h,i)}},toggleVisualMode:function(b,c,e){var f,g=c.repeat,h=b.getCursor();e.visualMode?e.visualLine^c.linewise||e.visualBlock^c.blockwise?(e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b)):ia(b):(e.visualMode=!0,e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,f=J(b,d(h.line,h.ch+g-1),!0),e.sel={anchor:h,head:f},a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b),ua(b,e,"<",U(h,f)),ua(b,e,">",V(h,f)))},reselectLastSelection:function(b,c,d){var e=d.lastSelection;if(d.visualMode&&da(b,d),e){var f=e.anchorMark.find(),g=e.headMark.find();if(!f||!g)return;d.sel={anchor:f,head:g},d.visualMode=!0,d.visualLine=e.visualLine,d.visualBlock=e.visualBlock,fa(b),ua(b,d,"<",U(f,g)),ua(b,d,">",V(f,g)),a.signal(b,"vim-mode-change",{mode:"visual",subMode:d.visualLine?"linewise":d.visualBlock?"blockwise":""})}},joinLines:function(a,b,c){var e,f;if(c.visualMode){if(e=a.getCursor("anchor"),f=a.getCursor("head"),T(f,e)){var g=f;f=e,e=g}f.ch=X(a,f.line)-1}else{var h=Math.max(b.repeat,2);e=a.getCursor(),f=J(a,d(e.line+h-1,1/0))}for(var i=0,j=e.line;j<f.line;j++){i=X(a,e.line);var g=d(e.line+1,X(a,e.line+1)),k=a.getRange(e,g);k=k.replace(/\n\s*/g," "),a.replaceRange(k,e,g)}var l=d(e.line,i);c.visualMode&&ia(a,!1),a.setCursor(l)},newLineAndEnterInsertMode:function(b,c,e){e.insertMode=!0;var f=R(b.getCursor());if(f.line!==b.firstLine()||c.after){f.line=c.after?f.line:f.line-1,f.ch=X(b,f.line),b.setCursor(f);var g=a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent;g(b)}else b.replaceRange("\n",d(b.firstLine(),0)),b.setCursor(b.firstLine(),0);this.enterInsertMode(b,{repeat:c.repeat},e)},paste:function(a,b,c){var e=R(a.getCursor()),f=vb.registerController.getRegister(b.registerName),g=f.toString();if(g){if(b.matchIndent){var h=a.getOption("tabSize"),i=function(a){var b=a.split("\t").length-1,c=a.split(" ").length-1;return b*h+1*c},j=a.getLine(a.getCursor().line),k=i(j.match(/^\s*/)[0]),l=g.replace(/\n$/,""),m=g!==l,n=i(g.match(/^\s*/)[0]),g=l.replace(/^\s*/gm,function(b){var c=k+(i(b)-n);if(c<0)return"";if(a.getOption("indentWithTabs")){var d=Math.floor(c/h);return Array(d+1).join("\t")}return Array(c+1).join(" ")});g+=m?"\n":""}if(b.repeat>1)var g=Array(b.repeat+1).join(g);var o=f.linewise,p=f.blockwise;if(o)c.visualMode?g=c.visualLine?g.slice(0,-1):"\n"+g.slice(0,g.length-1)+"\n":b.after?(g="\n"+g.slice(0,g.length-1),e.ch=X(a,e.line)):e.ch=0;else{if(p){g=g.split("\n");for(var q=0;q<g.length;q++)g[q]=""==g[q]?" ":g[q]}e.ch+=b.after?1:0}var r,s;if(c.visualMode){c.lastPastedText=g;var t,u=ca(a,c),v=u[0],w=u[1],x=a.getSelection(),y=a.listSelections(),z=new Array(y.length).join("1").split("1");c.lastSelection&&(t=c.lastSelection.headMark.find()),vb.registerController.unnamedRegister.setText(x),p?(a.replaceSelections(z),w=d(v.line+g.length-1,v.ch),a.setCursor(v),_(a,w),a.replaceSelections(g),r=v):c.visualBlock?(a.replaceSelections(z),a.setCursor(v),a.replaceRange(g,v,v),r=v):(a.replaceRange(g,v,w),r=a.posFromIndex(a.indexFromPos(v)+g.length-1)),t&&(c.lastSelection.headMark=a.setBookmark(t)),o&&(r.ch=0)}else if(p){a.setCursor(e);for(var q=0;q<g.length;q++){var A=e.line+q;A>a.lastLine()&&a.replaceRange("\n",d(A,0));var B=X(a,A);B<e.ch&&$(a,A,e.ch)}a.setCursor(e),_(a,d(e.line+g.length-1,e.ch)),a.replaceSelections(g),r=e}else a.replaceRange(g,e),o&&b.after?r=d(e.line+1,la(a.getLine(e.line+1))):o&&!b.after?r=d(e.line,la(a.getLine(e.line))):!o&&b.after?(s=a.indexFromPos(e),r=a.posFromIndex(s+g.length-1)):(s=a.indexFromPos(e),r=a.posFromIndex(s+g.length));c.visualMode&&ia(a,!1),a.setCursor(r)}},undo:function(b,c){b.operation(function(){Q(b,a.commands.undo,c.repeat)(),b.setCursor(b.getCursor("anchor"))})},redo:function(b,c){Q(b,a.commands.redo,c.repeat)()},setRegister:function(a,b,c){c.inputState.registerName=b.selectedCharacter},setMark:function(a,b,c){var d=b.selectedCharacter;ua(a,c,d,a.getCursor())},replace:function(b,c,e){var f,g,h=c.selectedCharacter,i=b.getCursor(),j=b.listSelections();if(e.visualMode)i=b.getCursor("start"),g=b.getCursor("end");else{var k=b.getLine(i.line);f=i.ch+c.repeat,f>k.length&&(f=k.length),g=d(i.line,f)}if("\n"==h)e.visualMode||b.replaceRange("",i,g),(a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent)(b);else{var l=b.getRange(i,g);if(l=l.replace(/[^\n]/g,h),e.visualBlock){var m=new Array(b.getOption("tabSize")+1).join(" ");l=b.getSelection(),l=l.replace(/\t/g,m).replace(/[^\n]/g,h).split("\n"),b.replaceSelections(l)}else b.replaceRange(l,i,g);e.visualMode?(i=T(j[0].anchor,j[0].head)?j[0].anchor:j[0].head,b.setCursor(i),ia(b,!1)):b.setCursor(L(g,0,-1))}},incrementNumberToken:function(a,b){for(var c,e,f,g,h,i=a.getCursor(),j=a.getLine(i.line),k=/-?\d+/g;null!==(c=k.exec(j))&&(h=c[0],e=c.index,f=e+h.length,!(i.ch<f)););if((b.backtrack||!(f<=i.ch))&&h){var l=b.increase?1:-1,m=parseInt(h)+l*b.repeat,n=d(i.line,e),o=d(i.line,f);g=m.toString(),a.replaceRange(g,n,o),a.setCursor(d(i.line,e+g.length-1))}},repeatLastEdit:function(a,b,c){var d=c.lastEditInputState;if(d){var e=b.repeat;e&&b.repeatIsExplicit?c.lastEditInputState.repeatOverride=e:e=c.lastEditInputState.repeatOverride||e,gb(a,c,e,!1)}},indent:function(a,b){a.indentLine(a.getCursor().line,b.indentRight)},exitInsertMode:Va},Cb={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Db={bracket:{isComplete:function(a){if(a.nextCh===a.symb){if(a.depth++,a.depth>=1)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0,a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b="*"===a.lastCh&&"/"===a.nextCh;return a.lastCh=a.nextCh,b}},method:{init:function(a){a.symb="m"===a.symb?"{":"}",a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};t("pcre",!0,"boolean"),za.prototype={getQuery:function(){return vb.query},setQuery:function(a){vb.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return vb.isReversed},setReversed:function(a){vb.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var Eb={"\\n":"\n","\\r":"\r","\\t":"\t"},Fb={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},Gb="(Javascript regexp)",Hb=function(){this.buildCommandMap_()};Hb.prototype={processCommand:function(a,b,c){var d=this;a.operation(function(){a.curOp.isVimOp=!0,d._processCommand(a,b,c)})},_processCommand:function(b,c,d){var e=b.state.vim,f=vb.registerController.getRegister(":"),g=f.toString();e.visualMode&&ia(b);var h=new a.StringStream(c);f.setText(c);var i=d||{};i.input=c;try{this.parseInput_(b,h,i)}catch(j){throw Ia(b,j),j}var k,l;if(i.commandName){if(k=this.matchCommand_(i.commandName)){if(l=k.name,k.excludeFromCommandHistory&&f.setText(g),this.parseCommandArgs_(h,i,k),"exToKey"==k.type){for(var m=0;m<k.toKeys.length;m++)a.Vim.handleKey(b,k.toKeys[m],"mapping");return}if("exToEx"==k.type)return void this.processCommand(b,k.toInput)}}else void 0!==i.line&&(l="move");if(!l)return void Ia(b,'Not an editor command ":'+c+'"');try{Ib[l](b,i),k&&k.possiblyAsync||!i.callback||i.callback()}catch(j){throw Ia(b,j),j}},parseInput_:function(a,b,c){b.eatWhile(":"),b.eat("%")?(c.line=a.firstLine(),c.lineEnd=a.lastLine()):(c.line=this.parseLineSpec_(a,b),void 0!==c.line&&b.eat(",")&&(c.lineEnd=this.parseLineSpec_(a,b)));var d=b.match(/^(\w+)/);return d?c.commandName=d[1]:c.commandName=b.match(/.*/)[0],c},parseLineSpec_:function(a,b){var c=b.match(/^(\d+)/);if(c)return parseInt(c[1],10)-1;switch(b.next()){case".":return this.parseLineSpecOffset_(b,a.getCursor().line);case"$":return this.parseLineSpecOffset_(b,a.lastLine());case"'":var d=b.next(),e=Ta(a,a.state.vim,d);if(!e)throw new Error("Mark not set");return this.parseLineSpecOffset_(b,e.line);case"-":case"+":return b.backUp(1),this.parseLineSpecOffset_(b,a.getCursor().line);default:return void b.backUp(1)}},parseLineSpecOffset_:function(a,b){var c=a.match(/^([+-])?(\d+)/);if(c){var d=parseInt(c[2],10);"-"==c[1]?b-=d:b+=d}return b},parseCommandArgs_:function(a,b,c){if(!a.eol()){b.argString=a.match(/.*/)[0];var d=c.argDelimiter||/\s+/,e=Y(b.argString).split(d);e.length&&e[0]&&(b.args=e)}},matchCommand_:function(a){for(var b=a.length;b>0;b--){var c=a.substring(0,b);if(this.commandMap_[c]){var d=this.commandMap_[c];if(0===d.name.indexOf(a))return d}}return null},buildCommandMap_:function(){this.commandMap_={};for(var a=0;a<c.length;a++){var b=c[a],d=b.shortName||b.name;this.commandMap_[d]=b}},map:function(a,c,d){if(":"!=a&&":"==a.charAt(0)){if(d)throw Error("Mode not supported for ex mappings");var e=a.substring(1);":"!=c&&":"==c.charAt(0)?this.commandMap_[e]={name:e,type:"exToEx",toInput:c.substring(1),user:!0}:this.commandMap_[e]={name:e,type:"exToKey",toKeys:c,user:!0}}else if(":"!=c&&":"==c.charAt(0)){var f={keys:a,type:"keyToEx",exArgs:{input:c.substring(1)}};d&&(f.context=d),b.unshift(f)}else{var f={keys:a,type:"keyToKey",toKeys:c};d&&(f.context=d),b.unshift(f)}},unmap:function(a,c){if(":"!=a&&":"==a.charAt(0)){if(c)throw Error("Mode not supported for ex mappings");var d=a.substring(1);if(this.commandMap_[d]&&this.commandMap_[d].user)return void delete this.commandMap_[d]}else for(var e=a,f=0;f<b.length;f++)if(e==b[f].keys&&b[f].context===c)return void b.splice(f,1);throw Error("No such mapping.")}};var Ib={colorscheme:function(a,b){return!b.args||b.args.length<1?void Ia(a,a.getOption("theme")):void a.setOption("theme",b.args[0])},map:function(a,b,c){var d=b.args;return!d||d.length<2?void(a&&Ia(a,"Invalid mapping: "+b.input)):void Jb.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,"insert")},nmap:function(a,b){this.map(a,b,"normal")},vmap:function(a,b){this.map(a,b,"visual")},unmap:function(a,b,c){var d=b.args;return!d||d.length<1?void(a&&Ia(a,"No such mapping: "+b.input)):void Jb.unmap(d[0],c)},move:function(a,b){yb.processCommand(a,a.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||c.length<1)return void(a&&Ia(a,"Invalid mapping: "+b.input));var e=c[0].split("="),f=e[0],g=e[1],h=!1;if("?"==f.charAt(f.length-1)){if(g)throw Error("Trailing characters: "+b.argString);f=f.substring(0,f.length-1),h=!0}void 0===g&&"no"==f.substring(0,2)&&(f=f.substring(2),g=!1);var i=sb[f]&&"boolean"==sb[f].type;if(i&&void 0==g&&(g=!0),!i&&void 0===g||h){var j=v(f,a,d);j instanceof Error?Ia(a,j.message):j===!0||j===!1?Ia(a," "+(j?"":"no")+f):Ia(a," "+f+"="+j)}else{var k=u(f,g,a,d);k instanceof Error&&Ia(a,k.message)}},setlocal:function(a,b){b.setCfg={scope:"local"},this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:"global"},this.set(a,b)},registers:function(a,b){var c=b.args,d=vb.registerController.registers,e="----------Registers----------<br><br>";if(c){var f;c=c.join("");for(var g=0;g<c.length;g++)if(f=c.charAt(g),vb.registerController.isValidRegister(f)){var h=d[f]||new B;e+='"'+f+" "+h.toString()+"<br>"}}else for(var f in d){var i=d[f].toString();i.length&&(e+='"'+f+" "+i+"<br>")}Ia(a,e)},sort:function(b,c){function e(){if(c.argString){var b=new a.StringStream(c.argString);if(b.eat("!")&&(h=!0),b.eol())return;if(!b.eatSpace())return"Invalid arguments";var d=b.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!d&&!b.eol())return"Invalid arguments";if(d[1]){i=d[1].indexOf("i")!=-1,j=d[1].indexOf("u")!=-1;var e=d[1].indexOf("d")!=-1||d[1].indexOf("n")!=-1&&1,f=d[1].indexOf("x")!=-1&&1,g=d[1].indexOf("o")!=-1&&1;if(e+f+g>1)return"Invalid arguments";k=e&&"decimal"||f&&"hex"||g&&"octal"}d[2]&&(l=new RegExp(d[2].substr(1,d[2].length-2),i?"i":""))}}function f(a,b){if(h){var c;c=a,a=b,b=c}i&&(a=a.toLowerCase(),b=b.toLowerCase());var d=k&&s.exec(a),e=k&&s.exec(b);return d?(d=parseInt((d[1]+d[2]).toLowerCase(),t),e=parseInt((e[1]+e[2]).toLowerCase(),t),d-e):a<b?-1:1}function g(a,b){if(h){var c;c=a,a=b,b=c}return i&&(a[0]=a[0].toLowerCase(),b[0]=b[0].toLowerCase()),a[0]<b[0]?-1:1}var h,i,j,k,l,m=e();if(m)return void Ia(b,m+": "+c.argString);var n=c.line||b.firstLine(),o=c.lineEnd||c.line||b.lastLine();if(n!=o){var p=d(n,0),q=d(o,X(b,o)),r=b.getRange(p,q).split("\n"),s=l?l:"decimal"==k?/(-?)([\d]+)/:"hex"==k?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==k?/([0-7]+)/:null,t="decimal"==k?10:"hex"==k?16:"octal"==k?8:null,u=[],v=[];if(k||l)for(var w=0;w<r.length;w++){var x=l?r[w].match(l):null;x&&""!=x[0]?u.push(x):!l&&s.exec(r[w])?u.push(r[w]):v.push(r[w])}else v=r;if(u.sort(l?g:f),l)for(var w=0;w<u.length;w++)u[w]=u[w].input;else k||v.sort(f);if(r=h?u.concat(v):v.concat(u),j){var y,z=r;r=[];for(var w=0;w<z.length;w++)z[w]!=y&&r.push(z[w]),y=z[w]}b.replaceRange(r.join("\n"),p,q)}},global:function(a,b){var c=b.argString;if(!c)return void Ia(a,"Regular Expression missing from global");var d,e=void 0!==b.line?b.line:a.firstLine(),f=b.lineEnd||b.line||a.lastLine(),g=Ca(c),h=c;if(g.length&&(h=g[0],d=g.slice(1,g.length).join("/")),h)try{Ma(a,h,!0,!0)}catch(i){return void Ia(a,"Invalid regex: "+h)}for(var j=Aa(a).getQuery(),k=[],l="",m=e;m<=f;m++){var n=j.test(a.getLine(m));n&&(k.push(m+1),l+=a.getLine(m)+"<br>")}if(!d)return void Ia(a,l);var o=0,p=function(){if(o<k.length){var b=k[o]+d;Jb.processCommand(a,b,{callback:p})}o++};p()},substitute:function(a,b){if(!a.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var c,e,f,g,h=b.argString,i=h?Ca(h):[],j="",k=!1,l=!1;if(i.length)c=i[0],j=i[1],c&&"$"===c[c.length-1]&&(c=c.slice(0,c.length-1)+"\\n",j=j?j+"\n":"\n"),void 0!==j&&(j=v("pcre")?Ga(j):Fa(j),vb.lastSubstituteReplacePart=j),e=i[2]?i[2].split(" "):[];else if(h&&h.length)return void Ia(a,"Substitutions should be of the form :s/pattern/replace/");if(e&&(f=e[0],g=parseInt(e[1]),f&&(f.indexOf("c")!=-1&&(k=!0,f.replace("c","")),f.indexOf("g")!=-1&&(l=!0,f.replace("g","")),c=c+"/"+f)),c)try{Ma(a,c,!0,!0)}catch(m){return void Ia(a,"Invalid regex: "+c)}if(j=j||vb.lastSubstituteReplacePart,void 0===j)return void Ia(a,"No previous substitute regular expression");var n=Aa(a),o=n.getQuery(),p=void 0!==b.line?b.line:a.getCursor().line,q=b.lineEnd||p;p==a.firstLine()&&q==a.lastLine()&&(q=1/0),g&&(p=q,q=p+g-1);var r=J(a,d(p,0)),s=a.getSearchCursor(o,r);Ua(a,k,l,p,q,s,o,j,b.callback)},redo:a.commands.redo,undo:a.commands.undo,write:function(b){a.commands.save?a.commands.save(b):b.save&&b.save()},nohlsearch:function(a){Qa(a)},yank:function(a){var b=R(a.getCursor()),c=b.line,d=a.getLine(c);vb.registerController.pushText("0","yank",d,!0,!0)},delmarks:function(b,c){if(!c.argString||!Y(c.argString))return void Ia(b,"Argument required");for(var d=b.state.vim,e=new a.StringStream(Y(c.argString));!e.eol();){e.eatSpace();var f=e.pos;if(!e.match(/[a-zA-Z]/,!1))return void Ia(b,"Invalid argument: "+c.argString.substring(f));var g=e.next();if(e.match("-",!0)){if(!e.match(/[a-zA-Z]/,!1))return void Ia(b,"Invalid argument: "+c.argString.substring(f));var h=g,i=e.next();if(!(n(h)&&n(i)||q(h)&&q(i)))return void Ia(b,"Invalid argument: "+h+"-");var j=h.charCodeAt(0),k=i.charCodeAt(0);if(j>=k)return void Ia(b,"Invalid argument: "+c.argString.substring(f));for(var l=0;l<=k-j;l++){var m=String.fromCharCode(j+l);delete d.marks[m]}}else delete d.marks[g]}}},Jb=new Hb;return a.keyMap.vim={attach:h,detach:g,call:i},t("insertModeEscKeysTimeout",200,"number"),a.keyMap["vim-insert"]={fallthrough:["default"],attach:h,detach:g,call:i},a.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:h,detach:g,call:i},y(),xb};a.Vim=e()})},{"../addon/dialog/dialog":3,"../addon/edit/matchbrackets.js":12,"../addon/search/searchcursor":49,"../lib/codemirror":59}],59:[function(a,b,c){!function(a,d){"object"==typeof c&&"undefined"!=typeof b?b.exports=d():"function"==typeof define&&define.amd?define(d):a.CodeMirror=d()}(this,function(){"use strict";function a(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function b(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function c(a,c){return b(a).appendChild(c)}function d(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function e(a,b,c,e){var f=d(a,b,c,e);return f.setAttribute("role","presentation"),f}function f(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function g(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function h(b,c){var d=b.className;a(c).test(d)||(b.className+=(d?" ":"")+c)}function i(b,c){for(var d=b.split(" "),e=0;e<d.length;e++)d[e]&&!a(d[e]).test(c)&&(c+=" "+d[e]);return c}function j(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function k(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function l(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var f=d||0,g=e||0;;){var h=a.indexOf("\t",f);if(h<0||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}}function m(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function n(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);f==-1&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function o(a){for(;Qg.length<=a;)Qg.push(p(Qg)+" ");return Qg[a]}function p(a){return a[a.length-1]}function q(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function r(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function s(){}function t(a,b){var c;return Object.create?c=Object.create(a):(s.prototype=a,c=new s),b&&k(b,c),c}function u(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||Rg.test(a))}function v(a,b){return b?!!(b.source.indexOf("\\w")>-1&&u(a))||b.test(a):u(a)}function w(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function x(a){return a.charCodeAt(0)>=768&&Sg.test(a)}function y(a,b,c){for(;(c<0?b>0:b<a.length)&&x(a.charAt(b));)b+=c;return b}function z(a,b,c){for(;;){if(Math.abs(b-c)<=1)return a(b)?b:c;var d=Math.floor((b+c)/2);a(d)?c=d:b=d}}function A(a,b,c){var f=this;this.input=c,f.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),f.scrollbarFiller.setAttribute("cm-not-content","true"),f.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),f.gutterFiller.setAttribute("cm-not-content","true"),f.lineDiv=e("div",null,"CodeMirror-code"),f.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),f.cursorDiv=d("div",null,"CodeMirror-cursors"),f.measure=d("div",null,"CodeMirror-measure"),f.lineMeasure=d("div",null,"CodeMirror-measure"),f.lineSpace=e("div",[f.measure,f.lineMeasure,f.selectionDiv,f.cursorDiv,f.lineDiv],null,"position: relative; outline: none");var g=e("div",[f.lineSpace],"CodeMirror-lines");f.mover=d("div",[g],null,"position: relative"),f.sizer=d("div",[f.mover],"CodeMirror-sizer"),f.sizerWidth=null,f.heightForcer=d("div",null,null,"position: absolute; height: "+Lg+"px; width: 1px;"),f.gutters=d("div",null,"CodeMirror-gutters"),f.lineGutter=null,f.scroller=d("div",[f.sizer,f.heightForcer,f.gutters],"CodeMirror-scroll"),f.scroller.setAttribute("tabIndex","-1"),f.wrapper=d("div",[f.scrollbarFiller,f.gutterFiller,f.scroller],"CodeMirror"),ng&&og<8&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),pg||jg&&yg||(f.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(f.wrapper):a(f.wrapper)),f.viewFrom=f.viewTo=b.first,f.reportedViewFrom=f.reportedViewTo=b.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,c.init(f)}function B(a,b){if(b-=a.first,b<0||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function C(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function D(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function E(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function F(a){if(null==a.parent)return null;for(var b=a.parent,c=m(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function G(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var g=0;g<a.lines.length;++g){var h=a.lines[g],i=h.height;if(b<i)break;b-=i}return c+g}function H(a,b){return b>=a.first&&b<a.first+a.size}function I(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function J(a,b,c){return void 0===c&&(c=null),this instanceof J?(this.line=a,this.ch=b,void(this.sticky=c)):new J(a,b,c)}function K(a,b){return a.line-b.line||a.ch-b.ch}function L(a,b){return a.sticky==b.sticky&&0==K(a,b)}function M(a){return J(a.line,a.ch)}function N(a,b){return K(a,b)<0?b:a}function O(a,b){return K(a,b)<0?a:b}function P(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Q(a,b){if(b.line<a.first)return J(a.first,0);var c=a.first+a.size-1;return b.line>c?J(c,B(a,c).text.length):R(b,B(a,b.line).text.length)}function R(a,b){var c=a.ch;return null==c||c>b?J(a.line,b):c<0?J(a.line,0):a}function S(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=Q(a,b[d]);return c}function T(){Tg=!0}function U(){Ug=!0}function V(a,b,c){this.marker=a,this.from=b,this.to=c}function W(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function X(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Y(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Z(a,b,c){var d;if(a)for(var e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push(new V(g,f.from,i?null:f.to))}}return d}function $(a,b,c){var d;if(a)for(var e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push(new V(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return d}function _(a,b){if(b.full)return null;var c=H(a,b.from.line)&&B(a,b.from.line).markedSpans,d=H(a,b.to.line)&&B(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==K(b.from,b.to),h=Z(c,e,g),i=$(d,f,g),j=1==b.text.length,k=p(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=W(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var o=0;o<i.length;++o){var q=i[o];if(null!=q.to&&(q.to+=k),null==q.from){var r=W(h,q.marker);r||(q.from=k,j&&(h||(h=[])).push(q))}else q.from+=k,j&&(h||(h=[])).push(q)}h&&(h=aa(h)),i&&i!=h&&(i=aa(i));var s=[h];if(!j){var t,u=b.text.length-2;if(u>0&&h)for(var v=0;v<h.length;++v)null==h[v].to&&(t||(t=[])).push(new V(h[v].marker,null,null));for(var w=0;w<u;++w)s.push(t);s.push(i)}return s}function aa(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function ba(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&m(d,c)!=-1||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(0),i=0;i<e.length;++i){var j=e[i];if(!(K(j.to,h.from)<0||K(j.from,h.to)>0)){var k=[i,1],l=K(j.from,h.from),n=K(j.to,h.to);(l<0||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(n>0||!g.inclusiveRight&&!n)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-3}}return e}function ca(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function da(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function ea(a){return a.inclusiveLeft?-1:0}function fa(a){return a.inclusiveRight?1:0}function ga(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=K(d.from,e.from)||ea(a)-ea(b);if(f)return-f;var g=K(d.to,e.to)||fa(a)-fa(b);return g?g:b.id-a.id}function ha(a,b){var c,d=Ug&&a.markedSpans;if(d)for(var e=void 0,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||ga(c,e.marker)<0)&&(c=e.marker);return c}function ia(a){return ha(a,!0)}function ja(a){return ha(a,!1)}function ka(a,b,c,d,e){var f=B(a,b),g=Ug&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=K(j.from,c)||ea(i.marker)-ea(e),l=K(j.to,d)||fa(i.marker)-fa(e); if(!(k>=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?K(j.to,c)>=0:K(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?K(j.from,d)<=0:K(j.from,d)<0)))return!0}}}function la(a){for(var b;b=ia(a);)a=b.find(-1,!0).line;return a}function ma(a){for(var b;b=ja(a);)a=b.find(1,!0).line;return a}function na(a){for(var b,c;b=ja(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function oa(a,b){var c=B(a,b),d=la(c);return c==d?b:F(d)}function pa(a,b){if(b>a.lastLine())return b;var c,d=B(a,b);if(!qa(a,d))return b;for(;c=ja(d);)d=c.find(1,!0).line;return F(d)+1}function qa(a,b){var c=Ug&&b.markedSpans;if(c)for(var d=void 0,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&ra(a,b,d))return!0}}function ra(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return ra(a,d.line,W(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e=void 0,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&ra(a,b,e))return!0}function sa(a){a=la(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var g=0;g<f.children.length;++g){var h=f.children[g];if(h==c)break;b+=h.height}return b}function ta(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=ia(d);){var e=b.find(0,!0);d=e.from.line,c+=e.from.ch-e.to.ch}for(d=a;b=ja(d);){var f=b.find(0,!0);c-=d.text.length-f.from.ch,d=f.to.line,c+=d.text.length-f.to.ch}return c}function ua(a){var b=a.display,c=a.doc;b.maxLine=B(c,c.first),b.maxLineLength=ta(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=ta(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function va(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function wa(a,b,c){var d;Vg=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==c?d=e:Vg=e),f.from==b&&(f.from!=f.to&&"before"!=c?d=e:Vg=e)}return null!=d?d:Vg}function xa(a,b){var c=a.order;return null==c&&(c=a.order=Wg(a.text,b)),c}function ya(a,b,c){var d=y(a.text,b+c,c);return d<0||d>a.text.length?null:d}function za(a,b,c){var d=ya(a,b.ch,c);return null==d?null:new J(b.line,d,c<0?"after":"before")}function Aa(a,b,c,d,e){if(a){var f=xa(c,b.doc.direction);if(f){var g,h=e<0?p(f):f[0],i=e<0==(1==h.level),j=i?"after":"before";if(h.level>0){var k=Zb(b,c);g=e<0?c.text.length-1:0;var l=$b(b,k,g).top;g=z(function(a){return $b(b,k,a).top==l},e<0==(1==h.level)?h.from:h.to-1,g),"before"==j&&(g=ya(c,g,1))}else g=e<0?h.to:h.from;return new J(d,g,j)}}return new J(d,e<0?c.text.length:0,e<0?"before":"after")}function Ba(a,b,c,d){var e=xa(b,a.doc.direction);if(!e)return za(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):c.ch<=0&&(c.ch=0,c.sticky="after");var f=wa(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&g.level%2==0&&(d>0?g.to>c.ch:g.from<c.ch))return za(b,c,d);var h,i=function(a,c){return ya(b,a instanceof J?a.ch:a,c)},j=function(c){return a.options.lineWrapping?(h=h||Zb(a,b),qc(a,b,h,c)):{begin:0,end:b.text.length}},k=j("before"==c.sticky?i(c,-1):c.ch);if("rtl"==a.doc.direction||1==g.level){var l=1==g.level==d<0,m=i(c,l?1:-1);if(null!=m&&(l?m<=g.to&&m<=k.end:m>=g.from&&m>=k.begin)){var n=l?"before":"after";return new J(c.line,m,n)}}var o=function(a,b,d){for(var f=function(a,b){return b?new J(c.line,i(a,1),"before"):new J(c.line,a,"after")};a>=0&&a<e.length;a+=b){var g=e[a],h=b>0==(1!=g.level),j=h?d.begin:i(d.end,-1);if(g.from<=j&&j<g.to)return f(j,h);if(j=h?g.from:i(g.to,-1),d.begin<=j&&j<d.end)return f(j,h)}},p=o(f+d,d,k);if(p)return p;var q=d>0?k.end:i(k.begin,-1);return null==q||d>0&&q==b.text.length||!(p=o(d>0?0:e.length-1,d,j(q)))?null:p}function Ca(a,b){return a._handlers&&a._handlers[b]||Xg}function Da(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers,e=d&&d[b];if(e){var f=m(e,c);f>-1&&(d[b]=e.slice(0,f).concat(e.slice(f+1)))}}}function Ea(a,b){var c=Ca(a,b);if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Fa(a,b,c){return"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}}),Ea(a,c||b.type,a,b),La(b)||b.codemirrorIgnore}function Ga(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)m(c,b[d])==-1&&c.push(b[d])}function Ha(a,b){return Ca(a,b).length>0}function Ia(a){a.prototype.on=function(a,b){Yg(this,a,b)},a.prototype.off=function(a,b){Da(this,a,b)}}function Ja(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ka(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function La(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ma(a){Ja(a),Ka(a)}function Na(a){return a.target||a.srcElement}function Oa(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),zg&&a.ctrlKey&&1==b&&(b=3),b}function Pa(a){if(null==Jg){var b=d("span","\u200b");c(a,d("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Jg=b.offsetWidth<=1&&b.offsetHeight>2&&!(ng&&og<8))}var e=Jg?d("span","\u200b"):d("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return e.setAttribute("cm-text",""),e}function Qa(a){if(null!=Kg)return Kg;var d=c(a,document.createTextNode("A\u062eA")),e=Dg(d,0,1).getBoundingClientRect(),f=Dg(d,1,2).getBoundingClientRect();return b(a),!(!e||e.left==e.right)&&(Kg=f.right-e.right<3)}function Ra(a){if(null!=bh)return bh;var b=c(a,d("span","x")),e=b.getBoundingClientRect(),f=Dg(b,0,1).getBoundingClientRect();return bh=Math.abs(e.left-f.left)>1}function Sa(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),ch[a]=b}function Ta(a,b){dh[a]=b}function Ua(a){if("string"==typeof a&&dh.hasOwnProperty(a))a=dh[a];else if(a&&"string"==typeof a.name&&dh.hasOwnProperty(a.name)){var b=dh[a.name];"string"==typeof b&&(b={name:b}),a=t(b,a),a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Ua("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Ua("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function Va(a,b){b=Ua(b);var c=ch[b.name];if(!c)return Va(a,"text/plain");var d=c(a,b);if(eh.hasOwnProperty(b.name)){var e=eh[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var g in b.modeProps)d[g]=b.modeProps[g];return d}function Wa(a,b){var c=eh.hasOwnProperty(a)?eh[a]:eh[a]={};k(b,c)}function Xa(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function Ya(a,b){for(var c;a.innerMode&&(c=a.innerMode(b),c&&c.mode!=a);)b=c.state,a=c.mode;return c||{mode:a,state:b}}function Za(a,b,c){return!a.startState||a.startState(b,c)}function $a(a,b,c,d){var e=[a.state.modeGen],f={};gb(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);for(var g=c.state,h=function(d){var g=a.state.overlays[d],h=1,i=0;c.state=!0,gb(a,b.text,g.mode,c,function(a,b){for(var c=h;i<a;){var d=e[h];d>a&&e.splice(h,1,a,e[h+1],d),h+=2,i=Math.min(a,d)}if(b)if(g.opaque)e.splice(c,h-c,a,"overlay "+b),h=c+2;else for(;c<h;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"overlay "+b}},f)},i=0;i<a.state.overlays.length;++i)h(i);return c.state=g,{styles:e,classes:f.bgClass||f.textClass?f:null}}function _a(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=ab(a,F(b)),e=b.text.length>a.options.maxHighlightLength&&Xa(a.doc.mode,d.state),f=$a(a,b,d);e&&(d.state=e),b.stateAfter=d.save(!e),b.styles=f.styles,f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function ab(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new hh(d,!0,b);var f=hb(a,b,c),g=f>d.first&&B(d,f-1).stateAfter,h=g?hh.fromSaved(d,g,f):new hh(d,Za(d.mode),f);return d.iter(f,b,function(c){bb(a,c.text,h);var d=h.line;c.stateAfter=d==b-1||d%5==0||d>=e.viewFrom&&d<e.viewTo?h.save():null,h.nextLine()}),c&&(d.modeFrontier=h.line),h}function bb(a,b,c,d){var e=a.doc.mode,f=new fh(b,a.options.tabSize,c);for(f.start=f.pos=d||0,""==b&&cb(e,c.state);!f.eol();)db(e,f,c.state),f.start=f.pos}function cb(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=Ya(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function db(a,b,c,d){for(var e=0;e<10;e++){d&&(d[0]=Ya(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw new Error("Mode "+a.name+" failed to advance stream.")}function eb(a,b,c,d){var e,f=a.doc,g=f.mode;b=Q(f,b);var h,i=B(f,b.line),j=ab(a,b.line,c),k=new fh(i.text,a.options.tabSize,j);for(d&&(h=[]);(d||k.pos<b.ch)&&!k.eol();)k.start=k.pos,e=db(g,k,j.state),d&&h.push(new ih(k,e,Xa(f.mode,j.state)));return d?h:new ih(k,e,j.state)}function fb(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function gb(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var i,j=0,k=null,l=new fh(b,a.options.tabSize,d),m=a.options.addModeClass&&[null];for(""==b&&fb(cb(c,d.state),f);!l.eol();){if(l.pos>a.options.maxHighlightLength?(h=!1,g&&bb(a,b,d,l.pos),l.pos=b.length,i=null):i=fb(db(c,l,d.state,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;j<l.start;)j=Math.min(l.start,j+5e3),e(j,k);k=i}l.start=l.pos}for(;j<l.pos;){var o=Math.min(l.pos,j+5e3);e(o,k),j=o}}function hb(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=B(f,h-1),j=i.stateAfter;if(j&&(!c||h+(j instanceof gh?j.lookAhead:0)<=f.modeFrontier))return h;var k=l(i.text,null,a.options.tabSize);(null==e||d>k)&&(e=h-1,d=k)}return e}function ib(a,b){if(a.modeFrontier=Math.min(a.modeFrontier,b),!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=B(a,d).stateAfter;if(e&&(!(e instanceof gh)||d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function jb(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),ca(a),da(a,c);var e=d?d(a):1;e!=a.height&&E(a,e)}function kb(a){a.parent=null,ca(a)}function lb(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?mh:lh;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function mb(a,b){var c=e("span",null,null,pg?"padding-right: .1px":null),d={pre:e("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(ng||pg)&&a.getOption("lineWrapping")};b.measure={};for(var f=0;f<=(b.rest?b.rest.length:0);f++){var g=f?b.rest[f-1]:b.line,h=void 0;d.pos=0,d.addToken=ob,Qa(a.display.measure)&&(h=xa(g,a.doc.direction))&&(d.addToken=qb(d.addToken,h)),d.map=[];var j=b!=a.display.externalMeasured&&F(g);sb(g,d,_a(a,g,j)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=i(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=i(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Pa(a.display.measure))),0==f?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(pg){var k=d.content.lastChild;(/\bcm-tab\b/.test(k.className)||k.querySelector&&k.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack")}return Ea(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=i(d.pre.className,d.textClass||"")),d}function nb(a){var b=d("span","\u2022","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function ob(a,b,c,e,f,g,h){if(b){var i,j=a.splitSpaces?pb(b,a.trailingSpace):b,k=a.cm.state.specialChars,l=!1;if(k.test(b)){i=document.createDocumentFragment();for(var m=0;;){k.lastIndex=m;var n=k.exec(b),p=n?n.index-m:b.length-m;if(p){var q=document.createTextNode(j.slice(m,m+p));ng&&og<9?i.appendChild(d("span",[q])):i.appendChild(q),a.map.push(a.pos,a.pos+p,q),a.col+=p,a.pos+=p}if(!n)break;m+=p+1;var r=void 0;if("\t"==n[0]){var s=a.cm.options.tabSize,t=s-a.col%s;r=i.appendChild(d("span",o(t),"cm-tab")),r.setAttribute("role","presentation"),r.setAttribute("cm-text","\t"),a.col+=t}else"\r"==n[0]||"\n"==n[0]?(r=i.appendChild(d("span","\r"==n[0]?"\u240d":"\u2424","cm-invalidchar")),r.setAttribute("cm-text",n[0]),a.col+=1):(r=a.cm.options.specialCharPlaceholder(n[0]),r.setAttribute("cm-text",n[0]),ng&&og<9?i.appendChild(d("span",[r])):i.appendChild(r),a.col+=1);a.map.push(a.pos,a.pos+1,r),a.pos++}}else a.col+=b.length,i=document.createTextNode(j),a.map.push(a.pos,a.pos+b.length,i),ng&&og<9&&(l=!0),a.pos+=b.length;if(a.trailingSpace=32==j.charCodeAt(b.length-1),c||e||f||l||h){var u=c||"";e&&(u+=e),f&&(u+=f);var v=d("span",[i],u,h);return g&&(v.title=g),a.content.appendChild(v)}a.content.appendChild(i)}}function pb(a,b){if(a.length>1&&!/ /.test(a))return a;for(var c=b,d="",e=0;e<a.length;e++){var f=a.charAt(e);" "!=f||!c||e!=a.length-1&&32!=a.charCodeAt(e+1)||(f="\xa0"),d+=f,c=" "==f}return d}function qb(a,b){return function(c,d,e,f,g,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var j=c.pos,k=j+d.length;;){for(var l=void 0,m=0;m<b.length&&(l=b[m],!(l.to>j&&l.from<=j));m++);if(l.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,l.to-j),e,f,null,h,i),f=null,d=d.slice(l.to-j),j=l.to}}}function rb(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b,a.trailingSpace=!1}function sb(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=void 0,u=0;u<d.length;++u){var v=d[u],w=v.marker;"bookmark"==w.type&&v.from==o&&w.widgetNode?s.push(w):v.from<=o&&(null==v.to||v.to>o||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(t||(t=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||ga(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(t)for(var x=0;x<t.length;x+=2)t[x+1]==r&&(j+=" "+t[x]);if(!m||m.from==o)for(var y=0;y<s.length;++y)rb(b,0,s[y]);if(m&&(m.from||0)==o){if(rb(b,(null==m.to?n+1:m.to)-o,m.marker,null==m.from),null==m.to)return;m.to==o&&(m=!1)}}if(o>=n)break;for(var z=Math.min(n,r);;){if(q){var A=o+q.length;if(!m){var B=A>z?q.slice(0,z-o):q;b.addToken(b,B,g?g+i:i,k,o+B.length==r?j:"",l,h)}if(A>=z){q=q.slice(z-o),o=z;break}o=A,k=""}q=e.slice(f,f=c[p++]),g=lb(c[p++],b.cm.options)}}else for(var C=1;C<c.length;C+=2)b.addToken(b,e.slice(f,f=c[C]),lb(c[C+1],b.cm.options))}function tb(a,b,c){this.line=b,this.rest=na(b),this.size=this.rest?F(p(this.rest))-c+1:1,this.node=this.text=null,this.hidden=qa(a,b)}function ub(a,b,c){for(var d,e=[],f=b;f<c;f=d){var g=new tb(a.doc,B(a.doc,f),f);d=f+g.size,e.push(g)}return e}function vb(a){nh?nh.ops.push(a):a.ownsGroup=nh={ops:[a],delayedCallbacks:[]}}function wb(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c].call(null);for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(c<b.length)}function xb(a,b){var c=a.ownsGroup;if(c)try{wb(c)}finally{nh=null,b(c)}}function yb(a,b){var c=Ca(a,b);if(c.length){var d,e=Array.prototype.slice.call(arguments,2);nh?d=nh.delayedCallbacks:oh?d=oh:(d=oh=[],setTimeout(zb,0));for(var f=function(a){d.push(function(){return c[a].apply(null,e)})},g=0;g<c.length;++g)f(g)}}function zb(){var a=oh;oh=null;for(var b=0;b<a.length;++b)a[b]()}function Ab(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?Eb(a,b):"gutter"==f?Gb(a,b,c,d):"class"==f?Fb(a,b):"widget"==f&&Hb(a,b,d)}b.changes=null}function Bb(a){return a.node==a.text&&(a.node=d("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),ng&&og<8&&(a.node.style.zIndex=2)),a.node}function Cb(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;if(c&&(c+=" CodeMirror-linebackground"),b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var e=Bb(b);b.background=e.insertBefore(d("div",null,c),e.firstChild),a.display.input.setUneditable(b.background)}}function Db(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):mb(a,b)}function Eb(a,b){var c=b.text.className,d=Db(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,Fb(a,b)):c&&(b.text.className=c)}function Fb(a,b){Cb(a,b),b.line.wrapClass?Bb(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");var c=b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass;b.text.className=c||""}function Gb(a,b,c,e){if(b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null),b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null),b.line.gutterClass){var f=Bb(b);b.gutterBackground=d("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px; width: "+e.gutterTotalWidth+"px"),a.display.input.setUneditable(b.gutterBackground),f.insertBefore(b.gutterBackground,b.text)}var g=b.line.gutterMarkers;if(a.options.lineNumbers||g){var h=Bb(b),i=b.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px");if(a.display.input.setUneditable(i),h.insertBefore(i,b.text),b.line.gutterClass&&(i.className+=" "+b.line.gutterClass),!a.options.lineNumbers||g&&g["CodeMirror-linenumbers"]||(b.lineNumber=i.appendChild(d("div",I(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),g)for(var j=0;j<a.options.gutters.length;++j){var k=a.options.gutters[j],l=g.hasOwnProperty(k)&&g[k];l&&i.appendChild(d("div",[l],"CodeMirror-gutter-elt","left: "+e.gutterLeft[k]+"px; width: "+e.gutterWidth[k]+"px"))}}}function Hb(a,b,c){b.alignable&&(b.alignable=null);for(var d=b.node.firstChild,e=void 0;d;d=e)e=d.nextSibling,"CodeMirror-linewidget"==d.className&&b.node.removeChild(d);Jb(a,b,c)}function Ib(a,b,c,d){var e=Db(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),Fb(a,b),Gb(a,b,c,d),Jb(a,b,d),b.node}function Jb(a,b,c){if(Kb(a,b.line,b,c,!0),b.rest)for(var d=0;d<b.rest.length;d++)Kb(a,b.rest[d],b,c,!1)}function Kb(a,b,c,e,f){if(b.widgets)for(var g=Bb(c),h=0,i=b.widgets;h<i.length;++h){var j=i[h],k=d("div",[j.node],"CodeMirror-linewidget");j.handleMouseEvents||k.setAttribute("cm-ignore-events","true"),Lb(j,k,c,e),a.display.input.setUneditable(k),f&&j.above?g.insertBefore(k,c.gutter||c.text):g.appendChild(k),yb(j,"redraw")}}function Lb(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function Mb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!f(document.body,a.node)){var e="position: relative;";a.coverGutter&&(e+="margin-left: -"+b.display.gutters.offsetWidth+"px;"),a.noHScroll&&(e+="width: "+b.display.wrapper.clientWidth+"px;"),c(b.display.measure,d("div",[a.node],null,e))}return a.height=a.node.parentNode.offsetHeight}function Nb(a,b){for(var c=Na(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ob(a){return a.lineSpace.offsetTop}function Pb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Qb(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=c(a.measure,d("pre","x")),e=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,f={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};return isNaN(f.left)||isNaN(f.right)||(a.cachedPaddingH=f),f}function Rb(a){return Lg-a.display.nativeBarWidth}function Sb(a){return a.display.scroller.clientWidth-Rb(a)-a.display.barWidth}function Tb(a){return a.display.scroller.clientHeight-Rb(a)-a.display.barHeight}function Ub(a,b,c){var d=a.options.lineWrapping,e=d&&Sb(a);if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Vb(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var e=0;e<a.rest.length;e++)if(F(a.rest[e])>c)return{map:a.measure.maps[e],cache:a.measure.caches[e],before:!0}}function Wb(a,b){b=la(b);var d=F(b),e=a.display.externalMeasured=new tb(a.doc,b,d);e.lineN=d;var f=e.built=mb(a,e);return e.text=f.pre,c(a.display.lineMeasure,f.pre),e}function Xb(a,b,c,d){return $b(a,Zb(a,b),c,d)}function Yb(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[zc(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function Zb(a,b){var c=F(b),d=Yb(a,c);d&&!d.text?d=null:d&&d.changes&&(Ab(a,d,c,uc(a)),a.curOp.forceUpdate=!0),d||(d=Wb(a,b));var e=Vb(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function $b(a,b,c,d,e){b.before&&(c=-1);var f,g=c+(d||"");return b.cache.hasOwnProperty(g)?f=b.cache[g]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(Ub(a,b.view,b.rect),b.hasHeights=!0),f=bc(a,b,c,d),f.bogus||(b.cache[g]=f)),{left:f.left,right:f.right,top:e?f.rtop:f.top,bottom:e?f.rbottom:f.bottom}}function _b(a,b,c){for(var d,e,f,g,h,i,j=0;j<a.length;j+=3)if(h=a[j],i=a[j+1],b<h?(e=0,f=1,g="left"):b<i?(e=b-h,f=e+1):(j==a.length-3||b==i&&a[j+3]>b)&&(f=i-h,e=f-1,b>=i&&(g="right")),null!=e){if(d=a[j+2],h==i&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;j&&a[j-2]==a[j-3]&&a[j-1].insertLeft;)d=a[(j-=3)+2],g="left";if("right"==c&&e==i-h)for(;j<a.length-3&&a[j+3]==a[j+4]&&!a[j+5].insertLeft;)d=a[(j+=3)+2],g="right";break}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:i}}function ac(a,b){var c=ph;if("left"==b)for(var d=0;d<a.length&&(c=a[d]).left==c.right;d++);else for(var e=a.length-1;e>=0&&(c=a[e]).left==c.right;e--);return c}function bc(a,b,c,d){var e,f=_b(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;k<4;k++){for(;h&&x(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i<f.coverEnd&&x(b.line.text.charAt(f.coverStart+i));)++i;if(e=ng&&og<9&&0==h&&i==f.coverEnd-f.coverStart?g.parentNode.getBoundingClientRect():ac(Dg(g,h,i).getClientRects(),d),e.left||e.right||0==h)break;i=h,h-=1,j="right"}ng&&og<11&&(e=cc(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(ng&&og<9&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+tc(a.display),top:m.top,bottom:m.bottom}:ph}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,r=0;r<q.length-1&&!(p<q[r]);r++);var s=r?q[r-1]:0,t=q[r],u={left:("right"==j?e.right:e.left)-b.rect.left,right:("left"==j?e.left:e.right)-b.rect.left,top:s,bottom:t};return e.left||e.right||(u.bogus=!0),a.options.singleCursorHeightPerLine||(u.rtop=n,u.rbottom=o),u}function cc(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ra(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function dc(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ec(a){a.display.externalMeasure=null,b(a.display.lineMeasure);for(var c=0;c<a.display.view.length;c++)dc(a.display.view[c])}function fc(a){ec(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function gc(){return rg&&xg?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function hc(){return rg&&xg?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ic(a,b,c,d,e){if(!e&&b.widgets)for(var f=0;f<b.widgets.length;++f)if(b.widgets[f].above){var g=Mb(b.widgets[f]);c.top+=g,c.bottom+=g}if("line"==d)return c;d||(d="local");var h=sa(b);if("local"==d?h+=Ob(a.display):h-=a.display.viewOffset,"page"==d||"window"==d){var i=a.display.lineSpace.getBoundingClientRect();h+=i.top+("window"==d?0:hc());var j=i.left+("window"==d?0:gc());c.left+=j,c.right+=j}return c.top+=h,c.bottom+=h,c}function jc(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=gc(),e-=hc();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function kc(a,b,c,d,e){return d||(d=B(a.doc,b.line)),ic(a,d,Xb(a,d,b.ch,e),c)}function lc(a,b,c,d,e,f){function g(b,g){var h=$b(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,ic(a,d,h,c)}function h(a,b,c){var d=i[b],e=d.level%2!=0;return g(c?a-1:a,e!=c)}d=d||B(a.doc,b.line),e||(e=Zb(a,d));var i=xa(d,a.doc.direction),j=b.ch,k=b.sticky;if(j>=d.text.length?(j=d.text.length,k="before"):j<=0&&(j=0,k="after"),!i)return g("before"==k?j-1:j,"before"==k);var l=wa(i,j,k),m=Vg,n=h(j,l,"before"==k);return null!=m&&(n.other=h(j,m,"before"!=k)),n}function mc(a,b){var c=0;b=Q(a.doc,b),a.options.lineWrapping||(c=tc(a.display)*b.ch);var d=B(a.doc,b.line),e=sa(d)+Ob(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function nc(a,b,c,d,e){var f=J(a,b,c);return f.xRel=e,d&&(f.outside=!0),f}function oc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return nc(d.first,0,null,!0,-1);var e=G(d,c),f=d.first+d.size-1;if(e>f)return nc(d.first+d.size-1,B(d,f).text.length,null,!0,1);b<0&&(b=0);for(var g=B(d,e);;){var h=rc(a,g,e,b,c),i=ja(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=F(g=j.to.line)}}function pc(a,b,c,d){var e=function(d){return ic(a,b,$b(a,c,d),"line")},f=b.text.length,g=z(function(a){return e(a-1).bottom<=d},f,0);return f=z(function(a){return e(a).top>d},g,f),{begin:g,end:f}}function qc(a,b,c,d){var e=ic(a,b,$b(a,c,d),"line").top;return pc(a,b,c,e)}function rc(a,b,c,d,e){e-=sa(b);var f,g=0,h=b.text.length,i=Zb(a,b),j=xa(b,a.doc.direction);if(j){if(a.options.lineWrapping){var k;k=pc(a,b,i,e),g=k.begin,h=k.end}f=new J(c,Math.floor(g+(h-g)/2));var l,m,n=lc(a,f,"line",b,i).left,o=n<d?1:-1,p=n-d,q=Math.ceil((h-g)/4);a:do{l=p,m=f;for(var r=0;r<q;++r){var s=f;if(f=Ba(a,b,f,o),null==f||f.ch<g||h<=("before"==f.sticky?f.ch-1:f.ch)){f=s;break a}}if(p=lc(a,f,"line",b,i).left-d,q>1){var t=Math.abs(p-l)/q;q=Math.min(q,Math.ceil(Math.abs(p)/t)),o=p<0?1:-1}}while(0!=p&&(q>1||o<0!=p<0&&Math.abs(p)<=Math.abs(l)));if(Math.abs(p)>Math.abs(l)){if(p<0==l<0)throw new Error("Broke out of infinite loop in coordsCharInner");f=m}}else{var u=z(function(c){var f=ic(a,b,$b(a,i,c),"line");return f.top>e?(h=Math.min(c,h),!0):!(f.bottom<=e)&&(f.left>d||!(f.right<d)&&d-f.left<f.right-d)},g,h);u=y(b.text,u,1),f=new J(c,u,u==h?"before":"after")}var v=lc(a,f,"line",b,i);return(e<v.top||v.bottom<e)&&(f.outside=!0),f.xRel=d<v.left?-1:d>v.right?1:0,f}function sc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==kh){kh=d("pre");for(var e=0;e<49;++e)kh.appendChild(document.createTextNode("x")),kh.appendChild(d("br"));kh.appendChild(document.createTextNode("x"))}c(a.measure,kh);var f=kh.offsetHeight/50;return f>3&&(a.cachedTextHeight=f),b(a.measure),f||1}function tc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=d("span","xxxxxxxxxx"),e=d("pre",[b]);c(a.measure,e);var f=b.getBoundingClientRect(),g=(f.right-f.left)/10;return g>2&&(a.cachedCharWidth=g),g||10}function uc(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:vc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function vc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function wc(a){var b=sc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/tc(a.display)-3);return function(e){if(qa(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function xc(a){var b=a.doc,c=wc(a);b.iter(function(a){var b=c(a);b!=a.height&&E(a,b)})}function yc(a,b,c,d){var e=a.display;if(!c&&"true"==Na(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=oc(a,f,g);if(d&&1==j.xRel&&(i=B(a.doc,j.line).text).length==j.ch){var k=l(i,i.length,a.options.tabSize)-i.length;j=J(j.line,Math.max(0,Math.round((f-Qb(a.display).left)/tc(a.display))-k))}return j}function zc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,b<0)return d}function Ac(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Bc(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(b!==!1||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var i=h.empty();(i||a.options.showCursorWhenSelecting)&&Cc(a,h.head,e),i||Ec(a,h,f)}}return d}function Cc(a,b,c){var e=lc(a,b,"div",null,null,!a.options.singleCursorHeightPerLine),f=c.appendChild(d("div","\xa0","CodeMirror-cursor"));if(f.style.left=e.left+"px",f.style.top=e.top+"px",f.style.height=Math.max(0,e.bottom-e.top)*a.options.cursorHeight+"px",e.other){var g=c.appendChild(d("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=e.other.left+"px",g.style.top=e.other.top+"px",g.style.height=.85*(e.other.bottom-e.other.top)+"px"}}function Dc(a,b){return a.top-b.top||a.left-b.left}function Ec(a,b,c){ function e(a,b,c,e){b<0&&(b=0),b=Math.round(b),e=Math.round(e),i.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+b+"px; width: "+(null==c?l-a:c)+"px;\n height: "+(e-b)+"px"))}function f(b,c,d){function f(c,d){return kc(a,J(b,c),"div",j,d)}var g,i,j=B(h,b),m=j.text.length;return va(xa(j,h.direction),c||0,null==d?m:d,function(a,b,h){var j,n;if("ltr"==h){j=f(a,"left"),n=f(b-1,"right");var o=null==c&&0==a?k:j.left,p=null==d&&b==m?l:n.right;n.top-j.top<=3?e(o,n.top,p-o,n.bottom):(e(o,j.top,null,j.bottom),j.bottom<n.top&&e(k,j.bottom,null,n.top),e(k,n.top,n.right,n.bottom))}else{j=f(a,"right"),n=f(b-1,"left");var q=null==c&&0==a?l:j.right,r=null==d&&b==m?k:n.left;n.top-j.top<=3?e(r,n.top,q-r,n.bottom):(e(k,j.top,q-k,j.bottom),j.bottom<n.top&&e(k,j.bottom,null,n.top),e(r,n.top,null,n.bottom))}(!g||Dc(j,g)<0)&&(g=j),Dc(n,g)<0&&(g=n),(!i||Dc(j,i)<0)&&(i=j),Dc(n,i)<0&&(i=n)}),{start:g,end:i}}var g=a.display,h=a.doc,i=document.createDocumentFragment(),j=Qb(a.display),k=j.left,l=Math.max(g.sizerWidth,Sb(a)-g.sizer.offsetLeft)-j.right,m=b.from(),n=b.to();if(m.line==n.line)f(m.line,m.ch,n.ch);else{var o=B(h,m.line),p=B(h,n.line),q=la(o)==la(p),r=f(m.line,m.ch,q?o.text.length+1:null).end,s=f(n.line,q?0:null,n.ch).start;q&&(r.top<s.top-2?(e(r.right,r.top,null,r.bottom),e(k,s.top,s.left,s.bottom)):e(r.right,r.top,s.left-r.right,r.bottom)),r.bottom<s.top&&e(k,r.bottom,null,s.top)}c.appendChild(i)}function Fc(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Gc(a){a.state.focused||(a.display.input.focus(),Ic(a))}function Hc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Jc(a))},100)}function Ic(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Ea(a,"focus",a,b),a.state.focused=!0,h(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),pg&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Fc(a))}function Jc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(Ea(a,"blur",a,b),a.state.focused=!1,Gg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Kc(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d<b.view.length;d++){var e=b.view[d],f=void 0;if(!e.hidden){if(ng&&og<8){var g=e.node.offsetTop+e.node.offsetHeight;f=g-c,c=g}else{var h=e.node.getBoundingClientRect();f=h.bottom-h.top}var i=e.line.height-f;if(f<2&&(f=sc(b)),(i>.005||i<-.005)&&(E(e.line,f),Lc(e.line),e.rest))for(var j=0;j<e.rest.length;j++)Lc(e.rest[j])}}}function Lc(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function Mc(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Ob(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=G(b,d),g=G(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;h<f?(f=h,g=G(b,sa(B(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=G(b,sa(B(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function Nc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=vc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&(c[g].gutter&&(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Oc(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=I(a.options,b.first+b.size-1),e=a.display;if(c.length!=e.lineNumChars){var f=e.measure.appendChild(d("div",[d("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),g=f.firstChild.offsetWidth,h=f.offsetWidth-g;return e.lineGutter.style.width="",e.lineNumInnerWidth=Math.max(g,e.lineGutter.offsetWidth-h)+1,e.lineNumWidth=e.lineNumInnerWidth+h,e.lineNumChars=e.lineNumInnerWidth?c.length:-1,e.lineGutter.style.width=e.lineNumWidth+"px",Fd(a),!0}return!1}function Pc(a,b){if(!Fa(a,"scrollCursorIntoView")){var c=a.display,e=c.sizer.getBoundingClientRect(),f=null;if(b.top+e.top<0?f=!0:b.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),null!=f&&!vg){var g=d("div","\u200b",null,"position: absolute;\n top: "+(b.top-c.viewOffset-Ob(a.display))+"px;\n height: "+(b.bottom-b.top+Rb(a)+c.barHeight)+"px;\n left: "+b.left+"px; width: "+Math.max(2,b.right-b.left)+"px;");a.display.lineSpace.appendChild(g),g.scrollIntoView(f),a.display.lineSpace.removeChild(g)}}}function Qc(a,b,c,d){null==d&&(d=0);var e;a.options.lineWrapping||b!=c||(b=b.ch?J(b.line,"before"==b.sticky?b.ch-1:b.ch,"after"):b,c="before"==b.sticky?J(b.line,b.ch+1,"before"):b);for(var f=0;f<5;f++){var g=!1,h=lc(a,b),i=c&&c!=b?lc(a,c):h;e={left:Math.min(h.left,i.left),top:Math.min(h.top,i.top)-d,right:Math.max(h.left,i.left),bottom:Math.max(h.bottom,i.bottom)+d};var j=Sc(a,e),k=a.doc.scrollTop,l=a.doc.scrollLeft;if(null!=j.scrollTop&&(Zc(a,j.scrollTop),Math.abs(a.doc.scrollTop-k)>1&&(g=!0)),null!=j.scrollLeft&&(_c(a,j.scrollLeft),Math.abs(a.doc.scrollLeft-l)>1&&(g=!0)),!g)break}return e}function Rc(a,b){var c=Sc(a,b);null!=c.scrollTop&&Zc(a,c.scrollTop),null!=c.scrollLeft&&_c(a,c.scrollLeft)}function Sc(a,b){var c=a.display,d=sc(a.display);b.top<0&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,f=Tb(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+Pb(c),i=b.top<d,j=b.bottom>h-d;if(b.top<e)g.scrollTop=i?0:b.top;else if(b.bottom>e+f){var k=Math.min(b.top,(j?h:b.bottom)-f);k!=e&&(g.scrollTop=k)}var l=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft,m=Sb(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0),n=b.right-b.left>m;return n&&(b.right=b.left+m),b.left<10?g.scrollLeft=0:b.left<l?g.scrollLeft=Math.max(0,b.left-(n?0:10)):b.right>m+l-3&&(g.scrollLeft=b.right+(n?0:10)-m),g}function Tc(a,b){null!=b&&(Xc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Uc(a){Xc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Vc(a,b,c){null==b&&null==c||Xc(a),null!=b&&(a.curOp.scrollLeft=b),null!=c&&(a.curOp.scrollTop=c)}function Wc(a,b){Xc(a),a.curOp.scrollToPos=b}function Xc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=mc(a,b.from),d=mc(a,b.to);Yc(a,c,d,b.margin)}}function Yc(a,b,c,d){var e=Sc(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Vc(a,e.scrollLeft,e.scrollTop)}function Zc(a,b){Math.abs(a.doc.scrollTop-b)<2||(jg||Dd(a,{top:b}),$c(a,b,!0),jg&&Dd(a),wd(a,100))}function $c(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b),(a.display.scroller.scrollTop!=b||c)&&(a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b))}function _c(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)&&!d||(a.doc.scrollLeft=b,Nc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function ad(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Pb(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Rb(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function bd(a,b){b||(b=ad(a));var c=a.display.barWidth,d=a.display.barHeight;cd(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&Kc(a),cd(a,ad(a)),c=a.display.barWidth,d=a.display.barHeight}function cd(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",c.heightForcer.style.borderBottom=d.bottom+"px solid transparent",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function dd(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Gg(a.display.wrapper,a.display.scrollbars.addClass)),a.display.scrollbars=new sh[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller),Yg(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)}),b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?_c(a,b):Zc(a,b)},a),a.display.scrollbars.addClass&&h(a.display.wrapper,a.display.scrollbars.addClass)}function ed(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++th},vb(a.curOp)}function fd(a){var b=a.curOp;xb(b,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;gd(a)})}function gd(a){for(var b=a.ops,c=0;c<b.length;c++)hd(b[c]);for(var d=0;d<b.length;d++)id(b[d]);for(var e=0;e<b.length;e++)jd(b[e]);for(var f=0;f<b.length;f++)kd(b[f]);for(var g=0;g<b.length;g++)ld(b[g])}function hd(a){var b=a.cm,c=b.display;yd(b),a.updateMaxLine&&ua(b),a.mustUpdate=a.viewChanged||a.forceUpdate||null!=a.scrollTop||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new uh(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function id(a){a.updatedDisplay=a.mustUpdate&&Bd(a.cm,a.update)}function jd(a){var b=a.cm,c=b.display;a.updatedDisplay&&Kc(b),a.barMeasure=ad(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Xb(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Rb(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Sb(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function kd(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&_c(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1);var c=a.focus&&a.focus==g()&&(!document.hasFocus||document.hasFocus());a.preparedSelection&&b.display.input.showSelection(a.preparedSelection,c),(a.updatedDisplay||a.startHeight!=b.doc.height)&&bd(b,a.barMeasure),a.updatedDisplay&&Gd(b,a.barMeasure),a.selectionChanged&&Fc(b),b.state.focused&&a.updateInput&&b.display.input.reset(a.typing),c&&Gc(a.cm)}function ld(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay&&Cd(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null!=a.scrollTop&&$c(b,a.scrollTop,a.forceScroll),null!=a.scrollLeft&&_c(b,a.scrollLeft,!0,!0),a.scrollToPos){var e=Qc(b,Q(d,a.scrollToPos.from),Q(d,a.scrollToPos.to),a.scrollToPos.margin);Pc(b,e)}var f=a.maybeHiddenMarkers,g=a.maybeUnhiddenMarkers;if(f)for(var h=0;h<f.length;++h)f[h].lines.length||Ea(f[h],"hide");if(g)for(var i=0;i<g.length;++i)g[i].lines.length&&Ea(g[i],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.changeObjs&&Ea(b,"changes",b,a.changeObjs),a.update&&a.update.finish()}function md(a,b){if(a.curOp)return b();ed(a);try{return b()}finally{fd(a)}}function nd(a,b){return function(){if(a.curOp)return b.apply(a,arguments);ed(a);try{return b.apply(a,arguments)}finally{fd(a)}}}function od(a){return function(){if(this.curOp)return a.apply(this,arguments);ed(this);try{return a.apply(this,arguments)}finally{fd(this)}}}function pd(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);ed(b);try{return a.apply(this,arguments)}finally{fd(b)}}}function qd(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Ug&&oa(a.doc,b)<e.viewTo&&sd(a);else if(c<=e.viewFrom)Ug&&pa(a.doc,c+d)>e.viewFrom?sd(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)sd(a);else if(b<=e.viewFrom){var f=td(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):sd(a)}else if(c>=e.viewTo){var g=td(a,b,b,-1);g?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):sd(a)}else{var h=td(a,b,b,-1),i=td(a,c,c+d,1);h&&i?(e.view=e.view.slice(0,h.index).concat(ub(a,h.lineN,i.lineN)).concat(e.view.slice(i.index)),e.viewTo+=d):sd(a)}var j=e.externalMeasured;j&&(c<j.lineN?j.lineN+=d:b<j.lineN+j.size&&(e.externalMeasured=null))}function rd(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[zc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);m(g,c)==-1&&g.push(c)}}}function sd(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function td(a,b,c,d){var e,f=zc(a,b),g=a.display.view;if(!Ug||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=a.display.viewFrom,i=0;i<f;i++)h+=g[i].size;if(h!=b){if(d>0){if(f==g.length-1)return null;e=h+g[f].size-b,f++}else e=h-b;b+=e,c+=e}for(;oa(a.doc,c)!=c;){if(f==(d<0?0:g.length-1))return null;c+=d*g[f-(d<0?1:0)].size,f+=d}return{index:f,lineN:c}}function ud(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=ub(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=ub(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(zc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(ub(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,zc(a,c)))),d.viewTo=c}function vd(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function wd(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,j(xd,a))}function xd(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=ab(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?Xa(b.mode,d.state):null,i=$a(a,f,d,!0);h&&(d.state=h),f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&m<g.length;++m)l=g[m]!=f.styles[m];l&&e.push(d.line),f.stateAfter=d.save(),d.nextLine()}else f.text.length<=a.options.maxHighlightLength&&bb(a,f.text,d),f.stateAfter=d.line%5==0?d.save():null,d.nextLine();if(+new Date>c)return wd(a,a.options.workDelay),!0}),b.highlightFrontier=d.line,b.modeFrontier=Math.max(b.modeFrontier,d.line),e.length&&md(a,function(){for(var b=0;b<e.length;b++)rd(a,e[b],"text")})}}function yd(a){var b=a.display;!b.scrollbarsClipped&&b.scroller.offsetWidth&&(b.nativeBarWidth=b.scroller.offsetWidth-b.scroller.clientWidth,b.heightForcer.style.height=Rb(a)+"px",b.sizer.style.marginBottom=-b.nativeBarWidth+"px",b.sizer.style.borderRightWidth=Rb(a)+"px",b.scrollbarsClipped=!0)}function zd(a){if(a.hasFocus())return null;var b=g();if(!b||!f(a.display.lineDiv,b))return null;var c={activeElt:b};if(window.getSelection){var d=window.getSelection();d.anchorNode&&d.extend&&f(a.display.lineDiv,d.anchorNode)&&(c.anchorNode=d.anchorNode,c.anchorOffset=d.anchorOffset,c.focusNode=d.focusNode,c.focusOffset=d.focusOffset)}return c}function Ad(a){if(a&&a.activeElt&&a.activeElt!=g()&&(a.activeElt.focus(),a.anchorNode&&f(document.body,a.anchorNode)&&f(document.body,a.focusNode))){var b=window.getSelection(),c=document.createRange();c.setEnd(a.anchorNode,a.anchorOffset),c.collapse(!1),b.removeAllRanges(),b.addRange(c),b.extend(a.focusNode,a.focusOffset)}}function Bd(a,c){var d=a.display,e=a.doc;if(c.editorIsHidden)return sd(a),!1;if(!c.force&&c.visible.from>=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==vd(a))return!1;Oc(a)&&(sd(a),c.dims=uc(a));var f=e.first+e.size,g=Math.max(c.visible.from-a.options.viewportMargin,e.first),h=Math.min(f,c.visible.to+a.options.viewportMargin);d.viewFrom<g&&g-d.viewFrom<20&&(g=Math.max(e.first,d.viewFrom)),d.viewTo>h&&d.viewTo-h<20&&(h=Math.min(f,d.viewTo)),Ug&&(g=oa(a.doc,g),h=pa(a.doc,h));var i=g!=d.viewFrom||h!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;ud(a,g,h),d.viewOffset=sa(B(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var j=vd(a);if(!i&&0==j&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;var k=zd(a);return j>4&&(d.lineDiv.style.display="none"),Ed(a,d.updateLineNumbers,c.dims),j>4&&(d.lineDiv.style.display=""),d.renderedView=d.view,Ad(k),b(d.cursorDiv),b(d.selectionDiv),d.gutters.style.height=d.sizer.style.minHeight=0,i&&(d.lastWrapHeight=c.wrapperHeight,d.lastWrapWidth=c.wrapperWidth,wd(a,400)),d.updateLineNumbers=null,!0}function Cd(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Sb(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Pb(a.display)-Tb(a),c.top)}),b.visible=Mc(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&Bd(a,b);d=!1){Kc(a);var e=ad(a);Ac(a),bd(a,e),Gd(a,e),b.force=!1}b.signal(a,"update",a),a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function Dd(a,b){var c=new uh(a,b);if(Bd(a,c)){Kc(a),Cd(a,c);var d=ad(a);Ac(a),bd(a,d),Gd(a,d),c.finish()}}function Ed(a,c,d){function e(b){var c=b.nextSibling;return pg&&zg&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var f=a.display,g=a.options.lineNumbers,h=f.lineDiv,i=h.firstChild,j=f.view,k=f.viewFrom,l=0;l<j.length;l++){var n=j[l];if(n.hidden);else if(n.node&&n.node.parentNode==h){for(;i!=n.node;)i=e(i);var o=g&&null!=c&&c<=k&&n.lineNumber;n.changes&&(m(n.changes,"gutter")>-1&&(o=!1),Ab(a,n,k,d)),o&&(b(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(I(a.options,k)))),i=n.node.nextSibling}else{var p=Ib(a,n,k,d);h.insertBefore(p,i)}k+=n.size}for(;i;)i=e(i)}function Fd(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function Gd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Rb(a)+"px"}function Hd(a){var c=a.display.gutters,e=a.options.gutters;b(c);for(var f=0;f<e.length;++f){var g=e[f],h=c.appendChild(d("div",null,"CodeMirror-gutter "+g));"CodeMirror-linenumbers"==g&&(a.display.lineGutter=h,h.style.width=(a.display.lineNumWidth||1)+"px")}c.style.display=f?"":"none",Fd(a)}function Id(a){var b=m(a.gutters,"CodeMirror-linenumbers");b==-1&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Jd(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}}function Kd(a){var b=Jd(a);return b.x*=wh,b.y*=wh,b}function Ld(a,b){var c=Jd(b),d=c.x,e=c.y,f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&zg&&pg)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==j){a.display.currentWheelTarget=j;break a}if(d&&!jg&&!sg&&null!=wh)return e&&i&&Zc(a,Math.max(0,g.scrollTop+e*wh)),_c(a,Math.max(0,g.scrollLeft+d*wh)),(!e||e&&i)&&Ja(b),void(f.wheelStartX=null);if(e&&null!=wh){var m=e*wh,n=a.doc.scrollTop,o=n+f.wrapper.clientHeight;m<0?n=Math.max(0,n+m-50):o=Math.min(a.doc.height,o+m+50),Dd(a,{top:n,bottom:o})}vh<20&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(wh=(wh*vh+c)/(vh+1),++vh)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function Md(a,b){var c=a[b];a.sort(function(a,b){return K(a.from(),b.from())}),b=m(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(K(f.to(),e.from())>=0){var g=O(f.from(),e.from()),h=N(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new yh(i?h:g,i?g:h))}}return new xh(a,b)}function Nd(a,b){return new xh([new yh(a,b||a)],0)}function Od(a){return a.text?J(a.from.line+a.text.length-1,p(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Pd(a,b){if(K(a,b.from)<0)return a;if(K(a,b.to)<=0)return Od(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Od(b).ch-b.to.ch),J(c,d)}function Qd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new yh(Pd(e.anchor,b),Pd(e.head,b)))}return Md(c,a.sel.primIndex)}function Rd(a,b,c){return a.line==b.line?J(c.line,a.ch-b.ch+c.ch):J(c.line+(a.line-b.line),a.ch)}function Sd(a,b,c){for(var d=[],e=J(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Rd(h.from,e,f),j=Rd(Od(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=K(k.head,k.anchor)<0;d[g]=new yh(l?j:i,l?i:j)}else d[g]=new yh(i,i)}return new xh(d,a.sel.primIndex)}function Td(a){a.doc.mode=Va(a.options,a.doc.modeOption),Ud(a)}function Ud(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first,wd(a,100),a.state.modeGen++,a.curOp&&qd(a)}function Vd(a,b){return 0==b.from.ch&&0==b.to.ch&&""==p(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Wd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){jb(a,c,e,d),yb(a,"change",a,b)}function g(a,b){for(var c=[],f=a;f<b;++f)c.push(new jh(j[f],e(f),d));return c}var h=b.from,i=b.to,j=b.text,k=B(a,h.line),l=B(a,i.line),m=p(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Vd(a,b)){var q=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),q.length&&a.insert(h.line,q)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var r=g(1,j.length-1);r.push(new jh(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,r)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var s=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,s)}yb(a,"change",a,b)}function Xd(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;c&&!i||(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function Yd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,xc(a),Td(a),Zd(a),a.options.lineWrapping||ua(a),a.options.mode=b.modeOption,qd(a)}function Zd(a){("rtl"==a.doc.direction?h:Gg)(a.display.lineDiv,"CodeMirror-rtl")}function $d(a){md(a,function(){Zd(a),qd(a)})}function _d(a){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=a||1}function ae(a,b){var c={from:M(b.from),to:Od(b),text:C(a,b.from,b.to)};return he(a,c,b.from.line,b.to.line+1),Xd(a,function(a){return he(a,c,b.from.line,b.to.line+1)},!0),c}function be(a){for(;a.length;){var b=p(a);if(!b.ranges)break;a.pop()}}function ce(a,b){return b?(be(a.done),p(a.done)):a.done.length&&!p(a.done).ranges?p(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),p(a.done)):void 0}function de(a,b,c,d){var e=a.history;e.undone.length=0;var f,g,h=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>h-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=ce(e,e.lastOp==d)))g=p(f.changes),0==K(b.from,b.to)&&0==K(b.from,g.to)?g.to=Od(b):f.changes.push(ae(a,b));else{var i=p(e.done);for(i&&i.ranges||ge(a.sel,e.done),f={changes:[ae(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=h,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,g||Ea(a,"historyAdded")}function ee(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function fe(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ee(a,f,p(e.done),b))?e.done[e.done.length-1]=b:ge(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&be(e.undone)}function ge(a,b){var c=p(b);c&&c.ranges&&c.equals(a)||b.push(a)}function he(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ie(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function je(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=[],e=0;e<b.text.length;++e)d.push(ie(c[e]));return d}function ke(a,b){var c=je(a,b),d=_(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function le(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?xh.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];d.push({changes:h});for(var i=0;i<g.length;++i){var j=g[i],k=void 0;if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&m(b,Number(k[1]))>-1&&(p(h)[l]=j[l],delete j[l])}}}return d}function me(a,b,c,d){if(d){var e=a.anchor;if(c){var f=K(b,e)<0;f!=K(c,e)<0?(e=b,b=c):f!=K(b,c)<0&&(b=c)}return new yh(e,b)}return new yh(c||b,b)}function ne(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend)),te(a,new xh([me(a.sel.primary(),b,c,e)],0),d)}function oe(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)d[f]=me(a.sel.ranges[f],b[f],null,e);var g=Md(d,a.sel.primIndex);te(a,g,c)}function pe(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,te(a,Md(e,a.sel.primIndex),d)}function qe(a,b,c,d){te(a,Nd(b,c),d)}function re(a,b,c){var d={ranges:b.ranges,update:function(b){var c=this;this.ranges=[];for(var d=0;d<b.length;d++)c.ranges[d]=new yh(Q(a,b[d].anchor),Q(a,b[d].head))},origin:c&&c.origin};return Ea(a,"beforeSelectionChange",a,d),a.cm&&Ea(a.cm,"beforeSelectionChange",a.cm,d),d.ranges!=b.ranges?Md(d.ranges,d.ranges.length-1):b}function se(a,b,c){var d=a.history.done,e=p(d);e&&e.ranges?(d[d.length-1]=b,ue(a,b,c)):te(a,b,c)}function te(a,b,c){ue(a,b,c),fe(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function ue(a,b,c){(Ha(a,"beforeSelectionChange")||a.cm&&Ha(a.cm,"beforeSelectionChange"))&&(b=re(a,b,c));var d=c&&c.bias||(K(b.primary().head,a.sel.primary().head)<0?-1:1);ve(a,xe(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Uc(a.cm)}function ve(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Ga(a.cm)),yb(a,"cursorActivity",a))}function we(a){ve(a,xe(a,a.sel,null,!1))}function xe(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],i=ze(a,g.anchor,h&&h.anchor,c,d),j=ze(a,g.head,h&&h.head,c,d);(e||i!=g.anchor||j!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new yh(i,j))}return e?Md(e,b.primIndex):b}function ye(a,b,c,d,e){var f=B(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],i=h.marker;if((null==h.from||(i.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(i.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(Ea(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j=i.find(d<0?1:-1),k=void 0;if((d<0?i.inclusiveRight:i.inclusiveLeft)&&(j=Ae(a,j,-d,j&&j.line==b.line?f:null)),j&&j.line==b.line&&(k=K(j,c))&&(d<0?k<0:k>0))return ye(a,j,b,d,e)}var l=i.find(d<0?-1:1);return(d<0?i.inclusiveLeft:i.inclusiveRight)&&(l=Ae(a,l,d,l.line==b.line?f:null)),l?ye(a,l,b,d,e):null}}return b}function ze(a,b,c,d,e){var f=d||1,g=ye(a,b,c,f,e)||!e&&ye(a,b,c,f,!0)||ye(a,b,c,-f,e)||!e&&ye(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,J(a.first,0))}function Ae(a,b,c,d){return c<0&&0==b.ch?b.line>a.first?Q(a,J(b.line-1)):null:c>0&&b.ch==(d||B(a,b.line)).text.length?b.line<a.first+a.size-1?J(b.line+1,0):null:new J(b.line,b.ch+c)}function Be(a){a.setSelection(J(a.firstLine(),0),J(a.lastLine()),Ng)}function Ce(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};return c&&(d.update=function(b,c,e,f){b&&(d.from=Q(a,b)),c&&(d.to=Q(a,c)),e&&(d.text=e),void 0!==f&&(d.origin=f)}),Ea(a,"beforeChange",a,d),a.cm&&Ea(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function De(a,b,c){if(a.cm){if(!a.cm.curOp)return nd(a.cm,De)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(Ha(a,"beforeChange")||a.cm&&Ha(a.cm,"beforeChange"))||(b=Ce(a,b,!0))){var d=Tg&&!c&&ba(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Ee(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text,origin:b.origin});else Ee(a,b)}}function Ee(a,b){if(1!=b.text.length||""!=b.text[0]||0!=K(b.from,b.to)){var c=Qd(a,b);de(a,b,c,a.cm?a.cm.curOp.id:NaN),He(a,b,c,_(a,b));var d=[];Xd(a,function(a,c){c||m(d,a.history)!=-1||(Me(a.history,b),d.push(a.history)),He(a,b,null,_(a,b))})}}function Fe(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i<g.length&&(d=g[i],c?!d.ranges||d.equals(a.sel):d.ranges);i++);if(i!=g.length){for(e.lastOrigin=e.lastSelOrigin=null;d=g.pop(),d.ranges;){if(ge(d,h),c&&!d.equals(a.sel))return void te(a,d,{clearRedo:!1});f=d}var j=[];ge(f,h),h.push({changes:j,generation:e.generation}),e.generation=d.generation||++e.maxGeneration;for(var k=Ha(a,"beforeChange")||a.cm&&Ha(a.cm,"beforeChange"),l=function(c){var e=d.changes[c];if(e.origin=b, k&&!Ce(a,e,!1))return g.length=0,{};j.push(ae(a,e));var f=c?Qd(a,e):p(g);He(a,e,f,ke(a,e)),!c&&a.cm&&a.cm.scrollIntoView({from:e.from,to:Od(e)});var h=[];Xd(a,function(a,b){b||m(h,a.history)!=-1||(Me(a.history,e),h.push(a.history)),He(a,e,null,ke(a,e))})},n=d.changes.length-1;n>=0;--n){var o=l(n);if(o)return o.v}}}}function Ge(a,b){if(0!=b&&(a.first+=b,a.sel=new xh(q(a.sel.ranges,function(a){return new yh(J(a.anchor.line+b,a.anchor.ch),J(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){qd(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)rd(a.cm,d,"gutter")}}function He(a,b,c,d){if(a.cm&&!a.cm.curOp)return nd(a.cm,He)(a,b,c,d);if(b.to.line<a.first)return void Ge(a,b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ge(a,e),b={from:J(a.first,0),to:J(b.to.line+e,b.to.ch),text:[p(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:J(f,B(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=C(a,b.from,b.to),c||(c=Qd(a,b)),a.cm?Ie(a.cm,b,d):Wd(a,b,d),ue(a,c,Ng)}}function Ie(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=F(la(B(d,f.line))),d.iter(i,g.line+1,function(a){if(a==e.maxLine)return h=!0,!0})),d.sel.contains(b.from,b.to)>-1&&Ga(a),Wd(d,b,c,wc(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=ta(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),ib(d,f.line),wd(a,400);var j=b.text.length-(g.line-f.line)-1;b.full?qd(a):f.line!=g.line||1!=b.text.length||Vd(a.doc,b)?qd(a,f.line,g.line+1,j):rd(a,f.line,"text");var k=Ha(a,"changes"),l=Ha(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&yb(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function Je(a,b,c,d,e){if(d||(d=c),K(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),De(a,{from:c,to:d,text:b,origin:e})}function Ke(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Le(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Ke(f.ranges[h].anchor,b,c,d),Ke(f.ranges[h].head,b,c,d)}else{for(var i=0;i<f.changes.length;++i){var j=f.changes[i];if(c<j.from.line)j.from=J(j.from.line+d,j.from.ch),j.to=J(j.to.line+d,j.to.ch);else if(b<=j.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Me(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Le(a.done,c,d,e),Le(a.undone,c,d,e)}function Ne(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=B(a,P(a,b)):e=F(b),null==e?null:(d(f,e)&&a.cm&&rd(a.cm,e,c),f)}function Oe(a){var b=this;this.lines=a,this.parent=null;for(var c=0,d=0;d<a.length;++d)a[d].parent=b,c+=a[d].height;this.height=c}function Pe(a){var b=this;this.children=a;for(var c=0,d=0,e=0;e<a.length;++e){var f=a[e];c+=f.chunkSize(),d+=f.height,f.parent=b}this.size=c,this.height=d,this.parent=null}function Qe(a,b,c){sa(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Tc(a,c)}function Re(a,b,c,d){var e=new zh(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Ne(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!qa(a,b)){var d=sa(b)<a.scrollTop;E(b,b.height+Mb(e)),d&&Tc(f,e.height),f.curOp.forceUpdate=!0}return!0}),yb(f,"lineWidgetAdded",f,e,"number"==typeof b?b:F(b)),e}function Se(a,b,c,d,f){if(d&&d.shared)return Te(a,b,c,d,f);if(a.cm&&!a.cm.curOp)return nd(a.cm,Se)(a,b,c,d,f);var g=new Bh(a,f),h=K(b,c);if(d&&k(d,g,!1),h>0||0==h&&g.clearWhenEmpty!==!1)return g;if(g.replacedWith&&(g.collapsed=!0,g.widgetNode=e("span",[g.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(g.widgetNode.insertLeft=!0)),g.collapsed){if(ka(a,b.line,b,c,g)||b.line!=c.line&&ka(a,c.line,b,c,g))throw new Error("Inserting collapsed marker partially overlapping an existing one");U()}g.addToHistory&&de(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var i,j=b.line,l=a.cm;if(a.iter(j,c.line+1,function(a){l&&g.collapsed&&!l.options.lineWrapping&&la(a)==l.display.maxLine&&(i=!0),g.collapsed&&j!=b.line&&E(a,0),Y(a,new V(g,j==b.line?b.ch:null,j==c.line?c.ch:null)),++j}),g.collapsed&&a.iter(b.line,c.line+1,function(b){qa(a,b)&&E(b,0)}),g.clearOnEnter&&Yg(g,"beforeCursorEnter",function(){return g.clear()}),g.readOnly&&(T(),(a.history.done.length||a.history.undone.length)&&a.clearHistory()),g.collapsed&&(g.id=++Ah,g.atomic=!0),l){if(i&&(l.curOp.updateMaxLine=!0),g.collapsed)qd(l,b.line,c.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(var m=b.line;m<=c.line;m++)rd(l,m,"text");g.atomic&&we(l.doc),yb(l,"markerAdded",l,g)}return g}function Te(a,b,c,d,e){d=k(d),d.shared=!1;var f=[Se(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Xd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Se(a,Q(a,b),Q(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=p(f)}),new Ch(f,g)}function Ue(a){return a.findMarks(J(a.first,0),a.clipPos(J(a.lastLine())),function(a){return a.parent})}function Ve(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(K(f,g)){var h=Se(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function We(a){for(var b=function(b){var c=a[b],d=[c.primary.doc];Xd(c.primary.doc,function(a){return d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];m(d,f.doc)==-1&&(f.parent=null,c.markers.splice(e--,1))}},c=0;c<a.length;c++)b(c)}function Xe(a){var b=this;if($e(b),!Fa(b,a)&&!Nb(b.display,a)){Ja(a),ng&&(Fh=+new Date);var c=yc(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||m(b.options.allowDropFileTypes,a.type)!=-1){var h=new FileReader;h.onload=nd(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=Q(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};De(b.doc,i),se(b.doc,Nd(c,Od(i)))}}),h.readAsText(a)}},i=0;i<e;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){return b.display.input.focus()},20);try{var j=a.dataTransfer.getData("Text");if(j){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),ue(b.doc,Nd(c,c)),k)for(var l=0;l<k.length;++l)Je(b.doc,"",k[l].anchor,k[l].head,"drag");b.replaceSelection(j,"around","paste"),b.display.input.focus()}}catch(a){}}}}function Ye(a,b){if(ng&&(!a.state.draggingText||+new Date-Fh<100))return void Ma(b);if(!Fa(a,b)&&!Nb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!tg)){var c=d("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",sg&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),sg&&c.parentNode.removeChild(c)}}function Ze(a,b){var e=yc(a,b);if(e){var f=document.createDocumentFragment();Cc(a,e,f),a.display.dragCursor||(a.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv)),c(a.display.dragCursor,f)}}function $e(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function _e(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function af(){Gh||(bf(),Gh=!0)}function bf(){var a;Yg(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,_e(cf)},100))}),Yg(window,"blur",function(){return _e(Jc)})}function cf(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function df(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else{if(!/^s(hift)?$/i.test(h))throw new Error("Unrecognized modifier name: "+h);e=!0}}return c&&(a="Alt-"+a),d&&(a="Ctrl-"+a),f&&(a="Cmd-"+a),e&&(a="Shift-"+a),a}function ef(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=q(c.split(" "),df),f=0;f<e.length;f++){var g=void 0,h=void 0;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a}function ff(a,b,c,d){b=kf(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return ff(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=ff(a,b.fallthrough[f],c,d);if(g)return g}}}function gf(a){var b="string"==typeof a?a:Hh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function hf(a,b,c){var d=a;return b.altKey&&"Alt"!=d&&(a="Alt-"+a),(Eg?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a),(Eg?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a),!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a),a}function jf(a,b){if(sg&&34==a.keyCode&&a["char"])return!1;var c=Hh[a.keyCode];return null!=c&&!a.altGraphKey&&hf(c,a,b)}function kf(a){return"string"==typeof a?Lh[a]:a}function lf(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&K(f.from,p(d).to)<=0;){var g=d.pop();if(K(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}md(a,function(){for(var b=d.length-1;b>=0;b--)Je(a.doc,"",d[b].from,d[b].to,"+delete");Uc(a)})}function mf(a,b){var c=B(a.doc,b),d=la(c);return d!=c&&(b=F(d)),Aa(!0,a,d,b,1)}function nf(a,b){var c=B(a.doc,b),d=ma(c);return d!=c&&(b=F(d)),Aa(!0,a,c,b,-1)}function of(a,b){var c=mf(a,b.line),d=B(a.doc,c.line),e=xa(d,a.doc.direction);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return J(c.line,g?0:f,c.sticky)}return c}function pf(a,b,c){if("string"==typeof b&&(b=Mh[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Mg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function qf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=ff(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&ff(b,a.options.extraKeys,c,a)||ff(b,a.options.keyMap,c,a)}function rf(a,b,c,d){var e=a.state.keySeq;if(e){if(gf(b))return"handled";Nh.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}),b=e+" "+b}var f=qf(a,b,d);return"multi"==f&&(a.state.keySeq=b),"handled"==f&&yb(a,"keyHandled",a,b,c),"handled"!=f&&"multi"!=f||(Ja(c),Fc(a)),e&&!f&&/\'$/.test(b)?(Ja(c),!0):!!f}function sf(a,b){var c=jf(b,!0);return!!c&&(b.shiftKey&&!a.state.keySeq?rf(a,"Shift-"+c,b,function(b){return pf(a,b,!0)})||rf(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return pf(a,b)}):rf(a,c,b,function(b){return pf(a,b)}))}function tf(a,b,c){return rf(a,"'"+c+"'",b,function(b){return pf(a,b,!0)})}function uf(a){var b=this;if(b.curOp.focus=g(),!Fa(b,a)){ng&&og<11&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=sf(b,a);sg&&(Oh=d?c:null,!d&&88==c&&!ah&&(zg?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||vf(b)}}function vf(a){function b(a){18!=a.keyCode&&a.altKey||(Gg(c,"CodeMirror-crosshair"),Da(document,"keyup",b),Da(document,"mouseover",b))}var c=a.display.lineDiv;h(c,"CodeMirror-crosshair"),Yg(document,"keyup",b),Yg(document,"mouseover",b)}function wf(a){16==a.keyCode&&(this.doc.sel.shift=!1),Fa(this,a)}function xf(a){var b=this;if(!(Nb(b.display,a)||Fa(b,a)||a.ctrlKey&&!a.altKey||zg&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(sg&&c==Oh)return Oh=null,void Ja(a);if(!sg||a.which&&!(a.which<10)||!sf(b,a)){var e=String.fromCharCode(null==d?c:d);"\b"!=e&&(tf(b,a,e)||b.display.input.onKeyPress(a))}}}function yf(a,b){var c=+new Date;return Sh&&Sh.compare(c,a,b)?(Rh=Sh=null,"triple"):Rh&&Rh.compare(c,a,b)?(Sh=new Qh(c,a,b),Rh=null,"double"):(Rh=new Qh(c,a,b),Sh=null,"single")}function zf(a){var b=this,c=b.display;if(!(Fa(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.input.ensurePolled(),c.shift=a.shiftKey,Nb(c,a))return void(pg||(c.scroller.draggable=!1,setTimeout(function(){return c.scroller.draggable=!0},100)));if(!Hf(b,a)){var d=yc(b,a),e=Oa(a),f=d?yf(d,e):"single";window.focus(),1==e&&b.state.selectingText&&b.state.selectingText(a),d&&Af(b,e,d,f,a)||(1==e?d?Cf(b,d,f,a):Na(a)==c.scroller&&Ja(a):2==e?(d&&ne(b.doc,d),setTimeout(function(){return c.input.focus()},20)):3==e&&(Fg?If(b,a):Hc(b)))}}}function Af(a,b,c,d,e){var f="Click";return"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f),f=(1==b?"Left":2==b?"Middle":"Right")+f,rf(a,hf(f,e),e,function(b){if("string"==typeof b&&(b=Mh[b]),!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Mg}finally{a.state.suppressEdits=!1}return d})}function Bf(a,b,c){var d=a.getOption("configureMouse"),e=d?d(a,b,c):{};if(null==e.unit){var f=Ag?c.shiftKey&&c.metaKey:c.altKey;e.unit=f?"rectangle":"single"==b?"char":"double"==b?"word":"line"}return(null==e.extend||a.doc.extend)&&(e.extend=a.doc.extend||c.shiftKey),null==e.addNew&&(e.addNew=zg?c.metaKey:c.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(zg?c.altKey:c.ctrlKey)),e}function Cf(a,b,c,d){ng?setTimeout(j(Gc,a),0):a.curOp.focus=g();var e,f=Bf(a,c,d),h=a.doc.sel;a.options.dragDrop&&Zg&&!a.isReadOnly()&&"single"==c&&(e=h.contains(b))>-1&&(K((e=h.ranges[e]).from(),b)<0||b.xRel>0)&&(K(e.to(),b)>0||b.xRel<0)?Df(a,d,b,f):Ff(a,d,b,f)}function Df(a,b,c,d){var e=a.display,f=!1,g=nd(a,function(b){pg&&(e.scroller.draggable=!1),a.state.draggingText=!1,Da(document,"mouseup",g),Da(document,"mousemove",h),Da(e.scroller,"dragstart",i),Da(e.scroller,"drop",g),f||(Ja(b),d.addNew||ne(a.doc,c,null,null,d.extend),pg||ng&&9==og?setTimeout(function(){document.body.focus(),e.input.focus()},20):e.input.focus())}),h=function(a){f=f||Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)>=10},i=function(){return f=!0};pg&&(e.scroller.draggable=!0),a.state.draggingText=g,g.copy=!d.moveOnDrag,e.scroller.dragDrop&&e.scroller.dragDrop(),Yg(document,"mouseup",g),Yg(document,"mousemove",h),Yg(e.scroller,"dragstart",i),Yg(e.scroller,"drop",g),Hc(a),setTimeout(function(){return e.input.focus()},20)}function Ef(a,b,c){if("char"==c)return new yh(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new yh(J(b.line,0),Q(a.doc,J(b.line+1,0)));var d=c(a,b);return new yh(d.from,d.to)}function Ff(a,b,c,d){function e(b){if(0!=K(r,b))if(r=b,"rectangle"==d.unit){for(var e=[],f=a.options.tabSize,g=l(B(j,c.line).text,c.ch,f),h=l(B(j,b.line).text,b.ch,f),i=Math.min(g,h),p=Math.max(g,h),q=Math.min(c.line,b.line),s=Math.min(a.lastLine(),Math.max(c.line,b.line));q<=s;q++){var t=B(j,q).text,u=n(t,i,f);i==p?e.push(new yh(J(q,u),J(q,u))):t.length>u&&e.push(new yh(J(q,u),J(q,n(t,p,f))))}e.length||e.push(new yh(c,c)),te(j,Md(o.ranges.slice(0,m).concat(e),m),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var v,w=k,x=Ef(a,b,d.unit),y=w.anchor;K(x.anchor,y)>0?(v=x.head,y=O(w.from(),x.anchor)):(v=x.anchor,y=N(w.to(),x.head));var z=o.ranges.slice(0);z[m]=new yh(Q(j,y),v),te(j,Md(z,m),Og)}}function f(b){var c=++t,h=yc(a,b,!0,"rectangle"==d.unit);if(h)if(0!=K(h,r)){a.curOp.focus=g(),e(h);var k=Mc(i,j);(h.line>=k.to||h.line<k.from)&&setTimeout(nd(a,function(){t==c&&f(b)}),150)}else{var l=b.clientY<s.top?-20:b.clientY>s.bottom?20:0;l&&setTimeout(nd(a,function(){t==c&&(i.scroller.scrollTop+=l,f(b))}),50)}}function h(b){a.state.selectingText=!1,t=1/0,Ja(b),i.input.focus(),Da(document,"mousemove",u),Da(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Ja(b);var k,m,o=j.sel,p=o.ranges;if(d.addNew&&!d.extend?(m=j.sel.contains(c),k=m>-1?p[m]:new yh(c,c)):(k=j.sel.primary(),m=j.sel.primIndex),"rectangle"==d.unit)d.addNew||(k=new yh(c,c)),c=yc(a,b,!0,!0),m=-1;else{var q=Ef(a,c,d.unit);k=d.extend?me(k,q.anchor,q.head,d.extend):q}d.addNew?m==-1?(m=p.length,te(j,Md(p.concat([k]),m),{scroll:!1,origin:"*mouse"})):p.length>1&&p[m].empty()&&"char"==d.unit&&!d.extend?(te(j,Md(p.slice(0,m).concat(p.slice(m+1)),0),{scroll:!1,origin:"*mouse"}),o=j.sel):pe(j,m,k,Og):(m=0,te(j,new xh([k],0),Og),o=j.sel);var r=c,s=i.wrapper.getBoundingClientRect(),t=0,u=nd(a,function(a){Oa(a)?f(a):h(a)}),v=nd(a,h);a.state.selectingText=v,Yg(document,"mousemove",u),Yg(document,"mouseup",v)}function Gf(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ja(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Ha(a,c))return La(b);f-=h.top-g.viewOffset;for(var i=0;i<a.options.gutters.length;++i){var j=g.gutters.childNodes[i];if(j&&j.getBoundingClientRect().right>=e){var k=G(a.doc,f),l=a.options.gutters[i];return Ea(a,c,a,k,l,b),La(b)}}}function Hf(a,b){return Gf(a,b,"gutterClick",!0)}function If(a,b){Nb(a.display,b)||Jf(a,b)||Fa(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Jf(a,b){return!!Ha(a,"gutterContextMenu")&&Gf(a,b,"gutterContextMenu",!1)}function Kf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fc(a)}function Lf(a){function b(b,d,e,f){a.defaults[b]=d,e&&(c[b]=f?function(a,b,c){c!=Th&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b,a.Init=Th,b("value","",function(a,b){return a.setValue(b)},!0),b("mode",null,function(a,b){a.doc.modeOption=b,Td(a)},!0),b("indentUnit",2,Td,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,function(a){Ud(a),fc(a),qd(a)},!0),b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1)break;e=f+b.length,c.push(J(d,f))}d++});for(var e=c.length-1;e>=0;e--)Je(a.doc,b,c[e],J(c[e].line,c[e].ch+b.length))}}),b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g"),c!=Th&&a.refresh()}),b("specialCharPlaceholder",nb,function(a){return a.refresh()},!0),b("electricChars",!0),b("inputStyle",yg?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0),b("rtlMoveVisually",!Bg),b("wholeLineUpdateBefore",!0),b("theme","default",function(a){Kf(a),Mf(a)},!0),b("keyMap","default",function(a,b,c){var d=kf(b),e=c!=Th&&kf(c);e&&e.detach&&e.detach(a,d),d.attach&&d.attach(a,e||null)}),b("extraKeys",null),b("configureMouse",null),b("lineWrapping",!1,Of,!0),b("gutters",[],function(a){Id(a.options),Mf(a)},!0),b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?vc(a.display)+"px":"0",a.refresh()},!0),b("coverGutterNextToScrollbar",!1,function(a){return bd(a)},!0),b("scrollbarStyle","native",function(a){dd(a),bd(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),b("lineNumbers",!1,function(a){Id(a.options),Mf(a)},!0),b("firstLineNumber",1,Mf,!0),b("lineNumberFormatter",function(a){return a},Mf,!0),b("showCursorWhenSelecting",!1,Ac,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("pasteLinesPerSelection",!0),b("readOnly",!1,function(a,b){"nocursor"==b&&(Jc(a),a.display.input.blur()),a.display.input.readOnlyChanged(b)}),b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),b("dragDrop",!0,Nf),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,Ac,!0),b("singleCursorHeightPerLine",!0,Ac,!0),b("workTime",100),b("workDelay",100),b("flattenSpans",!0,Ud,!0),b("addModeClass",!1,Ud,!0),b("pollInterval",100),b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b}),b("historyEventDelay",1250),b("viewportMargin",10,function(a){return a.refresh()},!0),b("maxHighlightLength",1e4,Ud,!0),b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""}),b("autofocus",null),b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)}function Mf(a){Hd(a),qd(a),Nc(a)}function Nf(a,b,c){var d=c&&c!=Th;if(!b!=!d){var e=a.display.dragFunctions,f=b?Yg:Da;f(a.display.scroller,"dragstart",e.start),f(a.display.scroller,"dragenter",e.enter),f(a.display.scroller,"dragover",e.over),f(a.display.scroller,"dragleave",e.leave),f(a.display.scroller,"drop",e.drop)}}function Of(a){a.options.lineWrapping?(h(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Gg(a.display.wrapper,"CodeMirror-wrap"),ua(a)),xc(a),qd(a),fc(a),setTimeout(function(){return bd(a)},100)}function Pf(a,b){var c=this;if(!(this instanceof Pf))return new Pf(a,b);this.options=b=b?k(b):{},k(Uh,b,!1),Id(b);var d=b.value;"string"==typeof d&&(d=new Eh(d,b.mode,null,b.lineSeparator,b.direction)),this.doc=d;var e=new Pf.inputStyles[b.inputStyle](this),f=this.display=new A(a,d,e);f.wrapper.CodeMirror=this,Hd(this),Kf(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),dd(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 Ig,keySeq:null,specialChars:null},b.autofocus&&!yg&&f.input.focus(),ng&&og<11&&setTimeout(function(){return c.display.input.reset(!0)},20),Qf(this),af(),ed(this),this.curOp.forceUpdate=!0,Yd(this,d),b.autofocus&&!yg||this.hasFocus()?setTimeout(j(Ic,this),20):Jc(this);for(var g in Vh)Vh.hasOwnProperty(g)&&Vh[g](c,b[g],Th);Oc(this),b.finishInit&&b.finishInit(this);for(var h=0;h<Wh.length;++h)Wh[h](c);fd(this),pg&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(f.lineDiv).textRendering&&(f.lineDiv.style.textRendering="auto")}function Qf(a){function b(){e.activeTouch&&(f=setTimeout(function(){return e.activeTouch=null},1e3),g=e.activeTouch,g.end=+new Date)}function c(a){if(1!=a.touches.length)return!1;var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>400}var e=a.display;Yg(e.scroller,"mousedown",nd(a,zf)),ng&&og<11?Yg(e.scroller,"dblclick",nd(a,function(b){if(!Fa(a,b)){var c=yc(a,b);if(c&&!Hf(a,b)&&!Nb(a.display,b)){Ja(b);var d=a.findWordAt(c);ne(a.doc,d.anchor,d.head)}}})):Yg(e.scroller,"dblclick",function(b){return Fa(a,b)||Ja(b)}),Fg||Yg(e.scroller,"contextmenu",function(b){return If(a,b)});var f,g={end:0};Yg(e.scroller,"touchstart",function(b){if(!Fa(a,b)&&!c(b)){e.input.ensurePolled(),clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),Yg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),Yg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Nb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new yh(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new yh(J(h.line,0),Q(a.doc,J(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ja(c)}b()}),Yg(e.scroller,"touchcancel",b),Yg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Zc(a,e.scroller.scrollTop),_c(a,e.scroller.scrollLeft,!0),Ea(a,"scroll",a))}),Yg(e.scroller,"mousewheel",function(b){return Ld(a,b)}),Yg(e.scroller,"DOMMouseScroll",function(b){return Ld(a,b)}),Yg(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){Fa(a,b)||Ma(b)},over:function(b){Fa(a,b)||(Ze(a,b),Ma(b))},start:function(b){return Ye(a,b)},drop:nd(a,Xe),leave:function(b){Fa(a,b)||$e(a)}};var h=e.input.getField();Yg(h,"keyup",function(b){return wf.call(a,b)}),Yg(h,"keydown",nd(a,uf)),Yg(h,"keypress",nd(a,xf)),Yg(h,"focus",function(b){return Ic(a,b)}),Yg(h,"blur",function(b){return Jc(a,b)})}function Rf(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=ab(a,b).state:c="prev");var g=a.options.tabSize,h=B(f,b),i=l(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Mg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?l(B(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var m="",n=0;if(a.options.indentWithTabs)for(var p=Math.floor(j/g);p;--p)n+=g,m+="\t";if(n<j&&(m+=o(j-n)),m!=k)return Je(f,m,J(b,0),J(b,k.length),"+input"),h.stateAfter=null,!0;for(var q=0;q<f.sel.ranges.length;q++){var r=f.sel.ranges[q];if(r.head.line==b&&r.head.ch<k.length){var s=J(b,k.length);pe(f,q,new yh(s,s));break}}}function Sf(a){Xh=a}function Tf(a,b,c,d,e){var f=a.doc;a.display.shift=!1,d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=$g(b),i=null;if(g&&d.ranges.length>1)if(Xh&&Xh.text.join("\n")==b){if(d.ranges.length%Xh.text.length==0){i=[];for(var j=0;j<Xh.text.length;j++)i.push(f.splitLines(Xh.text[j]))}}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(i=q(h,function(a){return[a]}));for(var k,l=d.ranges.length-1;l>=0;l--){var m=d.ranges[l],n=m.from(),o=m.to();m.empty()&&(c&&c>0?n=J(n.line,n.ch-c):a.state.overwrite&&!g?o=J(o.line,Math.min(B(f,o.line).text.length,o.ch+p(h).length)):Xh&&Xh.lineWise&&Xh.text.join("\n")==b&&(n=o=J(n.line,0))),k=a.curOp.updateInput;var r={from:n,to:o,text:i?i[l%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};De(a.doc,r),yb(a,"inputRead",a,r)}b&&!g&&Vf(a,b),Uc(a),a.curOp.updateInput=k,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function Uf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||md(b,function(){return Tf(b,c,0,null,"paste")}),!0}function Vf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++)if(b.indexOf(f.electricChars.charAt(h))>-1){g=Rf(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(B(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Rf(a,e.head.line,"smart"));g&&yb(a,"electricInput",a,e.head.line)}}}function Wf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,f={anchor:J(e,0),head:J(e+1,0)};c.push(f),b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function Xf(a,b){a.setAttribute("autocorrect","off"),a.setAttribute("autocapitalize","off"),a.setAttribute("spellcheck",!!b)}function Yf(){var a=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=d("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return pg?a.style.width="1000px":a.setAttribute("wrap","off"),wg&&(a.style.border="1px solid black"),Xf(a),b}function Zf(a,b,c,d,e){function f(){var d=b.line+c;return!(d<a.first||d>=a.first+a.size)&&(b=new J(d,b.ch,b.sticky),j=B(a,d))}function g(d){var g;if(g=e?Ba(a.cm,j,b,c):za(j,b,c),null==g){if(d||!f())return!1;b=Aa(e,a.cm,j,b.line,c)}else b=g;return!0}var h=b,i=c,j=B(a,b.line);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var k=null,l="group"==d,m=a.cm&&a.cm.getHelper(b,"wordChars"),n=!0;!(c<0)||g(!n);n=!1){var o=j.text.charAt(b.ch)||"\n",p=v(o,m)?"w":l&&"\n"==o?"n":!l||/\s/.test(o)?null:"p";if(!l||n||p||(p="s"),k&&k!=p){c<0&&(c=1,g(),b.sticky="after");break}if(p&&(k=p),c>0&&!g(!n))break}var q=ze(a,b,h,i,!0);return L(h,q)&&(q.hitSide=!0),q}function $f(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*sc(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(var j;j=oc(a,g,e),j.outside;){if(c<0?e<=0:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function _f(a,b){var c=Yb(a,b.line);if(!c||c.hidden)return null;var d=B(a.doc,b.line),e=Vb(c,d,b.line),f=xa(d,a.doc.direction),g="left";if(f){var h=wa(f,b.ch);g=h%2?"right":"left"}var i=_b(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function ag(a){for(var b=a;b;b=b.parentNode)if(/CodeMirror-gutter-wrapper/.test(b.className))return!0;return!1}function bg(a,b){return b&&(a.bad=!0),a}function cg(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(){k&&(j+=l,k=!1)}function h(a){a&&(g(),j+=a)}function i(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return void h(c||b.textContent.replace(/\u200b/g,""));var j,m=b.getAttribute("cm-marker");if(m){var n=a.findMarks(J(d,0),J(e+1,0),f(+m));return void(n.length&&(j=n[0].find(0))&&h(C(a.doc,j.from,j.to).join(l)))}if("false"==b.getAttribute("contenteditable"))return;var o=/^(pre|div|p)$/i.test(b.nodeName);o&&g();for(var p=0;p<b.childNodes.length;p++)i(b.childNodes[p]);o&&(k=!0)}else 3==b.nodeType&&h(b.nodeValue)}for(var j="",k=!1,l=a.doc.lineSeparator();i(b),b!=c;)b=b.nextSibling;return j}function dg(a,b,c){var d;if(b==a.display.lineDiv){if(d=a.display.lineDiv.childNodes[c],!d)return bg(a.clipPos(J(a.display.viewTo-1)),!0);b=null,c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return eg(f,b,c)}}function eg(a,b,c){function d(b,c,d){for(var e=-1;e<(l?l.length:0);e++)for(var f=e<0?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var i=F(e<0?a.line:a.rest[e]),j=f[g]+d;return(d<0||h!=b)&&(j=f[g+(d?1:0)]),J(i,j)}}}var e=a.text.firstChild,g=!1;if(!b||!f(e,b))return bg(J(F(a.line),0),!0);if(b==e&&(g=!0,b=e.childNodes[c],c=0,!b)){var h=a.rest?p(a.rest):a.line;return bg(J(F(h),h.text.length),g)}var i=3==b.nodeType?b:null,j=b;for(i||1!=b.childNodes.length||3!=b.firstChild.nodeType||(i=b.firstChild,c&&(c=i.nodeValue.length));j.parentNode!=e;)j=j.parentNode;var k=a.measure,l=k.maps,m=d(i,j,c);if(m)return bg(m,g);for(var n=j.nextSibling,o=i?i.nodeValue.length-c:0;n;n=n.nextSibling){if(m=d(n,n.firstChild,0))return bg(J(m.line,m.ch-o),g);o+=n.textContent.length}for(var q=j.previousSibling,r=c;q;q=q.previousSibling){if(m=d(q,q.firstChild,-1))return bg(J(m.line,m.ch+r),g);r+=q.textContent.length}}function fg(a,b){function c(){a.value=j.getValue()}if(b=b?k(b):{},b.value=a.value,!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var d=g();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(Yg(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var h=f.submit=function(){c(),f.submit=e,f.submit(),f.submit=h}}catch(i){}}b.finishInit=function(b){b.save=c,b.getTextArea=function(){return a},b.toTextArea=function(){b.toTextArea=isNaN, c(),a.parentNode.removeChild(b.getWrapperElement()),a.style.display="",a.form&&(Da(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}},a.style.display="none";var j=Pf(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return j}function gg(a){a.off=Da,a.on=Yg,a.wheelEventPixels=Kd,a.Doc=Eh,a.splitLines=$g,a.countColumn=l,a.findColumn=n,a.isWordChar=u,a.Pass=Mg,a.signal=Ea,a.Line=jh,a.changeEnd=Od,a.scrollbarModel=sh,a.Pos=J,a.cmpPos=K,a.modes=ch,a.mimeModes=dh,a.resolveMode=Ua,a.getMode=Va,a.modeExtensions=eh,a.extendMode=Wa,a.copyState=Xa,a.startState=Za,a.innerMode=Ya,a.commands=Mh,a.keyMap=Lh,a.keyName=jf,a.isModifierKey=gf,a.lookupKey=ff,a.normalizeKeyMap=ef,a.StringStream=fh,a.SharedTextMarker=Ch,a.TextMarker=Bh,a.LineWidget=zh,a.e_preventDefault=Ja,a.e_stopPropagation=Ka,a.e_stop=Ma,a.addClass=h,a.contains=f,a.rmClass=Gg,a.keyNames=Hh}var hg=navigator.userAgent,ig=navigator.platform,jg=/gecko\/\d/i.test(hg),kg=/MSIE \d/.test(hg),lg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hg),mg=/Edge\/(\d+)/.exec(hg),ng=kg||lg||mg,og=ng&&(kg?document.documentMode||6:+(mg||lg)[1]),pg=!mg&&/WebKit\//.test(hg),qg=pg&&/Qt\/\d+\.\d+/.test(hg),rg=!mg&&/Chrome\//.test(hg),sg=/Opera\//.test(hg),tg=/Apple Computer/.test(navigator.vendor),ug=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(hg),vg=/PhantomJS/.test(hg),wg=!mg&&/AppleWebKit/.test(hg)&&/Mobile\/\w+/.test(hg),xg=/Android/.test(hg),yg=wg||xg||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(hg),zg=wg||/Mac/.test(ig),Ag=/\bCrOS\b/.test(hg),Bg=/win/i.test(ig),Cg=sg&&hg.match(/Version\/(\d*\.\d*)/);Cg&&(Cg=Number(Cg[1])),Cg&&Cg>=15&&(sg=!1,pg=!0);var Dg,Eg=zg&&(qg||sg&&(null==Cg||Cg<12.11)),Fg=jg||ng&&og>=9,Gg=function(b,c){var d=b.className,e=a(c).exec(d);if(e){var f=d.slice(e.index+e[0].length);b.className=d.slice(0,e.index)+(f?e[1]+f:"")}};Dg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Hg=function(a){a.select()};wg?Hg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:ng&&(Hg=function(a){try{a.select()}catch(b){}});var Ig=function(){this.id=null};Ig.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Jg,Kg,Lg=30,Mg={toString:function(){return"CodeMirror.Pass"}},Ng={scroll:!1},Og={origin:"*mouse"},Pg={origin:"+move"},Qg=[""],Rg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Sg=/[\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]/,Tg=!1,Ug=!1,Vg=null,Wg=function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1785?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/;return function(c,d){var j="ltr"==d?"L":"R";if(0==c.length||"ltr"==d&&!e.test(c))return!1;for(var k=c.length,l=[],m=0;m<k;++m)l.push(a(c.charCodeAt(m)));for(var n=0,o=j;n<k;++n){var q=l[n];"m"==q?l[n]=o:o=q}for(var r=0,s=j;r<k;++r){var t=l[r];"1"==t&&"r"==s?l[r]="n":g.test(t)&&(s=t,"r"==t&&(l[r]="R"))}for(var u=1,v=l[0];u<k-1;++u){var w=l[u];"+"==w&&"1"==v&&"1"==l[u+1]?l[u]="1":","!=w||v!=l[u+1]||"1"!=v&&"n"!=v||(l[u]=v),v=w}for(var x=0;x<k;++x){var y=l[x];if(","==y)l[x]="N";else if("%"==y){var z=void 0;for(z=x+1;z<k&&"%"==l[z];++z);for(var A=x&&"!"==l[x-1]||z<k&&"1"==l[z]?"1":"N",B=x;B<z;++B)l[B]=A;x=z-1}}for(var C=0,D=j;C<k;++C){var E=l[C];"L"==D&&"1"==E?l[C]="L":g.test(E)&&(D=E)}for(var F=0;F<k;++F)if(f.test(l[F])){var G=void 0;for(G=F+1;G<k&&f.test(l[G]);++G);for(var H="L"==(F?l[F-1]:j),I="L"==(G<k?l[G]:j),J=H==I?H?"L":"R":j,K=F;K<G;++K)l[K]=J;F=G-1}for(var L,M=[],N=0;N<k;)if(h.test(l[N])){var O=N;for(++N;N<k&&h.test(l[N]);++N);M.push(new b(0,O,N))}else{var P=N,Q=M.length;for(++N;N<k&&"L"!=l[N];++N);for(var R=P;R<N;)if(i.test(l[R])){P<R&&M.splice(Q,0,new b(1,P,R));var S=R;for(++R;R<N&&i.test(l[R]);++R);M.splice(Q,0,new b(2,S,R)),P=R}else++R;P<N&&M.splice(Q,0,new b(1,P,N))}return 1==M[0].level&&(L=c.match(/^\s+/))&&(M[0].from=L[0].length,M.unshift(new b(0,0,L[0].length))),1==p(M).level&&(L=c.match(/\s+$/))&&(p(M).to-=L[0].length,M.push(new b(0,k-L[0].length,k))),"rtl"==d?M.reverse():M}}(),Xg=[],Yg=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={});d[b]=(d[b]||Xg).concat(c)}},Zg=function(){if(ng&&og<9)return!1;var a=d("div");return"draggable"in a||"dragDrop"in a}(),$g=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);e==-1&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");g!=-1?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},_g=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return!(!b||b.parentElement()!=a)&&0!=b.compareEndPoints("StartToEnd",b)},ah=function(){var a=d("div");return"oncopy"in a||(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),bh=null,ch={},dh={},eh={},fh=function(a,b,c){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=c};fh.prototype.eol=function(){return this.pos>=this.string.length},fh.prototype.sol=function(){return this.pos==this.lineStart},fh.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},fh.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},fh.prototype.eat=function(a){var b,c=this.string.charAt(this.pos);if(b="string"==typeof a?c==a:c&&(a.test?a.test(c):a(c)))return++this.pos,c},fh.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b},fh.prototype.eatSpace=function(){for(var a=this,b=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++a.pos;return this.pos>b},fh.prototype.skipToEnd=function(){this.pos=this.string.length},fh.prototype.skipTo=function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},fh.prototype.backUp=function(a){this.pos-=a},fh.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=l(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?l(this.string,this.lineStart,this.tabSize):0)},fh.prototype.indentation=function(){return l(this.string,null,this.tabSize)-(this.lineStart?l(this.string,this.lineStart,this.tabSize):0)},fh.prototype.match=function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},fh.prototype.current=function(){return this.string.slice(this.start,this.pos)},fh.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}},fh.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};var gh=function(a,b){this.state=a,this.lookAhead=b},hh=function(a,b,c,d){this.state=b,this.doc=a,this.line=c,this.maxLookAhead=d||0};hh.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);return null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a),b},hh.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hh.fromSaved=function(a,b,c){return b instanceof gh?new hh(a,Xa(a.mode,b.state),c,b.lookAhead):new hh(a,Xa(a.mode,b),c)},hh.prototype.save=function(a){var b=a!==!1?Xa(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new gh(b,this.maxLookAhead):b};var ih=function(a,b,c){this.start=a.start,this.end=a.pos,this.string=a.current(),this.type=b||null,this.state=c},jh=function(a,b,c){this.text=a,da(this,b),this.height=c?c(this):1};jh.prototype.lineNo=function(){return F(this)},Ia(jh);var kh,lh={},mh={},nh=null,oh=null,ph={left:0,right:0,top:0,bottom:0},qh=function(a,b,c){this.cm=c;var e=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(e),a(f),Yg(e,"scroll",function(){e.clientHeight&&b(e.scrollTop,"vertical")}),Yg(f,"scroll",function(){f.clientWidth&&b(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ng&&og<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qh.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+f)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},qh.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qh.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},qh.prototype.zeroWidthHack=function(){var a=zg&&!ug?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ig,this.disableVert=new Ig},qh.prototype.enableZeroWidthBar=function(a,b,c){function d(){var e=a.getBoundingClientRect(),f="vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);f!=a?a.style.pointerEvents="none":b.set(1e3,d)}a.style.pointerEvents="auto",b.set(1e3,d)},qh.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)};var rh=function(){};rh.prototype.update=function(){return{bottom:0,right:0}},rh.prototype.setScrollLeft=function(){},rh.prototype.setScrollTop=function(){},rh.prototype.clear=function(){};var sh={"native":qh,"null":rh},th=0,uh=function(a,b,c){var d=a.display;this.viewport=b,this.visible=Mc(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.wrapperWidth=d.wrapper.clientWidth,this.oldDisplayWidth=Sb(a),this.force=c,this.dims=uc(a),this.events=[]};uh.prototype.signal=function(a,b){Ha(a,b)&&this.events.push(arguments)},uh.prototype.finish=function(){for(var a=this,b=0;b<this.events.length;b++)Ea.apply(null,a.events[b])};var vh=0,wh=null;ng?wh=-.53:jg?wh=15:rg?wh=-.7:tg&&(wh=-1/3);var xh=function(a,b){this.ranges=a,this.primIndex=b};xh.prototype.primary=function(){return this.ranges[this.primIndex]},xh.prototype.equals=function(a){var b=this;if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var c=0;c<this.ranges.length;c++){var d=b.ranges[c],e=a.ranges[c];if(!L(d.anchor,e.anchor)||!L(d.head,e.head))return!1}return!0},xh.prototype.deepCopy=function(){for(var a=this,b=[],c=0;c<this.ranges.length;c++)b[c]=new yh(M(a.ranges[c].anchor),M(a.ranges[c].head));return new xh(b,this.primIndex)},xh.prototype.somethingSelected=function(){for(var a=this,b=0;b<this.ranges.length;b++)if(!a.ranges[b].empty())return!0;return!1},xh.prototype.contains=function(a,b){var c=this;b||(b=a);for(var d=0;d<this.ranges.length;d++){var e=c.ranges[d];if(K(b,e.from())>=0&&K(a,e.to())<=0)return d}return-1};var yh=function(a,b){this.anchor=a,this.head=b};yh.prototype.from=function(){return O(this.anchor,this.head)},yh.prototype.to=function(){return N(this.anchor,this.head)},yh.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Oe.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=this,d=a,e=a+b;d<e;++d){var f=c.lines[d];c.height-=f.height,kb(f),yb(f,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){var d=this;this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var e=0;e<b.length;++e)b[e].parent=d},iterN:function(a,b,c){for(var d=this,e=a+b;a<e;++a)if(c(d.lines[a]))return!0}},Pe.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){var c=this;this.size-=b;for(var d=0;d<this.children.length;++d){var e=c.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a),h=e.height;if(e.removeInner(a,g),c.height-=h-e.height,f==g&&(c.children.splice(d--,1),e.parent=null),0==(b-=g))break;a=0}else a-=f}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Oe))){var i=[];this.collapse(i),this.children=[new Oe(i)],this.children[0].parent=this}},collapse:function(a){for(var b=this,c=0;c<this.children.length;++c)b.children[c].collapse(a)},insertInner:function(a,b,c){var d=this;this.size+=b.length,this.height+=c;for(var e=0;e<this.children.length;++e){var f=d.children[e],g=f.chunkSize();if(a<=g){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(var h=f.lines.length%25+25,i=h;i<f.lines.length;){var j=new Oe(f.lines.slice(i,i+=25));f.height-=j.height,d.children.splice(++e,0,j),j.parent=d}f.lines=f.lines.slice(0,h),d.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Pe(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=m(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Pe(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=this,e=0;e<this.children.length;++e){var f=d.children[e],g=f.chunkSize();if(a<g){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var zh=function(a,b,c){var d=this;if(c)for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);this.doc=a,this.node=b};zh.prototype.clear=function(){var a=this,b=this.doc.cm,c=this.line.widgets,d=this.line,e=F(d);if(null!=e&&c){for(var f=0;f<c.length;++f)c[f]==a&&c.splice(f--,1);c.length||(d.widgets=null);var g=Mb(this);E(d,Math.max(0,d.height-g)),b&&(md(b,function(){Qe(b,d,-g),rd(b,e,"widget")}),yb(b,"lineWidgetCleared",b,this,e))}},zh.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=Mb(this)-b;e&&(E(d,d.height+e),c&&md(c,function(){c.curOp.forceUpdate=!0,Qe(c,d,e),yb(c,"lineWidgetChanged",c,a,F(d))}))},Ia(zh);var Ah=0,Bh=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++Ah};Bh.prototype.clear=function(){var a=this;if(!this.explicitlyCleared){var b=this.doc.cm,c=b&&!b.curOp;if(c&&ed(b),Ha(this,"clear")){var d=this.find();d&&yb(this,"clear",d.from,d.to)}for(var e=null,f=null,g=0;g<this.lines.length;++g){var h=a.lines[g],i=W(h.markedSpans,a);b&&!a.collapsed?rd(b,F(h),"text"):b&&(null!=i.to&&(f=F(h)),null!=i.from&&(e=F(h))),h.markedSpans=X(h.markedSpans,i),null==i.from&&a.collapsed&&!qa(a.doc,h)&&b&&E(h,sc(b.display))}if(b&&this.collapsed&&!b.options.lineWrapping)for(var j=0;j<this.lines.length;++j){var k=la(a.lines[j]),l=ta(k);l>b.display.maxLineLength&&(b.display.maxLine=k,b.display.maxLineLength=l,b.display.maxLineChanged=!0)}null!=e&&b&&this.collapsed&&qd(b,e,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,b&&we(b.doc)),b&&yb(b,"markerCleared",b,this,e,f),c&&fd(b),this.parent&&this.parent.clear()}},Bh.prototype.find=function(a,b){var c=this;null==a&&"bookmark"==this.type&&(a=1);for(var d,e,f=0;f<this.lines.length;++f){var g=c.lines[f],h=W(g.markedSpans,c);if(null!=h.from&&(d=J(b?g:F(g),h.from),a==-1))return d;if(null!=h.to&&(e=J(b?g:F(g),h.to),1==a))return e}return d&&{from:d,to:e}},Bh.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&md(d,function(){var e=b.line,f=F(b.line),g=Yb(d,f);if(g&&(dc(g),d.curOp.selectionChanged=d.curOp.forceUpdate=!0),d.curOp.updateMaxLine=!0,!qa(c.doc,e)&&null!=c.height){var h=c.height;c.height=null;var i=Mb(c)-h;i&&E(e,e.height+i)}yb(d,"markerChanged",d,a)})},Bh.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&m(b.maybeHiddenMarkers,this)!=-1||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},Bh.prototype.detachLine=function(a){if(this.lines.splice(m(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},Ia(Bh);var Ch=function(a,b){var c=this;this.markers=a,this.primary=b;for(var d=0;d<a.length;++d)a[d].parent=c};Ch.prototype.clear=function(){var a=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var b=0;b<this.markers.length;++b)a.markers[b].clear();yb(this,"clear")}},Ch.prototype.find=function(a,b){return this.primary.find(a,b)},Ia(Ch);var Dh=0,Eh=function(a,b,c,d,e){if(!(this instanceof Eh))return new Eh(a,b,c,d,e);null==c&&(c=0),Pe.call(this,[new Oe([new jh("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=c;var f=J(c,0);this.sel=Nd(f),this.history=new _d(null),this.id=++Dh,this.modeOption=b,this.lineSep=d,this.direction="rtl"==e?"rtl":"ltr",this.extend=!1,"string"==typeof a&&(a=this.splitLines(a)),Wd(this,{from:f,to:f,text:a}),te(this,Nd(f),Ng)};Eh.prototype=t(Pe.prototype,{constructor:Eh,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=D(this,this.first,this.first+this.size);return a===!1?b:b.join(a||this.lineSeparator())},setValue:pd(function(a){var b=J(this.first,0),c=this.first+this.size-1;De(this,{from:b,to:J(c,B(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0),this.cm&&Vc(this.cm,0,0),te(this,Nd(b),Ng)}),replaceRange:function(a,b,c,d){b=Q(this,b),c=c?Q(this,c):b,Je(this,a,b,c,d)},getRange:function(a,b,c){var d=C(this,Q(this,a),Q(this,b));return c===!1?d:d.join(c||this.lineSeparator())},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){if(H(this,a))return B(this,a)},getLineNumber:function(a){return F(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=B(this,a)),la(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Q(this,a)},getCursor:function(a){var b,c=this.sel.primary();return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||"to"==a||a===!1?c.to():c.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pd(function(a,b,c){qe(this,Q(this,"number"==typeof a?J(a,b||0):a),null,c)}),setSelection:pd(function(a,b,c){qe(this,Q(this,a),Q(this,b||a),c)}),extendSelection:pd(function(a,b,c){ne(this,Q(this,a),b&&Q(this,b),c)}),extendSelections:pd(function(a,b){oe(this,S(this,a),b)}),extendSelectionsBy:pd(function(a,b){var c=q(this.sel.ranges,a);oe(this,S(this,c),b)}),setSelections:pd(function(a,b,c){var d=this;if(a.length){for(var e=[],f=0;f<a.length;f++)e[f]=new yh(Q(d,a[f].anchor),Q(d,a[f].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),te(this,Md(e,b),c)}}),addSelection:pd(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new yh(Q(this,a),Q(this,b||a))),te(this,Md(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this,d=this.sel.ranges,e=0;e<d.length;e++){var f=C(c,d[e].from(),d[e].to());b=b?b.concat(f):f}return a===!1?b:b.join(a||this.lineSeparator())},getSelections:function(a){for(var b=this,c=[],d=this.sel.ranges,e=0;e<d.length;e++){var f=C(b,d[e].from(),d[e].to());a!==!1&&(f=f.join(a||b.lineSeparator())),c[e]=f}return c},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:pd(function(a,b,c){for(var d=this,e=[],f=this.sel,g=0;g<f.ranges.length;g++){var h=f.ranges[g];e[g]={from:h.from(),to:h.to(),text:d.splitLines(a[g]),origin:c}}for(var i=b&&"end"!=b&&Sd(this,e,b),j=e.length-1;j>=0;j--)De(d,e[j]);i?se(this,i):this.cm&&Uc(this.cm)}),undo:pd(function(){Fe(this,"undo")}),redo:pd(function(){Fe(this,"redo")}),undoSelection:pd(function(){Fe(this,"undo",!0)}),redoSelection:pd(function(){Fe(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var e=0;e<a.undone.length;e++)a.undone[e].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new _d(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:le(this.history.done),undone:le(this.history.undone)}},setHistory:function(a){var b=this.history=new _d(this.history.maxGeneration);b.done=le(a.done.slice(0),null,!0),b.undone=le(a.undone.slice(0),null,!0)},setGutterMarker:pd(function(a,b,c){return Ne(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&w(d)&&(a.gutterMarkers=null),!0})}),clearGutter:pd(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&Ne(b,c,"gutter",function(){return c.gutterMarkers[a]=null,w(c.gutterMarkers)&&(c.gutterMarkers=null),!0})})}),lineInfo:function(a){var b;if("number"==typeof a){if(!H(this,a))return null;if(b=a,a=B(this,a),!a)return null}else if(b=F(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:pd(function(b,c,d){return Ne(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass";if(b[e]){if(a(d).test(b[e]))return!1;b[e]+=" "+d}else b[e]=d;return!0})}),removeLineClass:pd(function(b,c,d){return Ne(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass",f=b[e];if(!f)return!1;if(null==d)b[e]=null;else{var g=f.match(a(d));if(!g)return!1;var h=g.index+g[0].length;b[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}return!0})}),addLineWidget:pd(function(a,b,c){return Re(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Se(this,Q(this,a),Q(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};return a=Q(this,a),Se(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Q(this,a);var b=[],c=B(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=Q(this,a),b=Q(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];null!=i.to&&e==a.line&&a.ch>=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;return this.iter(function(e){var f=e.text.length+d;return f>a?(b=a,!0):(a-=f,void++c)}),Q(this,J(c,b))},indexFromPos:function(a){a=Q(this,a);var b=a.ch;if(a.line<this.first||a.ch<0)return 0;var c=this.lineSeparator().length;return this.iter(this.first,a.line,function(a){b+=a.text.length+c}),b},copy:function(a){var b=new Eh(D(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new Eh(D(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],Ve(d,Ue(this)),d},unlinkDoc:function(a){var b=this;if(a instanceof Pf&&(a=a.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=b.linked[c];if(d.doc==a){b.linked.splice(c,1),a.unlinkDoc(b),We(Ue(b));break}}if(a.history==this.history){var e=[a.id];Xd(a,function(a){return e.push(a.id)},!0),a.history=new _d(null),a.history.done=le(this.history.done,e),a.history.undone=le(this.history.undone,e)}},iterLinkedDocs:function(a){Xd(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):$g(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:pd(function(a){"rtl"!=a&&(a="ltr"),a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&$d(this.cm))})}),Eh.prototype.eachLine=Eh.prototype.iter;for(var Fh=0,Gh=!1,Hh={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ih=0;Ih<10;Ih++)Hh[Ih+48]=Hh[Ih+96]=String(Ih);for(var Jh=65;Jh<=90;Jh++)Hh[Jh]=String.fromCharCode(Jh);for(var Kh=1;Kh<=12;Kh++)Hh[Kh+111]=Hh[Kh+63235]="F"+Kh;var Lh={};Lh.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"},Lh.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"},Lh.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"},Lh.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"]},Lh["default"]=zg?Lh.macDefault:Lh.pcDefault;var Mh={selectAll:Be,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ng)},killLine:function(a){return lf(a,function(b){if(b.empty()){var c=B(a.doc,b.head.line).text.length; return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:J(b.head.line+1,0)}:{from:b.head,to:J(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return lf(a,function(b){return{from:J(b.from().line,0),to:Q(a.doc,J(b.to().line+1,0))}})},delLineLeft:function(a){return lf(a,function(a){return{from:J(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return lf(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){return lf(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(J(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(J(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return mf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return of(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){return nf(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},Pg)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},Pg)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?of(a,b.head):d},Pg)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=l(a.getLine(f.line),f.ch,d);b.push(o(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return md(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=b[d].head,f=B(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new J(e.line,e.ch-1)),e.ch>0)e=new J(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),J(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=B(a.doc,e.line-1).text;g&&(e=new J(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),J(e.line-1,g.length-1),e,"+transpose"))}c.push(new yh(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return md(a,function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(var d=0;d<b.length;d++)a.indentLine(b[d].from().line,null,!0);Uc(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Nh=new Ig,Oh=null,Ph=400,Qh=function(a,b,c){this.time=a,this.pos=b,this.button=c};Qh.prototype.compare=function(a,b,c){return this.time+Ph>a&&0==K(b,this.pos)&&c==this.button};var Rh,Sh,Th={toString:function(){return"CodeMirror.Init"}},Uh={},Vh={};Pf.defaults=Uh,Pf.optionHandlers=Vh;var Wh=[];Pf.defineInitHook=function(a){return Wh.push(a)};var Xh=null,Yh=function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];d[a]==c&&"mode"!=a||(d[a]=c,b.hasOwnProperty(a)&&nd(this,b[a])(this,c,e),Ea(this,"optionChange",this,a))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](kf(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:od(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");r(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority}),this.state.modeGen++,qd(this)}),removeOverlay:od(function(a){for(var b=this,c=this.state.overlays,d=0;d<c.length;++d){var e=c[d].modeSpec;if(e==a||"string"==typeof a&&e.name==a)return c.splice(d,1),b.state.modeGen++,void qd(b)}}),indentLine:od(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),H(this.doc,a)&&Rf(this,a,b,c)}),indentSelection:od(function(a){for(var b=this,c=this.doc.sel.ranges,d=-1,e=0;e<c.length;e++){var f=c[e];if(f.empty())f.head.line>d&&(Rf(b,f.head.line,a,!0),d=f.head.line,e==b.doc.sel.primIndex&&Uc(b));else{var g=f.from(),h=f.to(),i=Math.max(d,g.line);d=Math.min(b.lastLine(),h.line-(h.ch?0:1))+1;for(var j=i;j<d;++j)Rf(b,j,a);var k=b.doc.sel.ranges;0==g.ch&&c.length==k.length&&k[e].from().ch>0&&pe(b.doc,e,new yh(g,k[e].to()),Ng)}}}),getTokenAt:function(a,b){return eb(this,a,b)},getLineTokens:function(a,b){return eb(this,J(a),b,!0)},getTokenTypeAt:function(a){a=Q(this.doc,a);var b,c=_a(this,B(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]<f)){b=c[2*g+2];break}d=g+1}}var h=b?b.indexOf("overlay "):-1;return h<0?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=this,e=[];if(!c.hasOwnProperty(b))return e;var f=c[b],g=this.getModeAt(a);if("string"==typeof g[b])f[g[b]]&&e.push(f[g[b]]);else if(g[b])for(var h=0;h<g[b].length;h++){var i=f[g[b][h]];i&&e.push(i)}else g.helperType&&f[g.helperType]?e.push(f[g.helperType]):f[g.name]&&e.push(f[g.name]);for(var j=0;j<f._global.length;j++){var k=f._global[j];k.pred(g,d)&&m(e,k.val)==-1&&e.push(k.val)}return e},getStateAfter:function(a,b){var c=this.doc;return a=P(c,null==a?c.first+c.size-1:a),ab(this,a+1,b).state},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?Q(this.doc,a):a?d.from():d.to(),lc(this,c,b||"page")},charCoords:function(a,b){return kc(this,Q(this.doc,a),b||"page")},coordsChar:function(a,b){return a=jc(this,a,b||"page"),oc(this,a.left,a.top)},lineAtHeight:function(a,b){return a=jc(this,{top:a,left:0},b||"page").top,G(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d,e=!1;if("number"==typeof a){var f=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>f&&(a=f,e=!0),d=B(this.doc,a)}else d=a;return ic(this,d,{top:0,left:0},b||"page",c||e).top+(e?this.doc.height-sa(d):0)},defaultTextHeight:function(){return sc(this.display)},defaultCharWidth:function(){return tc(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=lc(this,Q(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Rc(this,{left:h,top:g,right:h+b.offsetWidth,bottom:g+b.offsetHeight})},triggerOnKeyDown:od(uf),triggerOnKeyPress:od(xf),triggerOnKeyUp:wf,triggerOnMouseDown:od(zf),execCommand:function(a){if(Mh.hasOwnProperty(a))return Mh[a].call(null,this)},triggerElectric:od(function(a){Vf(this,a)}),findPosH:function(a,b,c,d){var e=this,f=1;b<0&&(f=-1,b=-b);for(var g=Q(this.doc,a),h=0;h<b&&(g=Zf(e.doc,g,f,c,d),!g.hitSide);++h);return g},moveH:od(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Zf(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},Pg)}),deleteH:od(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):lf(this,function(c){var e=Zf(d,c.head,a,b,!1);return a<0?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=this,f=1,g=d;b<0&&(f=-1,b=-b);for(var h=Q(this.doc,a),i=0;i<b;++i){var j=lc(e,h,"div");if(null==g?g=j.left:j.left=g,h=$f(e,j,f,c),h.hitSide)break}return h},moveV:od(function(a,b){var c=this,d=this.doc,e=[],f=!this.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return a<0?g.from():g.to();var h=lc(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=$f(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Tc(c,kc(c,i,"div").top-h.top),i},Pg),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=this.doc,c=B(b,a.line).text,d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");"before"!=a.sticky&&e!=c.length||!d?++e:--d;for(var g=c.charAt(d),h=v(g,f)?function(a){return v(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!v(a)};d>0&&h(c.charAt(d-1));)--d;for(;e<c.length&&h(c.charAt(e));)++e}return new yh(J(a.line,d),J(a.line,e))},toggleOverwrite:function(a){null!=a&&a==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?h(this.display.cursorDiv,"CodeMirror-overwrite"):Gg(this.display.cursorDiv,"CodeMirror-overwrite"),Ea(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==g()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:od(function(a,b){Vc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Rb(this)-this.display.barHeight,width:a.scrollWidth-Rb(this)-this.display.barWidth,clientHeight:Tb(this),clientWidth:Sb(this)}},scrollIntoView:od(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:J(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line?Wc(this,a):Yc(this,a.from,a.to,a.margin)}),setSize:od(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a)),null!=b&&(this.display.wrapper.style.height=d(b)),this.options.lineWrapping&&ec(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){rd(c,e,"widget");break}++e}),this.curOp.forceUpdate=!0,Ea(this,"refresh",this)}),operation:function(a){return md(this,a)},startOperation:function(){return ed(this)},endOperation:function(){return fd(this)},refresh:od(function(){var a=this.display.cachedTextHeight;qd(this),this.curOp.forceUpdate=!0,fc(this),Vc(this,this.doc.scrollLeft,this.doc.scrollTop),Fd(this),(null==a||Math.abs(a-sc(this.display))>.5)&&xc(this),Ea(this,"refresh",this)}),swapDoc:od(function(a){var b=this.doc;return b.cm=null,Yd(this,a),fc(this),this.display.input.reset(),Vc(this,a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,yb(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ia(a),a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]}),c[b][d]=e},a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f),c[b]._global.push({pred:e,val:f})}},Zh=function(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ig,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Zh.prototype.init=function(a){function b(a){if(!Fa(e,a)){if(e.somethingSelected())Sf({lineWise:!1,text:e.getSelections()}),"cut"==a.type&&e.replaceSelection("",null,"cut");else{if(!e.options.lineWiseCopyCut)return;var b=Wf(e);Sf({lineWise:!0,text:b.text}),"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,Ng),e.replaceSelection("",null,"cut")})}if(a.clipboardData){a.clipboardData.clearData();var c=Xh.text.join("\n");if(a.clipboardData.setData("Text",c),a.clipboardData.getData("Text")==c)return void a.preventDefault()}var g=Yf(),h=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild),h.value=Xh.text.join("\n");var i=document.activeElement;Hg(h),setTimeout(function(){e.display.lineSpace.removeChild(g),i.focus(),i==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Xf(f,e.options.spellcheck),Yg(f,"paste",function(a){Fa(e,a)||Uf(a,e)||og<=11&&setTimeout(nd(e,function(){return c.updateFromDOM()}),20)}),Yg(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}}),Yg(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})}),Yg(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)}),Yg(f,"touchstart",function(){return d.forceCompositionEnd()}),Yg(f,"input",function(){c.composing||c.readFromDOMSoon()}),Yg(f,"copy",b),Yg(f,"cut",b)},Zh.prototype.prepareSelection=function(){var a=Bc(this.cm,!1);return a.focus=this.cm.state.focused,a},Zh.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},Zh.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from(),e=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||e.line<b.display.viewFrom)return void a.removeAllRanges();var f=dg(b,a.anchorNode,a.anchorOffset),g=dg(b,a.focusNode,a.focusOffset);if(!f||f.bad||!g||g.bad||0!=K(O(f,g),d)||0!=K(N(f,g),e)){var h=b.display.view,i=d.line>=b.display.viewFrom&&_f(b,d)||{node:h[0].measure.map[2],offset:0},j=e.line<b.display.viewTo&&_f(b,e);if(!j){var k=h[h.length-1].measure,l=k.maps?k.maps[k.maps.length-1]:k.map;j={node:l[l.length-1],offset:l[l.length-2]-l[l.length-3]}}if(!i||!j)return void a.removeAllRanges();var m,n=a.rangeCount&&a.getRangeAt(0);try{m=Dg(i.node,i.offset,j.offset,j.node)}catch(o){}m&&(!jg&&b.state.focused?(a.collapse(i.node,i.offset),m.collapsed||(a.removeAllRanges(),a.addRange(m))):(a.removeAllRanges(),a.addRange(m)),n&&null==a.anchorNode?a.addRange(n):jg&&this.startGracePeriod()),this.rememberSelection()}},Zh.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)},Zh.prototype.showMultipleSelections=function(a){c(this.cm.display.cursorDiv,a.cursors),c(this.cm.display.selectionDiv,a.selection)},Zh.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},Zh.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return f(this.div,b)},Zh.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Zh.prototype.blur=function(){this.div.blur()},Zh.prototype.getField=function(){return this.div},Zh.prototype.supportsTouch=function(){return!0},Zh.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():md(this.cm,function(){return b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},Zh.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},Zh.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;if(xg&&rg&&this.cm.options.gutters.length&&ag(a.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var c=dg(b,a.anchorNode,a.anchorOffset),d=dg(b,a.focusNode,a.focusOffset);c&&d&&md(b,function(){te(b.doc,Nd(c,d),Ng),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}}},Zh.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(0==d.ch&&d.line>a.firstLine()&&(d=J(d.line-1,B(a.doc,d.line-1).length)),e.ch==B(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=J(e.line+1,0)),d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f,g,h;d.line==b.viewFrom||0==(f=zc(a,d.line))?(g=F(b.view[0].line),h=b.view[0].node):(g=F(b.view[f].line),h=b.view[f-1].node.nextSibling);var i,j,k=zc(a,e.line);if(k==b.view.length-1?(i=b.viewTo-1,j=b.lineDiv.lastChild):(i=F(b.view[k+1].line)-1,j=b.view[k+1].node.previousSibling),!h)return!1;for(var l=a.doc.splitLines(cg(a,h,j,g,i)),m=C(a.doc,J(g,0),J(i,B(a.doc,i).text.length));l.length>1&&m.length>1;)if(p(l)==p(m))l.pop(),m.pop(),i--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,q=l[0],r=m[0],s=Math.min(q.length,r.length);n<s&&q.charCodeAt(n)==r.charCodeAt(n);)++n;for(var t=p(l),u=p(m),v=Math.min(t.length-(1==l.length?n:0),u.length-(1==m.length?n:0));o<v&&t.charCodeAt(t.length-o-1)==u.charCodeAt(u.length-o-1);)++o;if(1==l.length&&1==m.length&&g==d.line)for(;n&&n>d.ch&&t.charCodeAt(t.length-o-1)==u.charCodeAt(u.length-o-1);)n--,o++;l[l.length-1]=t.slice(0,t.length-o).replace(/^\u200b+/,""),l[0]=l[0].slice(n).replace(/\u200b+$/,"");var w=J(g,n),x=J(i,m.length?p(m).length-o:0);return l.length>1||l[0]||K(w,x)?(Je(a.doc,l,w,x,"+input"),!0):void 0},Zh.prototype.ensurePolled=function(){this.forceCompositionEnd()},Zh.prototype.reset=function(){this.forceCompositionEnd()},Zh.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Zh.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(a.readDOMTimeout=null,a.composing){if(!a.composing.done)return;a.composing=null}a.updateFromDOM()},80))},Zh.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||md(this.cm,function(){return qd(a.cm)})},Zh.prototype.setUneditable=function(a){a.contentEditable="false"},Zh.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||nd(this.cm,Tf)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))},Zh.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)},Zh.prototype.onContextMenu=function(){},Zh.prototype.resetPosition=function(){},Zh.prototype.needsContentAttribute=!0;var $h=function(a){this.cm=a,this.prevInput="",this.pollingFast=!1,this.polling=new Ig,this.hasSelection=!1,this.composing=null};$h.prototype.init=function(a){function b(a){if(!Fa(e,a)){if(e.somethingSelected())Sf({lineWise:!1,text:e.getSelections()});else{if(!e.options.lineWiseCopyCut)return;var b=Wf(e);Sf({lineWise:!0,text:b.text}),"cut"==a.type?e.setSelections(b.ranges,null,Ng):(d.prevInput="",g.value=b.text.join("\n"),Hg(g))}"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Yf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild),wg&&(g.style.width="0px"),Yg(g,"input",function(){ng&&og>=9&&c.hasSelection&&(c.hasSelection=null),d.poll()}),Yg(g,"paste",function(a){Fa(e,a)||Uf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())}),Yg(g,"cut",b),Yg(g,"copy",b),Yg(a.scroller,"paste",function(b){Nb(a,b)||Fa(e,b)||(e.state.pasteIncoming=!0,d.focus())}),Yg(a.lineSpace,"selectstart",function(b){Nb(a,b)||Ja(b)}),Yg(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear(),d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}}),Yg(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})},$h.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Bc(a);if(a.options.moveInputWithCursor){var e=lc(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},$h.prototype.showSelection=function(a){var b=this.cm,d=b.display;c(d.cursorDiv,a.cursors),c(d.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},$h.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;if(b.somethingSelected()){this.prevInput="";var c=b.getSelection();this.textarea.value=c,b.state.focused&&Hg(this.textarea),ng&&og>=9&&(this.hasSelection=c)}else a||(this.prevInput=this.textarea.value="",ng&&og>=9&&(this.hasSelection=null))}},$h.prototype.getField=function(){return this.textarea},$h.prototype.supportsTouch=function(){return!1},$h.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!yg||g()!=this.textarea))try{this.textarea.focus()}catch(a){}},$h.prototype.blur=function(){this.textarea.blur()},$h.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$h.prototype.receivedFocus=function(){this.slowPoll()},$h.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},$h.prototype.fastPoll=function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},$h.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||_g(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(ng&&og>=9&&this.hasSelection===e||zg&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(8203!=f||d||(d="\u200b"),8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,h=Math.min(d.length,e.length);g<h&&d.charCodeAt(g)==e.charCodeAt(g);)++g;return md(b,function(){Tf(b,e.slice(g),d.length-g,null,a.composing?"*compose":null),e.length>1e3||e.indexOf("\n")>-1?c.value=a.prevInput="":a.prevInput=e,a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$h.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$h.prototype.onKeyPress=function(){ng&&og>=9&&(this.hasSelection=null),this.fastPoll()},$h.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="\u200b"+(a?g.value:"");g.value="\u21da",g.value=b,d.prevInput=a?"":"\u200b",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,ng&&og<9&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!ng||ng&&og<9)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"\u200b"==d.prevInput?nd(e,Be)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=yc(e,a),i=f.scroller.scrollTop;if(h&&!sg){var j=e.options.resetSelectionOnContextMenu;j&&e.doc.sel.contains(h)==-1&&nd(e,te)(e.doc,Nd(h),Ng);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px;\n z-index: 1000; background: "+(ng?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;if(pg&&(n=window.scrollY),f.input.focus(),pg&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),ng&&og>=9&&b(),Fg){Ma(a);var o=function(){Da(window,"mouseup",o),setTimeout(c,20)};Yg(window,"mouseup",o)}else setTimeout(c,50)}},$h.prototype.readOnlyChanged=function(a){a||this.reset(),this.textarea.disabled="nocursor"==a},$h.prototype.setUneditable=function(){},$h.prototype.needsContentAttribute=!1,Lf(Pf),Yh(Pf);var _h="iter insert remove copy getEditor constructor".split(" ");for(var ai in Eh.prototype)Eh.prototype.hasOwnProperty(ai)&&m(_h,ai)<0&&(Pf.prototype[ai]=function(a){return function(){return a.apply(this.doc,arguments)}}(Eh.prototype[ai]));return Ia(Eh),Pf.inputStyles={textarea:$h,contenteditable:Zh},Pf.defineMode=function(a){Pf.defaults.mode||"null"==a||(Pf.defaults.mode=a),Sa.apply(this,arguments)},Pf.defineMIME=Ta,Pf.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}}),Pf.defineMIME("text/plain","null"),Pf.defineExtension=function(a,b){Pf.prototype[a]=b},Pf.defineDocExtension=function(a,b){Eh.prototype[a]=b},Pf.fromTextArea=fg,gg(Pf),Pf.version="5.29.1",Pf})},{}],60:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.info=d,this.align=e,this.prev=f}function c(a,c,d,e){var f=a.indented;return a.context&&"statement"==a.context.type&&"statement"!=d&&(f=a.context.indented),a.context=new b(f,c,d,e,null,a.context)}function d(a){var b=a.context.type;return")"!=b&&"]"!=b&&"}"!=b||(a.indented=a.context.indented),a.context=a.context.prev}function e(a,b,c){return"variable"==b.prevToken||"type"==b.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(a.string.slice(0,c))||(!(!b.typeAtEndOfLine||a.column()!=a.indentation())||void 0))}function f(a){for(;;){if(!a||"top"==a.type)return!0;if("}"==a.type&&"namespace"!=a.prev.info)return!1;a=a.prev}}function g(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function h(a,b){return"function"==typeof a?a(b):a.propertyIsEnumerable(b)}function i(a,b){if(!b.startOfLine)return!1;for(var c,d=null;c=a.peek();){if("\\"==c&&a.match(/^.$/)){d=i;break}if("/"==c&&a.match(/^\/[\/\*]/,!1))break;a.next()}return b.tokenize=d,"meta"}function j(a,b){return"type"==b.prevToken&&"type"}function k(a){return a.eatWhile(/[\w\.']/),"number"}function l(a,b){if(a.backUp(1),a.match(/(R|u8R|uR|UR|LR)/)){var c=a.match(/"([^\s\\()]{0,16})\(/);return!!c&&(b.cpp11RawStringDelim=c[1],b.tokenize=o,o(a,b))}return a.match(/(u8|u|U|L)/)?!!a.match(/["']/,!1)&&"string":(a.next(),!1)}function m(a){var b=/(\w+)::~?(\w+)$/.exec(a);return b&&b[1]==b[2]}function n(a,b){for(var c;null!=(c=a.next());)if('"'==c&&!a.eat('"')){b.tokenize=null;break}return"string"}function o(a,b){var c=b.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),d=a.match(new RegExp(".*?\\)"+c+'"'));return d?b.tokenize=null:a.skipToEnd(),"string"}function p(b,c){function d(a){if(a)for(var b in a)a.hasOwnProperty(b)&&e.push(b)}"string"==typeof b&&(b=[b]);var e=[];d(c.keywords),d(c.types),d(c.builtin),d(c.atoms),e.length&&(c.helperType=b[0],a.registerHelper("hintWords",b[0],e));for(var f=0;f<b.length;++f)a.defineMIME(b[f],c)}function q(a,b){for(var c=!1;!a.eol();){if(!c&&a.match('"""')){b.tokenize=null;break}c="\\"==a.next()&&!c}return"string"}function r(a){return function(b,c){for(var d,e=!1,f=!1;!b.eol();){if(!a&&!e&&b.match('"')){f=!0;break}if(a&&b.match('"""')){f=!0;break}d=b.next(),!e&&"$"==d&&b.match("{")&&b.skipTo("}"),e=!e&&"\\"==d&&!a}return!f&&a||(c.tokenize=null),"string"}}function s(a){return function(b,c){for(var d,e=!1,f=!1;!b.eol();){if(!e&&b.match('"')&&("single"==a||b.match('""'))){f=!0;break}if(!e&&b.match("``")){v=s(a),f=!0;break}d=b.next(),e="single"==a&&!e&&"\\"==d}return f&&(c.tokenize=null),"string"}}a.defineMode("clike",function(g,i){function j(a,b){var c=a.next();if(y[c]){var d=y[c](a,b);if(d!==!1)return d}if('"'==c||"'"==c)return b.tokenize=k(c),b.tokenize(a,b);if(D.test(c))return n=c,null;if(E.test(c)){if(a.backUp(1),a.match(F))return"number";a.next()}if("/"==c){if(a.eat("*"))return b.tokenize=l,l(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(G.test(c)){for(;!a.match(/^\/[\/*]/,!1)&&a.eat(G););return"operator"}if(a.eatWhile(H),C)for(;a.match(C);)a.eatWhile(H);var e=a.current();return h(s,e)?(h(v,e)&&(n="newstatement"),h(w,e)&&(o=!0),"keyword"):h(t,e)?"type":h(u,e)?(h(v,e)&&(n="newstatement"),"builtin"):h(x,e)?"atom":"variable"}function k(a){return function(b,c){for(var d,e=!1,f=!1;null!=(d=b.next());){if(d==a&&!e){f=!0;break}e=!e&&"\\"==d}return(f||!e&&!z)&&(c.tokenize=null),"string"}}function l(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=null;break}d="*"==c}return"comment"}function m(a,b){i.typeFirstDefinitions&&a.eol()&&f(b.context)&&(b.typeAtEndOfLine=e(a,b,a.pos))}var n,o,p=g.indentUnit,q=i.statementIndentUnit||p,r=i.dontAlignCalls,s=i.keywords||{},t=i.types||{},u=i.builtin||{},v=i.blockKeywords||{},w=i.defKeywords||{},x=i.atoms||{},y=i.hooks||{},z=i.multiLineStrings,A=i.indentStatements!==!1,B=i.indentSwitch!==!1,C=i.namespaceSeparator,D=i.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=i.numberStart||/[\d\.]/,F=i.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,G=i.isOperatorChar||/[+\-*&%=<>!?|\/]/,H=i.isIdentifierChar||/[\w\$_\xa1-\uffff]/;return{startState:function(a){return{tokenize:null,context:new b((a||0)-p,0,"top",null,!1),indented:0, startOfLine:!0,prevToken:null}},token:function(a,b){var g=b.context;if(a.sol()&&(null==g.align&&(g.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return m(a,b),null;n=o=null;var h=(b.tokenize||j)(a,b);if("comment"==h||"meta"==h)return h;if(null==g.align&&(g.align=!0),";"==n||":"==n||","==n&&a.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==b.context.type;)d(b);else if("{"==n)c(b,a.column(),"}");else if("["==n)c(b,a.column(),"]");else if("("==n)c(b,a.column(),")");else if("}"==n){for(;"statement"==g.type;)g=d(b);for("}"==g.type&&(g=d(b));"statement"==g.type;)g=d(b)}else n==g.type?d(b):A&&(("}"==g.type||"top"==g.type)&&";"!=n||"statement"==g.type&&"newstatement"==n)&&c(b,a.column(),"statement",a.current());if("variable"==h&&("def"==b.prevToken||i.typeFirstDefinitions&&e(a,b,a.start)&&f(b.context)&&a.match(/^\s*\(/,!1))&&(h="def"),y.token){var k=y.token(a,b,h);void 0!==k&&(h=k)}return"def"==h&&i.styleDefs===!1&&(h="variable"),b.startOfLine=!1,b.prevToken=o?"def":h||n,m(a,b),h},indent:function(b,c){if(b.tokenize!=j&&null!=b.tokenize||b.typeAtEndOfLine)return a.Pass;var d=b.context,e=c&&c.charAt(0);if("statement"==d.type&&"}"==e&&(d=d.prev),i.dontIndentStatements)for(;"statement"==d.type&&i.dontIndentStatements.test(d.info);)d=d.prev;if(y.indent){var f=y.indent(b,d,c);if("number"==typeof f)return f}var g=e==d.type,h=d.prev&&"switch"==d.prev.info;if(i.allmanIndentation&&/[{(]/.test(e)){for(;"top"!=d.type&&"}"!=d.type;)d=d.prev;return d.indented}return"statement"==d.type?d.indented+("{"==e?0:q):!d.align||r&&")"==d.type?")"!=d.type||g?d.indented+(g?0:p)+(g||!h||/^(?:case|default)\b/.test(c)?0:p):d.indented+q:d.column+(g?0:1)},electricInput:B?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",u="int long char short double float unsigned signed void size_t ptrdiff_t";p(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:g(t),types:g(u+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:g("case do else for if switch while struct"),defKeywords:g("struct"),typeFirstDefinitions:!0,atoms:g("null true false"),hooks:{"#":i,"*":j},modeProps:{fold:["brace","include"]}}),p(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:g(t+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:g(u+" bool wchar_t"),blockKeywords:g("catch class do else finally for if struct switch try while"),defKeywords:g("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:g("true false null"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":i,"*":j,u:l,U:l,L:l,R:l,0:k,1:k,2:k,3:k,4:k,5:k,6:k,7:k,8:k,9:k,token:function(a,b,c){if("variable"==c&&"("==a.peek()&&(";"==b.prevToken||null==b.prevToken||"}"==b.prevToken)&&m(a.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),p("text/x-java",{name:"clike",keywords:g("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:g("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:g("catch class do else finally for if switch try while"),defKeywords:g("class interface package enum @interface"),typeFirstDefinitions:!0,atoms:g("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(a){return!a.match("interface",!1)&&(a.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),p("text/x-csharp",{name:"clike",keywords:g("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:g("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:g("catch class do else finally for foreach if struct switch try while"),defKeywords:g("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=n,n(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),p("text/x-scala",{name:"clike",keywords:g("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:g("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:g("catch class enum do else finally for forSome if match switch try while"),defKeywords:g("class enum def object package trait type val var"),atoms:g("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return!!a.match('""')&&(b.tokenize=q,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(a,c){var d=c.context;return!("}"!=d.type||!d.align||!a.eat(">"))&&(c.context=new b(d.indented,d.column,d.type,d.info,null,d.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),p("text/x-kotlin",{name:"clike",keywords:g("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend"),types:g("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:g("catch class do else finally for if where try while enum"),defKeywords:g("class val var object package interface fun"),atoms:g("true false null this"),hooks:{'"':function(a,b){return b.tokenize=r(a.match('""')),b.tokenize(a,b)}},modeProps:{closeBrackets:{triples:'"'}}}),p(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:g("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:g("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:g("for while do if else struct"),builtin:g("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:g("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-nesc",{name:"clike",keywords:g(t+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:g(u),blockKeywords:g("case do else for if switch while struct"),atoms:g("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-objectivec",{name:"clike",keywords:g(t+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:g(u),atoms:g("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(a){return a.eatWhile(/[\w\$]/),"keyword"},"#":i,indent:function(a,b,c){if("statement"==b.type&&/^@\w/.test(c))return b.indented}},modeProps:{fold:"brace"}}),p("text/x-squirrel",{name:"clike",keywords:g("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:g(u),blockKeywords:g("case catch class else for foreach if switch try while"),defKeywords:g("function local class"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"#":i},modeProps:{fold:["brace","include"]}});var v=null;p("text/x-ceylon",{name:"clike",keywords:g("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(a){var b=a.charAt(0);return b===b.toUpperCase()&&b!==b.toLowerCase()},blockKeywords:g("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:g("class dynamic function interface module object package value"),builtin:g("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:g("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return b.tokenize=s(a.match('""')?"triple":"single"),b.tokenize(a,b)},"`":function(a,b){return!(!v||!a.match("`"))&&(b.tokenize=v,v=null,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(a,b,c){if(("variable"==c||"type"==c)&&"."==b.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})},{"../../lib/codemirror":59}],61:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c<a.length;++c)b[a[c].toLowerCase()]=!0;return b}function c(a,b){for(var c,d=!1;null!=(c=a.next());){if(d&&"/"==c){b.tokenize=null;break}d="*"==c}return["comment","comment"]}a.defineMode("css",function(b,c){function d(a,b){return o=b,a}function e(a,b){var c=a.next();if(r[c]){var e=r[c](a,b);if(e!==!1)return e}return"@"==c?(a.eatWhile(/[\w\\\-]/),d("def",a.current())):"="==c||("~"==c||"|"==c)&&a.eat("=")?d(null,"compare"):'"'==c||"'"==c?(b.tokenize=f(c),b.tokenize(a,b)):"#"==c?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):"!"==c?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)||"."==c&&a.eat(/\d/)?(a.eatWhile(/[\w.%]/),d("number","unit")):"-"!==c?/[,+>*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):"u"==c&&a.match(/rl(-prefix)?\(/)||"d"==c&&a.match("omain(")||"r"==c&&a.match("egexp(")?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c,d){return a.context=new h(c,b.indentation()+(d===!1?0:q),a.context),c}function j(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function k(a,b,c){return F[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();p=B.hasOwnProperty(b)?"atom":A.hasOwnProperty(b)?"keyword":"variable"}var n=c.inline;c.propertyKeywords||(c=a.resolveMode("text/css"));var o,p,q=b.indentUnit,r=c.tokenHooks,s=c.documentTypes||{},t=c.mediaTypes||{},u=c.mediaFeatures||{},v=c.mediaValueKeywords||{},w=c.propertyKeywords||{},x=c.nonStandardPropertyKeywords||{},y=c.fontProperties||{},z=c.counterDescriptors||{},A=c.colorKeywords||{},B=c.valueKeywords||{},C=c.allowNested,D=c.lineComment,E=c.supportsAtComponent===!0,F={};return F.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(E&&/@component/.test(a))return i(c,b,"atComponentBlock");if(/^@(-moz-)?document$/.test(a))return i(c,b,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(a))return i(c,b,"atBlock");if(/^@(font-face|counter-style)/.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)p="builtin";else if("word"==a)p="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(C&&"("==a)return i(c,b,"parens")}return c.context.type},F.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return w.hasOwnProperty(d)?(p="property","maybeprop"):x.hasOwnProperty(d)?(p="string-2","maybeprop"):C?(p=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==a?"block":C||"hash"!=a&&"qualifier"!=a?F.top(a,b,c):(p="error","block")},F.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},F.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&C)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else p+=" error";return"prop"},F.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(p="property","maybeprop"):c.context.type},F.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},F.pseudo=function(a,b,c){return"meta"==a?"pseudo":"word"==a?(p="variable-3",c.context.type):k(a,b,c)},F.documentTypes=function(a,b,c){return"word"==a&&s.hasOwnProperty(b.current())?(p="tag",c.context.type):F.atBlock(a,b,c)},F.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a||";"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,C?"block":"top");if("interpolation"==a)return i(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();p="only"==d||"not"==d||"and"==d||"or"==d?"keyword":t.hasOwnProperty(d)?"attribute":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"keyword":w.hasOwnProperty(d)?"property":x.hasOwnProperty(d)?"string-2":B.hasOwnProperty(d)?"atom":A.hasOwnProperty(d)?"keyword":"error"}return c.context.type},F.atComponentBlock=function(a,b,c){return"}"==a?l(a,b,c):"{"==a?j(c)&&i(c,b,C?"block":"top",!1):("word"==a&&(p="error"),c.context.type)},F.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):F.atBlock(a,b,c)},F.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(p="variable","restricted_atBlock_before"):k(a,b,c)},F.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(p="@font-face"==c.stateArg&&!y.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!z.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},F.keyframes=function(a,b,c){return"word"==a?(p="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},F.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?p="tag":"hash"==a&&(p="builtin"),"at")},F.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?p="variable":"variable"!=a&&"("!=a&&")"!=a&&(p="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new h(n?"block":"top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(o=c[1],c=c[0]),p=c,"comment"!=o&&(b.state=F[b.state](o,a,b)),p},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),c.prev&&("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type?(")"!=d||"parens"!=c.type&&"atBlock_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"atBlock"!=c.type)||(e=Math.max(0,c.indent-q)):(c=c.prev,e=c.indent)),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:D,fold:"brace"}});var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["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"],i=b(h),j=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],k=b(j),l=["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","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"],m=b(l),n=["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"],o=b(n),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],q=b(p),r=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],s=b(r),t=["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"],u=b(t),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"],w=b(v),x=d.concat(f).concat(h).concat(j).concat(l).concat(n).concat(t).concat(v); a.registerHelper("hintWords","css",x),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return!!a.match(/\s*\{/,!1)&&[null,null]},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return!!a.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:!a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),a.defineMIME("text/x-gss",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css",helperType:"gss"})})},{"../../lib/codemirror":59}],62:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("diff",function(){var a={"+":"positive","-":"negative","@":"meta"};return{token:function(b){var c=b.string.search(/[\t ]+?$/);if(!b.sol()||0===c)return b.skipToEnd(),("error "+(a[b.string.charAt(0)]||"")).replace(/ $/,"");var d=a[b.peek()]||b.skipToEnd();return c===-1?b.skipToEnd():b.pos=c,d}}}),a.defineMIME("text/x-diff","diff")})},{"../../lib/codemirror":59}],63:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../markdown/markdown"),a("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],d):d(CodeMirror)}(function(a){"use strict";var b=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))/i;a.defineMode("gfm",function(c,d){function e(a){return a.code=!1,null}var f=0,g={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(a){return{code:a.code,codeBlock:a.codeBlock,ateSpace:a.ateSpace}},token:function(a,c){if(c.combineTokens=null,c.codeBlock)return a.match(/^```+/)?(c.codeBlock=!1,null):(a.skipToEnd(),null);if(a.sol()&&(c.code=!1),a.sol()&&a.match(/^```+/))return a.skipToEnd(),c.codeBlock=!0,null;if("`"===a.peek()){a.next();var e=a.pos;a.eatWhile("`");var g=1+a.pos-e;return c.code?g===f&&(c.code=!1):(f=g,c.code=!0),null}if(c.code)return a.next(),null;if(a.eatSpace())return c.ateSpace=!0,null;if((a.sol()||c.ateSpace)&&(c.ateSpace=!1,d.gitHubSpice!==!1)){if(a.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return c.combineTokens=!0,"link";if(a.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return c.combineTokens=!0,"link"}return a.match(b)&&"]("!=a.string.slice(a.start-2,a.start)&&(0==a.start||/\W/.test(a.string.charAt(a.start-1)))?(c.combineTokens=!0,"link"):(a.next(),null)},blankLine:e},h={taskLists:!0,strikethrough:!0,emoji:!0};for(var i in d)h[i]=d[i];return h.name="markdown",a.overlayMode(a.getMode(c,h),g)},"markdown"),a.defineMIME("text/x-gfm","gfm")})},{"../../addon/mode/overlay":37,"../../lib/codemirror":59,"../markdown/markdown":68}],64:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../xml/xml"),a("../javascript/javascript"),a("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c){var d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):d.match(/<\/?$/)&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function c(a){var b=i[a];return b?b:i[a]=new RegExp("\\s+"+a+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function d(a,b){var d=a.match(c(b));return d?/^\s*(.*?)\s*$/.exec(d[2])[1]:""}function e(a,b){return new RegExp((b?"^":"")+"</s*"+a+"s*>","i")}function f(a,b){for(var c in a)for(var d=b[c]||(b[c]=[]),e=a[c],f=e.length-1;f>=0;f--)d.unshift(e[f])}function g(a,b){for(var c=0;c<a.length;c++){var e=a[c];if(!e[0]||e[1].test(d(b,e[0])))return e[2]}}var h={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"]]},i={};a.defineMode("htmlmixed",function(c,d){function i(d,f){var h,l=j.token(d,f.htmlState),m=/\btag\b/.test(l);if(m&&!/[<>\s\/]/.test(d.current())&&(h=f.htmlState.tagName&&f.htmlState.tagName.toLowerCase())&&k.hasOwnProperty(h))f.inTag=h+" ";else if(f.inTag&&m&&/>$/.test(d.current())){var n=/^([\S]+) (.*)/.exec(f.inTag);f.inTag=null;var o=">"==d.current()&&g(k[n[1]],n[2]),p=a.getMode(c,o),q=e(n[1],!0),r=e(n[1],!1);f.token=function(a,c){return a.match(q,!1)?(c.token=i,c.localState=c.localMode=null,null):b(a,r,c.localMode.token(a,c.localState))},f.localMode=p,f.localState=a.startState(p,j.indent(f.htmlState,""))}else f.inTag&&(f.inTag+=d.current(),d.eol()&&(f.inTag+=" "));return l}var j=a.getMode(c,{name:"xml",htmlMode:!0,multilineTagIndentFactor:d.multilineTagIndentFactor,multilineTagIndentPastTag:d.multilineTagIndentPastTag}),k={},l=d&&d.tags,m=d&&d.scriptTypes;if(f(h,k),l&&f(l,k),m)for(var n=m.length-1;n>=0;n--)k.script.unshift(["type",m[n].matches,m[n].mode]);return{startState:function(){var b=a.startState(j);return{token:i,inTag:null,localMode:null,localState:null,htmlState:b}},copyState:function(b){var c;return b.localState&&(c=a.copyState(b.localMode,b.localState)),{token:b.token,inTag:b.inTag,localMode:b.localMode,localState:c,htmlState:a.copyState(j,b.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(b,c,d){return!b.localMode||/^\s*<\//.test(c)?j.indent(b.htmlState,c):b.localMode.indent?b.localMode.indent(b.localState,c,d):a.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||j}}}},"xml","javascript","css"),a.defineMIME("text/html","htmlmixed")})},{"../../lib/codemirror":59,"../css/css":61,"../javascript/javascript":66,"../xml/xml":75}],65:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("http",function(){function a(a,b){return a.skipToEnd(),b.cur=g,"error"}function b(b,d){return b.match(/^HTTP\/\d\.\d/)?(d.cur=c,"keyword"):b.match(/^[A-Z]+/)&&/[ \t]/.test(b.peek())?(d.cur=e,"keyword"):a(b,d)}function c(b,c){var e=b.match(/^\d+/);if(!e)return a(b,c);c.cur=d;var f=Number(e[0]);return f>=100&&f<200?"positive informational":f>=200&&f<300?"positive success":f>=300&&f<400?"positive redirect":f>=400&&f<500?"negative client-error":f>=500&&f<600?"negative server-error":"error"}function d(a,b){return a.skipToEnd(),b.cur=g,null}function e(a,b){return a.eatWhile(/\S/),b.cur=f,"string-2"}function f(b,c){return b.match(/^HTTP\/\d\.\d$/)?(c.cur=g,"keyword"):a(b,c)}function g(a){return a.sol()&&!a.eat(/[ \t]/)?a.match(/^.*?:/)?"atom":(a.skipToEnd(),"error"):(a.skipToEnd(),"string")}function h(a){return a.skipToEnd(),null}return{token:function(a,b){var c=b.cur;return c!=g&&c!=h&&a.eatSpace()?null:c(a,b)},blankLine:function(a){a.cur=h},startState:function(){return{cur:b}}}}),a.defineMIME("message/http","http")})},{"../../lib/codemirror":59}],66:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("javascript",function(b,c){function d(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function e(a,b,c){return Aa=a,Ba=c,b}function f(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=g(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return e("number","number");if("."==c&&a.match(".."))return e("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return e(c);if("="==c&&a.eat(">"))return e("=>","operator");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),e("number","number");if("0"==c&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),e("number","number");if("0"==c&&a.eat(/b/i))return a.eatWhile(/[01]/i),e("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),e("number","number");if("/"==c)return a.eat("*")?(b.tokenize=h,h(a,b)):a.eat("/")?(a.skipToEnd(),e("comment","comment")):za(a,b,1)?(d(a),a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),e("regexp","string-2")):(a.eatWhile(Ja),e("operator","operator",a.current()));if("`"==c)return b.tokenize=i,i(a,b);if("#"==c)return a.skipToEnd(),e("error","error");if(Ja.test(c))return">"==c&&b.lexical&&">"==b.lexical.type||a.eatWhile(Ja),e("operator","operator",a.current());if(Ha.test(c)){a.eatWhile(Ha);var f=a.current();if("."!=b.lastType){if(Ia.propertyIsEnumerable(f)){var j=Ia[f];return e(j.type,j.style,f)}if("async"==f&&a.match(/^\s*[\(\w]/,!1))return e("async","keyword",f)}return e("variable","variable",f)}}function g(a){return function(b,c){var d,g=!1;if(Ea&&"@"==b.peek()&&b.match(Ka))return c.tokenize=f,e("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||g);)g=!g&&"\\"==d;return g||(c.tokenize=f),e("string","string")}}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=f;break}d="*"==c}return e("comment","comment")}function i(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=f;break}d=!d&&"\\"==c}return e("quasi","string-2",a.current())}function j(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(c<0)){if(Ga){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}for(var e=0,f=!1,g=c-1;g>=0;--g){var h=a.string.charAt(g),i=La.indexOf(h);if(i>=0&&i<3){if(!e){++g;break}if(0==--e){"("==h&&(f=!0);break}}else if(i>=3&&i<6)++e;else if(Ha.test(h))f=!0;else{if(/["'\/]/.test(h))return;if(f&&!e){++g;break}}}f&&!e&&(b.fatArrowAt=g)}}function k(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function l(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function m(a,b,c,d,e){var f=a.cc;for(Na.state=a,Na.stream=e,Na.marked=null,Na.cc=f,Na.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():Fa?w:v;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Na.marked?Na.marked:"variable"==c&&l(a,d)?"variable-2":b}}}function n(){for(var a=arguments.length-1;a>=0;a--)Na.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=Na.state;if(Na.marked="def",d.context){if(b(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(b(d.globalVars))return;c.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function q(){Na.state.context={prev:Na.state.context,vars:Na.state.localVars},Na.state.localVars=Oa}function r(){Na.state.localVars=Na.state.context.vars,Na.state.context=Na.state.context.prev}function s(a,b){var c=function(){var c=Na.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new k(d,Na.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function t(){var a=Na.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function u(a){function b(c){return c==a?o():";"==a?n():o(b)}return b}function v(a,b){return"var"==a?o(s("vardef",b.length),$,u(";"),t):"keyword a"==a?o(s("form"),y,v,t):"keyword b"==a?o(s("form"),v,t):"{"==a?o(s("}"),S,t):";"==a?o():"if"==a?("else"==Na.state.lexical.info&&Na.state.cc[Na.state.cc.length-1]==t&&Na.state.cc.pop()(),o(s("form"),y,v,t,da)):"function"==a?o(ja):"for"==a?o(s("form"),ea,v,t):"variable"==a?Ga&&"type"==b?(Na.marked="keyword",o(U,u("operator"),U,u(";"))):Ga&&"declare"==b?(Na.marked="keyword",o(v)):o(s("stat"),L):"switch"==a?o(s("form"),y,u("{"),s("}","switch"),S,t,t):"case"==a?o(w,u(":")):"default"==a?o(u(":")):"catch"==a?o(s("form"),q,u("("),ka,u(")"),v,t,r):"class"==a?o(s("form"),ma,t):"export"==a?o(s("stat"),qa,t):"import"==a?o(s("stat"),sa,t):"module"==a?o(s("form"),_,u("{"),s("}"),S,t,t):"async"==a?o(v):"@"==b?o(w,v):n(s("stat"),w,u(";"),t)}function w(a){return z(a,!1)}function x(a){return z(a,!0)}function y(a){return"("!=a?n():o(s(")"),w,u(")"),t)}function z(a,b){if(Na.state.fatArrowAt==Na.stream.start){var c=b?H:G;if("("==a)return o(q,s(")"),Q(ka,")"),t,u("=>"),c,r);if("variable"==a)return n(q,_,u("=>"),c,r)}var d=b?D:C;return Ma.hasOwnProperty(a)?o(d):"function"==a?o(ja,d):"class"==a?o(s("form"),la,t):"keyword c"==a||"async"==a?o(b?B:A):"("==a?o(s(")"),A,u(")"),t,d):"operator"==a||"spread"==a?o(b?x:w):"["==a?o(s("]"),xa,t,d):"{"==a?R(N,"}",null,d):"quasi"==a?n(E,d):"new"==a?o(I(b)):o()}function A(a){return a.match(/[;\}\)\],]/)?n():n(w)}function B(a){return a.match(/[;\}\)\],]/)?n():n(x)}function C(a,b){return","==a?o(w):D(a,b,!1)}function D(a,b,c){var d=0==c?C:D,e=0==c?w:x;return"=>"==a?o(q,c?H:G,r):"operator"==a?/\+\+|--/.test(b)||Ga&&"!"==b?o(d):"?"==b?o(w,u(":"),e):o(e):"quasi"==a?n(E,d):";"!=a?"("==a?R(x,")","call",d):"."==a?o(M,d):"["==a?o(s("]"),A,u("]"),t,d):Ga&&"as"==b?(Na.marked="keyword",o(U,d)):void 0:void 0}function E(a,b){return"quasi"!=a?n():"${"!=b.slice(b.length-2)?o(E):o(w,F)}function F(a){if("}"==a)return Na.marked="string-2",Na.state.tokenize=i,o(E)}function G(a){return j(Na.stream,Na.state),n("{"==a?v:w)}function H(a){return j(Na.stream,Na.state),n("{"==a?v:x)}function I(a){return function(b){return"."==b?o(a?K:J):"variable"==b&&Ga?o(Z,a?D:C):n(a?x:w)}}function J(a,b){if("target"==b)return Na.marked="keyword",o(C)}function K(a,b){if("target"==b)return Na.marked="keyword",o(D)}function L(a){return":"==a?o(t,v):n(C,u(";"),t)}function M(a){if("variable"==a)return Na.marked="property",o()}function N(a,b){if("async"==a)return Na.marked="property",o(N);if("variable"==a||"keyword"==Na.style){if(Na.marked="property","get"==b||"set"==b)return o(O);var c;return Ga&&Na.state.fatArrowAt==Na.stream.start&&(c=Na.stream.match(/^\s*:\s*/,!1))&&(Na.state.fatArrowAt=Na.stream.pos+c[0].length),o(P)}return"number"==a||"string"==a?(Na.marked=Ea?"property":Na.style+" property",o(P)):"jsonld-keyword"==a?o(P):"modifier"==a?o(N):"["==a?o(w,u("]"),P):"spread"==a?o(w,P):":"==a?n(P):void 0}function O(a){return"variable"!=a?n(P):(Na.marked="property",o(ja))}function P(a){return":"==a?o(x):"("==a?n(ja):void 0}function Q(a,b,c){function d(e,f){if(c?c.indexOf(e)>-1:","==e){var g=Na.state.lexical;return"call"==g.info&&(g.pos=(g.pos||0)+1),o(function(c,d){return c==b||d==b?n():n(a)},d)}return e==b||f==b?o():o(u(b))}return function(c,e){return c==b||e==b?o():n(a,d)}}function R(a,b,c){for(var d=3;d<arguments.length;d++)Na.cc.push(arguments[d]);return o(s(b,c),Q(a,b),t)}function S(a){return"}"==a?o():n(v,S)}function T(a,b){if(Ga){if(":"==a)return o(U);if("?"==b)return o(T)}}function U(a,b){return"variable"==a?"keyof"==b?(Na.marked="keyword",o(U)):(Na.marked="type",o(Y)):"string"==a||"number"==a||"atom"==a?o(Y):"["==a?o(s("]"),Q(U,"]",","),t,Y):"{"==a?o(s("}"),Q(W,"}",",;"),t,Y):"("==a?o(Q(X,")"),V):void 0}function V(a){if("=>"==a)return o(U)}function W(a,b){return"variable"==a||"keyword"==Na.style?(Na.marked="property",o(W)):"?"==b?o(W):":"==a?o(U):"["==a?o(w,T,u("]"),W):void 0}function X(a){return"variable"==a?o(X):":"==a?o(U):void 0}function Y(a,b){return"<"==b?o(s(">"),Q(U,">"),t,Y):"|"==b||"."==a?o(U):"["==a?o(u("]"),Y):"extends"==b?o(U):void 0}function Z(a,b){if("<"==b)return o(s(">"),Q(U,">"),t,Y)}function $(){return n(_,T,ba,ca)}function _(a,b){return"modifier"==a?o(_):"variable"==a?(p(b),o()):"spread"==a?o(_):"["==a?R(_,"]"):"{"==a?R(aa,"}"):void 0}function aa(a,b){return"variable"!=a||Na.stream.match(/^\s*:/,!1)?("variable"==a&&(Na.marked="property"),"spread"==a?o(_):"}"==a?n():o(u(":"),_,ba)):(p(b),o(ba))}function ba(a,b){if("="==b)return o(x)}function ca(a){if(","==a)return o($)}function da(a,b){if("keyword b"==a&&"else"==b)return o(s("form","else"),v,t)}function ea(a){if("("==a)return o(s(")"),fa,u(")"),t)}function fa(a){return"var"==a?o($,u(";"),ha):";"==a?o(ha):"variable"==a?o(ga):n(w,u(";"),ha)}function ga(a,b){return"in"==b||"of"==b?(Na.marked="keyword",o(w)):o(C,ha)}function ha(a,b){return";"==a?o(ia):"in"==b||"of"==b?(Na.marked="keyword",o(w)):n(w,u(";"),ia)}function ia(a){")"!=a&&o(w)}function ja(a,b){return"*"==b?(Na.marked="keyword",o(ja)):"variable"==a?(p(b),o(ja)):"("==a?o(q,s(")"),Q(ka,")"),t,T,v,r):Ga&&"<"==b?o(s(">"),Q(U,">"),t,ja):void 0}function ka(a){return"spread"==a||"modifier"==a?o(ka):n(_,T,ba)}function la(a,b){return"variable"==a?ma(a,b):na(a,b)}function ma(a,b){if("variable"==a)return p(b),o(na)}function na(a,b){return"<"==b?o(s(">"),Q(U,">"),t,na):"extends"==b||"implements"==b||Ga&&","==a?o(Ga?U:w,na):"{"==a?o(s("}"),oa,t):void 0}function oa(a,b){return"modifier"==a||"async"==a||"variable"==a&&("static"==b||"get"==b||"set"==b)&&Na.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Na.marked="keyword",o(oa)):"variable"==a||"keyword"==Na.style?(Na.marked="property",o(Ga?pa:ja,oa)):"["==a?o(w,u("]"),Ga?pa:ja,oa):"*"==b?(Na.marked="keyword",o(oa)):";"==a?o(oa):"}"==a?o():"@"==b?o(w,oa):void 0}function pa(a,b){return"?"==b?o(pa):":"==a?o(U,ba):"="==b?o(x):n(ja)}function qa(a,b){return"*"==b?(Na.marked="keyword",o(wa,u(";"))):"default"==b?(Na.marked="keyword",o(w,u(";"))):"{"==a?o(Q(ra,"}"),wa,u(";")):n(v)}function ra(a,b){return"as"==b?(Na.marked="keyword",o(u("variable"))):"variable"==a?n(x,ra):void 0}function sa(a){return"string"==a?o():n(ta,ua,wa)}function ta(a,b){return"{"==a?R(ta,"}"):("variable"==a&&p(b),"*"==b&&(Na.marked="keyword"),o(va))}function ua(a){if(","==a)return o(ta,ua)}function va(a,b){if("as"==b)return Na.marked="keyword",o(ta)}function wa(a,b){if("from"==b)return Na.marked="keyword",o(w)}function xa(a){return"]"==a?o():n(Q(x,"]"))}function ya(a,b){return"operator"==a.lastType||","==a.lastType||Ja.test(b.charAt(0))||/[,.]/.test(b.charAt(0))}function za(a,b,c){return b.tokenize==f&&/^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(c||0)))}var Aa,Ba,Ca=b.indentUnit,Da=c.statementIndent,Ea=c.jsonld,Fa=c.json||Ea,Ga=c.typescript,Ha=c.wordCharacters||/[\w$\xa1-\uffff]/,Ia=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":a("new"),"delete":d,"throw":d,"debugger":d,"var":a("var"),"const":a("var"),"let":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,undefined:f,NaN:f,Infinity:f,"this":a("this"),"class":a("class"),"super":a("atom"),"yield":d,"export":a("export"),"import":a("import"),"extends":d,await:d};if(Ga){var h={type:"variable",style:"type"},i={"interface":a("class"),"implements":d,namespace:d,module:a("module"),"enum":a("module"),"public":a("modifier"),"private":a("modifier"),"protected":a("modifier"),"abstract":a("modifier"),readonly:a("modifier"),string:h,number:h,"boolean":h,any:h};for(var j in i)g[j]=i[j]}return g}(),Ja=/[+\-*&%=<>!?|~^@]/,Ka=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,La="([{}])",Ma={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Na={state:null,column:null,marked:null,cc:null},Oa={name:"this",next:{name:"arguments"}};return t.lex=!0,{startState:function(a){var b={tokenize:f,lastType:"sof",cc:[],lexical:new k((a||0)-Ca,0,"block",!1),localVars:c.localVars,context:c.localVars&&{vars:c.localVars},indented:a||0};return c.globalVars&&"object"==typeof c.globalVars&&(b.globalVars=c.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),j(a,b)),b.tokenize!=h&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==Aa?c:(b.lastType="operator"!=Aa||"++"!=Ba&&"--"!=Ba?Aa:"incdec",m(b,c,Aa,Ba,a))},indent:function(b,d){if(b.tokenize==h)return a.Pass;if(b.tokenize!=f)return 0;var e,g=d&&d.charAt(0),i=b.lexical;if(!/^\s*else\b/.test(d))for(var j=b.cc.length-1;j>=0;--j){var k=b.cc[j];if(k==t)i=i.prev;else if(k!=da)break}for(;("stat"==i.type||"form"==i.type)&&("}"==g||(e=b.cc[b.cc.length-1])&&(e==C||e==D)&&!/^[,\.=+\-*:?[\(]/.test(d));)i=i.prev;Da&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var l=i.type,m=g==l;return"vardef"==l?i.indented+("operator"==b.lastType||","==b.lastType?i.info+1:0):"form"==l&&"{"==g?i.indented:"form"==l?i.indented+Ca:"stat"==l?i.indented+(ya(b,d)?Da||Ca:0):"switch"!=i.info||m||0==c.doubleIndentSwitch?i.align?i.column+(m?0:1):i.indented+(m?0:Ca):i.indented+(/^(?:case|default)\b/.test(d)?Ca:2*Ca)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Fa?null:"/*",blockCommentEnd:Fa?null:"*/",lineComment:Fa?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Fa?"json":"javascript",jsonldMode:Ea,jsonMode:Fa,expressionAllowed:za,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=w&&b!=x||a.cc.pop()}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},{"../../lib/codemirror":59}],67:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../xml/xml"),a("../javascript/javascript")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript"],d):d(CodeMirror)}(function(a){"use strict";function b(a,b,c,d){this.state=a,this.mode=b,this.depth=c,this.prev=d}function c(d){return new b(a.copyState(d.mode,d.state),d.mode,d.depth,d.prev&&c(d.prev))}a.defineMode("jsx",function(d,e){function f(a){var b=a.tagName;a.tagName=null;var c=j.indent(a,"");return a.tagName=b,c}function g(a,b){return b.context.mode==j?h(a,b,b.context):i(a,b,b.context)}function h(c,e,h){if(2==h.depth)return c.match(/^.*?\*\//)?h.depth=1:c.skipToEnd(),"comment";if("{"==c.peek()){j.skipAttribute(h.state);var i=f(h.state),l=h.state.context;if(l&&c.match(/^[^>]*>\s*$/,!1)){for(;l.prev&&!l.startOfLine;)l=l.prev;l.startOfLine?i-=d.indentUnit:h.prev.state.lexical&&(i=h.prev.state.lexical.indented)}else 1==h.depth&&(i+=d.indentUnit);return e.context=new b(a.startState(k,i),k,0,e.context),null}if(1==h.depth){if("<"==c.peek())return j.skipAttribute(h.state),e.context=new b(a.startState(j,f(h.state)),j,0,e.context),null;if(c.match("//"))return c.skipToEnd(),"comment";if(c.match("/*"))return h.depth=2,g(c,e)}var m,n=j.token(c,h.state),o=c.current();return/\btag\b/.test(n)?/>$/.test(o)?h.state.context?h.depth=0:e.context=e.context.prev:/^</.test(o)&&(h.depth=1):!n&&(m=o.indexOf("{"))>-1&&c.backUp(o.length-m),n}function i(c,d,e){if("<"==c.peek()&&k.expressionAllowed(c,e.state))return k.skipExpression(e.state),d.context=new b(a.startState(j,k.indent(e.state,"")),j,0,d.context),null;var f=k.token(c,e.state);if(!f&&null!=e.depth){var g=c.current();"{"==g?e.depth++:"}"==g&&0==--e.depth&&(d.context=d.context.prev)}return f}var j=a.getMode(d,{name:"xml",allowMissing:!0,multilineTagIndentPastTag:!1}),k=a.getMode(d,e&&e.base||"javascript");return{startState:function(){return{context:new b(a.startState(k),k)}},copyState:function(a){return{context:c(a.context)}},token:g,indent:function(a,b,c){return a.context.mode.indent(a.context.state,b,c)},innerMode:function(a){return a.context}}},"xml","javascript"),a.defineMIME("text/jsx","jsx"),a.defineMIME("text/typescript-jsx",{name:"jsx",base:{name:"javascript",typescript:!0}})})},{"../../lib/codemirror":59,"../javascript/javascript":66,"../xml/xml":75}],68:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../xml/xml"),a("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("markdown",function(b,c){function d(c){if(a.findModeByName){var d=a.findModeByName(c);d&&(c=d.mime||d.mimes[0])}var e=a.getMode(b,c);return"null"==e.name?null:e}function e(a,b,c){return b.f=b.inline=c,c(a,b)}function f(a,b,c){return b.f=b.block=c,c(a,b)}function g(a){return!a||!/\S/.test(a.string)}function h(a){return a.linkTitle=!1,a.em=!1,a.strong=!1,a.strikethrough=!1,a.quote=0,a.indentedCode=!1,a.f==j&&(a.f=n,a.block=i),a.trailingSpace=0,a.trailingSpaceNewLine=!1,a.prevLine=a.thisLine,a.thisLine={stream:null},null}function i(b,f){var h=b.column()===f.indentation,i=g(f.prevLine.stream),j=f.indentedCode,m=f.prevLine.hr,n=f.list!==!1,o=(f.listStack[f.listStack.length-1]||0)+3;f.indentedCode=!1;var p=f.indentation;if(null===f.indentationDiff&&(f.indentationDiff=f.indentation,n)){for(f.list=null;p<f.listStack[f.listStack.length-1];)f.listStack.pop(),f.listStack.length?f.indentation=f.listStack[f.listStack.length-1]:f.list=!1;f.list!==!1&&(f.indentationDiff=p-f.listStack[f.listStack.length-1])}var q=!(i||m||f.prevLine.header||n&&j||f.prevLine.fencedCodeEnd),s=(f.list===!1||m||i)&&f.indentation<=o&&b.match(y),t=null;if(f.indentationDiff>=4&&(j||f.prevLine.fencedCodeEnd||f.prevLine.header||i))return b.skipToEnd(),f.indentedCode=!0,w.code;if(b.eatSpace())return null;if(h&&f.indentation<=o&&(t=b.match(B))&&t[1].length<=6)return f.quote=0,f.header=t[1].length,f.thisLine.header=!0,c.highlightFormatting&&(f.formatting="header"),f.f=f.inline,l(f);if(f.indentation<=o&&b.eat(">"))return f.quote=h?1:f.quote+1,c.highlightFormatting&&(f.formatting="quote"),b.eatSpace(),l(f);if(!s&&!f.setext&&h&&f.indentation<=o&&(t=b.match(z))){var u=t[1]?"ol":"ul";return f.indentation=p+b.current().length,f.list=!0,f.quote=0,f.listStack.push(f.indentation),c.taskLists&&b.match(A,!1)&&(f.taskList=!0),f.f=f.inline,c.highlightFormatting&&(f.formatting=["list","list-"+u]),l(f)}return h&&f.indentation<=o&&(t=b.match(E,!0))?(f.quote=0,f.fencedEndRE=new RegExp(t[1]+"+ *$"),f.localMode=c.fencedCodeBlockHighlighting&&d(t[2]),f.localMode&&(f.localState=a.startState(f.localMode)),f.f=f.block=k,c.highlightFormatting&&(f.formatting="code-block"),f.code=-1,l(f)):f.setext||!(q&&n||f.quote||f.list!==!1||f.code||s||F.test(b.string))&&(t=b.lookAhead(1))&&(t=t.match(C))?(f.setext?(f.header=f.setext,f.setext=0,b.skipToEnd(),c.highlightFormatting&&(f.formatting="header")):(f.header="="==t[0].charAt(0)?1:2,f.setext=f.header),f.thisLine.header=!0,f.f=f.inline,l(f)):s?(b.skipToEnd(),f.hr=!0,f.thisLine.hr=!0,w.hr):"["===b.peek()?e(b,f,r):e(b,f,f.inline)}function j(b,c){var d=u.token(b,c.htmlState);if(!v){var e=a.innerMode(u,c.htmlState);("xml"==e.mode.name&&null===e.state.tagStart&&!e.state.context&&e.state.tokenize.isInText||c.md_inside&&b.current().indexOf(">")>-1)&&(c.f=n,c.block=i,c.htmlState=null)}return d}function k(a,b){var d=b.listStack[b.listStack.length-1]||0,e=b.indentation<d,g=d+3;if(b.fencedEndRE&&b.indentation<=g&&(e||a.match(b.fencedEndRE))){c.highlightFormatting&&(b.formatting="code-block");var h;return e||(h=l(b)),b.localMode=b.localState=null,b.block=i,b.f=n,b.fencedEndRE=null,b.code=0,b.thisLine.fencedCodeEnd=!0,e?f(a,b,b.block):h}return b.localMode?b.localMode.token(a,b.localState):(a.skipToEnd(),w.code)}function l(a){var b=[];if(a.formatting){b.push(w.formatting),"string"==typeof a.formatting&&(a.formatting=[a.formatting]);for(var d=0;d<a.formatting.length;d++)b.push(w.formatting+"-"+a.formatting[d]),"header"===a.formatting[d]&&b.push(w.formatting+"-"+a.formatting[d]+"-"+a.header),"quote"===a.formatting[d]&&(!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?b.push(w.formatting+"-"+a.formatting[d]+"-"+a.quote):b.push("error"))}if(a.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(a.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(a.linkHref?b.push(w.linkHref,"url"):(a.strong&&b.push(w.strong),a.em&&b.push(w.em),a.strikethrough&&b.push(w.strikethrough),a.emoji&&b.push(w.emoji),a.linkText&&b.push(w.linkText),a.code&&b.push(w.code),a.image&&b.push(w.image),a.imageAltText&&b.push(w.imageAltText,"link"),a.imageMarker&&b.push(w.imageMarker)),a.header&&b.push(w.header,w.header+"-"+a.header),a.quote&&(b.push(w.quote),!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?b.push(w.quote+"-"+a.quote):b.push(w.quote+"-"+c.maxBlockquoteDepth)),a.list!==!1){var e=(a.listStack.length-1)%3;e?1===e?b.push(w.list2):b.push(w.list3):b.push(w.list1)}return a.trailingSpaceNewLine?b.push("trailing-space-new-line"):a.trailingSpace&&b.push("trailing-space-"+(a.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function m(a,b){if(a.match(D,!0))return l(b)}function n(b,d){var e=d.text(b,d);if("undefined"!=typeof e)return e;if(d.list)return d.list=null,l(d);if(d.taskList){var g=" "===b.match(A,!0)[1];return g?d.taskOpen=!0:d.taskClosed=!0,c.highlightFormatting&&(d.formatting="task"),d.taskList=!1, l(d)}if(d.taskOpen=!1,d.taskClosed=!1,d.header&&b.match(/^#+$/,!0))return c.highlightFormatting&&(d.formatting="header"),l(d);var h=b.next();if(d.linkTitle){d.linkTitle=!1;var i=h;"("===h&&(i=")"),i=(i+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var k="^\\s*(?:[^"+i+"\\\\]+|\\\\\\\\|\\\\.)"+i;if(b.match(new RegExp(k),!0))return w.linkHref}if("`"===h){var m=d.formatting;c.highlightFormatting&&(d.formatting="code"),b.eatWhile("`");var q=b.current().length;if(0!=d.code||d.quote&&1!=q){if(q==d.code){var r=l(d);return d.code=0,r}return d.formatting=m,l(d)}return d.code=q,l(d)}if(d.code)return l(d);if("\\"===h&&(b.next(),c.highlightFormatting)){var s=l(d),t=w.formatting+"-escape";return s?s+" "+t:t}if("!"===h&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return d.imageMarker=!0,d.image=!0,c.highlightFormatting&&(d.formatting="image"),l(d);if("["===h&&d.imageMarker&&b.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return d.imageMarker=!1,d.imageAltText=!0,c.highlightFormatting&&(d.formatting="image"),l(d);if("]"===h&&d.imageAltText){c.highlightFormatting&&(d.formatting="image");var s=l(d);return d.imageAltText=!1,d.image=!1,d.inline=d.f=p,s}if("["===h&&!d.image)return d.linkText=!0,c.highlightFormatting&&(d.formatting="link"),l(d);if("]"===h&&d.linkText){c.highlightFormatting&&(d.formatting="link");var s=l(d);return d.linkText=!1,d.inline=d.f=b.match(/\(.*?\)| ?\[.*?\]/,!1)?p:n,s}if("<"===h&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link");var s=l(d);return s?s+=" ":s="",s+w.linkInline}if("<"===h&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link");var s=l(d);return s?s+=" ":s="",s+w.linkEmail}if(c.xml&&"<"===h&&b.match(/^(!--|[a-z]+(?:\s+[a-z_:.\-]+(?:\s*=\s*[^ >]+)?)*\s*>)/i,!1)){var v=b.string.indexOf(">",b.pos);if(v!=-1){var x=b.string.substring(b.start,v);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(d.md_inside=!0)}return b.backUp(1),d.htmlState=a.startState(u),f(b,d,j)}if(c.xml&&"<"===h&&b.match(/^\/\w*?>/))return d.md_inside=!1,"tag";if("*"===h||"_"===h){for(var y=1,z=1==b.pos?" ":b.string.charAt(b.pos-2);y<3&&b.eat(h);)y++;var B=b.peek()||" ",C=!/\s/.test(B)&&(!G.test(B)||/\s/.test(z)||G.test(z)),D=!/\s/.test(z)&&(!G.test(z)||/\s/.test(B)||G.test(B)),E=null,F=null;if(y%2&&(d.em||!C||"*"!==h&&D&&!G.test(z)?d.em!=h||!D||"*"!==h&&C&&!G.test(B)||(E=!1):E=!0),y>1&&(d.strong||!C||"*"!==h&&D&&!G.test(z)?d.strong!=h||!D||"*"!==h&&C&&!G.test(B)||(F=!1):F=!0),null!=F||null!=E){c.highlightFormatting&&(d.formatting=null==E?"strong":null==F?"em":"strong em"),E===!0&&(d.em=h),F===!0&&(d.strong=h);var r=l(d);return E===!1&&(d.em=!1),F===!1&&(d.strong=!1),r}}else if(" "===h&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return l(d);b.backUp(1)}if(c.strikethrough)if("~"===h&&b.eatWhile(h)){if(d.strikethrough){c.highlightFormatting&&(d.formatting="strikethrough");var r=l(d);return d.strikethrough=!1,r}if(b.match(/^[^\s]/,!1))return d.strikethrough=!0,c.highlightFormatting&&(d.formatting="strikethrough"),l(d)}else if(" "===h&&b.match(/^~~/,!0)){if(" "===b.peek())return l(d);b.backUp(2)}if(c.emoji&&":"===h&&b.match(/^[a-z_\d+-]+:/)){d.emoji=!0,c.highlightFormatting&&(d.formatting="emoji");var H=l(d);return d.emoji=!1,H}return" "===h&&(b.match(/ +$/,!1)?d.trailingSpace++:d.trailingSpace&&(d.trailingSpaceNewLine=!0)),l(d)}function o(a,b){var d=a.next();if(">"===d){b.f=b.inline=n,c.highlightFormatting&&(b.formatting="link");var e=l(b);return e?e+=" ":e="",e+w.linkInline}return a.match(/^[^>]+/,!0),w.linkInline}function p(a,b){if(a.eatSpace())return null;var d=a.next();return"("===d||"["===d?(b.f=b.inline=q("("===d?")":"]"),c.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,l(b)):"error"}function q(a){return function(b,d){var e=b.next();if(e===a){d.f=d.inline=n,c.highlightFormatting&&(d.formatting="link-string");var f=l(d);return d.linkHref=!1,f}return b.match(I[a]),d.linkHref=!0,l(d)}}function r(a,b){return a.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=s,a.next(),c.highlightFormatting&&(b.formatting="link"),b.linkText=!0,l(b)):e(a,b,n)}function s(a,b){if(a.match(/^\]:/,!0)){b.f=b.inline=t,c.highlightFormatting&&(b.formatting="link");var d=l(b);return b.linkText=!1,d}return a.match(/^([^\]\\]|\\.)+/,!0),w.linkText}function t(a,b){return a.eatSpace()?null:(a.match(/^[^\s]+/,!0),void 0===a.peek()?b.linkTitle=!0:a.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=n,w.linkHref+" url")}var u=a.getMode(b,"text/html"),v="null"==u.name;void 0===c.highlightFormatting&&(c.highlightFormatting=!1),void 0===c.maxBlockquoteDepth&&(c.maxBlockquoteDepth=0),void 0===c.taskLists&&(c.taskLists=!1),void 0===c.strikethrough&&(c.strikethrough=!1),void 0===c.emoji&&(c.emoji=!1),void 0===c.fencedCodeBlockHighlighting&&(c.fencedCodeBlockHighlighting=!0),void 0===c.xml&&(c.xml=!0),void 0===c.tokenTypeOverrides&&(c.tokenTypeOverrides={});var w={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var x in w)w.hasOwnProperty(x)&&c.tokenTypeOverrides[x]&&(w[x]=c.tokenTypeOverrides[x]);var y=/^([*\-_])(?:\s*\1){2,}\s*$/,z=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,A=/^\[(x| )\](?=\s)/i,B=c.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,C=/^ *(?:\={1,}|-{1,})\s*$/,D=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,F=/^\s*\[[^\]]+?\]:\s*\S+(\s*\S*\s*)?$/,G=/[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~\u2014]/,H=" ",I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/},J={startState:function(){return{f:i,prevLine:{stream:null},thisLine:{stream:null},block:i,htmlState:null,indentation:0,inline:n,text:m,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(b){return{f:b.f,prevLine:b.prevLine,thisLine:b.thisLine,block:b.block,htmlState:b.htmlState&&a.copyState(u,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?a.copyState(b.localMode,b.localState):null,inline:b.inline,text:b.text,formatting:!1,linkText:b.linkText,linkTitle:b.linkTitle,code:b.code,em:b.em,strong:b.strong,strikethrough:b.strikethrough,emoji:b.emoji,header:b.header,setext:b.setext,hr:b.hr,taskList:b.taskList,list:b.list,listStack:b.listStack.slice(0),quote:b.quote,indentedCode:b.indentedCode,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside,fencedEndRE:b.fencedEndRE}},token:function(a,b){if(b.formatting=!1,a!=b.thisLine.stream){if(b.header=0,b.hr=!1,a.match(/^\s*$/,!0))return h(b),null;if(b.prevLine=b.thisLine,b.thisLine={stream:a},b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,b.f=b.block,b.f!=j){var c=a.match(/^\s*/,!0)[0].replace(/\t/g,H).length;if(b.indentation=c,b.indentationDiff=null,c>0)return null}}return b.f(a,b)},innerMode:function(a){return a.block==j?{state:a.htmlState,mode:u}:a.localState?{state:a.localState,mode:a.localMode}:{state:a,mode:J}},indent:function(b,c,d){return b.block==j&&u.indent?u.indent(b.htmlState,c,d):b.localState&&b.localMode.indent?b.localMode.indent(b.localState,c,d):a.Pass},blankLine:h,getType:l,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return J},"xml"),a.defineMIME("text/x-markdown","markdown")})},{"../../lib/codemirror":59,"../meta":69,"../xml/xml":75}],69:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"],alias:["objective-c","objc"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var b=0;b<a.modeInfo.length;b++){var c=a.modeInfo[b];c.mimes&&(c.mime=c.mimes[0])}a.findModeByMIME=function(b){b=b.toLowerCase();for(var c=0;c<a.modeInfo.length;c++){var d=a.modeInfo[c];if(d.mime==b)return d;if(d.mimes)for(var e=0;e<d.mimes.length;e++)if(d.mimes[e]==b)return d}return/\+xml$/.test(b)?a.findModeByMIME("application/xml"):/\+json$/.test(b)?a.findModeByMIME("application/json"):void 0},a.findModeByExtension=function(b){for(var c=0;c<a.modeInfo.length;c++){var d=a.modeInfo[c];if(d.ext)for(var e=0;e<d.ext.length;e++)if(d.ext[e]==b)return d}},a.findModeByFileName=function(b){for(var c=0;c<a.modeInfo.length;c++){var d=a.modeInfo[c];if(d.file&&d.file.test(b))return d}var e=b.lastIndexOf("."),f=e>-1&&b.substring(e+1,b.length);if(f)return a.findModeByExtension(f)},a.findModeByName=function(b){b=b.toLowerCase();for(var c=0;c<a.modeInfo.length;c++){var d=a.modeInfo[c];if(d.name.toLowerCase()==b)return d;if(d.alias)for(var e=0;e<d.alias.length;e++)if(d.alias[e].toLowerCase()==b)return d}}})},{"../lib/codemirror":59}],70:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("nginx",function(a){function b(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function c(a,b){return h=b,a}function d(a,b){a.eatWhile(/[\w\$_]/);var d=a.current();if(i.propertyIsEnumerable(d))return"keyword";if(j.propertyIsEnumerable(d))return"variable-2";if(k.propertyIsEnumerable(d))return"string-2";var h=a.next();return"@"==h?(a.eatWhile(/[\w\\\-]/),c("meta",a.current())):"/"==h&&a.eat("*")?(b.tokenize=e,e(a,b)):"<"==h&&a.eat("!")?(b.tokenize=f,f(a,b)):"="!=h?"~"!=h&&"|"!=h||!a.eat("=")?'"'==h||"'"==h?(b.tokenize=g(h),b.tokenize(a,b)):"#"==h?(a.skipToEnd(),c("comment","comment")):"!"==h?(a.match(/^\s*\w*/),c("keyword","important")):/\d/.test(h)?(a.eatWhile(/[\w.%]/),c("number","unit")):/[,.+>*\/]/.test(h)?c(null,"select-op"):/[;{}:\[\]]/.test(h)?c(null,h):(a.eatWhile(/[\w\\\-]/),c("variable","variable")):c(null,"compare"):void c(null,"compare")}function e(a,b){for(var e,f=!1;null!=(e=a.next());){if(f&&"/"==e){b.tokenize=d;break}f="*"==e}return c("comment","comment")}function f(a,b){for(var e,f=0;null!=(e=a.next());){if(f>=2&&">"==e){b.tokenize=d;break}f="-"==e?f+1:0}return c("comment","comment")}function g(a){return function(b,e){for(var f,g=!1;null!=(f=b.next())&&(f!=a||g);)g=!g&&"\\"==f;return g||(e.tokenize=d),c("string","string")}}var h,i=b("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),j=b("http mail events server types location upstream charset_map limit_except if geo map"),k=b("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),l=a.indentUnit;return{startState:function(a){return{tokenize:d,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;h=null;var c=b.tokenize(a,b),d=b.stack[b.stack.length-1];return"hash"==h&&"rule"==d?c="atom":"variable"==c&&("rule"==d?c="number":d&&"@media{"!=d||(c="tag")),"rule"==d&&/^[\{\};]$/.test(h)&&b.stack.pop(),"{"==h?"@media"==d?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):"}"==h?b.stack.pop():"@media"==h?b.stack.push("@media"):"{"==d&&"comment"!=h&&b.stack.push("rule"),c},indent:function(a,b){var c=a.stack.length;return/^\}/.test(b)&&(c-="rule"==a.stack[a.stack.length-1]?2:1),a.baseIndent+c*l},electricChars:"}"}}),a.defineMIME("text/x-nginx-conf","nginx")})},{"../../lib/codemirror":59}],71:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../htmlmixed/htmlmixed"),a("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],d):d(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function c(a,b,e){return 0==a.length?d(b):function(f,g){for(var h=a[0],i=0;i<h.length;i++)if(f.match(h[i][0]))return g.tokenize=c(a.slice(1),b),h[i][1];return g.tokenize=d(b,e),"string"}}function d(a,b){return function(c,d){return e(c,d,a,b)}}function e(a,b,d,e){if(e!==!1&&a.match("${",!1)||a.match("{$",!1))return b.tokenize=null,"string";if(e!==!1&&a.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return a.match("[",!1)&&(b.tokenize=c([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],d,e)),a.match(/\-\>\w/,!1)&&(b.tokenize=c([[["->",null]],[[/[\w]+/,"variable"]]],d,e)),"variable-2";for(var f=!1;!a.eol()&&(f||e===!1||!a.match("{$",!1)&&!a.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!f&&a.match(d)){b.tokenize=null,b.tokStack.pop(),b.tokStack.pop();break}f="\\"==a.next()&&!f}return"string"}var f="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",g="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",h="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; a.registerHelper("hintWords","php",[f,g,h].join(" ").split(" ")),a.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:b(f),blockKeywords:b("catch do else elseif for foreach if switch try while finally"),defKeywords:b("class function interface namespace trait"),atoms:b(g),builtin:b(h),multiLineStrings:!0,hooks:{$:function(a){return a.eatWhile(/[\w\$_]/),"variable-2"},"<":function(a,b){var c;if(c=a.match(/<<\s*/)){var e=a.eat(/['"]/);a.eatWhile(/[\w\.]/);var f=a.current().slice(c[0].length+(e?2:1));if(e&&a.eat(e),f)return(b.tokStack||(b.tokStack=[])).push(f,0),b.tokenize=d(f,"'"!=e),"string"}return!1},"#":function(a){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"},"/":function(a){if(a.eat("/")){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"}return!1},'"':function(a,b){return(b.tokStack||(b.tokStack=[])).push('"',0),b.tokenize=d('"'),"string"},"{":function(a,b){return b.tokStack&&b.tokStack.length&&b.tokStack[b.tokStack.length-1]++,!1},"}":function(a,b){return b.tokStack&&b.tokStack.length>0&&!--b.tokStack[b.tokStack.length-1]&&(b.tokenize=d(b.tokStack[b.tokStack.length-2])),!1}}};a.defineMode("php",function(b,c){function d(b,c){var d=c.curMode==f;if(b.sol()&&c.pending&&'"'!=c.pending&&"'"!=c.pending&&(c.pending=null),d)return d&&null==c.php.tokenize&&b.match("?>")?(c.curMode=e,c.curState=c.html,c.php.context.prev||(c.php=null),"meta"):f.token(b,c.curState);if(b.match(/^<\?\w*/))return c.curMode=f,c.php||(c.php=a.startState(f,e.indent(c.html,""))),c.curState=c.php,"meta";if('"'==c.pending||"'"==c.pending){for(;!b.eol()&&b.next()!=c.pending;);var g="string"}else if(c.pending&&b.pos<c.pending.end){b.pos=c.pending.end;var g=c.pending.style}else var g=e.token(b,c.curState);c.pending&&(c.pending=null);var h,i=b.current(),j=i.search(/<\?/);return j!=-1&&("string"==g&&(h=i.match(/[\'\"]$/))&&!/\?>/.test(i)?c.pending=h[0]:c.pending={end:b.pos,style:g},b.backUp(i.length-j)),g}var e=a.getMode(b,"text/html"),f=a.getMode(b,i);return{startState:function(){var b=a.startState(e),d=c.startOpen?a.startState(f):null;return{html:b,php:d,curMode:c.startOpen?f:e,curState:c.startOpen?d:b,pending:null}},copyState:function(b){var c,d=b.html,g=a.copyState(e,d),h=b.php,i=h&&a.copyState(f,h);return c=b.curMode==e?g:i,{html:g,php:i,curMode:b.curMode,curState:c,pending:b.pending}},token:d,indent:function(a,b){return a.curMode!=f&&/^\s*<\//.test(b)||a.curMode==f&&/^\?>/.test(b)?e.indent(a.html,b):a.curMode.indent(a.curState,b)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(a){return{state:a.curState,mode:a.curMode}}}},"htmlmixed","clike"),a.defineMIME("application/x-httpd-php","php"),a.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),a.defineMIME("text/x-php",i)})},{"../../lib/codemirror":59,"../clike/clike":60,"../htmlmixed/htmlmixed":64}],72:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror"),a("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../css/css"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("sass",function(b){function c(a){return new RegExp("^"+a.join("|"))}function d(a){return!a.peek()||a.match(/\s+$/,!1)}function e(a,b){var c=a.peek();return")"===c?(a.next(),b.tokenizer=k,"operator"):"("===c?(a.next(),a.eatSpace(),"operator"):"'"===c||'"'===c?(b.tokenizer=g(a.next()),"string"):(b.tokenizer=g(")",!1),"string")}function f(a,b){return function(c,d){return c.sol()&&c.indentation()<=a?(d.tokenizer=k,k(c,d)):(b&&c.skipTo("*/")?(c.next(),c.next(),d.tokenizer=k):c.skipToEnd(),"comment")}}function g(a,b){function c(e,f){var g=e.next(),i=e.peek(),j=e.string.charAt(e.pos-2),l="\\"!==g&&i===a||g===a&&"\\"!==j;return l?(g!==a&&b&&e.next(),d(e)&&(f.cursorHalf=0),f.tokenizer=k,"string"):"#"===g&&"{"===i?(f.tokenizer=h(c),e.next(),"operator"):"string"}return null==b&&(b=!0),c}function h(a){return function(b,c){return"}"===b.peek()?(b.next(),c.tokenizer=a,"operator"):k(b,c)}}function i(a){if(0==a.indentCount){a.indentCount++;var c=a.scopes[0].offset,d=c+b.indentUnit;a.scopes.unshift({offset:d})}}function j(a){1!=a.scopes.length&&a.scopes.shift()}function k(a,b){var c=a.peek();if(a.match("/*"))return b.tokenizer=f(a.indentation(),!0),b.tokenizer(a,b);if(a.match("//"))return b.tokenizer=f(a.indentation(),!1),b.tokenizer(a,b);if(a.match("#{"))return b.tokenizer=h(k),"operator";if('"'===c||"'"===c)return a.next(),b.tokenizer=g(c),"string";if(b.cursorHalf){if("#"===c&&(a.next(),a.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return d(a)&&(b.cursorHalf=0),"number";if(a.match(/^-?[0-9\.]+/))return d(a)&&(b.cursorHalf=0),"number";if(a.match(/^(px|em|in)\b/))return d(a)&&(b.cursorHalf=0),"unit";if(a.match(t))return d(a)&&(b.cursorHalf=0),"keyword";if(a.match(/^url/)&&"("===a.peek())return b.tokenizer=e,d(a)&&(b.cursorHalf=0),"atom";if("$"===c)return a.next(),a.eatWhile(/[\w-]/),d(a)&&(b.cursorHalf=0),"variable-2";if("!"===c)return a.next(),b.cursorHalf=0,a.match(/^[\w]+/)?"keyword":"operator";if(a.match(v))return d(a)&&(b.cursorHalf=0),"operator";if(a.eatWhile(/[\w-]/))return d(a)&&(b.cursorHalf=0),m=a.current().toLowerCase(),q.hasOwnProperty(m)?"atom":p.hasOwnProperty(m)?"keyword":o.hasOwnProperty(m)?(b.prevProp=a.current().toLowerCase(),"property"):"tag";if(d(a))return b.cursorHalf=0,null}else{if("-"===c&&a.match(/^-\w+-/))return"meta";if("."===c){if(a.next(),a.match(/^[\w-]+/))return i(b),"qualifier";if("#"===a.peek())return i(b),"tag"}if("#"===c){if(a.next(),a.match(/^[\w-]+/))return i(b),"builtin";if("#"===a.peek())return i(b),"tag"}if("$"===c)return a.next(),a.eatWhile(/[\w-]/),"variable-2";if(a.match(/^-?[0-9\.]+/))return"number";if(a.match(/^(px|em|in)\b/))return"unit";if(a.match(t))return"keyword";if(a.match(/^url/)&&"("===a.peek())return b.tokenizer=e,"atom";if("="===c&&a.match(/^=[\w-]+/))return i(b),"meta";if("+"===c&&a.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&a.match(/@extend/)&&(a.match(/\s*[\w]/)||j(b)),a.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return i(b),"def";if("@"===c)return a.next(),a.eatWhile(/[\w-]/),"def";if(a.eatWhile(/[\w-]/)){if(a.match(/ *: *[\w-\+\$#!\("']/,!1)){m=a.current().toLowerCase();var l=b.prevProp+"-"+m;return o.hasOwnProperty(l)?"property":o.hasOwnProperty(m)?(b.prevProp=m,"property"):r.hasOwnProperty(m)?"property":"tag"}return a.match(/ *:/,!1)?(i(b),b.cursorHalf=1,b.prevProp=a.current().toLowerCase(),"property"):a.match(/ *,/,!1)?"tag":(i(b),"tag")}if(":"===c)return a.match(w)?"variable-3":(a.next(),b.cursorHalf=1,"operator")}return a.match(v)?"operator":(a.next(),null)}function l(a,c){a.sol()&&(c.indentCount=0);var d=c.tokenizer(a,c),e=a.current();if("@return"!==e&&"}"!==e||j(c),null!==d){for(var f=a.pos-e.length,g=f+b.indentUnit*c.indentCount,h=[],i=0;i<c.scopes.length;i++){var k=c.scopes[i];k.offset<=g&&h.push(k)}c.scopes=h}return d}var m,n=a.mimeModes["text/css"],o=n.propertyKeywords||{},p=n.colorKeywords||{},q=n.valueKeywords||{},r=n.fontProperties||{},s=["true","false","null","auto"],t=new RegExp("^"+s.join("|")),u=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],v=c(u),w=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:k,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(a,b){var c=l(a,b);return b.lastToken={style:c,content:a.current()},c},indent:function(a){return a.scopes[0].offset}}},"css"),a.defineMIME("text/x-sass","sass")})},{"../../lib/codemirror":59,"../css/css":61}],73:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("shell",function(){function a(a,b){for(var c=b.split(" "),d=0;d<c.length;d++)e[c[d]]=a}function b(a,b){if(a.eatSpace())return null;var g=a.sol(),h=a.next();if("\\"===h)return a.next(),null;if("'"===h||'"'===h||"`"===h)return b.tokens.unshift(c(h,"`"===h?"quote":"string")),d(a,b);if("#"===h)return g&&a.eat("!")?(a.skipToEnd(),"meta"):(a.skipToEnd(),"comment");if("$"===h)return b.tokens.unshift(f),d(a,b);if("+"===h||"="===h)return"operator";if("-"===h)return a.eat("-"),a.eatWhile(/\w/),"attribute";if(/\d/.test(h)&&(a.eatWhile(/\d/),a.eol()||!/\w/.test(a.peek())))return"number";a.eatWhile(/[\w-]/);var i=a.current();return"="===a.peek()&&/\w+/.test(i)?"def":e.hasOwnProperty(i)?e[i]:null}function c(a,b){var e="("==a?")":"{"==a?"}":a;return function(g,h){for(var i,j=!1,k=!1;null!=(i=g.next());){if(i===e&&!k){j=!0;break}if("$"===i&&!k&&"'"!==a){k=!0,g.backUp(1),h.tokens.unshift(f);break}if(!k&&i===a&&a!==e)return h.tokens.unshift(c(a,b)),d(g,h);k=!k&&"\\"===i}return j&&h.tokens.shift(),b}}function d(a,c){return(c.tokens[0]||b)(a,c)}var e={};a("atom","true false"),a("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),a("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep hg kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo svn tee telnet top touch vi vim wall wc wget who write yes zsh");var f=function(a,b){b.tokens.length>1&&a.eat("$");var e=a.next();return/['"({]/.test(e)?(b.tokens[0]=c(e,"("==e?"quote":"{"==e?"def":"string"),d(a,b)):(/\d/.test(e)||a.eatWhile(/\w/),b.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(a,b){return d(a,b)},closeBrackets:"()[]{}''\"\"``",lineComment:"#",fold:"brace"}}),a.defineMIME("text/x-sh","shell"),a.defineMIME("application/x-sh","shell")})},{"../../lib/codemirror":59}],74:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("sql",function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),n.decimallessFloat&&a.match(/^\.(?!\.)/),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((n.nCharCast&&("n"==c||"N"==c)||n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f(1),b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":a.match(/^\.+/)?null:n.ODBCdotTable&&a.match(/^[\w\d_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a){return function(b,c){var e=b.match(/^.*?(\/\*|\*\/)/);return e?"/*"==e[1]?c.tokenize=f(a+1):a>1?c.tokenize=f(a-1):c.tokenize=d:b.skipToEnd(),"comment"}}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{"false":!0,"true":!0,"null":!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),b.tokenize==d&&a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var e=a.current();return"("==e?g(a,b,")"):"["==e?g(a,b,"]"):b.context&&b.context.type==e&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":"--"}}),function(){function b(a){for(var b;null!=(b=a.next());)if("`"==b&&!a.eat("`"))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function c(a){for(var b;null!=(b=a.next());)if('"'==b&&!a.eat('"'))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function d(a){return a.eat("@")&&(a.match(/^session\./),a.match(/^local\./),a.match(/^global\./)),a.eat("'")?(a.match(/^.*'/),"variable-2"):a.eat('"')?(a.match(/^.*"/),"variable-2"):a.eat("`")?(a.match(/^.*`/),"variable-2"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function e(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function f(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}var g="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";a.defineMIME("text/x-sql",{name:"sql",keywords:f(g+"begin"),builtin:f("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-mssql",{name:"sql",client:f("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:f(g+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec"),builtin:f("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:f("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":d}}),a.defineMIME("text/x-mysql",{name:"sql",client:f("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:f(g+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:f("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":d,"`":b,"\\":e}}),a.defineMIME("text/x-mariadb",{name:"sql",client:f("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:f(g+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:f("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":d,"`":b,"\\":e}}),a.defineMIME("text/x-sqlite",{name:"sql",client:f("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),keywords:f(g+"abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),builtin:f("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),atoms:f("null current_date current_time current_timestamp"),operatorChars:/^[*+\-%<>!=&|\/~]/,dateSQL:f("date time timestamp datetime"),support:f("decimallessFloat zerolessFloat"),identifierQuote:'"',hooks:{"@":d,":":d,"?":d,$:d,'"':c,"`":b}}),a.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:f("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:f("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:f("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:f("commentSlashSlash decimallessFloat"),hooks:{}}),a.defineMIME("text/x-plsql",{name:"sql",client:f("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:f("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:f("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:f("date time timestamp"),support:f("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),a.defineMIME("text/x-hive",{name:"sql",keywords:f("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:f("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:f("date timestamp"),support:f("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-pgsql",{name:"sql",client:f("source"),keywords:f(g+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict restricted result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat attach path depends detach zone"), builtin:f("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),a.defineMIME("text/x-gql",{name:"sql",keywords:f("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:f("false true"),builtin:f("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/}),a.defineMIME("text/x-gpsql",{name:"sql",client:f("source"),keywords:f("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),builtin:f("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:f("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),a.defineMIME("text/x-sparksql",{name:"sql",keywords:f("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases datata dbproperties defined delete delimited desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),builtin:f("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),atoms:f("false true null"),operatorChars:/^[*+\-%<>!=~&|^]/,dateSQL:f("date time timestamp"),support:f("ODBCdotTable doubleQuote zerolessFloat")})}()})},{"../../lib/codemirror":59}],75:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";var b={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},c={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};a.defineMode("xml",function(d,e){function f(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d)return a.eat("!")?a.eat("[")?a.match("CDATA[")?c(i("atom","]]>")):null:a.match("--")?c(i("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(j(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=i("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",b.tokenize=g,"tag bracket");if("&"==d){var e;return e=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),e?"atom":"error"}return a.eatWhile(/[^&<]/),null}function g(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=f,A=">"==c?"endTag":"selfcloseTag","tag bracket";if("="==c)return A="equals",null;if("<"==c){b.tokenize=f,b.state=n,b.tagName=b.tagStart=null;var d=b.tokenize(a,b);return d?d+" tag error":"tag error"}return/[\'\"]/.test(c)?(b.tokenize=h(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=g;break}return"string"};return b.isInAttribute=!0,b}function i(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=f;break}c.next()}return a}}function j(a){return function(b,c){for(var d;null!=(d=b.next());){if("<"==d)return c.tokenize=j(a+1),c.tokenize(b,c);if(">"==d){if(1==a){c.tokenize=f;break}return c.tokenize=j(a-1),c.tokenize(b,c)}}return"meta"}}function k(a,b,c){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=c,(x.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function l(a){a.context&&(a.context=a.context.prev)}function m(a,b){for(var c;;){if(!a.context)return;if(c=a.context.tagName,!x.contextGrabbers.hasOwnProperty(c)||!x.contextGrabbers[c].hasOwnProperty(b))return;l(a)}}function n(a,b,c){return"openTag"==a?(c.tagStart=b.column(),o):"closeTag"==a?p:n}function o(a,b,c){return"word"==a?(c.tagName=b.current(),B="tag",s):(B="error",o)}function p(a,b,c){if("word"==a){var d=b.current();return c.context&&c.context.tagName!=d&&x.implicitlyClosed.hasOwnProperty(c.context.tagName)&&l(c),c.context&&c.context.tagName==d||x.matchClosing===!1?(B="tag",q):(B="tag error",r)}return B="error",r}function q(a,b,c){return"endTag"!=a?(B="error",q):(l(c),n)}function r(a,b,c){return B="error",q(a,b,c)}function s(a,b,c){if("word"==a)return B="attribute",t;if("endTag"==a||"selfcloseTag"==a){var d=c.tagName,e=c.tagStart;return c.tagName=c.tagStart=null,"selfcloseTag"==a||x.autoSelfClosers.hasOwnProperty(d)?m(c,d):(m(c,d),c.context=new k(c,d,e==c.indented)),n}return B="error",s}function t(a,b,c){return"equals"==a?u:(x.allowMissing||(B="error"),s(a,b,c))}function u(a,b,c){return"string"==a?v:"word"==a&&x.allowUnquoted?(B="string",s):(B="error",s(a,b,c))}function v(a,b,c){return"string"==a?v:s(a,b,c)}var w=d.indentUnit,x={},y=e.htmlMode?b:c;for(var z in y)x[z]=y[z];for(var z in e)x[z]=e[z];var A,B;return f.isInText=!0,{startState:function(a){var b={tokenize:f,state:n,indented:a||0,tagName:null,tagStart:null,context:null};return null!=a&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;A=null;var c=b.tokenize(a,b);return(c||A)&&"comment"!=c&&(B=null,b.state=b.state(A||c,a,b),B&&(c="error"==B?c+" error":B)),c},indent:function(b,c,d){var e=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+w;if(e&&e.noIndent)return a.Pass;if(b.tokenize!=g&&b.tokenize!=f)return d?d.match(/^(\s*)/)[0].length:0;if(b.tagName)return x.multilineTagIndentPastTag!==!1?b.tagStart+b.tagName.length+2:b.tagStart+w*(x.multilineTagIndentFactor||1);if(x.alignCDATA&&/<!\[CDATA\[/.test(c))return 0;var h=c&&/^<(\/)?([\w_:\.-]*)/.exec(c);if(h&&h[1])for(;e;){if(e.tagName==h[2]){e=e.prev;break}if(!x.implicitlyClosed.hasOwnProperty(e.tagName))break;e=e.prev}else if(h)for(;e;){var i=x.contextGrabbers[e.tagName];if(!i||!i.hasOwnProperty(h[2]))break;e=e.prev}for(;e&&e.prev&&!e.startOfLine;)e=e.prev;return e?e.indent+w:b.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:x.htmlMode?"html":"xml",helperType:x.htmlMode?"html":"xml",skipAttribute:function(a){a.state==u&&(a.state=s)}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":59}],76:[function(a,b,c){!function(d){"object"==typeof c&&"object"==typeof b?d(a("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)}(function(a){"use strict";a.defineMode("yaml",function(){var a=["true","false","on","off","yes","no"],b=new RegExp("\\b(("+a.join(")|(")+"))$","i");return{token:function(a,c){var d=a.peek(),e=c.escaped;if(c.escaped=!1,"#"==d&&(0==a.pos||/\s/.test(a.string.charAt(a.pos-1))))return a.skipToEnd(),"comment";if(a.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(c.literal&&a.indentation()>c.keyCol)return a.skipToEnd(),"string";if(c.literal&&(c.literal=!1),a.sol()){if(c.keyCol=0,c.pair=!1,c.pairStart=!1,a.match(/---/))return"def";if(a.match(/\.\.\./))return"def";if(a.match(/\s*-\s+/))return"meta"}if(a.match(/^(\{|\}|\[|\])/))return"{"==d?c.inlinePairs++:"}"==d?c.inlinePairs--:"["==d?c.inlineList++:c.inlineList--,"meta";if(c.inlineList>0&&!e&&","==d)return a.next(),"meta";if(c.inlinePairs>0&&!e&&","==d)return c.keyCol=0,c.pair=!1,c.pairStart=!1,a.next(),"meta";if(c.pairStart){if(a.match(/^\s*(\||\>)\s*/))return c.literal=!0,"meta";if(a.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==c.inlinePairs&&a.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(c.inlinePairs>0&&a.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(a.match(b))return"keyword"}return!c.pair&&a.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(c.pair=!0,c.keyCol=a.indentation(),"atom"):c.pair&&a.match(/^:\s*/)?(c.pairStart=!0,"meta"):(c.pairStart=!1,c.escaped="\\"==d,a.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),a.defineMIME("text/x-yaml","yaml"),a.defineMIME("text/yaml","yaml")})},{"../../lib/codemirror":59}],77:[function(a,b,c){var d=a("../../../node_modules/codemirror/lib/codemirror");a("../../../node_modules/codemirror/lib/codemirror.js"),a("../../../node_modules/codemirror/keymap/emacs.js"),a("../../../node_modules/codemirror/keymap/sublime.js"),a("../../../node_modules/codemirror/keymap/vim.js"),a("../../../node_modules/codemirror/addon/hint/show-hint.js"),a("../../../node_modules/codemirror/addon/hint/anyword-hint.js"),a("../../../node_modules/codemirror/addon/hint/css-hint.js"),a("../../../node_modules/codemirror/addon/hint/html-hint.js"),a("../../../node_modules/codemirror/addon/hint/javascript-hint.js"),a("../../../node_modules/codemirror/addon/hint/sql-hint.js"),a("../../../node_modules/codemirror/addon/hint/xml-hint.js"),a("../../../node_modules/codemirror/addon/lint/lint.js"),a("../../../node_modules/codemirror/addon/lint/css-lint.js"),a("../../../node_modules/codemirror/addon/lint/html-lint.js"),a("../../../node_modules/codemirror/addon/lint/javascript-lint.js"),a("../../../node_modules/codemirror/addon/lint/json-lint.js"),a("../../../node_modules/codemirror/addon/comment/comment.js"),a("../../../node_modules/codemirror/addon/comment/continuecomment.js"),a("../../../node_modules/codemirror/addon/fold/xml-fold.js"),a("../../../node_modules/codemirror/addon/mode/overlay.js"),a("../../../node_modules/codemirror/addon/edit/closebrackets.js"),a("../../../node_modules/codemirror/addon/edit/closetag.js"),a("../../../node_modules/codemirror/addon/edit/continuelist.js"),a("../../../node_modules/codemirror/addon/edit/matchbrackets.js"),a("../../../node_modules/codemirror/addon/edit/matchtags.js"),a("../../../node_modules/codemirror/addon/edit/trailingspace.js"),a("../../../node_modules/codemirror/addon/dialog/dialog.js"),a("../../../node_modules/codemirror/addon/display/autorefresh.js"),a("../../../node_modules/codemirror/addon/display/fullscreen.js"),a("../../../node_modules/codemirror/addon/display/panel.js"),a("../../../node_modules/codemirror/addon/display/placeholder.js"),a("../../../node_modules/codemirror/addon/display/rulers.js"),a("../../../node_modules/codemirror/addon/fold/brace-fold.js"),a("../../../node_modules/codemirror/addon/fold/comment-fold.js"),a("../../../node_modules/codemirror/addon/fold/foldcode.js"),a("../../../node_modules/codemirror/addon/fold/foldgutter.js"),a("../../../node_modules/codemirror/addon/fold/indent-fold.js"),a("../../../node_modules/codemirror/addon/fold/markdown-fold.js"),a("../../../node_modules/codemirror/addon/merge/merge.js"),a("../../../node_modules/codemirror/addon/mode/loadmode.js"),a("../../../node_modules/codemirror/addon/mode/multiplex.js"),a("../../../node_modules/codemirror/addon/mode/simple.js"),a("../../../node_modules/codemirror/addon/runmode/runmode.js"),a("../../../node_modules/codemirror/addon/runmode/colorize.js"),a("../../../node_modules/codemirror/addon/runmode/runmode-standalone.js"),a("../../../node_modules/codemirror/addon/scroll/annotatescrollbar.js"),a("../../../node_modules/codemirror/addon/scroll/scrollpastend.js"),a("../../../node_modules/codemirror/addon/scroll/simplescrollbars.js"),a("../../../node_modules/codemirror/addon/search/search.js"),a("../../../node_modules/codemirror/addon/search/jump-to-line.js"),a("../../../node_modules/codemirror/addon/search/match-highlighter.js"),a("../../../node_modules/codemirror/addon/search/matchesonscrollbar.js"),a("../../../node_modules/codemirror/addon/search/searchcursor.js"),a("../../../node_modules/codemirror/addon/tern/tern.js"),a("../../../node_modules/codemirror/addon/tern/worker.js"),a("../../../node_modules/codemirror/addon/wrap/hardwrap.js"),a("../../../node_modules/codemirror/addon/selection/active-line.js"),a("../../../node_modules/codemirror/addon/selection/mark-selection.js"),a("../../../node_modules/codemirror/addon/selection/selection-pointer.js"),a("../../../node_modules/codemirror/mode/meta.js"),a("../../../node_modules/codemirror/mode/clike/clike.js"),a("../../../node_modules/codemirror/mode/css/css.js"),a("../../../node_modules/codemirror/mode/diff/diff.js"),a("../../../node_modules/codemirror/mode/htmlmixed/htmlmixed.js"),a("../../../node_modules/codemirror/mode/http/http.js"),a("../../../node_modules/codemirror/mode/javascript/javascript.js"),a("../../../node_modules/codemirror/mode/jsx/jsx.js"),a("../../../node_modules/codemirror/mode/markdown/markdown.js"),a("../../../node_modules/codemirror/mode/gfm/gfm.js"),a("../../../node_modules/codemirror/mode/nginx/nginx.js"),a("../../../node_modules/codemirror/mode/php/php.js"),a("../../../node_modules/codemirror/mode/sass/sass.js"),a("../../../node_modules/codemirror/mode/shell/shell.js"),a("../../../node_modules/codemirror/mode/sql/sql.js"),a("../../../node_modules/codemirror/mode/xml/xml.js"),a("../../../node_modules/codemirror/mode/yaml/yaml.js"),window.wp||(window.wp={}),window.wp.CodeMirror=d},{"../../../node_modules/codemirror/addon/comment/comment.js":1,"../../../node_modules/codemirror/addon/comment/continuecomment.js":2,"../../../node_modules/codemirror/addon/dialog/dialog.js":3,"../../../node_modules/codemirror/addon/display/autorefresh.js":4,"../../../node_modules/codemirror/addon/display/fullscreen.js":5,"../../../node_modules/codemirror/addon/display/panel.js":6,"../../../node_modules/codemirror/addon/display/placeholder.js":7,"../../../node_modules/codemirror/addon/display/rulers.js":8,"../../../node_modules/codemirror/addon/edit/closebrackets.js":9,"../../../node_modules/codemirror/addon/edit/closetag.js":10,"../../../node_modules/codemirror/addon/edit/continuelist.js":11,"../../../node_modules/codemirror/addon/edit/matchbrackets.js":12,"../../../node_modules/codemirror/addon/edit/matchtags.js":13,"../../../node_modules/codemirror/addon/edit/trailingspace.js":14,"../../../node_modules/codemirror/addon/fold/brace-fold.js":15,"../../../node_modules/codemirror/addon/fold/comment-fold.js":16,"../../../node_modules/codemirror/addon/fold/foldcode.js":17,"../../../node_modules/codemirror/addon/fold/foldgutter.js":18,"../../../node_modules/codemirror/addon/fold/indent-fold.js":19,"../../../node_modules/codemirror/addon/fold/markdown-fold.js":20,"../../../node_modules/codemirror/addon/fold/xml-fold.js":21,"../../../node_modules/codemirror/addon/hint/anyword-hint.js":22,"../../../node_modules/codemirror/addon/hint/css-hint.js":23,"../../../node_modules/codemirror/addon/hint/html-hint.js":24,"../../../node_modules/codemirror/addon/hint/javascript-hint.js":25,"../../../node_modules/codemirror/addon/hint/show-hint.js":26,"../../../node_modules/codemirror/addon/hint/sql-hint.js":27,"../../../node_modules/codemirror/addon/hint/xml-hint.js":28,"../../../node_modules/codemirror/addon/lint/css-lint.js":29,"../../../node_modules/codemirror/addon/lint/html-lint.js":30,"../../../node_modules/codemirror/addon/lint/javascript-lint.js":31,"../../../node_modules/codemirror/addon/lint/json-lint.js":32,"../../../node_modules/codemirror/addon/lint/lint.js":33,"../../../node_modules/codemirror/addon/merge/merge.js":34,"../../../node_modules/codemirror/addon/mode/loadmode.js":35,"../../../node_modules/codemirror/addon/mode/multiplex.js":36,"../../../node_modules/codemirror/addon/mode/overlay.js":37,"../../../node_modules/codemirror/addon/mode/simple.js":38,"../../../node_modules/codemirror/addon/runmode/colorize.js":39,"../../../node_modules/codemirror/addon/runmode/runmode-standalone.js":40,"../../../node_modules/codemirror/addon/runmode/runmode.js":41,"../../../node_modules/codemirror/addon/scroll/annotatescrollbar.js":42,"../../../node_modules/codemirror/addon/scroll/scrollpastend.js":43,"../../../node_modules/codemirror/addon/scroll/simplescrollbars.js":44,"../../../node_modules/codemirror/addon/search/jump-to-line.js":45,"../../../node_modules/codemirror/addon/search/match-highlighter.js":46,"../../../node_modules/codemirror/addon/search/matchesonscrollbar.js":47,"../../../node_modules/codemirror/addon/search/search.js":48,"../../../node_modules/codemirror/addon/search/searchcursor.js":49,"../../../node_modules/codemirror/addon/selection/active-line.js":50,"../../../node_modules/codemirror/addon/selection/mark-selection.js":51,"../../../node_modules/codemirror/addon/selection/selection-pointer.js":52,"../../../node_modules/codemirror/addon/tern/tern.js":53,"../../../node_modules/codemirror/addon/tern/worker.js":54,"../../../node_modules/codemirror/addon/wrap/hardwrap.js":55,"../../../node_modules/codemirror/keymap/emacs.js":56,"../../../node_modules/codemirror/keymap/sublime.js":57,"../../../node_modules/codemirror/keymap/vim.js":58,"../../../node_modules/codemirror/lib/codemirror":59,"../../../node_modules/codemirror/lib/codemirror.js":59,"../../../node_modules/codemirror/mode/clike/clike.js":60,"../../../node_modules/codemirror/mode/css/css.js":61,"../../../node_modules/codemirror/mode/diff/diff.js":62,"../../../node_modules/codemirror/mode/gfm/gfm.js":63,"../../../node_modules/codemirror/mode/htmlmixed/htmlmixed.js":64,"../../../node_modules/codemirror/mode/http/http.js":65,"../../../node_modules/codemirror/mode/javascript/javascript.js":66,"../../../node_modules/codemirror/mode/jsx/jsx.js":67,"../../../node_modules/codemirror/mode/markdown/markdown.js":68,"../../../node_modules/codemirror/mode/meta.js":69,"../../../node_modules/codemirror/mode/nginx/nginx.js":70,"../../../node_modules/codemirror/mode/php/php.js":71,"../../../node_modules/codemirror/mode/sass/sass.js":72,"../../../node_modules/codemirror/mode/shell/shell.js":73,"../../../node_modules/codemirror/mode/sql/sql.js":74,"../../../node_modules/codemirror/mode/xml/xml.js":75,"../../../node_modules/codemirror/mode/yaml/yaml.js":76}]},{},[77]); htmlhint-kses.js 0000644 00000001730 14720661433 0007703 0 ustar 00 /* global HTMLHint */ /* eslint no-magic-numbers: ["error", { "ignore": [0, 1] }] */ HTMLHint.addRule({ id: 'kses', description: 'Element or attribute cannot be used.', init: function( parser, reporter, options ) { 'use strict'; var self = this; parser.addListener( 'tagstart', function( event ) { var attr, col, attrName, allowedAttributes, i, len, tagName; tagName = event.tagName.toLowerCase(); if ( ! options[ tagName ] ) { reporter.error( 'Tag <' + event.tagName + '> is not allowed.', event.line, event.col, self, event.raw ); return; } allowedAttributes = options[ tagName ]; col = event.col + event.tagName.length + 1; for ( i = 0, len = event.attrs.length; i < len; i++ ) { attr = event.attrs[ i ]; attrName = attr.name.toLowerCase(); if ( ! allowedAttributes[ attrName ] ) { reporter.error( 'Tag attribute [' + attr.raw + ' ] is not allowed.', event.line, col + attr.index, self, attr.raw ); } } }); } }); jsonlint.js 0000644 00000037475 14720661433 0006770 0 ustar 00 /* Jison generated parser */ var jsonlint = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1}, terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"}, productions_: [0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { case 1: // replace escaped characters with actual character this.$ = yytext.replace(/\\(\\|")/g, "$"+"1") .replace(/\\n/g,'\n') .replace(/\\r/g,'\r') .replace(/\\t/g,'\t') .replace(/\\v/g,'\v') .replace(/\\f/g,'\f') .replace(/\\b/g,'\b'); break; case 2:this.$ = Number(yytext); break; case 3:this.$ = null; break; case 4:this.$ = true; break; case 5:this.$ = false; break; case 6:return this.$ = $$[$0-1]; break; case 13:this.$ = {}; break; case 14:this.$ = $$[$0-1]; break; case 15:this.$ = [$$[$0-2], $$[$0]]; break; case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1]; break; case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1]; break; case 18:this.$ = []; break; case 19:this.$ = $$[$0-1]; break; case 20:this.$ = [$$[$0]]; break; case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]); break; } }, table: [{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}], defaultActions: {16:[2,6]}, parseError: function parseError(str, hash) { throw new Error(str); }, parse: function parse(input) { var self = this, stack = [0], vstack = [null], // semantic value stack lstack = [], // location stack table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; //this.reductionCount = this.shiftCount = 0; this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {}; var yyloc = this.lexer.yylloc; lstack.push(yyloc); if (typeof this.yy.parseError === 'function') this.parseError = this.yy.parseError; function popStack (n) { stack.length = stack.length - 2*n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = self.lexer.lex() || 1; // $end = 1 // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; while (true) { // retreive state number from top of stack state = stack[stack.length-1]; // use default actions if available if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol == null) symbol = lex(); // read action for current state and first input action = table[state] && table[state][symbol]; } // handle parse error _handle_error: if (typeof action === 'undefined' || !action.length || !action[0]) { if (!recovering) { // Report error expected = []; for (p in table[state]) if (this.terminals_[p] && p > 2) { expected.push("'"+this.terminals_[p]+"'"); } var errStr = ''; if (this.lexer.showPosition) { errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; } else { errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + (symbol == 1 /*EOF*/ ? "end of input" : ("'"+(this.terminals_[symbol] || symbol)+"'")); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } // just recovered from another error if (recovering == 3) { if (symbol == EOF) { throw new Error(errStr || 'Parsing halted.'); } // discard current lookahead and grab another yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; symbol = lex(); } // try to recover from error while (1) { // check for error recovery rule in this state if ((TERROR.toString()) in table[state]) { break; } if (state == 0) { throw new Error(errStr || 'Parsing halted.'); } popStack(1); state = stack[stack.length-1]; } preErrorSymbol = symbol; // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead state = stack[stack.length-1]; action = table[state] && table[state][TERROR]; recovering = 3; // allow 3 real symbols to be shifted before reporting a new error } // this shouldn't happen, unless resolve defaults are off if (action[0] instanceof Array && action.length > 1) { throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); } switch (action[0]) { case 1: // shift //this.shiftCount++; stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); // push state symbol = null; if (!preErrorSymbol) { // normal execution/no error yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: // reduce //this.reductionCount++; len = this.productions_[action[1]][1]; // perform semantic action yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts yyval._$ = { first_line: lstack[lstack.length-(len||1)].first_line, last_line: lstack[lstack.length-1].last_line, first_column: lstack[lstack.length-(len||1)].first_column, last_column: lstack[lstack.length-1].last_column }; r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== 'undefined') { return r; } // pop off stack if (len) { stack = stack.slice(0,-1*len*2); vstack = vstack.slice(0, -1*len); lstack = lstack.slice(0, -1*len); } stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) vstack.push(yyval.$); lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] newState = table[stack[stack.length-2]][stack[stack.length-1]]; stack.push(newState); break; case 3: // accept return true; } } return true; }}; /* Jison generated lexer */ var lexer = (function(){ var lexer = ({EOF:1, parseError:function parseError(str, hash) { if (this.yy.parseError) { this.yy.parseError(str, hash); } else { throw new Error(str); } }, setInput:function (input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; return this; }, input:function () { var ch = this._input[0]; this.yytext+=ch; this.yyleng++; this.match+=ch; this.matched+=ch; var lines = ch.match(/\n/); if (lines) this.yylineno++; this._input = this._input.slice(1); return ch; }, unput:function (ch) { this._input = ch + this._input; return this; }, more:function () { this._more = true; return this; }, less:function (n) { this._input = this.match.slice(n) + this._input; }, pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function () { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, tempMatch, index, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i=0;i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (!this.options.flex) break; } } if (match) { lines = match[0].match(/\n.*/g); if (lines) this.yylineno += lines.length; this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length} this.yytext += match[0]; this.match += match[0]; this.yyleng = this.yytext.length; this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); if (this.done && this._input) this.done = false; if (token) return token; else return; } if (this._input === "") { return this.EOF; } else { this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, lex:function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin:function begin(condition) { this.conditionStack.push(condition); }, popState:function popState() { return this.conditionStack.pop(); }, _currentRules:function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function () { return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition) { this.begin(condition); }}); lexer.options = {}; lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START switch($avoiding_name_collisions) { case 0:/* skip whitespace */ break; case 1:return 6 break; case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4 break; case 3:return 17 break; case 4:return 18 break; case 5:return 23 break; case 6:return 24 break; case 7:return 22 break; case 8:return 21 break; case 9:return 10 break; case 10:return 11 break; case 11:return 8 break; case 12:return 14 break; case 13:return 'INVALID' break; } }; lexer.rules = [/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/]; lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}}; ; return lexer;})() parser.lexer = lexer; return parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = jsonlint; exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); } exports.main = function commonjsMain(args) { if (!args[1]) throw new Error('Usage: '+args[0]+' FILE'); if (typeof process !== 'undefined') { var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); } else { var cwd = require("file").path(require("file").cwd()); var source = cwd.join(args[1]).read({charset: "utf-8"}); } return exports.parser.parse(source); } if (typeof module !== 'undefined' && require.main === module) { exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); } } esprima.js 0000644 00001051015 14720661433 0006553 0 ustar 00 (function webpackUniversalModuleDefinition(root, factory) { /* istanbul ignore next */ if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); /* istanbul ignore next */ else if(typeof exports === 'object') exports["esprima"] = factory(); else root["esprima"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /* istanbul ignore if */ /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; /* Copyright JS Foundation and other contributors, https://js.foundation/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ Object.defineProperty(exports, "__esModule", { value: true }); var comment_handler_1 = __webpack_require__(1); var jsx_parser_1 = __webpack_require__(3); var parser_1 = __webpack_require__(8); var tokenizer_1 = __webpack_require__(15); function parse(code, options, delegate) { var commentHandler = null; var proxyDelegate = function (node, metadata) { if (delegate) { delegate(node, metadata); } if (commentHandler) { commentHandler.visit(node, metadata); } }; var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; var collectComment = false; if (options) { collectComment = (typeof options.comment === 'boolean' && options.comment); var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); if (collectComment || attachComment) { commentHandler = new comment_handler_1.CommentHandler(); commentHandler.attach = attachComment; options.comment = true; parserDelegate = proxyDelegate; } } var isModule = false; if (options && typeof options.sourceType === 'string') { isModule = (options.sourceType === 'module'); } var parser; if (options && typeof options.jsx === 'boolean' && options.jsx) { parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); } else { parser = new parser_1.Parser(code, options, parserDelegate); } var program = isModule ? parser.parseModule() : parser.parseScript(); var ast = program; if (collectComment && commentHandler) { ast.comments = commentHandler.comments; } if (parser.config.tokens) { ast.tokens = parser.tokens; } if (parser.config.tolerant) { ast.errors = parser.errorHandler.errors; } return ast; } exports.parse = parse; function parseModule(code, options, delegate) { var parsingOptions = options || {}; parsingOptions.sourceType = 'module'; return parse(code, parsingOptions, delegate); } exports.parseModule = parseModule; function parseScript(code, options, delegate) { var parsingOptions = options || {}; parsingOptions.sourceType = 'script'; return parse(code, parsingOptions, delegate); } exports.parseScript = parseScript; function tokenize(code, options, delegate) { var tokenizer = new tokenizer_1.Tokenizer(code, options); var tokens; tokens = []; try { while (true) { var token = tokenizer.getNextToken(); if (!token) { break; } if (delegate) { token = delegate(token); } tokens.push(token); } } catch (e) { tokenizer.errorHandler.tolerate(e); } if (tokenizer.errorHandler.tolerant) { tokens.errors = tokenizer.errors(); } return tokens; } exports.tokenize = tokenize; var syntax_1 = __webpack_require__(2); exports.Syntax = syntax_1.Syntax; // Sync with *.json manifests. exports.version = '4.0.0'; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var syntax_1 = __webpack_require__(2); var CommentHandler = (function () { function CommentHandler() { this.attach = false; this.comments = []; this.stack = []; this.leading = []; this.trailing = []; } CommentHandler.prototype.insertInnerComments = function (node, metadata) { // innnerComments for properties empty block // `function a() {/** comments **\/}` if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { var innerComments = []; for (var i = this.leading.length - 1; i >= 0; --i) { var entry = this.leading[i]; if (metadata.end.offset >= entry.start) { innerComments.unshift(entry.comment); this.leading.splice(i, 1); this.trailing.splice(i, 1); } } if (innerComments.length) { node.innerComments = innerComments; } } }; CommentHandler.prototype.findTrailingComments = function (metadata) { var trailingComments = []; if (this.trailing.length > 0) { for (var i = this.trailing.length - 1; i >= 0; --i) { var entry_1 = this.trailing[i]; if (entry_1.start >= metadata.end.offset) { trailingComments.unshift(entry_1.comment); } } this.trailing.length = 0; return trailingComments; } var entry = this.stack[this.stack.length - 1]; if (entry && entry.node.trailingComments) { var firstComment = entry.node.trailingComments[0]; if (firstComment && firstComment.range[0] >= metadata.end.offset) { trailingComments = entry.node.trailingComments; delete entry.node.trailingComments; } } return trailingComments; }; CommentHandler.prototype.findLeadingComments = function (metadata) { var leadingComments = []; var target; while (this.stack.length > 0) { var entry = this.stack[this.stack.length - 1]; if (entry && entry.start >= metadata.start.offset) { target = entry.node; this.stack.pop(); } else { break; } } if (target) { var count = target.leadingComments ? target.leadingComments.length : 0; for (var i = count - 1; i >= 0; --i) { var comment = target.leadingComments[i]; if (comment.range[1] <= metadata.start.offset) { leadingComments.unshift(comment); target.leadingComments.splice(i, 1); } } if (target.leadingComments && target.leadingComments.length === 0) { delete target.leadingComments; } return leadingComments; } for (var i = this.leading.length - 1; i >= 0; --i) { var entry = this.leading[i]; if (entry.start <= metadata.start.offset) { leadingComments.unshift(entry.comment); this.leading.splice(i, 1); } } return leadingComments; }; CommentHandler.prototype.visitNode = function (node, metadata) { if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { return; } this.insertInnerComments(node, metadata); var trailingComments = this.findTrailingComments(metadata); var leadingComments = this.findLeadingComments(metadata); if (leadingComments.length > 0) { node.leadingComments = leadingComments; } if (trailingComments.length > 0) { node.trailingComments = trailingComments; } this.stack.push({ node: node, start: metadata.start.offset }); }; CommentHandler.prototype.visitComment = function (node, metadata) { var type = (node.type[0] === 'L') ? 'Line' : 'Block'; var comment = { type: type, value: node.value }; if (node.range) { comment.range = node.range; } if (node.loc) { comment.loc = node.loc; } this.comments.push(comment); if (this.attach) { var entry = { comment: { type: type, value: node.value, range: [metadata.start.offset, metadata.end.offset] }, start: metadata.start.offset }; if (node.loc) { entry.comment.loc = node.loc; } node.type = type; this.leading.push(entry); this.trailing.push(entry); } }; CommentHandler.prototype.visit = function (node, metadata) { if (node.type === 'LineComment') { this.visitComment(node, metadata); } else if (node.type === 'BlockComment') { this.visitComment(node, metadata); } else if (this.attach) { this.visitNode(node, metadata); } }; return CommentHandler; }()); exports.CommentHandler = CommentHandler; /***/ }, /* 2 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Syntax = { AssignmentExpression: 'AssignmentExpression', AssignmentPattern: 'AssignmentPattern', ArrayExpression: 'ArrayExpression', ArrayPattern: 'ArrayPattern', ArrowFunctionExpression: 'ArrowFunctionExpression', AwaitExpression: 'AwaitExpression', BlockStatement: 'BlockStatement', BinaryExpression: 'BinaryExpression', BreakStatement: 'BreakStatement', CallExpression: 'CallExpression', CatchClause: 'CatchClause', ClassBody: 'ClassBody', ClassDeclaration: 'ClassDeclaration', ClassExpression: 'ClassExpression', ConditionalExpression: 'ConditionalExpression', ContinueStatement: 'ContinueStatement', DoWhileStatement: 'DoWhileStatement', DebuggerStatement: 'DebuggerStatement', EmptyStatement: 'EmptyStatement', ExportAllDeclaration: 'ExportAllDeclaration', ExportDefaultDeclaration: 'ExportDefaultDeclaration', ExportNamedDeclaration: 'ExportNamedDeclaration', ExportSpecifier: 'ExportSpecifier', ExpressionStatement: 'ExpressionStatement', ForStatement: 'ForStatement', ForOfStatement: 'ForOfStatement', ForInStatement: 'ForInStatement', FunctionDeclaration: 'FunctionDeclaration', FunctionExpression: 'FunctionExpression', Identifier: 'Identifier', IfStatement: 'IfStatement', ImportDeclaration: 'ImportDeclaration', ImportDefaultSpecifier: 'ImportDefaultSpecifier', ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', ImportSpecifier: 'ImportSpecifier', Literal: 'Literal', LabeledStatement: 'LabeledStatement', LogicalExpression: 'LogicalExpression', MemberExpression: 'MemberExpression', MetaProperty: 'MetaProperty', MethodDefinition: 'MethodDefinition', NewExpression: 'NewExpression', ObjectExpression: 'ObjectExpression', ObjectPattern: 'ObjectPattern', Program: 'Program', Property: 'Property', RestElement: 'RestElement', ReturnStatement: 'ReturnStatement', SequenceExpression: 'SequenceExpression', SpreadElement: 'SpreadElement', Super: 'Super', SwitchCase: 'SwitchCase', SwitchStatement: 'SwitchStatement', TaggedTemplateExpression: 'TaggedTemplateExpression', TemplateElement: 'TemplateElement', TemplateLiteral: 'TemplateLiteral', ThisExpression: 'ThisExpression', ThrowStatement: 'ThrowStatement', TryStatement: 'TryStatement', UnaryExpression: 'UnaryExpression', UpdateExpression: 'UpdateExpression', VariableDeclaration: 'VariableDeclaration', VariableDeclarator: 'VariableDeclarator', WhileStatement: 'WhileStatement', WithStatement: 'WithStatement', YieldExpression: 'YieldExpression' }; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { "use strict"; /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var character_1 = __webpack_require__(4); var JSXNode = __webpack_require__(5); var jsx_syntax_1 = __webpack_require__(6); var Node = __webpack_require__(7); var parser_1 = __webpack_require__(8); var token_1 = __webpack_require__(13); var xhtml_entities_1 = __webpack_require__(14); token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier'; token_1.TokenName[101 /* Text */] = 'JSXText'; // Fully qualified element name, e.g. <svg:path> returns "svg:path" function getQualifiedElementName(elementName) { var qualifiedName; switch (elementName.type) { case jsx_syntax_1.JSXSyntax.JSXIdentifier: var id = elementName; qualifiedName = id.name; break; case jsx_syntax_1.JSXSyntax.JSXNamespacedName: var ns = elementName; qualifiedName = getQualifiedElementName(ns.namespace) + ':' + getQualifiedElementName(ns.name); break; case jsx_syntax_1.JSXSyntax.JSXMemberExpression: var expr = elementName; qualifiedName = getQualifiedElementName(expr.object) + '.' + getQualifiedElementName(expr.property); break; /* istanbul ignore next */ default: break; } return qualifiedName; } var JSXParser = (function (_super) { __extends(JSXParser, _super); function JSXParser(code, options, delegate) { return _super.call(this, code, options, delegate) || this; } JSXParser.prototype.parsePrimaryExpression = function () { return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); }; JSXParser.prototype.startJSX = function () { // Unwind the scanner before the lookahead token. this.scanner.index = this.startMarker.index; this.scanner.lineNumber = this.startMarker.line; this.scanner.lineStart = this.startMarker.index - this.startMarker.column; }; JSXParser.prototype.finishJSX = function () { // Prime the next lookahead. this.nextToken(); }; JSXParser.prototype.reenterJSX = function () { this.startJSX(); this.expectJSX('}'); // Pop the closing '}' added from the lookahead. if (this.config.tokens) { this.tokens.pop(); } }; JSXParser.prototype.createJSXNode = function () { this.collectComments(); return { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }; }; JSXParser.prototype.createJSXChildNode = function () { return { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }; }; JSXParser.prototype.scanXHTMLEntity = function (quote) { var result = '&'; var valid = true; var terminated = false; var numeric = false; var hex = false; while (!this.scanner.eof() && valid && !terminated) { var ch = this.scanner.source[this.scanner.index]; if (ch === quote) { break; } terminated = (ch === ';'); result += ch; ++this.scanner.index; if (!terminated) { switch (result.length) { case 2: // e.g. '{' numeric = (ch === '#'); break; case 3: if (numeric) { // e.g. 'A' hex = (ch === 'x'); valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); numeric = numeric && !hex; } break; default: valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); break; } } } if (valid && terminated && result.length > 2) { // e.g. 'A' becomes just '#x41' var str = result.substr(1, result.length - 2); if (numeric && str.length > 1) { result = String.fromCharCode(parseInt(str.substr(1), 10)); } else if (hex && str.length > 2) { result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); } else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { result = xhtml_entities_1.XHTMLEntities[str]; } } return result; }; // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. JSXParser.prototype.lexJSX = function () { var cp = this.scanner.source.charCodeAt(this.scanner.index); // < > / : = { } if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { var value = this.scanner.source[this.scanner.index++]; return { type: 7 /* Punctuator */, value: value, lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: this.scanner.index - 1, end: this.scanner.index }; } // " ' if (cp === 34 || cp === 39) { var start = this.scanner.index; var quote = this.scanner.source[this.scanner.index++]; var str = ''; while (!this.scanner.eof()) { var ch = this.scanner.source[this.scanner.index++]; if (ch === quote) { break; } else if (ch === '&') { str += this.scanXHTMLEntity(quote); } else { str += ch; } } return { type: 8 /* StringLiteral */, value: str, lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: start, end: this.scanner.index }; } // ... or . if (cp === 46) { var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); var value = (n1 === 46 && n2 === 46) ? '...' : '.'; var start = this.scanner.index; this.scanner.index += value.length; return { type: 7 /* Punctuator */, value: value, lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: start, end: this.scanner.index }; } // ` if (cp === 96) { // Only placeholder, since it will be rescanned as a real assignment expression. return { type: 10 /* Template */, value: '', lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: this.scanner.index, end: this.scanner.index }; } // Identifer can not contain backslash (char code 92). if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) { var start = this.scanner.index; ++this.scanner.index; while (!this.scanner.eof()) { var ch = this.scanner.source.charCodeAt(this.scanner.index); if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) { ++this.scanner.index; } else if (ch === 45) { // Hyphen (char code 45) can be part of an identifier. ++this.scanner.index; } else { break; } } var id = this.scanner.source.slice(start, this.scanner.index); return { type: 100 /* Identifier */, value: id, lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: start, end: this.scanner.index }; } return this.scanner.lex(); }; JSXParser.prototype.nextJSXToken = function () { this.collectComments(); this.startMarker.index = this.scanner.index; this.startMarker.line = this.scanner.lineNumber; this.startMarker.column = this.scanner.index - this.scanner.lineStart; var token = this.lexJSX(); this.lastMarker.index = this.scanner.index; this.lastMarker.line = this.scanner.lineNumber; this.lastMarker.column = this.scanner.index - this.scanner.lineStart; if (this.config.tokens) { this.tokens.push(this.convertToken(token)); } return token; }; JSXParser.prototype.nextJSXText = function () { this.startMarker.index = this.scanner.index; this.startMarker.line = this.scanner.lineNumber; this.startMarker.column = this.scanner.index - this.scanner.lineStart; var start = this.scanner.index; var text = ''; while (!this.scanner.eof()) { var ch = this.scanner.source[this.scanner.index]; if (ch === '{' || ch === '<') { break; } ++this.scanner.index; text += ch; if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { ++this.scanner.lineNumber; if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { ++this.scanner.index; } this.scanner.lineStart = this.scanner.index; } } this.lastMarker.index = this.scanner.index; this.lastMarker.line = this.scanner.lineNumber; this.lastMarker.column = this.scanner.index - this.scanner.lineStart; var token = { type: 101 /* Text */, value: text, lineNumber: this.scanner.lineNumber, lineStart: this.scanner.lineStart, start: start, end: this.scanner.index }; if ((text.length > 0) && this.config.tokens) { this.tokens.push(this.convertToken(token)); } return token; }; JSXParser.prototype.peekJSXToken = function () { var state = this.scanner.saveState(); this.scanner.scanComments(); var next = this.lexJSX(); this.scanner.restoreState(state); return next; }; // Expect the next JSX token to match the specified punctuator. // If not, an exception will be thrown. JSXParser.prototype.expectJSX = function (value) { var token = this.nextJSXToken(); if (token.type !== 7 /* Punctuator */ || token.value !== value) { this.throwUnexpectedToken(token); } }; // Return true if the next JSX token matches the specified punctuator. JSXParser.prototype.matchJSX = function (value) { var next = this.peekJSXToken(); return next.type === 7 /* Punctuator */ && next.value === value; }; JSXParser.prototype.parseJSXIdentifier = function () { var node = this.createJSXNode(); var token = this.nextJSXToken(); if (token.type !== 100 /* Identifier */) { this.throwUnexpectedToken(token); } return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); }; JSXParser.prototype.parseJSXElementName = function () { var node = this.createJSXNode(); var elementName = this.parseJSXIdentifier(); if (this.matchJSX(':')) { var namespace = elementName; this.expectJSX(':'); var name_1 = this.parseJSXIdentifier(); elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); } else if (this.matchJSX('.')) { while (this.matchJSX('.')) { var object = elementName; this.expectJSX('.'); var property = this.parseJSXIdentifier(); elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); } } return elementName; }; JSXParser.prototype.parseJSXAttributeName = function () { var node = this.createJSXNode(); var attributeName; var identifier = this.parseJSXIdentifier(); if (this.matchJSX(':')) { var namespace = identifier; this.expectJSX(':'); var name_2 = this.parseJSXIdentifier(); attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); } else { attributeName = identifier; } return attributeName; }; JSXParser.prototype.parseJSXStringLiteralAttribute = function () { var node = this.createJSXNode(); var token = this.nextJSXToken(); if (token.type !== 8 /* StringLiteral */) { this.throwUnexpectedToken(token); } var raw = this.getTokenRaw(token); return this.finalize(node, new Node.Literal(token.value, raw)); }; JSXParser.prototype.parseJSXExpressionAttribute = function () { var node = this.createJSXNode(); this.expectJSX('{'); this.finishJSX(); if (this.match('}')) { this.tolerateError('JSX attributes must only be assigned a non-empty expression'); } var expression = this.parseAssignmentExpression(); this.reenterJSX(); return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); }; JSXParser.prototype.parseJSXAttributeValue = function () { return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); }; JSXParser.prototype.parseJSXNameValueAttribute = function () { var node = this.createJSXNode(); var name = this.parseJSXAttributeName(); var value = null; if (this.matchJSX('=')) { this.expectJSX('='); value = this.parseJSXAttributeValue(); } return this.finalize(node, new JSXNode.JSXAttribute(name, value)); }; JSXParser.prototype.parseJSXSpreadAttribute = function () { var node = this.createJSXNode(); this.expectJSX('{'); this.expectJSX('...'); this.finishJSX(); var argument = this.parseAssignmentExpression(); this.reenterJSX(); return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); }; JSXParser.prototype.parseJSXAttributes = function () { var attributes = []; while (!this.matchJSX('/') && !this.matchJSX('>')) { var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : this.parseJSXNameValueAttribute(); attributes.push(attribute); } return attributes; }; JSXParser.prototype.parseJSXOpeningElement = function () { var node = this.createJSXNode(); this.expectJSX('<'); var name = this.parseJSXElementName(); var attributes = this.parseJSXAttributes(); var selfClosing = this.matchJSX('/'); if (selfClosing) { this.expectJSX('/'); } this.expectJSX('>'); return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); }; JSXParser.prototype.parseJSXBoundaryElement = function () { var node = this.createJSXNode(); this.expectJSX('<'); if (this.matchJSX('/')) { this.expectJSX('/'); var name_3 = this.parseJSXElementName(); this.expectJSX('>'); return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); } var name = this.parseJSXElementName(); var attributes = this.parseJSXAttributes(); var selfClosing = this.matchJSX('/'); if (selfClosing) { this.expectJSX('/'); } this.expectJSX('>'); return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); }; JSXParser.prototype.parseJSXEmptyExpression = function () { var node = this.createJSXChildNode(); this.collectComments(); this.lastMarker.index = this.scanner.index; this.lastMarker.line = this.scanner.lineNumber; this.lastMarker.column = this.scanner.index - this.scanner.lineStart; return this.finalize(node, new JSXNode.JSXEmptyExpression()); }; JSXParser.prototype.parseJSXExpressionContainer = function () { var node = this.createJSXNode(); this.expectJSX('{'); var expression; if (this.matchJSX('}')) { expression = this.parseJSXEmptyExpression(); this.expectJSX('}'); } else { this.finishJSX(); expression = this.parseAssignmentExpression(); this.reenterJSX(); } return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); }; JSXParser.prototype.parseJSXChildren = function () { var children = []; while (!this.scanner.eof()) { var node = this.createJSXChildNode(); var token = this.nextJSXText(); if (token.start < token.end) { var raw = this.getTokenRaw(token); var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); children.push(child); } if (this.scanner.source[this.scanner.index] === '{') { var container = this.parseJSXExpressionContainer(); children.push(container); } else { break; } } return children; }; JSXParser.prototype.parseComplexJSXElement = function (el) { var stack = []; while (!this.scanner.eof()) { el.children = el.children.concat(this.parseJSXChildren()); var node = this.createJSXChildNode(); var element = this.parseJSXBoundaryElement(); if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { var opening = element; if (opening.selfClosing) { var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); el.children.push(child); } else { stack.push(el); el = { node: node, opening: opening, closing: null, children: [] }; } } if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { el.closing = element; var open_1 = getQualifiedElementName(el.opening.name); var close_1 = getQualifiedElementName(el.closing.name); if (open_1 !== close_1) { this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); } if (stack.length > 0) { var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); el = stack[stack.length - 1]; el.children.push(child); stack.pop(); } else { break; } } } return el; }; JSXParser.prototype.parseJSXElement = function () { var node = this.createJSXNode(); var opening = this.parseJSXOpeningElement(); var children = []; var closing = null; if (!opening.selfClosing) { var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children }); children = el.children; closing = el.closing; } return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); }; JSXParser.prototype.parseJSXRoot = function () { // Pop the opening '<' added from the lookahead. if (this.config.tokens) { this.tokens.pop(); } this.startJSX(); var element = this.parseJSXElement(); this.finishJSX(); return element; }; JSXParser.prototype.isStartOfExpression = function () { return _super.prototype.isStartOfExpression.call(this) || this.match('<'); }; return JSXParser; }(parser_1.Parser)); exports.JSXParser = JSXParser; /***/ }, /* 4 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // See also tools/generate-unicode-regex.js. var Regex = { // Unicode v8.0.0 NonAsciiIdentifierStart: NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, // Unicode v8.0.0 NonAsciiIdentifierPart: NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ }; exports.Character = { /* tslint:disable:no-bitwise */ fromCodePoint: function (cp) { return (cp < 0x10000) ? String.fromCharCode(cp) : String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); }, // https://tc39.github.io/ecma262/#sec-white-space isWhiteSpace: function (cp) { return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) || (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0); }, // https://tc39.github.io/ecma262/#sec-line-terminators isLineTerminator: function (cp) { return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029); }, // https://tc39.github.io/ecma262/#sec-names-and-keywords isIdentifierStart: function (cp) { return (cp === 0x24) || (cp === 0x5F) || (cp >= 0x41 && cp <= 0x5A) || (cp >= 0x61 && cp <= 0x7A) || (cp === 0x5C) || ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp))); }, isIdentifierPart: function (cp) { return (cp === 0x24) || (cp === 0x5F) || (cp >= 0x41 && cp <= 0x5A) || (cp >= 0x61 && cp <= 0x7A) || (cp >= 0x30 && cp <= 0x39) || (cp === 0x5C) || ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp))); }, // https://tc39.github.io/ecma262/#sec-literals-numeric-literals isDecimalDigit: function (cp) { return (cp >= 0x30 && cp <= 0x39); // 0..9 }, isHexDigit: function (cp) { return (cp >= 0x30 && cp <= 0x39) || (cp >= 0x41 && cp <= 0x46) || (cp >= 0x61 && cp <= 0x66); // a..f }, isOctalDigit: function (cp) { return (cp >= 0x30 && cp <= 0x37); // 0..7 } }; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var jsx_syntax_1 = __webpack_require__(6); /* tslint:disable:max-classes-per-file */ var JSXClosingElement = (function () { function JSXClosingElement(name) { this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; this.name = name; } return JSXClosingElement; }()); exports.JSXClosingElement = JSXClosingElement; var JSXElement = (function () { function JSXElement(openingElement, children, closingElement) { this.type = jsx_syntax_1.JSXSyntax.JSXElement; this.openingElement = openingElement; this.children = children; this.closingElement = closingElement; } return JSXElement; }()); exports.JSXElement = JSXElement; var JSXEmptyExpression = (function () { function JSXEmptyExpression() { this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; } return JSXEmptyExpression; }()); exports.JSXEmptyExpression = JSXEmptyExpression; var JSXExpressionContainer = (function () { function JSXExpressionContainer(expression) { this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; this.expression = expression; } return JSXExpressionContainer; }()); exports.JSXExpressionContainer = JSXExpressionContainer; var JSXIdentifier = (function () { function JSXIdentifier(name) { this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; this.name = name; } return JSXIdentifier; }()); exports.JSXIdentifier = JSXIdentifier; var JSXMemberExpression = (function () { function JSXMemberExpression(object, property) { this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; this.object = object; this.property = property; } return JSXMemberExpression; }()); exports.JSXMemberExpression = JSXMemberExpression; var JSXAttribute = (function () { function JSXAttribute(name, value) { this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; this.name = name; this.value = value; } return JSXAttribute; }()); exports.JSXAttribute = JSXAttribute; var JSXNamespacedName = (function () { function JSXNamespacedName(namespace, name) { this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; this.namespace = namespace; this.name = name; } return JSXNamespacedName; }()); exports.JSXNamespacedName = JSXNamespacedName; var JSXOpeningElement = (function () { function JSXOpeningElement(name, selfClosing, attributes) { this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; this.name = name; this.selfClosing = selfClosing; this.attributes = attributes; } return JSXOpeningElement; }()); exports.JSXOpeningElement = JSXOpeningElement; var JSXSpreadAttribute = (function () { function JSXSpreadAttribute(argument) { this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; this.argument = argument; } return JSXSpreadAttribute; }()); exports.JSXSpreadAttribute = JSXSpreadAttribute; var JSXText = (function () { function JSXText(value, raw) { this.type = jsx_syntax_1.JSXSyntax.JSXText; this.value = value; this.raw = raw; } return JSXText; }()); exports.JSXText = JSXText; /***/ }, /* 6 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JSXSyntax = { JSXAttribute: 'JSXAttribute', JSXClosingElement: 'JSXClosingElement', JSXElement: 'JSXElement', JSXEmptyExpression: 'JSXEmptyExpression', JSXExpressionContainer: 'JSXExpressionContainer', JSXIdentifier: 'JSXIdentifier', JSXMemberExpression: 'JSXMemberExpression', JSXNamespacedName: 'JSXNamespacedName', JSXOpeningElement: 'JSXOpeningElement', JSXSpreadAttribute: 'JSXSpreadAttribute', JSXText: 'JSXText' }; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var syntax_1 = __webpack_require__(2); /* tslint:disable:max-classes-per-file */ var ArrayExpression = (function () { function ArrayExpression(elements) { this.type = syntax_1.Syntax.ArrayExpression; this.elements = elements; } return ArrayExpression; }()); exports.ArrayExpression = ArrayExpression; var ArrayPattern = (function () { function ArrayPattern(elements) { this.type = syntax_1.Syntax.ArrayPattern; this.elements = elements; } return ArrayPattern; }()); exports.ArrayPattern = ArrayPattern; var ArrowFunctionExpression = (function () { function ArrowFunctionExpression(params, body, expression) { this.type = syntax_1.Syntax.ArrowFunctionExpression; this.id = null; this.params = params; this.body = body; this.generator = false; this.expression = expression; this.async = false; } return ArrowFunctionExpression; }()); exports.ArrowFunctionExpression = ArrowFunctionExpression; var AssignmentExpression = (function () { function AssignmentExpression(operator, left, right) { this.type = syntax_1.Syntax.AssignmentExpression; this.operator = operator; this.left = left; this.right = right; } return AssignmentExpression; }()); exports.AssignmentExpression = AssignmentExpression; var AssignmentPattern = (function () { function AssignmentPattern(left, right) { this.type = syntax_1.Syntax.AssignmentPattern; this.left = left; this.right = right; } return AssignmentPattern; }()); exports.AssignmentPattern = AssignmentPattern; var AsyncArrowFunctionExpression = (function () { function AsyncArrowFunctionExpression(params, body, expression) { this.type = syntax_1.Syntax.ArrowFunctionExpression; this.id = null; this.params = params; this.body = body; this.generator = false; this.expression = expression; this.async = true; } return AsyncArrowFunctionExpression; }()); exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; var AsyncFunctionDeclaration = (function () { function AsyncFunctionDeclaration(id, params, body) { this.type = syntax_1.Syntax.FunctionDeclaration; this.id = id; this.params = params; this.body = body; this.generator = false; this.expression = false; this.async = true; } return AsyncFunctionDeclaration; }()); exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; var AsyncFunctionExpression = (function () { function AsyncFunctionExpression(id, params, body) { this.type = syntax_1.Syntax.FunctionExpression; this.id = id; this.params = params; this.body = body; this.generator = false; this.expression = false; this.async = true; } return AsyncFunctionExpression; }()); exports.AsyncFunctionExpression = AsyncFunctionExpression; var AwaitExpression = (function () { function AwaitExpression(argument) { this.type = syntax_1.Syntax.AwaitExpression; this.argument = argument; } return AwaitExpression; }()); exports.AwaitExpression = AwaitExpression; var BinaryExpression = (function () { function BinaryExpression(operator, left, right) { var logical = (operator === '||' || operator === '&&'); this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; this.operator = operator; this.left = left; this.right = right; } return BinaryExpression; }()); exports.BinaryExpression = BinaryExpression; var BlockStatement = (function () { function BlockStatement(body) { this.type = syntax_1.Syntax.BlockStatement; this.body = body; } return BlockStatement; }()); exports.BlockStatement = BlockStatement; var BreakStatement = (function () { function BreakStatement(label) { this.type = syntax_1.Syntax.BreakStatement; this.label = label; } return BreakStatement; }()); exports.BreakStatement = BreakStatement; var CallExpression = (function () { function CallExpression(callee, args) { this.type = syntax_1.Syntax.CallExpression; this.callee = callee; this.arguments = args; } return CallExpression; }()); exports.CallExpression = CallExpression; var CatchClause = (function () { function CatchClause(param, body) { this.type = syntax_1.Syntax.CatchClause; this.param = param; this.body = body; } return CatchClause; }()); exports.CatchClause = CatchClause; var ClassBody = (function () { function ClassBody(body) { this.type = syntax_1.Syntax.ClassBody; this.body = body; } return ClassBody; }()); exports.ClassBody = ClassBody; var ClassDeclaration = (function () { function ClassDeclaration(id, superClass, body) { this.type = syntax_1.Syntax.ClassDeclaration; this.id = id; this.superClass = superClass; this.body = body; } return ClassDeclaration; }()); exports.ClassDeclaration = ClassDeclaration; var ClassExpression = (function () { function ClassExpression(id, superClass, body) { this.type = syntax_1.Syntax.ClassExpression; this.id = id; this.superClass = superClass; this.body = body; } return ClassExpression; }()); exports.ClassExpression = ClassExpression; var ComputedMemberExpression = (function () { function ComputedMemberExpression(object, property) { this.type = syntax_1.Syntax.MemberExpression; this.computed = true; this.object = object; this.property = property; } return ComputedMemberExpression; }()); exports.ComputedMemberExpression = ComputedMemberExpression; var ConditionalExpression = (function () { function ConditionalExpression(test, consequent, alternate) { this.type = syntax_1.Syntax.ConditionalExpression; this.test = test; this.consequent = consequent; this.alternate = alternate; } return ConditionalExpression; }()); exports.ConditionalExpression = ConditionalExpression; var ContinueStatement = (function () { function ContinueStatement(label) { this.type = syntax_1.Syntax.ContinueStatement; this.label = label; } return ContinueStatement; }()); exports.ContinueStatement = ContinueStatement; var DebuggerStatement = (function () { function DebuggerStatement() { this.type = syntax_1.Syntax.DebuggerStatement; } return DebuggerStatement; }()); exports.DebuggerStatement = DebuggerStatement; var Directive = (function () { function Directive(expression, directive) { this.type = syntax_1.Syntax.ExpressionStatement; this.expression = expression; this.directive = directive; } return Directive; }()); exports.Directive = Directive; var DoWhileStatement = (function () { function DoWhileStatement(body, test) { this.type = syntax_1.Syntax.DoWhileStatement; this.body = body; this.test = test; } return DoWhileStatement; }()); exports.DoWhileStatement = DoWhileStatement; var EmptyStatement = (function () { function EmptyStatement() { this.type = syntax_1.Syntax.EmptyStatement; } return EmptyStatement; }()); exports.EmptyStatement = EmptyStatement; var ExportAllDeclaration = (function () { function ExportAllDeclaration(source) { this.type = syntax_1.Syntax.ExportAllDeclaration; this.source = source; } return ExportAllDeclaration; }()); exports.ExportAllDeclaration = ExportAllDeclaration; var ExportDefaultDeclaration = (function () { function ExportDefaultDeclaration(declaration) { this.type = syntax_1.Syntax.ExportDefaultDeclaration; this.declaration = declaration; } return ExportDefaultDeclaration; }()); exports.ExportDefaultDeclaration = ExportDefaultDeclaration; var ExportNamedDeclaration = (function () { function ExportNamedDeclaration(declaration, specifiers, source) { this.type = syntax_1.Syntax.ExportNamedDeclaration; this.declaration = declaration; this.specifiers = specifiers; this.source = source; } return ExportNamedDeclaration; }()); exports.ExportNamedDeclaration = ExportNamedDeclaration; var ExportSpecifier = (function () { function ExportSpecifier(local, exported) { this.type = syntax_1.Syntax.ExportSpecifier; this.exported = exported; this.local = local; } return ExportSpecifier; }()); exports.ExportSpecifier = ExportSpecifier; var ExpressionStatement = (function () { function ExpressionStatement(expression) { this.type = syntax_1.Syntax.ExpressionStatement; this.expression = expression; } return ExpressionStatement; }()); exports.ExpressionStatement = ExpressionStatement; var ForInStatement = (function () { function ForInStatement(left, right, body) { this.type = syntax_1.Syntax.ForInStatement; this.left = left; this.right = right; this.body = body; this.each = false; } return ForInStatement; }()); exports.ForInStatement = ForInStatement; var ForOfStatement = (function () { function ForOfStatement(left, right, body) { this.type = syntax_1.Syntax.ForOfStatement; this.left = left; this.right = right; this.body = body; } return ForOfStatement; }()); exports.ForOfStatement = ForOfStatement; var ForStatement = (function () { function ForStatement(init, test, update, body) { this.type = syntax_1.Syntax.ForStatement; this.init = init; this.test = test; this.update = update; this.body = body; } return ForStatement; }()); exports.ForStatement = ForStatement; var FunctionDeclaration = (function () { function FunctionDeclaration(id, params, body, generator) { this.type = syntax_1.Syntax.FunctionDeclaration; this.id = id; this.params = params; this.body = body; this.generator = generator; this.expression = false; this.async = false; } return FunctionDeclaration; }()); exports.FunctionDeclaration = FunctionDeclaration; var FunctionExpression = (function () { function FunctionExpression(id, params, body, generator) { this.type = syntax_1.Syntax.FunctionExpression; this.id = id; this.params = params; this.body = body; this.generator = generator; this.expression = false; this.async = false; } return FunctionExpression; }()); exports.FunctionExpression = FunctionExpression; var Identifier = (function () { function Identifier(name) { this.type = syntax_1.Syntax.Identifier; this.name = name; } return Identifier; }()); exports.Identifier = Identifier; var IfStatement = (function () { function IfStatement(test, consequent, alternate) { this.type = syntax_1.Syntax.IfStatement; this.test = test; this.consequent = consequent; this.alternate = alternate; } return IfStatement; }()); exports.IfStatement = IfStatement; var ImportDeclaration = (function () { function ImportDeclaration(specifiers, source) { this.type = syntax_1.Syntax.ImportDeclaration; this.specifiers = specifiers; this.source = source; } return ImportDeclaration; }()); exports.ImportDeclaration = ImportDeclaration; var ImportDefaultSpecifier = (function () { function ImportDefaultSpecifier(local) { this.type = syntax_1.Syntax.ImportDefaultSpecifier; this.local = local; } return ImportDefaultSpecifier; }()); exports.ImportDefaultSpecifier = ImportDefaultSpecifier; var ImportNamespaceSpecifier = (function () { function ImportNamespaceSpecifier(local) { this.type = syntax_1.Syntax.ImportNamespaceSpecifier; this.local = local; } return ImportNamespaceSpecifier; }()); exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; var ImportSpecifier = (function () { function ImportSpecifier(local, imported) { this.type = syntax_1.Syntax.ImportSpecifier; this.local = local; this.imported = imported; } return ImportSpecifier; }()); exports.ImportSpecifier = ImportSpecifier; var LabeledStatement = (function () { function LabeledStatement(label, body) { this.type = syntax_1.Syntax.LabeledStatement; this.label = label; this.body = body; } return LabeledStatement; }()); exports.LabeledStatement = LabeledStatement; var Literal = (function () { function Literal(value, raw) { this.type = syntax_1.Syntax.Literal; this.value = value; this.raw = raw; } return Literal; }()); exports.Literal = Literal; var MetaProperty = (function () { function MetaProperty(meta, property) { this.type = syntax_1.Syntax.MetaProperty; this.meta = meta; this.property = property; } return MetaProperty; }()); exports.MetaProperty = MetaProperty; var MethodDefinition = (function () { function MethodDefinition(key, computed, value, kind, isStatic) { this.type = syntax_1.Syntax.MethodDefinition; this.key = key; this.computed = computed; this.value = value; this.kind = kind; this.static = isStatic; } return MethodDefinition; }()); exports.MethodDefinition = MethodDefinition; var Module = (function () { function Module(body) { this.type = syntax_1.Syntax.Program; this.body = body; this.sourceType = 'module'; } return Module; }()); exports.Module = Module; var NewExpression = (function () { function NewExpression(callee, args) { this.type = syntax_1.Syntax.NewExpression; this.callee = callee; this.arguments = args; } return NewExpression; }()); exports.NewExpression = NewExpression; var ObjectExpression = (function () { function ObjectExpression(properties) { this.type = syntax_1.Syntax.ObjectExpression; this.properties = properties; } return ObjectExpression; }()); exports.ObjectExpression = ObjectExpression; var ObjectPattern = (function () { function ObjectPattern(properties) { this.type = syntax_1.Syntax.ObjectPattern; this.properties = properties; } return ObjectPattern; }()); exports.ObjectPattern = ObjectPattern; var Property = (function () { function Property(kind, key, computed, value, method, shorthand) { this.type = syntax_1.Syntax.Property; this.key = key; this.computed = computed; this.value = value; this.kind = kind; this.method = method; this.shorthand = shorthand; } return Property; }()); exports.Property = Property; var RegexLiteral = (function () { function RegexLiteral(value, raw, pattern, flags) { this.type = syntax_1.Syntax.Literal; this.value = value; this.raw = raw; this.regex = { pattern: pattern, flags: flags }; } return RegexLiteral; }()); exports.RegexLiteral = RegexLiteral; var RestElement = (function () { function RestElement(argument) { this.type = syntax_1.Syntax.RestElement; this.argument = argument; } return RestElement; }()); exports.RestElement = RestElement; var ReturnStatement = (function () { function ReturnStatement(argument) { this.type = syntax_1.Syntax.ReturnStatement; this.argument = argument; } return ReturnStatement; }()); exports.ReturnStatement = ReturnStatement; var Script = (function () { function Script(body) { this.type = syntax_1.Syntax.Program; this.body = body; this.sourceType = 'script'; } return Script; }()); exports.Script = Script; var SequenceExpression = (function () { function SequenceExpression(expressions) { this.type = syntax_1.Syntax.SequenceExpression; this.expressions = expressions; } return SequenceExpression; }()); exports.SequenceExpression = SequenceExpression; var SpreadElement = (function () { function SpreadElement(argument) { this.type = syntax_1.Syntax.SpreadElement; this.argument = argument; } return SpreadElement; }()); exports.SpreadElement = SpreadElement; var StaticMemberExpression = (function () { function StaticMemberExpression(object, property) { this.type = syntax_1.Syntax.MemberExpression; this.computed = false; this.object = object; this.property = property; } return StaticMemberExpression; }()); exports.StaticMemberExpression = StaticMemberExpression; var Super = (function () { function Super() { this.type = syntax_1.Syntax.Super; } return Super; }()); exports.Super = Super; var SwitchCase = (function () { function SwitchCase(test, consequent) { this.type = syntax_1.Syntax.SwitchCase; this.test = test; this.consequent = consequent; } return SwitchCase; }()); exports.SwitchCase = SwitchCase; var SwitchStatement = (function () { function SwitchStatement(discriminant, cases) { this.type = syntax_1.Syntax.SwitchStatement; this.discriminant = discriminant; this.cases = cases; } return SwitchStatement; }()); exports.SwitchStatement = SwitchStatement; var TaggedTemplateExpression = (function () { function TaggedTemplateExpression(tag, quasi) { this.type = syntax_1.Syntax.TaggedTemplateExpression; this.tag = tag; this.quasi = quasi; } return TaggedTemplateExpression; }()); exports.TaggedTemplateExpression = TaggedTemplateExpression; var TemplateElement = (function () { function TemplateElement(value, tail) { this.type = syntax_1.Syntax.TemplateElement; this.value = value; this.tail = tail; } return TemplateElement; }()); exports.TemplateElement = TemplateElement; var TemplateLiteral = (function () { function TemplateLiteral(quasis, expressions) { this.type = syntax_1.Syntax.TemplateLiteral; this.quasis = quasis; this.expressions = expressions; } return TemplateLiteral; }()); exports.TemplateLiteral = TemplateLiteral; var ThisExpression = (function () { function ThisExpression() { this.type = syntax_1.Syntax.ThisExpression; } return ThisExpression; }()); exports.ThisExpression = ThisExpression; var ThrowStatement = (function () { function ThrowStatement(argument) { this.type = syntax_1.Syntax.ThrowStatement; this.argument = argument; } return ThrowStatement; }()); exports.ThrowStatement = ThrowStatement; var TryStatement = (function () { function TryStatement(block, handler, finalizer) { this.type = syntax_1.Syntax.TryStatement; this.block = block; this.handler = handler; this.finalizer = finalizer; } return TryStatement; }()); exports.TryStatement = TryStatement; var UnaryExpression = (function () { function UnaryExpression(operator, argument) { this.type = syntax_1.Syntax.UnaryExpression; this.operator = operator; this.argument = argument; this.prefix = true; } return UnaryExpression; }()); exports.UnaryExpression = UnaryExpression; var UpdateExpression = (function () { function UpdateExpression(operator, argument, prefix) { this.type = syntax_1.Syntax.UpdateExpression; this.operator = operator; this.argument = argument; this.prefix = prefix; } return UpdateExpression; }()); exports.UpdateExpression = UpdateExpression; var VariableDeclaration = (function () { function VariableDeclaration(declarations, kind) { this.type = syntax_1.Syntax.VariableDeclaration; this.declarations = declarations; this.kind = kind; } return VariableDeclaration; }()); exports.VariableDeclaration = VariableDeclaration; var VariableDeclarator = (function () { function VariableDeclarator(id, init) { this.type = syntax_1.Syntax.VariableDeclarator; this.id = id; this.init = init; } return VariableDeclarator; }()); exports.VariableDeclarator = VariableDeclarator; var WhileStatement = (function () { function WhileStatement(test, body) { this.type = syntax_1.Syntax.WhileStatement; this.test = test; this.body = body; } return WhileStatement; }()); exports.WhileStatement = WhileStatement; var WithStatement = (function () { function WithStatement(object, body) { this.type = syntax_1.Syntax.WithStatement; this.object = object; this.body = body; } return WithStatement; }()); exports.WithStatement = WithStatement; var YieldExpression = (function () { function YieldExpression(argument, delegate) { this.type = syntax_1.Syntax.YieldExpression; this.argument = argument; this.delegate = delegate; } return YieldExpression; }()); exports.YieldExpression = YieldExpression; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var assert_1 = __webpack_require__(9); var error_handler_1 = __webpack_require__(10); var messages_1 = __webpack_require__(11); var Node = __webpack_require__(7); var scanner_1 = __webpack_require__(12); var syntax_1 = __webpack_require__(2); var token_1 = __webpack_require__(13); var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; var Parser = (function () { function Parser(code, options, delegate) { if (options === void 0) { options = {}; } this.config = { range: (typeof options.range === 'boolean') && options.range, loc: (typeof options.loc === 'boolean') && options.loc, source: null, tokens: (typeof options.tokens === 'boolean') && options.tokens, comment: (typeof options.comment === 'boolean') && options.comment, tolerant: (typeof options.tolerant === 'boolean') && options.tolerant }; if (this.config.loc && options.source && options.source !== null) { this.config.source = String(options.source); } this.delegate = delegate; this.errorHandler = new error_handler_1.ErrorHandler(); this.errorHandler.tolerant = this.config.tolerant; this.scanner = new scanner_1.Scanner(code, this.errorHandler); this.scanner.trackComment = this.config.comment; this.operatorPrecedence = { ')': 0, ';': 0, ',': 0, '=': 0, ']': 0, '||': 1, '&&': 2, '|': 3, '^': 4, '&': 5, '==': 6, '!=': 6, '===': 6, '!==': 6, '<': 7, '>': 7, '<=': 7, '>=': 7, '<<': 8, '>>': 8, '>>>': 8, '+': 9, '-': 9, '*': 11, '/': 11, '%': 11 }; this.lookahead = { type: 2 /* EOF */, value: '', lineNumber: this.scanner.lineNumber, lineStart: 0, start: 0, end: 0 }; this.hasLineTerminator = false; this.context = { isModule: false, await: false, allowIn: true, allowStrictDirective: true, allowYield: true, firstCoverInitializedNameError: null, isAssignmentTarget: false, isBindingElement: false, inFunctionBody: false, inIteration: false, inSwitch: false, labelSet: {}, strict: false }; this.tokens = []; this.startMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }; this.lastMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }; this.nextToken(); this.lastMarker = { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }; } Parser.prototype.throwError = function (messageFormat) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var args = Array.prototype.slice.call(arguments, 1); var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { assert_1.assert(idx < args.length, 'Message reference must be in range'); return args[idx]; }); var index = this.lastMarker.index; var line = this.lastMarker.line; var column = this.lastMarker.column + 1; throw this.errorHandler.createError(index, line, column, msg); }; Parser.prototype.tolerateError = function (messageFormat) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var args = Array.prototype.slice.call(arguments, 1); var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { assert_1.assert(idx < args.length, 'Message reference must be in range'); return args[idx]; }); var index = this.lastMarker.index; var line = this.scanner.lineNumber; var column = this.lastMarker.column + 1; this.errorHandler.tolerateError(index, line, column, msg); }; // Throw an exception because of the token. Parser.prototype.unexpectedTokenError = function (token, message) { var msg = message || messages_1.Messages.UnexpectedToken; var value; if (token) { if (!message) { msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS : (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier : (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber : (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString : (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate : messages_1.Messages.UnexpectedToken; if (token.type === 4 /* Keyword */) { if (this.scanner.isFutureReservedWord(token.value)) { msg = messages_1.Messages.UnexpectedReserved; } else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { msg = messages_1.Messages.StrictReservedWord; } } } value = token.value; } else { value = 'ILLEGAL'; } msg = msg.replace('%0', value); if (token && typeof token.lineNumber === 'number') { var index = token.start; var line = token.lineNumber; var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; var column = token.start - lastMarkerLineStart + 1; return this.errorHandler.createError(index, line, column, msg); } else { var index = this.lastMarker.index; var line = this.lastMarker.line; var column = this.lastMarker.column + 1; return this.errorHandler.createError(index, line, column, msg); } }; Parser.prototype.throwUnexpectedToken = function (token, message) { throw this.unexpectedTokenError(token, message); }; Parser.prototype.tolerateUnexpectedToken = function (token, message) { this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); }; Parser.prototype.collectComments = function () { if (!this.config.comment) { this.scanner.scanComments(); } else { var comments = this.scanner.scanComments(); if (comments.length > 0 && this.delegate) { for (var i = 0; i < comments.length; ++i) { var e = comments[i]; var node = void 0; node = { type: e.multiLine ? 'BlockComment' : 'LineComment', value: this.scanner.source.slice(e.slice[0], e.slice[1]) }; if (this.config.range) { node.range = e.range; } if (this.config.loc) { node.loc = e.loc; } var metadata = { start: { line: e.loc.start.line, column: e.loc.start.column, offset: e.range[0] }, end: { line: e.loc.end.line, column: e.loc.end.column, offset: e.range[1] } }; this.delegate(node, metadata); } } } }; // From internal representation to an external structure Parser.prototype.getTokenRaw = function (token) { return this.scanner.source.slice(token.start, token.end); }; Parser.prototype.convertToken = function (token) { var t = { type: token_1.TokenName[token.type], value: this.getTokenRaw(token) }; if (this.config.range) { t.range = [token.start, token.end]; } if (this.config.loc) { t.loc = { start: { line: this.startMarker.line, column: this.startMarker.column }, end: { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart } }; } if (token.type === 9 /* RegularExpression */) { var pattern = token.pattern; var flags = token.flags; t.regex = { pattern: pattern, flags: flags }; } return t; }; Parser.prototype.nextToken = function () { var token = this.lookahead; this.lastMarker.index = this.scanner.index; this.lastMarker.line = this.scanner.lineNumber; this.lastMarker.column = this.scanner.index - this.scanner.lineStart; this.collectComments(); if (this.scanner.index !== this.startMarker.index) { this.startMarker.index = this.scanner.index; this.startMarker.line = this.scanner.lineNumber; this.startMarker.column = this.scanner.index - this.scanner.lineStart; } var next = this.scanner.lex(); this.hasLineTerminator = (token.lineNumber !== next.lineNumber); if (next && this.context.strict && next.type === 3 /* Identifier */) { if (this.scanner.isStrictModeReservedWord(next.value)) { next.type = 4 /* Keyword */; } } this.lookahead = next; if (this.config.tokens && next.type !== 2 /* EOF */) { this.tokens.push(this.convertToken(next)); } return token; }; Parser.prototype.nextRegexToken = function () { this.collectComments(); var token = this.scanner.scanRegExp(); if (this.config.tokens) { // Pop the previous token, '/' or '/=' // This is added from the lookahead token. this.tokens.pop(); this.tokens.push(this.convertToken(token)); } // Prime the next lookahead. this.lookahead = token; this.nextToken(); return token; }; Parser.prototype.createNode = function () { return { index: this.startMarker.index, line: this.startMarker.line, column: this.startMarker.column }; }; Parser.prototype.startNode = function (token) { return { index: token.start, line: token.lineNumber, column: token.start - token.lineStart }; }; Parser.prototype.finalize = function (marker, node) { if (this.config.range) { node.range = [marker.index, this.lastMarker.index]; } if (this.config.loc) { node.loc = { start: { line: marker.line, column: marker.column, }, end: { line: this.lastMarker.line, column: this.lastMarker.column } }; if (this.config.source) { node.loc.source = this.config.source; } } if (this.delegate) { var metadata = { start: { line: marker.line, column: marker.column, offset: marker.index }, end: { line: this.lastMarker.line, column: this.lastMarker.column, offset: this.lastMarker.index } }; this.delegate(node, metadata); } return node; }; // Expect the next token to match the specified punctuator. // If not, an exception will be thrown. Parser.prototype.expect = function (value) { var token = this.nextToken(); if (token.type !== 7 /* Punctuator */ || token.value !== value) { this.throwUnexpectedToken(token); } }; // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). Parser.prototype.expectCommaSeparator = function () { if (this.config.tolerant) { var token = this.lookahead; if (token.type === 7 /* Punctuator */ && token.value === ',') { this.nextToken(); } else if (token.type === 7 /* Punctuator */ && token.value === ';') { this.nextToken(); this.tolerateUnexpectedToken(token); } else { this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); } } else { this.expect(','); } }; // Expect the next token to match the specified keyword. // If not, an exception will be thrown. Parser.prototype.expectKeyword = function (keyword) { var token = this.nextToken(); if (token.type !== 4 /* Keyword */ || token.value !== keyword) { this.throwUnexpectedToken(token); } }; // Return true if the next token matches the specified punctuator. Parser.prototype.match = function (value) { return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value; }; // Return true if the next token matches the specified keyword Parser.prototype.matchKeyword = function (keyword) { return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword; }; // Return true if the next token matches the specified contextual keyword // (where an identifier is sometimes a keyword depending on the context) Parser.prototype.matchContextualKeyword = function (keyword) { return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword; }; // Return true if the next token is an assignment operator Parser.prototype.matchAssign = function () { if (this.lookahead.type !== 7 /* Punctuator */) { return false; } var op = this.lookahead.value; return op === '=' || op === '*=' || op === '**=' || op === '/=' || op === '%=' || op === '+=' || op === '-=' || op === '<<=' || op === '>>=' || op === '>>>=' || op === '&=' || op === '^=' || op === '|='; }; // Cover grammar support. // // When an assignment expression position starts with an left parenthesis, the determination of the type // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) // or the first comma. This situation also defers the determination of all the expressions nested in the pair. // // There are three productions that can be parsed in a parentheses pair that needs to be determined // after the outermost pair is closed. They are: // // 1. AssignmentExpression // 2. BindingElements // 3. AssignmentTargets // // In order to avoid exponential backtracking, we use two flags to denote if the production can be // binding element or assignment target. // // The three productions have the relationship: // // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression // // with a single exception that CoverInitializedName when used directly in an Expression, generates // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. // // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not // effect the current flags. This means the production the parser parses is only used as an expression. Therefore // the CoverInitializedName check is conducted. // // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates // the flags outside of the parser. This means the production the parser parses is used as a part of a potential // pattern. The CoverInitializedName check is deferred. Parser.prototype.isolateCoverGrammar = function (parseFunction) { var previousIsBindingElement = this.context.isBindingElement; var previousIsAssignmentTarget = this.context.isAssignmentTarget; var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; this.context.isBindingElement = true; this.context.isAssignmentTarget = true; this.context.firstCoverInitializedNameError = null; var result = parseFunction.call(this); if (this.context.firstCoverInitializedNameError !== null) { this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); } this.context.isBindingElement = previousIsBindingElement; this.context.isAssignmentTarget = previousIsAssignmentTarget; this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; return result; }; Parser.prototype.inheritCoverGrammar = function (parseFunction) { var previousIsBindingElement = this.context.isBindingElement; var previousIsAssignmentTarget = this.context.isAssignmentTarget; var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; this.context.isBindingElement = true; this.context.isAssignmentTarget = true; this.context.firstCoverInitializedNameError = null; var result = parseFunction.call(this); this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; return result; }; Parser.prototype.consumeSemicolon = function () { if (this.match(';')) { this.nextToken(); } else if (!this.hasLineTerminator) { if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) { this.throwUnexpectedToken(this.lookahead); } this.lastMarker.index = this.startMarker.index; this.lastMarker.line = this.startMarker.line; this.lastMarker.column = this.startMarker.column; } }; // https://tc39.github.io/ecma262/#sec-primary-expression Parser.prototype.parsePrimaryExpression = function () { var node = this.createNode(); var expr; var token, raw; switch (this.lookahead.type) { case 3 /* Identifier */: if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { this.tolerateUnexpectedToken(this.lookahead); } expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); break; case 6 /* NumericLiteral */: case 8 /* StringLiteral */: if (this.context.strict && this.lookahead.octal) { this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); } this.context.isAssignmentTarget = false; this.context.isBindingElement = false; token = this.nextToken(); raw = this.getTokenRaw(token); expr = this.finalize(node, new Node.Literal(token.value, raw)); break; case 1 /* BooleanLiteral */: this.context.isAssignmentTarget = false; this.context.isBindingElement = false; token = this.nextToken(); raw = this.getTokenRaw(token); expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); break; case 5 /* NullLiteral */: this.context.isAssignmentTarget = false; this.context.isBindingElement = false; token = this.nextToken(); raw = this.getTokenRaw(token); expr = this.finalize(node, new Node.Literal(null, raw)); break; case 10 /* Template */: expr = this.parseTemplateLiteral(); break; case 7 /* Punctuator */: switch (this.lookahead.value) { case '(': this.context.isBindingElement = false; expr = this.inheritCoverGrammar(this.parseGroupExpression); break; case '[': expr = this.inheritCoverGrammar(this.parseArrayInitializer); break; case '{': expr = this.inheritCoverGrammar(this.parseObjectInitializer); break; case '/': case '/=': this.context.isAssignmentTarget = false; this.context.isBindingElement = false; this.scanner.index = this.startMarker.index; token = this.nextRegexToken(); raw = this.getTokenRaw(token); expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); break; default: expr = this.throwUnexpectedToken(this.nextToken()); } break; case 4 /* Keyword */: if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { expr = this.parseIdentifierName(); } else if (!this.context.strict && this.matchKeyword('let')) { expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); } else { this.context.isAssignmentTarget = false; this.context.isBindingElement = false; if (this.matchKeyword('function')) { expr = this.parseFunctionExpression(); } else if (this.matchKeyword('this')) { this.nextToken(); expr = this.finalize(node, new Node.ThisExpression()); } else if (this.matchKeyword('class')) { expr = this.parseClassExpression(); } else { expr = this.throwUnexpectedToken(this.nextToken()); } } break; default: expr = this.throwUnexpectedToken(this.nextToken()); } return expr; }; // https://tc39.github.io/ecma262/#sec-array-initializer Parser.prototype.parseSpreadElement = function () { var node = this.createNode(); this.expect('...'); var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); return this.finalize(node, new Node.SpreadElement(arg)); }; Parser.prototype.parseArrayInitializer = function () { var node = this.createNode(); var elements = []; this.expect('['); while (!this.match(']')) { if (this.match(',')) { this.nextToken(); elements.push(null); } else if (this.match('...')) { var element = this.parseSpreadElement(); if (!this.match(']')) { this.context.isAssignmentTarget = false; this.context.isBindingElement = false; this.expect(','); } elements.push(element); } else { elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); if (!this.match(']')) { this.expect(','); } } } this.expect(']'); return this.finalize(node, new Node.ArrayExpression(elements)); }; // https://tc39.github.io/ecma262/#sec-object-initializer Parser.prototype.parsePropertyMethod = function (params) { this.context.isAssignmentTarget = false; this.context.isBindingElement = false; var previousStrict = this.context.strict; var previousAllowStrictDirective = this.context.allowStrictDirective; this.context.allowStrictDirective = params.simple; var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); if (this.context.strict && params.firstRestricted) { this.tolerateUnexpectedToken(params.firstRestricted, params.message); } if (this.context.strict && params.stricted) { this.tolerateUnexpectedToken(params.stricted, params.message); } this.context.strict = previousStrict; this.context.allowStrictDirective = previousAllowStrictDirective; return body; }; Parser.prototype.parsePropertyMethodFunction = function () { var isGenerator = false; var node = this.createNode(); var previousAllowYield = this.context.allowYield; this.context.allowYield = false; var params = this.parseFormalParameters(); var method = this.parsePropertyMethod(params); this.context.allowYield = previousAllowYield; return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); }; Parser.prototype.parsePropertyMethodAsyncFunction = function () { var node = this.createNode(); var previousAllowYield = this.context.allowYield; var previousAwait = this.context.await; this.context.allowYield = false; this.context.await = true; var params = this.parseFormalParameters(); var method = this.parsePropertyMethod(params); this.context.allowYield = previousAllowYield; this.context.await = previousAwait; return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); }; Parser.prototype.parseObjectPropertyKey = function () { var node = this.createNode(); var token = this.nextToken(); var key; switch (token.type) { case 8 /* StringLiteral */: case 6 /* NumericLiteral */: if (this.context.strict && token.octal) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); } var raw = this.getTokenRaw(token); key = this.finalize(node, new Node.Literal(token.value, raw)); break; case 3 /* Identifier */: case 1 /* BooleanLiteral */: case 5 /* NullLiteral */: case 4 /* Keyword */: key = this.finalize(node, new Node.Identifier(token.value)); break; case 7 /* Punctuator */: if (token.value === '[') { key = this.isolateCoverGrammar(this.parseAssignmentExpression); this.expect(']'); } else { key = this.throwUnexpectedToken(token); } break; default: key = this.throwUnexpectedToken(token); } return key; }; Parser.prototype.isPropertyKey = function (key, value) { return (key.type === syntax_1.Syntax.Identifier && key.name === value) || (key.type === syntax_1.Syntax.Literal && key.value === value); }; Parser.prototype.parseObjectProperty = function (hasProto) { var node = this.createNode(); var token = this.lookahead; var kind; var key = null; var value = null; var computed = false; var method = false; var shorthand = false; var isAsync = false; if (token.type === 3 /* Identifier */) { var id = token.value; this.nextToken(); computed = this.match('['); isAsync = !this.hasLineTerminator && (id === 'async') && !this.match(':') && !this.match('(') && !this.match('*'); key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); } else if (this.match('*')) { this.nextToken(); } else { computed = this.match('['); key = this.parseObjectPropertyKey(); } var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) { kind = 'get'; computed = this.match('['); key = this.parseObjectPropertyKey(); this.context.allowYield = false; value = this.parseGetterMethod(); } else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) { kind = 'set'; computed = this.match('['); key = this.parseObjectPropertyKey(); value = this.parseSetterMethod(); } else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { kind = 'init'; computed = this.match('['); key = this.parseObjectPropertyKey(); value = this.parseGeneratorMethod(); method = true; } else { if (!key) { this.throwUnexpectedToken(this.lookahead); } kind = 'init'; if (this.match(':') && !isAsync) { if (!computed && this.isPropertyKey(key, '__proto__')) { if (hasProto.value) { this.tolerateError(messages_1.Messages.DuplicateProtoProperty); } hasProto.value = true; } this.nextToken(); value = this.inheritCoverGrammar(this.parseAssignmentExpression); } else if (this.match('(')) { value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); method = true; } else if (token.type === 3 /* Identifier */) { var id = this.finalize(node, new Node.Identifier(token.value)); if (this.match('=')) { this.context.firstCoverInitializedNameError = this.lookahead; this.nextToken(); shorthand = true; var init = this.isolateCoverGrammar(this.parseAssignmentExpression); value = this.finalize(node, new Node.AssignmentPattern(id, init)); } else { shorthand = true; value = id; } } else { this.throwUnexpectedToken(this.nextToken()); } } return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); }; Parser.prototype.parseObjectInitializer = function () { var node = this.createNode(); this.expect('{'); var properties = []; var hasProto = { value: false }; while (!this.match('}')) { properties.push(this.parseObjectProperty(hasProto)); if (!this.match('}')) { this.expectCommaSeparator(); } } this.expect('}'); return this.finalize(node, new Node.ObjectExpression(properties)); }; // https://tc39.github.io/ecma262/#sec-template-literals Parser.prototype.parseTemplateHead = function () { assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); var node = this.createNode(); var token = this.nextToken(); var raw = token.value; var cooked = token.cooked; return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); }; Parser.prototype.parseTemplateElement = function () { if (this.lookahead.type !== 10 /* Template */) { this.throwUnexpectedToken(); } var node = this.createNode(); var token = this.nextToken(); var raw = token.value; var cooked = token.cooked; return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); }; Parser.prototype.parseTemplateLiteral = function () { var node = this.createNode(); var expressions = []; var quasis = []; var quasi = this.parseTemplateHead(); quasis.push(quasi); while (!quasi.tail) { expressions.push(this.parseExpression()); quasi = this.parseTemplateElement(); quasis.push(quasi); } return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); }; // https://tc39.github.io/ecma262/#sec-grouping-operator Parser.prototype.reinterpretExpressionAsPattern = function (expr) { switch (expr.type) { case syntax_1.Syntax.Identifier: case syntax_1.Syntax.MemberExpression: case syntax_1.Syntax.RestElement: case syntax_1.Syntax.AssignmentPattern: break; case syntax_1.Syntax.SpreadElement: expr.type = syntax_1.Syntax.RestElement; this.reinterpretExpressionAsPattern(expr.argument); break; case syntax_1.Syntax.ArrayExpression: expr.type = syntax_1.Syntax.ArrayPattern; for (var i = 0; i < expr.elements.length; i++) { if (expr.elements[i] !== null) { this.reinterpretExpressionAsPattern(expr.elements[i]); } } break; case syntax_1.Syntax.ObjectExpression: expr.type = syntax_1.Syntax.ObjectPattern; for (var i = 0; i < expr.properties.length; i++) { this.reinterpretExpressionAsPattern(expr.properties[i].value); } break; case syntax_1.Syntax.AssignmentExpression: expr.type = syntax_1.Syntax.AssignmentPattern; delete expr.operator; this.reinterpretExpressionAsPattern(expr.left); break; default: // Allow other node type for tolerant parsing. break; } }; Parser.prototype.parseGroupExpression = function () { var expr; this.expect('('); if (this.match(')')) { this.nextToken(); if (!this.match('=>')) { this.expect('=>'); } expr = { type: ArrowParameterPlaceHolder, params: [], async: false }; } else { var startToken = this.lookahead; var params = []; if (this.match('...')) { expr = this.parseRestElement(params); this.expect(')'); if (!this.match('=>')) { this.expect('=>'); } expr = { type: ArrowParameterPlaceHolder, params: [expr], async: false }; } else { var arrow = false; this.context.isBindingElement = true; expr = this.inheritCoverGrammar(this.parseAssignmentExpression); if (this.match(',')) { var expressions = []; this.context.isAssignmentTarget = false; expressions.push(expr); while (this.lookahead.type !== 2 /* EOF */) { if (!this.match(',')) { break; } this.nextToken(); if (this.match(')')) { this.nextToken(); for (var i = 0; i < expressions.length; i++) { this.reinterpretExpressionAsPattern(expressions[i]); } arrow = true; expr = { type: ArrowParameterPlaceHolder, params: expressions, async: false }; } else if (this.match('...')) { if (!this.context.isBindingElement) { this.throwUnexpectedToken(this.lookahead); } expressions.push(this.parseRestElement(params)); this.expect(')'); if (!this.match('=>')) { this.expect('=>'); } this.context.isBindingElement = false; for (var i = 0; i < expressions.length; i++) { this.reinterpretExpressionAsPattern(expressions[i]); } arrow = true; expr = { type: ArrowParameterPlaceHolder, params: expressions, async: false }; } else { expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); } if (arrow) { break; } } if (!arrow) { expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); } } if (!arrow) { this.expect(')'); if (this.match('=>')) { if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { arrow = true; expr = { type: ArrowParameterPlaceHolder, params: [expr], async: false }; } if (!arrow) { if (!this.context.isBindingElement) { this.throwUnexpectedToken(this.lookahead); } if (expr.type === syntax_1.Syntax.SequenceExpression) { for (var i = 0; i < expr.expressions.length; i++) { this.reinterpretExpressionAsPattern(expr.expressions[i]); } } else { this.reinterpretExpressionAsPattern(expr); } var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); expr = { type: ArrowParameterPlaceHolder, params: parameters, async: false }; } } this.context.isBindingElement = false; } } } return expr; }; // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions Parser.prototype.parseArguments = function () { this.expect('('); var args = []; if (!this.match(')')) { while (true) { var expr = this.match('...') ? this.parseSpreadElement() : this.isolateCoverGrammar(this.parseAssignmentExpression); args.push(expr); if (this.match(')')) { break; } this.expectCommaSeparator(); if (this.match(')')) { break; } } } this.expect(')'); return args; }; Parser.prototype.isIdentifierName = function (token) { return token.type === 3 /* Identifier */ || token.type === 4 /* Keyword */ || token.type === 1 /* BooleanLiteral */ || token.type === 5 /* NullLiteral */; }; Parser.prototype.parseIdentifierName = function () { var node = this.createNode(); var token = this.nextToken(); if (!this.isIdentifierName(token)) { this.throwUnexpectedToken(token); } return this.finalize(node, new Node.Identifier(token.value)); }; Parser.prototype.parseNewExpression = function () { var node = this.createNode(); var id = this.parseIdentifierName(); assert_1.assert(id.name === 'new', 'New expression must start with `new`'); var expr; if (this.match('.')) { this.nextToken(); if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') { var property = this.parseIdentifierName(); expr = new Node.MetaProperty(id, property); } else { this.throwUnexpectedToken(this.lookahead); } } else { var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); var args = this.match('(') ? this.parseArguments() : []; expr = new Node.NewExpression(callee, args); this.context.isAssignmentTarget = false; this.context.isBindingElement = false; } return this.finalize(node, expr); }; Parser.prototype.parseAsyncArgument = function () { var arg = this.parseAssignmentExpression(); this.context.firstCoverInitializedNameError = null; return arg; }; Parser.prototype.parseAsyncArguments = function () { this.expect('('); var args = []; if (!this.match(')')) { while (true) { var expr = this.match('...') ? this.parseSpreadElement() : this.isolateCoverGrammar(this.parseAsyncArgument); args.push(expr); if (this.match(')')) { break; } this.expectCommaSeparator(); if (this.match(')')) { break; } } } this.expect(')'); return args; }; Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { var startToken = this.lookahead; var maybeAsync = this.matchContextualKeyword('async'); var previousAllowIn = this.context.allowIn; this.context.allowIn = true; var expr; if (this.matchKeyword('super') && this.context.inFunctionBody) { expr = this.createNode(); this.nextToken(); expr = this.finalize(expr, new Node.Super()); if (!this.match('(') && !this.match('.') && !this.match('[')) { this.throwUnexpectedToken(this.lookahead); } } else { expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); } while (true) { if (this.match('.')) { this.context.isBindingElement = false; this.context.isAssignmentTarget = true; this.expect('.'); var property = this.parseIdentifierName(); expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); } else if (this.match('(')) { var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber); this.context.isBindingElement = false; this.context.isAssignmentTarget = false; var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); if (asyncArrow && this.match('=>')) { for (var i = 0; i < args.length; ++i) { this.reinterpretExpressionAsPattern(args[i]); } expr = { type: ArrowParameterPlaceHolder, params: args, async: true }; } } else if (this.match('[')) { this.context.isBindingElement = false; this.context.isAssignmentTarget = true; this.expect('['); var property = this.isolateCoverGrammar(this.parseExpression); this.expect(']'); expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); } else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { var quasi = this.parseTemplateLiteral(); expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); } else { break; } } this.context.allowIn = previousAllowIn; return expr; }; Parser.prototype.parseSuper = function () { var node = this.createNode(); this.expectKeyword('super'); if (!this.match('[') && !this.match('.')) { this.throwUnexpectedToken(this.lookahead); } return this.finalize(node, new Node.Super()); }; Parser.prototype.parseLeftHandSideExpression = function () { assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); var node = this.startNode(this.lookahead); var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); while (true) { if (this.match('[')) { this.context.isBindingElement = false; this.context.isAssignmentTarget = true; this.expect('['); var property = this.isolateCoverGrammar(this.parseExpression); this.expect(']'); expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); } else if (this.match('.')) { this.context.isBindingElement = false; this.context.isAssignmentTarget = true; this.expect('.'); var property = this.parseIdentifierName(); expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); } else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { var quasi = this.parseTemplateLiteral(); expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); } else { break; } } return expr; }; // https://tc39.github.io/ecma262/#sec-update-expressions Parser.prototype.parseUpdateExpression = function () { var expr; var startToken = this.lookahead; if (this.match('++') || this.match('--')) { var node = this.startNode(startToken); var token = this.nextToken(); expr = this.inheritCoverGrammar(this.parseUnaryExpression); if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { this.tolerateError(messages_1.Messages.StrictLHSPrefix); } if (!this.context.isAssignmentTarget) { this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); } var prefix = true; expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); this.context.isAssignmentTarget = false; this.context.isBindingElement = false; } else { expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) { if (this.match('++') || this.match('--')) { if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { this.tolerateError(messages_1.Messages.StrictLHSPostfix); } if (!this.context.isAssignmentTarget) { this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); } this.context.isAssignmentTarget = false; this.context.isBindingElement = false; var operator = this.nextToken().value; var prefix = false; expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); } } } return expr; }; // https://tc39.github.io/ecma262/#sec-unary-operators Parser.prototype.parseAwaitExpression = function () { var node = this.createNode(); this.nextToken(); var argument = this.parseUnaryExpression(); return this.finalize(node, new Node.AwaitExpression(argument)); }; Parser.prototype.parseUnaryExpression = function () { var expr; if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { var node = this.startNode(this.lookahead); var token = this.nextToken(); expr = this.inheritCoverGrammar(this.parseUnaryExpression); expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { this.tolerateError(messages_1.Messages.StrictDelete); } this.context.isAssignmentTarget = false; this.context.isBindingElement = false; } else if (this.context.await && this.matchContextualKeyword('await')) { expr = this.parseAwaitExpression(); } else { expr = this.parseUpdateExpression(); } return expr; }; Parser.prototype.parseExponentiationExpression = function () { var startToken = this.lookahead; var expr = this.inheritCoverGrammar(this.parseUnaryExpression); if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { this.nextToken(); this.context.isAssignmentTarget = false; this.context.isBindingElement = false; var left = expr; var right = this.isolateCoverGrammar(this.parseExponentiationExpression); expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); } return expr; }; // https://tc39.github.io/ecma262/#sec-exp-operator // https://tc39.github.io/ecma262/#sec-multiplicative-operators // https://tc39.github.io/ecma262/#sec-additive-operators // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators // https://tc39.github.io/ecma262/#sec-relational-operators // https://tc39.github.io/ecma262/#sec-equality-operators // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators // https://tc39.github.io/ecma262/#sec-binary-logical-operators Parser.prototype.binaryPrecedence = function (token) { var op = token.value; var precedence; if (token.type === 7 /* Punctuator */) { precedence = this.operatorPrecedence[op] || 0; } else if (token.type === 4 /* Keyword */) { precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; } else { precedence = 0; } return precedence; }; Parser.prototype.parseBinaryExpression = function () { var startToken = this.lookahead; var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); var token = this.lookahead; var prec = this.binaryPrecedence(token); if (prec > 0) { this.nextToken(); this.context.isAssignmentTarget = false; this.context.isBindingElement = false; var markers = [startToken, this.lookahead]; var left = expr; var right = this.isolateCoverGrammar(this.parseExponentiationExpression); var stack = [left, token.value, right]; var precedences = [prec]; while (true) { prec = this.binaryPrecedence(this.lookahead); if (prec <= 0) { break; } // Reduce: make a binary expression from the three topmost entries. while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) { right = stack.pop(); var operator = stack.pop(); precedences.pop(); left = stack.pop(); markers.pop(); var node = this.startNode(markers[markers.length - 1]); stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); } // Shift. stack.push(this.nextToken().value); precedences.push(prec); markers.push(this.lookahead); stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); } // Final reduce to clean-up the stack. var i = stack.length - 1; expr = stack[i]; markers.pop(); while (i > 1) { var node = this.startNode(markers.pop()); var operator = stack[i - 1]; expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); i -= 2; } } return expr; }; // https://tc39.github.io/ecma262/#sec-conditional-operator Parser.prototype.parseConditionalExpression = function () { var startToken = this.lookahead; var expr = this.inheritCoverGrammar(this.parseBinaryExpression); if (this.match('?')) { this.nextToken(); var previousAllowIn = this.context.allowIn; this.context.allowIn = true; var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); this.context.allowIn = previousAllowIn; this.expect(':'); var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); this.context.isAssignmentTarget = false; this.context.isBindingElement = false; } return expr; }; // https://tc39.github.io/ecma262/#sec-assignment-operators Parser.prototype.checkPatternParam = function (options, param) { switch (param.type) { case syntax_1.Syntax.Identifier: this.validateParam(options, param, param.name); break; case syntax_1.Syntax.RestElement: this.checkPatternParam(options, param.argument); break; case syntax_1.Syntax.AssignmentPattern: this.checkPatternParam(options, param.left); break; case syntax_1.Syntax.ArrayPattern: for (var i = 0; i < param.elements.length; i++) { if (param.elements[i] !== null) { this.checkPatternParam(options, param.elements[i]); } } break; case syntax_1.Syntax.ObjectPattern: for (var i = 0; i < param.properties.length; i++) { this.checkPatternParam(options, param.properties[i].value); } break; default: break; } options.simple = options.simple && (param instanceof Node.Identifier); }; Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { var params = [expr]; var options; var asyncArrow = false; switch (expr.type) { case syntax_1.Syntax.Identifier: break; case ArrowParameterPlaceHolder: params = expr.params; asyncArrow = expr.async; break; default: return null; } options = { simple: true, paramSet: {} }; for (var i = 0; i < params.length; ++i) { var param = params[i]; if (param.type === syntax_1.Syntax.AssignmentPattern) { if (param.right.type === syntax_1.Syntax.YieldExpression) { if (param.right.argument) { this.throwUnexpectedToken(this.lookahead); } param.right.type = syntax_1.Syntax.Identifier; param.right.name = 'yield'; delete param.right.argument; delete param.right.delegate; } } else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { this.throwUnexpectedToken(this.lookahead); } this.checkPatternParam(options, param); params[i] = param; } if (this.context.strict || !this.context.allowYield) { for (var i = 0; i < params.length; ++i) { var param = params[i]; if (param.type === syntax_1.Syntax.YieldExpression) { this.throwUnexpectedToken(this.lookahead); } } } if (options.message === messages_1.Messages.StrictParamDupe) { var token = this.context.strict ? options.stricted : options.firstRestricted; this.throwUnexpectedToken(token, options.message); } return { simple: options.simple, params: params, stricted: options.stricted, firstRestricted: options.firstRestricted, message: options.message }; }; Parser.prototype.parseAssignmentExpression = function () { var expr; if (!this.context.allowYield && this.matchKeyword('yield')) { expr = this.parseYieldExpression(); } else { var startToken = this.lookahead; var token = startToken; expr = this.parseConditionalExpression(); if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) { var arg = this.parsePrimaryExpression(); this.reinterpretExpressionAsPattern(arg); expr = { type: ArrowParameterPlaceHolder, params: [arg], async: true }; } } if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { // https://tc39.github.io/ecma262/#sec-arrow-function-definitions this.context.isAssignmentTarget = false; this.context.isBindingElement = false; var isAsync = expr.async; var list = this.reinterpretAsCoverFormalsList(expr); if (list) { if (this.hasLineTerminator) { this.tolerateUnexpectedToken(this.lookahead); } this.context.firstCoverInitializedNameError = null; var previousStrict = this.context.strict; var previousAllowStrictDirective = this.context.allowStrictDirective; this.context.allowStrictDirective = list.simple; var previousAllowYield = this.context.allowYield; var previousAwait = this.context.await; this.context.allowYield = true; this.context.await = isAsync; var node = this.startNode(startToken); this.expect('=>'); var body = void 0; if (this.match('{')) { var previousAllowIn = this.context.allowIn; this.context.allowIn = true; body = this.parseFunctionSourceElements(); this.context.allowIn = previousAllowIn; } else { body = this.isolateCoverGrammar(this.parseAssignmentExpression); } var expression = body.type !== syntax_1.Syntax.BlockStatement; if (this.context.strict && list.firstRestricted) { this.throwUnexpectedToken(list.firstRestricted, list.message); } if (this.context.strict && list.stricted) { this.tolerateUnexpectedToken(list.stricted, list.message); } expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); this.context.strict = previousStrict; this.context.allowStrictDirective = previousAllowStrictDirective; this.context.allowYield = previousAllowYield; this.context.await = previousAwait; } } else { if (this.matchAssign()) { if (!this.context.isAssignmentTarget) { this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); } if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { var id = expr; if (this.scanner.isRestrictedWord(id.name)) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); } if (this.scanner.isStrictModeReservedWord(id.name)) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); } } if (!this.match('=')) { this.context.isAssignmentTarget = false; this.context.isBindingElement = false; } else { this.reinterpretExpressionAsPattern(expr); } token = this.nextToken(); var operator = token.value; var right = this.isolateCoverGrammar(this.parseAssignmentExpression); expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); this.context.firstCoverInitializedNameError = null; } } } return expr; }; // https://tc39.github.io/ecma262/#sec-comma-operator Parser.prototype.parseExpression = function () { var startToken = this.lookahead; var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); if (this.match(',')) { var expressions = []; expressions.push(expr); while (this.lookahead.type !== 2 /* EOF */) { if (!this.match(',')) { break; } this.nextToken(); expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); } expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); } return expr; }; // https://tc39.github.io/ecma262/#sec-block Parser.prototype.parseStatementListItem = function () { var statement; this.context.isAssignmentTarget = true; this.context.isBindingElement = true; if (this.lookahead.type === 4 /* Keyword */) { switch (this.lookahead.value) { case 'export': if (!this.context.isModule) { this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); } statement = this.parseExportDeclaration(); break; case 'import': if (!this.context.isModule) { this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); } statement = this.parseImportDeclaration(); break; case 'const': statement = this.parseLexicalDeclaration({ inFor: false }); break; case 'function': statement = this.parseFunctionDeclaration(); break; case 'class': statement = this.parseClassDeclaration(); break; case 'let': statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); break; default: statement = this.parseStatement(); break; } } else { statement = this.parseStatement(); } return statement; }; Parser.prototype.parseBlock = function () { var node = this.createNode(); this.expect('{'); var block = []; while (true) { if (this.match('}')) { break; } block.push(this.parseStatementListItem()); } this.expect('}'); return this.finalize(node, new Node.BlockStatement(block)); }; // https://tc39.github.io/ecma262/#sec-let-and-const-declarations Parser.prototype.parseLexicalBinding = function (kind, options) { var node = this.createNode(); var params = []; var id = this.parsePattern(params, kind); if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { if (this.scanner.isRestrictedWord(id.name)) { this.tolerateError(messages_1.Messages.StrictVarName); } } var init = null; if (kind === 'const') { if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { if (this.match('=')) { this.nextToken(); init = this.isolateCoverGrammar(this.parseAssignmentExpression); } else { this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); } } } else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { this.expect('='); init = this.isolateCoverGrammar(this.parseAssignmentExpression); } return this.finalize(node, new Node.VariableDeclarator(id, init)); }; Parser.prototype.parseBindingList = function (kind, options) { var list = [this.parseLexicalBinding(kind, options)]; while (this.match(',')) { this.nextToken(); list.push(this.parseLexicalBinding(kind, options)); } return list; }; Parser.prototype.isLexicalDeclaration = function () { var state = this.scanner.saveState(); this.scanner.scanComments(); var next = this.scanner.lex(); this.scanner.restoreState(state); return (next.type === 3 /* Identifier */) || (next.type === 7 /* Punctuator */ && next.value === '[') || (next.type === 7 /* Punctuator */ && next.value === '{') || (next.type === 4 /* Keyword */ && next.value === 'let') || (next.type === 4 /* Keyword */ && next.value === 'yield'); }; Parser.prototype.parseLexicalDeclaration = function (options) { var node = this.createNode(); var kind = this.nextToken().value; assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); var declarations = this.parseBindingList(kind, options); this.consumeSemicolon(); return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); }; // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns Parser.prototype.parseBindingRestElement = function (params, kind) { var node = this.createNode(); this.expect('...'); var arg = this.parsePattern(params, kind); return this.finalize(node, new Node.RestElement(arg)); }; Parser.prototype.parseArrayPattern = function (params, kind) { var node = this.createNode(); this.expect('['); var elements = []; while (!this.match(']')) { if (this.match(',')) { this.nextToken(); elements.push(null); } else { if (this.match('...')) { elements.push(this.parseBindingRestElement(params, kind)); break; } else { elements.push(this.parsePatternWithDefault(params, kind)); } if (!this.match(']')) { this.expect(','); } } } this.expect(']'); return this.finalize(node, new Node.ArrayPattern(elements)); }; Parser.prototype.parsePropertyPattern = function (params, kind) { var node = this.createNode(); var computed = false; var shorthand = false; var method = false; var key; var value; if (this.lookahead.type === 3 /* Identifier */) { var keyToken = this.lookahead; key = this.parseVariableIdentifier(); var init = this.finalize(node, new Node.Identifier(keyToken.value)); if (this.match('=')) { params.push(keyToken); shorthand = true; this.nextToken(); var expr = this.parseAssignmentExpression(); value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); } else if (!this.match(':')) { params.push(keyToken); shorthand = true; value = init; } else { this.expect(':'); value = this.parsePatternWithDefault(params, kind); } } else { computed = this.match('['); key = this.parseObjectPropertyKey(); this.expect(':'); value = this.parsePatternWithDefault(params, kind); } return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); }; Parser.prototype.parseObjectPattern = function (params, kind) { var node = this.createNode(); var properties = []; this.expect('{'); while (!this.match('}')) { properties.push(this.parsePropertyPattern(params, kind)); if (!this.match('}')) { this.expect(','); } } this.expect('}'); return this.finalize(node, new Node.ObjectPattern(properties)); }; Parser.prototype.parsePattern = function (params, kind) { var pattern; if (this.match('[')) { pattern = this.parseArrayPattern(params, kind); } else if (this.match('{')) { pattern = this.parseObjectPattern(params, kind); } else { if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); } params.push(this.lookahead); pattern = this.parseVariableIdentifier(kind); } return pattern; }; Parser.prototype.parsePatternWithDefault = function (params, kind) { var startToken = this.lookahead; var pattern = this.parsePattern(params, kind); if (this.match('=')) { this.nextToken(); var previousAllowYield = this.context.allowYield; this.context.allowYield = true; var right = this.isolateCoverGrammar(this.parseAssignmentExpression); this.context.allowYield = previousAllowYield; pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); } return pattern; }; // https://tc39.github.io/ecma262/#sec-variable-statement Parser.prototype.parseVariableIdentifier = function (kind) { var node = this.createNode(); var token = this.nextToken(); if (token.type === 4 /* Keyword */ && token.value === 'yield') { if (this.context.strict) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); } else if (!this.context.allowYield) { this.throwUnexpectedToken(token); } } else if (token.type !== 3 /* Identifier */) { if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); } else { if (this.context.strict || token.value !== 'let' || kind !== 'var') { this.throwUnexpectedToken(token); } } } else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') { this.tolerateUnexpectedToken(token); } return this.finalize(node, new Node.Identifier(token.value)); }; Parser.prototype.parseVariableDeclaration = function (options) { var node = this.createNode(); var params = []; var id = this.parsePattern(params, 'var'); if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { if (this.scanner.isRestrictedWord(id.name)) { this.tolerateError(messages_1.Messages.StrictVarName); } } var init = null; if (this.match('=')) { this.nextToken(); init = this.isolateCoverGrammar(this.parseAssignmentExpression); } else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { this.expect('='); } return this.finalize(node, new Node.VariableDeclarator(id, init)); }; Parser.prototype.parseVariableDeclarationList = function (options) { var opt = { inFor: options.inFor }; var list = []; list.push(this.parseVariableDeclaration(opt)); while (this.match(',')) { this.nextToken(); list.push(this.parseVariableDeclaration(opt)); } return list; }; Parser.prototype.parseVariableStatement = function () { var node = this.createNode(); this.expectKeyword('var'); var declarations = this.parseVariableDeclarationList({ inFor: false }); this.consumeSemicolon(); return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); }; // https://tc39.github.io/ecma262/#sec-empty-statement Parser.prototype.parseEmptyStatement = function () { var node = this.createNode(); this.expect(';'); return this.finalize(node, new Node.EmptyStatement()); }; // https://tc39.github.io/ecma262/#sec-expression-statement Parser.prototype.parseExpressionStatement = function () { var node = this.createNode(); var expr = this.parseExpression(); this.consumeSemicolon(); return this.finalize(node, new Node.ExpressionStatement(expr)); }; // https://tc39.github.io/ecma262/#sec-if-statement Parser.prototype.parseIfClause = function () { if (this.context.strict && this.matchKeyword('function')) { this.tolerateError(messages_1.Messages.StrictFunction); } return this.parseStatement(); }; Parser.prototype.parseIfStatement = function () { var node = this.createNode(); var consequent; var alternate = null; this.expectKeyword('if'); this.expect('('); var test = this.parseExpression(); if (!this.match(')') && this.config.tolerant) { this.tolerateUnexpectedToken(this.nextToken()); consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); } else { this.expect(')'); consequent = this.parseIfClause(); if (this.matchKeyword('else')) { this.nextToken(); alternate = this.parseIfClause(); } } return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); }; // https://tc39.github.io/ecma262/#sec-do-while-statement Parser.prototype.parseDoWhileStatement = function () { var node = this.createNode(); this.expectKeyword('do'); var previousInIteration = this.context.inIteration; this.context.inIteration = true; var body = this.parseStatement(); this.context.inIteration = previousInIteration; this.expectKeyword('while'); this.expect('('); var test = this.parseExpression(); if (!this.match(')') && this.config.tolerant) { this.tolerateUnexpectedToken(this.nextToken()); } else { this.expect(')'); if (this.match(';')) { this.nextToken(); } } return this.finalize(node, new Node.DoWhileStatement(body, test)); }; // https://tc39.github.io/ecma262/#sec-while-statement Parser.prototype.parseWhileStatement = function () { var node = this.createNode(); var body; this.expectKeyword('while'); this.expect('('); var test = this.parseExpression(); if (!this.match(')') && this.config.tolerant) { this.tolerateUnexpectedToken(this.nextToken()); body = this.finalize(this.createNode(), new Node.EmptyStatement()); } else { this.expect(')'); var previousInIteration = this.context.inIteration; this.context.inIteration = true; body = this.parseStatement(); this.context.inIteration = previousInIteration; } return this.finalize(node, new Node.WhileStatement(test, body)); }; // https://tc39.github.io/ecma262/#sec-for-statement // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements Parser.prototype.parseForStatement = function () { var init = null; var test = null; var update = null; var forIn = true; var left, right; var node = this.createNode(); this.expectKeyword('for'); this.expect('('); if (this.match(';')) { this.nextToken(); } else { if (this.matchKeyword('var')) { init = this.createNode(); this.nextToken(); var previousAllowIn = this.context.allowIn; this.context.allowIn = false; var declarations = this.parseVariableDeclarationList({ inFor: true }); this.context.allowIn = previousAllowIn; if (declarations.length === 1 && this.matchKeyword('in')) { var decl = declarations[0]; if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); } init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); this.nextToken(); left = init; right = this.parseExpression(); init = null; } else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); this.nextToken(); left = init; right = this.parseAssignmentExpression(); init = null; forIn = false; } else { init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); this.expect(';'); } } else if (this.matchKeyword('const') || this.matchKeyword('let')) { init = this.createNode(); var kind = this.nextToken().value; if (!this.context.strict && this.lookahead.value === 'in') { init = this.finalize(init, new Node.Identifier(kind)); this.nextToken(); left = init; right = this.parseExpression(); init = null; } else { var previousAllowIn = this.context.allowIn; this.context.allowIn = false; var declarations = this.parseBindingList(kind, { inFor: true }); this.context.allowIn = previousAllowIn; if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); this.nextToken(); left = init; right = this.parseExpression(); init = null; } else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); this.nextToken(); left = init; right = this.parseAssignmentExpression(); init = null; forIn = false; } else { this.consumeSemicolon(); init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); } } } else { var initStartToken = this.lookahead; var previousAllowIn = this.context.allowIn; this.context.allowIn = false; init = this.inheritCoverGrammar(this.parseAssignmentExpression); this.context.allowIn = previousAllowIn; if (this.matchKeyword('in')) { if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { this.tolerateError(messages_1.Messages.InvalidLHSInForIn); } this.nextToken(); this.reinterpretExpressionAsPattern(init); left = init; right = this.parseExpression(); init = null; } else if (this.matchContextualKeyword('of')) { if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); } this.nextToken(); this.reinterpretExpressionAsPattern(init); left = init; right = this.parseAssignmentExpression(); init = null; forIn = false; } else { if (this.match(',')) { var initSeq = [init]; while (this.match(',')) { this.nextToken(); initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); } init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); } this.expect(';'); } } } if (typeof left === 'undefined') { if (!this.match(';')) { test = this.parseExpression(); } this.expect(';'); if (!this.match(')')) { update = this.parseExpression(); } } var body; if (!this.match(')') && this.config.tolerant) { this.tolerateUnexpectedToken(this.nextToken()); body = this.finalize(this.createNode(), new Node.EmptyStatement()); } else { this.expect(')'); var previousInIteration = this.context.inIteration; this.context.inIteration = true; body = this.isolateCoverGrammar(this.parseStatement); this.context.inIteration = previousInIteration; } return (typeof left === 'undefined') ? this.finalize(node, new Node.ForStatement(init, test, update, body)) : forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : this.finalize(node, new Node.ForOfStatement(left, right, body)); }; // https://tc39.github.io/ecma262/#sec-continue-statement Parser.prototype.parseContinueStatement = function () { var node = this.createNode(); this.expectKeyword('continue'); var label = null; if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { var id = this.parseVariableIdentifier(); label = id; var key = '$' + id.name; if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { this.throwError(messages_1.Messages.UnknownLabel, id.name); } } this.consumeSemicolon(); if (label === null && !this.context.inIteration) { this.throwError(messages_1.Messages.IllegalContinue); } return this.finalize(node, new Node.ContinueStatement(label)); }; // https://tc39.github.io/ecma262/#sec-break-statement Parser.prototype.parseBreakStatement = function () { var node = this.createNode(); this.expectKeyword('break'); var label = null; if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { var id = this.parseVariableIdentifier(); var key = '$' + id.name; if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { this.throwError(messages_1.Messages.UnknownLabel, id.name); } label = id; } this.consumeSemicolon(); if (label === null && !this.context.inIteration && !this.context.inSwitch) { this.throwError(messages_1.Messages.IllegalBreak); } return this.finalize(node, new Node.BreakStatement(label)); }; // https://tc39.github.io/ecma262/#sec-return-statement Parser.prototype.parseReturnStatement = function () { if (!this.context.inFunctionBody) { this.tolerateError(messages_1.Messages.IllegalReturn); } var node = this.createNode(); this.expectKeyword('return'); var hasArgument = !this.match(';') && !this.match('}') && !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */; var argument = hasArgument ? this.parseExpression() : null; this.consumeSemicolon(); return this.finalize(node, new Node.ReturnStatement(argument)); }; // https://tc39.github.io/ecma262/#sec-with-statement Parser.prototype.parseWithStatement = function () { if (this.context.strict) { this.tolerateError(messages_1.Messages.StrictModeWith); } var node = this.createNode(); var body; this.expectKeyword('with'); this.expect('('); var object = this.parseExpression(); if (!this.match(')') && this.config.tolerant) { this.tolerateUnexpectedToken(this.nextToken()); body = this.finalize(this.createNode(), new Node.EmptyStatement()); } else { this.expect(')'); body = this.parseStatement(); } return this.finalize(node, new Node.WithStatement(object, body)); }; // https://tc39.github.io/ecma262/#sec-switch-statement Parser.prototype.parseSwitchCase = function () { var node = this.createNode(); var test; if (this.matchKeyword('default')) { this.nextToken(); test = null; } else { this.expectKeyword('case'); test = this.parseExpression(); } this.expect(':'); var consequent = []; while (true) { if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { break; } consequent.push(this.parseStatementListItem()); } return this.finalize(node, new Node.SwitchCase(test, consequent)); }; Parser.prototype.parseSwitchStatement = function () { var node = this.createNode(); this.expectKeyword('switch'); this.expect('('); var discriminant = this.parseExpression(); this.expect(')'); var previousInSwitch = this.context.inSwitch; this.context.inSwitch = true; var cases = []; var defaultFound = false; this.expect('{'); while (true) { if (this.match('}')) { break; } var clause = this.parseSwitchCase(); if (clause.test === null) { if (defaultFound) { this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); } defaultFound = true; } cases.push(clause); } this.expect('}'); this.context.inSwitch = previousInSwitch; return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); }; // https://tc39.github.io/ecma262/#sec-labelled-statements Parser.prototype.parseLabelledStatement = function () { var node = this.createNode(); var expr = this.parseExpression(); var statement; if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { this.nextToken(); var id = expr; var key = '$' + id.name; if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); } this.context.labelSet[key] = true; var body = void 0; if (this.matchKeyword('class')) { this.tolerateUnexpectedToken(this.lookahead); body = this.parseClassDeclaration(); } else if (this.matchKeyword('function')) { var token = this.lookahead; var declaration = this.parseFunctionDeclaration(); if (this.context.strict) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); } else if (declaration.generator) { this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); } body = declaration; } else { body = this.parseStatement(); } delete this.context.labelSet[key]; statement = new Node.LabeledStatement(id, body); } else { this.consumeSemicolon(); statement = new Node.ExpressionStatement(expr); } return this.finalize(node, statement); }; // https://tc39.github.io/ecma262/#sec-throw-statement Parser.prototype.parseThrowStatement = function () { var node = this.createNode(); this.expectKeyword('throw'); if (this.hasLineTerminator) { this.throwError(messages_1.Messages.NewlineAfterThrow); } var argument = this.parseExpression(); this.consumeSemicolon(); return this.finalize(node, new Node.ThrowStatement(argument)); }; // https://tc39.github.io/ecma262/#sec-try-statement Parser.prototype.parseCatchClause = function () { var node = this.createNode(); this.expectKeyword('catch'); this.expect('('); if (this.match(')')) { this.throwUnexpectedToken(this.lookahead); } var params = []; var param = this.parsePattern(params); var paramMap = {}; for (var i = 0; i < params.length; i++) { var key = '$' + params[i].value; if (Object.prototype.hasOwnProperty.call(paramMap, key)) { this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); } paramMap[key] = true; } if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { if (this.scanner.isRestrictedWord(param.name)) { this.tolerateError(messages_1.Messages.StrictCatchVariable); } } this.expect(')'); var body = this.parseBlock(); return this.finalize(node, new Node.CatchClause(param, body)); }; Parser.prototype.parseFinallyClause = function () { this.expectKeyword('finally'); return this.parseBlock(); }; Parser.prototype.parseTryStatement = function () { var node = this.createNode(); this.expectKeyword('try'); var block = this.parseBlock(); var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; if (!handler && !finalizer) { this.throwError(messages_1.Messages.NoCatchOrFinally); } return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); }; // https://tc39.github.io/ecma262/#sec-debugger-statement Parser.prototype.parseDebuggerStatement = function () { var node = this.createNode(); this.expectKeyword('debugger'); this.consumeSemicolon(); return this.finalize(node, new Node.DebuggerStatement()); }; // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations Parser.prototype.parseStatement = function () { var statement; switch (this.lookahead.type) { case 1 /* BooleanLiteral */: case 5 /* NullLiteral */: case 6 /* NumericLiteral */: case 8 /* StringLiteral */: case 10 /* Template */: case 9 /* RegularExpression */: statement = this.parseExpressionStatement(); break; case 7 /* Punctuator */: var value = this.lookahead.value; if (value === '{') { statement = this.parseBlock(); } else if (value === '(') { statement = this.parseExpressionStatement(); } else if (value === ';') { statement = this.parseEmptyStatement(); } else { statement = this.parseExpressionStatement(); } break; case 3 /* Identifier */: statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); break; case 4 /* Keyword */: switch (this.lookahead.value) { case 'break': statement = this.parseBreakStatement(); break; case 'continue': statement = this.parseContinueStatement(); break; case 'debugger': statement = this.parseDebuggerStatement(); break; case 'do': statement = this.parseDoWhileStatement(); break; case 'for': statement = this.parseForStatement(); break; case 'function': statement = this.parseFunctionDeclaration(); break; case 'if': statement = this.parseIfStatement(); break; case 'return': statement = this.parseReturnStatement(); break; case 'switch': statement = this.parseSwitchStatement(); break; case 'throw': statement = this.parseThrowStatement(); break; case 'try': statement = this.parseTryStatement(); break; case 'var': statement = this.parseVariableStatement(); break; case 'while': statement = this.parseWhileStatement(); break; case 'with': statement = this.parseWithStatement(); break; default: statement = this.parseExpressionStatement(); break; } break; default: statement = this.throwUnexpectedToken(this.lookahead); } return statement; }; // https://tc39.github.io/ecma262/#sec-function-definitions Parser.prototype.parseFunctionSourceElements = function () { var node = this.createNode(); this.expect('{'); var body = this.parseDirectivePrologues(); var previousLabelSet = this.context.labelSet; var previousInIteration = this.context.inIteration; var previousInSwitch = this.context.inSwitch; var previousInFunctionBody = this.context.inFunctionBody; this.context.labelSet = {}; this.context.inIteration = false; this.context.inSwitch = false; this.context.inFunctionBody = true; while (this.lookahead.type !== 2 /* EOF */) { if (this.match('}')) { break; } body.push(this.parseStatementListItem()); } this.expect('}'); this.context.labelSet = previousLabelSet; this.context.inIteration = previousInIteration; this.context.inSwitch = previousInSwitch; this.context.inFunctionBody = previousInFunctionBody; return this.finalize(node, new Node.BlockStatement(body)); }; Parser.prototype.validateParam = function (options, param, name) { var key = '$' + name; if (this.context.strict) { if (this.scanner.isRestrictedWord(name)) { options.stricted = param; options.message = messages_1.Messages.StrictParamName; } if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { options.stricted = param; options.message = messages_1.Messages.StrictParamDupe; } } else if (!options.firstRestricted) { if (this.scanner.isRestrictedWord(name)) { options.firstRestricted = param; options.message = messages_1.Messages.StrictParamName; } else if (this.scanner.isStrictModeReservedWord(name)) { options.firstRestricted = param; options.message = messages_1.Messages.StrictReservedWord; } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { options.stricted = param; options.message = messages_1.Messages.StrictParamDupe; } } /* istanbul ignore next */ if (typeof Object.defineProperty === 'function') { Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); } else { options.paramSet[key] = true; } }; Parser.prototype.parseRestElement = function (params) { var node = this.createNode(); this.expect('...'); var arg = this.parsePattern(params); if (this.match('=')) { this.throwError(messages_1.Messages.DefaultRestParameter); } if (!this.match(')')) { this.throwError(messages_1.Messages.ParameterAfterRestParameter); } return this.finalize(node, new Node.RestElement(arg)); }; Parser.prototype.parseFormalParameter = function (options) { var params = []; var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); for (var i = 0; i < params.length; i++) { this.validateParam(options, params[i], params[i].value); } options.simple = options.simple && (param instanceof Node.Identifier); options.params.push(param); }; Parser.prototype.parseFormalParameters = function (firstRestricted) { var options; options = { simple: true, params: [], firstRestricted: firstRestricted }; this.expect('('); if (!this.match(')')) { options.paramSet = {}; while (this.lookahead.type !== 2 /* EOF */) { this.parseFormalParameter(options); if (this.match(')')) { break; } this.expect(','); if (this.match(')')) { break; } } } this.expect(')'); return { simple: options.simple, params: options.params, stricted: options.stricted, firstRestricted: options.firstRestricted, message: options.message }; }; Parser.prototype.matchAsyncFunction = function () { var match = this.matchContextualKeyword('async'); if (match) { var state = this.scanner.saveState(); this.scanner.scanComments(); var next = this.scanner.lex(); this.scanner.restoreState(state); match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function'); } return match; }; Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { var node = this.createNode(); var isAsync = this.matchContextualKeyword('async'); if (isAsync) { this.nextToken(); } this.expectKeyword('function'); var isGenerator = isAsync ? false : this.match('*'); if (isGenerator) { this.nextToken(); } var message; var id = null; var firstRestricted = null; if (!identifierIsOptional || !this.match('(')) { var token = this.lookahead; id = this.parseVariableIdentifier(); if (this.context.strict) { if (this.scanner.isRestrictedWord(token.value)) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); } } else { if (this.scanner.isRestrictedWord(token.value)) { firstRestricted = token; message = messages_1.Messages.StrictFunctionName; } else if (this.scanner.isStrictModeReservedWord(token.value)) { firstRestricted = token; message = messages_1.Messages.StrictReservedWord; } } } var previousAllowAwait = this.context.await; var previousAllowYield = this.context.allowYield; this.context.await = isAsync; this.context.allowYield = !isGenerator; var formalParameters = this.parseFormalParameters(firstRestricted); var params = formalParameters.params; var stricted = formalParameters.stricted; firstRestricted = formalParameters.firstRestricted; if (formalParameters.message) { message = formalParameters.message; } var previousStrict = this.context.strict; var previousAllowStrictDirective = this.context.allowStrictDirective; this.context.allowStrictDirective = formalParameters.simple; var body = this.parseFunctionSourceElements(); if (this.context.strict && firstRestricted) { this.throwUnexpectedToken(firstRestricted, message); } if (this.context.strict && stricted) { this.tolerateUnexpectedToken(stricted, message); } this.context.strict = previousStrict; this.context.allowStrictDirective = previousAllowStrictDirective; this.context.await = previousAllowAwait; this.context.allowYield = previousAllowYield; return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); }; Parser.prototype.parseFunctionExpression = function () { var node = this.createNode(); var isAsync = this.matchContextualKeyword('async'); if (isAsync) { this.nextToken(); } this.expectKeyword('function'); var isGenerator = isAsync ? false : this.match('*'); if (isGenerator) { this.nextToken(); } var message; var id = null; var firstRestricted; var previousAllowAwait = this.context.await; var previousAllowYield = this.context.allowYield; this.context.await = isAsync; this.context.allowYield = !isGenerator; if (!this.match('(')) { var token = this.lookahead; id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); if (this.context.strict) { if (this.scanner.isRestrictedWord(token.value)) { this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); } } else { if (this.scanner.isRestrictedWord(token.value)) { firstRestricted = token; message = messages_1.Messages.StrictFunctionName; } else if (this.scanner.isStrictModeReservedWord(token.value)) { firstRestricted = token; message = messages_1.Messages.StrictReservedWord; } } } var formalParameters = this.parseFormalParameters(firstRestricted); var params = formalParameters.params; var stricted = formalParameters.stricted; firstRestricted = formalParameters.firstRestricted; if (formalParameters.message) { message = formalParameters.message; } var previousStrict = this.context.strict; var previousAllowStrictDirective = this.context.allowStrictDirective; this.context.allowStrictDirective = formalParameters.simple; var body = this.parseFunctionSourceElements(); if (this.context.strict && firstRestricted) { this.throwUnexpectedToken(firstRestricted, message); } if (this.context.strict && stricted) { this.tolerateUnexpectedToken(stricted, message); } this.context.strict = previousStrict; this.context.allowStrictDirective = previousAllowStrictDirective; this.context.await = previousAllowAwait; this.context.allowYield = previousAllowYield; return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); }; // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive Parser.prototype.parseDirective = function () { var token = this.lookahead; var node = this.createNode(); var expr = this.parseExpression(); var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null; this.consumeSemicolon(); return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); }; Parser.prototype.parseDirectivePrologues = function () { var firstRestricted = null; var body = []; while (true) { var token = this.lookahead; if (token.type !== 8 /* StringLiteral */) { break; } var statement = this.parseDirective(); body.push(statement); var directive = statement.directive; if (typeof directive !== 'string') { break; } if (directive === 'use strict') { this.context.strict = true; if (firstRestricted) { this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); } if (!this.context.allowStrictDirective) { this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); } } else { if (!firstRestricted && token.octal) { firstRestricted = token; } } } return body; }; // https://tc39.github.io/ecma262/#sec-method-definitions Parser.prototype.qualifiedPropertyName = function (token) { switch (token.type) { case 3 /* Identifier */: case 8 /* StringLiteral */: case 1 /* BooleanLiteral */: case 5 /* NullLiteral */: case 6 /* NumericLiteral */: case 4 /* Keyword */: return true; case 7 /* Punctuator */: return token.value === '['; default: break; } return false; }; Parser.prototype.parseGetterMethod = function () { var node = this.createNode(); var isGenerator = false; var previousAllowYield = this.context.allowYield; this.context.allowYield = false; var formalParameters = this.parseFormalParameters(); if (formalParameters.params.length > 0) { this.tolerateError(messages_1.Messages.BadGetterArity); } var method = this.parsePropertyMethod(formalParameters); this.context.allowYield = previousAllowYield; return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); }; Parser.prototype.parseSetterMethod = function () { var node = this.createNode(); var isGenerator = false; var previousAllowYield = this.context.allowYield; this.context.allowYield = false; var formalParameters = this.parseFormalParameters(); if (formalParameters.params.length !== 1) { this.tolerateError(messages_1.Messages.BadSetterArity); } else if (formalParameters.params[0] instanceof Node.RestElement) { this.tolerateError(messages_1.Messages.BadSetterRestParameter); } var method = this.parsePropertyMethod(formalParameters); this.context.allowYield = previousAllowYield; return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); }; Parser.prototype.parseGeneratorMethod = function () { var node = this.createNode(); var isGenerator = true; var previousAllowYield = this.context.allowYield; this.context.allowYield = true; var params = this.parseFormalParameters(); this.context.allowYield = false; var method = this.parsePropertyMethod(params); this.context.allowYield = previousAllowYield; return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); }; // https://tc39.github.io/ecma262/#sec-generator-function-definitions Parser.prototype.isStartOfExpression = function () { var start = true; var value = this.lookahead.value; switch (this.lookahead.type) { case 7 /* Punctuator */: start = (value === '[') || (value === '(') || (value === '{') || (value === '+') || (value === '-') || (value === '!') || (value === '~') || (value === '++') || (value === '--') || (value === '/') || (value === '/='); // regular expression literal break; case 4 /* Keyword */: start = (value === 'class') || (value === 'delete') || (value === 'function') || (value === 'let') || (value === 'new') || (value === 'super') || (value === 'this') || (value === 'typeof') || (value === 'void') || (value === 'yield'); break; default: break; } return start; }; Parser.prototype.parseYieldExpression = function () { var node = this.createNode(); this.expectKeyword('yield'); var argument = null; var delegate = false; if (!this.hasLineTerminator) { var previousAllowYield = this.context.allowYield; this.context.allowYield = false; delegate = this.match('*'); if (delegate) { this.nextToken(); argument = this.parseAssignmentExpression(); } else if (this.isStartOfExpression()) { argument = this.parseAssignmentExpression(); } this.context.allowYield = previousAllowYield; } return this.finalize(node, new Node.YieldExpression(argument, delegate)); }; // https://tc39.github.io/ecma262/#sec-class-definitions Parser.prototype.parseClassElement = function (hasConstructor) { var token = this.lookahead; var node = this.createNode(); var kind = ''; var key = null; var value = null; var computed = false; var method = false; var isStatic = false; var isAsync = false; if (this.match('*')) { this.nextToken(); } else { computed = this.match('['); key = this.parseObjectPropertyKey(); var id = key; if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { token = this.lookahead; isStatic = true; computed = this.match('['); if (this.match('*')) { this.nextToken(); } else { key = this.parseObjectPropertyKey(); } } if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) { var punctuator = this.lookahead.value; if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { isAsync = true; token = this.lookahead; key = this.parseObjectPropertyKey(); if (token.type === 3 /* Identifier */) { if (token.value === 'get' || token.value === 'set') { this.tolerateUnexpectedToken(token); } else if (token.value === 'constructor') { this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); } } } } } var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); if (token.type === 3 /* Identifier */) { if (token.value === 'get' && lookaheadPropertyKey) { kind = 'get'; computed = this.match('['); key = this.parseObjectPropertyKey(); this.context.allowYield = false; value = this.parseGetterMethod(); } else if (token.value === 'set' && lookaheadPropertyKey) { kind = 'set'; computed = this.match('['); key = this.parseObjectPropertyKey(); value = this.parseSetterMethod(); } } else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { kind = 'init'; computed = this.match('['); key = this.parseObjectPropertyKey(); value = this.parseGeneratorMethod(); method = true; } if (!kind && key && this.match('(')) { kind = 'init'; value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); method = true; } if (!kind) { this.throwUnexpectedToken(this.lookahead); } if (kind === 'init') { kind = 'method'; } if (!computed) { if (isStatic && this.isPropertyKey(key, 'prototype')) { this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); } if (!isStatic && this.isPropertyKey(key, 'constructor')) { if (kind !== 'method' || !method || (value && value.generator)) { this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); } if (hasConstructor.value) { this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); } else { hasConstructor.value = true; } kind = 'constructor'; } } return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); }; Parser.prototype.parseClassElementList = function () { var body = []; var hasConstructor = { value: false }; this.expect('{'); while (!this.match('}')) { if (this.match(';')) { this.nextToken(); } else { body.push(this.parseClassElement(hasConstructor)); } } this.expect('}'); return body; }; Parser.prototype.parseClassBody = function () { var node = this.createNode(); var elementList = this.parseClassElementList(); return this.finalize(node, new Node.ClassBody(elementList)); }; Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { var node = this.createNode(); var previousStrict = this.context.strict; this.context.strict = true; this.expectKeyword('class'); var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier(); var superClass = null; if (this.matchKeyword('extends')) { this.nextToken(); superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); } var classBody = this.parseClassBody(); this.context.strict = previousStrict; return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); }; Parser.prototype.parseClassExpression = function () { var node = this.createNode(); var previousStrict = this.context.strict; this.context.strict = true; this.expectKeyword('class'); var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null; var superClass = null; if (this.matchKeyword('extends')) { this.nextToken(); superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); } var classBody = this.parseClassBody(); this.context.strict = previousStrict; return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); }; // https://tc39.github.io/ecma262/#sec-scripts // https://tc39.github.io/ecma262/#sec-modules Parser.prototype.parseModule = function () { this.context.strict = true; this.context.isModule = true; var node = this.createNode(); var body = this.parseDirectivePrologues(); while (this.lookahead.type !== 2 /* EOF */) { body.push(this.parseStatementListItem()); } return this.finalize(node, new Node.Module(body)); }; Parser.prototype.parseScript = function () { var node = this.createNode(); var body = this.parseDirectivePrologues(); while (this.lookahead.type !== 2 /* EOF */) { body.push(this.parseStatementListItem()); } return this.finalize(node, new Node.Script(body)); }; // https://tc39.github.io/ecma262/#sec-imports Parser.prototype.parseModuleSpecifier = function () { var node = this.createNode(); if (this.lookahead.type !== 8 /* StringLiteral */) { this.throwError(messages_1.Messages.InvalidModuleSpecifier); } var token = this.nextToken(); var raw = this.getTokenRaw(token); return this.finalize(node, new Node.Literal(token.value, raw)); }; // import {<foo as bar>} ...; Parser.prototype.parseImportSpecifier = function () { var node = this.createNode(); var imported; var local; if (this.lookahead.type === 3 /* Identifier */) { imported = this.parseVariableIdentifier(); local = imported; if (this.matchContextualKeyword('as')) { this.nextToken(); local = this.parseVariableIdentifier(); } } else { imported = this.parseIdentifierName(); local = imported; if (this.matchContextualKeyword('as')) { this.nextToken(); local = this.parseVariableIdentifier(); } else { this.throwUnexpectedToken(this.nextToken()); } } return this.finalize(node, new Node.ImportSpecifier(local, imported)); }; // {foo, bar as bas} Parser.prototype.parseNamedImports = function () { this.expect('{'); var specifiers = []; while (!this.match('}')) { specifiers.push(this.parseImportSpecifier()); if (!this.match('}')) { this.expect(','); } } this.expect('}'); return specifiers; }; // import <foo> ...; Parser.prototype.parseImportDefaultSpecifier = function () { var node = this.createNode(); var local = this.parseIdentifierName(); return this.finalize(node, new Node.ImportDefaultSpecifier(local)); }; // import <* as foo> ...; Parser.prototype.parseImportNamespaceSpecifier = function () { var node = this.createNode(); this.expect('*'); if (!this.matchContextualKeyword('as')) { this.throwError(messages_1.Messages.NoAsAfterImportNamespace); } this.nextToken(); var local = this.parseIdentifierName(); return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); }; Parser.prototype.parseImportDeclaration = function () { if (this.context.inFunctionBody) { this.throwError(messages_1.Messages.IllegalImportDeclaration); } var node = this.createNode(); this.expectKeyword('import'); var src; var specifiers = []; if (this.lookahead.type === 8 /* StringLiteral */) { // import 'foo'; src = this.parseModuleSpecifier(); } else { if (this.match('{')) { // import {bar} specifiers = specifiers.concat(this.parseNamedImports()); } else if (this.match('*')) { // import * as foo specifiers.push(this.parseImportNamespaceSpecifier()); } else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { // import foo specifiers.push(this.parseImportDefaultSpecifier()); if (this.match(',')) { this.nextToken(); if (this.match('*')) { // import foo, * as foo specifiers.push(this.parseImportNamespaceSpecifier()); } else if (this.match('{')) { // import foo, {bar} specifiers = specifiers.concat(this.parseNamedImports()); } else { this.throwUnexpectedToken(this.lookahead); } } } else { this.throwUnexpectedToken(this.nextToken()); } if (!this.matchContextualKeyword('from')) { var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; this.throwError(message, this.lookahead.value); } this.nextToken(); src = this.parseModuleSpecifier(); } this.consumeSemicolon(); return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); }; // https://tc39.github.io/ecma262/#sec-exports Parser.prototype.parseExportSpecifier = function () { var node = this.createNode(); var local = this.parseIdentifierName(); var exported = local; if (this.matchContextualKeyword('as')) { this.nextToken(); exported = this.parseIdentifierName(); } return this.finalize(node, new Node.ExportSpecifier(local, exported)); }; Parser.prototype.parseExportDeclaration = function () { if (this.context.inFunctionBody) { this.throwError(messages_1.Messages.IllegalExportDeclaration); } var node = this.createNode(); this.expectKeyword('export'); var exportDeclaration; if (this.matchKeyword('default')) { // export default ... this.nextToken(); if (this.matchKeyword('function')) { // export default function foo () {} // export default function () {} var declaration = this.parseFunctionDeclaration(true); exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); } else if (this.matchKeyword('class')) { // export default class foo {} var declaration = this.parseClassDeclaration(true); exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); } else if (this.matchContextualKeyword('async')) { // export default async function f () {} // export default async function () {} // export default async x => x var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); } else { if (this.matchContextualKeyword('from')) { this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); } // export default {}; // export default []; // export default (1 + 2); var declaration = this.match('{') ? this.parseObjectInitializer() : this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); this.consumeSemicolon(); exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); } } else if (this.match('*')) { // export * from 'foo'; this.nextToken(); if (!this.matchContextualKeyword('from')) { var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; this.throwError(message, this.lookahead.value); } this.nextToken(); var src = this.parseModuleSpecifier(); this.consumeSemicolon(); exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); } else if (this.lookahead.type === 4 /* Keyword */) { // export var f = 1; var declaration = void 0; switch (this.lookahead.value) { case 'let': case 'const': declaration = this.parseLexicalDeclaration({ inFor: false }); break; case 'var': case 'class': case 'function': declaration = this.parseStatementListItem(); break; default: this.throwUnexpectedToken(this.lookahead); } exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); } else if (this.matchAsyncFunction()) { var declaration = this.parseFunctionDeclaration(); exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); } else { var specifiers = []; var source = null; var isExportFromIdentifier = false; this.expect('{'); while (!this.match('}')) { isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); specifiers.push(this.parseExportSpecifier()); if (!this.match('}')) { this.expect(','); } } this.expect('}'); if (this.matchContextualKeyword('from')) { // export {default} from 'foo'; // export {foo} from 'foo'; this.nextToken(); source = this.parseModuleSpecifier(); this.consumeSemicolon(); } else if (isExportFromIdentifier) { // export {default}; // missing fromClause var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; this.throwError(message, this.lookahead.value); } else { // export {foo}; this.consumeSemicolon(); } exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); } return exportDeclaration; }; return Parser; }()); exports.Parser = Parser; /***/ }, /* 9 */ /***/ function(module, exports) { "use strict"; // Ensure the condition is true, otherwise throw an error. // This is only to have a better contract semantic, i.e. another safety net // to catch a logic error. The condition shall be fulfilled in normal case. // Do NOT use this to enforce a certain condition on any user input. Object.defineProperty(exports, "__esModule", { value: true }); function assert(condition, message) { /* istanbul ignore if */ if (!condition) { throw new Error('ASSERT: ' + message); } } exports.assert = assert; /***/ }, /* 10 */ /***/ function(module, exports) { "use strict"; /* tslint:disable:max-classes-per-file */ Object.defineProperty(exports, "__esModule", { value: true }); var ErrorHandler = (function () { function ErrorHandler() { this.errors = []; this.tolerant = false; } ErrorHandler.prototype.recordError = function (error) { this.errors.push(error); }; ErrorHandler.prototype.tolerate = function (error) { if (this.tolerant) { this.recordError(error); } else { throw error; } }; ErrorHandler.prototype.constructError = function (msg, column) { var error = new Error(msg); try { throw error; } catch (base) { /* istanbul ignore else */ if (Object.create && Object.defineProperty) { error = Object.create(base); Object.defineProperty(error, 'column', { value: column }); } } /* istanbul ignore next */ return error; }; ErrorHandler.prototype.createError = function (index, line, col, description) { var msg = 'Line ' + line + ': ' + description; var error = this.constructError(msg, col); error.index = index; error.lineNumber = line; error.description = description; return error; }; ErrorHandler.prototype.throwError = function (index, line, col, description) { throw this.createError(index, line, col, description); }; ErrorHandler.prototype.tolerateError = function (index, line, col, description) { var error = this.createError(index, line, col, description); if (this.tolerant) { this.recordError(error); } else { throw error; } }; return ErrorHandler; }()); exports.ErrorHandler = ErrorHandler; /***/ }, /* 11 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Error messages should be identical to V8. exports.Messages = { BadGetterArity: 'Getter must not have any formal parameters', BadSetterArity: 'Setter must have exactly one formal parameter', BadSetterRestParameter: 'Setter function argument must not be a rest parameter', ConstructorIsAsync: 'Class constructor may not be an async method', ConstructorSpecialMethod: 'Class constructor may not be an accessor', DeclarationMissingInitializer: 'Missing initializer in %0 declaration', DefaultRestParameter: 'Unexpected token =', DuplicateBinding: 'Duplicate binding %0', DuplicateConstructor: 'A class may only have one constructor', DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', IllegalBreak: 'Illegal break statement', IllegalContinue: 'Illegal continue statement', IllegalExportDeclaration: 'Unexpected token', IllegalImportDeclaration: 'Unexpected token', IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', IllegalReturn: 'Illegal return statement', InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', InvalidLHSInAssignment: 'Invalid left-hand side in assignment', InvalidLHSInForIn: 'Invalid left-hand side in for-in', InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', InvalidModuleSpecifier: 'Unexpected token', InvalidRegExp: 'Invalid regular expression', LetInLexicalBinding: 'let is disallowed as a lexically bound name', MissingFromClause: 'Unexpected token', MultipleDefaultsInSwitch: 'More than one default clause in switch statement', NewlineAfterThrow: 'Illegal newline after throw', NoAsAfterImportNamespace: 'Unexpected token', NoCatchOrFinally: 'Missing catch or finally after try', ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', Redeclaration: '%0 \'%1\' has already been declared', StaticPrototype: 'Classes may not have static property named prototype', StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', StrictDelete: 'Delete of an unqualified identifier in strict mode.', StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', StrictFunctionName: 'Function name may not be eval or arguments in strict mode', StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', StrictModeWith: 'Strict mode code may not include a with statement', StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', StrictParamDupe: 'Strict mode function may not have duplicate parameter names', StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', StrictReservedWord: 'Use of future reserved word in strict mode', StrictVarName: 'Variable name may not be eval or arguments in strict mode', TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', UnexpectedEOS: 'Unexpected end of input', UnexpectedIdentifier: 'Unexpected identifier', UnexpectedNumber: 'Unexpected number', UnexpectedReserved: 'Unexpected reserved word', UnexpectedString: 'Unexpected string', UnexpectedTemplate: 'Unexpected quasi %0', UnexpectedToken: 'Unexpected token %0', UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', UnknownLabel: 'Undefined label \'%0\'', UnterminatedRegExp: 'Invalid regular expression: missing /' }; /***/ }, /* 12 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var assert_1 = __webpack_require__(9); var character_1 = __webpack_require__(4); var messages_1 = __webpack_require__(11); function hexValue(ch) { return '0123456789abcdef'.indexOf(ch.toLowerCase()); } function octalValue(ch) { return '01234567'.indexOf(ch); } var Scanner = (function () { function Scanner(code, handler) { this.source = code; this.errorHandler = handler; this.trackComment = false; this.length = code.length; this.index = 0; this.lineNumber = (code.length > 0) ? 1 : 0; this.lineStart = 0; this.curlyStack = []; } Scanner.prototype.saveState = function () { return { index: this.index, lineNumber: this.lineNumber, lineStart: this.lineStart }; }; Scanner.prototype.restoreState = function (state) { this.index = state.index; this.lineNumber = state.lineNumber; this.lineStart = state.lineStart; }; Scanner.prototype.eof = function () { return this.index >= this.length; }; Scanner.prototype.throwUnexpectedToken = function (message) { if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); }; Scanner.prototype.tolerateUnexpectedToken = function (message) { if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); }; // https://tc39.github.io/ecma262/#sec-comments Scanner.prototype.skipSingleLineComment = function (offset) { var comments = []; var start, loc; if (this.trackComment) { comments = []; start = this.index - offset; loc = { start: { line: this.lineNumber, column: this.index - this.lineStart - offset }, end: {} }; } while (!this.eof()) { var ch = this.source.charCodeAt(this.index); ++this.index; if (character_1.Character.isLineTerminator(ch)) { if (this.trackComment) { loc.end = { line: this.lineNumber, column: this.index - this.lineStart - 1 }; var entry = { multiLine: false, slice: [start + offset, this.index - 1], range: [start, this.index - 1], loc: loc }; comments.push(entry); } if (ch === 13 && this.source.charCodeAt(this.index) === 10) { ++this.index; } ++this.lineNumber; this.lineStart = this.index; return comments; } } if (this.trackComment) { loc.end = { line: this.lineNumber, column: this.index - this.lineStart }; var entry = { multiLine: false, slice: [start + offset, this.index], range: [start, this.index], loc: loc }; comments.push(entry); } return comments; }; Scanner.prototype.skipMultiLineComment = function () { var comments = []; var start, loc; if (this.trackComment) { comments = []; start = this.index - 2; loc = { start: { line: this.lineNumber, column: this.index - this.lineStart - 2 }, end: {} }; } while (!this.eof()) { var ch = this.source.charCodeAt(this.index); if (character_1.Character.isLineTerminator(ch)) { if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { ++this.index; } ++this.lineNumber; ++this.index; this.lineStart = this.index; } else if (ch === 0x2A) { // Block comment ends with '*/'. if (this.source.charCodeAt(this.index + 1) === 0x2F) { this.index += 2; if (this.trackComment) { loc.end = { line: this.lineNumber, column: this.index - this.lineStart }; var entry = { multiLine: true, slice: [start + 2, this.index - 2], range: [start, this.index], loc: loc }; comments.push(entry); } return comments; } ++this.index; } else { ++this.index; } } // Ran off the end of the file - the whole thing is a comment if (this.trackComment) { loc.end = { line: this.lineNumber, column: this.index - this.lineStart }; var entry = { multiLine: true, slice: [start + 2, this.index], range: [start, this.index], loc: loc }; comments.push(entry); } this.tolerateUnexpectedToken(); return comments; }; Scanner.prototype.scanComments = function () { var comments; if (this.trackComment) { comments = []; } var start = (this.index === 0); while (!this.eof()) { var ch = this.source.charCodeAt(this.index); if (character_1.Character.isWhiteSpace(ch)) { ++this.index; } else if (character_1.Character.isLineTerminator(ch)) { ++this.index; if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { ++this.index; } ++this.lineNumber; this.lineStart = this.index; start = true; } else if (ch === 0x2F) { ch = this.source.charCodeAt(this.index + 1); if (ch === 0x2F) { this.index += 2; var comment = this.skipSingleLineComment(2); if (this.trackComment) { comments = comments.concat(comment); } start = true; } else if (ch === 0x2A) { this.index += 2; var comment = this.skipMultiLineComment(); if (this.trackComment) { comments = comments.concat(comment); } } else { break; } } else if (start && ch === 0x2D) { // U+003E is '>' if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) { // '-->' is a single-line comment this.index += 3; var comment = this.skipSingleLineComment(3); if (this.trackComment) { comments = comments.concat(comment); } } else { break; } } else if (ch === 0x3C) { if (this.source.slice(this.index + 1, this.index + 4) === '!--') { this.index += 4; // `<!--` var comment = this.skipSingleLineComment(4); if (this.trackComment) { comments = comments.concat(comment); } } else { break; } } else { break; } } return comments; }; // https://tc39.github.io/ecma262/#sec-future-reserved-words Scanner.prototype.isFutureReservedWord = function (id) { switch (id) { case 'enum': case 'export': case 'import': case 'super': return true; default: return false; } }; Scanner.prototype.isStrictModeReservedWord = function (id) { switch (id) { case 'implements': case 'interface': case 'package': case 'private': case 'protected': case 'public': case 'static': case 'yield': case 'let': return true; default: return false; } }; Scanner.prototype.isRestrictedWord = function (id) { return id === 'eval' || id === 'arguments'; }; // https://tc39.github.io/ecma262/#sec-keywords Scanner.prototype.isKeyword = function (id) { switch (id.length) { case 2: return (id === 'if') || (id === 'in') || (id === 'do'); case 3: return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try') || (id === 'let'); case 4: return (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with') || (id === 'enum'); case 5: return (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw') || (id === 'const') || (id === 'yield') || (id === 'class') || (id === 'super'); case 6: return (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch') || (id === 'export') || (id === 'import'); case 7: return (id === 'default') || (id === 'finally') || (id === 'extends'); case 8: return (id === 'function') || (id === 'continue') || (id === 'debugger'); case 10: return (id === 'instanceof'); default: return false; } }; Scanner.prototype.codePointAt = function (i) { var cp = this.source.charCodeAt(i); if (cp >= 0xD800 && cp <= 0xDBFF) { var second = this.source.charCodeAt(i + 1); if (second >= 0xDC00 && second <= 0xDFFF) { var first = cp; cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; } } return cp; }; Scanner.prototype.scanHexEscape = function (prefix) { var len = (prefix === 'u') ? 4 : 2; var code = 0; for (var i = 0; i < len; ++i) { if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) { code = code * 16 + hexValue(this.source[this.index++]); } else { return null; } } return String.fromCharCode(code); }; Scanner.prototype.scanUnicodeCodePointEscape = function () { var ch = this.source[this.index]; var code = 0; // At least, one hex digit is required. if (ch === '}') { this.throwUnexpectedToken(); } while (!this.eof()) { ch = this.source[this.index++]; if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) { break; } code = code * 16 + hexValue(ch); } if (code > 0x10FFFF || ch !== '}') { this.throwUnexpectedToken(); } return character_1.Character.fromCodePoint(code); }; Scanner.prototype.getIdentifier = function () { var start = this.index++; while (!this.eof()) { var ch = this.source.charCodeAt(this.index); if (ch === 0x5C) { // Blackslash (U+005C) marks Unicode escape sequence. this.index = start; return this.getComplexIdentifier(); } else if (ch >= 0xD800 && ch < 0xDFFF) { // Need to handle surrogate pairs. this.index = start; return this.getComplexIdentifier(); } if (character_1.Character.isIdentifierPart(ch)) { ++this.index; } else { break; } } return this.source.slice(start, this.index); }; Scanner.prototype.getComplexIdentifier = function () { var cp = this.codePointAt(this.index); var id = character_1.Character.fromCodePoint(cp); this.index += id.length; // '\u' (U+005C, U+0075) denotes an escaped character. var ch; if (cp === 0x5C) { if (this.source.charCodeAt(this.index) !== 0x75) { this.throwUnexpectedToken(); } ++this.index; if (this.source[this.index] === '{') { ++this.index; ch = this.scanUnicodeCodePointEscape(); } else { ch = this.scanHexEscape('u'); if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) { this.throwUnexpectedToken(); } } id = ch; } while (!this.eof()) { cp = this.codePointAt(this.index); if (!character_1.Character.isIdentifierPart(cp)) { break; } ch = character_1.Character.fromCodePoint(cp); id += ch; this.index += ch.length; // '\u' (U+005C, U+0075) denotes an escaped character. if (cp === 0x5C) { id = id.substr(0, id.length - 1); if (this.source.charCodeAt(this.index) !== 0x75) { this.throwUnexpectedToken(); } ++this.index; if (this.source[this.index] === '{') { ++this.index; ch = this.scanUnicodeCodePointEscape(); } else { ch = this.scanHexEscape('u'); if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) { this.throwUnexpectedToken(); } } id += ch; } } return id; }; Scanner.prototype.octalToDecimal = function (ch) { // \0 is not octal escape sequence var octal = (ch !== '0'); var code = octalValue(ch); if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) { octal = true; code = code * 8 + octalValue(this.source[this.index++]); // 3 digits are only allowed when string starts // with 0, 1, 2, 3 if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) { code = code * 8 + octalValue(this.source[this.index++]); } } return { code: code, octal: octal }; }; // https://tc39.github.io/ecma262/#sec-names-and-keywords Scanner.prototype.scanIdentifier = function () { var type; var start = this.index; // Backslash (U+005C) starts an escaped character. var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier(); // There is no keyword or literal with only one character. // Thus, it must be an identifier. if (id.length === 1) { type = 3 /* Identifier */; } else if (this.isKeyword(id)) { type = 4 /* Keyword */; } else if (id === 'null') { type = 5 /* NullLiteral */; } else if (id === 'true' || id === 'false') { type = 1 /* BooleanLiteral */; } else { type = 3 /* Identifier */; } if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) { var restore = this.index; this.index = start; this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord); this.index = restore; } return { type: type, value: id, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; // https://tc39.github.io/ecma262/#sec-punctuators Scanner.prototype.scanPunctuator = function () { var start = this.index; // Check for most common single-character punctuators. var str = this.source[this.index]; switch (str) { case '(': case '{': if (str === '{') { this.curlyStack.push('{'); } ++this.index; break; case '.': ++this.index; if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') { // Spread operator: ... this.index += 2; str = '...'; } break; case '}': ++this.index; this.curlyStack.pop(); break; case ')': case ';': case ',': case '[': case ']': case ':': case '?': case '~': ++this.index; break; default: // 4-character punctuator. str = this.source.substr(this.index, 4); if (str === '>>>=') { this.index += 4; } else { // 3-character punctuators. str = str.substr(0, 3); if (str === '===' || str === '!==' || str === '>>>' || str === '<<=' || str === '>>=' || str === '**=') { this.index += 3; } else { // 2-character punctuators. str = str.substr(0, 2); if (str === '&&' || str === '||' || str === '==' || str === '!=' || str === '+=' || str === '-=' || str === '*=' || str === '/=' || str === '++' || str === '--' || str === '<<' || str === '>>' || str === '&=' || str === '|=' || str === '^=' || str === '%=' || str === '<=' || str === '>=' || str === '=>' || str === '**') { this.index += 2; } else { // 1-character punctuators. str = this.source[this.index]; if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { ++this.index; } } } } } if (this.index === start) { this.throwUnexpectedToken(); } return { type: 7 /* Punctuator */, value: str, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; // https://tc39.github.io/ecma262/#sec-literals-numeric-literals Scanner.prototype.scanHexLiteral = function (start) { var num = ''; while (!this.eof()) { if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) { break; } num += this.source[this.index++]; } if (num.length === 0) { this.throwUnexpectedToken(); } if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) { this.throwUnexpectedToken(); } return { type: 6 /* NumericLiteral */, value: parseInt('0x' + num, 16), lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; Scanner.prototype.scanBinaryLiteral = function (start) { var num = ''; var ch; while (!this.eof()) { ch = this.source[this.index]; if (ch !== '0' && ch !== '1') { break; } num += this.source[this.index++]; } if (num.length === 0) { // only 0b or 0B this.throwUnexpectedToken(); } if (!this.eof()) { ch = this.source.charCodeAt(this.index); /* istanbul ignore else */ if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) { this.throwUnexpectedToken(); } } return { type: 6 /* NumericLiteral */, value: parseInt(num, 2), lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; Scanner.prototype.scanOctalLiteral = function (prefix, start) { var num = ''; var octal = false; if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) { octal = true; num = '0' + this.source[this.index++]; } else { ++this.index; } while (!this.eof()) { if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) { break; } num += this.source[this.index++]; } if (!octal && num.length === 0) { // only 0o or 0O this.throwUnexpectedToken(); } if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { this.throwUnexpectedToken(); } return { type: 6 /* NumericLiteral */, value: parseInt(num, 8), octal: octal, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; Scanner.prototype.isImplicitOctalLiteral = function () { // Implicit octal, unless there is a non-octal digit. // (Annex B.1.1 on Numeric Literals) for (var i = this.index + 1; i < this.length; ++i) { var ch = this.source[i]; if (ch === '8' || ch === '9') { return false; } if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) { return true; } } return true; }; Scanner.prototype.scanNumericLiteral = function () { var start = this.index; var ch = this.source[start]; assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point'); var num = ''; if (ch !== '.') { num = this.source[this.index++]; ch = this.source[this.index]; // Hex number starts with '0x'. // Octal number starts with '0'. // Octal number in ES6 starts with '0o'. // Binary number in ES6 starts with '0b'. if (num === '0') { if (ch === 'x' || ch === 'X') { ++this.index; return this.scanHexLiteral(start); } if (ch === 'b' || ch === 'B') { ++this.index; return this.scanBinaryLiteral(start); } if (ch === 'o' || ch === 'O') { return this.scanOctalLiteral(ch, start); } if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) { if (this.isImplicitOctalLiteral()) { return this.scanOctalLiteral(ch, start); } } } while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { num += this.source[this.index++]; } ch = this.source[this.index]; } if (ch === '.') { num += this.source[this.index++]; while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { num += this.source[this.index++]; } ch = this.source[this.index]; } if (ch === 'e' || ch === 'E') { num += this.source[this.index++]; ch = this.source[this.index]; if (ch === '+' || ch === '-') { num += this.source[this.index++]; } if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { num += this.source[this.index++]; } } else { this.throwUnexpectedToken(); } } if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) { this.throwUnexpectedToken(); } return { type: 6 /* NumericLiteral */, value: parseFloat(num), lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; // https://tc39.github.io/ecma262/#sec-literals-string-literals Scanner.prototype.scanStringLiteral = function () { var start = this.index; var quote = this.source[start]; assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote'); ++this.index; var octal = false; var str = ''; while (!this.eof()) { var ch = this.source[this.index++]; if (ch === quote) { quote = ''; break; } else if (ch === '\\') { ch = this.source[this.index++]; if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) { switch (ch) { case 'u': if (this.source[this.index] === '{') { ++this.index; str += this.scanUnicodeCodePointEscape(); } else { var unescaped_1 = this.scanHexEscape(ch); if (unescaped_1 === null) { this.throwUnexpectedToken(); } str += unescaped_1; } break; case 'x': var unescaped = this.scanHexEscape(ch); if (unescaped === null) { this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence); } str += unescaped; break; case 'n': str += '\n'; break; case 'r': str += '\r'; break; case 't': str += '\t'; break; case 'b': str += '\b'; break; case 'f': str += '\f'; break; case 'v': str += '\x0B'; break; case '8': case '9': str += ch; this.tolerateUnexpectedToken(); break; default: if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) { var octToDec = this.octalToDecimal(ch); octal = octToDec.octal || octal; str += String.fromCharCode(octToDec.code); } else { str += ch; } break; } } else { ++this.lineNumber; if (ch === '\r' && this.source[this.index] === '\n') { ++this.index; } this.lineStart = this.index; } } else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { break; } else { str += ch; } } if (quote !== '') { this.index = start; this.throwUnexpectedToken(); } return { type: 8 /* StringLiteral */, value: str, octal: octal, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; // https://tc39.github.io/ecma262/#sec-template-literal-lexical-components Scanner.prototype.scanTemplate = function () { var cooked = ''; var terminated = false; var start = this.index; var head = (this.source[start] === '`'); var tail = false; var rawOffset = 2; ++this.index; while (!this.eof()) { var ch = this.source[this.index++]; if (ch === '`') { rawOffset = 1; tail = true; terminated = true; break; } else if (ch === '$') { if (this.source[this.index] === '{') { this.curlyStack.push('${'); ++this.index; terminated = true; break; } cooked += ch; } else if (ch === '\\') { ch = this.source[this.index++]; if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) { switch (ch) { case 'n': cooked += '\n'; break; case 'r': cooked += '\r'; break; case 't': cooked += '\t'; break; case 'u': if (this.source[this.index] === '{') { ++this.index; cooked += this.scanUnicodeCodePointEscape(); } else { var restore = this.index; var unescaped_2 = this.scanHexEscape(ch); if (unescaped_2 !== null) { cooked += unescaped_2; } else { this.index = restore; cooked += ch; } } break; case 'x': var unescaped = this.scanHexEscape(ch); if (unescaped === null) { this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence); } cooked += unescaped; break; case 'b': cooked += '\b'; break; case 'f': cooked += '\f'; break; case 'v': cooked += '\v'; break; default: if (ch === '0') { if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) { // Illegal: \01 \02 and so on this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral); } cooked += '\0'; } else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) { // Illegal: \1 \2 this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral); } else { cooked += ch; } break; } } else { ++this.lineNumber; if (ch === '\r' && this.source[this.index] === '\n') { ++this.index; } this.lineStart = this.index; } } else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { ++this.lineNumber; if (ch === '\r' && this.source[this.index] === '\n') { ++this.index; } this.lineStart = this.index; cooked += '\n'; } else { cooked += ch; } } if (!terminated) { this.throwUnexpectedToken(); } if (!head) { this.curlyStack.pop(); } return { type: 10 /* Template */, value: this.source.slice(start + 1, this.index - rawOffset), cooked: cooked, head: head, tail: tail, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals Scanner.prototype.testRegExp = function (pattern, flags) { // The BMP character to use as a replacement for astral symbols when // translating an ES6 "u"-flagged pattern to an ES5-compatible // approximation. // Note: replacing with '\uFFFF' enables false positives in unlikely // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid // pattern that would not be detected by this substitution. var astralSubstitute = '\uFFFF'; var tmp = pattern; var self = this; if (flags.indexOf('u') >= 0) { tmp = tmp .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) { var codePoint = parseInt($1 || $2, 16); if (codePoint > 0x10FFFF) { self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp); } if (codePoint <= 0xFFFF) { return String.fromCharCode(codePoint); } return astralSubstitute; }) .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute); } // First, detect invalid regular expressions. try { RegExp(tmp); } catch (e) { this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp); } // Return a regular expression object for this pattern-flag pair, or // `null` in case the current environment doesn't support the flags it // uses. try { return new RegExp(pattern, flags); } catch (exception) { /* istanbul ignore next */ return null; } }; Scanner.prototype.scanRegExpBody = function () { var ch = this.source[this.index]; assert_1.assert(ch === '/', 'Regular expression literal must start with a slash'); var str = this.source[this.index++]; var classMarker = false; var terminated = false; while (!this.eof()) { ch = this.source[this.index++]; str += ch; if (ch === '\\') { ch = this.source[this.index++]; // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); } str += ch; } else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); } else if (classMarker) { if (ch === ']') { classMarker = false; } } else { if (ch === '/') { terminated = true; break; } else if (ch === '[') { classMarker = true; } } } if (!terminated) { this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp); } // Exclude leading and trailing slash. return str.substr(1, str.length - 2); }; Scanner.prototype.scanRegExpFlags = function () { var str = ''; var flags = ''; while (!this.eof()) { var ch = this.source[this.index]; if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) { break; } ++this.index; if (ch === '\\' && !this.eof()) { ch = this.source[this.index]; if (ch === 'u') { ++this.index; var restore = this.index; var char = this.scanHexEscape('u'); if (char !== null) { flags += char; for (str += '\\u'; restore < this.index; ++restore) { str += this.source[restore]; } } else { this.index = restore; flags += 'u'; str += '\\u'; } this.tolerateUnexpectedToken(); } else { str += '\\'; this.tolerateUnexpectedToken(); } } else { flags += ch; str += ch; } } return flags; }; Scanner.prototype.scanRegExp = function () { var start = this.index; var pattern = this.scanRegExpBody(); var flags = this.scanRegExpFlags(); var value = this.testRegExp(pattern, flags); return { type: 9 /* RegularExpression */, value: '', pattern: pattern, flags: flags, regex: value, lineNumber: this.lineNumber, lineStart: this.lineStart, start: start, end: this.index }; }; Scanner.prototype.lex = function () { if (this.eof()) { return { type: 2 /* EOF */, value: '', lineNumber: this.lineNumber, lineStart: this.lineStart, start: this.index, end: this.index }; } var cp = this.source.charCodeAt(this.index); if (character_1.Character.isIdentifierStart(cp)) { return this.scanIdentifier(); } // Very common: ( and ) and ; if (cp === 0x28 || cp === 0x29 || cp === 0x3B) { return this.scanPunctuator(); } // String literal starts with single quote (U+0027) or double quote (U+0022). if (cp === 0x27 || cp === 0x22) { return this.scanStringLiteral(); } // Dot (.) U+002E can also start a floating-point number, hence the need // to check the next character. if (cp === 0x2E) { if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) { return this.scanNumericLiteral(); } return this.scanPunctuator(); } if (character_1.Character.isDecimalDigit(cp)) { return this.scanNumericLiteral(); } // Template literals start with ` (U+0060) for template head // or } (U+007D) for template middle or template tail. if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) { return this.scanTemplate(); } // Possible identifier start in a surrogate pair. if (cp >= 0xD800 && cp < 0xDFFF) { if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) { return this.scanIdentifier(); } } return this.scanPunctuator(); }; return Scanner; }()); exports.Scanner = Scanner; /***/ }, /* 13 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TokenName = {}; exports.TokenName[1 /* BooleanLiteral */] = 'Boolean'; exports.TokenName[2 /* EOF */] = '<end>'; exports.TokenName[3 /* Identifier */] = 'Identifier'; exports.TokenName[4 /* Keyword */] = 'Keyword'; exports.TokenName[5 /* NullLiteral */] = 'Null'; exports.TokenName[6 /* NumericLiteral */] = 'Numeric'; exports.TokenName[7 /* Punctuator */] = 'Punctuator'; exports.TokenName[8 /* StringLiteral */] = 'String'; exports.TokenName[9 /* RegularExpression */] = 'RegularExpression'; exports.TokenName[10 /* Template */] = 'Template'; /***/ }, /* 14 */ /***/ function(module, exports) { "use strict"; // Generated by generate-xhtml-entities.js. DO NOT MODIFY! Object.defineProperty(exports, "__esModule", { value: true }); exports.XHTMLEntities = { quot: '\u0022', amp: '\u0026', apos: '\u0027', gt: '\u003E', nbsp: '\u00A0', iexcl: '\u00A1', cent: '\u00A2', pound: '\u00A3', curren: '\u00A4', yen: '\u00A5', brvbar: '\u00A6', sect: '\u00A7', uml: '\u00A8', copy: '\u00A9', ordf: '\u00AA', laquo: '\u00AB', not: '\u00AC', shy: '\u00AD', reg: '\u00AE', macr: '\u00AF', deg: '\u00B0', plusmn: '\u00B1', sup2: '\u00B2', sup3: '\u00B3', acute: '\u00B4', micro: '\u00B5', para: '\u00B6', middot: '\u00B7', cedil: '\u00B8', sup1: '\u00B9', ordm: '\u00BA', raquo: '\u00BB', frac14: '\u00BC', frac12: '\u00BD', frac34: '\u00BE', iquest: '\u00BF', Agrave: '\u00C0', Aacute: '\u00C1', Acirc: '\u00C2', Atilde: '\u00C3', Auml: '\u00C4', Aring: '\u00C5', AElig: '\u00C6', Ccedil: '\u00C7', Egrave: '\u00C8', Eacute: '\u00C9', Ecirc: '\u00CA', Euml: '\u00CB', Igrave: '\u00CC', Iacute: '\u00CD', Icirc: '\u00CE', Iuml: '\u00CF', ETH: '\u00D0', Ntilde: '\u00D1', Ograve: '\u00D2', Oacute: '\u00D3', Ocirc: '\u00D4', Otilde: '\u00D5', Ouml: '\u00D6', times: '\u00D7', Oslash: '\u00D8', Ugrave: '\u00D9', Uacute: '\u00DA', Ucirc: '\u00DB', Uuml: '\u00DC', Yacute: '\u00DD', THORN: '\u00DE', szlig: '\u00DF', agrave: '\u00E0', aacute: '\u00E1', acirc: '\u00E2', atilde: '\u00E3', auml: '\u00E4', aring: '\u00E5', aelig: '\u00E6', ccedil: '\u00E7', egrave: '\u00E8', eacute: '\u00E9', ecirc: '\u00EA', euml: '\u00EB', igrave: '\u00EC', iacute: '\u00ED', icirc: '\u00EE', iuml: '\u00EF', eth: '\u00F0', ntilde: '\u00F1', ograve: '\u00F2', oacute: '\u00F3', ocirc: '\u00F4', otilde: '\u00F5', ouml: '\u00F6', divide: '\u00F7', oslash: '\u00F8', ugrave: '\u00F9', uacute: '\u00FA', ucirc: '\u00FB', uuml: '\u00FC', yacute: '\u00FD', thorn: '\u00FE', yuml: '\u00FF', OElig: '\u0152', oelig: '\u0153', Scaron: '\u0160', scaron: '\u0161', Yuml: '\u0178', fnof: '\u0192', circ: '\u02C6', tilde: '\u02DC', Alpha: '\u0391', Beta: '\u0392', Gamma: '\u0393', Delta: '\u0394', Epsilon: '\u0395', Zeta: '\u0396', Eta: '\u0397', Theta: '\u0398', Iota: '\u0399', Kappa: '\u039A', Lambda: '\u039B', Mu: '\u039C', Nu: '\u039D', Xi: '\u039E', Omicron: '\u039F', Pi: '\u03A0', Rho: '\u03A1', Sigma: '\u03A3', Tau: '\u03A4', Upsilon: '\u03A5', Phi: '\u03A6', Chi: '\u03A7', Psi: '\u03A8', Omega: '\u03A9', alpha: '\u03B1', beta: '\u03B2', gamma: '\u03B3', delta: '\u03B4', epsilon: '\u03B5', zeta: '\u03B6', eta: '\u03B7', theta: '\u03B8', iota: '\u03B9', kappa: '\u03BA', lambda: '\u03BB', mu: '\u03BC', nu: '\u03BD', xi: '\u03BE', omicron: '\u03BF', pi: '\u03C0', rho: '\u03C1', sigmaf: '\u03C2', sigma: '\u03C3', tau: '\u03C4', upsilon: '\u03C5', phi: '\u03C6', chi: '\u03C7', psi: '\u03C8', omega: '\u03C9', thetasym: '\u03D1', upsih: '\u03D2', piv: '\u03D6', ensp: '\u2002', emsp: '\u2003', thinsp: '\u2009', zwnj: '\u200C', zwj: '\u200D', lrm: '\u200E', rlm: '\u200F', ndash: '\u2013', mdash: '\u2014', lsquo: '\u2018', rsquo: '\u2019', sbquo: '\u201A', ldquo: '\u201C', rdquo: '\u201D', bdquo: '\u201E', dagger: '\u2020', Dagger: '\u2021', bull: '\u2022', hellip: '\u2026', permil: '\u2030', prime: '\u2032', Prime: '\u2033', lsaquo: '\u2039', rsaquo: '\u203A', oline: '\u203E', frasl: '\u2044', euro: '\u20AC', image: '\u2111', weierp: '\u2118', real: '\u211C', trade: '\u2122', alefsym: '\u2135', larr: '\u2190', uarr: '\u2191', rarr: '\u2192', darr: '\u2193', harr: '\u2194', crarr: '\u21B5', lArr: '\u21D0', uArr: '\u21D1', rArr: '\u21D2', dArr: '\u21D3', hArr: '\u21D4', forall: '\u2200', part: '\u2202', exist: '\u2203', empty: '\u2205', nabla: '\u2207', isin: '\u2208', notin: '\u2209', ni: '\u220B', prod: '\u220F', sum: '\u2211', minus: '\u2212', lowast: '\u2217', radic: '\u221A', prop: '\u221D', infin: '\u221E', ang: '\u2220', and: '\u2227', or: '\u2228', cap: '\u2229', cup: '\u222A', int: '\u222B', there4: '\u2234', sim: '\u223C', cong: '\u2245', asymp: '\u2248', ne: '\u2260', equiv: '\u2261', le: '\u2264', ge: '\u2265', sub: '\u2282', sup: '\u2283', nsub: '\u2284', sube: '\u2286', supe: '\u2287', oplus: '\u2295', otimes: '\u2297', perp: '\u22A5', sdot: '\u22C5', lceil: '\u2308', rceil: '\u2309', lfloor: '\u230A', rfloor: '\u230B', loz: '\u25CA', spades: '\u2660', clubs: '\u2663', hearts: '\u2665', diams: '\u2666', lang: '\u27E8', rang: '\u27E9' }; /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var error_handler_1 = __webpack_require__(10); var scanner_1 = __webpack_require__(12); var token_1 = __webpack_require__(13); var Reader = (function () { function Reader() { this.values = []; this.curly = this.paren = -1; } // A function following one of those tokens is an expression. Reader.prototype.beforeFunctionExpression = function (t) { return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new', 'return', 'case', 'delete', 'throw', 'void', // assignment operators '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', '&=', '|=', '^=', ',', // binary/unary operators '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&', '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=', '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0; }; // Determine if forward slash (/) is an operator or part of a regular expression // https://github.com/mozilla/sweet.js/wiki/design Reader.prototype.isRegexStart = function () { var previous = this.values[this.values.length - 1]; var regex = (previous !== null); switch (previous) { case 'this': case ']': regex = false; break; case ')': var keyword = this.values[this.paren - 1]; regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with'); break; case '}': // Dividing a function by anything makes little sense, // but we have to check for that. regex = false; if (this.values[this.curly - 3] === 'function') { // Anonymous function, e.g. function(){} /42 var check = this.values[this.curly - 4]; regex = check ? !this.beforeFunctionExpression(check) : false; } else if (this.values[this.curly - 4] === 'function') { // Named function, e.g. function f(){} /42/ var check = this.values[this.curly - 5]; regex = check ? !this.beforeFunctionExpression(check) : true; } break; default: break; } return regex; }; Reader.prototype.push = function (token) { if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) { if (token.value === '{') { this.curly = this.values.length; } else if (token.value === '(') { this.paren = this.values.length; } this.values.push(token.value); } else { this.values.push(null); } }; return Reader; }()); var Tokenizer = (function () { function Tokenizer(code, config) { this.errorHandler = new error_handler_1.ErrorHandler(); this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false; this.scanner = new scanner_1.Scanner(code, this.errorHandler); this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false; this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false; this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false; this.buffer = []; this.reader = new Reader(); } Tokenizer.prototype.errors = function () { return this.errorHandler.errors; }; Tokenizer.prototype.getNextToken = function () { if (this.buffer.length === 0) { var comments = this.scanner.scanComments(); if (this.scanner.trackComment) { for (var i = 0; i < comments.length; ++i) { var e = comments[i]; var value = this.scanner.source.slice(e.slice[0], e.slice[1]); var comment = { type: e.multiLine ? 'BlockComment' : 'LineComment', value: value }; if (this.trackRange) { comment.range = e.range; } if (this.trackLoc) { comment.loc = e.loc; } this.buffer.push(comment); } } if (!this.scanner.eof()) { var loc = void 0; if (this.trackLoc) { loc = { start: { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }, end: {} }; } var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart(); var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex(); this.reader.push(token); var entry = { type: token_1.TokenName[token.type], value: this.scanner.source.slice(token.start, token.end) }; if (this.trackRange) { entry.range = [token.start, token.end]; } if (this.trackLoc) { loc.end = { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }; entry.loc = loc; } if (token.type === 9 /* RegularExpression */) { var pattern = token.pattern; var flags = token.flags; entry.regex = { pattern: pattern, flags: flags }; } this.buffer.push(entry); } } return this.buffer.shift(); }; return Tokenizer; }()); exports.Tokenizer = Tokenizer; /***/ } /******/ ]) }); ; csslint.js 0000644 00001314261 14720661433 0006577 0 ustar 00 /*! CSSLint v1.0.4 Copyright (c) 2016 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var CSSLint = (function(){ var module = module || {}, exports = exports || {}; /*! Parser-Lib Copyright (c) 2009-2016 Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Version v1.1.0, Build time: 6-December-2016 10:31:29 */ var parserlib = (function () { var require; require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ "use strict"; /* exported Colors */ var Colors = module.exports = { __proto__ :null, aliceblue :"#f0f8ff", antiquewhite :"#faebd7", aqua :"#00ffff", aquamarine :"#7fffd4", azure :"#f0ffff", beige :"#f5f5dc", bisque :"#ffe4c4", black :"#000000", blanchedalmond :"#ffebcd", blue :"#0000ff", blueviolet :"#8a2be2", brown :"#a52a2a", burlywood :"#deb887", cadetblue :"#5f9ea0", chartreuse :"#7fff00", chocolate :"#d2691e", coral :"#ff7f50", cornflowerblue :"#6495ed", cornsilk :"#fff8dc", crimson :"#dc143c", cyan :"#00ffff", darkblue :"#00008b", darkcyan :"#008b8b", darkgoldenrod :"#b8860b", darkgray :"#a9a9a9", darkgrey :"#a9a9a9", darkgreen :"#006400", darkkhaki :"#bdb76b", darkmagenta :"#8b008b", darkolivegreen :"#556b2f", darkorange :"#ff8c00", darkorchid :"#9932cc", darkred :"#8b0000", darksalmon :"#e9967a", darkseagreen :"#8fbc8f", darkslateblue :"#483d8b", darkslategray :"#2f4f4f", darkslategrey :"#2f4f4f", darkturquoise :"#00ced1", darkviolet :"#9400d3", deeppink :"#ff1493", deepskyblue :"#00bfff", dimgray :"#696969", dimgrey :"#696969", dodgerblue :"#1e90ff", firebrick :"#b22222", floralwhite :"#fffaf0", forestgreen :"#228b22", fuchsia :"#ff00ff", gainsboro :"#dcdcdc", ghostwhite :"#f8f8ff", gold :"#ffd700", goldenrod :"#daa520", gray :"#808080", grey :"#808080", green :"#008000", greenyellow :"#adff2f", honeydew :"#f0fff0", hotpink :"#ff69b4", indianred :"#cd5c5c", indigo :"#4b0082", ivory :"#fffff0", khaki :"#f0e68c", lavender :"#e6e6fa", lavenderblush :"#fff0f5", lawngreen :"#7cfc00", lemonchiffon :"#fffacd", lightblue :"#add8e6", lightcoral :"#f08080", lightcyan :"#e0ffff", lightgoldenrodyellow :"#fafad2", lightgray :"#d3d3d3", lightgrey :"#d3d3d3", lightgreen :"#90ee90", lightpink :"#ffb6c1", lightsalmon :"#ffa07a", lightseagreen :"#20b2aa", lightskyblue :"#87cefa", lightslategray :"#778899", lightslategrey :"#778899", lightsteelblue :"#b0c4de", lightyellow :"#ffffe0", lime :"#00ff00", limegreen :"#32cd32", linen :"#faf0e6", magenta :"#ff00ff", maroon :"#800000", mediumaquamarine:"#66cdaa", mediumblue :"#0000cd", mediumorchid :"#ba55d3", mediumpurple :"#9370d8", mediumseagreen :"#3cb371", mediumslateblue :"#7b68ee", mediumspringgreen :"#00fa9a", mediumturquoise :"#48d1cc", mediumvioletred :"#c71585", midnightblue :"#191970", mintcream :"#f5fffa", mistyrose :"#ffe4e1", moccasin :"#ffe4b5", navajowhite :"#ffdead", navy :"#000080", oldlace :"#fdf5e6", olive :"#808000", olivedrab :"#6b8e23", orange :"#ffa500", orangered :"#ff4500", orchid :"#da70d6", palegoldenrod :"#eee8aa", palegreen :"#98fb98", paleturquoise :"#afeeee", palevioletred :"#d87093", papayawhip :"#ffefd5", peachpuff :"#ffdab9", peru :"#cd853f", pink :"#ffc0cb", plum :"#dda0dd", powderblue :"#b0e0e6", purple :"#800080", red :"#ff0000", rosybrown :"#bc8f8f", royalblue :"#4169e1", saddlebrown :"#8b4513", salmon :"#fa8072", sandybrown :"#f4a460", seagreen :"#2e8b57", seashell :"#fff5ee", sienna :"#a0522d", silver :"#c0c0c0", skyblue :"#87ceeb", slateblue :"#6a5acd", slategray :"#708090", slategrey :"#708090", snow :"#fffafa", springgreen :"#00ff7f", steelblue :"#4682b4", tan :"#d2b48c", teal :"#008080", thistle :"#d8bfd8", tomato :"#ff6347", turquoise :"#40e0d0", violet :"#ee82ee", wheat :"#f5deb3", white :"#ffffff", whitesmoke :"#f5f5f5", yellow :"#ffff00", yellowgreen :"#9acd32", //'currentColor' color keyword https://www.w3.org/TR/css3-color/#currentcolor currentColor :"The value of the 'color' property.", //CSS2 system colors https://www.w3.org/TR/css3-color/#css2-system activeBorder :"Active window border.", activecaption :"Active window caption.", appworkspace :"Background color of multiple document interface.", background :"Desktop background.", buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", buttontext :"Text on push buttons.", captiontext :"Text in caption, size box, and scrollbar arrow box.", graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", highlight :"Item(s) selected in a control.", highlighttext :"Text of item(s) selected in a control.", inactiveborder :"Inactive window border.", inactivecaption :"Inactive window caption.", inactivecaptiontext :"Color of text in an inactive caption.", infobackground :"Background color for tooltip controls.", infotext :"Text color for tooltip controls.", menu :"Menu background.", menutext :"Text in menus.", scrollbar :"Scroll bar gray area.", threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", window :"Window background.", windowframe :"Window frame.", windowtext :"Text in windows." }; },{}],2:[function(require,module,exports){ "use strict"; module.exports = Combinator; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a selector combinator (whitespace, +, >). * @namespace parserlib.css * @class Combinator * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} text The text representation of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function Combinator(text, line, col) { SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); /** * The type of modifier. * @type String * @property type */ this.type = "unknown"; //pretty simple if (/^\s+$/.test(text)) { this.type = "descendant"; } else if (text === ">") { this.type = "child"; } else if (text === "+") { this.type = "adjacent-sibling"; } else if (text === "~") { this.type = "sibling"; } } Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; },{"../util/SyntaxUnit":26,"./Parser":6}],3:[function(require,module,exports){ "use strict"; module.exports = Matcher; var StringReader = require("../util/StringReader"); var SyntaxError = require("../util/SyntaxError"); /** * This class implements a combinator library for matcher functions. * The combinators are described at: * https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax#Component_value_combinators */ function Matcher(matchFunc, toString) { this.match = function(expression) { // Save/restore marks to ensure that failed matches always restore // the original location in the expression. var result; expression.mark(); result = matchFunc(expression); if (result) { expression.drop(); } else { expression.restore(); } return result; }; this.toString = typeof toString === "function" ? toString : function() { return toString; }; } /** Precedence table of combinators. */ Matcher.prec = { MOD: 5, SEQ: 4, ANDAND: 3, OROR: 2, ALT: 1 }; /** Simple recursive-descent grammar to build matchers from strings. */ Matcher.parse = function(str) { var reader, eat, expr, oror, andand, seq, mod, term, result; reader = new StringReader(str); eat = function(matcher) { var result = reader.readMatch(matcher); if (result === null) { throw new SyntaxError( "Expected "+matcher, reader.getLine(), reader.getCol()); } return result; }; expr = function() { // expr = oror (" | " oror)* var m = [ oror() ]; while (reader.readMatch(" | ") !== null) { m.push(oror()); } return m.length === 1 ? m[0] : Matcher.alt.apply(Matcher, m); }; oror = function() { // oror = andand ( " || " andand)* var m = [ andand() ]; while (reader.readMatch(" || ") !== null) { m.push(andand()); } return m.length === 1 ? m[0] : Matcher.oror.apply(Matcher, m); }; andand = function() { // andand = seq ( " && " seq)* var m = [ seq() ]; while (reader.readMatch(" && ") !== null) { m.push(seq()); } return m.length === 1 ? m[0] : Matcher.andand.apply(Matcher, m); }; seq = function() { // seq = mod ( " " mod)* var m = [ mod() ]; while (reader.readMatch(/^ (?![&|\]])/) !== null) { m.push(mod()); } return m.length === 1 ? m[0] : Matcher.seq.apply(Matcher, m); }; mod = function() { // mod = term ( "?" | "*" | "+" | "#" | "{<num>,<num>}" )? var m = term(); if (reader.readMatch("?") !== null) { return m.question(); } else if (reader.readMatch("*") !== null) { return m.star(); } else if (reader.readMatch("+") !== null) { return m.plus(); } else if (reader.readMatch("#") !== null) { return m.hash(); } else if (reader.readMatch(/^\{\s*/) !== null) { var min = eat(/^\d+/); eat(/^\s*,\s*/); var max = eat(/^\d+/); eat(/^\s*\}/); return m.braces(+min, +max); } return m; }; term = function() { // term = <nt> | literal | "[ " expression " ]" if (reader.readMatch("[ ") !== null) { var m = expr(); eat(" ]"); return m; } return Matcher.fromType(eat(/^[^ ?*+#{]+/)); }; result = expr(); if (!reader.eof()) { throw new SyntaxError( "Expected end of string", reader.getLine(), reader.getCol()); } return result; }; /** * Convert a string to a matcher (parsing simple alternations), * or do nothing if the argument is already a matcher. */ Matcher.cast = function(m) { if (m instanceof Matcher) { return m; } return Matcher.parse(m); }; /** * Create a matcher for a single type. */ Matcher.fromType = function(type) { // Late require of ValidationTypes to break a dependency cycle. var ValidationTypes = require("./ValidationTypes"); return new Matcher(function(expression) { return expression.hasNext() && ValidationTypes.isType(expression, type); }, type); }; /** * Create a matcher for one or more juxtaposed words, which all must * occur, in the given order. */ Matcher.seq = function() { var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); if (ms.length === 1) { return ms[0]; } return new Matcher(function(expression) { var i, result = true; for (i = 0; result && i < ms.length; i++) { result = ms[i].match(expression); } return result; }, function(prec) { var p = Matcher.prec.SEQ; var s = ms.map(function(m) { return m.toString(p); }).join(" "); if (prec > p) { s = "[ " + s + " ]"; } return s; }); }; /** * Create a matcher for one or more alternatives, where exactly one * must occur. */ Matcher.alt = function() { var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); if (ms.length === 1) { return ms[0]; } return new Matcher(function(expression) { var i, result = false; for (i = 0; !result && i < ms.length; i++) { result = ms[i].match(expression); } return result; }, function(prec) { var p = Matcher.prec.ALT; var s = ms.map(function(m) { return m.toString(p); }).join(" | "); if (prec > p) { s = "[ " + s + " ]"; } return s; }); }; /** * Create a matcher for two or more options. This implements the * double bar (||) and double ampersand (&&) operators, as well as * variants of && where some of the alternatives are optional. * This will backtrack through even successful matches to try to * maximize the number of items matched. */ Matcher.many = function(required) { var ms = Array.prototype.slice.call(arguments, 1).reduce(function(acc, v) { if (v.expand) { // Insert all of the options for the given complex rule as // individual options. var ValidationTypes = require("./ValidationTypes"); acc.push.apply(acc, ValidationTypes.complex[v.expand].options); } else { acc.push(Matcher.cast(v)); } return acc; }, []); if (required === true) { required = ms.map(function() { return true; }); } var result = new Matcher(function(expression) { var seen = [], max = 0, pass = 0; var success = function(matchCount) { if (pass === 0) { max = Math.max(matchCount, max); return matchCount === ms.length; } else { return matchCount === max; } }; var tryMatch = function(matchCount) { for (var i = 0; i < ms.length; i++) { if (seen[i]) { continue; } expression.mark(); if (ms[i].match(expression)) { seen[i] = true; // Increase matchCount iff this was a required element // (or if all the elements are optional) if (tryMatch(matchCount + ((required === false || required[i]) ? 1 : 0))) { expression.drop(); return true; } // Backtrack: try *not* matching using this rule, and // let's see if it leads to a better overall match. expression.restore(); seen[i] = false; } else { expression.drop(); } } return success(matchCount); }; if (!tryMatch(0)) { // Couldn't get a complete match, retrace our steps to make the // match with the maximum # of required elements. pass++; tryMatch(0); } if (required === false) { return max > 0; } // Use finer-grained specification of which matchers are required. for (var i = 0; i < ms.length; i++) { if (required[i] && !seen[i]) { return false; } } return true; }, function(prec) { var p = required === false ? Matcher.prec.OROR : Matcher.prec.ANDAND; var s = ms.map(function(m, i) { if (required !== false && !required[i]) { return m.toString(Matcher.prec.MOD) + "?"; } return m.toString(p); }).join(required === false ? " || " : " && "); if (prec > p) { s = "[ " + s + " ]"; } return s; }); result.options = ms; return result; }; /** * Create a matcher for two or more options, where all options are * mandatory but they may appear in any order. */ Matcher.andand = function() { var args = Array.prototype.slice.call(arguments); args.unshift(true); return Matcher.many.apply(Matcher, args); }; /** * Create a matcher for two or more options, where options are * optional and may appear in any order, but at least one must be * present. */ Matcher.oror = function() { var args = Array.prototype.slice.call(arguments); args.unshift(false); return Matcher.many.apply(Matcher, args); }; /** Instance methods on Matchers. */ Matcher.prototype = { constructor: Matcher, // These are expected to be overridden in every instance. match: function() { throw new Error("unimplemented"); }, toString: function() { throw new Error("unimplemented"); }, // This returns a standalone function to do the matching. func: function() { return this.match.bind(this); }, // Basic combinators then: function(m) { return Matcher.seq(this, m); }, or: function(m) { return Matcher.alt(this, m); }, andand: function(m) { return Matcher.many(true, this, m); }, oror: function(m) { return Matcher.many(false, this, m); }, // Component value multipliers star: function() { return this.braces(0, Infinity, "*"); }, plus: function() { return this.braces(1, Infinity, "+"); }, question: function() { return this.braces(0, 1, "?"); }, hash: function() { return this.braces(1, Infinity, "#", Matcher.cast(",")); }, braces: function(min, max, marker, optSep) { var m1 = this, m2 = optSep ? optSep.then(this) : this; if (!marker) { marker = "{" + min + "," + max + "}"; } return new Matcher(function(expression) { var result = true, i; for (i = 0; i < max; i++) { if (i > 0 && optSep) { result = m2.match(expression); } else { result = m1.match(expression); } if (!result) { break; } } return i >= min; }, function() { return m1.toString(Matcher.prec.MOD) + marker; }); } }; },{"../util/StringReader":24,"../util/SyntaxError":25,"./ValidationTypes":21}],4:[function(require,module,exports){ "use strict"; module.exports = MediaFeature; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a media feature, such as max-width:500. * @namespace parserlib.css * @class MediaFeature * @extends parserlib.util.SyntaxUnit * @constructor * @param {SyntaxUnit} name The name of the feature. * @param {SyntaxUnit} value The value of the feature or null if none. */ function MediaFeature(name, value) { SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); /** * The name of the media feature * @type String * @property name */ this.name = name; /** * The value for the feature or null if there is none. * @type SyntaxUnit * @property value */ this.value = value; } MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; },{"../util/SyntaxUnit":26,"./Parser":6}],5:[function(require,module,exports){ "use strict"; module.exports = MediaQuery; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents an individual media query. * @namespace parserlib.css * @class MediaQuery * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} modifier The modifier "not" or "only" (or null). * @param {String} mediaType The type of media (i.e., "print"). * @param {Array} parts Array of selectors parts making up this selector. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function MediaQuery(modifier, mediaType, features, line, col) { SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); /** * The media modifier ("not" or "only") * @type String * @property modifier */ this.modifier = modifier; /** * The mediaType (i.e., "print") * @type String * @property mediaType */ this.mediaType = mediaType; /** * The parts that make up the selector. * @type Array * @property features */ this.features = features; } MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; },{"../util/SyntaxUnit":26,"./Parser":6}],6:[function(require,module,exports){ "use strict"; module.exports = Parser; var EventTarget = require("../util/EventTarget"); var SyntaxError = require("../util/SyntaxError"); var SyntaxUnit = require("../util/SyntaxUnit"); var Combinator = require("./Combinator"); var MediaFeature = require("./MediaFeature"); var MediaQuery = require("./MediaQuery"); var PropertyName = require("./PropertyName"); var PropertyValue = require("./PropertyValue"); var PropertyValuePart = require("./PropertyValuePart"); var Selector = require("./Selector"); var SelectorPart = require("./SelectorPart"); var SelectorSubPart = require("./SelectorSubPart"); var TokenStream = require("./TokenStream"); var Tokens = require("./Tokens"); var Validation = require("./Validation"); /** * A CSS3 parser. * @namespace parserlib.css * @class Parser * @constructor * @param {Object} options (Optional) Various options for the parser: * starHack (true|false) to allow IE6 star hack as valid, * underscoreHack (true|false) to interpret leading underscores * as IE6-7 targeting for known properties, ieFilters (true|false) * to indicate that IE < 8 filters should be accepted and not throw * syntax errors. */ function Parser(options) { //inherit event functionality EventTarget.call(this); this.options = options || {}; this._tokenStream = null; } //Static constants Parser.DEFAULT_TYPE = 0; Parser.COMBINATOR_TYPE = 1; Parser.MEDIA_FEATURE_TYPE = 2; Parser.MEDIA_QUERY_TYPE = 3; Parser.PROPERTY_NAME_TYPE = 4; Parser.PROPERTY_VALUE_TYPE = 5; Parser.PROPERTY_VALUE_PART_TYPE = 6; Parser.SELECTOR_TYPE = 7; Parser.SELECTOR_PART_TYPE = 8; Parser.SELECTOR_SUB_PART_TYPE = 9; Parser.prototype = function() { var proto = new EventTarget(), //new prototype prop, additions = { __proto__: null, //restore constructor constructor: Parser, //instance constants - yuck DEFAULT_TYPE : 0, COMBINATOR_TYPE : 1, MEDIA_FEATURE_TYPE : 2, MEDIA_QUERY_TYPE : 3, PROPERTY_NAME_TYPE : 4, PROPERTY_VALUE_TYPE : 5, PROPERTY_VALUE_PART_TYPE : 6, SELECTOR_TYPE : 7, SELECTOR_PART_TYPE : 8, SELECTOR_SUB_PART_TYPE : 9, //----------------------------------------------------------------- // Grammar //----------------------------------------------------------------- _stylesheet: function() { /* * stylesheet * : [ CHARSET_SYM S* STRING S* ';' ]? * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* * [ namespace [S|CDO|CDC]* ]* * [ [ ruleset | media | page | font_face | keyframes_rule | supports_rule ] [S|CDO|CDC]* ]* * ; */ var tokenStream = this._tokenStream, count, token, tt; this.fire("startstylesheet"); //try to read character set this._charset(); this._skipCruft(); //try to read imports - may be more than one while (tokenStream.peek() === Tokens.IMPORT_SYM) { this._import(); this._skipCruft(); } //try to read namespaces - may be more than one while (tokenStream.peek() === Tokens.NAMESPACE_SYM) { this._namespace(); this._skipCruft(); } //get the next token tt = tokenStream.peek(); //try to read the rest while (tt > Tokens.EOF) { try { switch (tt) { case Tokens.MEDIA_SYM: this._media(); this._skipCruft(); break; case Tokens.PAGE_SYM: this._page(); this._skipCruft(); break; case Tokens.FONT_FACE_SYM: this._font_face(); this._skipCruft(); break; case Tokens.KEYFRAMES_SYM: this._keyframes(); this._skipCruft(); break; case Tokens.VIEWPORT_SYM: this._viewport(); this._skipCruft(); break; case Tokens.DOCUMENT_SYM: this._document(); this._skipCruft(); break; case Tokens.SUPPORTS_SYM: this._supports(); this._skipCruft(); break; case Tokens.UNKNOWN_SYM: //unknown @ rule tokenStream.get(); if (!this.options.strict) { //fire error event this.fire({ type: "error", error: null, message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", line: tokenStream.LT(0).startLine, col: tokenStream.LT(0).startCol }); //skip braces count=0; while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) { count++; //keep track of nesting depth } while (count) { tokenStream.advance([Tokens.RBRACE]); count--; } } else { //not a syntax error, rethrow it throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); } break; case Tokens.S: this._readWhitespace(); break; default: if (!this._ruleset()) { //error handling for known issues switch (tt) { case Tokens.CHARSET_SYM: token = tokenStream.LT(1); this._charset(false); throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); case Tokens.IMPORT_SYM: token = tokenStream.LT(1); this._import(false); throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); case Tokens.NAMESPACE_SYM: token = tokenStream.LT(1); this._namespace(false); throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); default: tokenStream.get(); //get the last token this._unexpectedToken(tokenStream.token()); } } } } catch (ex) { if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); } else { throw ex; } } tt = tokenStream.peek(); } if (tt !== Tokens.EOF) { this._unexpectedToken(tokenStream.token()); } this.fire("endstylesheet"); }, _charset: function(emit) { var tokenStream = this._tokenStream, charset, token, line, col; if (tokenStream.match(Tokens.CHARSET_SYM)) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); tokenStream.mustMatch(Tokens.STRING); token = tokenStream.token(); charset = token.value; this._readWhitespace(); tokenStream.mustMatch(Tokens.SEMICOLON); if (emit !== false) { this.fire({ type: "charset", charset:charset, line: line, col: col }); } } }, _import: function(emit) { /* * import * : IMPORT_SYM S* * [STRING|URI] S* media_query_list? ';' S* */ var tokenStream = this._tokenStream, uri, importToken, mediaList = []; //read import symbol tokenStream.mustMatch(Tokens.IMPORT_SYM); importToken = tokenStream.token(); this._readWhitespace(); tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); //grab the URI value uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); this._readWhitespace(); mediaList = this._media_query_list(); //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); if (emit !== false) { this.fire({ type: "import", uri: uri, media: mediaList, line: importToken.startLine, col: importToken.startCol }); } }, _namespace: function(emit) { /* * namespace * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* */ var tokenStream = this._tokenStream, line, col, prefix, uri; //read import symbol tokenStream.mustMatch(Tokens.NAMESPACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT if (tokenStream.match(Tokens.IDENT)) { prefix = tokenStream.token().value; this._readWhitespace(); } tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); /*if (!tokenStream.match(Tokens.STRING)){ tokenStream.mustMatch(Tokens.URI); }*/ //grab the URI value uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); this._readWhitespace(); //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); if (emit !== false) { this.fire({ type: "namespace", prefix: prefix, uri: uri, line: line, col: col }); } }, _supports: function(emit) { /* * supports_rule * : SUPPORTS_SYM S* supports_condition S* group_rule_body * ; */ var tokenStream = this._tokenStream, line, col; if (tokenStream.match(Tokens.SUPPORTS_SYM)) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); this._supports_condition(); this._readWhitespace(); tokenStream.mustMatch(Tokens.LBRACE); this._readWhitespace(); if (emit !== false) { this.fire({ type: "startsupports", line: line, col: col }); } while (true) { if (!this._ruleset()) { break; } } tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); this.fire({ type: "endsupports", line: line, col: col }); } }, _supports_condition: function() { /* * supports_condition * : supports_negation | supports_conjunction | supports_disjunction | * supports_condition_in_parens * ; */ var tokenStream = this._tokenStream, ident; if (tokenStream.match(Tokens.IDENT)) { ident = tokenStream.token().value.toLowerCase(); if (ident === "not") { tokenStream.mustMatch(Tokens.S); this._supports_condition_in_parens(); } else { tokenStream.unget(); } } else { this._supports_condition_in_parens(); this._readWhitespace(); while (tokenStream.peek() === Tokens.IDENT) { ident = tokenStream.LT(1).value.toLowerCase(); if (ident === "and" || ident === "or") { tokenStream.mustMatch(Tokens.IDENT); this._readWhitespace(); this._supports_condition_in_parens(); this._readWhitespace(); } } } }, _supports_condition_in_parens: function() { /* * supports_condition_in_parens * : ( '(' S* supports_condition S* ')' ) | supports_declaration_condition | * general_enclosed * ; */ var tokenStream = this._tokenStream, ident; if (tokenStream.match(Tokens.LPAREN)) { this._readWhitespace(); if (tokenStream.match(Tokens.IDENT)) { // look ahead for not keyword, if not given, continue with declaration condition. ident = tokenStream.token().value.toLowerCase(); if (ident === "not") { this._readWhitespace(); this._supports_condition(); this._readWhitespace(); tokenStream.mustMatch(Tokens.RPAREN); } else { tokenStream.unget(); this._supports_declaration_condition(false); } } else { this._supports_condition(); this._readWhitespace(); tokenStream.mustMatch(Tokens.RPAREN); } } else { this._supports_declaration_condition(); } }, _supports_declaration_condition: function(requireStartParen) { /* * supports_declaration_condition * : '(' S* declaration ')' * ; */ var tokenStream = this._tokenStream; if (requireStartParen !== false) { tokenStream.mustMatch(Tokens.LPAREN); } this._readWhitespace(); this._declaration(); tokenStream.mustMatch(Tokens.RPAREN); }, _media: function() { /* * media * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, mediaList;// = []; //look for @media tokenStream.mustMatch(Tokens.MEDIA_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); mediaList = this._media_query_list(); tokenStream.mustMatch(Tokens.LBRACE); this._readWhitespace(); this.fire({ type: "startmedia", media: mediaList, line: line, col: col }); while (true) { if (tokenStream.peek() === Tokens.PAGE_SYM) { this._page(); } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) { this._font_face(); } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) { this._viewport(); } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) { this._document(); } else if (tokenStream.peek() === Tokens.SUPPORTS_SYM) { this._supports(); } else if (tokenStream.peek() === Tokens.MEDIA_SYM) { this._media(); } else if (!this._ruleset()) { break; } } tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); this.fire({ type: "endmedia", media: mediaList, line: line, col: col }); }, //CSS3 Media Queries _media_query_list: function() { /* * media_query_list * : S* [media_query [ ',' S* media_query ]* ]? * ; */ var tokenStream = this._tokenStream, mediaList = []; this._readWhitespace(); if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) { mediaList.push(this._media_query()); } while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); mediaList.push(this._media_query()); } return mediaList; }, /* * Note: "expression" in the grammar maps to the _media_expression * method. */ _media_query: function() { /* * media_query * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* * | expression [ AND S* expression ]* * ; */ var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = []; if (tokenStream.match(Tokens.IDENT)) { ident = tokenStream.token().value.toLowerCase(); //since there's no custom tokens for these, need to manually check if (ident !== "only" && ident !== "not") { tokenStream.unget(); ident = null; } else { token = tokenStream.token(); } } this._readWhitespace(); if (tokenStream.peek() === Tokens.IDENT) { type = this._media_type(); if (token === null) { token = tokenStream.token(); } } else if (tokenStream.peek() === Tokens.LPAREN) { if (token === null) { token = tokenStream.LT(1); } expressions.push(this._media_expression()); } if (type === null && expressions.length === 0) { return null; } else { this._readWhitespace(); while (tokenStream.match(Tokens.IDENT)) { if (tokenStream.token().value.toLowerCase() !== "and") { this._unexpectedToken(tokenStream.token()); } this._readWhitespace(); expressions.push(this._media_expression()); } } return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); }, //CSS3 Media Queries _media_type: function() { /* * media_type * : IDENT * ; */ return this._media_feature(); }, /** * Note: in CSS3 Media Queries, this is called "expression". * Renamed here to avoid conflict with CSS3 Selectors * definition of "expression". Also note that "expr" in the * grammar now maps to "expression" from CSS3 selectors. * @method _media_expression * @private */ _media_expression: function() { /* * expression * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* * ; */ var tokenStream = this._tokenStream, feature = null, token, expression = null; tokenStream.mustMatch(Tokens.LPAREN); feature = this._media_feature(); this._readWhitespace(); if (tokenStream.match(Tokens.COLON)) { this._readWhitespace(); token = tokenStream.LT(1); expression = this._expression(); } tokenStream.mustMatch(Tokens.RPAREN); this._readWhitespace(); return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null); }, //CSS3 Media Queries _media_feature: function() { /* * media_feature * : IDENT * ; */ var tokenStream = this._tokenStream; this._readWhitespace(); tokenStream.mustMatch(Tokens.IDENT); return SyntaxUnit.fromToken(tokenStream.token()); }, //CSS3 Paged Media _page: function() { /* * page: * PAGE_SYM S* IDENT? pseudo_page? S* * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, identifier = null, pseudoPage = null; //look for @page tokenStream.mustMatch(Tokens.PAGE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); if (tokenStream.match(Tokens.IDENT)) { identifier = tokenStream.token().value; //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. if (identifier.toLowerCase() === "auto") { this._unexpectedToken(tokenStream.token()); } } //see if there's a colon upcoming if (tokenStream.peek() === Tokens.COLON) { pseudoPage = this._pseudo_page(); } this._readWhitespace(); this.fire({ type: "startpage", id: identifier, pseudo: pseudoPage, line: line, col: col }); this._readDeclarations(true, true); this.fire({ type: "endpage", id: identifier, pseudo: pseudoPage, line: line, col: col }); }, //CSS3 Paged Media _margin: function() { /* * margin : * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym(); if (marginSym) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; this.fire({ type: "startpagemargin", margin: marginSym, line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endpagemargin", margin: marginSym, line: line, col: col }); return true; } else { return false; } }, //CSS3 Paged Media _margin_sym: function() { /* * margin_sym : * TOPLEFTCORNER_SYM | * TOPLEFT_SYM | * TOPCENTER_SYM | * TOPRIGHT_SYM | * TOPRIGHTCORNER_SYM | * BOTTOMLEFTCORNER_SYM | * BOTTOMLEFT_SYM | * BOTTOMCENTER_SYM | * BOTTOMRIGHT_SYM | * BOTTOMRIGHTCORNER_SYM | * LEFTTOP_SYM | * LEFTMIDDLE_SYM | * LEFTBOTTOM_SYM | * RIGHTTOP_SYM | * RIGHTMIDDLE_SYM | * RIGHTBOTTOM_SYM * ; */ var tokenStream = this._tokenStream; if (tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) { return SyntaxUnit.fromToken(tokenStream.token()); } else { return null; } }, _pseudo_page: function() { /* * pseudo_page * : ':' IDENT * ; */ var tokenStream = this._tokenStream; tokenStream.mustMatch(Tokens.COLON); tokenStream.mustMatch(Tokens.IDENT); //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed return tokenStream.token().value; }, _font_face: function() { /* * font_face * : FONT_FACE_SYM S* * '{' S* declaration [ ';' S* declaration ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col; //look for @page tokenStream.mustMatch(Tokens.FONT_FACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); this.fire({ type: "startfontface", line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endfontface", line: line, col: col }); }, _viewport: function() { /* * viewport * : VIEWPORT_SYM S* * '{' S* declaration? [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col; tokenStream.mustMatch(Tokens.VIEWPORT_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); this.fire({ type: "startviewport", line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endviewport", line: line, col: col }); }, _document: function() { /* * document * : DOCUMENT_SYM S* * _document_function [ ',' S* _document_function ]* S* * '{' S* ruleset* '}' * ; */ var tokenStream = this._tokenStream, token, functions = [], prefix = ""; tokenStream.mustMatch(Tokens.DOCUMENT_SYM); token = tokenStream.token(); if (/^@\-([^\-]+)\-/.test(token.value)) { prefix = RegExp.$1; } this._readWhitespace(); functions.push(this._document_function()); while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); functions.push(this._document_function()); } tokenStream.mustMatch(Tokens.LBRACE); this._readWhitespace(); this.fire({ type: "startdocument", functions: functions, prefix: prefix, line: token.startLine, col: token.startCol }); var ok = true; while (ok) { switch (tokenStream.peek()) { case Tokens.PAGE_SYM: this._page(); break; case Tokens.FONT_FACE_SYM: this._font_face(); break; case Tokens.VIEWPORT_SYM: this._viewport(); break; case Tokens.MEDIA_SYM: this._media(); break; case Tokens.KEYFRAMES_SYM: this._keyframes(); break; case Tokens.DOCUMENT_SYM: this._document(); break; default: ok = Boolean(this._ruleset()); } } tokenStream.mustMatch(Tokens.RBRACE); token = tokenStream.token(); this._readWhitespace(); this.fire({ type: "enddocument", functions: functions, prefix: prefix, line: token.startLine, col: token.startCol }); }, _document_function: function() { /* * document_function * : function | URI S* * ; */ var tokenStream = this._tokenStream, value; if (tokenStream.match(Tokens.URI)) { value = tokenStream.token().value; this._readWhitespace(); } else { value = this._function(); } return value; }, _operator: function(inFunction) { /* * operator (outside function) * : '/' S* | ',' S* | /( empty )/ * operator (inside function) * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ * ; */ var tokenStream = this._tokenStream, token = null; if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))) { token = tokenStream.token(); this._readWhitespace(); } return token ? PropertyValuePart.fromToken(token) : null; }, _combinator: function() { /* * combinator * : PLUS S* | GREATER S* | TILDE S* | S+ * ; */ var tokenStream = this._tokenStream, value = null, token; if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) { token = tokenStream.token(); value = new Combinator(token.value, token.startLine, token.startCol); this._readWhitespace(); } return value; }, _unary_operator: function() { /* * unary_operator * : '-' | '+' * ; */ var tokenStream = this._tokenStream; if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) { return tokenStream.token().value; } else { return null; } }, _property: function() { /* * property * : IDENT S* * ; */ var tokenStream = this._tokenStream, value = null, hack = null, tokenValue, token, line, col; //check for star hack - throws error if not allowed if (tokenStream.peek() === Tokens.STAR && this.options.starHack) { tokenStream.get(); token = tokenStream.token(); hack = token.value; line = token.startLine; col = token.startCol; } if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); tokenValue = token.value; //check for underscore hack - no error if not allowed because it's valid CSS syntax if (tokenValue.charAt(0) === "_" && this.options.underscoreHack) { hack = "_"; tokenValue = tokenValue.substring(1); } value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); this._readWhitespace(); } return value; }, //Augmented with CSS3 Selectors _ruleset: function() { /* * ruleset * : selectors_group * '{' S* declaration? [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, tt, selectors; /* * Error Recovery: If even a single selector fails to parse, * then the entire ruleset should be thrown away. */ try { selectors = this._selectors_group(); } catch (ex) { if (ex instanceof SyntaxError && !this.options.strict) { //fire error event this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); //skip over everything until closing brace tt = tokenStream.advance([Tokens.RBRACE]); if (tt === Tokens.RBRACE) { //if there's a right brace, the rule is finished so don't do anything } else { //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { //not a syntax error, rethrow it throw ex; } //trigger parser to continue return true; } //if it got here, all selectors parsed if (selectors) { this.fire({ type: "startrule", selectors: selectors, line: selectors[0].line, col: selectors[0].col }); this._readDeclarations(true); this.fire({ type: "endrule", selectors: selectors, line: selectors[0].line, col: selectors[0].col }); } return selectors; }, //CSS3 Selectors _selectors_group: function() { /* * selectors_group * : selector [ COMMA S* selector ]* * ; */ var tokenStream = this._tokenStream, selectors = [], selector; selector = this._selector(); if (selector !== null) { selectors.push(selector); while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); selector = this._selector(); if (selector !== null) { selectors.push(selector); } else { this._unexpectedToken(tokenStream.LT(1)); } } } return selectors.length ? selectors : null; }, //CSS3 Selectors _selector: function() { /* * selector * : simple_selector_sequence [ combinator simple_selector_sequence ]* * ; */ var tokenStream = this._tokenStream, selector = [], nextSelector = null, combinator = null, ws = null; //if there's no simple selector, then there's no selector nextSelector = this._simple_selector_sequence(); if (nextSelector === null) { return null; } selector.push(nextSelector); do { //look for a combinator combinator = this._combinator(); if (combinator !== null) { selector.push(combinator); nextSelector = this._simple_selector_sequence(); //there must be a next selector if (nextSelector === null) { this._unexpectedToken(tokenStream.LT(1)); } else { //nextSelector is an instance of SelectorPart selector.push(nextSelector); } } else { //if there's not whitespace, we're done if (this._readWhitespace()) { //add whitespace separator ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); //combinator is not required combinator = this._combinator(); //selector is required if there's a combinator nextSelector = this._simple_selector_sequence(); if (nextSelector === null) { if (combinator !== null) { this._unexpectedToken(tokenStream.LT(1)); } } else { if (combinator !== null) { selector.push(combinator); } else { selector.push(ws); } selector.push(nextSelector); } } else { break; } } } while (true); return new Selector(selector, selector[0].line, selector[0].col); }, //CSS3 Selectors _simple_selector_sequence: function() { /* * simple_selector_sequence * : [ type_selector | universal ] * [ HASH | class | attrib | pseudo | negation ]* * | [ HASH | class | attrib | pseudo | negation ]+ * ; */ var tokenStream = this._tokenStream, //parts of a simple selector elementName = null, modifiers = [], //complete selector text selectorText= "", //the different parts after the element name to search for components = [ //HASH function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; }, this._class, this._attrib, this._pseudo, this._negation ], i = 0, len = components.length, component = null, line, col; //get starting line and column for the selector line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; elementName = this._type_selector(); if (!elementName) { elementName = this._universal(); } if (elementName !== null) { selectorText += elementName; } while (true) { //whitespace means we're done if (tokenStream.peek() === Tokens.S) { break; } //check for each component while (i < len && component === null) { component = components[i++].call(this); } if (component === null) { //we don't have a selector if (selectorText === "") { return null; } else { break; } } else { i = 0; modifiers.push(component); selectorText += component.toString(); component = null; } } return selectorText !== "" ? new SelectorPart(elementName, modifiers, selectorText, line, col) : null; }, //CSS3 Selectors _type_selector: function() { /* * type_selector * : [ namespace_prefix ]? element_name * ; */ var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name(); if (!elementName) { /* * Need to back out the namespace that was read due to both * type_selector and universal reading namespace_prefix * first. Kind of hacky, but only way I can figure out * right now how to not change the grammar. */ if (ns) { tokenStream.unget(); if (ns.length > 1) { tokenStream.unget(); } } return null; } else { if (ns) { elementName.text = ns + elementName.text; elementName.col -= ns.length; } return elementName; } }, //CSS3 Selectors _class: function() { /* * class * : '.' IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.DOT)) { tokenStream.mustMatch(Tokens.IDENT); token = tokenStream.token(); return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); } else { return null; } }, //CSS3 Selectors _element_name: function() { /* * element_name * : IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); } else { return null; } }, //CSS3 Selectors _namespace_prefix: function() { /* * namespace_prefix * : [ IDENT | '*' ]? '|' * ; */ var tokenStream = this._tokenStream, value = ""; //verify that this is a namespace prefix if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) { if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) { value += tokenStream.token().value; } tokenStream.mustMatch(Tokens.PIPE); value += "|"; } return value.length ? value : null; }, //CSS3 Selectors _universal: function() { /* * universal * : [ namespace_prefix ]? '*' * ; */ var tokenStream = this._tokenStream, value = "", ns; ns = this._namespace_prefix(); if (ns) { value += ns; } if (tokenStream.match(Tokens.STAR)) { value += "*"; } return value.length ? value : null; }, //CSS3 Selectors _attrib: function() { /* * attrib * : '[' S* [ namespace_prefix ]? IDENT S* * [ [ PREFIXMATCH | * SUFFIXMATCH | * SUBSTRINGMATCH | * '=' | * INCLUDES | * DASHMATCH ] S* [ IDENT | STRING ] S* * ]? ']' * ; */ var tokenStream = this._tokenStream, value = null, ns, token; if (tokenStream.match(Tokens.LBRACKET)) { token = tokenStream.token(); value = token.value; value += this._readWhitespace(); ns = this._namespace_prefix(); if (ns) { value += ns; } tokenStream.mustMatch(Tokens.IDENT); value += tokenStream.token().value; value += this._readWhitespace(); if (tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])) { value += tokenStream.token().value; value += this._readWhitespace(); tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); value += tokenStream.token().value; value += this._readWhitespace(); } tokenStream.mustMatch(Tokens.RBRACKET); return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); } else { return null; } }, //CSS3 Selectors _pseudo: function() { /* * pseudo * : ':' ':'? [ IDENT | functional_pseudo ] * ; */ var tokenStream = this._tokenStream, pseudo = null, colons = ":", line, col; if (tokenStream.match(Tokens.COLON)) { if (tokenStream.match(Tokens.COLON)) { colons += ":"; } if (tokenStream.match(Tokens.IDENT)) { pseudo = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol - colons.length; } else if (tokenStream.peek() === Tokens.FUNCTION) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol - colons.length; pseudo = this._functional_pseudo(); } if (pseudo) { pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); } else { var startLine = tokenStream.LT(1).startLine, startCol = tokenStream.LT(0).startCol; throw new SyntaxError("Expected a `FUNCTION` or `IDENT` after colon at line " + startLine + ", col " + startCol + ".", startLine, startCol); } } return pseudo; }, //CSS3 Selectors _functional_pseudo: function() { /* * functional_pseudo * : FUNCTION S* expression ')' * ; */ var tokenStream = this._tokenStream, value = null; if (tokenStream.match(Tokens.FUNCTION)) { value = tokenStream.token().value; value += this._readWhitespace(); value += this._expression(); tokenStream.mustMatch(Tokens.RPAREN); value += ")"; } return value; }, //CSS3 Selectors _expression: function() { /* * expression * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ * ; */ var tokenStream = this._tokenStream, value = ""; while (tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, Tokens.RESOLUTION, Tokens.SLASH])) { value += tokenStream.token().value; value += this._readWhitespace(); } return value.length ? value : null; }, //CSS3 Selectors _negation: function() { /* * negation * : NOT S* negation_arg S* ')' * ; */ var tokenStream = this._tokenStream, line, col, value = "", arg, subpart = null; if (tokenStream.match(Tokens.NOT)) { value = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol; value += this._readWhitespace(); arg = this._negation_arg(); value += arg; value += this._readWhitespace(); tokenStream.match(Tokens.RPAREN); value += tokenStream.token().value; subpart = new SelectorSubPart(value, "not", line, col); subpart.args.push(arg); } return subpart; }, //CSS3 Selectors _negation_arg: function() { /* * negation_arg * : type_selector | universal | HASH | class | attrib | pseudo * ; */ var tokenStream = this._tokenStream, args = [ this._type_selector, this._universal, function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; }, this._class, this._attrib, this._pseudo ], arg = null, i = 0, len = args.length, line, col, part; line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; while (i < len && arg === null) { arg = args[i].call(this); i++; } //must be a negation arg if (arg === null) { this._unexpectedToken(tokenStream.LT(1)); } //it's an element name if (arg.type === "elementName") { part = new SelectorPart(arg, [], arg.toString(), line, col); } else { part = new SelectorPart(null, [arg], arg.toString(), line, col); } return part; }, _declaration: function() { /* * declaration * : property ':' S* expr prio? * | /( empty )/ * ; */ var tokenStream = this._tokenStream, property = null, expr = null, prio = null, invalid = null, propertyName= ""; property = this._property(); if (property !== null) { tokenStream.mustMatch(Tokens.COLON); this._readWhitespace(); expr = this._expr(); //if there's no parts for the value, it's an error if (!expr || expr.length === 0) { this._unexpectedToken(tokenStream.LT(1)); } prio = this._prio(); /* * If hacks should be allowed, then only check the root * property. If hacks should not be allowed, treat * _property or *property as invalid properties. */ propertyName = property.toString(); if (this.options.starHack && property.hack === "*" || this.options.underscoreHack && property.hack === "_") { propertyName = property.text; } try { this._validateProperty(propertyName, expr); } catch (ex) { invalid = ex; } this.fire({ type: "property", property: property, value: expr, important: prio, line: property.line, col: property.col, invalid: invalid }); return true; } else { return false; } }, _prio: function() { /* * prio * : IMPORTANT_SYM S* * ; */ var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM); this._readWhitespace(); return result; }, _expr: function(inFunction) { /* * expr * : term [ operator term ]* * ; */ var values = [], //valueParts = [], value = null, operator = null; value = this._term(inFunction); if (value !== null) { values.push(value); do { operator = this._operator(inFunction); //if there's an operator, keep building up the value parts if (operator) { values.push(operator); } /*else { //if there's not an operator, you have a full value values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); valueParts = []; }*/ value = this._term(inFunction); if (value === null) { break; } else { values.push(value); } } while (true); } //cleanup /*if (valueParts.length) { values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); }*/ return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, _term: function(inFunction) { /* * term * : unary_operator? * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | * TIME S* | FREQ S* | function | ie_function ] * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor * ; */ var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, part = null, token, line, col; //returns the operator or null unary = this._unary_operator(); if (unary !== null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } //exception for IE filters if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) { value = this._ie_function(); if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } //see if it's a simple block } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) { token = tokenStream.token(); endChar = token.endChar; value = token.value + this._expr(inFunction).text; if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } tokenStream.mustMatch(Tokens.type(endChar)); value += endChar; this._readWhitespace(); //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, Tokens.ANGLE, Tokens.TIME, Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) { value = tokenStream.token().value; if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; // Correct potentially-inaccurate IDENT parsing in // PropertyValuePart constructor. part = PropertyValuePart.fromToken(tokenStream.token()); } this._readWhitespace(); } else { //see if it's a color token = this._hexcolor(); if (token === null) { //if there's no unary, get the start of the next token for line/col info if (unary === null) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; } //has to be a function if (value === null) { /* * This checks for alpha(opacity=0) style of IE * functions. IE_FUNCTION only presents progid: style. */ if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) { value = this._ie_function(); } else { value = this._function(); } } /*if (value === null) { return null; //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); }*/ } else { value = token.value; if (unary === null) { line = token.startLine; col = token.startCol; } } } return part !== null ? part : value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null; }, _function: function() { /* * function * : FUNCTION S* expr ')' S* * ; */ var tokenStream = this._tokenStream, functionText = null, expr = null, lt; if (tokenStream.match(Tokens.FUNCTION)) { functionText = tokenStream.token().value; this._readWhitespace(); expr = this._expr(true); functionText += expr; //START: Horrible hack in case it's an IE filter if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) { do { if (this._readWhitespace()) { functionText += tokenStream.token().value; } //might be second time in the loop if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } tokenStream.match(Tokens.IDENT); functionText += tokenStream.token().value; tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; //functionText += this._term(); lt = tokenStream.peek(); while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } } while (tokenStream.match([Tokens.COMMA, Tokens.S])); } //END: Horrible Hack tokenStream.match(Tokens.RPAREN); functionText += ")"; this._readWhitespace(); } return functionText; }, _ie_function: function() { /* (My own extension) * ie_function * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* * ; */ var tokenStream = this._tokenStream, functionText = null, lt; //IE function can begin like a regular function, too if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) { functionText = tokenStream.token().value; do { if (this._readWhitespace()) { functionText += tokenStream.token().value; } //might be second time in the loop if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } tokenStream.match(Tokens.IDENT); functionText += tokenStream.token().value; tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; //functionText += this._term(); lt = tokenStream.peek(); while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } } while (tokenStream.match([Tokens.COMMA, Tokens.S])); tokenStream.match(Tokens.RPAREN); functionText += ")"; this._readWhitespace(); } return functionText; }, _hexcolor: function() { /* * There is a constraint on the color that it must * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) * after the "#"; e.g., "#000" is OK, but "#abcd" is not. * * hexcolor * : HASH S* * ; */ var tokenStream = this._tokenStream, token = null, color; if (tokenStream.match(Tokens.HASH)) { //need to do some validation here token = tokenStream.token(); color = token.value; if (!/#[a-f0-9]{3,6}/i.test(color)) { throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } this._readWhitespace(); } return token; }, //----------------------------------------------------------------- // Animations methods //----------------------------------------------------------------- _keyframes: function() { /* * keyframes: * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { * ; */ var tokenStream = this._tokenStream, token, tt, name, prefix = ""; tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); token = tokenStream.token(); if (/^@\-([^\-]+)\-/.test(token.value)) { prefix = RegExp.$1; } this._readWhitespace(); name = this._keyframe_name(); this._readWhitespace(); tokenStream.mustMatch(Tokens.LBRACE); this.fire({ type: "startkeyframes", name: name, prefix: prefix, line: token.startLine, col: token.startCol }); this._readWhitespace(); tt = tokenStream.peek(); //check for key while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { this._keyframe_rule(); this._readWhitespace(); tt = tokenStream.peek(); } this.fire({ type: "endkeyframes", name: name, prefix: prefix, line: token.startLine, col: token.startCol }); this._readWhitespace(); tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); }, _keyframe_name: function() { /* * keyframe_name: * : IDENT * | STRING * ; */ var tokenStream = this._tokenStream; tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); return SyntaxUnit.fromToken(tokenStream.token()); }, _keyframe_rule: function() { /* * keyframe_rule: * : key_list S* * '{' S* declaration [ ';' S* declaration ]* '}' S* * ; */ var keyList = this._key_list(); this.fire({ type: "startkeyframerule", keys: keyList, line: keyList[0].line, col: keyList[0].col }); this._readDeclarations(true); this.fire({ type: "endkeyframerule", keys: keyList, line: keyList[0].line, col: keyList[0].col }); }, _key_list: function() { /* * key_list: * : key [ S* ',' S* key]* * ; */ var tokenStream = this._tokenStream, keyList = []; //must be least one key keyList.push(this._key()); this._readWhitespace(); while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); keyList.push(this._key()); this._readWhitespace(); } return keyList; }, _key: function() { /* * There is a restriction that IDENT can be only "from" or "to". * * key * : PERCENTAGE * | IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.PERCENTAGE)) { return SyntaxUnit.fromToken(tokenStream.token()); } else if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); if (/from|to/i.test(token.value)) { return SyntaxUnit.fromToken(token); } tokenStream.unget(); } //if it gets here, there wasn't a valid token, so time to explode this._unexpectedToken(tokenStream.LT(1)); }, //----------------------------------------------------------------- // Helper methods //----------------------------------------------------------------- /** * Not part of CSS grammar, but useful for skipping over * combination of white space and HTML-style comments. * @return {void} * @method _skipCruft * @private */ _skipCruft: function() { while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) { //noop } }, /** * Not part of CSS grammar, but this pattern occurs frequently * in the official CSS grammar. Split out here to eliminate * duplicate code. * @param {Boolean} checkStart Indicates if the rule should check * for the left brace at the beginning. * @param {Boolean} readMargins Indicates if the rule should check * for margin patterns. * @return {void} * @method _readDeclarations * @private */ _readDeclarations: function(checkStart, readMargins) { /* * Reads the pattern * S* '{' S* declaration [ ';' S* declaration ]* '}' S* * or * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. * A semicolon is only necessary following a declaration if there's another declaration * or margin afterwards. */ var tokenStream = this._tokenStream, tt; this._readWhitespace(); if (checkStart) { tokenStream.mustMatch(Tokens.LBRACE); } this._readWhitespace(); try { while (true) { if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())) { //noop } else if (this._declaration()) { if (!tokenStream.match(Tokens.SEMICOLON)) { break; } } else { break; } //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ // break; //} this._readWhitespace(); } tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); } catch (ex) { if (ex instanceof SyntaxError && !this.options.strict) { //fire error event this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); //see if there's another declaration tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); if (tt === Tokens.SEMICOLON) { //if there's a semicolon, then there might be another declaration this._readDeclarations(false, readMargins); } else if (tt !== Tokens.RBRACE) { //if there's a right brace, the rule is finished so don't do anything //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { //not a syntax error, rethrow it throw ex; } } }, /** * In some cases, you can end up with two white space tokens in a * row. Instead of making a change in every function that looks for * white space, this function is used to match as much white space * as necessary. * @method _readWhitespace * @return {String} The white space if found, empty string if not. * @private */ _readWhitespace: function() { var tokenStream = this._tokenStream, ws = ""; while (tokenStream.match(Tokens.S)) { ws += tokenStream.token().value; } return ws; }, /** * Throws an error when an unexpected token is found. * @param {Object} token The token that was found. * @method _unexpectedToken * @return {void} * @private */ _unexpectedToken: function(token) { throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); }, /** * Helper method used for parsing subparts of a style sheet. * @return {void} * @method _verifyEnd * @private */ _verifyEnd: function() { if (this._tokenStream.LA(1) !== Tokens.EOF) { this._unexpectedToken(this._tokenStream.LT(1)); } }, //----------------------------------------------------------------- // Validation methods //----------------------------------------------------------------- _validateProperty: function(property, value) { Validation.validate(property, value); }, //----------------------------------------------------------------- // Parsing methods //----------------------------------------------------------------- parse: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._stylesheet(); }, parseStyleSheet: function(input) { //just passthrough return this.parse(input); }, parseMediaQuery: function(input) { this._tokenStream = new TokenStream(input, Tokens); var result = this._media_query(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a property value (everything after the semicolon). * @return {parserlib.css.PropertyValue} The property value. * @throws parserlib.util.SyntaxError If an unexpected token is found. * @method parserPropertyValue */ parsePropertyValue: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); var result = this._expr(); //okay to have a trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a complete CSS rule, including selectors and * properties. * @param {String} input The text to parser. * @return {Boolean} True if the parse completed successfully, false if not. * @method parseRule */ parseRule: function(input) { this._tokenStream = new TokenStream(input, Tokens); //skip any leading white space this._readWhitespace(); var result = this._ruleset(); //skip any trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a single CSS selector (no comma) * @param {String} input The text to parse as a CSS selector. * @return {Selector} An object representing the selector. * @throws parserlib.util.SyntaxError If an unexpected token is found. * @method parseSelector */ parseSelector: function(input) { this._tokenStream = new TokenStream(input, Tokens); //skip any leading white space this._readWhitespace(); var result = this._selector(); //skip any trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses an HTML style attribute: a set of CSS declarations * separated by semicolons. * @param {String} input The text to parse as a style attribute * @return {void} * @method parseStyleAttribute */ parseStyleAttribute: function(input) { input += "}"; // for error recovery in _readDeclarations() this._tokenStream = new TokenStream(input, Tokens); this._readDeclarations(); } }; //copy over onto prototype for (prop in additions) { if (Object.prototype.hasOwnProperty.call(additions, prop)) { proto[prop] = additions[prop]; } } return proto; }(); /* nth : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* ; */ },{"../util/EventTarget":23,"../util/SyntaxError":25,"../util/SyntaxUnit":26,"./Combinator":2,"./MediaFeature":4,"./MediaQuery":5,"./PropertyName":8,"./PropertyValue":9,"./PropertyValuePart":11,"./Selector":13,"./SelectorPart":14,"./SelectorSubPart":15,"./TokenStream":17,"./Tokens":18,"./Validation":19}],7:[function(require,module,exports){ "use strict"; /* exported Properties */ var Properties = module.exports = { __proto__: null, //A "align-items" : "flex-start | flex-end | center | baseline | stretch", "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", "all" : "initial | inherit | unset", "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>", "alignment-baseline" : "auto | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "animation" : 1, "animation-delay" : "<time>#", "animation-direction" : "<single-animation-direction>#", "animation-duration" : "<time>#", "animation-fill-mode" : "[ none | forwards | backwards | both ]#", "animation-iteration-count" : "[ <number> | infinite ]#", "animation-name" : "[ none | <single-animation-name> ]#", "animation-play-state" : "[ running | paused ]#", "animation-timing-function" : 1, //vendor prefixed "-moz-animation-delay" : "<time>#", "-moz-animation-direction" : "[ normal | alternate ]#", "-moz-animation-duration" : "<time>#", "-moz-animation-iteration-count" : "[ <number> | infinite ]#", "-moz-animation-name" : "[ none | <single-animation-name> ]#", "-moz-animation-play-state" : "[ running | paused ]#", "-ms-animation-delay" : "<time>#", "-ms-animation-direction" : "[ normal | alternate ]#", "-ms-animation-duration" : "<time>#", "-ms-animation-iteration-count" : "[ <number> | infinite ]#", "-ms-animation-name" : "[ none | <single-animation-name> ]#", "-ms-animation-play-state" : "[ running | paused ]#", "-webkit-animation-delay" : "<time>#", "-webkit-animation-direction" : "[ normal | alternate ]#", "-webkit-animation-duration" : "<time>#", "-webkit-animation-fill-mode" : "[ none | forwards | backwards | both ]#", "-webkit-animation-iteration-count" : "[ <number> | infinite ]#", "-webkit-animation-name" : "[ none | <single-animation-name> ]#", "-webkit-animation-play-state" : "[ running | paused ]#", "-o-animation-delay" : "<time>#", "-o-animation-direction" : "[ normal | alternate ]#", "-o-animation-duration" : "<time>#", "-o-animation-iteration-count" : "[ <number> | infinite ]#", "-o-animation-name" : "[ none | <single-animation-name> ]#", "-o-animation-play-state" : "[ running | paused ]#", "appearance" : "none | auto", "-moz-appearance" : "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized", "-ms-appearance" : "none | icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal", "-webkit-appearance" : "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | listbox | listitem | media-fullscreen-button | media-mute-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical", "-o-appearance" : "none | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal", "azimuth" : "<azimuth>", //B "backface-visibility" : "visible | hidden", "background" : 1, "background-attachment" : "<attachment>#", "background-clip" : "<box>#", "background-color" : "<color>", "background-image" : "<bg-image>#", "background-origin" : "<box>#", "background-position" : "<bg-position>", "background-repeat" : "<repeat-style>#", "background-size" : "<bg-size>#", "baseline-shift" : "baseline | sub | super | <percentage> | <length>", "behavior" : 1, "binding" : 1, "bleed" : "<length>", "bookmark-label" : "<content> | <attr> | <string>", "bookmark-level" : "none | <integer>", "bookmark-state" : "open | closed", "bookmark-target" : "none | <uri> | <attr>", "border" : "<border-width> || <border-style> || <color>", "border-bottom" : "<border-width> || <border-style> || <color>", "border-bottom-color" : "<color>", "border-bottom-left-radius" : "<x-one-radius>", "border-bottom-right-radius" : "<x-one-radius>", "border-bottom-style" : "<border-style>", "border-bottom-width" : "<border-width>", "border-collapse" : "collapse | separate", "border-color" : "<color>{1,4}", "border-image" : 1, "border-image-outset" : "[ <length> | <number> ]{1,4}", "border-image-repeat" : "[ stretch | repeat | round ]{1,2}", "border-image-slice" : "<border-image-slice>", "border-image-source" : "<image> | none", "border-image-width" : "[ <length> | <percentage> | <number> | auto ]{1,4}", "border-left" : "<border-width> || <border-style> || <color>", "border-left-color" : "<color>", "border-left-style" : "<border-style>", "border-left-width" : "<border-width>", "border-radius" : "<border-radius>", "border-right" : "<border-width> || <border-style> || <color>", "border-right-color" : "<color>", "border-right-style" : "<border-style>", "border-right-width" : "<border-width>", "border-spacing" : "<length>{1,2}", "border-style" : "<border-style>{1,4}", "border-top" : "<border-width> || <border-style> || <color>", "border-top-color" : "<color>", "border-top-left-radius" : "<x-one-radius>", "border-top-right-radius" : "<x-one-radius>", "border-top-style" : "<border-style>", "border-top-width" : "<border-width>", "border-width" : "<border-width>{1,4}", "bottom" : "<margin-width>", "-moz-box-align" : "start | end | center | baseline | stretch", "-moz-box-decoration-break" : "slice | clone", "-moz-box-direction" : "normal | reverse", "-moz-box-flex" : "<number>", "-moz-box-flex-group" : "<integer>", "-moz-box-lines" : "single | multiple", "-moz-box-ordinal-group" : "<integer>", "-moz-box-orient" : "horizontal | vertical | inline-axis | block-axis", "-moz-box-pack" : "start | end | center | justify", "-o-box-decoration-break" : "slice | clone", "-webkit-box-align" : "start | end | center | baseline | stretch", "-webkit-box-decoration-break" : "slice | clone", "-webkit-box-direction" : "normal | reverse", "-webkit-box-flex" : "<number>", "-webkit-box-flex-group" : "<integer>", "-webkit-box-lines" : "single | multiple", "-webkit-box-ordinal-group" : "<integer>", "-webkit-box-orient" : "horizontal | vertical | inline-axis | block-axis", "-webkit-box-pack" : "start | end | center | justify", "box-decoration-break" : "slice | clone", "box-shadow" : "<box-shadow>", "box-sizing" : "content-box | border-box", "break-after" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column", "break-before" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column", "break-inside" : "auto | avoid | avoid-page | avoid-column", //C "caption-side" : "top | bottom", "clear" : "none | right | left | both", "clip" : "<shape> | auto", "-webkit-clip-path" : "<clip-source> | <clip-path> | none", "clip-path" : "<clip-source> | <clip-path> | none", "clip-rule" : "nonzero | evenodd", "color" : "<color>", "color-interpolation" : "auto | sRGB | linearRGB", "color-interpolation-filters" : "auto | sRGB | linearRGB", "color-profile" : 1, "color-rendering" : "auto | optimizeSpeed | optimizeQuality", "column-count" : "<integer> | auto", //https://www.w3.org/TR/css3-multicol/ "column-fill" : "auto | balance", "column-gap" : "<length> | normal", "column-rule" : "<border-width> || <border-style> || <color>", "column-rule-color" : "<color>", "column-rule-style" : "<border-style>", "column-rule-width" : "<border-width>", "column-span" : "none | all", "column-width" : "<length> | auto", "columns" : 1, "content" : 1, "counter-increment" : 1, "counter-reset" : 1, "crop" : "<shape> | auto", "cue" : "cue-after | cue-before", "cue-after" : 1, "cue-before" : 1, "cursor" : 1, //D "direction" : "ltr | rtl", "display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex", "dominant-baseline" : "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge", "drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>", "drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "drop-initial-before-adjust" : "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>", "drop-initial-before-align" : "caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "drop-initial-size" : "auto | line | <length> | <percentage>", "drop-initial-value" : "<integer>", //E "elevation" : "<angle> | below | level | above | higher | lower", "empty-cells" : "show | hide", "enable-background" : 1, //F "fill" : "<paint>", "fill-opacity" : "<opacity-value>", "fill-rule" : "nonzero | evenodd", "filter" : "<filter-function-list> | none", "fit" : "fill | hidden | meet | slice", "fit-position" : 1, "flex" : "<flex>", "flex-basis" : "<width>", "flex-direction" : "row | row-reverse | column | column-reverse", "flex-flow" : "<flex-direction> || <flex-wrap>", "flex-grow" : "<number>", "flex-shrink" : "<number>", "flex-wrap" : "nowrap | wrap | wrap-reverse", "-webkit-flex" : "<flex>", "-webkit-flex-basis" : "<width>", "-webkit-flex-direction" : "row | row-reverse | column | column-reverse", "-webkit-flex-flow" : "<flex-direction> || <flex-wrap>", "-webkit-flex-grow" : "<number>", "-webkit-flex-shrink" : "<number>", "-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse", "-ms-flex" : "<flex>", "-ms-flex-align" : "start | end | center | stretch | baseline", "-ms-flex-direction" : "row | row-reverse | column | column-reverse", "-ms-flex-order" : "<number>", "-ms-flex-pack" : "start | end | center | justify", "-ms-flex-wrap" : "nowrap | wrap | wrap-reverse", "float" : "left | right | none", "float-offset" : 1, "flood-color" : 1, "flood-opacity" : "<opacity-value>", "font" : "<font-shorthand> | caption | icon | menu | message-box | small-caption | status-bar", "font-family" : "<font-family>", "font-feature-settings" : "<feature-tag-value> | normal", "font-kerning" : "auto | normal | none", "font-size" : "<font-size>", "font-size-adjust" : "<number> | none", "font-stretch" : "<font-stretch>", "font-style" : "<font-style>", "font-variant" : "<font-variant> | normal | none", "font-variant-alternates" : "<font-variant-alternates> | normal", "font-variant-caps" : "<font-variant-caps> | normal", "font-variant-east-asian" : "<font-variant-east-asian> | normal", "font-variant-ligatures" : "<font-variant-ligatures> | normal | none", "font-variant-numeric" : "<font-variant-numeric> | normal", "font-variant-position" : "normal | sub | super", "font-weight" : "<font-weight>", //G "glyph-orientation-horizontal" : "<glyph-angle>", "glyph-orientation-vertical" : "auto | <glyph-angle>", "grid" : 1, "grid-area" : 1, "grid-auto-columns" : 1, "grid-auto-flow" : 1, "grid-auto-position" : 1, "grid-auto-rows" : 1, "grid-cell-stacking" : "columns | rows | layer", "grid-column" : 1, "grid-columns" : 1, "grid-column-align" : "start | end | center | stretch", "grid-column-sizing" : 1, "grid-column-start" : 1, "grid-column-end" : 1, "grid-column-span" : "<integer>", "grid-flow" : "none | rows | columns", "grid-layer" : "<integer>", "grid-row" : 1, "grid-rows" : 1, "grid-row-align" : "start | end | center | stretch", "grid-row-start" : 1, "grid-row-end" : 1, "grid-row-span" : "<integer>", "grid-row-sizing" : 1, "grid-template" : 1, "grid-template-areas" : 1, "grid-template-columns" : 1, "grid-template-rows" : 1, //H "hanging-punctuation" : 1, "height" : "<margin-width> | <content-sizing>", "hyphenate-after" : "<integer> | auto", "hyphenate-before" : "<integer> | auto", "hyphenate-character" : "<string> | auto", "hyphenate-lines" : "no-limit | <integer>", "hyphenate-resource" : 1, "hyphens" : "none | manual | auto", //I "icon" : 1, "image-orientation" : "angle | auto", "image-rendering" : "auto | optimizeSpeed | optimizeQuality", "image-resolution" : 1, "ime-mode" : "auto | normal | active | inactive | disabled", "inline-box-align" : "last | <integer>", //J "justify-content" : "flex-start | flex-end | center | space-between | space-around", "-webkit-justify-content" : "flex-start | flex-end | center | space-between | space-around", //K "kerning" : "auto | <length>", //L "left" : "<margin-width>", "letter-spacing" : "<length> | normal", "line-height" : "<line-height>", "line-break" : "auto | loose | normal | strict", "line-stacking" : 1, "line-stacking-ruby" : "exclude-ruby | include-ruby", "line-stacking-shift" : "consider-shifts | disregard-shifts", "line-stacking-strategy" : "inline-line-height | block-line-height | max-height | grid-height", "list-style" : 1, "list-style-image" : "<uri> | none", "list-style-position" : "inside | outside", "list-style-type" : "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none", //M "margin" : "<margin-width>{1,4}", "margin-bottom" : "<margin-width>", "margin-left" : "<margin-width>", "margin-right" : "<margin-width>", "margin-top" : "<margin-width>", "mark" : 1, "mark-after" : 1, "mark-before" : 1, "marker" : 1, "marker-end" : 1, "marker-mid" : 1, "marker-start" : 1, "marks" : 1, "marquee-direction" : 1, "marquee-play-count" : 1, "marquee-speed" : 1, "marquee-style" : 1, "mask" : 1, "max-height" : "<length> | <percentage> | <content-sizing> | none", "max-width" : "<length> | <percentage> | <content-sizing> | none", "min-height" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats", "min-width" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats", "move-to" : 1, //N "nav-down" : 1, "nav-index" : 1, "nav-left" : 1, "nav-right" : 1, "nav-up" : 1, //O "object-fit" : "fill | contain | cover | none | scale-down", "object-position" : "<position>", "opacity" : "<opacity-value>", "order" : "<integer>", "-webkit-order" : "<integer>", "orphans" : "<integer>", "outline" : 1, "outline-color" : "<color> | invert", "outline-offset" : 1, "outline-style" : "<border-style>", "outline-width" : "<border-width>", "overflow" : "visible | hidden | scroll | auto", "overflow-style" : 1, "overflow-wrap" : "normal | break-word", "overflow-x" : 1, "overflow-y" : 1, //P "padding" : "<padding-width>{1,4}", "padding-bottom" : "<padding-width>", "padding-left" : "<padding-width>", "padding-right" : "<padding-width>", "padding-top" : "<padding-width>", "page" : 1, "page-break-after" : "auto | always | avoid | left | right", "page-break-before" : "auto | always | avoid | left | right", "page-break-inside" : "auto | avoid", "page-policy" : 1, "pause" : 1, "pause-after" : 1, "pause-before" : 1, "perspective" : 1, "perspective-origin" : 1, "phonemes" : 1, "pitch" : 1, "pitch-range" : 1, "play-during" : 1, "pointer-events" : "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all", "position" : "static | relative | absolute | fixed", "presentation-level" : 1, "punctuation-trim" : 1, //Q "quotes" : 1, //R "rendering-intent" : 1, "resize" : 1, "rest" : 1, "rest-after" : 1, "rest-before" : 1, "richness" : 1, "right" : "<margin-width>", "rotation" : 1, "rotation-point" : 1, "ruby-align" : 1, "ruby-overhang" : 1, "ruby-position" : 1, "ruby-span" : 1, //S "shape-rendering" : "auto | optimizeSpeed | crispEdges | geometricPrecision", "size" : 1, "speak" : "normal | none | spell-out", "speak-header" : "once | always", "speak-numeral" : "digits | continuous", "speak-punctuation" : "code | none", "speech-rate" : 1, "src" : 1, "stop-color" : 1, "stop-opacity" : "<opacity-value>", "stress" : 1, "string-set" : 1, "stroke" : "<paint>", "stroke-dasharray" : "none | <dasharray>", "stroke-dashoffset" : "<percentage> | <length>", "stroke-linecap" : "butt | round | square", "stroke-linejoin" : "miter | round | bevel", "stroke-miterlimit" : "<miterlimit>", "stroke-opacity" : "<opacity-value>", "stroke-width" : "<percentage> | <length>", "table-layout" : "auto | fixed", "tab-size" : "<integer> | <length>", "target" : 1, "target-name" : 1, "target-new" : 1, "target-position" : 1, "text-align" : "left | right | center | justify | match-parent | start | end", "text-align-last" : 1, "text-anchor" : "start | middle | end", "text-decoration" : "<text-decoration-line> || <text-decoration-style> || <text-decoration-color>", "text-decoration-color" : "<text-decoration-color>", "text-decoration-line" : "<text-decoration-line>", "text-decoration-style" : "<text-decoration-style>", "text-emphasis" : 1, "text-height" : 1, "text-indent" : "<length> | <percentage>", "text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida", "text-outline" : 1, "text-overflow" : 1, "text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision", "text-shadow" : 1, "text-transform" : "capitalize | uppercase | lowercase | none", "text-wrap" : "normal | none | avoid", "top" : "<margin-width>", "-ms-touch-action" : "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation", "touch-action" : "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation", "transform" : 1, "transform-origin" : 1, "transform-style" : 1, "transition" : 1, "transition-delay" : 1, "transition-duration" : 1, "transition-property" : 1, "transition-timing-function" : 1, //U "unicode-bidi" : "normal | embed | isolate | bidi-override | isolate-override | plaintext", "user-modify" : "read-only | read-write | write-only", "user-select" : "none | text | toggle | element | elements | all", //V "vertical-align" : "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>", "visibility" : "visible | hidden | collapse", "voice-balance" : 1, "voice-duration" : 1, "voice-family" : 1, "voice-pitch" : 1, "voice-pitch-range" : 1, "voice-rate" : 1, "voice-stress" : 1, "voice-volume" : 1, "volume" : 1, //W "white-space" : "normal | pre | nowrap | pre-wrap | pre-line | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap", // https://perishablepress.com/wrapping-content/ "white-space-collapse" : 1, "widows" : "<integer>", "width" : "<length> | <percentage> | <content-sizing> | auto", "will-change" : "<will-change>", "word-break" : "normal | keep-all | break-all", "word-spacing" : "<length> | normal", "word-wrap" : "normal | break-word", "writing-mode" : "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb", //Z "z-index" : "<integer> | auto", "zoom" : "<number> | <percentage> | normal" }; },{}],8:[function(require,module,exports){ "use strict"; module.exports = PropertyName; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a selector combinator (whitespace, +, >). * @namespace parserlib.css * @class PropertyName * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} text The text representation of the unit. * @param {String} hack The type of IE hack applied ("*", "_", or null). * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function PropertyName(text, hack, line, col) { SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_NAME_TYPE); /** * The type of IE hack applied ("*", "_", or null). * @type String * @property hack */ this.hack = hack; } PropertyName.prototype = new SyntaxUnit(); PropertyName.prototype.constructor = PropertyName; PropertyName.prototype.toString = function() { return (this.hack ? this.hack : "") + this.text; }; },{"../util/SyntaxUnit":26,"./Parser":6}],9:[function(require,module,exports){ "use strict"; module.exports = PropertyValue; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a single part of a CSS property value, meaning that it represents * just everything single part between ":" and ";". If there are multiple values * separated by commas, this type represents just one of the values. * @param {String[]} parts An array of value parts making up this value. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. * @namespace parserlib.css * @class PropertyValue * @extends parserlib.util.SyntaxUnit * @constructor */ function PropertyValue(parts, line, col) { SyntaxUnit.call(this, parts.join(" "), line, col, Parser.PROPERTY_VALUE_TYPE); /** * The parts that make up the selector. * @type Array * @property parts */ this.parts = parts; } PropertyValue.prototype = new SyntaxUnit(); PropertyValue.prototype.constructor = PropertyValue; },{"../util/SyntaxUnit":26,"./Parser":6}],10:[function(require,module,exports){ "use strict"; module.exports = PropertyValueIterator; /** * A utility class that allows for easy iteration over the various parts of a * property value. * @param {parserlib.css.PropertyValue} value The property value to iterate over. * @namespace parserlib.css * @class PropertyValueIterator * @constructor */ function PropertyValueIterator(value) { /** * Iterator value * @type int * @property _i * @private */ this._i = 0; /** * The parts that make up the value. * @type Array * @property _parts * @private */ this._parts = value.parts; /** * Keeps track of bookmarks along the way. * @type Array * @property _marks * @private */ this._marks = []; /** * Holds the original property value. * @type parserlib.css.PropertyValue * @property value */ this.value = value; } /** * Returns the total number of parts in the value. * @return {int} The total number of parts in the value. * @method count */ PropertyValueIterator.prototype.count = function() { return this._parts.length; }; /** * Indicates if the iterator is positioned at the first item. * @return {Boolean} True if positioned at first item, false if not. * @method isFirst */ PropertyValueIterator.prototype.isFirst = function() { return this._i === 0; }; /** * Indicates if there are more parts of the property value. * @return {Boolean} True if there are more parts, false if not. * @method hasNext */ PropertyValueIterator.prototype.hasNext = function() { return this._i < this._parts.length; }; /** * Marks the current spot in the iteration so it can be restored to * later on. * @return {void} * @method mark */ PropertyValueIterator.prototype.mark = function() { this._marks.push(this._i); }; /** * Returns the next part of the property value or null if there is no next * part. Does not move the internal counter forward. * @return {parserlib.css.PropertyValuePart} The next part of the property value or null if there is no next * part. * @method peek */ PropertyValueIterator.prototype.peek = function(count) { return this.hasNext() ? this._parts[this._i + (count || 0)] : null; }; /** * Returns the next part of the property value or null if there is no next * part. * @return {parserlib.css.PropertyValuePart} The next part of the property value or null if there is no next * part. * @method next */ PropertyValueIterator.prototype.next = function() { return this.hasNext() ? this._parts[this._i++] : null; }; /** * Returns the previous part of the property value or null if there is no * previous part. * @return {parserlib.css.PropertyValuePart} The previous part of the * property value or null if there is no previous part. * @method previous */ PropertyValueIterator.prototype.previous = function() { return this._i > 0 ? this._parts[--this._i] : null; }; /** * Restores the last saved bookmark. * @return {void} * @method restore */ PropertyValueIterator.prototype.restore = function() { if (this._marks.length) { this._i = this._marks.pop(); } }; /** * Drops the last saved bookmark. * @return {void} * @method drop */ PropertyValueIterator.prototype.drop = function() { this._marks.pop(); }; },{}],11:[function(require,module,exports){ "use strict"; module.exports = PropertyValuePart; var SyntaxUnit = require("../util/SyntaxUnit"); var Colors = require("./Colors"); var Parser = require("./Parser"); var Tokens = require("./Tokens"); /** * Represents a single part of a CSS property value, meaning that it represents * just one part of the data between ":" and ";". * @param {String} text The text representation of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. * @namespace parserlib.css * @class PropertyValuePart * @extends parserlib.util.SyntaxUnit * @constructor */ function PropertyValuePart(text, line, col, optionalHint) { var hint = optionalHint || {}; SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_VALUE_PART_TYPE); /** * Indicates the type of value unit. * @type String * @property type */ this.type = "unknown"; //figure out what type of data it is var temp; //it is a measurement? if (/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)) { //dimension this.type = "dimension"; this.value = +RegExp.$1; this.units = RegExp.$2; //try to narrow down switch (this.units.toLowerCase()) { case "em": case "rem": case "ex": case "px": case "cm": case "mm": case "in": case "pt": case "pc": case "ch": case "vh": case "vw": case "vmax": case "vmin": this.type = "length"; break; case "fr": this.type = "grid"; break; case "deg": case "rad": case "grad": case "turn": this.type = "angle"; break; case "ms": case "s": this.type = "time"; break; case "hz": case "khz": this.type = "frequency"; break; case "dpi": case "dpcm": this.type = "resolution"; break; //default } } else if (/^([+\-]?[\d\.]+)%$/i.test(text)) { //percentage this.type = "percentage"; this.value = +RegExp.$1; } else if (/^([+\-]?\d+)$/i.test(text)) { //integer this.type = "integer"; this.value = +RegExp.$1; } else if (/^([+\-]?[\d\.]+)$/i.test(text)) { //number this.type = "number"; this.value = +RegExp.$1; } else if (/^#([a-f0-9]{3,6})/i.test(text)) { //hexcolor this.type = "color"; temp = RegExp.$1; if (temp.length === 3) { this.red = parseInt(temp.charAt(0)+temp.charAt(0), 16); this.green = parseInt(temp.charAt(1)+temp.charAt(1), 16); this.blue = parseInt(temp.charAt(2)+temp.charAt(2), 16); } else { this.red = parseInt(temp.substring(0, 2), 16); this.green = parseInt(temp.substring(2, 4), 16); this.blue = parseInt(temp.substring(4, 6), 16); } } else if (/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)) { //rgb() color with absolute numbers this.type = "color"; this.red = +RegExp.$1; this.green = +RegExp.$2; this.blue = +RegExp.$3; } else if (/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) { //rgb() color with percentages this.type = "color"; this.red = +RegExp.$1 * 255 / 100; this.green = +RegExp.$2 * 255 / 100; this.blue = +RegExp.$3 * 255 / 100; } else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)) { //rgba() color with absolute numbers this.type = "color"; this.red = +RegExp.$1; this.green = +RegExp.$2; this.blue = +RegExp.$3; this.alpha = +RegExp.$4; } else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) { //rgba() color with percentages this.type = "color"; this.red = +RegExp.$1 * 255 / 100; this.green = +RegExp.$2 * 255 / 100; this.blue = +RegExp.$3 * 255 / 100; this.alpha = +RegExp.$4; } else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) { //hsl() this.type = "color"; this.hue = +RegExp.$1; this.saturation = +RegExp.$2 / 100; this.lightness = +RegExp.$3 / 100; } else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) { //hsla() color with percentages this.type = "color"; this.hue = +RegExp.$1; this.saturation = +RegExp.$2 / 100; this.lightness = +RegExp.$3 / 100; this.alpha = +RegExp.$4; } else if (/^url\(("([^\\"]|\\.)*")\)/i.test(text)) { //URI // generated by TokenStream.readURI, so always double-quoted. this.type = "uri"; this.uri = PropertyValuePart.parseString(RegExp.$1); } else if (/^([^\(]+)\(/i.test(text)) { this.type = "function"; this.name = RegExp.$1; this.value = text; } else if (/^"([^\n\r\f\\"]|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*"/i.test(text)) { //double-quoted string this.type = "string"; this.value = PropertyValuePart.parseString(text); } else if (/^'([^\n\r\f\\']|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*'/i.test(text)) { //single-quoted string this.type = "string"; this.value = PropertyValuePart.parseString(text); } else if (Colors[text.toLowerCase()]) { //named color this.type = "color"; temp = Colors[text.toLowerCase()].substring(1); this.red = parseInt(temp.substring(0, 2), 16); this.green = parseInt(temp.substring(2, 4), 16); this.blue = parseInt(temp.substring(4, 6), 16); } else if (/^[,\/]$/.test(text)) { this.type = "operator"; this.value = text; } else if (/^-?[a-z_\u00A0-\uFFFF][a-z0-9\-_\u00A0-\uFFFF]*$/i.test(text)) { this.type = "identifier"; this.value = text; } // There can be ambiguity with escape sequences in identifiers, as // well as with "color" parts which are also "identifiers", so record // an explicit hint when the token generating this PropertyValuePart // was an identifier. this.wasIdent = Boolean(hint.ident); } PropertyValuePart.prototype = new SyntaxUnit(); PropertyValuePart.prototype.constructor = PropertyValuePart; /** * Helper method to parse a CSS string. */ PropertyValuePart.parseString = function(str) { str = str.slice(1, -1); // Strip surrounding single/double quotes var replacer = function(match, esc) { if (/^(\n|\r\n|\r|\f)$/.test(esc)) { return ""; } var m = /^[0-9a-f]{1,6}/i.exec(esc); if (m) { var codePoint = parseInt(m[0], 16); if (String.fromCodePoint) { return String.fromCodePoint(codePoint); } else { // XXX No support for surrogates on old JavaScript engines. return String.fromCharCode(codePoint); } } return esc; }; return str.replace(/\\(\r\n|[^\r0-9a-f]|[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)/ig, replacer); }; /** * Helper method to serialize a CSS string. */ PropertyValuePart.serializeString = function(value) { var replacer = function(match, c) { if (c === "\"") { return "\\" + c; } var cp = String.codePointAt ? String.codePointAt(0) : // We only escape non-surrogate chars, so using charCodeAt // is harmless here. String.charCodeAt(0); return "\\" + cp.toString(16) + " "; }; return "\"" + value.replace(/["\r\n\f]/g, replacer) + "\""; }; /** * Create a new syntax unit based solely on the given token. * Convenience method for creating a new syntax unit when * it represents a single token instead of multiple. * @param {Object} token The token object to represent. * @return {parserlib.css.PropertyValuePart} The object representing the token. * @static * @method fromToken */ PropertyValuePart.fromToken = function(token) { var part = new PropertyValuePart(token.value, token.startLine, token.startCol, { // Tokens can have escaped characters that would fool the type // identification in the PropertyValuePart constructor, so pass // in a hint if this was an identifier. ident: token.type === Tokens.IDENT }); return part; }; },{"../util/SyntaxUnit":26,"./Colors":1,"./Parser":6,"./Tokens":18}],12:[function(require,module,exports){ "use strict"; var Pseudos = module.exports = { __proto__: null, ":first-letter": 1, ":first-line": 1, ":before": 1, ":after": 1 }; Pseudos.ELEMENT = 1; Pseudos.CLASS = 2; Pseudos.isElement = function(pseudo) { return pseudo.indexOf("::") === 0 || Pseudos[pseudo.toLowerCase()] === Pseudos.ELEMENT; }; },{}],13:[function(require,module,exports){ "use strict"; module.exports = Selector; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); var Specificity = require("./Specificity"); /** * Represents an entire single selector, including all parts but not * including multiple selectors (those separated by commas). * @namespace parserlib.css * @class Selector * @extends parserlib.util.SyntaxUnit * @constructor * @param {Array} parts Array of selectors parts making up this selector. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function Selector(parts, line, col) { SyntaxUnit.call(this, parts.join(" "), line, col, Parser.SELECTOR_TYPE); /** * The parts that make up the selector. * @type Array * @property parts */ this.parts = parts; /** * The specificity of the selector. * @type parserlib.css.Specificity * @property specificity */ this.specificity = Specificity.calculate(this); } Selector.prototype = new SyntaxUnit(); Selector.prototype.constructor = Selector; },{"../util/SyntaxUnit":26,"./Parser":6,"./Specificity":16}],14:[function(require,module,exports){ "use strict"; module.exports = SelectorPart; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a single part of a selector string, meaning a single set of * element name and modifiers. This does not include combinators such as * spaces, +, >, etc. * @namespace parserlib.css * @class SelectorPart * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} elementName The element name in the selector or null * if there is no element name. * @param {Array} modifiers Array of individual modifiers for the element. * May be empty if there are none. * @param {String} text The text representation of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function SelectorPart(elementName, modifiers, text, line, col) { SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_PART_TYPE); /** * The tag name of the element to which this part * of the selector affects. * @type String * @property elementName */ this.elementName = elementName; /** * The parts that come after the element name, such as class names, IDs, * pseudo classes/elements, etc. * @type Array * @property modifiers */ this.modifiers = modifiers; } SelectorPart.prototype = new SyntaxUnit(); SelectorPart.prototype.constructor = SelectorPart; },{"../util/SyntaxUnit":26,"./Parser":6}],15:[function(require,module,exports){ "use strict"; module.exports = SelectorSubPart; var SyntaxUnit = require("../util/SyntaxUnit"); var Parser = require("./Parser"); /** * Represents a selector modifier string, meaning a class name, element name, * element ID, pseudo rule, etc. * @namespace parserlib.css * @class SelectorSubPart * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} text The text representation of the unit. * @param {String} type The type of selector modifier. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function SelectorSubPart(text, type, line, col) { SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE); /** * The type of modifier. * @type String * @property type */ this.type = type; /** * Some subparts have arguments, this represents them. * @type Array * @property args */ this.args = []; } SelectorSubPart.prototype = new SyntaxUnit(); SelectorSubPart.prototype.constructor = SelectorSubPart; },{"../util/SyntaxUnit":26,"./Parser":6}],16:[function(require,module,exports){ "use strict"; module.exports = Specificity; var Pseudos = require("./Pseudos"); var SelectorPart = require("./SelectorPart"); /** * Represents a selector's specificity. * @namespace parserlib.css * @class Specificity * @constructor * @param {int} a Should be 1 for inline styles, zero for stylesheet styles * @param {int} b Number of ID selectors * @param {int} c Number of classes and pseudo classes * @param {int} d Number of element names and pseudo elements */ function Specificity(a, b, c, d) { this.a = a; this.b = b; this.c = c; this.d = d; } Specificity.prototype = { constructor: Specificity, /** * Compare this specificity to another. * @param {Specificity} other The other specificity to compare to. * @return {int} -1 if the other specificity is larger, 1 if smaller, 0 if equal. * @method compare */ compare: function(other) { var comps = ["a", "b", "c", "d"], i, len; for (i=0, len=comps.length; i < len; i++) { if (this[comps[i]] < other[comps[i]]) { return -1; } else if (this[comps[i]] > other[comps[i]]) { return 1; } } return 0; }, /** * Creates a numeric value for the specificity. * @return {int} The numeric value for the specificity. * @method valueOf */ valueOf: function() { return (this.a * 1000) + (this.b * 100) + (this.c * 10) + this.d; }, /** * Returns a string representation for specificity. * @return {String} The string representation of specificity. * @method toString */ toString: function() { return this.a + "," + this.b + "," + this.c + "," + this.d; } }; /** * Calculates the specificity of the given selector. * @param {parserlib.css.Selector} The selector to calculate specificity for. * @return {parserlib.css.Specificity} The specificity of the selector. * @static * @method calculate */ Specificity.calculate = function(selector) { var i, len, part, b=0, c=0, d=0; function updateValues(part) { var i, j, len, num, elementName = part.elementName ? part.elementName.text : "", modifier; if (elementName && elementName.charAt(elementName.length-1) !== "*") { d++; } for (i=0, len=part.modifiers.length; i < len; i++) { modifier = part.modifiers[i]; switch (modifier.type) { case "class": case "attribute": c++; break; case "id": b++; break; case "pseudo": if (Pseudos.isElement(modifier.text)) { d++; } else { c++; } break; case "not": for (j=0, num=modifier.args.length; j < num; j++) { updateValues(modifier.args[j]); } } } } for (i=0, len=selector.parts.length; i < len; i++) { part = selector.parts[i]; if (part instanceof SelectorPart) { updateValues(part); } } return new Specificity(0, b, c, d); }; },{"./Pseudos":12,"./SelectorPart":14}],17:[function(require,module,exports){ "use strict"; module.exports = TokenStream; var TokenStreamBase = require("../util/TokenStreamBase"); var PropertyValuePart = require("./PropertyValuePart"); var Tokens = require("./Tokens"); var h = /^[0-9a-fA-F]$/, nonascii = /^[\u00A0-\uFFFF]$/, nl = /\n|\r\n|\r|\f/, whitespace = /\u0009|\u000a|\u000c|\u000d|\u0020/; //----------------------------------------------------------------------------- // Helper functions //----------------------------------------------------------------------------- function isHexDigit(c) { return c !== null && h.test(c); } function isDigit(c) { return c !== null && /\d/.test(c); } function isWhitespace(c) { return c !== null && whitespace.test(c); } function isNewLine(c) { return c !== null && nl.test(c); } function isNameStart(c) { return c !== null && /[a-z_\u00A0-\uFFFF\\]/i.test(c); } function isNameChar(c) { return c !== null && (isNameStart(c) || /[0-9\-\\]/.test(c)); } function isIdentStart(c) { return c !== null && (isNameStart(c) || /\-\\/.test(c)); } function mix(receiver, supplier) { for (var prop in supplier) { if (Object.prototype.hasOwnProperty.call(supplier, prop)) { receiver[prop] = supplier[prop]; } } return receiver; } //----------------------------------------------------------------------------- // CSS Token Stream //----------------------------------------------------------------------------- /** * A token stream that produces CSS tokens. * @param {String|Reader} input The source of text to tokenize. * @constructor * @class TokenStream * @namespace parserlib.css */ function TokenStream(input) { TokenStreamBase.call(this, input, Tokens); } TokenStream.prototype = mix(new TokenStreamBase(), { /** * Overrides the TokenStreamBase method of the same name * to produce CSS tokens. * @return {Object} A token object representing the next token. * @method _getToken * @private */ _getToken: function() { var c, reader = this._reader, token = null, startLine = reader.getLine(), startCol = reader.getCol(); c = reader.read(); while (c) { switch (c) { /* * Potential tokens: * - COMMENT * - SLASH * - CHAR */ case "/": if (reader.peek() === "*") { token = this.commentToken(c, startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - DASHMATCH * - INCLUDES * - PREFIXMATCH * - SUFFIXMATCH * - SUBSTRINGMATCH * - CHAR */ case "|": case "~": case "^": case "$": case "*": if (reader.peek() === "=") { token = this.comparisonToken(c, startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - STRING * - INVALID */ case "\"": case "'": token = this.stringToken(c, startLine, startCol); break; /* * Potential tokens: * - HASH * - CHAR */ case "#": if (isNameChar(reader.peek())) { token = this.hashToken(c, startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - DOT * - NUMBER * - DIMENSION * - PERCENTAGE */ case ".": if (isDigit(reader.peek())) { token = this.numberToken(c, startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - CDC * - MINUS * - NUMBER * - DIMENSION * - PERCENTAGE */ case "-": if (reader.peek() === "-") { //could be closing HTML-style comment token = this.htmlCommentEndToken(c, startLine, startCol); } else if (isNameStart(reader.peek())) { token = this.identOrFunctionToken(c, startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - IMPORTANT_SYM * - CHAR */ case "!": token = this.importantToken(c, startLine, startCol); break; /* * Any at-keyword or CHAR */ case "@": token = this.atRuleToken(c, startLine, startCol); break; /* * Potential tokens: * - NOT * - CHAR */ case ":": token = this.notToken(c, startLine, startCol); break; /* * Potential tokens: * - CDO * - CHAR */ case "<": token = this.htmlCommentStartToken(c, startLine, startCol); break; /* * Potential tokens: * - IDENT * - CHAR */ case "\\": if (/[^\r\n\f]/.test(reader.peek())) { token = this.identOrFunctionToken(this.readEscape(c, true), startLine, startCol); } else { token = this.charToken(c, startLine, startCol); } break; /* * Potential tokens: * - UNICODE_RANGE * - URL * - CHAR */ case "U": case "u": if (reader.peek() === "+") { token = this.unicodeRangeToken(c, startLine, startCol); break; } /* falls through */ default: /* * Potential tokens: * - NUMBER * - DIMENSION * - LENGTH * - FREQ * - TIME * - EMS * - EXS * - ANGLE */ if (isDigit(c)) { token = this.numberToken(c, startLine, startCol); } else /* * Potential tokens: * - S */ if (isWhitespace(c)) { token = this.whitespaceToken(c, startLine, startCol); } else /* * Potential tokens: * - IDENT */ if (isIdentStart(c)) { token = this.identOrFunctionToken(c, startLine, startCol); } else { /* * Potential tokens: * - CHAR * - PLUS */ token = this.charToken(c, startLine, startCol); } } //make sure this token is wanted //TODO: check channel break; } if (!token && c === null) { token = this.createToken(Tokens.EOF, null, startLine, startCol); } return token; }, //------------------------------------------------------------------------- // Methods to create tokens //------------------------------------------------------------------------- /** * Produces a token based on available data and the current * reader position information. This method is called by other * private methods to create tokens and is never called directly. * @param {int} tt The token type. * @param {String} value The text value of the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @param {Object} options (Optional) Specifies a channel property * to indicate that a different channel should be scanned * and/or a hide property indicating that the token should * be hidden. * @return {Object} A token object. * @method createToken */ createToken: function(tt, value, startLine, startCol, options) { var reader = this._reader; options = options || {}; return { value: value, type: tt, channel: options.channel, endChar: options.endChar, hide: options.hide || false, startLine: startLine, startCol: startCol, endLine: reader.getLine(), endCol: reader.getCol() }; }, //------------------------------------------------------------------------- // Methods to create specific tokens //------------------------------------------------------------------------- /** * Produces a token for any at-rule. If the at-rule is unknown, then * the token is for a single "@" character. * @param {String} first The first character for the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method atRuleToken */ atRuleToken: function(first, startLine, startCol) { var rule = first, reader = this._reader, tt = Tokens.CHAR, ident; /* * First, mark where we are. There are only four @ rules, * so anything else is really just an invalid token. * Basically, if this doesn't match one of the known @ * rules, just return '@' as an unknown token and allow * parsing to continue after that point. */ reader.mark(); //try to find the at-keyword ident = this.readName(); rule = first + ident; tt = Tokens.type(rule.toLowerCase()); //if it's not valid, use the first character only and reset the reader if (tt === Tokens.CHAR || tt === Tokens.UNKNOWN) { if (rule.length > 1) { tt = Tokens.UNKNOWN_SYM; } else { tt = Tokens.CHAR; rule = first; reader.reset(); } } return this.createToken(tt, rule, startLine, startCol); }, /** * Produces a character token based on the given character * and location in the stream. If there's a special (non-standard) * token name, this is used; otherwise CHAR is used. * @param {String} c The character for the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method charToken */ charToken: function(c, startLine, startCol) { var tt = Tokens.type(c); var opts = {}; if (tt === -1) { tt = Tokens.CHAR; } else { opts.endChar = Tokens[tt].endChar; } return this.createToken(tt, c, startLine, startCol, opts); }, /** * Produces a character token based on the given character * and location in the stream. If there's a special (non-standard) * token name, this is used; otherwise CHAR is used. * @param {String} first The first character for the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method commentToken */ commentToken: function(first, startLine, startCol) { var comment = this.readComment(first); return this.createToken(Tokens.COMMENT, comment, startLine, startCol); }, /** * Produces a comparison token based on the given character * and location in the stream. The next character must be * read and is already known to be an equals sign. * @param {String} c The character for the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method comparisonToken */ comparisonToken: function(c, startLine, startCol) { var reader = this._reader, comparison = c + reader.read(), tt = Tokens.type(comparison) || Tokens.CHAR; return this.createToken(tt, comparison, startLine, startCol); }, /** * Produces a hash token based on the specified information. The * first character provided is the pound sign (#) and then this * method reads a name afterward. * @param {String} first The first character (#) in the hash name. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method hashToken */ hashToken: function(first, startLine, startCol) { var name = this.readName(first); return this.createToken(Tokens.HASH, name, startLine, startCol); }, /** * Produces a CDO or CHAR token based on the specified information. The * first character is provided and the rest is read by the function to determine * the correct token to create. * @param {String} first The first character in the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method htmlCommentStartToken */ htmlCommentStartToken: function(first, startLine, startCol) { var reader = this._reader, text = first; reader.mark(); text += reader.readCount(3); if (text === "<!--") { return this.createToken(Tokens.CDO, text, startLine, startCol); } else { reader.reset(); return this.charToken(first, startLine, startCol); } }, /** * Produces a CDC or CHAR token based on the specified information. The * first character is provided and the rest is read by the function to determine * the correct token to create. * @param {String} first The first character in the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method htmlCommentEndToken */ htmlCommentEndToken: function(first, startLine, startCol) { var reader = this._reader, text = first; reader.mark(); text += reader.readCount(2); if (text === "-->") { return this.createToken(Tokens.CDC, text, startLine, startCol); } else { reader.reset(); return this.charToken(first, startLine, startCol); } }, /** * Produces an IDENT or FUNCTION token based on the specified information. The * first character is provided and the rest is read by the function to determine * the correct token to create. * @param {String} first The first character in the identifier. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method identOrFunctionToken */ identOrFunctionToken: function(first, startLine, startCol) { var reader = this._reader, ident = this.readName(first), tt = Tokens.IDENT, uriFns = ["url(", "url-prefix(", "domain("], uri; //if there's a left paren immediately after, it's a URI or function if (reader.peek() === "(") { ident += reader.read(); if (uriFns.indexOf(ident.toLowerCase()) > -1) { reader.mark(); uri = this.readURI(ident); if (uri === null) { //didn't find a valid URL or there's no closing paren reader.reset(); tt = Tokens.FUNCTION; } else { tt = Tokens.URI; ident = uri; } } else { tt = Tokens.FUNCTION; } } else if (reader.peek() === ":") { //might be an IE function //IE-specific functions always being with progid: if (ident.toLowerCase() === "progid") { ident += reader.readTo("("); tt = Tokens.IE_FUNCTION; } } return this.createToken(tt, ident, startLine, startCol); }, /** * Produces an IMPORTANT_SYM or CHAR token based on the specified information. The * first character is provided and the rest is read by the function to determine * the correct token to create. * @param {String} first The first character in the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method importantToken */ importantToken: function(first, startLine, startCol) { var reader = this._reader, important = first, tt = Tokens.CHAR, temp, c; reader.mark(); c = reader.read(); while (c) { //there can be a comment in here if (c === "/") { //if the next character isn't a star, then this isn't a valid !important token if (reader.peek() !== "*") { break; } else { temp = this.readComment(c); if (temp === "") { //broken! break; } } } else if (isWhitespace(c)) { important += c + this.readWhitespace(); } else if (/i/i.test(c)) { temp = reader.readCount(8); if (/mportant/i.test(temp)) { important += c + temp; tt = Tokens.IMPORTANT_SYM; } break; //we're done } else { break; } c = reader.read(); } if (tt === Tokens.CHAR) { reader.reset(); return this.charToken(first, startLine, startCol); } else { return this.createToken(tt, important, startLine, startCol); } }, /** * Produces a NOT or CHAR token based on the specified information. The * first character is provided and the rest is read by the function to determine * the correct token to create. * @param {String} first The first character in the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method notToken */ notToken: function(first, startLine, startCol) { var reader = this._reader, text = first; reader.mark(); text += reader.readCount(4); if (text.toLowerCase() === ":not(") { return this.createToken(Tokens.NOT, text, startLine, startCol); } else { reader.reset(); return this.charToken(first, startLine, startCol); } }, /** * Produces a number token based on the given character * and location in the stream. This may return a token of * NUMBER, EMS, EXS, LENGTH, ANGLE, TIME, FREQ, DIMENSION, * or PERCENTAGE. * @param {String} first The first character for the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method numberToken */ numberToken: function(first, startLine, startCol) { var reader = this._reader, value = this.readNumber(first), ident, tt = Tokens.NUMBER, c = reader.peek(); if (isIdentStart(c)) { ident = this.readName(reader.read()); value += ident; if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)) { tt = Tokens.LENGTH; } else if (/^deg|^rad$|^grad$|^turn$/i.test(ident)) { tt = Tokens.ANGLE; } else if (/^ms$|^s$/i.test(ident)) { tt = Tokens.TIME; } else if (/^hz$|^khz$/i.test(ident)) { tt = Tokens.FREQ; } else if (/^dpi$|^dpcm$/i.test(ident)) { tt = Tokens.RESOLUTION; } else { tt = Tokens.DIMENSION; } } else if (c === "%") { value += reader.read(); tt = Tokens.PERCENTAGE; } return this.createToken(tt, value, startLine, startCol); }, /** * Produces a string token based on the given character * and location in the stream. Since strings may be indicated * by single or double quotes, a failure to match starting * and ending quotes results in an INVALID token being generated. * The first character in the string is passed in and then * the rest are read up to and including the final quotation mark. * @param {String} first The first character in the string. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method stringToken */ stringToken: function(first, startLine, startCol) { var delim = first, string = first, reader = this._reader, tt = Tokens.STRING, c = reader.read(), i; while (c) { string += c; if (c === "\\") { c = reader.read(); if (c === null) { break; // premature EOF after backslash } else if (/[^\r\n\f0-9a-f]/i.test(c)) { // single-character escape string += c; } else { // read up to six hex digits for (i=0; isHexDigit(c) && i<6; i++) { string += c; c = reader.read(); } // swallow trailing newline or space if (c === "\r" && reader.peek() === "\n") { string += c; c = reader.read(); } if (isWhitespace(c)) { string += c; } else { // This character is null or not part of the escape; // jump back to the top to process it. continue; } } } else if (c === delim) { break; // delimiter found. } else if (isNewLine(reader.peek())) { // newline without an escapement: it's an invalid string tt = Tokens.INVALID; break; } c = reader.read(); } //if c is null, that means we're out of input and the string was never closed if (c === null) { tt = Tokens.INVALID; } return this.createToken(tt, string, startLine, startCol); }, unicodeRangeToken: function(first, startLine, startCol) { var reader = this._reader, value = first, temp, tt = Tokens.CHAR; //then it should be a unicode range if (reader.peek() === "+") { reader.mark(); value += reader.read(); value += this.readUnicodeRangePart(true); //ensure there's an actual unicode range here if (value.length === 2) { reader.reset(); } else { tt = Tokens.UNICODE_RANGE; //if there's a ? in the first part, there can't be a second part if (value.indexOf("?") === -1) { if (reader.peek() === "-") { reader.mark(); temp = reader.read(); temp += this.readUnicodeRangePart(false); //if there's not another value, back up and just take the first if (temp.length === 1) { reader.reset(); } else { value += temp; } } } } } return this.createToken(tt, value, startLine, startCol); }, /** * Produces a S token based on the specified information. Since whitespace * may have multiple characters, this consumes all whitespace characters * into a single token. * @param {String} first The first character in the token. * @param {int} startLine The beginning line for the character. * @param {int} startCol The beginning column for the character. * @return {Object} A token object. * @method whitespaceToken */ whitespaceToken: function(first, startLine, startCol) { var value = first + this.readWhitespace(); return this.createToken(Tokens.S, value, startLine, startCol); }, //------------------------------------------------------------------------- // Methods to read values from the string stream //------------------------------------------------------------------------- readUnicodeRangePart: function(allowQuestionMark) { var reader = this._reader, part = "", c = reader.peek(); //first read hex digits while (isHexDigit(c) && part.length < 6) { reader.read(); part += c; c = reader.peek(); } //then read question marks if allowed if (allowQuestionMark) { while (c === "?" && part.length < 6) { reader.read(); part += c; c = reader.peek(); } } //there can't be any other characters after this point return part; }, readWhitespace: function() { var reader = this._reader, whitespace = "", c = reader.peek(); while (isWhitespace(c)) { reader.read(); whitespace += c; c = reader.peek(); } return whitespace; }, readNumber: function(first) { var reader = this._reader, number = first, hasDot = (first === "."), c = reader.peek(); while (c) { if (isDigit(c)) { number += reader.read(); } else if (c === ".") { if (hasDot) { break; } else { hasDot = true; number += reader.read(); } } else { break; } c = reader.peek(); } return number; }, // returns null w/o resetting reader if string is invalid. readString: function() { var token = this.stringToken(this._reader.read(), 0, 0); return token.type === Tokens.INVALID ? null : token.value; }, // returns null w/o resetting reader if URI is invalid. readURI: function(first) { var reader = this._reader, uri = first, inner = "", c = reader.peek(); //skip whitespace before while (c && isWhitespace(c)) { reader.read(); c = reader.peek(); } //it's a string if (c === "'" || c === "\"") { inner = this.readString(); if (inner !== null) { inner = PropertyValuePart.parseString(inner); } } else { inner = this.readUnquotedURL(); } c = reader.peek(); //skip whitespace after while (c && isWhitespace(c)) { reader.read(); c = reader.peek(); } //if there was no inner value or the next character isn't closing paren, it's not a URI if (inner === null || c !== ")") { uri = null; } else { // Ensure argument to URL is always double-quoted // (This simplifies later processing in PropertyValuePart.) uri += PropertyValuePart.serializeString(inner) + reader.read(); } return uri; }, // This method never fails, although it may return an empty string. readUnquotedURL: function(first) { var reader = this._reader, url = first || "", c; for (c = reader.peek(); c; c = reader.peek()) { // Note that the grammar at // https://www.w3.org/TR/CSS2/grammar.html#scanner // incorrectly includes the backslash character in the // `url` production, although it is correctly omitted in // the `baduri1` production. if (nonascii.test(c) || /^[\-!#$%&*-\[\]-~]$/.test(c)) { url += c; reader.read(); } else if (c === "\\") { if (/^[^\r\n\f]$/.test(reader.peek(2))) { url += this.readEscape(reader.read(), true); } else { break; // bad escape sequence. } } else { break; // bad character } } return url; }, readName: function(first) { var reader = this._reader, ident = first || "", c; for (c = reader.peek(); c; c = reader.peek()) { if (c === "\\") { if (/^[^\r\n\f]$/.test(reader.peek(2))) { ident += this.readEscape(reader.read(), true); } else { // Bad escape sequence. break; } } else if (isNameChar(c)) { ident += reader.read(); } else { break; } } return ident; }, readEscape: function(first, unescape) { var reader = this._reader, cssEscape = first || "", i = 0, c = reader.peek(); if (isHexDigit(c)) { do { cssEscape += reader.read(); c = reader.peek(); } while (c && isHexDigit(c) && ++i < 6); } if (cssEscape.length === 1) { if (/^[^\r\n\f0-9a-f]$/.test(c)) { reader.read(); if (unescape) { return c; } } else { // We should never get here (readName won't call readEscape // if the escape sequence is bad). throw new Error("Bad escape sequence."); } } else if (c === "\r") { reader.read(); if (reader.peek() === "\n") { c += reader.read(); } } else if (/^[ \t\n\f]$/.test(c)) { reader.read(); } else { c = ""; } if (unescape) { var cp = parseInt(cssEscape.slice(first.length), 16); return String.fromCodePoint ? String.fromCodePoint(cp) : String.fromCharCode(cp); } return cssEscape + c; }, readComment: function(first) { var reader = this._reader, comment = first || "", c = reader.read(); if (c === "*") { while (c) { comment += c; //look for end of comment if (comment.length > 2 && c === "*" && reader.peek() === "/") { comment += reader.read(); break; } c = reader.read(); } return comment; } else { return ""; } } }); },{"../util/TokenStreamBase":27,"./PropertyValuePart":11,"./Tokens":18}],18:[function(require,module,exports){ "use strict"; var Tokens = module.exports = [ /* * The following token names are defined in CSS3 Grammar: https://www.w3.org/TR/css3-syntax/#lexical */ // HTML-style comments { name: "CDO" }, { name: "CDC" }, // ignorables { name: "S", whitespace: true/*, channel: "ws"*/ }, { name: "COMMENT", comment: true, hide: true, channel: "comment" }, // attribute equality { name: "INCLUDES", text: "~=" }, { name: "DASHMATCH", text: "|=" }, { name: "PREFIXMATCH", text: "^=" }, { name: "SUFFIXMATCH", text: "$=" }, { name: "SUBSTRINGMATCH", text: "*=" }, // identifier types { name: "STRING" }, { name: "IDENT" }, { name: "HASH" }, // at-keywords { name: "IMPORT_SYM", text: "@import" }, { name: "PAGE_SYM", text: "@page" }, { name: "MEDIA_SYM", text: "@media" }, { name: "FONT_FACE_SYM", text: "@font-face" }, { name: "CHARSET_SYM", text: "@charset" }, { name: "NAMESPACE_SYM", text: "@namespace" }, { name: "SUPPORTS_SYM", text: "@supports" }, { name: "VIEWPORT_SYM", text: ["@viewport", "@-ms-viewport", "@-o-viewport"] }, { name: "DOCUMENT_SYM", text: ["@document", "@-moz-document"] }, { name: "UNKNOWN_SYM" }, //{ name: "ATKEYWORD"}, // CSS3 animations { name: "KEYFRAMES_SYM", text: [ "@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes" ] }, // important symbol { name: "IMPORTANT_SYM" }, // measurements { name: "LENGTH" }, { name: "ANGLE" }, { name: "TIME" }, { name: "FREQ" }, { name: "DIMENSION" }, { name: "PERCENTAGE" }, { name: "NUMBER" }, // functions { name: "URI" }, { name: "FUNCTION" }, // Unicode ranges { name: "UNICODE_RANGE" }, /* * The following token names are defined in CSS3 Selectors: https://www.w3.org/TR/css3-selectors/#selector-syntax */ // invalid string { name: "INVALID" }, // combinators { name: "PLUS", text: "+" }, { name: "GREATER", text: ">" }, { name: "COMMA", text: "," }, { name: "TILDE", text: "~" }, // modifier { name: "NOT" }, /* * Defined in CSS3 Paged Media */ { name: "TOPLEFTCORNER_SYM", text: "@top-left-corner" }, { name: "TOPLEFT_SYM", text: "@top-left" }, { name: "TOPCENTER_SYM", text: "@top-center" }, { name: "TOPRIGHT_SYM", text: "@top-right" }, { name: "TOPRIGHTCORNER_SYM", text: "@top-right-corner" }, { name: "BOTTOMLEFTCORNER_SYM", text: "@bottom-left-corner" }, { name: "BOTTOMLEFT_SYM", text: "@bottom-left" }, { name: "BOTTOMCENTER_SYM", text: "@bottom-center" }, { name: "BOTTOMRIGHT_SYM", text: "@bottom-right" }, { name: "BOTTOMRIGHTCORNER_SYM", text: "@bottom-right-corner" }, { name: "LEFTTOP_SYM", text: "@left-top" }, { name: "LEFTMIDDLE_SYM", text: "@left-middle" }, { name: "LEFTBOTTOM_SYM", text: "@left-bottom" }, { name: "RIGHTTOP_SYM", text: "@right-top" }, { name: "RIGHTMIDDLE_SYM", text: "@right-middle" }, { name: "RIGHTBOTTOM_SYM", text: "@right-bottom" }, /* * The following token names are defined in CSS3 Media Queries: https://www.w3.org/TR/css3-mediaqueries/#syntax */ /*{ name: "MEDIA_ONLY", state: "media"}, { name: "MEDIA_NOT", state: "media"}, { name: "MEDIA_AND", state: "media"},*/ { name: "RESOLUTION", state: "media" }, /* * The following token names are not defined in any CSS specification but are used by the lexer. */ // not a real token, but useful for stupid IE filters { name: "IE_FUNCTION" }, // part of CSS3 grammar but not the Flex code { name: "CHAR" }, // TODO: Needed? // Not defined as tokens, but might as well be { name: "PIPE", text: "|" }, { name: "SLASH", text: "/" }, { name: "MINUS", text: "-" }, { name: "STAR", text: "*" }, { name: "LBRACE", endChar: "}", text: "{" }, { name: "RBRACE", text: "}" }, { name: "LBRACKET", endChar: "]", text: "[" }, { name: "RBRACKET", text: "]" }, { name: "EQUALS", text: "=" }, { name: "COLON", text: ":" }, { name: "SEMICOLON", text: ";" }, { name: "LPAREN", endChar: ")", text: "(" }, { name: "RPAREN", text: ")" }, { name: "DOT", text: "." } ]; (function() { var nameMap = [], typeMap = Object.create(null); Tokens.UNKNOWN = -1; Tokens.unshift({ name:"EOF" }); for (var i=0, len = Tokens.length; i < len; i++) { nameMap.push(Tokens[i].name); Tokens[Tokens[i].name] = i; if (Tokens[i].text) { if (Tokens[i].text instanceof Array) { for (var j=0; j < Tokens[i].text.length; j++) { typeMap[Tokens[i].text[j]] = i; } } else { typeMap[Tokens[i].text] = i; } } } Tokens.name = function(tt) { return nameMap[tt]; }; Tokens.type = function(c) { return typeMap[c] || -1; }; })(); },{}],19:[function(require,module,exports){ "use strict"; /* exported Validation */ var Matcher = require("./Matcher"); var Properties = require("./Properties"); var ValidationTypes = require("./ValidationTypes"); var ValidationError = require("./ValidationError"); var PropertyValueIterator = require("./PropertyValueIterator"); var Validation = module.exports = { validate: function(property, value) { //normalize name var name = property.toString().toLowerCase(), expression = new PropertyValueIterator(value), spec = Properties[name], part; if (!spec) { if (name.indexOf("-") !== 0) { //vendor prefixed are ok throw new ValidationError("Unknown property '" + property + "'.", property.line, property.col); } } else if (typeof spec !== "number") { // All properties accept some CSS-wide values. // https://drafts.csswg.org/css-values-3/#common-keywords if (ValidationTypes.isAny(expression, "inherit | initial | unset")) { if (expression.hasNext()) { part = expression.next(); throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); } return; } // Property-specific validation. this.singleProperty(spec, expression); } }, singleProperty: function(types, expression) { var result = false, value = expression.value, part; result = Matcher.parse(types).match(expression); if (!result) { if (expression.hasNext() && !expression.isFirst()) { part = expression.peek(); throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); } else { throw new ValidationError("Expected (" + ValidationTypes.describe(types) + ") but found '" + value + "'.", value.line, value.col); } } else if (expression.hasNext()) { part = expression.next(); throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); } } }; },{"./Matcher":3,"./Properties":7,"./PropertyValueIterator":10,"./ValidationError":20,"./ValidationTypes":21}],20:[function(require,module,exports){ "use strict"; module.exports = ValidationError; /** * Type to use when a validation error occurs. * @class ValidationError * @namespace parserlib.util * @constructor * @param {String} message The error message. * @param {int} line The line at which the error occurred. * @param {int} col The column at which the error occurred. */ function ValidationError(message, line, col) { /** * The column at which the error occurred. * @type int * @property col */ this.col = col; /** * The line at which the error occurred. * @type int * @property line */ this.line = line; /** * The text representation of the unit. * @type String * @property text */ this.message = message; } //inherit from Error ValidationError.prototype = new Error(); },{}],21:[function(require,module,exports){ "use strict"; var ValidationTypes = module.exports; var Matcher = require("./Matcher"); function copy(to, from) { Object.keys(from).forEach(function(prop) { to[prop] = from[prop]; }); } copy(ValidationTypes, { isLiteral: function (part, literals) { var text = part.text.toString().toLowerCase(), args = literals.split(" | "), i, len, found = false; for (i=0, len=args.length; i < len && !found; i++) { if (args[i].charAt(0) === "<") { found = this.simple[args[i]](part); } else if (args[i].slice(-2) === "()") { found = (part.type === "function" && part.name === args[i].slice(0, -2)); } else if (text === args[i].toLowerCase()) { found = true; } } return found; }, isSimple: function(type) { return Boolean(this.simple[type]); }, isComplex: function(type) { return Boolean(this.complex[type]); }, describe: function(type) { if (this.complex[type] instanceof Matcher) { return this.complex[type].toString(0); } return type; }, /** * Determines if the next part(s) of the given expression * are any of the given types. */ isAny: function (expression, types) { var args = types.split(" | "), i, len, found = false; for (i=0, len=args.length; i < len && !found && expression.hasNext(); i++) { found = this.isType(expression, args[i]); } return found; }, /** * Determines if the next part(s) of the given expression * are one of a group. */ isAnyOfGroup: function(expression, types) { var args = types.split(" || "), i, len, found = false; for (i=0, len=args.length; i < len && !found; i++) { found = this.isType(expression, args[i]); } return found ? args[i-1] : false; }, /** * Determines if the next part(s) of the given expression * are of a given type. */ isType: function (expression, type) { var part = expression.peek(), result = false; if (type.charAt(0) !== "<") { result = this.isLiteral(part, type); if (result) { expression.next(); } } else if (this.simple[type]) { result = this.simple[type](part); if (result) { expression.next(); } } else if (this.complex[type] instanceof Matcher) { result = this.complex[type].match(expression); } else { result = this.complex[type](expression); } return result; }, simple: { __proto__: null, "<absolute-size>": "xx-small | x-small | small | medium | large | x-large | xx-large", "<animateable-feature>": "scroll-position | contents | <animateable-feature-name>", "<animateable-feature-name>": function(part) { return this["<ident>"](part) && !/^(unset|initial|inherit|will-change|auto|scroll-position|contents)$/i.test(part); }, "<angle>": function(part) { return part.type === "angle"; }, "<attachment>": "scroll | fixed | local", "<attr>": "attr()", // inset() = inset( <shape-arg>{1,4} [round <border-radius>]? ) // circle() = circle( [<shape-radius>]? [at <position>]? ) // ellipse() = ellipse( [<shape-radius>{2}]? [at <position>]? ) // polygon() = polygon( [<fill-rule>,]? [<shape-arg> <shape-arg>]# ) "<basic-shape>": "inset() | circle() | ellipse() | polygon()", "<bg-image>": "<image> | <gradient> | none", "<border-style>": "none | hidden | dotted | dashed | solid | double | groove | " + "ridge | inset | outset", "<border-width>": "<length> | thin | medium | thick", "<box>": "padding-box | border-box | content-box", "<clip-source>": "<uri>", "<color>": function(part) { return part.type === "color" || String(part) === "transparent" || String(part) === "currentColor"; }, // The SVG <color> spec doesn't include "currentColor" or "transparent" as a color. "<color-svg>": function(part) { return part.type === "color"; }, "<content>": "content()", // https://www.w3.org/TR/css3-sizing/#width-height-keywords "<content-sizing>": "fill-available | -moz-available | -webkit-fill-available | " + "max-content | -moz-max-content | -webkit-max-content | " + "min-content | -moz-min-content | -webkit-min-content | " + "fit-content | -moz-fit-content | -webkit-fit-content", "<feature-tag-value>": function(part) { return part.type === "function" && /^[A-Z0-9]{4}$/i.test(part); }, // custom() isn't actually in the spec "<filter-function>": "blur() | brightness() | contrast() | custom() | " + "drop-shadow() | grayscale() | hue-rotate() | invert() | " + "opacity() | saturate() | sepia()", "<flex-basis>": "<width>", "<flex-direction>": "row | row-reverse | column | column-reverse", "<flex-grow>": "<number>", "<flex-shrink>": "<number>", "<flex-wrap>": "nowrap | wrap | wrap-reverse", "<font-size>": "<absolute-size> | <relative-size> | <length> | <percentage>", "<font-stretch>": "normal | ultra-condensed | extra-condensed | condensed | " + "semi-condensed | semi-expanded | expanded | extra-expanded | " + "ultra-expanded", "<font-style>": "normal | italic | oblique", "<font-variant-caps>": "small-caps | all-small-caps | petite-caps | all-petite-caps | " + "unicase | titling-caps", "<font-variant-css21>": "normal | small-caps", "<font-weight>": "normal | bold | bolder | lighter | " + "100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900", "<generic-family>": "serif | sans-serif | cursive | fantasy | monospace", "<geometry-box>": "<shape-box> | fill-box | stroke-box | view-box", "<glyph-angle>": function(part) { return part.type === "angle" && part.units === "deg"; }, "<gradient>": function(part) { return part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part); }, "<icccolor>": "cielab() | cielch() | cielchab() | " + "icc-color() | icc-named-color()", //any identifier "<ident>": function(part) { return part.type === "identifier" || part.wasIdent; }, "<ident-not-generic-family>": function(part) { return this["<ident>"](part) && !this["<generic-family>"](part); }, "<image>": "<uri>", "<integer>": function(part) { return part.type === "integer"; }, "<length>": function(part) { if (part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)) { return true; } else { return part.type === "length" || part.type === "number" || part.type === "integer" || String(part) === "0"; } }, "<line>": function(part) { return part.type === "integer"; }, "<line-height>": "<number> | <length> | <percentage> | normal", "<margin-width>": "<length> | <percentage> | auto", "<miterlimit>": function(part) { return this["<number>"](part) && part.value >= 1; }, "<nonnegative-length-or-percentage>": function(part) { return (this["<length>"](part) || this["<percentage>"](part)) && (String(part) === "0" || part.type === "function" || (part.value) >= 0); }, "<nonnegative-number-or-percentage>": function(part) { return (this["<number>"](part) || this["<percentage>"](part)) && (String(part) === "0" || part.type === "function" || (part.value) >= 0); }, "<number>": function(part) { return part.type === "number" || this["<integer>"](part); }, "<opacity-value>": function(part) { return this["<number>"](part) && part.value >= 0 && part.value <= 1; }, "<padding-width>": "<nonnegative-length-or-percentage>", "<percentage>": function(part) { return part.type === "percentage" || String(part) === "0"; }, "<relative-size>": "smaller | larger", "<shape>": "rect() | inset-rect()", "<shape-box>": "<box> | margin-box", "<single-animation-direction>": "normal | reverse | alternate | alternate-reverse", "<single-animation-name>": function(part) { return this["<ident>"](part) && /^-?[a-z_][-a-z0-9_]+$/i.test(part) && !/^(none|unset|initial|inherit)$/i.test(part); }, "<string>": function(part) { return part.type === "string"; }, "<time>": function(part) { return part.type === "time"; }, "<uri>": function(part) { return part.type === "uri"; }, "<width>": "<margin-width>" }, complex: { __proto__: null, "<azimuth>": "<angle>" + " | " + "[ [ left-side | far-left | left | center-left | center | " + "center-right | right | far-right | right-side ] || behind ]" + " | "+ "leftwards | rightwards", "<bg-position>": "<position>#", "<bg-size>": "[ <length> | <percentage> | auto ]{1,2} | cover | contain", "<border-image-slice>": // [<number> | <percentage>]{1,4} && fill? // *but* fill can appear between any of the numbers Matcher.many([true /* first element is required */], Matcher.cast("<nonnegative-number-or-percentage>"), Matcher.cast("<nonnegative-number-or-percentage>"), Matcher.cast("<nonnegative-number-or-percentage>"), Matcher.cast("<nonnegative-number-or-percentage>"), "fill"), "<border-radius>": "<nonnegative-length-or-percentage>{1,4} " + "[ / <nonnegative-length-or-percentage>{1,4} ]?", "<box-shadow>": "none | <shadow>#", "<clip-path>": "<basic-shape> || <geometry-box>", "<dasharray>": // "list of comma and/or white space separated <length>s and // <percentage>s". There is a non-negative constraint. Matcher.cast("<nonnegative-length-or-percentage>") .braces(1, Infinity, "#", Matcher.cast(",").question()), "<family-name>": // <string> | <IDENT>+ "<string> | <ident-not-generic-family> <ident>*", "<filter-function-list>": "[ <filter-function> | <uri> ]+", // https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property "<flex>": "none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]", "<font-family>": "[ <generic-family> | <family-name> ]#", "<font-shorthand>": "[ <font-style> || <font-variant-css21> || " + "<font-weight> || <font-stretch> ]? <font-size> " + "[ / <line-height> ]? <font-family>", "<font-variant-alternates>": // stylistic(<feature-value-name>) "stylistic() || " + "historical-forms || " + // styleset(<feature-value-name> #) "styleset() || " + // character-variant(<feature-value-name> #) "character-variant() || " + // swash(<feature-value-name>) "swash() || " + // ornaments(<feature-value-name>) "ornaments() || " + // annotation(<feature-value-name>) "annotation()", "<font-variant-ligatures>": // <common-lig-values> "[ common-ligatures | no-common-ligatures ] || " + // <discretionary-lig-values> "[ discretionary-ligatures | no-discretionary-ligatures ] || " + // <historical-lig-values> "[ historical-ligatures | no-historical-ligatures ] || " + // <contextual-alt-values> "[ contextual | no-contextual ]", "<font-variant-numeric>": // <numeric-figure-values> "[ lining-nums | oldstyle-nums ] || " + // <numeric-spacing-values> "[ proportional-nums | tabular-nums ] || " + // <numeric-fraction-values> "[ diagonal-fractions | stacked-fractions ] || " + "ordinal || slashed-zero", "<font-variant-east-asian>": // <east-asian-variant-values> "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ] || " + // <east-asian-width-values> "[ full-width | proportional-width ] || " + "ruby", // Note that <color> here is "as defined in the SVG spec", which // is more restrictive that the <color> defined in the CSS spec. // none | currentColor | <color> [<icccolor>]? | // <funciri> [ none | currentColor | <color> [<icccolor>]? ]? "<paint>": "<paint-basic> | <uri> <paint-basic>?", // Helper definition for <paint> above. "<paint-basic>": "none | currentColor | <color-svg> <icccolor>?", "<position>": // Because our `alt` combinator is ordered, we need to test these // in order from longest possible match to shortest. "[ center | [ left | right ] [ <percentage> | <length> ]? ] && " + "[ center | [ top | bottom ] [ <percentage> | <length> ]? ]" + " | " + "[ left | center | right | <percentage> | <length> ] " + "[ top | center | bottom | <percentage> | <length> ]" + " | " + "[ left | center | right | top | bottom | <percentage> | <length> ]", "<repeat-style>": "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}", "<shadow>": //inset? && [ <length>{2,4} && <color>? ] Matcher.many([true /* length is required */], Matcher.cast("<length>").braces(2, 4), "inset", "<color>"), "<text-decoration-color>": "<color>", "<text-decoration-line>": "none | [ underline || overline || line-through || blink ]", "<text-decoration-style>": "solid | double | dotted | dashed | wavy", "<will-change>": "auto | <animateable-feature>#", "<x-one-radius>": //[ <length> | <percentage> ] [ <length> | <percentage> ]? "[ <length> | <percentage> ]{1,2}" } }); Object.keys(ValidationTypes.simple).forEach(function(nt) { var rule = ValidationTypes.simple[nt]; if (typeof rule === "string") { ValidationTypes.simple[nt] = function(part) { return ValidationTypes.isLiteral(part, rule); }; } }); Object.keys(ValidationTypes.complex).forEach(function(nt) { var rule = ValidationTypes.complex[nt]; if (typeof rule === "string") { ValidationTypes.complex[nt] = Matcher.parse(rule); } }); // Because this is defined relative to other complex validation types, // we need to define it *after* the rest of the types are initialized. ValidationTypes.complex["<font-variant>"] = Matcher.oror({ expand: "<font-variant-ligatures>" }, { expand: "<font-variant-alternates>" }, "<font-variant-caps>", { expand: "<font-variant-numeric>" }, { expand: "<font-variant-east-asian>" }); },{"./Matcher":3}],22:[function(require,module,exports){ "use strict"; module.exports = { Colors : require("./Colors"), Combinator : require("./Combinator"), Parser : require("./Parser"), PropertyName : require("./PropertyName"), PropertyValue : require("./PropertyValue"), PropertyValuePart : require("./PropertyValuePart"), Matcher : require("./Matcher"), MediaFeature : require("./MediaFeature"), MediaQuery : require("./MediaQuery"), Selector : require("./Selector"), SelectorPart : require("./SelectorPart"), SelectorSubPart : require("./SelectorSubPart"), Specificity : require("./Specificity"), TokenStream : require("./TokenStream"), Tokens : require("./Tokens"), ValidationError : require("./ValidationError") }; },{"./Colors":1,"./Combinator":2,"./Matcher":3,"./MediaFeature":4,"./MediaQuery":5,"./Parser":6,"./PropertyName":8,"./PropertyValue":9,"./PropertyValuePart":11,"./Selector":13,"./SelectorPart":14,"./SelectorSubPart":15,"./Specificity":16,"./TokenStream":17,"./Tokens":18,"./ValidationError":20}],23:[function(require,module,exports){ "use strict"; module.exports = EventTarget; /** * A generic base to inherit from for any object * that needs event handling. * @class EventTarget * @constructor */ function EventTarget() { /** * The array of listeners for various events. * @type Object * @property _listeners * @private */ this._listeners = Object.create(null); } EventTarget.prototype = { //restore constructor constructor: EventTarget, /** * Adds a listener for a given event type. * @param {String} type The type of event to add a listener for. * @param {Function} listener The function to call when the event occurs. * @return {void} * @method addListener */ addListener: function(type, listener) { if (!this._listeners[type]) { this._listeners[type] = []; } this._listeners[type].push(listener); }, /** * Fires an event based on the passed-in object. * @param {Object|String} event An object with at least a 'type' attribute * or a string indicating the event name. * @return {void} * @method fire */ fire: function(event) { if (typeof event === "string") { event = { type: event }; } if (typeof event.target !== "undefined") { event.target = this; } if (typeof event.type === "undefined") { throw new Error("Event object missing 'type' property."); } if (this._listeners[event.type]) { //create a copy of the array and use that so listeners can't chane var listeners = this._listeners[event.type].concat(); for (var i=0, len=listeners.length; i < len; i++) { listeners[i].call(this, event); } } }, /** * Removes a listener for a given event type. * @param {String} type The type of event to remove a listener from. * @param {Function} listener The function to remove from the event. * @return {void} * @method removeListener */ removeListener: function(type, listener) { if (this._listeners[type]) { var listeners = this._listeners[type]; for (var i=0, len=listeners.length; i < len; i++) { if (listeners[i] === listener) { listeners.splice(i, 1); break; } } } } }; },{}],24:[function(require,module,exports){ "use strict"; module.exports = StringReader; /** * Convenient way to read through strings. * @namespace parserlib.util * @class StringReader * @constructor * @param {String} text The text to read. */ function StringReader(text) { /** * The input text with line endings normalized. * @property _input * @type String * @private */ this._input = text.replace(/(\r\n?|\n)/g, "\n"); /** * The row for the character to be read next. * @property _line * @type int * @private */ this._line = 1; /** * The column for the character to be read next. * @property _col * @type int * @private */ this._col = 1; /** * The index of the character in the input to be read next. * @property _cursor * @type int * @private */ this._cursor = 0; } StringReader.prototype = { // restore constructor constructor: StringReader, //------------------------------------------------------------------------- // Position info //------------------------------------------------------------------------- /** * Returns the column of the character to be read next. * @return {int} The column of the character to be read next. * @method getCol */ getCol: function() { return this._col; }, /** * Returns the row of the character to be read next. * @return {int} The row of the character to be read next. * @method getLine */ getLine: function() { return this._line; }, /** * Determines if you're at the end of the input. * @return {Boolean} True if there's no more input, false otherwise. * @method eof */ eof: function() { return this._cursor === this._input.length; }, //------------------------------------------------------------------------- // Basic reading //------------------------------------------------------------------------- /** * Reads the next character without advancing the cursor. * @param {int} count How many characters to look ahead (default is 1). * @return {String} The next character or null if there is no next character. * @method peek */ peek: function(count) { var c = null; count = typeof count === "undefined" ? 1 : count; // if we're not at the end of the input... if (this._cursor < this._input.length) { // get character and increment cursor and column c = this._input.charAt(this._cursor + count - 1); } return c; }, /** * Reads the next character from the input and adjusts the row and column * accordingly. * @return {String} The next character or null if there is no next character. * @method read */ read: function() { var c = null; // if we're not at the end of the input... if (this._cursor < this._input.length) { // if the last character was a newline, increment row count // and reset column count if (this._input.charAt(this._cursor) === "\n") { this._line++; this._col=1; } else { this._col++; } // get character and increment cursor and column c = this._input.charAt(this._cursor++); } return c; }, //------------------------------------------------------------------------- // Misc //------------------------------------------------------------------------- /** * Saves the current location so it can be returned to later. * @method mark * @return {void} */ mark: function() { this._bookmark = { cursor: this._cursor, line: this._line, col: this._col }; }, reset: function() { if (this._bookmark) { this._cursor = this._bookmark.cursor; this._line = this._bookmark.line; this._col = this._bookmark.col; delete this._bookmark; } }, //------------------------------------------------------------------------- // Advanced reading //------------------------------------------------------------------------- /** * Reads up to and including the given string. Throws an error if that * string is not found. * @param {String} pattern The string to read. * @return {String} The string when it is found. * @throws Error when the string pattern is not found. * @method readTo */ readTo: function(pattern) { var buffer = "", c; /* * First, buffer must be the same length as the pattern. * Then, buffer must end with the pattern or else reach the * end of the input. */ while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length) { c = this.read(); if (c) { buffer += c; } else { throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); } } return buffer; }, /** * Reads characters while each character causes the given * filter function to return true. The function is passed * in each character and either returns true to continue * reading or false to stop. * @param {Function} filter The function to read on each character. * @return {String} The string made up of all characters that passed the * filter check. * @method readWhile */ readWhile: function(filter) { var buffer = "", c = this.peek(); while (c !== null && filter(c)) { buffer += this.read(); c = this.peek(); } return buffer; }, /** * Reads characters that match either text or a regular expression and * returns those characters. If a match is found, the row and column * are adjusted; if no match is found, the reader's state is unchanged. * reading or false to stop. * @param {String|RegExp} matcher If a string, then the literal string * value is searched for. If a regular expression, then any string * matching the pattern is search for. * @return {String} The string made up of all characters that matched or * null if there was no match. * @method readMatch */ readMatch: function(matcher) { var source = this._input.substring(this._cursor), value = null; // if it's a string, just do a straight match if (typeof matcher === "string") { if (source.slice(0, matcher.length) === matcher) { value = this.readCount(matcher.length); } } else if (matcher instanceof RegExp) { if (matcher.test(source)) { value = this.readCount(RegExp.lastMatch.length); } } return value; }, /** * Reads a given number of characters. If the end of the input is reached, * it reads only the remaining characters and does not throw an error. * @param {int} count The number of characters to read. * @return {String} The string made up the read characters. * @method readCount */ readCount: function(count) { var buffer = ""; while (count--) { buffer += this.read(); } return buffer; } }; },{}],25:[function(require,module,exports){ "use strict"; module.exports = SyntaxError; /** * Type to use when a syntax error occurs. * @class SyntaxError * @namespace parserlib.util * @constructor * @param {String} message The error message. * @param {int} line The line at which the error occurred. * @param {int} col The column at which the error occurred. */ function SyntaxError(message, line, col) { Error.call(this); this.name = this.constructor.name; /** * The column at which the error occurred. * @type int * @property col */ this.col = col; /** * The line at which the error occurred. * @type int * @property line */ this.line = line; /** * The text representation of the unit. * @type String * @property text */ this.message = message; } //inherit from Error SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line },{}],26:[function(require,module,exports){ "use strict"; module.exports = SyntaxUnit; /** * Base type to represent a single syntactic unit. * @class SyntaxUnit * @namespace parserlib.util * @constructor * @param {String} text The text of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function SyntaxUnit(text, line, col, type) { /** * The column of text on which the unit resides. * @type int * @property col */ this.col = col; /** * The line of text on which the unit resides. * @type int * @property line */ this.line = line; /** * The text representation of the unit. * @type String * @property text */ this.text = text; /** * The type of syntax unit. * @type int * @property type */ this.type = type; } /** * Create a new syntax unit based solely on the given token. * Convenience method for creating a new syntax unit when * it represents a single token instead of multiple. * @param {Object} token The token object to represent. * @return {parserlib.util.SyntaxUnit} The object representing the token. * @static * @method fromToken */ SyntaxUnit.fromToken = function(token) { return new SyntaxUnit(token.value, token.startLine, token.startCol); }; SyntaxUnit.prototype = { //restore constructor constructor: SyntaxUnit, /** * Returns the text representation of the unit. * @return {String} The text representation of the unit. * @method valueOf */ valueOf: function() { return this.toString(); }, /** * Returns the text representation of the unit. * @return {String} The text representation of the unit. * @method toString */ toString: function() { return this.text; } }; },{}],27:[function(require,module,exports){ "use strict"; module.exports = TokenStreamBase; var StringReader = require("./StringReader"); var SyntaxError = require("./SyntaxError"); /** * Generic TokenStream providing base functionality. * @class TokenStreamBase * @namespace parserlib.util * @constructor * @param {String|StringReader} input The text to tokenize or a reader from * which to read the input. */ function TokenStreamBase(input, tokenData) { /** * The string reader for easy access to the text. * @type StringReader * @property _reader * @private */ this._reader = new StringReader(input ? input.toString() : ""); /** * Token object for the last consumed token. * @type Token * @property _token * @private */ this._token = null; /** * The array of token information. * @type Array * @property _tokenData * @private */ this._tokenData = tokenData; /** * Lookahead token buffer. * @type Array * @property _lt * @private */ this._lt = []; /** * Lookahead token buffer index. * @type int * @property _ltIndex * @private */ this._ltIndex = 0; this._ltIndexCache = []; } /** * Accepts an array of token information and outputs * an array of token data containing key-value mappings * and matching functions that the TokenStream needs. * @param {Array} tokens An array of token descriptors. * @return {Array} An array of processed token data. * @method createTokenData * @static */ TokenStreamBase.createTokenData = function(tokens) { var nameMap = [], typeMap = Object.create(null), tokenData = tokens.concat([]), i = 0, len = tokenData.length+1; tokenData.UNKNOWN = -1; tokenData.unshift({ name:"EOF" }); for (; i < len; i++) { nameMap.push(tokenData[i].name); tokenData[tokenData[i].name] = i; if (tokenData[i].text) { typeMap[tokenData[i].text] = i; } } tokenData.name = function(tt) { return nameMap[tt]; }; tokenData.type = function(c) { return typeMap[c]; }; return tokenData; }; TokenStreamBase.prototype = { //restore constructor constructor: TokenStreamBase, //------------------------------------------------------------------------- // Matching methods //------------------------------------------------------------------------- /** * Determines if the next token matches the given token type. * If so, that token is consumed; if not, the token is placed * back onto the token stream. You can pass in any number of * token types and this will return true if any of the token * types is found. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token might be. If an array is passed, * it's assumed that the token can be any of these. * @param {variant} channel (Optional) The channel to read from. If not * provided, reads from the default (unnamed) channel. * @return {Boolean} True if the token type matches, false if not. * @method match */ match: function(tokenTypes, channel) { //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)) { tokenTypes = [tokenTypes]; } var tt = this.get(channel), i = 0, len = tokenTypes.length; while (i < len) { if (tt === tokenTypes[i++]) { return true; } } //no match found, put the token back this.unget(); return false; }, /** * Determines if the next token matches the given token type. * If so, that token is consumed; if not, an error is thrown. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token should be. If an array is passed, * it's assumed that the token must be one of these. * @return {void} * @method mustMatch */ mustMatch: function(tokenTypes) { var token; //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)) { tokenTypes = [tokenTypes]; } if (!this.match.apply(this, arguments)) { token = this.LT(1); throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } }, //------------------------------------------------------------------------- // Consuming methods //------------------------------------------------------------------------- /** * Keeps reading from the token stream until either one of the specified * token types is found or until the end of the input is reached. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token should be. If an array is passed, * it's assumed that the token must be one of these. * @param {variant} channel (Optional) The channel to read from. If not * provided, reads from the default (unnamed) channel. * @return {void} * @method advance */ advance: function(tokenTypes, channel) { while (this.LA(0) !== 0 && !this.match(tokenTypes, channel)) { this.get(); } return this.LA(0); }, /** * Consumes the next token from the token stream. * @return {int} The token type of the token that was just consumed. * @method get */ get: function(channel) { var tokenInfo = this._tokenData, i =0, token, info; //check the lookahead buffer first if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length) { i++; this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; //obey channels logic while ((info.channel !== undefined && channel !== info.channel) && this._ltIndex < this._lt.length) { this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; i++; } //here be dragons if ((info.channel === undefined || channel === info.channel) && this._ltIndex <= this._lt.length) { this._ltIndexCache.push(i); return this._token.type; } } //call token retriever method token = this._getToken(); //if it should be hidden, don't save a token if (token.type > -1 && !tokenInfo[token.type].hide) { //apply token channel token.channel = tokenInfo[token.type].channel; //save for later this._token = token; this._lt.push(token); //save space that will be moved (must be done before array is truncated) this._ltIndexCache.push(this._lt.length - this._ltIndex + i); //keep the buffer under 5 items if (this._lt.length > 5) { this._lt.shift(); } //also keep the shift buffer under 5 items if (this._ltIndexCache.length > 5) { this._ltIndexCache.shift(); } //update lookahead index this._ltIndex = this._lt.length; } /* * Skip to the next token if: * 1. The token type is marked as hidden. * 2. The token type has a channel specified and it isn't the current channel. */ info = tokenInfo[token.type]; if (info && (info.hide || (info.channel !== undefined && channel !== info.channel))) { return this.get(channel); } else { //return just the type return token.type; } }, /** * Looks ahead a certain number of tokens and returns the token type at * that position. This will throw an error if you lookahead past the * end of input, past the size of the lookahead buffer, or back past * the first token in the lookahead buffer. * @param {int} The index of the token type to retrieve. 0 for the * current token, 1 for the next, -1 for the previous, etc. * @return {int} The token type of the token in the given position. * @method LA */ LA: function(index) { var total = index, tt; if (index > 0) { //TODO: Store 5 somewhere if (index > 5) { throw new Error("Too much lookahead."); } //get all those tokens while (total) { tt = this.get(); total--; } //unget all those tokens while (total < index) { this.unget(); total++; } } else if (index < 0) { if (this._lt[this._ltIndex+index]) { tt = this._lt[this._ltIndex+index].type; } else { throw new Error("Too much lookbehind."); } } else { tt = this._token.type; } return tt; }, /** * Looks ahead a certain number of tokens and returns the token at * that position. This will throw an error if you lookahead past the * end of input, past the size of the lookahead buffer, or back past * the first token in the lookahead buffer. * @param {int} The index of the token type to retrieve. 0 for the * current token, 1 for the next, -1 for the previous, etc. * @return {Object} The token of the token in the given position. * @method LA */ LT: function(index) { //lookahead first to prime the token buffer this.LA(index); //now find the token, subtract one because _ltIndex is already at the next index return this._lt[this._ltIndex+index-1]; }, /** * Returns the token type for the next token in the stream without * consuming it. * @return {int} The token type of the next token in the stream. * @method peek */ peek: function() { return this.LA(1); }, /** * Returns the actual token object for the last consumed token. * @return {Token} The token object for the last consumed token. * @method token */ token: function() { return this._token; }, /** * Returns the name of the token for the given token type. * @param {int} tokenType The type of token to get the name of. * @return {String} The name of the token or "UNKNOWN_TOKEN" for any * invalid token type. * @method tokenName */ tokenName: function(tokenType) { if (tokenType < 0 || tokenType > this._tokenData.length) { return "UNKNOWN_TOKEN"; } else { return this._tokenData[tokenType].name; } }, /** * Returns the token type value for the given token name. * @param {String} tokenName The name of the token whose value should be returned. * @return {int} The token type value for the given token name or -1 * for an unknown token. * @method tokenName */ tokenType: function(tokenName) { return this._tokenData[tokenName] || -1; }, /** * Returns the last consumed token to the token stream. * @method unget */ unget: function() { //if (this._ltIndex > -1) { if (this._ltIndexCache.length) { this._ltIndex -= this._ltIndexCache.pop();//--; this._token = this._lt[this._ltIndex - 1]; } else { throw new Error("Too much lookahead."); } } }; },{"./StringReader":24,"./SyntaxError":25}],28:[function(require,module,exports){ "use strict"; module.exports = { StringReader : require("./StringReader"), SyntaxError : require("./SyntaxError"), SyntaxUnit : require("./SyntaxUnit"), EventTarget : require("./EventTarget"), TokenStreamBase : require("./TokenStreamBase") }; },{"./EventTarget":23,"./StringReader":24,"./SyntaxError":25,"./SyntaxUnit":26,"./TokenStreamBase":27}],"parserlib":[function(require,module,exports){ "use strict"; module.exports = { css : require("./css"), util : require("./util") }; },{"./css":22,"./util":28}]},{},[]); return require('parserlib'); })(); var clone = (function() { 'use strict'; var nativeMap; try { nativeMap = Map; } catch(_) { // maybe a reference error because no `Map`. Give it a dummy value that no // value will ever be an instanceof. nativeMap = function() {}; } var nativeSet; try { nativeSet = Set; } catch(_) { nativeSet = function() {}; } var nativePromise; try { nativePromise = Promise; } catch(_) { nativePromise = function() {}; } /** * Clones (copies) an Object using deep copying. * * This function supports circular references by default, but if you are certain * there are no circular references in your object, you can save some CPU time * by calling clone(obj, false). * * Caution: if `circular` is false and `parent` contains circular references, * your program may enter an infinite loop and crash. * * @param `parent` - the object to be cloned * @param `circular` - set to true if the object to be cloned may contain * circular references. (optional - true by default) * @param `depth` - set to a number if the object is only to be cloned to * a particular depth. (optional - defaults to Infinity) * @param `prototype` - sets the prototype to be used when cloning an object. * (optional - defaults to parent prototype). * @param `includeNonEnumerable` - set to true if the non-enumerable properties * should be cloned as well. Non-enumerable properties on the prototype * chain will be ignored. (optional - false by default) */ function clone(parent, circular, depth, prototype, includeNonEnumerable) { if (typeof circular === 'object') { depth = circular.depth; prototype = circular.prototype; includeNonEnumerable = circular.includeNonEnumerable; circular = circular.circular; } // maintain two arrays for circular references, where corresponding parents // and children have the same index var allParents = []; var allChildren = []; var useBuffer = typeof Buffer != 'undefined'; if (typeof circular == 'undefined') circular = true; if (typeof depth == 'undefined') depth = Infinity; // recurse this function so we don't reset allParents and allChildren function _clone(parent, depth) { // cloning null always returns null if (parent === null) return null; if (depth === 0) return parent; var child; var proto; if (typeof parent != 'object') { return parent; } if (parent instanceof nativeMap) { child = new nativeMap(); } else if (parent instanceof nativeSet) { child = new nativeSet(); } else if (parent instanceof nativePromise) { child = new nativePromise(function (resolve, reject) { parent.then(function(value) { resolve(_clone(value, depth - 1)); }, function(err) { reject(_clone(err, depth - 1)); }); }); } else if (clone.__isArray(parent)) { child = []; } else if (clone.__isRegExp(parent)) { child = new RegExp(parent.source, __getRegExpFlags(parent)); if (parent.lastIndex) child.lastIndex = parent.lastIndex; } else if (clone.__isDate(parent)) { child = new Date(parent.getTime()); } else if (useBuffer && Buffer.isBuffer(parent)) { child = new Buffer(parent.length); parent.copy(child); return child; } else if (parent instanceof Error) { child = Object.create(parent); } else { if (typeof prototype == 'undefined') { proto = Object.getPrototypeOf(parent); child = Object.create(proto); } else { child = Object.create(prototype); proto = prototype; } } if (circular) { var index = allParents.indexOf(parent); if (index != -1) { return allChildren[index]; } allParents.push(parent); allChildren.push(child); } if (parent instanceof nativeMap) { var keyIterator = parent.keys(); while(true) { var next = keyIterator.next(); if (next.done) { break; } var keyChild = _clone(next.value, depth - 1); var valueChild = _clone(parent.get(next.value), depth - 1); child.set(keyChild, valueChild); } } if (parent instanceof nativeSet) { var iterator = parent.keys(); while(true) { var next = iterator.next(); if (next.done) { break; } var entryChild = _clone(next.value, depth - 1); child.add(entryChild); } } for (var i in parent) { var attrs; if (proto) { attrs = Object.getOwnPropertyDescriptor(proto, i); } if (attrs && attrs.set == null) { continue; } child[i] = _clone(parent[i], depth - 1); } if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(parent); for (var i = 0; i < symbols.length; i++) { // Don't need to worry about cloning a symbol because it is a primitive, // like a number or string. var symbol = symbols[i]; var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { continue; } child[symbol] = _clone(parent[symbol], depth - 1); if (!descriptor.enumerable) { Object.defineProperty(child, symbol, { enumerable: false }); } } } if (includeNonEnumerable) { var allPropertyNames = Object.getOwnPropertyNames(parent); for (var i = 0; i < allPropertyNames.length; i++) { var propertyName = allPropertyNames[i]; var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); if (descriptor && descriptor.enumerable) { continue; } child[propertyName] = _clone(parent[propertyName], depth - 1); Object.defineProperty(child, propertyName, { enumerable: false }); } } return child; } return _clone(parent, depth); } /** * Simple flat clone using prototype, accepts only objects, usefull for property * override on FLAT configuration object (no nested props). * * USE WITH CAUTION! This may not behave as you wish if you do not know how this * works. */ clone.clonePrototype = function clonePrototype(parent) { if (parent === null) return null; var c = function () {}; c.prototype = parent; return new c(); }; // private utility functions function __objToStr(o) { return Object.prototype.toString.call(o); } clone.__objToStr = __objToStr; function __isDate(o) { return typeof o === 'object' && __objToStr(o) === '[object Date]'; } clone.__isDate = __isDate; function __isArray(o) { return typeof o === 'object' && __objToStr(o) === '[object Array]'; } clone.__isArray = __isArray; function __isRegExp(o) { return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; } clone.__isRegExp = __isRegExp; function __getRegExpFlags(re) { var flags = ''; if (re.global) flags += 'g'; if (re.ignoreCase) flags += 'i'; if (re.multiline) flags += 'm'; return flags; } clone.__getRegExpFlags = __getRegExpFlags; return clone; })(); if (typeof module === 'object' && module.exports) { module.exports = clone; } /** * Main CSSLint object. * @class CSSLint * @static * @extends parserlib.util.EventTarget */ /* global parserlib, clone, Reporter */ /* exported CSSLint */ var CSSLint = (function() { "use strict"; var rules = [], formatters = [], embeddedRuleset = /\/\*\s*csslint([^\*]*)\*\//, api = new parserlib.util.EventTarget(); api.version = "1.0.4"; //------------------------------------------------------------------------- // Rule Management //------------------------------------------------------------------------- /** * Adds a new rule to the engine. * @param {Object} rule The rule to add. * @method addRule */ api.addRule = function(rule) { rules.push(rule); rules[rule.id] = rule; }; /** * Clears all rule from the engine. * @method clearRules */ api.clearRules = function() { rules = []; }; /** * Returns the rule objects. * @return An array of rule objects. * @method getRules */ api.getRules = function() { return [].concat(rules).sort(function(a, b) { return a.id > b.id ? 1 : 0; }); }; /** * Returns a ruleset configuration object with all current rules. * @return A ruleset object. * @method getRuleset */ api.getRuleset = function() { var ruleset = {}, i = 0, len = rules.length; while (i < len) { ruleset[rules[i++].id] = 1; // by default, everything is a warning } return ruleset; }; /** * Returns a ruleset object based on embedded rules. * @param {String} text A string of css containing embedded rules. * @param {Object} ruleset A ruleset object to modify. * @return {Object} A ruleset object. * @method getEmbeddedRuleset */ function applyEmbeddedRuleset(text, ruleset) { var valueMap, embedded = text && text.match(embeddedRuleset), rules = embedded && embedded[1]; if (rules) { valueMap = { "true": 2, // true is error "": 1, // blank is warning "false": 0, // false is ignore "2": 2, // explicit error "1": 1, // explicit warning "0": 0 // explicit ignore }; rules.toLowerCase().split(",").forEach(function(rule) { var pair = rule.split(":"), property = pair[0] || "", value = pair[1] || ""; ruleset[property.trim()] = valueMap[value.trim()]; }); } return ruleset; } //------------------------------------------------------------------------- // Formatters //------------------------------------------------------------------------- /** * Adds a new formatter to the engine. * @param {Object} formatter The formatter to add. * @method addFormatter */ api.addFormatter = function(formatter) { // formatters.push(formatter); formatters[formatter.id] = formatter; }; /** * Retrieves a formatter for use. * @param {String} formatId The name of the format to retrieve. * @return {Object} The formatter or undefined. * @method getFormatter */ api.getFormatter = function(formatId) { return formatters[formatId]; }; /** * Formats the results in a particular format for a single file. * @param {Object} result The results returned from CSSLint.verify(). * @param {String} filename The filename for which the results apply. * @param {String} formatId The name of the formatter to use. * @param {Object} options (Optional) for special output handling. * @return {String} A formatted string for the results. * @method format */ api.format = function(results, filename, formatId, options) { var formatter = this.getFormatter(formatId), result = null; if (formatter) { result = formatter.startFormat(); result += formatter.formatResults(results, filename, options || {}); result += formatter.endFormat(); } return result; }; /** * Indicates if the given format is supported. * @param {String} formatId The ID of the format to check. * @return {Boolean} True if the format exists, false if not. * @method hasFormat */ api.hasFormat = function(formatId) { return formatters.hasOwnProperty(formatId); }; //------------------------------------------------------------------------- // Verification //------------------------------------------------------------------------- /** * Starts the verification process for the given CSS text. * @param {String} text The CSS text to verify. * @param {Object} ruleset (Optional) List of rules to apply. If null, then * all rules are used. If a rule has a value of 1 then it's a warning, * a value of 2 means it's an error. * @return {Object} Results of the verification. * @method verify */ api.verify = function(text, ruleset) { var i = 0, reporter, lines, allow = {}, ignore = [], report, parser = new parserlib.css.Parser({ starHack: true, ieFilters: true, underscoreHack: true, strict: false }); // normalize line endings lines = text.replace(/\n\r?/g, "$split$").split("$split$"); // find 'allow' comments CSSLint.Util.forEach(lines, function (line, lineno) { var allowLine = line && line.match(/\/\*[ \t]*csslint[ \t]+allow:[ \t]*([^\*]*)\*\//i), allowRules = allowLine && allowLine[1], allowRuleset = {}; if (allowRules) { allowRules.toLowerCase().split(",").forEach(function(allowRule) { allowRuleset[allowRule.trim()] = true; }); if (Object.keys(allowRuleset).length > 0) { allow[lineno + 1] = allowRuleset; } } }); var ignoreStart = null, ignoreEnd = null; CSSLint.Util.forEach(lines, function (line, lineno) { // Keep oldest, "unclosest" ignore:start if (ignoreStart === null && line.match(/\/\*[ \t]*csslint[ \t]+ignore:start[ \t]*\*\//i)) { ignoreStart = lineno; } if (line.match(/\/\*[ \t]*csslint[ \t]+ignore:end[ \t]*\*\//i)) { ignoreEnd = lineno; } if (ignoreStart !== null && ignoreEnd !== null) { ignore.push([ignoreStart, ignoreEnd]); ignoreStart = ignoreEnd = null; } }); // Close remaining ignore block, if any if (ignoreStart !== null) { ignore.push([ignoreStart, lines.length]); } if (!ruleset) { ruleset = this.getRuleset(); } if (embeddedRuleset.test(text)) { // defensively copy so that caller's version does not get modified ruleset = clone(ruleset); ruleset = applyEmbeddedRuleset(text, ruleset); } reporter = new Reporter(lines, ruleset, allow, ignore); ruleset.errors = 2; // always report parsing errors as errors for (i in ruleset) { if (ruleset.hasOwnProperty(i) && ruleset[i]) { if (rules[i]) { rules[i].init(parser, reporter); } } } // capture most horrible error type try { parser.parse(text); } catch (ex) { reporter.error("Fatal error, cannot continue: " + ex.message, ex.line, ex.col, {}); } report = { messages : reporter.messages, stats : reporter.stats, ruleset : reporter.ruleset, allow : reporter.allow, ignore : reporter.ignore }; // sort by line numbers, rollups at the bottom report.messages.sort(function (a, b) { if (a.rollup && !b.rollup) { return 1; } else if (!a.rollup && b.rollup) { return -1; } else { return a.line - b.line; } }); return report; }; //------------------------------------------------------------------------- // Publish the API //------------------------------------------------------------------------- return api; })(); /** * An instance of Report is used to report results of the * verification back to the main API. * @class Reporter * @constructor * @param {String[]} lines The text lines of the source. * @param {Object} ruleset The set of rules to work with, including if * they are errors or warnings. * @param {Object} explicitly allowed lines * @param {[][]} ingore list of line ranges to be ignored */ function Reporter(lines, ruleset, allow, ignore) { "use strict"; /** * List of messages being reported. * @property messages * @type String[] */ this.messages = []; /** * List of statistics being reported. * @property stats * @type String[] */ this.stats = []; /** * Lines of code being reported on. Used to provide contextual information * for messages. * @property lines * @type String[] */ this.lines = lines; /** * Information about the rules. Used to determine whether an issue is an * error or warning. * @property ruleset * @type Object */ this.ruleset = ruleset; /** * Lines with specific rule messages to leave out of the report. * @property allow * @type Object */ this.allow = allow; if (!this.allow) { this.allow = {}; } /** * Linesets not to include in the report. * @property ignore * @type [][] */ this.ignore = ignore; if (!this.ignore) { this.ignore = []; } } Reporter.prototype = { // restore constructor constructor: Reporter, /** * Report an error. * @param {String} message The message to store. * @param {int} line The line number. * @param {int} col The column number. * @param {Object} rule The rule this message relates to. * @method error */ error: function(message, line, col, rule) { "use strict"; this.messages.push({ type : "error", line : line, col : col, message : message, evidence: this.lines[line-1], rule : rule || {} }); }, /** * Report an warning. * @param {String} message The message to store. * @param {int} line The line number. * @param {int} col The column number. * @param {Object} rule The rule this message relates to. * @method warn * @deprecated Use report instead. */ warn: function(message, line, col, rule) { "use strict"; this.report(message, line, col, rule); }, /** * Report an issue. * @param {String} message The message to store. * @param {int} line The line number. * @param {int} col The column number. * @param {Object} rule The rule this message relates to. * @method report */ report: function(message, line, col, rule) { "use strict"; // Check if rule violation should be allowed if (this.allow.hasOwnProperty(line) && this.allow[line].hasOwnProperty(rule.id)) { return; } var ignore = false; CSSLint.Util.forEach(this.ignore, function (range) { if (range[0] <= line && line <= range[1]) { ignore = true; } }); if (ignore) { return; } this.messages.push({ type : this.ruleset[rule.id] === 2 ? "error" : "warning", line : line, col : col, message : message, evidence: this.lines[line-1], rule : rule }); }, /** * Report some informational text. * @param {String} message The message to store. * @param {int} line The line number. * @param {int} col The column number. * @param {Object} rule The rule this message relates to. * @method info */ info: function(message, line, col, rule) { "use strict"; this.messages.push({ type : "info", line : line, col : col, message : message, evidence: this.lines[line-1], rule : rule }); }, /** * Report some rollup error information. * @param {String} message The message to store. * @param {Object} rule The rule this message relates to. * @method rollupError */ rollupError: function(message, rule) { "use strict"; this.messages.push({ type : "error", rollup : true, message : message, rule : rule }); }, /** * Report some rollup warning information. * @param {String} message The message to store. * @param {Object} rule The rule this message relates to. * @method rollupWarn */ rollupWarn: function(message, rule) { "use strict"; this.messages.push({ type : "warning", rollup : true, message : message, rule : rule }); }, /** * Report a statistic. * @param {String} name The name of the stat to store. * @param {Variant} value The value of the stat. * @method stat */ stat: function(name, value) { "use strict"; this.stats[name] = value; } }; // expose for testing purposes CSSLint._Reporter = Reporter; /* * Utility functions that make life easier. */ CSSLint.Util = { /* * Adds all properties from supplier onto receiver, * overwriting if the same name already exists on * receiver. * @param {Object} The object to receive the properties. * @param {Object} The object to provide the properties. * @return {Object} The receiver */ mix: function(receiver, supplier) { "use strict"; var prop; for (prop in supplier) { if (supplier.hasOwnProperty(prop)) { receiver[prop] = supplier[prop]; } } return prop; }, /* * Polyfill for array indexOf() method. * @param {Array} values The array to search. * @param {Variant} value The value to search for. * @return {int} The index of the value if found, -1 if not. */ indexOf: function(values, value) { "use strict"; if (values.indexOf) { return values.indexOf(value); } else { for (var i=0, len=values.length; i < len; i++) { if (values[i] === value) { return i; } } return -1; } }, /* * Polyfill for array forEach() method. * @param {Array} values The array to operate on. * @param {Function} func The function to call on each item. * @return {void} */ forEach: function(values, func) { "use strict"; if (values.forEach) { return values.forEach(func); } else { for (var i=0, len=values.length; i < len; i++) { func(values[i], i, values); } } } }; /* * Rule: Don't use adjoining classes (.foo.bar). */ CSSLint.addRule({ // rule information id: "adjoining-classes", name: "Disallow adjoining classes", desc: "Don't use adjoining classes.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-adjoining-classes", browsers: "IE6", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, modifier, classCount, i, j, k; for (i=0; i < selectors.length; i++) { selector = selectors[i]; for (j=0; j < selector.parts.length; j++) { part = selector.parts[j]; if (part.type === parser.SELECTOR_PART_TYPE) { classCount = 0; for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (modifier.type === "class") { classCount++; } if (classCount > 1){ reporter.report("Adjoining classes: "+selectors[i].text, part.line, part.col, rule); } } } } } }); } }); /* * Rule: Don't use width or height when using padding or border. */ CSSLint.addRule({ // rule information id: "box-model", name: "Beware of broken box size", desc: "Don't use width or height when using padding or border.", url: "https://github.com/CSSLint/csslint/wiki/Beware-of-box-model-size", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, widthProperties = { border: 1, "border-left": 1, "border-right": 1, padding: 1, "padding-left": 1, "padding-right": 1 }, heightProperties = { border: 1, "border-bottom": 1, "border-top": 1, padding: 1, "padding-bottom": 1, "padding-top": 1 }, properties, boxSizing = false; function startRule() { properties = {}; boxSizing = false; } function endRule() { var prop, value; if (!boxSizing) { if (properties.height) { for (prop in heightProperties) { if (heightProperties.hasOwnProperty(prop) && properties[prop]) { value = properties[prop].value; // special case for padding if (!(prop === "padding" && value.parts.length === 2 && value.parts[0].value === 0)) { reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule); } } } } if (properties.width) { for (prop in widthProperties) { if (widthProperties.hasOwnProperty(prop) && properties[prop]) { value = properties[prop].value; if (!(prop === "padding" && value.parts.length === 2 && value.parts[1].value === 0)) { reporter.report("Using width with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule); } } } } } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var name = event.property.text.toLowerCase(); if (heightProperties[name] || widthProperties[name]) { if (!/^0\S*$/.test(event.value) && !(name === "border" && event.value.toString() === "none")) { properties[name] = { line: event.property.line, col: event.property.col, value: event.value }; } } else { if (/^(width|height)/i.test(name) && /^(length|percentage)/.test(event.value.parts[0].type)) { properties[name] = 1; } else if (name === "box-sizing") { boxSizing = true; } } }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); parser.addListener("endpage", endRule); parser.addListener("endpagemargin", endRule); parser.addListener("endkeyframerule", endRule); parser.addListener("endviewport", endRule); } }); /* * Rule: box-sizing doesn't work in IE6 and IE7. */ CSSLint.addRule({ // rule information id: "box-sizing", name: "Disallow use of box-sizing", desc: "The box-sizing properties isn't supported in IE6 and IE7.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-box-sizing", browsers: "IE6, IE7", tags: ["Compatibility"], // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("property", function(event) { var name = event.property.text.toLowerCase(); if (name === "box-sizing") { reporter.report("The box-sizing property isn't supported in IE6 and IE7.", event.line, event.col, rule); } }); } }); /* * Rule: Use the bulletproof @font-face syntax to avoid 404's in old IE * (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax) */ CSSLint.addRule({ // rule information id: "bulletproof-font-face", name: "Use the bulletproof @font-face syntax", desc: "Use the bulletproof @font-face syntax to avoid 404's in old IE (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax).", url: "https://github.com/CSSLint/csslint/wiki/Bulletproof-font-face", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, fontFaceRule = false, firstSrc = true, ruleFailed = false, line, col; // Mark the start of a @font-face declaration so we only test properties inside it parser.addListener("startfontface", function() { fontFaceRule = true; }); parser.addListener("property", function(event) { // If we aren't inside an @font-face declaration then just return if (!fontFaceRule) { return; } var propertyName = event.property.toString().toLowerCase(), value = event.value.toString(); // Set the line and col numbers for use in the endfontface listener line = event.line; col = event.col; // This is the property that we care about, we can ignore the rest if (propertyName === "src") { var regex = /^\s?url\(['"].+\.eot\?.*['"]\)\s*format\(['"]embedded-opentype['"]\).*$/i; // We need to handle the advanced syntax with two src properties if (!value.match(regex) && firstSrc) { ruleFailed = true; firstSrc = false; } else if (value.match(regex) && !firstSrc) { ruleFailed = false; } } }); // Back to normal rules that we don't need to test parser.addListener("endfontface", function() { fontFaceRule = false; if (ruleFailed) { reporter.report("@font-face declaration doesn't follow the fontspring bulletproof syntax.", line, col, rule); } }); } }); /* * Rule: Include all compatible vendor prefixes to reach a wider * range of users. */ CSSLint.addRule({ // rule information id: "compatible-vendor-prefixes", name: "Require compatible vendor prefixes", desc: "Include all compatible vendor prefixes to reach a wider range of users.", url: "https://github.com/CSSLint/csslint/wiki/Require-compatible-vendor-prefixes", browsers: "All", // initialization init: function (parser, reporter) { "use strict"; var rule = this, compatiblePrefixes, properties, prop, variations, prefixed, i, len, inKeyFrame = false, arrayPush = Array.prototype.push, applyTo = []; // See http://peter.sh/experiments/vendor-prefixed-css-property-overview/ for details compatiblePrefixes = { "animation" : "webkit", "animation-delay" : "webkit", "animation-direction" : "webkit", "animation-duration" : "webkit", "animation-fill-mode" : "webkit", "animation-iteration-count" : "webkit", "animation-name" : "webkit", "animation-play-state" : "webkit", "animation-timing-function" : "webkit", "appearance" : "webkit moz", "border-end" : "webkit moz", "border-end-color" : "webkit moz", "border-end-style" : "webkit moz", "border-end-width" : "webkit moz", "border-image" : "webkit moz o", "border-radius" : "webkit", "border-start" : "webkit moz", "border-start-color" : "webkit moz", "border-start-style" : "webkit moz", "border-start-width" : "webkit moz", "box-align" : "webkit moz ms", "box-direction" : "webkit moz ms", "box-flex" : "webkit moz ms", "box-lines" : "webkit ms", "box-ordinal-group" : "webkit moz ms", "box-orient" : "webkit moz ms", "box-pack" : "webkit moz ms", "box-sizing" : "", "box-shadow" : "", "column-count" : "webkit moz ms", "column-gap" : "webkit moz ms", "column-rule" : "webkit moz ms", "column-rule-color" : "webkit moz ms", "column-rule-style" : "webkit moz ms", "column-rule-width" : "webkit moz ms", "column-width" : "webkit moz ms", "hyphens" : "epub moz", "line-break" : "webkit ms", "margin-end" : "webkit moz", "margin-start" : "webkit moz", "marquee-speed" : "webkit wap", "marquee-style" : "webkit wap", "padding-end" : "webkit moz", "padding-start" : "webkit moz", "tab-size" : "moz o", "text-size-adjust" : "webkit ms", "transform" : "webkit ms", "transform-origin" : "webkit ms", "transition" : "", "transition-delay" : "", "transition-duration" : "", "transition-property" : "", "transition-timing-function" : "", "user-modify" : "webkit moz", "user-select" : "webkit moz ms", "word-break" : "epub ms", "writing-mode" : "epub ms" }; for (prop in compatiblePrefixes) { if (compatiblePrefixes.hasOwnProperty(prop)) { variations = []; prefixed = compatiblePrefixes[prop].split(" "); for (i = 0, len = prefixed.length; i < len; i++) { variations.push("-" + prefixed[i] + "-" + prop); } compatiblePrefixes[prop] = variations; arrayPush.apply(applyTo, variations); } } parser.addListener("startrule", function () { properties = []; }); parser.addListener("startkeyframes", function (event) { inKeyFrame = event.prefix || true; }); parser.addListener("endkeyframes", function () { inKeyFrame = false; }); parser.addListener("property", function (event) { var name = event.property; if (CSSLint.Util.indexOf(applyTo, name.text) > -1) { // e.g., -moz-transform is okay to be alone in @-moz-keyframes if (!inKeyFrame || typeof inKeyFrame !== "string" || name.text.indexOf("-" + inKeyFrame + "-") !== 0) { properties.push(name); } } }); parser.addListener("endrule", function () { if (!properties.length) { return; } var propertyGroups = {}, i, len, name, prop, variations, value, full, actual, item, propertiesSpecified; for (i = 0, len = properties.length; i < len; i++) { name = properties[i]; for (prop in compatiblePrefixes) { if (compatiblePrefixes.hasOwnProperty(prop)) { variations = compatiblePrefixes[prop]; if (CSSLint.Util.indexOf(variations, name.text) > -1) { if (!propertyGroups[prop]) { propertyGroups[prop] = { full: variations.slice(0), actual: [], actualNodes: [] }; } if (CSSLint.Util.indexOf(propertyGroups[prop].actual, name.text) === -1) { propertyGroups[prop].actual.push(name.text); propertyGroups[prop].actualNodes.push(name); } } } } } for (prop in propertyGroups) { if (propertyGroups.hasOwnProperty(prop)) { value = propertyGroups[prop]; full = value.full; actual = value.actual; if (full.length > actual.length) { for (i = 0, len = full.length; i < len; i++) { item = full[i]; if (CSSLint.Util.indexOf(actual, item) === -1) { propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length === 2) ? actual.join(" and ") : actual.join(", "); reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule); } } } } } }); } }); /* * Rule: Certain properties don't play well with certain display values. * - float should not be used with inline-block * - height, width, margin-top, margin-bottom, float should not be used with inline * - vertical-align should not be used with block * - margin, float should not be used with table-* */ CSSLint.addRule({ // rule information id: "display-property-grouping", name: "Require properties appropriate for display", desc: "Certain properties shouldn't be used with certain display property values.", url: "https://github.com/CSSLint/csslint/wiki/Require-properties-appropriate-for-display", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; var propertiesToCheck = { display: 1, "float": "none", height: 1, width: 1, margin: 1, "margin-left": 1, "margin-right": 1, "margin-bottom": 1, "margin-top": 1, padding: 1, "padding-left": 1, "padding-right": 1, "padding-bottom": 1, "padding-top": 1, "vertical-align": 1 }, properties; function reportProperty(name, display, msg) { if (properties[name]) { if (typeof propertiesToCheck[name] !== "string" || properties[name].value.toLowerCase() !== propertiesToCheck[name]) { reporter.report(msg || name + " can't be used with display: " + display + ".", properties[name].line, properties[name].col, rule); } } } function startRule() { properties = {}; } function endRule() { var display = properties.display ? properties.display.value : null; if (display) { switch (display) { case "inline": // height, width, margin-top, margin-bottom, float should not be used with inline reportProperty("height", display); reportProperty("width", display); reportProperty("margin", display); reportProperty("margin-top", display); reportProperty("margin-bottom", display); reportProperty("float", display, "display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug)."); break; case "block": // vertical-align should not be used with block reportProperty("vertical-align", display); break; case "inline-block": // float should not be used with inline-block reportProperty("float", display); break; default: // margin, float should not be used with table if (display.indexOf("table-") === 0) { reportProperty("margin", display); reportProperty("margin-left", display); reportProperty("margin-right", display); reportProperty("margin-top", display); reportProperty("margin-bottom", display); reportProperty("float", display); } // otherwise do nothing } } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startpage", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var name = event.property.text.toLowerCase(); if (propertiesToCheck[name]) { properties[name] = { value: event.value.text, line: event.property.line, col: event.property.col }; } }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); parser.addListener("endkeyframerule", endRule); parser.addListener("endpagemargin", endRule); parser.addListener("endpage", endRule); parser.addListener("endviewport", endRule); } }); /* * Rule: Disallow duplicate background-images (using url). */ CSSLint.addRule({ // rule information id: "duplicate-background-images", name: "Disallow duplicate background images", desc: "Every background-image should be unique. Use a common class for e.g. sprites.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-duplicate-background-images", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, stack = {}; parser.addListener("property", function(event) { var name = event.property.text, value = event.value, i, len; if (name.match(/background/i)) { for (i=0, len=value.parts.length; i < len; i++) { if (value.parts[i].type === "uri") { if (typeof stack[value.parts[i].uri] === "undefined") { stack[value.parts[i].uri] = event; } else { reporter.report("Background image '" + value.parts[i].uri + "' was used multiple times, first declared at line " + stack[value.parts[i].uri].line + ", col " + stack[value.parts[i].uri].col + ".", event.line, event.col, rule); } } } } }); } }); /* * Rule: Duplicate properties must appear one after the other. If an already-defined * property appears somewhere else in the rule, then it's likely an error. */ CSSLint.addRule({ // rule information id: "duplicate-properties", name: "Disallow duplicate properties", desc: "Duplicate properties must appear one after the other.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-duplicate-properties", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, properties, lastProperty; function startRule() { properties = {}; } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var property = event.property, name = property.text.toLowerCase(); if (properties[name] && (lastProperty !== name || properties[name] === event.value.text)) { reporter.report("Duplicate property '" + event.property + "' found.", event.line, event.col, rule); } properties[name] = event.value.text; lastProperty = name; }); } }); /* * Rule: Style rules without any properties defined should be removed. */ CSSLint.addRule({ // rule information id: "empty-rules", name: "Disallow empty rules", desc: "Rules without any properties specified should be removed.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-empty-rules", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; parser.addListener("startrule", function() { count=0; }); parser.addListener("property", function() { count++; }); parser.addListener("endrule", function(event) { var selectors = event.selectors; if (count === 0) { reporter.report("Rule is empty.", selectors[0].line, selectors[0].col, rule); } }); } }); /* * Rule: There should be no syntax errors. (Duh.) */ CSSLint.addRule({ // rule information id: "errors", name: "Parsing Errors", desc: "This rule looks for recoverable syntax errors.", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("error", function(event) { reporter.error(event.message, event.line, event.col, rule); }); } }); CSSLint.addRule({ // rule information id: "fallback-colors", name: "Require fallback colors", desc: "For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.", url: "https://github.com/CSSLint/csslint/wiki/Require-fallback-colors", browsers: "IE6,IE7,IE8", // initialization init: function(parser, reporter) { "use strict"; var rule = this, lastProperty, propertiesToCheck = { color: 1, background: 1, "border-color": 1, "border-top-color": 1, "border-right-color": 1, "border-bottom-color": 1, "border-left-color": 1, border: 1, "border-top": 1, "border-right": 1, "border-bottom": 1, "border-left": 1, "background-color": 1 }; function startRule() { lastProperty = null; } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var property = event.property, name = property.text.toLowerCase(), parts = event.value.parts, i = 0, colorType = "", len = parts.length; if (propertiesToCheck[name]) { while (i < len) { if (parts[i].type === "color") { if ("alpha" in parts[i] || "hue" in parts[i]) { if (/([^\)]+)\(/.test(parts[i])) { colorType = RegExp.$1.toUpperCase(); } if (!lastProperty || (lastProperty.property.text.toLowerCase() !== name || lastProperty.colorType !== "compat")) { reporter.report("Fallback " + name + " (hex or RGB) should precede " + colorType + " " + name + ".", event.line, event.col, rule); } } else { event.colorType = "compat"; } } i++; } } lastProperty = event; }); } }); /* * Rule: You shouldn't use more than 10 floats. If you do, there's probably * room for some abstraction. */ CSSLint.addRule({ // rule information id: "floats", name: "Disallow too many floats", desc: "This rule tests if the float property is used too many times", url: "https://github.com/CSSLint/csslint/wiki/Disallow-too-many-floats", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; var count = 0; // count how many times "float" is used parser.addListener("property", function(event) { if (event.property.text.toLowerCase() === "float" && event.value.text.toLowerCase() !== "none") { count++; } }); // report the results parser.addListener("endstylesheet", function() { reporter.stat("floats", count); if (count >= 10) { reporter.rollupWarn("Too many floats (" + count + "), you're probably using them for layout. Consider using a grid system instead.", rule); } }); } }); /* * Rule: Avoid too many @font-face declarations in the same stylesheet. */ CSSLint.addRule({ // rule information id: "font-faces", name: "Don't use too many web fonts", desc: "Too many different web fonts in the same stylesheet.", url: "https://github.com/CSSLint/csslint/wiki/Don%27t-use-too-many-web-fonts", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; parser.addListener("startfontface", function() { count++; }); parser.addListener("endstylesheet", function() { if (count > 5) { reporter.rollupWarn("Too many @font-face declarations (" + count + ").", rule); } }); } }); /* * Rule: You shouldn't need more than 9 font-size declarations. */ CSSLint.addRule({ // rule information id: "font-sizes", name: "Disallow too many font sizes", desc: "Checks the number of font-size declarations.", url: "https://github.com/CSSLint/csslint/wiki/Don%27t-use-too-many-font-size-declarations", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; // check for use of "font-size" parser.addListener("property", function(event) { if (event.property.toString() === "font-size") { count++; } }); // report the results parser.addListener("endstylesheet", function() { reporter.stat("font-sizes", count); if (count >= 10) { reporter.rollupWarn("Too many font-size declarations (" + count + "), abstraction needed.", rule); } }); } }); /* * Rule: When using a vendor-prefixed gradient, make sure to use them all. */ CSSLint.addRule({ // rule information id: "gradients", name: "Require all gradient definitions", desc: "When using a vendor-prefixed gradient, make sure to use them all.", url: "https://github.com/CSSLint/csslint/wiki/Require-all-gradient-definitions", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, gradients; parser.addListener("startrule", function() { gradients = { moz: 0, webkit: 0, oldWebkit: 0, o: 0 }; }); parser.addListener("property", function(event) { if (/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)) { gradients[RegExp.$1] = 1; } else if (/\-webkit\-gradient/i.test(event.value)) { gradients.oldWebkit = 1; } }); parser.addListener("endrule", function(event) { var missing = []; if (!gradients.moz) { missing.push("Firefox 3.6+"); } if (!gradients.webkit) { missing.push("Webkit (Safari 5+, Chrome)"); } if (!gradients.oldWebkit) { missing.push("Old Webkit (Safari 4+, Chrome)"); } if (!gradients.o) { missing.push("Opera 11.1+"); } if (missing.length && missing.length < 4) { reporter.report("Missing vendor-prefixed CSS gradients for " + missing.join(", ") + ".", event.selectors[0].line, event.selectors[0].col, rule); } }); } }); /* * Rule: Don't use IDs for selectors. */ CSSLint.addRule({ // rule information id: "ids", name: "Disallow IDs in selectors", desc: "Selectors should not contain IDs.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-IDs-in-selectors", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, modifier, idCount, i, j, k; for (i=0; i < selectors.length; i++) { selector = selectors[i]; idCount = 0; for (j=0; j < selector.parts.length; j++) { part = selector.parts[j]; if (part.type === parser.SELECTOR_PART_TYPE) { for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (modifier.type === "id") { idCount++; } } } } if (idCount === 1) { reporter.report("Don't use IDs in selectors.", selector.line, selector.col, rule); } else if (idCount > 1) { reporter.report(idCount + " IDs in the selector, really?", selector.line, selector.col, rule); } } }); } }); /* * Rule: IE6-9 supports up to 31 stylesheet import. * Reference: * http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/internet-explorer-stylesheet-rule-selector-import-sheet-limit-maximum.aspx */ CSSLint.addRule({ // rule information id: "import-ie-limit", name: "@import limit on IE6-IE9", desc: "IE6-9 supports up to 31 @import per stylesheet", browsers: "IE6, IE7, IE8, IE9", // initialization init: function(parser, reporter) { "use strict"; var rule = this, MAX_IMPORT_COUNT = 31, count = 0; function startPage() { count = 0; } parser.addListener("startpage", startPage); parser.addListener("import", function() { count++; }); parser.addListener("endstylesheet", function() { if (count > MAX_IMPORT_COUNT) { reporter.rollupError( "Too many @import rules (" + count + "). IE6-9 supports up to 31 import per stylesheet.", rule ); } }); } }); /* * Rule: Don't use @import, use <link> instead. */ CSSLint.addRule({ // rule information id: "import", name: "Disallow @import", desc: "Don't use @import, use <link> instead.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-%40import", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("import", function(event) { reporter.report("@import prevents parallel downloads, use <link> instead.", event.line, event.col, rule); }); } }); /* * Rule: Make sure !important is not overused, this could lead to specificity * war. Display a warning on !important declarations, an error if it's * used more at least 10 times. */ CSSLint.addRule({ // rule information id: "important", name: "Disallow !important", desc: "Be careful when using !important declaration", url: "https://github.com/CSSLint/csslint/wiki/Disallow-%21important", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; // warn that important is used and increment the declaration counter parser.addListener("property", function(event) { if (event.important === true) { count++; reporter.report("Use of !important", event.line, event.col, rule); } }); // if there are more than 10, show an error parser.addListener("endstylesheet", function() { reporter.stat("important", count); if (count >= 10) { reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specificity issues.", rule); } }); } }); /* * Rule: Properties should be known (listed in CSS3 specification) or * be a vendor-prefixed property. */ CSSLint.addRule({ // rule information id: "known-properties", name: "Require use of known properties", desc: "Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.", url: "https://github.com/CSSLint/csslint/wiki/Require-use-of-known-properties", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("property", function(event) { // the check is handled entirely by the parser-lib (https://github.com/nzakas/parser-lib) if (event.invalid) { reporter.report(event.invalid.message, event.line, event.col, rule); } }); } }); /* * Rule: All properties should be in alphabetical order. */ CSSLint.addRule({ // rule information id: "order-alphabetical", name: "Alphabetical order", desc: "Assure properties are in alphabetical order", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, properties; var startRule = function () { properties = []; }; var endRule = function(event) { var currentProperties = properties.join(","), expectedProperties = properties.sort().join(","); if (currentProperties !== expectedProperties) { reporter.report("Rule doesn't have all its properties in alphabetical order.", event.line, event.col, rule); } }; parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var name = event.property.text, lowerCasePrefixLessName = name.toLowerCase().replace(/^-.*?-/, ""); properties.push(lowerCasePrefixLessName); }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); parser.addListener("endpage", endRule); parser.addListener("endpagemargin", endRule); parser.addListener("endkeyframerule", endRule); parser.addListener("endviewport", endRule); } }); /* * Rule: outline: none or outline: 0 should only be used in a :focus rule * and only if there are other properties in the same rule. */ CSSLint.addRule({ // rule information id: "outline-none", name: "Disallow outline: none", desc: "Use of outline: none or outline: 0 should be limited to :focus rules.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-outline%3Anone", browsers: "All", tags: ["Accessibility"], // initialization init: function(parser, reporter) { "use strict"; var rule = this, lastRule; function startRule(event) { if (event.selectors) { lastRule = { line: event.line, col: event.col, selectors: event.selectors, propCount: 0, outline: false }; } else { lastRule = null; } } function endRule() { if (lastRule) { if (lastRule.outline) { if (lastRule.selectors.toString().toLowerCase().indexOf(":focus") === -1) { reporter.report("Outlines should only be modified using :focus.", lastRule.line, lastRule.col, rule); } else if (lastRule.propCount === 1) { reporter.report("Outlines shouldn't be hidden unless other visual changes are made.", lastRule.line, lastRule.col, rule); } } } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var name = event.property.text.toLowerCase(), value = event.value; if (lastRule) { lastRule.propCount++; if (name === "outline" && (value.toString() === "none" || value.toString() === "0")) { lastRule.outline = true; } } }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); parser.addListener("endpage", endRule); parser.addListener("endpagemargin", endRule); parser.addListener("endkeyframerule", endRule); parser.addListener("endviewport", endRule); } }); /* * Rule: Don't use classes or IDs with elements (a.foo or a#foo). */ CSSLint.addRule({ // rule information id: "overqualified-elements", name: "Disallow overqualified elements", desc: "Don't use classes or IDs with elements (a.foo or a#foo).", url: "https://github.com/CSSLint/csslint/wiki/Disallow-overqualified-elements", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, classes = {}; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, modifier, i, j, k; for (i=0; i < selectors.length; i++) { selector = selectors[i]; for (j=0; j < selector.parts.length; j++) { part = selector.parts[j]; if (part.type === parser.SELECTOR_PART_TYPE) { for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (part.elementName && modifier.type === "id") { reporter.report("Element (" + part + ") is overqualified, just use " + modifier + " without element name.", part.line, part.col, rule); } else if (modifier.type === "class") { if (!classes[modifier]) { classes[modifier] = []; } classes[modifier].push({ modifier: modifier, part: part }); } } } } } }); parser.addListener("endstylesheet", function() { var prop; for (prop in classes) { if (classes.hasOwnProperty(prop)) { // one use means that this is overqualified if (classes[prop].length === 1 && classes[prop][0].part.elementName) { reporter.report("Element (" + classes[prop][0].part + ") is overqualified, just use " + classes[prop][0].modifier + " without element name.", classes[prop][0].part.line, classes[prop][0].part.col, rule); } } } }); } }); /* * Rule: Headings (h1-h6) should not be qualified (namespaced). */ CSSLint.addRule({ // rule information id: "qualified-headings", name: "Disallow qualified headings", desc: "Headings should not be qualified (namespaced).", url: "https://github.com/CSSLint/csslint/wiki/Disallow-qualified-headings", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, i, j; for (i=0; i < selectors.length; i++) { selector = selectors[i]; for (j=0; j < selector.parts.length; j++) { part = selector.parts[j]; if (part.type === parser.SELECTOR_PART_TYPE) { if (part.elementName && /h[1-6]/.test(part.elementName.toString()) && j > 0) { reporter.report("Heading (" + part.elementName + ") should not be qualified.", part.line, part.col, rule); } } } } }); } }); /* * Rule: Selectors that look like regular expressions are slow and should be avoided. */ CSSLint.addRule({ // rule information id: "regex-selectors", name: "Disallow selectors that look like regexs", desc: "Selectors that look like regular expressions are slow and should be avoided.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-selectors-that-look-like-regular-expressions", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, modifier, i, j, k; for (i=0; i < selectors.length; i++) { selector = selectors[i]; for (j=0; j < selector.parts.length; j++) { part = selector.parts[j]; if (part.type === parser.SELECTOR_PART_TYPE) { for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (modifier.type === "attribute") { if (/([~\|\^\$\*]=)/.test(modifier)) { reporter.report("Attribute selectors with " + RegExp.$1 + " are slow!", modifier.line, modifier.col, rule); } } } } } } }); } }); /* * Rule: Total number of rules should not exceed x. */ CSSLint.addRule({ // rule information id: "rules-count", name: "Rules Count", desc: "Track how many rules there are.", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var count = 0; // count each rule parser.addListener("startrule", function() { count++; }); parser.addListener("endstylesheet", function() { reporter.stat("rule-count", count); }); } }); /* * Rule: Warn people with approaching the IE 4095 limit */ CSSLint.addRule({ // rule information id: "selector-max-approaching", name: "Warn when approaching the 4095 selector limit for IE", desc: "Will warn when selector count is >= 3800 selectors.", browsers: "IE", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; parser.addListener("startrule", function(event) { count += event.selectors.length; }); parser.addListener("endstylesheet", function() { if (count >= 3800) { reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.", 0, 0, rule); } }); } }); /* * Rule: Warn people past the IE 4095 limit */ CSSLint.addRule({ // rule information id: "selector-max", name: "Error when past the 4095 selector limit for IE", desc: "Will error when selector count is > 4095.", browsers: "IE", // initialization init: function(parser, reporter) { "use strict"; var rule = this, count = 0; parser.addListener("startrule", function(event) { count += event.selectors.length; }); parser.addListener("endstylesheet", function() { if (count > 4095) { reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.", 0, 0, rule); } }); } }); /* * Rule: Avoid new-line characters in selectors. */ CSSLint.addRule({ // rule information id: "selector-newline", name: "Disallow new-line characters in selectors", desc: "New-line characters in selectors are usually a forgotten comma and not a descendant combinator.", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; function startRule(event) { var i, len, selector, p, n, pLen, part, part2, type, currentLine, nextLine, selectors = event.selectors; for (i = 0, len = selectors.length; i < len; i++) { selector = selectors[i]; for (p = 0, pLen = selector.parts.length; p < pLen; p++) { for (n = p + 1; n < pLen; n++) { part = selector.parts[p]; part2 = selector.parts[n]; type = part.type; currentLine = part.line; nextLine = part2.line; if (type === "descendant" && nextLine > currentLine) { reporter.report("newline character found in selector (forgot a comma?)", currentLine, selectors[i].parts[0].col, rule); } } } } } parser.addListener("startrule", startRule); } }); /* * Rule: Use shorthand properties where possible. * */ CSSLint.addRule({ // rule information id: "shorthand", name: "Require shorthand properties", desc: "Use shorthand properties where possible.", url: "https://github.com/CSSLint/csslint/wiki/Require-shorthand-properties", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, prop, i, len, propertiesToCheck = {}, properties, mapping = { "margin": [ "margin-top", "margin-bottom", "margin-left", "margin-right" ], "padding": [ "padding-top", "padding-bottom", "padding-left", "padding-right" ] }; // initialize propertiesToCheck for (prop in mapping) { if (mapping.hasOwnProperty(prop)) { for (i=0, len=mapping[prop].length; i < len; i++) { propertiesToCheck[mapping[prop][i]] = prop; } } } function startRule() { properties = {}; } // event handler for end of rules function endRule(event) { var prop, i, len, total; // check which properties this rule has for (prop in mapping) { if (mapping.hasOwnProperty(prop)) { total=0; for (i=0, len=mapping[prop].length; i < len; i++) { total += properties[mapping[prop][i]] ? 1 : 0; } if (total === mapping[prop].length) { reporter.report("The properties " + mapping[prop].join(", ") + " can be replaced by " + prop + ".", event.line, event.col, rule); } } } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); // check for use of "font-size" parser.addListener("property", function(event) { var name = event.property.toString().toLowerCase(); if (propertiesToCheck[name]) { properties[name] = 1; } }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); } }); /* * Rule: Don't use properties with a star prefix. * */ CSSLint.addRule({ // rule information id: "star-property-hack", name: "Disallow properties with a star prefix", desc: "Checks for the star property hack (targets IE6/7)", url: "https://github.com/CSSLint/csslint/wiki/Disallow-star-hack", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; // check if property name starts with "*" parser.addListener("property", function(event) { var property = event.property; if (property.hack === "*") { reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule); } }); } }); /* * Rule: Don't use text-indent for image replacement if you need to support rtl. * */ CSSLint.addRule({ // rule information id: "text-indent", name: "Disallow negative text-indent", desc: "Checks for text indent less than -99px", url: "https://github.com/CSSLint/csslint/wiki/Disallow-negative-text-indent", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, textIndent, direction; function startRule() { textIndent = false; direction = "inherit"; } // event handler for end of rules function endRule() { if (textIndent && direction !== "ltr") { reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.", textIndent.line, textIndent.col, rule); } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); // check for use of "font-size" parser.addListener("property", function(event) { var name = event.property.toString().toLowerCase(), value = event.value; if (name === "text-indent" && value.parts[0].value < -99) { textIndent = event.property; } else if (name === "direction" && value.toString() === "ltr") { direction = "ltr"; } }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); } }); /* * Rule: Don't use properties with a underscore prefix. * */ CSSLint.addRule({ // rule information id: "underscore-property-hack", name: "Disallow properties with an underscore prefix", desc: "Checks for the underscore property hack (targets IE6)", url: "https://github.com/CSSLint/csslint/wiki/Disallow-underscore-hack", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; // check if property name starts with "_" parser.addListener("property", function(event) { var property = event.property; if (property.hack === "_") { reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule); } }); } }); /* * Rule: Headings (h1-h6) should be defined only once. */ CSSLint.addRule({ // rule information id: "unique-headings", name: "Headings should only be defined once", desc: "Headings should be defined only once.", url: "https://github.com/CSSLint/csslint/wiki/Headings-should-only-be-defined-once", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; var headings = { h1: 0, h2: 0, h3: 0, h4: 0, h5: 0, h6: 0 }; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, pseudo, i, j; for (i=0; i < selectors.length; i++) { selector = selectors[i]; part = selector.parts[selector.parts.length-1]; if (part.elementName && /(h[1-6])/i.test(part.elementName.toString())) { for (j=0; j < part.modifiers.length; j++) { if (part.modifiers[j].type === "pseudo") { pseudo = true; break; } } if (!pseudo) { headings[RegExp.$1]++; if (headings[RegExp.$1] > 1) { reporter.report("Heading (" + part.elementName + ") has already been defined.", part.line, part.col, rule); } } } } }); parser.addListener("endstylesheet", function() { var prop, messages = []; for (prop in headings) { if (headings.hasOwnProperty(prop)) { if (headings[prop] > 1) { messages.push(headings[prop] + " " + prop + "s"); } } } if (messages.length) { reporter.rollupWarn("You have " + messages.join(", ") + " defined in this stylesheet.", rule); } }); } }); /* * Rule: Don't use universal selector because it's slow. */ CSSLint.addRule({ // rule information id: "universal-selector", name: "Disallow universal selector", desc: "The universal selector (*) is known to be slow.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-universal-selector", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, i; for (i=0; i < selectors.length; i++) { selector = selectors[i]; part = selector.parts[selector.parts.length-1]; if (part.elementName === "*") { reporter.report(rule.desc, part.line, part.col, rule); } } }); } }); /* * Rule: Don't use unqualified attribute selectors because they're just like universal selectors. */ CSSLint.addRule({ // rule information id: "unqualified-attributes", name: "Disallow unqualified attribute selectors", desc: "Unqualified attribute selectors are known to be slow.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-unqualified-attribute-selectors", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; parser.addListener("startrule", function(event) { var selectors = event.selectors, selectorContainsClassOrId = false, selector, part, modifier, i, k; for (i=0; i < selectors.length; i++) { selector = selectors[i]; part = selector.parts[selector.parts.length-1]; if (part.type === parser.SELECTOR_PART_TYPE) { for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (modifier.type === "class" || modifier.type === "id") { selectorContainsClassOrId = true; break; } } if (!selectorContainsClassOrId) { for (k=0; k < part.modifiers.length; k++) { modifier = part.modifiers[k]; if (modifier.type === "attribute" && (!part.elementName || part.elementName === "*")) { reporter.report(rule.desc, part.line, part.col, rule); } } } } } }); } }); /* * Rule: When using a vendor-prefixed property, make sure to * include the standard one. */ CSSLint.addRule({ // rule information id: "vendor-prefix", name: "Require standard property with vendor prefix", desc: "When using a vendor-prefixed property, make sure to include the standard one.", url: "https://github.com/CSSLint/csslint/wiki/Require-standard-property-with-vendor-prefix", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this, properties, num, propertiesToCheck = { "-webkit-border-radius": "border-radius", "-webkit-border-top-left-radius": "border-top-left-radius", "-webkit-border-top-right-radius": "border-top-right-radius", "-webkit-border-bottom-left-radius": "border-bottom-left-radius", "-webkit-border-bottom-right-radius": "border-bottom-right-radius", "-o-border-radius": "border-radius", "-o-border-top-left-radius": "border-top-left-radius", "-o-border-top-right-radius": "border-top-right-radius", "-o-border-bottom-left-radius": "border-bottom-left-radius", "-o-border-bottom-right-radius": "border-bottom-right-radius", "-moz-border-radius": "border-radius", "-moz-border-radius-topleft": "border-top-left-radius", "-moz-border-radius-topright": "border-top-right-radius", "-moz-border-radius-bottomleft": "border-bottom-left-radius", "-moz-border-radius-bottomright": "border-bottom-right-radius", "-moz-column-count": "column-count", "-webkit-column-count": "column-count", "-moz-column-gap": "column-gap", "-webkit-column-gap": "column-gap", "-moz-column-rule": "column-rule", "-webkit-column-rule": "column-rule", "-moz-column-rule-style": "column-rule-style", "-webkit-column-rule-style": "column-rule-style", "-moz-column-rule-color": "column-rule-color", "-webkit-column-rule-color": "column-rule-color", "-moz-column-rule-width": "column-rule-width", "-webkit-column-rule-width": "column-rule-width", "-moz-column-width": "column-width", "-webkit-column-width": "column-width", "-webkit-column-span": "column-span", "-webkit-columns": "columns", "-moz-box-shadow": "box-shadow", "-webkit-box-shadow": "box-shadow", "-moz-transform": "transform", "-webkit-transform": "transform", "-o-transform": "transform", "-ms-transform": "transform", "-moz-transform-origin": "transform-origin", "-webkit-transform-origin": "transform-origin", "-o-transform-origin": "transform-origin", "-ms-transform-origin": "transform-origin", "-moz-box-sizing": "box-sizing", "-webkit-box-sizing": "box-sizing" }; // event handler for beginning of rules function startRule() { properties = {}; num = 1; } // event handler for end of rules function endRule() { var prop, i, len, needed, actual, needsStandard = []; for (prop in properties) { if (propertiesToCheck[prop]) { needsStandard.push({ actual: prop, needed: propertiesToCheck[prop] }); } } for (i=0, len=needsStandard.length; i < len; i++) { needed = needsStandard[i].needed; actual = needsStandard[i].actual; if (!properties[needed]) { reporter.report("Missing standard property '" + needed + "' to go along with '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule); } else { // make sure standard property is last if (properties[needed][0].pos < properties[actual][0].pos) { reporter.report("Standard property '" + needed + "' should come after vendor-prefixed property '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule); } } } } parser.addListener("startrule", startRule); parser.addListener("startfontface", startRule); parser.addListener("startpage", startRule); parser.addListener("startpagemargin", startRule); parser.addListener("startkeyframerule", startRule); parser.addListener("startviewport", startRule); parser.addListener("property", function(event) { var name = event.property.text.toLowerCase(); if (!properties[name]) { properties[name] = []; } properties[name].push({ name: event.property, value: event.value, pos: num++ }); }); parser.addListener("endrule", endRule); parser.addListener("endfontface", endRule); parser.addListener("endpage", endRule); parser.addListener("endpagemargin", endRule); parser.addListener("endkeyframerule", endRule); parser.addListener("endviewport", endRule); } }); /* * Rule: You don't need to specify units when a value is 0. */ CSSLint.addRule({ // rule information id: "zero-units", name: "Disallow units for 0 values", desc: "You don't need to specify units when a value is 0.", url: "https://github.com/CSSLint/csslint/wiki/Disallow-units-for-zero-values", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; // count how many times "float" is used parser.addListener("property", function(event) { var parts = event.value.parts, i = 0, len = parts.length; while (i < len) { if ((parts[i].units || parts[i].type === "percentage") && parts[i].value === 0 && parts[i].type !== "time") { reporter.report("Values of 0 shouldn't have units specified.", parts[i].line, parts[i].col, rule); } i++; } }); } }); (function() { "use strict"; /** * Replace special characters before write to output. * * Rules: * - single quotes is the escape sequence for double-quotes * - & is the escape sequence for & * - < is the escape sequence for < * - > is the escape sequence for > * * @param {String} message to escape * @return escaped message as {String} */ var xmlEscape = function(str) { if (!str || str.constructor !== String) { return ""; } return str.replace(/["&><]/g, function(match) { switch (match) { case "\"": return """; case "&": return "&"; case "<": return "<"; case ">": return ">"; } }); }; CSSLint.addFormatter({ // format information id: "checkstyle-xml", name: "Checkstyle XML format", /** * Return opening root XML tag. * @return {String} to prepend before all results */ startFormat: function() { return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>"; }, /** * Return closing root XML tag. * @return {String} to append after all results */ endFormat: function() { return "</checkstyle>"; }, /** * Returns message when there is a file read error. * @param {String} filename The name of the file that caused the error. * @param {String} message The error message * @return {String} The error message. */ readError: function(filename, message) { return "<file name=\"" + xmlEscape(filename) + "\"><error line=\"0\" column=\"0\" severty=\"error\" message=\"" + xmlEscape(message) + "\"></error></file>"; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (UNUSED for now) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename/*, options*/) { var messages = results.messages, output = []; /** * Generate a source string for a rule. * Checkstyle source strings usually resemble Java class names e.g * net.csslint.SomeRuleName * @param {Object} rule * @return rule source as {String} */ var generateSource = function(rule) { if (!rule || !("name" in rule)) { return ""; } return "net.csslint." + rule.name.replace(/\s/g, ""); }; if (messages.length > 0) { output.push("<file name=\""+filename+"\">"); CSSLint.Util.forEach(messages, function (message) { // ignore rollups for now if (!message.rollup) { output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" + " message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>"); } }); output.push("</file>"); } return output.join(""); } }); }()); CSSLint.addFormatter({ // format information id: "compact", name: "Compact, 'porcelain' format", /** * Return content to be printed before all file results. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; return ""; }, /** * Return content to be printed after all file results. * @return {String} to append after all results */ endFormat: function() { "use strict"; return ""; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (Optional) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename, options) { "use strict"; var messages = results.messages, output = ""; options = options || {}; /** * Capitalize and return given string. * @param str {String} to capitalize * @return {String} capitalized */ var capitalize = function(str) { return str.charAt(0).toUpperCase() + str.slice(1); }; if (messages.length === 0) { return options.quiet ? "" : filename + ": Lint Free!"; } CSSLint.Util.forEach(messages, function(message) { if (message.rollup) { output += filename + ": " + capitalize(message.type) + " - " + message.message + " (" + message.rule.id + ")\n"; } else { output += filename + ": line " + message.line + ", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + " (" + message.rule.id + ")\n"; } }); return output; } }); CSSLint.addFormatter({ // format information id: "csslint-xml", name: "CSSLint XML format", /** * Return opening root XML tag. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; return "<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>"; }, /** * Return closing root XML tag. * @return {String} to append after all results */ endFormat: function() { "use strict"; return "</csslint>"; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (UNUSED for now) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename/*, options*/) { "use strict"; var messages = results.messages, output = []; /** * Replace special characters before write to output. * * Rules: * - single quotes is the escape sequence for double-quotes * - & is the escape sequence for & * - < is the escape sequence for < * - > is the escape sequence for > * * @param {String} message to escape * @return escaped message as {String} */ var escapeSpecialCharacters = function(str) { if (!str || str.constructor !== String) { return ""; } return str.replace(/"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); }; if (messages.length > 0) { output.push("<file name=\""+filename+"\">"); CSSLint.Util.forEach(messages, function (message) { if (message.rollup) { output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>"); } else { output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" + " reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>"); } }); output.push("</file>"); } return output.join(""); } }); /* globals JSON: true */ CSSLint.addFormatter({ // format information id: "json", name: "JSON", /** * Return content to be printed before all file results. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; this.json = []; return ""; }, /** * Return content to be printed after all file results. * @return {String} to append after all results */ endFormat: function() { "use strict"; var ret = ""; if (this.json.length > 0) { if (this.json.length === 1) { ret = JSON.stringify(this.json[0]); } else { ret = JSON.stringify(this.json); } } return ret; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path (Unused) * @return {String} output for results */ formatResults: function(results, filename, options) { "use strict"; if (results.messages.length > 0 || !options.quiet) { this.json.push({ filename: filename, messages: results.messages, stats: results.stats }); } return ""; } }); CSSLint.addFormatter({ // format information id: "junit-xml", name: "JUNIT XML format", /** * Return opening root XML tag. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; return "<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>"; }, /** * Return closing root XML tag. * @return {String} to append after all results */ endFormat: function() { "use strict"; return "</testsuites>"; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (UNUSED for now) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename/*, options*/) { "use strict"; var messages = results.messages, output = [], tests = { "error": 0, "failure": 0 }; /** * Generate a source string for a rule. * JUNIT source strings usually resemble Java class names e.g * net.csslint.SomeRuleName * @param {Object} rule * @return rule source as {String} */ var generateSource = function(rule) { if (!rule || !("name" in rule)) { return ""; } return "net.csslint." + rule.name.replace(/\s/g, ""); }; /** * Replace special characters before write to output. * * Rules: * - single quotes is the escape sequence for double-quotes * - < is the escape sequence for < * - > is the escape sequence for > * * @param {String} message to escape * @return escaped message as {String} */ var escapeSpecialCharacters = function(str) { if (!str || str.constructor !== String) { return ""; } return str.replace(/"/g, "'").replace(/</g, "<").replace(/>/g, ">"); }; if (messages.length > 0) { messages.forEach(function (message) { // since junit has no warning class // all issues as errors var type = message.type === "warning" ? "error" : message.type; // ignore rollups for now if (!message.rollup) { // build the test case separately, once joined // we'll add it to a custom array filtered by type output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">"); output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">"); output.push("</testcase>"); tests[type] += 1; } }); output.unshift("<testsuite time=\"0\" tests=\"" + messages.length + "\" skipped=\"0\" errors=\"" + tests.error + "\" failures=\"" + tests.failure + "\" package=\"net.csslint\" name=\"" + filename + "\">"); output.push("</testsuite>"); } return output.join(""); } }); CSSLint.addFormatter({ // format information id: "lint-xml", name: "Lint XML format", /** * Return opening root XML tag. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; return "<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>"; }, /** * Return closing root XML tag. * @return {String} to append after all results */ endFormat: function() { "use strict"; return "</lint>"; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (UNUSED for now) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename/*, options*/) { "use strict"; var messages = results.messages, output = []; /** * Replace special characters before write to output. * * Rules: * - single quotes is the escape sequence for double-quotes * - & is the escape sequence for & * - < is the escape sequence for < * - > is the escape sequence for > * * @param {String} message to escape * @return escaped message as {String} */ var escapeSpecialCharacters = function(str) { if (!str || str.constructor !== String) { return ""; } return str.replace(/"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); }; if (messages.length > 0) { output.push("<file name=\""+filename+"\">"); CSSLint.Util.forEach(messages, function (message) { if (message.rollup) { output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>"); } else { var rule = ""; if (message.rule && message.rule.id) { rule = "rule=\"" + escapeSpecialCharacters(message.rule.id) + "\" "; } output.push("<issue " + rule + "line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" + " reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>"); } }); output.push("</file>"); } return output.join(""); } }); CSSLint.addFormatter({ // format information id: "text", name: "Plain Text", /** * Return content to be printed before all file results. * @return {String} to prepend before all results */ startFormat: function() { "use strict"; return ""; }, /** * Return content to be printed after all file results. * @return {String} to append after all results */ endFormat: function() { "use strict"; return ""; }, /** * Given CSS Lint results for a file, return output for this format. * @param results {Object} with error and warning messages * @param filename {String} relative file path * @param options {Object} (Optional) specifies special handling of output * @return {String} output for results */ formatResults: function(results, filename, options) { "use strict"; var messages = results.messages, output = ""; options = options || {}; if (messages.length === 0) { return options.quiet ? "" : "\n\ncsslint: No errors in " + filename + "."; } output = "\n\ncsslint: There "; if (messages.length === 1) { output += "is 1 problem"; } else { output += "are " + messages.length + " problems"; } output += " in " + filename + "."; var pos = filename.lastIndexOf("/"), shortFilename = filename; if (pos === -1) { pos = filename.lastIndexOf("\\"); } if (pos > -1) { shortFilename = filename.substring(pos+1); } CSSLint.Util.forEach(messages, function (message, i) { output = output + "\n\n" + shortFilename; if (message.rollup) { output += "\n" + (i+1) + ": " + message.type; output += "\n" + message.message; } else { output += "\n" + (i+1) + ": " + message.type + " at line " + message.line + ", col " + message.col; output += "\n" + message.message; output += "\n" + message.evidence; } }); return output; } }); return CSSLint; })(); htmlhint.js 0000644 00000042507 14720661433 0006747 0 ustar 00 /*! * HTMLHint v0.9.14 * https://github.com/yaniswang/HTMLHint * * (c) 2014-2017 Yanis Wang <yanis.wang@gmail.com>. * MIT Licensed */ var HTMLHint=function(e){function t(e,t){return Array(e+1).join(t||" ")}var a={};return a.version="0.9.14",a.release="20170826",a.rules={},a.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0},a.addRule=function(e){a.rules[e.id]=e},a.verify=function(t,n){(n===e||0===Object.keys(n).length)&&(n=a.defaultRuleset),t=t.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,function(t,a){return n===e&&(n={}),a.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,function(t,a,r){"false"===r?r=!1:"true"===r&&(r=!0),n[a]=r===e?!0:r}),""});var r,i=new HTMLParser,s=new a.Reporter(t,n),o=a.rules;for(var l in n)r=o[l],r!==e&&n[l]!==!1&&r.init(i,s,n[l]);return i.parse(t),s.messages},a.format=function(e,a){a=a||{};var n=[],r={white:"",grey:"",red:"",reset:""};a.colors&&(r.white="[37m",r.grey="[90m",r.red="[31m",r.reset="[39m");var i=a.indent||0;return e.forEach(function(e){var a=40,s=a+20,o=e.evidence,l=e.line,u=e.col,d=o.length,c=u>a+1?u-a:1,f=o.length>u+s?u+s:d;a+1>u&&(f+=a-u+1),o=o.replace(/\t/g," ").substring(c-1,f),c>1&&(o="..."+o,c-=3),d>f&&(o+="..."),n.push(r.white+t(i)+"L"+l+" |"+r.grey+o+r.reset);var g=u-c,h=o.substring(0,g).match(/[^\u0000-\u00ff]/g);null!==h&&(g+=h.length),n.push(r.white+t(i)+t((l+"").length+3+g)+"^ "+r.red+e.message+" ("+e.rule.id+")"+r.reset)}),n},a}();"object"==typeof exports&&exports&&(exports.HTMLHint=HTMLHint),function(e){var t=function(){var e=this;e._init.apply(e,arguments)};t.prototype={_init:function(e,t){var a=this;a.html=e,a.lines=e.split(/\r?\n/);var n=e.match(/\r?\n/);a.brLen=null!==n?n[0].length:0,a.ruleset=t,a.messages=[]},error:function(e,t,a,n,r){this.report("error",e,t,a,n,r)},warn:function(e,t,a,n,r){this.report("warning",e,t,a,n,r)},info:function(e,t,a,n,r){this.report("info",e,t,a,n,r)},report:function(e,t,a,n,r,i){for(var s,o,l=this,u=l.lines,d=l.brLen,c=a-1,f=u.length;f>c&&(s=u[c],o=s.length,n>o&&f>a);c++)a++,n-=o,1!==n&&(n-=d);l.messages.push({type:e,message:t,raw:i,evidence:s,line:a,col:n,rule:{id:r.id,description:r.description,link:"https://github.com/yaniswang/HTMLHint/wiki/"+r.id}})}},e.Reporter=t}(HTMLHint);var HTMLParser=function(e){var t=function(){var e=this;e._init.apply(e,arguments)};return t.prototype={_init:function(){var e=this;e._listeners={},e._mapCdataTags=e.makeMap("script,style"),e._arrBlocks=[],e.lastEvent=null},makeMap:function(e){for(var t={},a=e.split(","),n=0;a.length>n;n++)t[a[n]]=!0;return t},parse:function(t){function a(t,a,n,r){var i=n-b+1;r===e&&(r={}),r.raw=a,r.pos=n,r.line=w,r.col=i,L.push(r),c.fire(t,r);for(var s;s=m.exec(a);)w++,b=n+m.lastIndex}var n,r,i,s,o,l,u,d,c=this,f=c._mapCdataTags,g=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,h=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,m=/\r?\n/g,p=0,v=0,b=0,w=1,L=c._arrBlocks;for(c.fire("start",{pos:0,line:1,col:1});n=g.exec(t);)if(r=n.index,r>p&&(d=t.substring(p,r),o?u.push(d):a("text",d,p)),p=g.lastIndex,!(i=n[1])||(o&&i===o&&(d=u.join(""),a("cdata",d,v,{tagName:o,attrs:l}),o=null,l=null,u=null),o))if(o)u.push(n[0]);else if(i=n[4]){s=[];for(var y,T=n[5],H=0;y=h.exec(T);){var x=y[1],M=y[2]?y[2]:y[4]?y[4]:"",N=y[3]?y[3]:y[5]?y[5]:y[6]?y[6]:"";s.push({name:x,value:N,quote:M,index:y.index,raw:y[0]}),H+=y[0].length}H===T.length?(a("tagstart",n[0],r,{tagName:i,attrs:s,close:n[6]}),f[i]&&(o=i,l=s.concat(),u=[],v=p)):a("text",n[0],r)}else(n[2]||n[3])&&a("comment",n[0],r,{content:n[2]||n[3],"long":n[2]?!0:!1});else a("tagend",n[0],r,{tagName:i});t.length>p&&(d=t.substring(p,t.length),a("text",d,p)),c.fire("end",{pos:p,line:w,col:t.length-b+1})},addListener:function(t,a){for(var n,r=this._listeners,i=t.split(/[,\s]/),s=0,o=i.length;o>s;s++)n=i[s],r[n]===e&&(r[n]=[]),r[n].push(a)},fire:function(t,a){a===e&&(a={}),a.type=t;var n=this,r=[],i=n._listeners[t],s=n._listeners.all;i!==e&&(r=r.concat(i)),s!==e&&(r=r.concat(s));var o=n.lastEvent;null!==o&&(delete o.lastEvent,a.lastEvent=o),n.lastEvent=a;for(var l=0,u=r.length;u>l;l++)r[l].call(n,a)},removeListener:function(t,a){var n=this._listeners[t];if(n!==e)for(var r=0,i=n.length;i>r;r++)if(n[r]===a){n.splice(r,1);break}},fixPos:function(e,t){var a,n=e.raw.substr(0,t),r=n.split(/\r?\n/),i=r.length-1,s=e.line;return i>0?(s+=i,a=r[i].length+1):a=e.col+t,{line:s,col:a}},getMapAttrs:function(e){for(var t,a={},n=0,r=e.length;r>n;n++)t=e[n],a[t.name]=t.value;return a}},t}();"object"==typeof exports&&exports&&(exports.HTMLParser=HTMLParser),HTMLHint.addRule({id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init:function(e,t){var a=this;e.addListener("tagstart",function(n){var r,i=n.tagName.toLowerCase(),s=e.getMapAttrs(n.attrs),o=n.col+i.length+1;"img"!==i||"alt"in s?("area"===i&&"href"in s||"input"===i&&"image"===s.type)&&("alt"in s&&""!==s.alt||(r="area"===i?"area[href]":"input[type=image]",t.warn("The alt attribute of "+r+" must have a value.",n.line,o,a,n.raw))):t.warn("An alt attribute must be present on <img> elements.",n.line,o,a,n.raw)})}}),HTMLHint.addRule({id:"attr-lowercase",description:"All attribute names must be in lowercase.",init:function(e,t,a){var n=this,r=Array.isArray(a)?a:[];e.addListener("tagstart",function(e){for(var a,i=e.attrs,s=e.col+e.tagName.length+1,o=0,l=i.length;l>o;o++){a=i[o];var u=a.name;-1===r.indexOf(u)&&u!==u.toLowerCase()&&t.error("The attribute name of [ "+u+" ] must be in lowercase.",e.line,s+a.index,n,a.raw)}})}}),HTMLHint.addRule({id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r,i=e.attrs,s=e.col+e.tagName.length+1,o={},l=0,u=i.length;u>l;l++)n=i[l],r=n.name,o[r]===!0&&t.error("Duplicate of attribute name [ "+n.name+" ] was found.",e.line,s+n.index,a,n.raw),o[r]=!0})}}),HTMLHint.addRule({id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r,i=e.attrs,s=e.col+e.tagName.length+1,o=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,l=0,u=i.length;u>l;l++)if(n=i[l],r=n.value.match(o),null!==r){var d=escape(r[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn("The value of attribute [ "+n.name+" ] cannot contain an unsafe char [ "+d+" ].",e.line,s+n.index,a,n.raw)}})}}),HTMLHint.addRule({id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r=e.attrs,i=e.col+e.tagName.length+1,s=0,o=r.length;o>s;s++)n=r[s],(""!==n.value&&'"'!==n.quote||""===n.value&&"'"===n.quote)&&t.error("The value of attribute [ "+n.name+" ] must be in double quotes.",e.line,i+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"attr-value-not-empty",description:"All attributes must have values.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r=e.attrs,i=e.col+e.tagName.length+1,s=0,o=r.length;o>s;s++)n=r[s],""===n.quote&&""===n.value&&t.warn("The attribute [ "+n.name+" ] must have a value.",e.line,i+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"csslint",description:"Scan css with csslint.",init:function(e,t,a){var n=this;e.addListener("cdata",function(e){if("style"===e.tagName.toLowerCase()){var r;if(r="object"==typeof exports&&require?require("csslint").CSSLint.verify:CSSLint.verify,void 0!==a){var i=e.line-1,s=e.col-1;try{var o=r(e.raw,a).messages;o.forEach(function(e){var a=e.line;t["warning"===e.type?"warn":"error"]("["+e.rule.id+"] "+e.message,i+a,(1===a?s:0)+e.col,n,e.evidence)})}catch(l){}}}})}}),HTMLHint.addRule({id:"doctype-first",description:"Doctype must be declared first.",init:function(e,t){var a=this,n=function(r){"start"===r.type||"text"===r.type&&/^\s*$/.test(r.raw)||(("comment"!==r.type&&r.long===!1||/^DOCTYPE\s+/i.test(r.content)===!1)&&t.error("Doctype must be declared first.",r.line,r.col,a,r.raw),e.removeListener("all",n))};e.addListener("all",n)}}),HTMLHint.addRule({id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init:function(e,t){function a(e){e.long===!1&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,r,e.raw)}function n(){e.removeListener("comment",a),e.removeListener("tagstart",n)}var r=this;e.addListener("all",a),e.addListener("tagstart",n)}}),HTMLHint.addRule({id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init:function(e,t){function a(a){var n=e.getMapAttrs(a.attrs),o=n.type,l=a.tagName.toLowerCase();"head"===l&&(s=!0),s!==!0||"script"!==l||o&&i.test(o)!==!0||t.warn("The <script> tag cannot be used in a <head> tag.",a.line,a.col,r,a.raw)}function n(t){"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",a),e.removeListener("tagend",n))}var r=this,i=/^(text\/javascript|application\/javascript)$/i,s=!1;e.addListener("tagstart",a),e.addListener("tagend",n)}}),HTMLHint.addRule({id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init:function(e,t,a){var n=this,r="abs"===a?"absolute":"relative";e.addListener("tagstart",function(e){for(var a,i=e.attrs,s=e.col+e.tagName.length+1,o=0,l=i.length;l>o;o++)if(a=i[o],"href"===a.name){("absolute"===r&&/^\w+?:/.test(a.value)===!1||"relative"===r&&/^https?:\/\//.test(a.value)===!0)&&t.warn("The value of the href attribute [ "+a.value+" ] must be "+r+".",e.line,s+a.index,n,a.raw);break}})}}),HTMLHint.addRule({id:"id-class-ad-disabled",description:"The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r,i=e.attrs,s=e.col+e.tagName.length+1,o=0,l=i.length;l>o;o++)n=i[o],r=n.name,/^(id|class)$/i.test(r)&&/(^|[-\_])ad([-\_]|$)/i.test(n.value)&&t.warn("The value of attribute "+r+" cannot use the ad keyword.",e.line,s+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init:function(e,t,a){var n,r=this,i={underline:{regId:/^[a-z\d]+(_[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by an underscore."},dash:{regId:/^[a-z\d]+(-[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by a dash."},hump:{regId:/^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,message:"The id and class attribute values must meet the camelCase style."}};if(n="string"==typeof a?i[a]:a,n&&n.regId){var s=n.regId,o=n.message;e.addListener("tagstart",function(e){for(var a,n=e.attrs,i=e.col+e.tagName.length+1,l=0,u=n.length;u>l;l++)if(a=n[l],"id"===a.name.toLowerCase()&&s.test(a.value)===!1&&t.warn(o,e.line,i+a.index,r,a.raw),"class"===a.name.toLowerCase())for(var d,c=a.value.split(/\s+/g),f=0,g=c.length;g>f;f++)d=c[f],d&&s.test(d)===!1&&t.warn(o,e.line,i+a.index,r,d)})}}}),HTMLHint.addRule({id:"id-unique",description:"The value of id attributes must be unique.",init:function(e,t){var a=this,n={};e.addListener("tagstart",function(e){for(var r,i,s=e.attrs,o=e.col+e.tagName.length+1,l=0,u=s.length;u>l;l++)if(r=s[l],"id"===r.name.toLowerCase()){i=r.value,i&&(void 0===n[i]?n[i]=1:n[i]++,n[i]>1&&t.error("The id value [ "+i+" ] must be unique.",e.line,o+r.index,a,r.raw));break}})}}),HTMLHint.addRule({id:"inline-script-disabled",description:"Inline script cannot be used.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r,i=e.attrs,s=e.col+e.tagName.length+1,o=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i,l=0,u=i.length;u>l;l++)n=i[l],r=n.name.toLowerCase(),o.test(r)===!0?t.warn("Inline script [ "+n.raw+" ] cannot be used.",e.line,s+n.index,a,n.raw):("src"===r||"href"===r)&&/^\s*javascript:/i.test(n.value)&&t.warn("Inline script [ "+n.raw+" ] cannot be used.",e.line,s+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"inline-style-disabled",description:"Inline style cannot be used.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r=e.attrs,i=e.col+e.tagName.length+1,s=0,o=r.length;o>s;s++)n=r[s],"style"===n.name.toLowerCase()&&t.warn("Inline style [ "+n.raw+" ] cannot be used.",e.line,i+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"jshint",description:"Scan script with jshint.",init:function(e,t,a){var n=this;e.addListener("cdata",function(r){if("script"===r.tagName.toLowerCase()){var i=e.getMapAttrs(r.attrs),s=i.type;if(void 0!==i.src||s&&/^(text\/javascript)$/i.test(s)===!1)return;var o;if(o="object"==typeof exports&&require?require("jshint").JSHINT:JSHINT,void 0!==a){var l=r.line-1,u=r.col-1,d=r.raw.replace(/\t/g," ");try{var c=o(d,a,a.globals);c===!1&&o.errors.forEach(function(e){var a=e.line;t.warn(e.reason,l+a,(1===a?u:0)+e.character,n,e.evidence)})}catch(f){}}}})}}),HTMLHint.addRule({id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init:function(e,t,a){var n=this,r="nomix",i=null;if("string"==typeof a){var s=a.match(/^([a-z]+)(\d+)?/);r=s[1],i=s[2]&&parseInt(s[2],10)}e.addListener("text",function(a){for(var s,o=a.raw,l=/(^|\r?\n)([ \t]+)/g;s=l.exec(o);){var u=e.fixPos(a,s.index+s[1].length);if(1===u.col){var d=s[2];"space"===r?i?(/^ +$/.test(d)===!1||0!==d.length%i)&&t.warn("Please use space for indentation and keep "+i+" length.",u.line,1,n,a.raw):/^ +$/.test(d)===!1&&t.warn("Please use space for indentation.",u.line,1,n,a.raw):"tab"===r&&/^\t+$/.test(d)===!1?t.warn("Please use tab for indentation.",u.line,1,n,a.raw):/ +\t|\t+ /.test(d)===!0&&t.warn("Do not mix tabs and spaces for indentation.",u.line,1,n,a.raw)}}})}}),HTMLHint.addRule({id:"spec-char-escape",description:"Special characters must be escaped.",init:function(e,t){var a=this;e.addListener("text",function(n){for(var r,i=n.raw,s=/[<>]/g;r=s.exec(i);){var o=e.fixPos(n,r.index);t.error("Special characters must be escaped : [ "+r[0]+" ].",o.line,o.col,a,n.raw)}})}}),HTMLHint.addRule({id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,r=e.tagName,i=e.attrs,s=e.col+r.length+1,o=0,l=i.length;l>o;o++)n=i[o],(/^(img|script|embed|bgsound|iframe)$/.test(r)===!0&&"src"===n.name||"link"===r&&"href"===n.name||"object"===r&&"data"===n.name)&&""===n.value&&t.error("The attribute [ "+n.name+" ] of the tag [ "+r+" ] must have a value.",e.line,s+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"style-disabled",description:"<style> tags cannot be used.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,a,e.raw)})}}),HTMLHint.addRule({id:"tag-pair",description:"Tag must be paired.",init:function(e,t){var a=this,n=[],r=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",function(e){var t=e.tagName.toLowerCase();void 0!==r[t]||e.close||n.push({tagName:t,line:e.line,raw:e.raw})}),e.addListener("tagend",function(e){for(var r=e.tagName.toLowerCase(),i=n.length-1;i>=0&&n[i].tagName!==r;i--);if(i>=0){for(var s=[],o=n.length-1;o>i;o--)s.push("</"+n[o].tagName+">");if(s.length>0){var l=n[n.length-1];t.error("Tag must be paired, missing: [ "+s.join("")+" ], start tag match failed [ "+l.raw+" ] on line "+l.line+".",e.line,e.col,a,e.raw)}n.length=i}else t.error("Tag must be paired, no start tag: [ "+e.raw+" ]",e.line,e.col,a,e.raw)}),e.addListener("end",function(e){for(var r=[],i=n.length-1;i>=0;i--)r.push("</"+n[i].tagName+">");if(r.length>0){var s=n[n.length-1];t.error("Tag must be paired, missing: [ "+r.join("")+" ], open tag match failed [ "+s.raw+" ] on line "+s.line+".",e.line,e.col,a,"")}})}}),HTMLHint.addRule({id:"tag-self-close",description:"Empty tags must be self closed.",init:function(e,t){var a=this,n=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",function(e){var r=e.tagName.toLowerCase();void 0!==n[r]&&(e.close||t.warn("The empty tag : [ "+r+" ] must be self closed.",e.line,e.col,a,e.raw))})}}),HTMLHint.addRule({id:"tagname-lowercase",description:"All html element names must be in lowercase.",init:function(e,t){var a=this;e.addListener("tagstart,tagend",function(e){var n=e.tagName;n!==n.toLowerCase()&&t.error("The html element name of [ "+n+" ] must be in lowercase.",e.line,e.col,a,e.raw)})}}),HTMLHint.addRule({id:"title-require",description:"<title> must be present in <head> tag.",init:function(e,t){function a(e){var t=e.tagName.toLowerCase();"head"===t?i=!0:"title"===t&&i&&(s=!0)}function n(i){var o=i.tagName.toLowerCase();if(s&&"title"===o){var l=i.lastEvent;("text"!==l.type||"text"===l.type&&/^\s*$/.test(l.raw)===!0)&&t.error("<title></title> must not be empty.",i.line,i.col,r,i.raw)}else"head"===o&&(s===!1&&t.error("<title> must be present in <head> tag.",i.line,i.col,r,i.raw),e.removeListener("tagstart",a),e.removeListener("tagend",n))}var r=this,i=!1,s=!1;e.addListener("tagstart",a),e.addListener("tagend",n)}}); fakejshint.js 0000644 00000001752 14720661433 0007243 0 ustar 00 // JSHINT has some GPL Compatability issues, so we are faking it out and using esprima for validation // Based on https://github.com/jquery/esprima/blob/gh-pages/demo/validate.js which is MIT licensed var fakeJSHINT = new function() { var syntax, errors; var that = this; this.data = []; this.convertError = function( error ){ return { line: error.lineNumber, character: error.column, reason: error.description, code: 'E' }; }; this.parse = function( code ){ try { syntax = window.esprima.parse(code, { tolerant: true, loc: true }); errors = syntax.errors; if ( errors.length > 0 ) { for ( var i = 0; i < errors.length; i++) { var error = errors[i]; that.data.push( that.convertError( error ) ); } } else { that.data = []; } } catch (e) { that.data.push( that.convertError( e ) ); } }; }; window.JSHINT = function( text ){ fakeJSHINT.parse( text ); }; window.JSHINT.data = function(){ return { errors: fakeJSHINT.data }; };
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0.33 |
proxy
|
phpinfo
|
Réglages