trill_on_swish/commit

prolog highlight in query pane

authorrzese
Thu May 28 10:43:07 2015 +0200
committerrzese
Thu May 28 10:43:07 2015 +0200
commit8e19c7cd0f5ef4a17c7739db6d494a39384b4738
tree62c6279a70189b4e335732fb9a870bd8a066df0a
parentbebe0af224f52ad2efd2a188a7051d2d418f736f
Diff style: patch stat
diff --git a/src b/src
index 5ea574f..9b1feaf 160000
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 5ea574fedea1011da0ae91c685cb9ae5763c9a9b
+Subproject commit 9b1feaf00512b5a7c6900256c237b00cc30892b2
diff --git a/web/css/trill_on_swish-min.css b/web/css/trill_on_swish-min.css
index 56bb81d..4fb9f5c 100644
--- a/web/css/trill_on_swish-min.css
+++ b/web/css/trill_on_swish-min.css
@@ -1,4 +1,4 @@
-ul.dropdown-menu li.checkbox input{margin-left:3px}ul.dropdown-menu li.checkbox span{margin-left:20px}body,html{width:100%;height:100%;padding:0;margin:0;overflow:hidden}nav.navbar{margin-bottom:5px}#content{width:100%;height:calc(100% - 55px);padding:0;background-color:#fff}.pane-container,.pane-wrapper{width:100%;height:100%;background-color:white:green}.splittable{background-color:#fff;width:100%;height:100%;padding:5px}.CodeMirror{font-family:monospace;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.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}@-moz-keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}@-webkit-keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}@keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.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-invalidchar,.cm-s-default .cm-error{color:red}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;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative;border-right:30px solid transparent;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper{-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror ::selection{background:#d7d4f0}.CodeMirror ::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-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;max-width:19em;overflow:hidden;white-space:pre;color:#000;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:#fff}.CodeMirror,.prolog-editor{height:100%}.CodeMirror pre.CodeMirror-placeholder{color:#999}.CodeMirror .source-msg.error{color:red;border-left:2px solid red}.CodeMirror .source-msg{border-left:2px solid #000;padding:0 5px;background-color:#ddd;cursor:hand;cursor:pointer}.CodeMirror .source-msg>span{color:#888;font-weight:700;border:1px solid #bbb}.CodeMirror .source-msg:hover>span{color:red}.CodeMirror-hover{outline:grey solid 1px}.CodeMirror-search-match{background-color:#ff0}.CodeMirror-search-alt-match{background-color:#bee}div.prolog-query{height:100%;padding:5px;background-color:#eee}table.prolog-query{width:100%;height:100%}table.prolog-query .buttons-right{text-align:right}table.prolog-query textarea.query{width:100%;height:100%;box-sizing:border-box}table.prolog-query .prolog-prompt{vertical-align:top;font-weight:700}span.run-chk-table{margin-right:5px;color:#777}span.run-chk-table input{position:relative;top:2px}div.prolog-runners{width:100%;height:100%;background-image:url(../icons/owl_25_years.png);background-size:90%;background-repeat:no-repeat;background-position:35% 50%;overflow:auto}div.prolog-runner{margin:2px 5px;border:1px solid #ccc;border-radius:5px}div.prolog-runner:focus{outline:0}div.prolog-runner.iconic>div.runner-results{display:none}div.runner-title{padding:0 5px 2px;border-radius:5px}div.prolog-runner:focus div.runner-title{border:2px solid #000}div.runner-results{padding:2px 0;background-color:#fff}span.answer-no{float:right;color:#060;font-size:80%;margin-right:2px;font-style:italic}div.answer{padding-left:5px}div.answer.even{background-color:#eee}div.answer.odd{background-color:#fff}div.response{font-style:italic;color:#00f;font-size:90%;margin-left:10%;background-color:#eee;border:1px solid #ccc;border-radius:5px;padding:0 5px}span.prolog-true{font-weight:700}span.prolog-false{font-weight:700;color:red}div.cputime{text-align:right}div.cputime span{background-color:#ccc;border-radius:5px;border:1px solid #888;padding:0 5px;font-size:80%;font-style:italic;color:#060}span.runner-state{position:relative;top:2px;width:1.5em;height:1.5em;margin-right:5px;background-size:100%;background-repeat:no-repeat;display:inline-block}div.runners-menu{position:absolute;top:3px;right:5px;z-index:2000}div.runners-menu button.dropdown-toggle{background:none;border:0;cursor:pointer;padding:0;color:#000;float:right;font-size:16px;font-weight:700;line-height:1;opacity:.2}div.runner-title button.dropdown-toggle{background:none;border:0;cursor:pointer;padding:0}div.runner-title>button{background:none;border:0;cursor:pointer;padding:0;color:#000;float:right;font-size:21px;font-weight:700;line-height:1;opacity:.2;text-shadow:0 1px 0 #fff;margin-left:5px}div.runner-title>button:hover,div.runners-menu button.dropdown-toggle:hover{opacity:.8}span.runner-state.idle,span.runner-state.wait-input,span.runner-state.wait-next{background-image:url(../icons/logo.png)}span.runner-state.running{background-image:url(../icons/running.gif)}span.runner-state.false,span.runner-state.stopped,span.runner-state.true{background-image:url(../icons/dead.png)}span.runner-state.aborted,span.runner-state.error{background-image:url(../icons/error.png)}div.controller.running>div.running,div.controller.wait-input>div.wait-input,div.controller.wait-next>div.wait-next{display:block}div.controller>div{display:none}div.wait-input button{float:right;box-sizing:border-box}div.wait-input span{display:block;overflow:hidden}div.wait-input input{width:100%;box-sizing:border-box}pre.prolog-message{white-space:pre-wrap;padding:2px;margin:0}pre.msg-information,pre.msg-informational{color:#060;font-style:italic}pre.msg-warning{color:red}pre.msg-error{color:red;font-weight:700}table.prolog-answers{width:100%}table.prolog-answers td{padding:0 5px;border:1px solid #888}table.prolog-answers th{padding:0 5px;border:1px solid #888;text-align:center}table.prolog-answers tr:nth-child(odd){background-color:#eee}table.prolog-answers tr:nth-child(even){background-color:#fff}table.prolog-answers tr.projection{border-bottom:2px solid #333}tr.projection th.pl-pvar{color:#800;font-weight:700}tr.projection th.residuals{color:#888;font-weight:400;font-style:italic}.answer-nth{width:2ex;text-align:right}th.answer-nth{color:#888;font-weight:400;font-style:italic}td.answer-nth{color:#060;font-size:80%;font-style:italic;background-color:#eee;vertical-align:top}div.render-multi{position:relative;vertical-align:top;background-image:url(../icons/page-fold-20.png);background-size:15px;background-repeat:no-repeat}#render-select{position:absolute;background-color:#fff;padding:5px 20px;border:1px solid #000;border-radius:5px;box-shadow:5px 5px 5px #888;z-index:500;white-space:nowrap}.render-selecting{outline:#800 solid 1px}.render-multi-active{position:absolute;left:0;top:0;width:20px;height:20px}.render-table{border:2px solid #333}.render-table td{padding:0 5px;border:1px solid #888}.render-table th{padding:0 5px;border:1px solid #888;text-align:center}.render-table tr:nth-child(odd){background-color:#eee}.render-table tr:nth-child(even){background-color:#fff}.render-table tr.hrow{border-bottom:2px solid #333}.render-code-list{color:#040;font-style:italic}.render-ellipsis{colour:#00f;padding:0 5px}.render-svg-tree{padding:5px;display:inline-block}.render-svg-tree svg text{padding:.5em .2em}.render-svg-tree svg g.collapsed g text{padding:0 .5ex}.render-svg-tree svg polyline{fill:none}.render-svg-tree g.noleaf text{font-weight:700;fill:#00f}.render-svg-tree g.leaf text{font-weight:400;fill:#000}.fold{display:none}.pl-ellipsis,.pl-functor:hover,.pl-infix:hover{color:#00f;text-decoration:underline}.pl-ovar{color:#800;font-weight:700}.pl-anon{color:#800}.pl-avar{color:#888}.pl-var{color:#800}.pl-atom{color:#762}.pl-functor{color:#000;font-style:italic}.pl-comment{color:#060;font-style:italic}span.diff-tags{margin-left:2em}.diff-tag{border:1px solid #ddd;padding:0 4px;margin-left:2px;border-radius:5px;background-color:#e1edff}.diff-tag.added{color:green}.diff-tag.deleted{text-decoration:line-through;color:red}pre.udiff .udiff-del{color:red}pre.udiff .udiff-add{color:green}/*! jQuery UI - v1.11.3 - 2015-02-12
+ul.dropdown-menu li.checkbox input{margin-left:3px}ul.dropdown-menu li.checkbox span{margin-left:20px}body,html{width:100%;height:100%;padding:0;margin:0;overflow:hidden}nav.navbar{margin-bottom:5px}#content{width:100%;height:calc(100% - 55px);padding:0;background-color:#fff}.pane-container,.pane-wrapper{width:100%;height:100%;background-color:white:green}.splittable{background-color:#fff;width:100%;height:100%;padding:5px}.CodeMirror{font-family:monospace;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.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}@-moz-keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}@-webkit-keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}@keyframes blink{0%{background:#7e7}50%{background:0 0}100%{background:#7e7}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.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-invalidchar,.cm-s-default .cm-error{color:red}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;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative;border-right:30px solid transparent;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper{-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror ::selection{background:#d7d4f0}.CodeMirror ::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-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}.cm-s-prolog span.cm-neg-number,.cm-s-prolog span.cm-number{color:#000}.cm-s-prolog span.cm-atom{color:#762}.cm-s-prolog span.cm-qatom{color:#008}.cm-s-prolog span.cm-string{color:#008;font-style:italic}.cm-s-prolog span.cm-bqstring,.cm-s-prolog span.cm-chars,.cm-s-prolog span.cm-codes{color:#040;font-style:italic}.cm-s-prolog span.cm-functor{color:#000;font-style:italic}.cm-s-prolog span.cm-key,.cm-s-prolog span.cm-tag{color:#000;font-weight:700}.cm-s-prolog span.cm-qq_content{color:#900}.cm-s-prolog span.cm-qq_close,.cm-s-prolog span.cm-qq_open,.cm-s-prolog span.cm-qq_sep{color:#00f;font-weight:700}.cm-s-prolog span.cm-qq_type{font-weight:700}.cm-s-prolog span.cm-comment,.cm-s-prolog span.cm-comment_string{color:#060;font-style:italic;line-height:1em}.cm-s-prolog span.cm-var{color:#800}.cm-s-prolog span.cm-var-2{color:#888}.cm-s-prolog span.cm-anon{color:#800}.cm-s-prolog span.cm-singleton{color:#800;font-weight:700}.cm-s-prolog span.cm-identifier{font-weight:700}.cm-s-prolog span.cm-module{color:#549}.cm-s-prolog span.cm-head_exported{color:#00f;font-weight:700}.cm-s-prolog span.cm-head_unreferenced{color:red;font-weight:700}.cm-s-prolog span.cm-head_built_in,.cm-s-prolog span.cm-head_iso{background:orange;font-weight:700}.cm-s-prolog span.cm-head_hook{color:#00f;text-decoration:underline}.cm-s-prolog span.cm-head_extern{color:#00f;font-weight:700}.cm-s-prolog span.cm-head_public{color:#016300;font-weight:700}.cm-s-prolog span.cm-head{font-weight:700}.cm-s-prolog span.cm-goal_built_in,.cm-s-prolog span.cm-goal_imported{color:#00f}.cm-s-prolog span.cm-goal_autoload{color:#008}.cm-s-prolog span.cm-goal_undefined{color:red}.cm-s-prolog span.cm-goal_dynamic{color:#f0f}.cm-s-prolog span.cm-goal_thread_local{color:#f0f;text-decoration:underline}.cm-s-prolog span.cm-goal_recursion{text-decoration:underline}.cm-s-prolog span.cm-meta,.cm-s-prolog span.cm-op_type{color:#00f}.cm-s-prolog span.cm-file_no_depends{color:#00f;text-decoration:underline;background:#fcd}.cm-s-prolog span.cm-file{color:#00f;text-decoration:underline}.cm-s-prolog span.cm-nofile{color:red}.cm-s-prolog span.cm-option_name{color:#3434ba}.cm-s-prolog span.cm-no_option_name{color:red}.cm-s-prolog span.cm-flag_name{color:#00f}.cm-s-prolog span.cm-no_flag_name{color:red}.cm-s-prolog span.cm-error{background-color:#fa0}.cm-s-prolog span.cm-link{color:#762}.cm-s-prolog span.cm-expanded{color:#00f;text-decoration:underline}.cm-s-prolog span.cm-xpce_method{font-weight:700}.cm-s-prolog span.cm-xpce_class_built_in{color:#00f}.cm-s-prolog span.cm-xpce_class_lib{color:#00f;font-style:italic}.cm-s-prolog span.cm-xpce_class_undef,.cm-s-prolog span.cm-xpce_class_user{color:#000;font-style:italic}.cm-s-prolog span.cm-outofsync{border:1px dotted red}.cm-s-prolog span.cm-html{color:#909;font-weight:700}.cm-s-prolog span.cm-entity,.cm-s-prolog span.cm-html_attribute{color:#909}.cm-s-prolog span.cm-sgml_attr_function{color:#00f}.cm-s-prolog span.cm-http_location_for_id{font-weight:700}.cm-s-prolog span.cm-http_no_location_for_id{color:red;font-weight:700}.cm-jumped{background:#ff0}.CodeMirror-hover-tooltip{background-color:infobackground;border:1px solid #000;border-radius:4px;color:infotext;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;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-hover-tooltip .pred-name{color:#00f;font-family:monospace;margin-right:5px}.CodeMirror-hover-tooltip .pred-tag{font-weight:700;margin-right:5px}.CodeMirror-hover-tooltip .pred-summary{font-style:italic}.CodeMirror-templates-variable{outline:#4664A5 solid 1px}.CodeMirror-templates-variable-selected{background-color:#B4D7FF}.CodeMirror-hint-template{background:url(data:image/gif;base64,R0lGODlhEAAQANUAAH5weoJ1g4h8kY+EoZaMsZyTv6CYyGd9qWqArG+Fr3aLs3yRuIKXvYmdwY2hxIaUroiVrIyXqoidwZGlx4+aqJScpfr9//f8//b8//n9/9Xz/+v5/5ifovH7/+n5/+36//D7//T8/+r6/+v6//P8//f9//b9//r+//n+/56inqKlm6iol62rlP7xevzndvjQasiYQP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADEALAAAAAAQABAAAAaEwJhwSCwOYcikEkmEtZ7QKKzpMhgKhIEgAHBNj6+wePwVsjTotJpFXGk88Hh8RVRpJo4GY6FIIDwqRCkaIxuFIoUjIylEHHd5e30IHxxEFRogIB2ZmpoVRBR3EgsJByGnJBREERolFyWwJhgmJRFEEBonFigoFhYZvRBED8TFxsRGyUVBADs=) left center no-repeat;padding-left:18px;margin:3px 0}.CodeMirror-hints-contextInfo{position:absolute;z-index:10;border:3px double #d4d0c8;max-height:200px;max-width:400px;min-width:400px;overflow:auto;background:#FFFFE1;font-family:Tahoma;font-size:12px;padding:5px}.CodeMirror-hints{overflow-x:visible}.CodeMirror-hint{position:relative;max-width:none;overflow:visible}.CodeMirror-hint-description{display:none}.CodeMirror-hint-description.active{display:block;position:absolute;z-index:20;left:10px;top:0}.CodeMirror,.prolog-editor{height:100%}.CodeMirror pre.CodeMirror-placeholder{color:#999}.CodeMirror .source-msg.error{color:red;border-left:2px solid red}.CodeMirror .source-msg{border-left:2px solid #000;padding:0 5px;background-color:#ddd;cursor:hand;cursor:pointer}.CodeMirror .source-msg>span{color:#888;font-weight:700;border:1px solid #bbb}.CodeMirror .source-msg:hover>span{color:red}.CodeMirror-hover{outline:grey solid 1px}.CodeMirror-search-match{background-color:#ff0}.CodeMirror-search-alt-match{background-color:#bee}div.prolog-query{height:100%;padding:5px;background-color:#eee}table.prolog-query{width:100%;height:100%}table.prolog-query .buttons-right{text-align:right}table.prolog-query textarea.query{width:100%;height:100%;box-sizing:border-box}table.prolog-query .prolog-prompt{vertical-align:top;font-weight:700}span.run-chk-table{margin-right:5px;color:#777}span.run-chk-table input{position:relative;top:2px}div.prolog-runners{width:100%;height:100%;background-image:url(../icons/owl_25_years.png);background-size:90%;background-repeat:no-repeat;background-position:35% 50%;overflow:auto}div.prolog-runner{margin:2px 5px;border:1px solid #ccc;border-radius:5px}div.prolog-runner:focus{outline:0}div.prolog-runner.iconic>div.runner-results{display:none}div.runner-title{padding:0 5px 2px;border-radius:5px}div.prolog-runner:focus div.runner-title{border:2px solid #000}div.runner-results{padding:2px 0;background-color:#fff}span.answer-no{float:right;color:#060;font-size:80%;margin-right:2px;font-style:italic}div.answer{padding-left:5px}div.answer.even{background-color:#eee}div.answer.odd{background-color:#fff}div.response{font-style:italic;color:#00f;font-size:90%;margin-left:10%;background-color:#eee;border:1px solid #ccc;border-radius:5px;padding:0 5px}span.prolog-true{font-weight:700}span.prolog-false{font-weight:700;color:red}div.cputime{text-align:right}div.cputime span{background-color:#ccc;border-radius:5px;border:1px solid #888;padding:0 5px;font-size:80%;font-style:italic;color:#060}span.runner-state{position:relative;top:2px;width:1.5em;height:1.5em;margin-right:5px;background-size:100%;background-repeat:no-repeat;display:inline-block}div.runners-menu{position:absolute;top:3px;right:5px;z-index:2000}div.runners-menu button.dropdown-toggle{background:none;border:0;cursor:pointer;padding:0;color:#000;float:right;font-size:16px;font-weight:700;line-height:1;opacity:.2}div.runner-title button.dropdown-toggle{background:none;border:0;cursor:pointer;padding:0}div.runner-title>button{background:none;border:0;cursor:pointer;padding:0;color:#000;float:right;font-size:21px;font-weight:700;line-height:1;opacity:.2;text-shadow:0 1px 0 #fff;margin-left:5px}div.runner-title>button:hover,div.runners-menu button.dropdown-toggle:hover{opacity:.8}span.runner-state.idle,span.runner-state.wait-input,span.runner-state.wait-next{background-image:url(../icons/logo.png)}span.runner-state.running{background-image:url(../icons/running.gif)}span.runner-state.false,span.runner-state.stopped,span.runner-state.true{background-image:url(../icons/dead.png)}span.runner-state.aborted,span.runner-state.error{background-image:url(../icons/error.png)}div.controller.running>div.running,div.controller.wait-input>div.wait-input,div.controller.wait-next>div.wait-next{display:block}div.controller>div{display:none}div.wait-input button{float:right;box-sizing:border-box}div.wait-input span{display:block;overflow:hidden}div.wait-input input{width:100%;box-sizing:border-box}pre.prolog-message{white-space:pre-wrap;padding:2px;margin:0}pre.msg-information,pre.msg-informational{color:#060;font-style:italic}pre.msg-warning{color:red}pre.msg-error{color:red;font-weight:700}table.prolog-answers{width:100%}table.prolog-answers td{padding:0 5px;border:1px solid #888}table.prolog-answers th{padding:0 5px;border:1px solid #888;text-align:center}table.prolog-answers tr:nth-child(odd){background-color:#eee}table.prolog-answers tr:nth-child(even){background-color:#fff}table.prolog-answers tr.projection{border-bottom:2px solid #333}tr.projection th.pl-pvar{color:#800;font-weight:700}tr.projection th.residuals{color:#888;font-weight:400;font-style:italic}.answer-nth{width:2ex;text-align:right}th.answer-nth{color:#888;font-weight:400;font-style:italic}td.answer-nth{color:#060;font-size:80%;font-style:italic;background-color:#eee;vertical-align:top}div.render-multi{position:relative;vertical-align:top;background-image:url(../icons/page-fold-20.png);background-size:15px;background-repeat:no-repeat}#render-select{position:absolute;background-color:#fff;padding:5px 20px;border:1px solid #000;border-radius:5px;box-shadow:5px 5px 5px #888;z-index:500;white-space:nowrap}.render-selecting{outline:#800 solid 1px}.render-multi-active{position:absolute;left:0;top:0;width:20px;height:20px}.render-table{border:2px solid #333}.render-table td{padding:0 5px;border:1px solid #888}.render-table th{padding:0 5px;border:1px solid #888;text-align:center}.render-table tr:nth-child(odd){background-color:#eee}.render-table tr:nth-child(even){background-color:#fff}.render-table tr.hrow{border-bottom:2px solid #333}.render-code-list{color:#040;font-style:italic}.render-ellipsis{colour:#00f;padding:0 5px}.render-svg-tree{padding:5px;display:inline-block}.render-svg-tree svg text{padding:.5em .2em}.render-svg-tree svg g.collapsed g text{padding:0 .5ex}.render-svg-tree svg polyline{fill:none}.render-svg-tree g.noleaf text{font-weight:700;fill:#00f}.render-svg-tree g.leaf text{font-weight:400;fill:#000}.fold{display:none}.pl-ellipsis,.pl-functor:hover,.pl-infix:hover{color:#00f;text-decoration:underline}.pl-ovar{color:#800;font-weight:700}.pl-anon{color:#800}.pl-avar{color:#888}.pl-var{color:#800}.pl-atom{color:#762}.pl-functor{color:#000;font-style:italic}.pl-comment{color:#060;font-style:italic}span.diff-tags{margin-left:2em}.diff-tag{border:1px solid #ddd;padding:0 4px;margin-left:2px;border-radius:5px;background-color:#e1edff}.diff-tag.added{color:green}.diff-tag.deleted{text-decoration:line-through;color:red}pre.udiff .udiff-del{color:red}pre.udiff .udiff-add{color:green}/*! jQuery UI - v1.11.3 - 2015-02-12
 * http://jqueryui.com
 * Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
 * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
diff --git a/web/css/trill_on_swish-min.css.gz b/web/css/trill_on_swish-min.css.gz
index 98a29fd..5fe6185 100644
Binary files a/web/css/trill_on_swish-min.css.gz and b/web/css/trill_on_swish-min.css.gz differ
diff --git a/web/help/help.html b/web/help/help.html
index 439e99f..a633795 100644
--- a/web/help/help.html
+++ b/web/help/help.html
@@ -58,7 +58,7 @@ they will be used to populate the example menu and make the
 first goal show in the Goal input field.
 </p>
 <p>
-<b>NOTE:</b> if a complex string containing special characters (s.a. &#35;), surround it with escaped single quote (\'). See <a href="#help-trill">TRILL manual</a> section for a list of possible queries.
+<b>NOTE:</b> if a complex string containing special characters (s.a. &#35;), surround it with escaped single quote (\'). See TRILL manual section for a list of possible queries.
 </p>
 <pre style="font-size:80%">
 /** &lt;examples&gt;
diff --git a/web/help/query.html b/web/help/query.html
index 6e83743..724e79a 100644
--- a/web/help/query.html
+++ b/web/help/query.html
@@ -16,7 +16,7 @@ program and select it from the <b>Examples</b> dropup menu. Queries are
 added to the <b>History</b> dropup menu for re-use.
 
 <p>
-<b>NOTE:</b> if a complex string containing special characters (s.a. &#35;), surround it with escaped single quote (\'). See <a href="#help-trill">TRILL manual</a> section for a list of possible queries.
+<b>NOTE:</b> if a complex string containing special characters (s.a. &#35;), surround it with escaped single quote (\'). See TRILL manual section in Help page for a list of possible queries.
 </p>
 
 <p>
@@ -30,5 +30,44 @@ Example queries embedded in your program must be formatted like this:
 */
 </pre>
 
+<p>
+TRILL can compute the probability of queries using the commands shown below:
+<dl>
+  <dt><b>prob_instanceOf(Class,Individual,Prob)</b><dd>
+  Concept membership queries.
+  </dd>
+  <dt><b>prob_sub_class(Class1,Class2,Prob)</b>
+  <dd>
+  Subsumption queries.
+  </dd>
+  <dt><b>prob_unsat(ClassExpression,Prob)</b><dd>
+  Unsatifiability of a concept.
+  </dd>
+  <dt><b>prob_inconsistent_theory(Prob)</b><dd>
+  Inconsistency of the knowledge base.
+  </dd>
+  </dl>
+TRILL can test entailment or find an explanation <code>Expl</code> using the queries below:
+<dl>
+  <dt><b>instanceOf(Class,Individual),
+instanceOf(Class,Individual,Expl)</b><dd>
+  Concept membership queries.
+  </dd>
+  <dt><b>sub_class(Class1,Class2),
+sub_class(Class1,Class2,Expl)</b>
+  <dd>
+  Subsumption queries.
+  </dd>
+  <dt><b>unsat(ClassExpression),
+unsat(ClassExpression,Expl)</b><dd>
+  Unsatifiability of a concept.
+  </dd>
+  <dt><b>inconsistent_theory,
+inconsistent_theory(Expl)</b><dd>
+  Inconsistency of the knowledge base.
+  </dd>
+  </dl>
+</p>
+
 </body>
 </html>
diff --git a/web/js/trill_on_swish-min.js b/web/js/trill_on_swish-min.js
index 045d496..2a10e66 100644
--- a/web/js/trill_on_swish-min.js
+++ b/web/js/trill_on_swish-min.js
@@ -55,4 +55,4 @@
  * limitations under the License.
  * ========================================================== */
 
-!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(a,b){function s(e){var t=e.length,r=n.type(e);return"function"===r||n.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}function x(e,t,r){if(n.isFunction(t))return n.grep(e,function(e,n){return!!t.call(e,n,e)!==r});if(t.nodeType)return n.grep(e,function(e){return e===t!==r});if("string"==typeof t){if(w.test(t))return n.filter(t,e,r);t=n.filter(t,e)}return n.grep(e,function(e){return g.call(t,e)>=0!==r})}function D(e,t){while((e=e[t])&&1!==e.nodeType);return e}function G(e){var t=F[e]={};return n.each(e.match(E)||[],function(e,n){t[n]=!0}),t}function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}function P(e,t,r){var i;if(void 0===r&&1===e.nodeType)if(i="data-"+t.replace(O,"-$1").toLowerCase(),r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:N.test(r)?n.parseJSON(r):r}catch(s){}M.set(e,t,r)}else r=void 0;return r}function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(e){}}function jb(e,t){return n.nodeName(e,"table")&&n.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function kb(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function lb(e){var t=gb.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function mb(e,t){for(var n=0,r=e.length;r>n;n++)L.set(e[n],"globalEval",!t||L.get(t[n],"globalEval"))}function nb(e,t){var r,i,s,o,u,a,f,l;if(1===t.nodeType){if(L.hasData(e)&&(o=L.access(e),u=L.set(t,o),l=o.events)){delete u.handle,u.events={};for(s in l)for(r=0,i=l[s].length;i>r;r++)n.event.add(t,s,l[s][r])}M.hasData(e)&&(a=M.access(e),f=n.extend({},a),M.set(t,f))}}function ob(e,t){var r=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&n.nodeName(e,t)?n.merge([e],r):r}function pb(e,t){var n=t.nodeName.toLowerCase();"input"===n&&T.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function sb(e,t){var r,i=n(t.createElement(e)).appendTo(t.body),s=a.getDefaultComputedStyle&&(r=a.getDefaultComputedStyle(i[0]))?r.display:n.css(i[0],"display");return i.detach(),s}function tb(e){var t=l,r=rb[e];return r||(r=sb(e,t),"none"!==r&&r||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=qb[0].contentDocument,t.write(),t.close(),r=sb(e,t),qb.detach()),rb[e]=r),r}function xb(e,t,r){var i,s,o,u,a=e.style;return r=r||wb(e),r&&(u=r.getPropertyValue(t)||r[t]),r&&(""!==u||n.contains(e.ownerDocument,e)||(u=n.style(e,t)),vb.test(u)&&ub.test(t)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=u,u=r.width,a.width=i,a.minWidth=s,a.maxWidth=o)),void 0!==u?u+"":u}function yb(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function Fb(e,t){if(t in e)return t;var n=t[0].toUpperCase()+t.slice(1),r=t,i=Eb.length;while(i--)if(t=Eb[i]+n,t in e)return t;return r}function Gb(e,t,n){var r=Ab.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Hb(e,t,r,i,s){for(var o=r===(i?"border":"content")?4:"width"===t?1:0,u=0;4>o;o+=2)"margin"===r&&(u+=n.css(e,r+R[o],!0,s)),i?("content"===r&&(u-=n.css(e,"padding"+R[o],!0,s)),"margin"!==r&&(u-=n.css(e,"border"+R[o]+"Width",!0,s))):(u+=n.css(e,"padding"+R[o],!0,s),"padding"!==r&&(u+=n.css(e,"border"+R[o]+"Width",!0,s)));return u}function Ib(e,t,r){var i=!0,s="width"===t?e.offsetWidth:e.offsetHeight,o=wb(e),u="border-box"===n.css(e,"boxSizing",!1,o);if(0>=s||null==s){if(s=xb(e,t,o),(0>s||null==s)&&(s=e.style[t]),vb.test(s))return s;i=u&&(k.boxSizingReliable()||s===e.style[t]),s=parseFloat(s)||0}return s+Hb(e,t,r||(u?"border":"content"),i,o)+"px"}function Jb(e,t){for(var r,i,s,o=[],u=0,a=e.length;a>u;u++)i=e[u],i.style&&(o[u]=L.get(i,"olddisplay"),r=i.style.display,t?(o[u]||"none"!==r||(i.style.display=""),""===i.style.display&&S(i)&&(o[u]=L.access(i,"olddisplay",tb(i.nodeName)))):(s=S(i),"none"===r&&s||L.set(i,"olddisplay",s?r:n.css(i,"display"))));for(u=0;a>u;u++)i=e[u],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[u]||"":"none"));return e}function Kb(e,t,n,r,i){return new Kb.prototype.init(e,t,n,r,i)}function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(e,t){var n,r=0,i={height:e};for(t=t?1:0;4>r;r+=2-t)n=R[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function Ub(e,t,n){for(var r,i=(Rb[t]||[]).concat(Rb["*"]),s=0,o=i.length;o>s;s++)if(r=i[s].call(n,t,e))return r}function Vb(e,t,r){var i,s,o,u,a,f,l,c,h=this,p={},d=e.style,v=e.nodeType&&S(e),m=L.get(e,"fxshow");r.queue||(a=n._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,f=a.empty.fire,a.empty.fire=function(){a.unqueued||f()}),a.unqueued++,h.always(function(){h.always(function(){a.unqueued--,n.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(r.overflow=[d.overflow,d.overflowX,d.overflowY],l=n.css(e,"display"),c="none"===l?L.get(e,"olddisplay")||tb(e.nodeName):l,"inline"===c&&"none"===n.css(e,"float")&&(d.display="inline-block")),r.overflow&&(d.overflow="hidden",h.always(function(){d.overflow=r.overflow[0],d.overflowX=r.overflow[1],d.overflowY=r.overflow[2]}));for(i in t)if(s=t[i],Nb.exec(s)){if(delete t[i],o=o||"toggle"===s,s===(v?"hide":"show")){if("show"!==s||!m||void 0===m[i])continue;v=!0}p[i]=m&&m[i]||n.style(e,i)}else l=void 0;if(n.isEmptyObject(p))"inline"===("none"===l?tb(e.nodeName):l)&&(d.display=l);else{m?"hidden"in m&&(v=m.hidden):m=L.access(e,"fxshow",{}),o&&(m.hidden=!v),v?n(e).show():h.done(function(){n(e).hide()}),h.done(function(){var t;L.remove(e,"fxshow");for(t in p)n.style(e,t,p[t])});for(i in p)u=Ub(v?m[i]:0,i,h),i in m||(m[i]=u.start,v&&(u.end=u.start,u.start="width"===i||"height"===i?1:0))}}function Wb(e,t){var r,i,s,o,u;for(r in e)if(i=n.camelCase(r),s=t[i],o=e[r],n.isArray(o)&&(s=o[1],o=e[r]=o[0]),r!==i&&(e[i]=o,delete e[r]),u=n.cssHooks[i],u&&"expand"in u){o=u.expand(o),delete e[i];for(r in o)r in e||(e[r]=o[r],t[r]=s)}else t[i]=s}function Xb(e,t,r){var i,s,o=0,u=Qb.length,a=n.Deferred().always(function(){delete f.elem}),f=function(){if(s)return!1;for(var t=Lb||Sb(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,i=1-r,o=0,u=l.tweens.length;u>o;o++)l.tweens[o].run(i);return a.notifyWith(e,[l,i,n]),1>i&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:n.extend({},t),opts:n.extend(!0,{specialEasing:{}},r),originalProperties:t,originalOptions:r,startTime:Lb||Sb(),duration:r.duration,tweens:[],createTween:function(t,r){var i=n.Tween(e,l.opts,t,r,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,r=t?l.tweens.length:0;if(s)return this;for(s=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Wb(c,l.opts.specialEasing);u>o;o++)if(i=Qb[o].call(l,e,c,l.opts))return i;return n.map(c,Ub,l),n.isFunction(l.opts.start)&&l.opts.start.call(e,l),n.fx.timer(n.extend(f,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function qc(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var i,s=0,o=t.toLowerCase().match(E)||[];if(n.isFunction(r))while(i=o[s++])"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(r)):(e[i]=e[i]||[]).push(r)}}function rc(e,t,r,i){function u(l){var h;return s[l]=!0,n.each(e[l]||[],function(e,n){var a=n(t,r,i);return"string"!=typeof a||o||s[a]?o?!(h=a):void 0:(t.dataTypes.unshift(a),u(a),!1)}),h}var s={},o=e===mc;return u(t.dataTypes[0])||!s["*"]&&u("*")}function sc(e,t){var r,i,s=n.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((s[r]?e:i||(i={}))[r]=t[r]);return i&&n.extend(!0,e,i),e}function tc(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while("*"===a[0])a.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}return s?(s!==a[0]&&a.unshift(s),n[s]):void 0}function uc(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift())if("*"===s)s=a;else if("*"!==a&&a!==s){if(o=f[a+" "+s]||f["* "+s],!o)for(i in f)if(u=i.split(" "),u[1]===s&&(o=f[a+" "+u[0]]||f["* "+u[0]])){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}return{state:"success",data:t}}function Ac(e,t,r,i){var s;if(n.isArray(t))n.each(t,function(t,n){r||wc.test(e)?i(e,n):Ac(e+"["+("object"==typeof n?t:"")+"]",n,r,i)});else if(r||"object"!==n.type(t))i(e,t);else for(s in t)Ac(e+"["+s+"]",t[s],r,i)}function Jc(e){return n.isWindow(e)?e:9===e.nodeType&&e.defaultView}var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(e,t){return new n.fn.init(e,t)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(e,t){return t.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:d.call(this)},pushStack:function(e){var t=n.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return n.each(this,e,t)},map:function(e){return this.pushStack(n.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var e,t,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;for("boolean"==typeof u&&(l=u,u=arguments[a]||{},a++),"object"==typeof u||n.isFunction(u)||(u={}),a===f&&(u=this,a--);f>a;a++)if(null!=(e=arguments[a]))for(t in e)r=u[t],i=e[t],u!==i&&(l&&i&&(n.isPlainObject(i)||(s=n.isArray(i)))?(s?(s=!1,o=r&&n.isArray(r)?r:[]):o=r&&n.isPlainObject(r)?r:{},u[t]=n.extend(l,o,i)):void 0!==i&&(u[t]=i));return u},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===n.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!n.isArray(e)&&e-parseFloat(e)+1>=0},isPlainObject:function(e){return"object"!==n.type(e)||e.nodeType||n.isWindow(e)?!1:e.constructor&&!j.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?h[i.call(e)]||"object":typeof e},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(e){return e.replace(p,"ms-").replace(q,r)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,u=s(e);if(n){if(u){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(u){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(o,"")},makeArray:function(e,t){var r=t||[];return null!=e&&(s(Object(e))?n.merge(r,"string"==typeof e?[e]:e):f.call(r,e)),r},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],s=0,o=e.length,u=!n;o>s;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(t,n,r){var i,o=0,u=t.length,a=s(t),f=[];if(a)for(;u>o;o++)i=n(t[o],o,r),null!=i&&f.push(i);else for(o in t)i=n(t[o],o,r),null!=i&&f.push(i);return e.apply([],f)},guid:1,proxy:function(e,t){var r,i,s;return"string"==typeof t&&(r=e[t],t=e,e=r),n.isFunction(e)?(i=d.call(arguments,2),s=function(){return e.apply(t||this,i.concat(d.call(arguments)))},s.guid=e.guid=e.guid||n.guid++,s):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){h["[object "+t+"]"]=t.toLowerCase()});var t=function(e){function ot(e,t,r,i){var s,u,f,l,c,d,g,y,S,x;if((t?t.ownerDocument||t:E)!==p&&h(t),t=t||p,r=r||[],l=t.nodeType,"string"!=typeof e||!e||1!==l&&9!==l&&11!==l)return r;if(!i&&v){if(11!==l&&(s=Z.exec(e)))if(f=s[1]){if(9===l){if(u=t.getElementById(f),!u||!u.parentNode)return r;if(u.id===f)return r.push(u),r}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(f))&&b(t,u)&&u.id===f)return r.push(u),r}else{if(s[2])return D.apply(r,t.getElementsByTagName(e)),r;if((f=s[3])&&n.getElementsByClassName)return D.apply(r,t.getElementsByClassName(f)),r}if(n.qsa&&(!m||!m.test(e))){if(y=g=w,S=t,x=1!==l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){d=o(e),(g=t.getAttribute("id"))?y=g.replace(tt,"\\$&"):t.setAttribute("id",y),y="[id='"+y+"'] ",c=d.length;while(c--)d[c]=y+gt(d[c]);S=et.test(e)&&vt(t.parentNode)||t,x=d.join(",")}if(x)try{return D.apply(r,S.querySelectorAll(x)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return a(e.replace(z,"$1"),t,r,i)}function ut(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function at(e){return e[w]=!0,e}function ft(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),i=e.length;while(i--)r.attrHandle[n[i]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function dt(e){return at(function(t){return t=+t,at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function vt(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function mt(){}function gt(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var r=t.dir,i=n&&"parentNode"===r,s=x++;return t.first?function(t,n,s){while(t=t[r])if(1===t.nodeType||i)return e(t,n,s)}:function(t,n,o){var u,a,f=[S,s];if(o){while(t=t[r])if((1===t.nodeType||i)&&e(t,n,o))return!0}else while(t=t[r])if(1===t.nodeType||i){if(a=t[w]||(t[w]={}),(u=a[r])&&u[0]===S&&u[1]===s)return f[2]=u[2];if(a[r]=f,f[2]=e(t,n,o))return!0}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n){for(var r=0,i=t.length;i>r;r++)ot(e,t[r],n);return n}function Et(e,t,n,r,i){for(var s,o=[],u=0,a=e.length,f=null!=t;a>u;u++)(s=e[u])&&(!n||n(s,r,i))&&(o.push(s),f&&t.push(u));return o}function St(e,t,n,r,i,s){return r&&!r[w]&&(r=St(r)),i&&!i[w]&&(i=St(i,s)),at(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||wt(t||"*",u.nodeType?[u]:u,[]),m=!e||!s&&t?v:Et(v,h,e,u,a),g=n?i||(s?e:d||r)?[]:o:m;if(n&&n(m,g,u,a),r){f=Et(g,p),r(f,[],u,a),l=f.length;while(l--)(c=f[l])&&(g[p[l]]=!(m[p[l]]=c))}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=Et(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function xt(e){for(var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,!0),c=yt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];s>a;a++)if(n=r.relative[e[a].type])h=[yt(bt(h),n)];else{if(n=r.filter[e[a].type].apply(null,e[a].matches),n[w]){for(i=++a;s>i;i++)if(r.relative[e[i].type])break;return St(a>1&&bt(h),a>1&&gt(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(z,"$1"),n,i>a&&xt(e.slice(a,i)),s>i&&xt(e=e.slice(i)),s>i&&gt(e))}h.push(n)}return bt(h)}function Tt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,h,d,v=0,m="0",g=s&&[],y=[],b=f,w=s||i&&r.find.TAG("*",l),E=S+=null==b?1:Math.random()||.1,x=w.length;for(l&&(f=o!==p&&o);m!==x&&null!=(c=w[m]);m++){if(i&&c){h=0;while(d=e[h++])if(d(c,o,u)){a.push(c);break}l&&(S=E)}n&&((c=!d&&c)&&v--,s&&g.push(c))}if(v+=m,n&&m!==v){h=0;while(d=t[h++])d(g,y,o,u);if(s){if(v>0)while(m--)g[m]||y[m]||(y[m]=M.call(a));y=Et(y)}D.apply(a,y),l&&!s&&y.length>0&&v+t.length>1&&ot.uniqueSort(a)}return l&&(S=E,f=b),g};return n?at(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ut(),N=ut(),C=ut(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I=F.replace("w","w#"),q="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+j+"*\\]",R=":("+F+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|.*)\\)|)",U=new RegExp(j+"+","g"),z=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),W=new RegExp("^"+j+"*,"+j+"*"),X=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),V=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),$=new RegExp(R),J=new RegExp("^"+I+"$"),K={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/[+~]/,tt=/'|\\/g,nt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},it=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(st){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=ot.support={},s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},h=ot.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;return o!==p&&9===o.nodeType&&o.documentElement?(p=o,d=o.documentElement,i=o.defaultView,i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",it,!1):i.attachEvent&&i.attachEvent("onunload",it)),v=!s(o),n.attributes=ft(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ft(function(e){return e.appendChild(o.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Y.test(o.getElementsByClassName),n.getById=ft(function(e){return d.appendChild(e).id=w,!o.getElementsByName||!o.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&v){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if("*"===e){while(n=s[i++])1===n.nodeType&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){return v?t.getElementsByClassName(e):void 0},g=[],m=[],(n.qsa=Y.test(o.querySelectorAll))&&(ft(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a><select id='"+w+"-\f]' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),ft(function(e){var t=o.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(n.matchesSelector=Y.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ft(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",R)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=Y.test(d.compareDocumentPosition),b=t||Y.test(d.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&1===r.nodeType&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&r||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===o||e.ownerDocument===E&&b(E,e)?-1:t===o||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:4&r?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,u=[e],a=[t];if(!i||!s)return e===o?-1:t===o?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return ct(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)a.unshift(n);while(u[r]===a[r])r++;return r?ct(u[r],a[r]):u[r]===E?-1:a[r]===E?1:0},o):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']"),!(!n.matchesSelector||!v||g&&g.test(t)||m&&m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):void 0;return void 0!==s?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,s=0;if(c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k),c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=ot.getText=function(e){var t,n="",r=0,s=e.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===s||4===s)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},r=ot.selectors={cacheLength:50,createPseudo:at,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[3]||e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(U," ")+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),u="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;d=v="only"===e&&!d&&"nextSibling"}return!0}if(d=[o?m.firstChild:m.lastChild],o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===S&&f[1],h=f[0]===S&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(1===c.nodeType&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:1===c.nodeType)&&++h&&(y&&((c[w]||(c[w]={}))[e]=[S,h]),c===t))break;return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:at(function(e){var t=[],n=[],r=u(e.replace(z,"$1"));return r[w]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)(s=o[u])&&(e[u]=!(t[u]=s))}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return e=e.replace(nt,rt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:at(function(e){return J.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[0>n?n+t:n]}),even:dt(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:dt(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ht(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pt(t);return mt.prototype=r.filters=r.pseudos,r.setFilters=new mt,o=ot.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){(!n||(i=W.exec(u)))&&(i&&(u=u.slice(i[0].length)||u),a.push(s=[])),n=!1,(i=X.exec(u))&&(n=i.shift(),s.push({value:n,type:i[0].replace(z," ")}),u=u.slice(n.length));for(o in r.filter)!(i=K[o].exec(u))||f[o]&&!(i=f[o](i))||(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)},u=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=xt(t[n]),s[w]?r.push(s):i.push(s);s=C(e,Tt(i,r)),s.selector=e}return s},a=ot.select=function(e,t,i,s){var a,f,l,c,h,p="function"==typeof e&&e,d=!s&&o(e=p.selector||e);if(i=i||[],1===d.length){if(f=d[0]=d[0].slice(0),f.length>2&&"ID"===(l=f[0]).type&&n.getById&&9===t.nodeType&&v&&r.relative[f[1].type]){if(t=(r.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=K.needsContext.test(e)?0:f.length;while(a--){if(l=f[a],r.relative[c=l.type])break;if((h=r.find[c])&&(s=h(l.matches[0].replace(nt,rt),et.test(f[0].type)&&vt(t.parentNode)||t))){if(f.splice(a,1),e=s.length&&gt(f),!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,et.test(e)&&vt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=ft(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ft(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ft(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),ft(function(e){return null==e.getAttribute("disabled")})||lt(B,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ot}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;n.filter=function(e,t,r){var i=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?n.find.matchesSelector(i,e)?[i]:[]:n.find.matches(e,n.grep(t,function(e){return 1===e.nodeType}))},n.fn.extend({find:function(e){var t,r=this.length,i=[],s=this;if("string"!=typeof e)return this.pushStack(n(e).filter(function(){for(t=0;r>t;t++)if(n.contains(s[t],this))return!0}));for(t=0;r>t;t++)n.find(e,s[t],i);return i=this.pushStack(r>1?n.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},filter:function(e){return this.pushStack(x(this,e||[],!1))},not:function(e){return this.pushStack(x(this,e||[],!0))},is:function(e){return!!x(this,"string"==typeof e&&u.test(e)?n(e):e||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(e,t){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:z.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||y).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof n?t[0]:t,n.merge(this,n.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:l,!0)),v.test(r[1])&&n.isPlainObject(t))for(r in t)n.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=l.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=l,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):n.isFunction(e)?"undefined"!=typeof y.ready?y.ready(e):e(n):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),n.makeArray(e,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(e,t,r){var i=[],s=void 0!==r;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(s&&n(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),n.fn.extend({has:function(e){var t=n(e,this),r=t.length;return this.filter(function(){for(var e=0;r>e;e++)if(n.contains(this,t[e]))return!0})},closest:function(e,t){for(var r,i=0,s=this.length,o=[],a=u.test(e)||"string"!=typeof e?n(e,t||this.context):0;s>i;i++)for(r=this[i];r&&r!==t;r=r.parentNode)if(r.nodeType<11&&(a?a.index(r)>-1:1===r.nodeType&&n.find.matchesSelector(r,e))){o.push(r);break}return this.pushStack(o.length>1?n.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(n(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(n.unique(n.merge(this.get(),n(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),n.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return n.dir(e,"parentNode")},parentsUntil:function(e,t,r){return n.dir(e,"parentNode",r)},next:function(e){return D(e,"nextSibling")},prev:function(e){return D(e,"previousSibling")},nextAll:function(e){return n.dir(e,"nextSibling")},prevAll:function(e){return n.dir(e,"previousSibling")},nextUntil:function(e,t,r){return n.dir(e,"nextSibling",r)},prevUntil:function(e,t,r){return n.dir(e,"previousSibling",r)},siblings:function(e){return n.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return n.sibling(e.firstChild)},contents:function(e){return e.contentDocument||n.merge([],e.childNodes)}},function(e,t){n.fn[e]=function(r,i){var s=n.map(this,t,r);return"Until"!==e.slice(-5)&&(i=r),i&&"string"==typeof i&&(s=n.filter(i,s)),this.length>1&&(C[e]||n.unique(s),B.test(e)&&s.reverse()),this.pushStack(s)}});var E=/\S+/g,F={};n.Callbacks=function(e){e="string"==typeof e?F[e]||G(e):n.extend({},e);var t,r,i,s,o,u,a=[],f=!e.once&&[],l=function(n){for(t=e.memory&&n,r=!0,u=s||0,s=0,o=a.length,i=!0;a&&o>u;u++)if(a[u].apply(n[0],n[1])===!1&&e.stopOnFalse){t=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var r=a.length;!function u(t){n.each(t,function(t,r){var i=n.type(r);"function"===i?e.unique&&c.has(r)||a.push(r):r&&r.length&&"string"!==i&&u(r)})}(arguments),i?o=a.length:t&&(s=r,l(t))}return this},remove:function(){return a&&n.each(arguments,function(e,t){var r;while((r=n.inArray(t,a,r))>-1)a.splice(r,1),i&&(o>=r&&o--,u>=r&&u--)}),this},has:function(e){return e?n.inArray(e,a)>-1:!!a&&!!a.length},empty:function(){return a=[],o=0,this},disable:function(){return a=f=t=void 0,this},disabled:function(){return!a},lock:function(){return f=void 0,t||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return!a||r&&!f||(t=t||[],t=[e,t.slice?t.slice():t],i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},n.extend({Deferred:function(e){var t=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],r="pending",i={state:function(){return r},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n.Deferred(function(r){n.each(t,function(t,o){var u=n.isFunction(e[t])&&e[t];s[o[1]](function(){var e=u&&u.apply(this,arguments);e&&n.isFunction(e.promise)?e.promise().done(r.resolve).fail(r.reject).progress(r.notify):r[o[0]+"With"](this===i?r.promise():this,u?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?n.extend(e,i):i}},s={};return i.pipe=i.then,n.each(t,function(e,n){var o=n[2],u=n[3];i[n[1]]=o.add,u&&o.add(function(){r=u},t[1^e][2].disable,t[2][2].lock),s[n[0]]=function(){return s[n[0]+"With"](this===s?i:this,arguments),this},s[n[0]+"With"]=o.fireWith}),i.promise(s),e&&e.call(s,s),s},when:function(e){var t=0,r=d.call(arguments),i=r.length,s=1!==i||e&&n.isFunction(e.promise)?i:0,o=1===s?e:n.Deferred(),u=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--s||o.resolveWith(t,n)}},a,f,l;if(i>1)for(a=new Array(i),f=new Array(i),l=new Array(i);i>t;t++)r[t]&&n.isFunction(r[t].promise)?r[t].promise().done(u(t,l,r)).fail(o.reject).progress(u(t,f,a)):--s;return s||o.resolveWith(l,r),o.promise()}});var H;n.fn.ready=function(e){return n.ready.promise().done(e),this},n.extend({isReady:!1,readyWait:1,holdReady:function(e){e?n.readyWait++:n.ready(!0)},ready:function(e){(e===!0?--n.readyWait:n.isReady)||(n.isReady=!0,e!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}}),n.ready.promise=function(e){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(e)},n.ready.promise();var J=n.access=function(e,t,r,i,s,o,u){var a=0,f=e.length,l=null==r;if("object"===n.type(r)){s=!0;for(a in r)n.access(e,t,a,r[a],!0,o,u)}else if(void 0!==i&&(s=!0,n.isFunction(i)||(u=!0),l&&(u?(t.call(e,i),t=null):(l=t,t=function(e,t,r){return l.call(n(e),r)})),t))for(;f>a;a++)t(e[a],r,u?i:i.call(e[a],a,t(e[a],r)));return s?e:l?t.call(e):f?t(e[0],r):o};n.acceptData=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(e){if(!K.accepts(e))return 0;var t={},r=e[this.expando];if(!r){r=K.uid++;try{t[this.expando]={value:r},Object.defineProperties(e,t)}catch(i){t[this.expando]=r,n.extend(e,t)}}return this.cache[r]||(this.cache[r]={}),r},set:function(e,t,r){var i,s=this.key(e),o=this.cache[s];if("string"==typeof t)o[t]=r;else if(n.isEmptyObject(o))n.extend(this.cache[s],t);else for(i in t)o[i]=t[i];return o},get:function(e,t){var n=this.cache[this.key(e)];return void 0===t?n:n[t]},access:function(e,t,r){var i;return void 0===t||t&&"string"==typeof t&&void 0===r?(i=this.get(e,t),void 0!==i?i:this.get(e,n.camelCase(t))):(this.set(e,t,r),void 0!==r?r:t)},remove:function(e,t){var r,i,s,o=this.key(e),u=this.cache[o];if(void 0===t)this.cache[o]={};else{n.isArray(t)?i=t.concat(t.map(n.camelCase)):(s=n.camelCase(t),t in u?i=[t,s]:(i=s,i=i in u?[i]:i.match(E)||[])),r=i.length;while(r--)delete u[i[r]]}},hasData:function(e){return!n.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;n.extend({hasData:function(e){return M.hasData(e)||L.hasData(e)},data:function(e,t,n){return M.access(e,t,n)},removeData:function(e,t){M.remove(e,t)},_data:function(e,t,n){return L.access(e,t,n)},_removeData:function(e,t){L.remove(e,t)}}),n.fn.extend({data:function(e,t){var r,i,s,o=this[0],u=o&&o.attributes;if(void 0===e){if(this.length&&(s=M.get(o),1===o.nodeType&&!L.get(o,"hasDataAttrs"))){r=u.length;while(r--)u[r]&&(i=u[r].name,0===i.indexOf("data-")&&(i=n.camelCase(i.slice(5)),P(o,i,s[i])));L.set(o,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){M.set(this,e)}):J(this,function(t){var r,i=n.camelCase(e);if(o&&void 0===t){if(r=M.get(o,e),void 0!==r)return r;if(r=M.get(o,i),void 0!==r)return r;if(r=P(o,i,void 0),void 0!==r)return r}else this.each(function(){var n=M.get(this,i);M.set(this,i,t),-1!==e.indexOf("-")&&void 0!==n&&M.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){M.remove(this,e)})}}),n.extend({queue:function(e,t,r){var i;return e?(t=(t||"fx")+"queue",i=L.get(e,t),r&&(!i||n.isArray(r)?i=L.access(e,t,n.makeArray(r)):i.push(r)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var r=n.queue(e,t),i=r.length,s=r.shift(),o=n._queueHooks(e,t),u=function(){n.dequeue(e,t)};"inprogress"===s&&(s=r.shift(),i--),s&&("fx"===t&&r.unshift("inprogress"),delete o.stop,s.call(e,u,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return L.get(e,r)||L.access(e,r,{empty:n.Callbacks("once memory").add(function(){L.remove(e,[t+"queue",r])})})}}),n.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length<r?n.queue(this[0],e):void 0===t?this:this.each(function(){var r=n.queue(this,e,t);n._queueHooks(this,e),"fx"===e&&"inprogress"!==r[0]&&n.dequeue(this,e)})},dequeue:function(e){return this.each(function(){n.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var r,i=1,s=n.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(u--)r=L.get(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(t)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(e,t){return e=t||e,"none"===n.css(e,"display")||!n.contains(e.ownerDocument,e)},T=/^(?:checkbox|radio)$/i;!function(){var e=l.createDocumentFragment(),t=e.appendChild(l.createElement("div")),n=l.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),k.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;n.event={global:{},add:function(e,t,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=L.get(e);if(g){r.handler&&(o=r,r=o.handler,s=o.selector),r.guid||(r.guid=n.guid++),(f=g.events)||(f=g.events={}),(u=g.handle)||(u=g.handle=function(t){return typeof n!==U&&n.event.triggered!==t.type?n.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(E)||[""],l=t.length;while(l--)a=Y.exec(t[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),d&&(h=n.event.special[d]||{},d=(s?h.delegateType:h.bindType)||d,h=n.event.special[d]||{},c=n.extend({type:d,origType:m,data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&n.expr.match.needsContext.test(s),namespace:v.join(".")},o),(p=f[d])||(p=f[d]=[],p.delegateCount=0,h.setup&&h.setup.call(e,i,v,u)!==!1||e.addEventListener&&e.addEventListener(d,u,!1)),h.add&&(h.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),s?p.splice(p.delegateCount++,0,c):p.push(c),n.event.global[d]=!0)}},remove:function(e,t,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=L.hasData(e)&&L.get(e);if(g&&(f=g.events)){t=(t||"").match(E)||[""],l=t.length;while(l--)if(a=Y.exec(t[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),d){h=n.event.special[d]||{},d=(i?h.delegateType:h.bindType)||d,p=f[d]||[],a=a[2]&&new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=p.length;while(o--)c=p[o],!s&&m!==c.origType||r&&r.guid!==c.guid||a&&!a.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,h.remove&&h.remove.call(e,c));u&&!p.length&&(h.teardown&&h.teardown.call(e,v,g.handle)!==!1||n.removeEvent(e,d,g.handle),delete f[d])}else for(d in f)n.event.remove(e,d+t[l],r,i,!0);n.isEmptyObject(f)&&(delete g.handle,L.remove(e,"events"))}},trigger:function(e,t,r,i){var s,o,u,f,c,h,p,d=[r||l],v=j.call(e,"type")?e.type:e,m=j.call(e,"namespace")?e.namespace.split("."):[];if(o=u=r=r||l,3!==r.nodeType&&8!==r.nodeType&&!X.test(v+n.event.triggered)&&(v.indexOf(".")>=0&&(m=v.split("."),v=m.shift(),m.sort()),c=v.indexOf(":")<0&&"on"+v,e=e[n.expando]?e:new n.Event(v,"object"==typeof e&&e),e.isTrigger=i?2:3,e.namespace=m.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:n.makeArray(t,[e]),p=n.event.special[v]||{},i||!p.trigger||p.trigger.apply(r,t)!==!1)){if(!i&&!p.noBubble&&!n.isWindow(r)){for(f=p.delegateType||v,X.test(f+v)||(o=o.parentNode);o;o=o.parentNode)d.push(o),u=o;u===(r.ownerDocument||l)&&d.push(u.defaultView||u.parentWindow||a)}s=0;while((o=d[s++])&&!e.isPropagationStopped())e.type=s>1?f:p.bindType||v,h=(L.get(o,"events")||{})[e.type]&&L.get(o,"handle"),h&&h.apply(o,t),h=c&&o[c],h&&h.apply&&n.acceptData(o)&&(e.result=h.apply(o,t),e.result===!1&&e.preventDefault());return e.type=v,i||e.isDefaultPrevented()||p._default&&p._default.apply(d.pop(),t)!==!1||!n.acceptData(r)||c&&n.isFunction(r[v])&&!n.isWindow(r)&&(u=r[c],u&&(r[c]=null),n.event.triggered=v,r[v](),n.event.triggered=void 0,u&&(r[c]=u)),e.result}},dispatch:function(e){e=n.event.fix(e);var t,r,i,s,o,u=[],a=d.call(arguments),f=(L.get(this,"events")||{})[e.type]||[],l=n.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){u=n.event.handlers.call(this,e,f),t=0;while((s=u[t++])&&!e.isPropagationStopped()){e.currentTarget=s.elem,r=0;while((o=s.handlers[r++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,i=((n.event.special[o.origType]||{}).handle||o.handler).apply(s.elem,a),void 0!==i&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var r,i,s,o,u=[],a=t.delegateCount,f=e.target;if(a&&f.nodeType&&(!e.button||"click"!==e.type))for(;f!==this;f=f.parentNode||this)if(f.disabled!==!0||"click"!==e.type){for(i=[],r=0;a>r;r++)o=t[r],s=o.selector+" ",void 0===i[s]&&(i[s]=o.needsContext?n(s,this).index(f)>=0:n.find(s,this,null,[f]).length),i[s]&&i.push(o);i.length&&u.push({elem:f,handlers:i})}return a<t.length&&u.push({elem:this,handlers:t.slice(a)}),u},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||l,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||void 0===s||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[n.expando])return e;var t,r,i,s=e.type,o=e,u=this.fixHooks[s];u||(this.fixHooks[s]=u=W.test(s)?this.mouseHooks:V.test(s)?this.keyHooks:{}),i=u.props?this.props.concat(u.props):this.props,e=new n.Event(o),t=i.length;while(t--)r=i[t],e[r]=o[r];return e.target||(e.target=l),3===e.target.nodeType&&(e.target=e.target.parentNode),u.filter?u.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(e){return n.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,r,i){var s=n.extend(new n.Event,r,{type:e,isSimulated:!0,originalEvent:{}});i?n.event.trigger(s,null,t):n.event.dispatch.call(t,s),s.isDefaultPrevented()&&r.preventDefault()}},n.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},n.Event=function(e,t){return this instanceof n.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?Z:$):this.type=e,t&&n.extend(this,t),this.timeStamp=e&&e.timeStamp||n.now(),void (this[n.expando]=!0)):new n.Event(e,t)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Z,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Z,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Z,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){n.event.special[e]={delegateType:t,bindType:t,handle:function(e){var r,i=this,s=e.relatedTarget,o=e.handleObj;return(!s||s!==i&&!n.contains(i,s))&&(e.type=o.origType,r=o.handler.apply(this,arguments),e.type=t),r}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(e,t){var r=function(e){n.event.simulate(t,e.target,n.event.fix(e),!0)};n.event.special[t]={setup:function(){var n=this.ownerDocument||this,i=L.access(n,t);i||n.addEventListener(e,r,!0),L.access(n,t,(i||0)+1)},teardown:function(){var n=this.ownerDocument||this,i=L.access(n,t)-1;i?L.access(n,t,i):(n.removeEventListener(e,r,!0),L.remove(n,t))}}}),n.fn.extend({on:function(e,t,r,i,s){var o,u;if("object"==typeof e){"string"!=typeof t&&(r=r||t,t=void 0);for(u in e)this.on(u,t,r,e[u],s);return this}if(null==r&&null==i?(i=t,r=t=void 0):null==i&&("string"==typeof t?(i=r,r=void 0):(i=r,r=t,t=void 0)),i===!1)i=$;else if(!i)return this;return 1===s&&(o=i,i=function(e){return n().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=n.guid++)),this.each(function(){n.event.add(this,e,i,r,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,n(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(s in e)this.off(s,t,e[s]);return this}return(t===!1||"function"==typeof t)&&(r=t,t=void 0),r===!1&&(r=$),this.each(function(){n.event.remove(this,e,r,t)})},trigger:function(e,t){return this.each(function(){n.event.trigger(e,t,this)})},triggerHandler:function(e,t){var r=this[0];return r?n.event.trigger(e,t,r,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td,n.extend({clone:function(e,t,r){var i,s,o,u,a=e.cloneNode(!0),f=n.contains(e.ownerDocument,e);if(!(k.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||n.isXMLDoc(e)))for(u=ob(a),o=ob(e),i=0,s=o.length;s>i;i++)pb(o[i],u[i]);if(t)if(r)for(o=o||ob(e),u=u||ob(a),i=0,s=o.length;s>i;i++)nb(o[i],u[i]);else nb(e,a);return u=ob(a,"script"),u.length>0&&mb(u,!f&&ob(e,"script")),a},buildFragment:function(e,t,r,i){for(var s,o,u,a,f,l,c=t.createDocumentFragment(),h=[],p=0,d=e.length;d>p;p++)if(s=e[p],s||0===s)if("object"===n.type(s))n.merge(h,s.nodeType?[s]:s);else if(cb.test(s)){o=o||c.appendChild(t.createElement("div")),u=(bb.exec(s)||["",""])[1].toLowerCase(),a=ib[u]||ib._default,o.innerHTML=a[1]+s.replace(ab,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.lastChild;n.merge(h,o.childNodes),o=c.firstChild,o.textContent=""}else h.push(t.createTextNode(s));c.textContent="",p=0;while(s=h[p++])if((!i||-1===n.inArray(s,i))&&(f=n.contains(s.ownerDocument,s),o=ob(c.appendChild(s),"script"),f&&mb(o),r)){l=0;while(s=o[l++])fb.test(s.type||"")&&r.push(s)}return c},cleanData:function(e){for(var t,r,i,s,o=n.event.special,u=0;void 0!==(r=e[u]);u++){if(n.acceptData(r)&&(s=r[L.expando],s&&(t=L.cache[s]))){if(t.events)for(i in t.events)o[i]?n.event.remove(r,i):n.removeEvent(r,i,t.handle);L.cache[s]&&delete L.cache[s]}delete M.cache[r[M.expando]]}}}),n.fn.extend({text:function(e){return J(this,function(e){return void 0===e?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=jb(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=jb(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var r,i=e?n.filter(e,this):this,s=0;null!=(r=i[s]);s++)t||1!==r.nodeType||n.cleanData(ob(r)),r.parentNode&&(t&&n.contains(r.ownerDocument,r)&&mb(ob(r,"script")),r.parentNode.removeChild(r));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(n.cleanData(ob(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return n.clone(this,e,t)})},html:function(e){return J(this,function(e){var t=this[0]||{},r=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!db.test(e)&&!ib[(bb.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(ab,"<$1></$2>");try{for(;i>r;r++)t=this[r]||{},1===t.nodeType&&(n.cleanData(ob(t,!1)),t.innerHTML=e);t=0}catch(s){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,n.cleanData(ob(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(t,r){t=e.apply([],t);var i,s,o,u,a,f,l=0,c=this.length,h=this,p=c-1,d=t[0],v=n.isFunction(d);if(v||c>1&&"string"==typeof d&&!k.checkClone&&eb.test(d))return this.each(function(e){var n=h.eq(e);v&&(t[0]=d.call(this,e,n.html())),n.domManip(t,r)});if(c&&(i=n.buildFragment(t,this[0].ownerDocument,!1,this),s=i.firstChild,1===i.childNodes.length&&(i=s),s)){for(o=n.map(ob(i,"script"),kb),u=o.length;c>l;l++)a=i,l!==p&&(a=n.clone(a,!0,!0),u&&n.merge(o,ob(a,"script"))),r.call(this[l],a,l);if(u)for(f=o[o.length-1].ownerDocument,n.map(o,lb),l=0;u>l;l++)a=o[l],fb.test(a.type||"")&&!L.access(a,"globalEval")&&n.contains(f,a)&&(a.src?n._evalUrl&&n._evalUrl(a.src):n.globalEval(a.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){n.fn[e]=function(e){for(var r,i=[],s=n(e),o=s.length-1,u=0;o>=u;u++)r=u===o?this:this.clone(!0),n(s[u])[t](r),f.apply(i,r.get());return this.pushStack(i)}});var qb,rb={},ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):a.getComputedStyle(e,null)};!function(){var e,t,r=l.documentElement,i=l.createElement("div"),s=l.createElement("div");if(s.style){s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===s.style.backgroundClip,i.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",i.appendChild(s);function o(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",s.innerHTML="",r.appendChild(i);var n=a.getComputedStyle(s,null);e="1%"!==n.top,t="4px"===n.width,r.removeChild(i)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return o(),e},boxSizingReliable:function(){return null==t&&o(),t},reliableMarginRight:function(){var e,t=s.appendChild(l.createElement("div"));return t.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",s.style.width="1px",r.appendChild(i),e=!parseFloat(a.getComputedStyle(t,null).marginRight),r.removeChild(i),s.removeChild(t),e}})}}(),n.swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];n.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=xb(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var s,o,u,a=n.camelCase(t),f=e.style;return t=n.cssProps[a]||(n.cssProps[a]=Fb(f,a)),u=n.cssHooks[t]||n.cssHooks[a],void 0===r?u&&"get"in u&&void 0!==(s=u.get(e,!1,i))?s:f[t]:(o=typeof r,"string"===o&&(s=Bb.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(n.css(e,t)),o="number"),null!=r&&r===r&&("number"!==o||n.cssNumber[a]||(r+="px"),k.clearCloneStyle||""!==r||0!==t.indexOf("background")||(f[t]="inherit"),u&&"set"in u&&void 0===(r=u.set(e,r,i))||(f[t]=r)),void 0)}},css:function(e,t,r,i){var s,o,u,a=n.camelCase(t);return t=n.cssProps[a]||(n.cssProps[a]=Fb(e.style,a)),u=n.cssHooks[t]||n.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,r)),void 0===s&&(s=xb(e,t,i)),"normal"===s&&t in Db&&(s=Db[t]),""===r||r?(o=parseFloat(s),r===!0||n.isNumeric(o)?o||0:s):s}}),n.each(["height","width"],function(e,t){n.cssHooks[t]={get:function(e,r,i){return r?zb.test(n.css(e,"display"))&&0===e.offsetWidth?n.swap(e,Cb,function(){return Ib(e,t,i)}):Ib(e,t,i):void 0},set:function(e,r,i){var s=i&&wb(e);return Gb(e,r,i?Hb(e,t,i,"border-box"===n.css(e,"boxSizing",!1,s),s):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(e,t){return t?n.swap(e,{display:"inline-block"},xb,[e,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(e,t){n.cssHooks[e+t]={expand:function(n){for(var r=0,i={},s="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+R[r]+t]=s[r]||s[r-2]||s[0];return i}},ub.test(e)||(n.cssHooks[e+t].set=Gb)}),n.fn.extend({css:function(e,t){return J(this,function(e,t,r){var i,s,o={},u=0;if(n.isArray(t)){for(i=wb(e),s=t.length;s>u;u++)o[t[u]]=n.css(e,t[u],!1,i);return o}return void 0!==r?n.style(e,t,r):n.css(e,t)},e,t,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}}),n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(e,t,r,i,s,o){this.elem=e,this.prop=r,this.easing=s||"swing",this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(n.cssNumber[r]?"":"px")},cur:function(){var e=Kb.propHooks[this.prop];return e&&e.get?e.get(this):Kb.propHooks._default.get(this)},run:function(e){var t,r=Kb.propHooks[this.prop];return this.pos=t=this.options.duration?n.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=n.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){n.fx.step[e.prop]?n.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[n.cssProps[e.prop]]||n.cssHooks[e.prop])?n.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},n.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(e,t){var r=this.createTween(e,t),i=r.cur(),s=Ob.exec(t),o=s&&s[3]||(n.cssNumber[e]?"":"px"),u=(n.cssNumber[e]||"px"!==o&&+i)&&Ob.exec(n.css(r.elem,e)),a=1,f=20;if(u&&u[3]!==o){o=o||u[3],s=s||[],u=+i||1;do a=a||".5",u/=a,n.style(r.elem,e,u+o);while(a!==(a=r.cur()/i)&&1!==a&&--f)}return s&&(u=r.start=+u||+i||0,r.unit=o,r.end=s[1]?u+(s[1]+1)*s[2]:+s[2]),r}]};n.Animation=n.extend(Xb,{tweener:function(e,t){n.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var r,i=0,s=e.length;s>i;i++)r=e[i],Rb[r]=Rb[r]||[],Rb[r].unshift(t)},prefilter:function(e,t){t?Qb.unshift(e):Qb.push(e)}}),n.speed=function(e,t,r){var i=e&&"object"==typeof e?n.extend({},e):{complete:r||!r&&t||n.isFunction(e)&&e,duration:e,easing:r&&t||t&&!n.isFunction(t)&&t};return i.duration=n.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in n.fx.speeds?n.fx.speeds[i.duration]:n.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){n.isFunction(i.old)&&i.old.call(this),i.queue&&n.dequeue(this,i.queue)},i},n.fn.extend({fadeTo:function(e,t,n,r){return this.filter(S).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,r,i){var s=n.isEmptyObject(e),o=n.speed(t,r,i),u=function(){var t=Xb(this,n.extend({},e),o);(s||L.get(this,"finish"))&&t.stop(!0)};return u.finish=u,s||o.queue===!1?this.each(u):this.queue(o.queue,u)},stop:function(e,t,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,s=null!=e&&e+"queueHooks",o=n.timers,u=L.get(this);if(s)u[s]&&u[s].stop&&i(u[s]);else for(s in u)u[s]&&u[s].stop&&Pb.test(s)&&i(u[s]);for(s=o.length;s--;)o[s].elem!==this||null!=e&&o[s].queue!==e||(o[s].anim.stop(r),t=!1,o.splice(s,1));(t||!r)&&n.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,r=L.get(this),i=r[e+"queue"],s=r[e+"queueHooks"],o=n.timers,u=i?i.length:0;for(r.finish=!0,n.queue(this,e,[]),s&&s.stop&&s.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;u>t;t++)i[t]&&i[t].finish&&i[t].finish.call(this);delete r.finish})}}),n.each(["toggle","show","hide"],function(e,t){var r=n.fn[t];n.fn[t]=function(e,n,i){return null==e||"boolean"==typeof e?r.apply(this,arguments):this.animate(Tb(t,!0),e,n,i)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){n.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),n.timers=[],n.fx.tick=function(){var e,t=0,r=n.timers;for(Lb=n.now();t<r.length;t++)e=r[t],e()||r[t]!==e||r.splice(t--,1);r.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(e){n.timers.push(e),e()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(e,t){return e=n.fx?n.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e=l.createElement("input"),t=l.createElement("select"),n=t.appendChild(l.createElement("option"));e.type="checkbox",k.checkOn=""!==e.value,k.optSelected=n.selected,t.disabled=!0,k.optDisabled=!n.disabled,e=l.createElement("input"),e.value="t",e.type="radio",k.radioValue="t"===e.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(e,t){return J(this,n.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){n.removeAttr(this,e)})}}),n.extend({attr:function(e,t,r){var i,s,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===U?n.prop(e,t,r):(1===o&&n.isXMLDoc(e)||(t=t.toLowerCase(),i=n.attrHooks[t]||(n.expr.match.bool.test(t)?Zb:Yb)),void 0===r?i&&"get"in i&&null!==(s=i.get(e,t))?s:(s=n.find.attr(e,t),null==s?void 0:s):null!==r?i&&"set"in i&&void 0!==(s=i.set(e,r,t))?s:(e.setAttribute(t,r+""),r):void n.removeAttr(e,t))},removeAttr:function(e,t){var r,i,s=0,o=t&&t.match(E);if(o&&1===e.nodeType)while(r=o[s++])i=n.propFix[r]||r,n.expr.match.bool.test(r)&&(e[i]=!1),e.removeAttribute(r)},attrHooks:{type:{set:function(e,t){if(!k.radioValue&&"radio"===t&&n.nodeName(e,"input")){var r=e.value;return e.setAttribute("type",t),r&&(e.value=r),t}}}}}),Zb={set:function(e,t,r){return t===!1?n.removeAttr(e,r):e.setAttribute(r,r),r}},n.each(n.expr.match.bool.source.match(/\w+/g),function(e,t){var r=$b[t]||n.find.attr;$b[t]=function(e,t,n){var i,s;return n||(s=$b[t],$b[t]=i,i=null!=r(e,t,n)?t.toLowerCase():null,$b[t]=s),i}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(e,t){return J(this,n.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[n.propFix[e]||e]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,r){var i,s,o,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return o=1!==u||!n.isXMLDoc(e),o&&(t=n.propFix[t]||t,s=n.propHooks[t]),void 0!==r?s&&"set"in s&&void 0!==(i=s.set(e,r,t))?i:e[t]=r:s&&"get"in s&&null!==(i=s.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||_b.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(e){var t,r,i,s,o,u,a="string"==typeof e&&e,f=0,l=this.length;if(n.isFunction(e))return this.each(function(t){n(this).addClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(E)||[];l>f;f++)if(r=this[f],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(ac," "):" ")){o=0;while(s=t[o++])i.indexOf(" "+s+" ")<0&&(i+=s+" ");u=n.trim(i),r.className!==u&&(r.className=u)}return this},removeClass:function(e){var t,r,i,s,o,u,a=0===arguments.length||"string"==typeof e&&e,f=0,l=this.length;if(n.isFunction(e))return this.each(function(t){n(this).removeClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(E)||[];l>f;f++)if(r=this[f],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(ac," "):"")){o=0;while(s=t[o++])while(i.indexOf(" "+s+" ")>=0)i=i.replace(" "+s+" "," ");u=e?n.trim(i):"",r.className!==u&&(r.className=u)}return this},toggleClass:function(e,t){var r=typeof e;return"boolean"==typeof t&&"string"===r?t?this.addClass(e):this.removeClass(e):this.each(n.isFunction(e)?function(r){n(this).toggleClass(e.call(this,r,this.className,t),t)}:function(){if("string"===r){var t,i=0,s=n(this),o=e.match(E)||[];while(t=o[i++])s.hasClass(t)?s.removeClass(t):s.addClass(t)}else(r===U||"boolean"===r)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||e===!1?"":L.get(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(ac," ").indexOf(t)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(e){var t,r,i,s=this[0];if(arguments.length)return i=n.isFunction(e),this.each(function(r){var s;1===this.nodeType&&(s=i?e.call(this,r,n(this).val()):e,null==s?s="":"number"==typeof s?s+="":n.isArray(s)&&(s=n.map(s,function(e){return null==e?"":e+""})),t=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,s,"value")||(this.value=s))});if(s)return t=n.valHooks[s.type]||n.valHooks[s.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(r=t.get(s,"value"))?r:(r=s.value,"string"==typeof r?r.replace(bc,""):null==r?"":r)}}),n.extend({valHooks:{option:{get:function(e){var t=n.find.attr(e,"value");return null!=t?t:n.trim(n.text(e))}},select:{get:function(e){for(var t,r,i=e.options,s=e.selectedIndex,o="select-one"===e.type||0>s,u=o?null:[],a=o?s+1:i.length,f=0>s?a:o?s:0;a>f;f++)if(r=i[f],!(!r.selected&&f!==s||(k.optDisabled?r.disabled:null!==r.getAttribute("disabled"))||r.parentNode.disabled&&n.nodeName(r.parentNode,"optgroup"))){if(t=n(r).val(),o)return t;u.push(t)}return u},set:function(e,t){var r,i,s=e.options,o=n.makeArray(t),u=s.length;while(u--)i=s[u],(i.selected=n.inArray(i.value,o)>=0)&&(r=!0);return r||(e.selectedIndex=-1),o}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(e,t){return n.isArray(t)?e.checked=n.inArray(n(e).val(),t)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){n.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),n.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(e){return JSON.parse(e+"")},n.parseXML=function(e){var t,r;if(!e||"string"!=typeof e)return null;try{r=new DOMParser,t=r.parseFromString(e,"text/xml")}catch(i){t=void 0}return(!t||t.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+e),t};var ec=/#.*$/,fc=/([?&])_=[^&]*/,gc=/^(.*?):[ \t]*([^\r\n]*)$/gm,hc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ic=/^(?:GET|HEAD)$/,jc=/^\/\//,kc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lc={},mc={},nc="*/".concat("*"),oc=a.location.href,pc=kc.exec(oc.toLowerCase())||[];n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:oc,type:"GET",isLocal:hc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?sc(sc(e,n.ajaxSettings),t):sc(n.ajaxSettings,e)},ajaxPrefilter:qc(lc),ajaxTransport:qc(mc),ajax:function(e,t){function T(e,t,o,a){var l,g,y,w,E,x=t;2!==b&&(b=2,u&&clearTimeout(u),r=void 0,s=a||"",S.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(w=tc(c,S,o)),w=uc(c,w,S,l),l?(c.ifModified&&(E=S.getResponseHeader("Last-Modified"),E&&(n.lastModified[i]=E),E=S.getResponseHeader("etag"),E&&(n.etag[i]=E)),204===e||"HEAD"===c.type?x="nocontent":304===e?x="notmodified":(x=w.state,g=w.data,y=w.error,l=!y)):(y=x,(e||!x)&&(x="error",0>e&&(e=0))),S.status=e,S.statusText=(t||x)+"",l?d.resolveWith(h,[g,x,S]):d.rejectWith(h,[S,x,y]),S.statusCode(m),m=void 0,f&&p.trigger(l?"ajaxSuccess":"ajaxError",[S,c,l?g:y]),v.fireWith(h,[S,x]),f&&(p.trigger("ajaxComplete",[S,c]),--n.active||n.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,s,o,u,a,f,l,c=n.ajaxSetup({},t),h=c.context||c,p=c.context&&(h.nodeType||h.jquery)?n(h):n.event,d=n.Deferred(),v=n.Callbacks("once memory"),m=c.statusCode||{},g={},y={},b=0,w="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!o){o={};while(t=gc.exec(s))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,g[e]=t),this},overrideMimeType:function(e){return b||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else S.always(e[S.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),T(0,t),this}};if(d.promise(S).complete=v.add,S.success=S.done,S.error=S.fail,c.url=((e||c.url||oc)+"").replace(ec,"").replace(jc,pc[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=n.trim(c.dataType||"*").toLowerCase().match(E)||[""],null==c.crossDomain&&(a=kc.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===pc[1]&&a[2]===pc[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(pc[3]||("http:"===pc[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=n.param(c.data,c.traditional)),rc(lc,c,t,S),2===b)return S;f=n.event&&c.global,f&&0===n.active++&&n.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!ic.test(c.type),i=c.url,c.hasContent||(c.data&&(i=c.url+=(dc.test(i)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=fc.test(i)?i.replace(fc,"$1_="+cc++):i+(dc.test(i)?"&":"?")+"_="+cc++)),c.ifModified&&(n.lastModified[i]&&S.setRequestHeader("If-Modified-Since",n.lastModified[i]),n.etag[i]&&S.setRequestHeader("If-None-Match",n.etag[i])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&S.setRequestHeader("Content-Type",c.contentType),S.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+nc+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)S.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,S,c)!==!1&&2!==b){w="abort";for(l in{success:1,error:1,complete:1})S[l](c[l]);if(r=rc(mc,c,t,S)){S.readyState=1,f&&p.trigger("ajaxSend",[S,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){S.abort("timeout")},c.timeout));try{b=1,r.send(g,T)}catch(x){if(!(2>b))throw x;T(-1,x)}}else T(-1,"No Transport");return S}return S.abort()},getJSON:function(e,t,r){return n.get(e,t,r,"json")},getScript:function(e,t){return n.get(e,void 0,t,"script")}}),n.each(["get","post"],function(e,t){n[t]=function(e,r,i,s){return n.isFunction(r)&&(s=s||i,i=r,r=void 0),n.ajax({url:e,type:t,dataType:s,data:r,success:i})}}),n._evalUrl=function(e){return n.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(e){var t;return n.isFunction(e)?this.each(function(t){n(this).wrapAll(e.call(this,t))}):(this[0]&&(t=n(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return this.each(n.isFunction(e)?function(t){n(this).wrapInner(e.call(this,t))}:function(){var t=n(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)})},wrap:function(e){var t=n.isFunction(e);return this.each(function(r){n(this).wrapAll(t?e.call(this,r):e)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},n.expr.filters.visible=function(e){return!n.expr.filters.hidden(e)};var vc=/%20/g,wc=/\[\]$/,xc=/\r?\n/g,yc=/^(?:submit|button|image|reset|file)$/i,zc=/^(?:input|select|textarea|keygen)/i;n.param=function(e,t){var r,i=[],s=function(e,t){t=n.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(e)||e.jquery&&!n.isPlainObject(e))n.each(e,function(){s(this.name,this.value)});else for(r in e)Ac(r,e[r],t,s);return i.join("&").replace(vc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=n.prop(this,"elements");return e?n.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!n(this).is(":disabled")&&zc.test(this.nodeName)&&!yc.test(e)&&(this.checked||!T.test(e))}).map(function(e,t){var r=n(this).val();return null==r?null:n.isArray(r)?n.map(r,function(e){return{name:t.name,value:e.replace(xc,"\r\n")}}):{name:t.name,value:r.replace(xc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var Bc=0,Cc={},Dc={0:200,1223:204},Ec=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var e in Cc)Cc[e]()}),k.cors=!!Ec&&"withCredentials"in Ec,k.ajax=Ec=!!Ec,n.ajaxTransport(function(e){var t;return k.cors||Ec&&!e.crossDomain?{send:function(n,r){var i,s=e.xhr(),o=++Bc;if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete Cc[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status,s.statusText):r(Dc[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:void 0,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=Cc[o]=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return n.globalEval(e),e}}}),n.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),n.ajaxTransport("script",function(e){if(e.crossDomain){var t,r;return{send:function(i,s){t=n("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",r=function(e){t.remove(),r=null,e&&s("error"===e.type?404:200,e.type)}),l.head.appendChild(t[0])},abort:function(){r&&r()}}}});var Fc=[],Gc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fc.pop()||n.expando+"_"+cc++;return this[e]=!0,e}}),n.ajaxPrefilter("json jsonp",function(e,t,r){var i,s,o,u=e.jsonp!==!1&&(Gc.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gc.test(e.data)&&"data");return u||"jsonp"===e.dataTypes[0]?(i=e.jsonpCallback=n.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,u?e[u]=e[u].replace(Gc,"$1"+i):e.jsonp!==!1&&(e.url+=(dc.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||n.error(i+" was not called"),o[0]},e.dataTypes[0]="json",s=a[i],a[i]=function(){o=arguments},r.always(function(){a[i]=s,e[i]&&(e.jsonpCallback=t.jsonpCallback,Fc.push(i)),o&&n.isFunction(s)&&s(o[0]),o=s=void 0}),"script"):void 0}),n.parseHTML=function(e,t,r){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(r=t,t=!1),t=t||l;var i=v.exec(e),s=!r&&[];return i?[t.createElement(i[1])]:(i=n.buildFragment([e],t,s),s&&s.length&&n(s).remove(),n.merge([],i.childNodes))};var Hc=n.fn.load;n.fn.load=function(e,t,r){if("string"!=typeof e&&Hc)return Hc.apply(this,arguments);var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=n.trim(e.slice(a)),e=e.slice(0,a)),n.isFunction(t)?(r=t,t=void 0):t&&"object"==typeof t&&(s="POST"),u.length>0&&n.ajax({url:e,type:s,dataType:"html",data:t}).done(function(e){o=arguments,u.html(i?n("<div>").append(n.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){u.each(r,o||[e.responseText,t,e])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){n.fn[t]=function(e){return this.on(t,e)}}),n.expr.filters.animated=function(e){return n.grep(n.timers,function(t){return e===t.elem}).length};var Ic=a.document.documentElement;n.offset={setOffset:function(e,t,r){var i,s,o,u,a,f,l,c=n.css(e,"position"),h=n(e),p={};"static"===c&&(e.style.position="relative"),a=h.offset(),o=n.css(e,"top"),f=n.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+f).indexOf("auto")>-1,l?(i=h.position(),u=i.top,s=i.left):(u=parseFloat(o)||0,s=parseFloat(f)||0),n.isFunction(t)&&(t=t.call(e,r,a)),null!=t.top&&(p.top=t.top-a.top+u),null!=t.left&&(p.left=t.left-a.left+s),"using"in t?t.using.call(e,p):h.css(p)}},n.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){n.offset.setOffset(this,e,t)});var t,r,i=this[0],s={top:0,left:0},o=i&&i.ownerDocument;if(o)return t=o.documentElement,n.contains(t,i)?(typeof i.getBoundingClientRect!==U&&(s=i.getBoundingClientRect()),r=Jc(o),{top:s.top+r.pageYOffset-t.clientTop,left:s.left+r.pageXOffset-t.clientLeft}):s},position:function(){if(this[0]){var e,t,r=this[0],i={top:0,left:0};return"fixed"===n.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),n.nodeName(e[0],"html")||(i=e.offset()),i.top+=n.css(e[0],"borderTopWidth",!0),i.left+=n.css(e[0],"borderLeftWidth",!0)),{top:t.top-i.top-n.css(r,"marginTop",!0),left:t.left-i.left-n.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||Ic;while(e&&!n.nodeName(e,"html")&&"static"===n.css(e,"position"))e=e.offsetParent;return e||Ic})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var r="pageYOffset"===t;n.fn[e]=function(n){return J(this,function(e,n,i){var s=Jc(e);return void 0===i?s?s[t]:e[n]:void (s?s.scrollTo(r?a.pageXOffset:i,r?i:a.pageYOffset):e[n]=i)},e,n,arguments.length,null)}}),n.each(["top","left"],function(e,t){n.cssHooks[t]=yb(k.pixelPosition,function(e,r){return r?(r=xb(e,t),vb.test(r)?n(e).position()[t]+"px":r):void 0})}),n.each({Height:"height",Width:"width"},function(e,t){n.each({padding:"inner"+e,content:t,"":"outer"+e},function(r,i){n.fn[i]=function(i,s){var o=arguments.length&&(r||"boolean"!=typeof i),u=r||(i===!0||s===!0?"margin":"border");return J(this,function(t,r,i){var s;return n.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(s=t.documentElement,Math.max(t.body["scroll"+e],s["scroll"+e],t.body["offset"+e],s["offset"+e],s["client"+e])):void 0===i?n.css(t,r,u):n.style(t,r,i,u)},t,o?i:void 0,o,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kc=a.jQuery,Lc=a.$;return n.noConflict=function(e){return a.$===n&&(a.$=Lc),e&&a.jQuery===n&&(a.jQuery=Kc),n},typeof b===U&&(a.jQuery=a.$=n),n}),define("config",["jquery"],function(e){function r(){if(typeof Storage!="undefined"&&window.trill_on_swish.config_hash){var e;if(e=localStorage.getItem(t)){value=JSON.parse(e);if(value.hash==window.trill_on_swish.config_hash)return value.config}}}function i(e){typeof Storage!="undefined"&&window.trill_on_swish.config_hash&&localStorage.setItem(t,JSON.stringify({hash:window.trill_on_swish.config_hash,config:e}))}var t="TRILLONSWISHCONFIG",n;return n||(n=r())||e.ajax("trill_on_swish_config.json",{dataType:"json",async:!1,success:function(e){n=e,i(n)},error:function(){alert("Failed to fetch configuration from server")}}),n}),define("preferences",["jquery"],function(e){function i(){var e=localStorage.getItem("notagain")||"[]",t;try{data=JSON.parse(e),typeof data!="object"&&(data=[])}catch(n){data=[]}return data}var t=typeof Storage!="undefined",n={},r={persistent:function(){return t},setNotAgain:function(e){if(t){var n=i();n.indexOf(e)<0&&(n.push(e),localStorage.setItem("notagain",JSON.stringify(n)))}},notagain:function(e){if(t){var n=i();return n.indexOf(e)>=0}return!1},broadcast:function(t,n){e(".trill_on_swish-event-receiver").trigger("preference",{name:t,value:n})},setVal:function(e,n){t&&localStorage.setItem(e,JSON.stringify(n)),this.broadcast(e,n)},setDefault:function(e,t){n[e]=t},getVal:function(e){if(t){var r;if(r=localStorage.getItem(e))return value=JSON.parse(r),value}return n[e]}};return r}),function(e){"function"==typeof define&&define.amd?define("jquery-ui",["jquery"],e):e(jQuery)}(function(e){function t(t,r){var i,s,o,u=t.nodeName.toLowerCase();return"area"===u?(i=t.parentNode,s=i.name,t.href&&s&&"map"===i.nodeName.toLowerCase()?(o=e("img[usemap='#"+s+"']")[0],!!o&&n(o)):!1):(/^(input|select|textarea|button|object)$/.test(u)?!t.disabled:"a"===u?t.href||r:r)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function r(e){for(var t,n;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(n=parseInt(e.css("zIndex"),10),!isNaN(n)&&0!==n))return n;e=e.parent()}return 0}function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=s(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(t){var n="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(n,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(n,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(g.inline?g.dpDiv.parent()[0]:g.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function u(t,n){e.extend(t,n);for(var r in n)null==n[r]&&(t[r]=n[r]);return t}function a(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var n=this.css("position"),r="absolute"===n,i=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return r&&"static"===t.css("position")?!1:i.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==n&&s.length?s:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(n){return t(n,!isNaN(e.attr(n,"tabindex")))},tabbable:function(n){var r=e.attr(n,"tabindex"),i=isNaN(r);return(i||r>=0)&&t(n,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function r(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i="Width"===n?["Left","Right"]:["Top","Bottom"],s=n.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return void 0===t?o["inner"+n].call(this):this.each(function(){e(this).css(s,r(this,t)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?o["outer"+n].call(this,t):this.each(function(){e(this).css(s,r(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return"number"==typeof n?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var n,r,i=e(this[0]);i.length&&i[0]!==document;){if(n=i.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(r=parseInt(i.css("zIndex"),10),!isNaN(r)&&0!==r))return r;i=i.parent()}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(s&&(r||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(i=0;s.length>i;i++)e.options[s[i][0]]&&s[i][1].apply(e.element,n)}};var f=0,l=Array.prototype.slice;e.cleanData=function(t){return function(n){var r,i,s;for(s=0;null!=(i=n[s]);s++)try{r=e._data(i,"events"),r&&r.remove&&e(i).triggerHandler("remove")}catch(o){}t(n)}}(e.cleanData),e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];return t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){return e.isFunction(r)?(a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t,n=this._super,s=this._superApply;return this._super=e,this._superApply=i,t=r.apply(this,arguments),this._super=n,this._superApply=s,t}}(),void 0):(a[t]=r,void 0)}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix||t:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var n,r,i=l.call(arguments,1),s=0,o=i.length;o>s;s++)for(n in i[s])r=i[s][n],i[s].hasOwnProperty(n)&&void 0!==r&&(t[n]=e.isPlainObject(r)?e.isPlainObject(t[n])?e.widget.extend({},t[n],r):e.widget.extend({},r):r);return t},e.widget.bridge=function(t,n){var r=n.prototype.widgetFullName||t;e.fn[t]=function(i){var s="string"==typeof i,o=l.call(arguments,1),u=this;return s?this.each(function(){var n,s=e.data(this,r);return"instance"===i?(u=s,!1):s?e.isFunction(s[i])&&"_"!==i.charAt(0)?(n=s[i].apply(s,o),n!==s&&void 0!==n?(u=n&&n.jquery?u.pushStack(n.get()):n,!1):void 0):e.error("no such method '"+i+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+i+"'")}):(o.length&&(i=e.widget.extend.apply(null,[i].concat(o))),this.each(function(){var t=e.data(this,r);t?(t.option(i||{}),t._init&&t._init()):e.data(this,r,new n(i,this))})),u}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=f++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r,i,s,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},r=t.split("."),t=r.shift(),r.length){for(i=o[t]=e.widget.extend({},this.options[t]),s=0;r.length-1>s;s++)i[r[s]]=i[r[s]]||{},i=i[r[s]];if(t=r.pop(),1===arguments.length)return void 0===i[t]?null:i[t];i[t]=n}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=n}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,n,r){var i,s=this;"boolean"!=typeof t&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){return t||s.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?s[o]:o).apply(s,arguments):void 0}"string"!=typeof o&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^([\w:-]*)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(t,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(n).undelegate(n),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function n(){return("string"==typeof e?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];if(r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){"string"==typeof i&&(i={effect:i});var o,u=i?i===!0||"number"==typeof i?n:i.effect||n:t;i=i||{},"number"==typeof i&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.widget;var c=!1;e(document).mouseup(function(){c=!1}),e.widget("ui.mouse",{version:"1.11.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){return!0===e.data(n.target,t.widgetName+".preventClickEvent")?(e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!c){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var n=this,r=1===t.which,i="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return r&&!i&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),c=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),c=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,n){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?n/100:1)]}function n(t,n){return parseInt(e.css(t,n),10)||0}function r(t){var n=t[0];return 9===n.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var i,s,o=Math.max,u=Math.abs,a=Math.round,f=/left|center|right/,l=/top|center|bottom/,c=/[\+\-]\d+(\.[\d]+)?%?/,h=/^\w+/,p=/%$/,d=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==i)return i;var t,n,r=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),s=r.children()[0];return e("body").append(r),t=s.offsetWidth,r.css("overflow","scroll"),n=s.offsetWidth,t===n&&(n=r[0].clientWidth),r.remove(),i=t-n},getScrollInfo:function(t){var n=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),r=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),i="scroll"===n||"auto"===n&&t.width<t.element[0].scrollWidth,s="scroll"===r||"auto"===r&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:i?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]),i=!!n[0]&&9===n[0].nodeType;return{element:n,isWindow:r,isDocument:i,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r||i?n.width():n.outerWidth(),height:r||i?n.height():n.outerHeight()}}},e.fn.position=function(i){if(!i||!i.of)return d.apply(this,arguments);i=e.extend({},i);var p,v,m,g,y,b,w=e(i.of),E=e.position.getWithinInfo(i.within),S=e.position.getScrollInfo(E),x=(i.collision||"flip").split(" "),T={};return b=r(w),w[0].preventDefault&&(i.at="left top"),v=b.width,m=b.height,g=b.offset,y=e.extend({},g),e.each(["my","at"],function(){var e,t,n=(i[this]||"").split(" ");1===n.length&&(n=f.test(n[0])?n.concat(["center"]):l.test(n[0])?["center"].concat(n):["center","center"]),n[0]=f.test(n[0])?n[0]:"center",n[1]=l.test(n[1])?n[1]:"center",e=c.exec(n[0]),t=c.exec(n[1]),T[this]=[e?e[0]:0,t?t[0]:0],i[this]=[h.exec(n[0])[0],h.exec(n[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===i.at[0]?y.left+=v:"center"===i.at[0]&&(y.left+=v/2),"bottom"===i.at[1]?y.top+=m:"center"===i.at[1]&&(y.top+=m/2),p=t(T.at,v,m),y.left+=p[0],y.top+=p[1],this.each(function(){var r,f,l=e(this),c=l.outerWidth(),h=l.outerHeight(),d=n(this,"marginLeft"),b=n(this,"marginTop"),N=c+d+n(this,"marginRight")+S.width,C=h+b+n(this,"marginBottom")+S.height,L=e.extend({},y),A=t(T.my,l.outerWidth(),l.outerHeight());"right"===i.my[0]?L.left-=c:"center"===i.my[0]&&(L.left-=c/2),"bottom"===i.my[1]?L.top-=h:"center"===i.my[1]&&(L.top-=h/2),L.left+=A[0],L.top+=A[1],s||(L.left=a(L.left),L.top=a(L.top)),r={marginLeft:d,marginTop:b},e.each(["left","top"],function(t,n){e.ui.position[x[t]]&&e.ui.position[x[t]][n](L,{targetWidth:v,targetHeight:m,elemWidth:c,elemHeight:h,collisionPosition:r,collisionWidth:N,collisionHeight:C,offset:[p[0]+A[0],p[1]+A[1]],my:i.my,at:i.at,within:E,elem:l})}),i.using&&(f=function(e){var t=g.left-L.left,n=t+v-c,r=g.top-L.top,s=r+m-h,a={target:{element:w,left:g.left,top:g.top,width:v,height:m},element:{element:l,left:L.left,top:L.top,width:c,height:h},horizontal:0>n?"left":t>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};c>v&&v>u(t+n)&&(a.horizontal="center"),h>m&&m>u(r+s)&&(a.vertical="middle"),a.important=o(u(t),u(n))>o(u(r),u(s))?"horizontal":"vertical",i.using.call(this,e,a)}),l.offset(e.extend(L,{using:f}))})},e.ui.position={fit:{left:function(e,t){var n,r=t.within,i=r.isWindow?r.scrollLeft:r.offset.left,s=r.width,u=e.left-t.collisionPosition.marginLeft,a=i-u,f=u+t.collisionWidth-s-i;t.collisionWidth>s?a>0&&0>=f?(n=e.left+a+t.collisionWidth-s-i,e.left+=a-n):e.left=f>0&&0>=a?i:a>f?i+s-t.collisionWidth:i:a>0?e.left+=a:f>0?e.left-=f:e.left=o(e.left-u,e.left)},top:function(e,t){var n,r=t.within,i=r.isWindow?r.scrollTop:r.offset.top,s=t.within.height,u=e.top-t.collisionPosition.marginTop,a=i-u,f=u+t.collisionHeight-s-i;t.collisionHeight>s?a>0&&0>=f?(n=e.top+a+t.collisionHeight-s-i,e.top+=a-n):e.top=f>0&&0>=a?i:a>f?i+s-t.collisionHeight:i:a>0?e.top+=a:f>0?e.top-=f:e.top=o(e.top-u,e.top)}},flip:{left:function(e,t){var n,r,i=t.within,s=i.offset.left+i.scrollLeft,o=i.width,a=i.isWindow?i.scrollLeft:i.offset.left,f=e.left-t.collisionPosition.marginLeft,l=f-a,c=f+t.collisionWidth-o-a,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,d=-2*t.offset[0];0>l?(n=e.left+h+p+d+t.collisionWidth-o-s,(0>n||u(l)>n)&&(e.left+=h+p+d)):c>0&&(r=e.left-t.collisionPosition.marginLeft+h+p+d-a,(r>0||c>u(r))&&(e.left+=h+p+d))},top:function(e,t){var n,r,i=t.within,s=i.offset.top+i.scrollTop,o=i.height,a=i.isWindow?i.scrollTop:i.offset.top,f=e.top-t.collisionPosition.marginTop,l=f-a,c=f+t.collisionHeight-o-a,h="top"===t.my[1],p=h?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,d="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,v=-2*t.offset[1];0>l?(r=e.top+p+d+v+t.collisionHeight-o-s,(0>r||u(l)>r)&&(e.top+=p+d+v)):c>0&&(n=e.top-t.collisionPosition.marginTop+p+d+v-a,(n>0||c>u(n))&&(e.top+=p+d+v))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,r,i,o,u=document.getElementsByTagName("body")[0],a=document.createElement("div");t=document.createElement(u?"div":"body"),r={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},u&&e.extend(r,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in r)t.style[o]=r[o];t.appendChild(a),n=u||document.documentElement,n.insertBefore(t,n.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",i=e(a).offset().left,s=i>10&&11>i,t.innerHTML="",n.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._eventHandler(t);break;case n.HOME:s=this.headers[0];break;case n.END:s=this.headers[r-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,n=this.options,r=n.heightStyle,i=this.element.parent();this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),n=t.uniqueId().attr("id"),r=t.next(),i=r.uniqueId().attr("id");t.attr("aria-controls",i),r.attr("aria-labelledby",n)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),"fill"===r?(t=i.height(),this.element.siblings(":visible").each(function(){var n=e(this),r=n.css("position");"absolute"!==r&&"fixed"!==r&&(t-=n.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===r&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var n=this._findActive(t)[0];n!==this.active[0]&&(n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var n={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,n),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i[0]===r[0],o=s&&n.collapsible,u=o?e():i.next(),a=r.next(),f={oldHeader:r,oldPanel:a,newHeader:o?e():i,newPanel:u};t.preventDefault(),s&&!n.collapsible||this._trigger("beforeActivate",t,f)===!1||(n.active=o?!1:this.headers.index(i),this.active=s?e():i,this._toggle(f),r.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&r.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),s||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),i.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var n=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=r,this.options.animate?this._animate(n,r,t):(r.hide(),n.show(),this._toggleComplete(t)),r.attr({"aria-hidden":"true"}),r.prev().attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&r.length?r.prev().attr({tabIndex:-1,"aria-expanded":"false"}):n.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),n.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,n){var r,i,s,o=this,u=0,a=e.length&&(!t.length||e.index()<t.index()),f=this.options.animate||{},l=a&&f.down||f,c=function(){o._toggleComplete(n)};return"number"==typeof l&&(s=l),"string"==typeof l&&(i=l),i=i||l.easing||f.easing,s=s||l.duration||f.duration,t.length?e.length?(r=e.show().outerHeight(),t.animate(this.hideProps,{duration:s,easing:i,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:s,easing:i,complete:c,step:function(e,n){n.now=Math.round(e),"height"!==n.prop?u+=n.now:"content"!==o.options.heightStyle&&(n.now=Math.round(r-t.outerHeight()-u),u=0)}}),void 0):t.animate(this.hideProps,s,i,c):e.animate(this.showProps,s,i,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var n=e(t.target);!this.mouseHandled&&n.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),n.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var n=e(t.currentTarget);n.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,n)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var n=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,n)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var n,r,i,s,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,r=this.previousFilter||"",i=String.fromCharCode(t.keyCode),s=!1,clearTimeout(this.filterTimer),i===r?s=!0:i=r+i,n=this._filterMenuItems(i),n=s&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(i=String.fromCharCode(t.keyCode),n=this._filterMenuItems(i)),n.length?(this.focus(t,n),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,n,r=this,i=this.options.icons.submenu,s=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.parent(),r=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(r),t.attr("aria-labelledby",n.attr("id"))}),t=s.add(this.element),n=t.find(this.options.items),n.not(".ui-menu-item").each(function(){var t=e(this);r._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),n.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),n.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var n,r;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),r=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",r.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=t.children(".ui-menu"),n.length&&e&&/^mouse/.test(e.type)&&this._startOpening(n),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var n,r,i,s,o,u;this._hasScroll()&&(n=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,r=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,i=t.offset().top-this.activeMenu.offset().top-n-r,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),u=t.outerHeight(),0>i?this.activeMenu.scrollTop(s+i):i+u>o&&this.activeMenu.scrollTop(s+i-o+u))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var n=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(n)},collapseAll:function(t,n){clearTimeout(this.timer),this.timer=this._delay(function(){var r=n?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));r.length||(r=this.element),this._close(r),this.blur(t),this.activeMenu=r},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,n){var r;this.active&&(r="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),r&&r.length&&this.active||(r=this.activeMenu.find(this.options.items)[t]()),this.focus(n,r)},nextPage:function(t){var n,r,i;return this.active?(this.isLastItem()||(this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return n=e(this),0>n.offset().top-r-i}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var n,r,i;return this.active?(this.isFirstItem()||(this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r+i>0}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var n={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,n)},_filterMenuItems:function(t){var n=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),r=RegExp("^"+n,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return r.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,n,r,i=this.element[0].nodeName.toLowerCase(),s="textarea"===i,o="input"===i;this.isMultiLine=s?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[s||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(i){if(this.element.prop("readOnly"))return t=!0,r=!0,n=!0,void 0;t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",i);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",i);break;case s.UP:t=!0,this._keyEvent("previous",i);break;case s.DOWN:t=!0,this._keyEvent("next",i);break;case s.ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&r.preventDefault(),void 0;if(!n){var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move("previousPage",r);break;case i.PAGE_DOWN:this._move("nextPage",r);break;case i.UP:this._keyEvent("previous",r);break;case i.DOWN:this._keyEvent("next",r)}}},input:function(e){return r?(r=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target===t.element[0]||r.target===n||e.contains(n,r.target)||t.close()})})},menufocus:function(t,n){var r,i;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(i=n.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:i})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(i.value),r=n.item.attr("aria-label")||i.value,r&&e.trim(r).length&&(this.liveRegion.children().hide(),e("<div>").text(r).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):"string"==typeof this.options.source?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),n=this.menu.element.is(":visible"),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!n&&!r)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var n=this.menu.element.empty();this._renderMenu(n,t),this.isNewMenu=!0,this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,n){return e("<li>").text(n.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var n;this._superApply(arguments),this.options.disabled||this.cancelSearch||(n=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(n).appendTo(this.liveRegion))}}),e.ui.autocomplete;var h,p="ui-button ui-widget ui-state-default ui-corner-all",d="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",v=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},m=function(t){var n=t.name,r=t.form,i=e([]);return n&&(n=n.replace(/'/g,"\\'"),i=r?e(r).find("[name='"+n+"'][type=radio]"):e("[name='"+n+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.11.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,v),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,n=this.options,r="checkbox"===this.type||"radio"===this.type,i=r?"":"ui-state-active";null===n.label&&(n.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){n.disabled||this===h&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){n.disabled||e(this).removeClass(i)}).bind("click"+this.eventNamespace,function(e){n.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),r&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return n.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(n.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var r=t.element[0];m(r).not(r).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return n.disabled?!1:(e(this).addClass("ui-state-active"),h=this,t.document.one("mouseup",function(){h=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return n.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return n.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",n.disabled),this._resetButton()},_determineButtonType:function(){var e,t,n;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),n=this.element.is(":checked"),n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",n)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+d).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?m(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(d),n=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(n)))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),n=this.element.find(this.options.items),r=n.filter(":ui-button");n.not(":ui-button").button(),r.button("refresh"),this.buttons=n.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.3"}});var g;e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return u(this._defaults,e||{}),this},_attachDatepicker:function(t,n){var r,i,s;r=t.nodeName.toLowerCase(),i="div"===r||"span"===r,t.id||(this.uuid+=1,t.id="dp"+this.uuid),s=this._newInst(e(t),i),s.settings=e.extend({},n||{}),"input"===r?this._connectDatepicker(t,s):i&&this._inlineDatepicker(t,s)},_newInst:function(t,n){var r=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:r,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:n,dpDiv:n?s(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,n){var r=e(t);n.append=e([]),n.trigger=e([]),r.hasClass(this.markerClassName)||(this._attachments(r,n),r.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(n),e.data(t,"datepicker",n),n.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,n){var r,i,s,o=this._get(n,"appendText"),u=this._get(n,"isRTL");n.append&&n.append.remove(),o&&(n.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[u?"before":"after"](n.append)),t.unbind("focus",this._showDatepicker),n.trigger&&n.trigger.remove(),r=this._get(n,"showOn"),("focus"===r||"both"===r)&&t.focus(this._showDatepicker),("button"===r||"both"===r)&&(i=this._get(n,"buttonText"),s=this._get(n,"buttonImage"),n.trigger=e(this._get(n,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:s,alt:i,title:i}):e("<button type='button'></button>").addClass(this._triggerClass).html(s?e("<img/>").attr({src:s,alt:i,title:i}):i)),t[u?"before":"after"](n.trigger),n.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,n,r,i,s=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(n=0,r=0,i=0;e.length>i;i++)e[i].length>n&&(n=e[i].length,r=i);return r},s.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),s.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-s.getDay())),e.input.attr("size",this._formatDate(e,s).length)}},_inlineDatepicker:function(t,n){var r=e(t);r.hasClass(this.markerClassName)||(r.addClass(this.markerClassName).append(n.dpDiv),e.data(t,"datepicker",n),this._setDate(n,this._getDefaultDate(n),!0),this._updateDatepicker(n),this._updateAlternate(n),n.settings.disabled&&this._disableDatepicker(t),n.dpDiv.css("display","block"))},_dialogDatepicker:function(t,n,r,i,s){var o,a,f,l,c,h=this._dialogInst;return h||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),h=this._dialogInst=this._newInst(this._dialogInput,!1),h.settings={},e.data(this._dialogInput[0],"datepicker",h)),u(h.settings,i||{}),n=n&&n.constructor===Date?this._formatDate(h,n):n,this._dialogInput.val(n),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(a=document.documentElement.clientWidth,f=document.documentElement.clientHeight,l=document.documentElement.scrollLeft||document.body.scrollLeft,c=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[a/2-100+l,f/2-150+c]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),h.settings.onSelect=r,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",h),this},_destroyDatepicker:function(t){var n,r=e(t),i=e.data(t,"datepicker");r.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===n?(i.append.remove(),i.trigger.remove(),r.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===n||"span"===n)&&r.removeClass(this.markerClassName).empty(),g===i&&(g=null))},_enableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");i.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),"input"===n?(t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===n||"span"===n)&&(r=i.children("."+this._inlineClass),r.children().removeClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");i.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),"input"===n?(t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===n||"span"===n)&&(r=i.children("."+this._inlineClass),r.children().addClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(n){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,n,r){var i,s,o,a,f=this._getInst(t);return 2===arguments.length&&"string"==typeof n?"defaults"===n?e.extend({},e.datepicker._defaults):f?"all"===n?e.extend({},f.settings):this._get(f,n):null:(i=n||{},"string"==typeof n&&(i={},i[n]=r),f&&(this._curInst===f&&this._hideDatepicker(),s=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(f,"min"),a=this._getMinMaxDate(f,"max"),u(f.settings,i),null!==o&&void 0!==i.dateFormat&&void 0===i.minDate&&(f.settings.minDate=this._formatDate(f,o)),null!==a&&void 0!==i.dateFormat&&void 0===i.maxDate&&(f.settings.maxDate=this._formatDate(f,a)),"disabled"in i&&(i.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),f),this._autoSize(f),this._setDate(f,s),this._updateAlternate(f),this._updateDatepicker(f)),void 0)},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(t){var n,r,i,s=e.datepicker._getInst(t.target),o=!0,u=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return i=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",s.dpDiv),i[0]&&e.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),n=e.datepicker._get(s,"onSelect"),n?(r=e.datepicker._formatDate(s),n.apply(s.input?s.input[0]:null,[r,s])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var n,r,i=e.datepicker._getInst(t.target);return e.datepicker._get(i,"constrainInput")?(n=e.datepicker._possibleChars(e.datepicker._get(i,"dateFormat")),r=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">r||!n||n.indexOf(r)>-1):void 0},_doKeyUp:function(t){var n,r=e.datepicker._getInst(t.target);if(r.input.val()!==r.lastVal)try{n=e.datepicker.parseDate(e.datepicker._get(r,"dateFormat"),r.input?r.input.val():null,e.datepicker._getFormatConfig(r)),n&&(e.datepicker._setDateFromField(r),e.datepicker._updateAlternate(r),e.datepicker._updateDatepicker(r))}catch(i){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var n,i,s,o,a,f,l;n=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==n&&(e.datepicker._curInst.dpDiv.stop(!0,!0),n&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),i=e.datepicker._get(n,"beforeShow"),s=i?i.apply(t,[t,n]):{},s!==!1&&(u(n.settings,s),n.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(n),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),a={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(n),a=e.datepicker._checkOffset(n,a,o),n.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),n.inline||(f=e.datepicker._get(n,"showAnim"),l=e.datepicker._get(n,"duration"),n.dpDiv.css("z-index",r(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[f]?n.dpDiv.show(f,e.datepicker._get(n,"showOptions"),l):n.dpDiv[f||"show"](f?l:null),e.datepicker._shouldFocusInput(n)&&n.input.focus(),e.datepicker._curInst=n))}},_updateDatepicker:function(t){this.maxRows=4,g=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var n,r=this._getNumberOfMonths(t),i=r[1],s=17,u=t.dpDiv.find("."+this._dayOverClass+" a");u.length>0&&o.apply(u.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),i>1&&t.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",s*i+"em"),t.dpDiv[(1!==r[0]||1!==r[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(n=t.yearshtml,setTimeout(function(){n===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),n=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,n,r){var i=t.dpDiv.outerWidth(),s=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,u=t.input?t.input.outerHeight():0,a=document.documentElement.clientWidth+(r?0:e(document).scrollLeft()),f=document.documentElement.clientHeight+(r?0:e(document).scrollTop());return n.left-=this._get(t,"isRTL")?i-o:0,n.left-=r&&n.left===t.input.offset().left?e(document).scrollLeft():0,n.top-=r&&n.top===t.input.offset().top+u?e(document).scrollTop():0,n.left-=Math.min(n.left,n.left+i>a&&a>i?Math.abs(n.left+i-a):0),n.top-=Math.min(n.top,n.top+s>f&&f>s?Math.abs(s+u):0),n},_findPos:function(t){for(var n,r=this._getInst(t),i=this._get(r,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return n=e(t).offset(),[n.left,n.top]},_hideDatepicker:function(t){var n,r,i,s,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(n=this._get(o,"showAnim"),r=this._get(o,"duration"),i=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[n]||e.effects[n])?o.dpDiv.hide(n,e.datepicker._get(o,"showOptions"),r,i):o.dpDiv["slideDown"===n?"slideUp":"fadeIn"===n?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1,s=this._get(o,"onClose"),s&&s.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var n=e(t.target),r=e.datepicker._getInst(n[0]);(n[0].id!==e.datepicker._mainDivId&&0===n.parents("#"+e.datepicker._mainDivId).length&&!n.hasClass(e.datepicker.markerClassName)&&!n.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||n.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==r)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,n,r){var i=e(t),s=this._getInst(i[0]);this._isDisabledDatepicker(i[0])||(this._adjustInstDate(s,n+("M"===r?this._get(s,"showCurrentAtPos"):0),r),this._updateDatepicker(s))},_gotoToday:function(t){var n,r=e(t),i=this._getInst(r[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(n=new Date,i.selectedDay=n.getDate(),i.drawMonth=i.selectedMonth=n.getMonth(),i.drawYear=i.selectedYear=n.getFullYear()),this._notifyChange(i),this._adjustDate(r)},_selectMonthYear:function(t,n,r){var i=e(t),s=this._getInst(i[0]);s["selected"+("M"===r?"Month":"Year")]=s["draw"+("M"===r?"Month":"Year")]=parseInt(n.options[n.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(i)},_selectDay:function(t,n,r,i){var s,o=e(t);e(i).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(s=this._getInst(o[0]),s.selectedDay=s.currentDay=e("a",i).html(),s.selectedMonth=s.currentMonth=n,s.selectedYear=s.currentYear=r,this._selectDate(t,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear)))},_clearDate:function(t){var n=e(t);this._selectDate(n,"")},_selectDate:function(t,n){var r,i=e(t),s=this._getInst(i[0]);n=null!=n?n:this._formatDate(s),s.input&&s.input.val(n),this._updateAlternate(s),r=this._get(s,"onSelect"),r?r.apply(s.input?s.input[0]:null,[n,s]):s.input&&s.input.trigger("change"),s.inline?this._updateDatepicker(s):(this._hideDatepicker(),this._lastInput=s.input[0],"object"!=typeof s.input[0]&&s.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var n,r,i,s=this._get(t,"altField");s&&(n=this._get(t,"altFormat")||this._get(t,"dateFormat"),r=this._getDate(t),i=this.formatDate(n,r,this._getFormatConfig(t)),e(s).each(function(){e(this).val(i)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,n=new Date(e.getTime());return n.setDate(n.getDate()+4-(n.getDay()||7)),t=n.getTime(),n.setMonth(0),n.setDate(1),Math.floor(Math.round((t-n)/864e5)/7)+1},parseDate:function(t,n,r){if(null==t||null==n)throw"Invalid arguments";if(n="object"==typeof n?""+n:n+"",""===n)return null;var i,s,o,u,a=0,f=(r?r.shortYearCutoff:null)||this._defaults.shortYearCutoff,l="string"!=typeof f?f:(new Date).getFullYear()%100+parseInt(f,10),c=(r?r.dayNamesShort:null)||this._defaults.dayNamesShort,h=(r?r.dayNames:null)||this._defaults.dayNames,p=(r?r.monthNamesShort:null)||this._defaults.monthNamesShort,d=(r?r.monthNames:null)||this._defaults.monthNames,v=-1,m=-1,g=-1,y=-1,b=!1,w=function(e){var n=t.length>i+1&&t.charAt(i+1)===e;return n&&i++,n},E=function(e){var t=w(e),r="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,i="y"===e?r:1,s=RegExp("^\\d{"+i+","+r+"}"),o=n.substring(a).match(s);if(!o)throw"Missing number at position "+a;return a+=o[0].length,parseInt(o[0],10)},S=function(t,r,i){var s=-1,o=e.map(w(t)?i:r,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var r=t[1];return n.substr(a,r.length).toLowerCase()===r.toLowerCase()?(s=t[0],a+=r.length,!1):void 0}),-1!==s)return s+1;throw"Unknown name at position "+a},x=function(){if(n.charAt(a)!==t.charAt(i))throw"Unexpected literal at position "+a;a++};for(i=0;t.length>i;i++)if(b)"'"!==t.charAt(i)||w("'")?x():b=!1;else switch(t.charAt(i)){case"d":g=E("d");break;case"D":S("D",c,h);break;case"o":y=E("o");break;case"m":m=E("m");break;case"M":m=S("M",p,d);break;case"y":v=E("y");break;case"@":u=new Date(E("@")),v=u.getFullYear(),m=u.getMonth()+1,g=u.getDate();break;case"!":u=new Date((E("!")-this._ticksTo1970)/1e4),v=u.getFullYear(),m=u.getMonth()+1,g=u.getDate();break;case"'":w("'")?x():b=!0;break;default:x()}if(n.length>a&&(o=n.substr(a),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===v?v=(new Date).getFullYear():100>v&&(v+=(new Date).getFullYear()-(new Date).getFullYear()%100+(l>=v?0:-100)),y>-1)for(m=1,g=y;;){if(s=this._getDaysInMonth(v,m-1),s>=g)break;m++,g-=s}if(u=this._daylightSavingAdjust(new Date(v,m-1,g)),u.getFullYear()!==v||u.getMonth()+1!==m||u.getDate()!==g)throw"Invalid date";return u},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864e9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,n){if(!t)return"";var r,i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=function(t){var n=e.length>r+1&&e.charAt(r+1)===t;return n&&r++,n},f=function(e,t,n){var r=""+t;if(a(e))for(;n>r.length;)r="0"+r;return r},l=function(e,t,n,r){return a(e)?r[t]:n[t]},c="",h=!1;if(t)for(r=0;e.length>r;r++)if(h)"'"!==e.charAt(r)||a("'")?c+=e.charAt(r):h=!1;else switch(e.charAt(r)){case"d":c+=f("d",t.getDate(),2);break;case"D":c+=l("D",t.getDay(),i,s);break;case"o":c+=f("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":c+=f("m",t.getMonth()+1,2);break;case"M":c+=l("M",t.getMonth(),o,u);break;case"y":c+=a("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":c+=t.getTime();break;case"!":c+=1e4*t.getTime()+this._ticksTo1970;break;case"'":a("'")?c+="'":h=!0;break;default:c+=e.charAt(r)}return c},_possibleChars:function(e){var t,n="",r=!1,i=function(n){var r=e.length>t+1&&e.charAt(t+1)===n;return r&&t++,r};for(t=0;e.length>t;t++)if(r)"'"!==e.charAt(t)||i("'")?n+=e.charAt(t):r=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":n+="0123456789";break;case"D":case"M":return null;case"'":i("'")?n+="'":r=!0;break;default:n+=e.charAt(t)}return n},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i=this._getDefaultDate(e),s=i,o=this._getFormatConfig(e);try{s=this.parseDate(n,r,o)||i}catch(u){r=t?"":r}e.selectedDay=s.getDate(),e.drawMonth=e.selectedMonth=s.getMonth(),e.drawYear=e.selectedYear=s.getFullYear(),e.currentDay=r?s.getDate():0,e.currentMonth=r?s.getMonth():0,e.currentYear=r?s.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,n,r){var i=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(n){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),n,e.datepicker._getFormatConfig(t))}catch(r){}for(var i=(n.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,s=i.getFullYear(),o=i.getMonth(),u=i.getDate(),a=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,f=a.exec(n);f;){switch(f[2]||"d"){case"d":case"D":u+=parseInt(f[1],10);break;case"w":case"W":u+=7*parseInt(f[1],10);break;case"m":case"M":o+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o));break;case"y":case"Y":s+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o))}f=a.exec(n)}return new Date(s,o,u)},o=null==n||""===n?r:"string"==typeof n?s(n):"number"==typeof n?isNaN(n)?r:i(n):new Date(n.getTime());return o=o&&"Invalid Date"==""+o?r:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),i===e.selectedMonth&&s===e.selectedYear||n||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var n=this._get(t,"stepMonths"),r="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(r,-n,"M")},next:function(){e.datepicker._adjustDate(r,+n,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(r)},selectDay:function(){return e.datepicker._selectDay(r,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(r,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(r,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q=new Date,R=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth(),q.getDate())),U=this._get(e,"isRTL"),z=this._get(e,"showButtonPanel"),W=this._get(e,"hideIfNoPrevNext"),X=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),$=this._get(e,"showCurrentAtPos"),J=this._get(e,"stepMonths"),K=1!==V[0]||1!==V[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(e,"min"),Y=this._getMinMaxDate(e,"max"),Z=e.drawMonth-$,et=e.drawYear;if(0>Z&&(Z+=12,et--),Y)for(t=this._daylightSavingAdjust(new Date(Y.getFullYear(),Y.getMonth()-V[0]*V[1]+1,Y.getDate())),t=G&&G>t?G:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,n=this._get(e,"prevText"),n=X?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z-J,1)),this._getFormatConfig(e)):n,r=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>":W?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>",i=this._get(e,"nextText"),i=X?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z+J,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>":W?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>",o=this._get(e,"currentText"),u=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,o=X?this.formatDate(o,u,this._getFormatConfig(e)):o,a=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",f=z?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(U?a:"")+(this._isInRange(e,u)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(U?"":a)+"</div>":"",l=parseInt(this._get(e,"firstDay"),10),l=isNaN(l)?0:l,c=this._get(e,"showWeek"),h=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),d=this._get(e,"monthNames"),v=this._get(e,"monthNamesShort"),m=this._get(e,"beforeShowDay"),g=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),w="",S=0;V[0]>S;S++){for(x="",this.maxRows=4,T=0;V[1]>T;T++){if(N=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),C=" ui-corner-all",k="",K){if(k+="<div class='ui-datepicker-group",V[1]>1)switch(T){case 0:k+=" ui-datepicker-group-first",C=" ui-corner-"+(U?"right":"left");break;case V[1]-1:k+=" ui-datepicker-group-last",C=" ui-corner-"+(U?"left":"right");break;default:k+=" ui-datepicker-group-middle",C=""}k+="'>"}for(k+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&0===S?U?s:r:"")+(/all|right/.test(C)&&0===S?U?r:s:"")+this._generateMonthYearHeader(e,Z,et,G,Y,S>0||T>0,d,v)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",L=c?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",E=0;7>E;E++)A=(E+l)%7,L+="<th scope='col'"+((E+l+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+h[A]+"'>"+p[A]+"</span></th>";for(k+=L+"</tr></thead><tbody>",O=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,O)),M=(this._getFirstDayOfMonth(et,Z)-l+7)%7,_=Math.ceil((M+O)/7),D=K?this.maxRows>_?this.maxRows:_:_,this.maxRows=D,P=this._daylightSavingAdjust(new Date(et,Z,1-M)),H=0;D>H;H++){for(k+="<tr>",B=c?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(P)+"</td>":"",E=0;7>E;E++)j=m?m.apply(e.input?e.input[0]:null,[P]):[!0,""],F=P.getMonth()!==Z,I=F&&!y||!j[0]||G&&G>P||Y&&P>Y,B+="<td class='"+((E+l+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(P.getTime()===N.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===P.getTime()&&b.getTime()===N.getTime()?" "+this._dayOverClass:"")+(I?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!g?"":" "+j[1]+(P.getTime()===Q.getTime()?" "+this._currentClass:"")+(P.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(F&&!g||!j[2]?"":" title='"+j[2].replace(/'/g,"&#39;")+"'")+(I?"":" data-handler='selectDay' data-event='click' data-month='"+P.getMonth()+"' data-year='"+P.getFullYear()+"'")+">"+(F&&!g?"&#xa0;":I?"<span class='ui-state-default'>"+P.getDate()+"</span>":"<a class='ui-state-default"+(P.getTime()===R.getTime()?" ui-state-highlight":"")+(P.getTime()===Q.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+P.getDate()+"</a>")+"</td>",P.setDate(P.getDate()+1),P=this._daylightSavingAdjust(P);k+=B+"</tr>"}Z++,Z>11&&(Z=0,et++),k+="</tbody></table>"+(K?"</div>"+(V[0]>0&&T===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=k}w+=x}return w+=f,e._keyEvent=!1,w},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m=this._get(e,"changeMonth"),g=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",w="";if(s||!m)w+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(a=r&&r.getFullYear()===n,f=i&&i.getFullYear()===n,w+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",l=0;12>l;l++)(!a||l>=r.getMonth())&&(!f||i.getMonth()>=l)&&(w+="<option value='"+l+"'"+(l===t?" selected='selected'":"")+">"+u[l]+"</option>");w+="</select>"}if(y||(b+=w+(!s&&m&&g?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",s||!g)b+="<span class='ui-datepicker-year'>"+n+"</span>";else{for(c=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?n+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);return isNaN(t)?h:t},d=p(c[0]),v=Math.max(d,p(c[1]||"")),d=r?Math.max(d,r.getFullYear()):d,v=i?Math.min(v,i.getFullYear()):v,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";v>=d;d++)e.yearshtml+="<option value='"+d+"'"+(d===n?" selected='selected'":"")+">"+d+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!s&&m&&g?"":"&#xa0;")+w),b+="</div>"},_adjustInstDate:function(e,t,n){var r=e.drawYear+("Y"===n?t:0),i=e.drawMonth+("M"===n?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+("D"===n?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===n||"Y"===n)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&n>t?n:t;return r&&i>r?r:i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(0>t?t:i[0]*i[1]),1));return 0>t&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n,r,i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),o=null,u=null,a=this._get(e,"yearRange");return a&&(n=a.split(":"),r=(new Date).getFullYear(),o=parseInt(n[0],10),u=parseInt(n[1],10),n[0].match(/[+\-].*/)&&(o+=r),n[1].match(/[+\-].*/)&&(u+=r)),(!i||t.getTime()>=i.getTime())&&(!s||t.getTime()<=s.getTime())&&(!o||t.getFullYear()>=o)&&(!u||u>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var n=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(n)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.3",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var n=this.options;return this._blurActiveElement(t),this.helper||n.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(n.iframeFix===!0?"iframe":n.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var n=this.document[0];if(this.handleElement.is(t.target))try{n.activeElement&&"body"!==n.activeElement.nodeName.toLowerCase()&&e(n.activeElement).blur()}catch(r){}},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,n){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=this,r=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(r=e.ui.ddmanager.drop(this,t)),this.dropped&&(r=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!r||"valid"===this.options.revert&&r||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){n._trigger("stop",t)!==!1&&n._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper),i=r?e(n.helper.apply(this.element[0],[t])):"clone"===n.helper?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo("parent"===n.appendTo?this.element[0].parentNode:n.appendTo),r&&i[0]===this.element[0]&&this._setPositionRelative(),i[0]===this.element[0]||/(fixed|absolute)/.test(i.css("position"))||i.css("position","absolute"),i},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),n=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==n&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,r,i=this.options,s=this.document[0];return this.relativeContainer=null,i.containment?"window"===i.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===i.containment?(this.containment=[0,0,e(s).width()-this.helperProportions.width-this.margins.left,(e(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):i.containment.constructor===Array?(this.containment=i.containment,void 0):("parent"===i.containment&&(i.containment=this.helper[0].parentNode),n=e(i.containment),r=n[0],r&&(t=/(scroll|auto)/.test(n.css("overflow")),this.containment=[(parseInt(n.css("borderLeftWidth"),10)||0)+(parseInt(n.css("paddingLeft"),10)||0),(parseInt(n.css("borderTopWidth"),10)||0)+(parseInt(n.css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(n.css("borderRightWidth"),10)||0)-(parseInt(n.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(n.css("borderBottomWidth"),10)||0)-(parseInt(n.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=n),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var n="absolute"===e?1:-1,r=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top)*n,left:t.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)*n}},_generatePosition:function(e,t){var n,r,i,s,o=this.options,u=this._isRootNode(this.scrollParent[0]),a=e.pageX,f=e.pageY;return u&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(r=this.relativeContainer.offset(),n=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):n=this.containment,e.pageX-this.offset.click.left<n[0]&&(a=n[0]+this.offset.click.left),e.pageY-this.offset.click.top<n[1]&&(f=n[1]+this.offset.click.top),e.pageX-this.offset.click.left>n[2]&&(a=n[2]+this.offset.click.left),e.pageY-this.offset.click.top>n[3]&&(f=n[3]+this.offset.click.top)),o.grid&&(i=o.grid[1]?this.originalPageY+Math.round((f-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,f=n?i-this.offset.click.top>=n[1]||i-this.offset.click.top>n[3]?i:i-this.offset.click.top>=n[1]?i-o.grid[1]:i+o.grid[1]:i,s=o.grid[0]?this.originalPageX+Math.round((a-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,a=n?s-this.offset.click.left>=n[0]||s-this.offset.click.left>n[2]?s:s-this.offset.click.left>=n[0]?s-o.grid[0]:s+o.grid[0]:s),"y"===o.axis&&(a=this.originalPageX),"x"===o.axis&&(f=this.originalPageY)),{top:f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:u?0:this.offset.scroll.top),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:u?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),r.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n,r){var i=e.extend({},n,{item:r.element});r.sortables=[],e(r.options.connectToSortable).each(function(){var n=e(this).sortable("instance");n&&!n.options.disabled&&(r.sortables.push(n),n.refreshPositions(),n._trigger("activate",t,i))})},stop:function(t,n,r){var i=e.extend({},n,{item:r.element});r.cancelHelperRemoval=!1,e.each(r.sortables,function(){var e=this;e.isOver?(e.isOver=0,r.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,i))})},drag:function(t,n,r){e.each(r.sortables,function(){var i=!1,s=this;s.positionAbs=r.positionAbs,s.helperProportions=r.helperProportions,s.offset.click=r.offset.click,s._intersectsWith(s.containerCache)&&(i=!0,e.each(r.sortables,function(){return this.positionAbs=r.positionAbs,this.helperProportions=r.helperProportions,this.offset.click=r.offset.click,this!==s&&this._intersectsWith(this.containerCache)&&e.contains(s.element[0],this.element[0])&&(i=!1),i})),i?(s.isOver||(s.isOver=1,s.currentItem=n.helper.appendTo(s.element).data("ui-sortable-item",!0),s.options._helper=s.options.helper,s.options.helper=function(){return n.helper[0]},t.target=s.currentItem[0],s._mouseCapture(t,!0),s._mouseStart(t,!0,!0),s.offset.click.top=r.offset.click.top,s.offset.click.left=r.offset.click.left,s.offset.parent.left-=r.offset.parent.left-s.offset.parent.left,s.offset.parent.top-=r.offset.parent.top-s.offset.parent.top,r._trigger("toSortable",t),r.dropped=s.element,e.each(r.sortables,function(){this.refreshPositions()}),r.currentItem=r.element,s.fromOutside=r),s.currentItem&&(s._mouseDrag(t),n.position=s.position)):s.isOver&&(s.isOver=0,s.cancelHelperRemoval=!0,s.options._revert=s.options.revert,s.options.revert=!1,s._trigger("out",t,s._uiHash(s)),s._mouseStop(t,!0),s.options.revert=s.options._revert,s.options.helper=s.options._helper,s.placeholder&&s.placeholder.remove(),r._refreshOffsets(t),n.position=r._generatePosition(t,!0),r._trigger("fromSortable",t),r.dropped=!1,e.each(r.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n,r){var i=e("body"),s=r.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,n,r){var i=r.options;i._cursor&&e("body").css("cursor",i._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("opacity")&&(s._opacity=i.css("opacity")),i.css("opacity",s.opacity)},stop:function(t,n,r){var i=r.options;i._opacity&&e(n.helper).css("opacity",i._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&"HTML"!==n.scrollParentNotHidden[0].tagName&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(t,n,r){var i=r.options,s=!1,o=r.scrollParentNotHidden[0],u=r.document[0];o!==u&&"HTML"!==o.tagName?(i.axis&&"x"===i.axis||(r.overflowOffset.top+o.offsetHeight-t.pageY<i.scrollSensitivity?o.scrollTop=s=o.scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(o.scrollTop=s=o.scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(r.overflowOffset.left+o.offsetWidth-t.pageX<i.scrollSensitivity?o.scrollLeft=s=o.scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(o.scrollLeft=s=o.scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-e(u).scrollTop()<i.scrollSensitivity?s=e(u).scrollTop(e(u).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(u).scrollTop())<i.scrollSensitivity&&(s=e(u).scrollTop(e(u).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-e(u).scrollLeft()<i.scrollSensitivity?s=e(u).scrollLeft(e(u).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(u).scrollLeft())<i.scrollSensitivity&&(s=e(u).scrollLeft(e(u).scrollLeft()+i.scrollSpeed)))),s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n,r){var i=r.options;r.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!==r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n,r){var i,s,o,u,a,f,l,c,h,p,d=r.options,v=d.snapTolerance,m=n.offset.left,g=m+r.helperProportions.width,y=n.offset.top,b=y+r.helperProportions.height;for(h=r.snapElements.length-1;h>=0;h--)a=r.snapElements[h].left-r.margins.left,f=a+r.snapElements[h].width,l=r.snapElements[h].top-r.margins.top,c=l+r.snapElements[h].height,a-v>g||m>f+v||l-v>b||y>c+v||!e.contains(r.snapElements[h].item.ownerDocument,r.snapElements[h].item)?(r.snapElements[h].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=!1):("inner"!==d.snapMode&&(i=v>=Math.abs(l-b),s=v>=Math.abs(c-y),o=v>=Math.abs(a-g),u=v>=Math.abs(f-m),i&&(n.position.top=r._convertPositionTo("relative",{top:l-r.helperProportions.height,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a-r.helperProportions.width}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f}).left)),p=i||s||o||u,"outer"!==d.snapMode&&(i=v>=Math.abs(l-y),s=v>=Math.abs(c-b),o=v>=Math.abs(a-m),u=v>=Math.abs(f-g),i&&(n.position.top=r._convertPositionTo("relative",{top:l,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c-r.helperProportions.height,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f-r.helperProportions.width}).left)),!r.snapElements[h].snapping&&(i||s||o||u||p)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=i||s||o||u||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,n,r){var i,s=r.options,o=e.makeArray(e(s.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});o.length&&(i=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",i+t)}),this.css("zIndex",i+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("zIndex")&&(s._zIndex=i.css("zIndex")),i.css("zIndex",s.zIndex)},stop:function(t,n,r){var i=r.options;i._zIndex&&e(n.helper).css("zIndex",i._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,n){if("hidden"===e(t).css("overflow"))return!1;var r=n&&"left"===n?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},_create:function(){var t,n,r,i,s,o=this,u=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!u.aspectRatio,aspectRatio:u.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:u.helper||u.ghost||u.animate?u.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=u.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},n=0;t.length>n;n++)r=e.trim(t[n]),s="ui-resizable-"+r,i=e("<div class='ui-resizable-handle "+s+"'></div>"),i.css({zIndex:u.zIndex}),"se"===r&&i.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[r]=".ui-resizable-"+r,this.element.append(i);this._renderAxis=function(t){var n,r,i,s;t=t||this.element;for(n in this.handles)this.handles[n].constructor===String&&(this.handles[n]=this.element.children(this.handles[n]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(r=e(this.handles[n],this.element),s=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth(),i=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),e(this.handles[n]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=i&&i[1]?i[1]:"se")}),u.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){u.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){u.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,n=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(n(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),n(this.originalElement),this},_mouseCapture:function(t){var n,r,i=!1;for(n in this.handles)r=e(this.handles[n])[0],(r===t.target||e.contains(r,t.target))&&(i=!0);return!this.options.disabled&&i},_mouseStart:function(t){var n,r,i,s=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),n=this._num(this.helper.css("left")),r=this._num(this.helper.css("top")),s.containment&&(n+=e(s.containment).scrollLeft()||0,r+=e(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:r},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:n,top:r},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,i=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===i?this.axis+"-resize":i),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var n,r,i=this.originalMousePosition,s=this.axis,o=t.pageX-i.left||0,u=t.pageY-i.top||0,a=this._change[s];return this._updatePrevProperties(),a?(n=a.apply(this,[t,o,u]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(n=this._updateRatio(n,t)),n=this._respectSize(n,t),this._updateCache(n),this._propagate("resize",t),r=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var n,r,i,s,o,u,a,f=this.options,l=this;return this._helper&&(n=this._proportionallyResizeElements,r=n.length&&/textarea/i.test(n[0].nodeName),i=r&&this._hasScroll(n[0],"left")?0:l.sizeDiff.height,s=r?0:l.sizeDiff.width,o={width:l.helper.width()-s,height:l.helper.height()-i},u=parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left)||null,a=parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top)||null,f.animate||this.element.css(e.extend(o,{top:a,left:u})),l.helper.height(l.size.height),l.helper.width(l.size.width),this._helper&&!f.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,n,r,i,s,o=this.options;s={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=s.minHeight*this.aspectRatio,r=s.minWidth/this.aspectRatio,n=s.maxHeight*this.aspectRatio,i=s.maxWidth/this.aspectRatio,t>s.minWidth&&(s.minWidth=t),r>s.minHeight&&(s.minHeight=r),s.maxWidth>n&&(s.maxWidth=n),s.maxHeight>i&&(s.maxHeight=i)),this._vBoundaries=s},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,n=this.size,r=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===r&&(e.left=t.left+(n.width-e.width),e.top=null),"nw"===r&&(e.top=t.top+(n.height-e.height),e.left=t.left+(n.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,n=this.axis,r=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,i=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,s=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,u=this.originalPosition.left+this.originalSize.width,a=this.position.top+this.size.height,f=/sw|nw|w/.test(n),l=/nw|ne|n/.test(n);return s&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),i&&(e.height=t.maxHeight),s&&f&&(e.left=u-t.minWidth),r&&f&&(e.left=u-t.maxWidth),o&&l&&(e.top=a-t.minHeight),i&&l&&(e.top=a-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,n=[],r=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],i=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)n[t]=parseInt(r[t],10)||0,n[t]+=parseInt(i[t],10)||0;return{height:n[0]+n[2],width:n[1]+n[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,n=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:n.height()-this.outerDimensions.height||0,width:n.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var n=this.originalSize,r=this.originalPosition;return{left:r.left+t,width:n.width-t}},n:function(e,t,n){var r=this.originalSize,i=this.originalPosition;return{top:i.top+n,height:r.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),"resize"!==t&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var n=e(this).resizable("instance"),r=n.options,i=n._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&n._hasScroll(i[0],"left")?0:n.sizeDiff.height,u=s?0:n.sizeDiff.width,a={width:n.size.width-u,height:n.size.height-o},f=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,l=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(a,l&&f?{top:l,left:f}:{}),{duration:r.animateDuration,easing:r.animateEasing,step:function(){var r={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};i&&i.length&&e(i[0]).css({width:r.width,height:r.height}),n._updateCache(r),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,n,r,i,s,o,u,a=e(this).resizable("instance"),f=a.options,l=a.element,c=f.containment,h=c instanceof e?c.get(0):/parent/.test(c)?l.parent().get(0):c;h&&(a.containerElement=e(h),/document/.test(c)||c===document?(a.containerOffset={left:0,top:0},a.containerPosition={left:0,top:0},a.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(h),n=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){n[e]=a._num(t.css("padding"+r))}),a.containerOffset=t.offset(),a.containerPosition=t.position(),a.containerSize={height:t.innerHeight()-n[3],width:t.innerWidth()-n[1]},r=a.containerOffset,i=a.containerSize.height,s=a.containerSize.width,o=a._hasScroll(h,"left")?h.scrollWidth:s,u=a._hasScroll(h)?h.scrollHeight:i,a.parentData={element:h,left:r.left,top:r.top,width:o,height:u}))},resize:function(t){var n,r,i,s,o=e(this).resizable("instance"),u=o.options,a=o.containerOffset,f=o.position,l=o._aspectRatio||t.shiftKey,c={top:0,left:0},h=o.containerElement,p=!0;h[0]!==document&&/static/.test(h.css("position"))&&(c=a),f.left<(o._helper?a.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-a.left:o.position.left-c.left),l&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=u.helper?a.left:0),f.top<(o._helper?a.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-a.top:o.position.top),l&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?a.top:0),i=o.containerElement.get(0)===o.element.parent().get(0),s=/relative|absolute/.test(o.containerElement.css("position")),i&&s?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),n=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-c.left:o.offset.left-a.left)),r=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-c.top:o.offset.top-a.top)),n+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-n,l&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),r+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-r,l&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),n=t.options,r=t.containerOffset,i=t.containerPosition,s=t.containerElement,o=e(t.helper),u=o.offset(),a=o.outerWidth()-t.sizeDiff.width,f=o.outerHeight()-t.sizeDiff.height;t._helper&&!n.animate&&/relative/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f}),t._helper&&!n.animate&&/static/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),n=t.options,r=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof n.alsoResize||n.alsoResize.parentNode?r(n.alsoResize):n.alsoResize.length?(n.alsoResize=n.alsoResize[0],r(n.alsoResize)):e.each(n.alsoResize,function(e){r(e)})},resize:function(t,n){var r=e(this).resizable("instance"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0},a=function(t,r){e(t).each(function(){var t=e(this),i=e(this).data("ui-resizable-alsoresize"),s={},o=r&&r.length?r:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var n=(i[t]||0)+(u[t]||0);n&&n>=0&&(s[t]=n||null)}),t.css(s)})};"object"!=typeof i.alsoResize||i.alsoResize.nodeType?a(i.alsoResize):e.each(i.alsoResize,function(e,t){a(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),n=t.options,r=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:r.height,width:r.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof n.ghost?n.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,n=e(this).resizable("instance"),r=n.options,i=n.size,s=n.originalSize,o=n.originalPosition,u=n.axis,a="number"==typeof r.grid?[r.grid,r.grid]:r.grid,f=a[0]||1,l=a[1]||1,c=Math.round((i.width-s.width)/f)*f,h=Math.round((i.height-s.height)/l)*l,p=s.width+c,d=s.height+h,v=r.maxWidth&&p>r.maxWidth,m=r.maxHeight&&d>r.maxHeight,g=r.minWidth&&r.minWidth>p,y=r.minHeight&&r.minHeight>d;r.grid=a,g&&(p+=f),y&&(d+=l),v&&(p-=f),m&&(d-=l),/^(se|s|e)$/.test(u)?(n.size.width=p,n.size.height=d):/^(ne)$/.test(u)?(n.size.width=p,n.size.height=d,n.position.top=o.top-h):/^(sw)$/.test(u)?(n.size.width=p,n.size.height=d,n.position.left=o.left-c):((0>=d-l||0>=p-f)&&(t=n._getPaddingPlusBorderDimensions(this)),d-l>0?(n.size.height=d,n.position.top=o.top-h):(d=l-t.height,n.size.height=d,n.position.top=o.top+s.height-d),p-f>0?(n.size.width=p,n.position.left=o.left-c):(p=f-t.width,n.size.width=p,n.position.left=o.left+s.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var n=e(this).css(t).offset().top;0>n&&e(this).css("top",t.top-n)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var n,r=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{n=this.document[0].activeElement,n&&"body"!==n.nodeName.toLowerCase()&&e(n).blur()}catch(i){}this._hide(this.uiDialog,this.options.hide,function(){r._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,n){var r=!1,i=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),s=Math.max.apply(null,i);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),r=!0),r&&!n&&this._trigger("focus",t),r},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function n(){var t=this.document[0].activeElement,n=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);n||this._focusTabbable()}t.preventDefault(),n.call(this),this._delay(n)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var n=this.uiDialog.find(":tabbable"),r=n.filter(":first"),i=n.filter(":last");t.target!==i[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==r[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){i.focus()}),t.preventDefault()):(this._delay(function(){r.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,n=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(n)||e.isArray(n)&&!n.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(n,function(n,r){var i,s;r=e.isFunction(r)?{click:r,text:n}:r,r=e.extend({type:"button"},r),i=r.click,r.click=function(){i.apply(t.element[0],arguments)},s={icons:r.icons,text:r.showText},delete r.icons,delete r.showText,e("<button></button>",r).button(s).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var n=this,r=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(r,i){e(this).addClass("ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",r,t(i))},drag:function(e,r){n._trigger("drag",e,t(r))},stop:function(i,s){var o=s.offset.left-n.document.scrollLeft(),u=s.offset.top-n.document.scrollTop();r.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(u>=0?"+":"")+u,of:n.window},e(this).removeClass("ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",i,t(s))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var n=this,r=this.options,i=r.resizable,s=this.uiDialog.css("position"),o="string"==typeof i?i:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:r.maxWidth,maxHeight:r.maxHeight,minWidth:r.minWidth,minHeight:this._minHeight(),handles:o,start:function(r,i){e(this).addClass("ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",r,t(i))},resize:function(e,r){n._trigger("resize",e,t(r))},stop:function(i,s){var o=n.uiDialog.offset(),u=o.left-n.document.scrollLeft(),a=o.top-n.document.scrollTop();r.height=n.uiDialog.height(),r.width=n.uiDialog.width(),r.position={my:"left top",at:"left"+(u>=0?"+":"")+u+" "+"top"+(a>=0?"+":"")+a,of:n.window},e(this).removeClass("ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",i,t(s))}}).css("position",s)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),n=e.inArray(this,t);-1!==n&&t.splice(n,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var n=this,r=!1,i={};e.each(t,function(e,t){n._setOption(e,t),e in n.sizeRelatedOptions&&(r=!0),e in n.resizableRelatedOptions&&(i[e]=t)}),r&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",i)},_setOption:function(e,t){var n,r,i=this.uiDialog;"dialogClass"===e&&i.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(n=i.is(":data(ui-draggable)"),n&&!t&&i.draggable("destroy"),!n&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(r=i.is(":data(ui-resizable)"),r&&!t&&i.resizable("destroy"),r&&"string"==typeof t&&i.resizable("option","handles",t),r||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,n,r=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),r.minWidth>r.width&&(r.width=r.minWidth),e=this.uiDialog.css({height:"auto",width:r.width}).outerHeight(),t=Math.max(0,r.minHeight-e),n="number"==typeof r.maxHeight?Math.max(0,r.maxHeight-e):"none","auto"===r.height?this.element.css({minHeight:t,maxHeight:n,height:"auto"}):this.element.height(Math.max(0,r.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,n=this.options,r=n.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(r)?r:function(e){return e.is(r)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(n.scope),n.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){if("accept"===t)this.accept=e.isFunction(n)?n:function(e){return e.is(n)};else if("scope"===t){var r=e.ui.ddmanager.droppables[this.options.scope];this._splice(r),this._addToManager(n)}this._super(t,n)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current,i=!1;return r&&(r.currentItem||r.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var n=e(this).droppable("instance");return n.options.greedy&&!n.options.disabled&&n.options.scope===r.options.scope&&n.accept.call(n.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(n,{offset:n.element.offset()}),n.options.tolerance,t)?(i=!0,!1):void 0}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,n){return e>=t&&t+n>e}return function(t,n,r,i){if(!n.offset)return!1;var s=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,u=s+t.helperProportions.width,a=o+t.helperProportions.height,f=n.offset.left,l=n.offset.top,c=f+n.proportions().width,h=l+n.proportions().height;switch(r){case"fit":return s>=f&&c>=u&&o>=l&&h>=a;case"intersect":return s+t.helperProportions.width/2>f&&c>u-t.helperProportions.width/2&&o+t.helperProportions.height/2>l&&h>a-t.helperProportions.height/2;case"pointer":return e(i.pageY,l,n.proportions().height)&&e(i.pageX,f,n.proportions().width);case"touch":return(o>=l&&h>=o||a>=l&&h>=a||l>o&&a>h)&&(s>=f&&c>=s||u>=f&&c>=u||f>s&&u>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r,i,s=e.ui.ddmanager.droppables[t.options.scope]||[],o=n?n.type:null,u=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(r=0;s.length>r;r++)if(!(s[r].options.disabled||t&&!s[r].accept.call(s[r].element[0],t.currentItem||t.element))){for(i=0;u.length>i;i++)if(u[i]===s[r].element[0]){s[r].proportions().height=0;continue e}s[r].visible="none"!==s[r].element.css("display"),s[r].visible&&("mousedown"===o&&s[r]._activate.call(s[r],n),s[r].offset=s[r].element.offset(),s[r].proportions({width:s[r].element[0].offsetWidth,height:s[r].element[0].offsetHeight}))}},drop:function(t,n){var r=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,n)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n)))}),r},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var r,i,s,o=e.ui.intersect(t,this,this.options.tolerance,n),u=!o&&this.isover?"isout":o&&!this.isover?"isover":null;u&&(this.options.greedy&&(i=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===i}),s.length&&(r=e(s[0]).droppable("instance"),r.greedyChild="isover"===u)),r&&"isover"===u&&(r.isover=!1,r.isout=!0,r._out.call(r,n)),this[u]=!0,this["isout"===u?"isover":"isout"]=!1,this["isover"===u?"_over":"_out"].call(this,n),r&&"isout"===u&&(r.isout=!1,r.isover=!0,r._over.call(r,n)))}})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function n(e,t,n){var r=c[t.type]||{};return null==e?n||!t.def?null:t.def:(e=r.floor?~~e:parseFloat(e),isNaN(e)?t.def:r.mod?(e+r.mod)%r.mod:0>e?0:e>r.max?r.max:e)}function r(n){var r=f(),i=r._rgba=[];return n=n.toLowerCase(),d(a,function(e,s){var o,u=s.re.exec(n),a=u&&s.parse(u),f=s.space||"rgba";return a?(o=r[f](a),r[l[f].cache]=o[l[f].cache],i=r._rgba=o._rgba,!1):t}),i.length?("0,0,0,0"===i.join()&&e.extend(i,s.transparent),r):s[n]}function i(e,t,n){return n=(n+1)%1,1>6*n?e+6*(t-e)*n:1>2*n?t:2>3*n?e+6*(t-e)*(2/3-n):e}var s,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",u=/^([\-+])=\s*(\d+\.?\d*)/,a=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],f=e.Color=function(t,n,r,i){return new e.Color.fn.parse(t,n,r,i)},l={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},h=f.support={},p=e("<p>")[0],d=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",h.rgba=p.style.backgroundColor.indexOf("rgba")>-1,d(l,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),f.fn=e.extend(f.prototype,{parse:function(i,o,u,a){if(i===t)return this._rgba=[null,null,null,null],this;(i.jquery||i.nodeType)&&(i=e(i).css(o),o=t);var c=this,h=e.type(i),p=this._rgba=[];return o!==t&&(i=[i,o,u,a],h="array"),"string"===h?this.parse(r(i)||s._default):"array"===h?(d(l.rgba.props,function(e,t){p[t.idx]=n(i[t.idx],t)}),this):"object"===h?(i instanceof f?d(l,function(e,t){i[t.cache]&&(c[t.cache]=i[t.cache].slice())}):d(l,function(t,r){var s=r.cache;d(r.props,function(e,t){if(!c[s]&&r.to){if("alpha"===e||null==i[e])return;c[s]=r.to(c._rgba)}c[s][t.idx]=n(i[e],t,!0)}),c[s]&&0>e.inArray(null,c[s].slice(0,3))&&(c[s][3]=1,r.from&&(c._rgba=r.from(c[s])))}),this):t},is:function(e){var n=f(e),r=!0,i=this;return d(l,function(e,s){var o,u=n[s.cache];return u&&(o=i[s.cache]||s.to&&s.to(i._rgba)||[],d(s.props,function(e,n){return null!=u[n.idx]?r=u[n.idx]===o[n.idx]:t})),r}),r},_space:function(){var e=[],t=this;return d(l,function(n,r){t[r.cache]&&e.push(n)}),e.pop()},transition:function(e,t){var r=f(e),i=r._space(),s=l[i],o=0===this.alpha()?f("transparent"):this,u=o[s.cache]||s.to(o._rgba),a=u.slice();return r=r[s.cache],d(s.props,function(e,i){var s=i.idx,o=u[s],f=r[s],l=c[i.type]||{};null!==f&&(null===o?a[s]=f:(l.mod&&(f-o>l.mod/2?o+=l.mod:o-f>l.mod/2&&(o-=l.mod)),a[s]=n((f-o)*t+o,i)))}),this[i](a)},blend:function(t){if(1===this._rgba[3])return this;var n=this._rgba.slice(),r=n.pop(),i=f(t)._rgba;return f(e.map(n,function(e,t){return(1-r)*i[t]+r*e}))},toRgbaString:function(){var t="rgba(",n=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===n[3]&&(n.pop(),t="rgb("),t+n.join()+")"},toHslaString:function(){var t="hsla(",n=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===n[3]&&(n.pop(),t="hsl("),t+n.join()+")"},toHexString:function(t){var n=this._rgba.slice(),r=n.pop();return t&&n.push(~~(255*r)),"#"+e.map(n,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,l.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,n,r=e[0]/255,i=e[1]/255,s=e[2]/255,o=e[3],u=Math.max(r,i,s),a=Math.min(r,i,s),f=u-a,l=u+a,c=.5*l;return t=a===u?0:r===u?60*(i-s)/f+360:i===u?60*(s-r)/f+120:60*(r-i)/f+240,n=0===f?0:.5>=c?f/l:f/(2-l),[Math.round(t)%360,n,c,null==o?1:o]},l.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,n=e[1],r=e[2],s=e[3],o=.5>=r?r*(1+n):r+n-r*n,u=2*r-o;return[Math.round(255*i(u,o,t+1/3)),Math.round(255*i(u,o,t)),Math.round(255*i(u,o,t-1/3)),s]},d(l,function(r,i){var s=i.props,o=i.cache,a=i.to,l=i.from;f.fn[r]=function(r){if(a&&!this[o]&&(this[o]=a(this._rgba)),r===t)return this[o].slice();var i,u=e.type(r),c="array"===u||"object"===u?r:arguments,h=this[o].slice();return d(s,function(e,t){var r=c["object"===u?e:t.idx];null==r&&(r=h[t.idx]),h[t.idx]=n(r,t)}),l?(i=f(l(h)),i[o]=h,i):f(h)},d(s,function(t,n){f.fn[t]||(f.fn[t]=function(i){var s,o=e.type(i),a="alpha"===t?this._hsla?"hsla":"rgba":r,f=this[a](),l=f[n.idx];return"undefined"===o?l:("function"===o&&(i=i.call(this,l),o=e.type(i)),null==i&&n.empty?this:("string"===o&&(s=u.exec(i),s&&(i=l+parseFloat(s[2])*("+"===s[1]?1:-1))),f[n.idx]=i,this[a](f)))})})}),f.hook=function(t){var n=t.split(" ");d(n,function(t,n){e.cssHooks[n]={set:function(t,i){var s,o,u="";if("transparent"!==i&&("string"!==e.type(i)||(s=r(i)))){if(i=f(s||i),!h.rgba&&1!==i._rgba[3]){for(o="backgroundColor"===n?t.parentNode:t;(""===u||"transparent"===u)&&o&&o.style;)try{u=e.css(o,"backgroundColor"),o=o.parentNode}catch(a){}i=i.blend(u&&"transparent"!==u?u:"_default")}i=i.toRgbaString()}try{t.style[n]=i}catch(a){}}},e.fx.step[n]=function(t){t.colorInit||(t.start=f(t.elem,n),t.end=f(t.end),t.colorInit=!0),e.cssHooks[n].set(t.elem,t.start.transition(t.end,t.pos))}})},f.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return d(["Top","Right","Bottom","Left"],function(n,r){t["border"+r+"Color"]=e}),t}},s=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var n,r,i=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,s={};if(i&&i.length&&i[0]&&i[i[0]])for(r=i.length;r--;)n=i[r],"string"==typeof i[n]&&(s[e.camelCase(n)]=i[n]);else for(n in i)"string"==typeof i[n]&&(s[n]=i[n]);return s}function n(t,n){var r,s,o={};for(r in n)s=n[r],t[r]!==s&&(i[r]||(e.fx.step[r]||!isNaN(parseFloat(s)))&&(o[r]=s));return o}var r=["add","remove","toggle"],i={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,n){e.fx.step[n]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,n,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(i,s,o,u){var a=e.speed(s,o,u);return this.queue(function(){var s,o=e(this),u=o.attr("class")||"",f=a.children?o.find("*").addBack():o;f=f.map(function(){var n=e(this);return{el:n,start:t(this)}}),s=function(){e.each(r,function(e,t){i[t]&&o[t+"Class"](i[t])})},s(),f=f.map(function(){return this.end=t(this.el[0]),this.diff=n(this.start,this.end),this}),o.attr("class",u),f=f.map(function(){var t=this,n=e.Deferred(),r=e.extend({},a,{queue:!1,complete:function(){n.resolve(t)}});return this.el.animate(this.diff,r),n.promise()}),e.when.apply(e,f.get()).done(function(){s(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),a.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(n,r,i,s){return r?e.effects.animateClass.call(this,{add:n},r,i,s):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(n,r,i,s){return arguments.length>1?e.effects.animateClass.call(this,{remove:n},r,i,s):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(n,r,i,s,o){return"boolean"==typeof r||void 0===r?i?e.effects.animateClass.call(this,r?{add:n}:{remove:n},i,s,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:n},r,i,s)}}(e.fn.toggleClass),switchClass:function(t,n,r,i,s){return e.effects.animateClass.call(this,{add:n,remove:t},r,i,s)}})}(),function(){function t(t,n,r,i){return e.isPlainObject(t)&&(n=t,t=t.effect),t={effect:t},null==n&&(n={}),e.isFunction(n)&&(i=n,r=null,n={}),("number"==typeof n||e.fx.speeds[n])&&(i=r,r=n,n={}),e.isFunction(r)&&(i=r,r=null),n&&e.extend(t,n),r=r||n.duration,t.duration=e.fx.off?0:"number"==typeof r?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,t.complete=i||n.complete,t}function n(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.3",save:function(e,t){for(var n=0;t.length>n;n++)null!==t[n]&&e.data(y+t[n],e[0].style[t[n]])},restore:function(e,t){var n,r;for(r=0;t.length>r;r++)null!==t[r]&&(n=e.data(y+t[r]),void 0===n&&(n=""),e.css(t[r],n))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(o){s=document.body}return t.wrap(r),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),r=t.parent(),"static"===t.css("position")?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(i),r.css(n).show()},removeWrapper:function(t){var n=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===n||e.contains(t[0],n))&&e(n).focus()),t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(){function n(t){function n(){e.isFunction(s)&&s.call(i[0]),e.isFunction(t)&&t()}var i=e(this),s=r.complete,u=r.mode;(i.is(":hidden")?"hide"===u:"show"===u)?(i[u](),n()):o.call(i[0],r,n)}var r=t.apply(this,arguments),i=r.mode,s=r.queue,o=e.effects.effect[r.effect];return e.fx.off||!o?i?this[i](r.duration,r.complete):this.each(function(){r.complete&&r.complete.call(this)}):s===!1?this.each(n):this.queue(s||"fx",n)},show:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(r){if(n(r)||"boolean"==typeof r)return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,n){t[n]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,n=4;((t=Math.pow(2,--n))-1)/11>e;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?n(2*e)/2:1-n(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,n){var r,i,s,o=e(this),u=/up|down|vertical/,a=/up|left|vertical|horizontal/,f=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(o,t.mode||"hide"),c=t.direction||"up",h=u.test(c),p=h?"height":"width",d=h?"top":"left",v=a.test(c),m={},g="show"===l;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),f):e.effects.save(o,f),o.show(),r=e.effects.createWrapper(o).css({overflow:"hidden"}),i=r[p](),s=parseFloat(r.css(d))||0,m[p]=g?i:0,v||(o.css(h?"bottom":"right",0).css(h?"top":"left","auto").css({position:"absolute"}),m[d]=g?s:i+s),g&&(r.css(p,0),v||r.css(d,s+i)),r.animate(m,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===l&&o.hide(),e.effects.restore(o,f),e.effects.removeWrapper(o),n()}})},e.effects.effect.bounce=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(o,t.mode||"effect"),f="hide"===a,l="show"===a,c=t.direction||"up",h=t.distance,p=t.times||5,d=2*p+(l||f?1:0),v=t.duration/d,m=t.easing,g="up"===c||"down"===c?"top":"left",y="up"===c||"left"===c,b=o.queue(),w=b.length;for((l||f)&&u.push("opacity"),e.effects.save(o,u),o.show(),e.effects.createWrapper(o),h||(h=o["top"===g?"outerHeight":"outerWidth"]()/3),l&&(s={opacity:1},s[g]=0,o.css("opacity",0).css(g,y?2*-h:2*h).animate(s,v,m)),f&&(h/=Math.pow(2,p-1)),s={},s[g]=0,r=0;p>r;r++)i={},i[g]=(y?"-=":"+=")+h,o.animate(i,v,m).animate(s,v,m),h=f?2*h:h/2;f&&(i={opacity:0},i[g]=(y?"-=":"+=")+h,o.animate(i,v,m)),o.queue(function(){f&&o.hide(),e.effects.restore(o,u),e.effects.removeWrapper(o),n()}),w>1&&b.splice.apply(b,[1,0].concat(b.splice(w,d+1))),o.dequeue()},e.effects.effect.clip=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(o,t.mode||"hide"),f="show"===a,l=t.direction||"vertical",c="vertical"===l,h=c?"height":"width",p=c?"top":"left",d={};e.effects.save(o,u),o.show(),r=e.effects.createWrapper(o).css({overflow:"hidden"}),i="IMG"===o[0].tagName?r:o,s=i[h](),f&&(i.css(h,0),i.css(p,s/2)),d[h]=f?s:0,d[p]=f?0:s/2,i.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){f||o.hide(),e.effects.restore(o,u),e.effects.removeWrapper(o),n()}})},e.effects.effect.drop=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(i,t.mode||"hide"),u="show"===o,a=t.direction||"left",f="up"===a||"down"===a?"top":"left",l="up"===a||"left"===a?"pos":"neg",c={opacity:u?1:0};e.effects.save(i,s),i.show(),e.effects.createWrapper(i),r=t.distance||i["top"===f?"outerHeight":"outerWidth"](!0)/2,u&&i.css("opacity",0).css(f,"pos"===l?-r:r),c[f]=(u?"pos"===l?"+=":"-=":"pos"===l?"-=":"+=")+r,i.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}})},e.effects.effect.explode=function(t,n){function r(){b.push(this),b.length===c*h&&i()}function i(){p.css({visibility:"visible"}),e(b).remove(),v||p.hide(),n()}var s,o,u,a,f,l,c=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=c,p=e(this),d=e.effects.setMode(p,t.mode||"hide"),v="show"===d,m=p.show().css("visibility","hidden").offset(),g=Math.ceil(p.outerWidth()/h),y=Math.ceil(p.outerHeight()/c),b=[];for(s=0;c>s;s++)for(a=m.top+s*y,l=s-(c-1)/2,o=0;h>o;o++)u=m.left+o*g,f=o-(h-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*g,top:-s*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g,height:y,left:u+(v?f*g:0),top:a+(v?l*y:0),opacity:v?0:1}).animate({left:u+(v?0:f*g),top:a+(v?0:l*y),opacity:v?1:0},t.duration||500,t.easing,r)},e.effects.effect.fade=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"toggle");r.animate({opacity:i},{queue:!1,duration:t.duration,easing:t.easing,complete:n})},e.effects.effect.fold=function(t,n){var r,i,s=e(this),o=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(s,t.mode||"hide"),a="show"===u,f="hide"===u,l=t.size||15,c=/([0-9]+)%/.exec(l),h=!!t.horizFirst,p=a!==h,d=p?["width","height"]:["height","width"],v=t.duration/2,m={},g={};e.effects.save(s,o),s.show(),r=e.effects.createWrapper(s).css({overflow:"hidden"}),i=p?[r.width(),r.height()]:[r.height(),r.width()],c&&(l=parseInt(c[1],10)/100*i[f?0:1]),a&&r.css(h?{height:0,width:l}:{height:l,width:0}),m[d[0]]=a?i[0]:l,g[d[1]]=a?i[1]:0,r.animate(m,v,t.easing).animate(g,v,t.easing,function(){f&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),n()})},e.effects.effect.highlight=function(t,n){var r=e(this),i=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(r,t.mode||"show"),o={backgroundColor:r.css("backgroundColor")};"hide"===s&&(o.opacity=0),e.effects.save(r,i),r.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&r.hide(),e.effects.restore(r,i),n()}})},e.effects.effect.size=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","width","height","overflow","opacity"],a=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],l=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),d=t.restore||"effect"!==p,v=t.scale||"both",m=t.origin||["middle","center"],g=o.css("position"),y=d?u:a,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),r={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||r):(o.from=t.from||("show"===p?b:r),o.to=t.to||("hide"===p?b:r)),s={from:{y:o.from.height/r.height,x:o.from.width/r.width},to:{y:o.to.height/r.height,x:o.to.width/r.width}},("box"===v||"both"===v)&&(s.from.y!==s.to.y&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,s.from.y,o.from),o.to=e.effects.setTransition(o,c,s.to.y,o.to)),s.from.x!==s.to.x&&(y=y.concat(h),o.from=e.effects.setTransition(o,h,s.from.x,o.from),o.to=e.effects.setTransition(o,h,s.to.x,o.to))),("content"===v||"both"===v)&&s.from.y!==s.to.y&&(y=y.concat(l).concat(f),o.from=e.effects.setTransition(o,l,s.from.y,o.from),o.to=e.effects.setTransition(o,l,s.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(i=e.effects.getBaseline(m,r),o.from.top=(r.outerHeight-o.outerHeight())*i.y,o.from.left=(r.outerWidth-o.outerWidth())*i.x,o.to.top=(r.outerHeight-o.to.outerHeight)*i.y,o.to.left=(r.outerWidth-o.to.outerWidth)*i.x),o.css(o.from),("content"===v||"both"===v)&&(c=c.concat(["marginTop","marginBottom"]).concat(l),h=h.concat(["marginLeft","marginRight"]),f=u.concat(c).concat(h),o.find("*[width]").each(function(){var n=e(this),r={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};d&&e.effects.save(n,f),n.from={height:r.height*s.from.y,width:r.width*s.from.x,outerHeight:r.outerHeight*s.from.y,outerWidth:r.outerWidth*s.from.x},n.to={height:r.height*s.to.y,width:r.width*s.to.x,outerHeight:r.height*s.to.y,outerWidth:r.width*s.to.x},s.from.y!==s.to.y&&(n.from=e.effects.setTransition(n,c,s.from.y,n.from),n.to=e.effects.setTransition(n,c,s.to.y,n.to)),s.from.x!==s.to.x&&(n.from=e.effects.setTransition(n,h,s.from.x,n.from),n.to=e.effects.setTransition(n,h,s.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){d&&e.effects.restore(n,f)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),d||("static"===g?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,n){var r=parseInt(n,10),i=e?o.to.left:o.to.top;return"auto"===n?i+"px":r+i+"px"})})),e.effects.removeWrapper(o),n()}})},e.effects.effect.scale=function(t,n){var r=e(this),i=e.extend(!0,{},t),s=e.effects.setMode(r,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===s?0:100),u=t.direction||"both",a=t.origin,f={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},l={y:"horizontal"!==u?o/100:1,x:"vertical"!==u?o/100:1};i.effect="size",i.queue=!1,i.complete=n,"effect"!==s&&(i.origin=a||["middle","center"],i.restore=!0),i.from=t.from||("show"===s?{height:0,width:0,outerHeight:0,outerWidth:0}:f),i.to={height:f.height*l.y,width:f.width*l.x,outerHeight:f.outerHeight*l.y,outerWidth:f.outerWidth*l.x},i.fade&&("show"===s&&(i.from.opacity=0,i.to.opacity=1),"hide"===s&&(i.from.opacity=1,i.to.opacity=0)),r.effect(i)},e.effects.effect.puff=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"hide"),s="hide"===i,o=parseInt(t.percent,10)||150,u=o/100,a={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:i,complete:n,percent:s?o:100,from:s?a:{height:a.height*u,width:a.width*u,outerHeight:a.outerHeight*u,outerWidth:a.outerWidth*u}}),r.effect(t)},e.effects.effect.pulsate=function(t,n){var r,i=e(this),s=e.effects.setMode(i,t.mode||"show"),o="show"===s,u="hide"===s,a=o||"hide"===s,f=2*(t.times||5)+(a?1:0),l=t.duration/f,c=0,h=i.queue(),p=h.length;for((o||!i.is(":visible"))&&(i.css("opacity",0).show(),c=1),r=1;f>r;r++)i.animate({opacity:c},l,t.easing),c=1-c;i.animate({opacity:c},l,t.easing),i.queue(function(){u&&i.hide(),n()}),p>1&&h.splice.apply(h,[1,0].concat(h.splice(p,f+1))),i.dequeue()},e.effects.effect.shake=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(i,t.mode||"effect"),u=t.direction||"left",a=t.distance||20,f=t.times||3,l=2*f+1,c=Math.round(t.duration/l),h="up"===u||"down"===u?"top":"left",p="up"===u||"left"===u,d={},v={},m={},g=i.queue(),y=g.length;for(e.effects.save(i,s),i.show(),e.effects.createWrapper(i),d[h]=(p?"-=":"+=")+a,v[h]=(p?"+=":"-=")+2*a,m[h]=(p?"-=":"+=")+2*a,i.animate(d,c,t.easing),r=1;f>r;r++)i.animate(v,c,t.easing).animate(m,c,t.easing);i.animate(v,c,t.easing).animate(d,c/2,t.easing).queue(function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}),y>1&&g.splice.apply(g,[1,0].concat(g.splice(y,l+1))),i.dequeue()},e.effects.effect.slide=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(i,t.mode||"show"),u="show"===o,a=t.direction||"left",f="up"===a||"down"===a?"top":"left",l="up"===a||"left"===a,c={};e.effects.save(i,s),i.show(),r=t.distance||i["top"===f?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(i).css({overflow:"hidden"}),u&&i.css(f,l?isNaN(r)?"-"+r:-r:r),c[f]=(u?l?"+=":"-=":l?"-=":"+=")+r,i.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}})},e.effects.effect.transfer=function(t,n){var r=e(this),i=e(t.to),s="fixed"===i.css("position"),o=e("body"),u=s?o.scrollTop():0,a=s?o.scrollLeft():0,f=i.offset(),l={top:f.top-u,left:f.left-a,height:i.innerHeight(),width:i.innerWidth()},c=r.offset(),h=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:c.top-u,left:c.left-a,height:r.innerHeight(),width:r.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){h.remove(),n()})},e.widget("ui.progressbar",{version:"1.11.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,n=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(n.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,n=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(n.options.filter,n.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this,r=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,t.metaKey||t.ctrlKey||(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().addBack().each(function(){var r,i=e.data(this,"selectable-item");return i?(r=!t.metaKey&&!t.ctrlKey||!i.$element.hasClass("ui-selected"),i.$element.removeClass(r?"ui-unselecting":"ui-selected").addClass(r?"ui-selecting":"ui-unselecting"),i.unselecting=!r,i.selecting=r,i.selected=r,r?n._trigger("selecting",t,{selecting:i.element}):n._trigger("unselecting",t,{unselecting:i.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var n,r=this,i=this.options,s=this.opos[0],o=this.opos[1],u=t.pageX,a=t.pageY;return s>u&&(n=u,u=s,s=n),o>a&&(n=a,a=o,o=n),this.helper.css({left:s,top:o,width:u-s,height:a-o}),this.selectees.each(function(){var n=e.data(this,"selectable-item"),f=!1;n&&n.element!==r.element[0]&&("touch"===i.tolerance?f=!(n.left>u||s>n.right||n.top>a||o>n.bottom):"fit"===i.tolerance&&(f=n.left>s&&u>n.right&&n.top>o&&a>n.bottom),f?(n.selected&&(n.$element.removeClass("ui-selected"),n.selected=!1),n.unselecting&&(n.$element.removeClass("ui-unselecting"),n.unselecting=!1),n.selecting||(n.$element.addClass("ui-selecting"),n.selecting=!0,r._trigger("selecting",t,{selecting:n.element}))):(n.selecting&&((t.metaKey||t.ctrlKey)&&n.startselected?(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.$element.addClass("ui-selected"),n.selected=!0):(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.startselected&&(n.$element.addClass("ui-unselecting"),n.unselecting=!0),r._trigger("unselecting",t,{unselecting:n.element}))),n.selected&&(t.metaKey||t.ctrlKey||n.startselected||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,r._trigger("unselecting",t,{unselecting:n.element})))))}),!1}},_mouseStop:function(t){var n=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.3",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,n){e.preventDefault(),t._setSelection(),t._select(n.item.data("ui-selectmenu-item"),e)},focus:function(e,n){var r=n.item.data("ui-selectmenu-item");null!=t.focusIndex&&r.index!==t.focusIndex&&(t._trigger("focus",e,{item:r}),t.isOpen||t._select(r,e)),t.focusIndex=r.index,t.button.attr("aria-activedescendant",t.menuItems.eq(r.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,n){var r=this,i="";e.each(n,function(n,s){s.optgroup!==i&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(s.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:s.optgroup}).appendTo(t),i=s.optgroup),r._renderItemData(t,s)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,n){var r=e("<li>");return n.disabled&&r.addClass("ui-state-disabled"),this._setText(r,n.label),r.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var n,r,i=".ui-menu-item";this.isOpen?n=this.menuItems.eq(this.focusIndex):(n=this.menuItems.eq(this.element[0].selectedIndex),i+=":not(.ui-state-disabled)"),r="first"===e||"last"===e?n["first"===e?"prevAll":"nextAll"](i).eq(-1):n[e+"All"](i).eq(0),r.length&&this.menuInstance.focus(t,r)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var n=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),n=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),n=!1}n&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var n=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==n&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var n=[];t.each(function(t,r){var i=e(r),s=i.parent("optgroup");n.push({element:i,index:t,value:i.val(),label:i.text(),optgroup:s.attr("label")||"",disabled:s.prop("disabled")||i.prop("disabled")})}),this.items=n},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,n,r=this.options,i=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),s="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(n=r.values&&r.values.length||1,i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;n>t;t++)o.push(s);this.handles=i.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,n="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),n="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(n+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var n,r,i,s,o,u,a,f,l=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),n={x:t.pageX,y:t.pageY},r=this._normValueFromMouse(n),i=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var n=Math.abs(r-l.values(t));(i>n||i===n&&(t===l._lastChangedValue||l.values(t)===c.min))&&(i=n,s=e(this),o=t)}),u=this._start(t,o),u===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),a=s.offset(),f=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=f?{left:0,top:0}:{left:t.pageX-a.left-s.width()/2,top:t.pageY-a.top-s.height()/2-(parseInt(s.css("borderTopWidth"),10)||0)-(parseInt(s.css("borderBottomWidth"),10)||0)+(parseInt(s.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return"horizontal"===this.orientation?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),0>r&&(r=0),"vertical"===this.orientation&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&n>r||1===t&&r>n)&&(n=r),n!==this.values(t)&&(i=this.values(),i[t]=n,s=this._trigger("slide",e,{handle:this.handles[t],value:n,values:i}),r=this.values(t?0:1),s!==!1&&this.values(t,n))):n!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:n}),s!==!1&&this.value(n))},_stop:function(e,t){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("stop",e,n)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,n)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,n){var r,i,s;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(r=this.options.values,i=arguments[0],s=0;r.length>s;s+=1)r[s]=this._trimAlignValue(i[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,n){var r,i=0;switch("range"===t&&this.options.range===!0&&("min"===n?(this.options.value=this._values(0),this.options.values=null):"max"===n&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(i=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!n),this._super(t,n),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===n?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),r=0;i>r;r+=1)this._change(null,r);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,n,r;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(n=this.options.values.slice(),r=0;n.length>r;r+=1)n[r]=this._trimAlignValue(n[r]);return n}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return 2*Math.abs(n)>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),n=this.options.step,r=Math.floor((e-t)/n)*n;e=r+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,n=t.indexOf(".");return-1===n?0:t.length-n-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,n,r,i,s,o=this.options.range,u=this.options,a=this,f=this._animateOff?!1:u.animate,l={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=100*((a.values(r)-a._valueMin())/(a._valueMax()-a._valueMin())),l["horizontal"===a.orientation?"left":"bottom"]=n+"%",e(this).stop(1,1)[f?"animate":"css"](l,u.animate),a.options.range===!0&&("horizontal"===a.orientation?(0===r&&a.range.stop(1,1)[f?"animate":"css"]({left:n+"%"},u.animate),1===r&&a.range[f?"animate":"css"]({width:n-t+"%"},{queue:!1,duration:u.animate})):(0===r&&a.range.stop(1,1)[f?"animate":"css"]({bottom:n+"%"},u.animate),1===r&&a.range[f?"animate":"css"]({height:n-t+"%"},{queue:!1,duration:u.animate}))),t=n}):(r=this.value(),i=this._valueMin(),s=this._valueMax(),n=s!==i?100*((r-i)/(s-i)):0,l["horizontal"===this.orientation?"left":"bottom"]=n+"%",this.handle.stop(1,1)[f?"animate":"css"](l,u.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[f?"animate":"css"]({width:n+"%"},u.animate),"max"===o&&"horizontal"===this.orientation&&this.range[f?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:u.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[f?"animate":"css"]({height:n+"%"},u.animate),"max"===o&&"vertical"===this.orientation&&this.range[f?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:u.animate}))},_handleEvents:{keydown:function(t){var n,r,i,s,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),n=this._start(t,o),n===!1))return}switch(s=this.options.step,r=i=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:i=this._valueMin();break;case e.ui.keyCode.END:i=this._valueMax();break;case e.ui.keyCode.PAGE_UP:i=this._trimAlignValue(r+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(r-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(r===this._valueMax())return;i=this._trimAlignValue(r+s);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(r===this._valueMin())return;i=this._trimAlignValue(r-s)}this._slide(t,o,i)},keyup:function(t){var n=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,n),this._change(t,n),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,n){return e>=t&&t+n>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,n){var r=null,i=!1,s=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,s.widgetName+"-item")===s?(r=e(this),!1):void 0}),e.data(t.target,s.widgetName+"-item")===s&&(r=e(t.target)),r?!this.options.handle||n||(e(this.options.handle,r).find("*").addBack().each(function(){this===t.target&&(i=!0)}),i)?(this.currentItem=r,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,n,r){var i,s,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(s=this.document.find("body"),this.storedCursor=s.css("cursor"),s.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(s)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var n,r,i,s,o=this.options,u=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?u=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(u=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?u=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(u=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),u!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),n=this.items.length-1;n>=0;n--)if(r=this.items[n],i=r.item[0],s=this._intersectsWithPointer(r),s&&r.instance===this.currentContainer&&i!==this.currentItem[0]&&this.placeholder[1===s?"next":"prev"]()[0]!==i&&!e.contains(this.placeholder[0],i)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],i):!0)){if(this.direction=1===s?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(r))break;this._rearrange(t,r),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var r=this,i=this.placeholder.offset(),s=this.options.axis,o={};s&&"x"!==s||(o.left=i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),s&&"y"!==s||(o.top=i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c="x"===this.options.axis||r+f>u&&a>r+f,h="y"===this.options.axis||t+l>s&&o>t+l,p=c&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>s&&o>n-this.helperProportions.width/2&&r+this.helperProportions.height/2>u&&a>i-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=t&&n,i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return r?this.floating?s&&"right"===s||"down"===i?2:1:i&&("down"===i?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),n=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection();return this.floating&&i?"right"===i&&n||"left"===i&&!n:r&&("down"===r&&t||"up"===r&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function n(){u.push(this)}var r,i,s,o,u=[],a=[],f=this._connectWith();if(f&&t)for(r=f.length-1;r>=0;r--)for(s=e(f[r],this.document[0]),i=s.length-1;i>=0;i--)o=e.data(s[i],this.widgetFullName),o&&o!==this&&!o.options.disabled&&a.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(a.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),r=a.length-1;r>=0;r--)a[r][0].each(n);return e(u)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;t.length>n;n++)if(t[n]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n,r,i,s,o,u,a,f,l=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--)for(i=e(h[n],this.document[0]),r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(c.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s));for(n=c.length-1;n>=0;n--)for(o=c[n][1],u=c[n][0],r=0,f=u.length;f>r;r++)a=e(u[r]),a.data(this.widgetName+"-item",o),l.push({item:a,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,s;for(n=this.items.length-1;n>=0;n--)r=this.items[n],r.instance!==this.currentContainer&&this.currentContainer&&r.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item,t||(r.width=i.outerWidth(),r.height=i.outerHeight()),s=i.offset(),r.left=s.left,r.top=s.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)s=this.containers[n].element.offset(),this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var n,r=t.options;r.placeholder&&r.placeholder.constructor!==String||(n=r.placeholder,r.placeholder={element:function(){var r=t.currentItem[0].nodeName.toLowerCase(),i=e("<"+r+">",t.document[0]).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===r?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)}):"img"===r&&i.attr("src",t.currentItem.attr("src")),n||i.css("visibility","hidden"),i},update:function(e,i){(!n||r.forcePlaceholderSize)&&(i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(r.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),r.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n,r,i,s,o,u,a,f,l,c,h=null,p=null;for(n=this.containers.length-1;n>=0;n--)if(!e.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(h&&e.contains(this.containers[n].element[0],h.element[0]))continue;h=this.containers[n],p=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",t,this._uiHash(this)),this.containers[n].containerCache.over=0);if(h)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(i=1e4,s=null,l=h.floating||this._isFloating(this.currentItem),o=l?"left":"top",u=l?"width":"height",c=l?"clientX":"clientY",r=this.items.length-1;r>=0;r--)e.contains(this.containers[p].element[0],this.items[r].item[0])&&this.items[r].item[0]!==this.currentItem[0]&&(a=this.items[r].item.offset()[o],f=!1,t[c]-a>this.items[r][u]/2&&(f=!0),i>Math.abs(t[c]-a)&&(i=Math.abs(t[c]-a),s=this.items[r],this.direction=f?"up":"down"));if(!s&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;return r.parents("body").length||e("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width()),(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,r,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),("document"===i.containment||"window"===i.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=e(i.containment)[0],n=e(i.containment).offset(),r="hidden"!==e(t).css("overflow"),this.containment=[n.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,n){n||(n=this.position);var r="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*r}},_generatePosition:function(t){var n,r,i=this.options,s=t.pageX,o=t.pageY,u="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(u[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),i.grid&&(n=this.originalPageY+Math.round((o-this.originalPageY)/i.grid[1])*i.grid[1],o=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n,r=this.originalPageX+Math.round((s-this.originalPageX)/i.grid[0])*i.grid[0],s=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:u.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:u.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(e,t){function n(e,t,n){return function(r){n._trigger(e,r,t._uiHash(t))}}this.reverting=!1;var r,i=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(r in this._storedCSS)("auto"===this._storedCSS[r]||"static"===this._storedCSS[r])&&(this._storedCSS[r]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&i.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||i.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(i.push(function(e){this._trigger("remove",e,this._uiHash())}),i.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),i.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),r=this.containers.length-1;r>=0;r--)t||i.push(n("deactivate",this,this.containers[r])),this.containers[r].containerCache.over&&(i.push(n("out",this,this.containers[r])),this.containers[r].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(r=0;i.length>r;r++)i[r].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},n=this.element;return e.each(["min","max","step"],function(e,r){var i=n.attr(r);void 0!==i&&i.length&&(t[r]=i)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function n(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r}))}var r;r=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),n.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,n.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var n=this.options,r=e.ui.keyCode;switch(t.keyCode){case r.UP:return this._repeat(null,1,t),!0;case r.DOWN:return this._repeat(null,-1,t),!0;case r.PAGE_UP:return this._repeat(null,n.page,t),!0;case r.PAGE_DOWN:return this._repeat(null,-n.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,n){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,n)},e),this._spin(t*this.options.step,n)},_spin:function(e,t){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:n})===!1||(this._value(n),this.counter++)},_increment:function(t){var n=this.options.incremental;return n?e.isFunction(n)?n(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,n=t.indexOf(".");return-1===n?0:t.length-n-1},_adjustValue:function(e){var t,n,r=this.options;return t=null!==r.min?r.min:0,n=e-t,n=Math.round(n/r.step)*r.step,e=t+n,e=parseFloat(e.toFixed(this._precision())),null!==r.max&&e>r.max?r.max:null!==r.min&&r.min>e?r.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var n=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(n)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:a(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var n;""!==e&&(n=this._parse(e),null!==n&&(t||(n=this._adjustValue(n)),e=this._format(n))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:a(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:a(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:a(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:a(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(a(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var n,r;t=t.cloneNode(!1),n=t.href.replace(e,""),r=location.href.replace(e,"");try{n=decodeURIComponent(n)}catch(i){}try{r=decodeURIComponent(r)}catch(i){}return t.hash.length>1&&n===r}}(),_create:function(){var t=this,n=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible),this._processTabs(),n.active=this._initialActive(),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(n.active):e(),this._refresh(),this.active.length&&this.load(n.active)},_initialActive:function(){var t=this.options.active,n=this.options.collapsible,r=location.hash.substring(1);return null===t&&(r&&this.tabs.each(function(n,i){return e(i).attr("aria-controls")===r?(t=n,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=n?!1:0)),!n&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(r),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),t.ctrlKey||t.metaKey||(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,n){function r(){return t>i&&(t=0),0>t&&(t=i),t}for(var i=this.tabs.length-1;-1!==e.inArray(r(),this.options.disabled);)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,n=this.tabs,r=this.anchors,i=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,s,o,u=e(r).uniqueId().attr("id"),a=e(r).closest("li"),f=a.attr("aria-controls");t._isLocal(r)?(i=r.hash,o=i.substring(1),s=t.element.find(t._sanitizeSelector(i))):(o=a.attr("aria-controls")||e({}).uniqueId()[0].id,i="#"+o,s=t.element.find(i),s.length||(s=t._createPanel(o),s.insertAfter(t.panels[n-1]||t.tablist)),s.attr("aria-live","polite")),s.length&&(t.panels=t.panels.add(s)),f&&a.data("ui-tabs-aria-controls",f),a.attr({"aria-controls":o,"aria-labelledby":u}),s.attr("aria-labelledby",u)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),n&&(this._off(n.not(this.tabs)),this._off(r.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n,r=0;n=this.tabs[r];r++)t===!0||-1!==e.inArray(r,t)?e(n).addClass("ui-state-disabled").attr("aria-disabled","true"):e(n).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r=this.element.parent();"fill"===t?(n=r.height(),n-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");"absolute"!==r&&"fixed"!==r&&(n-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1||(n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),f.length||a.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l))},_toggle:function(t,n){function r(){s.running=!1,s._trigger("activate",t,n)}function i(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&s.options.show?s._show(o,s.options.show,r):(o.show(),r())}var s=this,o=n.newPanel,u=n.oldPanel;this.running=!0,u.length&&this.options.hide?this._hide(u,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),i()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u.hide(),i()),u.attr("aria-hidden","true"),n.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&u.length?n.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),n.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);r[0]!==this.active[0]&&(r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var n=this.options.disabled;n!==!1&&(void 0===t?n=!1:(t=this._getIndex(t),n=e.isArray(n)?e.map(n,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,n){return n!==t?n:null})),this._setupDisabled(n))},disable:function(t){var n=this.options.disabled;if(n!==!0){if(void 0===t)n=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,n))return;n=e.isArray(n)?e.merge([t],n).sort():[t]}this._setupDisabled(n)}},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),s=i.find(".ui-tabs-anchor"),o=this._getPanelForTab(i),u={tab:i,panel:o};this._isLocal(s[0])||(this.xhr=e.ajax(this._ajaxSettings(s,n,u)),this.xhr&&"canceled"!==this.xhr.statusText&&(i.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),r._trigger("load",n,u)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)})))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}}),e.widget("ui.tooltip",{version:"1.11.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))},_removeDescribedBy:function(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);-1!==i&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,n){var r=this;return"disabled"===t?(this[n?"_disable":"_enable"](),this.options[t]=n,void 0):(this._super(t,n),"content"===t&&e.each(this.tooltips,function(e,t){r._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r.element[0],t.close(i,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);r.length&&!r.data("ui-tooltip-id")&&(r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&r.parents().each(function(){var t,r=e(this);r.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,n.close(t,!0)),r.attr("title")&&(r.uniqueId(),n.parents[this.id]={element:this,title:r.attr("title")},r.attr("title",""))}),this._updateContent(r,t))},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;return"string"==typeof r?this._open(t,e,r):(n=r.call(e[0],function(n){e.data("ui-tooltip-open")&&i._delay(function(){t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n),void 0)},_open:function(t,n,r){function i(e){l.of=e,o.is(":hidden")||o.position(l)}var s,o,u,a,f,l=e.extend({},this.options.position);if(r){if(s=this._find(n))return s.tooltip.find(".ui-tooltip-content").html(r),void 0;n.is("[title]")&&(t&&"mouseover"===t.type?n.attr("title",""):n.removeAttr("title")),s=this._tooltip(n),o=s.tooltip,this._addDescribedBy(n,o.attr("id")),o.find(".ui-tooltip-content").html(r),this.liveRegion.children().hide(),r.clone?(f=r.clone(),f.removeAttr("id").find("[id]").removeAttr("id")):f=r,e("<div>").html(f).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:i}),i(t)):o.position(e.extend({of:n},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(a=this.delayedShow=setInterval(function(){o.is(":visible")&&(i(l.of),clearInterval(a))},e.fx.interval)),this._trigger("open",t,{tooltip:o}),u={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var r=e.Event(t);r.currentTarget=n[0],this.close(r,!0)}}},n[0]!==this.element[0]&&(u.remove=function(){this._removeTooltip(o)}),t&&"mouseover"!==t.type||(u.mouseleave="close"),t&&"focusin"!==t.type||(u.focusout="close"),this._on(!0,n,u)}},close:function(t){var n,r=this,i=e(t?t.currentTarget:this.element),s=this._find(i);s&&(n=s.tooltip,s.closing||(clearInterval(this.delayedShow),i.data("ui-tooltip-title")&&!i.attr("title")&&i.attr("title",i.data("ui-tooltip-title")),this._removeDescribedBy(i),s.hiding=!0,n.stop(!0),this._hide(n,this.options.hide,function(){r._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,n){e(n.element).attr("title",n.title),delete r.parents[t]}),s.closing=!0,this._trigger("close",t,{tooltip:n}),s.hiding||(s.closing=!1)))},_tooltip:function(t){var n=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),r=n.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[r]={element:t,tooltip:n}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur"),s=r.element;i.target=i.currentTarget=s[0],t.close(i,!0),e("#"+n).remove(),s.data("ui-tooltip-title")&&(s.attr("title")||s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})}),function(e,t){var n=0,r=null,i=[],s=null;e.fn.split=function(o){function y(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=e.match(/^([0-9]+)(px|%)$/);if(t){if(t[2]=="px")return+t[1];if(l.orientation=="vertical")return p*+t[1]/100;if(l.orientation=="horizontal")return d*+t[1]/100}}}var u=this.data("splitter");if(u)return u;var a,f,l=e.extend({limit:100,orientation:"horizontal",position:"50%",invisible:!1,onDragStart:e.noop,onDragEnd:e.noop,onDrag:e.noop},o||{});this.settings=l;var c,h=this.children();l.orientation=="vertical"?(a=h.first().addClass("left_panel"),f=a.next().addClass("right_panel"),c="vsplitter"):l.orientation=="horizontal"&&(a=h.first().addClass("top_panel"),f=a.next().addClass("bottom_panel"),c="hsplitter"),l.invisible&&(c+=" splitter-invisible");var p=this.width(),d=this.height(),v=n++;this.addClass("splitter_panel");var m=e("<div/>").addClass(c).mouseenter(function(){r=v}).mouseleave(function(){r=null}).insertAfter(a),g,b=e.extend(this,{refresh:function(){var e=this.width(),t=this.height();if(p!=e||d!=t)p=this.width(),d=this.height(),b.position(g)},position:function(){return l.orientation=="vertical"?function(e,n){if(e===t)return g;g=y(e);var r=m.width(),i=r/2;if(l.invisible){var s=a.width(g).outerWidth();f.width(b.width()-s),m.css("left",s-i)}else{var s=a.width(g-i).outerWidth();f.width(b.width()-s-r),m.css("left",s)}return n||b.find(".splitter_panel").trigger("splitter.resize"),b}:l.orientation=="horizontal"?function(e,n){if(e===t)return g;g=y(e);var r=m.height(),i=r/2;if(l.invisible){var s=a.height(g).outerHeight();f.height(b.height()-s),m.css("top",s-i)}else{var s=a.height(g-i).outerHeight();f.height(b.height()-s-r),m.css("top",s)}return n||b.find(".splitter_panel").trigger("splitter.resize"),b}:e.noop}(),orientation:l.orientation,limit:l.limit,isActive:function(){return r===v},destroy:function(){b.removeClass("splitter_panel"),m.unbind("mouseenter"),m.unbind("mouseleave"),l.orientation=="vertical"?(a.removeClass("left_panel"),f.removeClass("right_panel")):l.orientation=="horizontal"&&(a.removeClass("top_panel"),f.removeClass("bottom_panel")),b.unbind("splitter.resize"),b.find(".splitter_panel").trigger("splitter.resize"),i[v]=null,m.remove();var t=!1;for(var r=i.length;r--;)if(i[r]!==null){t=!0;break}t||(e(document.documentElement).unbind(".splitter"),e(window).unbind("resize.splitter"),b.data("splitter",null),i=[],n=0)}});b.bind("splitter.resize",function(e){var t=b.position();b.orientation=="vertical"&&t>b.width()?t=b.width()-b.limit-1:b.orientation=="horizontal"&&t>b.height()&&(t=b.height()-b.limit-1),t<b.limit&&(t=b.limit+1),b.position(t,!0)});var w;return l.orientation=="vertical"?w>p-l.limit?w=p-l.limit:w=y(l.position):l.orientation=="horizontal"&&(w>d-l.limit?w=d-l.limit:w=y(l.position)),w<l.limit&&(w=l.limit),b.position(w,!0),i.length==0&&(e(window).bind("resize.splitter",function(){e.each(i,function(e,t){t.refresh()})}),e(document.documentElement).bind("mousedown.splitter",function(t){if(r!==null&&t.which==1)return s=i[r],e('<div class="splitterMask"></div>').css("cursor",m.css("cursor")).insertAfter(s),s.settings.onDragStart(t),!1}).bind("mouseup.splitter",function(t){s&&(e(".splitterMask").remove(),s.settings.onDragEnd(t),s=null)}).bind("mousemove.splitter",function(e){if(s!==null){var t=s.limit,n=s.offset();if(s.orientation=="vertical"){var r=e.pageX-n.left;r<=s.limit?r=s.limit+1:r>=s.width()-t&&(r=s.width()-t-1),r>s.limit&&r<s.width()-t&&(s.position(r,!0),s.find(".splitter_panel").trigger("splitter.resize"),e.preventDefault())}else if(s.orientation=="horizontal"){var i=e.pageY-n.top;i<=s.limit?i=s.limit+1:i>=s.height()-t&&(i=s.height()-t-1),i>s.limit&&i<s.height()-t&&(s.position(i,!0),s.find(".splitter_panel").trigger("splitter.resize"),e.preventDefault())}s.settings.onDrag(e)}})),i.push(b),b.data("splitter",b),b}}(jQuery),define("splitter",["jquery"],function(){});if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(e){function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(void 0!==e.style[n])return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,r=this;e(this).one("bsTransitionEnd",function(){n=!0});var i=function(){n||e(r).trigger(e.support.transition.end)};return setTimeout(i,t),this},e(function(){e.support.transition=t(),e.support.transition&&(e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){return e(t.target).is(this)?t.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(e){function t(t){return this.each(function(){var n=e(this),i=n.data("bs.alert");i||n.data("bs.alert",i=new r(this)),"string"==typeof t&&i[t].call(n)})}var n='[data-dismiss="alert"]',r=function(t){e(t).on("click",n,this.close)};r.VERSION="3.3.2",r.TRANSITION_DURATION=150,r.prototype.close=function(t){function n(){o.detach().trigger("closed.bs.alert").remove()}var i=e(this),s=i.attr("data-target");s||(s=i.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var o=e(s);t&&t.preventDefault(),o.length||(o=i.closest(".alert")),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(r.TRANSITION_DURATION):n())};var i=e.fn.alert;e.fn.alert=t,e.fn.alert.Constructor=r,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",n,r.prototype.close)}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.button"),s="object"==typeof t&&t;i||r.data("bs.button",i=new n(this,s)),"toggle"==t?i.toggle():t&&i.setState(t)})}var n=function(t,r){this.$element=e(t),this.options=e.extend({},n.DEFAULTS,r),this.isLoading=!1};n.VERSION="3.3.2",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var n="disabled",r=this.$element,i=r.is("input")?"val":"html",s=r.data();t+="Text",null==s.resetText&&r.data("resetText",r[i]()),setTimeout(e.proxy(function(){r[i](null==s[t]?this.options[t]:s[t]),"loadingText"==t?(this.isLoading=!0,r.addClass(n).attr(n,n)):this.isLoading&&(this.isLoading=!1,r.removeClass(n).removeAttr(n))},this),0)},n.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var n=this.$element.find("input");"radio"==n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?e=!1:t.find(".active").removeClass("active")),e&&n.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));e&&this.$element.toggleClass("active")};var r=e.fn.button;e.fn.button=t,e.fn.button.Constructor=n,e.fn.button.noConflict=function(){return e.fn.button=r,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(n){var r=e(n.target);r.hasClass("btn")||(r=r.closest(".btn")),t.call(r,"toggle"),n.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){e(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.carousel"),s=e.extend({},n.DEFAULTS,r.data(),"object"==typeof t&&t),o="string"==typeof t?t:s.slide;i||r.data("bs.carousel",i=new n(this,s)),"number"==typeof t?i.to(t):o?i[o]():s.interval&&i.pause().cycle()})}var n=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",e.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",e.proxy(this.pause,this)).on("mouseleave.bs.carousel",e.proxy(this.cycle,this))};n.VERSION="3.3.2",n.TRANSITION_DURATION=600,n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},n.prototype.keydown=function(e){if(!/input|textarea/i.test(e.target.tagName)){switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()}},n.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},n.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},n.prototype.getItemForDirection=function(e,t){var n=this.getItemIndex(t),r="prev"==e&&0===n||"next"==e&&n==this.$items.length-1;if(r&&!this.options.wrap)return t;var i="prev"==e?-1:1,s=(n+i)%this.$items.length;return this.$items.eq(s)},n.prototype.to=function(e){var t=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));return e>this.$items.length-1||0>e?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){t.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",this.$items.eq(e))},n.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){return this.sliding?void 0:this.slide("next")},n.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},n.prototype.slide=function(t,r){var i=this.$element.find(".item.active"),s=r||this.getItemForDirection(t,i),o=this.interval,u="next"==t?"left":"right",f=this;if(s.hasClass("active"))return this.sliding=!1;var l=s[0],h=e.Event("slide.bs.carousel",{relatedTarget:l,direction:u});if(this.$element.trigger(h),!h.isDefaultPrevented()){if(this.sliding=!0,o&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var p=e(this.$indicators.children()[this.getItemIndex(s)]);p&&p.addClass("active")}var d=e.Event("slid.bs.carousel",{relatedTarget:l,direction:u});return e.support.transition&&this.$element.hasClass("slide")?(s.addClass(t),s[0].offsetWidth,i.addClass(u),s.addClass(u),i.one("bsTransitionEnd",function(){s.removeClass([t,u].join(" ")).addClass("active"),i.removeClass(["active",u].join(" ")),f.sliding=!1,setTimeout(function(){f.$element.trigger(d)},0)}).emulateTransitionEnd(n.TRANSITION_DURATION)):(i.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(d)),o&&this.cycle(),this}};var r=e.fn.carousel;e.fn.carousel=t,e.fn.carousel.Constructor=n,e.fn.carousel.noConflict=function(){return e.fn.carousel=r,this};var i=function(n){var r,i=e(this),s=e(i.attr("data-target")||(r=i.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var o=e.extend({},s.data(),i.data()),u=i.attr("data-slide-to");u&&(o.interval=!1),t.call(s,o),u&&s.data("bs.carousel").to(u),n.preventDefault()}};e(document).on("click.bs.carousel.data-api","[data-slide]",i).on("click.bs.carousel.data-api","[data-slide-to]",i),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var n=e(this);t.call(n,n.data())})})}(jQuery),+function(e){function t(t){var n,r=t.attr("data-target")||(n=t.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return e(r)}function n(t){return this.each(function(){var n=e(this),i=n.data("bs.collapse"),s=e.extend({},r.DEFAULTS,n.data(),"object"==typeof t&&t);!i&&s.toggle&&"show"==t&&(s.toggle=!1),i||n.data("bs.collapse",i=new r(this,s)),"string"==typeof t&&i[t]()})}var r=function(t,n){this.$element=e(t),this.options=e.extend({},r.DEFAULTS,n),this.$trigger=e(this.options.trigger).filter('[href="#'+t.id+'"], [data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};r.VERSION="3.3.2",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0,trigger:'[data-toggle="collapse"]'},r.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,i=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(i&&i.length&&(t=i.data("bs.collapse"),t&&t.transitioning))){var s=e.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){i&&i.length&&(n.call(i,"hide"),t||i.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var u=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return u.call(this);var f=e.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",e.proxy(u,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][f])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return e.support.transition?void this.$element[n](0).one("bsTransitionEnd",e.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION):i.call(this)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(n,r){var i=e(r);this.addAriaAndCollapsedClass(t(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(e,t){var n=e.hasClass("in");e.attr("aria-expanded",n),t.toggleClass("collapsed",!n).attr("aria-expanded",n)};var i=e.fn.collapse;e.fn.collapse=n,e.fn.collapse.Constructor=r,e.fn.collapse.noConflict=function(){return e.fn.collapse=i,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(r){var i=e(this);i.attr("data-target")||r.preventDefault();var s=t(i),o=s.data("bs.collapse"),u=o?"toggle":e.extend({},i.data(),{trigger:this});n.call(s,u)})}(jQuery),+function(e){function t(t){t&&3===t.which||(e(i).remove(),e(s).each(function(){var r=e(this),i=n(r),s={relatedTarget:this};i.hasClass("open")&&(i.trigger(t=e.Event("hide.bs.dropdown",s)),t.isDefaultPrevented()||(r.attr("aria-expanded","false"),i.removeClass("open").trigger("hidden.bs.dropdown",s)))}))}function n(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r=n&&e(n);return r&&r.length?r:t.parent()}function r(t){return this.each(function(){var n=e(this),r=n.data("bs.dropdown");r||n.data("bs.dropdown",r=new o(this)),"string"==typeof t&&r[t].call(n)})}var i=".dropdown-backdrop",s='[data-toggle="dropdown"]',o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.VERSION="3.3.2",o.prototype.toggle=function(r){var i=e(this);if(!i.is(".disabled, :disabled")){var s=n(i),o=s.hasClass("open");if(t(),!o){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&e('<div class="dropdown-backdrop"/>').insertAfter(e(this)).on("click",t);var u={relatedTarget:this};if(s.trigger(r=e.Event("show.bs.dropdown",u)),r.isDefaultPrevented())return;i.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger("shown.bs.dropdown",u)}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var r=e(this);if(t.preventDefault(),t.stopPropagation(),!r.is(".disabled, :disabled")){var i=n(r),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(s).trigger("focus"),r.trigger("click");var u=" li:not(.divider):visible a",l=i.find('[role="menu"]'+u+', [role="listbox"]'+u);if(l.length){var h=l.index(t.target);38==t.which&&h>0&&h--,40==t.which&&h<l.length-1&&h++,~h||(h=0),l.eq(h).trigger("focus")}}}};var u=e.fn.dropdown;e.fn.dropdown=r,e.fn.dropdown.Constructor=o,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=u,this},e(document).on("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",s,o.prototype.toggle).on("keydown.bs.dropdown.data-api",s,o.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',o.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',o.prototype.keydown)}(jQuery),+function(e){function t(t,r){return this.each(function(){var i=e(this),s=i.data("bs.modal"),o=e.extend({},n.DEFAULTS,i.data(),"object"==typeof t&&t);s||i.data("bs.modal",s=new n(this,o)),"string"==typeof t?s[t](r):o.show&&s.show(r)})}var n=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};n.VERSION="3.3.2",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},n.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},n.prototype.show=function(t){var r=this,i=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.backdrop(function(){var i=e.support.transition&&r.$element.hasClass("fade");r.$element.parent().length||r.$element.appendTo(r.$body),r.$element.show().scrollTop(0),r.options.backdrop&&r.adjustBackdrop(),r.adjustDialog(),i&&r.$element[0].offsetWidth,r.$element.addClass("in").attr("aria-hidden",!1),r.enforceFocus();var s=e.Event("shown.bs.modal",{relatedTarget:t});i?r.$element.find(".modal-dialog").one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(n.TRANSITION_DURATION):r.$element.trigger("focus").trigger(s)}))},n.prototype.hide=function(t){t&&t.preventDefault(),t=e.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(n.TRANSITION_DURATION):this.hideModal())},n.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||this.$element.trigger("focus")},this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",e.proxy(function(e){27==e.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},n.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},n.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(t){var r=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=e.support.transition&&i;if(this.$backdrop=e('<div class="modal-backdrop '+i+'" />').prependTo(this.$element).on("click.dismiss.bs.modal",e.proxy(function(e){e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){r.removeBackdrop(),t&&t()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):o()}else t&&t()},n.prototype.handleUpdate=function(){this.options.backdrop&&this.adjustBackdrop(),this.adjustDialog()},n.prototype.adjustBackdrop=function(){this.$backdrop.css("height",0).css("height",this.$element[0].scrollHeight)},n.prototype.adjustDialog=function(){var e=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&e?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!e?this.scrollbarWidth:""})},n.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},n.prototype.checkScrollbar=function(){this.bodyIsOverflowing=document.body.scrollHeight>document.documentElement.clientHeight,this.scrollbarWidth=this.measureScrollbar()},n.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},n.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},n.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var r=e.fn.modal;e.fn.modal=t,e.fn.modal.Constructor=n,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(n){var r=e(this),i=r.attr("href"),s=e(r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},s.data(),r.data());r.is("a")&&n.preventDefault(),s.one("show.bs.modal",function(e){e.isDefaultPrevented()||s.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})}),t.call(s,o,this)})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s="object"==typeof t&&t;(i||"destroy"!=t)&&(i||r.data("bs.tooltip",i=new n(this,s)),"string"==typeof t&&i[t]())})}var n=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};n.VERSION="3.3.2",n.TRANSITION_DURATION=150,n.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},n.prototype.init=function(t,n,r){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&e(this.options.viewport.selector||this.options.viewport);for(var i=this.options.trigger.split(" "),s=i.length;s--;){var o=i[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=o){var u="hover"==o?"mouseenter":"focusin",f="hover"==o?"mouseleave":"focusout";this.$element.on(u+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},n.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,r){n[e]!=r&&(t[e]=r)}),t},n.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return n&&n.$tip&&n.$tip.is(":visible")?void (n.hoverState="in"):(n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?void (n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)):n.show())},n.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?void (n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)):n.hide()},n.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var r=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!r)return;var i=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var u="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,l=f.test(u);l&&(u=u.replace(f,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(u).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var h=this.getPosition(),p=s[0].offsetWidth,d=s[0].offsetHeight;if(l){var v=u,m=this.options.container?e(this.options.container):this.$element.parent(),g=this.getPosition(m);u="bottom"==u&&h.bottom+d>g.bottom?"top":"top"==u&&h.top-d<g.top?"bottom":"right"==u&&h.right+p>g.width?"left":"left"==u&&h.left-p<g.left?"right":u,s.removeClass(v).addClass(u)}var y=this.getCalculatedOffset(u,h,p,d);this.applyPlacement(y,u);var b=function(){var e=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==e&&i.leave(i)};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",b).emulateTransitionEnd(n.TRANSITION_DURATION):b()}},n.prototype.applyPlacement=function(t,n){var r=this.tip(),i=r[0].offsetWidth,s=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),u=parseInt(r.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(u)&&(u=0),t.top=t.top+o,t.left=t.left+u,e.offset.setOffset(r[0],e.extend({using:function(e){r.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),r.addClass("in");var f=r[0].offsetWidth,l=r[0].offsetHeight;"top"==n&&l!=s&&(t.top=t.top+s-l);var c=this.getViewportAdjustedDelta(n,t,f,l);c.left?t.left+=c.left:t.top+=c.top;var h=/top|bottom/.test(n),p=h?2*c.left-i+f:2*c.top-s+l,d=h?"offsetWidth":"offsetHeight";r.offset(t),this.replaceArrow(p,r[0][d],h)},n.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},n.prototype.hide=function(t){function r(){"in"!=i.hoverState&&s.detach(),i.$element.removeAttr("aria-describedby").trigger("hidden.bs."+i.type),t&&t()}var i=this,s=this.tip(),o=e.Event("hide.bs."+this.type);return this.$element.trigger(o),o.isDefaultPrevented()?void 0:(s.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",r).emulateTransitionEnd(n.TRANSITION_DURATION):r(),this.hoverState=null,this)},n.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},n.prototype.hasContent=function(){return this.getTitle()},n.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],r="BODY"==n.tagName,i=n.getBoundingClientRect();null==i.width&&(i=e.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var s=r?{top:0,left:0}:t.offset(),o={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},u=r?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},i,o,u,s)},n.prototype.getCalculatedOffset=function(e,t,n,r){return"bottom"==e?{top:t.top+t.height,left:t.left+t.width/2-n/2}:"top"==e?{top:t.top-r,left:t.left+t.width/2-n/2}:"left"==e?{top:t.top+t.height/2-r/2,left:t.left-n}:{top:t.top+t.height/2-r/2,left:t.left+t.width}},n.prototype.getViewportAdjustedDelta=function(e,t,n,r){var i={top:0,left:0};if(!this.$viewport)return i;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var u=t.top-s-o.scroll,a=t.top+s-o.scroll+r;u<o.top?i.top=o.top-u:a>o.top+o.height&&(i.top=o.top+o.height-a)}else{var f=t.left-s,l=t.left+s+n;f<o.left?i.left=o.left-f:l>o.width&&(i.left=o.left+o.width-l)}return i},n.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)},n.prototype.getUID=function(e){do e+=~~(1e6*Math.random());while(document.getElementById(e));return e},n.prototype.tip=function(){return this.$tip=this.$tip||e(this.options.template)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},n.prototype.enable=function(){this.enabled=!0},n.prototype.disable=function(){this.enabled=!1},n.prototype.toggleEnabled=function(){this.enabled=!this.enabled},n.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),n.tip().hasClass("in")?n.leave(n):n.enter(n)},n.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type)})};var r=e.fn.tooltip;e.fn.tooltip=t,e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.popover"),s="object"==typeof t&&t;(i||"destroy"!=t)&&(i||r.data("bs.popover",i=new n(this,s)),"string"==typeof t&&i[t]())})}var n=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");n.VERSION="3.3.2",n.DEFAULTS=e.extend({},e.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),n.prototype.constructor=n,n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof n?"html":"append":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},n.prototype.tip=function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip};var r=e.fn.popover;e.fn.popover=t,e.fn.popover.Constructor=n,e.fn.popover.noConflict=function(){return e.fn.popover=r,this}}(jQuery),+function(e){function t(n,r){var i=e.proxy(this.process,this);this.$body=e("body"),this.$scrollElement=e(e(n).is("body")?window:n),this.options=e.extend({},t.DEFAULTS,r),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",i),this.refresh(),this.process()}function n(n){return this.each(function(){var r=e(this),i=r.data("bs.scrollspy"),s="object"==typeof n&&n;i||r.data("bs.scrollspy",i=new t(this,s)),"string"==typeof n&&i[n]()})}t.VERSION="3.3.2",t.DEFAULTS={offset:10},t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},t.prototype.refresh=function(){var t="offset",n=0;e.isWindow(this.$scrollElement[0])||(t="position",n=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var r=this;this.$body.find(this.selector).map(function(){var r=e(this),i=r.data("target")||r.attr("href"),s=/^#./.test(i)&&e(i);return s&&s.length&&s.is(":visible")&&[[s[t]().top+n,i]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){r.offsets.push(this[0]),r.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.getScrollHeight(),r=this.options.offset+n-this.$scrollElement.height(),i=this.offsets,s=this.targets,o=this.activeTarget;if(this.scrollHeight!=n&&this.refresh(),t>=r)return o!=(e=s[s.length-1])&&this.activate(e);if(o&&t<i[0])return this.activeTarget=null,this.clear();for(e=i.length;e--;)o!=s[e]&&t>=i[e]&&(!i[e+1]||t<=i[e+1])&&this.activate(s[e])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',r=e(n).parents("li").addClass("active");r.parent(".dropdown-menu").length&&(r=r.closest("li.dropdown").addClass("active")),r.trigger("activate.bs.scrollspy")},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=e.fn.scrollspy;e.fn.scrollspy=n,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=r,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.tab");i||r.data("bs.tab",i=new n(this)),"string"==typeof t&&i[t]()})}var n=function(t){this.element=e(t)};n.VERSION="3.3.2",n.TRANSITION_DURATION=150,n.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.data("target");if(r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var i=n.find(".active:last a"),s=e.Event("hide.bs.tab",{relatedTarget:t[0]}),o=e.Event("show.bs.tab",{relatedTarget:i[0]});if(i.trigger(s),t.trigger(o),!o.isDefaultPrevented()&&!s.isDefaultPrevented()){var u=e(r);this.activate(t.closest("li"),n),this.activate(u,u.parent(),function(){i.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:i[0]})})}}},n.prototype.activate=function(t,r,i){function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),u?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}var o=r.find("> .active"),u=i&&e.support.transition&&(o.length&&o.hasClass("fade")||!!r.find("> .fade").length);o.length&&u?o.one("bsTransitionEnd",s).emulateTransitionEnd(n.TRANSITION_DURATION):s(),o.removeClass("in")};var r=e.fn.tab;e.fn.tab=t,e.fn.tab.Constructor=n,e.fn.tab.noConflict=function(){return e.fn.tab=r,this};var i=function(n){n.preventDefault(),t.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.affix"),s="object"==typeof t&&t;i||r.data("bs.affix",i=new n(this,s)),"string"==typeof t&&i[t]()})}var n=function(t,r){this.options=e.extend({},n.DEFAULTS,r),this.$target=e(this.options.target).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(t),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};n.VERSION="3.3.2",n.RESET="affix affix-top affix-bottom",n.DEFAULTS={offset:0,target:window},n.prototype.getState=function(e,t,n,r){var i=this.$target.scrollTop(),s=this.$element.offset(),o=this.$target.height();if(null!=n&&"top"==this.affixed)return n>i?"top":!1;if("bottom"==this.affixed)return null!=n?i+this.unpin<=s.top?!1:"bottom":e-r>=i+o?!1:"bottom";var u=null==this.affixed,a=u?i:s.top,f=u?o:t;return null!=n&&n>=i?"top":null!=r&&a+f>=e-r?"bottom":!1},n.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(n.RESET).addClass("affix");var e=this.$target.scrollTop(),t=this.$element.offset();return this.pinnedOffset=t.top-e},n.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},n.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),r=this.options.offset,i=r.top,s=r.bottom,o=e("body").height();"object"!=typeof r&&(s=i=r),"function"==typeof i&&(i=r.top(this.$element)),"function"==typeof s&&(s=r.bottom(this.$element));var u=this.getState(o,t,i,s);if(this.affixed!=u){null!=this.unpin&&this.$element.css("top","");var f="affix"+(u?"-"+u:""),l=e.Event(f+".bs.affix");if(this.$element.trigger(l),l.isDefaultPrevented())return;this.affixed=u,this.unpin="bottom"==u?this.getPinnedOffset():null,this.$element.removeClass(n.RESET).addClass(f).trigger(f.replace("affix","affixed")+".bs.affix")}"bottom"==u&&this.$element.offset({top:o-t-s})}};var r=e.fn.affix;e.fn.affix=t,e.fn.affix.Constructor=n,e.fn.affix.noConflict=function(){return e.fn.affix=r,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var n=e(this),r=n.data();r.offset=r.offset||{},null!=r.offsetBottom&&(r.offset.bottom=r.offsetBottom),null!=r.offsetTop&&(r.offset.top=r.offsetTop),t.call(n,r)})})}(jQuery),define("bootstrap",["jquery"],function(){}),define("pane",["jquery","splitter"],function(){function e(e,t,n){var r=e.wrap('<div class="pane-container"></div>').parent();n=="above"||n=="left"?r.prepend(t):r.append(t),e.wrap('<div class="pane-wrapper"></div>'),t.wrap('<div class="pane-wrapper"></div>'),n=="above"||n=="below"?dir="horizontal":dir="vertical",r.split({orientation:dir,limit:10})}function t(e){var t=e.parents(".pane-container").first();t.split().destroy(),e.parent().remove(),t.children().first().children().first().unwrap().unwrap()}(function(e){function r(t){var n=t.children();return{splitter:t.split(),first:e(n[0]).children()[0],second:e(n[2]).children()[0]}}var t="tile",n={_init:function(t){return this.each(function(){var t=e(this),n=t.hasClass("horizontal")?"vertical":"horizontal",r=t.attr("data-split"),i=t.children();r||(r="50%"),i.each(function(){e(this).wrap('<div class="pane-wrapper"></div>')}),t.addClass("pane-container"),t.split({orientation:n,position:r,limit:10,onDrag:function(e){i.trigger("pane.resize")},onDragEnd:function(){t.tile("resize_save")}}),t.tile("resize_save")})},resize_save:function(){return this.each(function(){var t=e(this),n=r(t),i,s;n.splitter.orientation=="horizontal"?(i=t.height(),s=e(n.first).height()):(i=t.width(),s=e(n.first).width());var o=Math.round(100*s/i)+"%";n.splitter.resizestart=o})},resize:function(){return this.each(function(){var t=e(this),n=t.split();n.resizestart&&(n.position(n.resizestart),n.settings.onDrag(t))})}};e.fn.tile=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery)}),function(e){function n(){var e=document.createElement(arguments[0]);for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r===null||r===undefined)continue;if(r.nodeType===1)e.appendChild(r);else if(!(r===""||r&&r.charCodeAt&&r.substr)&&!(r===0||r&&r.toExponential&&r.toFixed)){if(n===1&&typeof r=="object"){for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];if(s!==null&&s!==undefined){i=i.toLowerCase(),i=t[i]||i;var o=i.charAt(0)==="o"&&i.charAt(1)==="n";o?(r.href===undefined&&i==="onclick"&&e.setAttribute("href","#"),e[i]=s):i==="style"&&e.style.setAttribute?e.style.setAttribute("cssText",s):i==="className"||i==="htmlFor"?e[i]=s:e.setAttribute(i,s)}}}else if(Object.prototype.toString.call(r)==="[object Array]")for(var u=0;u<r.length;u++){var a=r[u];a.nodeType===1&&e.appendChild(a)}}else e.appendChild(document.createTextNode(r))}return e.appendTo=function(t){return t.nodeType===1&&this.nodeType===1&&t.appendChild(this),e},e}var t={acceptcharset:"acceptCharset",accesskey:"accessKey",allowtransparency:"allowTransparency",bgcolor:"bgColor",cellpadding:"cellPadding",cellspacing:"cellSpacing","class":"className",classname:"className",colspan:"colSpan",csstext:"style",defaultchecked:"defaultChecked",defaultselected:"defaultSelected",defaultvalue:"defaultValue","for":"htmlFor",frameborder:"frameBorder",hspace:"hSpace",htmlfor:"htmlFor",longdesc:"longDesc",maxlength:"maxLength",marginwidth:"marginWidth",marginheight:"marginHeight",noresize:"noResize",noshade:"noShade",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",valign:"vAlign",vspace:"vSpace"};n.registerElement=function(e,t){n[e]||(n[e]=function(){var r=n("div",{"class":e});return t.apply(r,Array.prototype.slice.call(arguments)),r})};var r=["acronym","applet","basefont","big","center","dir","font","frame","frameset","noframes","strike","tt","u","xmp"],i=["a","abbr","address","area","article","aside","audio","b","base","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","ul","var","video","wbr"].concat(r),s=function(e){return function(){return n.apply(this,[e].concat(Array.prototype.slice.call(arguments)))}};for(var o=0;o<i.length;o++)n[i[o]]=s(i[o]);if(typeof module!="undefined"&&module.exports)module.exports=n;else{var u=e.$||{};u.el=n,e.$=u}}(this),define("laconic",["jquery"],function(){}),define("navbar",["jquery","preferences","laconic"],function(e,t){(function(e){function i(n,r,i){if(i=="--")n.append(e.el.li({"class":"divider"}));else if(typeof i=="function"){var s=e.el.a(r);e(s).data("action",i),i.name&&e(s).attr("id",i.name),n.append(e.el.li(s))}else if(i.type=="checkbox"){var o=e(e.el.input({type:"checkbox"}));i.preference!==undefined?(o.addClass("trill_on_swish-event-receiver"),t.getVal(i.preference)&&o.prop("checked",!0),o.on("click",function(){t.setVal(i.preference,e(this).prop("checked"))}),o.on("preference",function(e){e.name==i.preference&&o.prop("checked",e.value)})):(i.checked&&o.prop("checked",i.checked),o.on("click",function(){i.action(e(this).prop("checked"))})),n.append(e.el.li({"class":"checkbox"},o[0],e.el.span(r)))}else alert("Unknown navbar item")}function s(t,n){return t.find(".dropdown-menu").filter(function(){return e(this).attr("name")==n})}function o(t,n){var r=e(t).data("action");return r&&(n.preventDefault(),r.call(t)),!1}var n="navbar",r={_init:function(t){return this.each(function(){var n=e(this),r={};for(var i in t)t.hasOwnProperty(i)&&(n.navbar("appendDropdown",i),n.navbar("populateDropdown",i,t[i]));n.on("click","a",function(e){o(this,e)})})},appendDropdown:function(t){var n=this.children(".nav.navbar-nav"),r=e.el.ul({name:t,"class":"dropdown-menu"}),i=e.el.li({"class":"dropdown"},e.el.a({"class":"dropdown-toggle","data-toggle":"dropdown"},t,e.el.b({"class":"caret"})),r);return n.append(i),this},populateDropdown:function(e,t){if(typeof t=="function")t(this,e);else{var n=s(this,e);for(var r in t)t.hasOwnProperty(r)&&i(n,r,t[r])}},extendDropdown:function(e,t,n){var r=s(this,e);i(r,t,n)}};e.fn.navbar=function(t){if(r[t])return r[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return r._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}})(jQuery)}),!function(e){var t=function(){return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(e){return!e||/^\s*$/.test(e)},escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isArray:e.isArray,isFunction:e.isFunction,isObject:e.isPlainObject,isUndefined:function(e){return"undefined"==typeof e},toStr:function(e){return t.isUndefined(e)||null===e?"":e+""},bind:e.proxy,each:function(t,n){function r(e,t){return n(t,e)}e.each(t,r)},map:e.map,filter:e.grep,every:function(t,n){var r=!0;return t?(e.each(t,function(e,i){return(r=n.call(null,i,e,t))?void 0:!1}),!!r):r},some:function(t,n){var r=!1;return t?(e.each(t,function(e,i){return(r=n.call(null,i,e,t))?!1:void 0}),!!r):r},mixin:e.extend,getUniqueId:function(){var e=0;return function(){return e++}}(),templatify:function(t){function n(){return String(t)}return e.isFunction(t)?t:n},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var r,i;return function(){var s,o,u=this,a=arguments;return s=function(){r=null,n||(i=e.apply(u,a))},o=n&&!r,clearTimeout(r),r=setTimeout(s,t),o&&(i=e.apply(u,a)),i}},throttle:function(e,t){var n,r,i,s,o,u;return o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)},function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,0>=f?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},noop:function(){}}}(),n="0.10.5",r=function(){function e(e){return e=t.toStr(e),e?e.split(/\s+/):[]}function n(e){return e=t.toStr(e),e?e.split(/\W+/):[]}function r(e){return function(){var n=[].slice.call(arguments,0);return function(r){var i=[];return t.each(n,function(n){i=i.concat(e(t.toStr(r[n])))}),i}}}return{nonword:n,whitespace:e,obj:{nonword:r(n),whitespace:r(e)}}}(),i=function(){function n(n){this.maxSize=t.isNumber(n)?n:100,this.reset(),this.maxSize<=0&&(this.set=this.get=e.noop)}function r(){this.head=this.tail=null}function i(e,t){this.key=e,this.val=t,this.prev=this.next=null}return t.mixin(n.prototype,{set:function(e,t){var n,r=this.list.tail;this.size>=this.maxSize&&(this.list.remove(r),delete this.hash[r.key]),(n=this.hash[e])?(n.val=t,this.list.moveToFront(n)):(n=new i(e,t),this.list.add(n),this.hash[e]=n,this.size++)},get:function(e){var t=this.hash[e];return t?(this.list.moveToFront(t),t.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new r}}),t.mixin(r.prototype,{add:function(e){this.head&&(e.next=this.head,this.head.prev=e),this.head=e,this.tail=this.tail||e},remove:function(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev},moveToFront:function(e){this.remove(e),this.add(e)}}),n}(),s=function(){function e(e){this.prefix=["__",e,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+t.escapeRegExChars(this.prefix))}function n(){return(new Date).getTime()}function r(e){return JSON.stringify(t.isUndefined(e)?null:e)}function i(e){return JSON.parse(e)}var s,o;try{s=window.localStorage,s.setItem("~~~","!"),s.removeItem("~~~")}catch(u){s=null}return o=s&&window.JSON?{_prefix:function(e){return this.prefix+e},_ttlKey:function(e){return this._prefix(e)+this.ttlKey},get:function(e){return this.isExpired(e)&&this.remove(e),i(s.getItem(this._prefix(e)))},set:function(e,i,o){return t.isNumber(o)?s.setItem(this._ttlKey(e),r(n()+o)):s.removeItem(this._ttlKey(e)),s.setItem(this._prefix(e),r(i))},remove:function(e){return s.removeItem(this._ttlKey(e)),s.removeItem(this._prefix(e)),this},clear:function(){var e,t,n=[],r=s.length;for(e=0;r>e;e++)(t=s.key(e)).match(this.keyMatcher)&&n.push(t.replace(this.keyMatcher,""));for(e=n.length;e--;)this.remove(n[e]);return this},isExpired:function(e){var r=i(s.getItem(this._ttlKey(e)));return t.isNumber(r)&&n()>r?!0:!1}}:{get:t.noop,set:t.noop,remove:t.noop,clear:t.noop,isExpired:t.noop},t.mixin(e.prototype,o),e}(),o=function(){function n(t){t=t||{},this.cancelled=!1,this.lastUrl=null,this._send=t.transport?r(t.transport):e.ajax,this._get=t.rateLimiter?t.rateLimiter(this._get):this._get,this._cache=t.cache===!1?new i(0):a}function r(n){return function(r,i){function s(e){t.defer(function(){u.resolve(e)})}function o(e){t.defer(function(){u.reject(e)})}var u=e.Deferred();return n(r,i,s,o),u}}var s=0,o={},u=6,a=new i(10);return n.setMaxPendingRequests=function(e){u=e},n.resetCache=function(){a.reset()},t.mixin(n.prototype,{_get:function(e,t,n){function r(t){n&&n(null,t),l._cache.set(e,t)}function i(){n&&n(!0)}function a(){s--,delete o[e],l.onDeckRequestArgs&&(l._get.apply(l,l.onDeckRequestArgs),l.onDeckRequestArgs=null)}var f,l=this;this.cancelled||e!==this.lastUrl||((f=o[e])?f.done(r).fail(i):u>s?(s++,o[e]=this._send(e,t).done(r).fail(i).always(a)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(e,n,r){var i;return t.isFunction(n)&&(r=n,n={}),this.cancelled=!1,this.lastUrl=e,(i=this._cache.get(e))?t.defer(function(){r&&r(null,i)}):this._get(e,n,r),!!i},cancel:function(){this.cancelled=!0}}),n}(),u=function(){function n(t){t=t||{},t.datumTokenizer&&t.queryTokenizer||e.error("datumTokenizer and queryTokenizer are both required"),this.datumTokenizer=t.datumTokenizer,this.queryTokenizer=t.queryTokenizer,this.reset()}function r(e){return e=t.filter(e,function(e){return!!e}),e=t.map(e,function(e){return e.toLowerCase()})}function i(){return{ids:[],children:{}}}function s(e){for(var t={},n=[],r=0,i=e.length;i>r;r++)t[e[r]]||(t[e[r]]=!0,n.push(e[r]));return n}function o(e,t){function n(e,t){return e-t}var r=0,i=0,s=[];e=e.sort(n),t=t.sort(n);for(var o=e.length,u=t.length;o>r&&u>i;)e[r]<t[i]?r++:e[r]>t[i]?i++:(s.push(e[r]),r++,i++);return s}return t.mixin(n.prototype,{bootstrap:function(e){this.datums=e.datums,this.trie=e.trie},add:function(e){var n=this;e=t.isArray(e)?e:[e],t.each(e,function(e){var s,o;s=n.datums.push(e)-1,o=r(n.datumTokenizer(e)),t.each(o,function(e){var t,r,o;for(t=n.trie,r=e.split("");o=r.shift();)t=t.children[o]||(t.children[o]=i()),t.ids.push(s)})})},get:function(e){var n,i,u=this;return n=r(this.queryTokenizer(e)),t.each(n,function(e){var t,n,r,s;if(i&&0===i.length)return!1;for(t=u.trie,n=e.split("");t&&(r=n.shift());)t=t.children[r];return t&&0===n.length?(s=t.ids.slice(0),void (i=i?o(i,s):s)):(i=[],!1)}),i?t.map(s(i),function(e){return u.datums[e]}):[]},reset:function(){this.datums=[],this.trie=i()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),n}(),a=function(){function r(e){return e.local||null}function i(r){var i,s;return s={url:null,thumbprint:"",ttl:864e5,filter:null,ajax:{}},(i=r.prefetch||null)&&(i=t.isString(i)?{url:i}:i,i=t.mixin(s,i),i.thumbprint=n+i.thumbprint,i.ajax.type=i.ajax.type||"GET",i.ajax.dataType=i.ajax.dataType||"json",!i.url&&e.error("prefetch requires url to be set")),i}function s(n){function r(e){return function(n){return t.debounce(n,e)}}function i(e){return function(n){return t.throttle(n,e)}}var s,o;return o={url:null,cache:!0,wildcard:"%QUERY",replace:null,rateLimitBy:"debounce",rateLimitWait:300,send:null,filter:null,ajax:{}},(s=n.remote||null)&&(s=t.isString(s)?{url:s}:s,s=t.mixin(o,s),s.rateLimiter=/^throttle$/i.test(s.rateLimitBy)?i(s.rateLimitWait):r(s.rateLimitWait),s.ajax.type=s.ajax.type||"GET",s.ajax.dataType=s.ajax.dataType||"json",delete s.rateLimitBy,delete s.rateLimitWait,!s.url&&e.error("remote requires url to be set")),s}return{local:r,prefetch:i,remote:s}}();!function(n){function i(t){t&&(t.local||t.prefetch||t.remote)||e.error("one of local, prefetch, or remote is required"),this.limit=t.limit||5,this.sorter=f(t.sorter),this.dupDetector=t.dupDetector||l,this.local=a.local(t),this.prefetch=a.prefetch(t),this.remote=a.remote(t),this.cacheKey=this.prefetch?this.prefetch.cacheKey||this.prefetch.url:null,this.index=new u({datumTokenizer:t.datumTokenizer,queryTokenizer:t.queryTokenizer}),this.storage=this.cacheKey?new s(this.cacheKey):null}function f(e){function n(t){return t.sort(e)}function r(e){return e}return t.isFunction(e)?n:r}function l(){return!1}var c,h;return c=n.Bloodhound,h={data:"data",protocol:"protocol",thumbprint:"thumbprint"},n.Bloodhound=i,i.noConflict=function(){return n.Bloodhound=c,i},i.tokenizers=r,t.mixin(i.prototype,{_loadPrefetch:function(t){function n(e){s.clear(),s.add(t.filter?t.filter(e):e),s._saveToStorage(s.index.serialize(),t.thumbprint,t.ttl)}var r,i,s=this;return(r=this._readFromStorage(t.thumbprint))?(this.index.bootstrap(r),i=e.Deferred().resolve()):i=e.ajax(t.url,t.ajax).done(n),i},_getFromRemote:function(e,t){function n(e,n){t(e?[]:s.remote.filter?s.remote.filter(n):n)}var r,i,s=this;if(this.transport)return e=e||"",i=encodeURIComponent(e),r=this.remote.replace?this.remote.replace(this.remote.url,e):this.remote.url.replace(this.remote.wildcard,i),this.transport.get(r,this.remote.ajax,n)},_cancelLastRemoteRequest:function(){this.transport&&this.transport.cancel()},_saveToStorage:function(e,t,n){this.storage&&(this.storage.set(h.data,e,n),this.storage.set(h.protocol,location.protocol,n),this.storage.set(h.thumbprint,t,n))},_readFromStorage:function(e){var t,n={};return this.storage&&(n.data=this.storage.get(h.data),n.protocol=this.storage.get(h.protocol),n.thumbprint=this.storage.get(h.thumbprint)),t=n.thumbprint!==e||n.protocol!==location.protocol,n.data&&!t?n.data:null},_initialize:function(){function n(){i.add(t.isFunction(s)?s():s)}var r,i=this,s=this.local;return r=this.prefetch?this._loadPrefetch(this.prefetch):e.Deferred().resolve(),s&&r.done(n),this.transport=this.remote?new o(this.remote):null,this.initPromise=r.promise()},initialize:function(e){return!this.initPromise||e?this._initialize():this.initPromise},add:function(e){this.index.add(e)},get:function(e,n){function r(e){var r=s.slice(0);t.each(e,function(e){var n;return n=t.some(r,function(t){return i.dupDetector(e,t)}),!n&&r.push(e),r.length<i.limit}),n&&n(i.sorter(r))}var i=this,s=[],o=!1;s=this.index.get(e),s=this.sorter(s).slice(0,this.limit),s.length<this.limit?o=this._getFromRemote(e,r):this._cancelLastRemoteRequest(),o||(s.length>0||!this.transport)&&n&&n(s)},clear:function(){this.index.reset()},clearPrefetchCache:function(){this.storage&&this.storage.clear()},clearRemoteCache:function(){this.transport&&o.resetCache()},ttAdapter:function(){return t.bind(this.get,this)}}),i}(this);var f=function(){return{wrapper:'<span class="twitter-typeahead"></span>',dropdown:'<span class="tt-dropdown-menu"></span>',dataset:'<div class="tt-dataset-%CLASS%"></div>',suggestions:'<span class="tt-suggestions"></span>',suggestion:'<div class="tt-suggestion"></div>'}}(),l=function(){var e={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return t.isMsie()&&t.mixin(e.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t.isMsie()&&t.isMsie()<=7&&t.mixin(e.input,{marginTop:"-1px"}),e}(),c=function(){function n(t){t&&t.el||e.error("EventBus initialized without el"),this.$el=e(t.el)}var r="typeahead:";return t.mixin(n.prototype,{trigger:function(e){var t=[].slice.call(arguments,1);this.$el.trigger(r+e,t)}}),n}(),h=function(){function e(e,t,n,r){var i;if(!n)return this;for(t=t.split(a),n=r?u(n,r):n,this._callbacks=this._callbacks||{};i=t.shift();)this._callbacks[i]=this._callbacks[i]||{sync:[],async:[]},this._callbacks[i][e].push(n);return this}function t(t,n,r){return e.call(this,"async",t,n,r)}function n(t,n,r){return e.call(this,"sync",t,n,r)}function r(e){var t;if(!this._callbacks)return this;for(e=e.split(a);t=e.shift();)delete this._callbacks[t];return this}function i(e){var t,n,r,i,o;if(!this._callbacks)return this;for(e=e.split(a),r=[].slice.call(arguments,1);(t=e.shift())&&(n=this._callbacks[t]);)i=s(n.sync,this,[t].concat(r)),o=s(n.async,this,[t].concat(r)),i()&&f(o);return this}function s(e,t,n){function r(){for(var r,i=0,s=e.length;!r&&s>i;i+=1)r=e[i].apply(t,n)===!1;return!r}return r}function o(){var e;return e=window.setImmediate?function(e){setImmediate(function(){e()})}:function(e){setTimeout(function(){e()},0)}}function u(e,t){return e.bind?e.bind(t):function(){e.apply(t,[].slice.call(arguments,0))}}var a=/\s+/,f=o();return{onSync:n,onAsync:t,off:r,trigger:i}}(),p=function(e){function n(e,n,r){for(var i,s=[],o=0,u=e.length;u>o;o++)s.push(t.escapeRegExChars(e[o]));return i=r?"\\b("+s.join("|")+")\\b":"("+s.join("|")+")",n?new RegExp(i):new RegExp(i,"i")}var r={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(i){function s(t){var n,r,s;return(n=u.exec(t.data))&&(s=e.createElement(i.tagName),i.className&&(s.className=i.className),r=t.splitText(n.index),r.splitText(n[0].length),s.appendChild(r.cloneNode(!0)),t.parentNode.replaceChild(s,r)),!!n}function o(e,t){for(var n,r=3,i=0;i<e.childNodes.length;i++)n=e.childNodes[i],n.nodeType===r?i+=t(n)?1:0:o(n,t)}var u;i=t.mixin({},r,i),i.node&&i.pattern&&(i.pattern=t.isArray(i.pattern)?i.pattern:[i.pattern],u=n(i.pattern,i.caseSensitive,i.wordsOnly),o(i.node,s))}}(window.document),d=function(){function n(n){var i,s,u,a,f=this;n=n||{},n.input||e.error("input is missing"),i=t.bind(this._onBlur,this),s=t.bind(this._onFocus,this),u=t.bind(this._onKeydown,this),a=t.bind(this._onInput,this),this.$hint=e(n.hint),this.$input=e(n.input).on("blur.tt",i).on("focus.tt",s).on("keydown.tt",u),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=t.noop),t.isMsie()?this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(e){o[e.which||e.keyCode]||t.defer(t.bind(f._onInput,f,e))}):this.$input.on("input.tt",a),this.query=this.$input.val(),this.$overflowHelper=r(this.$input)}function r(t){return e('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}function i(e,t){return n.normalizeQuery(e)===n.normalizeQuery(t)}function s(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}var o;return o={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},n.normalizeQuery=function(e){return(e||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},t.mixin(n.prototype,h,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(e){var t=o[e.which||e.keyCode];this._managePreventDefault(t,e),t&&this._shouldTrigger(t,e)&&this.trigger(t+"Keyed",e)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(e,t){var n,r,i;switch(e){case"tab":r=this.getHint(),i=this.getInputValue(),n=r&&r!==i&&!s(t);break;case"up":case"down":n=!s(t);break;default:n=!1}n&&t.preventDefault()},_shouldTrigger:function(e,t){var n;switch(e){case"tab":n=!s(t);break;default:n=!0}return n},_checkInputValue:function(){var e,t,n;e=this.getInputValue(),t=i(e,this.query),n=t?this.query.length!==e.length:!1,this.query=e,t?n&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(e){this.query=e},getInputValue:function(){return this.$input.val()},setInputValue:function(e,t){this.$input.val(e),t?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(e){this.$hint.val(e)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var e,t,n,r;e=this.getInputValue(),t=this.getHint(),n=e!==t&&0===t.indexOf(e),r=""!==e&&n&&!this.hasOverflow(),!r&&this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var e=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=e},isCursorAtEnd:function(){var e,n,r;return e=this.$input.val().length,n=this.$input[0].selectionStart,t.isNumber(n)?n===e:document.selection?(r=document.selection.createRange(),r.moveStart("character",-e),e===r.text.length):!0},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$hint=this.$input=this.$overflowHelper=null}}),n}(),v=function(){function n(n){n=n||{},n.templates=n.templates||{},n.source||e.error("missing source"),n.name&&!s(n.name)&&e.error("invalid dataset name: "+n.name),this.query=null,this.highlight=!!n.highlight,this.name=n.name||t.getUniqueId(),this.source=n.source,this.displayFn=r(n.display||n.displayKey),this.templates=i(n.templates,this.displayFn),this.$el=e(f.dataset.replace("%CLASS%",this.name))}function r(e){function n(t){return t[e]}return e=e||"value",t.isFunction(e)?e:n}function i(e,n){function r(e){return"<p>"+n(e)+"</p>"}return{empty:e.empty&&t.templatify(e.empty),header:e.header&&t.templatify(e.header),footer:e.footer&&t.templatify(e.footer),suggestion:e.suggestion||r}}function s(e){return/^[_a-zA-Z0-9-]+$/.test(e)}var o="ttDataset",u="ttValue",a="ttDatum";return n.extractDatasetName=function(t){return e(t).data(o)},n.extractValue=function(t){return e(t).data(u)},n.extractDatum=function(t){return e(t).data(a)},t.mixin(n.prototype,h,{_render:function(n,r){function i(){return v.templates.empty({query:n,isEmpty:!0})}function s(){function i(t){var n;return n=e(f.suggestion).append(v.templates.suggestion(t)).data(o,v.name).data(u,v.displayFn(t)).data(a,t),n.children().each(function(){e(this).css(l.suggestionChild)}),n}var s,c;return s=e(f.suggestions).css(l.suggestions),c=t.map(r,i),s.append.apply(s,c),v.highlight&&p({className:"tt-highlight",node:s[0],pattern:n}),s}function c(){return v.templates.header({query:n,isEmpty:!d})}function h(){return v.templates.footer({query:n,isEmpty:!d})}if(this.$el){var d,v=this;this.$el.empty(),d=r&&r.length,!d&&this.templates.empty?this.$el.html(i()).prepend(v.templates.header?c():null).append(v.templates.footer?h():null):d&&this.$el.html(s()).prepend(v.templates.header?c():null).append(v.templates.footer?h():null),this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(e){function t(t){n.canceled||e!==n.query||n._render(e,t)}var n=this;this.query=e,this.canceled=!1,this.source(e,t)},cancel:function(){this.canceled=!0},clear:function(){this.cancel(),this.$el.empty(),this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),n}(),m=function(){function n(n){var i,s,o,u=this;n=n||{},n.menu||e.error("menu is required"),this.isOpen=!1,this.isEmpty=!0,this.datasets=t.map(n.datasets,r),i=t.bind(this._onSuggestionClick,this),s=t.bind(this._onSuggestionMouseEnter,this),o=t.bind(this._onSuggestionMouseLeave,this),this.$menu=e(n.menu).on("click.tt",".tt-suggestion",i).on("mouseenter.tt",".tt-suggestion",s).on("mouseleave.tt",".tt-suggestion",o),t.each(this.datasets,function(e){u.$menu.append(e.getRoot()),e.onSync("rendered",u._onRendered,u)})}function r(e){return new v(e)}return t.mixin(n.prototype,h,{_onSuggestionClick:function(t){this.trigger("suggestionClicked",e(t.currentTarget))},_onSuggestionMouseEnter:function(t){this._removeCursor(),this._setCursor(e(t.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._removeCursor()},_onRendered:function(){function e(e){return e.isEmpty()}this.isEmpty=t.every(this.datasets,e),this.isEmpty?this._hide():this.isOpen&&this._show(),this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".tt-suggestion")},_getCursor:function(){return this.$menu.find(".tt-cursor").first()},_setCursor:function(e,t){e.first().addClass("tt-cursor"),!t&&this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("tt-cursor")},_moveCursor:function(e){var t,n,r,i;if(this.isOpen){if(n=this._getCursor(),t=this._getSuggestions(),this._removeCursor(),r=t.index(n)+e,r=(r+1)%(t.length+1)-1,-1===r)return void this.trigger("cursorRemoved");-1>r&&(r=t.length-1),this._setCursor(i=t.eq(r)),this._ensureVisible(i)}},_ensureVisible:function(e){var t,n,r,i;t=e.position().top,n=t+e.outerHeight(!0),r=this.$menu.scrollTop(),i=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),0>t?this.$menu.scrollTop(r+t):n>i&&this.$menu.scrollTop(r+(n-i))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,!this.isEmpty&&this._show(),this.trigger("opened"))},setLanguageDirection:function(e){this.$menu.css("ltr"===e?l.ltr:l.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(e){var t=null;return e.length&&(t={raw:v.extractDatum(e),value:v.extractValue(e),datasetName:v.extractDatasetName(e)}),t},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(e){function n(t){t.update(e)}t.each(this.datasets,n)},empty:function(){function e(e){e.clear()}t.each(this.datasets,e),this.isEmpty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function e(e){e.destroy()}this.$menu.off(".tt"),this.$menu=null,t.each(this.datasets,e)}}),n}(),g=function(){function n(n){var i,s,o;n=n||{},n.input||e.error("missing input"),this.isActivated=!1,this.autoselect=!!n.autoselect,this.minLength=t.isNumber(n.minLength)?n.minLength:1,this.$node=r(n.input,n.withHint),i=this.$node.find(".tt-dropdown-menu"),s=this.$node.find(".tt-input"),o=this.$node.find(".tt-hint"),s.on("blur.tt",function(e){var n,r,o;n=document.activeElement,r=i.is(n),o=i.has(n).length>0,t.isMsie()&&(r||o)&&(e.preventDefault(),e.stopImmediatePropagation(),t.defer(function(){s.focus()}))}),i.on("mousedown.tt",function(e){e.preventDefault()}),this.eventBus=n.eventBus||new c({el:s}),this.dropdown=(new m({menu:i,datasets:n.datasets})).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=(new d({input:s,hint:o})).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._setLanguageDirection()}function r(t,n){var r,s,u,a;r=e(t),s=e(f.wrapper).css(l.wrapper),u=e(f.dropdown).css(l.dropdown),a=r.clone().css(l.hint).css(i(r)),a.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder required").prop("readonly",!0).attr({autocomplete:"off",spellcheck:"false",tabindex:-1}),r.data(o,{dir:r.attr("dir"),autocomplete:r.attr("autocomplete"),spellcheck:r.attr("spellcheck"),style:r.attr("style")}),r.addClass("tt-input").attr({autocomplete:"off",spellcheck:!1}).css(n?l.input:l.inputWithNoHint);try{!r.attr("dir")&&r.attr("dir","auto")}catch(c){}return r.wrap(s).parent().prepend(n?a:null).append(u)}function i(e){return{backgroundAttachment:e.css("background-attachment"),backgroundClip:e.css("background-clip"),backgroundColor:e.css("background-color"),backgroundImage:e.css("background-image"),backgroundOrigin:e.css("background-origin"),backgroundPosition:e.css("background-position"),backgroundRepeat:e.css("background-repeat"),backgroundSize:e.css("background-size")}}function s(e){var n=e.find(".tt-input");t.each(n.data(o),function(e,r){t.isUndefined(e)?n.removeAttr(r):n.attr(r,e)}),n.detach().removeData(o).removeClass("tt-input").insertAfter(e),e.remove()}var o="ttAttrs";return t.mixin(n.prototype,{_onSuggestionClicked:function(e,t){var n;(n=this.dropdown.getDatumForSuggestion(t))&&this._select(n)},_onCursorMoved:function(){var e=this.dropdown.getDatumForCursor();this.input.setInputValue(e.value,!0),this.eventBus.trigger("cursorchanged",e.raw,e.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint()},_onDatasetRendered:function(){this._updateHint()},_onOpened:function(){this._updateHint(),this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint(),this.eventBus.trigger("closed")},_onFocused:function(){this.isActivated=!0,this.dropdown.open()},_onBlurred:function(){this.isActivated=!1,this.dropdown.empty(),this.dropdown.close()},_onEnterKeyed:function(e,t){var n,r;n=this.dropdown.getDatumForCursor(),r=this.dropdown.getDatumForTopSuggestion(),n?(this._select(n),t.preventDefault()):this.autoselect&&r&&(this._select(r),t.preventDefault())},_onTabKeyed:function(e,t){var n;(n=this.dropdown.getDatumForCursor())?(this._select(n),t.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onUpKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(e,t){this.input.clearHintIfInvalid(),t.length>=this.minLength?this.dropdown.update(t):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var e;this.dir!==(e=this.input.getLanguageDirection())&&(this.dir=e,this.$node.css("direction",e),this.dropdown.setLanguageDirection(e))},_updateHint:function(){var e,n,r,i,s,o;e=this.dropdown.getDatumForTopSuggestion(),e&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(n=this.input.getInputValue(),r=d.normalizeQuery(n),i=t.escapeRegExChars(r),s=new RegExp("^(?:"+i+")(.+$)","i"),o=s.exec(e.value),o?this.input.setHint(n+o[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(e){var t,n,r,i;t=this.input.getHint(),n=this.input.getQuery(),r=e||this.input.isCursorAtEnd(),t&&n!==t&&r&&(i=this.dropdown.getDatumForTopSuggestion(),i&&this.input.setInputValue(i.value),this.eventBus.trigger("autocompleted",i.raw,i.datasetName))},_select:function(e){this.input.setQuery(e.value),this.input.setInputValue(e.value,!0),this._setLanguageDirection(),this.eventBus.trigger("selected",e.raw,e.datasetName),this.dropdown.close(),t.defer(t.bind(this.dropdown.empty,this.dropdown))},open:function(){this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(e){e=t.toStr(e),this.isActivated?this.input.setInputValue(e):(this.input.setQuery(e),this.input.setInputValue(e,!0)),this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),s(this.$node),this.$node=null}}),n}();!function(){var n,r,i;n=e.fn.typeahead,r="ttTypeahead",i={initialize:function(n,i){function s(){var s,o,u=e(this);t.each(i,function(e){e.highlight=!!n.highlight}),o=new g({input:u,eventBus:s=new c({el:u}),withHint:t.isUndefined(n.hint)?!0:!!n.hint,minLength:n.minLength,autoselect:n.autoselect,datasets:i}),u.data(r,o)}return i=t.isArray(i)?i:[].slice.call(arguments,1),n=n||{},this.each(s)},open:function(){function t(){var t,n=e(this);(t=n.data(r))&&t.open()}return this.each(t)},close:function(){function t(){var t,n=e(this);(t=n.data(r))&&t.close()}return this.each(t)},val:function(t){function n(){var n,i=e(this);(n=i.data(r))&&n.setVal(t)}function i(e){var t,n;return(t=e.data(r))&&(n=t.getVal()),n}return arguments.length?this.each(n):i(this.first())},destroy:function(){function t(){var t,n=e(this);(t=n.data(r))&&(t.destroy(),n.removeData(r))}return this.each(t)}},e.fn.typeahead=function(t){var n;return i[t]&&"initialize"!==t?(n=this.filter(function(){return!!e(this).data(r)}),i[t].apply(n,[].slice.call(arguments,1))):i.initialize.apply(this,arguments)},e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this}}()}(window.jQuery),define("typeahead",["jquery"],function(){}),define("search",["jquery","config","typeahead"],function(e,t){(function(e){function i(e){return e?document.createElement("a").appendChild(document.createTextNode(e)).parentNode.innerHTML:""}var n="search",r={_init:function(n){return this.each(function(){function o(e){return(e.tags||[]).push(e.name)}function u(e){var t='<div class="tt-match file"><span class="tt-label">'+i(e.name);0/0;if(e.tags){t+='<span class="tt-tags">';for(var n=0;n<e.tags.length;n++){var r=e.tags[n];t+='<span class="tt-tag">'+i(r)+"</span>"}t+="</span>"}return e.title&&(t+='<div class="tt-title file">'+i(e.title)+"</div>"),t+="</div>",t}function a(e,n){var r=t.trill_on_swish.templates,i=[],s=e.split(" "),o=[];for(var u=0;u<s.length;u++)o.push({prefix:s[u],regex:new RegExp("_"+s[u])});for(var u=0;u<r.length;u++){var a=r[u];if(a.arity!==undefined){for(var f=0,l=!0;f<o.length&&l;f++)!a.name.startsWith(o[f].prefix)&&!a.name.match(o[f].regex)&&(l=!1);l&&i.push(a)}}n(i)}function f(e){var t='<div class="tt-match predicate';return e.type&&(t+=" "+e.type),e.mode&&(t+='" title="'+e.mode),t+='"><span class="tt-label">'+i(e.name)+"/"+e.arity+"</span>",e.iso&&(t+='<span class="tt-tags">',e.iso&&(t+='<span class="tt-tag">ISO</span>'),t+="</span>"),e.summary&&(t+='<div class="tt-title file">'+i(e.summary)+"</div>"),t+="</div>",t+="</div>",t}function c(t,n){r=t;if(t.length<2)return[];var i=[],s=new RegExp("\\b"+t,"g");l=s,e(".prolog-editor").each(function(){var t=this,n=e(t).prologEditor("search",s,{max:7});for(var r=0;r<n.length;r++)n[r].editor=t,n[r].regex=l,i.push(n[r])}),n(i)}function h(e){var t=e.text,n;(n=t.search(l))>20&&(t="..."+t.slice(n-17)),t.length>80&&(t=t.substring(0,80));var r='<div class="tt-match source"><span class="tt-line"><span class="tt-lineno">'+e.line+"</span>"+'<span class="tt-text">'+i(t)+"</span>"+"</span>";return r}var n=e(this),r,s=new Bloodhound({name:"files",remote:t.http.locations.typeahead+"?set=file&q=%QUERY",datumTokenizer:o,queryTokenizer:Bloodhound.tokenizers.whitespace});s.initialize();var l;n.typeahead({minLength:1,highlight:!0},[{name:"source",source:c,templates:{suggestion:h}},{name:"files",source:s.ttAdapter(),templates:{suggestion:u}},{name:"predicates",source:a,templates:{suggestion:f}}]).on("typeahead:selected typeahead:autocompleted",function(t,r,i){r.type=="store"?e(t.target).parents(".trill_on_swish").swish("playFile",r.file):r.arity!==undefined?e(".trill_on_swish-event-receiver").trigger("pldoc",r):r.editor!==undefined&&r.line!==undefined?e(r.editor).prologEditor("gotoLine",r.line,{regex:r.regex,showAllMatches:!0}):(n.data("target",{datum:r,set:i}),console.log(n.data("target")))}),n.parents("form").submit(function(e){var t=n.data("target"),r=n.val();if(!t||!t.datum||t.datum.label!=r)t=r;return n.val(""),n.data("target",null),n.search("search",t),!1})})},search:function(e){alert("Full search not yet implemented\nPlease select from auto completion list")}};typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(e){return this.lastIndexOf(e,0)===0}),e.fn.search=function(t){if(r[t])return r[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return r._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}})(jQuery)}),function(e){if(typeof exports=="object"&&typeof module=="object")module.exports=e();else{if(typeof define=="function"&&define.amd)return define("tos_cm/lib/codemirror",[],e);this.CodeMirror=e()}}(function(){function E(e,t){if(!(this instanceof E))return new E(e,t);this.options=t=t?nu(t):{},nu(Ei,t,!1),P(t);var n=t.value;typeof n=="string"&&(n=new Ks(n,t.mode)),this.doc=n;var o=new E.inputStyles[t.inputStyle](this),u=this.display=new S(e,n,o);u.wrapper.CodeMirror=this,O(this),L(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),t.autofocus&&!p&&u.input.focus(),F(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Xo,keySeq:null};var a=this;r&&i<11&&setTimeout(function(){a.display.input.reset(!0)},20),dr(this),Su(),Vn(this),this.curOp.forceUpdate=!0,Zs(this,n),t.autofocus&&!p||a.hasFocus()?setTimeout(ru(Vr,this),20):$r(this);for(var f in Si)Si.hasOwnProperty(f)&&Si[f](this,t[f],Ti);z(this),t.finishInit&&t.finishInit(this);for(var l=0;l<Li.length;++l)Li[l](this);Jn(this),s&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}function S(t,n,o){var u=this;this.input=o,u.scrollbarFiller=lu("div",null,"CodeMirror-scrollbar-filler"),u.scrollbarFiller.setAttribute("cm-not-content","true"),u.gutterFiller=lu("div",null,"CodeMirror-gutter-filler"),u.gutterFiller.setAttribute("cm-not-content","true"),u.lineDiv=lu("div",null,"CodeMirror-code"),u.selectionDiv=lu("div",null,null,"position: relative; z-index: 1"),u.cursorDiv=lu("div",null,"CodeMirror-cursors"),u.measure=lu("div",null,"CodeMirror-measure"),u.lineMeasure=lu("div",null,"CodeMirror-measure"),u.lineSpace=lu("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none"),u.mover=lu("div",[lu("div",[u.lineSpace],"CodeMirror-lines")],null,"position: relative"),u.sizer=lu("div",[u.mover],"CodeMirror-sizer"),u.sizerWidth=null,u.heightForcer=lu("div",null,null,"position: absolute; height: "+qo+"px; width: 1px;"),u.gutters=lu("div",null,"CodeMirror-gutters"),u.lineGutter=null,u.scroller=lu("div",[u.sizer,u.heightForcer,u.gutters],"CodeMirror-scroll"),u.scroller.setAttribute("tabIndex","-1"),u.wrapper=lu("div",[u.scrollbarFiller,u.gutterFiller,u.scroller],"CodeMirror"),r&&i<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0),!s&&(!e||!p)&&(u.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(u.wrapper):t(u.wrapper)),u.viewFrom=u.viewTo=n.first,u.reportedViewFrom=u.reportedViewTo=n.first,u.view=[],u.renderedView=null,u.externalMeasured=null,u.viewOffset=0,u.lastWrapHeight=u.lastWrapWidth=0,u.updateLineNumbers=null,u.nativeBarWidth=u.barHeight=u.barWidth=0,u.scrollbarsClipped=!1,u.lineNumWidth=u.lineNumInnerWidth=u.lineNumChars=null,u.alignWidgets=!1,u.cachedCharWidth=u.cachedTextHeight=u.cachedPaddingH=null,u.maxLine=null,u.maxLineLength=0,u.maxLineChanged=!1,u.wheelDX=u.wheelDY=u.wheelStartX=u.wheelStartY=null,u.shift=!1,u.selForContextMenu=null,u.activeTouch=null,o.init(u)}function x(e){e.doc.mode=E.getMode(e.options,e.doc.modeOption),T(e)}function T(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,un(e,100),e.state.modeGen++,e.curOp&&ur(e)}function N(e){e.options.lineWrapping?(yu(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(gu(e.display.wrapper,"CodeMirror-wrap"),D(e)),k(e),ur(e),On(e),setTimeout(function(){I(e)},100)}function C(e){var t=Un(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/zn(e.display)-3);return function(i){if(gs(e.doc,i))return 0;var s=0;if(i.widgets)for(var o=0;o<i.widgets.length;o++)i.widgets[o].height&&(s+=i.widgets[o].height);return n?s+(Math.ceil(i.text.length/r)||1)*t:s+t}}function k(e){var t=e.doc,n=C(e);t.iter(function(e){var t=n(e);t!=e.height&&ro(e,t)})}function L(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),On(e)}function A(e){O(e),ur(e),setTimeout(function(){U(e)},20)}function O(e){var t=e.display.gutters,n=e.options.gutters;hu(t);for(var r=0;r<n.length;++r){var i=n[r],s=t.appendChild(lu("div",null,"CodeMirror-gutter "+i));i=="CodeMirror-linenumbers"&&(e.display.lineGutter=s,s.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",M(e)}function M(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function _(e){if(e.height==0)return 0;var t=e.text.length,n,r=e;while(n=ls(r)){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}r=e;while(n=cs(r)){var i=n.find(0,!0);t-=r.text.length-i.from.ch,r=i.to.line,t+=r.text.length-i.to.ch}return t}function D(e){var t=e.display,n=e.doc;t.maxLine=eo(n,n.first),t.maxLineLength=_(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=_(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function P(e){var t=Yo(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function H(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+hn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+dn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function B(e,t,n){this.cm=n;var s=this.vert=lu("div",[lu("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=lu("div",[lu("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(s),e(o),Oo(s,"scroll",function(){s.clientHeight&&t(s.scrollTop,"vertical")}),Oo(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedOverlay=!1,r&&i<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function j(){}function F(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&gu(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new E.scrollbarModel[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oo(t,"mousedown",function(){e.state.focused&&setTimeout(function(){e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Or(e,t):Ar(e,t)},e),e.display.scrollbars.addClass&&yu(e.display.wrapper,e.display.scrollbars.addClass)}function I(e,t){t||(t=H(e));var n=e.display.barWidth,r=e.display.barHeight;q(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Y(e),q(e,H(e)),n=e.display.barWidth,r=e.display.barHeight}function q(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function R(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-cn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,s=so(t,r),o=so(t,i);if(n&&n.ensure){var u=n.ensure.from.line,a=n.ensure.to.line;u<s?(s=u,o=so(t,oo(eo(t,u))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=o&&(s=so(t,oo(eo(t,a))-e.wrapper.clientHeight),o=a)}return{from:s,to:Math.max(o,s+1)}}function U(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var r=X(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,s=r+"px";for(var o=0;o<n.length;o++)if(!n[o].hidden){e.options.fixedGutter&&n[o].gutter&&(n[o].gutter.style.left=s);var u=n[o].alignable;if(u)for(var a=0;a<u.length;a++)u[a].style.left=s}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function z(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=W(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(lu("div",[lu("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=i.firstChild.offsetWidth,o=i.offsetWidth-s;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-o),r.lineNumWidth=r.lineNumInnerWidth+o,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",M(e),!0}return!1}function W(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function X(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function V(e,t,n){var r=e.display;this.viewport=t,this.visible=R(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=vn(e),this.force=n,this.dims=et(e),this.events=[]}function $(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=dn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=dn(e)+"px",t.scrollbarsClipped=!0)}function J(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return fr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&pr(e)==0)return!1;z(e)&&(fr(e),t.dims=et(e));var i=r.first+r.size,s=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<s&&s-n.viewFrom<20&&(s=Math.max(r.first,n.viewFrom)),n.viewTo>o&&n.viewTo-o<20&&(o=Math.min(i,n.viewTo)),w&&(s=vs(e.doc,s),o=ms(e.doc,o));var u=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;hr(e,s,o),n.viewOffset=oo(eo(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=pr(e);if(!u&&a==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=vu();return a>4&&(n.lineDiv.style.display="none"),tt(e,n.updateLineNumbers,t.dims),a>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,f&&vu()!=f&&f.offsetHeight&&f.focus(),hu(n.cursorDiv),hu(n.selectionDiv),n.gutters.style.height=0,u&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,un(e,400)),n.updateLineNumbers=null,!0}function K(e,t){var n=t.force,r=t.viewport;for(var i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=vn(e))n=!0;else{n=!1,r&&r.top!=null&&(r={top:Math.min(e.doc.height+hn(e.display)-mn(e),r.top)}),t.visible=R(e.display,e.doc,r);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}if(!J(e,t))break;Y(e);var s=H(e);tn(e),G(e,s),I(e,s)}t.signal(e,"update",e);if(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo}function Q(e,t){var n=new V(e,t);if(J(e,n)){Y(e),K(e,n);var r=H(e);tn(e),G(e,r),I(e,r),n.finish()}}function G(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+dn(e),t.clientHeight)+"px"}function Y(e){var t=e.display,n=t.lineDiv.offsetTop;for(var s=0;s<t.view.length;s++){var o=t.view[s],u;if(o.hidden)continue;if(r&&i<8){var a=o.node.offsetTop+o.node.offsetHeight;u=a-n,n=a}else{var f=o.node.getBoundingClientRect();u=f.bottom-f.top}var l=o.line.height-u;u<2&&(u=Un(t));if(l>.001||l<-0.001){ro(o.line,u),Z(o.line);if(o.rest)for(var c=0;c<o.rest.length;c++)Z(o.rest[c])}}}function Z(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function et(e){var t=e.display,n={},r={},i=t.gutters.clientLeft;for(var s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o)n[e.options.gutters[o]]=s.offsetLeft+s.clientLeft+i,r[e.options.gutters[o]]=s.clientWidth;return{fixedPos:X(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function tt(e,t,n){function a(t){var n=t.nextSibling;return s&&d&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild,f=r.view,l=r.viewFrom;for(var c=0;c<f.length;c++){var h=f[c];if(!h.hidden)if(!h.node||h.node.parentNode!=o){var p=lt(e,h,l,n);o.insertBefore(p,u)}else{while(u!=h.node)u=a(u);var v=i&&t!=null&&t<=l&&h.lineNumber;h.changes&&(Yo(h.changes,"gutter")>-1&&(v=!1),nt(e,h,l,n)),v&&(hu(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(W(e.options,l)))),u=h.node.nextSibling}l+=h.size}while(u)u=a(u)}function nt(e,t,n,r){for(var i=0;i<t.changes.length;i++){var s=t.changes[i];s=="text"?ot(e,t):s=="gutter"?at(e,t,n,r):s=="class"?ut(t):s=="widget"&&ft(e,t,r)}t.changes=null}function rt(e){return e.node==e.text&&(e.node=lu("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),r&&i<8&&(e.node.style.zIndex=2)),e.node}function it(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;t&&(t+=" CodeMirror-linebackground");if(e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=rt(e);e.background=n.insertBefore(lu("div",null,t),n.firstChild)}}function st(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):js(e,t)}function ot(e,t){var n=t.text.className,r=st(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ut(t)):n&&(t.text.className=n)}function ut(e){it(e),e.line.wrapClass?rt(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function at(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var s=rt(t),o=t.gutter=lu("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px");e.display.input.setUneditable(o),s.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!i||!i["CodeMirror-linenumbers"])&&(t.lineNumber=o.appendChild(lu("div",W(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px")));if(i)for(var u=0;u<e.options.gutters.length;++u){var a=e.options.gutters[u],f=i.hasOwnProperty(a)&&i[a];f&&o.appendChild(lu("div",[f],"CodeMirror-gutter-elt","left: "+r.gutterLeft[a]+"px; width: "+r.gutterWidth[a]+"px"))}}}function ft(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,i;r;r=i){var i=r.nextSibling;r.className=="CodeMirror-linewidget"&&t.node.removeChild(r)}ct(e,t,n)}function lt(e,t,n,r){var i=st(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ut(t),at(e,t,n,r),ct(e,t,r),t.node}function ct(e,t,n){ht(e,t.line,t,n,!0);if(t.rest)for(var r=0;r<t.rest.length;r++)ht(e,t.rest[r],t,n,!1)}function ht(e,t,n,r,i){if(!t.widgets)return;var s=rt(n);for(var o=0,u=t.widgets;o<u.length;++o){var a=u[o],f=lu("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||f.setAttribute("cm-ignore-events","true"),pt(a,f,n,r),e.display.input.setUneditable(f),i&&a.above?s.insertBefore(f,n.gutter||n.text):s.appendChild(f),Po(a,"redraw")}}function pt(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mt(e){return dt(e.line,e.ch)}function gt(e,t){return vt(e,t)<0?t:e}function yt(e,t){return vt(e,t)<0?e:t}function bt(e){e.state.focused||(e.display.input.focus(),Vr(e))}function wt(e){return e.options.readOnly||e.doc.cantEdit}function St(e,t,n,r){var i=e.doc;e.display.shift=!1,r||(r=i.sel);var s=Au(t),o=null;e.state.pasteIncoming&&r.ranges.length>1&&(Et&&Et.join("\n")==t?o=r.ranges.length%Et.length==0&&Zo(Et,Au):s.length==r.ranges.length&&(o=Zo(s,function(e){return[e]})));for(var u=r.ranges.length-1;u>=0;u--){var a=r.ranges[u],f=a.from(),l=a.to();a.empty()&&(n&&n>0?f=dt(f.line,f.ch-n):e.state.overwrite&&!e.state.pasteIncoming&&(l=dt(l.line,Math.min(eo(i,l.line).text.length,l.ch+Qo(s).length))));var c=e.curOp.updateInput,h={from:f,to:l,text:o?o[u%o.length]:s,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};ni(e.doc,h),Po(e,"inputRead",e,h);if(t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&a.head.ch<100&&(!u||r.ranges[u-1].head.line!=a.head.line)){var p=e.getModeAt(a.head),d=Qr(h);if(p.electricChars){for(var v=0;v<p.electricChars.length;v++)if(t.indexOf(p.electricChars.charAt(v))>-1){mi(e,d.line,"smart");break}}else p.electricInput&&p.electricInput.test(eo(i,d.line).text.slice(0,d.ch))&&mi(e,d.line,"smart")}}di(e),e.curOp.updateInput=c,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function xt(e){var t=[],n=[];for(var r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,s={anchor:dt(i,0),head:dt(i+1,0)};n.push(s),t.push(e.getRange(s.anchor,s.head))}return{text:t,ranges:n}}function Tt(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function Nt(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Xo,this.inaccurateSelection=!1,this.hasSelection=!1}function Ct(){var e=lu("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=lu("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),h&&(e.style.border="1px solid black"),Tt(e),t}function kt(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Xo}function Lt(e,t){var n=En(e,t.line);if(!n||n.hidden)return null;var r=eo(e.doc,t.line),i=yn(n,r,t.line),s=uo(r),o="left";if(s){var u=Xu(s,t.ch);o=u%2?"right":"left"}var a=Nn(i.map,t.ch,"left");return a.offset=a.collapse=="right"?a.end:a.start,a}function At(e,t){return t&&(e.bad=!0),e}function Ot(e,t,n){var r;if(t==e.display.lineDiv){r=e.display.lineDiv.childNodes[n];if(!r)return At(e.clipPos(dt(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var s=e.display.view[i];if(s.node==r)return Mt(s,t,n)}}function Mt(e,t,n){function l(t,n,r){for(var i=-1;i<(f?f.length:0);i++){var s=i<0?a.map:f[i];for(var o=0;o<s.length;o+=3){var u=s[o+2];if(u==t||u==n){var l=io(i<0?e.line:e.rest[i]),c=s[o]+r;if(r<0||u!=t)c=s[o+(r?1:0)];return dt(l,c)}}}}var r=e.text.firstChild,i=!1;if(!t||!du(r,t))return At(dt(io(e.line),0),!0);if(t==r){i=!0,t=r.childNodes[n],n=0;if(!t){var s=e.rest?Qo(e.rest):e.line;return At(dt(io(s),s.text.length),i)}}var o=t.nodeType==3?t:null,u=t;!o&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(o=t.firstChild,n&&(n=o.nodeValue.length));while(u.parentNode!=r)u=u.parentNode;var a=e.measure,f=a.maps,c=l(o,u,n);if(c)return At(c,i);for(var h=u.nextSibling,p=o?o.nodeValue.length-n:0;h;h=h.nextSibling){c=l(h,h.firstChild,0);if(c)return At(dt(c.line,c.ch-p),i);p+=h.textContent.length}for(var d=u.previousSibling,p=n;d;d=d.previousSibling){c=l(d,d.firstChild,-1);if(c)return At(dt(c.line,c.ch+p),i);p+=h.textContent.length}}function _t(e,t,n,r,i){function u(e){return function(t){return t.id==e}}function a(t){if(t.nodeType==1){var n=t.getAttribute("cm-text");if(n!=null){n==""&&(n=t.textContent.replace(/\u200b/g,"")),s+=n;return}var f=t.getAttribute("cm-marker"),l;if(f){var c=e.findMarks(dt(r,0),dt(i+1,0),u(+f));c.length&&(l=c[0].find())&&(s+=to(e.doc,l.from,l.to).join("\n"));return}if(t.getAttribute("contenteditable")=="false")return;for(var h=0;h<t.childNodes.length;h++)a(t.childNodes[h]);/^(pre|div|p)$/i.test(t.nodeName)&&(o=!0)}else if(t.nodeType==3){var p=t.nodeValue;if(!p)return;o&&(s+="\n",o=!1),s+=p}}var s="",o=!1;for(;;){a(t);if(t==n)break;t=t.nextSibling}return s}function Dt(e,t){this.ranges=e,this.primIndex=t}function Pt(e,t){this.anchor=e,this.head=t}function Ht(e,t){var n=e[t];e.sort(function(e,t){return vt(e.from(),t.from())}),t=Yo(e,n);for(var r=1;r<e.length;r++){var i=e[r],s=e[r-1];if(vt(s.to(),i.from())>=0){var o=yt(s.from(),i.from()),u=gt(s.to(),i.to()),a=s.empty()?i.from()==i.head:s.from()==s.head;r<=t&&--t,e.splice(--r,2,new Pt(a?u:o,a?o:u))}}return new Dt(e,t)}function Bt(e,t){return new Dt([new Pt(e,t||e)],0)}function jt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ft(e,t){if(t.line<e.first)return dt(e.first,0);var n=e.first+e.size-1;return t.line>n?dt(n,eo(e,n).text.length):It(t,eo(e,t.line).text.length)}function It(e,t){var n=e.ch;return n==null||n>t?dt(e.line,t):n<0?dt(e.line,0):e}function qt(e,t){return t>=e.first&&t<e.first+e.size}function Rt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Ft(e,t[r]);return n}function Ut(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var s=vt(n,i)<0;s!=vt(r,i)<0?(i=n,n=r):s!=vt(n,r)<0&&(n=r)}return new Pt(i,n)}return new Pt(r||n,n)}function zt(e,t,n,r){Kt(e,new Dt([Ut(e,e.sel.primary(),t,n)],0),r)}function Wt(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=Ut(e,e.sel.ranges[i],t[i],null);var s=Ht(r,e.sel.primIndex);Kt(e,s,n)}function Xt(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Kt(e,Ht(i,e.sel.primIndex),r)}function Vt(e,t,n,r){Kt(e,Bt(t,n),r)}function $t(e,t){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new Pt(Ft(e,t[n].anchor),Ft(e,t[n].head))}};return _o(e,"beforeSelectionChange",e,n),e.cm&&_o(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Ht(n.ranges,n.ranges.length-1):t}function Jt(e,t,n){var r=e.history.done,i=Qo(r);i&&i.ranges?(r[r.length-1]=t,Qt(e,t,n)):Kt(e,t,n)}function Kt(e,t,n){Qt(e,t,n),vo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Qt(e,t,n){if(Fo(e,"beforeSelectionChange")||e.cm&&Fo(e.cm,"beforeSelectionChange"))t=$t(e,t);var r=n&&n.bias||(vt(t.primary().head,e.sel.primary().head)<0?-1:1);Gt(e,Zt(e,t,r,!0)),(!n||n.scroll!==!1)&&e.cm&&di(e.cm)}function Gt(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,jo(e.cm)),Po(e,"cursorActivity",e)}function Yt(e){Gt(e,Zt(e,e.sel,null,!1),Uo)}function Zt(e,t,n,r){var i;for(var s=0;s<t.ranges.length;s++){var o=t.ranges[s],u=en(e,o.anchor,n,r),a=en(e,o.head,n,r);if(i||u!=o.anchor||a!=o.head)i||(i=t.ranges.slice(0,s)),i[s]=new Pt(u,a)}return i?Ht(i,t.primIndex):t}function en(e,t,n,r){var i=!1,s=t,o=n||1;e.cantEdit=!1;e:for(;;){var u=eo(e,s.line);if(u.markedSpans)for(var a=0;a<u.markedSpans.length;++a){var f=u.markedSpans[a],l=f.marker;if((f.from==null||(l.inclusiveLeft?f.from<=s.ch:f.from<s.ch))&&(f.to==null||(l.inclusiveRight?f.to>=s.ch:f.to>s.ch))){if(r){_o(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find(o<0?-1:1);if(vt(c,s)==0){c.ch+=o,c.ch<0?c.line>e.first?c=Ft(e,dt(c.line-1)):c=null:c.ch>u.text.length&&(c.line<e.first+e.size-1?c=dt(c.line+1,0):c=null);if(!c){if(i)return r?(e.cantEdit=!0,dt(e.first,0)):en(e,t,n,!0);i=!0,c=t,o=-o}}s=c;continue e}}return s}}function tn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function nn(e,t){var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),s=r.selection=document.createDocumentFragment();for(var o=0;o<n.sel.ranges.length;o++){if(t===!1&&o==n.sel.primIndex)continue;var u=n.sel.ranges[o],a=u.empty();(a||e.options.showCursorWhenSelecting)&&rn(e,u,i),a||sn(e,u,s)}return r}function rn(e,t,n){var r=Bn(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(lu("div","ย ","CodeMirror-cursor"));i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px";if(r.other){var s=n.appendChild(lu("div","ย ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=r.other.left+"px",s.style.top=r.other.top+"px",s.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function sn(e,t,n){function f(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild(lu("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(n==null?a-e:n)+"px; height: "+(r-t)+"px"))}function l(t,n,r){function h(n,r){return Hn(e,dt(t,n),"div",s,r)}var s=eo(i,t),o=s.text.length,l,c;return Hu(uo(s),n||0,r==null?o:r,function(e,t,i){var s=h(e,"left"),p,d,v;if(e==t)p=s,d=v=s.left;else{p=h(t-1,"right");if(i=="rtl"){var m=s;s=p,p=m}d=s.left,v=p.right}n==null&&e==0&&(d=u),p.top-s.top>3&&(f(d,s.top,null,s.bottom),d=u,s.bottom<p.top&&f(d,s.bottom,null,p.top)),r==null&&t==o&&(v=a);if(!l||s.top<l.top||s.top==l.top&&s.left<l.left)l=s;if(!c||p.bottom>c.bottom||p.bottom==c.bottom&&p.right>c.right)c=p;d<u+1&&(d=u),f(d,p.top,v-d,p.bottom)}),{start:l,end:c}}var r=e.display,i=e.doc,s=document.createDocumentFragment(),o=pn(e.display),u=o.left,a=Math.max(r.sizerWidth,vn(e)-r.sizer.offsetLeft)-o.right,c=t.from(),h=t.to();if(c.line==h.line)l(c.line,c.ch,h.ch);else{var p=eo(i,c.line),d=eo(i,h.line),v=ps(p)==ps(d),m=l(c.line,c.ch,v?p.text.length+1:null).end,g=l(h.line,v?0:null,h.ch).start;v&&(m.top<g.top-2?(f(m.right,m.top,null,m.bottom),f(u,g.top,g.left,g.bottom)):f(m.right,m.top,g.left-m.right,m.bottom)),m.bottom<g.top&&f(u,m.bottom,null,g.top)}n.appendChild(s)}function on(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function un(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,ru(an,e))}function an(e){var t=e.doc;t.frontier<t.first&&(t.frontier=t.first);if(t.frontier>=e.display.viewTo)return;var n=+(new Date)+e.options.workTime,r=Oi(t.mode,ln(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(t.frontier>=e.display.viewFrom){var o=s.styles,u=Ms(e,s,r,!0);s.styles=u.styles;var a=s.styleClasses,f=u.classes;f?s.styleClasses=f:a&&(s.styleClasses=null);var l=!o||o.length!=s.styles.length||a!=f&&(!a||!f||a.bgClass!=f.bgClass||a.textClass!=f.textClass);for(var c=0;!l&&c<o.length;++c)l=o[c]!=s.styles[c];l&&i.push(t.frontier),s.stateAfter=Oi(t.mode,r)}else Ds(e,s.text,r),s.stateAfter=t.frontier%5==0?Oi(t.mode,r):null;++t.frontier;if(+(new Date)>n)return un(e,e.options.workDelay),!0}),i.length&&tr(e,function(){for(var t=0;t<i.length;t++)ar(e,i[t],"text")})}function fn(e,t,n){var r,i,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100);for(var u=t;u>o;--u){if(u<=s.first)return s.first;var a=eo(s,u-1);if(a.stateAfter&&(!n||u<=s.frontier))return u;var f=Vo(a.text,null,e.options.tabSize);if(i==null||r>f)i=u-1,r=f}return i}function ln(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var s=fn(e,t,n),o=s>r.first&&eo(r,s-1).stateAfter;return o?o=Oi(r.mode,o):o=Mi(r.mode),r.iter(s,t,function(n){Ds(e,n.text,o);var u=s==t-1||s%5==0||s>=i.viewFrom&&s<i.viewTo;n.stateAfter=u?Oi(r.mode,o):null,++s}),n&&(r.frontier=s),o}function cn(e){return e.lineSpace.offsetTop}function hn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function pn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=pu(e.measure,lu("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function dn(e){return qo-e.display.nativeBarWidth}function vn(e){return e.display.scroller.clientWidth-dn(e)-e.display.barWidth}function mn(e){return e.display.scroller.clientHeight-dn(e)-e.display.barHeight}function gn(e,t,n){var r=e.options.lineWrapping,i=r&&vn(e);if(!t.measure.heights||r&&t.measure.width!=i){var s=t.measure.heights=[];if(r){t.measure.width=i;var o=t.text.firstChild.getClientRects();for(var u=0;u<o.length-1;u++){var a=o[u],f=o[u+1];Math.abs(a.bottom-f.bottom)>2&&s.push((a.bottom+f.top)/2-n.top)}}s.push(n.bottom-n.top)}}function yn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(io(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function bn(e,t){t=ps(t);var n=io(t),r=e.display.externalMeasured=new sr(e.doc,t,n);r.lineN=n;var i=r.built=js(e,r);return r.text=i.pre,pu(e.display.lineMeasure,i.pre),r}function wn(e,t,n,r){return xn(e,Sn(e,t),n,r)}function En(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[lr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Sn(e,t){var n=io(t),r=En(e,n);r&&!r.text?r=null:r&&r.changes&&nt(e,r,n,et(e)),r||(r=bn(e,t));var i=yn(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function xn(e,t,n,r,i){t.before&&(n=-1);var s=n+(r||""),o;return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(gn(e,t.view,t.rect),t.hasHeights=!0),o=Cn(e,t,n,r),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Nn(e,t,n){var r,i,s,o;for(var u=0;u<e.length;u+=3){var a=e[u],f=e[u+1];if(t<a)i=0,s=1,o="left";else if(t<f)i=t-a,s=i+1;else if(u==e.length-3||t==f&&e[u+3]>t)s=f-a,i=s-1,t>=f&&(o="right");if(i!=null){r=e[u+2],a==f&&n==(r.insertLeft?"left":"right")&&(o=n);if(n=="left"&&i==0)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)r=e[(u-=3)+2],o="left";if(n=="right"&&i==f-a)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft)r=e[(u+=3)+2],o="right";break}}return{node:r,start:i,end:s,collapse:o,coverStart:a,coverEnd:f}}function Cn(e,t,n,s){var o=Nn(t.map,n,s),u=o.node,a=o.start,f=o.end,l=o.collapse,c;if(u.nodeType==3){for(var h=0;h<4;h++){while(a&&fu(t.line.text.charAt(o.coverStart+a)))--a;while(o.coverStart+f<o.coverEnd&&fu(t.line.text.charAt(o.coverStart+f)))++f;if(r&&i<9&&a==0&&f==o.coverEnd-o.coverStart)c=u.parentNode.getBoundingClientRect();else if(r&&e.options.lineWrapping){var p=cu(u,a,f).getClientRects();p.length?c=p[s=="right"?p.length-1:0]:c=Tn}else c=cu(u,a,f).getBoundingClientRect()||Tn;if(c.left||c.right||a==0)break;f=a,a-=1,l="right"}r&&i<11&&(c=kn(e.display.measure,c))}else{a>0&&(l=s="right");var p;e.options.lineWrapping&&(p=u.getClientRects()).length>1?c=p[s=="right"?p.length-1:0]:c=u.getBoundingClientRect()}if(r&&i<9&&!a&&(!c||!c.left&&!c.right)){var d=u.parentNode.getClientRects()[0];d?c={left:d.left,right:d.left+zn(e.display),top:d.top,bottom:d.bottom}:c=Tn}var v=c.top-t.rect.top,m=c.bottom-t.rect.top,g=(v+m)/2,y=t.view.measure.heights;for(var h=0;h<y.length-1;h++)if(g<y[h])break;var b=h?y[h-1]:0,w=y[h],E={left:(l=="right"?c.right:c.left)-t.rect.left,right:(l=="left"?c.left:c.right)-t.rect.left,top:b,bottom:w};return!c.left&&!c.right&&(E.bogus=!0),e.options.singleCursorHeightPerLine||(E.rtop=v,E.rbottom=m),E}function kn(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Du(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Ln(e){if(e.measure){e.measure.cache={},e.measure.heights=null;if(e.rest)for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}}function An(e){e.display.externalMeasure=null,hu(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ln(e.display.view[t])}function On(e){An(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Mn(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function _n(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Dn(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var s=Es(t.widgets[i]);n.top+=s,n.bottom+=s}if(r=="line")return n;r||(r="local");var o=oo(t);r=="local"?o+=cn(e.display):o-=e.display.viewOffset;if(r=="page"||r=="window"){var u=e.display.lineSpace.getBoundingClientRect();o+=u.top+(r=="window"?0:_n());var a=u.left+(r=="window"?0:Mn());n.left+=a,n.right+=a}return n.top+=o,n.bottom+=o,n}function Pn(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Mn(),i-=_n();else if(n=="local"||!n){var s=e.display.sizer.getBoundingClientRect();r+=s.left,i+=s.top}var o=e.display.lineSpace.getBoundingClientRect();return{left:r-o.left,top:i-o.top}}function Hn(e,t,n,r,i){return r||(r=eo(e.doc,t.line)),Dn(e,r,wn(e,r,t.ch,i),n)}function Bn(e,t,n,r,i,s){function o(t,o){var u=xn(e,i,t,o?"right":"left",s);return o?u.left=u.right:u.right=u.left,Dn(e,r,u,n)}function u(e,t){var n=a[t],r=n.level%2;return e==Bu(n)&&t&&n.level<a[t-1].level?(n=a[--t],e=ju(n)-(n.level%2?0:1),r=!0):e==ju(n)&&t<a.length-1&&n.level<a[t+1].level&&(n=a[++t],e=Bu(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?o(e-1):o(e,r)}r=r||eo(e.doc,t.line),i||(i=Sn(e,r));var a=uo(r),f=t.ch;if(!a)return o(f);var l=Xu(a,f),c=u(f,l);return Wu!=null&&(c.other=u(f,Wu)),c}function jn(e,t){var n=0,t=Ft(e.doc,t);e.options.lineWrapping||(n=zn(e.display)*t.ch);var r=eo(e.doc,t.line),i=oo(r)+cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Fn(e,t,n,r){var i=dt(e,t);return i.xRel=r,n&&(i.outside=!0),i}function In(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return Fn(r.first,0,!0,-1);var i=so(r,n),s=r.first+r.size-1;if(i>s)return Fn(r.first+r.size-1,eo(r,s).text.length,!0,1);t<0&&(t=0);var o=eo(r,i);for(;;){var u=qn(e,o,i,t,n),a=cs(o),f=a&&a.find(0,!0);if(!a||!(u.ch>f.from.ch||u.ch==f.from.ch&&u.xRel>0))return u;i=io(o=f.to.line)}}function qn(e,t,n,r,i){function f(r){var i=Bn(e,dt(n,r),"line",t,a);return o=!0,s>i.bottom?i.left-u:s<i.top?i.left+u:(o=!1,i.left)}var s=i-oo(t),o=!1,u=2*e.display.wrapper.clientWidth,a=Sn(e,t),l=uo(t),c=t.text.length,h=Fu(t),p=Iu(t),d=f(h),v=o,m=f(p),g=o;if(r>m)return Fn(n,p,g,1);for(;;){if(l?p==h||p==$u(t,h,1):p-h<=1){var y=r<d||r-d<=m-r?h:p,b=r-(y==h?d:m);while(fu(t.text.charAt(y)))++y;var w=Fn(n,y,y==h?v:g,b<-1?-1:b>1?1:0);return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;x<E;++x)S=$u(t,S,1)}var T=f(S);if(T>r){p=S,m=T;if(g=o)m+=1e3;c=E}else h=S,d=T,v=o,c-=E}}function Un(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rn==null){Rn=lu("pre");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(lu("br"));Rn.appendChild(document.createTextNode("x"))}pu(e.measure,Rn);var n=Rn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),hu(e.measure),n||1}function zn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=lu("span","xxxxxxxxxx"),n=lu("pre",[t]);pu(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Vn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Xn},Wn?Wn.ops.push(e.curOp):e.curOp.ownsGroup=Wn={ops:[e.curOp],delayedCallbacks:[]}}function $n(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n]();for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<t.length)}function Jn(e){var t=e.curOp,n=t.ownsGroup;if(!n)return;try{$n(n)}finally{Wn=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Kn(n)}}function Kn(e){var t=e.ops;for(var n=0;n<t.length;n++)Qn(t[n]);for(var n=0;n<t.length;n++)Gn(t[n]);for(var n=0;n<t.length;n++)Yn(t[n]);for(var n=0;n<t.length;n++)Zn(t[n]);for(var n=0;n<t.length;n++)er(t[n])}function Qn(e){var t=e.cm,n=t.display;$(t),e.updateMaxLine&&D(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new V(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Gn(e){e.updatedDisplay=e.mustUpdate&&J(e.cm,e.update)}function Yn(e){var t=e.cm,n=t.display;e.updatedDisplay&&Y(t),e.barMeasure=H(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=wn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+dn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vn(t)));if(e.updatedDisplay||e.selectionChanged)e.preparedSelection=n.input.prepareSelection()}function Zn(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&G(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&I(t,e.barMeasure),e.selectionChanged&&on(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing)}function er(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&K(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&(n.scroller.scrollTop!=e.scrollTop||e.forceScroll)&&(r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(r.scrollTop),n.scroller.scrollTop=r.scrollTop),e.scrollLeft!=null&&(n.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)&&(r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-vn(t),e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,U(t));if(e.scrollToPos){var i=li(t,Ft(r,e.scrollToPos.from),Ft(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&fi(t,i)}var s=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(s)for(var u=0;u<s.length;++u)s[u].lines.length||_o(s[u],"hide");if(o)for(var u=0;u<o.length;++u)o[u].lines.length&&_o(o[u],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_o(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function tr(e,t){if(e.curOp)return t();Vn(e);try{return t()}finally{Jn(e)}}function nr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Vn(e);try{return t.apply(e,arguments)}finally{Jn(e)}}}function rr(e){return function(){if(this.curOp)return e.apply(this,arguments);Vn(this);try{return e.apply(this,arguments)}finally{Jn(this)}}}function ir(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Vn(t);try{return e.apply(this,arguments)}finally{Jn(t)}}}function sr(e,t,n){this.line=t,this.rest=ds(t),this.size=this.rest?io(Qo(this.rest))-n+1:1,this.node=this.text=null,this.hidden=gs(e,t)}function or(e,t,n){var r=[],i;for(var s=t;s<n;s=i){var o=new sr(e.doc,eo(e.doc,s),s);i=s+o.size,r.push(o)}return r}function ur(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0;if(t>=i.viewTo)w&&vs(e.doc,t)<i.viewTo&&fr(e);else if(n<=i.viewFrom)w&&ms(e.doc,n+r)>i.viewFrom?fr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)fr(e);else if(t<=i.viewFrom){var s=cr(e,n,n+r,1);s?(i.view=i.view.slice(s.index),i.viewFrom=s.lineN,i.viewTo+=r):fr(e)}else if(n>=i.viewTo){var s=cr(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):fr(e)}else{var o=cr(e,t,t,-1),u=cr(e,n,n+r,1);o&&u?(i.view=i.view.slice(0,o.index).concat(or(e,o.lineN,u.lineN)).concat(i.view.slice(u.index)),i.viewTo+=r):fr(e)}var a=i.externalMeasured;a&&(n<a.lineN?a.lineN+=r:t<a.lineN+a.size&&(i.externalMeasured=null))}function ar(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null);if(t<r.viewFrom||t>=r.viewTo)return;var s=r.view[lr(e,t)];if(s.node==null)return;var o=s.changes||(s.changes=[]);Yo(o,n)==-1&&o.push(n)}function fr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function lr(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var n=e.display.view;for(var r=0;r<n.length;r++){t-=n[r].size;if(t<0)return r}}function cr(e,t,n,r){var i=lr(e,t),s,o=e.display.view;if(!w||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var u=0,a=e.display.viewFrom;u<i;u++)a+=o[u].size;if(a!=t){if(r>0){if(i==o.length-1)return null;s=a+o[i].size-t,i++}else s=a-t;t+=s,n+=s}while(vs(e.doc,n)!=n){if(i==(r<0?0:o.length-1))return null;n+=r*o[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function hr(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=or(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=or(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(lr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(or(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,lr(e,n)))),r.viewTo=n}function pr(e){var t=e.display.view,n=0;for(var r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function dr(e){function o(){t.activeTouch&&(n=setTimeout(function(){t.activeTouch=null},1e3),s=t.activeTouch,s.end=+(new Date))}function u(e){if(e.touches.length!=1)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function a(e,t){if(t.left==null)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}function f(t){Bo(e,t)||ko(t)}var t=e.display;Oo(t.scroller,"mousedown",nr(e,yr)),r&&i<11?Oo(t.scroller,"dblclick",nr(e,function(t){if(Bo(e,t))return;var n=gr(e,t);if(!n||Nr(e,t)||mr(e.display,t))return;To(t);var r=e.findWordAt(n);zt(e.doc,r.anchor,r.head)})):Oo(t.scroller,"dblclick",function(t){Bo(e,t)||To(t)}),y||Oo(t.scroller,"contextmenu",function(t){Jr(e,t)});var n,s={end:0};Oo(t.scroller,"touchstart",function(e){if(!u(e)){clearTimeout(n);var r=+(new Date);t.activeTouch={start:r,moved:!1,prev:r-s.end<=300?s:null},e.touches.length==1&&(t.activeTouch.left=e.touches[0].pageX,t.activeTouch.top=e.touches[0].pageY)}}),Oo(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oo(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!mr(t,n)&&r.left!=null&&!r.moved&&new Date-r.start<300){var i=e.coordsChar(t.activeTouch,"page"),s;!r.prev||a(r,r.prev)?s=new Pt(i,i):!r.prev.prev||a(r,r.prev.prev)?s=e.findWordAt(i):s=new Pt(dt(i.line,0),Ft(e.doc,dt(i.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),To(n)}o()}),Oo(t.scroller,"touchcancel",o),Oo(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ar(e,t.scroller.scrollTop),Or(e,t.scroller.scrollLeft,!0),_o(e,"scroll",e))}),Oo(t.scroller,"mousewheel",function(t){Pr(e,t)}),Oo(t.scroller,"DOMMouseScroll",function(t){Pr(e,t)}),Oo(t.wrapper,"scroll",function(){t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),e.options.dragDrop&&(Oo(t.scroller,"dragstart",function(t){Lr(e,t)}),Oo(t.scroller,"dragenter",f),Oo(t.scroller,"dragover",f),Oo(t.scroller,"drop",nr(e,kr)));var l=t.input.getField();Oo(l,"keyup",function(t){Wr.call(e,t)}),Oo(l,"keydown",nr(e,Ur)),Oo(l,"keypress",nr(e,Xr)),Oo(l,"focus",ru(Vr,e)),Oo(l,"blur",ru($r,e))}function vr(e){var t=e.display;if(t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth)return;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}function mr(e,t){for(var n=Lo(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function gr(e,t,n,r){var i=e.display;if(!n&&Lo(t).getAttribute("cm-not-content")=="true")return null;var s,o,u=i.lineSpace.getBoundingClientRect();try{s=t.clientX-u.left,o=t.clientY-u.top}catch(t){return null}var a=In(e,s,o),f;if(r&&a.xRel==1&&(f=eo(e.doc,a.line).text).length==a.ch){var l=Vo(f,f.length,e.options.tabSize)-f.length;a=dt(a.line,Math.max(0,Math.round((s-pn(e.display).left)/zn(e.display))-l))}return a}function yr(e){var t=this,n=t.display;if(n.activeTouch&&n.input.supportsTouch()||Bo(t,e))return;n.shift=e.shiftKey;if(mr(n,e)){s||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100));return}if(Nr(t,e))return;var r=gr(t,e);window.focus();switch(Ao(e)){case 1:r?Er(t,e,r):Lo(e)==n.scroller&&To(e);break;case 2:s&&(t.state.lastMiddleDown=+(new Date)),r&&zt(t.doc,r),setTimeout(function(){n.input.focus()},20),To(e);break;case 3:y&&Jr(t,e)}}function Er(e,t,n){r?setTimeout(ru(bt,e),0):bt(e);var i=+(new Date),s;wr&&wr.time>i-400&&vt(wr.pos,n)==0?s="triple":br&&br.time>i-400&&vt(br.pos,n)==0?(s="double",wr={time:i,pos:n}):(s="single",br={time:i,pos:n});var o=e.doc.sel,u=d?t.metaKey:t.ctrlKey,a;e.options.dragDrop&&Tu&&!wt(e)&&s=="single"&&(a=o.contains(n))>-1&&!o.ranges[a].empty()?Sr(e,t,n,u):xr(e,t,n,s,u)}function Sr(e,t,n,o){var u=e.display,a=nr(e,function(f){s&&(u.scroller.draggable=!1),e.state.draggingText=!1,Mo(document,"mouseup",a),Mo(u.scroller,"drop",a),Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)<10&&(To(f),o||zt(e.doc,n),u.input.focus(),r&&i==9&&setTimeout(function(){document.body.focus(),u.input.focus()},20))});s&&(u.scroller.draggable=!0),e.state.draggingText=a,u.scroller.dragDrop&&u.scroller.dragDrop(),Oo(document,"mouseup",a),Oo(u.scroller,"drop",a)}function xr(e,t,n,r,i){function d(t){if(vt(p,t)==0)return;p=t;if(r=="rect"){var i=[],s=e.options.tabSize,l=Vo(eo(o,n.line).text,n.ch,s),c=Vo(eo(o,t.line).text,t.ch,s),h=Math.min(l,c),d=Math.max(l,c);for(var v=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));v<=m;v++){var g=eo(o,v).text,y=$o(g,h,s);h==d?i.push(new Pt(dt(v,y),dt(v,y))):g.length>y&&i.push(new Pt(dt(v,y),dt(v,$o(g,d,s))))}i.length||i.push(new Pt(n,n)),Kt(o,Ht(f.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,E=t;if(r!="single"){if(r=="double")var S=e.findWordAt(t);else var S=new Pt(dt(t.line,0),Ft(o,dt(t.line+1,0)));vt(S.anchor,w)>0?(E=S.head,w=yt(b.from(),S.anchor)):(E=S.anchor,w=gt(b.to(),S.head))}var i=f.ranges.slice(0);i[a]=new Pt(Ft(o,w),E),Kt(o,Ht(i,a),zo)}}function g(t){var n=++m,i=gr(e,t,!0,r=="rect");if(!i)return;if(vt(i,p)!=0){bt(e),d(i);var u=R(s,o);(i.line>=u.to||i.line<u.from)&&setTimeout(nr(e,function(){m==n&&g(t)}),150)}else{var a=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;a&&setTimeout(nr(e,function(){if(m!=n)return;s.scroller.scrollTop+=a,g(t)}),50)}}function y(e){m=Infinity,To(e),s.input.focus(),Mo(document,"mousemove",b),Mo(document,"mouseup",w),o.history.lastSelOrigin=null}var s=e.display,o=e.doc;To(t);var u,a,f=o.sel,l=f.ranges;i&&!t.shiftKey?(a=o.sel.contains(n),a>-1?u=l[a]:u=new Pt(n,n)):u=o.sel.primary();if(t.altKey)r="rect",i||(u=new Pt(n,n)),n=gr(e,t,!0,!0),a=-1;else if(r=="double"){var c=e.findWordAt(n);e.display.shift||o.extend?u=Ut(o,u,c.anchor,c.head):u=c}else if(r=="triple"){var h=new Pt(dt(n.line,0),Ft(o,dt(n.line+1,0)));e.display.shift||o.extend?u=Ut(o,u,h.anchor,h.head):u=h}else u=Ut(o,u,n);i?a==-1?(a=l.length,Kt(o,Ht(l.concat([u]),a),{scroll:!1,origin:"*mouse"})):l.length>1&&l[a].empty()&&r=="single"?(Kt(o,Ht(l.slice(0,a).concat(l.slice(a+1)),0)),f=o.sel):Xt(o,a,u,zo):(a=0,Kt(o,new Dt([u],0),zo),f=o.sel);var p=n,v=s.wrapper.getBoundingClientRect(),m=0,b=nr(e,function(e){Ao(e)?g(e):y(e)}),w=nr(e,y);Oo(document,"mousemove",b),Oo(document,"mouseup",w)}function Tr(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&To(t);var u=e.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!Fo(e,n))return Co(t);o-=a.top-u.viewOffset;for(var f=0;f<e.options.gutters.length;++f){var l=u.gutters.childNodes[f];if(l&&l.getBoundingClientRect().right>=s){var c=so(e.doc,o),h=e.options.gutters[f];return i(e,n,e,c,h,t),Co(t)}}}function Nr(e,t){return Tr(e,t,"gutterClick",!0,Po)}function kr(e){var t=this;if(Bo(t,e)||mr(t.display,e))return;To(e),r&&(Cr=+(new Date));var n=gr(t,e,!0),i=e.dataTransfer.files;if(!n||wt(t))return;if(i&&i.length&&window.FileReader&&window.File){var s=i.length,o=Array(s),u=0,a=function(e,r){var i=new FileReader;i.onload=nr(t,function(){o[r]=i.result;if(++u==s){n=Ft(t.doc,n);var e={from:n,to:n,text:Au(o.join("\n")),origin:"paste"};ni(t.doc,e),Jt(t.doc,Bt(n,Qr(e)))}}),i.readAsText(e)};for(var f=0;f<s;++f)a(i[f],f)}else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){t.display.input.focus()},20);return}try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&(d?!e.metaKey:!e.ctrlKey))var l=t.listSelections();Qt(t.doc,Bt(n,n));if(l)for(var f=0;f<l.length;++f)ai(t.doc,"",l[f].anchor,l[f].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}function Lr(e,t){if(r&&(!e.state.draggingText||+(new Date)-Cr<100)){ko(t);return}if(Bo(e,t)||mr(e.display,t))return;t.dataTransfer.setData("Text",e.getSelection());if(t.dataTransfer.setDragImage&&!f){var n=lu("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",a&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),a&&n.parentNode.removeChild(n)}}function Ar(t,n){if(Math.abs(t.doc.scrollTop-n)<2)return;t.doc.scrollTop=n,e||Q(t,{top:n}),t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n),t.display.scrollbars.setScrollTop(n),e&&Q(t),un(t,100)}function Or(e,t,n){if(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)return;t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,U(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Pr(t,n){var r=Dr(n),i=r.x,o=r.y,u=t.display,f=u.scroller;if(!(i&&f.scrollWidth>f.clientWidth||o&&f.scrollHeight>f.clientHeight))return;if(o&&d&&s)e:for(var l=n.target,c=u.view;l!=f;l=l.parentNode)for(var h=0;h<c.length;h++)if(c[h].node==l){t.display.currentWheelTarget=l;break e}if(i&&!e&&!a&&_r!=null){o&&Ar(t,Math.max(0,Math.min(f.scrollTop+o*_r,f.scrollHeight-f.clientHeight))),Or(t,Math.max(0,Math.min(f.scrollLeft+i*_r,f.scrollWidth-f.clientWidth))),To(n),u.wheelStartX=null;return}if(o&&_r!=null){var p=o*_r,v=t.doc.scrollTop,m=v+u.wrapper.clientHeight;p<0?v=Math.max(0,v+p-50):m=Math.min(t.doc.height,m+p+50),Q(t,{top:v,bottom:m})}Mr<20&&(u.wheelStartX==null?(u.wheelStartX=f.scrollLeft,u.wheelStartY=f.scrollTop,u.wheelDX=i,u.wheelDY=o,setTimeout(function(){if(u.wheelStartX==null)return;var e=f.scrollLeft-u.wheelStartX,t=f.scrollTop-u.wheelStartY,n=t&&u.wheelDY&&t/u.wheelDY||e&&u.wheelDX&&e/u.wheelDX;u.wheelStartX=u.wheelStartY=null;if(!n)return;_r=(_r*Mr+n)/(Mr+1),++Mr},200)):(u.wheelDX+=i,u.wheelDY+=o))}function Hr(e,t,n){if(typeof t=="string"){t=_i[t];if(!t)return!1}e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{wt(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ro}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Br(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Hi(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Hi(t,e.options.extraKeys,n,e)||Hi(t,e.options.keyMap,n,e)}function Fr(e,t,n,r){var i=e.state.keySeq;if(i){if(Bi(t))return"handled";jr.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var s=Br(e,t,r);s=="multi"&&(e.state.keySeq=t),s=="handled"&&Po(e,"keyHandled",e,t,n);if(s=="handled"||s=="multi")To(n),on(e);return i&&!s&&/\'$/.test(t)?(To(n),!0):!!s}function Ir(e,t){var n=ji(t,!0);return n?t.shiftKey&&!e.state.keySeq?Fr(e,"Shift-"+n,t,function(t){return Hr(e,t,!0)})||Fr(e,n,t,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return Hr(e,t)}):Fr(e,n,t,function(t){return Hr(e,t)}):!1}function qr(e,t,n){return Fr(e,"'"+n+"'",t,function(t){return Hr(e,t,!0)})}function Ur(e){var t=this;bt(t);if(Bo(t,e))return;r&&i<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var s=Ir(t,e);a&&(Rr=s?n:null,!s&&n==88&&!Mu&&(d?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&zr(t)}function zr(e){function n(e){if(e.keyCode==18||!e.altKey)gu(t,"CodeMirror-crosshair"),Mo(document,"keyup",n),Mo(document,"mouseover",n)}var t=e.display.lineDiv;yu(t,"CodeMirror-crosshair"),Oo(document,"keyup",n),Oo(document,"mouseover",n)}function Wr(e){e.keyCode==16&&(this.doc.sel.shift=!1),Bo(this,e)}function Xr(e){var t=this;if(mr(t.display,e)||Bo(t,e)||e.ctrlKey&&!e.altKey||d&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(a&&n==Rr){Rr=null,To(e);return}if(a&&(!e.which||e.which<10)&&Ir(t,e))return;var i=String.fromCharCode(r==null?n:r);if(qr(t,e,i))return;t.display.input.onKeyPress(e)}function Vr(e){if(e.options.readOnly=="nocursor")return;e.state.focused||(_o(e,"focus",e),e.state.focused=!0,yu(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),s&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),on(e)}function $r(e){e.state.focused&&(_o(e,"blur",e),e.state.focused=!1,gu(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Jr(e,t){if(mr(e.display,t)||Kr(e,t))return;e.display.input.onContextMenu(t)}function Kr(e,t){return Fo(e,"gutterContextMenu")?Tr(e,t,"gutterContextMenu",!1,_o):!1}function Gr(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return Qr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Qr(t).ch-t.to.ch),dt(n,r)}function Yr(e,t){var n=[];for(var r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Pt(Gr(i.anchor,t),Gr(i.head,t)))}return Ht(n,e.sel.primIndex)}function Zr(e,t,n){return e.line==t.line?dt(n.line,e.ch-t.ch+n.ch):dt(n.line+(e.line-t.line),e.ch)}function ei(e,t,n){var r=[],i=dt(e.first,0),s=i;for(var o=0;o<t.length;o++){var u=t[o],a=Zr(u.from,i,s),f=Zr(Qr(u),i,s);i=u.to,s=f;if(n=="around"){var l=e.sel.ranges[o],c=vt(l.head,l.anchor)<0;r[o]=new Pt(c?f:a,c?a:f)}else r[o]=new Pt(a,a)}return new Dt(r,e.sel.primIndex)}function ti(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=Ft(e,t)),n&&(this.to=Ft(e,n)),r&&(this.text=r),i!==undefined&&(this.origin=i)}),_o(e,"beforeChange",e,r),e.cm&&_o(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ni(e,t,n){if(e.cm){if(!e.cm.curOp)return nr(e.cm,ni)(e,t,n);if(e.cm.state.suppressEdits)return}if(Fo(e,"beforeChange")||e.cm&&Fo(e.cm,"beforeChange")){t=ti(e,t,!0);if(!t)return}var r=b&&!n&&rs(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)ri(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else ri(e,t)}function ri(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var n=Yr(e,t);ho(e,t,n,e.cm?e.cm.curOp.id:NaN),oi(e,t,n,es(e,t));var r=[];Ys(e,function(e,n){!n&&Yo(r,e.history)==-1&&(xo(e.history,t),r.push(e.history)),oi(e,t,null,es(e,t))})}function ii(e,t,n){if(e.cm&&e.cm.state.suppressEdits)return;var r=e.history,i,s=e.sel,o=t=="undo"?r.done:r.undone,u=t=="undo"?r.undone:r.done;for(var a=0;a<o.length;a++){i=o[a];if(n?i.ranges&&!i.equals(e.sel):!i.ranges)break}if(a==o.length)return;r.lastOrigin=r.lastSelOrigin=null;for(;;){i=o.pop();if(!i.ranges)break;mo(i,u);if(n&&!i.equals(e.sel)){Kt(e,i,{clearRedo:!1});return}s=i}var f=[];mo(s,u),u.push({changes:f,generation:r.generation}),r.generation=i.generation||++r.maxGeneration;var l=Fo(e,"beforeChange")||e.cm&&Fo(e.cm,"beforeChange");for(var a=i.changes.length-1;a>=0;--a){var c=i.changes[a];c.origin=t;if(l&&!ti(e,c,!1)){o.length=0;return}f.push(fo(e,c));var h=a?Yr(e,c):Qo(o);oi(e,c,h,ns(e,c)),!a&&e.cm&&e.cm.scrollIntoView({from:c.from,to:Qr(c)});var p=[];Ys(e,function(e,t){!t&&Yo(p,e.history)==-1&&(xo(e.history,c),p.push(e.history)),oi(e,c,null,ns(e,c))})}}function si(e,t){if(t==0)return;e.first+=t,e.sel=new Dt(Zo(e.sel.ranges,function(e){return new Pt(dt(e.anchor.line+t,e.anchor.ch),dt(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){ur(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)ar(e.cm,r,"gutter")}}function oi(e,t,n,r){if(e.cm&&!e.cm.curOp)return nr(e.cm,oi)(e,t,n,r);if(t.to.line<e.first){si(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);si(e,i),t={from:dt(e.first,0),to:dt(t.to.line+i,t.to.ch),text:[Qo(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:dt(s,eo(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=to(e,t.from,t.to),n||(n=Yr(e,t)),e.cm?ui(e.cm,t,r):Xs(e,t,r),Qt(e,n,Uo)}function ui(e,t,n){var r=e.doc,i=e.display,s=t.from,o=t.to,u=!1,a=s.line;e.options.lineWrapping||(a=io(ps(eo(r,s.line))),r.iter(a,o.line+1,function(e){if(e==i.maxLine)return u=!0,!0})),r.sel.contains(t.from,t.to)>-1&&jo(e),Xs(r,t,n,C(e)),e.options.lineWrapping||(r.iter(a,s.line+t.text.length,function(e){var t=_(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),un(e,400);var f=t.text.length-(o.line-s.line)-1;t.full?ur(e):s.line==o.line&&t.text.length==1&&!Ws(e.doc,t)?ar(e,s.line,"text"):ur(e,s.line,o.line+1,f);var l=Fo(e,"changes"),c=Fo(e,"change");if(c||l){var h={from:s,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&Po(e,"change",e,h),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function ai(e,t,n,r,i){r||(r=n);if(vt(r,n)<0){var s=r;r=n,n=s}typeof t=="string"&&(t=Au(t)),ni(e,{from:n,to:r,text:t,origin:i})}function fi(e,t){if(Bo(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!c){var s=lu("div","โ€‹",null,"position: absolute; top: "+(t.top-n.viewOffset-cn(e.display))+"px; height: "+(t.bottom-t.top+dn(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}function li(e,t,n,r){r==null&&(r=0);for(var i=0;i<5;i++){var s=!1,o=Bn(e,t),u=!n||n==t?o:Bn(e,n),a=hi(e,Math.min(o.left,u.left),Math.min(o.top,u.top)-r,Math.max(o.left,u.left),Math.max(o.bottom,u.bottom)+r),f=e.doc.scrollTop,l=e.doc.scrollLeft;a.scrollTop!=null&&(Ar(e,a.scrollTop),Math.abs(e.doc.scrollTop-f)>1&&(s=!0)),a.scrollLeft!=null&&(Or(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-l)>1&&(s=!0));if(!s)break}return o}function ci(e,t,n,r,i){var s=hi(e,t,n,r,i);s.scrollTop!=null&&Ar(e,s.scrollTop),s.scrollLeft!=null&&Or(e,s.scrollLeft)}function hi(e,t,n,r,i){var s=e.display,o=Un(e.display);n<0&&(n=0);var u=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,a=mn(e),f={};i-n>a&&(i=n+a);var l=e.doc.height+hn(s),c=n<o,h=i>l-o;if(n<u)f.scrollTop=c?0:n;else if(i>u+a){var p=Math.min(n,(h?l:i)-a);p!=u&&(f.scrollTop=p)}var d=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft,v=vn(e)-(e.options.fixedGutter?s.gutters.offsetWidth:0),m=r-t>v;return m&&(r=t+v),t<10?f.scrollLeft=0:t<d?f.scrollLeft=Math.max(0,t-(m?0:10)):r>v+d-3&&(f.scrollLeft=r+(m?0:10)-v),f}function pi(e,t,n){(t!=null||n!=null)&&vi(e),t!=null&&(e.curOp.scrollLeft=(e.curOp.scrollLeft==null?e.doc.scrollLeft:e.curOp.scrollLeft)+t),n!=null&&(e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n)}function di(e){vi(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?dt(t.line,t.ch-1):t,r=dt(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function vi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=jn(e,t.from),r=jn(e,t.to),i=hi(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function mi(e,t,n,r){var i=e.doc,s;n==null&&(n="add"),n=="smart"&&(i.mode.indent?s=ln(e,t):n="prev");var o=e.options.tabSize,u=eo(i,t),a=Vo(u.text,null,o);u.stateAfter&&(u.stateAfter=null);var f=u.text.match(/^\s*/)[0],l;if(!r&&!/\S/.test(u.text))l=0,n="not";else if(n=="smart"){l=i.mode.indent(s,u.text.slice(f.length),u.text);if(l==Ro||l>150){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=Vo(eo(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n),l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p)h+=o,c+="	";h<l&&(c+=Ko(l-h));if(c!=f)ai(i,c,dt(t,0),dt(t,f.length),"+input");else for(var p=0;p<i.sel.ranges.length;p++){var d=i.sel.ranges[p];if(d.head.line==t&&d.head.ch<f.length){var h=dt(t,f.length);Xt(i,p,new Pt(h,h));break}}u.stateAfter=null}function gi(e,t,n,r){var i=t,s=t;return typeof t=="number"?s=eo(e,jt(e,t)):i=io(t),i==null?null:(r(s,i)&&e.cm&&ar(e.cm,i,n),s)}function yi(e,t){var n=e.doc.sel.ranges,r=[];for(var i=0;i<n.length;i++){var s=t(n[i]);while(r.length&&vt(s.from,Qo(r).to)<=0){var o=r.pop();if(vt(o.from,s.from)<0){s.from=o.from;break}}r.push(s)}tr(e,function(){for(var t=r.length-1;t>=0;t--)ai(e.doc,"",r[t].from,r[t].to,"+delete");di(e)})}function bi(e,t,n,r,i){function l(){var t=s+n;return t<e.first||t>=e.first+e.size?f=!1:(s=t,a=eo(e,t))}function c(e){var t=(i?$u:Ju)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Iu:Fu)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=eo(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group",d=e.cm&&e.cm.getHelper(t,"wordChars");for(var v=!0;;v=!1){if(n<0&&!c(!v))break;var m=a.text.charAt(o)||"\n",g=ou(m,d)?"w":p&&m=="\n"?"n":!p||/\s/.test(m)?null:"p";p&&!v&&!g&&(g="s");if(h&&h!=g){n<0&&(n=1,c());break}g&&(h=g);if(n>0&&!c(!v))break}}var y=en(e,dt(s,o),u,!0);return f||(y.hitSide=!0),y}function wi(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*Un(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=In(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function xi(e,t,n,r){E.defaults[e]=t,n&&(Si[e]=r?function(e,t,r){r!=Ti&&n(e,t,r)}:n)}function Pi(e){var t=e.split(/-(?!$)/),e=t[t.length-1],n,r,i,s;for(var o=0;o<t.length-1;o++){var u=t[o];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))r=!0;else{if(!/^s(hift)$/i.test(u))throw new Error("Unrecognized modifier name: "+u);i=!0}}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),s&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Fi(e){return typeof e=="string"?Di[e]:e}function Ui(e,t,n,r,i){if(r&&r.shared)return Wi(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return nr(e.cm,Ui)(e,t,n,r,i);var s=new Ri(e,i),o=vt(t,n);r&&nu(r,s,!1);if(o>0||o==0&&s.clearWhenEmpty!==!1)return s;s.replacedWith&&(s.collapsed=!0,s.widgetNode=lu("span",[s.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(s.widgetNode.insertLeft=!0));if(s.collapsed){if(hs(e,t.line,t,n,s)||t.line!=n.line&&hs(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");w=!0}s.addToHistory&&ho(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u=t.line,a=e.cm,f;e.iter(u,n.line+1,function(e){a&&s.collapsed&&!a.options.lineWrapping&&ps(e)==a.display.maxLine&&(f=!0),s.collapsed&&u!=t.line&&ro(e,0),Gi(e,new Ji(s,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),s.collapsed&&e.iter(t.line,n.line+1,function(t){gs(e,t)&&ro(t,0)}),s.clearOnEnter&&Oo(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(b=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++qi,s.atomic=!0);if(a){f&&(a.curOp.updateMaxLine=!0);if(s.collapsed)ur(a,t.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(var l=t.line;l<=n.line;l++)ar(a,l,"text");s.atomic&&Yt(a.doc),Po(a,"markerAdded",a,s)}return s}function Wi(e,t,n,r,i){r=nu(r),r.shared=!1;var s=[Ui(e,t,n,r,i)],o=s[0],u=r.widgetNode;return Ys(e,function(e){u&&(r.widgetNode=u.cloneNode(!0)),s.push(Ui(e,Ft(e,t),Ft(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;o=Qo(s)}),new zi(s,o)}function Xi(e){return e.findMarks(dt(e.first,0),e.clipPos(dt(e.lastLine())),function(e){return e.parent})}function Vi(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),s=e.clipPos(i.from),o=e.clipPos(i.to);if(vt(s,o)){var u=Ui(e,s,o,r.primary,r.primary.type);r.markers.push(u),u.parent=r}}}function $i(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Ys(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var s=n.markers[i];Yo(r,s.doc)==-1&&(s.parent=null,n.markers.splice(i--,1))}}}function Ji(e,t,n){this.marker=e,this.from=t,this.to=n}function Ki(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Qi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Gi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Yi(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||s.from==t&&o.type=="bookmark"&&(!n||!s.marker.insertLeft)){var a=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);(i||(i=[])).push(new Ji(o,s.from,a?null:s.to))}}return i}function Zi(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);if(u||s.from==t&&o.type=="bookmark"&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);(i||(i=[])).push(new Ji(o,a?null:s.from-t,s.to==null?null:s.to-t))}}return i}function es(e,t){if(t.full)return null;var n=qt(e,t.from.line)&&eo(e,t.from.line).markedSpans,r=qt(e,t.to.line)&&eo(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,s=t.to.ch,o=vt(t.from,t.to)==0,u=Yi(n,i,o),a=Zi(r,s,o),f=t.text.length==1,l=Qo(t.text).length+(f?i:0);if(u)for(var c=0;c<u.length;++c){var h=u[c];if(h.to==null){var p=Ki(a,h.marker);p?f&&(h.to=p.to==null?null:p.to+l):h.to=i}}if(a)for(var c=0;c<a.length;++c){var h=a[c];h.to!=null&&(h.to+=l);if(h.from==null){var p=Ki(u,h.marker);p||(h.from=l,f&&(u||(u=[])).push(h))}else h.from+=l,f&&(u||(u=[])).push(h)}u&&(u=ts(u)),a&&a!=u&&(a=ts(a));var d=[u];if(!f){var v=t.text.length-2,m;if(v>0&&u)for(var c=0;c<u.length;++c)u[c].to==null&&(m||(m=[])).push(new Ji(u[c].marker,null,null));for(var c=0;c<v;++c)d.push(m);d.push(a)}return d}function ts(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ns(e,t){var n=bo(e,t),r=es(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var s=n[i],o=r[i];if(s&&o)e:for(var u=0;u<o.length;++u){var a=o[u];for(var f=0;f<s.length;++f)if(s[f].marker==a.marker)continue e;s.push(a)}else o&&(n[i]=o)}return n}function rs(e,t,n){var r=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;n.readOnly&&(!r||Yo(r,n)==-1)&&(r||(r=[])).push(n)}});if(!r)return null;var i=[{from:t,to:n}];for(var s=0;s<r.length;++s){var o=r[s],u=o.find(0);for(var a=0;a<i.length;++a){var f=i[a];if(vt(f.to,u.from)<0||vt(f.from,u.to)>0)continue;var l=[a,1],c=vt(f.from,u.from),h=vt(f.to,u.to);(c<0||!o.inclusiveLeft&&!c)&&l.push({from:f.from,to:u.from}),(h>0||!o.inclusiveRight&&!h)&&l.push({from:u.to,to:f.to}),i.splice.apply(i,l),a+=l.length-1}}return i}function is(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function ss(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function os(e){return e.inclusiveLeft?-1:0}function us(e){return e.inclusiveRight?1:0}function as(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),s=vt(r.from,i.from)||os(e)-os(t);if(s)return-s;var o=vt(r.to,i.to)||us(e)-us(t);return o?o:t.id-e.id}function fs(e,t){var n=w&&e.markedSpans,r;if(n)for(var i,s=0;s<n.length;++s)i=n[s],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||as(r,i.marker)<0)&&(r=i.marker);return r}function ls(e){return fs(e,!0)}function cs(e){return fs(e,!1)}function hs(e,t,n,r,i){var s=eo(e,t),o=w&&s.markedSpans;if(o)for(var u=0;u<o.length;++u){var a=o[u];if(!a.marker.collapsed)continue;var f=a.marker.find(0),l=vt(f.from,n)||os(a.marker)-os(i),c=vt(f.to,r)||us(a.marker)-us(i);if(l>=0&&c<=0||l<=0&&c>=0)continue;if(l<=0&&(vt(f.to,n)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||l>=0&&(vt(f.from,r)<0||a.marker.inclusiveLeft&&i.inclusiveRight))return!0}}function ps(e){var t;while(t=ls(e))e=t.find(-1,!0).line;return e}function ds(e){var t,n;while(t=cs(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function vs(e,t){var n=eo(e,t),r=ps(n);return n==r?t:io(r)}function ms(e,t){if(t>e.lastLine())return t;var n=eo(e,t),r;if(!gs(e,n))return t;while(r=cs(n))n=r.find(1,!0).line;return io(n)+1}function gs(e,t){var n=w&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}function ys(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ys(e,r.line,Ki(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i,s=0;s<t.markedSpans.length;++s){i=t.markedSpans[s];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ys(e,t,i))return!0}}function ws(e,t,n){oo(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&pi(e,null,n)}function Es(e){if(e.height!=null)return e.height;if(!du(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+e.cm.display.wrapper.clientWidth+"px;"),pu(e.cm.display.measure,lu("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function Ss(e,t,n,r){var i=new bs(e,n,r);return i.noHScroll&&(e.display.alignWidgets=!0),gi(e.doc,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);i.insertAt==null?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t;if(!gs(e.doc,t)){var r=oo(t)<e.doc.scrollTop;ro(t,t.height+Es(i)),r&&pi(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function Ts(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),is(e),ss(e,n);var i=r?r(e):1;i!=e.height&&ro(e,i)}function Ns(e){e.parent=null,is(e)}function Cs(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:(new RegExp("(?:^|s)"+n[2]+"(?:$|s)")).test(t[r])||(t[r]+=" "+n[2])}return e}function ks(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=E.innerMode(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Ls(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=E.innerMode(e,n).mode);var s=e.token(t,n);if(t.pos>t.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}function As(e,t,n,r){function i(e){return{start:l.start,end:l.pos,string:l.current(),type:u||null,state:e?Oi(s.mode,f):f}}var s=e.doc,o=s.mode,u;t=Ft(s,t);var a=eo(s,t.line),f=ln(e,t.line,n),l=new Ii(a.text,e.options.tabSize),c;r&&(c=[]);while((r||l.pos<t.ch)&&!l.eol())l.start=l.pos,u=Ls(o,l,f),r&&c.push(i(!0));return r?c:i()}function Os(e,t,n,r,i,s,o){var u=n.flattenSpans;u==null&&(u=e.options.flattenSpans);var a=0,f=null,l=new Ii(t,e.options.tabSize),c,h=e.options.addModeClass&&[null];t==""&&Cs(ks(n,r),s);while(!l.eol()){l.pos>e.options.maxHighlightLength?(u=!1,o&&Ds(e,t,r,l.pos),l.pos=t.length,c=null):c=Cs(Ls(n,l,r,h),s);if(h){var p=h[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!u||f!=c){while(a<l.start)a=Math.min(l.start,a+5e4),i(a,f);f=c}l.start=l.pos}while(a<l.pos){var d=Math.min(l.pos,a+5e4);i(d,f),a=d}}function Ms(e,t,n,r){var i=[e.state.modeGen],s={};Os(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},s,r);for(var o=0;o<e.state.overlays.length;++o){var u=e.state.overlays[o],a=1,f=0;Os(e,t.text,u.mode,!0,function(e,t){var n=a;while(f<e){var r=i[a];r>e&&i.splice(a,1,e,i[a+1],r),a+=2,f=Math.min(e,r)}if(!t)return;if(u.opaque)i.splice(n,a-n,e,"cm-overlay "+t),a=n+2;else for(;n<a;n+=2){var s=i[n+1];i[n+1]=(s?s+" ":"")+"cm-overlay "+t}},s)}return{styles:i,classes:s.bgClass||s.textClass?s:null}}function _s(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ms(e,t,t.stateAfter=ln(e,io(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Ds(e,t,n,r){var i=e.doc.mode,s=new Ii(t,e.options.tabSize);s.start=s.pos=r||0,t==""&&ks(i,n);while(!s.eol()&&s.pos<=e.options.maxHighlightLength)Ls(i,s,n),s.start=s.pos}function Bs(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Hs:Ps;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function js(e,t){var n=lu("span",null,null,s?"padding-right: .1px":null),i={pre:lu("pre",[n]),content:n,col:0,pos:0,cm:e};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var u=o?t.rest[o-1]:t.line,a;i.pos=0,i.addToken=Is,(r||s)&&e.getOption("lineWrapping")&&(i.addToken=qs(i.addToken)),Lu(e.display.measure)&&(a=uo(u))&&(i.addToken=Rs(i.addToken,a)),i.map=[];var f=t!=e.display.externalMeasured&&io(u);zs(u,i,_s(e,u,f)),u.styleClasses&&(u.styleClasses.bgClass&&(i.bgClass=bu(u.styleClasses.bgClass,i.bgClass||"")),u.styleClasses.textClass&&(i.textClass=bu(u.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(Cu(e.display.measure))),o==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return s&&/\bcm-tab\b/.test(i.content.lastChild.className)&&(i.content.className="cm-tab-wrap-hack"),_o(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=bu(i.pre.className,i.textClass||"")),i}function Fs(e){var t=lu("span","โ€ข","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Is(e,t,n,s,o,u,a){if(!t)return;var f=e.cm.options.specialChars,l=!1;if(!f.test(t)){e.col+=t.length;var c=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,c),r&&i<9&&(l=!0),e.pos+=t.length}else{var c=document.createDocumentFragment(),h=0;for(;;){f.lastIndex=h;var p=f.exec(t),d=p?p.index-h:t.length-h;if(d){var v=document.createTextNode(t.slice(h,h+d));r&&i<9?c.appendChild(lu("span",[v])):c.appendChild(v),e.map.push(e.pos,e.pos+d,v),e.col+=d,e.pos+=d}if(!p)break;h+=d+1;if(p[0]=="	"){var m=e.cm.options.tabSize,g=m-e.col%m,v=c.appendChild(lu("span",Ko(g),"cm-tab"));v.setAttribute("role","presentation"),v.setAttribute("cm-text","	"),e.col+=g}else{var v=e.cm.options.specialCharPlaceholder(p[0]);v.setAttribute("cm-text",p[0]),r&&i<9?c.appendChild(lu("span",[v])):c.appendChild(v),e.col+=1}e.map.push(e.pos,e.pos+1,v),e.pos++}}if(n||s||o||l||a){var y=n||"";s&&(y+=s),o&&(y+=o);var b=lu("span",[c],y,a);return u&&(b.title=u),e.content.appendChild(b)}e.content.appendChild(c)}function qs(e){function t(e){var t=" ";for(var n=0;n<e.length-2;++n)t+=n%2?" ":"ย ";return t+=" ",t}return function(n,r,i,s,o,u){e(n,r.replace(/ {3,}/g,t),i,s,o,u)}}function Rs(e,t){return function(n,r,i,s,o,u){i=i?i+" cm-force-border":"cm-force-border";var a=n.pos,f=a+r.length;for(;;){for(var l=0;l<t.length;l++){var c=t[l];if(c.to>a&&c.from<=a)break}if(c.to>=f)return e(n,r,i,s,o,u);e(n,r.slice(0,c.to-a),i,s,null,u),s=null,r=r.slice(c.to-a),a=c.to}}}function Us(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function zs(e,t,n){var r=e.markedSpans,i=e.text,s=0;if(!r){for(var o=1;o<n.length;o+=2)t.addToken(t,i.slice(s,s=n[o]),Bs(n[o+1],t.cm.options));return}var u=i.length,a=0,o=1,f="",l,c,h=0,p,d,v,m,g;for(;;){if(h==a){p=d=v=m=c="",g=null,h=Infinity;var y=[];for(var b=0;b<r.length;++b){var w=r[b],E=w.marker;w.from<=a&&(w.to==null||w.to>a)?(w.to!=null&&h>w.to&&(h=w.to,d=""),E.className&&(p+=" "+E.className),E.css&&(c=E.css),E.startStyle&&w.from==a&&(v+=" "+E.startStyle),E.endStyle&&w.to==h&&(d+=" "+E.endStyle),E.title&&!m&&(m=E.title),E.collapsed&&(!g||as(g.marker,E)<0)&&(g=w)):w.from>a&&h>w.from&&(h=w.from),E.type=="bookmark"&&w.from==a&&E.widgetNode&&y.push(E)}if(g&&(g.from||0)==a){Us(t,(g.to==null?u+1:g.to)-a,g.marker,g.from==null);if(g.to==null)return}if(!g&&y.length)for(var b=0;b<y.length;++b)Us(t,0,y[b])}if(a>=u)break;var S=Math.min(u,h);for(;;){if(f){var x=a+f.length;if(!g){var T=x>S?f.slice(0,S-a):f;t.addToken(t,T,l?l+p:p,v,a+T.length==h?d:"",m,c)}if(x>=S){f=f.slice(S-a),a=S;break}a=x,v=""}f=i.slice(s,s=n[o++]),l=Bs(n[o++],t.cm.options)}}}function Ws(e,t){return t.from.ch==0&&t.to.ch==0&&Qo(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Xs(e,t,n,r){function i(e){return n?n[e]:null}function s(e,n,i){Ts(e,n,i,r),Po(e,"change",e,t)}function o(e,t){for(var n=e,s=[];n<t;++n)s.push(new xs(f[n],i(n),r));return s}var u=t.from,a=t.to,f=t.text,l=eo(e,u.line),c=eo(e,a.line),h=Qo(f),p=i(f.length-1),d=a.line-u.line;if(t.full)e.insert(0,o(0,f.length)),e.remove(f.length,e.size-f.length);else if(Ws(e,t)){var v=o(0,f.length-1);s(c,c.text,p),d&&e.remove(u.line,d),v.length&&e.insert(u.line,v)}else if(l==c)if(f.length==1)s(l,l.text.slice(0,u.ch)+h+l.text.slice(a.ch),p);else{var v=o(1,f.length-1);v.push(new xs(h+l.text.slice(a.ch),p,r)),s(l,l.text.slice(0,u.ch)+f[0],i(0)),e.insert(u.line+1,v)}else if(f.length==1)s(l,l.text.slice(0,u.ch)+f[0]+c.text.slice(a.ch),i(0)),e.remove(u.line+1,d);else{s(l,l.text.slice(0,u.ch)+f[0],i(0)),s(c,h+c.text.slice(a.ch),p);var v=o(1,f.length-1);d>1&&e.remove(u.line+1,d-1),e.insert(u.line+1,v)}Po(e,"change",e,t)}function Vs(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function $s(e){this.children=e;var t=0,n=0;for(var r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}function Ys(e,t,n){function r(e,i,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var u=e.linked[o];if(u.doc==i)continue;var a=s&&u.sharedHist;if(n&&!a)continue;t(u.doc,a),r(u.doc,e,a)}}r(e,null,!0)}function Zs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,k(e),x(e),e.options.lineWrapping||D(e),e.options.mode=t.modeOption,ur(e)}function eo(e,t){t-=e.first;if(t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],s=i.chunkSize();if(t<s){n=i;break}t-=s}return n.lines[t]}function to(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var s=e.text;i==n.line&&(s=s.slice(0,n.ch)),i==t.line&&(s=s.slice(t.ch)),r.push(s),++i}),r}function no(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ro(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function io(e){if(e.parent==null)return null;var t=e.parent,n=Yo(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function so(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],s=i.height;if(t<s){e=i;continue e}t-=s,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;r<e.lines.length;++r){var o=e.lines[r],u=o.height;if(t<u)break;t-=u}return n+r}function oo(e){e=ps(e);var t=0,n=e.parent;for(var r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var s=n.parent;s;n=s,s=n.parent)for(var r=0;r<s.children.length;++r){var o=s.children[r];if(o==n)break;t+=o.height}return t}function uo(e){var t=e.order;return t==null&&(t=e.order=Ku(e.text)),t}function ao(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function fo(e,t){var n={from:mt(t.from),to:Qr(t),text:to(e,t.from,t.to)};return go(e,n,t.from.line,t.to.line+1),Ys(e,function(e){go(e,n,t.from.line,t.to.line+1)},!0),n}function lo(e){while(e.length){var t=Qo(e);if(!t.ranges)break;e.pop()}}function co(e,t){if(t)return lo(e.done),Qo(e.done);if(e.done.length&&!Qo(e.done).ranges)return Qo(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Qo(e.done)}function ho(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(o=co(i,i.lastOp==r))){var u=Qo(o.changes);vt(t.from,t.to)==0&&vt(t.from,u.to)==0?u.to=Qr(t):o.changes.push(fo(e,t))}else{var a=Qo(i.done);(!a||!a.ranges)&&mo(e.sel,i.done),o={changes:[fo(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,u||_o(e,"historyAdded")}function po(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function vo(e,t,n,r){var i=e.history,s=r&&r.origin;n==i.lastSelOp||s&&i.lastSelOrigin==s&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==s||po(e,s,Qo(i.done),t))?i.done[i.done.length-1]=t:mo(t,i.done),i.lastSelTime=+(new Date),i.lastSelOrigin=s,i.lastSelOp=n,r&&r.clearRedo!==!1&&lo(i.undone)}function mo(e,t){var n=Qo(t);n&&n.ranges&&n.equals(e)||t.push(e)}function go(e,t,n,r){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[s]=n.markedSpans),++s})}function yo(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function bo(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(yo(n[r]));return i}function wo(e,t,n){for(var r=0,i=[];r<e.length;++r){var s=e[r];if(s.ranges){i.push(n?Dt.prototype.deepCopy.call(s):s);continue}var o=s.changes,u=[];i.push({changes:u});for(var a=0;a<o.length;++a){var f=o[a],l;u.push({from:f.from,to:f.to,text:f.text});if(t)for(var c in f)(l=c.match(/^spans_(\d+)$/))&&Yo(t,Number(l[1]))>-1&&(Qo(u)[c]=f[c],delete f[c])}}return i}function Eo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function So(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i],o=!0;if(s.ranges){s.copied||(s=e[i]=s.deepCopy(),s.copied=!0);for(var u=0;u<s.ranges.length;u++)Eo(s.ranges[u].anchor,t,n,r),Eo(s.ranges[u].head,t,n,r);continue}for(var u=0;u<s.changes.length;++u){var a=s.changes[u];if(n<a.from.line)a.from=dt(a.from.line+r,a.from.ch),a.to=dt(a.to.line+r,a.to.ch);else if(t<=a.to.line){o=!1;break}}o||(e.splice(0,i+1),i=0)}}function xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;So(e.done,n,r,i),So(e.undone,n,r,i)}function Co(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==0}function Lo(e){return e.target||e.srcElement}function Ao(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),d&&e.ctrlKey&&t==1&&(t=3),t}function Po(e,t){function s(e){return function(){e.apply(null,r)}}var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2),i;Wn?i=Wn.delayedCallbacks:Do?i=Do:(i=Do=[],setTimeout(Ho,0));for(var o=0;o<n.length;++o)i.push(s(n[o]))}function Ho(){var e=Do;Do=null;for(var t=0;t<e.length;++t)e[t]()}function Bo(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_o(e,n||t.type,e,t),Co(t)||t.codemirrorIgnore}function jo(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(var r=0;r<t.length;++r)Yo(n,t[r])==-1&&n.push(t[r])}function Fo(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function Io(e){e.prototype.on=function(e,t){Oo(this,e,t)},e.prototype.off=function(e,t){Mo(this,e,t)}}function Xo(){this.id=null}function $o(e,t,n){for(var r=0,i=0;;){var s=e.indexOf("	",r);s==-1&&(s=e.length);var o=s-r;if(s==e.length||i+o>=t)return r+Math.min(o,t-i);i+=s-r,i+=n-i%n,r=s+1;if(i>=t)return r}}function Ko(e){while(Jo.length<=e)Jo.push(Qo(Jo)+" ");return Jo[e]}function Qo(e){return e[e.length-1]}function Yo(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Zo(e,t){var n=[];for(var r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function eu(){}function tu(e,t){var n;return Object.create?n=Object.create(e):(eu.prototype=e,n=new eu),t&&nu(t,n),n}function nu(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ru(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ou(e,t){return t?t.source.indexOf("\\w")>-1&&su(e)?!0:t.test(e):su(e)}function uu(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function fu(e){return e.charCodeAt(0)>=768&&au.test(e)}function lu(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function hu(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function pu(e,t){return hu(e).appendChild(t)}function vu(){return document.activeElement}function mu(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function bu(e,t){var n=e.split(" ");for(var r=0;r<n.length;r++)n[r]&&!mu(n[r]).test(t)&&(t+=" "+n[r]);return t}function wu(e){if(!document.body.getElementsByClassName)return;var t=document.body.getElementsByClassName("CodeMirror");for(var n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function Su(){if(Eu)return;xu(),Eu=!0}function xu(){var e;Oo(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,wu(vr)},100))}),Oo(window,"blur",function(){wu($r)})}function Cu(e){if(Nu==null){var t=lu("span","โ€‹");pu(e,lu("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Nu=t.offsetWidth<=1&&t.offsetHeight>2&&!(r&&i<8))}var n=Nu?lu("span","โ€‹"):lu("span","ย ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Lu(e){if(ku!=null)return ku;var t=pu(e,document.createTextNode("AุฎA")),n=cu(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=cu(t,1,2).getBoundingClientRect();return ku=r.right-n.right<3}function Du(e){if(_u!=null)return _u;var t=pu(e,lu("span","x")),n=t.getBoundingClientRect(),r=cu(t,0,1).getBoundingClientRect();return _u=Math.abs(n.left-r.left)>1}function Hu(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;s<e.length;++s){var o=e[s];if(o.from<n&&o.to>t||t==n&&o.to==t)r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr"),i=!0}i||r(t,n,"ltr")}function Bu(e){return e.level%2?e.to:e.from}function ju(e){return e.level%2?e.from:e.to}function Fu(e){var t=uo(e);return t?Bu(t[0]):0}function Iu(e){var t=uo(e);return t?ju(Qo(t)):e.text.length}function qu(e,t){var n=eo(e.doc,t),r=ps(n);r!=n&&(t=io(r));var i=uo(r),s=i?i[0].level%2?Iu(r):Fu(r):0;return dt(t,s)}function Ru(e,t){var n,r=eo(e.doc,t);while(n=cs(r))r=n.find(1,!0).line,t=null;var i=uo(r),s=i?i[0].level%2?Fu(r):Iu(r):r.text.length;return dt(t==null?io(r):t,s)}function Uu(e,t){var n=qu(e,t.line),r=eo(e.doc,n.line),i=uo(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/)),o=t.line==n.line&&t.ch<=s&&t.ch;return dt(n.line,o?0:s)}return n}function zu(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:t<n}function Xu(e,t){Wu=null;for(var n=0,r;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(r!=null)return zu(e,i.level,e[r].level)?(i.from!=i.to&&(Wu=r),n):(i.from!=i.to&&(Wu=n),r);r=n}}return r}function Vu(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&fu(e.text.charAt(t)));return t}function $u(e,t,n,r){var i=uo(e);if(!i)return Ju(e,t,n,r);var s=Xu(i,t),o=i[s],u=Vu(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u<o.to)return u;if(u==o.from||u==o.to)return Xu(i,u)==s?u:(o=i[s+=n],n>0==o.level%2?o.to:o.from);o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Vu(e,o.to,-1,r):u=Vu(e,o.from,1,r)}}function Ju(e,t,n,r){var i=t+n;if(r)while(i>0&&fu(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),r=t||n,i=r&&(t?document.documentMode||6:n[1]),s=/WebKit\//.test(navigator.userAgent),o=s&&/Qt\/\d+\.\d+/.test(navigator.userAgent),u=/Chrome\//.test(navigator.userAgent),a=/Opera\//.test(navigator.userAgent),f=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),c=/PhantomJS/.test(navigator.userAgent),h=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),p=h||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),d=h||/Mac/.test(navigator.platform),v=/win/i.test(navigator.platform),m=a&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(a=!1,s=!0);var g=d&&(o||a&&(m==null||m<12.11)),y=e||r&&i>=9,b=!1,w=!1;B.prototype=nu({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+s+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(r==0&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=d&&!l?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){Lo(e)!=t.vert&&Lo(e)!=t.horiz&&nr(t.cm,yr)(e)};Oo(this.vert,"mousedown",n),Oo(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},B.prototype),j.prototype=nu({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},j.prototype),E.scrollbarModel={"native":B,"null":j},V.prototype.signal=function(e,t){Fo(e,t)&&this.events.push(arguments)},V.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_o.apply(null,this.events[e])};var dt=E.Pos=function(e,t){if(!(this instanceof dt))return new dt(e,t);this.line=e,this.ch=t},vt=E.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Et=null;Nt.prototype=nu({init:function(e){function a(e){if(n.somethingSelected())Et=n.getSelections(),t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,u.value=Et.join("\n"),Go(u));else{var r=xt(n);Et=r.text,e.type=="cut"?n.setSelections(r.ranges,null,Uo):(t.prevInput="",u.value=r.text.join("\n"),Go(u))}e.type=="cut"&&(n.state.cutIncoming=!0)}var t=this,n=this.cm,o=this.wrapper=Ct(),u=this.textarea=o.firstChild;e.wrapper.insertBefore(o,e.wrapper.firstChild),h&&(u.style.width="0px"),Oo(u,"input",function(){r&&i>=9&&t.hasSelection&&(t.hasSelection=null),t.poll()}),Oo(u,"paste",function(){if(s&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=u.selectionStart,r=u.selectionEnd;u.value+="$",u.selectionEnd=r,u.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,t.fastPoll()}),Oo(u,"cut",a),Oo(u,"copy",a),Oo(e.scroller,"paste",function(r){if(mr(e,r))return;n.state.pasteIncoming=!0,t.focus()}),Oo(e.lineSpace,"selectstart",function(t){mr(e,t)||To(t)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=nn(e);if(e.options.moveInputWithCursor){var i=Bn(e,n.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+o.top-s.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+o.left-s.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;pu(n.cursorDiv,e.cursors),pu(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(this.contextMenuPending)return;var t,n,s=this.cm,o=s.doc;if(s.somethingSelected()){this.prevInput="";var u=o.sel.primary();t=Mu&&(u.to().line-u.from().line>100||(n=s.getSelection()).length>1e3);var a=t?"-":n||s.getSelection();this.textarea.value=a,s.state.focused&&Go(this.textarea),r&&i>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",r&&i>=9&&(this.hasSelection=null));this.inaccurateSelection=t},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!p||vu()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;if(e.pollingFast)return;e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,n)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(!e.state.focused||Ou(t)&&!n||wt(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var s=t.value;if(s==n&&!e.somethingSelected())return!1;if(r&&i>=9&&this.hasSelection===s||d&&/[\uf700-\uf7ff]/.test(s))return e.display.input.reset(),!1;s.charCodeAt(0)==8203&&e.doc.sel==e.display.selForContextMenu&&!n&&(n="โ€‹");var o=0,u=Math.min(n.length,s.length);while(o<u&&n.charCodeAt(o)==s.charCodeAt(o))++o;var a=this;return tr(e,function(){St(e,s.slice(o),n.length-o),s.length>1e3||s.indexOf("\n")>-1?t.value=a.prevInput="":a.prevInput=s}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){r&&i>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function d(){if(u.selectionStart!=null){var e=n.somethingSelected(),r=u.value="โ€‹"+(e?u.value:"");t.prevInput=e?"":"โ€‹",u.selectionStart=1,u.selectionEnd=r.length,o.selForContextMenu=n.doc.sel}}function v(){t.contextMenuPending=!1,t.wrapper.style.position="relative",u.style.cssText=h,r&&i<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l);if(u.selectionStart!=null){(!r||r&&i<9)&&d();var e=0,s=function(){o.selForContextMenu==n.doc.sel&&u.selectionStart==0?nr(n,_i.selectAll)(n):e++<10?o.detectingSelectAll=setTimeout(s,500):o.input.reset()};o.detectingSelectAll=setTimeout(s,200)}}var t=this,n=t.cm,o=n.display,u=t.textarea,f=gr(n,e),l=o.scroller.scrollTop;if(!f||a)return;var c=n.options.resetSelectionOnContextMenu;c&&n.doc.sel.contains(f)==-1&&nr(n,Kt)(n.doc,Bt(f),Uo);var h=u.style.cssText;t.wrapper.style.position="absolute",u.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(r?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(s)var p=window.scrollY;o.input.focus(),s&&window.scrollTo(null,p),o.input.reset(),n.somethingSelected()||(u.value=t.prevInput=" "),t.contextMenuPending=!0,o.selForContextMenu=n.doc.sel,clearTimeout(o.detectingSelectAll),r&&i>=9&&d();if(y){ko(e);var m=function(){Mo(window,"mouseup",m),setTimeout(v,20)};Oo(window,"mouseup",m)}else setTimeout(v,50)},setUneditable:eu,needsContentAttribute:!1},Nt.prototype),kt.prototype=nu({init:function(e){function i(e){if(n.somethingSelected())Et=n.getSelections(),e.type=="cut"&&n.replaceSelection("",null,"cut");else{var t=xt(n);Et=t.text,e.type=="cut"&&n.operation(function(){n.setSelections(t.ranges,0,Uo),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!h)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Et.join("\n"));else{var r=Ct(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Et.join("\n");var s=document.activeElement;Go(i),setTimeout(function(){n.display.lineSpace.removeChild(r),s.focus()},50)}}var t=this,n=t.cm,r=t.div=e.lineDiv;r.contentEditable="true",Tt(r),Oo(r,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),Oo(r,"compositionstart",function(e){var r=e.data;t.composing={sel:n.doc.sel,data:r,startData:r};if(!r)return;var i=n.doc.sel.primary(),s=n.getLine(i.head.line),o=s.indexOf(r,Math.max(0,i.head.ch-r.length));o>-1&&o<=i.head.ch&&(t.composing.sel=Bt(dt(i.head.line,o),dt(i.head.line,o+r.length)))}),Oo(r,"compositionupdate",function(e){t.composing.data=e.data}),Oo(r,"compositionend",function(e){var n=t.composing;if(!n)return;e.data!=n.startData&&!/\u200b/.test(e.data)&&(n.data=e.data),setTimeout(function(){n.handled||t.applyComposition(n),t.composing==n&&(t.composing=null)},50)}),Oo(r,"touchstart",function(){t.forceCompositionEnd()}),Oo(r,"input",function(){if(t.composing)return;t.pollContent()||tr(t.cm,function(){ur(n)})}),Oo(r,"copy",i),Oo(r,"cut",i)},prepareSelection:function(){var e=nn(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){if(!e||!this.cm.display.view.length)return;e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e)},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=Ot(this.cm,e.anchorNode,e.anchorOffset),r=Ot(this.cm,e.focusNode,e.focusOffset);if(n&&!n.bad&&r&&!r.bad&&vt(yt(n,r),t.from())==0&&vt(gt(n,r),t.to())==0)return;var i=Lt(this.cm,t.from()),s=Lt(this.cm,t.to());if(!i&&!s)return;var o=this.cm.display.view,u=e.rangeCount&&e.getRangeAt(0);if(!i)i={node:o[0].measure.map[2],offset:0};else if(!s){var a=o[o.length-1].measure,f=a.maps?a.maps[a.maps.length-1]:a.map;s={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}try{var l=cu(i.node,i.offset,s.offset,s.node)}catch(c){}l&&(e.removeAllRanges(),e.addRange(l),u&&e.anchorNode==null&&e.addRange(u)),this.rememberSelection()},showMultipleSelections:function(e){pu(this.cm.display.cursorDiv,e.cursors),pu(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return du(this.div,t)},focus:function(){this.cm.options.readOnly!="nocursor"&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}var e=this;this.selectionInEditor()?this.pollSelection():tr(this.cm,function(){e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,t)},pollSelection:function(){if(this.composing)return;var e=window.getSelection(),t=this.cm;if(e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset){this.rememberSelection();var n=Ot(t,e.anchorNode,e.anchorOffset),r=Ot(t,e.focusNode,e.focusOffset);n&&r&&tr(t,function(){Kt(t.doc,Bt(n,r),Uo);if(n.bad||r.bad)t.curOp.selectionChanged=!0})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var s;if(r.line==t.viewFrom||(s=lr(e,r.line))==0)var o=io(t.view[0].line),u=t.view[0].node;else var o=io(t.view[s].line),u=t.view[s-1].node.nextSibling;var a=lr(e,i.line);if(a==t.view.length-1)var f=t.viewTo-1,l=t.view[a].node;else var f=io(t.view[a+1].line)-1,l=t.view[a+1].node.previousSibling;var c=Au(_t(e,u,l,o,f)),h=to(e.doc,dt(o,0),dt(f,eo(e.doc,f).text.length));while(c.length>1&&h.length>1)if(Qo(c)==Qo(h))c.pop(),h.pop(),f--;else{if(c[0]!=h[0])break;c.shift(),h.shift(),o++}var p=0,d=0,v=c[0],m=h[0],g=Math.min(v.length,m.length);while(p<g&&v.charCodeAt(p)==m.charCodeAt(p))++p;var y=Qo(c),b=Qo(h),w=Math.min(y.length-(c.length==1?p:0),b.length-(h.length==1?p:0));while(d<w&&y.charCodeAt(y.length-d-1)==b.charCodeAt(b.length-d-1))++d;c[c.length-1]=y.slice(0,y.length-d),c[0]=c[0].slice(p);var E=dt(o,p),S=dt(f,h.length?Qo(h).length-d:0);if(c.length>1||c[0]||vt(E,S))return ai(e.doc,c,E,S,"+input"),!0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){if(!this.composing||this.composing.handled)return;this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus()},applyComposition:function(e){e.data&&e.data!=e.startData&&nr(this.cm,St)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),nr(this.cm,St)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},onContextMenu:eu,resetPosition:eu,needsContentAttribute:!0},kt.prototype),E.inputStyles={textarea:Nt,contenteditable:kt},Dt.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(vt(n.anchor,r.anchor)!=0||vt(n.head,r.head)!=0)return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Pt(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Dt(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(vt(t,r.from())>=0&&vt(e,r.to())<=0)return n}return-1}},Pt.prototype={from:function(){return yt(this.anchor,this.head)},to:function(){return gt(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Tn={left:0,right:0,top:0,bottom:0},Rn,Wn=null,Xn=0,br,wr,Cr=0,Mr=0,_r=null;r?_r=-0.53:e?_r=15:u?_r=-0.7:f&&(_r=-1/3);var Dr=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}};E.wheelEventPixels=function(e){var t=Dr(e);return t.x*=_r,t.y*=_r,t};var jr=new Xo,Rr=null,Qr=E.changeEnd=function(e){return e.text?dt(e.from.line+e.text.length-1,Qo(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};E.prototype={constructor:E,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t,Si.hasOwnProperty(e)&&nr(this,Si[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Fi(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:rr(function(e,t){var n=e.token?e:E.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:t&&t.opaque}),this.state.modeGen++,ur(this)}),removeOverlay:rr(function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||typeof e=="string"&&r.name==e){t.splice(n,1),this.state.modeGen++,ur(this);return}}}),indentLine:rr(function(e,t,n){typeof t!="string"&&typeof t!="number"&&(t==null?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract"),qt(this.doc,e)&&mi(this,e,t,n)}),indentSelection:rr(function(e){var t=this.doc.sel.ranges,n=-1;for(var r=0;r<t.length;r++){var i=t[r];if(!i.empty()){var s=i.from(),o=i.to(),u=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var a=u;a<n;++a)mi(this,a,e);var f=this.doc.sel.ranges;s.ch==0&&t.length==f.length&&f[r].from().ch>0&&Xt(this.doc,r,new Pt(s,f[r].to()),Uo)}else i.head.line>n&&(mi(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&di(this))}}),getTokenAt:function(e,t){return As(this,e,t)},getLineTokens:function(e,t){return As(this,dt(e),t,!0)},getTokenTypeAt:function(e){e=Ft(this.doc,e);var t=_s(this,eo(this.doc,e.line)),n=0,r=(t.length-1)/2,i=e.ch,s;if(i==0)s=t[2];else for(;;){var o=n+r>>1;if((o?t[o*2-1]:0)>=i)r=o;else{if(!(t[o*2+1]<i)){s=t[o*2+2];break}n=o+1}}var u=s?s.indexOf("cm-overlay "):-1;return u<0?s:u==0?null:s.slice(0,u-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?E.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!Ai.hasOwnProperty(t))return Ai;var r=Ai[t],i=this.getModeAt(e);if(typeof i[t]=="string")r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var s=0;s<i[t].length;s++){var o=r[i[t][s]];o&&n.push(o)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var s=0;s<r._global.length;s++){var u=r._global[s];u.pred(i,this)&&Yo(n,u.val)==-1&&n.push(u.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=jt(n,e==null?n.first+n.size-1:e),ln(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return e==null?n=r.head:typeof e=="object"?n=Ft(this.doc,e):n=e?r.from():r.to(),Bn(this,n,t||"page")},charCoords:function(e,t){return Hn(this,Ft(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Pn(this,e,t||"page"),In(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Pn(this,{top:e,left:0},t||"page").top,so(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n=!1,r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0);var i=eo(this.doc,e);return Dn(this,i,{top:0,left:0},t||"page").top+(n?this.doc.height-oo(i):0)},defaultTextHeight:function(){return Un(this.display)},defaultCharWidth:function(){return zn(this.display)},setGutterMarker:rr(function(e,t,n){return gi(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&uu(r)&&(e.gutterMarkers=null),!0})}),clearGutter:rr(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,ar(t,r,"gutter"),uu(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineWidget:rr(function(e,t,n){return Ss(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!qt(this.doc,e))return null;var t=e;e=eo(this.doc,e);if(!e)return null}else{var t=io(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=Bn(this,Ft(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="",i=="right"?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&ci(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:rr(Ur),triggerOnKeyPress:rr(Xr),triggerOnKeyUp:Wr,execCommand:function(e){if(_i.hasOwnProperty(e))return _i[e](this)},findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var s=0,o=Ft(this.doc,e);s<t;++s){o=bi(this.doc,o,i,n,r);if(o.hitSide)break}return o},moveH:rr(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?bi(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},Wo)}),deleteH:rr(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):yi(this,function(n){var i=bi(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,s=r;t<0&&(i=-1,t=-t);for(var o=0,u=Ft(this.doc,e);o<t;++o){var a=Bn(this,u,"div");s==null?s=a.left:a.left=s,u=wi(this,a,i,n);if(u.hitSide)break}return u},moveV:rr(function(e,t){var n=this,r=this.doc,i=[],s=!n.display.shift&&!r.extend&&r.sel.somethingSelected();r.extendSelectionsBy(function(o){if(s)return e<0?o.from():o.to();var u=Bn(n,o.head,"div");o.goalColumn!=null&&(u.left=o.goalColumn),i.push(u.left);var a=wi(n,u,e,t);return t=="page"&&o==r.sel.primary()&&pi(n,null,Hn(n,a,"div").top-u.top),a},Wo);if(i.length)for(var o=0;o<r.sel.ranges.length;o++)r.sel.ranges[o].goalColumn=i[o]}),findWordAt:function(e){var t=this.doc,n=eo(t,e.line).text,r=e.ch,i=e.ch;if(n){var s=this.getHelper(e,"wordChars");(e.xRel<0||i==n.length)&&r?--r:++i;var o=n.charAt(r),u=ou(o,s)?function(e){return ou(e,s)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ou(e)};while(r>0&&u(n.charAt(r-1)))--r;while(i<n.length&&u(n.charAt(i)))++i}return new Pt(dt(e.line,r),dt(e.line,i))},toggleOverwrite:function(e){if(e!=null&&e==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?yu(this.display.cursorDiv,"CodeMirror-overwrite"):gu(this.display.cursorDiv,"CodeMirror-overwrite"),_o(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==vu()},scrollTo:rr(function(e,t){(e!=null||t!=null)&&vi(this),e!=null&&(this.curOp.scrollLeft=e),t!=null&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-dn(this)-this.display.barHeight,width:e.scrollWidth-dn(this)-this.display.barWidth,clientHeight:mn(this),clientWidth:vn(this)}},scrollIntoView:rr(function(e,t){e==null?(e={from:this.doc.sel.primary().head,to:null},t==null&&(t=this.options.cursorScrollMargin)):typeof e=="number"?e={from:dt(e,0),to:null}:e.from==null&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0;if(e.from.line!=null)vi(this),this.curOp.scrollToPos=e;else{var n=hi(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:rr(function(e,t){function r(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e}var n=this;e!=null&&(n.display.wrapper.style.width=r(e)),t!=null&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&An(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){ar(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,_o(n,"refresh",this)}),operation:function(e){return tr(this,e)},refresh:rr(function(){var e=this.display.cachedTextHeight;ur(this),this.curOp.forceUpdate=!0,On(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),M(this),(e==null||Math.abs(e-Un(this.display))>.5)&&k(this),_o(this,"refresh",this)}),swapDoc:rr(function(e){var t=this.doc;return t.cm=null,Zs(this,e),On(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Po(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Io(E);var Ei=E.defaults={},Si=E.optionHandlers={},Ti=E.Init={toString:function(){return"CodeMirror.Init"}};xi("value","",function(e,t){e.setValue(t)},!0),xi("mode",null,function(e,t){e.doc.modeOption=t,x(e)},!0),xi("indentUnit",2,x,!0),xi("indentWithTabs",!1),xi("smartIndent",!0),xi("tabSize",4,function(e){T(e),On(e),ur(e)},!0),xi("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test("	")?"":"|	"),"g"),e.refresh()},!0),xi("specialCharPlaceholder",Fs,function(e){e.refresh()},!0),xi("electricChars",!0),xi("inputStyle",p?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),xi("rtlMoveVisually",!v),xi("wholeLineUpdateBefore",!0),xi("theme","default",function(e){L(e),A(e)},!0),xi("keyMap","default",function(e,t,n){var r=Fi(t),i=n!=E.Init&&Fi(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),xi("extraKeys",null),xi("lineWrapping",!1,N,!0),xi("gutters",[],function(e){P(e.options),A(e)},!0),xi("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?X(e.display)+"px":"0",e.refresh()},!0),xi("coverGutterNextToScrollbar",!1,function(e){I(e)},!0),xi("scrollbarStyle","native",function(e){F(e),I(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),xi("lineNumbers",!1,function(e){P(e.options),A(e)},!0),xi("firstLineNumber",1,A,!0),xi("lineNumberFormatter",function(e){return e},A,!0),xi("showCursorWhenSelecting",!1,tn,!0),xi("resetSelectionOnContextMenu",!0),xi("readOnly",!1,function(e,t){t=="nocursor"?($r(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),xi("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),xi("dragDrop",!0),xi("cursorBlinkRate",530),xi("cursorScrollMargin",0),xi("cursorHeight",1,tn,!0),xi("singleCursorHeightPerLine",!0,tn,!0),xi("workTime",100),xi("workDelay",100),xi("flattenSpans",!0,T,!0),xi("addModeClass",!1,T,!0),xi("pollInterval",100),xi("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),xi("historyEventDelay",1250),xi("viewportMargin",10,function(e){e.refresh()},!0),xi("maxHighlightLength",1e4,T,!0),xi("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),xi("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),xi("autofocus",null);var Ni=E.modes={},Ci=E.mimeModes={};E.defineMode=function(e,t){!E.defaults.mode&&e!="null"&&(E.defaults.mode=e),arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ni[e]=t},E.defineMIME=function(e,t){Ci[e]=t},E.resolveMode=function(e){if(typeof e=="string"&&Ci.hasOwnProperty(e))e=Ci[e];else if(e&&typeof e.name=="string"&&Ci.hasOwnProperty(e.name)){var t=Ci[e.name];typeof t=="string"&&(t={name:t}),e=tu(t,e),e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return E.resolveMode("application/xml");return typeof e=="string"?{name:e}:e||{name:"null"}},E.getMode=function(e,t){var t=E.resolveMode(t),n=Ni[t.name];if(!n)return E.getMode(e,"text/plain");var r=n(e,t);if(ki.hasOwnProperty(t.name)){var i=ki[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;r.hasOwnProperty(s)&&(r["_"+s]=r[s]),r[s]=i[s]}}r.name=t.name,t.helperType&&(r.helperType=t.helperType);if(t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r},E.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),E.defineMIME("text/plain","null");var ki=E.modeExtensions={};E.extendMode=function(e,t){var n=ki.hasOwnProperty(e)?ki[e]:ki[e]={};nu(t,n)},E.defineExtension=function(e,t){E.prototype[e]=t},E.defineDocExtension=function(e,t){Ks.prototype[e]=t},E.defineOption=xi;var Li=[];E.defineInitHook=function(e){Li.push(e)};var Ai=E.helpers={};E.registerHelper=function(e,t,n){Ai.hasOwnProperty(e)||(Ai[e]=E[e]={_global:[]}),Ai[e][t]=n},E.registerGlobalHelper=function(e,t,n,r){E.registerHelper(e,t,r),Ai[e]._global.push({pred:n,val:r})};var Oi=E.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},Mi=E.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};E.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var _i=E.commands={selectAll:function(e){e.setSelection(dt(e.firstLine(),0),dt(e.lastLine()),Uo)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Uo)},killLine:function(e){yi(e,function(t){if(t.empty()){var n=eo(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:dt(t.head.line+1,0)}:{from:t.head,to:dt(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){yi(e,function(t){return{from:dt(t.from().line,0),to:Ft(e.doc,dt(t.to().line+1,0))}})},delLineLeft:function(e){yi(e,function(e){return{from:dt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){yi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){yi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(dt(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(dt(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return qu(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return Uu(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Ru(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Wo)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Wo)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Uu(e,t.head):r},Wo)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("	")},insertSoftTab:function(e){var t=[],n=e.listSelections(),r=e.options.tabSize;for(var i=0;i<n.length;i++){var s=n[i].from(),o=Vo(e.getLine(s.line),s.ch,r);t.push((new Array(r-o%r+1)).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){tr(e,function(){var t=e.listSelections(),n=[];for(var r=0;r<t.length;r++){var i=t[r].head,s=eo(e.doc,i.line).text;if(s){i.ch==s.length&&(i=new dt(i.line,i.ch-1));if(i.ch>0)i=new dt(i.line,i.ch+1),e.replaceRange(s.charAt(i.ch-1)+s.charAt(i.ch-2),dt(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var o=eo(e.doc,i.line-1).text;o&&e.replaceRange(s.charAt(0)+"\n"+o.charAt(o.length-1),dt(i.line-1,o.length-1),dt(i.line,1),"+transpose")}}n.push(new Pt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){tr(e,function(){var t=e.listSelections().length;for(var n=0;n<t;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),di(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Di=E.keyMap={};Di.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"},Di.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"},Di.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"},Di.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"]},Di["default"]=d?Di.macDefault:Di.pcDefault,E.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}var i=Zo(n.split(" "),Pi);for(var s=0;s<i.length;s++){var o,u;s==i.length-1?(u=n,o=r):(u=i.slice(0,s+1).join(" "),o="...");var a=t[u];if(!a)t[u]=o;else if(a!=o)throw new Error("Inconsistent bindings for "+u)}delete e[n]}for(var f in t)e[f]=t[f];return e};var Hi=E.lookupKey=function(e,t,n,r){t=Fi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Hi(e,t.fallthrough,n,r);for(var s=0;s<t.fallthrough.length;s++){var o=Hi(e,t.fallthrough[s],n,r);if(o)return o}}},Bi=E.isModifierKey=function(e){var t=typeof e=="string"?e:Pu[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"},ji=E.keyName=function(e,t){if(a&&e.keyCode==34&&e["char"])return!1;var n=Pu[e.keyCode],r=n;return r==null||e.altGraphKey?!1:(e.altKey&&n!="Alt"&&(r="Alt-"+r),(g?e.metaKey:e.ctrlKey)&&n!="Ctrl"&&(r="Ctrl-"+r),(g?e.ctrlKey:e.metaKey)&&n!="Cmd"&&(r="Cmd-"+r),!t&&e.shiftKey&&n!="Shift"&&(r="Shift-"+r),r)};E.fromTextArea=function(e,t){function r(){e.value=a.getValue()}t=t?nu(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder);if(t.autofocus==null){var n=vu();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}if(e.form){Oo(e.form,"submit",r);if(!t.leaveSubmitMethodAlone){var i=e.form,s=i.submit;try{var o=i.submit=function(){r(),i.submit=s,i.submit(),i.submit=o}}catch(u){}}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(Mo(e.form,"submit",r),typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var a=E(function(t){e.parentNode.insertBefore(t,e.nextSibling)},t);return a};var Ii=E.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ii.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Vo(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Vo(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Vo(this.string,null,this.tabSize)-(this.lineStart?Vo(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if(typeof e!="string"){var s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var qi=0,Ri=E.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++qi};Io(Ri),Ri.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&Vn(e);if(Fo(this,"clear")){var n=this.find();n&&Po(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;s<this.lines.length;++s){var o=this.lines[s],u=Ki(o.markedSpans,this);e&&!this.collapsed?ar(e,io(o),"text"):e&&(u.to!=null&&(i=io(o)),u.from!=null&&(r=io(o))),o.markedSpans=Qi(o.markedSpans,u),u.from==null&&this.collapsed&&!gs(this.doc,o)&&e&&ro(o,Un(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var a=ps(this.lines[s]),f=_(a);f>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=f,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&ur(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Yt(e.doc)),e&&Po(e,"markerCleared",e,this),t&&Jn(e),this.parent&&this.parent.clear()},Ri.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);var n,r;for(var i=0;i<this.lines.length;++i){var s=this.lines[i],o=Ki(s.markedSpans,this);if(o.from!=null){n=dt(t?s:io(s),o.from);if(e==-1)return n}if(o.to!=null){r=dt(t?s:io(s),o.to);if(e==1)return r}}return n&&{from:n,to:r}},Ri.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;if(!e||!n)return;tr(n,function(){var r=e.line,i=io(e.line),s=En(n,i);s&&(Ln(s),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0;if(!gs(t.doc,r)&&t.height!=null){var o=t.height;t.height=null;var u=Es(t)-o;u&&ro(r,r.height+u)}})},Ri.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Yo(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ri.prototype.detachLine=function(e){this.lines.splice(Yo(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var qi=0,zi=E.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Io(zi),zi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Po(this,"clear")},zi.prototype.find=function(e,t){return this.primary.find(e,t)};var bs=E.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=e,this.node=t};Io(bs),bs.prototype.clear=function(){var e=this.cm,t=this.line.widgets,n=this.line,r=io(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var s=Es(this);tr(e,function(){ws(e,n,-s),ar(e,r,"widget"),ro(n,Math.max(0,n.height-s))})},bs.prototype.changed=function(){var e=this.height,t=this.cm,n=this.line;this.height=null;var r=Es(this)-e;if(!r)return;tr(t,function(){t.curOp.forceUpdate=!0,ws(t,n,r),ro(n,n.height+r)})};var xs=E.Line=function(e,t,n){this.text=e,ss(this,t),this.height=n?n(this):1};Io(xs),xs.prototype.lineNo=function(){return io(this)};var Ps={},Hs={};Vs.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Ns(i),Po(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},$s.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var s=Math.min(t,i-e),o=r.height;r.removeInner(e,s),this.height-=o-r.height,i==s&&(this.children.splice(n--,1),r.parent=null);if((t-=s)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Vs))){var u=[];this.collapse(u),this.children=[new Vs(u)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<=s){i.insertInner(e,t,n);if(i.lines&&i.lines.length>50){while(i.lines.length>50){var o=i.lines.splice(i.lines.length-25,25),u=new Vs(o);i.height-=u.height,this.children.splice(r+1,0,u),u.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new $s(t);if(!e.parent){var r=new $s(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=Yo(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e);if(i.iterN(e,o,n))return!0;if((t-=o)==0)break;e=0}else e-=s}}};var Js=0,Ks=E.Doc=function(e,t,n){if(!(this instanceof Ks))return new Ks(e,t,n);n==null&&(n=0),$s.call(this,[new Vs([new xs("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=dt(n,0);this.sel=Bt(r),this.history=new ao(null),this.id=++Js,this.modeOption=t,typeof e=="string"&&(e=Au(e)),Xs(this,{from:r,to:r,text:e}),Kt(this,Bt(r),Uo)};Ks.prototype=tu($s.prototype,{constructor:Ks,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=no(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:ir(function(e){var t=dt(this.first,0),n=this.first+this.size-1;ni(this,{from:t,to:dt(n,eo(this,n).text.length),text:Au(e),origin:"setValue",full:!0},!0),Kt(this,Bt(t))}),replaceRange:function(e,t,n,r){t=Ft(this,t),n=n?Ft(this,n):t,ai(this,e,t,n,r)},getRange:function(e,t,n){var r=to(this,Ft(this,e),Ft(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(qt(this,e))return eo(this,e)},getLineNumber:function(e){return io(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=eo(this,e)),ps(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Ft(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ir(function(e,t,n){Vt(this,Ft(this,typeof e=="number"?dt(e,t||0):e),null,n)}),setSelection:ir(function(e,t,n){Vt(this,Ft(this,e),Ft(this,t||e),n)}),extendSelection:ir(function(e,t,n){zt(this,Ft(this,e),t&&Ft(this,t),n)}),extendSelections:ir(function(e,t){Wt(this,Rt(this,e,t))}),extendSelectionsBy:ir(function(e,t){Wt(this,Zo(this.sel.ranges,e),t)}),setSelections:ir(function(e,t,n){if(!e.length)return;for(var r=0,i=[];r<e.length;r++)i[r]=new Pt(Ft(this,e[r].anchor),Ft(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Kt(this,Ht(i,t),n)}),addSelection:ir(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Pt(Ft(this,e),Ft(this,t||e))),Kt(this,Ht(r,r.length-1),n)}),getSelection:function(e){var t=this.sel.ranges,n;for(var r=0;r<t.length;r++){var i=to(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||"\n")},getSelections:function(e){var t=[],n=this.sel.ranges;for(var r=0;r<n.length;r++){var i=to(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||"\n")),t[r]=i}return t},replaceSelection:function(e,t,n){var r=[];for(var i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:ir(function(e,t,n){var r=[],i=this.sel;for(var s=0;s<i.ranges.length;s++){var o=i.ranges[s];r[s]={from:o.from(),to:o.to(),text:Au(e[s]),origin:n}}var u=t&&t!="end"&&ei(this,r,t);for(var s=r.length-1;s>=0;s--)ni(this,r[s]);u?Jt(this,u):this.cm&&di(this.cm)}),undo:ir(function(){ii(this,"undo")}),redo:ir(function(){ii(this,"redo")}),undoSelection:ir(function(){ii(this,"undo",!0)}),redoSelection:ir(function(){ii(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new ao(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:wo(this.history.done),undone:wo(this.history.undone)}},setHistory:function(e){var t=this.history=new ao(this.history.maxGeneration);t.done=wo(e.done.slice(0),null,!0),t.undone=wo(e.undone.slice(0),null,!0)},addLineClass:ir(function(e,t,n){return gi(this,e,t=="gutter"?"gutter":"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!e[r])e[r]=n;else{if(mu(n).test(e[r]))return!1;e[r]+=" "+n}return!0})}),removeLineClass:ir(function(e,t,n){return gi(this,e,t=="gutter"?"gutter":"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(n==null)e[r]=null;else{var s=i.match(mu(n));if(!s)return!1;var o=s.index+s[0].length;e[r]=i.slice(0,s.index)+(!s.index||o==i.length?"":" ")+i.slice(o)||null}return!0})}),markText:function(e,t,n){return Ui(this,Ft(this,e),Ft(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=Ft(this,e),Ui(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Ft(this,e);var t=[],n=eo(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=Ft(this,e),t=Ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(s){var o=s.markedSpans;if(o)for(var u=0;u<o.length;u++){var a=o[u];!(i==e.line&&e.ch>a.to||a.from==null&&i!=e.line||i==t.line&&a.from>t.ch)&&(!n||n(a.marker))&&r.push(a.marker.parent||a.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first;return this.iter(function(r){var i=r.text.length+1;if(i>e)return t=e,!0;e-=i,++n}),Ft(this,dt(n,t))},indexFromPos:function(e){e=Ft(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ks(no(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Ks(no(this,t,n),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Vi(r,Xi(this)),r},unlinkDoc:function(e){e instanceof E&&(e=e.doc);if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),$i(Xi(this));break}if(e.history==this.history){var r=[e.id];Ys(e,function(e){r.push(e.id)},!0),e.history=new ao(null),e.history.done=wo(this.history.done,r),e.history.undone=wo(this.history.undone,r)}},iterLinkedDocs:function(e){Ys(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ks.prototype.eachLine=Ks.prototype.iter;var Qs="iter insert remove copy getEditor".split(" ");for(var Gs in Ks.prototype)Ks.prototype.hasOwnProperty(Gs)&&Yo(Qs,Gs)<0&&(E.prototype[Gs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ks.prototype[Gs]));Io(Ks);var To=E.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},No=E.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ko=E.e_stop=function(e){To(e),No(e)},Oo=E.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}},Mo=E.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},_o=E.signal=function(e,t){var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);for(var i=0;i<n.length;++i)n[i].apply(null,r)},Do=null,qo=30,Ro=E.Pass={toString:function(){return"CodeMirror.Pass"}},Uo={scroll:!1},zo={origin:"*mouse"},Wo={origin:"+move"};Xo.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Vo=E.countColumn=function(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var s=r||0,o=i||0;;){var u=e.indexOf("	",s);if(u<0||u>=t)return o+(t-s);o+=u-s,o+=n-o%n,s=u+1}},Jo=[""],Go=function(e){e.select()};h?Go=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:r&&(Go=function(e){try{e.select()}catch(t){}});var iu=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,su=E.isWordChar=function(e){return/\w/.test(e)||e>"ย€"&&(e.toUpperCase()!=e.toLowerCase()||iu.test(e))},au=/[\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]/,cu;document.createRange?cu=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:cu=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var du=E.contains=function(e,t){t.nodeType==3&&(t=t.parentNode);if(e.contains)return e.contains(t);do{t.nodeType==11&&(t=t.host);if(t==e)return!0}while(t=t.parentNode)};r&&i<11&&(vu=function(){try{return document.activeElement}catch(e){return document.body}});var gu=E.rmClass=function(e,t){var n=e.className,r=mu(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},yu=E.addClass=function(e,t){var n=e.className;mu(t).test(n)||(e.className+=(n?" ":"")+t)},Eu=!1,Tu=function(){if(r&&i<9)return!1;var e=lu("div");return"draggable"in e||"dragDrop"in e}(),Nu,ku,Au=E.splitLines="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ou=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Mu=function(){var e=lu("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),_u=null,Pu={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};E.keyNames=Pu,function(){for(var e=0;e<10;e++)Pu[e+48]=Pu[e+96]=String(e);for(var e=65;e<=90;e++)Pu[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)Pu[e+111]=Pu[e+63235]="F"+e}();var Wu,Ku=function(){function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function f(e,t,n){this.level=e,this.from=t,this.to=n}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,l=[];for(var c=0,h;c<t;++c)l.push(h=n(e.charCodeAt(c)));for(var c=0,p=a;c<t;++c){var h=l[c];h=="m"?l[c]=p:p=h}for(var c=0,d=a;c<t;++c){var h=l[c];h=="1"&&d=="r"?l[c]="n":s.test(h)&&(d=h,h=="r"&&(l[c]="R"))}for(var c=1,p=l[0];c<t-1;++c){var h=l[c];h=="+"&&p=="1"&&l[c+1]=="1"?l[c]="1":h==","&&p==l[c+1]&&(p=="1"||p=="n")&&(l[c]=p),p=h}for(var c=0;c<t;++c){var h=l[c];if(h==",")l[c]="N";else if(h=="%"){for(var v=c+1;v<t&&l[v]=="%";++v);var m=c&&l[c-1]=="!"||v<t&&l[v]=="1"?"1":"N";for(var g=c;g<v;++g)l[g]=m;c=v-1}}for(var c=0,d=a;c<t;++c){var h=l[c];d=="L"&&h=="1"?l[c]="L":s.test(h)&&(d=h)}for(var c=0;c<t;++c)if(i.test(l[c])){for(var v=c+1;v<t&&i.test(l[v]);++v);var y=(c?l[c-1]:a)=="L",b=(v<t?l[v]:a)=="L",m=y||b?"L":"R";for(var g=c;g<v;++g)l[g]=m;c=v-1}var w=[],E;for(var c=0;c<t;)if(o.test(l[c])){var S=c;for(++c;c<t&&o.test(l[c]);++c);w.push(new f(0,S,c))}else{var x=c,T=w.length;for(++c;c<t&&l[c]!="L";++c);for(var g=x;g<c;)if(u.test(l[g])){x<g&&w.splice(T,0,new f(1,x,g));var N=g;for(++g;g<c&&u.test(l[g]);++g);w.splice(T,0,new f(2,N,g)),x=g}else++g;x<c&&w.splice(T,0,new f(1,x,c))}return w[0].level==1&&(E=e.match(/^\s+/))&&(w[0].from=E[0].length,w.unshift(new f(0,0,E[0].length))),Qo(w).level==1&&(E=e.match(/\s+$/))&&(Qo(w).to-=E[0].length,w.push(new f(0,t-E[0].length,t))),w[0].level!=Qo(w).level&&w.push(new f(w[0].level,t,t)),w}}();return E.version="5.0.0",E}),function(e){var t={prefilled:null,CapitalizeFirstLetter:!1,preventSubmitOnEnter:!0,isClearInputOnEsc:!0,externalTagId:!1,prefillIdFieldName:"Id",prefillValueFieldName:"Value",AjaxPush:null,AjaxPushAllTags:null,AjaxPushParameters:null,delimiters:[9,13,44],backspace:[8],maxTags:0,hiddenTagListName:null,hiddenTagListId:null,replace:!0,output:null,deleteTagsOnBackspace:!0,tagsContainer:null,tagCloseIcon:"x",tagClass:"",validator:null,onlyTagList:!1,tagList:null,fillInputOnTagRemove:!1},n={pushTag:function(t,n,i){var s=e(this),o=s.data("opts"),u,a,f,l,c=s.data("tlis"),h=s.data("tlid"),p,d,v,m,g,y,b,w;t=r.trimTag(t,o.delimiterChars);if(!t||t.length<=0)return;if(o.onlyTagList&&undefined!==o.tagList&&o.tagList){var E=o.tagList;e.each(E,function(e,t){E[e]=t.toLowerCase()});var S=e.inArray(t.toLowerCase(),E);if(-1===S)return}o.CapitalizeFirstLetter&&t.length>1&&(t=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase());if(o.validator&&!o.validator(t)){s.trigger("tm:invalid",t);return}if(o.maxTags>0&&c.length>=o.maxTags)return;u=!1,a=jQuery.map(c,function(e){return e.toLowerCase()}),p=e.inArray(t.toLowerCase(),a),-1!==p&&(u=!0);if(u){s.trigger("tm:duplicated",t);if(o.blinkClass)for(var x=0;x<6;++x)e("#"+s.data("tm_rndid")+"_"+h[p]).queue(function(t){e(this).toggleClass(o.blinkClass),t()}).delay(100);else e("#"+s.data("tm_rndid")+"_"+h[p]).stop().animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100).animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100).animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100)}else o.externalTagId===!0?(i===undefined&&e.error("externalTagId is not passed for tag -"+t),l=i):(f=Math.max.apply(null,h),f=f===-Infinity?0:f,l=++f),n||s.trigger("tm:pushing",[t,l]),c.push(t),h.push(l),n||o.AjaxPush!==null&&o.AjaxPushAllTags==null&&e.inArray(t,o.prefilled)===-1&&e.post(o.AjaxPush,e.extend({tag:t},o.AjaxPushParameters)),d=s.data("tm_rndid")+"_"+l,v=s.data("tm_rndid")+"_Remover_"+l,m=e("<span/>").text(t).html(),g='<span class="'+r.tagClasses.call(s)+'" id="'+d+'">',g+="<span>"+m+"</span>",g+='<a href="#" class="tm-tag-remove" id="'+v+'" TagIdToRemove="'+l+'">',g+=o.tagCloseIcon+"</a></span> ",y=e(g),o.tagsContainer!==null?e(o.tagsContainer).append(y):h.length>1?(w=s.siblings("#"+s.data("tm_rndid")+"_"+h[h.length-2]),w.after(y)):s.before(y),y.find("#"+v).on("click",s,function(t){t.preventDefault();var n=parseInt(e(this).attr("TagIdToRemove"));r.spliceTag.call(s,n,t.data)}),r.refreshHiddenTagList.call(s),n||s.trigger("tm:pushed",[t,l]),r.showOrHide.call(s);s.val("")},popTag:function(){var t=e(this),n,i,s=t.data("tlis"),o=t.data("tlid");o.length>0&&(n=o.pop(),i=s[s.length-1],t.trigger("tm:popping",[i,n]),s.pop(),e("#"+t.data("tm_rndid")+"_"+n).remove(),r.refreshHiddenTagList.call(t),t.trigger("tm:popped",[i,n]))},empty:function(){var t=e(this),n=t.data("tlis"),i=t.data("tlid"),s;while(i.length>0)s=i.pop(),n.pop(),e("#"+t.data("tm_rndid")+"_"+s).remove(),r.refreshHiddenTagList.call(t);t.trigger("tm:emptied",null),r.showOrHide.call(t)},tags:function(){var e=this,t=e.data("tlis");return t}},r={showOrHide:function(){var e=this,t=e.data("opts"),n=e.data("tlis");t.maxTags>0&&n.length<t.maxTags&&(e.show(),e.trigger("tm:show")),t.maxTags>0&&n.length>=t.maxTags&&(e.hide(),e.trigger("tm:hide"))},tagClasses:function(){var t=e(this),n=t.data("opts"),r=n.tagBaseClass,i=n.inputBaseClass,s;return s=r,t.attr("class")&&e.each(t.attr("class").split(" "),function(e,t){t.indexOf(i+"-")!==-1&&(s+=" "+r+t.substring(i.length))}),s+=n.tagClass?" "+n.tagClass:"",s},trimTag:function(t,n){var r;t=e.trim(t),r=0;for(r;r<t.length;r++)if(e.inArray(t.charCodeAt(r),n)!==-1)break;return t.substring(0,r)},refreshHiddenTagList:function(){var t=e(this),n=t.data("tlis"),r=t.data("lhiddenTagList");r&&e(r).val(n.join(t.data("opts").baseDelimiter)).change(),t.trigger("tm:refresh",n.join(t.data("opts").baseDelimiter))},killEvent:function(e){e.cancelBubble=!0,e.returnValue=!1,e.stopPropagation(),e.preventDefault()},keyInArray:function(t,n){return e.inArray(t.which,n)!==-1},applyDelimiter:function(t){var r=e(this);n.pushTag.call(r,e(this).val()),t.preventDefault()},prefill:function(t){var r=e(this),i=r.data("opts");e.each(t,function(e,t){i.externalTagId===!0?n.pushTag.call(r,t[i.prefillValueFieldName],!0,t[i.prefillIdFieldName]):n.pushTag.call(r,t,!0)})},pushAllTags:function(t,n){var r=e(this),i=r.data("opts"),s=r.data("tlis");i.AjaxPushAllTags&&(t.type!=="tm:pushed"||e.inArray(n,i.prefilled)===-1)&&e.post(i.AjaxPush,e.extend({tags:s.join(i.baseDelimiter)},i.AjaxPushParameters))},spliceTag:function(t){var n=this,i=n.data("tlis"),s=n.data("tlid"),o=e.inArray(t,s),u;-1!==o&&(u=i[o],n.trigger("tm:splicing",[u,t]),e("#"+n.data("tm_rndid")+"_"+t).remove(),i.splice(o,1),s.splice(o,1),r.refreshHiddenTagList.call(n),n.trigger("tm:spliced",[u,t])),r.showOrHide.call(n)},init:function(i){var s=e.extend({},t,i),o,u;return s.hiddenTagListName=s.hiddenTagListName===null?"hidden-"+this.attr("name"):s.hiddenTagListName,o=s.delimeters||s.delimiters,u=[9,13,17,18,19,37,38,39,40],s.delimiterChars=[],s.delimiterKeys=[],e.each(o,function(t,n){e.inArray(n,u)!==-1?s.delimiterKeys.push(n):s.delimiterChars.push(n)}),s.baseDelimiter=String.fromCharCode(s.delimiterChars[0]||44),s.tagBaseClass="tm-tag",s.inputBaseClass="tm-input",e.isFunction(s.validator)||(s.validator=null),this.each(function(){var t=e(this),i="",o="",u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";if(t.data("tagManager"))return!1;t.data("tagManager",!0);for(var a=0;a<5;a++)o+=u.charAt(Math.floor(Math.random()*u.length));t.data("tm_rndid",o),t.data("opts",s).data("tlis",[]).data("tlid",[]),s.output===null?(i=e("<input/>",{type:"hidden",name:s.hiddenTagListName}),t.after(i),t.data("lhiddenTagList",i)):t.data("lhiddenTagList",e(s.output)),s.AjaxPushAllTags&&(t.on("tm:spliced",r.pushAllTags),t.on("tm:popped",r.pushAllTags),t.on("tm:pushed",r.pushAllTags)),t.on("focus keypress",function(t){e(this).popover&&e(this).popover("hide")}),s.isClearInputOnEsc&&t.on("keyup",function(t){t.which===27&&(e(this).val(""),r.killEvent(t))}),t.on("keypress",function(e){r.keyInArray(e,s.delimiterChars)&&r.applyDelimiter.call(t,e)}),t.on("keydown",function(e){e.which===13&&s.preventSubmitOnEnter&&r.killEvent(e),r.keyInArray(e,s.delimiterKeys)&&r.applyDelimiter.call(t,e)}),s.deleteTagsOnBackspace&&t.on("keydown",function(i){r.keyInArray(i,s.backspace)&&e(this).val().length<=0&&(n.popTag.call(t),r.killEvent(i))}),s.fillInputOnTagRemove&&t.on("tm:popped",function(t,n){e(this).val(n)}),t.change(function(e){/webkit/.test(navigator.userAgent.toLowerCase())||t.focus(),r.killEvent(e)});if(s.prefilled!==null)typeof s.prefilled=="object"?r.prefill.call(t,s.prefilled):typeof s.prefilled=="string"?r.prefill.call(t,s.prefilled.split(s.baseDelimiter)):typeof s.prefilled=="function"&&r.prefill.call(t,s.prefilled());else if(s.output!==null){if(e(s.output)&&e(s.output).val())var f=e(s.output);r.prefill.call(t,e(s.output).val().split(s.baseDelimiter))}}),this}};e.fn.tagsManager=function(t){var i=e(this);return 0 in this?n[t]?n[t].apply(i,Array.prototype.slice.call(arguments,1)):typeof t=="object"||!t?r.init.apply(this,arguments):(e.error("Method "+t+" does not exist."),!1):this}}(jQuery),define("tagmanager",["jquery"],function(){}),define("form",["jquery","laconic","tagmanager"],function(e){function n(t,n){return e.el.label({"class":"control-label col-xs-2","for":t},n)}function r(t,n){var r={name:t,type:"checkbox"};return n=n||{},n.checked&&(r.checked="checked"),n.title&&(r.title=n.title),e.el.input(r)}function i(t,n){var r={name:t,type:"text","class":"form-control"};return n=n||{},n.placeholder&&(r.placeholder=n.placeholder),n.title&&(r.title=n.title),n.value&&(r.value=n.value),n.disabled&&(r.disabled=n.disabled),e.el.input(r)}function s(t,n,r){var i={name:t,type:"text","class":"tm-input tag-list"};n&&(i.placeholder=n);var s=e.el.input(i);return r&&e(s).data("prefilled",r),s}function o(t){return e.el.p({"class":"help-block"},"Make saved file public and give it a meaningful name")}function u(t,n){var r={name:t,"class":"form-control"};return n=n||{},n.placeholder&&(r.placeholder=n.placeholder),e.el.textarea(r,n.value||"")}var t={serializeAsObject:function(t){var n=t.serializeArray(0),r={};for(var i=0;i<n.length;i++){var s=n[i].name,o=n[i].value,u=t.find('[name="'+s+'"]'),a=u.prop("type");o!=""&&(a=="hidden"&&s.indexOf("hidden-")==0?(s=s.slice("hidden-".length),r[s]==undefined?r[s]=o.split(","):r[s]=o.split(",").concat(r[s])):a=="text"&&u.hasClass("tag-list")?o!=""&&(r[s]!==undefined?r[s].push(o):r[s]=[o]):a=="checkbox"?r[s]=o=="on"?!0:!1:r[s]=o)}return t.find("[type=checkbox]").each(function(){var t=e(this),n=t.prop("name");r[n]===undefined&&(r[n]=!1)}),r},showDialog:function(t){e(".trill_on_swish-event-receiver").trigger("dialog",t)},formBroadcast:function(t,n){e(".trill_on_swish-event-receiver").trigger(t,n)},fields:{fileName:function(t,s,u){var a=e.el.div({"class":"form-group"},n("name","Public | name"),e.el.div({"class":"col-xs-10"},e.el.div({"class":"input-group"},e.el.span({"class":"input-group-addon",title:"If checked, other users can find this program"},r("public",{checked:s})),i("name",{placeholder:"Name (leave empty for generated random name)",title:"Public name of your program",value:t,disabled:u})),o("Make saved file public or give it a meaningful name")));return a},title:function(t){var r=e.el.div({"class":"form-group"},n("title","Title"),e.el.div({"class":"col-xs-10"},i("title",{placeholder:"Descriptive title",value:t})));return r},author:function(t){var r=e.el.div({"class":"form-group"},n("author","Author"),e.el.div({"class":"col-xs-10"},i("author",{placeholder:"Your name",value:t})));return r},date:function(t,r,s){s=s||n;var o=e.el.div({"class":"form-group"},n(s,r),e.el.div({"class":"col-xs-10"},i(s,{disabled:!0,value:(new Date(t*1e3)).toLocaleString()})));return o},description:function(t){var r=e.el.div({"class":"form-group"},n("description","Description"),e.el.div({"class":"col-xs-10"},u("description",{value:t})));return r},commit_message:function(t){var r=e.el.div({"class":"form-group"},n("commit_message","Changes"),e.el.div({"class":"col-xs-10"},u("commit_message",{value:t,placeholder:"Describe your changes here"})));return r},tags:function(t){var r=e.el.div({"class":"form-group"},n("tags","Tags"),e.el.div({"class":"col-xs-10"},s("tags","Tags help finding this code",t)));return r},buttons:function(n){n=n||{};var r=n.label||"Save program",i=e.el.button({name:"save","class":"btn btn-primary"},r);e(i).on("click",function(r){var i=e(r.target).parents("form")[0],s=t.serializeAsObject(e(i));return n.action(r,s),e(r.target).parents(".modal").modal("hide"),r.preventDefault(),!1});var s=e.el.div({"class":"form-group"},e.el.div({"class":"col-xs-offset-2 col-xs-10"},i,e.el.button({name:"cancel","class":"btn btn-danger","data-dismiss":"modal"},"Cancel")));return s}},widgets:{glyphIconButton:function(t,n){var r={"class":"btn btn-info",type:"button"};return n.action&&(r["data-action"]=n.action),n.title&&(r.title=n.title),elem=e.el.button(r,e.el.span({"class":"glyphicon "+t})),elem}}};return t}),define("trill_on_swish_gitty",["jquery","config","form","laconic"],function(e,t,n){function r(t,n){function i(e){(t[e]||n[e])&&t[e]!=n[e]&&(r[e]={from:t[e],to:n[e]})}var r={};i("author"),i("title"),i("data"),i("public");if(d=s(t.tags,n.tags))r.tags=d;return e.isEmptyObject(r)?null:r}function i(t,n){var r={};for(var i in t)if(t.hasOwnProperty(i)){switch(typeof t[i]){case"object":if(e.isArray(t[i])&&!s(t[i],n[i]))continue;break;case"string":case"boolean":if(n[i]==t[i])continue}r[i]=t[i]}return r}function s(t,n){function s(e,t){var n=[];for(var r=0;r<t.length;r++)e.indexOf(t[r])<0&&n.push(t[r]);return n}var r,i={};return t=t||[],n=n||[],(r=s(t,n)).length>0&&(i.added=r),(r=s(n,t)).length>0&&(i.deleted=r),e.isEmptyObject(i)?null:i}return function(e){var i="trill_on_swish_gitty",s={_init:function(t){return this.each(function(){function u(t,n,r,i){var s={role:"presentation"},o=[];n&&o.push("active"),i&&o.push("disabled"),o!=[]&&(s.class=o.join(" "));var u=e.el.li(s,e.el.a({href:"#"+r,"data-toggle":"tab"},t));return u}var n=e(this),r=n.data(i)||{},s=t.meta,o;r.commits=[],r.commits[s.commit]=s,r.commit=s.commit,r.editor=t.editor,henabled=!Boolean(s.previous),o=e(e.el.div({"class":"tab-content"})),n.append(e.el.ul({"class":"nav nav-tabs"},u("Meta data",!0,"trill_on_swish_gitty-meta-data"),u("History",!1,"trill_on_swish_gitty-history",henabled),u("Changes",!1,"trill_on_swish_gitty-diff",henabled))),n.append(o),o.append(e.el.div({"class":"tab-pane fade in active trill_on_swish_gitty-meta-data",id:"trill_on_swish_gitty-meta-data"})),n.find('[href="#trill_on_swish_gitty-meta-data"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showMetaData")}),o.append(e.el.div({"class":"tab-pane fade trill_on_swish_gitty-history",id:"trill_on_swish_gitty-history"})),n.find('[href="#trill_on_swish_gitty-history"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showHistory")}),o.append(e.el.div({"class":"tab-pane fade trill_on_swish_gitty-diff",id:"trill_on_swish_gitty-diff"})),n.find('[href="#trill_on_swish_gitty-diff"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showDiff")}),n.data(i,r),n.trill_on_swish_gitty("showMetaData")})},title:function(t){var n=e.el.span("File ",e.el.span({"class":"filename"},t.name));return t.symbolic!="HEAD"&&t.commit&&e(n).append("@",e.el.span({"class":"sha1 abbrev"},t.commit.substring(0,7))),n},showMetaData:function(){return this.each(function(){var t=e(this),r=t.data(i),s=t.find(".trill_on_swish_gitty-meta-data"),o,u=r.commits[r.commit];if(r.metaData==r.commit)return;r.metaData=r.commit,s.html(""),o=e.el.form({"class":"form-horizontal"},n.fields.fileName(u.name,u.public,!0),n.fields.title(u.title),n.fields.author(u.author),n.fields.date(u.time,"Date","date"),n.fields.tags(u.tags)),u.symbolic=="HEAD"&&e(o).append(n.fields.buttons({label:"Update meta data",action:function(e,t){return r.editor.prologEditor("save",t,"only-meta-data"),!1}})),s.append(o)})},showHistory:function(){return this.each(function(){var r=e(this),s=r.data(i),o=r.find(".trill_on_swish_gitty-history"),u=s.commits[s.commit],a;if(s.history)return;o.html(""),o.append(e.el.table({"class":"table table-striped table-condensed trill_on_swish_gitty-history","data-click-to-select":!0,"data-single-select":!0},e.el.tr(e.el.th("Comment"),e.el.th("Date"),e.el.th("Author"),e.el.th("Changed")))),a=n.widgets.glyphIconButton("glyphicon-play",{title:"Open the highlighted version in SWISH"}),o.append(a),e(a).on("click",function(t){var n=r.find("tr.success");if(n.length==1){var i=n.data("commit");s.commits[i].symbolic=="HEAD"?file=s.commits[i].name:file=i,r.parents(".trill_on_swish").trill_on_swish("playFile",file),e("#ajaxModal").modal("hide")}return!1});var f=t.http.locations.trill_on_swish_web_storage+"/"+encodeURI(u.name);e.ajax({url:f,contentType:"application/json",type:"GET",data:{format:"history",depth:6,to:s.commit},success:function(e){r.trill_on_swish_gitty("fillHistoryTable",e),s.history=s.commit},error:function(){alert("Failed to fetch history")}})})},fillHistoryTable:function(t){function f(t){var n,i,o=e.el.span();if(t.previous){if((n=s.commits[t.previous])&&(i=r(t,n)))for(var u in i)i.hasOwnProperty(u)&&e(o).append(e.el.span({"class":"change-type"},u))}else e(o).append("initial");return o}var n=this,s=this.data(i),o=this.find(".table.trill_on_swish_gitty-history");for(var u=0;u<t.length;u++){var a=t[u];s.commits[a.commit]||(s.commits[a.commit]=a)}for(var u=0;u<t.length;u++){var a=t[u],l;if(u==t.length-1&&a.previous&&!s.commit[a.previous])break;var c={"data-commit":a.commit};s.commit==a.commit&&(c.class="success"),l=e.el.tr(c,e.el.td({"class":"commit-message"},a.commit_message||"No comment"),e.el.td({"class":"date"},(new Date(a.time*1e3)).toLocaleString()),e.el.td({"class":"author"},a.author||"No author"),e.el.td({"class":"changes"},f(a))),o.append(l)}o.on("click","tr",function(t){var r=e(t.target).parents("tr"),i=r.data("commit");n.trill_on_swish_gitty("setCommit",i)})},setCommit:function(e){var t=this.data(i),n=this.parent(".modal-content").find("h2");return n.html(""),n.append(this.trill_on_swish_gitty("title",t.commits[e])),this.find("tr.success").removeClass("success"),this.find("tr[data-commit="+e+"]").addClass("success"),t.commit=e,this},showDiff:function(){return this.each(function(){var n=e(this),r=n.data(i);if(r.diff==r.commit)return;n.find(".trill_on_swish_gitty-diff").html("");var s=t.http.locations.trill_on_swish_web_storage+"/"+encodeURI(r.commit);e.ajax({url:s,contentType:"application/json",type:"GET",data:{format:"diff"},success:function(e){n.trill_on_swish_gitty("fillDiff",e),r.diff=r.commit},error:function(){alert("Failed to fetch diff")}})})},fillDiff:function(e){e.tags&&this.trill_on_swish_gitty("diffTags",e.tags),e.data&&this.trill_on_swish_gitty("udiffData",e.data)},diffTags:function(t){function s(t,n){i.append(e.el.span({"class":"diff-tag "+n},t))}var n=this.find(".trill_on_swish_gitty-diff"),r=e(e.el.div({"class":"diff-tags"},e.el.label("Tags"))),i=e(e.el.span({"class":"diff-tags"}));r.append(i);if(t.deleted.length){i.append("Removed: ");for(var o=0;o<t.deleted.length;o++)s(t.deleted[o],"deleted")}if(t.added.length){i.append(t.deleted.length?", ":"","Added: ");for(var o=0;o<t.added.length;o++)s(t.added[o],"added")}return n.append(r),this},udiffData:function(t){var n=this.find(".trill_on_swish_gitty-diff"),r=t.split("\n"),i=e(e.el.pre({"class":"udiff"}));for(var s=0;s<r.length;s++){var o=r[s],u={"@":"udiff-hdr"," ":"udiff-ctx","+":"udiff-add","-":"udiff-del"};i.append(e.el.span({"class":u[o.charAt(0)]},o),e.el.br())}n.append(i)}};e.fn.trill_on_swish_gitty=function(t){if(s[t])return s[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return s._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+i)}}(jQuery),{diffMeta:r,reduceMeta:i}}),define("modal",["config","preferences","jquery","laconic","bootstrap"],function(e,t){(function(n){function s(){var e=n.el.button({type:"button","class":"close","data-dismiss":"modal"});return n(e).html("&times;").on("click",function(e){var r=n(this).parents(".modal"),i=r.find("[data-notagain]");e.preventDefault();if(i&&i.prop("checked")){var s=i.attr("data-notagain");t.setNotAgain(s)}r.modal({show:!1})}),e}function o(e){return e.notagain&&t.persistent()?n.el.label(n.el.input({type:"checkbox","data-notagain":e.notagain,name:"dismiss"})," Don't show again!"):""}function u(){var e=n(this).find(".tm-input");e.each(function(){var e=n(this),t=e.data("prefilled"),r={};t&&(r.prefilled=t),e.tagsManager(r)})}var r="trill_on_swishModal",i={_init:function(e){return this.each(function(){var e=n(this);e.addClass("trill_on_swish-event-receiver"),e.on("trill_on_swish_help",function(t,n){e.trill_on_swishModal("showHelp",n)}),e.on("pldoc",function(t,n){e.trill_on_swishModal("showPlDoc",n)}),e.on("form",function(t,n){e.trill_on_swishModal("showForm",n)}),e.on("dialog",function(t,n){e.trill_on_swishModal("show",n)}),e.on("error",function(t,n){e.trill_on_swishModal("show",n)})})},showHelp:function(r){var i=this;if(r.notagain&&t.notagain(r.notagain))return;n.ajax({url:e.http.locations.trill_on_swish_help+"/"+r.file,dataType:"html",success:function(e){var t=n("<div>");t.html(e),i.trill_on_swishModal("show",n.extend({title:t.find("title").text(),body:t},r))}})},showForm:function(t){var r=this;n.ajax({url:e.http.locations.form+"/"+t.file,dataType:"html",success:function(e){var i=n("<div>");i.html(e),r.trill_on_swishModal("show",n.extend({title:i.find("legend").text(),body:i},t))}})},showPlDoc:function(t){function n(t){var n=t.name+"/"+t.arity;return e.http.locations.pldoc_doc_for+"?header=false&object="+encodeURIComponent(n)}function r(e,t){return e.parents("div.modal-dialog").addClass("swish-embedded-manual"),"<iframe class='swish-embedded-manual' onload='javascript:resizeIframe(this);' src='"+t+"'>"+"</iframe>"}var i={title:"SWI-Prolog manual",body:function(){return r(this,n(t))}};return this.trill_on_swishModal("show",i)},show:function(e){var r=n.el.div({"class":"modal-body"}),i=n.el.h2(),a=n.el.div({"class":"modal-content"},n.el.div({"class":"modal-header"},o(e),s(),i),r),f=n.el.div({"class":"modal fade",id:"ajaxModal",tabindex:-1,role:"dialog"},n.el.div({"class":"modal-dialog"},a));e.notagain&&t.persistent()&&n(a).append(n.el.div({"class":"modal-footer"},o(e))),r=n(r);if(typeof e.body=="function"){var l=e.body.call(r);l&&r.append(l)}else r.html(e.body);return n(i).html(e.title),n(f).modal({show:!0}).on("shown.bs.modal",u).on("hidden.bs.modal",function(){n(this).remove()}),this}};window.resizeIframe=function(e){e.style.height=0,e.style.height=e.contentWindow.document.body.scrollHeight+20+"px"},n.fn.trill_on_swishModal=function(e){if(i[e])return i[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return i._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+r)}})(jQuery)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/edit/matchbrackets",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e,t,i,o){var u=e.getLineHandle(t.line),a=t.ch-1,f=a>=0&&r[u.text.charAt(a)]||r[u.text.charAt(++a)];if(!f)return null;var l=f.charAt(1)==">"?1:-1;if(i&&l>0!=(a==t.ch))return null;var c=e.getTokenTypeAt(n(t.line,a+1)),h=s(e,n(t.line,a+(l>0?1:0)),l,c||null,o);return h==null?null:{from:n(t.line,a),to:h&&h.pos,match:h&&h.ch==f.charAt(0),forward:l>0}}function s(e,t,i,s,o){var u=o&&o.maxScanLineLength||1e4,a=o&&o.maxScanLines||1e3,f=[],l=o&&o.bracketRegex?o.bracketRegex:/[(){}[\]]/,c=i>0?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a);for(var h=t.line;h!=c;h+=i){var p=e.getLine(h);if(!p)continue;var d=i>0?0:p.length-1,v=i>0?p.length:-1;if(p.length>u)continue;h==t.line&&(d=t.ch-(i<0?1:0));for(;d!=v;d+=i){var m=p.charAt(d);if(l.test(m)&&(s===undefined||e.getTokenTypeAt(n(h,d+1))==s)){var g=r[m];if(g.charAt(1)==">"==i>0)f.push(m);else{if(!f.length)return{pos:n(h,d),ch:m};f.pop()}}}}return h-i==(i>0?e.lastLine():e.firstLine())?!1:null}function o(e,r,s){var o=e.state.matchBrackets.maxHighlightLineLength||1e3,u=[],a=e.listSelections();for(var f=0;f<a.length;f++){var l=a[f].empty()&&i(e,a[f].head,!1,s);if(l&&e.getLine(l.from.line).length<=o){var c=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";u.push(e.markText(l.from,n(l.from.line,l.from.ch+1),{className:c})),l.to&&e.getLine(l.to.line).length<=o&&u.push(e.markText(l.to,n(l.to.line,l.to.ch+1),{className:c}))}}if(u.length){t&&e.state.focused&&e.focus();var h=function(){e.operation(function(){for(var e=0;e<u.length;e++)u[e].clear()})};if(!r)return h;setTimeout(h,800)}}function a(e){e.operation(function(){u&&(u(),u=null),u=o(e,!1,e.state.matchBrackets)})}var t=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},u=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",a),n&&(t.state.matchBrackets=typeof n=="object"?n:{},t.on("cursorActivity",a))}),e.defineExtension("matchBrackets",function(){o(this,!0)}),e.defineExtension("findMatchingBracket",function(e,t,n){return i(this,e,t,n)}),e.defineExtension("scanForBracket",function(e,t,n,r){return s(this,e,t,n,r)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/comment/continuecomment",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function r(t){if(t.getOption("disableInput"))return e.Pass;var n=t.listSelections(),r,s=[];for(var o=0;o<n.length;o++){var u=n[o].head,a=t.getTokenAt(u);if(a.type!="comment")return e.Pass;var f=e.innerMode(t.getMode(),a.state).mode;if(!r)r=f;else if(r!=f)return e.Pass;var l=null;if(r.blockCommentStart&&r.blockCommentContinue){var c=a.string.indexOf(r.blockCommentEnd),h=t.getRange(e.Pos(u.line,0),e.Pos(u.line,a.end)),p;if(!(c!=-1&&c==a.string.length-r.blockCommentEnd.length&&u.ch>=c))if(a.string.indexOf(r.blockCommentStart)==0){l=h.slice(0,a.start);if(!/^\s*$/.test(l)){l="";for(var d=0;d<a.start;++d)l+=" "}}else(p=h.indexOf(r.blockCommentContinue))!=-1&&p+r.blockCommentContinue.length>a.start&&/^\s*$/.test(h.slice(0,p))&&(l=h.slice(0,p));l!=null&&(l+=r.blockCommentContinue)}if(l==null&&r.lineComment&&i(t)){var v=t.getLine(u.line),p=v.indexOf(r.lineComment);p>-1&&(l=v.slice(0,p),/\S/.test(l)?l=null:l+=r.lineComment+v.slice(p+r.lineComment.length).match(/^\s*/)[0])}if(l==null)return e.Pass;s[o]="\n"+l}t.operation(function(){for(var e=n.length-1;e>=0;e--)t.replaceRange(s[e],n[e].from(),n[e].to(),"+insert")})}function i(e){var t=e.getOption("continueComments");return t&&typeof t=="object"?t.continueLineComment!==!1:!0}var t=["clike","css","javascript"];for(var n=0;n<t.length;++n)e.extendMode(t[n],{blockCommentContinue:" * "});e.defineOption("continueComments",null,function(t,n,i){i&&i!=e.Init&&t.removeKeyMap("continueComment");if(n){var s="Enter";typeof n=="string"?s=n:typeof n=="object"&&n.key&&(s=n.key);var o={name:"continueComment"};o[s]=r,t.addKeyMap(o)}})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/comment/comment",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e){var t=e.search(n);return t==-1?0:t}var t={},n=/[^\s\u00a0]/,r=e.Pos;e.commands.toggleComment=function(e){var t=Infinity,n=e.listSelections(),i=null;for(var s=n.length-1;s>=0;s--){var o=n[s].from(),u=n[s].to();if(o.line>=t)continue;u.line>=t&&(u=r(t,0)),t=o.line,i==null?e.uncomment(o,u)?i="un":(e.lineComment(o,u),i="line"):i=="un"?e.uncomment(o,u):e.lineComment(o,u)}},e.defineExtension("lineComment",function(e,s,o){o||(o=t);var u=this,a=u.getModeAt(e),f=o.lineComment||a.lineComment;if(!f){if(o.blockCommentStart||a.blockCommentStart)o.fullLines=!0,u.blockComment(e,s,o);return}var l=u.getLine(e.line);if(l==null)return;var c=Math.min(s.ch!=0||s.line==e.line?s.line+1:s.line,u.lastLine()+1),h=o.padding==null?" ":o.padding,p=o.commentBlankLines||e.line==s.line;u.operation(function(){if(o.indent){var t=l.slice(0,i(l));for(var s=e.line;s<c;++s){var a=u.getLine(s),d=t.length;if(!p&&!n.test(a))continue;a.slice(0,d)!=t&&(d=i(a)),u.replaceRange(t+f+h,r(s,0),r(s,d))}}else for(var s=e.line;s<c;++s)(p||n.test(u.getLine(s)))&&u.replaceRange(f+h,r(s,0))})}),e.defineExtension("blockComment",function(e,i,s){s||(s=t);var o=this,u=o.getModeAt(e),a=s.blockCommentStart||u.blockCommentStart,f=s.blockCommentEnd||u.blockCommentEnd;if(!a||!f){(s.lineComment||u.lineComment)&&s.fullLines!=0&&o.lineComment(e,i,s);return}var l=Math.min(i.line,o.lastLine());l!=e.line&&i.ch==0&&n.test(o.getLine(l))&&--l;var c=s.padding==null?" ":s.padding;if(e.line>l)return;o.operation(function(){if(s.fullLines!=0){var t=n.test(o.getLine(l));o.replaceRange(c+f,r(l)),o.replaceRange(a+c,r(e.line,0));var h=s.blockCommentLead||u.blockCommentLead;if(h!=null)for(var p=e.line+1;p<=l;++p)(p!=l||t)&&o.replaceRange(h+c,r(p,0))}else o.replaceRange(f,i),o.replaceRange(a,e)})}),e.defineExtension("uncomment",function(e,i,s){s||(s=t);var o=this,u=o.getModeAt(e),a=Math.min(i.ch!=0||i.line==e.line?i.line:i.line-1,o.lastLine()),f=Math.min(e.line,a),l=s.lineComment||u.lineComment,c=[],h=s.padding==null?" ":s.padding,p;e:{if(!l)break e;for(var d=f;d<=a;++d){var v=o.getLine(d),m=v.indexOf(l);m>-1&&!/comment/.test(o.getTokenTypeAt(r(d,m+1)))&&(m=-1);if(!(m!=-1||d==a&&d!=f||!n.test(v)))break e;if(m>-1&&n.test(v.slice(0,m)))break e;c.push(v)}o.operation(function(){for(var e=f;e<=a;++e){var t=c[e-f],n=t.indexOf(l),i=n+l.length;if(n<0)continue;t.slice(i,i+h.length)==h&&(i+=h.length),p=!0,o.replaceRange("",r(e,n),r(e,i))}});if(p)return!0}var g=s.blockCommentStart||u.blockCommentStart,y=s.blockCommentEnd||u.blockCommentEnd;if(!g||!y)return!1;var b=s.blockCommentLead||u.blockCommentLead,w=o.getLine(f),E=a==f?w:o.getLine(a),S=w.indexOf(g),x=E.lastIndexOf(y);x==-1&&f!=a&&(E=o.getLine(--a),x=E.lastIndexOf(y));if(S==-1||x==-1||!/comment/.test(o.getTokenTypeAt(r(f,S+1)))||!/comment/.test(o.getTokenTypeAt(r(a,x+1))))return!1;var T=w.lastIndexOf(g,e.ch),N=T==-1?-1:w.slice(0,e.ch).indexOf(y,T+g.length);if(T!=-1&&N!=-1&&N+y.length!=e.ch)return!1;N=E.indexOf(y,i.ch);var C=E.slice(i.ch).lastIndexOf(g,N-i.ch);return T=N==-1||C==-1?-1:i.ch+C,N!=-1&&T!=-1&&T!=i.ch?!1:(o.operation(function(){o.replaceRange("",r(a,x-(h&&E.slice(x-h.length,x)==h?h.length:0)),r(a,x+y.length));var e=S+g.length;h&&w.slice(e,e+h.length)==h&&(e+=h.length),o.replaceRange("",r(f,S),r(f,e));if(b)for(var t=f+1;t<=a;++t){var i=o.getLine(t),s=i.indexOf(b);if(s==-1||n.test(i.slice(0,s)))continue;var u=s+b.length;h&&i.slice(u,u+h.length)==h&&(u+=h.length),o.replaceRange("",r(t,s),r(t,u))}}),!0)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/hint/show-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e,t,n,i){if(e.async){var s=++r;e(t,function(e){r==s&&i(e)},n)}else i(e(t,n))}function s(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function o(e){return typeof e=="string"?e:e.text}function u(e,t){function s(e,r){var s;typeof r!="string"?s=function(e){return r(e,t)}:n.hasOwnProperty(r)?s=n[r]:s=r,i[e]=s}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=e.options.customKeys,i=r?{}:n;if(r)for(var o in r)r.hasOwnProperty(o)&&s(o,r[o]);var u=e.options.extraKeys;if(u)for(var o in u)u.hasOwnProperty(o)&&s(o,u[o]);return i}function a(e,t){while(t&&t!=e){if(t.nodeName.toUpperCase()==="LI"&&t.parentNode==e)return t;t=t.parentNode}}function f(r,i){this.completion=r,this.data=i;var s=this,f=r.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=i.selectedHint||0;var c=i.list;for(var h=0;h<c.length;++h){var p=l.appendChild(document.createElement("li")),d=c[h],v=t+(h!=this.selectedHint?"":" "+n);d.className!=null&&(v=d.className+" "+v),p.className=v,d.render?d.render(p,i,d):p.appendChild(document.createTextNode(d.displayText||o(d))),p.hintId=h}var m=f.cursorCoords(r.options.alignWithWord?i.from:null),g=m.left,y=m.bottom,b=!0;l.style.left=g+"px",l.style.top=y+"px";var w=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),E=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(r.options.container||document.body).appendChild(l);var S=l.getBoundingClientRect(),x=S.bottom-E;if(x>0){var T=S.bottom-S.top,N=m.top-(m.bottom-S.top);if(N-T>0)l.style.top=(y=m.top-T)+"px",b=!1;else if(T>E){l.style.height=E-5+"px",l.style.top=(y=m.bottom-S.top)+"px";var C=f.getCursor();i.from.ch!=C.ch&&(m=f.cursorCoords(C),l.style.left=(g=m.left)+"px",S=l.getBoundingClientRect())}}var k=S.right-w;k>0&&(S.right-S.left>w&&(l.style.width=w-5+"px",k-=S.right-S.left-w),l.style.left=(g=m.left-k)+"px"),f.addKeyMap(this.keyMap=u(r,{moveFocus:function(e,t){s.changeActive(s.selectedHint+e,t)},setFocus:function(e){s.changeActive(e)},menuSize:function(){return s.screenAmount()},length:c.length,close:function(){r.close()},pick:function(){s.pick()},data:i}));if(r.options.closeOnUnfocus){var L;f.on("blur",this.onBlur=function(){L=setTimeout(function(){r.close()},100)}),f.on("focus",this.onFocus=function(){clearTimeout(L)})}var A=f.getScrollInfo();return f.on("scroll",this.onScroll=function(){var e=f.getScrollInfo(),t=f.getWrapperElement().getBoundingClientRect(),n=y+A.top-e.top,i=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);b||(i+=l.offsetHeight);if(i<=t.top||i>=t.bottom)return r.close();l.style.top=n+"px",l.style.left=g+A.left-e.left+"px"}),e.on(l,"dblclick",function(e){var t=a(l,e.target||e.srcElement);t&&t.hintId!=null&&(s.changeActive(t.hintId),s.pick())}),e.on(l,"click",function(e){var t=a(l,e.target||e.srcElement);t&&t.hintId!=null&&(s.changeActive(t.hintId),r.options.completeOnSingleClick&&s.pick())}),e.on(l,"mousedown",function(){setTimeout(function(){f.focus()},20)}),e.signal(i,"select",c[0],l.firstChild),!0}var t="CodeMirror-hint",n="CodeMirror-hint-active";e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var r={hint:t};if(n)for(var i in n)r[i]=n[i];return e.showHint(r)};var r=0;e.defineExtension("showHint",function(t){if(this.listSelections().length>1||this.somethingSelected())return;this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new s(this,t),r=n.options.hint;if(!r)return;return e.signal(this,"startCompletion",this),i(r,this,n.options,function(e){n.showHints(e)})}),s.prototype={close:function(){if(!this.active())return;this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm)},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var r=t.list[n];r.hint?r.hint(this.cm,t,r):this.cm.replaceRange(o(r),r.from||t.from,r.to||t.to,"complete"),e.signal(t,"pick",r),this.close()},showHints:function(e){if(!e||!e.list.length||!this.active())return this.close();this.options.completeSingle&&e.list.length==1?this.pick(e,0):this.showWidget(e)},showWidget:function(t){function h(){if(s)return;s=!0,r.close(),r.cm.off("cursorActivity",m),t&&e.signal(t,"close")}function p(){if(s)return;e.signal(t,"update"),i(r.options.hint,r.cm,r.options,d)}function d(e){t=e;if(s)return;if(!t||!t.list.length)return h();r.widget&&r.widget.close(),r.widget=new f(r,t)}function v(){n&&(c(n),n=0)}function m(){v();var e=r.cm.getCursor(),t=r.cm.getLine(e.line);e.line!=u.line||t.length-e.ch!=a-u.ch||e.ch<u.ch||r.cm.somethingSelected()||e.ch&&o.test(t.charAt(e.ch-1))?r.close():(n=l(p),r.widget&&r.widget.close())}this.widget=new f(this,t),e.signal(t,"shown");var n=0,r=this,s,o=this.options.closeCharacters,u=this.cm.getCursor(),a=this.cm.getLine(u.line).length,l=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},c=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",m),this.onClose=h},buildOptions:function(e){var t=this.cm.options.hintOptions,n={};for(var r in l)n[r]=l[r];if(t)for(var r in t)t[r]!==undefined&&(n[r]=t[r]);if(e)for(var r in e)e[r]!==undefined&&(n[r]=e[r]);return n}},f.prototype={close:function(){if(this.completion.widget!=this)return;this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,r){t>=this.data.list.length?t=r?this.data.list.length-1:0:t<0&&(t=r?0:this.data.list.length-1);if(this.selectedHint==t)return;var i=this.hints.childNodes[this.selectedHint];i.className=i.className.replace(" "+n,""),i=this.hints.childNodes[this.selectedHint=t],i.className+=" "+n,i.offsetTop<this.hints.scrollTop?this.hints.scrollTop=i.offsetTop-3:i.offsetTop+i.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=i.offsetTop+i.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],i)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,n){var r=t.getHelpers(t.getCursor(),"hint"),i;if(r.length)for(var s=0;s<r.length;s++){var o=r[s](t,n);if(o&&o.list.length)return o}else if(i=t.getHelper(t.getCursor(),"hintWords")){if(i)return e.hint.fromList(t,{words:i})}else if(e.hint.anyword)return e.hint.anyword(t,n)}),e.registerHelper("hint","fromList",function(t,n){var r=t.getCursor(),i=t.getTokenAt(r),s=[];for(var o=0;o<n.words.length;o++){var u=n.words[o];u.slice(0,i.string.length)==i.string&&s.push(u)}if(s.length)return{list:s,from:e.Pos(r.line,i.start),to:e.Pos(r.line,i.end)}}),e.commands.autocomplete=e.showHint;var l={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/hint/anyword-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){var t=/[\w$]+/,n=500;e.registerHelper("hint","anyword",function(r,i){var s=i&&i.word||t,o=i&&i.range||n,u=r.getCursor(),a=r.getLine(u.line),f=u.ch,l=f;while(l&&s.test(a.charAt(l-1)))--l;var c=l!=f&&a.slice(l,f),h=[],p={},d=new RegExp(s.source,"g");for(var v=-1;v<=1;v+=2){var m=u.line,g=Math.min(Math.max(m+v*o,r.firstLine()),r.lastLine())+v;for(;m!=g;m+=v){var y=r.getLine(m),b;while(b=d.exec(y)){if(m==u.line&&b[0]===c)continue;(!c||b[0].lastIndexOf(c,0)==0)&&!Object.prototype.hasOwnProperty.call(p,b[0])&&(p[b[0]]=!0,h.push(b[0]))}}}return{list:h,from:e.Pos(u.line,l),to:e.Pos(u.line,f)}})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/display/placeholder",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder",n.appendChild(document.createTextNode(e.getOption("placeholder"))),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){s(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=s(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function s(e){return e.lineCount()===1&&e.getLine(0)===""}e.defineOption("placeholder","",function(n,s,o){var u=o&&o!=e.Init;if(s&&!u)n.on("blur",r),n.on("change",i),i(n);else if(!s&&u){n.off("blur",r),n.off("change",i),t(n);var a=n.getWrapperElement();a.className=a.className.replace(" CodeMirror-empty","")}s&&!n.hasFocus()&&r(n)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/runmode/runmode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.runMode=function(t,n,r,i){var s=e.getMode(e.defaults,n),o=/MSIE \d/.test(navigator.userAgent),u=o&&(document.documentMode==null||document.documentMode<9);if(r.nodeType==1){var a=i&&i.tabSize||e.defaults.tabSize,f=r,l=0;f.innerHTML="",r=function(e,t){if(e=="\n"){f.appendChild(document.createTextNode(u?"\r":e)),l=0;return}var n="";for(var r=0;;){var i=e.indexOf("	",r);if(i==-1){n+=e.slice(r),l+=e.length-r;break}l+=i-r,n+=e.slice(r,i);var s=a-l%a;l+=s;for(var o=0;o<s;++o)n+=" ";r=i+1}if(t){var c=f.appendChild(document.createElement("span"));c.className="cm-"+t.replace(/ +/g," cm-"),c.appendChild(document.createTextNode(n))}else f.appendChild(document.createTextNode(n))}}var c=e.splitLines(t),h=i&&i.state||e.startState(s);for(var p=0,d=c.length;p<d;++p){p&&r("\n");var v=new e.StringStream(c[p]);!v.string&&s.blankLine&&s.blankLine(h);while(!v.eol()){var m=s.token(v,h);r(v.current(),m,p,v.start,h),v.start=v.pos}}}}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/mode/xml/xml",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineMode("xml",function(t,n){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<")return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta"):(a=e.eat("/")?"closeTag":"openTag",t.tokenize=c,"tag bracket");if(r=="&"){var i;return e.eat("#")?e.eat("x")?i=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):i=e.eatWhile(/[\d]/)&&e.eat(";"):i=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag bracket";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(o.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName;if(!o.contextGrabbers.hasOwnProperty(n)||!o.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){return e=="openTag"?(n.tagStart=t.column(),b):e=="closeTag"?w:y}function b(e,t,n){return e=="word"?(n.tagName=t.current(),f="tag",x):(f="error",b)}function w(e,t,n){if(e=="word"){var r=t.current();return n.context&&n.context.tagName!=r&&o.implicitlyClosed.hasOwnProperty(n.context.tagName)&&m(n),n.context&&n.context.tagName==r?(f="tag",E):(f="tag error",S)}return f="error",S}function E(e,t,n){return e!="endTag"?(f="error",E):(m(n),y)}function S(e,t,n){return f="error",E(e,t,n)}function x(e,t,n){if(e=="word")return f="attribute",T;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||o.autoSelfClosers.hasOwnProperty(r)?g(n,r):(g(n,r),n.context=new v(n,r,i==n.indented)),y}return f="error",x}function T(e,t,n){return e=="equals"?N:(o.allowMissing||(f="error"),x(e,t,n))}function N(e,t,n){return e=="string"?C:e=="word"&&o.allowUnquoted?(f="string",x):(f="error",x(e,t,n))}function C(e,t,n){return e=="string"?C:x(e,t,n)}var r=t.indentUnit,i=n.multilineTagIndentFactor||1,s=n.multilineTagIndentPastTag;s==null&&(s=!0);var o=n.htmlMode?{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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},u=n.alignCDATA,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(t,n,a){var f=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+r;if(f&&f.noIndent)return e.Pass;if(t.tokenize!=c&&t.tokenize!=l)return a?a.match(/^(\s*)/)[0].length:0;if(t.tagName)return s?t.tagStart+t.tagName.length+2:t.tagStart+r*i;if(u&&/<!\[CDATA\[/.test(n))return 0;var h=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(h&&h[1])while(f){if(f.tagName==h[2]){f=f.prev;break}if(!o.implicitlyClosed.hasOwnProperty(f.tagName))break;f=f.prev}else if(h)while(f){var p=o.contextGrabbers[f.tagName];if(!p||!p.hasOwnProperty(h[2]))break;f=f.prev}while(f&&!f.startOfLine)f=f.prev;return f?f.indent+r:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),define("editorxml",["tos_cm/lib/codemirror","config","preferences","form","trill_on_swish_gitty","modal","tos_cm/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment","tos_cm/addon/comment/comment","tos_cm/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint","tos_cm/addon/display/placeholder","tos_cm/addon/runmode/runmode","tos_cm/mode/xml/xml","jquery","laconic"],function(e,t,n,r,i){(function(n){function u(e){var t=window.location.pathname;t!=e.url&&(window.history.pushState({location:e.url},"",e.url),document.title="TRILL on SWISH -- "+(e.file?e.file:"SWI-Prolog for SHaring"))}var s="xmlEditor",o={_init:function(t){return this.each(function(){var r=n(this),i={},o;t=n.extend({role:"source",placeholder:"Your ontology goes here (use RDF/XML format) ...",lineNumbers:!0,mode:"xml"},t),t.role!="query"&&(t.continueComments="Enter");if(o=r.children("textarea")[0]){var u=n(o).attr("data-file");u&&(i.file=u),window.trill_on_swish&&window.trill_on_swish.meta_data&&(i.meta=window.trill_on_swish.meta_data)}else o=n.el.textarea({placeholder:t.placeholder},r.text()),r.append(o);i.tos_cm=e.fromTextArea(o,t),console.log(e.defaults),console.log(i.tos_cm.getMode()),console.log(i.tos_cm.getOption("mode")),i.cleanGeneration=i.tos_cm.changeGeneration(),i.role=t.role,r.data(s,i),r.addClass("trill_on_swish-event-receiver"),i.role=="source"&&(r.on("source",function(e,t){r.xmlEditor("setSource",t)}),r.on("saveProgram",function(e,t){r.xmlEditor("save",t)}),r.on("fileInfo",function(){r.xmlEditor("info")}))})},getOption:function(e){var t=this;return t.data(s)[e]},getSource:function(){return this.data(s).tos_cm.getValue()},getSourceID:function(){var e=this.data(s).tos_cm;return null},setSource:function(e){var n=this.data(s);return typeof e=="string"&&(e={data:e}),this.data(s).tos_cm.setValue(e.data),n.role=="source"&&(e.meta?(n.file=e.meta.name,n.meta=e.meta):(n.file=null,n.meta=null),e.url||(e.url=t.http.locations.trill_on_swish),u(e)),this},load:function(e){if(e){var r=this,i=this.data(s);n.ajax({url:t.http.locations.trill_on_swish_web_storage+"/"+e,dataType:"text",success:function(t){r.xmlEditor("setSource",t),i.file=e},error:function(e,t){alert("Failed to load document: "+t)}})}return this},save:function(e,r){var o=this.data(s),a=t.http.locations.trill_on_swish_web_storage,f="POST",l;if(e=="as")return this.xmlEditor("saveAs"),this;o.file&&(!e||!e.name||e.name==o.file)&&(a+="/"+encodeURI(o.file),f="PUT");if(r=="only-meta-data"){e=i.reduceMeta(e,o.meta);if(n.isEmptyObject(e)){alert("No change");return}l={update:"meta-data"}}else if(f=="POST")l={data:this.xmlEditor("getSource"),type:"owl"},o.meta&&(l.previous=o.meta.commit);else if(!o.tos_cm.isClean(o.cleanGeneration))l={data:this.xmlEditor("getSource"),type:"owl"};else if(sameSet(o.meta.tags,e.tags)){alert("No change");return}return e&&(l.meta=e),n.ajax({url:a,dataType:"json",contentType:"application/json",type:f,data:JSON.stringify(l),success:function(e){e.error?alert(JSON.stringify(e)):(o.url=e.url,o.file=e.file,o.meta=e.meta,u(e))},error:function(){alert("Failed to save document")}}),this},saveAs:function(){function a(){this.append(n.el.form({"class":"form-horizontal"},r.fields.fileName(u?null:e.file,t.public),r.fields.title(t.title),r.fields.author(t.author),o?r.fields.commit_message():undefined,r.fields.tags(t.tags),r.fields.buttons({label:u?"Fork program":o?"Update program":"Save program",action:function(e,t){return console.log(t),i.xmlEditor("save",t),!1}})))}var e=this.data(s),t=e.meta||{},i=this,o=Boolean(e.file),u=e.meta&&t.symbolic!="HEAD";return t.public===undefined&&(t.public=!0),r.showDialog({title:u?"Fork from "+t.commit.substring(0,7):o?"Save new version":"Save program as",body:a}),this},info:function(){function u(){e.meta?(e.editor=i,this.trill_on_swish_gitty(e)):this.append(n.el.p("The source is not associated with a file. ","Use ",n.el.b("Save ...")," to save the source with meta information."))}var e=this.data(s),t=e.meta,i=this,o;return e.meta?o=n().trill_on_swish_gitty("title",e.meta):o="Local source",r.showDialog({title:o,body:u}),this},print:function(t){function i(e){var t=n.el.iframe({src:"about:blank"});n("body").append(t),n("body",t.contentWindow.document).append(e),t.contentWindow.print()}var r=n.el.pre({"class":"tos_cm-s-neo"});return t||(t=this.xmlEditor("getSource")),e.runMode(t,"application/xml",r),n.ajax({url:"/trill_on_swish/bower_components/codemirror/theme/neo.css",dataType:"text",success:function(e){i(n.el.div(n.el.style(e),r))},error:function(){i(r),console.log("ciao")}}),this},preference:function(e){var t=this.data(s);return e.name=="semantic-highlighting"&&t.tos_cm.setOption("prologHighlightServer",{enabled:e.value}),this},getExamples:function(e,t){var r=e?e:this.xmlEditor("getSource"),i,s=[];if(n.trim(r)=="")return null;t==0?i=[e]:i=r.match(/\/\*\* *<?examples>?[\s\S]*?\*\//igm);if(i)for(var o=0;o<i.length;o++){var u=i[o].match(/^ *\?-[\s\S]*?[^-#$&*+./:<=>?@\\^~]\.\s/gm);if(u)for(var a=0;a<u.length;a++){var f=u[a].replace(/^ *\?-\s*/,"").replace(/\s*$/,"").replace(/\\'/g,"'");s.push(f)}}return s},search:function(e,t){var n=this.data(s).tos_cm,r=n.firstLine(),i=n.lastLine(),o=[];for(var u=r;u<=i;u++){var a=n.getLine(u);if(a.search(e)>=0){o.push({line:u+1,text:a});if(t.max&&t.max===o.length)return o}}return o},gotoLine:function(e,t){function u(e){if(e._searchMarkers!==undefined){for(var t=0;t<e._searchMarkers.length;t++)e._searchMarkers[t].clear();e.off("cursorActivity",u)}e._searchMarkers=[]}var n=this.data(s),r=n.tos_cm,i=0,o;e-=1,o=t.regex,u(r),t=t||{},o&&(i=r.getLine(e).search(o),i<0&&(i=0)),r.setCursor({line:e,ch:i});var a=r.getScrollInfo().clientHeight,f=r.charCoords({line:e,ch:0},"local");r.scrollTo(null,(f.top+f.bottom-a)/2);if(o){function l(e,t){var n;while(n=o.exec(r.getLine(e)))r._searchMarkers.push(r.markText({line:e,ch:n.index},{line:e,ch:n.index+n[0].length},{className:t,clearOnEnter:!0,clearWhenEmpty:!0,title:"Search match"}))}l(e,"CodeMirror-search-match");if(t.showAllMatches){var c=r.getViewport();for(var h=c.from;h<c.to;h++)h!=e&&l(h,"CodeMirror-search-alt-match")}r._searchMarkers.length>0&&r.on("cursorActivity",u)}}};window.onpopstate=function(e){e.state?e.state.location&&(window.location=e.state.location):window.location.reload(!0)},n.fn.xmlEditor=function(e){if(o[e])return o[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return o._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+s)}})(jQuery)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/mode/erlang/erlang",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineMIME("text/x-erlang","erlang"),e.defineMode("erlang",function(t){function g(e,t){if(t.in_string)return t.in_string=!w(e),N(t,e,"string");if(t.in_atom)return t.in_atom=!E(e),N(t,e,"atom");if(e.eatSpace())return N(t,e,"whitespace");if(!A(t)&&e.match(/-\s*[a-zรŸ-รถรธ-รฟ][\wร˜-รžร€-ร–รŸ-รถรธ-รฟ]*/))return T(e.current(),n)?N(t,e,"type"):N(t,e,"attribute");var g=e.next();if(g=="%")return e.skipToEnd(),N(t,e,"comment");if(g==":")return N(t,e,"colon");if(g=="?")return e.eatSpace(),e.eatWhile(v),N(t,e,"macro");if(g=="#")return e.eatSpace(),e.eatWhile(v),N(t,e,"record");if(g=="$")return e.next()=="\\"&&!e.match(m)?N(t,e,"error"):N(t,e,"number");if(g==".")return N(t,e,"dot");if(g=="'"){if(!(t.in_atom=!E(e))){if(e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),N(t,e,"fun");if(e.match(/\s*\(/,!1)||e.match(/\s*:/,!1))return N(t,e,"function")}return N(t,e,"atom")}if(g=='"')return t.in_string=!w(e),N(t,e,"string");if(/[A-Z_ร˜-รžร€-ร–]/.test(g))return e.eatWhile(v),N(t,e,"variable");if(/[a-z_รŸ-รถรธ-รฟ]/.test(g)){e.eatWhile(v);if(e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),N(t,e,"fun");var S=e.current();return T(S,r)?N(t,e,"keyword"):T(S,o)?N(t,e,"operator"):e.match(/\s*\(/,!1)?!T(S,d)||A(t).token==":"&&A(t,2).token!="erlang"?T(S,p)?N(t,e,"guard"):N(t,e,"function"):N(t,e,"builtin"):T(S,o)?N(t,e,"operator"):x(e)==":"?S=="erlang"?N(t,e,"builtin"):N(t,e,"function"):T(S,["true","false"])?N(t,e,"boolean"):T(S,["true","false"])?N(t,e,"boolean"):N(t,e,"atom")}var C=/[0-9]/,k=/[0-9a-zA-Z]/;return C.test(g)?(e.eatWhile(C),e.eat("#")?e.eatWhile(k)||e.backUp(1):e.eat(".")&&(e.eatWhile(C)?e.eat(/[eE]/)&&(e.eat(/[-+]/)?e.eatWhile(C)||e.backUp(2):e.eatWhile(C)||e.backUp(1)):e.backUp(1)),N(t,e,"number")):y(e,f,l)?N(t,e,"open_paren"):y(e,c,h)?N(t,e,"close_paren"):b(e,i,s)?N(t,e,"separator"):b(e,u,a)?N(t,e,"operator"):N(t,e,null)}function y(e,t,n){if(e.current().length==1&&t.test(e.current())){e.backUp(1);while(t.test(e.peek())){e.next();if(T(e.current(),n))return!0}e.backUp(e.current().length-1)}return!1}function b(e,t,n){if(e.current().length==1&&t.test(e.current())){while(t.test(e.peek()))e.next();while(0<e.current().length){if(T(e.current(),n))return!0;e.backUp(1)}e.next()}return!1}function w(e){return S(e,'"',"\\")}function E(e){return S(e,"'","\\")}function S(e,t,n){while(!e.eol()){var r=e.next();if(r==t)return!0;r==n&&e.next()}return!1}function x(e){var t=e.match(/([\n\s]+|%[^\n]*\n)*(.)/,!1);return t?t.pop():""}function T(e,t){return-1<t.indexOf(e)}function N(e,t,n){O(e,k(n,t));switch(n){case"atom":return"atom";case"attribute":return"attribute";case"boolean":return"atom";case"builtin":return"builtin";case"close_paren":return null;case"colon":return null;case"comment":return"comment";case"dot":return null;case"error":return"error";case"fun":return"meta";case"function":return"tag";case"guard":return"property";case"keyword":return"keyword";case"macro":return"variable-2";case"number":return"number";case"open_paren":return null;case"operator":return"operator";case"record":return"bracket";case"separator":return null;case"string":return"string";case"type":return"def";case"variable":return"variable";default:return null}}function C(e,t,n,r){return{token:e,column:t,indent:n,type:r}}function k(e,t){return C(t.current(),t.column(),t.indentation(),e)}function L(e){return C(e,0,0,e)}function A(e,t){var n=e.tokenStack.length,r=t?t:1;return n<r?!1:e.tokenStack[n-r]}function O(e,t){t.type!="comment"&&t.type!="whitespace"&&(e.tokenStack=M(e.tokenStack,t),e.tokenStack=_(e.tokenStack))}function M(e,t){var n=e.length-1;return 0<n&&e[n].type==="record"&&t.type==="dot"?e.pop():0<n&&e[n].type==="group"?(e.pop(),e.push(t)):e.push(t),e}function _(e){var t=e.length-1;if(e[t].type==="dot")return[];if(e[t].type==="fun"&&e[t-1].token==="fun")return e.slice(0,t-1);switch(e[e.length-1].token){case"}":return D(e,{g:["{"]});case"]":return D(e,{i:["["]});case")":return D(e,{i:["("]});case">>":return D(e,{i:["<<"]});case"end":return D(e,{i:["begin","case","fun","if","receive","try"]});case",":return D(e,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return D(e,{r:["when"],m:["try","if","case","receive"]});case";":return D(e,{E:["case","fun","if","receive","try","when"]});case"catch":return D(e,{e:["try"]});case"of":return D(e,{e:["case"]});case"after":return D(e,{e:["receive","try"]});default:return e}}function D(e,t){for(var n in t){var r=e.length-1,i=t[n];for(var s=r-1;-1<s;s--)if(T(e[s].token,i)){var o=e.slice(0,s);switch(n){case"m":return o.concat(e[s]).concat(e[r]);case"r":return o.concat(e[r]);case"i":return o;case"g":return o.concat(L("group"));case"E":return o.concat(e[s]);case"e":return o.concat(e[s])}}}return n=="E"?[]:e}function P(n,r){var i,s=t.indentUnit,o=H(r),u=A(n,1),a=A(n,2);return n.in_string||n.in_atom?e.Pass:a?u.token=="when"?u.column+s:o==="when"&&a.type==="function"?a.indent+s:o==="("&&u.token==="fun"?u.column+3:o==="catch"&&(i=F(n,["try"]))?i.column:T(o,["end","after","of"])?(i=F(n,["begin","case","fun","if","receive","try"]),i?i.column:e.Pass):T(o,h)?(i=F(n,l),i?i.column:e.Pass):T(u.token,[",","|","||"])||T(o,[",","|","||"])?(i=B(n),i?i.column+i.token.length:s):u.token=="->"?T(a.token,["receive","case","if","try"])?a.column+s+s:a.column+s:T(u.token,l)?u.column+u.token.length:(i=j(n),q(i)?i.column+s:0):0}function H(e){var t=e.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);return q(t)&&t.index===0?t[0]:""}function B(e){var t=e.tokenStack.slice(0,-1),n=I(t,"type",["open_paren"]);return q(t[n])?t[n]:!1}function j(e){var t=e.tokenStack,n=I(t,"type",["open_paren","separator","keyword"]),r=I(t,"type",["operator"]);return q(n)&&q(r)&&n<r?t[n+1]:q(n)?t[n]:!1}function F(e,t){var n=e.tokenStack,r=I(n,"token",t);return q(n[r])?n[r]:!1}function I(e,t,n){for(var r=e.length-1;-1<r;r--)if(T(e[r][t],n))return r;return!1}function q(e){return e!==!1&&e!=null}var n=["-type","-spec","-export_type","-opaque"],r=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],i=/[\->,;]/,s=["->",";",","],o=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],u=/[\+\-\*\/<>=\|:!]/,a=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],f=/[<\(\[\{]/,l=["<<","(","[","{"],c=/[>\)\]\}]/,h=["}","]",")",">>"],p=["is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_record","is_reference","is_tuple","atom","binary","bitstring","boolean","function","integer","list","number","pid","port","record","reference","tuple"],d=["abs","adler32","adler32_combine","alive","apply","atom_to_binary","atom_to_list","binary_to_atom","binary_to_existing_atom","binary_to_list","binary_to_term","bit_size","bitstring_to_list","byte_size","check_process_code","contact_binary","crc32","crc32_combine","date","decode_packet","delete_module","disconnect_node","element","erase","exit","float","float_to_list","garbage_collect","get","get_keys","group_leader","halt","hd","integer_to_list","internal_bif","iolist_size","iolist_to_binary","is_alive","is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_process_alive","is_record","is_reference","is_tuple","length","link","list_to_atom","list_to_binary","list_to_bitstring","list_to_existing_atom","list_to_float","list_to_integer","list_to_pid","list_to_tuple","load_module","make_ref","module_loaded","monitor_node","node","node_link","node_unlink","nodes","notalive","now","open_port","pid_to_list","port_close","port_command","port_connect","port_control","pre_loaded","process_flag","process_info","processes","purge_module","put","register","registered","round","self","setelement","size","spawn","spawn_link","spawn_monitor","spawn_opt","split_binary","statistics","term_to_binary","time","throw","tl","trunc","tuple_size","tuple_to_list","unlink","unregister","whereis"],v=/[\w@ร˜-รžร€-ร–รŸ-รถรธ-รฟ]/,m=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;return{startState:function(){return{tokenStack:[],in_string:!1,in_atom:!1}},token:function(e,t){return g(e,t)},indent:function(e,t){return P(e,t)},lineComment:"%"}})}),define("editorprolog",["tos_cm/lib/codemirror","config","preferences","form","trill_on_swish_gitty","modal","tos_cm/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment","tos_cm/addon/comment/comment","tos_cm/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint","tos_cm/addon/display/placeholder","tos_cm/addon/runmode/runmode","tos_cm/mode/erlang/erlang","jquery","laconic"],function(e,t,n,r,i){(function(n){function u(e){var t=window.location.pathname;t!=e.url&&(window.history.pushState({location:e.url},"",e.url),document.title="TRILL on SWISH -- "+(e.file?e.file:"SWI-Prolog for SHaring"))}var s="prologEditor",o={_init:function(t){return this.each(function(){var r=n(this),i={},o;t=n.extend({role:"source",placeholder:"Your ontology goes here (use RDF/XML format) ...",lineNumbers:!0,mode:"erlang",matchBrackets:!0},t),t.role!="query"&&(t.continueComments="Enter");if(o=r.children("textarea")[0]){var u=n(o).attr("data-file");u&&(i.file=u),window.trill_on_swish&&window.trill_on_swish.meta_data&&(i.meta=window.trill_on_swish.meta_data)}else o=n.el.textarea({placeholder:t.placeholder},r.text()),r.append(o);i.tos_cm=e.fromTextArea(o,t),console.log(e.defaults),console.log(i.tos_cm.getMode()),console.log(i.tos_cm.getOption("mode")),i.cleanGeneration=i.tos_cm.changeGeneration(),i.role=t.role,r.data(s,i),r.addClass("trill_on_swish-event-receiver"),i.role=="source"&&(r.on("source",function(e,t){r.prologEditor("setSource",t)}),r.on("saveProgram",function(e,t){r.prologEditor("save",t)}),r.on("fileInfo",function(){r.prologEditor("info")}))})},getOption:function(e){var t=this;return t.data(s)[e]},getSource:function(){return this.data(s).tos_cm.getValue()},getSourceID:function(){var e=this.data(s).tos_cm;return null},setSource:function(e){var n=this.data(s);return typeof e=="string"&&(e={data:e}),this.data(s).tos_cm.setValue(e.data),n.role=="source"&&(e.meta?(n.file=e.meta.name,n.meta=e.meta):(n.file=null,n.meta=null),e.url||(e.url=t.http.locations.trill_on_swish),u(e)),this},load:function(e){if(e){var r=this,i=this.data(s);n.ajax({url:t.http.locations.trill_on_swish_web_storage+"/"+e,dataType:"text",success:function(t){r.prologEditor("setSource",t),i.file=e},error:function(e,t){alert("Failed to load document: "+t)}})}return this},save:function(e,r){var o=this.data(s),a=t.http.locations.trill_on_swish_web_storage,f="POST",l;if(e=="as")return this.prologEditor("saveAs"),this;o.file&&(!e||!e.name||e.name==o.file)&&(a+="/"+encodeURI(o.file),f="PUT");if(r=="only-meta-data"){e=i.reduceMeta(e,o.meta);if(n.isEmptyObject(e)){alert("No change");return}l={update:"meta-data"}}else if(f=="POST")l={data:this.prologEditor("getSource"),type:"pl"},o.meta&&(l.previous=o.meta.commit);else if(!o.tos_cm.isClean(o.cleanGeneration))l={data:this.prologEditor("getSource"),type:"pl"};else if(sameSet(o.meta.tags,e.tags)){alert("No change");return}return e&&(l.meta=e),n.ajax({url:a,dataType:"json",contentType:"application/json",type:f,data:JSON.stringify(l),success:function(e){e.error?alert(JSON.stringify(e)):(o.url=e.url,o.file=e.file,o.meta=e.meta,u(e))},error:function(){alert("Failed to save document")}}),this},saveAs:function(){function a(){this.append(n.el.form({"class":"form-horizontal"},r.fields.fileName(u?null:e.file,t.public),r.fields.title(t.title),r.fields.author(t.author),o?r.fields.commit_message():undefined,r.fields.tags(t.tags),r.fields.buttons({label:u?"Fork program":o?"Update program":"Save program",action:function(e,t){return console.log(t),i.prologEditor("save",t),!1}})))}var e=this.data(s),t=e.meta||{},i=this,o=Boolean(e.file),u=e.meta&&t.symbolic!="HEAD";return t.public===undefined&&(t.public=!0),r.showDialog({title:u?"Fork from "+t.commit.substring(0,7):o?"Save new version":"Save program as",body:a}),this},info:function(){function u(){e.meta?(e.editor=i,this.trill_on_swish_gitty(e)):this.append(n.el.p("The source is not associated with a file. ","Use ",n.el.b("Save ...")," to save the source with meta information."))}var e=this.data(s),t=e.meta,i=this,o;return e.meta?o=n().trill_on_swish_gitty("title",e.meta):o="Local source",r.showDialog({title:o,body:u}),this},print:function(t){function i(e){var t=n.el.iframe({src:"about:blank"});n("body").append(t),n("body",t.contentWindow.document).append(e),t.contentWindow.print()}var r=n.el.pre({"class":"tos_cm-s-neo"});return t||(t=this.prologEditor("getSource")),e.runMode(t,"application/xml",r),n.ajax({url:"/trill_on_swish/bower_components/codemirror/theme/neo.css",dataType:"text",success:function(e){i(n.el.div(n.el.style(e),r))},error:function(){i(r),console.log("ciao")}}),this},preference:function(e){var t=this.data(s);return e.name=="semantic-highlighting"&&t.tos_cm.setOption("prologHighlightServer",{enabled:e.value}),this},getExamples:function(e,t){var r=e?e:this.prologEditor("getSource"),i,s=[];if(n.trim(r)=="")return null;t==0?i=[e]:i=r.match(/\/\*\* *<?examples>?[\s\S]*?\*\//igm);if(i)for(var o=0;o<i.length;o++){var u=i[o].match(/^ *\?-[\s\S]*?[^-#$&*+./:<=>?@\\^~]\.\s/gm);if(u)for(var a=0;a<u.length;a++){var f=u[a].replace(/^ *\?-\s*/,"").replace(/\s*$/,"").replace(/\\'/g,"'");s.push(f)}}return s},search:function(e,t){var n=this.data(s).tos_cm,r=n.firstLine(),i=n.lastLine(),o=[];for(var u=r;u<=i;u++){var a=n.getLine(u);if(a.search(e)>=0){o.push({line:u+1,text:a});if(t.max&&t.max===o.length)return o}}return o},gotoLine:function(e,t){function u(e){if(e._searchMarkers!==undefined){for(var t=0;t<e._searchMarkers.length;t++)e._searchMarkers[t].clear();e.off("cursorActivity",u)}e._searchMarkers=[]}var n=this.data(s),r=n.tos_cm,i=0,o;e-=1,o=t.regex,u(r),t=t||{},o&&(i=r.getLine(e).search(o),i<0&&(i=0)),r.setCursor({line:e,ch:i});var a=r.getScrollInfo().clientHeight,f=r.charCoords({line:e,ch:0},"local");r.scrollTo(null,(f.top+f.bottom-a)/2);if(o){function l(e,t){var n;while(n=o.exec(r.getLine(e)))r._searchMarkers.push(r.markText({line:e,ch:n.index},{line:e,ch:n.index+n[0].length},{className:t,clearOnEnter:!0,clearWhenEmpty:!0,title:"Search match"}))}l(e,"CodeMirror-search-match");if(t.showAllMatches){var c=r.getViewport();for(var h=c.from;h<c.to;h++)h!=e&&l(h,"CodeMirror-search-alt-match")}r._searchMarkers.length>0&&r.on("cursorActivity",u)}}};window.onpopstate=function(e){e.state?e.state.location&&(window.location=e.state.location):window.location.reload(!0)},n.fn.prologEditor=function(e){if(o[e])return o[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return o._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+s)}})(jQuery)}),define("query",["jquery","laconic","editorprolog"],function(){(function(e){function r(t){return e(t).parents(".prolog-query-editor")}function i(t,n,i){var s=e.el.div({"class":"btn-group dropup"},e.el.button({"class":"btn btn-default btn-xs dropdown-toggle "+t,"data-toggle":"dropdown"},n,e.el.span({"class":"caret"})),e.el.ul({"class":"dropdown-menu "+t}));return e(s).on("click","a",function(){r(this).queryEditor("setQuery",e(this).text())}),s}function s(t){function o(t){var i=t.examples();e.isArray(i)&&r(n).queryEditor("setExamples",i,!0)}var n=i("examples","Examples",t),s=e(n).find("ul");if(typeof t.examples=="function")e(n).mousedown(function(e){e.which==1&&o(t)});else if(t.examples){var u=t.examples;for(var a=0;a<u.length;a++)s.append(e.el.li(e.el.a(u[a])))}return n}function o(e){return i("history","History",e)}function u(t){var n=e.el.button({"class":"clear-btn-query btn btn-default btn-xs"},"Clear");return e(n).on("click",function(){r(this).queryEditor("setQuery","")}),n}function a(t){var n=e.el.button({"class":"run-btn-query","class":"btn btn-default btn-primary btn-xs"},"Run!");return e(n).on("click",function(){r(this).queryEditor("run",undefined,f(this))}),n}function f(t){return e(t).parent().find("input").prop("checked")}function l(t){var n=e.el.span({"class":"run-chk-table"},e.el.input({type:"checkbox",name:"table"})," table results");return n}var t="queryEditor",n={_init:function(n){return this.each(function(){function p(){return e(c).find("input").prop("checked")}var r=e(this),i=e.extend({maxHistoryLength:50},n),f=e.el.div({"class":"query",style:"height:100%"}),c=l(n),h=e.el.table({"class":"prolog-query"},e.el.tr(e.el.td({"class":"prolog-prompt"},"?-"),e.el.td({colspan:2,style:"height:100%"},f),e.el.td()),e.el.tr(e.el.td(),e.el.td({"class":"buttons-left"},s(n),o(n),u(n)),e.el.td({"class":"buttons-right"},c,a(n))));r.addClass("prolog-query-editor trill_on_swish-event-receiver"),r.append(h),e(f).append(r.children("textarea")).prologEditor({role:"query",sourceID:n.sourceID,placeholder:"Your query goes here ...",lineNumbers:!1,lineWrapping:!0,prologQuery:function(e){r.queryEditor("run",e,p())}}),typeof n.examples=="object"&&n.examples[0]&&!e(f).prologEditor("getSource")&&e(f).prologEditor("setSource",n.examples[0]),r.on("source",function(e){typeof i.examples=="function"&&(exl=i.examples(),r.queryEditor("setQuery",exl&&exl[0]?exl[0]:""))}),r.data(t,i)})},setExamples:function(t,n){function i(e){var t;if((t=r.data("examples"))&&t.length==e.length){for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return!1}var r=this.find("ul.examples");t||(t=[]),n===undefined&&(n=!0);if(n&&i(t))return this;n===!0&&r.html("");for(var s=0;s<t.length;s++)r.append(e.el.li(e.el.a(t[s])));return r.data("examples",t.slice(0)),this},addHistory:function(t){function i(){return n.children().filter(function(){return e(this).text()==t})}var n=this.find("ul.history"),r=this.data("queryEditor");if(t){var s;(s=i())&&s.remove(),n.children().length>=r.maxHistoryLength&&n.children().first().remove(),n.append(e.el.li(e.el.a(t)))}return this},setQuery:function(e){return this.find(".query").prologEditor("setSource",e).focus()},getQuery:function(){return this.find(".query").prologEditor("getSource")},run:function(t,n){var r=this.data("queryEditor");t===undefined&&(t=this.queryEditor("getQuery")),t=e.trim(t);if(!t)return e(".trill_on_swish-event-receiver").trigger("trill_on_swish_help",{file:"query.html"}),this;e(".trill_on_swish-event-receiver").trigger("clearMessages");var i={query:t};return typeof r.source=="function"?i.source=r.source(t):typeof r.source=="string"&&(i.source=source),n&&(i.tabled=!0),this.queryEditor("addHistory",t),r.runner.prologRunners("run",i),this}};e.fn.queryEditor=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery)}),define("answer",["jquery","laconic"],function(){(function($){function answerHasOutput(e){return e.variables.length>0||e.residuals}function renderSubstitutions(e,t){t.push(', <span class="pl-comment">% where</span><br/>');for(var n=0;n<e.length;n++)t.push('<span class="where-binding">',"<span class='pl-var'>",e[n].var+"</span> = ",e[n].value,"</span>"),n<e.length-1&&t.push(",<br/>")}function renderAnswer(e){var t=[],n=e.variables;for(var r=0;r<n.length;r++){var i=n[r].variables;for(var s=0;s<i.length-1;s++)t.push("<span class='pl-ovar'>",i[s],"</span> = ","<span class='pl-var'>",i[s+1],"</span>, ");t.push("<span class='pl-ovar'>",i[i.length-1],"</span> = ",n[r].value),n[r].substitutions&&renderSubstitutions(n[r].substitutions,t),(r<n.length-1||e.residuals)&&t.push(",<br/>")}var o;if(o=e.residuals)for(var r=0;r<o.length;r++)t.push(o[r]),r<o.length-1&&t.push(",<br/>");return t.join("")}function renderTabledAnswer(e,t){function r(t){var n=e.variables;for(var r=0;r<n.length;r++){var i=n[r].variables;for(var s=0;s<i.length;s++)if(i[s]==t)return n[r]}return null}function u(){t.find("tr.projection th.residuals").length==0&&($("<th class='residuals'>Residual goals</th>").insertBefore(t.find("tr.projection th.answer-nth")),$("<td></td>").insertBefore(t.find("tr td.answer-nth")))}var n=[];for(var i=0;i<e.projection.length;i++){var s=e.projection[i],o=r(s);n.push("<td>"),o?(n.push(o.value),o.substitutions&&renderSubstitutions(o.substitutions,n)):n.push("<span class='pl-var'>",s,"</span>"),n.push("</td>")}var a;if(a=e.residuals){u(),n.push("<td>");for(var i=0;i<a.length;i++)n.push(a[i]),i<a.length-1&&n.push(",<br/>");n.push("</td>")}return e.nth&&n.push("<td class='answer-nth'>",e.nth,"</td>"),n.join("")}function evalScripts(elem){elem.find("script").each(function(){this.getAttribute("type")=="text/javascript"&&($.ajaxScript=$(this)),eval(this.textContent)}),$.ajaxScript&&delete $.ajaxScript}var pluginName="prologAnswer",methods={_init:function(e){return this.each(function(){var t=$(this);if(answerHasOutput(e))if(t.is("table")){var n=$.el.tr();n.innerHTML=renderTabledAnswer(e,t),evalScripts($(n)),t.append(n),$(n).find(".render-multi").renderMulti()}else t[0].innerHTML=renderAnswer(e),evalScripts(t),t.find(".render-multi").renderMulti();else t.append($.el.span({"class":"prolog-true"},"true"))})}};$.fn.prologAnswer=function(e){if(methods[e])return methods[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return methods._init.apply(this,arguments);$.error("Method "+e+" does not exist on jQuery."+pluginName)}})(jQuery),function(e){function s(){var t=e("#render-select");return t[0]||(t=e(e.el.form({id:"render-select",style:"display:none"})),t.on("click",function(){var n=e("input[name=render]:checked",e(this)).val();t.data("target").renderMulti("select",parseInt(n))}),t.hover(function(){r=!0,u()},function(){a()}),e("body").append(t)),t}function o(){if(!r){var e=s(),t=e.data("target");t&&(t.removeClass("render-selecting"),e.data("target",null)),e.hide(400)}}function u(){n=setTimeout(function(){o()},400)}function a(){r=!1,u()}var t="renderMulti",n=0,r=!1,i={_init:function(n){return this.each(function(){var n=e(this),r={current:0},i=[],s=e.el.div({"class":"render-multi-active"}),o=0;n.children().each(function(){var t=e(this).css("display");i.push(t),o++==0?n.css("display",t):e(this).hide()}),r.display=i,n.append(s),e(s).hover(function(e){n.renderMulti("showSelect",e)},function(e){n.renderMulti("hideSelect",e)}),n.data(t,r)})},selectMenu:function(){var n=this.data(t),r=["<label>View as</label><br>"],i=this.children(),s=0;for(var s=0;s<n.display.length;s++){var o=e(i[s]),u=o.attr("data-render");u||(s==0?u="Default rendered":u="Alt rendered ["+(s+1)+"]"),r.push("<input type='radio' name='render' value='",s,"'"),s==n.current&&r.push(" checked"),r.push("> ",u,"<br>")}return r.push("</form"),r.join("")},showSelect:function(e){var t=this,i=s(),o=this.offset(),u;r=!0,n&&(clearTimeout(n),n=0),(u=i.data("target"))&&u.removeClass("render-selecting"),i.data("target",t),i.html(this.renderMulti("selectMenu")),i.css({top:o.top+5+"px",left:o.left+5+"px"}).show(400),this.addClass("render-selecting")},hideSelect:function(e){a()},select:function(n){var r=this.data(t),i=this.children(),s=r.display[n];e(i[r.current]).hide(400),e(i[n]).show(400,function(){e(this).css("display",s)}),this.css("display",s),r.current=n,o()}};e.fn.renderMulti=function(n){if(i[n])return i[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n=="object"||!n)return i._init.apply(this,arguments);e.error("Method "+n+" does not exist on jQuery."+t)}}(jQuery)}),define("runner",["jquery","config","tos_cm/lib/codemirror","answer","laconic"],function(e,t,n){function r(t,n){n||(n={});var r=n.divClass,i=n.ulClass,o=e.el.div({"class":"btn-group dropdown"+(r?" "+r:"")},e.el.button({"class":"dropdown-toggle","data-toggle":"dropdown"},t),e.el.ul({"class":"dropdown-menu"+(i?" "+i:"")}));return n.actions&&s(e(o),n.client,n.actions),o}function s(t,n,r){function s(t){var r=e(t).data("action");return r&&r.call(n),!1}function o(t,n){var r=e.el.a(t);e(r).data("action",n),i.append(e.el.li(r))}var i=t.find(".dropdown-menu");for(var u in r)r.hasOwnProperty(u)&&o(u,r[u]);return i.on("click","a",function(){s(this)}),t}(function(e){var t="prologRunners",n={_init:function(n){return this.each(function(){function s(){var t=e.el.span();e(t).html("&#9776");var i=r(t,{divClass:"runners-menu",ulClass:"pull-right",client:n,actions:{"Collapse all":function(){this.find(".prolog-runner").prologRunner("toggleIconic",!0)},"Expand all":function(){this.find(".prolog-runner").prologRunner("toggleIconic",!1)},"Stop all":function(){this.find(".prolog-runner").prologRunner("stop")},Clear:function(){this.prologRunners("clear")}}});return i}var n=e(this),i={};i.stretch=e(e.el.div({"class":"stretch"})),i.inner=e(e.el.div({"class":"inner"})),n.append(s()),n.append(i.stretch),n.append(i.inner),n.on("pane.resize",function(){n.prologRunners("scrollToBottom",!0)}),n.data(t,i)})},run:function(t){var n=this.data("prologRunners");t.iconifyLast&&this.prologRunners("iconifyLast");var r=e.el.div({"class":"prolog-runner"});return n.inner.append(r),e(r).prologRunner(t),this.prologRunners("scrollToBottom"),this},clear:function(){this.find(".prolog-runner").prologRunner("close")},iconifyLast:function(){var t=e(this.inner).children().last();if(t.length==1){var n=t.prologRunner();n.alive()||n.toggleIconic(!0)}return this},scrollToBottom:function(t){return this.each(function(){var n=e(this),r=n.data("prologRunners"),i=r.inner.height(),s=n.height()-i-4-2;if(s>0||t!==!0)r.stretch.height(s>0?s:0),n.scrollTop(i)}),this}};e.fn.prologRunners=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery),function(e){function f(t){return e(t).parents(".prolog-runners")}function l(e,t){var n=e.find(".runner-results");return n.append(t),this}function c(e){switch(e){case"running":case"wait-next":case"wait-input":return!0;default:return!1}}function h(t){var n=[{"class":"projection"}];for(i=0;i<t.length;i++)n.push(e.el.th({"class":"pl-pvar"},t[i]));n.push(e.el.th({"class":"answer-nth"},"No"));var r=e.el.table({"class":"prolog-answers"},e.el.tbody(e.el.tr.apply(this,n)));return r}function p(){var e=this.pengine.options.runner,t=e.data("prologRunner");this.pengine.ask("parse,query_call("+S(t.query.query)+")"),e.prologRunner("setState","running")}function d(){var t=this.pengine.options.runner;for(var n=0;n<this.data.length;n++){var r=this.data[n];this.projection&&(r.projection=this.projection),t.prologRunner("renderAnswer",r)}this.time>.1&&l(t,e.el.div({"class":"cputime"},e.el.span(this.time.toFixed(3)," seconds cpu time"))),t.prologRunner("setState",this.more?"wait-next":"true")}function v(){var t=this.pengine.options.runner;l(t,e.el.span({"class":"prolog-false"},"false")),t.prologRunner("setState","false")}function m(){var e=this.pengine.options.runner;e.prologRunner("setState","stopped")}function g(){var e=this.pengine.options.runner,t=this.data?this.data:"Please enter a Prolog term";e.prologRunner("setPrompt",t),e.prologRunner("setState","wait-input")}function y(){var t=this.pengine.options.runner;this.data=this.data.replace(new RegExp("'[-0-9a-f]{36}':","g"),""),this.location&&(this.data=this.data.replace(/pengine:\/\/[-0-9a-f]*\//,""),e(".trill_on_swish-event-receiver").trigger("source-error",this)),t.prologRunner("outputHTML",this.data),f(t).prologRunners("scrollToBottom")}function b(){var e=this.pengine.options.runner,t;this.code=="too_many_pengines"?t="Too many open queries.  Please complete some\nqueries by using |Next|, |Stop| or by\nclosing some queries.":t=String(this.data).replace(new RegExp("'"+this.pengine.id+"':","g"),""),e.prologRunner("error",t),e.prologRunner("setState","error")}function w(){var e=this.pengine.options.runner;e.prologRunner("error","** Execution aborted **"),e.prologRunner("setState","aborted")}function E(e){return e.variables.length>0||e.residuals}function S(t){return String(e.trim(t)).replace(/\.$/,"")}var o="prologRunner",u={59:"next",186:"next",32:"next",190:"stop",13:"stop",65:"stopOrAbort",27:"stopOrAbort",46:"close",112:"trill_on_swish_help"},a={_init:function(i){return this.each(function(){function a(){var t=e.el.button();return e(t).html("&times"),e(t).on("click",function(){s.prologRunner("close")}),t}function f(){var t=e.el.button("_");return e(t).on("click",function(){s.prologRunner("toggleIconic")}),t}function l(){var t=e.el.span({"class":"runner-state show-state idle"});return r(t)}function c(){function t(){s.prologRunner("next",1)}function n(){s.prologRunner("next",10)}function r(){s.prologRunner("next",100)}function i(){s.prologRunner("next",1e3)}function u(){o.prolog.stop()}function a(){o.prolog.abort()}function f(t,n){var r=e.el.button(n);return e(r).on("click",t),r}function l(){var t=e.el.input({"class":"prolog-input"}),n=e.el.button("Send");return e(t).keypress(function(n){var r;if(n.which==13&&(r=S(e(t).val()))!="")return e(t).val(""),n.preventDefault(),s.prologRunner("respond",r),!1;n.key!="Esc"&&n.stopPropagation()}),e(n).on("click",function(){var n;(n=S(e(t).val()))!=""&&s.prologRunner("respond",n)}),{input:t,button:n}}var c=l(),h=e.el.div({"class":"controller show-state"},e.el.div({"class":"running"},f(a,"Abort")),e.el.div({"class":"wait-next"},f(t,"Next"),f(n,"10"),f(r,"100"),f(i,"1,000")," ",f(u,"Stop")),e.el.div({"class":"wait-input"},f(a,"Abort"),c.button,e.el.span(c.input)));return h}var s=e(this),o={};s.addClass("prolog-runner");var h=e.el.span({"class":"query tos_cm-s-prolog"});return n.runMode(i.query,"prolog",h),s.append(e.el.div({"class":"runner-title ui-widget-header"},a(),f(),l(),h)),s.append(e.el.div({"class":"runner-results"})),s.append(c()),s.data("prologRunner",o),s.prologRunner("populateActionMenu"),s.keydown(function(e){s.prologRunner("getState")!="wait-input"&&u[e.which]&&(e.preventDefault(),s.prologRunner(u[e.which]))}),o.savedFocus=document.activeElement,s.attr("tabindex",-1),s.focus(),o.query=i,o.answers=0,require([t.http.locations.pengines+"/pengines.js"],function(){o.prolog=new Pengine({server:t.http.locations.pengines,runner:s,application:"trill_on_swish",src:"\n\n\n:- dynamic\n        classAssertion/2,\n        propertyAssertion/3,\n        subPropertyOf/2,\n        subClassOf/2,\n        equivalentClasses/1,\n        differentIndividuals/1,\n        sameIndividual/1,\n        intersectionOf/1,\n        unionOf/1,\n        propertyRange/2,\n        propertyDomain/2,\n        annotationAssertion/3,\n        exactCardinality/2,\n        exactCardinality/3,\n        maxCardinality/2,\n        maxCardinality/3,\n        minCardinality/2,\n        minCardinality/3.\n\n:- use_module(library(lists),[member/2]).\n:- use_module(library(pengines)).\n:- use_module(library(trill)).\n\n\n:- discontiguous(valid_axiom/1).\n:- discontiguous(axiompred/1).\n:- discontiguous(axiom_arguments/2).\n\n\nbuiltin_class('http://www.w3.org/2002/07/owl#Thing').\nbuiltin_class('http://www.w3.org/2002/07/owl#Nothing').\nis_class(C) :- class(C).\nis_class(C) :- builtin_class(C).\n\n\n% TODO: hasKey\n\n/****************************************\n  AXIOMS\n  ****************************************/\n\n%% entity(?IRI)\n% the fundamental building blocks of owl 2 ontologies, and they define the vocabulary (the named terms) of an ontology\n%\n% @see individual/1, property/1, class/1, datatype/1\nentity(A) :- individual(A).\nentity(A) :- property(A).\nentity(A) :- class(A).\nentity(A) :- datatype(A).\naxiom_arguments(entity,[iri]).\nvalid_axiom(entity(A)) :- subsumed_by([A],[iri]).\n\n%declarationAxiom(individual(A)) :- individual(A). % TODO - check this\ndeclarationAxiom(namedIndividual(A)) :- namedIndividual(A).\ndeclarationAxiom(objectProperty(A)) :- objectProperty(A).\ndeclarationAxiom(dataProperty(A)) :- dataProperty(A).\ndeclarationAxiom(annotationProperty(A)) :- annotationProperty(A).  % VV added 9/3/2010\ndeclarationAxiom(class(A)) :- class(A).\ndeclarationAxiom(datatype(A)) :- datatype(A).\n% TODO: check. here we treat the ontology declaration as an axiom;\n% this liberal definition of axiom allows us to iterate over axiom/1\n% to find every piece of information in the ontology.\ndeclarationAxiom(ontology(A)) :- ontology(A).\n\n%% class(?IRI)\n% Classes can be understood as sets of individuals\n:- dynamic(class/1).\n\naxiompred(class/1).\naxiom_arguments(class,[iri]).\nvalid_axiom(class(A)) :- subsumed_by([A],[iri]).\n\n%% datatype(?IRI)\n% Datatypes are entities that refer to sets of values described by a datatype map\n:- dynamic(datatype/1).\n\naxiompred(datatype/1).\naxiom_arguments(datatype,[iri]).\nvalid_axiom(datatype(A)) :- subsumed_by([A],[iri]).\n\n%% property(?IRI)\n% Properties connect individuals with either other individuals or with literals\n%\n% @see dataProperty/1, objectProperty/1, annotationProperty/1\nproperty(A) :- dataProperty(A).\nproperty(A) :- objectProperty(A).\nproperty(A) :- annotationProperty(A).\naxiom_arguments(property,[iri]).\nvalid_axiom(property(A)) :- subsumed_by([A],[iri]).\n\n%% objectProperty(?IRI)\n% Object properties connect pairs of individuals\n:- dynamic(objectProperty/1).\n\naxiompred(objectProperty/1).\naxiom_arguments(objectProperty,[iri]).\nvalid_axiom(objectProperty(A)) :- subsumed_by([A],[iri]).\n\n%% dataProperty(?IRI)\n% Data properties connect individuals with literals. In some knowledge representation systems, functional data properties are called attributes.\n:- dynamic(dataProperty/1).\n\naxiompred(dataProperty/1).\naxiom_arguments(dataProperty,[iri]).\nvalid_axiom(dataProperty(A)) :- subsumed_by([A],[iri]).\n\n%% annotationProperty(?IRI)\n% Annotation properties can be used to provide an annotation for an ontology, axiom, or an IRI\n:- dynamic(annotationProperty/1).\n\naxiompred(annotationProperty/1).\naxiom_arguments(annotationProperty,[iri]).\nvalid_axiom(annotationProperty(A)) :- subsumed_by([A],[iri]).\n\n\n%% individual(?IRI)\n% Individuals represent actual objects from the domain being modeled\n% @see anonymousIndividual/1, namedIndividual/1\nindividual(A) :- anonymousIndividual(A).\nindividual(A) :- namedIndividual(A).\n%individual(A) :- nonvar(A),iri(A),\\+property(A),\\+class(A),\\+ontology(A). % TODO: check: make individuals the default\naxiom_arguments(individual,[iri]).\nvalid_axiom(individual(A)) :- subsumed_by([A],[iri]).\n\n%% namedIndividual(?IRI)\n% Named individuals are given an explicit name that can be used in any ontology in the import closure to refer to the same individual\n:- dynamic(namedIndividual/1).\n\naxiompred(namedIndividual/1).\naxiom_arguments(namedIndividual,[iri]).\nvalid_axiom(namedIndividual(A)) :- subsumed_by([A],[iri]).\n\n%% anonymousIndividual(?IRI)\n% Anonymous individuals are local to the ontology they are contained in. Analagous to bnodes\n% @see construct/1\n:- dynamic(anonymousIndividual/1).\n\naxiompred(anonymousIndividual/1).\naxiom_arguments(anonymousIndividual,[iri]).\nvalid_axiom(anonymousIndividual(A)) :- subsumed_by([A],[iri]).\n\n%% construct(?IRI)\n% @see axiom/1, annotation/1, ontology/1\nconstruct(A) :- axiom(A).\nconstruct(A) :- annotation(A).\nconstruct(A) :- ontology(A).\naxiom_arguments(construct,[iri]).\nvalid_axiom(construct(A)) :- subsumed_by([A],[iri]).\n\n%% axiom(?Axiom)\n% The main component of an OWL 2 ontology is a set of axioms - statements that say what is true in the domain being modeled.\n% @see classAxiom/1, propertyAxiom/1, fact/1\naxiom(A) :- classAxiom(A).\naxiom(A) :- propertyAxiom(A).\naxiom(hasKey(A,B)) :- hasKey(A,B).\naxiom(A) :- fact(A).\naxiom(A) :- declarationAxiom(A).\n%axiom(annotation(A,B,C)) :-\n%	annotation(A,B,C). % CJM-treat annotations as axioms\naxiom_arguments(axiom,[axiom]).\nvalid_axiom(axiom(A)) :- subsumed_by([A],[axiom]).\n\n%% classAxiom(?Axiom)\n% OWL 2 provides axioms that allow relationships to be established between class expressions. This predicate reifies the actual axiom\n% @see equivalentClasses/1, disjointClasses/1, subClassOf/2, disjointUnion/2\nclassAxiom(equivalentClasses(A)) :- equivalentClasses(A).\nclassAxiom(disjointClasses(A)) :- disjointClasses(A).\nclassAxiom(subClassOf(A, B)) :- subClassOf(A, B).\nclassAxiom(disjointUnion(A, B)) :- disjointUnion(A, B).\naxiom_arguments(classAxiom,[axiom]).\nvalid_axiom(classAxiom(A)) :- subsumed_by([A],[axiom]).\n\n%% subClassOf(?SubClass:ClassExpression, ?SuperClass:ClassExpression)\n% A subclass axiom SubClassOf( CE1 CE2 ) states that the class expression CE1 is a subclass of the class expression CE2\n%\n%   @param SubClass a classExpression/1 representing the more specific class\n%   @param SuperClass a classExpression/1 representing the more general class\n:- dynamic(subClassOf/2).\n\naxiompred(subClassOf/2).\naxiom_arguments(subClassOf,[classExpression, classExpression]).\nvalid_axiom(subClassOf(A, B)) :- subsumed_by([A, B],[classExpression, classExpression]).\n\n\n%% equivalentClasses(?ClassExpressions:set(ClassExpression))\n% An equivalent classes axiom EquivalentClasses( CE1 ... CEn ) states that all of the class expressions CEi, 1 <= i <= n, are semantically equivalent to each other.\n:- dynamic(equivalentClasses/1).\n\naxiompred(equivalentClasses/1).\naxiom_arguments(equivalentClasses,[set(classExpression)]).\nvalid_axiom(equivalentClasses(A)) :- subsumed_by([A],[set(classExpression)]).\n\n%% disjointClasses(?ClassExpressions:set(ClassExpression))\n% A disjoint classes axiom DisjointClasses( CE1 ... CEn ) states that all of the class expressions CEi, 1 <= i <= n, are pairwise disjoint; that is, no individual can be at the same time an instance of both CEi and CEj for i != j\n:- dynamic(disjointClasses/1).\n\naxiompred(disjointClasses/1).\naxiom_arguments(disjointClasses,[set(classExpression)]).\nvalid_axiom(disjointClasses(A)) :- subsumed_by([A],[set(classExpression)]).\n\n%% disjointUnion(?ClassExpression, ?ClassExpressions:set(ClassExpression))\n% A disjoint union axiom DisjointUnion( C CE1 ... CEn ) states that a class C is a disjoint union of the class expressions CEi, 1 <= i <= n, all of which are pairwise disjoint.\n:- dynamic(disjointUnion/2).\n\naxiompred(disjointUnion/2).\naxiom_arguments(disjointUnion,[classExpression,set(classExpression)]).\nvalid_axiom(disjointUnion(A,B)) :- subsumed_by([A,B],[classExpression,set(classExpression)]).\n\n%% propertyAxiom(?Axiom)\n% OWL 2 provides axioms that can be used to characterize and establish relationships between object property expressions. This predicate reifies the actual axiom\n%\n% @see symmetricProperty/1, inverseFunctionalProperty/1, transitiveProperty/1, asymmetricProperty/1, subPropertyOf/2, functionalProperty/1, irreflexiveProperty/1, disjointProperties/1, propertyDomain/2, reflexiveProperty/1, propertyRange/2, equivalentProperties/1, inverseProperties/2\npropertyAxiom(symmetricProperty(A)) :- symmetricProperty(A).\npropertyAxiom(inverseFunctionalProperty(A)) :- inverseFunctionalProperty(A).\npropertyAxiom(transitiveProperty(A)) :- transitiveProperty(A).\npropertyAxiom(asymmetricProperty(A)) :- asymmetricProperty(A).\npropertyAxiom(subPropertyOf(A, B)) :- subPropertyOf(A, B).\npropertyAxiom(functionalProperty(A)) :- functionalProperty(A).\npropertyAxiom(irreflexiveProperty(A)) :- irreflexiveProperty(A).\npropertyAxiom(disjointProperties(A)) :- disjointProperties(A).\npropertyAxiom(propertyDomain(A, B)) :- propertyDomain(A, B).\npropertyAxiom(reflexiveProperty(A)) :- reflexiveProperty(A).\npropertyAxiom(propertyRange(A, B)) :- propertyRange(A, B).\npropertyAxiom(equivalentProperties(A)) :- equivalentProperties(A).\npropertyAxiom(inverseProperties(A, B)) :- inverseProperties(A, B).\naxiom_arguments(propertyAxiom,[axiom]).\nvalid_axiom(propertyAxiom(A)) :- subsumed_by([A],[axiom]).\n\n\n%% subPropertyOf(?Sub:PropertyExpression, ?Super:ObjectPropertyExpression)\n% subproperty axioms are analogous to subclass axioms\n% (extensional predicate - can be asserted)\n:- dynamic(subPropertyOf/2).\n\naxiompred(subPropertyOf/2).\naxiom_arguments(subPropertyOf,[propertyExpression, objectPropertyExpression]).\nvalid_axiom(subPropertyOf(A, B)) :- subsumed_by([A, B],[propertyExpression, objectPropertyExpression]).\n\n%% subObjectPropertyOf(?Sub:ObjectPropertyExpressionOrChain, ?Super:ObjectPropertyExpression)\n% The basic form is SubPropertyOf( OPE1 OPE2 ). This axiom states that the object property expression OPE1 is a subproperty of the object property expression OPE2 - that is, if an individual x is connected by OPE1 to an individual y, then x is also connected by OPE2 to y. The more complex form is SubPropertyOf( PropertyChain( OPE1 ... OPEn ) OPE ). This axiom states that, if an individual x is connected by a sequence of object property expressions OPE1, ..., OPEn with an individual y, then x is also connected with y by the object property expression OPE\nsubObjectPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[objectPropertyExpressionOrChain, objectPropertyExpression]).\naxiom_arguments(subObjectPropertyOf,[objectPropertyExpressionOrChain, objectPropertyExpression]).\nvalid_axiom(subObjectPropertyOf(A, B)) :- subsumed_by([A, B],[objectPropertyExpressionOrChain, objectPropertyExpression]).\n\n%% subDataPropertyOf(?Sub:DataPropertyExpression, ?Super:DataPropertyExpression)\n% A data subproperty axiom SubPropertyOf( DPE1 DPE2 ) states that the data property expression DPE1 is a subproperty of the data property expression DPE2 - that is, if an individual x is connected by OPE1 to a literal y, then x is connected by OPE2 to y as well.\nsubDataPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[dataPropertyExpression, dataPropertyExpression]).\naxiom_arguments(subDataPropertyOf,[dataPropertyExpression, dataPropertyExpression]).\nvalid_axiom(subDataPropertyOf(A, B)) :- subsumed_by([A, B],[dataPropertyExpression, dataPropertyExpression]).\n\n%% subAnnotationPropertyOf(?Sub:AnnotationProperty, ?Super:AnnotationProperty)\n% An annotation subproperty axiom SubPropertyOf( AP1 AP2 ) states that the annotation property AP1 is a subproperty of the annotation property AP2\nsubAnnotationPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[annotationProperty, annotationProperty]).\naxiom_arguments(subAnnotationPropertyOf,[annotationProperty, annotationProperty]).\nvalid_axiom(subAnnotationPropertyOf(A, B)) :- subsumed_by([A, B],[annotationProperty, annotationProperty]).\n\n%% equivalentProperties(?PropertyExpressions:set(PropertyExpression))\n% An equivalent object properties axiom EquivalentProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are semantically equivalent to each other\n% (extensional predicate - can be asserted)\n:- dynamic(equivalentProperties/1).\n\naxiompred(equivalentProperties/1).\naxiom_arguments(equivalentProperties,[set(propertyExpression)]).\nvalid_axiom(equivalentProperties(A)) :- subsumed_by([A],[set(propertyExpression)]).\n\n%% equivalentObjectProperties(?PropertyExpressions:set(ObjectPropertyExpression))\n% An equivalent object properties axiom EquivalentObjectProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are semantically equivalent to each other\nequivalentObjectProperties(A) :- equivalentProperties(A),subsumed_by([A],[set(objectPropertyExpression)]).\naxiom_arguments(equivalentObjectProperties,[set(objectPropertyExpression)]).\nvalid_axiom(equivalentObjectProperties(A)) :- subsumed_by([A],[set(objectPropertyExpression)]).\n\n%% equivalentDataProperties(?PropertyExpressions:set(DataPropertyExpression))\n% An equivalent data properties axiom EquivalentProperties( DPE1 ... DPEn ) states that all the data property expressions DPEi, 1 <= i <= n, are semantically equivalent to each other. This axiom allows one to use each DPEi as a synonym for each DPEj - that is, in any expression in the ontology containing such an axiom, DPEi can be replaced with DPEj without affecting the meaning of the ontology\nequivalentDataProperties(A) :- equivalentProperties(A),subsumed_by([A],[set(dataPropertyExpression)]).\naxiom_arguments(equivalentDataProperties,[set(dataPropertyExpression)]).\nvalid_axiom(equivalentDataProperties(A)) :- subsumed_by([A],[set(dataPropertyExpression)]).\n\n%% disjointProperties(?PropertyExpressions:set(PropertyExpression))\n% A disjoint properties axiom DisjointProperties( PE1 ... PEn ) states that all of the property expressions PEi, 1 <= i <= n, are pairwise disjoint\n% (extensional predicate - can be asserted)\n:- dynamic(disjointProperties/1).\n\naxiompred(disjointProperties/1).\naxiom_arguments(disjointProperties,[set(propertyExpression)]).\nvalid_axiom(disjointProperties(A)) :- subsumed_by([A],[set(propertyExpression)]).\n\n%% disjointObjectProperties(?PropertyExpressions:set(ObjectPropertyExpression))\n% A disjoint object properties axiom DisjointProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are pairwise disjoint; that is, no individual x can be connected to an individual y by both OPEi and OPEj for i != j.\ndisjointObjectProperties(A) :- disjointProperties(A),subsumed_by([A],[set(objectPropertyExpression)]).\naxiom_arguments(disjointObjectProperties,[set(objectPropertyExpression)]).\nvalid_axiom(disjointObjectProperties(A)) :- subsumed_by([A],[set(objectPropertyExpression)]).\n\n%% disjointDataProperties(?PropertyExpressions:set(DataPropertyExpression))\n% A disjoint data properties axiom DisjointProperties( DPE1 ... DPEn ) states that all of the data property expressions DPEi, 1 <= i <= n, are pairwise disjoint; that is, no individual x can be connected to a literal y by both DPEi and DPEj for i !- j.\ndisjointDataProperties(A) :- disjointProperties(A),subsumed_by([A],[set(dataPropertyExpression)]).\naxiom_arguments(disjointDataProperties,[set(dataPropertyExpression)]).\nvalid_axiom(disjointDataProperties(A)) :- subsumed_by([A],[set(dataPropertyExpression)]).\n\n%% inverseProperties(?ObjectPropertyExpression1:ObjectPropertyExpression, ?ObjectPropertyExpression2:ObjectPropertyExpression)\n% An inverse object properties axiom InverseProperties( OPE1 OPE2 ) states that the object property expression OPE1 is an inverse of the object property expression OPE2\n% (note there are no inverse data properties, as literals are not connected to individuals)\n% Example:\n% =|inverseProperties(partOf,hasPart)|=\n% (extensional predicate - can be asserted)\n:- dynamic(inverseProperties/2).\n\naxiompred(inverseProperties/2).\naxiom_arguments(inverseProperties,[objectPropertyExpression, objectPropertyExpression]).\nvalid_axiom(inverseProperties(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, objectPropertyExpression]).\n\n%% propertyDomain(?PropertyExpression, ?CE)\n%  A property domain axiom PropertyDomain( PE CE ) states that the\n%  domain of the property expression PE is CE\n% (extensional predicate - can be asserted)\n\n:- dynamic(propertyDomain/2).\n\naxiompred(propertyDomain/2).\naxiom_arguments(propertyDomain,[propertyExpression, classExpression]).\nvalid_axiom(propertyDomain(A, B)) :- subsumed_by([A, B],[propertyExpression, classExpression]).\n\n%% objectPropertyDomain(?ObjectPropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyDomain( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\nobjectPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[objectPropertyExpression, classExpression]).\naxiom_arguments(objectPropertyDomain,[objectPropertyExpression, classExpression]).\nvalid_axiom(objectPropertyDomain(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, classExpression]).\n\n%% dataPropertyDomain(?DataPropertyExpression, ?ClassExpression)\n% A data property domain axiom PropertyDomain( DPE CE ) states that the domain of the data property expression DPE is the class expression CE - that is, if an individual x is connected by DPE with some literal, then x is an instance of CE\ndataPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[dataPropertyExpression, classExpression]).\naxiom_arguments(dataPropertyDomain,[dataPropertyExpression, classExpression]).\nvalid_axiom(dataPropertyDomain(A, B)) :- subsumed_by([A, B],[dataPropertyExpression, classExpression]).\n\n%% annotationPropertyDomain(?AnnotationProperty, ?IRI)\n% An annotation property domain axiom PropertyDomain( AP U ) states that the domain of the annotation property AP is the IRI U. Such axioms have no effect on the Direct Semantics of OWL 2\nannotationPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[annotationProperty, iri]).\naxiom_arguments(annotationPropertyDomain,[annotationProperty, iri]).\nvalid_axiom(annotationPropertyDomain(A, B)) :- subsumed_by([A, B],[annotationProperty, iri]).\n\n%% propertyRange(?PropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyRange( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\n% (extensional predicate - can be asserted)\n:- dynamic(propertyRange/2).\n\naxiompred(propertyRange/2).\naxiom_arguments(propertyRange,[propertyExpression, classExpression]).\nvalid_axiom(propertyRange(A, B)) :- subsumed_by([A, B],[propertyExpression, classExpression]).\n\n%% objectPropertyRange(?ObjectPropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyRange( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\nobjectPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[objectPropertyExpression, classExpression]).\naxiom_arguments(objectPropertyRange,[objectPropertyExpression, classExpression]).\nvalid_axiom(objectPropertyRange(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, classExpression]).\n\n%% dataPropertyRange(?ObjectPropertyExpression, ?DataRange)\n% A data property range axiom PropertyRange( DPE DR ) states that the range of the data property expression DPE is the data range DR - that is, if some individual is connected by DPE with a literal x, then x is in DR. The arity of DR MUST be one\ndataPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[dataPropertyExpression, dataRange]).\naxiom_arguments(dataPropertyRange,[objectPropertyExpression, dataRange]).\nvalid_axiom(dataPropertyRange(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, dataRange]).\n\n%% annotationPropertyRange(?AnnotationProperty, ?IRI)\n% An annotation property range axiom PropertyRange( AP U ) states that the range of the annotation property AP is the IRI U. Such axioms have no effect on the Direct Semantics of OWL 2\nannotationPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[annotationProperty, iri]).\naxiom_arguments(annotationPropertyRange,[annotationProperty, iri]).\nvalid_axiom(annotationPropertyRange(A, B)) :- subsumed_by([A, B],[annotationProperty, iri]).\n\n%% functionalProperty(?PropertyExpression)\n% An object property functionality axiom FunctionalProperty( OPE ) states that the object property expression OPE is functional - that is, for each individual x, there can be at most one distinct individual y such that x is connected by OPE to y\n% (extensional predicate - can be asserted)\n:- dynamic(functionalProperty/1).\n\naxiompred(functionalProperty/1).\naxiom_arguments(functionalProperty,[propertyExpression]).\nvalid_axiom(functionalProperty(A)) :- subsumed_by([A],[propertyExpression]).\n\n%% functionalObjectProperty(?ObjectPropertyExpression)\n% An object property functionality axiom FunctionalProperty( OPE ) states that the object property expression OPE is functional - that is, for each individual x, there can be at most one distinct individual y such that x is connected by OPE to y\nfunctionalObjectProperty(A) :- functionalProperty(A),subsumed_by([A],[objectPropertyExpression]).\naxiom_arguments(functionalObjectProperty,[objectPropertyExpression]).\nvalid_axiom(functionalObjectProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% functionalDataProperty(?DataPropertyExpression)\n% A data property functionality axiom FunctionalProperty( DPE ) states that the data property expression DPE is functional - that is, for each individual x, there can be at most one distinct literal y such that x is connected by DPE with y\nfunctionalDataProperty(A) :- functionalProperty(A),subsumed_by([A],[dataPropertyExpression]).\naxiom_arguments(functionalDataProperty,[dataPropertyExpression]).\nvalid_axiom(functionalDataProperty(A)) :- subsumed_by([A],[dataPropertyExpression]).\n\n%% inverseFunctionalProperty(?ObjectPropertyExpression)\n% An object property inverse functionality axiom InverseFunctionalProperty( OPE ) states that the object property expression OPE is inverse-functional - that is, for each individual x, there can be at most one individual y such that y is connected by OPE with x. Note there are no InverseFunctional DataProperties\n:- dynamic(inverseFunctionalProperty/1).\n\naxiompred(inverseFunctionalProperty/1).\naxiom_arguments(inverseFunctionalProperty,[objectPropertyExpression]).\nvalid_axiom(inverseFunctionalProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% reflexiveProperty(?ObjectPropertyExpression)\n% An object property reflexivity axiom ReflexiveProperty( OPE ) states that the object property expression OPE is reflexive - that is, each individual is connected by OPE to itself\n:- dynamic(reflexiveProperty/1).\n\naxiompred(reflexiveProperty/1).\naxiom_arguments(reflexiveProperty,[objectPropertyExpression]).\nvalid_axiom(reflexiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% irreflexiveProperty(?ObjectPropertyExpression)\n% An object property reflexivity axiom ReflexiveProperty( OPE ) states that the object property expression OPE is reflexive - that is, no individual is connected by OPE to itsel\n:- dynamic(irreflexiveProperty/1).\n\naxiompred(irreflexiveProperty/1).\naxiom_arguments(irreflexiveProperty,[objectPropertyExpression]).\nvalid_axiom(irreflexiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% symmetricProperty(?ObjectPropertyExpression)\n% An object property symmetry axiom SymmetricProperty( OPE ) states that the object property expression OPE is symmetric - that is, if an individual x is connected by OPE to an individual y, then y is also connected by OPE to x\n:- dynamic(symmetricProperty/1).\n\naxiompred(symmetricProperty/1).\naxiom_arguments(symmetricProperty,[objectPropertyExpression]).\nvalid_axiom(symmetricProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% asymmetricProperty(?ObjectPropertyExpression)\n% An object property asymmetry axiom AsymmetricProperty( OPE ) states that the object property expression OPE is asymmetric - that is, if an individual x is connected by OPE to an individual y, then y cannot be connected by OPE to x\n:- dynamic(asymmetricProperty/1).\n\naxiompred(asymmetricProperty/1).\naxiom_arguments(asymmetricProperty,[objectPropertyExpression]).\nvalid_axiom(asymmetricProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% transitiveProperty(?ObjectPropertyExpression)\n% An object property transitivity axiom TransitiveProperty( OPE ) states that the object property expression OPE is transitive - that is, if an individual x is connected by OPE to an individual y that is connected by OPE to an individual z, then x is also connected by OPE to z\n:- dynamic(transitiveProperty/1).\n\naxiompred(transitiveProperty/1).\naxiom_arguments(transitiveProperty,[objectPropertyExpression]).\nvalid_axiom(transitiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% hasKey(?ClassExpression,?PropertyExpression)\n% A key axiom HasKey( CE PE1 ... PEn ) states that each (named) instance of the class expression CE is uniquely identified by the (data or object) property expressions PEi - that is, no two distinct (named) instances of CE can coincide on the values of all property expressions PEi\n:- dynamic(hasKey/2).\n\naxiompred(hasKey/2).\naxiom_arguments(hasKey,[classExpression,propertyExpression]).\nvalid_axiom(hasKey(CE,PE)) :- subsumed_by([CE,PE],[classExpression,propertyExpression]).\n\n\n%% fact(?Axiom)\n% OWL 2 supports a rich set of axioms for stating assertions - axioms about individuals that are often also called facts. The fact/1 predicate reifies the fact predicate\n%\n% @see annotationAssertion/3, differentIndividuals/1, negativePropertyAssertion/3, propertyAssertion/3, sameIndividual/1, classAssertion/2\nfact(annotationAssertion(A, B, C)) :- annotationAssertion(A, B, C).\nfact(differentIndividuals(A)) :- differentIndividuals(A).\nfact(negativePropertyAssertion(A, B, C)) :- negativePropertyAssertion(A, B, C).\nfact(propertyAssertion(A, B, C)) :- propertyAssertion(A, B, C).\nfact(sameIndividual(A)) :- sameIndividual(A).\nfact(classAssertion(A, B)) :- classAssertion(A, B).\naxiom_arguments(fact,[axiom]).\nvalid_axiom(fact(A)) :- subsumed_by([A],[axiom]).\n\n%% sameIndividual(?Individuals:set(Individual))\n% An individual equality axiom SameIndividual( a1 ... an ) states that all of the individuals ai, 1 <= i <= n, are equal to each other.\n% note that despite the name of this predicate, it accepts a list of individuals as argument\n:- dynamic(sameIndividual/1).\n\naxiompred(sameIndividual/1).\naxiom_arguments(sameIndividual,[set(individual)]).\nvalid_axiom(sameIndividual(A)) :- subsumed_by([A],[set(individual)]).\n\n%% differentIndividuals(?Individuals:set(Individual))\n% An individual inequality axiom DifferentIndividuals( a1 ... an ) states that all of the individuals ai, 1 <= i <= n, are different from each other\n:- dynamic(differentIndividuals/1).\n\naxiompred(differentIndividuals/1).\naxiom_arguments(differentIndividuals,[set(individual)]).\nvalid_axiom(differentIndividuals(A)) :- subsumed_by([A],[set(individual)]).\n\n%% classAssertion(?ClassExpression, ?Individual)\n% A class assertion ClassAssertion( CE a ) states that the individual a is an instance of the class expression CE\n:- dynamic(classAssertion/2).\n\naxiompred(classAssertion/2).\naxiom_arguments(classAssertion,[classExpression, individual]).\nvalid_axiom(classAssertion(A, B)) :- subsumed_by([A, B],[classExpression, individual]).\n\n%% propertyAssertion(?PropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A positive object property assertion PropertyAssertion( OPE a1 a2 ) states that the individual a1 is connected by the object property expression OPE to the individual a2\n% (extensional predicate - can be asserted)\n:- dynamic(propertyAssertion/3).\n\naxiompred(propertyAssertion/3).\naxiom_arguments(propertyAssertion,[propertyExpression, individual, individual]).\nvalid_axiom(propertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[propertyExpression, individual, individual]).\n\n%% objectPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A positive object property assertion PropertyAssertion( OPE a1 a2 ) states that the individual a1 is connected by the object property expression OPE to the individual a2\nobjectPropertyAssertion(A, B, C) :- propertyAssertion(A, B, C),subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\naxiom_arguments(objectPropertyAssertion,[objectPropertyExpression, individual, individual]).\nvalid_axiom(objectPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\n\n%% dataPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetValue:Literal)\n% A positive data property assertion PropertyAssertion( DPE a lt ) states that the individual a is connected by the data property expression DPE to the literal lt\ndataPropertyAssertion(A, B, C) :- propertyAssertion(A, B, C),subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\naxiom_arguments(dataPropertyAssertion,[objectPropertyExpression, individual, literal]).\nvalid_axiom(dataPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\n\n%% negativePropertyAssertion(?PropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A negative object property assertion NegativePropertyAssertion( OPE a1 a2 ) states that the individual a1 is not connected by the object property expression OPE to the individual a2\n% (extensional predicate - can be asserted)\n:- dynamic(negativePropertyAssertion/3).\n\naxiompred(negativePropertyAssertion/3).\naxiom_arguments(negativePropertyAssertion,[propertyExpression, individual, individual]).\nvalid_axiom(negativePropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[propertyExpression, individual, individual]).\n\n%% negativeObjectPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A negative object property assertion NegativePropertyAssertion( OPE a1 a2 ) states that the individual a1 is not connected by the object property expression OPE to the individual a2\nnegativeObjectPropertyAssertion(A, B, C) :- negativePropertyAssertion(A, B, C),subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\naxiom_arguments(negativeObjectPropertyAssertion,[objectPropertyExpression, individual, individual]).\nvalid_axiom(negativeObjectPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\n\n%% negativeDataPropertyAssertion(?DataPropertyExpression, ?SourceIndividual:Individual, ?TargetValue:Literal)\n% A negative data property assertion NegativePropertyAssertion( DPE a lt ) states that the individual a is not connected by the data property expression DPE to the literal lt\nnegativeDataPropertyAssertion(A, B, C) :- negativePropertyAssertion(A, B, C),subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\naxiom_arguments(negativeDataPropertyAssertion,[dataPropertyExpression, individual, literal]).\nvalid_axiom(negativeDataPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\n\n%% annotationAssertion(?AnnotationProperty, ?AnnotationSubject, ?AnnotationValue)\n% An annotation assertion AnnotationAssertion( AP as av ) states that the annotation subject as - an IRI or an anonymous individual - is annotated with the annotation property AP and the annotation value av\n:- dynamic(annotationAssertion/3).\n\naxiompred(annotationAssertion/3).\naxiom_arguments(annotationAssertion,[annotationProperty, annotationSubject, annotationValue]).\nvalid_axiom(annotationAssertion(A, B, C)) :- subsumed_by([A, B, C],[annotationProperty, annotationSubject, annotationValue]).\nannotationSubject(_).\nannotationValue(_).\n\n%% annotation(?IRI,?AnnotationProperty,?AnnotationValue)\n%\n% @see annotationAnnotation/3, ontologyAnnotation/3, axiomAnnotation/3\n:- dynamic(annotation/3).\n\naxiompred(annotation/3).\n\nannotation(annotationAnnotation(A, B, C)) :- annotationAnnotation(A, B, C).\nannotation(axiomAnnotation(A, B, C)) :- axiomAnnotation(A, B, C).\naxiom_arguments(annotation,[iri,annotationProperty,annotationValue]).\nvalid_axiom(annotation(A,B,C)) :- subsumed_by([A,B,C],[iri,annotationProperty,annotationValue]).\n\n%% ontologyAnnotation(?Ontology, ?AnnotationProperty, ?AnnotationValue)\nontologyAnnotation(Ontology,AP,AV) :-\n	annotation(Ontology,AP,AV),\n	ontology(Ontology).\naxiom_arguments(ontologyAnnotation,[ontology, annotationProperty, annotationValue]).\nvalid_axiom(ontologyAnnotation(A, B, C)) :- subsumed_by([A, B, C],[ontology, annotationProperty, annotationValue]).\n\n%% axiomAnnotation(?Axiom, ?AnnotationProperty, ?AnnotationValue)\naxiomAnnotation(Axiom,AP,AV) :-\n	annotation(Axiom,AP,AV),\n	axiom(Axiom).\naxiom_arguments(axiomAnnotation,[axiom, annotationProperty, annotationValue]).\nvalid_axiom(axiomAnnotation(A, B, C)) :- subsumed_by([A, B, C],[axiom, annotationProperty, annotationValue]).\n\n%% annotationAnnotation(?Annotation, ?AnnotationProperty, ?AnnotationValue)\nannotationAnnotation(Annotation,AP,AV) :-\n	annotation(Annotation,AP,AV),\n	annotation(Annotation).\naxiom_arguments(annotationAnnotation,[annotation, annotationProperty, annotationValue]).\nvalid_axiom(annotationAnnotation(A, B, C)) :- subsumed_by([A, B, C],[annotation, annotationProperty, annotationValue]).\n\n%% ontology(?IRI)\n% An ontology in OWL2 is a collection of OWL Axioms\n:- dynamic(ontology/1).\n\naxiompred(ontology/1).\naxiom_arguments(ontology,[iri]).\nvalid_axiom(ontology(A)) :- subsumed_by([A],[iri]).\n\n%% ontologyDirective(?OntologyIRI,?IRI)\n% @see ontologyImport/2, ontologyAxiom/2\nontologyDirective(A, B) :- ontologyImport(A, B).\nontologyDirective(A, B) :- ontologyAxiom(A, B).\nontologyDirective(A, B) :- ontologyVersionInfo(A, B).\naxiom_arguments(ontologyDirective,[ontology, iri]).\nvalid_axiom(ontologyDirective(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n%% ontologyAxiom(?Ontology, ?Axiom)\n% True if Ontology contains Axiom.\n% Axiom is a prolog term that is typically asserted and separately and can thus can be executed as a goal.\n% For example, an ontology http://example.org# will contain redundant assertions:\n% ==\n% subClassOf('http://example.org#a', 'http://example.org#b').\n% ontologyAxiom('http://example.org#', subClassOf('http://example.org#a','http://example.org#b')).\n% ==\n:- dynamic(ontologyAxiom/2).\n\naxiompred(ontologyAxiom/2).\naxiom_arguments(ontologyAxiom,[ontology, axiom]).\nvalid_axiom(ontologyAxiom(A, B)) :- subsumed_by([A, B],[ontology, axiom]).\n\n%% ontologyImport(?Ontology, ?IRI)\n% True of Ontology imports document IRI\n:- dynamic(ontologyImport/2).\n\naxiompred(ontologyImport/2).\naxiom_arguments(ontologyImport,[ontology, iri]).\nvalid_axiom(ontologyImport(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n%% ontologyVersionInfo(?Ontology, ?IRI)\n:- dynamic(ontologyVersionInfo/2).\n\naxiompred(ontologyVersionInfo/2).\naxiom_arguments(ontologyVersionInfo,[ontology, iri]).\nvalid_axiom(ontologyVersionInfo(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n/****************************************\n  RESTRICTIONS ON AXIOMS\n  ****************************************/\n\n% 11.1\n% An object property expression OPE is simple in Ax if, for each object property expression OPE' such that OPE' ->* OPE holds, OPE' is not composite.\n% (The property hierarchy relation ->* is the reflexive-transitive closure of ->)\n%simpleObjectPropertyExpresion(OPE) :-\n%        objectPropertyExpression(OPE),\n\n\n/****************************************\n  EXPRESSIONS\n  ****************************************/\n\nsubsumed_by(X,_) :- var(X),!.\nsubsumed_by([],[]) :- !.\nsubsumed_by([I|IL],[T|TL]) :-\n	!,\n	subsumed_by(I,T),\n	subsumed_by(IL,TL).\nsubsumed_by(L,set(T)):-\n        !,\n        forall(member(I,L),\n               subsumed_by(I,T)).\nsubsumed_by(I,T):-\n        !,\n	G=..[T,I],\n	G.\n\n\n%% iri(?IRI)\n% true if IRI is an IRI. TODO: currently underconstrained, any atomic term can be an IRI\niri(IRI) :- atomic(IRI).	%\n\n%% literal(?Lit)\n% true if Lit is an rdf literal\n%literal(_).			% TODO\nliteral(literal(_)).			% TODO\n\npropertyExpression(E) :- objectPropertyExpression(E) ; dataPropertyExpression(E).\n\n%% objectPropertyExpression(?OPE)\n% true if OPE is an ObjectPropertyExpression\n% ObjectPropertyExpression := ObjectProperty | InverseObjectProperty\nobjectPropertyExpression(E) :- objectProperty(E) ; inverseObjectProperty(E).\n\n% give benefit of doubt; e.g. rdfs:label\n% in the OWL2 spec we have DataProperty := IRI\n% here dataProperty/1 is an asserted fact\nobjectPropertyExpression(E) :- nonvar(E),iri(E).\n\nobjectPropertyExpressionOrChain(propertyChain(PL)) :- forall(member(P,PL),objectPropertyExpression(P)).\nobjectPropertyExpressionOrChain(PE) :- objectPropertyExpression(PE).\n\n\ninverseObjectProperty(inverseOf(OP)) :- objectProperty(OP).\n\ndataPropertyExpression(E) :- dataProperty(E).\n\ndataPropertyExpression(DPEs) :-\n	(   is_list(DPEs)\n	->  forall(member(DPE,DPEs),\n		   dataPropertyExpression(DPE))\n	;   dataPropertyExpression(DPEs)).\n\n% give benefit of doubt; e.g. rdfs:label\n% in the OWL2 spec we have DataProperty := IRI\n% here dataProperty/1 is an asserted fact\ndataPropertyExpression(E) :- nonvar(E),iri(E).\n\n%already declared as entity\n%datatype(IRI) :- iri(IRI).\n\n%% dataRange(+DR) is semidet\ndataRange(DR) :-\n    datatype(DR) ;\n    dataIntersectionOf(DR );\n    dataUnionOf(DR) ;\n    dataComplementOf(DR) ;\n    dataOneOf(DR) ;\n    datatypeRestriction(DR).\n\n%% classExpression(+CE) is semidet\n%\n% true if CE is a class expression term, as defined in OWL2\n%\n% Example: =|classExpression(intersectionOf([car,someValuesFrom(hasColor,blue)])))|=\n%\n% Union of:\n%\n%    class/1 | objectIntersectionOf/1 | objectUnionOf/1 |\n%    objectComplementOf/1 | objectOneOf/1 | objectSomeValuesFrom/1 |\n%    objectAllValuesFrom/1 | objectHasValue/1 | objectHasSelf/1 |\n%    objectMinCardinality/1 | objectMaxCardinality/1 |\n%    objectExactCardinality/1 | dataSomeValuesFrom/1 |\n%    dataAllValuesFrom/1 | dataHasValue/1 | dataMinCardinality/1 |\n%    dataMaxCardinality/1 | dataExactCardinality/1\nclassExpression(CE):-\n        iri(CE) ;               % NOTE: added to allow cases where class is not imported\n    class(CE) ;\n    objectIntersectionOf(CE) ; objectUnionOf(CE) ; objectComplementOf(CE) ; objectOneOf(CE) ;\n    objectSomeValuesFrom(CE) ; objectAllValuesFrom(CE) ; objectHasValue(CE) ; objectHasSelf(CE) ;\n    objectMinCardinality(CE) ; objectMaxCardinality(CE) ; objectExactCardinality(CE) ;\n    dataSomeValuesFrom(CE) ; dataAllValuesFrom(CE) ; dataHasValue(CE) ;\n    dataMinCardinality(CE) ; dataMaxCardinality(CE) ; dataExactCardinality(CE).\n\n%% objectIntersectionOf(+CE) is semidet\n% true if CE is a term intersectionOf(ClassExpression:list)\n%\n% An intersection class expression IntersectionOf( CE1 ... CEn ) contains all individuals that are instances of all class expressions CEi for 1 <= i <= n.\nobjectIntersectionOf(intersectionOf(CEs)) :-\n	forall(member(CE,CEs),\n	       classExpression(CE)).\n\n%% objectUnionOf(+CE) is semidet\n% A union class expression UnionOf( CE1 ... CEn ) contains all individuals that are instances of at least one class expression CEi for 1 <= i <= n\nobjectUnionOf(unionOf(CEs)) :-\n	forall(member(CE,CEs),\n	       classExpression(CE)).\n\n%% objectComplementOf(+CE) is semidet\n%\nobjectComplementOf(complementOf(CE)) :-\n	classExpression(CE).\n\n%% objectOneOf(+CE) is semidet\n% An enumeration of individuals OneOf( a1 ... an ) contains exactly the individuals ai with 1 <= i <= n.\nobjectOneOf(oneOf(Is)) :-\n        is_list(Is). % TODO: check if we need to strengthen this check\n%objectOneOf(oneOf(Is)) :-\n%	forall(member(I,Is),\n%	       individual(I)).\n\n%% objectSomeValuesFrom(+R) is semidet\n% An existential class expression SomeValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE to an individual that is an instance of CE\nobjectSomeValuesFrom(someValuesFrom(OPE,CE)) :-\n	objectPropertyExpression(OPE),\n	classExpression(CE).\n\n%% objectAllValuesFrom(+R) is semidet\n% A universal class expression AllValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE only to individuals that are instances of CE\nobjectAllValuesFrom(allValuesFrom(OPE,CE)) :-\n	objectPropertyExpression(OPE),\n	classExpression(CE).\n\n%% objectHasValue(+R) is semidet\n% A has-value class expression HasValue( OPE a ) consists of an object property expression OPE and an individual a, and it contains all those individuals that are connected by OPE to a\nobjectHasValue(hasValue(OPE,I)) :-\n	objectPropertyExpression(OPE),\n	individual(I).\n\n%% objectHasSelf(+R) is semidet\n% A self-restriction HasSelf( OPE ) consists of an object property expression OPE, and it contains all those individuals that are connected by OPE to themselves\nobjectHasSelf(hasSelf(OPE)) :-\n	objectPropertyExpression(OPE).\n\n%% objectMinCardinality(+CR) is semidet\n% A minimum cardinality expression MinCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at least n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectMinCardinality(minCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectMinCardinality(minCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% objectMaxCardinality(+CR) is semidet\n% A maximum cardinality expression MaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at most n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectMaxCardinality(maxCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectMaxCardinality(maxCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n%% objectExactCardinality(+CR) is semidet\n% An exact cardinality expression ExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to exactly n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectExactCardinality(exactCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectExactCardinality(exactCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n% NON-NORMATIVE: we accept this in order to maximize compatibility with Thea1\nobjectExactCardinality(cardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% dataIntersectionOf(+DR:dataIntersectionOf) is semidet\n% An intersection data range IntersectionOf( DR1 ... DRn ) contains all data values that are contained in the value space of every data range DRi for 1 <= i <= n. All data ranges DRi must be of the same arity\ndataIntersectionOf(intersectionOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% dataUnionOf(+DR:dataUnionOf) is semidet\n% A union data range UnionOf( DR1 ... DRn ) contains all data values that are contained in the value space of at least one data range DRi for 1 <= i <= n. All data ranges DRi must be of the same arity\ndataUnionOf(unionOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% dataComplementOf(+DR:dataComplementOf) is semidet\n% A complement data range ComplementOf( DR ) contains all literals that are not contained in the data range DR\ndataComplementOf(complementOf(DR)) :-\n	dataRange(DR).\n\n%% dataOneOf(+DR:dataOneOf) is semidet\n% An enumeration of literals OneOf( lt1 ... ltn ) contains exactly the explicitly specified literals lti with 1 <= i <= n\ndataOneOf(oneOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% datatypeRestriction(+DR) is semidet\n%\n% TODO: multiple args\ndatatypeRestriction(datatypeRestriction(DR,FacetValues)):-\n	datatype(DR),\n	FacetValues=[_|_].\n\n%% dataSomeValuesFrom(+DR) is semidet\ndataSomeValuesFrom(someValuesFrom(DPE,DR)):-\n	dataPropertyExpression(DPE),\n	dataRange(DR).\n\n%% dataAllValuesFrom(+DR) is semidet\ndataAllValuesFrom(allValuesFrom(DPE,DR)):-\n	dataPropertyExpression(DPE),\n	dataRange(DR).\n\n%% dataHasValue(+DR) is semidet\n% A has-value class expression HasValue( DPE lt ) consists of a data property expression DPE and a literal lt, and it contains all those individuals that are connected by DPE to lt. Each such class expression can be seen as a syntactic shortcut for the class expression SomeValuesFrom( DPE OneOf( lt ) )\ndataHasValue(hasValue(DPE,L)):-\n	dataPropertyExpression(DPE),\n	literal(L).\n\n%% dataMinCardinality(+DR) is semidet\n% A minimum cardinality expression MinCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to at least n different literals in DR. If DR is not present, it is taken to be rdfs:Literal\ndataMinCardinality(minCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataMinCardinality(minCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n\n\n\n%% dataMaxCardinality(+DR) is semidet\n% A maximum cardinality expression MaxCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to at most n different literals in DR. If DR is not present, it is taken to be rdfs:Literal.\ndataMaxCardinality(maxCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataMaxCardinality(maxCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n\n\n%% dataExactCardinality(+DR) is semidet\n% An exact cardinality expression ExactCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to exactly n different literals in DR. If DR is not present, it is taken to be rdfs:Literal\ndataExactCardinality(exactCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataExactCardinality(exactCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n% NON-NORMATIVE: we accept this in order to maximize compatibility with Thea1\ndataExactCardinality(cardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% valid_axiom(?Axiom) is nondet\n% true if Axiom passes typechecking\n\n\n%% is_valid_axiom(?Axiom) is semidet\n% true if Axiom passes typechecking\nis_valid_axiom(Axiom) :- \\+ \\+ valid_axiom(Axiom).\n\n\n/****************************************\n  VIEW PREDICATES\n  ****************************************/\n\n%% equivalent_to(?X,?Y)\n% note: this is currently slow for bound values of X and Y\nequivalent_to(X,Y) :- equivalentClasses(L),member(X,L),member(Y,L),X\\=Y.\nequivalent_to(X,Y) :- equivalentProperties(L),member(X,L),member(Y,L),X\\=Y.\n\ndisjoint_with(X,Y) :- disjointClasses(L),member(X,L),member(Y,L),X\\=Y.\n\n%% anyPropertyAssertion(?Property,?Entity,?Value)\n% subsumes propertyAssertion/3 and annotationAssertion/3\nanyPropertyAssertion(P,E,V) :- propertyAssertion(P,E,V).\nanyPropertyAssertion(P,E,V) :- annotationAssertion(P,E,V).\n\n\n%% labelAnnotation_value(?X,?Val)\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(type(_,Val))),atom(Val).\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(lang(_,Val))),atom(Val).\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(Val)),atom(Val).\n\n/****************************************\n  META-PREDICATES\n  ****************************************/\n\n\n%% axiom_directly_about(?Ax,?About)\n% true if Ax is an axiom whose first argument is equal to About.\n%\n% e.g. axiom_directly_about( subClassOf(X,_), X).\n%\n% also include property assertions whose second argument is equal to About.\n%\n% e.g. axiom_directly_about( propertyAssertion(P,X,_), X).\n%\naxiom_directly_about(Ax,About) :-\n        axiom(Ax),\n        Ax =.. [_,Arg1|_],\n        (   is_list(Arg1)\n        ->  member(About,Arg1)\n        ;   About=Arg1).\naxiom_directly_about(Ax,About) :-\n	Ax=propertyAssertion(_,About,_),\n        axiom(Ax).\naxiom_directly_about(Ax,About) :-\n	Ax=annotationAssertion(_,About,_),\n        axiom(Ax).\naxiom_directly_about(Ax,About) :-\n	Ax=classAssertion(_,About),\n        axiom(Ax).\n\n\n%% axiom_directly_references(?Ax:axiom,?Ref)\n%\n% Ref may be\n%  - an axiom\n%  - a named entity\n%  - an expression\naxiom_directly_references(Ax,Ref) :-\n        axiom(Ax),\n        axiom_or_expression_references(Ax,Ref).\n\naxiom_or_expression_references(X,Ref) :-\n        X =.. [P|Args],\n        P\\=literal,\n        member(Arg,Args),\n        (   is_list(Arg)\n        ->  member(Ref,Arg)\n        ;   Ref=Arg).\n\naxiom_about(Ax,About) :-\n        axiom_directly_about(Ax,About).\naxiom_about(Ax,About) :-\n        axiom_directly_about(Ax,X),\n        axiom_about(X,About).\n\naxiom_references(Ax,Ref) :-\n        axiom_directly_references(Ax,Ref).\naxiom_references(Ax,Ref) :-\n        axiom_directly_references(Ax,X),\n        axiom_or_expression_references(X,Ref).\n\naxiom_contains_expression(Ax,Ex) :-\n        axiom_contains_expression(Ax,Ex,_).\naxiom_contains_expression(Ax,Ex,D) :-\n        axiom(Ax),\n        expression_has_subexpression(Ax,Ex,[],Chain),\n        length(Chain,D).\n\nexpression_has_subexpression(Ex,Ex,Accum,Accum).\nexpression_has_subexpression(Ex,SubEx,Accum,Results) :-\n        Ex =.. [F|Args],\n        member(A,Args),\n        expression_has_subexpression(A,SubEx,[F|Accum],Results).\n\n\n\n%% referenced_description(?Desc) is nondet\n% true if Desc is either a class or a class expression using the set of ontologies loaded.\n% Example: if the ontology contains\n% ==\n% subClassOf(a,intersectionOf([b,someValuesFrom(p,c)]))\n% ==\n% then Desc will be a member of [a, b, c, b and p some c, p some c]\nreferenced_description(C) :-\n        setof(C,referenced_description_1(C),Cs),\n        member(C,Cs).\n\nreferenced_description_1(C) :- class(C).\nreferenced_description_1(C) :-\n        subClassOf(A,B),\n        (   referenced_description(A,C)\n        ;   referenced_description(B,C)).\nreferenced_description_1(C) :-\n        equivalentClasses(L),\n        member(A,L),\n        referenced_description(A,C).\nreferenced_description_1(C) :-\n        classAssertion(A,_),\n        referenced_description(A,C).\n\n% TODO - this is incomplete\nreferenced_description(X,X) :- ground(X).\nreferenced_description(someValuesFrom(_,X),Y) :- referenced_description(X,Y).\nreferenced_description(allValuesFrom(_,X),Y) :- referenced_description(X,Y).\nreferenced_description(intersectionOf(L),Y) :- member(X,L),referenced_description(X,Y).\nreferenced_description(unionOf(L),Y) :- member(X,L),referenced_description(X,Y).\n\n\n/****************************************\n  UTILITY\n  ****************************************/\n\n\n:- dynamic assert_axiom_hook/1.\n\n%% assert_axiom(+Axiom:axiom)\n%\n% writes an axiom to the prolog database.\n% typically this will just be a matter of calling assert/1. However, in future we\n% will have different backing stores (rdf_db, sql), and in these cases calls to\n% this predicate will perform the appropriate actions.\n%\n% this also asserts ontologyAxiom/2, using nb_getval with current_ontology\nassert_axiom(Axiom) :-\n        assert_axiom_hook(Axiom),\n        !.\nassert_axiom(Axiom) :-\n        assert(Axiom),\n	(   nb_current(current_ontology,O)\n        ->  assert(ontologyAxiom(O,Axiom))\n        ;   true),\n        !.\n  \n%% assert_axiom(+Axiom:axiom,+Ontology:ontology) is det\n%\n% as assert_axiom/1, but also asserts to ontologyAxiom/2\nassert_axiom(Axiom,O) :-\n        assert(Axiom),\n	assert(ontologyAxiom(O,Axiom)),\n        !.\n\n\n:- dynamic retract_axiom_hook/1.\n\n%% retract_axiom(+Axiom:axiom)\n%\n% removes an axiom from the prolog database.\n% typically this will just be a matter of calling retract/1. However, in future we\n% will have different backing stores (rdf_db, sql), and in these cases calls to\n% this predicate will perform the appropriate actions.\n%\n% also removes ontologyAxiom/2 from ALL ontologies\nretract_axiom(Axiom) :-\n        retract_axiom_hook(Axiom),\n        !.\nretract_axiom(Axiom) :-\n        retractall(Axiom),\n	retractall(ontologyAxiom(_,Axiom)),\n        !.\n\n%% retract_axiom(+Axiom:axiom,+Ontology)\n% retracts axioms from a specified ontology\nretract_axiom(Axiom,Ontology) :-\n        \\+ var(Ontology),\n	retractall(ontologyAxiom(Ontology,Axiom)),\n        (   \\+ ontologyAxiom(_,Axiom)\n        ->  retractall(Axiom)\n        ;   true),              % still exists in other ontology..\n        !.\n\n\nretract_all_axioms :-\n        findall(A,axiom(A),Axioms),\n        maplist(retract,Axioms),\n        findall(ontologyAxiom(O,A),ontologyAxiom(O,A),OAxioms),\n        maplist(retract,OAxioms),\n	!.\n\n\nowl2_model_init :-\n	assert(annotationProperty('http://www.w3.org/2000/01/rdf-schema#label')),\n	assert(annotationProperty('http://www.w3.org/2000/01/rdf-schema#comment')).\n\nconsult_axioms(File) :-\n        consult(File).\n\naxiom_type(A,T) :- functor(A,T,_).\n\n/** <module> Ontology language axioms and expressions\n\n---+ Synopsis\n\n    Example OWL2 ontology as a prolog database:\n==\nclass(organism).\nclass(animal).\nclass(carnivore).\nclass(herbivore).\nobjectProperty(eats).\nsubClassOf(animal,organism).\nequivalentClasses([carnivore,intersectionOf([animal,someValuesFrom(eats,animal)])]).\ndisjointClasses([herbivore,carnivore]).\n==\n\nExample of use:\n\n==\n:- use_module(library(thea2/owl2_io)).\n:- use_module(library(thea2/owl2_model)).\n\nshow_superclasses(OntFile,Class) :-\n        load_axioms(OntFile),\n        forall(subClassOf(Class,Super),\n               writeln(Super)).\n==\n\n---+ Details\n\nThis module is a prolog model of the OWL2 language. It consists of predicates for both OWL2 axioms and expressions.\n\nThis model is intended to closely parallel Structural Specification and Functional-Style Syntax for OWL2 (http://www.w3.org/TR/owl2-syntax).\n\n* Axioms and Declarations are modeled as prolog predicates (e.g. SubClassOf --> subClassOf/2)\n* Class and Property Expressions are modeled as prolog terms. These can be checked via semi-deterministic predicates (e.g. objectIntersectionOf/1)\n* Axiom Annotations are modeled as prolog predicates taking a reified axiom clause head as an argument (axiomAnnotation/3)\n* The names should correspond exactly, with the leading uppercase character substituted for a lowercase (to avoid quoting in prolog) - the one exception is Import, which maps to the prolog predicate ontologyImport/2 (to avoid confusion with prolog import/1)\n* Axioms with variable arguments are modeled as prolog predicates that take prolog lists as arguments (e.g. equivalentClasses/1)\n* For programmatic convenience we provide additional abstract predicates that do not necessarily correspond to the OWL syntax (e.g. property/1,fact/1)\n\n\n---++ Axioms\n\nExtensional predicates are declared for all terminal axiom symbols in the functional syntax;  i.e. subPropertyOf/2, subClassOf/2.\nThese can be directly asserted, or compiled from a prolog file.\n\nThe terms from the OWL2 structural syntax are taken as primitive,\ni.e. they are extensional / unit-clauses, and designed to be asserted\nor compiled.\n\nSome predicates such as property/1 are intensional - these generalize\nover the OWL2 axioms are defined by prolog rules, and should not be\nasserted.  In this case property/1 is defined as annotationProperty/1\nor dataProperty/1 or objectProperty/1.\n\nFor the strong typed model, we also provide intensional predicates\nsuch as subObjectPropertyOf/2 - satisfaction of this predicate is\ndetermined at runtime based on type-checking, if subPropertyOf/2 holds.\n\n\n---++ Expressions and Type checking\n\nOWL Axioms can take either entities or expressions as arguments.\n Entities are simply prolog atoms corresponding to the IRI.\n Expressions are prolog terms;\n e.g. =|intersectionOf(a,someValuesFrom(inverseOf(p),b))|=\n\n (Class expressions are also known as Descriptions)\n\n Optional run-time checking of predicates using valid_axiom/1.\n\n For example =|subClassOf(intersectionOf(c1,c2),unionOf(c3,c4))|= is\n valid if c1,c2,c3,c4 are all class expressions, but\n =|subClassOf(p1,c1)|= is not valid if p1 is a property\n\n We can also make checks for specific types: e.g objectIntersectionOf/1\n\n---++ Annotations\n\n  In OWL Syntax, axiom annotations are written using an optional annotation list argument.\n  We opt not to do this here; instead we use axiomAnnotation/3 where the first argument is the reified predicate head.\n  E.g.\n\n==\nsubClassOf(cat,mammal).\naxiomAnnotation(SubClassOf(cat,mammal),author,linnaeus).\n==\n\n\n  ---++ Ontologies\n\n  We use a similar scheme for annotations:\n\n==\nsubClassOf(cat,mammal).\nontologyAxiom(linnaenTaxonomy,SubClassOf(cat,mammal)).\nontology(linnaenTaxonomy).\n==\n\nTODO: check edge cases, eg two ontologies have the same axioms but different annotations\n\n---++ IRIs\n\nBy default there is no type checking of IRIs, so =|class(polarBear)|=\nis allowed, even though polarBear is not an IRI - this makes for\nconvenience in working with example ontologies.\n\nSee prefix_IRIs/1 in owl2_util.pl for converting between short names\nand valid IRIs.\n\n---+ Open Issues\n\n---++ Enumeration of expressions\n\nWe provide semi-deterministic predicates of the form\n  ?type(+Expression).  Should the mode be extended to allow\n  enumeration of all descriptions/expressions? This would probably\n  require forcing all expressions to be bnodes OR possibly recursively\n  analyzing the term Axiom in a call axiom(Axiom)\n\n---++ Type checking\n\n  Is Tom Schrijvers type checking system going to be integrated into SWI and Yap? Should we use that?\n\n  I am attempting to put as much typing info in the pldoc comments,\n  but unsure of the conventions for complex terms.\n\n  LATEST: see owl2_metamodel.pl\n\n---++ Ontologies\n\n  continue using ontologyAxiom/2? Alternatively use builtin prolog module mechanism..?\n\n---+ See Also\n\n* owl2_from_rdf.pl\n* swrl.pl\n\n---+ Additional Information\n\n@see     README\n@license License\n\n*/\n\n:- use_module(library(debug)).\n:- use_module(library('semweb/rdf_db')).\n:- use_module(library('semweb/rdf_edit')).\n:- use_module(library('semweb/rdfs')).\n:- use_module(library('url')).\n:- use_module(library('http/http_open')).\n:- use_module(library(charsio)).\n\n:- dynamic(owl/4).\n%% blanknode(Node,Description,Used)\n% see owl_get_bnode/2\n% Node - bNodeId\n% Description - prolog term corresponding to owl Description\n% Used - used | shared\n:- dynamic(blanknode/3).\n:- dynamic(outstream/1).\n\n:- dynamic(aNN/3). % implements the ANN(X) function.\n:- dynamic(annotation_r_node/4).  % annotation_r_node(S,P,O,Node)\n:- dynamic(axiom_r_node/4).       % axiom_r_node(S,P,O,Node)\n:- dynamic(owl_repository/2). % implements a simple OWL repository: if URL not found, Ontology is read from a repository (local) RURL\n\n\n% we make this discontiguous so that the code can follow the structure of the document as much as possible\n\n:- discontiguous owl_parse_axiom/3.\n:- discontiguous dothislater/1.\n\n% hookable\n\n\n% -----------------------------------------------------------------------\n%                                UTILITY Predicates\n% -----------------------------------------------------------------------\n\n\n%%       owl_clear_as\n%\n%       Clears the prolog terms that store the Abstract Syntax\n%       implementation of the OWL ontology.\n\nowl_clear_as :-\n        debug(owl_parser,'Clearing abstract syntax',[]),\n        forall((axiompred(PredSpec),predspec_head(PredSpec,Head)),\n               retractall(Head)).\n\npredspec_head(Pred/A,Head) :- functor(Head,Pred,A).\n\nu_assert(Term) :-\n	call(Term), !; assert(Term).\n\n\nconvert(T,V,typed_value(T,V)).\n\n\n%%	rdf_2_owl(+Base, +Ont) is det\n%\n%       Converts RDF triples to OWL/4 triples so that\n%	their use can tracked by the OWL parser.\n\n\nrdf_2_owl(_Base,Ont) :-\n%	debug(owl_parser, 'Removing existing owl triples',[]),\n%	retractall(owl(_,_,_,Ont)),\n%  pengine_self(Self),\n%  pengine_property(Self,module(M)),\n	debug(owl_parser,'Copying RDF triples to OWL triples for Ontology ~w',[Ont]),\n	myrdf(X,Y,Z),\n%	owl_fix_no(X,X1), owl_fix_no(Y,Y1), owl_fix_no(Z,Z1),\n	assert(owl(X,Y,Z,Ont)), fail.\n\nrdf_2_owl(_,Ont) :-\n	owl_count(Ont,Z),\n	debug(owl_parser,'Number of owl triples copied: ~w',[Z]).\n\n\n%%	owl_count(?U).\n%       Returns/Checks the number of unused OWL triples.\n\nowl_count(O,U) :-\n	findall(1,owl(_,_,_,O),X), length(X,U).\n\n%% expand_and_assert(S,P,O) is det\n%\n% adds a owl(S,P,O,not_used) after expanding namespaces.\n% this is required for the triple replacement rules,\n% which use shortened rdfs/owl namespaces.\n% (or we could just use the expanded forms here which\n%  may be faster..)\nexpand_and_assert(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),!,\n	retractall(owl(X,Y,Z, used1)),\n	assert(owl(X,Y,Z, not_used)).\n\n\n%%       test_use_owl(+Triples:list) is nondet\n%\n%       As use_owl/1, but does not consume the triple.  If owl(S,P,O)\n%       in Triples has a non-ground variable then this will succeed\n%       non-deterministically.  If all variables are ground, then this\n%       will succeed semi-deterministically.\ntest_use_owl([]).\ntest_use_owl([owl(S,P,O)|Rest]) :-\n	test_use_owl(S,P,O),\n	test_use_owl(Rest).\n\n\n%%       test_use_owl(?S,?P,?O)\n%	As use_owl/3, but does not consume the triple. Expands the S,P,O.\n%\n%       If any of S, P or O is non-ground then this will succeed\n%       non-deterministically.  If all variables are ground, then this\n%       will succeed semi-deterministically.\ntest_use_owl(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),!,\n	owl(X,Y,Z, not_used).\n\ntest_use_owl(X1,Y1,Z1,named) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__').\n\n\n%%       use_owl(+Triples:list)\n%	Marks a list of OWL triples as used, but only if all match. Expands the S,P,O.\n\nuse_owl(Triples) :-\n        test_use_owl(Triples),\n        use_owl_2(Triples).\n\n% consume all triples; we have already tested the list and know that all match\nuse_owl_2([]).\nuse_owl_2([owl(S,P,O)|Triples]) :-\n        use_owl(S,P,O),\n        use_owl_2(Triples).\n\n\nuse_owl(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	debug(owl_parser_detail,'using ~w ~w ~w',[X,Y,Z]),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used1)).\n\nuse_owl(X1,Y1,Z1,named) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__'),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used2)).\n\nuse_owl(X1,Y1,Z1,Term) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	debug(owl_parser_detail,'using ~w ~w ~w',[X,Y,Z]),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used(Term))).\n\n\n%%	use_owl(?S,?P,?O,+Named,Term)\n%\n%       Named = named: Same as use_owl/3, but marks only if S 	is Named URI (i.e. non blank node).\n\nuse_owl(X1,Y1,Z1,named,Term) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__'),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used(Term))).\n\n\n%%       expand_ns(+NS_URL, ?Full_URL)\n%\n%       Expands a 'namespaced' URI of the form ns:fragment to a full URI\n%       substituting the full expansion for ns from the ns/2 facts\nexpand_ns(NS_URL, Full_URL) :-\n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	uri_split(NS_URL,Short_NS,Term, ':'),\n	rdf_db:ns(Short_NS,Long_NS),!,\n	concat_atom([Long_NS,Term],Full_URL).\n\nexpand_ns(URL, URL).\n\n\n%%       collapse_ns(+FullURL, ?NSURL, +Char, +Options)\n%\n%	Collapses a full URI of the form Path#fragment to a Namespaced\n%	URI NS:fragment substituting the full expansion for ns from\n%	the ns/2 facts\n%	Char is either ':' for normal ns notation or '_' for builing\n%	prolog terms.\n%	Options supported: no_base(ShortNs): Use only term!\n\n\ncollapse_ns(FullURL, NSURL,Char,Options) :-\n	nonvar(FullURL),\n	FullURL \\= literal(_),\n	uri_split(FullURL,LongNS, Term, '#'),\n	concat(LongNS,'#',LongNS1),\n	rdf_db:ns(ShortNS,LongNS1),\n	(   member(no_base(ShortNS),Options), ! , NSURL = Term\n	;\n	concat_atom([ShortNS,Char,Term],NSURL)\n	),!.\n% CJM\ncollapse_ns(FullURL, NSURL,_Char,Options) :-\n	nonvar(FullURL),\n	\\+ FullURL = literal(_),\n	uri_split(FullURL,LongNS, Term, '#'),\n	member(no_base(LongNS),Options),\n        !,\n        NSURL = Term.\n\n\ncollapse_ns(URL, URL,_,_).\n\n\n\n%%       uri_split(+URI,-Namespace,-Term,+Split_Char) is det\n%\n%       Splits a URI into the Namespace and the Term parts\n%       separated by the Split_Char character.\n%       It supposes URI = concat(Namespace,Split_Char,Term)\n\nuri_split(URI,Namespace,Term,Split_Char) :-\n	sub_atom(URI,Start,_,After,Split_Char),\n	sub_atom(URI,0,Start,_,Namespace),\n	Start1 is Start + 1,\n	sub_atom(URI,Start1,After,_,Term).\n\n\n%%       owl_collect_linked_nodes(+Node,+Predicate, +InList,-OutList)\n\n%	Appends Node to the InList, and recursively, all other\n%	Nodes that are linked with the Predicate to the Node. The\n%	result is returned to OutList.\n\nowl_collect_linked_nodes(Node,Predicate,InList,OutList) :-\n	use_owl(Node,Predicate,A),!,\n	owl_collect_linked_nodes(Node,Predicate,InList,List1),\n	owl_collect_linked_nodes(A,Predicate,List1,OutList).\n\nowl_collect_linked_nodes(Node,Predicate,InList,OutList) :-\n	use_owl(A,Predicate,Node),!,\n	owl_collect_linked_nodes(Node,Predicate,InList,List1),\n	owl_collect_linked_nodes(A,Predicate,List1,OutList).\n\nowl_collect_linked_nodes(Node,_,List, [Node|List]) :-\n	\\+ memberchk(Node, List),!.\n\nowl_collect_linked_nodes(_,_,List, List) :- !.\n\n\n% ----------------------------------------------------------------\n%                OWL Parser implementation predicates\n% ----------------------------------------------------------------\n\n\n%%       owl_get_bnode(+Node,+Description)\n%\n%	if Node is a blank (not named) node, then it is asserted in\n%	the database as a blanknode(Node,Description,used) term.\n%	The purpose is to record when a blank node has been used, so\n%	subsequent uses of it will result in structure sharing.\n\nowl_get_bnode(Node,Description) :-\n	sub_string(Node,0,2,_,'__'),!,\n	\\+ blanknode(Node,_,_),\n	assert(blanknode(Node,Description, used)).\n\nowl_get_bnode(_,_).\n\n\n\n% -----------------------------------------------------------------------\n%                                Top Level  Predicates\n% -----------------------------------------------------------------------\n\n/*:- multifile owl2_io:load_axioms_hook/3.\n\nowl2_io:load_axioms_hook(File,owl,Opts) :-\n        owl_parse_rdf(File,Opts).\n\nowl2_io:load_axioms_hook(File,ttl,Opts) :-\n        ensure_loaded(library('semweb/rdf_turtle')),\n        owl_parse_rdf(File,Opts).\n*/\n%% owl_parse_rdf(+File)\n% as owl_parse_rdf/1 with empty Opts\nowl_parse_rdf(F):-\n	owl_parse_rdf(F,[]).\n\n%% owl_parse_rdf(+File,+Opts:list)\n% @param Opts\n%  * imports(ImportFlag:Boolean) if true, follow imports\n%  * clear(Clear) if Clear=complete, clears all axioms in owl2_model\nowl_parse_rdf(F,Opts):-\n	(   member(imports(Imports),Opts)\n	->  true\n	;   Imports=false),\n	(   member(clear(Clear),Opts)\n	->  true\n	;   Clear=false),\n	owl_parse(F,Clear,Clear,Imports),\n	debug(owl_parser,'parsed ~w',[F]).\n\n\n\n\n%% owl_parse(+URL, +RDF_Load_Mode, +OWL_Parse_Mode, +ImportFlag:boolean)\n%\n%  Top level: parse a set of RDF triples and produce an\n%  AS representation of an OWL ontology.\n%\n%	Calls the rdf_load_stream predicate to parse RDF stream in URL.\n%       If RDF_Load_Mode = complete it first retacts all rdf triples.\n%       If ImportFlag = true it handles owl:import clause at RDF level.\n%\n% This implements the mapping defined here:\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\nowl_parse(URL, RDF_Load_Mode, OWL_Parse_Mode,ImportFlag) :-\n	(   RDF_Load_Mode=complete\n	->  rdf_retractall(_,_,_), retractall(rdf_db:rdf_source(_,_,_,_))\n        ;   true),\n	(   OWL_Parse_Mode=complete\n        ->  owl_clear_as,retractall(blanknode(_,_,_)), retractall(owl(_,_,_,_))\n        ;   true),\n        !,\n        debug(owl_parser,'Loading stream ~w',[URL]),\n	owl_canonical_parse_2([URL],URL,ImportFlag,[],ProcessedIRIs),\n        debug(owl_parser,'rdf_db populated, the following IRIs were processed: ~w',[ProcessedIRIs]),\n	owl2_model_init,\n	owl_canonical_parse_3(ProcessedIRIs).\n\n%% owl_canonical_parse_2(+IRIs:list,+ParentIRI,+ImportFlag:boolean,+ProcessedURIsIn:list,?ProcessedURIsOut:list) is det\n% recursively parses all ontologies in IRIs into rdf_db, ensuring none are processed twice.\nowl_canonical_parse_2([],_,_,Processed,Processed) :- !.\n\nowl_canonical_parse_2([IRI|ToProcessRest],Parent,ImportFlag,ProcessedIn,ProcessedOut) :-\n	member(IRI,ProcessedIn),\n        !,\n	owl_canonical_parse_2(ToProcessRest,Parent,ImportFlag,ProcessedIn,ProcessedOut).\n\nowl_canonical_parse_2([IRI|ToProcessRest],Parent,ImportFlag,ProcessedIn,ProcessedOut) :-\n	% Get rdf triples, *Ontology* and Imports\n	rdf_load_stream(IRI,O,BaseURI,Imports),\n	(   nonvar(O)\n        ->  Ont = O\n        ;   Ont = Parent), % in the include case we may need to remove the import...\n        debug(owl_parser,'Commencing rdf_2_owl. Generating owl/4',[]),\n	rdf_2_owl(BaseURI,Ont),  	% move the RDF triples into the owl-Ont/4 facts\n	(   ImportFlag = true\n        ->  owl_canonical_parse_2(Imports,Ont,ImportFlag,[Ont|ProcessedIn],ProcessedIn1)\n        ;   ProcessedIn1=[Ont|ProcessedIn]),\n	owl_canonical_parse_2(ToProcessRest,Parent,ImportFlag,ProcessedIn1,ProcessedOut).\n\n\n%% owl_canonical_parse_3(+IRIs:list) is det\n% translate the current rdf_db into owl2_model axioms.\n% First owl/4 facts are populated, and then these are translated\n% according to:\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\n% (table references refer to this document).\n% we use an intermediate owl/4 database because the mapping\n% is non-monotonic, and triples are 'consumed'\nowl_canonical_parse_3([]).\n\nowl_canonical_parse_3([IRI|Rest]) :-\n	% Remove any existing not used owl fact\n	retractall(owl(_,_,_,not_used)),\n	% Copy the owl facts of the IRI document to the 'not_used'\n	forall(owl(S,P,O,IRI),assert(owl(S,P,O,not_used))),\n\n        debug(owl_parser,'Anon individuals in reification [see table 8]',[]),\n\n\n	collect_r_nodes,\n\n	% First parse the Ontology axiom\n        owl_parse_annotated_axioms(ontology/1),\n\n        debug(owl_parser,'Replacing patterns [see table 5]',[]),\n	% remove triples based on pattern match (Table 5)\n	(   forall((triple_remove(Pattern,Remove), test_use_owl(Pattern)),\n	        forall(member(owl(S,P,O),Remove),use_owl(S,P,O,removed))) -> true ; true),\n\n\n        % temporary fix to make up for bug in rdf parsing\n        % see email to JanW July-1-2009\n        forall((test_use_owl(S,P,BNode),\n                atom(BNode),\n                sub_atom(BNode,0,2,_,'__'),\n                test_use_owl(BNode,'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype',literal(_))),\n               (   use_owl(S,P,BNode,datatype_fix),\n                   use_owl(BNode,'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype',literal(_)),\n                   expand_and_assert(S,P,literal('')))),\n\n	% replace matched patterns (Table 6)\n        debug(owl_parser,'Replacing patterns [see table 6]',[]),\n	(   setof(ReplaceWith,\n                  Pattern^(   triple_replace(Pattern,ReplaceWith), % +Triples:list, ?Triples:list\n                              use_owl(Pattern),\n                              debug(owl_parser,'Replacing ~w ==> ~w [see table 6]',[Pattern,ReplaceWith])),\n                  ReplacementSetList)\n        ->  forall((member(ReplacementSet,ReplacementSetList),member(owl(S,P,O),ReplacementSet)),\n                   expand_and_assert(S,P,O))\n        ;   debug(owl_parser,'No replacements required',[])),\n\n        /*\n	forall(triple_replace(Pattern,ReplaceWith),\n               forall(use_owl(Pattern),\n                      forall(member(owl(S,P,O),ReplaceWith),\n                             (   expand_and_assert(S,P,O),\n                                 debug(owl_parser,'Replacing ~w ==> ~w [see table 6]',[Pattern,owl(S,P,O)]))))),\n        */\n\n	% continue with parsing using the rules...\n	% Table 8, get the set of RIND - anonymous individuals in reification\n	findall(X, (member(Y,['owl:Axiom','owl:Annotation',\n			      'owl:AllDisjointClasses','owl:AllDisljointProperties',\n			      'owl:AllDifferent','owl:NegativePropertyAssertion']),\n                    test_use_owl(X,'rdf:type',Y)\n                   ),\n                RIND),\n	nb_setval(rind,RIND),\n\n        % Table 9, row 5\n	% VV 10/3/2010 get the annotation properties before collecting the annotations.\n        debug(owl_parser,'asserting annotationProperty/1 for all APs',[]),\n	forall( test_use_owl(D,'rdf:type','owl:AnnotationProperty'),\n		assert_axiom(annotationProperty(D))),\n\n        % TODO - make this faster\n        debug(owl_parser,'Implements function ANN(x) 3.2.2 Table 10.',[]),\n	findall(_,ann(_,_),_), % find all annotations, assert annotation(X,AP,AV) axioms.\n\n        debug(owl_parser,'Commencing parse of annotated axioms',[]),\n        forall((axiompred(PredSpec),\\+dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_annotated_axioms(PredSpec)),\n        forall((axiompred(PredSpec),dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_annotated_axioms(PredSpec)),\n\n        debug(owl_parser_detail,'Commencing parse of unannotated axioms',[]),\n        forall((axiompred(PredSpec),\\+dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_nonannotated_axioms(PredSpec)),\n        forall((axiompred(PredSpec),dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_nonannotated_axioms(PredSpec)),!,\n	% annotation Assertion\n	parse_annotation_assertions,\n	forall(owl_parse_compatibility_DL(Axiom),assert_axiom(Axiom)),\n	owl_canonical_parse_3(Rest).\n\nrdf_db_to_owl :-\n	owl2_model_init,\n        findall(BaseURI,\n                (   rdf(Ont,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_),\n                    rdf_2_owl(BaseURI,Ont),\n                    owl_canonical_parse_3(IRIs)),\n                IRIs).\n\n%% translate_rdf_db(+IRI)\n% translates a graph in current rdf_db instance into an owl2_model.pl set of facts.\n% assumes that IRI has already been loaded using the semweb package\ntranslate_rdf_db(BaseURI) :-\n        rdf(Ont,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_),\n        !,\n        rdf_2_owl(BaseURI,Ont),\n        owl2_model_init,\n        owl_canonical_parse_3(BaseURI).\n\n\nomitthis(ontology/1).\n\n\nowl_parse_annotated_axioms(Pred/Arity) :-\n        debug(owl_parser_detail,'[ann] Parsing all of type: ~w',[Pred]),\n        functor(Head,Pred,Arity),\n%        forall(owl_parse_axiom(Mod:Head),\n%               (   debug(owl_parser_detail,' parsed: [~w] ~w',[Mod,Head]),\n%                   assert(Mod:Head))).\n	forall(owl_parse_axiom(Head,true,Annotations),\n	       (   assert_axiom(Head),\n	           debug(owl_parser_detail_anns,' parsed: ~w : anns: ~w',[Head,Annotations]),\n		   forall(member(X,Annotations),\n			  forall(aNN(X,AP,AV),\n				 assert_axiom(annotation(Head,AP,AV))\n		          )\n			 )\n	       )\n	      ),\n        debug(owl_parser_detail,'[ann] Done parsing all of type: ~w',[Pred]).\n\nowl_parse_nonannotated_axioms(Pred/Arity) :-\n        debug(owl_parser_detail,'[unann] Parsing all of type: ~w',[Pred]),\n        functor(Head,Pred,Arity),\n	forall(owl_parse_axiom(Head,false,_),\n	       assert_axiom(Head)\n	      ).\n\n\n\n%%       rdf_load_stream(+URL, -Ontology, -BaseURI, -Imports:list) is det\n%\n%	This predicate calls the rdf parser to parse the RDF/XML URL\n%	into RDF triples. URL can be a local file or a URL.\n%	The predicate returns all Imports based on the 	owl:imports predicate.\n%	Also the Ontology of the URL if an owl:Ontology exists, var\n%	otherise.\n%\n%       If owl_repository/2 is defined, then this is used to map URLs\n%       prior to loading.\n\n\nrdf_load_stream(URL,Ontology,BaseURI,Imports) :-\n        owl_repository(URL,RURL),\n        !,\n        % note: users responsibility to avoid infinite loops by avoid cycles in repository mappings!\n        rdf_load_stream(RURL,Ontology,BaseURI,Imports).\n\nrdf_load_stream(URL,Ontology,BaseURI,Imports) :-\n	BaseURI = URL,\n  	(   sub_atom(URL,0,4,_,'http')\n        ->  catch((http_open(URL,RDF_Stream,[]),\n	      rdf_load(RDF_Stream,[if(true),base_uri(BaseURI),blank_nodes(noshare),\n				   result(Action, Triples, MD5),register_namespaces(true)]),\n		   debug(owl_parser,' Loaded ~w stream: ~w Action: ~w Triples:~w MD5: ~w',[URL,RDF_Stream,Action,Triples,MD5]),\n                   close(RDF_Stream)),\n                  Message,\n                  throw(io_error(URL,'rdf_load/2 failed',Message))) % re-throw with more information\n        ;  RDF_Stream = URL, rdf_load(RDF_Stream,[blank_nodes(noshare),if(true),base_uri(BaseURI),register_namespaces(true)])\n	),\n        % collect all imports directives\n	(   rdf(Ontology,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_)\n        ->  findall(I,rdf(Ontology,'http://www.w3.org/2002/07/owl#imports',I,BaseURI:_),Imports)\n	;   Imports = []\n	).\n\n\n\n% ----------------------------------------------------------------\n% 3 Mapping from RDF Graphs to the Structural Specification\n% ----------------------------------------------------------------\n\n/*\n\n  This section specifies the results of steps CP-2.2 and CP-3.3 of the\n  canonical parsing process from Section 3.6 of the OWL 2\n  Specification [OWL 2 Specification] on an ontology document D that\n  can be parsed into an RDF graph G. ...\n\n  */\n\n%       owl_description_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of descriptions for this Node.\n\nowl_description_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_description_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_description(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_description_list(Y,R).\n\n\n%       owl_individual_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of individuals for this Node.\n\nowl_individual_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_individual_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',F,first),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_individual_list(Y,R).\n\n%       owl_property_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of properties for this Node.\n\nowl_property_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_property_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_property_expression(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_property_list(Y,R).\n\n%       owl_datarange_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of dataranges for this Node.\n\nowl_datarange_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_datarange_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_datarange(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_datarange_list(Y,R).\n\n%       owl_datatype_restriction_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of datatype restrictions for this Node.\n\nowl_datatype_restriction_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_datatype_restriction_list(X,[facetRestriction(W2,L)|R]) :-\n	% use_owl(X,'rdf:type','rdf:List'), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first_datatype_restr),\n	use_owl(Element,W,L,datatype_restr),\n	(   concat_atom([_,W2],'#',W)\n	->  true\n	;   W2=W),\n	use_owl(X,'rdf:rest',Y,rest_datatype_restr),\n	!,owl_datatype_restriction_list(Y,R).\n\n\n% 3.1 Extracting Declarations and the IRIs of the Directly Imported Ontology Documents\n% This section specifies the result of step CP-2.2 of the canonical parsing process on an RDF graph G\n\n\n% 3.1.2 Parsing of the Ontology Header and Declarations\n\n%  Table 4.\nowl_parse_axiom(ontology(O),AnnMode,List) :-\n        test_use_owl(O,'rdf:type','owl:Ontology'),\n	\\+ test_use_owl([owl(U,_W,O),owl(U,'rdf:type','owl:Ontology')]),\n	valid_axiom_annotation_mode(AnnMode,O,'rdf:type','owl:Ontology',List),\n        use_owl(O,'rdf:type','owl:Ontology',ontology),\n        nb_setval(current_ontology,O),\n	forall(use_owl(O,'owl:imports',IRI,ontology_import), assert_axiom(ontologyImport(O,IRI))),\n	forall(use_owl(O,'owl:versionInfo',IRI2,ontology_version_info), assert_axiom(ontologyVersionInfo(O,IRI2))),!. % Do Once\n\n\n% See table 5.\n% triple_remove(Pattern:list,Remove:list)\n% if Pattern is present, remove triples in Remove\ntriple_remove([owl(X,'rdf:type','owl:Ontology')],[owl(X,'rdf:type','owl:Ontology')]).\ntriple_remove([owl(X,'rdf:type','owl:Class'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','rdfs:Datatype'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:DataRange'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:Restriction'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:Restriction'),owl(X,'rdf:type','owl:Class')],[owl(X,'rdf:type','owl:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:FunctionalProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:InverseFunctionalProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:TransitiveProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:DatatypeProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:AnnotationProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:OntologyProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','rdf:List'),owl(X,'rdf:first',_Y),owl(X,'rdf:rest',_Z)],[owl(X,'rdf:type','rdf:List')]).\n/*\n   triple_remove([owl(X,'rdf:type','owl:Thing')],[owl(X,'rdf:type','owl:Thing')]).\n*/\n% See table 6.\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\ntriple_replace([owl(X,'rdf:type','owl:OntologyProperty')],[owl(X,'rdf:type','owl:AnnotationProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:InverseFunctionalProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:InverseFunctionalProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:TransitiveProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:TransitiveProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:SymmetricProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:SymmetricProperty')]).\n\n% NOTE: this is not specified in table 6. However, we treat rdfs:Classes as equivalent to owl:Classes\ntriple_replace([owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','owl:Class')]).\n\n% DECLARATIONS\n%\n% See table 7.\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\n\n%% owl_parse_axiom(+AxiomSpec,+AnnMode:boolean,?AnnList:list) is det\n%\n% None\n%\nowl_parse_axiom(class(C),AnnMode,List) :-\n	test_use_owl(C,'rdf:type','owl:Class'),\n	valid_axiom_annotation_mode(AnnMode,C,'rdf:type','owl:Class',List),\n        (   use_owl(C,'rdf:type','owl:Class',named,class(C)) -> true ; use_owl(C,'rdf:type','rdfs:Class',named,class(C))),\n	\\+ class(C).\n\n\nowl_parse_axiom(datatype(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','rdf:Datatype'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:Datatype',List),\n        use_owl(D,'rdf:type','rdf:Datatype',datatype(D)).\n\n\nowl_parse_axiom(objectProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:ObjectProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','owl:ObjectProperty',List),\n        use_owl(D,'rdf:type','owl:ObjectProperty',objectProperty(D)),\n	\\+ objectProperty(D).\n\n\n% note the difference in names between syntax and rdf\nowl_parse_axiom(dataProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:DatatypeProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:DatatypeProperty',List),\n        use_owl(D,'rdf:type','owl:DatatypeProperty',dataProperty(D)),\n	\\+ dataProperty(D).\n\nowl_parse_axiom(annotationProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:AnnotationProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:AnnotationProperty',List),\n        use_owl(D,'rdf:type','owl:AnnotationProperty',annotationProperty(D)),\n	\\+ annotationProperty(D).\n\n\n% TODO: check this. do we need to assert individual axioms if all we have is an rdf:type?\nowl_parse_axiom(namedIndividual(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:NamedIndividual'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:NamedIndividual',List),\n        use_owl(D,'rdf:type','owl:NamedIndividual',namedIndividual(D)).\n\n\n% Table 8. Identifying Anonymous Individuals in Reification\n% TODO\n\n\n% 3.2 Populating an Ontology\n\n\n% 3.2.1 Analyzing Declarations\n\n% 3.2.2 Parsing of Annotations\n\n%\n%       ann(?X, -Extension List)\n%\n%       Implements function ANN(x) 3.2.2 Table 10\n%\n%     The annotations in G are parsed next. The function ANN assigns a\n%     set of annotations ANN(x) to each IRI or blank node x. This\n%     function is initialized by setting ANN(x) = รข.. for each each IRI\n%     or blank node x. Next, the triple patterns from Table 10 are\n%     matched in G and, for each matched pattern, ANN(x) is extended\n%     with an annotation from the right column. Each time one of these\n%     triple patterns is matched, the matched triples are removed from\n%     G. This process is repeated until no further matches are\n%     possible\n\nann(X,Y) :-\n	ann(X,X,Y).\n\n\n\nann(X,X1, annotation(X1,Y,Z)) :-\n	annotationProperty(Y),\n        debug(owl_parser_detail,'annotation property: ~w',[Y]),\n        owl(X,Y,Z,not_used),\n        use_owl(X,Y,Z,annotationProperty(Y)),\n	u_assert(aNN(X1,Y,Z)),\n	ann2(X,Y,Z,X1).\n\n\nann2(X,Y,Z,X1) :-\n	annotation_r_node(X,Y,Z,W),\n	ann(W,annotation(X1,Y,Z),Term),\n        u_assert(Term).\n\nann2(X,Y,Z,X1) :-\n	axiom_r_node(X,Y,Z,W),\n	ann(W,annotation(X1,Y,Z),Term),\n        u_assert(Term).\n\n\nann2(_,_,_,_).\n\n\n% 3.2.4 Parsing of Expressions\n\nis_bnode(C) :-\n	atom(C),\n	sub_atom(C,0,2,_,'__').\n\n\n	% Table 11. Parsing Object Property Expressions\nowl_property_expression(C,C) :-\n	\\+ is_bnode(C), % better: IRI(C).\n	% VV added 10/3/2011\n	C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#first',\n	C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',\n        !.\n\nowl_property_expression(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	    true).\n\nowl_property_expression(P,inverseOf(Q)) :-\n        use_owl(P,'owl:inverseOf',Q,inverseof(P,Q)),\n        owl_get_bnode(P,inverseOf(Q)).\n\n\n% Table 12. Parsing of Data Ranges\n\nowl_datarange(D,D) :-\n	\\+ is_bnode(D),!.  % better: IRI(C).\n\nowl_datarange(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	true).\n\nowl_datarange(D,intersectionOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:intersectionOf',Y,datarange(D)),\n	%print(D-inter-Y),nl,\n        owl_datarange_list(Y,L),\n	owl_get_bnode(D,intersectionOf(L)).\n\nowl_datarange(D,unionOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:unionOf',Y,datarange(D)),\n        owl_datarange_list(Y,L),\n	owl_get_bnode(D,unionOf(L)).\n\n\nowl_datarange(D,complementOf(DY)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',dataRange(D)),\n	use_owl(D,'owl:datatypeComplementOf',Y,datacomplement(D)),\n        owl_datarange(Y,DY),\n	owl_get_bnode(D,complementOf(DY)).\n\n% Table 14, case 2\n owl_datarange(D,complementOf('rdfs:Literal')) :-\n	use_owl(D,'rdf:type','rdfs:DataRange',dataRange(D)),\n	use_owl(D,'owl:oneOf',[],oneOf(D)),\n	owl_get_bnode(D,complementOf('rdfs:Literal')).\n\nowl_datarange(D,oneOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',dataType(D)),\n	use_owl(D,'owl:oneOf',L1,oneOf(D)),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)).\n\n% Table 14, case 1\nowl_datarange(D,oneOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:DataRange',datarange(D)),\n	use_owl(D,'owl:oneOf',L1,datarange(D)),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)).\n\n\nowl_datarange(D,datatypeRestriction(DY,L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:onDatatype',Y,datarange(D)),\n	owl_datarange(Y,DY),\n	use_owl(D,'owl:withRestrictions',L1,datarange(D)),\n	owl_datatype_restriction_list(L1,L),\n	owl_get_bnode(D,datatypeRestriction(DY,L)).\n\n% Table 13. Parsing of Class Expressions\n\n% ----------------------------------------------------------------------\n%       owl_description(+Node,-Description).\n%\n%	It implements OWL AS production rules for Descriptions.\n%         During the construction of the Description any blank node\n%         is recorded for later structure sharing checks.\n\nowl_description(C,C) :-\n	\\+ is_bnode(C),!. % better: IRI(C).\n\n\nowl_description(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	    true),!.\n\n% TODO: this leaves behind classAssertions of type owlClass for the bnodes\nowl_description(D,intersectionOf(L)) :-\n	use_owl(D,'owl:intersectionOf',L1,intersectionOf(D)),\n	owl_description_list(L1,L),\n	\\+L = [],\n	owl_get_bnode(D,intersectionOf(L)),!.\n\nowl_description(D,unionOf(L)) :-\n	use_owl(D,'owl:unionOf',L1,union(D)),\n	owl_description_list(L1,L),\n	owl_get_bnode(D,unionOf(L)),!.\n\n\nowl_description(D,complementOf(Descr)) :-\n	use_owl(D,'owl:complementOf',D1,complementOf(D)),\n	owl_description(D1,Descr),\n	owl_get_bnode(D,complementOf(Descr)),!.\n\nowl_description(D,oneOf(L)) :-\n	use_owl(D,'owl:oneOf',L1,oneOf(D)),\n	(   use_owl(D,'rdf:type','owl:Class',oneOf(D,L)) ; true),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)),!.\n\nowl_description(D,datatypeRestriction(DY,L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datatypeRestr(D)),\n	use_owl(D,'owl:onDatatype',Y,dataType(D)),\n	owl_datarange(Y,DY),\n	use_owl(D,'owl:withRestrictions',L1,withRestrictions(D)),\n	owl_datatype_restriction_list(L1,L),\n	owl_get_bnode(D,datatypeRestriction(DY,L)).\n\nowl_description(D,Restriction) :-\n	owl_restriction(D, Restriction),\n	owl_get_bnode(D,Restriction),!.\n\n\n% Table 15 - OWL DL compatibility class expressions\n%\nowl_description(D,Result) :-\n	\\+ is_bnode(D), % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',description(D)),\n	use_owl(D,'owl:unionOf',L,unionOf(L)),\n	owl_description_list(L,DL),\n	(   DL = [], Result = 'owl:Nothing' ;\n	    DL = [D1], Result = D1),\n	owl_get_bnode(D,Result),!.\n\nowl_description(D,Result) :-\n	\\+ is_bnode(D), % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',dl_compatibility_descr(D)),\n	use_owl(D,'owl:intersectionOf',L,intersectionOf(D)),\n	owl_description_list(L,DL),\n	(   DL = [], Result = 'owl:Thing' ;\n	    DL = [D1], Result = D1),\n	owl_get_bnode(D,Result),!.\n\nowl_description(D,Result) :-\n	\\+ is_bnode(D),!, % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',dl_compatibility_descr(D)),\n	use_owl(D,'owl:oneOf',[],oneOf(D)),\n	Result = 'owl:Nothing',\n	owl_get_bnode(D,Result).\n\n% support older deprecated versions of OWL2 spec. See for example hydrology.owl\nonClass(E,D) :- use_owl(E,'http://www.w3.org/2006/12/owl2#onClass',D,onClass(E)).\nonClass(E,D) :- use_owl(E,'owl:onClass',D,onClass(E)).\n\nonDataRange(E,D) :- use_owl(E, 'owl:onDataRange',D,onDatarange(E)).\n\n\n%       owl_restriction(+Element,-Restriction).\n%\n%       If Element is defined as a owl:Restriction on property P then\n%       Restriction binds to a restriction(Property,Type) term,\n%	according to OWL Abstract syntax specification.\n\nowl_restriction(Element,Restriction) :-\n	use_owl(Element,'rdf:type','owl:Restriction',restriction(Element)),\n	(   use_owl(Element, 'owl:onProperty',PropertyID,onProperty(Element,PropertyID)) ;\n    	    use_owl(Element, 'owl:onProperties',PropertyID,onProperties(Element,PropertyID))\n	),\n	owl_restriction_type(Element,PropertyID, Restriction),\n        debug(owl_parser_detail,'Restriction: ~w',[Restriction]).\n\n\n\nowl_restriction_type(E, P, someValuesFrom(PX, DX)) :-\n	use_owl(E, 'owl:someValuesFrom',D,someValuesFrom(E,P)),\n	(   owl_description(D, DX) ; owl_datarange(D,DX)),\n        (   P = [_|_], owl_property_list(P,PX) ;  owl_property_expression(P, PX)).\n\n\nowl_restriction_type(E, P, allValuesFrom(PX,DX)) :-\n	use_owl(E, 'owl:allValuesFrom',D,allValuesFrom(E,P)),\n	(   owl_description(D, DX) ; owl_datarange(D,DX)),\n        (   P = [_|_], owl_property_list(P,PX) ;  owl_property_expression(P, PX)).\n\n\n% changed from thea value-->hasValue\nowl_restriction_type(E, P, hasValue(PX,Value)) :-\n	use_owl(E, 'owl:hasValue',Value,hasValue(E)),\n        owl_property_expression(P, PX).\n\n% VV:check if RDF parser returns a triple with O=true for\nowl_restriction_type(E, P, hasSelf(PX)) :-\n	use_owl(E, 'owl:hasSelf', true,hasSelf(E)),\n        owl_property_expression(P, PX).\n\n% Support of deprecated translations:\n% in the OWL2 RDF mapping, unqualified CRs use owl:{min,max}Cardinality\n% and QCQs use owl:{min,ax}QualifiedCardinality\n%\n% however, there appear to be some ontologies; e.g. Hydrology.owl.\n% that use an older mapping, where the same properties are used\n% for QCR and unqCR\n%\n% it is relatively easy to support this legacy ontologies; however\n% we must process these BEFORE unqualified cardinality restrictions.\n\nowl_restriction_type(E, P, exactCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:cardinality',Lit),\n        onClass(E,D),\n	owl_description(D, DX),!,\n	use_owl(E, 'owl:cardinality',Lit,cardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, minCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:minCardinality',Lit),\n        (   onClass(E,D),owl_description(D, DX)\n        ;   onDataRange(E,D), owl_datarange(D,DX)),\n	!,\n        % we are sure this is an old-style unqualified CR - now consume triples\n	use_owl(E, 'owl:minCardinality',Lit,minCardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, maxCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:maxCardinality',Lit),\n        (   onClass(E,D),owl_description(D, DX)\n        ;   onDataRange(E,D), owl_datarange(D,DX)),\n	!,\n        % we are sure this is an old-style unqualified CR - now consume triples\n	use_owl(E, 'owl:maxCardinality',Lit,maxCard(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\n% END OF Support of deprecated translations:\n\n% the following are all in the spec:\n\n% changed from Thea1->2: cardinality->exactCardinality\nowl_restriction_type(E, P,exactCardinality(N,PX)) :-\n	use_owl(E, 'owl:cardinality',Lit,cardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P,exactCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:qualifiedCardinality',Lit),literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX) ;\n	    onDataRange(E,D), owl_datarange(D,DX)\n	),\n        owl_property_expression(P, PX).\n\n\nowl_restriction_type(E, P, minCardinality(N,PX)) :-\n	use_owl(E, 'owl:minCardinality',Lit,cardinality(E)),literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, minCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:minQualifiedCardinality',Lit,cardinality(E)),literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX);\n	    onDataRange(E,D), owl_datarange(D,DX)\n	),\n        owl_property_expression(P, PX).\n\n\nowl_restriction_type(E, P, maxCardinality(N,PX)) :-\n	use_owl(E, 'owl:maxCardinality',Lit,maxCardinality(E)),literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, maxCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:maxQualifiedCardinality',Lit,cardinality(E,Lit)),\n	literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX);\n	    onDataRange(E,D), owl_datarange(D,DX)),\n        owl_property_expression(P, PX).\n\n\n% Table 14. Parsing of Data Ranges for Compatibility with OWL DL\n% Included into owl_datarange clauses above\n\n% Table 15. Parsing of Class Expressions for Compatibility with OWL DL\n% Included into owl_dexcription clauses above\n\n% Table 16. Parsing of Axioms without Annotations\n% Declarations handled previously\n% CLASS AXIOMS\n% valid_axiom_annotation_mode: add clauses for the disjoint etc ....\n\ncollect_r_nodes :-\n	retractall(axiom_r_node(_,_,_,_)),\n	forall(( test_use_owl(Node,'rdf:type','owl:Axiom'),\n		 test_use_owl(Node,'owl:annotatedSource',S),\n		 test_use_owl(Node,'owl:annotatedProperty',P),\n		 test_use_owl(Node,'owl:annotatedTarget',O)),\n	       (assert(axiom_r_node(S,P,O,Node)),\n                debug(owl_parser_detail,'~w',[axiom_r_node(S,P,O,Node)]),\n		use_owl([owl(Node,'rdf:type','owl:Axiom'),\n			 owl(Node,'owl:annotatedSource',S),\n			 owl(Node,'owl:annotatedProperty',P),\n			 owl(Node,'owl:annotatedTarget',O)]))),\n\n	retractall(annotation_r_node(_,_,_,_)),\n	forall(( test_use_owl(W,'rdf:type','owl:Annotation'),\n		 test_use_owl(W,'owl:annotatedSource',S),\n		 test_use_owl(W,'owl:annotatedProperty',P),\n		 test_use_owl(W,'owl:annotatedTarget',O)),\n	       (assert(annotation_r_node(S,P,O,Node)),\n                debug(owl_parser_detail,'~w',[annotation_r_node(S,P,O,Node)]),\n		use_owl([owl(W,'rdf:type','owl:Annotation'),\n			 owl(W,'owl:annotatedSource',S),\n			 owl(W,'owl:annotatedProperty',P),\n			 owl(W,'owl:annotatedTarget',O)]))).\n\n%% valid_axiom_annotation_mode(+AnnMode,+S,+P,+O,?AnnotationNodes:list) is det\n% if AnnMode is true and annotation triples can be found then\n% unify AnnotationNodes with the Nodes that annotate the triple,\n% otherwise []\n\nvalid_axiom_annotation_mode(_Mode,S,P,O,List) :-\n        expand_ns(P,PE),\n        findall(Node,axiom_r_node(S,PE,O,Node),List).\n\n\nowl_parse_axiom(subClassOf(DX,DY),AnnMode,List) :-\n	test_use_owl(X,'rdfs:subClassOf',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'rdfs:subClassOf',Y,List),\n	use_owl(X,'rdfs:subClassOf',Y,subclassOf(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% Process each equivalentClass pair separately in order to capture\n% annotations. Block the maximally connected subgraph.\n% TODO. Process the equivalent(L) axioms to generate maximally connected\n% equivalentClasses(L) axioms. (but without annotations?)\n\nowl_parse_axiom(equivalentClasses(DL),AnnMode,List) :-\n	test_use_owl(X,'owl:equivalentClass',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:equivalentClass',Y,List),\n	use_owl(X,'owl:equivalentClass',Y,equivalentClass(X,Y)),\n        % maximally_connected_subgraph_over('owl:equivalentClass',L),\n        maplist(owl_description,[X,Y],DL),\n        debug(owl_parser_detail,'equivalentClasses Descs: ~w',[DL]).\n\n\nowl_parse_axiom(equivalentClasses([C,intersectionOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:intersectionOf',D1),\n	debug(owl_parser,'equivalent collection; intersection for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:intersectionOf',D1,List),\n	owl_description(C,intersectionOf(D)).\n\nowl_parse_axiom(equivalentClasses([C,unionOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:unionOf',D1),\n	debug(owl_parser,'equivalent collection; union for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:unionOf',D1,List),\n	owl_description(C,unionOf(D)).\n\nowl_parse_axiom(equivalentClasses([C,oneOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:oneOf',D1),\n	debug(owl_parser,'equivalent collection; one of for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:oneOf',D1,List),\n	owl_description(C,oneOf(D)).\n\n\nowl_parse_axiom(equivalentClasses([C,D])) :-\n        % TODO: this could be made more efficient by enforcing order of building\n        (   test_use_owl(C,'rdf:type','owl:Class',named)\n        ;   test_use_owl(C,'rdf:type','rdfs:Class',named)\n        ;   class(C)),\n        owl_description(C,D),\n        C\\=D.\n\n% TODO. Process the disjointClasses(L) axioms to generate\n% larger set of disjoint: ie if N classes are pairwise DisJoint\n% then we can assert a disjointClasses for all N\n\nowl_parse_axiom(disjointClasses([DX,DY]),AnnMode,List) :-\n	test_use_owl(X,'owl:disjointWith',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:disjointWith',Y,List),\n	use_owl(X,'owl:disjointWith',Y,disjointWith(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% One of the cases where annotations are those of _x and we do not seek\n% for further annotation axioms. Par. 3.2.5.\n% Whatever the AnnNode, _x is returned (will be ignored if mode false\n\nowl_parse_axiom(disjointClasses(L),_AnnMode,[X]) :-\n        % TODO: X may be referred to in an annotation axiom??\n	use_owl(X,'rdf:type','owl:AllDisjointClasses',allDisjointClasses(X)),\n        use_owl(X,'owl:members',L1,members(L1)),\n        owl_description_list(L1,L).\n\n\nowl_parse_axiom(disjointUnion(DX,DY),AnnMode,List) :-\n	test_use_owl(X,'owl:disjointUnionOf',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:disjointUnionOf',Y,List),\n	use_owl(X,'owl:disjointUnionOf',Y,disjointUnionOf(X,Y)),\n        owl_description(X,DX),\n        owl_description_list(Y,DY).\n\n\n% PROPERTY AXIOMS\n\n\n% introduces bnode\nowl_parse_axiom(subPropertyOf(propertyChain(PL),QX),AnnMode,List) :-\n	test_use_owl(Q,'owl:propertyChainAxiom',L1),\n	valid_axiom_annotation_mode(AnnMode,Q,'owl:propertyChainAxiom',L1,List),\n	use_owl(Q,'owl:propertyChainAxiom',L1,propertyChainAxiom(Q)),\n	owl_property_list(L1,PL),\n        owl_property_expression(Q,QX).\n\nowl_parse_axiom(subPropertyOf(PX,QX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:subPropertyOf',Q),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:subPropertyOf',Q,List),\n	use_owl(P,'rdfs:subPropertyOf',Q,subPropertyOf(P,Q)),\n        owl_property_expression(P,PX),\n        owl_property_expression(Q,QX).\n\n\n% Process each equivalentProperty pair separately in order to capture\n% annotations. Block the maximally connected subgraph.\n% TODO. Process the equivalent(L) axioms to generate maximally connected\n% equivalentProperties(L) axioms. (but without annotations?)\n\nowl_parse_axiom(equivalentProperties(OPEL),AnnMode,List) :-\n	test_use_owl(X,'owl:equivalentProperty',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:equivalentProperty',Y,List),\n	use_owl(X,'owl:equivalentProperty',Y,equivProperty(X,Y)),\n	% maximally_connected_subgraph_over('owl:equivalentProperty',L),\n	maplist(owl_property_expression,[X,Y],OPEL).\n\n\n% TODO. Process the disjointProperties(L) axioms to generate\n% larger set of disjoint: ie if N properties are pairwise DisJoint\n% then we can assert a disjointClasses for all N\n\nowl_parse_axiom(disjointProperties([DX,DY]),AnnMode,List) :-\n	test_use_owl(X,'owl:propertyDisjointWith',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:propertyDisjointWith',Y,List),\n	use_owl(X,'owl:propertyDisjointWith',Y,propertyDisjointWith(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% One more of the cases where annotations are those of _x and we do not\n% seek for further annotation axioms. Par. 3.2.5. Whatever the AnnNode,\n% _x is returned (will be ignored if mode false)\n\nowl_parse_axiom(disjointProperties(L),_AnnMode,[X]) :-\n        % TODO: X may be referred to in an annotation axiom??\n	use_owl(X,'rdf:type','owl:AllDisjointProperties',allDisjointProps(X,L1)),\n        use_owl(X,'owl:members',L1,members(L1)),\n        L1 = [_,_|_],           % length >= 2\n        owl_property_list(L1,L).\n\n\nowl_parse_axiom(propertyDomain(PX,CX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:domain',C),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:domain',C,List),\n        use_owl(P,'rdfs:domain',C,domain(P,C)),\n	(   annotationProperty(P),CX = C ;\n	    owl_property_expression(P,PX),\n	    owl_description(C,CX)\n	).\n\n% We need to distinguish here between object and data property\n% Currently we first test if the range is a class, this means OPE\n% otherwise if it is a datarange it means a DPE.\n% Ideally we should also check possible declarations of OPE or DPE.\n\nowl_parse_axiom(propertyRange(PX,CX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:range',C),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:range',C,List),\n        use_owl(P,'rdfs:range',C,range(P,C)),\n	(   annotationProperty(P) -> PX = P, CX = C ;\n	    owl_property_expression(P,PX),\n            (   owl_description(C,CX) -> true ; owl_datarange(C,CX))\n	).\n\nowl_parse_axiom(inverseProperties(PX,QX),AnnMode,List) :-\n	test_use_owl(P,'owl:inverseOf',Q),\n	valid_axiom_annotation_mode(AnnMode,P,'owl:inverseOf',Q,List),\n	use_owl(P,'owl:inverseOf',Q,inverseOf(P,Q)),\n        owl_property_expression(P,PX),\n        owl_property_expression(Q,QX).\n\nowl_parse_axiom(functionalProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:FunctionalProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:FunctionalProperty',List),\n        use_owl(P,'rdf:type','owl:FunctionalProperty',functionalProperty(P)).\n\nowl_parse_axiom(inverseFunctionalProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:InverseFunctionalProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:InverseFunctionalProperty',List),\n        use_owl(P,'rdf:type','owl:InverseFunctionalProperty',inverseFunctionalProperty(P)).\n\nowl_parse_axiom(reflexiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:ReflexiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:ReflexiveProperty',List),\n        use_owl(P,'rdf:type','owl:ReflexiveProperty',reflexiveProperty(P)).\n\nowl_parse_axiom(irreflexiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:IrreflexiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:IrreflexiveProperty',List),\n        use_owl(P,'rdf:type','owl:IrreflexiveProperty',irreflexiveProperty(P)).\n\nowl_parse_axiom(symmetricProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:SymmetricProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:SymmetricProperty',List),\n        use_owl(P,'rdf:type','owl:SymmetricProperty',symmetricProperty(P)).\n\nowl_parse_axiom(asymmetricProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:AsymmetricProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:AsymmetricProperty',List),\n        use_owl(P,'rdf:type','owl:AsymmetricProperty',assymetricProperty(P)).\n\nowl_parse_axiom(transitiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:TransitiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:TransitiveProperty',List),\n	use_owl(P,'rdf:type','owl:TransitiveProperty',transitiveProperty(P)).\n\nowl_parse_axiom(hasKey(CX,L),AnnMode,List) :-\n	test_use_owl(C,'owl:hasKey',L1),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:hasKey',L1,List),\n	use_owl(C,'owl:hasKey',L1,hasKey(C)),\n	owl_description(C,CX),\n        L1 = [_,_|_],           % length >= 2\n        owl_property_list(L1,L).\n\n% INDIVIDUALS\n\nowl_parse_axiom(sameIndividual([X,Y]),AnnMode,List) :-\n	test_use_owl(X,'owl:sameAs',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:sameAs',Y,List),\n	use_owl(X,'owl:sameAs',Y,sameAs(X,Y)).\n\nowl_parse_axiom(differentIndividuals([X,Y]),AnnMode,List) :-\n	test_use_owl(X,'owl:differentFrom',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:differentFrom',Y,List),\n	use_owl(X,'owl:differentFrom',Y,differentFrom(X,Y)).\n\nowl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-\n	use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(L)),\n	use_owl(X,'owl:distinctMembers',L1,distinctMembers(L)),\n        owl_individual_list(L1,L).\n\nowl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-\n	use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(X)),\n	use_owl(X,'owl:members',L1,members(L)),\n        owl_individual_list(L1,L).\n\n% make sure this is done before fetching classAssertion/2;\n% -- the annotationAssertion matching clause should preceded the classAssertion/2 matching clause\nowl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-\n	test_use_owl(X, 'rdf:type', 'owl:DeprecatedClass'),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedClass',List),\n	use_owl(X, 'rdf:type', 'owl:DeprecatedClass',deprecatedClass(X)).\n\n% make sure this is done before fetching propertyAssertion/3\n% this clause should precede it\nowl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-\n	test_use_owl(X, 'rdf:type', 'owl:DeprecatedProperty'),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedProperty',List),\n	use_owl(X, 'rdf:type', 'owl:DeprecatedProperty',deprecatedProperty(X)).\n\n% Table 17. Parsing of Annotated Axioms\n\ndothislater(annotationAssertion/3).\n% TODO - only on unnannotated pass?\n%\n\nowl_parse_axiom(annotationAssertion(P,A,B),AnnMode,List) :-\n        annotationProperty(P),\n        test_use_owl(A,P,B),         % B can be literal or individual\n        valid_axiom_annotation_mode(AnnMode,A,P,B,List),\n        use_owl(A,P,B,annotationProperty(P)).\n\n\ndothislater(classAssertion/2).\nowl_parse_axiom(classAssertion(CX,X),AnnMode,List) :-\n	test_use_owl(X,'rdf:type',C),\n        C\\='http://www.w3.org/2002/07/owl#DeprecatedClass',\n	% note: some ontologies may include a rdf:type with no\n	%  explicit class declaration. See testfiles/test_undeclared.owl\n	%class(C),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type',C,List),\n	use_owl(X,'rdf:type',C,classAssertion(CX,X)),\n        % I added this to avoid class assertions for bNodes. Perhaps a better\n        % way is to simply consume the owl4/ triple at the time of translating\n        % the description? --CJM\n        C\\='http://www.w3.org/2002/07/owl#Class',\n        %\n        C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#Property',\n        owl_description(C,CX).\n\ndothislater(propertyAssertion/3).\nowl_parse_axiom(propertyAssertion(PX,A,BX),AnnMode,List) :-\n        test_use_owl(A,P,B), % B can be literal or individual\n        P\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#type',\n	% note: some ontologies may include a triples with no\n	%  explicit property declaration. See testfiles/test_undeclared.owl\n	%property(P),\n	valid_axiom_annotation_mode(AnnMode,A,P,B,List),\n        \\+ annotationProperty(P), % these triples should have been removed before, during ann parsing\n	owl_property_expression(P,PX), % can also be inverse\n	% next line added by VV 9/3/2011 for Jochem Liem to support ID-lists as PA objects\n	(   owl_individual_list(B,BX) -> true ; BX = B),\n        use_owl(A,P,B,propertyAssertion(PX,A,BX)).\n\n\nowl_parse_axiom(negativePropertyAssertion(PX,A,B),_,X) :-\n        use_owl(X,'rdf:type','owl:NegativePropertyAssertion',negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:sourceIndividual',A,negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:assertionProperty',P,negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:targetValue',B,negPropertyAssertion(PX,A,B)),\n        owl_property_expression(P,PX).\n\n\n% process hooks; SWRL etc\n\n% Parsing annotationAssertions\n%\n\nparse_annotation_assertions :-\n	( nb_current(rind,RIND) -> true ; RIND = []),!,\n	forall((aNN(X,AP,AV),findall( aNN(annotation(X,AP,AV),AP1,AV1),\n				      aNN(annotation(X,AP,AV),AP1,AV1),ANN), \\+member(X,RIND), \\+name(X,[95, 95, 68, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110|_])),\n	       (   assert_axiom(annotationAssertion(AP,X,AV)),\n		  %  VV 10/3/2010 keep annotation/3\n		  % retract(annotation(X,AP,AV)),\n		   forall(member(aNN(_,AP1,AV1),ANN),\n			    assert_axiom(annotation(annotationAssertion(AP,X,AV),AP1,AV1))\n			 )\n	       )\n	      ),\n	% forall(aNN(X,Y,Z),assert(annotation(X,Y,Z))), VV remove 25/1/11\n	% annotation/3 axioms created already during owl_parse_annotated_axioms/1\n	retractall(aNN(_,_,_)).\n\n% Table 18. Parsing of Axioms for Compatibility with OWL DL\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,complementOf(CEY)])) :-\n	use_owl(X,'owl:complementOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description(Y,CEY).\n\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:unionOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Nothing' ; (DL=[CEY]->true;CEY = unionOf(DL))).\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:intersectionOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Thing' ; (DL=[CEY]->true;CEY = intersectionOf(DL))).\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:oneOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Nothing' ; CEY = oneOf(DL)).\n\n% UTIL\n\n%% maximally_connected_subgraph_over(+P,?ConnectedSets) is semidet\nmaximally_connected_subgraph_over(P,CSet):-\n        maximally_connected_subgraph_over(P,[],CSetL),\n        member(CSet,CSetL).\n\n%% maximally_connected_subgraph_over(+P,+Used,?ListOfConnectedSets) is det\nmaximally_connected_subgraph_over(P,Used,[CSet|All]):-\n        test_use_owl(X,P,Y), % seed\n        \\+ member(X,Used),\n        \\+ member(Y,Used),\n        use_owl(X,P,Y,maximally_conected), % seed\n        !,\n        extend_set_over(P,[X,Y],CSet),\n        append(CSet,Used,Used2),\n        maximally_connected_subgraph_over(P,Used2,All).\nmaximally_connected_subgraph_over(_,_,[]).\n\n\n% det\nextend_set_over(P,L,L2):-\n        member(X,L),\n        test_use_owl(X,P,Y),\n        \\+ member(Y,L),\n        use_owl(X,P,Y,extend_set_over),\n        !,extend_set_over(P,[Y|L],L2).\nextend_set_over(P,L,L2):-\n        member(X,L),\n        test_use_owl(Y,P,X),\n        \\+ member(Y,L),\n        use_owl(Y,P,X,extend_set_over),\n        !,extend_set_over(P,[Y|L],L2).\nextend_set_over(_,L,L):- !.\n\nliteral_integer(literal(type,A),N) :- atom_number(A,N).\nliteral_integer(literal(type(_,A)),N) :- atom_number(A,N).\n\n%% time_goal(+Goal,?Time)\n%  calls Goal and unifies Time with the cputime taken\ntime_goal(Goal,Time):-\n        statistics(cputime,T1), Goal,\n        statistics(cputime,T2), Time is T2-T1.\n\ntimed_forall(Cond,Action) :-\n        forall(Cond,\n               (   time_goal(Action,Time),\n                   debug(owl2_bench,'Goal: ~w Time:~w',[Action,Time]))).\n\n\n/** <module> Translates an RDF database to OWL2 axioms\n  ---+ Synopsis 1\n==\n:- use_module(bio(owl2_from_rdf)).\n%\n==\n---+ Details\n---++ Hooks\n* owl_parse_axiom_hook/3\n---+ See Also\nThe file owl2_from_rdf.plt has some examples\n*/\nload_owl(String):-\n  pengine_self(Self),\n  pengine_property(Self,module(M)),\n  open_chars_stream(String,S),\n  process_rdf(stream(S), assert_list(M), [namespaces(NSList)]),\n  rdf_register_prefix('disponte','https://sites.google.com/a/unife.it/ml/disponte#',[keep(true)]),\n  assert(M:ns4query(NSList)),\n  close(S),\n  rdf_2_owl('ont','ont'),\n  owl_canonical_parse_3(['ont']),\n  parse_probabilistic_annotation_assertions.\n\nassert_list(_M,[], _):-!.\nassert_list(M,[H|T], Source) :-\n    H=..[_|Args],\n    H1=..[myrdf|Args],\n	assert(M:H1),\n        assert_list(M,T, Source).\n\n/*\nassert_list([], _):-!.\nassert_list([H|T], Source) :-\n	assert(H),\n        assert_list(T, Source).\n*/\n\nparse_probabilistic_annotation_assertions :-\n  forall(annotation(Ax,'https://sites.google.com/a/unife.it/ml/disponte#probability',literal(type(_Type, PV))),\n       (assert_axiom(annotationAssertion('https://sites.google.com/a/unife.it/ml/disponte#probability',Ax,literal(PV))))\n  ),\n  % forall(aNN(X,Y,Z),assert(annotation(X,Y,Z))), VV remove 25/1/11\n  % annotation/3 axioms created already during owl_parse_annotated_axioms/1\n  retractall(annotation(_,'https://sites.google.com/a/unife.it/ml/disponte#probability',_)).\n\nquery_call(Q):-\n  Q =.. [P|Args],\n  pengine_self(Self),\n  pengine_property(Self,module(M)),\n  M:ns4query(NSList),!,\n  retract(M:ns4query(NSList)),\n  expand_all_ns(Args,NSList,NewArgs),!,\n  NQ =.. [P|NewArgs],\n  call(NQ).\n\nexpand_all_ns([],_,[]).\nexpand_all_ns([H|T],NSList,[H|NewArgs]):-\n  check_query_arg(H),!,\n  expand_all_ns(T,NSList,NewArgs).\n\nexpand_all_ns([H|T],NSList,[NewArg|NewArgs]):-\n  expand_ns4query(H,NSList,NewArg),\n  expand_all_ns(T,NSList,NewArgs).\n\ncheck_query_arg(Arg) :-\n  atomic(Arg),!,\n  axiom(Ax),\n  Ax =.. [_|L],\n  flatten(L,L1),\n  member(Arg,L1),!.\n\nexpand_ns4query(NS_URL, [], NS_URL).\nexpand_ns4query(NS_URL, [Short_NSL=Long_NSL|_],Full_URL):- \n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	uri_split(NS_URL,Short_NS,Term, ':'),\n	Short_NS = Short_NSL,\n	Long_NS = Long_NSL,!,\n	concat_atom([Long_NS,Term],Full_URL).\n\nexpand_ns4query(NS_URL, [[]=Long_NSL|_],Full_URL):- \n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	\\+ sub_atom(NS_URL,_,_,_,':'),\n	Long_NS = Long_NSL,!,\n	concat_atom([Long_NS,NS_URL],Full_URL).\n\nexpand_ns4query(NS_URL, [_|T],Full_URL):- \n  expand_ns4query(NS_URL, T,Full_URL),!.\nexpand_ns4query(URL,_, URL).\n\nparse:- \n  pengine_self(M),\n  set_prolog_flag(M:unknwon,fail),\n  load_owl('"+i.source+"').",destroy:!1,format:"json-html",oncreate:p,onsuccess:d,onfailure:v,onstop:m,onprompt:g,onoutput:y,onerror:b,onabort:w}),o.prolog.state="idle"}),this})},renderAnswer:function(t){var n=this.data("prologRunner"),r=++n.answers%2==0;if(n.query.tabled){if(n.answers!=1)return t.projection=n.projection,t.nth=n.answers,e(n.table).prologAnswer(t),this;if(t.projection&&t.projection.length>0){var i=h(t.projection);return l(this,i),n.table=i,n.projection=t.projection,t.nth=n.answers,e(n.table).prologAnswer(t),this}}var s=e.el.div({"class":"answer "+(r?"even":"odd")},e.el.span({"class":"answer-no"},n.answers));l(this,s),e(s).prologAnswer(t)},outputHTML:function(t){var n=e.el.span({"class":"output"});e(n).html(t),l(this,n)},error:function(t){l(this,e.el.pre({"class":"prolog-message msg-error"},t))},setPrompt:function(e){this.find(".controller input").attr("placeholder",e)},respond:function(t){var n=this.data("prologRunner");l(this,e.el.div({"class":"response"},t)),n.prolog.respond(t)},stop:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner");n.prolog.stop()})},stopOrAbort:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner"),r=t.prologRunner("getState");switch(r){case"running":case"wait-input":n.prolog.abort();break;case"wait-next":n.prolog.stop()}})},next:function(t){return this.each(function(){var n=e(this),r=n.data("prologRunner");r.prolog.next(t),n.prologRunner("setState","running")})},abort:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner");n.prolog.abort()})},close:function(){if(this.length){var t=f(this);this.each(function(){var t=e(this),n=t.data("prologRunner");t.prologRunner("alive")&&n.prolog.destroy()}),this.remove(),t.prologRunners("scrollToBottom",!0)}return this},trill_on_swish_help:function(){e(".trill_on_swish-event-receiver").trigger("trill_on_swish_help",{file:"runner.html"})},toggleIconic:function(e){return e==undefined?this.toggleClass("iconic"):e?this.addClass("iconic"):this.removeClass("iconic"),f(this).prologRunners("scrollToBottom",!0),this},populateActionMenu:function(t){var n=this.find(".runner-title .btn-group.dropdown");return t=e.extend({"Re-run":function(){console.log("Re-Run ",this)}},t),s(n,this,t),this},setState:function(t){var n=this.data("prologRunner");if(n.prolog.state!=t){var r=this.find(".show-state");r.removeClass(n.prolog.state).addClass(t),n.prolog.state=t,!c(t)&&n.savedFocus?(e(n.savedFocus).focus(),n.savedFocus=null):t=="wait-input"&&this.find("input").focus(),c(t)||n.prolog.destroy()}if(t=="wait-next"||t=="true"){var i=f(this);setTimeout(function(){i.prologRunners("scrollToBottom")},100)}else f(this).prologRunners("scrollToBottom");return this},getState:function(){var e=this.data("prologRunner");return e.prolog?e.prolog.state:"idle"},alive:function(){return c(this.prologRunner("getState"))}};e.fn.prologRunner=function(t){if(a[t])return a[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return a._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+o)}}(jQuery)}),define("term",["jquery"],function(){function e(){$(this).next().toggleClass("fold"),$(this).remove()}$(document).on("click",".pl-functor, .pl-infix",function(){var t=$(this).parent();$(t).toggleClass("fold"),$(t).before('<span class="pl-ellipsis">...</span>').prev().click(e)})}),define("jswish",["jquery","config","preferences","jquery-ui","splitter","bootstrap","pane","navbar","search","editorxml","query","runner","modal","term","laconic"],function(e,t,n){n.setDefault("semantic-highlighting",!1),function(e){function s(t,n){e(".trill_on_swish-event-receiver").trigger(t,n)}function o(){e(".swish-logo").append(e.el.b(e.el.span({style:"color:darkblue"},"TRILL "),e.el.span({style:"color:maroon"},"on "),e.el.span({style:"color:darkblue"},"SWI"),e.el.span({style:"color:maroon"},"SH"))).css("margin-left","30px").css("font-size","24px").addClass("navbar-brand")}function u(){e("#modal").length==0&&(e("body").append(e.el.div({id:"modal"})),e("#modal").trill_on_swishModal())}function a(){e(".tile").tile(),e(window).resize(function(){e(".tile").tile("resize")}),e("body").on("click","button.close-pane",function(){closePane(e(this).parent())})}var n="trill_on_swish",r={newProgramText:"<!-- Your program goes here\n\n\n\n/** <examples>\n\n\n*/\n-->",menu:{File:{New:function(){s("source",{data:r.newProgramText})},"File group":"--","Save ...":function(){s("saveProgram","as")},"Info & history ...":function(){s("fileInfo")},Share:"--","Collaborate ...":function(){e("body").trill_on_swish("collaborate")},"Print group":"--","Print ...":function(){e(".prolog-editor").xmlEditor("print")}},Edit:{"Clear messages":function(){s("clearMessages")},Options:"--","Semantic highlighting":{preference:"semantic-highlighting",type:"checkbox"}},Examples:function(t,n){e("body").trill_on_swish("populateExamples",t,n)},Help:{"About ...":function(){s("trill_on_swish_help",{file:"about.html"})},Topics:"--","Help ...":function(){s("trill_on_swish_help",{file:"help.html"})},"Runner ...":function(){s("trill_on_swish_help",{file:"runner.html"})},Background:"--","SWISH Beware! ...":function(){s("trill_on_swish_help",{file:"beware.html"})},"SWISH Caveats ...":function(){s("trill_on_swish_help",{file:"caveats.html"})},"Prolog Background ...":function(){s("trill_on_swish_help",{file:"background.html"})}}}},i={_init:function(t){return o(),u(),a(),e("#search").search(),t=t||{},this.addClass("trill_on_swish"),this.each(function(){var i=e(this),o={};e("#navbar").navbar(r.menu),o.editor=e(".prolog-editor").xmlEditor(),o.runner=e(".prolog-runners").prologRunners(),o.query=e(".prolog-query").queryEditor({source:function(){return i.trill_on_swish("prologSource")},sourceID:function(){return o.editor.prologEditor("getSourceID")},examples:i.trill_on_swish("examples"),runner:o.runner}).trigger("source"),t.show_beware&&s("trill_on_swish_help",{file:"beware.html",notagain:"beware"}),i.data(n,o)})},trigger:function(e,t){return s(e,t),this},playFile:function(n){var r=t.http.locations.trill_on_swish_web_storage+"/"+n;return e.ajax({url:r,type:"GET",data:{format:"json"},success:function(e){e.url=r,s("source",e)},error:function(){alert("Failed to load example")}}),this},openExampleFunction:function(t){return function(){e.ajax({url:t.href,type:"GET",data:{format:"raw"},success:function(e){s("source",{data:e,url:t.href})},error:function(){alert("Failed to load example")}})}},populateExamples:function(n,r){var i=this;return e.ajax(t.http.locations.trill_on_swish_examples,{dataType:"json",success:function(t){for(var n=0;n<t.length;n++)e("#navbar").navbar("extendDropdown",r,t[n].title,i.trill_on_swish("openExampleFunction",t[n]))}}),this},prologSource:function(){var t=[],n;return(n=e(".prolog-editor").xmlEditor("getSource"))&&t.push(n),(n=e(".background.prolog.source").text())&&t.push(n),t.join("\n\n")},examples:function(){var t=e(".examples.prolog").text();return t?e().xmlEditor("getExamples",t,!1):function(){return e(".prolog-editor").xmlEditor("getExamples")}},collaborate:function(){var t=this;return e(this).attr("data-end-togetherjs-html","End collaboration"),require(["https://togetherjs.com/togetherjs-min.js"],function(){TogetherJS(t)}),this}};e.fn.trill_on_swish=function(t){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return i._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}}(jQuery)}),require.config({urlArgs:"ts="+(new Date).getTime(),waitSeconds:60,paths:{jquery:"../bower_components/jquery/dist/jquery.min","jquery-ui":"../bower_components/jquery-ui/jquery-ui.min",laconic:"../bower_components/laconic/laconic",bootstrap:"../bower_components/bootstrap/dist/js/bootstrap.min",typeahead:"../bower_components/typeahead.js/dist/typeahead.bundle.min",splitter:"../bower_components/jquery.splitter/js/jquery.splitter-0.14.0",tagmanager:"../bower_components/tagmanager/tagmanager","tos_cm/lib/codemirror":"../bower_components/codemirror/lib/codemirror","tos_cm/addon/edit/matchbrackets":"../bower_components/codemirror/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment":"../bower_components/codemirror/addon/comment/continuecomment","tos_cm/addon/comment/comment":"../bower_components/codemirror/addon/comment/comment","tos_cm/addon/hint/show-hint":"../bower_components/codemirror/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint":"../bower_components/codemirror/addon/hint/anyword-hint","tos_cm/addon/display/placeholder":"../bower_components/codemirror/addon/display/placeholder","tos_cm/addon/runmode/runmode":"../bower_components/codemirror/addon/runmode/runmode","tos_cm/mode/xml/xml":"../bower_components/codemirror/mode/xml/xml","tos_cm/mode/erlang/erlang":"../bower_components/codemirror/mode/erlang/erlang","tos_cm/mode/prolog/prolog":"codemirror/mode/prolog/prolog","tos_cm/mode/prolog/prolog_keys":"codemirror/mode/prolog/prolog_keys","tos_cm/mode/prolog/prolog_query":"codemirror/mode/prolog/prolog_query","tos_cm/mode/prolog/prolog_server":"codemirror/mode/prolog/prolog_server","tos_cm/addon/hint/templates-hint":"codemirror/addon/hint/templates-hint","tos_cm/addon/hover/text-hover":"codemirror/addon/hover/text-hover","tos_cm/addon/hover/prolog-hover":"codemirror/addon/hover/prolog-hover","tos_cm/addon/hint/show-context-info":"codemirror/addon/hint/show-context-info","tos_cm/mode/prolog/prolog-template-hint":"codemirror/mode/prolog/prolog-template-hint"},shim:{bootstrap:{deps:["jquery"]},typeahead:{deps:["jquery"]},splitter:{deps:["jquery"]},laconic:{deps:["jquery"]},tagmanager:{deps:["jquery"]}}}),require(["jquery","config","jswish"],function(e,t,n){e(function(){e("body").trill_on_swish(t.trill_on_swish||{})})}),define("trill_on_swish",function(){});
\ No newline at end of file
+!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(a,b){function s(e){var t=e.length,r=n.type(e);return"function"===r||n.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}function x(e,t,r){if(n.isFunction(t))return n.grep(e,function(e,n){return!!t.call(e,n,e)!==r});if(t.nodeType)return n.grep(e,function(e){return e===t!==r});if("string"==typeof t){if(w.test(t))return n.filter(t,e,r);t=n.filter(t,e)}return n.grep(e,function(e){return g.call(t,e)>=0!==r})}function D(e,t){while((e=e[t])&&1!==e.nodeType);return e}function G(e){var t=F[e]={};return n.each(e.match(E)||[],function(e,n){t[n]=!0}),t}function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}function P(e,t,r){var i;if(void 0===r&&1===e.nodeType)if(i="data-"+t.replace(O,"-$1").toLowerCase(),r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:N.test(r)?n.parseJSON(r):r}catch(s){}M.set(e,t,r)}else r=void 0;return r}function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(e){}}function jb(e,t){return n.nodeName(e,"table")&&n.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function kb(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function lb(e){var t=gb.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function mb(e,t){for(var n=0,r=e.length;r>n;n++)L.set(e[n],"globalEval",!t||L.get(t[n],"globalEval"))}function nb(e,t){var r,i,s,o,u,a,f,l;if(1===t.nodeType){if(L.hasData(e)&&(o=L.access(e),u=L.set(t,o),l=o.events)){delete u.handle,u.events={};for(s in l)for(r=0,i=l[s].length;i>r;r++)n.event.add(t,s,l[s][r])}M.hasData(e)&&(a=M.access(e),f=n.extend({},a),M.set(t,f))}}function ob(e,t){var r=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&n.nodeName(e,t)?n.merge([e],r):r}function pb(e,t){var n=t.nodeName.toLowerCase();"input"===n&&T.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function sb(e,t){var r,i=n(t.createElement(e)).appendTo(t.body),s=a.getDefaultComputedStyle&&(r=a.getDefaultComputedStyle(i[0]))?r.display:n.css(i[0],"display");return i.detach(),s}function tb(e){var t=l,r=rb[e];return r||(r=sb(e,t),"none"!==r&&r||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=qb[0].contentDocument,t.write(),t.close(),r=sb(e,t),qb.detach()),rb[e]=r),r}function xb(e,t,r){var i,s,o,u,a=e.style;return r=r||wb(e),r&&(u=r.getPropertyValue(t)||r[t]),r&&(""!==u||n.contains(e.ownerDocument,e)||(u=n.style(e,t)),vb.test(u)&&ub.test(t)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=u,u=r.width,a.width=i,a.minWidth=s,a.maxWidth=o)),void 0!==u?u+"":u}function yb(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function Fb(e,t){if(t in e)return t;var n=t[0].toUpperCase()+t.slice(1),r=t,i=Eb.length;while(i--)if(t=Eb[i]+n,t in e)return t;return r}function Gb(e,t,n){var r=Ab.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Hb(e,t,r,i,s){for(var o=r===(i?"border":"content")?4:"width"===t?1:0,u=0;4>o;o+=2)"margin"===r&&(u+=n.css(e,r+R[o],!0,s)),i?("content"===r&&(u-=n.css(e,"padding"+R[o],!0,s)),"margin"!==r&&(u-=n.css(e,"border"+R[o]+"Width",!0,s))):(u+=n.css(e,"padding"+R[o],!0,s),"padding"!==r&&(u+=n.css(e,"border"+R[o]+"Width",!0,s)));return u}function Ib(e,t,r){var i=!0,s="width"===t?e.offsetWidth:e.offsetHeight,o=wb(e),u="border-box"===n.css(e,"boxSizing",!1,o);if(0>=s||null==s){if(s=xb(e,t,o),(0>s||null==s)&&(s=e.style[t]),vb.test(s))return s;i=u&&(k.boxSizingReliable()||s===e.style[t]),s=parseFloat(s)||0}return s+Hb(e,t,r||(u?"border":"content"),i,o)+"px"}function Jb(e,t){for(var r,i,s,o=[],u=0,a=e.length;a>u;u++)i=e[u],i.style&&(o[u]=L.get(i,"olddisplay"),r=i.style.display,t?(o[u]||"none"!==r||(i.style.display=""),""===i.style.display&&S(i)&&(o[u]=L.access(i,"olddisplay",tb(i.nodeName)))):(s=S(i),"none"===r&&s||L.set(i,"olddisplay",s?r:n.css(i,"display"))));for(u=0;a>u;u++)i=e[u],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[u]||"":"none"));return e}function Kb(e,t,n,r,i){return new Kb.prototype.init(e,t,n,r,i)}function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(e,t){var n,r=0,i={height:e};for(t=t?1:0;4>r;r+=2-t)n=R[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function Ub(e,t,n){for(var r,i=(Rb[t]||[]).concat(Rb["*"]),s=0,o=i.length;o>s;s++)if(r=i[s].call(n,t,e))return r}function Vb(e,t,r){var i,s,o,u,a,f,l,c,h=this,p={},d=e.style,v=e.nodeType&&S(e),m=L.get(e,"fxshow");r.queue||(a=n._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,f=a.empty.fire,a.empty.fire=function(){a.unqueued||f()}),a.unqueued++,h.always(function(){h.always(function(){a.unqueued--,n.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(r.overflow=[d.overflow,d.overflowX,d.overflowY],l=n.css(e,"display"),c="none"===l?L.get(e,"olddisplay")||tb(e.nodeName):l,"inline"===c&&"none"===n.css(e,"float")&&(d.display="inline-block")),r.overflow&&(d.overflow="hidden",h.always(function(){d.overflow=r.overflow[0],d.overflowX=r.overflow[1],d.overflowY=r.overflow[2]}));for(i in t)if(s=t[i],Nb.exec(s)){if(delete t[i],o=o||"toggle"===s,s===(v?"hide":"show")){if("show"!==s||!m||void 0===m[i])continue;v=!0}p[i]=m&&m[i]||n.style(e,i)}else l=void 0;if(n.isEmptyObject(p))"inline"===("none"===l?tb(e.nodeName):l)&&(d.display=l);else{m?"hidden"in m&&(v=m.hidden):m=L.access(e,"fxshow",{}),o&&(m.hidden=!v),v?n(e).show():h.done(function(){n(e).hide()}),h.done(function(){var t;L.remove(e,"fxshow");for(t in p)n.style(e,t,p[t])});for(i in p)u=Ub(v?m[i]:0,i,h),i in m||(m[i]=u.start,v&&(u.end=u.start,u.start="width"===i||"height"===i?1:0))}}function Wb(e,t){var r,i,s,o,u;for(r in e)if(i=n.camelCase(r),s=t[i],o=e[r],n.isArray(o)&&(s=o[1],o=e[r]=o[0]),r!==i&&(e[i]=o,delete e[r]),u=n.cssHooks[i],u&&"expand"in u){o=u.expand(o),delete e[i];for(r in o)r in e||(e[r]=o[r],t[r]=s)}else t[i]=s}function Xb(e,t,r){var i,s,o=0,u=Qb.length,a=n.Deferred().always(function(){delete f.elem}),f=function(){if(s)return!1;for(var t=Lb||Sb(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,i=1-r,o=0,u=l.tweens.length;u>o;o++)l.tweens[o].run(i);return a.notifyWith(e,[l,i,n]),1>i&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:n.extend({},t),opts:n.extend(!0,{specialEasing:{}},r),originalProperties:t,originalOptions:r,startTime:Lb||Sb(),duration:r.duration,tweens:[],createTween:function(t,r){var i=n.Tween(e,l.opts,t,r,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,r=t?l.tweens.length:0;if(s)return this;for(s=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(Wb(c,l.opts.specialEasing);u>o;o++)if(i=Qb[o].call(l,e,c,l.opts))return i;return n.map(c,Ub,l),n.isFunction(l.opts.start)&&l.opts.start.call(e,l),n.fx.timer(n.extend(f,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function qc(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var i,s=0,o=t.toLowerCase().match(E)||[];if(n.isFunction(r))while(i=o[s++])"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(r)):(e[i]=e[i]||[]).push(r)}}function rc(e,t,r,i){function u(l){var h;return s[l]=!0,n.each(e[l]||[],function(e,n){var a=n(t,r,i);return"string"!=typeof a||o||s[a]?o?!(h=a):void 0:(t.dataTypes.unshift(a),u(a),!1)}),h}var s={},o=e===mc;return u(t.dataTypes[0])||!s["*"]&&u("*")}function sc(e,t){var r,i,s=n.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((s[r]?e:i||(i={}))[r]=t[r]);return i&&n.extend(!0,e,i),e}function tc(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while("*"===a[0])a.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}return s?(s!==a[0]&&a.unshift(s),n[s]):void 0}function uc(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift())if("*"===s)s=a;else if("*"!==a&&a!==s){if(o=f[a+" "+s]||f["* "+s],!o)for(i in f)if(u=i.split(" "),u[1]===s&&(o=f[a+" "+u[0]]||f["* "+u[0]])){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}return{state:"success",data:t}}function Ac(e,t,r,i){var s;if(n.isArray(t))n.each(t,function(t,n){r||wc.test(e)?i(e,n):Ac(e+"["+("object"==typeof n?t:"")+"]",n,r,i)});else if(r||"object"!==n.type(t))i(e,t);else for(s in t)Ac(e+"["+s+"]",t[s],r,i)}function Jc(e){return n.isWindow(e)?e:9===e.nodeType&&e.defaultView}var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(e,t){return new n.fn.init(e,t)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(e,t){return t.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:d.call(this)},pushStack:function(e){var t=n.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return n.each(this,e,t)},map:function(e){return this.pushStack(n.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var e,t,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;for("boolean"==typeof u&&(l=u,u=arguments[a]||{},a++),"object"==typeof u||n.isFunction(u)||(u={}),a===f&&(u=this,a--);f>a;a++)if(null!=(e=arguments[a]))for(t in e)r=u[t],i=e[t],u!==i&&(l&&i&&(n.isPlainObject(i)||(s=n.isArray(i)))?(s?(s=!1,o=r&&n.isArray(r)?r:[]):o=r&&n.isPlainObject(r)?r:{},u[t]=n.extend(l,o,i)):void 0!==i&&(u[t]=i));return u},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===n.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!n.isArray(e)&&e-parseFloat(e)+1>=0},isPlainObject:function(e){return"object"!==n.type(e)||e.nodeType||n.isWindow(e)?!1:e.constructor&&!j.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?h[i.call(e)]||"object":typeof e},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(e){return e.replace(p,"ms-").replace(q,r)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,u=s(e);if(n){if(u){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(u){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(o,"")},makeArray:function(e,t){var r=t||[];return null!=e&&(s(Object(e))?n.merge(r,"string"==typeof e?[e]:e):f.call(r,e)),r},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],s=0,o=e.length,u=!n;o>s;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(t,n,r){var i,o=0,u=t.length,a=s(t),f=[];if(a)for(;u>o;o++)i=n(t[o],o,r),null!=i&&f.push(i);else for(o in t)i=n(t[o],o,r),null!=i&&f.push(i);return e.apply([],f)},guid:1,proxy:function(e,t){var r,i,s;return"string"==typeof t&&(r=e[t],t=e,e=r),n.isFunction(e)?(i=d.call(arguments,2),s=function(){return e.apply(t||this,i.concat(d.call(arguments)))},s.guid=e.guid=e.guid||n.guid++,s):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){h["[object "+t+"]"]=t.toLowerCase()});var t=function(e){function ot(e,t,r,i){var s,u,f,l,c,d,g,y,S,x;if((t?t.ownerDocument||t:E)!==p&&h(t),t=t||p,r=r||[],l=t.nodeType,"string"!=typeof e||!e||1!==l&&9!==l&&11!==l)return r;if(!i&&v){if(11!==l&&(s=Z.exec(e)))if(f=s[1]){if(9===l){if(u=t.getElementById(f),!u||!u.parentNode)return r;if(u.id===f)return r.push(u),r}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(f))&&b(t,u)&&u.id===f)return r.push(u),r}else{if(s[2])return D.apply(r,t.getElementsByTagName(e)),r;if((f=s[3])&&n.getElementsByClassName)return D.apply(r,t.getElementsByClassName(f)),r}if(n.qsa&&(!m||!m.test(e))){if(y=g=w,S=t,x=1!==l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){d=o(e),(g=t.getAttribute("id"))?y=g.replace(tt,"\\$&"):t.setAttribute("id",y),y="[id='"+y+"'] ",c=d.length;while(c--)d[c]=y+gt(d[c]);S=et.test(e)&&vt(t.parentNode)||t,x=d.join(",")}if(x)try{return D.apply(r,S.querySelectorAll(x)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return a(e.replace(z,"$1"),t,r,i)}function ut(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function at(e){return e[w]=!0,e}function ft(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),i=e.length;while(i--)r.attrHandle[n[i]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function dt(e){return at(function(t){return t=+t,at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function vt(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function mt(){}function gt(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var r=t.dir,i=n&&"parentNode"===r,s=x++;return t.first?function(t,n,s){while(t=t[r])if(1===t.nodeType||i)return e(t,n,s)}:function(t,n,o){var u,a,f=[S,s];if(o){while(t=t[r])if((1===t.nodeType||i)&&e(t,n,o))return!0}else while(t=t[r])if(1===t.nodeType||i){if(a=t[w]||(t[w]={}),(u=a[r])&&u[0]===S&&u[1]===s)return f[2]=u[2];if(a[r]=f,f[2]=e(t,n,o))return!0}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n){for(var r=0,i=t.length;i>r;r++)ot(e,t[r],n);return n}function Et(e,t,n,r,i){for(var s,o=[],u=0,a=e.length,f=null!=t;a>u;u++)(s=e[u])&&(!n||n(s,r,i))&&(o.push(s),f&&t.push(u));return o}function St(e,t,n,r,i,s){return r&&!r[w]&&(r=St(r)),i&&!i[w]&&(i=St(i,s)),at(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||wt(t||"*",u.nodeType?[u]:u,[]),m=!e||!s&&t?v:Et(v,h,e,u,a),g=n?i||(s?e:d||r)?[]:o:m;if(n&&n(m,g,u,a),r){f=Et(g,p),r(f,[],u,a),l=f.length;while(l--)(c=f[l])&&(g[p[l]]=!(m[p[l]]=c))}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=Et(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function xt(e){for(var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,!0),c=yt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];s>a;a++)if(n=r.relative[e[a].type])h=[yt(bt(h),n)];else{if(n=r.filter[e[a].type].apply(null,e[a].matches),n[w]){for(i=++a;s>i;i++)if(r.relative[e[i].type])break;return St(a>1&&bt(h),a>1&&gt(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(z,"$1"),n,i>a&&xt(e.slice(a,i)),s>i&&xt(e=e.slice(i)),s>i&&gt(e))}h.push(n)}return bt(h)}function Tt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,h,d,v=0,m="0",g=s&&[],y=[],b=f,w=s||i&&r.find.TAG("*",l),E=S+=null==b?1:Math.random()||.1,x=w.length;for(l&&(f=o!==p&&o);m!==x&&null!=(c=w[m]);m++){if(i&&c){h=0;while(d=e[h++])if(d(c,o,u)){a.push(c);break}l&&(S=E)}n&&((c=!d&&c)&&v--,s&&g.push(c))}if(v+=m,n&&m!==v){h=0;while(d=t[h++])d(g,y,o,u);if(s){if(v>0)while(m--)g[m]||y[m]||(y[m]=M.call(a));y=Et(y)}D.apply(a,y),l&&!s&&y.length>0&&v+t.length>1&&ot.uniqueSort(a)}return l&&(S=E,f=b),g};return n?at(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ut(),N=ut(),C=ut(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I=F.replace("w","w#"),q="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+j+"*\\]",R=":("+F+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|.*)\\)|)",U=new RegExp(j+"+","g"),z=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),W=new RegExp("^"+j+"*,"+j+"*"),X=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),V=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),$=new RegExp(R),J=new RegExp("^"+I+"$"),K={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/[+~]/,tt=/'|\\/g,nt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},it=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(st){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=ot.support={},s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},h=ot.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;return o!==p&&9===o.nodeType&&o.documentElement?(p=o,d=o.documentElement,i=o.defaultView,i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",it,!1):i.attachEvent&&i.attachEvent("onunload",it)),v=!s(o),n.attributes=ft(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ft(function(e){return e.appendChild(o.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Y.test(o.getElementsByClassName),n.getById=ft(function(e){return d.appendChild(e).id=w,!o.getElementsByName||!o.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&v){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if("*"===e){while(n=s[i++])1===n.nodeType&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){return v?t.getElementsByClassName(e):void 0},g=[],m=[],(n.qsa=Y.test(o.querySelectorAll))&&(ft(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a><select id='"+w+"-\f]' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),ft(function(e){var t=o.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(n.matchesSelector=Y.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ft(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",R)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=Y.test(d.compareDocumentPosition),b=t||Y.test(d.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&1===r.nodeType&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&r||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===o||e.ownerDocument===E&&b(E,e)?-1:t===o||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:4&r?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,u=[e],a=[t];if(!i||!s)return e===o?-1:t===o?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return ct(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)a.unshift(n);while(u[r]===a[r])r++;return r?ct(u[r],a[r]):u[r]===E?-1:a[r]===E?1:0},o):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']"),!(!n.matchesSelector||!v||g&&g.test(t)||m&&m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):void 0;return void 0!==s?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,s=0;if(c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k),c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=ot.getText=function(e){var t,n="",r=0,s=e.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===s||4===s)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},r=ot.selectors={cacheLength:50,createPseudo:at,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[3]||e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(U," ")+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),u="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;d=v="only"===e&&!d&&"nextSibling"}return!0}if(d=[o?m.firstChild:m.lastChild],o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===S&&f[1],h=f[0]===S&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(1===c.nodeType&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:1===c.nodeType)&&++h&&(y&&((c[w]||(c[w]={}))[e]=[S,h]),c===t))break;return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:at(function(e){var t=[],n=[],r=u(e.replace(z,"$1"));return r[w]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)(s=o[u])&&(e[u]=!(t[u]=s))}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return e=e.replace(nt,rt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:at(function(e){return J.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[0>n?n+t:n]}),even:dt(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:dt(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ht(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pt(t);return mt.prototype=r.filters=r.pseudos,r.setFilters=new mt,o=ot.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){(!n||(i=W.exec(u)))&&(i&&(u=u.slice(i[0].length)||u),a.push(s=[])),n=!1,(i=X.exec(u))&&(n=i.shift(),s.push({value:n,type:i[0].replace(z," ")}),u=u.slice(n.length));for(o in r.filter)!(i=K[o].exec(u))||f[o]&&!(i=f[o](i))||(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)},u=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=xt(t[n]),s[w]?r.push(s):i.push(s);s=C(e,Tt(i,r)),s.selector=e}return s},a=ot.select=function(e,t,i,s){var a,f,l,c,h,p="function"==typeof e&&e,d=!s&&o(e=p.selector||e);if(i=i||[],1===d.length){if(f=d[0]=d[0].slice(0),f.length>2&&"ID"===(l=f[0]).type&&n.getById&&9===t.nodeType&&v&&r.relative[f[1].type]){if(t=(r.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=K.needsContext.test(e)?0:f.length;while(a--){if(l=f[a],r.relative[c=l.type])break;if((h=r.find[c])&&(s=h(l.matches[0].replace(nt,rt),et.test(f[0].type)&&vt(t.parentNode)||t))){if(f.splice(a,1),e=s.length&&gt(f),!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,et.test(e)&&vt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=ft(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ft(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ft(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),ft(function(e){return null==e.getAttribute("disabled")})||lt(B,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ot}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;n.filter=function(e,t,r){var i=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?n.find.matchesSelector(i,e)?[i]:[]:n.find.matches(e,n.grep(t,function(e){return 1===e.nodeType}))},n.fn.extend({find:function(e){var t,r=this.length,i=[],s=this;if("string"!=typeof e)return this.pushStack(n(e).filter(function(){for(t=0;r>t;t++)if(n.contains(s[t],this))return!0}));for(t=0;r>t;t++)n.find(e,s[t],i);return i=this.pushStack(r>1?n.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},filter:function(e){return this.pushStack(x(this,e||[],!1))},not:function(e){return this.pushStack(x(this,e||[],!0))},is:function(e){return!!x(this,"string"==typeof e&&u.test(e)?n(e):e||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(e,t){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:z.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||y).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof n?t[0]:t,n.merge(this,n.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:l,!0)),v.test(r[1])&&n.isPlainObject(t))for(r in t)n.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=l.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=l,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):n.isFunction(e)?"undefined"!=typeof y.ready?y.ready(e):e(n):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),n.makeArray(e,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(e,t,r){var i=[],s=void 0!==r;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(s&&n(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),n.fn.extend({has:function(e){var t=n(e,this),r=t.length;return this.filter(function(){for(var e=0;r>e;e++)if(n.contains(this,t[e]))return!0})},closest:function(e,t){for(var r,i=0,s=this.length,o=[],a=u.test(e)||"string"!=typeof e?n(e,t||this.context):0;s>i;i++)for(r=this[i];r&&r!==t;r=r.parentNode)if(r.nodeType<11&&(a?a.index(r)>-1:1===r.nodeType&&n.find.matchesSelector(r,e))){o.push(r);break}return this.pushStack(o.length>1?n.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(n(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(n.unique(n.merge(this.get(),n(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),n.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return n.dir(e,"parentNode")},parentsUntil:function(e,t,r){return n.dir(e,"parentNode",r)},next:function(e){return D(e,"nextSibling")},prev:function(e){return D(e,"previousSibling")},nextAll:function(e){return n.dir(e,"nextSibling")},prevAll:function(e){return n.dir(e,"previousSibling")},nextUntil:function(e,t,r){return n.dir(e,"nextSibling",r)},prevUntil:function(e,t,r){return n.dir(e,"previousSibling",r)},siblings:function(e){return n.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return n.sibling(e.firstChild)},contents:function(e){return e.contentDocument||n.merge([],e.childNodes)}},function(e,t){n.fn[e]=function(r,i){var s=n.map(this,t,r);return"Until"!==e.slice(-5)&&(i=r),i&&"string"==typeof i&&(s=n.filter(i,s)),this.length>1&&(C[e]||n.unique(s),B.test(e)&&s.reverse()),this.pushStack(s)}});var E=/\S+/g,F={};n.Callbacks=function(e){e="string"==typeof e?F[e]||G(e):n.extend({},e);var t,r,i,s,o,u,a=[],f=!e.once&&[],l=function(n){for(t=e.memory&&n,r=!0,u=s||0,s=0,o=a.length,i=!0;a&&o>u;u++)if(a[u].apply(n[0],n[1])===!1&&e.stopOnFalse){t=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var r=a.length;!function u(t){n.each(t,function(t,r){var i=n.type(r);"function"===i?e.unique&&c.has(r)||a.push(r):r&&r.length&&"string"!==i&&u(r)})}(arguments),i?o=a.length:t&&(s=r,l(t))}return this},remove:function(){return a&&n.each(arguments,function(e,t){var r;while((r=n.inArray(t,a,r))>-1)a.splice(r,1),i&&(o>=r&&o--,u>=r&&u--)}),this},has:function(e){return e?n.inArray(e,a)>-1:!!a&&!!a.length},empty:function(){return a=[],o=0,this},disable:function(){return a=f=t=void 0,this},disabled:function(){return!a},lock:function(){return f=void 0,t||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return!a||r&&!f||(t=t||[],t=[e,t.slice?t.slice():t],i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},n.extend({Deferred:function(e){var t=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],r="pending",i={state:function(){return r},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n.Deferred(function(r){n.each(t,function(t,o){var u=n.isFunction(e[t])&&e[t];s[o[1]](function(){var e=u&&u.apply(this,arguments);e&&n.isFunction(e.promise)?e.promise().done(r.resolve).fail(r.reject).progress(r.notify):r[o[0]+"With"](this===i?r.promise():this,u?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?n.extend(e,i):i}},s={};return i.pipe=i.then,n.each(t,function(e,n){var o=n[2],u=n[3];i[n[1]]=o.add,u&&o.add(function(){r=u},t[1^e][2].disable,t[2][2].lock),s[n[0]]=function(){return s[n[0]+"With"](this===s?i:this,arguments),this},s[n[0]+"With"]=o.fireWith}),i.promise(s),e&&e.call(s,s),s},when:function(e){var t=0,r=d.call(arguments),i=r.length,s=1!==i||e&&n.isFunction(e.promise)?i:0,o=1===s?e:n.Deferred(),u=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--s||o.resolveWith(t,n)}},a,f,l;if(i>1)for(a=new Array(i),f=new Array(i),l=new Array(i);i>t;t++)r[t]&&n.isFunction(r[t].promise)?r[t].promise().done(u(t,l,r)).fail(o.reject).progress(u(t,f,a)):--s;return s||o.resolveWith(l,r),o.promise()}});var H;n.fn.ready=function(e){return n.ready.promise().done(e),this},n.extend({isReady:!1,readyWait:1,holdReady:function(e){e?n.readyWait++:n.ready(!0)},ready:function(e){(e===!0?--n.readyWait:n.isReady)||(n.isReady=!0,e!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}}),n.ready.promise=function(e){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(e)},n.ready.promise();var J=n.access=function(e,t,r,i,s,o,u){var a=0,f=e.length,l=null==r;if("object"===n.type(r)){s=!0;for(a in r)n.access(e,t,a,r[a],!0,o,u)}else if(void 0!==i&&(s=!0,n.isFunction(i)||(u=!0),l&&(u?(t.call(e,i),t=null):(l=t,t=function(e,t,r){return l.call(n(e),r)})),t))for(;f>a;a++)t(e[a],r,u?i:i.call(e[a],a,t(e[a],r)));return s?e:l?t.call(e):f?t(e[0],r):o};n.acceptData=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(e){if(!K.accepts(e))return 0;var t={},r=e[this.expando];if(!r){r=K.uid++;try{t[this.expando]={value:r},Object.defineProperties(e,t)}catch(i){t[this.expando]=r,n.extend(e,t)}}return this.cache[r]||(this.cache[r]={}),r},set:function(e,t,r){var i,s=this.key(e),o=this.cache[s];if("string"==typeof t)o[t]=r;else if(n.isEmptyObject(o))n.extend(this.cache[s],t);else for(i in t)o[i]=t[i];return o},get:function(e,t){var n=this.cache[this.key(e)];return void 0===t?n:n[t]},access:function(e,t,r){var i;return void 0===t||t&&"string"==typeof t&&void 0===r?(i=this.get(e,t),void 0!==i?i:this.get(e,n.camelCase(t))):(this.set(e,t,r),void 0!==r?r:t)},remove:function(e,t){var r,i,s,o=this.key(e),u=this.cache[o];if(void 0===t)this.cache[o]={};else{n.isArray(t)?i=t.concat(t.map(n.camelCase)):(s=n.camelCase(t),t in u?i=[t,s]:(i=s,i=i in u?[i]:i.match(E)||[])),r=i.length;while(r--)delete u[i[r]]}},hasData:function(e){return!n.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;n.extend({hasData:function(e){return M.hasData(e)||L.hasData(e)},data:function(e,t,n){return M.access(e,t,n)},removeData:function(e,t){M.remove(e,t)},_data:function(e,t,n){return L.access(e,t,n)},_removeData:function(e,t){L.remove(e,t)}}),n.fn.extend({data:function(e,t){var r,i,s,o=this[0],u=o&&o.attributes;if(void 0===e){if(this.length&&(s=M.get(o),1===o.nodeType&&!L.get(o,"hasDataAttrs"))){r=u.length;while(r--)u[r]&&(i=u[r].name,0===i.indexOf("data-")&&(i=n.camelCase(i.slice(5)),P(o,i,s[i])));L.set(o,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){M.set(this,e)}):J(this,function(t){var r,i=n.camelCase(e);if(o&&void 0===t){if(r=M.get(o,e),void 0!==r)return r;if(r=M.get(o,i),void 0!==r)return r;if(r=P(o,i,void 0),void 0!==r)return r}else this.each(function(){var n=M.get(this,i);M.set(this,i,t),-1!==e.indexOf("-")&&void 0!==n&&M.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){M.remove(this,e)})}}),n.extend({queue:function(e,t,r){var i;return e?(t=(t||"fx")+"queue",i=L.get(e,t),r&&(!i||n.isArray(r)?i=L.access(e,t,n.makeArray(r)):i.push(r)),i||[]):void 0},dequeue:function(e,t){t=t||"fx";var r=n.queue(e,t),i=r.length,s=r.shift(),o=n._queueHooks(e,t),u=function(){n.dequeue(e,t)};"inprogress"===s&&(s=r.shift(),i--),s&&("fx"===t&&r.unshift("inprogress"),delete o.stop,s.call(e,u,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return L.get(e,r)||L.access(e,r,{empty:n.Callbacks("once memory").add(function(){L.remove(e,[t+"queue",r])})})}}),n.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length<r?n.queue(this[0],e):void 0===t?this:this.each(function(){var r=n.queue(this,e,t);n._queueHooks(this,e),"fx"===e&&"inprogress"!==r[0]&&n.dequeue(this,e)})},dequeue:function(e){return this.each(function(){n.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var r,i=1,s=n.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(u--)r=L.get(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(t)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(e,t){return e=t||e,"none"===n.css(e,"display")||!n.contains(e.ownerDocument,e)},T=/^(?:checkbox|radio)$/i;!function(){var e=l.createDocumentFragment(),t=e.appendChild(l.createElement("div")),n=l.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),k.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;n.event={global:{},add:function(e,t,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=L.get(e);if(g){r.handler&&(o=r,r=o.handler,s=o.selector),r.guid||(r.guid=n.guid++),(f=g.events)||(f=g.events={}),(u=g.handle)||(u=g.handle=function(t){return typeof n!==U&&n.event.triggered!==t.type?n.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(E)||[""],l=t.length;while(l--)a=Y.exec(t[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),d&&(h=n.event.special[d]||{},d=(s?h.delegateType:h.bindType)||d,h=n.event.special[d]||{},c=n.extend({type:d,origType:m,data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&n.expr.match.needsContext.test(s),namespace:v.join(".")},o),(p=f[d])||(p=f[d]=[],p.delegateCount=0,h.setup&&h.setup.call(e,i,v,u)!==!1||e.addEventListener&&e.addEventListener(d,u,!1)),h.add&&(h.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),s?p.splice(p.delegateCount++,0,c):p.push(c),n.event.global[d]=!0)}},remove:function(e,t,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=L.hasData(e)&&L.get(e);if(g&&(f=g.events)){t=(t||"").match(E)||[""],l=t.length;while(l--)if(a=Y.exec(t[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),d){h=n.event.special[d]||{},d=(i?h.delegateType:h.bindType)||d,p=f[d]||[],a=a[2]&&new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=p.length;while(o--)c=p[o],!s&&m!==c.origType||r&&r.guid!==c.guid||a&&!a.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,h.remove&&h.remove.call(e,c));u&&!p.length&&(h.teardown&&h.teardown.call(e,v,g.handle)!==!1||n.removeEvent(e,d,g.handle),delete f[d])}else for(d in f)n.event.remove(e,d+t[l],r,i,!0);n.isEmptyObject(f)&&(delete g.handle,L.remove(e,"events"))}},trigger:function(e,t,r,i){var s,o,u,f,c,h,p,d=[r||l],v=j.call(e,"type")?e.type:e,m=j.call(e,"namespace")?e.namespace.split("."):[];if(o=u=r=r||l,3!==r.nodeType&&8!==r.nodeType&&!X.test(v+n.event.triggered)&&(v.indexOf(".")>=0&&(m=v.split("."),v=m.shift(),m.sort()),c=v.indexOf(":")<0&&"on"+v,e=e[n.expando]?e:new n.Event(v,"object"==typeof e&&e),e.isTrigger=i?2:3,e.namespace=m.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:n.makeArray(t,[e]),p=n.event.special[v]||{},i||!p.trigger||p.trigger.apply(r,t)!==!1)){if(!i&&!p.noBubble&&!n.isWindow(r)){for(f=p.delegateType||v,X.test(f+v)||(o=o.parentNode);o;o=o.parentNode)d.push(o),u=o;u===(r.ownerDocument||l)&&d.push(u.defaultView||u.parentWindow||a)}s=0;while((o=d[s++])&&!e.isPropagationStopped())e.type=s>1?f:p.bindType||v,h=(L.get(o,"events")||{})[e.type]&&L.get(o,"handle"),h&&h.apply(o,t),h=c&&o[c],h&&h.apply&&n.acceptData(o)&&(e.result=h.apply(o,t),e.result===!1&&e.preventDefault());return e.type=v,i||e.isDefaultPrevented()||p._default&&p._default.apply(d.pop(),t)!==!1||!n.acceptData(r)||c&&n.isFunction(r[v])&&!n.isWindow(r)&&(u=r[c],u&&(r[c]=null),n.event.triggered=v,r[v](),n.event.triggered=void 0,u&&(r[c]=u)),e.result}},dispatch:function(e){e=n.event.fix(e);var t,r,i,s,o,u=[],a=d.call(arguments),f=(L.get(this,"events")||{})[e.type]||[],l=n.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){u=n.event.handlers.call(this,e,f),t=0;while((s=u[t++])&&!e.isPropagationStopped()){e.currentTarget=s.elem,r=0;while((o=s.handlers[r++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,i=((n.event.special[o.origType]||{}).handle||o.handler).apply(s.elem,a),void 0!==i&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var r,i,s,o,u=[],a=t.delegateCount,f=e.target;if(a&&f.nodeType&&(!e.button||"click"!==e.type))for(;f!==this;f=f.parentNode||this)if(f.disabled!==!0||"click"!==e.type){for(i=[],r=0;a>r;r++)o=t[r],s=o.selector+" ",void 0===i[s]&&(i[s]=o.needsContext?n(s,this).index(f)>=0:n.find(s,this,null,[f]).length),i[s]&&i.push(o);i.length&&u.push({elem:f,handlers:i})}return a<t.length&&u.push({elem:this,handlers:t.slice(a)}),u},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||l,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||void 0===s||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[n.expando])return e;var t,r,i,s=e.type,o=e,u=this.fixHooks[s];u||(this.fixHooks[s]=u=W.test(s)?this.mouseHooks:V.test(s)?this.keyHooks:{}),i=u.props?this.props.concat(u.props):this.props,e=new n.Event(o),t=i.length;while(t--)r=i[t],e[r]=o[r];return e.target||(e.target=l),3===e.target.nodeType&&(e.target=e.target.parentNode),u.filter?u.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(e){return n.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,r,i){var s=n.extend(new n.Event,r,{type:e,isSimulated:!0,originalEvent:{}});i?n.event.trigger(s,null,t):n.event.dispatch.call(t,s),s.isDefaultPrevented()&&r.preventDefault()}},n.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},n.Event=function(e,t){return this instanceof n.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?Z:$):this.type=e,t&&n.extend(this,t),this.timeStamp=e&&e.timeStamp||n.now(),void (this[n.expando]=!0)):new n.Event(e,t)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Z,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Z,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Z,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){n.event.special[e]={delegateType:t,bindType:t,handle:function(e){var r,i=this,s=e.relatedTarget,o=e.handleObj;return(!s||s!==i&&!n.contains(i,s))&&(e.type=o.origType,r=o.handler.apply(this,arguments),e.type=t),r}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(e,t){var r=function(e){n.event.simulate(t,e.target,n.event.fix(e),!0)};n.event.special[t]={setup:function(){var n=this.ownerDocument||this,i=L.access(n,t);i||n.addEventListener(e,r,!0),L.access(n,t,(i||0)+1)},teardown:function(){var n=this.ownerDocument||this,i=L.access(n,t)-1;i?L.access(n,t,i):(n.removeEventListener(e,r,!0),L.remove(n,t))}}}),n.fn.extend({on:function(e,t,r,i,s){var o,u;if("object"==typeof e){"string"!=typeof t&&(r=r||t,t=void 0);for(u in e)this.on(u,t,r,e[u],s);return this}if(null==r&&null==i?(i=t,r=t=void 0):null==i&&("string"==typeof t?(i=r,r=void 0):(i=r,r=t,t=void 0)),i===!1)i=$;else if(!i)return this;return 1===s&&(o=i,i=function(e){return n().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=n.guid++)),this.each(function(){n.event.add(this,e,i,r,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,n(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(s in e)this.off(s,t,e[s]);return this}return(t===!1||"function"==typeof t)&&(r=t,t=void 0),r===!1&&(r=$),this.each(function(){n.event.remove(this,e,r,t)})},trigger:function(e,t){return this.each(function(){n.event.trigger(e,t,this)})},triggerHandler:function(e,t){var r=this[0];return r?n.event.trigger(e,t,r,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td,n.extend({clone:function(e,t,r){var i,s,o,u,a=e.cloneNode(!0),f=n.contains(e.ownerDocument,e);if(!(k.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||n.isXMLDoc(e)))for(u=ob(a),o=ob(e),i=0,s=o.length;s>i;i++)pb(o[i],u[i]);if(t)if(r)for(o=o||ob(e),u=u||ob(a),i=0,s=o.length;s>i;i++)nb(o[i],u[i]);else nb(e,a);return u=ob(a,"script"),u.length>0&&mb(u,!f&&ob(e,"script")),a},buildFragment:function(e,t,r,i){for(var s,o,u,a,f,l,c=t.createDocumentFragment(),h=[],p=0,d=e.length;d>p;p++)if(s=e[p],s||0===s)if("object"===n.type(s))n.merge(h,s.nodeType?[s]:s);else if(cb.test(s)){o=o||c.appendChild(t.createElement("div")),u=(bb.exec(s)||["",""])[1].toLowerCase(),a=ib[u]||ib._default,o.innerHTML=a[1]+s.replace(ab,"<$1></$2>")+a[2],l=a[0];while(l--)o=o.lastChild;n.merge(h,o.childNodes),o=c.firstChild,o.textContent=""}else h.push(t.createTextNode(s));c.textContent="",p=0;while(s=h[p++])if((!i||-1===n.inArray(s,i))&&(f=n.contains(s.ownerDocument,s),o=ob(c.appendChild(s),"script"),f&&mb(o),r)){l=0;while(s=o[l++])fb.test(s.type||"")&&r.push(s)}return c},cleanData:function(e){for(var t,r,i,s,o=n.event.special,u=0;void 0!==(r=e[u]);u++){if(n.acceptData(r)&&(s=r[L.expando],s&&(t=L.cache[s]))){if(t.events)for(i in t.events)o[i]?n.event.remove(r,i):n.removeEvent(r,i,t.handle);L.cache[s]&&delete L.cache[s]}delete M.cache[r[M.expando]]}}}),n.fn.extend({text:function(e){return J(this,function(e){return void 0===e?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=jb(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=jb(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var r,i=e?n.filter(e,this):this,s=0;null!=(r=i[s]);s++)t||1!==r.nodeType||n.cleanData(ob(r)),r.parentNode&&(t&&n.contains(r.ownerDocument,r)&&mb(ob(r,"script")),r.parentNode.removeChild(r));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(n.cleanData(ob(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return n.clone(this,e,t)})},html:function(e){return J(this,function(e){var t=this[0]||{},r=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!db.test(e)&&!ib[(bb.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(ab,"<$1></$2>");try{for(;i>r;r++)t=this[r]||{},1===t.nodeType&&(n.cleanData(ob(t,!1)),t.innerHTML=e);t=0}catch(s){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,n.cleanData(ob(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(t,r){t=e.apply([],t);var i,s,o,u,a,f,l=0,c=this.length,h=this,p=c-1,d=t[0],v=n.isFunction(d);if(v||c>1&&"string"==typeof d&&!k.checkClone&&eb.test(d))return this.each(function(e){var n=h.eq(e);v&&(t[0]=d.call(this,e,n.html())),n.domManip(t,r)});if(c&&(i=n.buildFragment(t,this[0].ownerDocument,!1,this),s=i.firstChild,1===i.childNodes.length&&(i=s),s)){for(o=n.map(ob(i,"script"),kb),u=o.length;c>l;l++)a=i,l!==p&&(a=n.clone(a,!0,!0),u&&n.merge(o,ob(a,"script"))),r.call(this[l],a,l);if(u)for(f=o[o.length-1].ownerDocument,n.map(o,lb),l=0;u>l;l++)a=o[l],fb.test(a.type||"")&&!L.access(a,"globalEval")&&n.contains(f,a)&&(a.src?n._evalUrl&&n._evalUrl(a.src):n.globalEval(a.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){n.fn[e]=function(e){for(var r,i=[],s=n(e),o=s.length-1,u=0;o>=u;u++)r=u===o?this:this.clone(!0),n(s[u])[t](r),f.apply(i,r.get());return this.pushStack(i)}});var qb,rb={},ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):a.getComputedStyle(e,null)};!function(){var e,t,r=l.documentElement,i=l.createElement("div"),s=l.createElement("div");if(s.style){s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===s.style.backgroundClip,i.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",i.appendChild(s);function o(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",s.innerHTML="",r.appendChild(i);var n=a.getComputedStyle(s,null);e="1%"!==n.top,t="4px"===n.width,r.removeChild(i)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return o(),e},boxSizingReliable:function(){return null==t&&o(),t},reliableMarginRight:function(){var e,t=s.appendChild(l.createElement("div"));return t.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",s.style.width="1px",r.appendChild(i),e=!parseFloat(a.getComputedStyle(t,null).marginRight),r.removeChild(i),s.removeChild(t),e}})}}(),n.swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];n.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=xb(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var s,o,u,a=n.camelCase(t),f=e.style;return t=n.cssProps[a]||(n.cssProps[a]=Fb(f,a)),u=n.cssHooks[t]||n.cssHooks[a],void 0===r?u&&"get"in u&&void 0!==(s=u.get(e,!1,i))?s:f[t]:(o=typeof r,"string"===o&&(s=Bb.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(n.css(e,t)),o="number"),null!=r&&r===r&&("number"!==o||n.cssNumber[a]||(r+="px"),k.clearCloneStyle||""!==r||0!==t.indexOf("background")||(f[t]="inherit"),u&&"set"in u&&void 0===(r=u.set(e,r,i))||(f[t]=r)),void 0)}},css:function(e,t,r,i){var s,o,u,a=n.camelCase(t);return t=n.cssProps[a]||(n.cssProps[a]=Fb(e.style,a)),u=n.cssHooks[t]||n.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,r)),void 0===s&&(s=xb(e,t,i)),"normal"===s&&t in Db&&(s=Db[t]),""===r||r?(o=parseFloat(s),r===!0||n.isNumeric(o)?o||0:s):s}}),n.each(["height","width"],function(e,t){n.cssHooks[t]={get:function(e,r,i){return r?zb.test(n.css(e,"display"))&&0===e.offsetWidth?n.swap(e,Cb,function(){return Ib(e,t,i)}):Ib(e,t,i):void 0},set:function(e,r,i){var s=i&&wb(e);return Gb(e,r,i?Hb(e,t,i,"border-box"===n.css(e,"boxSizing",!1,s),s):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(e,t){return t?n.swap(e,{display:"inline-block"},xb,[e,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(e,t){n.cssHooks[e+t]={expand:function(n){for(var r=0,i={},s="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+R[r]+t]=s[r]||s[r-2]||s[0];return i}},ub.test(e)||(n.cssHooks[e+t].set=Gb)}),n.fn.extend({css:function(e,t){return J(this,function(e,t,r){var i,s,o={},u=0;if(n.isArray(t)){for(i=wb(e),s=t.length;s>u;u++)o[t[u]]=n.css(e,t[u],!1,i);return o}return void 0!==r?n.style(e,t,r):n.css(e,t)},e,t,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}}),n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(e,t,r,i,s,o){this.elem=e,this.prop=r,this.easing=s||"swing",this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(n.cssNumber[r]?"":"px")},cur:function(){var e=Kb.propHooks[this.prop];return e&&e.get?e.get(this):Kb.propHooks._default.get(this)},run:function(e){var t,r=Kb.propHooks[this.prop];return this.pos=t=this.options.duration?n.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=n.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){n.fx.step[e.prop]?n.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[n.cssProps[e.prop]]||n.cssHooks[e.prop])?n.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},n.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(e,t){var r=this.createTween(e,t),i=r.cur(),s=Ob.exec(t),o=s&&s[3]||(n.cssNumber[e]?"":"px"),u=(n.cssNumber[e]||"px"!==o&&+i)&&Ob.exec(n.css(r.elem,e)),a=1,f=20;if(u&&u[3]!==o){o=o||u[3],s=s||[],u=+i||1;do a=a||".5",u/=a,n.style(r.elem,e,u+o);while(a!==(a=r.cur()/i)&&1!==a&&--f)}return s&&(u=r.start=+u||+i||0,r.unit=o,r.end=s[1]?u+(s[1]+1)*s[2]:+s[2]),r}]};n.Animation=n.extend(Xb,{tweener:function(e,t){n.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var r,i=0,s=e.length;s>i;i++)r=e[i],Rb[r]=Rb[r]||[],Rb[r].unshift(t)},prefilter:function(e,t){t?Qb.unshift(e):Qb.push(e)}}),n.speed=function(e,t,r){var i=e&&"object"==typeof e?n.extend({},e):{complete:r||!r&&t||n.isFunction(e)&&e,duration:e,easing:r&&t||t&&!n.isFunction(t)&&t};return i.duration=n.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in n.fx.speeds?n.fx.speeds[i.duration]:n.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){n.isFunction(i.old)&&i.old.call(this),i.queue&&n.dequeue(this,i.queue)},i},n.fn.extend({fadeTo:function(e,t,n,r){return this.filter(S).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,r,i){var s=n.isEmptyObject(e),o=n.speed(t,r,i),u=function(){var t=Xb(this,n.extend({},e),o);(s||L.get(this,"finish"))&&t.stop(!0)};return u.finish=u,s||o.queue===!1?this.each(u):this.queue(o.queue,u)},stop:function(e,t,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,s=null!=e&&e+"queueHooks",o=n.timers,u=L.get(this);if(s)u[s]&&u[s].stop&&i(u[s]);else for(s in u)u[s]&&u[s].stop&&Pb.test(s)&&i(u[s]);for(s=o.length;s--;)o[s].elem!==this||null!=e&&o[s].queue!==e||(o[s].anim.stop(r),t=!1,o.splice(s,1));(t||!r)&&n.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,r=L.get(this),i=r[e+"queue"],s=r[e+"queueHooks"],o=n.timers,u=i?i.length:0;for(r.finish=!0,n.queue(this,e,[]),s&&s.stop&&s.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;u>t;t++)i[t]&&i[t].finish&&i[t].finish.call(this);delete r.finish})}}),n.each(["toggle","show","hide"],function(e,t){var r=n.fn[t];n.fn[t]=function(e,n,i){return null==e||"boolean"==typeof e?r.apply(this,arguments):this.animate(Tb(t,!0),e,n,i)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){n.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),n.timers=[],n.fx.tick=function(){var e,t=0,r=n.timers;for(Lb=n.now();t<r.length;t++)e=r[t],e()||r[t]!==e||r.splice(t--,1);r.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(e){n.timers.push(e),e()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(e,t){return e=n.fx?n.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e=l.createElement("input"),t=l.createElement("select"),n=t.appendChild(l.createElement("option"));e.type="checkbox",k.checkOn=""!==e.value,k.optSelected=n.selected,t.disabled=!0,k.optDisabled=!n.disabled,e=l.createElement("input"),e.value="t",e.type="radio",k.radioValue="t"===e.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(e,t){return J(this,n.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){n.removeAttr(this,e)})}}),n.extend({attr:function(e,t,r){var i,s,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===U?n.prop(e,t,r):(1===o&&n.isXMLDoc(e)||(t=t.toLowerCase(),i=n.attrHooks[t]||(n.expr.match.bool.test(t)?Zb:Yb)),void 0===r?i&&"get"in i&&null!==(s=i.get(e,t))?s:(s=n.find.attr(e,t),null==s?void 0:s):null!==r?i&&"set"in i&&void 0!==(s=i.set(e,r,t))?s:(e.setAttribute(t,r+""),r):void n.removeAttr(e,t))},removeAttr:function(e,t){var r,i,s=0,o=t&&t.match(E);if(o&&1===e.nodeType)while(r=o[s++])i=n.propFix[r]||r,n.expr.match.bool.test(r)&&(e[i]=!1),e.removeAttribute(r)},attrHooks:{type:{set:function(e,t){if(!k.radioValue&&"radio"===t&&n.nodeName(e,"input")){var r=e.value;return e.setAttribute("type",t),r&&(e.value=r),t}}}}}),Zb={set:function(e,t,r){return t===!1?n.removeAttr(e,r):e.setAttribute(r,r),r}},n.each(n.expr.match.bool.source.match(/\w+/g),function(e,t){var r=$b[t]||n.find.attr;$b[t]=function(e,t,n){var i,s;return n||(s=$b[t],$b[t]=i,i=null!=r(e,t,n)?t.toLowerCase():null,$b[t]=s),i}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(e,t){return J(this,n.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[n.propFix[e]||e]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,r){var i,s,o,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return o=1!==u||!n.isXMLDoc(e),o&&(t=n.propFix[t]||t,s=n.propHooks[t]),void 0!==r?s&&"set"in s&&void 0!==(i=s.set(e,r,t))?i:e[t]=r:s&&"get"in s&&null!==(i=s.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||_b.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(e){var t,r,i,s,o,u,a="string"==typeof e&&e,f=0,l=this.length;if(n.isFunction(e))return this.each(function(t){n(this).addClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(E)||[];l>f;f++)if(r=this[f],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(ac," "):" ")){o=0;while(s=t[o++])i.indexOf(" "+s+" ")<0&&(i+=s+" ");u=n.trim(i),r.className!==u&&(r.className=u)}return this},removeClass:function(e){var t,r,i,s,o,u,a=0===arguments.length||"string"==typeof e&&e,f=0,l=this.length;if(n.isFunction(e))return this.each(function(t){n(this).removeClass(e.call(this,t,this.className))});if(a)for(t=(e||"").match(E)||[];l>f;f++)if(r=this[f],i=1===r.nodeType&&(r.className?(" "+r.className+" ").replace(ac," "):"")){o=0;while(s=t[o++])while(i.indexOf(" "+s+" ")>=0)i=i.replace(" "+s+" "," ");u=e?n.trim(i):"",r.className!==u&&(r.className=u)}return this},toggleClass:function(e,t){var r=typeof e;return"boolean"==typeof t&&"string"===r?t?this.addClass(e):this.removeClass(e):this.each(n.isFunction(e)?function(r){n(this).toggleClass(e.call(this,r,this.className,t),t)}:function(){if("string"===r){var t,i=0,s=n(this),o=e.match(E)||[];while(t=o[i++])s.hasClass(t)?s.removeClass(t):s.addClass(t)}else(r===U||"boolean"===r)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||e===!1?"":L.get(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(ac," ").indexOf(t)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(e){var t,r,i,s=this[0];if(arguments.length)return i=n.isFunction(e),this.each(function(r){var s;1===this.nodeType&&(s=i?e.call(this,r,n(this).val()):e,null==s?s="":"number"==typeof s?s+="":n.isArray(s)&&(s=n.map(s,function(e){return null==e?"":e+""})),t=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,s,"value")||(this.value=s))});if(s)return t=n.valHooks[s.type]||n.valHooks[s.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(r=t.get(s,"value"))?r:(r=s.value,"string"==typeof r?r.replace(bc,""):null==r?"":r)}}),n.extend({valHooks:{option:{get:function(e){var t=n.find.attr(e,"value");return null!=t?t:n.trim(n.text(e))}},select:{get:function(e){for(var t,r,i=e.options,s=e.selectedIndex,o="select-one"===e.type||0>s,u=o?null:[],a=o?s+1:i.length,f=0>s?a:o?s:0;a>f;f++)if(r=i[f],!(!r.selected&&f!==s||(k.optDisabled?r.disabled:null!==r.getAttribute("disabled"))||r.parentNode.disabled&&n.nodeName(r.parentNode,"optgroup"))){if(t=n(r).val(),o)return t;u.push(t)}return u},set:function(e,t){var r,i,s=e.options,o=n.makeArray(t),u=s.length;while(u--)i=s[u],(i.selected=n.inArray(i.value,o)>=0)&&(r=!0);return r||(e.selectedIndex=-1),o}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(e,t){return n.isArray(t)?e.checked=n.inArray(n(e).val(),t)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){n.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),n.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(e){return JSON.parse(e+"")},n.parseXML=function(e){var t,r;if(!e||"string"!=typeof e)return null;try{r=new DOMParser,t=r.parseFromString(e,"text/xml")}catch(i){t=void 0}return(!t||t.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+e),t};var ec=/#.*$/,fc=/([?&])_=[^&]*/,gc=/^(.*?):[ \t]*([^\r\n]*)$/gm,hc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ic=/^(?:GET|HEAD)$/,jc=/^\/\//,kc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lc={},mc={},nc="*/".concat("*"),oc=a.location.href,pc=kc.exec(oc.toLowerCase())||[];n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:oc,type:"GET",isLocal:hc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?sc(sc(e,n.ajaxSettings),t):sc(n.ajaxSettings,e)},ajaxPrefilter:qc(lc),ajaxTransport:qc(mc),ajax:function(e,t){function T(e,t,o,a){var l,g,y,w,E,x=t;2!==b&&(b=2,u&&clearTimeout(u),r=void 0,s=a||"",S.readyState=e>0?4:0,l=e>=200&&300>e||304===e,o&&(w=tc(c,S,o)),w=uc(c,w,S,l),l?(c.ifModified&&(E=S.getResponseHeader("Last-Modified"),E&&(n.lastModified[i]=E),E=S.getResponseHeader("etag"),E&&(n.etag[i]=E)),204===e||"HEAD"===c.type?x="nocontent":304===e?x="notmodified":(x=w.state,g=w.data,y=w.error,l=!y)):(y=x,(e||!x)&&(x="error",0>e&&(e=0))),S.status=e,S.statusText=(t||x)+"",l?d.resolveWith(h,[g,x,S]):d.rejectWith(h,[S,x,y]),S.statusCode(m),m=void 0,f&&p.trigger(l?"ajaxSuccess":"ajaxError",[S,c,l?g:y]),v.fireWith(h,[S,x]),f&&(p.trigger("ajaxComplete",[S,c]),--n.active||n.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,s,o,u,a,f,l,c=n.ajaxSetup({},t),h=c.context||c,p=c.context&&(h.nodeType||h.jquery)?n(h):n.event,d=n.Deferred(),v=n.Callbacks("once memory"),m=c.statusCode||{},g={},y={},b=0,w="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!o){o={};while(t=gc.exec(s))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,g[e]=t),this},overrideMimeType:function(e){return b||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else S.always(e[S.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),T(0,t),this}};if(d.promise(S).complete=v.add,S.success=S.done,S.error=S.fail,c.url=((e||c.url||oc)+"").replace(ec,"").replace(jc,pc[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=n.trim(c.dataType||"*").toLowerCase().match(E)||[""],null==c.crossDomain&&(a=kc.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===pc[1]&&a[2]===pc[2]&&(a[3]||("http:"===a[1]?"80":"443"))===(pc[3]||("http:"===pc[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=n.param(c.data,c.traditional)),rc(lc,c,t,S),2===b)return S;f=n.event&&c.global,f&&0===n.active++&&n.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!ic.test(c.type),i=c.url,c.hasContent||(c.data&&(i=c.url+=(dc.test(i)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=fc.test(i)?i.replace(fc,"$1_="+cc++):i+(dc.test(i)?"&":"?")+"_="+cc++)),c.ifModified&&(n.lastModified[i]&&S.setRequestHeader("If-Modified-Since",n.lastModified[i]),n.etag[i]&&S.setRequestHeader("If-None-Match",n.etag[i])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&S.setRequestHeader("Content-Type",c.contentType),S.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+nc+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)S.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,S,c)!==!1&&2!==b){w="abort";for(l in{success:1,error:1,complete:1})S[l](c[l]);if(r=rc(mc,c,t,S)){S.readyState=1,f&&p.trigger("ajaxSend",[S,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){S.abort("timeout")},c.timeout));try{b=1,r.send(g,T)}catch(x){if(!(2>b))throw x;T(-1,x)}}else T(-1,"No Transport");return S}return S.abort()},getJSON:function(e,t,r){return n.get(e,t,r,"json")},getScript:function(e,t){return n.get(e,void 0,t,"script")}}),n.each(["get","post"],function(e,t){n[t]=function(e,r,i,s){return n.isFunction(r)&&(s=s||i,i=r,r=void 0),n.ajax({url:e,type:t,dataType:s,data:r,success:i})}}),n._evalUrl=function(e){return n.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(e){var t;return n.isFunction(e)?this.each(function(t){n(this).wrapAll(e.call(this,t))}):(this[0]&&(t=n(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return this.each(n.isFunction(e)?function(t){n(this).wrapInner(e.call(this,t))}:function(){var t=n(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)})},wrap:function(e){var t=n.isFunction(e);return this.each(function(r){n(this).wrapAll(t?e.call(this,r):e)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},n.expr.filters.visible=function(e){return!n.expr.filters.hidden(e)};var vc=/%20/g,wc=/\[\]$/,xc=/\r?\n/g,yc=/^(?:submit|button|image|reset|file)$/i,zc=/^(?:input|select|textarea|keygen)/i;n.param=function(e,t){var r,i=[],s=function(e,t){t=n.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(e)||e.jquery&&!n.isPlainObject(e))n.each(e,function(){s(this.name,this.value)});else for(r in e)Ac(r,e[r],t,s);return i.join("&").replace(vc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=n.prop(this,"elements");return e?n.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!n(this).is(":disabled")&&zc.test(this.nodeName)&&!yc.test(e)&&(this.checked||!T.test(e))}).map(function(e,t){var r=n(this).val();return null==r?null:n.isArray(r)?n.map(r,function(e){return{name:t.name,value:e.replace(xc,"\r\n")}}):{name:t.name,value:r.replace(xc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var Bc=0,Cc={},Dc={0:200,1223:204},Ec=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var e in Cc)Cc[e]()}),k.cors=!!Ec&&"withCredentials"in Ec,k.ajax=Ec=!!Ec,n.ajaxTransport(function(e){var t;return k.cors||Ec&&!e.crossDomain?{send:function(n,r){var i,s=e.xhr(),o=++Bc;if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete Cc[o],t=s.onload=s.onerror=null,"abort"===e?s.abort():"error"===e?r(s.status,s.statusText):r(Dc[s.status]||s.status,s.statusText,"string"==typeof s.responseText?{text:s.responseText}:void 0,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=Cc[o]=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return n.globalEval(e),e}}}),n.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),n.ajaxTransport("script",function(e){if(e.crossDomain){var t,r;return{send:function(i,s){t=n("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",r=function(e){t.remove(),r=null,e&&s("error"===e.type?404:200,e.type)}),l.head.appendChild(t[0])},abort:function(){r&&r()}}}});var Fc=[],Gc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fc.pop()||n.expando+"_"+cc++;return this[e]=!0,e}}),n.ajaxPrefilter("json jsonp",function(e,t,r){var i,s,o,u=e.jsonp!==!1&&(Gc.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gc.test(e.data)&&"data");return u||"jsonp"===e.dataTypes[0]?(i=e.jsonpCallback=n.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,u?e[u]=e[u].replace(Gc,"$1"+i):e.jsonp!==!1&&(e.url+=(dc.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||n.error(i+" was not called"),o[0]},e.dataTypes[0]="json",s=a[i],a[i]=function(){o=arguments},r.always(function(){a[i]=s,e[i]&&(e.jsonpCallback=t.jsonpCallback,Fc.push(i)),o&&n.isFunction(s)&&s(o[0]),o=s=void 0}),"script"):void 0}),n.parseHTML=function(e,t,r){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(r=t,t=!1),t=t||l;var i=v.exec(e),s=!r&&[];return i?[t.createElement(i[1])]:(i=n.buildFragment([e],t,s),s&&s.length&&n(s).remove(),n.merge([],i.childNodes))};var Hc=n.fn.load;n.fn.load=function(e,t,r){if("string"!=typeof e&&Hc)return Hc.apply(this,arguments);var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=n.trim(e.slice(a)),e=e.slice(0,a)),n.isFunction(t)?(r=t,t=void 0):t&&"object"==typeof t&&(s="POST"),u.length>0&&n.ajax({url:e,type:s,dataType:"html",data:t}).done(function(e){o=arguments,u.html(i?n("<div>").append(n.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){u.each(r,o||[e.responseText,t,e])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){n.fn[t]=function(e){return this.on(t,e)}}),n.expr.filters.animated=function(e){return n.grep(n.timers,function(t){return e===t.elem}).length};var Ic=a.document.documentElement;n.offset={setOffset:function(e,t,r){var i,s,o,u,a,f,l,c=n.css(e,"position"),h=n(e),p={};"static"===c&&(e.style.position="relative"),a=h.offset(),o=n.css(e,"top"),f=n.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+f).indexOf("auto")>-1,l?(i=h.position(),u=i.top,s=i.left):(u=parseFloat(o)||0,s=parseFloat(f)||0),n.isFunction(t)&&(t=t.call(e,r,a)),null!=t.top&&(p.top=t.top-a.top+u),null!=t.left&&(p.left=t.left-a.left+s),"using"in t?t.using.call(e,p):h.css(p)}},n.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){n.offset.setOffset(this,e,t)});var t,r,i=this[0],s={top:0,left:0},o=i&&i.ownerDocument;if(o)return t=o.documentElement,n.contains(t,i)?(typeof i.getBoundingClientRect!==U&&(s=i.getBoundingClientRect()),r=Jc(o),{top:s.top+r.pageYOffset-t.clientTop,left:s.left+r.pageXOffset-t.clientLeft}):s},position:function(){if(this[0]){var e,t,r=this[0],i={top:0,left:0};return"fixed"===n.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),n.nodeName(e[0],"html")||(i=e.offset()),i.top+=n.css(e[0],"borderTopWidth",!0),i.left+=n.css(e[0],"borderLeftWidth",!0)),{top:t.top-i.top-n.css(r,"marginTop",!0),left:t.left-i.left-n.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||Ic;while(e&&!n.nodeName(e,"html")&&"static"===n.css(e,"position"))e=e.offsetParent;return e||Ic})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var r="pageYOffset"===t;n.fn[e]=function(n){return J(this,function(e,n,i){var s=Jc(e);return void 0===i?s?s[t]:e[n]:void (s?s.scrollTo(r?a.pageXOffset:i,r?i:a.pageYOffset):e[n]=i)},e,n,arguments.length,null)}}),n.each(["top","left"],function(e,t){n.cssHooks[t]=yb(k.pixelPosition,function(e,r){return r?(r=xb(e,t),vb.test(r)?n(e).position()[t]+"px":r):void 0})}),n.each({Height:"height",Width:"width"},function(e,t){n.each({padding:"inner"+e,content:t,"":"outer"+e},function(r,i){n.fn[i]=function(i,s){var o=arguments.length&&(r||"boolean"!=typeof i),u=r||(i===!0||s===!0?"margin":"border");return J(this,function(t,r,i){var s;return n.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(s=t.documentElement,Math.max(t.body["scroll"+e],s["scroll"+e],t.body["offset"+e],s["offset"+e],s["client"+e])):void 0===i?n.css(t,r,u):n.style(t,r,i,u)},t,o?i:void 0,o,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kc=a.jQuery,Lc=a.$;return n.noConflict=function(e){return a.$===n&&(a.$=Lc),e&&a.jQuery===n&&(a.jQuery=Kc),n},typeof b===U&&(a.jQuery=a.$=n),n}),define("config",["jquery"],function(e){function r(){if(typeof Storage!="undefined"&&window.trill_on_swish.config_hash){var e;if(e=localStorage.getItem(t)){value=JSON.parse(e);if(value.hash==window.trill_on_swish.config_hash)return value.config}}}function i(e){typeof Storage!="undefined"&&window.trill_on_swish.config_hash&&localStorage.setItem(t,JSON.stringify({hash:window.trill_on_swish.config_hash,config:e}))}var t="TRILLONSWISHCONFIG",n;return n||(n=r())||e.ajax("trill_on_swish_config.json",{dataType:"json",async:!1,success:function(e){n=e,i(n)},error:function(){alert("Failed to fetch configuration from server")}}),n}),define("preferences",["jquery"],function(e){function i(){var e=localStorage.getItem("notagain")||"[]",t;try{data=JSON.parse(e),typeof data!="object"&&(data=[])}catch(n){data=[]}return data}var t=typeof Storage!="undefined",n={},r={persistent:function(){return t},setNotAgain:function(e){if(t){var n=i();n.indexOf(e)<0&&(n.push(e),localStorage.setItem("notagain",JSON.stringify(n)))}},notagain:function(e){if(t){var n=i();return n.indexOf(e)>=0}return!1},broadcast:function(t,n){e(".trill_on_swish-event-receiver").trigger("preference",{name:t,value:n})},setVal:function(e,n){t&&localStorage.setItem(e,JSON.stringify(n)),this.broadcast(e,n)},setDefault:function(e,t){n[e]=t},getVal:function(e){if(t){var r;if(r=localStorage.getItem(e))return value=JSON.parse(r),value}return n[e]}};return r}),function(e){"function"==typeof define&&define.amd?define("jquery-ui",["jquery"],e):e(jQuery)}(function(e){function t(t,r){var i,s,o,u=t.nodeName.toLowerCase();return"area"===u?(i=t.parentNode,s=i.name,t.href&&s&&"map"===i.nodeName.toLowerCase()?(o=e("img[usemap='#"+s+"']")[0],!!o&&n(o)):!1):(/^(input|select|textarea|button|object)$/.test(u)?!t.disabled:"a"===u?t.href||r:r)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function r(e){for(var t,n;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(n=parseInt(e.css("zIndex"),10),!isNaN(n)&&0!==n))return n;e=e.parent()}return 0}function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=s(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(t){var n="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(n,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(n,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(g.inline?g.dpDiv.parent()[0]:g.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function u(t,n){e.extend(t,n);for(var r in n)null==n[r]&&(t[r]=n[r]);return t}function a(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var n=this.css("position"),r="absolute"===n,i=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return r&&"static"===t.css("position")?!1:i.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==n&&s.length?s:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(n){return t(n,!isNaN(e.attr(n,"tabindex")))},tabbable:function(n){var r=e.attr(n,"tabindex"),i=isNaN(r);return(i||r>=0)&&t(n,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function r(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i="Width"===n?["Left","Right"]:["Top","Bottom"],s=n.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return void 0===t?o["inner"+n].call(this):this.each(function(){e(this).css(s,r(this,t)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?o["outer"+n].call(this,t):this.each(function(){e(this).css(s,r(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return"number"==typeof n?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var n,r,i=e(this[0]);i.length&&i[0]!==document;){if(n=i.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(r=parseInt(i.css("zIndex"),10),!isNaN(r)&&0!==r))return r;i=i.parent()}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(s&&(r||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(i=0;s.length>i;i++)e.options[s[i][0]]&&s[i][1].apply(e.element,n)}};var f=0,l=Array.prototype.slice;e.cleanData=function(t){return function(n){var r,i,s;for(s=0;null!=(i=n[s]);s++)try{r=e._data(i,"events"),r&&r.remove&&e(i).triggerHandler("remove")}catch(o){}t(n)}}(e.cleanData),e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];return t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){return e.isFunction(r)?(a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t,n=this._super,s=this._superApply;return this._super=e,this._superApply=i,t=r.apply(this,arguments),this._super=n,this._superApply=s,t}}(),void 0):(a[t]=r,void 0)}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix||t:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var n,r,i=l.call(arguments,1),s=0,o=i.length;o>s;s++)for(n in i[s])r=i[s][n],i[s].hasOwnProperty(n)&&void 0!==r&&(t[n]=e.isPlainObject(r)?e.isPlainObject(t[n])?e.widget.extend({},t[n],r):e.widget.extend({},r):r);return t},e.widget.bridge=function(t,n){var r=n.prototype.widgetFullName||t;e.fn[t]=function(i){var s="string"==typeof i,o=l.call(arguments,1),u=this;return s?this.each(function(){var n,s=e.data(this,r);return"instance"===i?(u=s,!1):s?e.isFunction(s[i])&&"_"!==i.charAt(0)?(n=s[i].apply(s,o),n!==s&&void 0!==n?(u=n&&n.jquery?u.pushStack(n.get()):n,!1):void 0):e.error("no such method '"+i+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+i+"'")}):(o.length&&(i=e.widget.extend.apply(null,[i].concat(o))),this.each(function(){var t=e.data(this,r);t?(t.option(i||{}),t._init&&t._init()):e.data(this,r,new n(i,this))})),u}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=f++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r,i,s,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},r=t.split("."),t=r.shift(),r.length){for(i=o[t]=e.widget.extend({},this.options[t]),s=0;r.length-1>s;s++)i[r[s]]=i[r[s]]||{},i=i[r[s]];if(t=r.pop(),1===arguments.length)return void 0===i[t]?null:i[t];i[t]=n}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=n}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,n,r){var i,s=this;"boolean"!=typeof t&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){return t||s.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?s[o]:o).apply(s,arguments):void 0}"string"!=typeof o&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^([\w:-]*)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(t,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(n).undelegate(n),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function n(){return("string"==typeof e?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];if(r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){"string"==typeof i&&(i={effect:i});var o,u=i?i===!0||"number"==typeof i?n:i.effect||n:t;i=i||{},"number"==typeof i&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.widget;var c=!1;e(document).mouseup(function(){c=!1}),e.widget("ui.mouse",{version:"1.11.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){return!0===e.data(n.target,t.widgetName+".preventClickEvent")?(e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!c){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var n=this,r=1===t.which,i="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return r&&!i&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),c=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),c=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,n){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?n/100:1)]}function n(t,n){return parseInt(e.css(t,n),10)||0}function r(t){var n=t[0];return 9===n.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var i,s,o=Math.max,u=Math.abs,a=Math.round,f=/left|center|right/,l=/top|center|bottom/,c=/[\+\-]\d+(\.[\d]+)?%?/,h=/^\w+/,p=/%$/,d=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==i)return i;var t,n,r=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),s=r.children()[0];return e("body").append(r),t=s.offsetWidth,r.css("overflow","scroll"),n=s.offsetWidth,t===n&&(n=r[0].clientWidth),r.remove(),i=t-n},getScrollInfo:function(t){var n=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),r=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),i="scroll"===n||"auto"===n&&t.width<t.element[0].scrollWidth,s="scroll"===r||"auto"===r&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:i?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]),i=!!n[0]&&9===n[0].nodeType;return{element:n,isWindow:r,isDocument:i,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r||i?n.width():n.outerWidth(),height:r||i?n.height():n.outerHeight()}}},e.fn.position=function(i){if(!i||!i.of)return d.apply(this,arguments);i=e.extend({},i);var p,v,m,g,y,b,w=e(i.of),E=e.position.getWithinInfo(i.within),S=e.position.getScrollInfo(E),x=(i.collision||"flip").split(" "),T={};return b=r(w),w[0].preventDefault&&(i.at="left top"),v=b.width,m=b.height,g=b.offset,y=e.extend({},g),e.each(["my","at"],function(){var e,t,n=(i[this]||"").split(" ");1===n.length&&(n=f.test(n[0])?n.concat(["center"]):l.test(n[0])?["center"].concat(n):["center","center"]),n[0]=f.test(n[0])?n[0]:"center",n[1]=l.test(n[1])?n[1]:"center",e=c.exec(n[0]),t=c.exec(n[1]),T[this]=[e?e[0]:0,t?t[0]:0],i[this]=[h.exec(n[0])[0],h.exec(n[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===i.at[0]?y.left+=v:"center"===i.at[0]&&(y.left+=v/2),"bottom"===i.at[1]?y.top+=m:"center"===i.at[1]&&(y.top+=m/2),p=t(T.at,v,m),y.left+=p[0],y.top+=p[1],this.each(function(){var r,f,l=e(this),c=l.outerWidth(),h=l.outerHeight(),d=n(this,"marginLeft"),b=n(this,"marginTop"),N=c+d+n(this,"marginRight")+S.width,C=h+b+n(this,"marginBottom")+S.height,L=e.extend({},y),A=t(T.my,l.outerWidth(),l.outerHeight());"right"===i.my[0]?L.left-=c:"center"===i.my[0]&&(L.left-=c/2),"bottom"===i.my[1]?L.top-=h:"center"===i.my[1]&&(L.top-=h/2),L.left+=A[0],L.top+=A[1],s||(L.left=a(L.left),L.top=a(L.top)),r={marginLeft:d,marginTop:b},e.each(["left","top"],function(t,n){e.ui.position[x[t]]&&e.ui.position[x[t]][n](L,{targetWidth:v,targetHeight:m,elemWidth:c,elemHeight:h,collisionPosition:r,collisionWidth:N,collisionHeight:C,offset:[p[0]+A[0],p[1]+A[1]],my:i.my,at:i.at,within:E,elem:l})}),i.using&&(f=function(e){var t=g.left-L.left,n=t+v-c,r=g.top-L.top,s=r+m-h,a={target:{element:w,left:g.left,top:g.top,width:v,height:m},element:{element:l,left:L.left,top:L.top,width:c,height:h},horizontal:0>n?"left":t>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};c>v&&v>u(t+n)&&(a.horizontal="center"),h>m&&m>u(r+s)&&(a.vertical="middle"),a.important=o(u(t),u(n))>o(u(r),u(s))?"horizontal":"vertical",i.using.call(this,e,a)}),l.offset(e.extend(L,{using:f}))})},e.ui.position={fit:{left:function(e,t){var n,r=t.within,i=r.isWindow?r.scrollLeft:r.offset.left,s=r.width,u=e.left-t.collisionPosition.marginLeft,a=i-u,f=u+t.collisionWidth-s-i;t.collisionWidth>s?a>0&&0>=f?(n=e.left+a+t.collisionWidth-s-i,e.left+=a-n):e.left=f>0&&0>=a?i:a>f?i+s-t.collisionWidth:i:a>0?e.left+=a:f>0?e.left-=f:e.left=o(e.left-u,e.left)},top:function(e,t){var n,r=t.within,i=r.isWindow?r.scrollTop:r.offset.top,s=t.within.height,u=e.top-t.collisionPosition.marginTop,a=i-u,f=u+t.collisionHeight-s-i;t.collisionHeight>s?a>0&&0>=f?(n=e.top+a+t.collisionHeight-s-i,e.top+=a-n):e.top=f>0&&0>=a?i:a>f?i+s-t.collisionHeight:i:a>0?e.top+=a:f>0?e.top-=f:e.top=o(e.top-u,e.top)}},flip:{left:function(e,t){var n,r,i=t.within,s=i.offset.left+i.scrollLeft,o=i.width,a=i.isWindow?i.scrollLeft:i.offset.left,f=e.left-t.collisionPosition.marginLeft,l=f-a,c=f+t.collisionWidth-o-a,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,d=-2*t.offset[0];0>l?(n=e.left+h+p+d+t.collisionWidth-o-s,(0>n||u(l)>n)&&(e.left+=h+p+d)):c>0&&(r=e.left-t.collisionPosition.marginLeft+h+p+d-a,(r>0||c>u(r))&&(e.left+=h+p+d))},top:function(e,t){var n,r,i=t.within,s=i.offset.top+i.scrollTop,o=i.height,a=i.isWindow?i.scrollTop:i.offset.top,f=e.top-t.collisionPosition.marginTop,l=f-a,c=f+t.collisionHeight-o-a,h="top"===t.my[1],p=h?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,d="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,v=-2*t.offset[1];0>l?(r=e.top+p+d+v+t.collisionHeight-o-s,(0>r||u(l)>r)&&(e.top+=p+d+v)):c>0&&(n=e.top-t.collisionPosition.marginTop+p+d+v-a,(n>0||c>u(n))&&(e.top+=p+d+v))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,r,i,o,u=document.getElementsByTagName("body")[0],a=document.createElement("div");t=document.createElement(u?"div":"body"),r={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},u&&e.extend(r,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in r)t.style[o]=r[o];t.appendChild(a),n=u||document.documentElement,n.insertBefore(t,n.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",i=e(a).offset().left,s=i>10&&11>i,t.innerHTML="",n.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._eventHandler(t);break;case n.HOME:s=this.headers[0];break;case n.END:s=this.headers[r-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,n=this.options,r=n.heightStyle,i=this.element.parent();this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),n=t.uniqueId().attr("id"),r=t.next(),i=r.uniqueId().attr("id");t.attr("aria-controls",i),r.attr("aria-labelledby",n)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),"fill"===r?(t=i.height(),this.element.siblings(":visible").each(function(){var n=e(this),r=n.css("position");"absolute"!==r&&"fixed"!==r&&(t-=n.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===r&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var n=this._findActive(t)[0];n!==this.active[0]&&(n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var n={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,n),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i[0]===r[0],o=s&&n.collapsible,u=o?e():i.next(),a=r.next(),f={oldHeader:r,oldPanel:a,newHeader:o?e():i,newPanel:u};t.preventDefault(),s&&!n.collapsible||this._trigger("beforeActivate",t,f)===!1||(n.active=o?!1:this.headers.index(i),this.active=s?e():i,this._toggle(f),r.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&r.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),s||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),i.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var n=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=r,this.options.animate?this._animate(n,r,t):(r.hide(),n.show(),this._toggleComplete(t)),r.attr({"aria-hidden":"true"}),r.prev().attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&r.length?r.prev().attr({tabIndex:-1,"aria-expanded":"false"}):n.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),n.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,n){var r,i,s,o=this,u=0,a=e.length&&(!t.length||e.index()<t.index()),f=this.options.animate||{},l=a&&f.down||f,c=function(){o._toggleComplete(n)};return"number"==typeof l&&(s=l),"string"==typeof l&&(i=l),i=i||l.easing||f.easing,s=s||l.duration||f.duration,t.length?e.length?(r=e.show().outerHeight(),t.animate(this.hideProps,{duration:s,easing:i,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:s,easing:i,complete:c,step:function(e,n){n.now=Math.round(e),"height"!==n.prop?u+=n.now:"content"!==o.options.heightStyle&&(n.now=Math.round(r-t.outerHeight()-u),u=0)}}),void 0):t.animate(this.hideProps,s,i,c):e.animate(this.showProps,s,i,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var n=e(t.target);!this.mouseHandled&&n.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),n.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var n=e(t.currentTarget);n.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,n)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var n=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,n)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var n,r,i,s,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,r=this.previousFilter||"",i=String.fromCharCode(t.keyCode),s=!1,clearTimeout(this.filterTimer),i===r?s=!0:i=r+i,n=this._filterMenuItems(i),n=s&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(i=String.fromCharCode(t.keyCode),n=this._filterMenuItems(i)),n.length?(this.focus(t,n),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,n,r=this,i=this.options.icons.submenu,s=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.parent(),r=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(r),t.attr("aria-labelledby",n.attr("id"))}),t=s.add(this.element),n=t.find(this.options.items),n.not(".ui-menu-item").each(function(){var t=e(this);r._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),n.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),n.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var n,r;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),r=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",r.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=t.children(".ui-menu"),n.length&&e&&/^mouse/.test(e.type)&&this._startOpening(n),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var n,r,i,s,o,u;this._hasScroll()&&(n=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,r=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,i=t.offset().top-this.activeMenu.offset().top-n-r,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),u=t.outerHeight(),0>i?this.activeMenu.scrollTop(s+i):i+u>o&&this.activeMenu.scrollTop(s+i-o+u))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var n=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(n)},collapseAll:function(t,n){clearTimeout(this.timer),this.timer=this._delay(function(){var r=n?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));r.length||(r=this.element),this._close(r),this.blur(t),this.activeMenu=r},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,n){var r;this.active&&(r="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),r&&r.length&&this.active||(r=this.activeMenu.find(this.options.items)[t]()),this.focus(n,r)},nextPage:function(t){var n,r,i;return this.active?(this.isLastItem()||(this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return n=e(this),0>n.offset().top-r-i}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var n,r,i;return this.active?(this.isFirstItem()||(this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r+i>0}),this.focus(t,n)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var n={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,n)},_filterMenuItems:function(t){var n=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),r=RegExp("^"+n,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return r.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,n,r,i=this.element[0].nodeName.toLowerCase(),s="textarea"===i,o="input"===i;this.isMultiLine=s?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[s||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(i){if(this.element.prop("readOnly"))return t=!0,r=!0,n=!0,void 0;t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",i);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",i);break;case s.UP:t=!0,this._keyEvent("previous",i);break;case s.DOWN:t=!0,this._keyEvent("next",i);break;case s.ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&r.preventDefault(),void 0;if(!n){var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move("previousPage",r);break;case i.PAGE_DOWN:this._move("nextPage",r);break;case i.UP:this._keyEvent("previous",r);break;case i.DOWN:this._keyEvent("next",r)}}},input:function(e){return r?(r=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target===t.element[0]||r.target===n||e.contains(n,r.target)||t.close()})})},menufocus:function(t,n){var r,i;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(i=n.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:i})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(i.value),r=n.item.attr("aria-label")||i.value,r&&e.trim(r).length&&(this.liveRegion.children().hide(),e("<div>").text(r).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):"string"==typeof this.options.source?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),n=this.menu.element.is(":visible"),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!n&&!r)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var n=this.menu.element.empty();this._renderMenu(n,t),this.isNewMenu=!0,this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,n){return e("<li>").text(n.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var n;this._superApply(arguments),this.options.disabled||this.cancelSearch||(n=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(n).appendTo(this.liveRegion))}}),e.ui.autocomplete;var h,p="ui-button ui-widget ui-state-default ui-corner-all",d="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",v=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},m=function(t){var n=t.name,r=t.form,i=e([]);return n&&(n=n.replace(/'/g,"\\'"),i=r?e(r).find("[name='"+n+"'][type=radio]"):e("[name='"+n+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.11.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,v),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,n=this.options,r="checkbox"===this.type||"radio"===this.type,i=r?"":"ui-state-active";null===n.label&&(n.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){n.disabled||this===h&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){n.disabled||e(this).removeClass(i)}).bind("click"+this.eventNamespace,function(e){n.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),r&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return n.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(n.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var r=t.element[0];m(r).not(r).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return n.disabled?!1:(e(this).addClass("ui-state-active"),h=this,t.document.one("mouseup",function(){h=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return n.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return n.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",n.disabled),this._resetButton()},_determineButtonType:function(){var e,t,n;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),n=this.element.is(":checked"),n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",n)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+d).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?m(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(d),n=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(n)))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),n=this.element.find(this.options.items),r=n.filter(":ui-button");n.not(":ui-button").button(),r.button("refresh"),this.buttons=n.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.3"}});var g;e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return u(this._defaults,e||{}),this},_attachDatepicker:function(t,n){var r,i,s;r=t.nodeName.toLowerCase(),i="div"===r||"span"===r,t.id||(this.uuid+=1,t.id="dp"+this.uuid),s=this._newInst(e(t),i),s.settings=e.extend({},n||{}),"input"===r?this._connectDatepicker(t,s):i&&this._inlineDatepicker(t,s)},_newInst:function(t,n){var r=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:r,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:n,dpDiv:n?s(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,n){var r=e(t);n.append=e([]),n.trigger=e([]),r.hasClass(this.markerClassName)||(this._attachments(r,n),r.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(n),e.data(t,"datepicker",n),n.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,n){var r,i,s,o=this._get(n,"appendText"),u=this._get(n,"isRTL");n.append&&n.append.remove(),o&&(n.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[u?"before":"after"](n.append)),t.unbind("focus",this._showDatepicker),n.trigger&&n.trigger.remove(),r=this._get(n,"showOn"),("focus"===r||"both"===r)&&t.focus(this._showDatepicker),("button"===r||"both"===r)&&(i=this._get(n,"buttonText"),s=this._get(n,"buttonImage"),n.trigger=e(this._get(n,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:s,alt:i,title:i}):e("<button type='button'></button>").addClass(this._triggerClass).html(s?e("<img/>").attr({src:s,alt:i,title:i}):i)),t[u?"before":"after"](n.trigger),n.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,n,r,i,s=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(n=0,r=0,i=0;e.length>i;i++)e[i].length>n&&(n=e[i].length,r=i);return r},s.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),s.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-s.getDay())),e.input.attr("size",this._formatDate(e,s).length)}},_inlineDatepicker:function(t,n){var r=e(t);r.hasClass(this.markerClassName)||(r.addClass(this.markerClassName).append(n.dpDiv),e.data(t,"datepicker",n),this._setDate(n,this._getDefaultDate(n),!0),this._updateDatepicker(n),this._updateAlternate(n),n.settings.disabled&&this._disableDatepicker(t),n.dpDiv.css("display","block"))},_dialogDatepicker:function(t,n,r,i,s){var o,a,f,l,c,h=this._dialogInst;return h||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),h=this._dialogInst=this._newInst(this._dialogInput,!1),h.settings={},e.data(this._dialogInput[0],"datepicker",h)),u(h.settings,i||{}),n=n&&n.constructor===Date?this._formatDate(h,n):n,this._dialogInput.val(n),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(a=document.documentElement.clientWidth,f=document.documentElement.clientHeight,l=document.documentElement.scrollLeft||document.body.scrollLeft,c=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[a/2-100+l,f/2-150+c]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),h.settings.onSelect=r,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",h),this},_destroyDatepicker:function(t){var n,r=e(t),i=e.data(t,"datepicker");r.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===n?(i.append.remove(),i.trigger.remove(),r.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===n||"span"===n)&&r.removeClass(this.markerClassName).empty(),g===i&&(g=null))},_enableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");i.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),"input"===n?(t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===n||"span"===n)&&(r=i.children("."+this._inlineClass),r.children().removeClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var n,r,i=e(t),s=e.data(t,"datepicker");i.hasClass(this.markerClassName)&&(n=t.nodeName.toLowerCase(),"input"===n?(t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===n||"span"===n)&&(r=i.children("."+this._inlineClass),r.children().addClass("ui-state-disabled"),r.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(n){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,n,r){var i,s,o,a,f=this._getInst(t);return 2===arguments.length&&"string"==typeof n?"defaults"===n?e.extend({},e.datepicker._defaults):f?"all"===n?e.extend({},f.settings):this._get(f,n):null:(i=n||{},"string"==typeof n&&(i={},i[n]=r),f&&(this._curInst===f&&this._hideDatepicker(),s=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(f,"min"),a=this._getMinMaxDate(f,"max"),u(f.settings,i),null!==o&&void 0!==i.dateFormat&&void 0===i.minDate&&(f.settings.minDate=this._formatDate(f,o)),null!==a&&void 0!==i.dateFormat&&void 0===i.maxDate&&(f.settings.maxDate=this._formatDate(f,a)),"disabled"in i&&(i.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),f),this._autoSize(f),this._setDate(f,s),this._updateAlternate(f),this._updateDatepicker(f)),void 0)},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(t){var n,r,i,s=e.datepicker._getInst(t.target),o=!0,u=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return i=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",s.dpDiv),i[0]&&e.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),n=e.datepicker._get(s,"onSelect"),n?(r=e.datepicker._formatDate(s),n.apply(s.input?s.input[0]:null,[r,s])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(s,"stepBigMonths"):-e.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,u?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(s,"stepBigMonths"):+e.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var n,r,i=e.datepicker._getInst(t.target);return e.datepicker._get(i,"constrainInput")?(n=e.datepicker._possibleChars(e.datepicker._get(i,"dateFormat")),r=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">r||!n||n.indexOf(r)>-1):void 0},_doKeyUp:function(t){var n,r=e.datepicker._getInst(t.target);if(r.input.val()!==r.lastVal)try{n=e.datepicker.parseDate(e.datepicker._get(r,"dateFormat"),r.input?r.input.val():null,e.datepicker._getFormatConfig(r)),n&&(e.datepicker._setDateFromField(r),e.datepicker._updateAlternate(r),e.datepicker._updateDatepicker(r))}catch(i){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var n,i,s,o,a,f,l;n=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==n&&(e.datepicker._curInst.dpDiv.stop(!0,!0),n&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),i=e.datepicker._get(n,"beforeShow"),s=i?i.apply(t,[t,n]):{},s!==!1&&(u(n.settings,s),n.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(n),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),a={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(n),a=e.datepicker._checkOffset(n,a,o),n.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),n.inline||(f=e.datepicker._get(n,"showAnim"),l=e.datepicker._get(n,"duration"),n.dpDiv.css("z-index",r(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[f]?n.dpDiv.show(f,e.datepicker._get(n,"showOptions"),l):n.dpDiv[f||"show"](f?l:null),e.datepicker._shouldFocusInput(n)&&n.input.focus(),e.datepicker._curInst=n))}},_updateDatepicker:function(t){this.maxRows=4,g=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var n,r=this._getNumberOfMonths(t),i=r[1],s=17,u=t.dpDiv.find("."+this._dayOverClass+" a");u.length>0&&o.apply(u.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),i>1&&t.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",s*i+"em"),t.dpDiv[(1!==r[0]||1!==r[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(n=t.yearshtml,setTimeout(function(){n===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),n=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,n,r){var i=t.dpDiv.outerWidth(),s=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,u=t.input?t.input.outerHeight():0,a=document.documentElement.clientWidth+(r?0:e(document).scrollLeft()),f=document.documentElement.clientHeight+(r?0:e(document).scrollTop());return n.left-=this._get(t,"isRTL")?i-o:0,n.left-=r&&n.left===t.input.offset().left?e(document).scrollLeft():0,n.top-=r&&n.top===t.input.offset().top+u?e(document).scrollTop():0,n.left-=Math.min(n.left,n.left+i>a&&a>i?Math.abs(n.left+i-a):0),n.top-=Math.min(n.top,n.top+s>f&&f>s?Math.abs(s+u):0),n},_findPos:function(t){for(var n,r=this._getInst(t),i=this._get(r,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return n=e(t).offset(),[n.left,n.top]},_hideDatepicker:function(t){var n,r,i,s,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(n=this._get(o,"showAnim"),r=this._get(o,"duration"),i=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[n]||e.effects[n])?o.dpDiv.hide(n,e.datepicker._get(o,"showOptions"),r,i):o.dpDiv["slideDown"===n?"slideUp":"fadeIn"===n?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1,s=this._get(o,"onClose"),s&&s.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var n=e(t.target),r=e.datepicker._getInst(n[0]);(n[0].id!==e.datepicker._mainDivId&&0===n.parents("#"+e.datepicker._mainDivId).length&&!n.hasClass(e.datepicker.markerClassName)&&!n.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||n.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==r)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,n,r){var i=e(t),s=this._getInst(i[0]);this._isDisabledDatepicker(i[0])||(this._adjustInstDate(s,n+("M"===r?this._get(s,"showCurrentAtPos"):0),r),this._updateDatepicker(s))},_gotoToday:function(t){var n,r=e(t),i=this._getInst(r[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(n=new Date,i.selectedDay=n.getDate(),i.drawMonth=i.selectedMonth=n.getMonth(),i.drawYear=i.selectedYear=n.getFullYear()),this._notifyChange(i),this._adjustDate(r)},_selectMonthYear:function(t,n,r){var i=e(t),s=this._getInst(i[0]);s["selected"+("M"===r?"Month":"Year")]=s["draw"+("M"===r?"Month":"Year")]=parseInt(n.options[n.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(i)},_selectDay:function(t,n,r,i){var s,o=e(t);e(i).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(s=this._getInst(o[0]),s.selectedDay=s.currentDay=e("a",i).html(),s.selectedMonth=s.currentMonth=n,s.selectedYear=s.currentYear=r,this._selectDate(t,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear)))},_clearDate:function(t){var n=e(t);this._selectDate(n,"")},_selectDate:function(t,n){var r,i=e(t),s=this._getInst(i[0]);n=null!=n?n:this._formatDate(s),s.input&&s.input.val(n),this._updateAlternate(s),r=this._get(s,"onSelect"),r?r.apply(s.input?s.input[0]:null,[n,s]):s.input&&s.input.trigger("change"),s.inline?this._updateDatepicker(s):(this._hideDatepicker(),this._lastInput=s.input[0],"object"!=typeof s.input[0]&&s.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var n,r,i,s=this._get(t,"altField");s&&(n=this._get(t,"altFormat")||this._get(t,"dateFormat"),r=this._getDate(t),i=this.formatDate(n,r,this._getFormatConfig(t)),e(s).each(function(){e(this).val(i)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,n=new Date(e.getTime());return n.setDate(n.getDate()+4-(n.getDay()||7)),t=n.getTime(),n.setMonth(0),n.setDate(1),Math.floor(Math.round((t-n)/864e5)/7)+1},parseDate:function(t,n,r){if(null==t||null==n)throw"Invalid arguments";if(n="object"==typeof n?""+n:n+"",""===n)return null;var i,s,o,u,a=0,f=(r?r.shortYearCutoff:null)||this._defaults.shortYearCutoff,l="string"!=typeof f?f:(new Date).getFullYear()%100+parseInt(f,10),c=(r?r.dayNamesShort:null)||this._defaults.dayNamesShort,h=(r?r.dayNames:null)||this._defaults.dayNames,p=(r?r.monthNamesShort:null)||this._defaults.monthNamesShort,d=(r?r.monthNames:null)||this._defaults.monthNames,v=-1,m=-1,g=-1,y=-1,b=!1,w=function(e){var n=t.length>i+1&&t.charAt(i+1)===e;return n&&i++,n},E=function(e){var t=w(e),r="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,i="y"===e?r:1,s=RegExp("^\\d{"+i+","+r+"}"),o=n.substring(a).match(s);if(!o)throw"Missing number at position "+a;return a+=o[0].length,parseInt(o[0],10)},S=function(t,r,i){var s=-1,o=e.map(w(t)?i:r,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var r=t[1];return n.substr(a,r.length).toLowerCase()===r.toLowerCase()?(s=t[0],a+=r.length,!1):void 0}),-1!==s)return s+1;throw"Unknown name at position "+a},x=function(){if(n.charAt(a)!==t.charAt(i))throw"Unexpected literal at position "+a;a++};for(i=0;t.length>i;i++)if(b)"'"!==t.charAt(i)||w("'")?x():b=!1;else switch(t.charAt(i)){case"d":g=E("d");break;case"D":S("D",c,h);break;case"o":y=E("o");break;case"m":m=E("m");break;case"M":m=S("M",p,d);break;case"y":v=E("y");break;case"@":u=new Date(E("@")),v=u.getFullYear(),m=u.getMonth()+1,g=u.getDate();break;case"!":u=new Date((E("!")-this._ticksTo1970)/1e4),v=u.getFullYear(),m=u.getMonth()+1,g=u.getDate();break;case"'":w("'")?x():b=!0;break;default:x()}if(n.length>a&&(o=n.substr(a),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===v?v=(new Date).getFullYear():100>v&&(v+=(new Date).getFullYear()-(new Date).getFullYear()%100+(l>=v?0:-100)),y>-1)for(m=1,g=y;;){if(s=this._getDaysInMonth(v,m-1),s>=g)break;m++,g-=s}if(u=this._daylightSavingAdjust(new Date(v,m-1,g)),u.getFullYear()!==v||u.getMonth()+1!==m||u.getDate()!==g)throw"Invalid date";return u},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864e9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,n){if(!t)return"";var r,i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=function(t){var n=e.length>r+1&&e.charAt(r+1)===t;return n&&r++,n},f=function(e,t,n){var r=""+t;if(a(e))for(;n>r.length;)r="0"+r;return r},l=function(e,t,n,r){return a(e)?r[t]:n[t]},c="",h=!1;if(t)for(r=0;e.length>r;r++)if(h)"'"!==e.charAt(r)||a("'")?c+=e.charAt(r):h=!1;else switch(e.charAt(r)){case"d":c+=f("d",t.getDate(),2);break;case"D":c+=l("D",t.getDay(),i,s);break;case"o":c+=f("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":c+=f("m",t.getMonth()+1,2);break;case"M":c+=l("M",t.getMonth(),o,u);break;case"y":c+=a("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":c+=t.getTime();break;case"!":c+=1e4*t.getTime()+this._ticksTo1970;break;case"'":a("'")?c+="'":h=!0;break;default:c+=e.charAt(r)}return c},_possibleChars:function(e){var t,n="",r=!1,i=function(n){var r=e.length>t+1&&e.charAt(t+1)===n;return r&&t++,r};for(t=0;e.length>t;t++)if(r)"'"!==e.charAt(t)||i("'")?n+=e.charAt(t):r=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":n+="0123456789";break;case"D":case"M":return null;case"'":i("'")?n+="'":r=!0;break;default:n+=e.charAt(t)}return n},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i=this._getDefaultDate(e),s=i,o=this._getFormatConfig(e);try{s=this.parseDate(n,r,o)||i}catch(u){r=t?"":r}e.selectedDay=s.getDate(),e.drawMonth=e.selectedMonth=s.getMonth(),e.drawYear=e.selectedYear=s.getFullYear(),e.currentDay=r?s.getDate():0,e.currentMonth=r?s.getMonth():0,e.currentYear=r?s.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,n,r){var i=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(n){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),n,e.datepicker._getFormatConfig(t))}catch(r){}for(var i=(n.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,s=i.getFullYear(),o=i.getMonth(),u=i.getDate(),a=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,f=a.exec(n);f;){switch(f[2]||"d"){case"d":case"D":u+=parseInt(f[1],10);break;case"w":case"W":u+=7*parseInt(f[1],10);break;case"m":case"M":o+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o));break;case"y":case"Y":s+=parseInt(f[1],10),u=Math.min(u,e.datepicker._getDaysInMonth(s,o))}f=a.exec(n)}return new Date(s,o,u)},o=null==n||""===n?r:"string"==typeof n?s(n):"number"==typeof n?isNaN(n)?r:i(n):new Date(n.getTime());return o=o&&"Invalid Date"==""+o?r:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),i===e.selectedMonth&&s===e.selectedYear||n||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var n=this._get(t,"stepMonths"),r="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(r,-n,"M")},next:function(){e.datepicker._adjustDate(r,+n,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(r)},selectDay:function(){return e.datepicker._selectDay(r,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(r,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(r,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q=new Date,R=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth(),q.getDate())),U=this._get(e,"isRTL"),z=this._get(e,"showButtonPanel"),W=this._get(e,"hideIfNoPrevNext"),X=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),$=this._get(e,"showCurrentAtPos"),J=this._get(e,"stepMonths"),K=1!==V[0]||1!==V[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(e,"min"),Y=this._getMinMaxDate(e,"max"),Z=e.drawMonth-$,et=e.drawYear;if(0>Z&&(Z+=12,et--),Y)for(t=this._daylightSavingAdjust(new Date(Y.getFullYear(),Y.getMonth()-V[0]*V[1]+1,Y.getDate())),t=G&&G>t?G:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,n=this._get(e,"prevText"),n=X?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z-J,1)),this._getFormatConfig(e)):n,r=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>":W?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"e":"w")+"'>"+n+"</span></a>",i=this._get(e,"nextText"),i=X?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z+J,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>":W?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(U?"w":"e")+"'>"+i+"</span></a>",o=this._get(e,"currentText"),u=this._get(e,"gotoCurrent")&&e.currentDay?Q:R,o=X?this.formatDate(o,u,this._getFormatConfig(e)):o,a=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",f=z?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(U?a:"")+(this._isInRange(e,u)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(U?"":a)+"</div>":"",l=parseInt(this._get(e,"firstDay"),10),l=isNaN(l)?0:l,c=this._get(e,"showWeek"),h=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),d=this._get(e,"monthNames"),v=this._get(e,"monthNamesShort"),m=this._get(e,"beforeShowDay"),g=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),w="",S=0;V[0]>S;S++){for(x="",this.maxRows=4,T=0;V[1]>T;T++){if(N=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),C=" ui-corner-all",k="",K){if(k+="<div class='ui-datepicker-group",V[1]>1)switch(T){case 0:k+=" ui-datepicker-group-first",C=" ui-corner-"+(U?"right":"left");break;case V[1]-1:k+=" ui-datepicker-group-last",C=" ui-corner-"+(U?"left":"right");break;default:k+=" ui-datepicker-group-middle",C=""}k+="'>"}for(k+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&0===S?U?s:r:"")+(/all|right/.test(C)&&0===S?U?r:s:"")+this._generateMonthYearHeader(e,Z,et,G,Y,S>0||T>0,d,v)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",L=c?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",E=0;7>E;E++)A=(E+l)%7,L+="<th scope='col'"+((E+l+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+h[A]+"'>"+p[A]+"</span></th>";for(k+=L+"</tr></thead><tbody>",O=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,O)),M=(this._getFirstDayOfMonth(et,Z)-l+7)%7,_=Math.ceil((M+O)/7),D=K?this.maxRows>_?this.maxRows:_:_,this.maxRows=D,P=this._daylightSavingAdjust(new Date(et,Z,1-M)),H=0;D>H;H++){for(k+="<tr>",B=c?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(P)+"</td>":"",E=0;7>E;E++)j=m?m.apply(e.input?e.input[0]:null,[P]):[!0,""],F=P.getMonth()!==Z,I=F&&!y||!j[0]||G&&G>P||Y&&P>Y,B+="<td class='"+((E+l+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(P.getTime()===N.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===P.getTime()&&b.getTime()===N.getTime()?" "+this._dayOverClass:"")+(I?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!g?"":" "+j[1]+(P.getTime()===Q.getTime()?" "+this._currentClass:"")+(P.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(F&&!g||!j[2]?"":" title='"+j[2].replace(/'/g,"&#39;")+"'")+(I?"":" data-handler='selectDay' data-event='click' data-month='"+P.getMonth()+"' data-year='"+P.getFullYear()+"'")+">"+(F&&!g?"&#xa0;":I?"<span class='ui-state-default'>"+P.getDate()+"</span>":"<a class='ui-state-default"+(P.getTime()===R.getTime()?" ui-state-highlight":"")+(P.getTime()===Q.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+P.getDate()+"</a>")+"</td>",P.setDate(P.getDate()+1),P=this._daylightSavingAdjust(P);k+=B+"</tr>"}Z++,Z>11&&(Z=0,et++),k+="</tbody></table>"+(K?"</div>"+(V[0]>0&&T===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=k}w+=x}return w+=f,e._keyEvent=!1,w},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m=this._get(e,"changeMonth"),g=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",w="";if(s||!m)w+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(a=r&&r.getFullYear()===n,f=i&&i.getFullYear()===n,w+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",l=0;12>l;l++)(!a||l>=r.getMonth())&&(!f||i.getMonth()>=l)&&(w+="<option value='"+l+"'"+(l===t?" selected='selected'":"")+">"+u[l]+"</option>");w+="</select>"}if(y||(b+=w+(!s&&m&&g?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",s||!g)b+="<span class='ui-datepicker-year'>"+n+"</span>";else{for(c=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?n+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);return isNaN(t)?h:t},d=p(c[0]),v=Math.max(d,p(c[1]||"")),d=r?Math.max(d,r.getFullYear()):d,v=i?Math.min(v,i.getFullYear()):v,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";v>=d;d++)e.yearshtml+="<option value='"+d+"'"+(d===n?" selected='selected'":"")+">"+d+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!s&&m&&g?"":"&#xa0;")+w),b+="</div>"},_adjustInstDate:function(e,t,n){var r=e.drawYear+("Y"===n?t:0),i=e.drawMonth+("M"===n?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+("D"===n?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===n||"Y"===n)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&n>t?n:t;return r&&i>r?r:i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(0>t?t:i[0]*i[1]),1));return 0>t&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n,r,i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),o=null,u=null,a=this._get(e,"yearRange");return a&&(n=a.split(":"),r=(new Date).getFullYear(),o=parseInt(n[0],10),u=parseInt(n[1],10),n[0].match(/[+\-].*/)&&(o+=r),n[1].match(/[+\-].*/)&&(u+=r)),(!i||t.getTime()>=i.getTime())&&(!s||t.getTime()<=s.getTime())&&(!o||t.getFullYear()>=o)&&(!u||u>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var n=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(n)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(n))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.3",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var n=this.options;return this._blurActiveElement(t),this.helper||n.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(n.iframeFix===!0?"iframe":n.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var n=this.document[0];if(this.handleElement.is(t.target))try{n.activeElement&&"body"!==n.activeElement.nodeName.toLowerCase()&&e(n.activeElement).blur()}catch(r){}},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,n){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=this,r=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(r=e.ui.ddmanager.drop(this,t)),this.dropped&&(r=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!r||"valid"===this.options.revert&&r||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){n._trigger("stop",t)!==!1&&n._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper),i=r?e(n.helper.apply(this.element[0],[t])):"clone"===n.helper?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo("parent"===n.appendTo?this.element[0].parentNode:n.appendTo),r&&i[0]===this.element[0]&&this._setPositionRelative(),i[0]===this.element[0]||/(fixed|absolute)/.test(i.css("position"))||i.css("position","absolute"),i},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),n=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==n&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,r,i=this.options,s=this.document[0];return this.relativeContainer=null,i.containment?"window"===i.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===i.containment?(this.containment=[0,0,e(s).width()-this.helperProportions.width-this.margins.left,(e(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):i.containment.constructor===Array?(this.containment=i.containment,void 0):("parent"===i.containment&&(i.containment=this.helper[0].parentNode),n=e(i.containment),r=n[0],r&&(t=/(scroll|auto)/.test(n.css("overflow")),this.containment=[(parseInt(n.css("borderLeftWidth"),10)||0)+(parseInt(n.css("paddingLeft"),10)||0),(parseInt(n.css("borderTopWidth"),10)||0)+(parseInt(n.css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(n.css("borderRightWidth"),10)||0)-(parseInt(n.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(n.css("borderBottomWidth"),10)||0)-(parseInt(n.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=n),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var n="absolute"===e?1:-1,r=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top)*n,left:t.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)*n}},_generatePosition:function(e,t){var n,r,i,s,o=this.options,u=this._isRootNode(this.scrollParent[0]),a=e.pageX,f=e.pageY;return u&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(r=this.relativeContainer.offset(),n=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):n=this.containment,e.pageX-this.offset.click.left<n[0]&&(a=n[0]+this.offset.click.left),e.pageY-this.offset.click.top<n[1]&&(f=n[1]+this.offset.click.top),e.pageX-this.offset.click.left>n[2]&&(a=n[2]+this.offset.click.left),e.pageY-this.offset.click.top>n[3]&&(f=n[3]+this.offset.click.top)),o.grid&&(i=o.grid[1]?this.originalPageY+Math.round((f-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,f=n?i-this.offset.click.top>=n[1]||i-this.offset.click.top>n[3]?i:i-this.offset.click.top>=n[1]?i-o.grid[1]:i+o.grid[1]:i,s=o.grid[0]?this.originalPageX+Math.round((a-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,a=n?s-this.offset.click.left>=n[0]||s-this.offset.click.left>n[2]?s:s-this.offset.click.left>=n[0]?s-o.grid[0]:s+o.grid[0]:s),"y"===o.axis&&(a=this.originalPageX),"x"===o.axis&&(f=this.originalPageY)),{top:f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:u?0:this.offset.scroll.top),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:u?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),r.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n,r){var i=e.extend({},n,{item:r.element});r.sortables=[],e(r.options.connectToSortable).each(function(){var n=e(this).sortable("instance");n&&!n.options.disabled&&(r.sortables.push(n),n.refreshPositions(),n._trigger("activate",t,i))})},stop:function(t,n,r){var i=e.extend({},n,{item:r.element});r.cancelHelperRemoval=!1,e.each(r.sortables,function(){var e=this;e.isOver?(e.isOver=0,r.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,i))})},drag:function(t,n,r){e.each(r.sortables,function(){var i=!1,s=this;s.positionAbs=r.positionAbs,s.helperProportions=r.helperProportions,s.offset.click=r.offset.click,s._intersectsWith(s.containerCache)&&(i=!0,e.each(r.sortables,function(){return this.positionAbs=r.positionAbs,this.helperProportions=r.helperProportions,this.offset.click=r.offset.click,this!==s&&this._intersectsWith(this.containerCache)&&e.contains(s.element[0],this.element[0])&&(i=!1),i})),i?(s.isOver||(s.isOver=1,s.currentItem=n.helper.appendTo(s.element).data("ui-sortable-item",!0),s.options._helper=s.options.helper,s.options.helper=function(){return n.helper[0]},t.target=s.currentItem[0],s._mouseCapture(t,!0),s._mouseStart(t,!0,!0),s.offset.click.top=r.offset.click.top,s.offset.click.left=r.offset.click.left,s.offset.parent.left-=r.offset.parent.left-s.offset.parent.left,s.offset.parent.top-=r.offset.parent.top-s.offset.parent.top,r._trigger("toSortable",t),r.dropped=s.element,e.each(r.sortables,function(){this.refreshPositions()}),r.currentItem=r.element,s.fromOutside=r),s.currentItem&&(s._mouseDrag(t),n.position=s.position)):s.isOver&&(s.isOver=0,s.cancelHelperRemoval=!0,s.options._revert=s.options.revert,s.options.revert=!1,s._trigger("out",t,s._uiHash(s)),s._mouseStop(t,!0),s.options.revert=s.options._revert,s.options.helper=s.options._helper,s.placeholder&&s.placeholder.remove(),r._refreshOffsets(t),n.position=r._generatePosition(t,!0),r._trigger("fromSortable",t),r.dropped=!1,e.each(r.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n,r){var i=e("body"),s=r.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,n,r){var i=r.options;i._cursor&&e("body").css("cursor",i._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("opacity")&&(s._opacity=i.css("opacity")),i.css("opacity",s.opacity)},stop:function(t,n,r){var i=r.options;i._opacity&&e(n.helper).css("opacity",i._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,n){n.scrollParentNotHidden||(n.scrollParentNotHidden=n.helper.scrollParent(!1)),n.scrollParentNotHidden[0]!==n.document[0]&&"HTML"!==n.scrollParentNotHidden[0].tagName&&(n.overflowOffset=n.scrollParentNotHidden.offset())},drag:function(t,n,r){var i=r.options,s=!1,o=r.scrollParentNotHidden[0],u=r.document[0];o!==u&&"HTML"!==o.tagName?(i.axis&&"x"===i.axis||(r.overflowOffset.top+o.offsetHeight-t.pageY<i.scrollSensitivity?o.scrollTop=s=o.scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(o.scrollTop=s=o.scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(r.overflowOffset.left+o.offsetWidth-t.pageX<i.scrollSensitivity?o.scrollLeft=s=o.scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(o.scrollLeft=s=o.scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-e(u).scrollTop()<i.scrollSensitivity?s=e(u).scrollTop(e(u).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(u).scrollTop())<i.scrollSensitivity&&(s=e(u).scrollTop(e(u).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-e(u).scrollLeft()<i.scrollSensitivity?s=e(u).scrollLeft(e(u).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(u).scrollLeft())<i.scrollSensitivity&&(s=e(u).scrollLeft(e(u).scrollLeft()+i.scrollSpeed)))),s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n,r){var i=r.options;r.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!==r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n,r){var i,s,o,u,a,f,l,c,h,p,d=r.options,v=d.snapTolerance,m=n.offset.left,g=m+r.helperProportions.width,y=n.offset.top,b=y+r.helperProportions.height;for(h=r.snapElements.length-1;h>=0;h--)a=r.snapElements[h].left-r.margins.left,f=a+r.snapElements[h].width,l=r.snapElements[h].top-r.margins.top,c=l+r.snapElements[h].height,a-v>g||m>f+v||l-v>b||y>c+v||!e.contains(r.snapElements[h].item.ownerDocument,r.snapElements[h].item)?(r.snapElements[h].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=!1):("inner"!==d.snapMode&&(i=v>=Math.abs(l-b),s=v>=Math.abs(c-y),o=v>=Math.abs(a-g),u=v>=Math.abs(f-m),i&&(n.position.top=r._convertPositionTo("relative",{top:l-r.helperProportions.height,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a-r.helperProportions.width}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f}).left)),p=i||s||o||u,"outer"!==d.snapMode&&(i=v>=Math.abs(l-y),s=v>=Math.abs(c-b),o=v>=Math.abs(a-m),u=v>=Math.abs(f-g),i&&(n.position.top=r._convertPositionTo("relative",{top:l,left:0}).top),s&&(n.position.top=r._convertPositionTo("relative",{top:c-r.helperProportions.height,left:0}).top),o&&(n.position.left=r._convertPositionTo("relative",{top:0,left:a}).left),u&&(n.position.left=r._convertPositionTo("relative",{top:0,left:f-r.helperProportions.width}).left)),!r.snapElements[h].snapping&&(i||s||o||u||p)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[h].item})),r.snapElements[h].snapping=i||s||o||u||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,n,r){var i,s=r.options,o=e.makeArray(e(s.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});o.length&&(i=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",i+t)}),this.css("zIndex",i+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n,r){var i=e(n.helper),s=r.options;i.css("zIndex")&&(s._zIndex=i.css("zIndex")),i.css("zIndex",s.zIndex)},stop:function(t,n,r){var i=r.options;i._zIndex&&e(n.helper).css("zIndex",i._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,n){if("hidden"===e(t).css("overflow"))return!1;var r=n&&"left"===n?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},_create:function(){var t,n,r,i,s,o=this,u=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!u.aspectRatio,aspectRatio:u.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:u.helper||u.ghost||u.animate?u.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=u.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},n=0;t.length>n;n++)r=e.trim(t[n]),s="ui-resizable-"+r,i=e("<div class='ui-resizable-handle "+s+"'></div>"),i.css({zIndex:u.zIndex}),"se"===r&&i.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[r]=".ui-resizable-"+r,this.element.append(i);this._renderAxis=function(t){var n,r,i,s;t=t||this.element;for(n in this.handles)this.handles[n].constructor===String&&(this.handles[n]=this.element.children(this.handles[n]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(r=e(this.handles[n],this.element),s=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth(),i=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),e(this.handles[n]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=i&&i[1]?i[1]:"se")}),u.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){u.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){u.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,n=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(n(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),n(this.originalElement),this},_mouseCapture:function(t){var n,r,i=!1;for(n in this.handles)r=e(this.handles[n])[0],(r===t.target||e.contains(r,t.target))&&(i=!0);return!this.options.disabled&&i},_mouseStart:function(t){var n,r,i,s=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),n=this._num(this.helper.css("left")),r=this._num(this.helper.css("top")),s.containment&&(n+=e(s.containment).scrollLeft()||0,r+=e(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:r},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:n,top:r},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,i=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===i?this.axis+"-resize":i),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var n,r,i=this.originalMousePosition,s=this.axis,o=t.pageX-i.left||0,u=t.pageY-i.top||0,a=this._change[s];return this._updatePrevProperties(),a?(n=a.apply(this,[t,o,u]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(n=this._updateRatio(n,t)),n=this._respectSize(n,t),this._updateCache(n),this._propagate("resize",t),r=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var n,r,i,s,o,u,a,f=this.options,l=this;return this._helper&&(n=this._proportionallyResizeElements,r=n.length&&/textarea/i.test(n[0].nodeName),i=r&&this._hasScroll(n[0],"left")?0:l.sizeDiff.height,s=r?0:l.sizeDiff.width,o={width:l.helper.width()-s,height:l.helper.height()-i},u=parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left)||null,a=parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top)||null,f.animate||this.element.css(e.extend(o,{top:a,left:u})),l.helper.height(l.size.height),l.helper.width(l.size.width),this._helper&&!f.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,n,r,i,s,o=this.options;s={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=s.minHeight*this.aspectRatio,r=s.minWidth/this.aspectRatio,n=s.maxHeight*this.aspectRatio,i=s.maxWidth/this.aspectRatio,t>s.minWidth&&(s.minWidth=t),r>s.minHeight&&(s.minHeight=r),s.maxWidth>n&&(s.maxWidth=n),s.maxHeight>i&&(s.maxHeight=i)),this._vBoundaries=s},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,n=this.size,r=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===r&&(e.left=t.left+(n.width-e.width),e.top=null),"nw"===r&&(e.top=t.top+(n.height-e.height),e.left=t.left+(n.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,n=this.axis,r=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,i=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,s=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,u=this.originalPosition.left+this.originalSize.width,a=this.position.top+this.size.height,f=/sw|nw|w/.test(n),l=/nw|ne|n/.test(n);return s&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),i&&(e.height=t.maxHeight),s&&f&&(e.left=u-t.minWidth),r&&f&&(e.left=u-t.maxWidth),o&&l&&(e.top=a-t.minHeight),i&&l&&(e.top=a-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,n=[],r=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],i=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)n[t]=parseInt(r[t],10)||0,n[t]+=parseInt(i[t],10)||0;return{height:n[0]+n[2],width:n[1]+n[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,n=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:n.height()-this.outerDimensions.height||0,width:n.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var n=this.originalSize,r=this.originalPosition;return{left:r.left+t,width:n.width-t}},n:function(e,t,n){var r=this.originalSize,i=this.originalPosition;return{top:i.top+n,height:r.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),"resize"!==t&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var n=e(this).resizable("instance"),r=n.options,i=n._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&n._hasScroll(i[0],"left")?0:n.sizeDiff.height,u=s?0:n.sizeDiff.width,a={width:n.size.width-u,height:n.size.height-o},f=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,l=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(a,l&&f?{top:l,left:f}:{}),{duration:r.animateDuration,easing:r.animateEasing,step:function(){var r={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};i&&i.length&&e(i[0]).css({width:r.width,height:r.height}),n._updateCache(r),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,n,r,i,s,o,u,a=e(this).resizable("instance"),f=a.options,l=a.element,c=f.containment,h=c instanceof e?c.get(0):/parent/.test(c)?l.parent().get(0):c;h&&(a.containerElement=e(h),/document/.test(c)||c===document?(a.containerOffset={left:0,top:0},a.containerPosition={left:0,top:0},a.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(h),n=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){n[e]=a._num(t.css("padding"+r))}),a.containerOffset=t.offset(),a.containerPosition=t.position(),a.containerSize={height:t.innerHeight()-n[3],width:t.innerWidth()-n[1]},r=a.containerOffset,i=a.containerSize.height,s=a.containerSize.width,o=a._hasScroll(h,"left")?h.scrollWidth:s,u=a._hasScroll(h)?h.scrollHeight:i,a.parentData={element:h,left:r.left,top:r.top,width:o,height:u}))},resize:function(t){var n,r,i,s,o=e(this).resizable("instance"),u=o.options,a=o.containerOffset,f=o.position,l=o._aspectRatio||t.shiftKey,c={top:0,left:0},h=o.containerElement,p=!0;h[0]!==document&&/static/.test(h.css("position"))&&(c=a),f.left<(o._helper?a.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-a.left:o.position.left-c.left),l&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=u.helper?a.left:0),f.top<(o._helper?a.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-a.top:o.position.top),l&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?a.top:0),i=o.containerElement.get(0)===o.element.parent().get(0),s=/relative|absolute/.test(o.containerElement.css("position")),i&&s?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),n=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-c.left:o.offset.left-a.left)),r=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-c.top:o.offset.top-a.top)),n+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-n,l&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),r+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-r,l&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),n=t.options,r=t.containerOffset,i=t.containerPosition,s=t.containerElement,o=e(t.helper),u=o.offset(),a=o.outerWidth()-t.sizeDiff.width,f=o.outerHeight()-t.sizeDiff.height;t._helper&&!n.animate&&/relative/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f}),t._helper&&!n.animate&&/static/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),n=t.options,r=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof n.alsoResize||n.alsoResize.parentNode?r(n.alsoResize):n.alsoResize.length?(n.alsoResize=n.alsoResize[0],r(n.alsoResize)):e.each(n.alsoResize,function(e){r(e)})},resize:function(t,n){var r=e(this).resizable("instance"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0},a=function(t,r){e(t).each(function(){var t=e(this),i=e(this).data("ui-resizable-alsoresize"),s={},o=r&&r.length?r:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var n=(i[t]||0)+(u[t]||0);n&&n>=0&&(s[t]=n||null)}),t.css(s)})};"object"!=typeof i.alsoResize||i.alsoResize.nodeType?a(i.alsoResize):e.each(i.alsoResize,function(e,t){a(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),n=t.options,r=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:r.height,width:r.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof n.ghost?n.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,n=e(this).resizable("instance"),r=n.options,i=n.size,s=n.originalSize,o=n.originalPosition,u=n.axis,a="number"==typeof r.grid?[r.grid,r.grid]:r.grid,f=a[0]||1,l=a[1]||1,c=Math.round((i.width-s.width)/f)*f,h=Math.round((i.height-s.height)/l)*l,p=s.width+c,d=s.height+h,v=r.maxWidth&&p>r.maxWidth,m=r.maxHeight&&d>r.maxHeight,g=r.minWidth&&r.minWidth>p,y=r.minHeight&&r.minHeight>d;r.grid=a,g&&(p+=f),y&&(d+=l),v&&(p-=f),m&&(d-=l),/^(se|s|e)$/.test(u)?(n.size.width=p,n.size.height=d):/^(ne)$/.test(u)?(n.size.width=p,n.size.height=d,n.position.top=o.top-h):/^(sw)$/.test(u)?(n.size.width=p,n.size.height=d,n.position.left=o.left-c):((0>=d-l||0>=p-f)&&(t=n._getPaddingPlusBorderDimensions(this)),d-l>0?(n.size.height=d,n.position.top=o.top-h):(d=l-t.height,n.size.height=d,n.position.top=o.top+s.height-d),p-f>0?(n.size.width=p,n.position.left=o.left-c):(p=f-t.width,n.size.width=p,n.position.left=o.left+s.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var n=e(this).css(t).offset().top;0>n&&e(this).css("top",t.top-n)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var n,r=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{n=this.document[0].activeElement,n&&"body"!==n.nodeName.toLowerCase()&&e(n).blur()}catch(i){}this._hide(this.uiDialog,this.options.hide,function(){r._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,n){var r=!1,i=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),s=Math.max.apply(null,i);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),r=!0),r&&!n&&this._trigger("focus",t),r},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function n(){var t=this.document[0].activeElement,n=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);n||this._focusTabbable()}t.preventDefault(),n.call(this),this._delay(n)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var n=this.uiDialog.find(":tabbable"),r=n.filter(":first"),i=n.filter(":last");t.target!==i[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==r[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){i.focus()}),t.preventDefault()):(this._delay(function(){r.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,n=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(n)||e.isArray(n)&&!n.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(n,function(n,r){var i,s;r=e.isFunction(r)?{click:r,text:n}:r,r=e.extend({type:"button"},r),i=r.click,r.click=function(){i.apply(t.element[0],arguments)},s={icons:r.icons,text:r.showText},delete r.icons,delete r.showText,e("<button></button>",r).button(s).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var n=this,r=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(r,i){e(this).addClass("ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",r,t(i))},drag:function(e,r){n._trigger("drag",e,t(r))},stop:function(i,s){var o=s.offset.left-n.document.scrollLeft(),u=s.offset.top-n.document.scrollTop();r.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(u>=0?"+":"")+u,of:n.window},e(this).removeClass("ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",i,t(s))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var n=this,r=this.options,i=r.resizable,s=this.uiDialog.css("position"),o="string"==typeof i?i:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:r.maxWidth,maxHeight:r.maxHeight,minWidth:r.minWidth,minHeight:this._minHeight(),handles:o,start:function(r,i){e(this).addClass("ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",r,t(i))},resize:function(e,r){n._trigger("resize",e,t(r))},stop:function(i,s){var o=n.uiDialog.offset(),u=o.left-n.document.scrollLeft(),a=o.top-n.document.scrollTop();r.height=n.uiDialog.height(),r.width=n.uiDialog.width(),r.position={my:"left top",at:"left"+(u>=0?"+":"")+u+" "+"top"+(a>=0?"+":"")+a,of:n.window},e(this).removeClass("ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",i,t(s))}}).css("position",s)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),n=e.inArray(this,t);-1!==n&&t.splice(n,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var n=this,r=!1,i={};e.each(t,function(e,t){n._setOption(e,t),e in n.sizeRelatedOptions&&(r=!0),e in n.resizableRelatedOptions&&(i[e]=t)}),r&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",i)},_setOption:function(e,t){var n,r,i=this.uiDialog;"dialogClass"===e&&i.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(n=i.is(":data(ui-draggable)"),n&&!t&&i.draggable("destroy"),!n&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(r=i.is(":data(ui-resizable)"),r&&!t&&i.resizable("destroy"),r&&"string"==typeof t&&i.resizable("option","handles",t),r||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,n,r=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),r.minWidth>r.width&&(r.width=r.minWidth),e=this.uiDialog.css({height:"auto",width:r.width}).outerHeight(),t=Math.max(0,r.minHeight-e),n="number"==typeof r.maxHeight?Math.max(0,r.maxHeight-e):"none","auto"===r.height?this.element.css({minHeight:t,maxHeight:n,height:"auto"}):this.element.height(Math.max(0,r.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,n=this.options,r=n.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(r)?r:function(e){return e.is(r)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(n.scope),n.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){if("accept"===t)this.accept=e.isFunction(n)?n:function(e){return e.is(n)};else if("scope"===t){var r=e.ui.ddmanager.droppables[this.options.scope];this._splice(r),this._addToManager(n)}this._super(t,n)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current,i=!1;return r&&(r.currentItem||r.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var n=e(this).droppable("instance");return n.options.greedy&&!n.options.disabled&&n.options.scope===r.options.scope&&n.accept.call(n.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(n,{offset:n.element.offset()}),n.options.tolerance,t)?(i=!0,!1):void 0}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,n){return e>=t&&t+n>e}return function(t,n,r,i){if(!n.offset)return!1;var s=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,u=s+t.helperProportions.width,a=o+t.helperProportions.height,f=n.offset.left,l=n.offset.top,c=f+n.proportions().width,h=l+n.proportions().height;switch(r){case"fit":return s>=f&&c>=u&&o>=l&&h>=a;case"intersect":return s+t.helperProportions.width/2>f&&c>u-t.helperProportions.width/2&&o+t.helperProportions.height/2>l&&h>a-t.helperProportions.height/2;case"pointer":return e(i.pageY,l,n.proportions().height)&&e(i.pageX,f,n.proportions().width);case"touch":return(o>=l&&h>=o||a>=l&&h>=a||l>o&&a>h)&&(s>=f&&c>=s||u>=f&&c>=u||f>s&&u>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r,i,s=e.ui.ddmanager.droppables[t.options.scope]||[],o=n?n.type:null,u=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(r=0;s.length>r;r++)if(!(s[r].options.disabled||t&&!s[r].accept.call(s[r].element[0],t.currentItem||t.element))){for(i=0;u.length>i;i++)if(u[i]===s[r].element[0]){s[r].proportions().height=0;continue e}s[r].visible="none"!==s[r].element.css("display"),s[r].visible&&("mousedown"===o&&s[r]._activate.call(s[r],n),s[r].offset=s[r].element.offset(),s[r].proportions({width:s[r].element[0].offsetWidth,height:s[r].element[0].offsetHeight}))}},drop:function(t,n){var r=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,n)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n)))}),r},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var r,i,s,o=e.ui.intersect(t,this,this.options.tolerance,n),u=!o&&this.isover?"isout":o&&!this.isover?"isover":null;u&&(this.options.greedy&&(i=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===i}),s.length&&(r=e(s[0]).droppable("instance"),r.greedyChild="isover"===u)),r&&"isover"===u&&(r.isover=!1,r.isout=!0,r._out.call(r,n)),this[u]=!0,this["isout"===u?"isover":"isout"]=!1,this["isover"===u?"_over":"_out"].call(this,n),r&&"isout"===u&&(r.isout=!1,r.isover=!0,r._over.call(r,n)))}})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function n(e,t,n){var r=c[t.type]||{};return null==e?n||!t.def?null:t.def:(e=r.floor?~~e:parseFloat(e),isNaN(e)?t.def:r.mod?(e+r.mod)%r.mod:0>e?0:e>r.max?r.max:e)}function r(n){var r=f(),i=r._rgba=[];return n=n.toLowerCase(),d(a,function(e,s){var o,u=s.re.exec(n),a=u&&s.parse(u),f=s.space||"rgba";return a?(o=r[f](a),r[l[f].cache]=o[l[f].cache],i=r._rgba=o._rgba,!1):t}),i.length?("0,0,0,0"===i.join()&&e.extend(i,s.transparent),r):s[n]}function i(e,t,n){return n=(n+1)%1,1>6*n?e+6*(t-e)*n:1>2*n?t:2>3*n?e+6*(t-e)*(2/3-n):e}var s,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",u=/^([\-+])=\s*(\d+\.?\d*)/,a=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],f=e.Color=function(t,n,r,i){return new e.Color.fn.parse(t,n,r,i)},l={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},h=f.support={},p=e("<p>")[0],d=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",h.rgba=p.style.backgroundColor.indexOf("rgba")>-1,d(l,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),f.fn=e.extend(f.prototype,{parse:function(i,o,u,a){if(i===t)return this._rgba=[null,null,null,null],this;(i.jquery||i.nodeType)&&(i=e(i).css(o),o=t);var c=this,h=e.type(i),p=this._rgba=[];return o!==t&&(i=[i,o,u,a],h="array"),"string"===h?this.parse(r(i)||s._default):"array"===h?(d(l.rgba.props,function(e,t){p[t.idx]=n(i[t.idx],t)}),this):"object"===h?(i instanceof f?d(l,function(e,t){i[t.cache]&&(c[t.cache]=i[t.cache].slice())}):d(l,function(t,r){var s=r.cache;d(r.props,function(e,t){if(!c[s]&&r.to){if("alpha"===e||null==i[e])return;c[s]=r.to(c._rgba)}c[s][t.idx]=n(i[e],t,!0)}),c[s]&&0>e.inArray(null,c[s].slice(0,3))&&(c[s][3]=1,r.from&&(c._rgba=r.from(c[s])))}),this):t},is:function(e){var n=f(e),r=!0,i=this;return d(l,function(e,s){var o,u=n[s.cache];return u&&(o=i[s.cache]||s.to&&s.to(i._rgba)||[],d(s.props,function(e,n){return null!=u[n.idx]?r=u[n.idx]===o[n.idx]:t})),r}),r},_space:function(){var e=[],t=this;return d(l,function(n,r){t[r.cache]&&e.push(n)}),e.pop()},transition:function(e,t){var r=f(e),i=r._space(),s=l[i],o=0===this.alpha()?f("transparent"):this,u=o[s.cache]||s.to(o._rgba),a=u.slice();return r=r[s.cache],d(s.props,function(e,i){var s=i.idx,o=u[s],f=r[s],l=c[i.type]||{};null!==f&&(null===o?a[s]=f:(l.mod&&(f-o>l.mod/2?o+=l.mod:o-f>l.mod/2&&(o-=l.mod)),a[s]=n((f-o)*t+o,i)))}),this[i](a)},blend:function(t){if(1===this._rgba[3])return this;var n=this._rgba.slice(),r=n.pop(),i=f(t)._rgba;return f(e.map(n,function(e,t){return(1-r)*i[t]+r*e}))},toRgbaString:function(){var t="rgba(",n=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===n[3]&&(n.pop(),t="rgb("),t+n.join()+")"},toHslaString:function(){var t="hsla(",n=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===n[3]&&(n.pop(),t="hsl("),t+n.join()+")"},toHexString:function(t){var n=this._rgba.slice(),r=n.pop();return t&&n.push(~~(255*r)),"#"+e.map(n,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,l.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,n,r=e[0]/255,i=e[1]/255,s=e[2]/255,o=e[3],u=Math.max(r,i,s),a=Math.min(r,i,s),f=u-a,l=u+a,c=.5*l;return t=a===u?0:r===u?60*(i-s)/f+360:i===u?60*(s-r)/f+120:60*(r-i)/f+240,n=0===f?0:.5>=c?f/l:f/(2-l),[Math.round(t)%360,n,c,null==o?1:o]},l.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,n=e[1],r=e[2],s=e[3],o=.5>=r?r*(1+n):r+n-r*n,u=2*r-o;return[Math.round(255*i(u,o,t+1/3)),Math.round(255*i(u,o,t)),Math.round(255*i(u,o,t-1/3)),s]},d(l,function(r,i){var s=i.props,o=i.cache,a=i.to,l=i.from;f.fn[r]=function(r){if(a&&!this[o]&&(this[o]=a(this._rgba)),r===t)return this[o].slice();var i,u=e.type(r),c="array"===u||"object"===u?r:arguments,h=this[o].slice();return d(s,function(e,t){var r=c["object"===u?e:t.idx];null==r&&(r=h[t.idx]),h[t.idx]=n(r,t)}),l?(i=f(l(h)),i[o]=h,i):f(h)},d(s,function(t,n){f.fn[t]||(f.fn[t]=function(i){var s,o=e.type(i),a="alpha"===t?this._hsla?"hsla":"rgba":r,f=this[a](),l=f[n.idx];return"undefined"===o?l:("function"===o&&(i=i.call(this,l),o=e.type(i)),null==i&&n.empty?this:("string"===o&&(s=u.exec(i),s&&(i=l+parseFloat(s[2])*("+"===s[1]?1:-1))),f[n.idx]=i,this[a](f)))})})}),f.hook=function(t){var n=t.split(" ");d(n,function(t,n){e.cssHooks[n]={set:function(t,i){var s,o,u="";if("transparent"!==i&&("string"!==e.type(i)||(s=r(i)))){if(i=f(s||i),!h.rgba&&1!==i._rgba[3]){for(o="backgroundColor"===n?t.parentNode:t;(""===u||"transparent"===u)&&o&&o.style;)try{u=e.css(o,"backgroundColor"),o=o.parentNode}catch(a){}i=i.blend(u&&"transparent"!==u?u:"_default")}i=i.toRgbaString()}try{t.style[n]=i}catch(a){}}},e.fx.step[n]=function(t){t.colorInit||(t.start=f(t.elem,n),t.end=f(t.end),t.colorInit=!0),e.cssHooks[n].set(t.elem,t.start.transition(t.end,t.pos))}})},f.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return d(["Top","Right","Bottom","Left"],function(n,r){t["border"+r+"Color"]=e}),t}},s=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var n,r,i=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,s={};if(i&&i.length&&i[0]&&i[i[0]])for(r=i.length;r--;)n=i[r],"string"==typeof i[n]&&(s[e.camelCase(n)]=i[n]);else for(n in i)"string"==typeof i[n]&&(s[n]=i[n]);return s}function n(t,n){var r,s,o={};for(r in n)s=n[r],t[r]!==s&&(i[r]||(e.fx.step[r]||!isNaN(parseFloat(s)))&&(o[r]=s));return o}var r=["add","remove","toggle"],i={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,n){e.fx.step[n]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,n,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(i,s,o,u){var a=e.speed(s,o,u);return this.queue(function(){var s,o=e(this),u=o.attr("class")||"",f=a.children?o.find("*").addBack():o;f=f.map(function(){var n=e(this);return{el:n,start:t(this)}}),s=function(){e.each(r,function(e,t){i[t]&&o[t+"Class"](i[t])})},s(),f=f.map(function(){return this.end=t(this.el[0]),this.diff=n(this.start,this.end),this}),o.attr("class",u),f=f.map(function(){var t=this,n=e.Deferred(),r=e.extend({},a,{queue:!1,complete:function(){n.resolve(t)}});return this.el.animate(this.diff,r),n.promise()}),e.when.apply(e,f.get()).done(function(){s(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),a.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(n,r,i,s){return r?e.effects.animateClass.call(this,{add:n},r,i,s):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(n,r,i,s){return arguments.length>1?e.effects.animateClass.call(this,{remove:n},r,i,s):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(n,r,i,s,o){return"boolean"==typeof r||void 0===r?i?e.effects.animateClass.call(this,r?{add:n}:{remove:n},i,s,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:n},r,i,s)}}(e.fn.toggleClass),switchClass:function(t,n,r,i,s){return e.effects.animateClass.call(this,{add:n,remove:t},r,i,s)}})}(),function(){function t(t,n,r,i){return e.isPlainObject(t)&&(n=t,t=t.effect),t={effect:t},null==n&&(n={}),e.isFunction(n)&&(i=n,r=null,n={}),("number"==typeof n||e.fx.speeds[n])&&(i=r,r=n,n={}),e.isFunction(r)&&(i=r,r=null),n&&e.extend(t,n),r=r||n.duration,t.duration=e.fx.off?0:"number"==typeof r?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,t.complete=i||n.complete,t}function n(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.3",save:function(e,t){for(var n=0;t.length>n;n++)null!==t[n]&&e.data(y+t[n],e[0].style[t[n]])},restore:function(e,t){var n,r;for(r=0;t.length>r;r++)null!==t[r]&&(n=e.data(y+t[r]),void 0===n&&(n=""),e.css(t[r],n))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(o){s=document.body}return t.wrap(r),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),r=t.parent(),"static"===t.css("position")?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(i),r.css(n).show()},removeWrapper:function(t){var n=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===n||e.contains(t[0],n))&&e(n).focus()),t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(){function n(t){function n(){e.isFunction(s)&&s.call(i[0]),e.isFunction(t)&&t()}var i=e(this),s=r.complete,u=r.mode;(i.is(":hidden")?"hide"===u:"show"===u)?(i[u](),n()):o.call(i[0],r,n)}var r=t.apply(this,arguments),i=r.mode,s=r.queue,o=e.effects.effect[r.effect];return e.fx.off||!o?i?this[i](r.duration,r.complete):this.each(function(){r.complete&&r.complete.call(this)}):s===!1?this.each(n):this.queue(s||"fx",n)},show:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(r){if(n(r))return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(r){if(n(r)||"boolean"==typeof r)return e.apply(this,arguments);var i=t.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,n){t[n]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,n=4;((t=Math.pow(2,--n))-1)/11>e;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?n(2*e)/2:1-n(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,n){var r,i,s,o=e(this),u=/up|down|vertical/,a=/up|left|vertical|horizontal/,f=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(o,t.mode||"hide"),c=t.direction||"up",h=u.test(c),p=h?"height":"width",d=h?"top":"left",v=a.test(c),m={},g="show"===l;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),f):e.effects.save(o,f),o.show(),r=e.effects.createWrapper(o).css({overflow:"hidden"}),i=r[p](),s=parseFloat(r.css(d))||0,m[p]=g?i:0,v||(o.css(h?"bottom":"right",0).css(h?"top":"left","auto").css({position:"absolute"}),m[d]=g?s:i+s),g&&(r.css(p,0),v||r.css(d,s+i)),r.animate(m,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===l&&o.hide(),e.effects.restore(o,f),e.effects.removeWrapper(o),n()}})},e.effects.effect.bounce=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(o,t.mode||"effect"),f="hide"===a,l="show"===a,c=t.direction||"up",h=t.distance,p=t.times||5,d=2*p+(l||f?1:0),v=t.duration/d,m=t.easing,g="up"===c||"down"===c?"top":"left",y="up"===c||"left"===c,b=o.queue(),w=b.length;for((l||f)&&u.push("opacity"),e.effects.save(o,u),o.show(),e.effects.createWrapper(o),h||(h=o["top"===g?"outerHeight":"outerWidth"]()/3),l&&(s={opacity:1},s[g]=0,o.css("opacity",0).css(g,y?2*-h:2*h).animate(s,v,m)),f&&(h/=Math.pow(2,p-1)),s={},s[g]=0,r=0;p>r;r++)i={},i[g]=(y?"-=":"+=")+h,o.animate(i,v,m).animate(s,v,m),h=f?2*h:h/2;f&&(i={opacity:0},i[g]=(y?"-=":"+=")+h,o.animate(i,v,m)),o.queue(function(){f&&o.hide(),e.effects.restore(o,u),e.effects.removeWrapper(o),n()}),w>1&&b.splice.apply(b,[1,0].concat(b.splice(w,d+1))),o.dequeue()},e.effects.effect.clip=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(o,t.mode||"hide"),f="show"===a,l=t.direction||"vertical",c="vertical"===l,h=c?"height":"width",p=c?"top":"left",d={};e.effects.save(o,u),o.show(),r=e.effects.createWrapper(o).css({overflow:"hidden"}),i="IMG"===o[0].tagName?r:o,s=i[h](),f&&(i.css(h,0),i.css(p,s/2)),d[h]=f?s:0,d[p]=f?0:s/2,i.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){f||o.hide(),e.effects.restore(o,u),e.effects.removeWrapper(o),n()}})},e.effects.effect.drop=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(i,t.mode||"hide"),u="show"===o,a=t.direction||"left",f="up"===a||"down"===a?"top":"left",l="up"===a||"left"===a?"pos":"neg",c={opacity:u?1:0};e.effects.save(i,s),i.show(),e.effects.createWrapper(i),r=t.distance||i["top"===f?"outerHeight":"outerWidth"](!0)/2,u&&i.css("opacity",0).css(f,"pos"===l?-r:r),c[f]=(u?"pos"===l?"+=":"-=":"pos"===l?"-=":"+=")+r,i.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}})},e.effects.effect.explode=function(t,n){function r(){b.push(this),b.length===c*h&&i()}function i(){p.css({visibility:"visible"}),e(b).remove(),v||p.hide(),n()}var s,o,u,a,f,l,c=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=c,p=e(this),d=e.effects.setMode(p,t.mode||"hide"),v="show"===d,m=p.show().css("visibility","hidden").offset(),g=Math.ceil(p.outerWidth()/h),y=Math.ceil(p.outerHeight()/c),b=[];for(s=0;c>s;s++)for(a=m.top+s*y,l=s-(c-1)/2,o=0;h>o;o++)u=m.left+o*g,f=o-(h-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*g,top:-s*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g,height:y,left:u+(v?f*g:0),top:a+(v?l*y:0),opacity:v?0:1}).animate({left:u+(v?0:f*g),top:a+(v?0:l*y),opacity:v?1:0},t.duration||500,t.easing,r)},e.effects.effect.fade=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"toggle");r.animate({opacity:i},{queue:!1,duration:t.duration,easing:t.easing,complete:n})},e.effects.effect.fold=function(t,n){var r,i,s=e(this),o=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(s,t.mode||"hide"),a="show"===u,f="hide"===u,l=t.size||15,c=/([0-9]+)%/.exec(l),h=!!t.horizFirst,p=a!==h,d=p?["width","height"]:["height","width"],v=t.duration/2,m={},g={};e.effects.save(s,o),s.show(),r=e.effects.createWrapper(s).css({overflow:"hidden"}),i=p?[r.width(),r.height()]:[r.height(),r.width()],c&&(l=parseInt(c[1],10)/100*i[f?0:1]),a&&r.css(h?{height:0,width:l}:{height:l,width:0}),m[d[0]]=a?i[0]:l,g[d[1]]=a?i[1]:0,r.animate(m,v,t.easing).animate(g,v,t.easing,function(){f&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),n()})},e.effects.effect.highlight=function(t,n){var r=e(this),i=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(r,t.mode||"show"),o={backgroundColor:r.css("backgroundColor")};"hide"===s&&(o.opacity=0),e.effects.save(r,i),r.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&r.hide(),e.effects.restore(r,i),n()}})},e.effects.effect.size=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","width","height","overflow","opacity"],a=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],l=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),d=t.restore||"effect"!==p,v=t.scale||"both",m=t.origin||["middle","center"],g=o.css("position"),y=d?u:a,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),r={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||r):(o.from=t.from||("show"===p?b:r),o.to=t.to||("hide"===p?b:r)),s={from:{y:o.from.height/r.height,x:o.from.width/r.width},to:{y:o.to.height/r.height,x:o.to.width/r.width}},("box"===v||"both"===v)&&(s.from.y!==s.to.y&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,s.from.y,o.from),o.to=e.effects.setTransition(o,c,s.to.y,o.to)),s.from.x!==s.to.x&&(y=y.concat(h),o.from=e.effects.setTransition(o,h,s.from.x,o.from),o.to=e.effects.setTransition(o,h,s.to.x,o.to))),("content"===v||"both"===v)&&s.from.y!==s.to.y&&(y=y.concat(l).concat(f),o.from=e.effects.setTransition(o,l,s.from.y,o.from),o.to=e.effects.setTransition(o,l,s.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(i=e.effects.getBaseline(m,r),o.from.top=(r.outerHeight-o.outerHeight())*i.y,o.from.left=(r.outerWidth-o.outerWidth())*i.x,o.to.top=(r.outerHeight-o.to.outerHeight)*i.y,o.to.left=(r.outerWidth-o.to.outerWidth)*i.x),o.css(o.from),("content"===v||"both"===v)&&(c=c.concat(["marginTop","marginBottom"]).concat(l),h=h.concat(["marginLeft","marginRight"]),f=u.concat(c).concat(h),o.find("*[width]").each(function(){var n=e(this),r={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};d&&e.effects.save(n,f),n.from={height:r.height*s.from.y,width:r.width*s.from.x,outerHeight:r.outerHeight*s.from.y,outerWidth:r.outerWidth*s.from.x},n.to={height:r.height*s.to.y,width:r.width*s.to.x,outerHeight:r.height*s.to.y,outerWidth:r.width*s.to.x},s.from.y!==s.to.y&&(n.from=e.effects.setTransition(n,c,s.from.y,n.from),n.to=e.effects.setTransition(n,c,s.to.y,n.to)),s.from.x!==s.to.x&&(n.from=e.effects.setTransition(n,h,s.from.x,n.from),n.to=e.effects.setTransition(n,h,s.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){d&&e.effects.restore(n,f)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),d||("static"===g?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,n){var r=parseInt(n,10),i=e?o.to.left:o.to.top;return"auto"===n?i+"px":r+i+"px"})})),e.effects.removeWrapper(o),n()}})},e.effects.effect.scale=function(t,n){var r=e(this),i=e.extend(!0,{},t),s=e.effects.setMode(r,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===s?0:100),u=t.direction||"both",a=t.origin,f={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},l={y:"horizontal"!==u?o/100:1,x:"vertical"!==u?o/100:1};i.effect="size",i.queue=!1,i.complete=n,"effect"!==s&&(i.origin=a||["middle","center"],i.restore=!0),i.from=t.from||("show"===s?{height:0,width:0,outerHeight:0,outerWidth:0}:f),i.to={height:f.height*l.y,width:f.width*l.x,outerHeight:f.outerHeight*l.y,outerWidth:f.outerWidth*l.x},i.fade&&("show"===s&&(i.from.opacity=0,i.to.opacity=1),"hide"===s&&(i.from.opacity=1,i.to.opacity=0)),r.effect(i)},e.effects.effect.puff=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"hide"),s="hide"===i,o=parseInt(t.percent,10)||150,u=o/100,a={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:i,complete:n,percent:s?o:100,from:s?a:{height:a.height*u,width:a.width*u,outerHeight:a.outerHeight*u,outerWidth:a.outerWidth*u}}),r.effect(t)},e.effects.effect.pulsate=function(t,n){var r,i=e(this),s=e.effects.setMode(i,t.mode||"show"),o="show"===s,u="hide"===s,a=o||"hide"===s,f=2*(t.times||5)+(a?1:0),l=t.duration/f,c=0,h=i.queue(),p=h.length;for((o||!i.is(":visible"))&&(i.css("opacity",0).show(),c=1),r=1;f>r;r++)i.animate({opacity:c},l,t.easing),c=1-c;i.animate({opacity:c},l,t.easing),i.queue(function(){u&&i.hide(),n()}),p>1&&h.splice.apply(h,[1,0].concat(h.splice(p,f+1))),i.dequeue()},e.effects.effect.shake=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(i,t.mode||"effect"),u=t.direction||"left",a=t.distance||20,f=t.times||3,l=2*f+1,c=Math.round(t.duration/l),h="up"===u||"down"===u?"top":"left",p="up"===u||"left"===u,d={},v={},m={},g=i.queue(),y=g.length;for(e.effects.save(i,s),i.show(),e.effects.createWrapper(i),d[h]=(p?"-=":"+=")+a,v[h]=(p?"+=":"-=")+2*a,m[h]=(p?"-=":"+=")+2*a,i.animate(d,c,t.easing),r=1;f>r;r++)i.animate(v,c,t.easing).animate(m,c,t.easing);i.animate(v,c,t.easing).animate(d,c/2,t.easing).queue(function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}),y>1&&g.splice.apply(g,[1,0].concat(g.splice(y,l+1))),i.dequeue()},e.effects.effect.slide=function(t,n){var r,i=e(this),s=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(i,t.mode||"show"),u="show"===o,a=t.direction||"left",f="up"===a||"down"===a?"top":"left",l="up"===a||"left"===a,c={};e.effects.save(i,s),i.show(),r=t.distance||i["top"===f?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(i).css({overflow:"hidden"}),u&&i.css(f,l?isNaN(r)?"-"+r:-r:r),c[f]=(u?l?"+=":"-=":l?"-=":"+=")+r,i.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&i.hide(),e.effects.restore(i,s),e.effects.removeWrapper(i),n()}})},e.effects.effect.transfer=function(t,n){var r=e(this),i=e(t.to),s="fixed"===i.css("position"),o=e("body"),u=s?o.scrollTop():0,a=s?o.scrollLeft():0,f=i.offset(),l={top:f.top-u,left:f.left-a,height:i.innerHeight(),width:i.innerWidth()},c=r.offset(),h=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:c.top-u,left:c.left-a,height:r.innerHeight(),width:r.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){h.remove(),n()})},e.widget("ui.progressbar",{version:"1.11.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,n=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(n.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,n=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(n.options.filter,n.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this,r=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,t.metaKey||t.ctrlKey||(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().addBack().each(function(){var r,i=e.data(this,"selectable-item");return i?(r=!t.metaKey&&!t.ctrlKey||!i.$element.hasClass("ui-selected"),i.$element.removeClass(r?"ui-unselecting":"ui-selected").addClass(r?"ui-selecting":"ui-unselecting"),i.unselecting=!r,i.selecting=r,i.selected=r,r?n._trigger("selecting",t,{selecting:i.element}):n._trigger("unselecting",t,{unselecting:i.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var n,r=this,i=this.options,s=this.opos[0],o=this.opos[1],u=t.pageX,a=t.pageY;return s>u&&(n=u,u=s,s=n),o>a&&(n=a,a=o,o=n),this.helper.css({left:s,top:o,width:u-s,height:a-o}),this.selectees.each(function(){var n=e.data(this,"selectable-item"),f=!1;n&&n.element!==r.element[0]&&("touch"===i.tolerance?f=!(n.left>u||s>n.right||n.top>a||o>n.bottom):"fit"===i.tolerance&&(f=n.left>s&&u>n.right&&n.top>o&&a>n.bottom),f?(n.selected&&(n.$element.removeClass("ui-selected"),n.selected=!1),n.unselecting&&(n.$element.removeClass("ui-unselecting"),n.unselecting=!1),n.selecting||(n.$element.addClass("ui-selecting"),n.selecting=!0,r._trigger("selecting",t,{selecting:n.element}))):(n.selecting&&((t.metaKey||t.ctrlKey)&&n.startselected?(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.$element.addClass("ui-selected"),n.selected=!0):(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.startselected&&(n.$element.addClass("ui-unselecting"),n.unselecting=!0),r._trigger("unselecting",t,{unselecting:n.element}))),n.selected&&(t.metaKey||t.ctrlKey||n.startselected||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,r._trigger("unselecting",t,{unselecting:n.element})))))}),!1}},_mouseStop:function(t){var n=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.3",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,n){e.preventDefault(),t._setSelection(),t._select(n.item.data("ui-selectmenu-item"),e)},focus:function(e,n){var r=n.item.data("ui-selectmenu-item");null!=t.focusIndex&&r.index!==t.focusIndex&&(t._trigger("focus",e,{item:r}),t.isOpen||t._select(r,e)),t.focusIndex=r.index,t.button.attr("aria-activedescendant",t.menuItems.eq(r.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,n){var r=this,i="";e.each(n,function(n,s){s.optgroup!==i&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(s.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:s.optgroup}).appendTo(t),i=s.optgroup),r._renderItemData(t,s)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,n){var r=e("<li>");return n.disabled&&r.addClass("ui-state-disabled"),this._setText(r,n.label),r.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var n,r,i=".ui-menu-item";this.isOpen?n=this.menuItems.eq(this.focusIndex):(n=this.menuItems.eq(this.element[0].selectedIndex),i+=":not(.ui-state-disabled)"),r="first"===e||"last"===e?n["first"===e?"prevAll":"nextAll"](i).eq(-1):n[e+"All"](i).eq(0),r.length&&this.menuInstance.focus(t,r)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var n=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),n=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),n=!1}n&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var n=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==n&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var n=[];t.each(function(t,r){var i=e(r),s=i.parent("optgroup");n.push({element:i,index:t,value:i.val(),label:i.text(),optgroup:s.attr("label")||"",disabled:s.prop("disabled")||i.prop("disabled")})}),this.items=n},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,n,r=this.options,i=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),s="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(n=r.values&&r.values.length||1,i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;n>t;t++)o.push(s);this.handles=i.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,n="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),n="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(n+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var n,r,i,s,o,u,a,f,l=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),n={x:t.pageX,y:t.pageY},r=this._normValueFromMouse(n),i=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var n=Math.abs(r-l.values(t));(i>n||i===n&&(t===l._lastChangedValue||l.values(t)===c.min))&&(i=n,s=e(this),o=t)}),u=this._start(t,o),u===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),a=s.offset(),f=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=f?{left:0,top:0}:{left:t.pageX-a.left-s.width()/2,top:t.pageY-a.top-s.height()/2-(parseInt(s.css("borderTopWidth"),10)||0)-(parseInt(s.css("borderBottomWidth"),10)||0)+(parseInt(s.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return"horizontal"===this.orientation?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),0>r&&(r=0),"vertical"===this.orientation&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&n>r||1===t&&r>n)&&(n=r),n!==this.values(t)&&(i=this.values(),i[t]=n,s=this._trigger("slide",e,{handle:this.handles[t],value:n,values:i}),r=this.values(t?0:1),s!==!1&&this.values(t,n))):n!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:n}),s!==!1&&this.value(n))},_stop:function(e,t){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("stop",e,n)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,n)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,n){var r,i,s;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(r=this.options.values,i=arguments[0],s=0;r.length>s;s+=1)r[s]=this._trimAlignValue(i[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,n){var r,i=0;switch("range"===t&&this.options.range===!0&&("min"===n?(this.options.value=this._values(0),this.options.values=null):"max"===n&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(i=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!n),this._super(t,n),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===n?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),r=0;i>r;r+=1)this._change(null,r);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,n,r;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(n=this.options.values.slice(),r=0;n.length>r;r+=1)n[r]=this._trimAlignValue(n[r]);return n}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return 2*Math.abs(n)>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),n=this.options.step,r=Math.floor((e-t)/n)*n;e=r+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,n=t.indexOf(".");return-1===n?0:t.length-n-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,n,r,i,s,o=this.options.range,u=this.options,a=this,f=this._animateOff?!1:u.animate,l={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=100*((a.values(r)-a._valueMin())/(a._valueMax()-a._valueMin())),l["horizontal"===a.orientation?"left":"bottom"]=n+"%",e(this).stop(1,1)[f?"animate":"css"](l,u.animate),a.options.range===!0&&("horizontal"===a.orientation?(0===r&&a.range.stop(1,1)[f?"animate":"css"]({left:n+"%"},u.animate),1===r&&a.range[f?"animate":"css"]({width:n-t+"%"},{queue:!1,duration:u.animate})):(0===r&&a.range.stop(1,1)[f?"animate":"css"]({bottom:n+"%"},u.animate),1===r&&a.range[f?"animate":"css"]({height:n-t+"%"},{queue:!1,duration:u.animate}))),t=n}):(r=this.value(),i=this._valueMin(),s=this._valueMax(),n=s!==i?100*((r-i)/(s-i)):0,l["horizontal"===this.orientation?"left":"bottom"]=n+"%",this.handle.stop(1,1)[f?"animate":"css"](l,u.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[f?"animate":"css"]({width:n+"%"},u.animate),"max"===o&&"horizontal"===this.orientation&&this.range[f?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:u.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[f?"animate":"css"]({height:n+"%"},u.animate),"max"===o&&"vertical"===this.orientation&&this.range[f?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:u.animate}))},_handleEvents:{keydown:function(t){var n,r,i,s,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),n=this._start(t,o),n===!1))return}switch(s=this.options.step,r=i=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:i=this._valueMin();break;case e.ui.keyCode.END:i=this._valueMax();break;case e.ui.keyCode.PAGE_UP:i=this._trimAlignValue(r+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(r-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(r===this._valueMax())return;i=this._trimAlignValue(r+s);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(r===this._valueMin())return;i=this._trimAlignValue(r-s)}this._slide(t,o,i)},keyup:function(t){var n=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,n),this._change(t,n),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,n){return e>=t&&t+n>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,n){var r=null,i=!1,s=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,s.widgetName+"-item")===s?(r=e(this),!1):void 0}),e.data(t.target,s.widgetName+"-item")===s&&(r=e(t.target)),r?!this.options.handle||n||(e(this.options.handle,r).find("*").addBack().each(function(){this===t.target&&(i=!0)}),i)?(this.currentItem=r,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,n,r){var i,s,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(s=this.document.find("body"),this.storedCursor=s.css("cursor"),s.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(s)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var n,r,i,s,o=this.options,u=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?u=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(u=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?u=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(u=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),u!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),n=this.items.length-1;n>=0;n--)if(r=this.items[n],i=r.item[0],s=this._intersectsWithPointer(r),s&&r.instance===this.currentContainer&&i!==this.currentItem[0]&&this.placeholder[1===s?"next":"prev"]()[0]!==i&&!e.contains(this.placeholder[0],i)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],i):!0)){if(this.direction=1===s?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(r))break;this._rearrange(t,r),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var r=this,i=this.placeholder.offset(),s=this.options.axis,o={};s&&"x"!==s||(o.left=i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),s&&"y"!==s||(o.top=i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c="x"===this.options.axis||r+f>u&&a>r+f,h="y"===this.options.axis||t+l>s&&o>t+l,p=c&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>s&&o>n-this.helperProportions.width/2&&r+this.helperProportions.height/2>u&&a>i-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=t&&n,i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return r?this.floating?s&&"right"===s||"down"===i?2:1:i&&("down"===i?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),n=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection();return this.floating&&i?"right"===i&&n||"left"===i&&!n:r&&("down"===r&&t||"up"===r&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function n(){u.push(this)}var r,i,s,o,u=[],a=[],f=this._connectWith();if(f&&t)for(r=f.length-1;r>=0;r--)for(s=e(f[r],this.document[0]),i=s.length-1;i>=0;i--)o=e.data(s[i],this.widgetFullName),o&&o!==this&&!o.options.disabled&&a.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(a.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),r=a.length-1;r>=0;r--)a[r][0].each(n);return e(u)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;t.length>n;n++)if(t[n]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n,r,i,s,o,u,a,f,l=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--)for(i=e(h[n],this.document[0]),r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(c.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s));for(n=c.length-1;n>=0;n--)for(o=c[n][1],u=c[n][0],r=0,f=u.length;f>r;r++)a=e(u[r]),a.data(this.widgetName+"-item",o),l.push({item:a,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,s;for(n=this.items.length-1;n>=0;n--)r=this.items[n],r.instance!==this.currentContainer&&this.currentContainer&&r.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item,t||(r.width=i.outerWidth(),r.height=i.outerHeight()),s=i.offset(),r.left=s.left,r.top=s.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)s=this.containers[n].element.offset(),this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var n,r=t.options;r.placeholder&&r.placeholder.constructor!==String||(n=r.placeholder,r.placeholder={element:function(){var r=t.currentItem[0].nodeName.toLowerCase(),i=e("<"+r+">",t.document[0]).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===r?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)}):"img"===r&&i.attr("src",t.currentItem.attr("src")),n||i.css("visibility","hidden"),i},update:function(e,i){(!n||r.forcePlaceholderSize)&&(i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(r.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),r.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n,r,i,s,o,u,a,f,l,c,h=null,p=null;for(n=this.containers.length-1;n>=0;n--)if(!e.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(h&&e.contains(this.containers[n].element[0],h.element[0]))continue;h=this.containers[n],p=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",t,this._uiHash(this)),this.containers[n].containerCache.over=0);if(h)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(i=1e4,s=null,l=h.floating||this._isFloating(this.currentItem),o=l?"left":"top",u=l?"width":"height",c=l?"clientX":"clientY",r=this.items.length-1;r>=0;r--)e.contains(this.containers[p].element[0],this.items[r].item[0])&&this.items[r].item[0]!==this.currentItem[0]&&(a=this.items[r].item.offset()[o],f=!1,t[c]-a>this.items[r][u]/2&&(f=!0),i>Math.abs(t[c]-a)&&(i=Math.abs(t[c]-a),s=this.items[r],this.direction=f?"up":"down"));if(!s&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;return r.parents("body").length||e("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width()),(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,r,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),("document"===i.containment||"window"===i.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=e(i.containment)[0],n=e(i.containment).offset(),r="hidden"!==e(t).css("overflow"),this.containment=[n.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,n){n||(n=this.position);var r="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*r}},_generatePosition:function(t){var n,r,i=this.options,s=t.pageX,o=t.pageY,u="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(u[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),i.grid&&(n=this.originalPageY+Math.round((o-this.originalPageY)/i.grid[1])*i.grid[1],o=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n,r=this.originalPageX+Math.round((s-this.originalPageX)/i.grid[0])*i.grid[0],s=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:u.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:u.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(e,t){function n(e,t,n){return function(r){n._trigger(e,r,t._uiHash(t))}}this.reverting=!1;var r,i=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(r in this._storedCSS)("auto"===this._storedCSS[r]||"static"===this._storedCSS[r])&&(this._storedCSS[r]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&i.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||i.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(i.push(function(e){this._trigger("remove",e,this._uiHash())}),i.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),i.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),r=this.containers.length-1;r>=0;r--)t||i.push(n("deactivate",this,this.containers[r])),this.containers[r].containerCache.over&&(i.push(n("out",this,this.containers[r])),this.containers[r].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(r=0;i.length>r;r++)i[r].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},n=this.element;return e.each(["min","max","step"],function(e,r){var i=n.attr(r);void 0!==i&&i.length&&(t[r]=i)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function n(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r}))}var r;r=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),n.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,n.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var n=this.options,r=e.ui.keyCode;switch(t.keyCode){case r.UP:return this._repeat(null,1,t),!0;case r.DOWN:return this._repeat(null,-1,t),!0;case r.PAGE_UP:return this._repeat(null,n.page,t),!0;case r.PAGE_DOWN:return this._repeat(null,-n.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,n){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,n)},e),this._spin(t*this.options.step,n)},_spin:function(e,t){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:n})===!1||(this._value(n),this.counter++)},_increment:function(t){var n=this.options.incremental;return n?e.isFunction(n)?n(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,n=t.indexOf(".");return-1===n?0:t.length-n-1},_adjustValue:function(e){var t,n,r=this.options;return t=null!==r.min?r.min:0,n=e-t,n=Math.round(n/r.step)*r.step,e=t+n,e=parseFloat(e.toFixed(this._precision())),null!==r.max&&e>r.max?r.max:null!==r.min&&r.min>e?r.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var n=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(n)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:a(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var n;""!==e&&(n=this._parse(e),null!==n&&(t||(n=this._adjustValue(n)),e=this._format(n))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:a(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:a(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:a(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:a(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(a(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var n,r;t=t.cloneNode(!1),n=t.href.replace(e,""),r=location.href.replace(e,"");try{n=decodeURIComponent(n)}catch(i){}try{r=decodeURIComponent(r)}catch(i){}return t.hash.length>1&&n===r}}(),_create:function(){var t=this,n=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible),this._processTabs(),n.active=this._initialActive(),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(n.active):e(),this._refresh(),this.active.length&&this.load(n.active)},_initialActive:function(){var t=this.options.active,n=this.options.collapsible,r=location.hash.substring(1);return null===t&&(r&&this.tabs.each(function(n,i){return e(i).attr("aria-controls")===r?(t=n,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=n?!1:0)),!n&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(r),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),t.ctrlKey||t.metaKey||(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,n){function r(){return t>i&&(t=0),0>t&&(t=i),t}for(var i=this.tabs.length-1;-1!==e.inArray(r(),this.options.disabled);)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,n=this.tabs,r=this.anchors,i=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,s,o,u=e(r).uniqueId().attr("id"),a=e(r).closest("li"),f=a.attr("aria-controls");t._isLocal(r)?(i=r.hash,o=i.substring(1),s=t.element.find(t._sanitizeSelector(i))):(o=a.attr("aria-controls")||e({}).uniqueId()[0].id,i="#"+o,s=t.element.find(i),s.length||(s=t._createPanel(o),s.insertAfter(t.panels[n-1]||t.tablist)),s.attr("aria-live","polite")),s.length&&(t.panels=t.panels.add(s)),f&&a.data("ui-tabs-aria-controls",f),a.attr({"aria-controls":o,"aria-labelledby":u}),s.attr("aria-labelledby",u)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),n&&(this._off(n.not(this.tabs)),this._off(r.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n,r=0;n=this.tabs[r];r++)t===!0||-1!==e.inArray(r,t)?e(n).addClass("ui-state-disabled").attr("aria-disabled","true"):e(n).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r=this.element.parent();"fill"===t?(n=r.height(),n-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");"absolute"!==r&&"fixed"!==r&&(n-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1||(n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),f.length||a.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l))},_toggle:function(t,n){function r(){s.running=!1,s._trigger("activate",t,n)}function i(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&s.options.show?s._show(o,s.options.show,r):(o.show(),r())}var s=this,o=n.newPanel,u=n.oldPanel;this.running=!0,u.length&&this.options.hide?this._hide(u,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),i()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u.hide(),i()),u.attr("aria-hidden","true"),n.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&u.length?n.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),n.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);r[0]!==this.active[0]&&(r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var n=this.options.disabled;n!==!1&&(void 0===t?n=!1:(t=this._getIndex(t),n=e.isArray(n)?e.map(n,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,n){return n!==t?n:null})),this._setupDisabled(n))},disable:function(t){var n=this.options.disabled;if(n!==!0){if(void 0===t)n=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,n))return;n=e.isArray(n)?e.merge([t],n).sort():[t]}this._setupDisabled(n)}},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),s=i.find(".ui-tabs-anchor"),o=this._getPanelForTab(i),u={tab:i,panel:o};this._isLocal(s[0])||(this.xhr=e.ajax(this._ajaxSettings(s,n,u)),this.xhr&&"canceled"!==this.xhr.statusText&&(i.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),r._trigger("load",n,u)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)})))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}}),e.widget("ui.tooltip",{version:"1.11.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))},_removeDescribedBy:function(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);-1!==i&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,n){var r=this;return"disabled"===t?(this[n?"_disable":"_enable"](),this.options[t]=n,void 0):(this._super(t,n),"content"===t&&e.each(this.tooltips,function(e,t){r._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r.element[0],t.close(i,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);r.length&&!r.data("ui-tooltip-id")&&(r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&r.parents().each(function(){var t,r=e(this);r.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,n.close(t,!0)),r.attr("title")&&(r.uniqueId(),n.parents[this.id]={element:this,title:r.attr("title")},r.attr("title",""))}),this._updateContent(r,t))},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;return"string"==typeof r?this._open(t,e,r):(n=r.call(e[0],function(n){e.data("ui-tooltip-open")&&i._delay(function(){t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n),void 0)},_open:function(t,n,r){function i(e){l.of=e,o.is(":hidden")||o.position(l)}var s,o,u,a,f,l=e.extend({},this.options.position);if(r){if(s=this._find(n))return s.tooltip.find(".ui-tooltip-content").html(r),void 0;n.is("[title]")&&(t&&"mouseover"===t.type?n.attr("title",""):n.removeAttr("title")),s=this._tooltip(n),o=s.tooltip,this._addDescribedBy(n,o.attr("id")),o.find(".ui-tooltip-content").html(r),this.liveRegion.children().hide(),r.clone?(f=r.clone(),f.removeAttr("id").find("[id]").removeAttr("id")):f=r,e("<div>").html(f).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:i}),i(t)):o.position(e.extend({of:n},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(a=this.delayedShow=setInterval(function(){o.is(":visible")&&(i(l.of),clearInterval(a))},e.fx.interval)),this._trigger("open",t,{tooltip:o}),u={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var r=e.Event(t);r.currentTarget=n[0],this.close(r,!0)}}},n[0]!==this.element[0]&&(u.remove=function(){this._removeTooltip(o)}),t&&"mouseover"!==t.type||(u.mouseleave="close"),t&&"focusin"!==t.type||(u.focusout="close"),this._on(!0,n,u)}},close:function(t){var n,r=this,i=e(t?t.currentTarget:this.element),s=this._find(i);s&&(n=s.tooltip,s.closing||(clearInterval(this.delayedShow),i.data("ui-tooltip-title")&&!i.attr("title")&&i.attr("title",i.data("ui-tooltip-title")),this._removeDescribedBy(i),s.hiding=!0,n.stop(!0),this._hide(n,this.options.hide,function(){r._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,n){e(n.element).attr("title",n.title),delete r.parents[t]}),s.closing=!0,this._trigger("close",t,{tooltip:n}),s.hiding||(s.closing=!1)))},_tooltip:function(t){var n=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),r=n.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[r]={element:t,tooltip:n}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur"),s=r.element;i.target=i.currentTarget=s[0],t.close(i,!0),e("#"+n).remove(),s.data("ui-tooltip-title")&&(s.attr("title")||s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})}),function(e,t){var n=0,r=null,i=[],s=null;e.fn.split=function(o){function y(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=e.match(/^([0-9]+)(px|%)$/);if(t){if(t[2]=="px")return+t[1];if(l.orientation=="vertical")return p*+t[1]/100;if(l.orientation=="horizontal")return d*+t[1]/100}}}var u=this.data("splitter");if(u)return u;var a,f,l=e.extend({limit:100,orientation:"horizontal",position:"50%",invisible:!1,onDragStart:e.noop,onDragEnd:e.noop,onDrag:e.noop},o||{});this.settings=l;var c,h=this.children();l.orientation=="vertical"?(a=h.first().addClass("left_panel"),f=a.next().addClass("right_panel"),c="vsplitter"):l.orientation=="horizontal"&&(a=h.first().addClass("top_panel"),f=a.next().addClass("bottom_panel"),c="hsplitter"),l.invisible&&(c+=" splitter-invisible");var p=this.width(),d=this.height(),v=n++;this.addClass("splitter_panel");var m=e("<div/>").addClass(c).mouseenter(function(){r=v}).mouseleave(function(){r=null}).insertAfter(a),g,b=e.extend(this,{refresh:function(){var e=this.width(),t=this.height();if(p!=e||d!=t)p=this.width(),d=this.height(),b.position(g)},position:function(){return l.orientation=="vertical"?function(e,n){if(e===t)return g;g=y(e);var r=m.width(),i=r/2;if(l.invisible){var s=a.width(g).outerWidth();f.width(b.width()-s),m.css("left",s-i)}else{var s=a.width(g-i).outerWidth();f.width(b.width()-s-r),m.css("left",s)}return n||b.find(".splitter_panel").trigger("splitter.resize"),b}:l.orientation=="horizontal"?function(e,n){if(e===t)return g;g=y(e);var r=m.height(),i=r/2;if(l.invisible){var s=a.height(g).outerHeight();f.height(b.height()-s),m.css("top",s-i)}else{var s=a.height(g-i).outerHeight();f.height(b.height()-s-r),m.css("top",s)}return n||b.find(".splitter_panel").trigger("splitter.resize"),b}:e.noop}(),orientation:l.orientation,limit:l.limit,isActive:function(){return r===v},destroy:function(){b.removeClass("splitter_panel"),m.unbind("mouseenter"),m.unbind("mouseleave"),l.orientation=="vertical"?(a.removeClass("left_panel"),f.removeClass("right_panel")):l.orientation=="horizontal"&&(a.removeClass("top_panel"),f.removeClass("bottom_panel")),b.unbind("splitter.resize"),b.find(".splitter_panel").trigger("splitter.resize"),i[v]=null,m.remove();var t=!1;for(var r=i.length;r--;)if(i[r]!==null){t=!0;break}t||(e(document.documentElement).unbind(".splitter"),e(window).unbind("resize.splitter"),b.data("splitter",null),i=[],n=0)}});b.bind("splitter.resize",function(e){var t=b.position();b.orientation=="vertical"&&t>b.width()?t=b.width()-b.limit-1:b.orientation=="horizontal"&&t>b.height()&&(t=b.height()-b.limit-1),t<b.limit&&(t=b.limit+1),b.position(t,!0)});var w;return l.orientation=="vertical"?w>p-l.limit?w=p-l.limit:w=y(l.position):l.orientation=="horizontal"&&(w>d-l.limit?w=d-l.limit:w=y(l.position)),w<l.limit&&(w=l.limit),b.position(w,!0),i.length==0&&(e(window).bind("resize.splitter",function(){e.each(i,function(e,t){t.refresh()})}),e(document.documentElement).bind("mousedown.splitter",function(t){if(r!==null&&t.which==1)return s=i[r],e('<div class="splitterMask"></div>').css("cursor",m.css("cursor")).insertAfter(s),s.settings.onDragStart(t),!1}).bind("mouseup.splitter",function(t){s&&(e(".splitterMask").remove(),s.settings.onDragEnd(t),s=null)}).bind("mousemove.splitter",function(e){if(s!==null){var t=s.limit,n=s.offset();if(s.orientation=="vertical"){var r=e.pageX-n.left;r<=s.limit?r=s.limit+1:r>=s.width()-t&&(r=s.width()-t-1),r>s.limit&&r<s.width()-t&&(s.position(r,!0),s.find(".splitter_panel").trigger("splitter.resize"),e.preventDefault())}else if(s.orientation=="horizontal"){var i=e.pageY-n.top;i<=s.limit?i=s.limit+1:i>=s.height()-t&&(i=s.height()-t-1),i>s.limit&&i<s.height()-t&&(s.position(i,!0),s.find(".splitter_panel").trigger("splitter.resize"),e.preventDefault())}s.settings.onDrag(e)}})),i.push(b),b.data("splitter",b),b}}(jQuery),define("splitter",["jquery"],function(){});if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(e){function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(void 0!==e.style[n])return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,r=this;e(this).one("bsTransitionEnd",function(){n=!0});var i=function(){n||e(r).trigger(e.support.transition.end)};return setTimeout(i,t),this},e(function(){e.support.transition=t(),e.support.transition&&(e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){return e(t.target).is(this)?t.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(e){function t(t){return this.each(function(){var n=e(this),i=n.data("bs.alert");i||n.data("bs.alert",i=new r(this)),"string"==typeof t&&i[t].call(n)})}var n='[data-dismiss="alert"]',r=function(t){e(t).on("click",n,this.close)};r.VERSION="3.3.2",r.TRANSITION_DURATION=150,r.prototype.close=function(t){function n(){o.detach().trigger("closed.bs.alert").remove()}var i=e(this),s=i.attr("data-target");s||(s=i.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var o=e(s);t&&t.preventDefault(),o.length||(o=i.closest(".alert")),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(r.TRANSITION_DURATION):n())};var i=e.fn.alert;e.fn.alert=t,e.fn.alert.Constructor=r,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",n,r.prototype.close)}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.button"),s="object"==typeof t&&t;i||r.data("bs.button",i=new n(this,s)),"toggle"==t?i.toggle():t&&i.setState(t)})}var n=function(t,r){this.$element=e(t),this.options=e.extend({},n.DEFAULTS,r),this.isLoading=!1};n.VERSION="3.3.2",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var n="disabled",r=this.$element,i=r.is("input")?"val":"html",s=r.data();t+="Text",null==s.resetText&&r.data("resetText",r[i]()),setTimeout(e.proxy(function(){r[i](null==s[t]?this.options[t]:s[t]),"loadingText"==t?(this.isLoading=!0,r.addClass(n).attr(n,n)):this.isLoading&&(this.isLoading=!1,r.removeClass(n).removeAttr(n))},this),0)},n.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var n=this.$element.find("input");"radio"==n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?e=!1:t.find(".active").removeClass("active")),e&&n.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));e&&this.$element.toggleClass("active")};var r=e.fn.button;e.fn.button=t,e.fn.button.Constructor=n,e.fn.button.noConflict=function(){return e.fn.button=r,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(n){var r=e(n.target);r.hasClass("btn")||(r=r.closest(".btn")),t.call(r,"toggle"),n.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){e(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.carousel"),s=e.extend({},n.DEFAULTS,r.data(),"object"==typeof t&&t),o="string"==typeof t?t:s.slide;i||r.data("bs.carousel",i=new n(this,s)),"number"==typeof t?i.to(t):o?i[o]():s.interval&&i.pause().cycle()})}var n=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",e.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",e.proxy(this.pause,this)).on("mouseleave.bs.carousel",e.proxy(this.cycle,this))};n.VERSION="3.3.2",n.TRANSITION_DURATION=600,n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},n.prototype.keydown=function(e){if(!/input|textarea/i.test(e.target.tagName)){switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()}},n.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},n.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},n.prototype.getItemForDirection=function(e,t){var n=this.getItemIndex(t),r="prev"==e&&0===n||"next"==e&&n==this.$items.length-1;if(r&&!this.options.wrap)return t;var i="prev"==e?-1:1,s=(n+i)%this.$items.length;return this.$items.eq(s)},n.prototype.to=function(e){var t=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));return e>this.$items.length-1||0>e?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){t.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",this.$items.eq(e))},n.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){return this.sliding?void 0:this.slide("next")},n.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},n.prototype.slide=function(t,r){var i=this.$element.find(".item.active"),s=r||this.getItemForDirection(t,i),o=this.interval,u="next"==t?"left":"right",f=this;if(s.hasClass("active"))return this.sliding=!1;var l=s[0],h=e.Event("slide.bs.carousel",{relatedTarget:l,direction:u});if(this.$element.trigger(h),!h.isDefaultPrevented()){if(this.sliding=!0,o&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var p=e(this.$indicators.children()[this.getItemIndex(s)]);p&&p.addClass("active")}var d=e.Event("slid.bs.carousel",{relatedTarget:l,direction:u});return e.support.transition&&this.$element.hasClass("slide")?(s.addClass(t),s[0].offsetWidth,i.addClass(u),s.addClass(u),i.one("bsTransitionEnd",function(){s.removeClass([t,u].join(" ")).addClass("active"),i.removeClass(["active",u].join(" ")),f.sliding=!1,setTimeout(function(){f.$element.trigger(d)},0)}).emulateTransitionEnd(n.TRANSITION_DURATION)):(i.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(d)),o&&this.cycle(),this}};var r=e.fn.carousel;e.fn.carousel=t,e.fn.carousel.Constructor=n,e.fn.carousel.noConflict=function(){return e.fn.carousel=r,this};var i=function(n){var r,i=e(this),s=e(i.attr("data-target")||(r=i.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var o=e.extend({},s.data(),i.data()),u=i.attr("data-slide-to");u&&(o.interval=!1),t.call(s,o),u&&s.data("bs.carousel").to(u),n.preventDefault()}};e(document).on("click.bs.carousel.data-api","[data-slide]",i).on("click.bs.carousel.data-api","[data-slide-to]",i),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var n=e(this);t.call(n,n.data())})})}(jQuery),+function(e){function t(t){var n,r=t.attr("data-target")||(n=t.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return e(r)}function n(t){return this.each(function(){var n=e(this),i=n.data("bs.collapse"),s=e.extend({},r.DEFAULTS,n.data(),"object"==typeof t&&t);!i&&s.toggle&&"show"==t&&(s.toggle=!1),i||n.data("bs.collapse",i=new r(this,s)),"string"==typeof t&&i[t]()})}var r=function(t,n){this.$element=e(t),this.options=e.extend({},r.DEFAULTS,n),this.$trigger=e(this.options.trigger).filter('[href="#'+t.id+'"], [data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};r.VERSION="3.3.2",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0,trigger:'[data-toggle="collapse"]'},r.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,i=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(i&&i.length&&(t=i.data("bs.collapse"),t&&t.transitioning))){var s=e.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){i&&i.length&&(n.call(i,"hide"),t||i.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var u=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return u.call(this);var f=e.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",e.proxy(u,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][f])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return e.support.transition?void this.$element[n](0).one("bsTransitionEnd",e.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION):i.call(this)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(n,r){var i=e(r);this.addAriaAndCollapsedClass(t(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(e,t){var n=e.hasClass("in");e.attr("aria-expanded",n),t.toggleClass("collapsed",!n).attr("aria-expanded",n)};var i=e.fn.collapse;e.fn.collapse=n,e.fn.collapse.Constructor=r,e.fn.collapse.noConflict=function(){return e.fn.collapse=i,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(r){var i=e(this);i.attr("data-target")||r.preventDefault();var s=t(i),o=s.data("bs.collapse"),u=o?"toggle":e.extend({},i.data(),{trigger:this});n.call(s,u)})}(jQuery),+function(e){function t(t){t&&3===t.which||(e(i).remove(),e(s).each(function(){var r=e(this),i=n(r),s={relatedTarget:this};i.hasClass("open")&&(i.trigger(t=e.Event("hide.bs.dropdown",s)),t.isDefaultPrevented()||(r.attr("aria-expanded","false"),i.removeClass("open").trigger("hidden.bs.dropdown",s)))}))}function n(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r=n&&e(n);return r&&r.length?r:t.parent()}function r(t){return this.each(function(){var n=e(this),r=n.data("bs.dropdown");r||n.data("bs.dropdown",r=new o(this)),"string"==typeof t&&r[t].call(n)})}var i=".dropdown-backdrop",s='[data-toggle="dropdown"]',o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.VERSION="3.3.2",o.prototype.toggle=function(r){var i=e(this);if(!i.is(".disabled, :disabled")){var s=n(i),o=s.hasClass("open");if(t(),!o){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&e('<div class="dropdown-backdrop"/>').insertAfter(e(this)).on("click",t);var u={relatedTarget:this};if(s.trigger(r=e.Event("show.bs.dropdown",u)),r.isDefaultPrevented())return;i.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger("shown.bs.dropdown",u)}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var r=e(this);if(t.preventDefault(),t.stopPropagation(),!r.is(".disabled, :disabled")){var i=n(r),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(s).trigger("focus"),r.trigger("click");var u=" li:not(.divider):visible a",l=i.find('[role="menu"]'+u+', [role="listbox"]'+u);if(l.length){var h=l.index(t.target);38==t.which&&h>0&&h--,40==t.which&&h<l.length-1&&h++,~h||(h=0),l.eq(h).trigger("focus")}}}};var u=e.fn.dropdown;e.fn.dropdown=r,e.fn.dropdown.Constructor=o,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=u,this},e(document).on("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",s,o.prototype.toggle).on("keydown.bs.dropdown.data-api",s,o.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',o.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',o.prototype.keydown)}(jQuery),+function(e){function t(t,r){return this.each(function(){var i=e(this),s=i.data("bs.modal"),o=e.extend({},n.DEFAULTS,i.data(),"object"==typeof t&&t);s||i.data("bs.modal",s=new n(this,o)),"string"==typeof t?s[t](r):o.show&&s.show(r)})}var n=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};n.VERSION="3.3.2",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},n.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},n.prototype.show=function(t){var r=this,i=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.backdrop(function(){var i=e.support.transition&&r.$element.hasClass("fade");r.$element.parent().length||r.$element.appendTo(r.$body),r.$element.show().scrollTop(0),r.options.backdrop&&r.adjustBackdrop(),r.adjustDialog(),i&&r.$element[0].offsetWidth,r.$element.addClass("in").attr("aria-hidden",!1),r.enforceFocus();var s=e.Event("shown.bs.modal",{relatedTarget:t});i?r.$element.find(".modal-dialog").one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(n.TRANSITION_DURATION):r.$element.trigger("focus").trigger(s)}))},n.prototype.hide=function(t){t&&t.preventDefault(),t=e.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(n.TRANSITION_DURATION):this.hideModal())},n.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||this.$element.trigger("focus")},this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",e.proxy(function(e){27==e.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},n.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},n.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(t){var r=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=e.support.transition&&i;if(this.$backdrop=e('<div class="modal-backdrop '+i+'" />').prependTo(this.$element).on("click.dismiss.bs.modal",e.proxy(function(e){e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){r.removeBackdrop(),t&&t()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):o()}else t&&t()},n.prototype.handleUpdate=function(){this.options.backdrop&&this.adjustBackdrop(),this.adjustDialog()},n.prototype.adjustBackdrop=function(){this.$backdrop.css("height",0).css("height",this.$element[0].scrollHeight)},n.prototype.adjustDialog=function(){var e=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&e?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!e?this.scrollbarWidth:""})},n.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},n.prototype.checkScrollbar=function(){this.bodyIsOverflowing=document.body.scrollHeight>document.documentElement.clientHeight,this.scrollbarWidth=this.measureScrollbar()},n.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},n.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},n.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var r=e.fn.modal;e.fn.modal=t,e.fn.modal.Constructor=n,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(n){var r=e(this),i=r.attr("href"),s=e(r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},s.data(),r.data());r.is("a")&&n.preventDefault(),s.one("show.bs.modal",function(e){e.isDefaultPrevented()||s.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})}),t.call(s,o,this)})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s="object"==typeof t&&t;(i||"destroy"!=t)&&(i||r.data("bs.tooltip",i=new n(this,s)),"string"==typeof t&&i[t]())})}var n=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};n.VERSION="3.3.2",n.TRANSITION_DURATION=150,n.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},n.prototype.init=function(t,n,r){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&e(this.options.viewport.selector||this.options.viewport);for(var i=this.options.trigger.split(" "),s=i.length;s--;){var o=i[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=o){var u="hover"==o?"mouseenter":"focusin",f="hover"==o?"mouseleave":"focusout";this.$element.on(u+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},n.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,r){n[e]!=r&&(t[e]=r)}),t},n.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return n&&n.$tip&&n.$tip.is(":visible")?void (n.hoverState="in"):(n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?void (n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)):n.show())},n.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?void (n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)):n.hide()},n.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var r=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!r)return;var i=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var u="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,l=f.test(u);l&&(u=u.replace(f,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(u).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var h=this.getPosition(),p=s[0].offsetWidth,d=s[0].offsetHeight;if(l){var v=u,m=this.options.container?e(this.options.container):this.$element.parent(),g=this.getPosition(m);u="bottom"==u&&h.bottom+d>g.bottom?"top":"top"==u&&h.top-d<g.top?"bottom":"right"==u&&h.right+p>g.width?"left":"left"==u&&h.left-p<g.left?"right":u,s.removeClass(v).addClass(u)}var y=this.getCalculatedOffset(u,h,p,d);this.applyPlacement(y,u);var b=function(){var e=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==e&&i.leave(i)};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",b).emulateTransitionEnd(n.TRANSITION_DURATION):b()}},n.prototype.applyPlacement=function(t,n){var r=this.tip(),i=r[0].offsetWidth,s=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),u=parseInt(r.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(u)&&(u=0),t.top=t.top+o,t.left=t.left+u,e.offset.setOffset(r[0],e.extend({using:function(e){r.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),r.addClass("in");var f=r[0].offsetWidth,l=r[0].offsetHeight;"top"==n&&l!=s&&(t.top=t.top+s-l);var c=this.getViewportAdjustedDelta(n,t,f,l);c.left?t.left+=c.left:t.top+=c.top;var h=/top|bottom/.test(n),p=h?2*c.left-i+f:2*c.top-s+l,d=h?"offsetWidth":"offsetHeight";r.offset(t),this.replaceArrow(p,r[0][d],h)},n.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},n.prototype.hide=function(t){function r(){"in"!=i.hoverState&&s.detach(),i.$element.removeAttr("aria-describedby").trigger("hidden.bs."+i.type),t&&t()}var i=this,s=this.tip(),o=e.Event("hide.bs."+this.type);return this.$element.trigger(o),o.isDefaultPrevented()?void 0:(s.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",r).emulateTransitionEnd(n.TRANSITION_DURATION):r(),this.hoverState=null,this)},n.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},n.prototype.hasContent=function(){return this.getTitle()},n.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],r="BODY"==n.tagName,i=n.getBoundingClientRect();null==i.width&&(i=e.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var s=r?{top:0,left:0}:t.offset(),o={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},u=r?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},i,o,u,s)},n.prototype.getCalculatedOffset=function(e,t,n,r){return"bottom"==e?{top:t.top+t.height,left:t.left+t.width/2-n/2}:"top"==e?{top:t.top-r,left:t.left+t.width/2-n/2}:"left"==e?{top:t.top+t.height/2-r/2,left:t.left-n}:{top:t.top+t.height/2-r/2,left:t.left+t.width}},n.prototype.getViewportAdjustedDelta=function(e,t,n,r){var i={top:0,left:0};if(!this.$viewport)return i;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var u=t.top-s-o.scroll,a=t.top+s-o.scroll+r;u<o.top?i.top=o.top-u:a>o.top+o.height&&(i.top=o.top+o.height-a)}else{var f=t.left-s,l=t.left+s+n;f<o.left?i.left=o.left-f:l>o.width&&(i.left=o.left+o.width-l)}return i},n.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)},n.prototype.getUID=function(e){do e+=~~(1e6*Math.random());while(document.getElementById(e));return e},n.prototype.tip=function(){return this.$tip=this.$tip||e(this.options.template)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},n.prototype.enable=function(){this.enabled=!0},n.prototype.disable=function(){this.enabled=!1},n.prototype.toggleEnabled=function(){this.enabled=!this.enabled},n.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),n.tip().hasClass("in")?n.leave(n):n.enter(n)},n.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type)})};var r=e.fn.tooltip;e.fn.tooltip=t,e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.popover"),s="object"==typeof t&&t;(i||"destroy"!=t)&&(i||r.data("bs.popover",i=new n(this,s)),"string"==typeof t&&i[t]())})}var n=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");n.VERSION="3.3.2",n.DEFAULTS=e.extend({},e.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),n.prototype.constructor=n,n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof n?"html":"append":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},n.prototype.tip=function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip};var r=e.fn.popover;e.fn.popover=t,e.fn.popover.Constructor=n,e.fn.popover.noConflict=function(){return e.fn.popover=r,this}}(jQuery),+function(e){function t(n,r){var i=e.proxy(this.process,this);this.$body=e("body"),this.$scrollElement=e(e(n).is("body")?window:n),this.options=e.extend({},t.DEFAULTS,r),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",i),this.refresh(),this.process()}function n(n){return this.each(function(){var r=e(this),i=r.data("bs.scrollspy"),s="object"==typeof n&&n;i||r.data("bs.scrollspy",i=new t(this,s)),"string"==typeof n&&i[n]()})}t.VERSION="3.3.2",t.DEFAULTS={offset:10},t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},t.prototype.refresh=function(){var t="offset",n=0;e.isWindow(this.$scrollElement[0])||(t="position",n=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var r=this;this.$body.find(this.selector).map(function(){var r=e(this),i=r.data("target")||r.attr("href"),s=/^#./.test(i)&&e(i);return s&&s.length&&s.is(":visible")&&[[s[t]().top+n,i]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){r.offsets.push(this[0]),r.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.getScrollHeight(),r=this.options.offset+n-this.$scrollElement.height(),i=this.offsets,s=this.targets,o=this.activeTarget;if(this.scrollHeight!=n&&this.refresh(),t>=r)return o!=(e=s[s.length-1])&&this.activate(e);if(o&&t<i[0])return this.activeTarget=null,this.clear();for(e=i.length;e--;)o!=s[e]&&t>=i[e]&&(!i[e+1]||t<=i[e+1])&&this.activate(s[e])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',r=e(n).parents("li").addClass("active");r.parent(".dropdown-menu").length&&(r=r.closest("li.dropdown").addClass("active")),r.trigger("activate.bs.scrollspy")},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=e.fn.scrollspy;e.fn.scrollspy=n,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=r,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.tab");i||r.data("bs.tab",i=new n(this)),"string"==typeof t&&i[t]()})}var n=function(t){this.element=e(t)};n.VERSION="3.3.2",n.TRANSITION_DURATION=150,n.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.data("target");if(r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var i=n.find(".active:last a"),s=e.Event("hide.bs.tab",{relatedTarget:t[0]}),o=e.Event("show.bs.tab",{relatedTarget:i[0]});if(i.trigger(s),t.trigger(o),!o.isDefaultPrevented()&&!s.isDefaultPrevented()){var u=e(r);this.activate(t.closest("li"),n),this.activate(u,u.parent(),function(){i.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:i[0]})})}}},n.prototype.activate=function(t,r,i){function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),u?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}var o=r.find("> .active"),u=i&&e.support.transition&&(o.length&&o.hasClass("fade")||!!r.find("> .fade").length);o.length&&u?o.one("bsTransitionEnd",s).emulateTransitionEnd(n.TRANSITION_DURATION):s(),o.removeClass("in")};var r=e.fn.tab;e.fn.tab=t,e.fn.tab.Constructor=n,e.fn.tab.noConflict=function(){return e.fn.tab=r,this};var i=function(n){n.preventDefault(),t.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),+function(e){function t(t){return this.each(function(){var r=e(this),i=r.data("bs.affix"),s="object"==typeof t&&t;i||r.data("bs.affix",i=new n(this,s)),"string"==typeof t&&i[t]()})}var n=function(t,r){this.options=e.extend({},n.DEFAULTS,r),this.$target=e(this.options.target).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(t),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};n.VERSION="3.3.2",n.RESET="affix affix-top affix-bottom",n.DEFAULTS={offset:0,target:window},n.prototype.getState=function(e,t,n,r){var i=this.$target.scrollTop(),s=this.$element.offset(),o=this.$target.height();if(null!=n&&"top"==this.affixed)return n>i?"top":!1;if("bottom"==this.affixed)return null!=n?i+this.unpin<=s.top?!1:"bottom":e-r>=i+o?!1:"bottom";var u=null==this.affixed,a=u?i:s.top,f=u?o:t;return null!=n&&n>=i?"top":null!=r&&a+f>=e-r?"bottom":!1},n.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(n.RESET).addClass("affix");var e=this.$target.scrollTop(),t=this.$element.offset();return this.pinnedOffset=t.top-e},n.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},n.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),r=this.options.offset,i=r.top,s=r.bottom,o=e("body").height();"object"!=typeof r&&(s=i=r),"function"==typeof i&&(i=r.top(this.$element)),"function"==typeof s&&(s=r.bottom(this.$element));var u=this.getState(o,t,i,s);if(this.affixed!=u){null!=this.unpin&&this.$element.css("top","");var f="affix"+(u?"-"+u:""),l=e.Event(f+".bs.affix");if(this.$element.trigger(l),l.isDefaultPrevented())return;this.affixed=u,this.unpin="bottom"==u?this.getPinnedOffset():null,this.$element.removeClass(n.RESET).addClass(f).trigger(f.replace("affix","affixed")+".bs.affix")}"bottom"==u&&this.$element.offset({top:o-t-s})}};var r=e.fn.affix;e.fn.affix=t,e.fn.affix.Constructor=n,e.fn.affix.noConflict=function(){return e.fn.affix=r,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var n=e(this),r=n.data();r.offset=r.offset||{},null!=r.offsetBottom&&(r.offset.bottom=r.offsetBottom),null!=r.offsetTop&&(r.offset.top=r.offsetTop),t.call(n,r)})})}(jQuery),define("bootstrap",["jquery"],function(){}),define("pane",["jquery","splitter"],function(){function e(e,t,n){var r=e.wrap('<div class="pane-container"></div>').parent();n=="above"||n=="left"?r.prepend(t):r.append(t),e.wrap('<div class="pane-wrapper"></div>'),t.wrap('<div class="pane-wrapper"></div>'),n=="above"||n=="below"?dir="horizontal":dir="vertical",r.split({orientation:dir,limit:10})}function t(e){var t=e.parents(".pane-container").first();t.split().destroy(),e.parent().remove(),t.children().first().children().first().unwrap().unwrap()}(function(e){function r(t){var n=t.children();return{splitter:t.split(),first:e(n[0]).children()[0],second:e(n[2]).children()[0]}}var t="tile",n={_init:function(t){return this.each(function(){var t=e(this),n=t.hasClass("horizontal")?"vertical":"horizontal",r=t.attr("data-split"),i=t.children();r||(r="50%"),i.each(function(){e(this).wrap('<div class="pane-wrapper"></div>')}),t.addClass("pane-container"),t.split({orientation:n,position:r,limit:10,onDrag:function(e){i.trigger("pane.resize")},onDragEnd:function(){t.tile("resize_save")}}),t.tile("resize_save")})},resize_save:function(){return this.each(function(){var t=e(this),n=r(t),i,s;n.splitter.orientation=="horizontal"?(i=t.height(),s=e(n.first).height()):(i=t.width(),s=e(n.first).width());var o=Math.round(100*s/i)+"%";n.splitter.resizestart=o})},resize:function(){return this.each(function(){var t=e(this),n=t.split();n.resizestart&&(n.position(n.resizestart),n.settings.onDrag(t))})}};e.fn.tile=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery)}),function(e){function n(){var e=document.createElement(arguments[0]);for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r===null||r===undefined)continue;if(r.nodeType===1)e.appendChild(r);else if(!(r===""||r&&r.charCodeAt&&r.substr)&&!(r===0||r&&r.toExponential&&r.toFixed)){if(n===1&&typeof r=="object"){for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];if(s!==null&&s!==undefined){i=i.toLowerCase(),i=t[i]||i;var o=i.charAt(0)==="o"&&i.charAt(1)==="n";o?(r.href===undefined&&i==="onclick"&&e.setAttribute("href","#"),e[i]=s):i==="style"&&e.style.setAttribute?e.style.setAttribute("cssText",s):i==="className"||i==="htmlFor"?e[i]=s:e.setAttribute(i,s)}}}else if(Object.prototype.toString.call(r)==="[object Array]")for(var u=0;u<r.length;u++){var a=r[u];a.nodeType===1&&e.appendChild(a)}}else e.appendChild(document.createTextNode(r))}return e.appendTo=function(t){return t.nodeType===1&&this.nodeType===1&&t.appendChild(this),e},e}var t={acceptcharset:"acceptCharset",accesskey:"accessKey",allowtransparency:"allowTransparency",bgcolor:"bgColor",cellpadding:"cellPadding",cellspacing:"cellSpacing","class":"className",classname:"className",colspan:"colSpan",csstext:"style",defaultchecked:"defaultChecked",defaultselected:"defaultSelected",defaultvalue:"defaultValue","for":"htmlFor",frameborder:"frameBorder",hspace:"hSpace",htmlfor:"htmlFor",longdesc:"longDesc",maxlength:"maxLength",marginwidth:"marginWidth",marginheight:"marginHeight",noresize:"noResize",noshade:"noShade",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",valign:"vAlign",vspace:"vSpace"};n.registerElement=function(e,t){n[e]||(n[e]=function(){var r=n("div",{"class":e});return t.apply(r,Array.prototype.slice.call(arguments)),r})};var r=["acronym","applet","basefont","big","center","dir","font","frame","frameset","noframes","strike","tt","u","xmp"],i=["a","abbr","address","area","article","aside","audio","b","base","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","ul","var","video","wbr"].concat(r),s=function(e){return function(){return n.apply(this,[e].concat(Array.prototype.slice.call(arguments)))}};for(var o=0;o<i.length;o++)n[i[o]]=s(i[o]);if(typeof module!="undefined"&&module.exports)module.exports=n;else{var u=e.$||{};u.el=n,e.$=u}}(this),define("laconic",["jquery"],function(){}),define("navbar",["jquery","preferences","laconic"],function(e,t){(function(e){function i(n,r,i){if(i=="--")n.append(e.el.li({"class":"divider"}));else if(typeof i=="function"){var s=e.el.a(r);e(s).data("action",i),i.name&&e(s).attr("id",i.name),n.append(e.el.li(s))}else if(i.type=="checkbox"){var o=e(e.el.input({type:"checkbox"}));i.preference!==undefined?(o.addClass("trill_on_swish-event-receiver"),t.getVal(i.preference)&&o.prop("checked",!0),o.on("click",function(){t.setVal(i.preference,e(this).prop("checked"))}),o.on("preference",function(e){e.name==i.preference&&o.prop("checked",e.value)})):(i.checked&&o.prop("checked",i.checked),o.on("click",function(){i.action(e(this).prop("checked"))})),n.append(e.el.li({"class":"checkbox"},o[0],e.el.span(r)))}else alert("Unknown navbar item")}function s(t,n){return t.find(".dropdown-menu").filter(function(){return e(this).attr("name")==n})}function o(t,n){var r=e(t).data("action");return r&&(n.preventDefault(),r.call(t)),!1}var n="navbar",r={_init:function(t){return this.each(function(){var n=e(this),r={};for(var i in t)t.hasOwnProperty(i)&&(n.navbar("appendDropdown",i),n.navbar("populateDropdown",i,t[i]));n.on("click","a",function(e){o(this,e)})})},appendDropdown:function(t){var n=this.children(".nav.navbar-nav"),r=e.el.ul({name:t,"class":"dropdown-menu"}),i=e.el.li({"class":"dropdown"},e.el.a({"class":"dropdown-toggle","data-toggle":"dropdown"},t,e.el.b({"class":"caret"})),r);return n.append(i),this},populateDropdown:function(e,t){if(typeof t=="function")t(this,e);else{var n=s(this,e);for(var r in t)t.hasOwnProperty(r)&&i(n,r,t[r])}},extendDropdown:function(e,t,n){var r=s(this,e);i(r,t,n)}};e.fn.navbar=function(t){if(r[t])return r[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return r._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}})(jQuery)}),!function(e){var t=function(){return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(e){return!e||/^\s*$/.test(e)},escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isArray:e.isArray,isFunction:e.isFunction,isObject:e.isPlainObject,isUndefined:function(e){return"undefined"==typeof e},toStr:function(e){return t.isUndefined(e)||null===e?"":e+""},bind:e.proxy,each:function(t,n){function r(e,t){return n(t,e)}e.each(t,r)},map:e.map,filter:e.grep,every:function(t,n){var r=!0;return t?(e.each(t,function(e,i){return(r=n.call(null,i,e,t))?void 0:!1}),!!r):r},some:function(t,n){var r=!1;return t?(e.each(t,function(e,i){return(r=n.call(null,i,e,t))?!1:void 0}),!!r):r},mixin:e.extend,getUniqueId:function(){var e=0;return function(){return e++}}(),templatify:function(t){function n(){return String(t)}return e.isFunction(t)?t:n},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var r,i;return function(){var s,o,u=this,a=arguments;return s=function(){r=null,n||(i=e.apply(u,a))},o=n&&!r,clearTimeout(r),r=setTimeout(s,t),o&&(i=e.apply(u,a)),i}},throttle:function(e,t){var n,r,i,s,o,u;return o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)},function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,0>=f?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},noop:function(){}}}(),n="0.10.5",r=function(){function e(e){return e=t.toStr(e),e?e.split(/\s+/):[]}function n(e){return e=t.toStr(e),e?e.split(/\W+/):[]}function r(e){return function(){var n=[].slice.call(arguments,0);return function(r){var i=[];return t.each(n,function(n){i=i.concat(e(t.toStr(r[n])))}),i}}}return{nonword:n,whitespace:e,obj:{nonword:r(n),whitespace:r(e)}}}(),i=function(){function n(n){this.maxSize=t.isNumber(n)?n:100,this.reset(),this.maxSize<=0&&(this.set=this.get=e.noop)}function r(){this.head=this.tail=null}function i(e,t){this.key=e,this.val=t,this.prev=this.next=null}return t.mixin(n.prototype,{set:function(e,t){var n,r=this.list.tail;this.size>=this.maxSize&&(this.list.remove(r),delete this.hash[r.key]),(n=this.hash[e])?(n.val=t,this.list.moveToFront(n)):(n=new i(e,t),this.list.add(n),this.hash[e]=n,this.size++)},get:function(e){var t=this.hash[e];return t?(this.list.moveToFront(t),t.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new r}}),t.mixin(r.prototype,{add:function(e){this.head&&(e.next=this.head,this.head.prev=e),this.head=e,this.tail=this.tail||e},remove:function(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev},moveToFront:function(e){this.remove(e),this.add(e)}}),n}(),s=function(){function e(e){this.prefix=["__",e,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+t.escapeRegExChars(this.prefix))}function n(){return(new Date).getTime()}function r(e){return JSON.stringify(t.isUndefined(e)?null:e)}function i(e){return JSON.parse(e)}var s,o;try{s=window.localStorage,s.setItem("~~~","!"),s.removeItem("~~~")}catch(u){s=null}return o=s&&window.JSON?{_prefix:function(e){return this.prefix+e},_ttlKey:function(e){return this._prefix(e)+this.ttlKey},get:function(e){return this.isExpired(e)&&this.remove(e),i(s.getItem(this._prefix(e)))},set:function(e,i,o){return t.isNumber(o)?s.setItem(this._ttlKey(e),r(n()+o)):s.removeItem(this._ttlKey(e)),s.setItem(this._prefix(e),r(i))},remove:function(e){return s.removeItem(this._ttlKey(e)),s.removeItem(this._prefix(e)),this},clear:function(){var e,t,n=[],r=s.length;for(e=0;r>e;e++)(t=s.key(e)).match(this.keyMatcher)&&n.push(t.replace(this.keyMatcher,""));for(e=n.length;e--;)this.remove(n[e]);return this},isExpired:function(e){var r=i(s.getItem(this._ttlKey(e)));return t.isNumber(r)&&n()>r?!0:!1}}:{get:t.noop,set:t.noop,remove:t.noop,clear:t.noop,isExpired:t.noop},t.mixin(e.prototype,o),e}(),o=function(){function n(t){t=t||{},this.cancelled=!1,this.lastUrl=null,this._send=t.transport?r(t.transport):e.ajax,this._get=t.rateLimiter?t.rateLimiter(this._get):this._get,this._cache=t.cache===!1?new i(0):a}function r(n){return function(r,i){function s(e){t.defer(function(){u.resolve(e)})}function o(e){t.defer(function(){u.reject(e)})}var u=e.Deferred();return n(r,i,s,o),u}}var s=0,o={},u=6,a=new i(10);return n.setMaxPendingRequests=function(e){u=e},n.resetCache=function(){a.reset()},t.mixin(n.prototype,{_get:function(e,t,n){function r(t){n&&n(null,t),l._cache.set(e,t)}function i(){n&&n(!0)}function a(){s--,delete o[e],l.onDeckRequestArgs&&(l._get.apply(l,l.onDeckRequestArgs),l.onDeckRequestArgs=null)}var f,l=this;this.cancelled||e!==this.lastUrl||((f=o[e])?f.done(r).fail(i):u>s?(s++,o[e]=this._send(e,t).done(r).fail(i).always(a)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(e,n,r){var i;return t.isFunction(n)&&(r=n,n={}),this.cancelled=!1,this.lastUrl=e,(i=this._cache.get(e))?t.defer(function(){r&&r(null,i)}):this._get(e,n,r),!!i},cancel:function(){this.cancelled=!0}}),n}(),u=function(){function n(t){t=t||{},t.datumTokenizer&&t.queryTokenizer||e.error("datumTokenizer and queryTokenizer are both required"),this.datumTokenizer=t.datumTokenizer,this.queryTokenizer=t.queryTokenizer,this.reset()}function r(e){return e=t.filter(e,function(e){return!!e}),e=t.map(e,function(e){return e.toLowerCase()})}function i(){return{ids:[],children:{}}}function s(e){for(var t={},n=[],r=0,i=e.length;i>r;r++)t[e[r]]||(t[e[r]]=!0,n.push(e[r]));return n}function o(e,t){function n(e,t){return e-t}var r=0,i=0,s=[];e=e.sort(n),t=t.sort(n);for(var o=e.length,u=t.length;o>r&&u>i;)e[r]<t[i]?r++:e[r]>t[i]?i++:(s.push(e[r]),r++,i++);return s}return t.mixin(n.prototype,{bootstrap:function(e){this.datums=e.datums,this.trie=e.trie},add:function(e){var n=this;e=t.isArray(e)?e:[e],t.each(e,function(e){var s,o;s=n.datums.push(e)-1,o=r(n.datumTokenizer(e)),t.each(o,function(e){var t,r,o;for(t=n.trie,r=e.split("");o=r.shift();)t=t.children[o]||(t.children[o]=i()),t.ids.push(s)})})},get:function(e){var n,i,u=this;return n=r(this.queryTokenizer(e)),t.each(n,function(e){var t,n,r,s;if(i&&0===i.length)return!1;for(t=u.trie,n=e.split("");t&&(r=n.shift());)t=t.children[r];return t&&0===n.length?(s=t.ids.slice(0),void (i=i?o(i,s):s)):(i=[],!1)}),i?t.map(s(i),function(e){return u.datums[e]}):[]},reset:function(){this.datums=[],this.trie=i()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),n}(),a=function(){function r(e){return e.local||null}function i(r){var i,s;return s={url:null,thumbprint:"",ttl:864e5,filter:null,ajax:{}},(i=r.prefetch||null)&&(i=t.isString(i)?{url:i}:i,i=t.mixin(s,i),i.thumbprint=n+i.thumbprint,i.ajax.type=i.ajax.type||"GET",i.ajax.dataType=i.ajax.dataType||"json",!i.url&&e.error("prefetch requires url to be set")),i}function s(n){function r(e){return function(n){return t.debounce(n,e)}}function i(e){return function(n){return t.throttle(n,e)}}var s,o;return o={url:null,cache:!0,wildcard:"%QUERY",replace:null,rateLimitBy:"debounce",rateLimitWait:300,send:null,filter:null,ajax:{}},(s=n.remote||null)&&(s=t.isString(s)?{url:s}:s,s=t.mixin(o,s),s.rateLimiter=/^throttle$/i.test(s.rateLimitBy)?i(s.rateLimitWait):r(s.rateLimitWait),s.ajax.type=s.ajax.type||"GET",s.ajax.dataType=s.ajax.dataType||"json",delete s.rateLimitBy,delete s.rateLimitWait,!s.url&&e.error("remote requires url to be set")),s}return{local:r,prefetch:i,remote:s}}();!function(n){function i(t){t&&(t.local||t.prefetch||t.remote)||e.error("one of local, prefetch, or remote is required"),this.limit=t.limit||5,this.sorter=f(t.sorter),this.dupDetector=t.dupDetector||l,this.local=a.local(t),this.prefetch=a.prefetch(t),this.remote=a.remote(t),this.cacheKey=this.prefetch?this.prefetch.cacheKey||this.prefetch.url:null,this.index=new u({datumTokenizer:t.datumTokenizer,queryTokenizer:t.queryTokenizer}),this.storage=this.cacheKey?new s(this.cacheKey):null}function f(e){function n(t){return t.sort(e)}function r(e){return e}return t.isFunction(e)?n:r}function l(){return!1}var c,h;return c=n.Bloodhound,h={data:"data",protocol:"protocol",thumbprint:"thumbprint"},n.Bloodhound=i,i.noConflict=function(){return n.Bloodhound=c,i},i.tokenizers=r,t.mixin(i.prototype,{_loadPrefetch:function(t){function n(e){s.clear(),s.add(t.filter?t.filter(e):e),s._saveToStorage(s.index.serialize(),t.thumbprint,t.ttl)}var r,i,s=this;return(r=this._readFromStorage(t.thumbprint))?(this.index.bootstrap(r),i=e.Deferred().resolve()):i=e.ajax(t.url,t.ajax).done(n),i},_getFromRemote:function(e,t){function n(e,n){t(e?[]:s.remote.filter?s.remote.filter(n):n)}var r,i,s=this;if(this.transport)return e=e||"",i=encodeURIComponent(e),r=this.remote.replace?this.remote.replace(this.remote.url,e):this.remote.url.replace(this.remote.wildcard,i),this.transport.get(r,this.remote.ajax,n)},_cancelLastRemoteRequest:function(){this.transport&&this.transport.cancel()},_saveToStorage:function(e,t,n){this.storage&&(this.storage.set(h.data,e,n),this.storage.set(h.protocol,location.protocol,n),this.storage.set(h.thumbprint,t,n))},_readFromStorage:function(e){var t,n={};return this.storage&&(n.data=this.storage.get(h.data),n.protocol=this.storage.get(h.protocol),n.thumbprint=this.storage.get(h.thumbprint)),t=n.thumbprint!==e||n.protocol!==location.protocol,n.data&&!t?n.data:null},_initialize:function(){function n(){i.add(t.isFunction(s)?s():s)}var r,i=this,s=this.local;return r=this.prefetch?this._loadPrefetch(this.prefetch):e.Deferred().resolve(),s&&r.done(n),this.transport=this.remote?new o(this.remote):null,this.initPromise=r.promise()},initialize:function(e){return!this.initPromise||e?this._initialize():this.initPromise},add:function(e){this.index.add(e)},get:function(e,n){function r(e){var r=s.slice(0);t.each(e,function(e){var n;return n=t.some(r,function(t){return i.dupDetector(e,t)}),!n&&r.push(e),r.length<i.limit}),n&&n(i.sorter(r))}var i=this,s=[],o=!1;s=this.index.get(e),s=this.sorter(s).slice(0,this.limit),s.length<this.limit?o=this._getFromRemote(e,r):this._cancelLastRemoteRequest(),o||(s.length>0||!this.transport)&&n&&n(s)},clear:function(){this.index.reset()},clearPrefetchCache:function(){this.storage&&this.storage.clear()},clearRemoteCache:function(){this.transport&&o.resetCache()},ttAdapter:function(){return t.bind(this.get,this)}}),i}(this);var f=function(){return{wrapper:'<span class="twitter-typeahead"></span>',dropdown:'<span class="tt-dropdown-menu"></span>',dataset:'<div class="tt-dataset-%CLASS%"></div>',suggestions:'<span class="tt-suggestions"></span>',suggestion:'<div class="tt-suggestion"></div>'}}(),l=function(){var e={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return t.isMsie()&&t.mixin(e.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t.isMsie()&&t.isMsie()<=7&&t.mixin(e.input,{marginTop:"-1px"}),e}(),c=function(){function n(t){t&&t.el||e.error("EventBus initialized without el"),this.$el=e(t.el)}var r="typeahead:";return t.mixin(n.prototype,{trigger:function(e){var t=[].slice.call(arguments,1);this.$el.trigger(r+e,t)}}),n}(),h=function(){function e(e,t,n,r){var i;if(!n)return this;for(t=t.split(a),n=r?u(n,r):n,this._callbacks=this._callbacks||{};i=t.shift();)this._callbacks[i]=this._callbacks[i]||{sync:[],async:[]},this._callbacks[i][e].push(n);return this}function t(t,n,r){return e.call(this,"async",t,n,r)}function n(t,n,r){return e.call(this,"sync",t,n,r)}function r(e){var t;if(!this._callbacks)return this;for(e=e.split(a);t=e.shift();)delete this._callbacks[t];return this}function i(e){var t,n,r,i,o;if(!this._callbacks)return this;for(e=e.split(a),r=[].slice.call(arguments,1);(t=e.shift())&&(n=this._callbacks[t]);)i=s(n.sync,this,[t].concat(r)),o=s(n.async,this,[t].concat(r)),i()&&f(o);return this}function s(e,t,n){function r(){for(var r,i=0,s=e.length;!r&&s>i;i+=1)r=e[i].apply(t,n)===!1;return!r}return r}function o(){var e;return e=window.setImmediate?function(e){setImmediate(function(){e()})}:function(e){setTimeout(function(){e()},0)}}function u(e,t){return e.bind?e.bind(t):function(){e.apply(t,[].slice.call(arguments,0))}}var a=/\s+/,f=o();return{onSync:n,onAsync:t,off:r,trigger:i}}(),p=function(e){function n(e,n,r){for(var i,s=[],o=0,u=e.length;u>o;o++)s.push(t.escapeRegExChars(e[o]));return i=r?"\\b("+s.join("|")+")\\b":"("+s.join("|")+")",n?new RegExp(i):new RegExp(i,"i")}var r={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(i){function s(t){var n,r,s;return(n=u.exec(t.data))&&(s=e.createElement(i.tagName),i.className&&(s.className=i.className),r=t.splitText(n.index),r.splitText(n[0].length),s.appendChild(r.cloneNode(!0)),t.parentNode.replaceChild(s,r)),!!n}function o(e,t){for(var n,r=3,i=0;i<e.childNodes.length;i++)n=e.childNodes[i],n.nodeType===r?i+=t(n)?1:0:o(n,t)}var u;i=t.mixin({},r,i),i.node&&i.pattern&&(i.pattern=t.isArray(i.pattern)?i.pattern:[i.pattern],u=n(i.pattern,i.caseSensitive,i.wordsOnly),o(i.node,s))}}(window.document),d=function(){function n(n){var i,s,u,a,f=this;n=n||{},n.input||e.error("input is missing"),i=t.bind(this._onBlur,this),s=t.bind(this._onFocus,this),u=t.bind(this._onKeydown,this),a=t.bind(this._onInput,this),this.$hint=e(n.hint),this.$input=e(n.input).on("blur.tt",i).on("focus.tt",s).on("keydown.tt",u),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=t.noop),t.isMsie()?this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(e){o[e.which||e.keyCode]||t.defer(t.bind(f._onInput,f,e))}):this.$input.on("input.tt",a),this.query=this.$input.val(),this.$overflowHelper=r(this.$input)}function r(t){return e('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}function i(e,t){return n.normalizeQuery(e)===n.normalizeQuery(t)}function s(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}var o;return o={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},n.normalizeQuery=function(e){return(e||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},t.mixin(n.prototype,h,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(e){var t=o[e.which||e.keyCode];this._managePreventDefault(t,e),t&&this._shouldTrigger(t,e)&&this.trigger(t+"Keyed",e)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(e,t){var n,r,i;switch(e){case"tab":r=this.getHint(),i=this.getInputValue(),n=r&&r!==i&&!s(t);break;case"up":case"down":n=!s(t);break;default:n=!1}n&&t.preventDefault()},_shouldTrigger:function(e,t){var n;switch(e){case"tab":n=!s(t);break;default:n=!0}return n},_checkInputValue:function(){var e,t,n;e=this.getInputValue(),t=i(e,this.query),n=t?this.query.length!==e.length:!1,this.query=e,t?n&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(e){this.query=e},getInputValue:function(){return this.$input.val()},setInputValue:function(e,t){this.$input.val(e),t?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(e){this.$hint.val(e)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var e,t,n,r;e=this.getInputValue(),t=this.getHint(),n=e!==t&&0===t.indexOf(e),r=""!==e&&n&&!this.hasOverflow(),!r&&this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var e=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=e},isCursorAtEnd:function(){var e,n,r;return e=this.$input.val().length,n=this.$input[0].selectionStart,t.isNumber(n)?n===e:document.selection?(r=document.selection.createRange(),r.moveStart("character",-e),e===r.text.length):!0},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$hint=this.$input=this.$overflowHelper=null}}),n}(),v=function(){function n(n){n=n||{},n.templates=n.templates||{},n.source||e.error("missing source"),n.name&&!s(n.name)&&e.error("invalid dataset name: "+n.name),this.query=null,this.highlight=!!n.highlight,this.name=n.name||t.getUniqueId(),this.source=n.source,this.displayFn=r(n.display||n.displayKey),this.templates=i(n.templates,this.displayFn),this.$el=e(f.dataset.replace("%CLASS%",this.name))}function r(e){function n(t){return t[e]}return e=e||"value",t.isFunction(e)?e:n}function i(e,n){function r(e){return"<p>"+n(e)+"</p>"}return{empty:e.empty&&t.templatify(e.empty),header:e.header&&t.templatify(e.header),footer:e.footer&&t.templatify(e.footer),suggestion:e.suggestion||r}}function s(e){return/^[_a-zA-Z0-9-]+$/.test(e)}var o="ttDataset",u="ttValue",a="ttDatum";return n.extractDatasetName=function(t){return e(t).data(o)},n.extractValue=function(t){return e(t).data(u)},n.extractDatum=function(t){return e(t).data(a)},t.mixin(n.prototype,h,{_render:function(n,r){function i(){return v.templates.empty({query:n,isEmpty:!0})}function s(){function i(t){var n;return n=e(f.suggestion).append(v.templates.suggestion(t)).data(o,v.name).data(u,v.displayFn(t)).data(a,t),n.children().each(function(){e(this).css(l.suggestionChild)}),n}var s,c;return s=e(f.suggestions).css(l.suggestions),c=t.map(r,i),s.append.apply(s,c),v.highlight&&p({className:"tt-highlight",node:s[0],pattern:n}),s}function c(){return v.templates.header({query:n,isEmpty:!d})}function h(){return v.templates.footer({query:n,isEmpty:!d})}if(this.$el){var d,v=this;this.$el.empty(),d=r&&r.length,!d&&this.templates.empty?this.$el.html(i()).prepend(v.templates.header?c():null).append(v.templates.footer?h():null):d&&this.$el.html(s()).prepend(v.templates.header?c():null).append(v.templates.footer?h():null),this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(e){function t(t){n.canceled||e!==n.query||n._render(e,t)}var n=this;this.query=e,this.canceled=!1,this.source(e,t)},cancel:function(){this.canceled=!0},clear:function(){this.cancel(),this.$el.empty(),this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),n}(),m=function(){function n(n){var i,s,o,u=this;n=n||{},n.menu||e.error("menu is required"),this.isOpen=!1,this.isEmpty=!0,this.datasets=t.map(n.datasets,r),i=t.bind(this._onSuggestionClick,this),s=t.bind(this._onSuggestionMouseEnter,this),o=t.bind(this._onSuggestionMouseLeave,this),this.$menu=e(n.menu).on("click.tt",".tt-suggestion",i).on("mouseenter.tt",".tt-suggestion",s).on("mouseleave.tt",".tt-suggestion",o),t.each(this.datasets,function(e){u.$menu.append(e.getRoot()),e.onSync("rendered",u._onRendered,u)})}function r(e){return new v(e)}return t.mixin(n.prototype,h,{_onSuggestionClick:function(t){this.trigger("suggestionClicked",e(t.currentTarget))},_onSuggestionMouseEnter:function(t){this._removeCursor(),this._setCursor(e(t.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._removeCursor()},_onRendered:function(){function e(e){return e.isEmpty()}this.isEmpty=t.every(this.datasets,e),this.isEmpty?this._hide():this.isOpen&&this._show(),this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".tt-suggestion")},_getCursor:function(){return this.$menu.find(".tt-cursor").first()},_setCursor:function(e,t){e.first().addClass("tt-cursor"),!t&&this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("tt-cursor")},_moveCursor:function(e){var t,n,r,i;if(this.isOpen){if(n=this._getCursor(),t=this._getSuggestions(),this._removeCursor(),r=t.index(n)+e,r=(r+1)%(t.length+1)-1,-1===r)return void this.trigger("cursorRemoved");-1>r&&(r=t.length-1),this._setCursor(i=t.eq(r)),this._ensureVisible(i)}},_ensureVisible:function(e){var t,n,r,i;t=e.position().top,n=t+e.outerHeight(!0),r=this.$menu.scrollTop(),i=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),0>t?this.$menu.scrollTop(r+t):n>i&&this.$menu.scrollTop(r+(n-i))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,!this.isEmpty&&this._show(),this.trigger("opened"))},setLanguageDirection:function(e){this.$menu.css("ltr"===e?l.ltr:l.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(e){var t=null;return e.length&&(t={raw:v.extractDatum(e),value:v.extractValue(e),datasetName:v.extractDatasetName(e)}),t},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(e){function n(t){t.update(e)}t.each(this.datasets,n)},empty:function(){function e(e){e.clear()}t.each(this.datasets,e),this.isEmpty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function e(e){e.destroy()}this.$menu.off(".tt"),this.$menu=null,t.each(this.datasets,e)}}),n}(),g=function(){function n(n){var i,s,o;n=n||{},n.input||e.error("missing input"),this.isActivated=!1,this.autoselect=!!n.autoselect,this.minLength=t.isNumber(n.minLength)?n.minLength:1,this.$node=r(n.input,n.withHint),i=this.$node.find(".tt-dropdown-menu"),s=this.$node.find(".tt-input"),o=this.$node.find(".tt-hint"),s.on("blur.tt",function(e){var n,r,o;n=document.activeElement,r=i.is(n),o=i.has(n).length>0,t.isMsie()&&(r||o)&&(e.preventDefault(),e.stopImmediatePropagation(),t.defer(function(){s.focus()}))}),i.on("mousedown.tt",function(e){e.preventDefault()}),this.eventBus=n.eventBus||new c({el:s}),this.dropdown=(new m({menu:i,datasets:n.datasets})).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=(new d({input:s,hint:o})).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._setLanguageDirection()}function r(t,n){var r,s,u,a;r=e(t),s=e(f.wrapper).css(l.wrapper),u=e(f.dropdown).css(l.dropdown),a=r.clone().css(l.hint).css(i(r)),a.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder required").prop("readonly",!0).attr({autocomplete:"off",spellcheck:"false",tabindex:-1}),r.data(o,{dir:r.attr("dir"),autocomplete:r.attr("autocomplete"),spellcheck:r.attr("spellcheck"),style:r.attr("style")}),r.addClass("tt-input").attr({autocomplete:"off",spellcheck:!1}).css(n?l.input:l.inputWithNoHint);try{!r.attr("dir")&&r.attr("dir","auto")}catch(c){}return r.wrap(s).parent().prepend(n?a:null).append(u)}function i(e){return{backgroundAttachment:e.css("background-attachment"),backgroundClip:e.css("background-clip"),backgroundColor:e.css("background-color"),backgroundImage:e.css("background-image"),backgroundOrigin:e.css("background-origin"),backgroundPosition:e.css("background-position"),backgroundRepeat:e.css("background-repeat"),backgroundSize:e.css("background-size")}}function s(e){var n=e.find(".tt-input");t.each(n.data(o),function(e,r){t.isUndefined(e)?n.removeAttr(r):n.attr(r,e)}),n.detach().removeData(o).removeClass("tt-input").insertAfter(e),e.remove()}var o="ttAttrs";return t.mixin(n.prototype,{_onSuggestionClicked:function(e,t){var n;(n=this.dropdown.getDatumForSuggestion(t))&&this._select(n)},_onCursorMoved:function(){var e=this.dropdown.getDatumForCursor();this.input.setInputValue(e.value,!0),this.eventBus.trigger("cursorchanged",e.raw,e.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint()},_onDatasetRendered:function(){this._updateHint()},_onOpened:function(){this._updateHint(),this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint(),this.eventBus.trigger("closed")},_onFocused:function(){this.isActivated=!0,this.dropdown.open()},_onBlurred:function(){this.isActivated=!1,this.dropdown.empty(),this.dropdown.close()},_onEnterKeyed:function(e,t){var n,r;n=this.dropdown.getDatumForCursor(),r=this.dropdown.getDatumForTopSuggestion(),n?(this._select(n),t.preventDefault()):this.autoselect&&r&&(this._select(r),t.preventDefault())},_onTabKeyed:function(e,t){var n;(n=this.dropdown.getDatumForCursor())?(this._select(n),t.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onUpKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(e,t){this.input.clearHintIfInvalid(),t.length>=this.minLength?this.dropdown.update(t):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var e;this.dir!==(e=this.input.getLanguageDirection())&&(this.dir=e,this.$node.css("direction",e),this.dropdown.setLanguageDirection(e))},_updateHint:function(){var e,n,r,i,s,o;e=this.dropdown.getDatumForTopSuggestion(),e&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(n=this.input.getInputValue(),r=d.normalizeQuery(n),i=t.escapeRegExChars(r),s=new RegExp("^(?:"+i+")(.+$)","i"),o=s.exec(e.value),o?this.input.setHint(n+o[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(e){var t,n,r,i;t=this.input.getHint(),n=this.input.getQuery(),r=e||this.input.isCursorAtEnd(),t&&n!==t&&r&&(i=this.dropdown.getDatumForTopSuggestion(),i&&this.input.setInputValue(i.value),this.eventBus.trigger("autocompleted",i.raw,i.datasetName))},_select:function(e){this.input.setQuery(e.value),this.input.setInputValue(e.value,!0),this._setLanguageDirection(),this.eventBus.trigger("selected",e.raw,e.datasetName),this.dropdown.close(),t.defer(t.bind(this.dropdown.empty,this.dropdown))},open:function(){this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(e){e=t.toStr(e),this.isActivated?this.input.setInputValue(e):(this.input.setQuery(e),this.input.setInputValue(e,!0)),this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),s(this.$node),this.$node=null}}),n}();!function(){var n,r,i;n=e.fn.typeahead,r="ttTypeahead",i={initialize:function(n,i){function s(){var s,o,u=e(this);t.each(i,function(e){e.highlight=!!n.highlight}),o=new g({input:u,eventBus:s=new c({el:u}),withHint:t.isUndefined(n.hint)?!0:!!n.hint,minLength:n.minLength,autoselect:n.autoselect,datasets:i}),u.data(r,o)}return i=t.isArray(i)?i:[].slice.call(arguments,1),n=n||{},this.each(s)},open:function(){function t(){var t,n=e(this);(t=n.data(r))&&t.open()}return this.each(t)},close:function(){function t(){var t,n=e(this);(t=n.data(r))&&t.close()}return this.each(t)},val:function(t){function n(){var n,i=e(this);(n=i.data(r))&&n.setVal(t)}function i(e){var t,n;return(t=e.data(r))&&(n=t.getVal()),n}return arguments.length?this.each(n):i(this.first())},destroy:function(){function t(){var t,n=e(this);(t=n.data(r))&&(t.destroy(),n.removeData(r))}return this.each(t)}},e.fn.typeahead=function(t){var n;return i[t]&&"initialize"!==t?(n=this.filter(function(){return!!e(this).data(r)}),i[t].apply(n,[].slice.call(arguments,1))):i.initialize.apply(this,arguments)},e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this}}()}(window.jQuery),define("typeahead",["jquery"],function(){}),define("search",["jquery","config","typeahead"],function(e,t){(function(e){function i(e){return e?document.createElement("a").appendChild(document.createTextNode(e)).parentNode.innerHTML:""}var n="search",r={_init:function(n){return this.each(function(){function o(e){return(e.tags||[]).push(e.name)}function u(e){var t='<div class="tt-match file"><span class="tt-label">'+i(e.name);0/0;if(e.tags){t+='<span class="tt-tags">';for(var n=0;n<e.tags.length;n++){var r=e.tags[n];t+='<span class="tt-tag">'+i(r)+"</span>"}t+="</span>"}return e.title&&(t+='<div class="tt-title file">'+i(e.title)+"</div>"),t+="</div>",t}function a(e,n){var r=t.trill_on_swish.templates,i=[],s=e.split(" "),o=[];for(var u=0;u<s.length;u++)o.push({prefix:s[u],regex:new RegExp("_"+s[u])});for(var u=0;u<r.length;u++){var a=r[u];if(a.arity!==undefined){for(var f=0,l=!0;f<o.length&&l;f++)!a.name.startsWith(o[f].prefix)&&!a.name.match(o[f].regex)&&(l=!1);l&&i.push(a)}}n(i)}function f(e){var t='<div class="tt-match predicate';return e.type&&(t+=" "+e.type),e.mode&&(t+='" title="'+e.mode),t+='"><span class="tt-label">'+i(e.name)+"/"+e.arity+"</span>",e.iso&&(t+='<span class="tt-tags">',e.iso&&(t+='<span class="tt-tag">ISO</span>'),t+="</span>"),e.summary&&(t+='<div class="tt-title file">'+i(e.summary)+"</div>"),t+="</div>",t+="</div>",t}function c(t,n){r=t;if(t.length<2)return[];var i=[],s=new RegExp("\\b"+t,"g");l=s,e(".prolog-editor").each(function(){var t=this,n=e(t).prologEditor("search",s,{max:7});for(var r=0;r<n.length;r++)n[r].editor=t,n[r].regex=l,i.push(n[r])}),n(i)}function h(e){var t=e.text,n;(n=t.search(l))>20&&(t="..."+t.slice(n-17)),t.length>80&&(t=t.substring(0,80));var r='<div class="tt-match source"><span class="tt-line"><span class="tt-lineno">'+e.line+"</span>"+'<span class="tt-text">'+i(t)+"</span>"+"</span>";return r}var n=e(this),r,s=new Bloodhound({name:"files",remote:t.http.locations.typeahead+"?set=file&q=%QUERY",datumTokenizer:o,queryTokenizer:Bloodhound.tokenizers.whitespace});s.initialize();var l;n.typeahead({minLength:1,highlight:!0},[{name:"source",source:c,templates:{suggestion:h}},{name:"files",source:s.ttAdapter(),templates:{suggestion:u}},{name:"predicates",source:a,templates:{suggestion:f}}]).on("typeahead:selected typeahead:autocompleted",function(t,r,i){r.type=="store"?e(t.target).parents(".trill_on_swish").swish("playFile",r.file):r.arity!==undefined?e(".trill_on_swish-event-receiver").trigger("pldoc",r):r.editor!==undefined&&r.line!==undefined?e(r.editor).prologEditor("gotoLine",r.line,{regex:r.regex,showAllMatches:!0}):(n.data("target",{datum:r,set:i}),console.log(n.data("target")))}),n.parents("form").submit(function(e){var t=n.data("target"),r=n.val();if(!t||!t.datum||t.datum.label!=r)t=r;return n.val(""),n.data("target",null),n.search("search",t),!1})})},search:function(e){alert("Full search not yet implemented\nPlease select from auto completion list")}};typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(e){return this.lastIndexOf(e,0)===0}),e.fn.search=function(t){if(r[t])return r[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return r._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}})(jQuery)}),function(e){if(typeof exports=="object"&&typeof module=="object")module.exports=e();else{if(typeof define=="function"&&define.amd)return define("tos_cm/lib/codemirror",[],e);this.CodeMirror=e()}}(function(){function E(e,t){if(!(this instanceof E))return new E(e,t);this.options=t=t?nu(t):{},nu(Ei,t,!1),P(t);var n=t.value;typeof n=="string"&&(n=new Ks(n,t.mode)),this.doc=n;var o=new E.inputStyles[t.inputStyle](this),u=this.display=new S(e,n,o);u.wrapper.CodeMirror=this,O(this),L(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),t.autofocus&&!p&&u.input.focus(),F(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Xo,keySeq:null};var a=this;r&&i<11&&setTimeout(function(){a.display.input.reset(!0)},20),dr(this),Su(),Vn(this),this.curOp.forceUpdate=!0,Zs(this,n),t.autofocus&&!p||a.hasFocus()?setTimeout(ru(Vr,this),20):$r(this);for(var f in Si)Si.hasOwnProperty(f)&&Si[f](this,t[f],Ti);z(this),t.finishInit&&t.finishInit(this);for(var l=0;l<Li.length;++l)Li[l](this);Jn(this),s&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}function S(t,n,o){var u=this;this.input=o,u.scrollbarFiller=lu("div",null,"CodeMirror-scrollbar-filler"),u.scrollbarFiller.setAttribute("cm-not-content","true"),u.gutterFiller=lu("div",null,"CodeMirror-gutter-filler"),u.gutterFiller.setAttribute("cm-not-content","true"),u.lineDiv=lu("div",null,"CodeMirror-code"),u.selectionDiv=lu("div",null,null,"position: relative; z-index: 1"),u.cursorDiv=lu("div",null,"CodeMirror-cursors"),u.measure=lu("div",null,"CodeMirror-measure"),u.lineMeasure=lu("div",null,"CodeMirror-measure"),u.lineSpace=lu("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none"),u.mover=lu("div",[lu("div",[u.lineSpace],"CodeMirror-lines")],null,"position: relative"),u.sizer=lu("div",[u.mover],"CodeMirror-sizer"),u.sizerWidth=null,u.heightForcer=lu("div",null,null,"position: absolute; height: "+qo+"px; width: 1px;"),u.gutters=lu("div",null,"CodeMirror-gutters"),u.lineGutter=null,u.scroller=lu("div",[u.sizer,u.heightForcer,u.gutters],"CodeMirror-scroll"),u.scroller.setAttribute("tabIndex","-1"),u.wrapper=lu("div",[u.scrollbarFiller,u.gutterFiller,u.scroller],"CodeMirror"),r&&i<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0),!s&&(!e||!p)&&(u.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(u.wrapper):t(u.wrapper)),u.viewFrom=u.viewTo=n.first,u.reportedViewFrom=u.reportedViewTo=n.first,u.view=[],u.renderedView=null,u.externalMeasured=null,u.viewOffset=0,u.lastWrapHeight=u.lastWrapWidth=0,u.updateLineNumbers=null,u.nativeBarWidth=u.barHeight=u.barWidth=0,u.scrollbarsClipped=!1,u.lineNumWidth=u.lineNumInnerWidth=u.lineNumChars=null,u.alignWidgets=!1,u.cachedCharWidth=u.cachedTextHeight=u.cachedPaddingH=null,u.maxLine=null,u.maxLineLength=0,u.maxLineChanged=!1,u.wheelDX=u.wheelDY=u.wheelStartX=u.wheelStartY=null,u.shift=!1,u.selForContextMenu=null,u.activeTouch=null,o.init(u)}function x(e){e.doc.mode=E.getMode(e.options,e.doc.modeOption),T(e)}function T(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,un(e,100),e.state.modeGen++,e.curOp&&ur(e)}function N(e){e.options.lineWrapping?(yu(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(gu(e.display.wrapper,"CodeMirror-wrap"),D(e)),k(e),ur(e),On(e),setTimeout(function(){I(e)},100)}function C(e){var t=Un(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/zn(e.display)-3);return function(i){if(gs(e.doc,i))return 0;var s=0;if(i.widgets)for(var o=0;o<i.widgets.length;o++)i.widgets[o].height&&(s+=i.widgets[o].height);return n?s+(Math.ceil(i.text.length/r)||1)*t:s+t}}function k(e){var t=e.doc,n=C(e);t.iter(function(e){var t=n(e);t!=e.height&&ro(e,t)})}function L(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),On(e)}function A(e){O(e),ur(e),setTimeout(function(){U(e)},20)}function O(e){var t=e.display.gutters,n=e.options.gutters;hu(t);for(var r=0;r<n.length;++r){var i=n[r],s=t.appendChild(lu("div",null,"CodeMirror-gutter "+i));i=="CodeMirror-linenumbers"&&(e.display.lineGutter=s,s.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",M(e)}function M(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function _(e){if(e.height==0)return 0;var t=e.text.length,n,r=e;while(n=ls(r)){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}r=e;while(n=cs(r)){var i=n.find(0,!0);t-=r.text.length-i.from.ch,r=i.to.line,t+=r.text.length-i.to.ch}return t}function D(e){var t=e.display,n=e.doc;t.maxLine=eo(n,n.first),t.maxLineLength=_(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=_(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function P(e){var t=Yo(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function H(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+hn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+dn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function B(e,t,n){this.cm=n;var s=this.vert=lu("div",[lu("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=lu("div",[lu("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(s),e(o),Oo(s,"scroll",function(){s.clientHeight&&t(s.scrollTop,"vertical")}),Oo(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedOverlay=!1,r&&i<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function j(){}function F(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&gu(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new E.scrollbarModel[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oo(t,"mousedown",function(){e.state.focused&&setTimeout(function(){e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Or(e,t):Ar(e,t)},e),e.display.scrollbars.addClass&&yu(e.display.wrapper,e.display.scrollbars.addClass)}function I(e,t){t||(t=H(e));var n=e.display.barWidth,r=e.display.barHeight;q(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Y(e),q(e,H(e)),n=e.display.barWidth,r=e.display.barHeight}function q(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function R(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-cn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,s=so(t,r),o=so(t,i);if(n&&n.ensure){var u=n.ensure.from.line,a=n.ensure.to.line;u<s?(s=u,o=so(t,oo(eo(t,u))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=o&&(s=so(t,oo(eo(t,a))-e.wrapper.clientHeight),o=a)}return{from:s,to:Math.max(o,s+1)}}function U(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var r=X(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,s=r+"px";for(var o=0;o<n.length;o++)if(!n[o].hidden){e.options.fixedGutter&&n[o].gutter&&(n[o].gutter.style.left=s);var u=n[o].alignable;if(u)for(var a=0;a<u.length;a++)u[a].style.left=s}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function z(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=W(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(lu("div",[lu("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=i.firstChild.offsetWidth,o=i.offsetWidth-s;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-o),r.lineNumWidth=r.lineNumInnerWidth+o,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",M(e),!0}return!1}function W(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function X(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function V(e,t,n){var r=e.display;this.viewport=t,this.visible=R(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=vn(e),this.force=n,this.dims=et(e),this.events=[]}function $(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=dn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=dn(e)+"px",t.scrollbarsClipped=!0)}function J(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return fr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&pr(e)==0)return!1;z(e)&&(fr(e),t.dims=et(e));var i=r.first+r.size,s=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<s&&s-n.viewFrom<20&&(s=Math.max(r.first,n.viewFrom)),n.viewTo>o&&n.viewTo-o<20&&(o=Math.min(i,n.viewTo)),w&&(s=vs(e.doc,s),o=ms(e.doc,o));var u=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;hr(e,s,o),n.viewOffset=oo(eo(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=pr(e);if(!u&&a==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=vu();return a>4&&(n.lineDiv.style.display="none"),tt(e,n.updateLineNumbers,t.dims),a>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,f&&vu()!=f&&f.offsetHeight&&f.focus(),hu(n.cursorDiv),hu(n.selectionDiv),n.gutters.style.height=0,u&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,un(e,400)),n.updateLineNumbers=null,!0}function K(e,t){var n=t.force,r=t.viewport;for(var i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=vn(e))n=!0;else{n=!1,r&&r.top!=null&&(r={top:Math.min(e.doc.height+hn(e.display)-mn(e),r.top)}),t.visible=R(e.display,e.doc,r);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}if(!J(e,t))break;Y(e);var s=H(e);tn(e),G(e,s),I(e,s)}t.signal(e,"update",e);if(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo}function Q(e,t){var n=new V(e,t);if(J(e,n)){Y(e),K(e,n);var r=H(e);tn(e),G(e,r),I(e,r),n.finish()}}function G(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+dn(e),t.clientHeight)+"px"}function Y(e){var t=e.display,n=t.lineDiv.offsetTop;for(var s=0;s<t.view.length;s++){var o=t.view[s],u;if(o.hidden)continue;if(r&&i<8){var a=o.node.offsetTop+o.node.offsetHeight;u=a-n,n=a}else{var f=o.node.getBoundingClientRect();u=f.bottom-f.top}var l=o.line.height-u;u<2&&(u=Un(t));if(l>.001||l<-0.001){ro(o.line,u),Z(o.line);if(o.rest)for(var c=0;c<o.rest.length;c++)Z(o.rest[c])}}}function Z(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function et(e){var t=e.display,n={},r={},i=t.gutters.clientLeft;for(var s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o)n[e.options.gutters[o]]=s.offsetLeft+s.clientLeft+i,r[e.options.gutters[o]]=s.clientWidth;return{fixedPos:X(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function tt(e,t,n){function a(t){var n=t.nextSibling;return s&&d&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild,f=r.view,l=r.viewFrom;for(var c=0;c<f.length;c++){var h=f[c];if(!h.hidden)if(!h.node||h.node.parentNode!=o){var p=lt(e,h,l,n);o.insertBefore(p,u)}else{while(u!=h.node)u=a(u);var v=i&&t!=null&&t<=l&&h.lineNumber;h.changes&&(Yo(h.changes,"gutter")>-1&&(v=!1),nt(e,h,l,n)),v&&(hu(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(W(e.options,l)))),u=h.node.nextSibling}l+=h.size}while(u)u=a(u)}function nt(e,t,n,r){for(var i=0;i<t.changes.length;i++){var s=t.changes[i];s=="text"?ot(e,t):s=="gutter"?at(e,t,n,r):s=="class"?ut(t):s=="widget"&&ft(e,t,r)}t.changes=null}function rt(e){return e.node==e.text&&(e.node=lu("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),r&&i<8&&(e.node.style.zIndex=2)),e.node}function it(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;t&&(t+=" CodeMirror-linebackground");if(e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=rt(e);e.background=n.insertBefore(lu("div",null,t),n.firstChild)}}function st(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):js(e,t)}function ot(e,t){var n=t.text.className,r=st(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ut(t)):n&&(t.text.className=n)}function ut(e){it(e),e.line.wrapClass?rt(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function at(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var s=rt(t),o=t.gutter=lu("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px");e.display.input.setUneditable(o),s.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!i||!i["CodeMirror-linenumbers"])&&(t.lineNumber=o.appendChild(lu("div",W(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px")));if(i)for(var u=0;u<e.options.gutters.length;++u){var a=e.options.gutters[u],f=i.hasOwnProperty(a)&&i[a];f&&o.appendChild(lu("div",[f],"CodeMirror-gutter-elt","left: "+r.gutterLeft[a]+"px; width: "+r.gutterWidth[a]+"px"))}}}function ft(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,i;r;r=i){var i=r.nextSibling;r.className=="CodeMirror-linewidget"&&t.node.removeChild(r)}ct(e,t,n)}function lt(e,t,n,r){var i=st(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ut(t),at(e,t,n,r),ct(e,t,r),t.node}function ct(e,t,n){ht(e,t.line,t,n,!0);if(t.rest)for(var r=0;r<t.rest.length;r++)ht(e,t.rest[r],t,n,!1)}function ht(e,t,n,r,i){if(!t.widgets)return;var s=rt(n);for(var o=0,u=t.widgets;o<u.length;++o){var a=u[o],f=lu("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||f.setAttribute("cm-ignore-events","true"),pt(a,f,n,r),e.display.input.setUneditable(f),i&&a.above?s.insertBefore(f,n.gutter||n.text):s.appendChild(f),Po(a,"redraw")}}function pt(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mt(e){return dt(e.line,e.ch)}function gt(e,t){return vt(e,t)<0?t:e}function yt(e,t){return vt(e,t)<0?e:t}function bt(e){e.state.focused||(e.display.input.focus(),Vr(e))}function wt(e){return e.options.readOnly||e.doc.cantEdit}function St(e,t,n,r){var i=e.doc;e.display.shift=!1,r||(r=i.sel);var s=Au(t),o=null;e.state.pasteIncoming&&r.ranges.length>1&&(Et&&Et.join("\n")==t?o=r.ranges.length%Et.length==0&&Zo(Et,Au):s.length==r.ranges.length&&(o=Zo(s,function(e){return[e]})));for(var u=r.ranges.length-1;u>=0;u--){var a=r.ranges[u],f=a.from(),l=a.to();a.empty()&&(n&&n>0?f=dt(f.line,f.ch-n):e.state.overwrite&&!e.state.pasteIncoming&&(l=dt(l.line,Math.min(eo(i,l.line).text.length,l.ch+Qo(s).length))));var c=e.curOp.updateInput,h={from:f,to:l,text:o?o[u%o.length]:s,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};ni(e.doc,h),Po(e,"inputRead",e,h);if(t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&a.head.ch<100&&(!u||r.ranges[u-1].head.line!=a.head.line)){var p=e.getModeAt(a.head),d=Qr(h);if(p.electricChars){for(var v=0;v<p.electricChars.length;v++)if(t.indexOf(p.electricChars.charAt(v))>-1){mi(e,d.line,"smart");break}}else p.electricInput&&p.electricInput.test(eo(i,d.line).text.slice(0,d.ch))&&mi(e,d.line,"smart")}}di(e),e.curOp.updateInput=c,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function xt(e){var t=[],n=[];for(var r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,s={anchor:dt(i,0),head:dt(i+1,0)};n.push(s),t.push(e.getRange(s.anchor,s.head))}return{text:t,ranges:n}}function Tt(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function Nt(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Xo,this.inaccurateSelection=!1,this.hasSelection=!1}function Ct(){var e=lu("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=lu("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),h&&(e.style.border="1px solid black"),Tt(e),t}function kt(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Xo}function Lt(e,t){var n=En(e,t.line);if(!n||n.hidden)return null;var r=eo(e.doc,t.line),i=yn(n,r,t.line),s=uo(r),o="left";if(s){var u=Xu(s,t.ch);o=u%2?"right":"left"}var a=Nn(i.map,t.ch,"left");return a.offset=a.collapse=="right"?a.end:a.start,a}function At(e,t){return t&&(e.bad=!0),e}function Ot(e,t,n){var r;if(t==e.display.lineDiv){r=e.display.lineDiv.childNodes[n];if(!r)return At(e.clipPos(dt(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var s=e.display.view[i];if(s.node==r)return Mt(s,t,n)}}function Mt(e,t,n){function l(t,n,r){for(var i=-1;i<(f?f.length:0);i++){var s=i<0?a.map:f[i];for(var o=0;o<s.length;o+=3){var u=s[o+2];if(u==t||u==n){var l=io(i<0?e.line:e.rest[i]),c=s[o]+r;if(r<0||u!=t)c=s[o+(r?1:0)];return dt(l,c)}}}}var r=e.text.firstChild,i=!1;if(!t||!du(r,t))return At(dt(io(e.line),0),!0);if(t==r){i=!0,t=r.childNodes[n],n=0;if(!t){var s=e.rest?Qo(e.rest):e.line;return At(dt(io(s),s.text.length),i)}}var o=t.nodeType==3?t:null,u=t;!o&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(o=t.firstChild,n&&(n=o.nodeValue.length));while(u.parentNode!=r)u=u.parentNode;var a=e.measure,f=a.maps,c=l(o,u,n);if(c)return At(c,i);for(var h=u.nextSibling,p=o?o.nodeValue.length-n:0;h;h=h.nextSibling){c=l(h,h.firstChild,0);if(c)return At(dt(c.line,c.ch-p),i);p+=h.textContent.length}for(var d=u.previousSibling,p=n;d;d=d.previousSibling){c=l(d,d.firstChild,-1);if(c)return At(dt(c.line,c.ch+p),i);p+=h.textContent.length}}function _t(e,t,n,r,i){function u(e){return function(t){return t.id==e}}function a(t){if(t.nodeType==1){var n=t.getAttribute("cm-text");if(n!=null){n==""&&(n=t.textContent.replace(/\u200b/g,"")),s+=n;return}var f=t.getAttribute("cm-marker"),l;if(f){var c=e.findMarks(dt(r,0),dt(i+1,0),u(+f));c.length&&(l=c[0].find())&&(s+=to(e.doc,l.from,l.to).join("\n"));return}if(t.getAttribute("contenteditable")=="false")return;for(var h=0;h<t.childNodes.length;h++)a(t.childNodes[h]);/^(pre|div|p)$/i.test(t.nodeName)&&(o=!0)}else if(t.nodeType==3){var p=t.nodeValue;if(!p)return;o&&(s+="\n",o=!1),s+=p}}var s="",o=!1;for(;;){a(t);if(t==n)break;t=t.nextSibling}return s}function Dt(e,t){this.ranges=e,this.primIndex=t}function Pt(e,t){this.anchor=e,this.head=t}function Ht(e,t){var n=e[t];e.sort(function(e,t){return vt(e.from(),t.from())}),t=Yo(e,n);for(var r=1;r<e.length;r++){var i=e[r],s=e[r-1];if(vt(s.to(),i.from())>=0){var o=yt(s.from(),i.from()),u=gt(s.to(),i.to()),a=s.empty()?i.from()==i.head:s.from()==s.head;r<=t&&--t,e.splice(--r,2,new Pt(a?u:o,a?o:u))}}return new Dt(e,t)}function Bt(e,t){return new Dt([new Pt(e,t||e)],0)}function jt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ft(e,t){if(t.line<e.first)return dt(e.first,0);var n=e.first+e.size-1;return t.line>n?dt(n,eo(e,n).text.length):It(t,eo(e,t.line).text.length)}function It(e,t){var n=e.ch;return n==null||n>t?dt(e.line,t):n<0?dt(e.line,0):e}function qt(e,t){return t>=e.first&&t<e.first+e.size}function Rt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Ft(e,t[r]);return n}function Ut(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var s=vt(n,i)<0;s!=vt(r,i)<0?(i=n,n=r):s!=vt(n,r)<0&&(n=r)}return new Pt(i,n)}return new Pt(r||n,n)}function zt(e,t,n,r){Kt(e,new Dt([Ut(e,e.sel.primary(),t,n)],0),r)}function Wt(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=Ut(e,e.sel.ranges[i],t[i],null);var s=Ht(r,e.sel.primIndex);Kt(e,s,n)}function Xt(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Kt(e,Ht(i,e.sel.primIndex),r)}function Vt(e,t,n,r){Kt(e,Bt(t,n),r)}function $t(e,t){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new Pt(Ft(e,t[n].anchor),Ft(e,t[n].head))}};return _o(e,"beforeSelectionChange",e,n),e.cm&&_o(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Ht(n.ranges,n.ranges.length-1):t}function Jt(e,t,n){var r=e.history.done,i=Qo(r);i&&i.ranges?(r[r.length-1]=t,Qt(e,t,n)):Kt(e,t,n)}function Kt(e,t,n){Qt(e,t,n),vo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Qt(e,t,n){if(Fo(e,"beforeSelectionChange")||e.cm&&Fo(e.cm,"beforeSelectionChange"))t=$t(e,t);var r=n&&n.bias||(vt(t.primary().head,e.sel.primary().head)<0?-1:1);Gt(e,Zt(e,t,r,!0)),(!n||n.scroll!==!1)&&e.cm&&di(e.cm)}function Gt(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,jo(e.cm)),Po(e,"cursorActivity",e)}function Yt(e){Gt(e,Zt(e,e.sel,null,!1),Uo)}function Zt(e,t,n,r){var i;for(var s=0;s<t.ranges.length;s++){var o=t.ranges[s],u=en(e,o.anchor,n,r),a=en(e,o.head,n,r);if(i||u!=o.anchor||a!=o.head)i||(i=t.ranges.slice(0,s)),i[s]=new Pt(u,a)}return i?Ht(i,t.primIndex):t}function en(e,t,n,r){var i=!1,s=t,o=n||1;e.cantEdit=!1;e:for(;;){var u=eo(e,s.line);if(u.markedSpans)for(var a=0;a<u.markedSpans.length;++a){var f=u.markedSpans[a],l=f.marker;if((f.from==null||(l.inclusiveLeft?f.from<=s.ch:f.from<s.ch))&&(f.to==null||(l.inclusiveRight?f.to>=s.ch:f.to>s.ch))){if(r){_o(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find(o<0?-1:1);if(vt(c,s)==0){c.ch+=o,c.ch<0?c.line>e.first?c=Ft(e,dt(c.line-1)):c=null:c.ch>u.text.length&&(c.line<e.first+e.size-1?c=dt(c.line+1,0):c=null);if(!c){if(i)return r?(e.cantEdit=!0,dt(e.first,0)):en(e,t,n,!0);i=!0,c=t,o=-o}}s=c;continue e}}return s}}function tn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function nn(e,t){var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),s=r.selection=document.createDocumentFragment();for(var o=0;o<n.sel.ranges.length;o++){if(t===!1&&o==n.sel.primIndex)continue;var u=n.sel.ranges[o],a=u.empty();(a||e.options.showCursorWhenSelecting)&&rn(e,u,i),a||sn(e,u,s)}return r}function rn(e,t,n){var r=Bn(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(lu("div","ย ","CodeMirror-cursor"));i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px";if(r.other){var s=n.appendChild(lu("div","ย ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=r.other.left+"px",s.style.top=r.other.top+"px",s.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function sn(e,t,n){function f(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild(lu("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(n==null?a-e:n)+"px; height: "+(r-t)+"px"))}function l(t,n,r){function h(n,r){return Hn(e,dt(t,n),"div",s,r)}var s=eo(i,t),o=s.text.length,l,c;return Hu(uo(s),n||0,r==null?o:r,function(e,t,i){var s=h(e,"left"),p,d,v;if(e==t)p=s,d=v=s.left;else{p=h(t-1,"right");if(i=="rtl"){var m=s;s=p,p=m}d=s.left,v=p.right}n==null&&e==0&&(d=u),p.top-s.top>3&&(f(d,s.top,null,s.bottom),d=u,s.bottom<p.top&&f(d,s.bottom,null,p.top)),r==null&&t==o&&(v=a);if(!l||s.top<l.top||s.top==l.top&&s.left<l.left)l=s;if(!c||p.bottom>c.bottom||p.bottom==c.bottom&&p.right>c.right)c=p;d<u+1&&(d=u),f(d,p.top,v-d,p.bottom)}),{start:l,end:c}}var r=e.display,i=e.doc,s=document.createDocumentFragment(),o=pn(e.display),u=o.left,a=Math.max(r.sizerWidth,vn(e)-r.sizer.offsetLeft)-o.right,c=t.from(),h=t.to();if(c.line==h.line)l(c.line,c.ch,h.ch);else{var p=eo(i,c.line),d=eo(i,h.line),v=ps(p)==ps(d),m=l(c.line,c.ch,v?p.text.length+1:null).end,g=l(h.line,v?0:null,h.ch).start;v&&(m.top<g.top-2?(f(m.right,m.top,null,m.bottom),f(u,g.top,g.left,g.bottom)):f(m.right,m.top,g.left-m.right,m.bottom)),m.bottom<g.top&&f(u,m.bottom,null,g.top)}n.appendChild(s)}function on(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function un(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,ru(an,e))}function an(e){var t=e.doc;t.frontier<t.first&&(t.frontier=t.first);if(t.frontier>=e.display.viewTo)return;var n=+(new Date)+e.options.workTime,r=Oi(t.mode,ln(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(t.frontier>=e.display.viewFrom){var o=s.styles,u=Ms(e,s,r,!0);s.styles=u.styles;var a=s.styleClasses,f=u.classes;f?s.styleClasses=f:a&&(s.styleClasses=null);var l=!o||o.length!=s.styles.length||a!=f&&(!a||!f||a.bgClass!=f.bgClass||a.textClass!=f.textClass);for(var c=0;!l&&c<o.length;++c)l=o[c]!=s.styles[c];l&&i.push(t.frontier),s.stateAfter=Oi(t.mode,r)}else Ds(e,s.text,r),s.stateAfter=t.frontier%5==0?Oi(t.mode,r):null;++t.frontier;if(+(new Date)>n)return un(e,e.options.workDelay),!0}),i.length&&tr(e,function(){for(var t=0;t<i.length;t++)ar(e,i[t],"text")})}function fn(e,t,n){var r,i,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100);for(var u=t;u>o;--u){if(u<=s.first)return s.first;var a=eo(s,u-1);if(a.stateAfter&&(!n||u<=s.frontier))return u;var f=Vo(a.text,null,e.options.tabSize);if(i==null||r>f)i=u-1,r=f}return i}function ln(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var s=fn(e,t,n),o=s>r.first&&eo(r,s-1).stateAfter;return o?o=Oi(r.mode,o):o=Mi(r.mode),r.iter(s,t,function(n){Ds(e,n.text,o);var u=s==t-1||s%5==0||s>=i.viewFrom&&s<i.viewTo;n.stateAfter=u?Oi(r.mode,o):null,++s}),n&&(r.frontier=s),o}function cn(e){return e.lineSpace.offsetTop}function hn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function pn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=pu(e.measure,lu("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function dn(e){return qo-e.display.nativeBarWidth}function vn(e){return e.display.scroller.clientWidth-dn(e)-e.display.barWidth}function mn(e){return e.display.scroller.clientHeight-dn(e)-e.display.barHeight}function gn(e,t,n){var r=e.options.lineWrapping,i=r&&vn(e);if(!t.measure.heights||r&&t.measure.width!=i){var s=t.measure.heights=[];if(r){t.measure.width=i;var o=t.text.firstChild.getClientRects();for(var u=0;u<o.length-1;u++){var a=o[u],f=o[u+1];Math.abs(a.bottom-f.bottom)>2&&s.push((a.bottom+f.top)/2-n.top)}}s.push(n.bottom-n.top)}}function yn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(io(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function bn(e,t){t=ps(t);var n=io(t),r=e.display.externalMeasured=new sr(e.doc,t,n);r.lineN=n;var i=r.built=js(e,r);return r.text=i.pre,pu(e.display.lineMeasure,i.pre),r}function wn(e,t,n,r){return xn(e,Sn(e,t),n,r)}function En(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[lr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Sn(e,t){var n=io(t),r=En(e,n);r&&!r.text?r=null:r&&r.changes&&nt(e,r,n,et(e)),r||(r=bn(e,t));var i=yn(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function xn(e,t,n,r,i){t.before&&(n=-1);var s=n+(r||""),o;return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(gn(e,t.view,t.rect),t.hasHeights=!0),o=Cn(e,t,n,r),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Nn(e,t,n){var r,i,s,o;for(var u=0;u<e.length;u+=3){var a=e[u],f=e[u+1];if(t<a)i=0,s=1,o="left";else if(t<f)i=t-a,s=i+1;else if(u==e.length-3||t==f&&e[u+3]>t)s=f-a,i=s-1,t>=f&&(o="right");if(i!=null){r=e[u+2],a==f&&n==(r.insertLeft?"left":"right")&&(o=n);if(n=="left"&&i==0)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)r=e[(u-=3)+2],o="left";if(n=="right"&&i==f-a)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft)r=e[(u+=3)+2],o="right";break}}return{node:r,start:i,end:s,collapse:o,coverStart:a,coverEnd:f}}function Cn(e,t,n,s){var o=Nn(t.map,n,s),u=o.node,a=o.start,f=o.end,l=o.collapse,c;if(u.nodeType==3){for(var h=0;h<4;h++){while(a&&fu(t.line.text.charAt(o.coverStart+a)))--a;while(o.coverStart+f<o.coverEnd&&fu(t.line.text.charAt(o.coverStart+f)))++f;if(r&&i<9&&a==0&&f==o.coverEnd-o.coverStart)c=u.parentNode.getBoundingClientRect();else if(r&&e.options.lineWrapping){var p=cu(u,a,f).getClientRects();p.length?c=p[s=="right"?p.length-1:0]:c=Tn}else c=cu(u,a,f).getBoundingClientRect()||Tn;if(c.left||c.right||a==0)break;f=a,a-=1,l="right"}r&&i<11&&(c=kn(e.display.measure,c))}else{a>0&&(l=s="right");var p;e.options.lineWrapping&&(p=u.getClientRects()).length>1?c=p[s=="right"?p.length-1:0]:c=u.getBoundingClientRect()}if(r&&i<9&&!a&&(!c||!c.left&&!c.right)){var d=u.parentNode.getClientRects()[0];d?c={left:d.left,right:d.left+zn(e.display),top:d.top,bottom:d.bottom}:c=Tn}var v=c.top-t.rect.top,m=c.bottom-t.rect.top,g=(v+m)/2,y=t.view.measure.heights;for(var h=0;h<y.length-1;h++)if(g<y[h])break;var b=h?y[h-1]:0,w=y[h],E={left:(l=="right"?c.right:c.left)-t.rect.left,right:(l=="left"?c.left:c.right)-t.rect.left,top:b,bottom:w};return!c.left&&!c.right&&(E.bogus=!0),e.options.singleCursorHeightPerLine||(E.rtop=v,E.rbottom=m),E}function kn(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Du(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Ln(e){if(e.measure){e.measure.cache={},e.measure.heights=null;if(e.rest)for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}}function An(e){e.display.externalMeasure=null,hu(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ln(e.display.view[t])}function On(e){An(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Mn(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function _n(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Dn(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var s=Es(t.widgets[i]);n.top+=s,n.bottom+=s}if(r=="line")return n;r||(r="local");var o=oo(t);r=="local"?o+=cn(e.display):o-=e.display.viewOffset;if(r=="page"||r=="window"){var u=e.display.lineSpace.getBoundingClientRect();o+=u.top+(r=="window"?0:_n());var a=u.left+(r=="window"?0:Mn());n.left+=a,n.right+=a}return n.top+=o,n.bottom+=o,n}function Pn(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Mn(),i-=_n();else if(n=="local"||!n){var s=e.display.sizer.getBoundingClientRect();r+=s.left,i+=s.top}var o=e.display.lineSpace.getBoundingClientRect();return{left:r-o.left,top:i-o.top}}function Hn(e,t,n,r,i){return r||(r=eo(e.doc,t.line)),Dn(e,r,wn(e,r,t.ch,i),n)}function Bn(e,t,n,r,i,s){function o(t,o){var u=xn(e,i,t,o?"right":"left",s);return o?u.left=u.right:u.right=u.left,Dn(e,r,u,n)}function u(e,t){var n=a[t],r=n.level%2;return e==Bu(n)&&t&&n.level<a[t-1].level?(n=a[--t],e=ju(n)-(n.level%2?0:1),r=!0):e==ju(n)&&t<a.length-1&&n.level<a[t+1].level&&(n=a[++t],e=Bu(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?o(e-1):o(e,r)}r=r||eo(e.doc,t.line),i||(i=Sn(e,r));var a=uo(r),f=t.ch;if(!a)return o(f);var l=Xu(a,f),c=u(f,l);return Wu!=null&&(c.other=u(f,Wu)),c}function jn(e,t){var n=0,t=Ft(e.doc,t);e.options.lineWrapping||(n=zn(e.display)*t.ch);var r=eo(e.doc,t.line),i=oo(r)+cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Fn(e,t,n,r){var i=dt(e,t);return i.xRel=r,n&&(i.outside=!0),i}function In(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return Fn(r.first,0,!0,-1);var i=so(r,n),s=r.first+r.size-1;if(i>s)return Fn(r.first+r.size-1,eo(r,s).text.length,!0,1);t<0&&(t=0);var o=eo(r,i);for(;;){var u=qn(e,o,i,t,n),a=cs(o),f=a&&a.find(0,!0);if(!a||!(u.ch>f.from.ch||u.ch==f.from.ch&&u.xRel>0))return u;i=io(o=f.to.line)}}function qn(e,t,n,r,i){function f(r){var i=Bn(e,dt(n,r),"line",t,a);return o=!0,s>i.bottom?i.left-u:s<i.top?i.left+u:(o=!1,i.left)}var s=i-oo(t),o=!1,u=2*e.display.wrapper.clientWidth,a=Sn(e,t),l=uo(t),c=t.text.length,h=Fu(t),p=Iu(t),d=f(h),v=o,m=f(p),g=o;if(r>m)return Fn(n,p,g,1);for(;;){if(l?p==h||p==$u(t,h,1):p-h<=1){var y=r<d||r-d<=m-r?h:p,b=r-(y==h?d:m);while(fu(t.text.charAt(y)))++y;var w=Fn(n,y,y==h?v:g,b<-1?-1:b>1?1:0);return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;x<E;++x)S=$u(t,S,1)}var T=f(S);if(T>r){p=S,m=T;if(g=o)m+=1e3;c=E}else h=S,d=T,v=o,c-=E}}function Un(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rn==null){Rn=lu("pre");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(lu("br"));Rn.appendChild(document.createTextNode("x"))}pu(e.measure,Rn);var n=Rn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),hu(e.measure),n||1}function zn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=lu("span","xxxxxxxxxx"),n=lu("pre",[t]);pu(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Vn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Xn},Wn?Wn.ops.push(e.curOp):e.curOp.ownsGroup=Wn={ops:[e.curOp],delayedCallbacks:[]}}function $n(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n]();for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<t.length)}function Jn(e){var t=e.curOp,n=t.ownsGroup;if(!n)return;try{$n(n)}finally{Wn=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Kn(n)}}function Kn(e){var t=e.ops;for(var n=0;n<t.length;n++)Qn(t[n]);for(var n=0;n<t.length;n++)Gn(t[n]);for(var n=0;n<t.length;n++)Yn(t[n]);for(var n=0;n<t.length;n++)Zn(t[n]);for(var n=0;n<t.length;n++)er(t[n])}function Qn(e){var t=e.cm,n=t.display;$(t),e.updateMaxLine&&D(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new V(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Gn(e){e.updatedDisplay=e.mustUpdate&&J(e.cm,e.update)}function Yn(e){var t=e.cm,n=t.display;e.updatedDisplay&&Y(t),e.barMeasure=H(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=wn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+dn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vn(t)));if(e.updatedDisplay||e.selectionChanged)e.preparedSelection=n.input.prepareSelection()}function Zn(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&G(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&I(t,e.barMeasure),e.selectionChanged&&on(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing)}function er(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&K(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&(n.scroller.scrollTop!=e.scrollTop||e.forceScroll)&&(r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(r.scrollTop),n.scroller.scrollTop=r.scrollTop),e.scrollLeft!=null&&(n.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)&&(r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-vn(t),e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,U(t));if(e.scrollToPos){var i=li(t,Ft(r,e.scrollToPos.from),Ft(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&fi(t,i)}var s=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(s)for(var u=0;u<s.length;++u)s[u].lines.length||_o(s[u],"hide");if(o)for(var u=0;u<o.length;++u)o[u].lines.length&&_o(o[u],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_o(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function tr(e,t){if(e.curOp)return t();Vn(e);try{return t()}finally{Jn(e)}}function nr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Vn(e);try{return t.apply(e,arguments)}finally{Jn(e)}}}function rr(e){return function(){if(this.curOp)return e.apply(this,arguments);Vn(this);try{return e.apply(this,arguments)}finally{Jn(this)}}}function ir(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Vn(t);try{return e.apply(this,arguments)}finally{Jn(t)}}}function sr(e,t,n){this.line=t,this.rest=ds(t),this.size=this.rest?io(Qo(this.rest))-n+1:1,this.node=this.text=null,this.hidden=gs(e,t)}function or(e,t,n){var r=[],i;for(var s=t;s<n;s=i){var o=new sr(e.doc,eo(e.doc,s),s);i=s+o.size,r.push(o)}return r}function ur(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0;if(t>=i.viewTo)w&&vs(e.doc,t)<i.viewTo&&fr(e);else if(n<=i.viewFrom)w&&ms(e.doc,n+r)>i.viewFrom?fr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)fr(e);else if(t<=i.viewFrom){var s=cr(e,n,n+r,1);s?(i.view=i.view.slice(s.index),i.viewFrom=s.lineN,i.viewTo+=r):fr(e)}else if(n>=i.viewTo){var s=cr(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):fr(e)}else{var o=cr(e,t,t,-1),u=cr(e,n,n+r,1);o&&u?(i.view=i.view.slice(0,o.index).concat(or(e,o.lineN,u.lineN)).concat(i.view.slice(u.index)),i.viewTo+=r):fr(e)}var a=i.externalMeasured;a&&(n<a.lineN?a.lineN+=r:t<a.lineN+a.size&&(i.externalMeasured=null))}function ar(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null);if(t<r.viewFrom||t>=r.viewTo)return;var s=r.view[lr(e,t)];if(s.node==null)return;var o=s.changes||(s.changes=[]);Yo(o,n)==-1&&o.push(n)}function fr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function lr(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var n=e.display.view;for(var r=0;r<n.length;r++){t-=n[r].size;if(t<0)return r}}function cr(e,t,n,r){var i=lr(e,t),s,o=e.display.view;if(!w||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var u=0,a=e.display.viewFrom;u<i;u++)a+=o[u].size;if(a!=t){if(r>0){if(i==o.length-1)return null;s=a+o[i].size-t,i++}else s=a-t;t+=s,n+=s}while(vs(e.doc,n)!=n){if(i==(r<0?0:o.length-1))return null;n+=r*o[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function hr(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=or(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=or(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(lr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(or(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,lr(e,n)))),r.viewTo=n}function pr(e){var t=e.display.view,n=0;for(var r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function dr(e){function o(){t.activeTouch&&(n=setTimeout(function(){t.activeTouch=null},1e3),s=t.activeTouch,s.end=+(new Date))}function u(e){if(e.touches.length!=1)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function a(e,t){if(t.left==null)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}function f(t){Bo(e,t)||ko(t)}var t=e.display;Oo(t.scroller,"mousedown",nr(e,yr)),r&&i<11?Oo(t.scroller,"dblclick",nr(e,function(t){if(Bo(e,t))return;var n=gr(e,t);if(!n||Nr(e,t)||mr(e.display,t))return;To(t);var r=e.findWordAt(n);zt(e.doc,r.anchor,r.head)})):Oo(t.scroller,"dblclick",function(t){Bo(e,t)||To(t)}),y||Oo(t.scroller,"contextmenu",function(t){Jr(e,t)});var n,s={end:0};Oo(t.scroller,"touchstart",function(e){if(!u(e)){clearTimeout(n);var r=+(new Date);t.activeTouch={start:r,moved:!1,prev:r-s.end<=300?s:null},e.touches.length==1&&(t.activeTouch.left=e.touches[0].pageX,t.activeTouch.top=e.touches[0].pageY)}}),Oo(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oo(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!mr(t,n)&&r.left!=null&&!r.moved&&new Date-r.start<300){var i=e.coordsChar(t.activeTouch,"page"),s;!r.prev||a(r,r.prev)?s=new Pt(i,i):!r.prev.prev||a(r,r.prev.prev)?s=e.findWordAt(i):s=new Pt(dt(i.line,0),Ft(e.doc,dt(i.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),To(n)}o()}),Oo(t.scroller,"touchcancel",o),Oo(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ar(e,t.scroller.scrollTop),Or(e,t.scroller.scrollLeft,!0),_o(e,"scroll",e))}),Oo(t.scroller,"mousewheel",function(t){Pr(e,t)}),Oo(t.scroller,"DOMMouseScroll",function(t){Pr(e,t)}),Oo(t.wrapper,"scroll",function(){t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),e.options.dragDrop&&(Oo(t.scroller,"dragstart",function(t){Lr(e,t)}),Oo(t.scroller,"dragenter",f),Oo(t.scroller,"dragover",f),Oo(t.scroller,"drop",nr(e,kr)));var l=t.input.getField();Oo(l,"keyup",function(t){Wr.call(e,t)}),Oo(l,"keydown",nr(e,Ur)),Oo(l,"keypress",nr(e,Xr)),Oo(l,"focus",ru(Vr,e)),Oo(l,"blur",ru($r,e))}function vr(e){var t=e.display;if(t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth)return;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}function mr(e,t){for(var n=Lo(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function gr(e,t,n,r){var i=e.display;if(!n&&Lo(t).getAttribute("cm-not-content")=="true")return null;var s,o,u=i.lineSpace.getBoundingClientRect();try{s=t.clientX-u.left,o=t.clientY-u.top}catch(t){return null}var a=In(e,s,o),f;if(r&&a.xRel==1&&(f=eo(e.doc,a.line).text).length==a.ch){var l=Vo(f,f.length,e.options.tabSize)-f.length;a=dt(a.line,Math.max(0,Math.round((s-pn(e.display).left)/zn(e.display))-l))}return a}function yr(e){var t=this,n=t.display;if(n.activeTouch&&n.input.supportsTouch()||Bo(t,e))return;n.shift=e.shiftKey;if(mr(n,e)){s||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100));return}if(Nr(t,e))return;var r=gr(t,e);window.focus();switch(Ao(e)){case 1:r?Er(t,e,r):Lo(e)==n.scroller&&To(e);break;case 2:s&&(t.state.lastMiddleDown=+(new Date)),r&&zt(t.doc,r),setTimeout(function(){n.input.focus()},20),To(e);break;case 3:y&&Jr(t,e)}}function Er(e,t,n){r?setTimeout(ru(bt,e),0):bt(e);var i=+(new Date),s;wr&&wr.time>i-400&&vt(wr.pos,n)==0?s="triple":br&&br.time>i-400&&vt(br.pos,n)==0?(s="double",wr={time:i,pos:n}):(s="single",br={time:i,pos:n});var o=e.doc.sel,u=d?t.metaKey:t.ctrlKey,a;e.options.dragDrop&&Tu&&!wt(e)&&s=="single"&&(a=o.contains(n))>-1&&!o.ranges[a].empty()?Sr(e,t,n,u):xr(e,t,n,s,u)}function Sr(e,t,n,o){var u=e.display,a=nr(e,function(f){s&&(u.scroller.draggable=!1),e.state.draggingText=!1,Mo(document,"mouseup",a),Mo(u.scroller,"drop",a),Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)<10&&(To(f),o||zt(e.doc,n),u.input.focus(),r&&i==9&&setTimeout(function(){document.body.focus(),u.input.focus()},20))});s&&(u.scroller.draggable=!0),e.state.draggingText=a,u.scroller.dragDrop&&u.scroller.dragDrop(),Oo(document,"mouseup",a),Oo(u.scroller,"drop",a)}function xr(e,t,n,r,i){function d(t){if(vt(p,t)==0)return;p=t;if(r=="rect"){var i=[],s=e.options.tabSize,l=Vo(eo(o,n.line).text,n.ch,s),c=Vo(eo(o,t.line).text,t.ch,s),h=Math.min(l,c),d=Math.max(l,c);for(var v=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));v<=m;v++){var g=eo(o,v).text,y=$o(g,h,s);h==d?i.push(new Pt(dt(v,y),dt(v,y))):g.length>y&&i.push(new Pt(dt(v,y),dt(v,$o(g,d,s))))}i.length||i.push(new Pt(n,n)),Kt(o,Ht(f.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,E=t;if(r!="single"){if(r=="double")var S=e.findWordAt(t);else var S=new Pt(dt(t.line,0),Ft(o,dt(t.line+1,0)));vt(S.anchor,w)>0?(E=S.head,w=yt(b.from(),S.anchor)):(E=S.anchor,w=gt(b.to(),S.head))}var i=f.ranges.slice(0);i[a]=new Pt(Ft(o,w),E),Kt(o,Ht(i,a),zo)}}function g(t){var n=++m,i=gr(e,t,!0,r=="rect");if(!i)return;if(vt(i,p)!=0){bt(e),d(i);var u=R(s,o);(i.line>=u.to||i.line<u.from)&&setTimeout(nr(e,function(){m==n&&g(t)}),150)}else{var a=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;a&&setTimeout(nr(e,function(){if(m!=n)return;s.scroller.scrollTop+=a,g(t)}),50)}}function y(e){m=Infinity,To(e),s.input.focus(),Mo(document,"mousemove",b),Mo(document,"mouseup",w),o.history.lastSelOrigin=null}var s=e.display,o=e.doc;To(t);var u,a,f=o.sel,l=f.ranges;i&&!t.shiftKey?(a=o.sel.contains(n),a>-1?u=l[a]:u=new Pt(n,n)):u=o.sel.primary();if(t.altKey)r="rect",i||(u=new Pt(n,n)),n=gr(e,t,!0,!0),a=-1;else if(r=="double"){var c=e.findWordAt(n);e.display.shift||o.extend?u=Ut(o,u,c.anchor,c.head):u=c}else if(r=="triple"){var h=new Pt(dt(n.line,0),Ft(o,dt(n.line+1,0)));e.display.shift||o.extend?u=Ut(o,u,h.anchor,h.head):u=h}else u=Ut(o,u,n);i?a==-1?(a=l.length,Kt(o,Ht(l.concat([u]),a),{scroll:!1,origin:"*mouse"})):l.length>1&&l[a].empty()&&r=="single"?(Kt(o,Ht(l.slice(0,a).concat(l.slice(a+1)),0)),f=o.sel):Xt(o,a,u,zo):(a=0,Kt(o,new Dt([u],0),zo),f=o.sel);var p=n,v=s.wrapper.getBoundingClientRect(),m=0,b=nr(e,function(e){Ao(e)?g(e):y(e)}),w=nr(e,y);Oo(document,"mousemove",b),Oo(document,"mouseup",w)}function Tr(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&To(t);var u=e.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!Fo(e,n))return Co(t);o-=a.top-u.viewOffset;for(var f=0;f<e.options.gutters.length;++f){var l=u.gutters.childNodes[f];if(l&&l.getBoundingClientRect().right>=s){var c=so(e.doc,o),h=e.options.gutters[f];return i(e,n,e,c,h,t),Co(t)}}}function Nr(e,t){return Tr(e,t,"gutterClick",!0,Po)}function kr(e){var t=this;if(Bo(t,e)||mr(t.display,e))return;To(e),r&&(Cr=+(new Date));var n=gr(t,e,!0),i=e.dataTransfer.files;if(!n||wt(t))return;if(i&&i.length&&window.FileReader&&window.File){var s=i.length,o=Array(s),u=0,a=function(e,r){var i=new FileReader;i.onload=nr(t,function(){o[r]=i.result;if(++u==s){n=Ft(t.doc,n);var e={from:n,to:n,text:Au(o.join("\n")),origin:"paste"};ni(t.doc,e),Jt(t.doc,Bt(n,Qr(e)))}}),i.readAsText(e)};for(var f=0;f<s;++f)a(i[f],f)}else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){t.display.input.focus()},20);return}try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&(d?!e.metaKey:!e.ctrlKey))var l=t.listSelections();Qt(t.doc,Bt(n,n));if(l)for(var f=0;f<l.length;++f)ai(t.doc,"",l[f].anchor,l[f].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}function Lr(e,t){if(r&&(!e.state.draggingText||+(new Date)-Cr<100)){ko(t);return}if(Bo(e,t)||mr(e.display,t))return;t.dataTransfer.setData("Text",e.getSelection());if(t.dataTransfer.setDragImage&&!f){var n=lu("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",a&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),a&&n.parentNode.removeChild(n)}}function Ar(t,n){if(Math.abs(t.doc.scrollTop-n)<2)return;t.doc.scrollTop=n,e||Q(t,{top:n}),t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n),t.display.scrollbars.setScrollTop(n),e&&Q(t),un(t,100)}function Or(e,t,n){if(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)return;t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,U(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Pr(t,n){var r=Dr(n),i=r.x,o=r.y,u=t.display,f=u.scroller;if(!(i&&f.scrollWidth>f.clientWidth||o&&f.scrollHeight>f.clientHeight))return;if(o&&d&&s)e:for(var l=n.target,c=u.view;l!=f;l=l.parentNode)for(var h=0;h<c.length;h++)if(c[h].node==l){t.display.currentWheelTarget=l;break e}if(i&&!e&&!a&&_r!=null){o&&Ar(t,Math.max(0,Math.min(f.scrollTop+o*_r,f.scrollHeight-f.clientHeight))),Or(t,Math.max(0,Math.min(f.scrollLeft+i*_r,f.scrollWidth-f.clientWidth))),To(n),u.wheelStartX=null;return}if(o&&_r!=null){var p=o*_r,v=t.doc.scrollTop,m=v+u.wrapper.clientHeight;p<0?v=Math.max(0,v+p-50):m=Math.min(t.doc.height,m+p+50),Q(t,{top:v,bottom:m})}Mr<20&&(u.wheelStartX==null?(u.wheelStartX=f.scrollLeft,u.wheelStartY=f.scrollTop,u.wheelDX=i,u.wheelDY=o,setTimeout(function(){if(u.wheelStartX==null)return;var e=f.scrollLeft-u.wheelStartX,t=f.scrollTop-u.wheelStartY,n=t&&u.wheelDY&&t/u.wheelDY||e&&u.wheelDX&&e/u.wheelDX;u.wheelStartX=u.wheelStartY=null;if(!n)return;_r=(_r*Mr+n)/(Mr+1),++Mr},200)):(u.wheelDX+=i,u.wheelDY+=o))}function Hr(e,t,n){if(typeof t=="string"){t=_i[t];if(!t)return!1}e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{wt(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ro}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Br(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Hi(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Hi(t,e.options.extraKeys,n,e)||Hi(t,e.options.keyMap,n,e)}function Fr(e,t,n,r){var i=e.state.keySeq;if(i){if(Bi(t))return"handled";jr.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var s=Br(e,t,r);s=="multi"&&(e.state.keySeq=t),s=="handled"&&Po(e,"keyHandled",e,t,n);if(s=="handled"||s=="multi")To(n),on(e);return i&&!s&&/\'$/.test(t)?(To(n),!0):!!s}function Ir(e,t){var n=ji(t,!0);return n?t.shiftKey&&!e.state.keySeq?Fr(e,"Shift-"+n,t,function(t){return Hr(e,t,!0)})||Fr(e,n,t,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return Hr(e,t)}):Fr(e,n,t,function(t){return Hr(e,t)}):!1}function qr(e,t,n){return Fr(e,"'"+n+"'",t,function(t){return Hr(e,t,!0)})}function Ur(e){var t=this;bt(t);if(Bo(t,e))return;r&&i<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var s=Ir(t,e);a&&(Rr=s?n:null,!s&&n==88&&!Mu&&(d?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&zr(t)}function zr(e){function n(e){if(e.keyCode==18||!e.altKey)gu(t,"CodeMirror-crosshair"),Mo(document,"keyup",n),Mo(document,"mouseover",n)}var t=e.display.lineDiv;yu(t,"CodeMirror-crosshair"),Oo(document,"keyup",n),Oo(document,"mouseover",n)}function Wr(e){e.keyCode==16&&(this.doc.sel.shift=!1),Bo(this,e)}function Xr(e){var t=this;if(mr(t.display,e)||Bo(t,e)||e.ctrlKey&&!e.altKey||d&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(a&&n==Rr){Rr=null,To(e);return}if(a&&(!e.which||e.which<10)&&Ir(t,e))return;var i=String.fromCharCode(r==null?n:r);if(qr(t,e,i))return;t.display.input.onKeyPress(e)}function Vr(e){if(e.options.readOnly=="nocursor")return;e.state.focused||(_o(e,"focus",e),e.state.focused=!0,yu(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),s&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),on(e)}function $r(e){e.state.focused&&(_o(e,"blur",e),e.state.focused=!1,gu(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Jr(e,t){if(mr(e.display,t)||Kr(e,t))return;e.display.input.onContextMenu(t)}function Kr(e,t){return Fo(e,"gutterContextMenu")?Tr(e,t,"gutterContextMenu",!1,_o):!1}function Gr(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return Qr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Qr(t).ch-t.to.ch),dt(n,r)}function Yr(e,t){var n=[];for(var r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Pt(Gr(i.anchor,t),Gr(i.head,t)))}return Ht(n,e.sel.primIndex)}function Zr(e,t,n){return e.line==t.line?dt(n.line,e.ch-t.ch+n.ch):dt(n.line+(e.line-t.line),e.ch)}function ei(e,t,n){var r=[],i=dt(e.first,0),s=i;for(var o=0;o<t.length;o++){var u=t[o],a=Zr(u.from,i,s),f=Zr(Qr(u),i,s);i=u.to,s=f;if(n=="around"){var l=e.sel.ranges[o],c=vt(l.head,l.anchor)<0;r[o]=new Pt(c?f:a,c?a:f)}else r[o]=new Pt(a,a)}return new Dt(r,e.sel.primIndex)}function ti(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=Ft(e,t)),n&&(this.to=Ft(e,n)),r&&(this.text=r),i!==undefined&&(this.origin=i)}),_o(e,"beforeChange",e,r),e.cm&&_o(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ni(e,t,n){if(e.cm){if(!e.cm.curOp)return nr(e.cm,ni)(e,t,n);if(e.cm.state.suppressEdits)return}if(Fo(e,"beforeChange")||e.cm&&Fo(e.cm,"beforeChange")){t=ti(e,t,!0);if(!t)return}var r=b&&!n&&rs(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)ri(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else ri(e,t)}function ri(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var n=Yr(e,t);ho(e,t,n,e.cm?e.cm.curOp.id:NaN),oi(e,t,n,es(e,t));var r=[];Ys(e,function(e,n){!n&&Yo(r,e.history)==-1&&(xo(e.history,t),r.push(e.history)),oi(e,t,null,es(e,t))})}function ii(e,t,n){if(e.cm&&e.cm.state.suppressEdits)return;var r=e.history,i,s=e.sel,o=t=="undo"?r.done:r.undone,u=t=="undo"?r.undone:r.done;for(var a=0;a<o.length;a++){i=o[a];if(n?i.ranges&&!i.equals(e.sel):!i.ranges)break}if(a==o.length)return;r.lastOrigin=r.lastSelOrigin=null;for(;;){i=o.pop();if(!i.ranges)break;mo(i,u);if(n&&!i.equals(e.sel)){Kt(e,i,{clearRedo:!1});return}s=i}var f=[];mo(s,u),u.push({changes:f,generation:r.generation}),r.generation=i.generation||++r.maxGeneration;var l=Fo(e,"beforeChange")||e.cm&&Fo(e.cm,"beforeChange");for(var a=i.changes.length-1;a>=0;--a){var c=i.changes[a];c.origin=t;if(l&&!ti(e,c,!1)){o.length=0;return}f.push(fo(e,c));var h=a?Yr(e,c):Qo(o);oi(e,c,h,ns(e,c)),!a&&e.cm&&e.cm.scrollIntoView({from:c.from,to:Qr(c)});var p=[];Ys(e,function(e,t){!t&&Yo(p,e.history)==-1&&(xo(e.history,c),p.push(e.history)),oi(e,c,null,ns(e,c))})}}function si(e,t){if(t==0)return;e.first+=t,e.sel=new Dt(Zo(e.sel.ranges,function(e){return new Pt(dt(e.anchor.line+t,e.anchor.ch),dt(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){ur(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)ar(e.cm,r,"gutter")}}function oi(e,t,n,r){if(e.cm&&!e.cm.curOp)return nr(e.cm,oi)(e,t,n,r);if(t.to.line<e.first){si(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);si(e,i),t={from:dt(e.first,0),to:dt(t.to.line+i,t.to.ch),text:[Qo(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:dt(s,eo(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=to(e,t.from,t.to),n||(n=Yr(e,t)),e.cm?ui(e.cm,t,r):Xs(e,t,r),Qt(e,n,Uo)}function ui(e,t,n){var r=e.doc,i=e.display,s=t.from,o=t.to,u=!1,a=s.line;e.options.lineWrapping||(a=io(ps(eo(r,s.line))),r.iter(a,o.line+1,function(e){if(e==i.maxLine)return u=!0,!0})),r.sel.contains(t.from,t.to)>-1&&jo(e),Xs(r,t,n,C(e)),e.options.lineWrapping||(r.iter(a,s.line+t.text.length,function(e){var t=_(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),un(e,400);var f=t.text.length-(o.line-s.line)-1;t.full?ur(e):s.line==o.line&&t.text.length==1&&!Ws(e.doc,t)?ar(e,s.line,"text"):ur(e,s.line,o.line+1,f);var l=Fo(e,"changes"),c=Fo(e,"change");if(c||l){var h={from:s,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&Po(e,"change",e,h),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function ai(e,t,n,r,i){r||(r=n);if(vt(r,n)<0){var s=r;r=n,n=s}typeof t=="string"&&(t=Au(t)),ni(e,{from:n,to:r,text:t,origin:i})}function fi(e,t){if(Bo(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!c){var s=lu("div","โ€‹",null,"position: absolute; top: "+(t.top-n.viewOffset-cn(e.display))+"px; height: "+(t.bottom-t.top+dn(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}function li(e,t,n,r){r==null&&(r=0);for(var i=0;i<5;i++){var s=!1,o=Bn(e,t),u=!n||n==t?o:Bn(e,n),a=hi(e,Math.min(o.left,u.left),Math.min(o.top,u.top)-r,Math.max(o.left,u.left),Math.max(o.bottom,u.bottom)+r),f=e.doc.scrollTop,l=e.doc.scrollLeft;a.scrollTop!=null&&(Ar(e,a.scrollTop),Math.abs(e.doc.scrollTop-f)>1&&(s=!0)),a.scrollLeft!=null&&(Or(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-l)>1&&(s=!0));if(!s)break}return o}function ci(e,t,n,r,i){var s=hi(e,t,n,r,i);s.scrollTop!=null&&Ar(e,s.scrollTop),s.scrollLeft!=null&&Or(e,s.scrollLeft)}function hi(e,t,n,r,i){var s=e.display,o=Un(e.display);n<0&&(n=0);var u=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,a=mn(e),f={};i-n>a&&(i=n+a);var l=e.doc.height+hn(s),c=n<o,h=i>l-o;if(n<u)f.scrollTop=c?0:n;else if(i>u+a){var p=Math.min(n,(h?l:i)-a);p!=u&&(f.scrollTop=p)}var d=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft,v=vn(e)-(e.options.fixedGutter?s.gutters.offsetWidth:0),m=r-t>v;return m&&(r=t+v),t<10?f.scrollLeft=0:t<d?f.scrollLeft=Math.max(0,t-(m?0:10)):r>v+d-3&&(f.scrollLeft=r+(m?0:10)-v),f}function pi(e,t,n){(t!=null||n!=null)&&vi(e),t!=null&&(e.curOp.scrollLeft=(e.curOp.scrollLeft==null?e.doc.scrollLeft:e.curOp.scrollLeft)+t),n!=null&&(e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n)}function di(e){vi(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?dt(t.line,t.ch-1):t,r=dt(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function vi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=jn(e,t.from),r=jn(e,t.to),i=hi(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function mi(e,t,n,r){var i=e.doc,s;n==null&&(n="add"),n=="smart"&&(i.mode.indent?s=ln(e,t):n="prev");var o=e.options.tabSize,u=eo(i,t),a=Vo(u.text,null,o);u.stateAfter&&(u.stateAfter=null);var f=u.text.match(/^\s*/)[0],l;if(!r&&!/\S/.test(u.text))l=0,n="not";else if(n=="smart"){l=i.mode.indent(s,u.text.slice(f.length),u.text);if(l==Ro||l>150){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=Vo(eo(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n),l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p)h+=o,c+="	";h<l&&(c+=Ko(l-h));if(c!=f)ai(i,c,dt(t,0),dt(t,f.length),"+input");else for(var p=0;p<i.sel.ranges.length;p++){var d=i.sel.ranges[p];if(d.head.line==t&&d.head.ch<f.length){var h=dt(t,f.length);Xt(i,p,new Pt(h,h));break}}u.stateAfter=null}function gi(e,t,n,r){var i=t,s=t;return typeof t=="number"?s=eo(e,jt(e,t)):i=io(t),i==null?null:(r(s,i)&&e.cm&&ar(e.cm,i,n),s)}function yi(e,t){var n=e.doc.sel.ranges,r=[];for(var i=0;i<n.length;i++){var s=t(n[i]);while(r.length&&vt(s.from,Qo(r).to)<=0){var o=r.pop();if(vt(o.from,s.from)<0){s.from=o.from;break}}r.push(s)}tr(e,function(){for(var t=r.length-1;t>=0;t--)ai(e.doc,"",r[t].from,r[t].to,"+delete");di(e)})}function bi(e,t,n,r,i){function l(){var t=s+n;return t<e.first||t>=e.first+e.size?f=!1:(s=t,a=eo(e,t))}function c(e){var t=(i?$u:Ju)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Iu:Fu)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=eo(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group",d=e.cm&&e.cm.getHelper(t,"wordChars");for(var v=!0;;v=!1){if(n<0&&!c(!v))break;var m=a.text.charAt(o)||"\n",g=ou(m,d)?"w":p&&m=="\n"?"n":!p||/\s/.test(m)?null:"p";p&&!v&&!g&&(g="s");if(h&&h!=g){n<0&&(n=1,c());break}g&&(h=g);if(n>0&&!c(!v))break}}var y=en(e,dt(s,o),u,!0);return f||(y.hitSide=!0),y}function wi(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*Un(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=In(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function xi(e,t,n,r){E.defaults[e]=t,n&&(Si[e]=r?function(e,t,r){r!=Ti&&n(e,t,r)}:n)}function Pi(e){var t=e.split(/-(?!$)/),e=t[t.length-1],n,r,i,s;for(var o=0;o<t.length-1;o++){var u=t[o];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))r=!0;else{if(!/^s(hift)$/i.test(u))throw new Error("Unrecognized modifier name: "+u);i=!0}}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),s&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Fi(e){return typeof e=="string"?Di[e]:e}function Ui(e,t,n,r,i){if(r&&r.shared)return Wi(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return nr(e.cm,Ui)(e,t,n,r,i);var s=new Ri(e,i),o=vt(t,n);r&&nu(r,s,!1);if(o>0||o==0&&s.clearWhenEmpty!==!1)return s;s.replacedWith&&(s.collapsed=!0,s.widgetNode=lu("span",[s.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(s.widgetNode.insertLeft=!0));if(s.collapsed){if(hs(e,t.line,t,n,s)||t.line!=n.line&&hs(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");w=!0}s.addToHistory&&ho(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u=t.line,a=e.cm,f;e.iter(u,n.line+1,function(e){a&&s.collapsed&&!a.options.lineWrapping&&ps(e)==a.display.maxLine&&(f=!0),s.collapsed&&u!=t.line&&ro(e,0),Gi(e,new Ji(s,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),s.collapsed&&e.iter(t.line,n.line+1,function(t){gs(e,t)&&ro(t,0)}),s.clearOnEnter&&Oo(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(b=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++qi,s.atomic=!0);if(a){f&&(a.curOp.updateMaxLine=!0);if(s.collapsed)ur(a,t.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(var l=t.line;l<=n.line;l++)ar(a,l,"text");s.atomic&&Yt(a.doc),Po(a,"markerAdded",a,s)}return s}function Wi(e,t,n,r,i){r=nu(r),r.shared=!1;var s=[Ui(e,t,n,r,i)],o=s[0],u=r.widgetNode;return Ys(e,function(e){u&&(r.widgetNode=u.cloneNode(!0)),s.push(Ui(e,Ft(e,t),Ft(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;o=Qo(s)}),new zi(s,o)}function Xi(e){return e.findMarks(dt(e.first,0),e.clipPos(dt(e.lastLine())),function(e){return e.parent})}function Vi(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),s=e.clipPos(i.from),o=e.clipPos(i.to);if(vt(s,o)){var u=Ui(e,s,o,r.primary,r.primary.type);r.markers.push(u),u.parent=r}}}function $i(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Ys(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var s=n.markers[i];Yo(r,s.doc)==-1&&(s.parent=null,n.markers.splice(i--,1))}}}function Ji(e,t,n){this.marker=e,this.from=t,this.to=n}function Ki(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Qi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Gi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Yi(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||s.from==t&&o.type=="bookmark"&&(!n||!s.marker.insertLeft)){var a=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);(i||(i=[])).push(new Ji(o,s.from,a?null:s.to))}}return i}function Zi(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);if(u||s.from==t&&o.type=="bookmark"&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);(i||(i=[])).push(new Ji(o,a?null:s.from-t,s.to==null?null:s.to-t))}}return i}function es(e,t){if(t.full)return null;var n=qt(e,t.from.line)&&eo(e,t.from.line).markedSpans,r=qt(e,t.to.line)&&eo(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,s=t.to.ch,o=vt(t.from,t.to)==0,u=Yi(n,i,o),a=Zi(r,s,o),f=t.text.length==1,l=Qo(t.text).length+(f?i:0);if(u)for(var c=0;c<u.length;++c){var h=u[c];if(h.to==null){var p=Ki(a,h.marker);p?f&&(h.to=p.to==null?null:p.to+l):h.to=i}}if(a)for(var c=0;c<a.length;++c){var h=a[c];h.to!=null&&(h.to+=l);if(h.from==null){var p=Ki(u,h.marker);p||(h.from=l,f&&(u||(u=[])).push(h))}else h.from+=l,f&&(u||(u=[])).push(h)}u&&(u=ts(u)),a&&a!=u&&(a=ts(a));var d=[u];if(!f){var v=t.text.length-2,m;if(v>0&&u)for(var c=0;c<u.length;++c)u[c].to==null&&(m||(m=[])).push(new Ji(u[c].marker,null,null));for(var c=0;c<v;++c)d.push(m);d.push(a)}return d}function ts(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ns(e,t){var n=bo(e,t),r=es(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var s=n[i],o=r[i];if(s&&o)e:for(var u=0;u<o.length;++u){var a=o[u];for(var f=0;f<s.length;++f)if(s[f].marker==a.marker)continue e;s.push(a)}else o&&(n[i]=o)}return n}function rs(e,t,n){var r=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;n.readOnly&&(!r||Yo(r,n)==-1)&&(r||(r=[])).push(n)}});if(!r)return null;var i=[{from:t,to:n}];for(var s=0;s<r.length;++s){var o=r[s],u=o.find(0);for(var a=0;a<i.length;++a){var f=i[a];if(vt(f.to,u.from)<0||vt(f.from,u.to)>0)continue;var l=[a,1],c=vt(f.from,u.from),h=vt(f.to,u.to);(c<0||!o.inclusiveLeft&&!c)&&l.push({from:f.from,to:u.from}),(h>0||!o.inclusiveRight&&!h)&&l.push({from:u.to,to:f.to}),i.splice.apply(i,l),a+=l.length-1}}return i}function is(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function ss(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function os(e){return e.inclusiveLeft?-1:0}function us(e){return e.inclusiveRight?1:0}function as(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),s=vt(r.from,i.from)||os(e)-os(t);if(s)return-s;var o=vt(r.to,i.to)||us(e)-us(t);return o?o:t.id-e.id}function fs(e,t){var n=w&&e.markedSpans,r;if(n)for(var i,s=0;s<n.length;++s)i=n[s],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||as(r,i.marker)<0)&&(r=i.marker);return r}function ls(e){return fs(e,!0)}function cs(e){return fs(e,!1)}function hs(e,t,n,r,i){var s=eo(e,t),o=w&&s.markedSpans;if(o)for(var u=0;u<o.length;++u){var a=o[u];if(!a.marker.collapsed)continue;var f=a.marker.find(0),l=vt(f.from,n)||os(a.marker)-os(i),c=vt(f.to,r)||us(a.marker)-us(i);if(l>=0&&c<=0||l<=0&&c>=0)continue;if(l<=0&&(vt(f.to,n)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||l>=0&&(vt(f.from,r)<0||a.marker.inclusiveLeft&&i.inclusiveRight))return!0}}function ps(e){var t;while(t=ls(e))e=t.find(-1,!0).line;return e}function ds(e){var t,n;while(t=cs(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function vs(e,t){var n=eo(e,t),r=ps(n);return n==r?t:io(r)}function ms(e,t){if(t>e.lastLine())return t;var n=eo(e,t),r;if(!gs(e,n))return t;while(r=cs(n))n=r.find(1,!0).line;return io(n)+1}function gs(e,t){var n=w&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}function ys(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ys(e,r.line,Ki(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i,s=0;s<t.markedSpans.length;++s){i=t.markedSpans[s];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ys(e,t,i))return!0}}function ws(e,t,n){oo(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&pi(e,null,n)}function Es(e){if(e.height!=null)return e.height;if(!du(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+e.cm.display.wrapper.clientWidth+"px;"),pu(e.cm.display.measure,lu("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function Ss(e,t,n,r){var i=new bs(e,n,r);return i.noHScroll&&(e.display.alignWidgets=!0),gi(e.doc,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);i.insertAt==null?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t;if(!gs(e.doc,t)){var r=oo(t)<e.doc.scrollTop;ro(t,t.height+Es(i)),r&&pi(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function Ts(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),is(e),ss(e,n);var i=r?r(e):1;i!=e.height&&ro(e,i)}function Ns(e){e.parent=null,is(e)}function Cs(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:(new RegExp("(?:^|s)"+n[2]+"(?:$|s)")).test(t[r])||(t[r]+=" "+n[2])}return e}function ks(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=E.innerMode(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Ls(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=E.innerMode(e,n).mode);var s=e.token(t,n);if(t.pos>t.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}function As(e,t,n,r){function i(e){return{start:l.start,end:l.pos,string:l.current(),type:u||null,state:e?Oi(s.mode,f):f}}var s=e.doc,o=s.mode,u;t=Ft(s,t);var a=eo(s,t.line),f=ln(e,t.line,n),l=new Ii(a.text,e.options.tabSize),c;r&&(c=[]);while((r||l.pos<t.ch)&&!l.eol())l.start=l.pos,u=Ls(o,l,f),r&&c.push(i(!0));return r?c:i()}function Os(e,t,n,r,i,s,o){var u=n.flattenSpans;u==null&&(u=e.options.flattenSpans);var a=0,f=null,l=new Ii(t,e.options.tabSize),c,h=e.options.addModeClass&&[null];t==""&&Cs(ks(n,r),s);while(!l.eol()){l.pos>e.options.maxHighlightLength?(u=!1,o&&Ds(e,t,r,l.pos),l.pos=t.length,c=null):c=Cs(Ls(n,l,r,h),s);if(h){var p=h[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!u||f!=c){while(a<l.start)a=Math.min(l.start,a+5e4),i(a,f);f=c}l.start=l.pos}while(a<l.pos){var d=Math.min(l.pos,a+5e4);i(d,f),a=d}}function Ms(e,t,n,r){var i=[e.state.modeGen],s={};Os(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},s,r);for(var o=0;o<e.state.overlays.length;++o){var u=e.state.overlays[o],a=1,f=0;Os(e,t.text,u.mode,!0,function(e,t){var n=a;while(f<e){var r=i[a];r>e&&i.splice(a,1,e,i[a+1],r),a+=2,f=Math.min(e,r)}if(!t)return;if(u.opaque)i.splice(n,a-n,e,"cm-overlay "+t),a=n+2;else for(;n<a;n+=2){var s=i[n+1];i[n+1]=(s?s+" ":"")+"cm-overlay "+t}},s)}return{styles:i,classes:s.bgClass||s.textClass?s:null}}function _s(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ms(e,t,t.stateAfter=ln(e,io(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Ds(e,t,n,r){var i=e.doc.mode,s=new Ii(t,e.options.tabSize);s.start=s.pos=r||0,t==""&&ks(i,n);while(!s.eol()&&s.pos<=e.options.maxHighlightLength)Ls(i,s,n),s.start=s.pos}function Bs(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Hs:Ps;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function js(e,t){var n=lu("span",null,null,s?"padding-right: .1px":null),i={pre:lu("pre",[n]),content:n,col:0,pos:0,cm:e};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var u=o?t.rest[o-1]:t.line,a;i.pos=0,i.addToken=Is,(r||s)&&e.getOption("lineWrapping")&&(i.addToken=qs(i.addToken)),Lu(e.display.measure)&&(a=uo(u))&&(i.addToken=Rs(i.addToken,a)),i.map=[];var f=t!=e.display.externalMeasured&&io(u);zs(u,i,_s(e,u,f)),u.styleClasses&&(u.styleClasses.bgClass&&(i.bgClass=bu(u.styleClasses.bgClass,i.bgClass||"")),u.styleClasses.textClass&&(i.textClass=bu(u.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(Cu(e.display.measure))),o==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return s&&/\bcm-tab\b/.test(i.content.lastChild.className)&&(i.content.className="cm-tab-wrap-hack"),_o(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=bu(i.pre.className,i.textClass||"")),i}function Fs(e){var t=lu("span","โ€ข","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Is(e,t,n,s,o,u,a){if(!t)return;var f=e.cm.options.specialChars,l=!1;if(!f.test(t)){e.col+=t.length;var c=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,c),r&&i<9&&(l=!0),e.pos+=t.length}else{var c=document.createDocumentFragment(),h=0;for(;;){f.lastIndex=h;var p=f.exec(t),d=p?p.index-h:t.length-h;if(d){var v=document.createTextNode(t.slice(h,h+d));r&&i<9?c.appendChild(lu("span",[v])):c.appendChild(v),e.map.push(e.pos,e.pos+d,v),e.col+=d,e.pos+=d}if(!p)break;h+=d+1;if(p[0]=="	"){var m=e.cm.options.tabSize,g=m-e.col%m,v=c.appendChild(lu("span",Ko(g),"cm-tab"));v.setAttribute("role","presentation"),v.setAttribute("cm-text","	"),e.col+=g}else{var v=e.cm.options.specialCharPlaceholder(p[0]);v.setAttribute("cm-text",p[0]),r&&i<9?c.appendChild(lu("span",[v])):c.appendChild(v),e.col+=1}e.map.push(e.pos,e.pos+1,v),e.pos++}}if(n||s||o||l||a){var y=n||"";s&&(y+=s),o&&(y+=o);var b=lu("span",[c],y,a);return u&&(b.title=u),e.content.appendChild(b)}e.content.appendChild(c)}function qs(e){function t(e){var t=" ";for(var n=0;n<e.length-2;++n)t+=n%2?" ":"ย ";return t+=" ",t}return function(n,r,i,s,o,u){e(n,r.replace(/ {3,}/g,t),i,s,o,u)}}function Rs(e,t){return function(n,r,i,s,o,u){i=i?i+" cm-force-border":"cm-force-border";var a=n.pos,f=a+r.length;for(;;){for(var l=0;l<t.length;l++){var c=t[l];if(c.to>a&&c.from<=a)break}if(c.to>=f)return e(n,r,i,s,o,u);e(n,r.slice(0,c.to-a),i,s,null,u),s=null,r=r.slice(c.to-a),a=c.to}}}function Us(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function zs(e,t,n){var r=e.markedSpans,i=e.text,s=0;if(!r){for(var o=1;o<n.length;o+=2)t.addToken(t,i.slice(s,s=n[o]),Bs(n[o+1],t.cm.options));return}var u=i.length,a=0,o=1,f="",l,c,h=0,p,d,v,m,g;for(;;){if(h==a){p=d=v=m=c="",g=null,h=Infinity;var y=[];for(var b=0;b<r.length;++b){var w=r[b],E=w.marker;w.from<=a&&(w.to==null||w.to>a)?(w.to!=null&&h>w.to&&(h=w.to,d=""),E.className&&(p+=" "+E.className),E.css&&(c=E.css),E.startStyle&&w.from==a&&(v+=" "+E.startStyle),E.endStyle&&w.to==h&&(d+=" "+E.endStyle),E.title&&!m&&(m=E.title),E.collapsed&&(!g||as(g.marker,E)<0)&&(g=w)):w.from>a&&h>w.from&&(h=w.from),E.type=="bookmark"&&w.from==a&&E.widgetNode&&y.push(E)}if(g&&(g.from||0)==a){Us(t,(g.to==null?u+1:g.to)-a,g.marker,g.from==null);if(g.to==null)return}if(!g&&y.length)for(var b=0;b<y.length;++b)Us(t,0,y[b])}if(a>=u)break;var S=Math.min(u,h);for(;;){if(f){var x=a+f.length;if(!g){var T=x>S?f.slice(0,S-a):f;t.addToken(t,T,l?l+p:p,v,a+T.length==h?d:"",m,c)}if(x>=S){f=f.slice(S-a),a=S;break}a=x,v=""}f=i.slice(s,s=n[o++]),l=Bs(n[o++],t.cm.options)}}}function Ws(e,t){return t.from.ch==0&&t.to.ch==0&&Qo(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Xs(e,t,n,r){function i(e){return n?n[e]:null}function s(e,n,i){Ts(e,n,i,r),Po(e,"change",e,t)}function o(e,t){for(var n=e,s=[];n<t;++n)s.push(new xs(f[n],i(n),r));return s}var u=t.from,a=t.to,f=t.text,l=eo(e,u.line),c=eo(e,a.line),h=Qo(f),p=i(f.length-1),d=a.line-u.line;if(t.full)e.insert(0,o(0,f.length)),e.remove(f.length,e.size-f.length);else if(Ws(e,t)){var v=o(0,f.length-1);s(c,c.text,p),d&&e.remove(u.line,d),v.length&&e.insert(u.line,v)}else if(l==c)if(f.length==1)s(l,l.text.slice(0,u.ch)+h+l.text.slice(a.ch),p);else{var v=o(1,f.length-1);v.push(new xs(h+l.text.slice(a.ch),p,r)),s(l,l.text.slice(0,u.ch)+f[0],i(0)),e.insert(u.line+1,v)}else if(f.length==1)s(l,l.text.slice(0,u.ch)+f[0]+c.text.slice(a.ch),i(0)),e.remove(u.line+1,d);else{s(l,l.text.slice(0,u.ch)+f[0],i(0)),s(c,h+c.text.slice(a.ch),p);var v=o(1,f.length-1);d>1&&e.remove(u.line+1,d-1),e.insert(u.line+1,v)}Po(e,"change",e,t)}function Vs(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function $s(e){this.children=e;var t=0,n=0;for(var r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}function Ys(e,t,n){function r(e,i,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var u=e.linked[o];if(u.doc==i)continue;var a=s&&u.sharedHist;if(n&&!a)continue;t(u.doc,a),r(u.doc,e,a)}}r(e,null,!0)}function Zs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,k(e),x(e),e.options.lineWrapping||D(e),e.options.mode=t.modeOption,ur(e)}function eo(e,t){t-=e.first;if(t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],s=i.chunkSize();if(t<s){n=i;break}t-=s}return n.lines[t]}function to(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var s=e.text;i==n.line&&(s=s.slice(0,n.ch)),i==t.line&&(s=s.slice(t.ch)),r.push(s),++i}),r}function no(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ro(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function io(e){if(e.parent==null)return null;var t=e.parent,n=Yo(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function so(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],s=i.height;if(t<s){e=i;continue e}t-=s,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;r<e.lines.length;++r){var o=e.lines[r],u=o.height;if(t<u)break;t-=u}return n+r}function oo(e){e=ps(e);var t=0,n=e.parent;for(var r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var s=n.parent;s;n=s,s=n.parent)for(var r=0;r<s.children.length;++r){var o=s.children[r];if(o==n)break;t+=o.height}return t}function uo(e){var t=e.order;return t==null&&(t=e.order=Ku(e.text)),t}function ao(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function fo(e,t){var n={from:mt(t.from),to:Qr(t),text:to(e,t.from,t.to)};return go(e,n,t.from.line,t.to.line+1),Ys(e,function(e){go(e,n,t.from.line,t.to.line+1)},!0),n}function lo(e){while(e.length){var t=Qo(e);if(!t.ranges)break;e.pop()}}function co(e,t){if(t)return lo(e.done),Qo(e.done);if(e.done.length&&!Qo(e.done).ranges)return Qo(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Qo(e.done)}function ho(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(o=co(i,i.lastOp==r))){var u=Qo(o.changes);vt(t.from,t.to)==0&&vt(t.from,u.to)==0?u.to=Qr(t):o.changes.push(fo(e,t))}else{var a=Qo(i.done);(!a||!a.ranges)&&mo(e.sel,i.done),o={changes:[fo(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,u||_o(e,"historyAdded")}function po(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function vo(e,t,n,r){var i=e.history,s=r&&r.origin;n==i.lastSelOp||s&&i.lastSelOrigin==s&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==s||po(e,s,Qo(i.done),t))?i.done[i.done.length-1]=t:mo(t,i.done),i.lastSelTime=+(new Date),i.lastSelOrigin=s,i.lastSelOp=n,r&&r.clearRedo!==!1&&lo(i.undone)}function mo(e,t){var n=Qo(t);n&&n.ranges&&n.equals(e)||t.push(e)}function go(e,t,n,r){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[s]=n.markedSpans),++s})}function yo(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function bo(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(yo(n[r]));return i}function wo(e,t,n){for(var r=0,i=[];r<e.length;++r){var s=e[r];if(s.ranges){i.push(n?Dt.prototype.deepCopy.call(s):s);continue}var o=s.changes,u=[];i.push({changes:u});for(var a=0;a<o.length;++a){var f=o[a],l;u.push({from:f.from,to:f.to,text:f.text});if(t)for(var c in f)(l=c.match(/^spans_(\d+)$/))&&Yo(t,Number(l[1]))>-1&&(Qo(u)[c]=f[c],delete f[c])}}return i}function Eo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function So(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i],o=!0;if(s.ranges){s.copied||(s=e[i]=s.deepCopy(),s.copied=!0);for(var u=0;u<s.ranges.length;u++)Eo(s.ranges[u].anchor,t,n,r),Eo(s.ranges[u].head,t,n,r);continue}for(var u=0;u<s.changes.length;++u){var a=s.changes[u];if(n<a.from.line)a.from=dt(a.from.line+r,a.from.ch),a.to=dt(a.to.line+r,a.to.ch);else if(t<=a.to.line){o=!1;break}}o||(e.splice(0,i+1),i=0)}}function xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;So(e.done,n,r,i),So(e.undone,n,r,i)}function Co(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==0}function Lo(e){return e.target||e.srcElement}function Ao(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),d&&e.ctrlKey&&t==1&&(t=3),t}function Po(e,t){function s(e){return function(){e.apply(null,r)}}var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2),i;Wn?i=Wn.delayedCallbacks:Do?i=Do:(i=Do=[],setTimeout(Ho,0));for(var o=0;o<n.length;++o)i.push(s(n[o]))}function Ho(){var e=Do;Do=null;for(var t=0;t<e.length;++t)e[t]()}function Bo(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_o(e,n||t.type,e,t),Co(t)||t.codemirrorIgnore}function jo(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(var r=0;r<t.length;++r)Yo(n,t[r])==-1&&n.push(t[r])}function Fo(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function Io(e){e.prototype.on=function(e,t){Oo(this,e,t)},e.prototype.off=function(e,t){Mo(this,e,t)}}function Xo(){this.id=null}function $o(e,t,n){for(var r=0,i=0;;){var s=e.indexOf("	",r);s==-1&&(s=e.length);var o=s-r;if(s==e.length||i+o>=t)return r+Math.min(o,t-i);i+=s-r,i+=n-i%n,r=s+1;if(i>=t)return r}}function Ko(e){while(Jo.length<=e)Jo.push(Qo(Jo)+" ");return Jo[e]}function Qo(e){return e[e.length-1]}function Yo(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Zo(e,t){var n=[];for(var r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function eu(){}function tu(e,t){var n;return Object.create?n=Object.create(e):(eu.prototype=e,n=new eu),t&&nu(t,n),n}function nu(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ru(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ou(e,t){return t?t.source.indexOf("\\w")>-1&&su(e)?!0:t.test(e):su(e)}function uu(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function fu(e){return e.charCodeAt(0)>=768&&au.test(e)}function lu(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function hu(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function pu(e,t){return hu(e).appendChild(t)}function vu(){return document.activeElement}function mu(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function bu(e,t){var n=e.split(" ");for(var r=0;r<n.length;r++)n[r]&&!mu(n[r]).test(t)&&(t+=" "+n[r]);return t}function wu(e){if(!document.body.getElementsByClassName)return;var t=document.body.getElementsByClassName("CodeMirror");for(var n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function Su(){if(Eu)return;xu(),Eu=!0}function xu(){var e;Oo(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,wu(vr)},100))}),Oo(window,"blur",function(){wu($r)})}function Cu(e){if(Nu==null){var t=lu("span","โ€‹");pu(e,lu("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Nu=t.offsetWidth<=1&&t.offsetHeight>2&&!(r&&i<8))}var n=Nu?lu("span","โ€‹"):lu("span","ย ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Lu(e){if(ku!=null)return ku;var t=pu(e,document.createTextNode("AุฎA")),n=cu(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=cu(t,1,2).getBoundingClientRect();return ku=r.right-n.right<3}function Du(e){if(_u!=null)return _u;var t=pu(e,lu("span","x")),n=t.getBoundingClientRect(),r=cu(t,0,1).getBoundingClientRect();return _u=Math.abs(n.left-r.left)>1}function Hu(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;s<e.length;++s){var o=e[s];if(o.from<n&&o.to>t||t==n&&o.to==t)r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr"),i=!0}i||r(t,n,"ltr")}function Bu(e){return e.level%2?e.to:e.from}function ju(e){return e.level%2?e.from:e.to}function Fu(e){var t=uo(e);return t?Bu(t[0]):0}function Iu(e){var t=uo(e);return t?ju(Qo(t)):e.text.length}function qu(e,t){var n=eo(e.doc,t),r=ps(n);r!=n&&(t=io(r));var i=uo(r),s=i?i[0].level%2?Iu(r):Fu(r):0;return dt(t,s)}function Ru(e,t){var n,r=eo(e.doc,t);while(n=cs(r))r=n.find(1,!0).line,t=null;var i=uo(r),s=i?i[0].level%2?Fu(r):Iu(r):r.text.length;return dt(t==null?io(r):t,s)}function Uu(e,t){var n=qu(e,t.line),r=eo(e.doc,n.line),i=uo(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/)),o=t.line==n.line&&t.ch<=s&&t.ch;return dt(n.line,o?0:s)}return n}function zu(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:t<n}function Xu(e,t){Wu=null;for(var n=0,r;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(r!=null)return zu(e,i.level,e[r].level)?(i.from!=i.to&&(Wu=r),n):(i.from!=i.to&&(Wu=n),r);r=n}}return r}function Vu(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&fu(e.text.charAt(t)));return t}function $u(e,t,n,r){var i=uo(e);if(!i)return Ju(e,t,n,r);var s=Xu(i,t),o=i[s],u=Vu(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u<o.to)return u;if(u==o.from||u==o.to)return Xu(i,u)==s?u:(o=i[s+=n],n>0==o.level%2?o.to:o.from);o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Vu(e,o.to,-1,r):u=Vu(e,o.from,1,r)}}function Ju(e,t,n,r){var i=t+n;if(r)while(i>0&&fu(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),r=t||n,i=r&&(t?document.documentMode||6:n[1]),s=/WebKit\//.test(navigator.userAgent),o=s&&/Qt\/\d+\.\d+/.test(navigator.userAgent),u=/Chrome\//.test(navigator.userAgent),a=/Opera\//.test(navigator.userAgent),f=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),c=/PhantomJS/.test(navigator.userAgent),h=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),p=h||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),d=h||/Mac/.test(navigator.platform),v=/win/i.test(navigator.platform),m=a&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(a=!1,s=!0);var g=d&&(o||a&&(m==null||m<12.11)),y=e||r&&i>=9,b=!1,w=!1;B.prototype=nu({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+s+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(r==0&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=d&&!l?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){Lo(e)!=t.vert&&Lo(e)!=t.horiz&&nr(t.cm,yr)(e)};Oo(this.vert,"mousedown",n),Oo(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},B.prototype),j.prototype=nu({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},j.prototype),E.scrollbarModel={"native":B,"null":j},V.prototype.signal=function(e,t){Fo(e,t)&&this.events.push(arguments)},V.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_o.apply(null,this.events[e])};var dt=E.Pos=function(e,t){if(!(this instanceof dt))return new dt(e,t);this.line=e,this.ch=t},vt=E.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Et=null;Nt.prototype=nu({init:function(e){function a(e){if(n.somethingSelected())Et=n.getSelections(),t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,u.value=Et.join("\n"),Go(u));else{var r=xt(n);Et=r.text,e.type=="cut"?n.setSelections(r.ranges,null,Uo):(t.prevInput="",u.value=r.text.join("\n"),Go(u))}e.type=="cut"&&(n.state.cutIncoming=!0)}var t=this,n=this.cm,o=this.wrapper=Ct(),u=this.textarea=o.firstChild;e.wrapper.insertBefore(o,e.wrapper.firstChild),h&&(u.style.width="0px"),Oo(u,"input",function(){r&&i>=9&&t.hasSelection&&(t.hasSelection=null),t.poll()}),Oo(u,"paste",function(){if(s&&!n.state.fakedLastChar&&!(new Date-n.state.lastMiddleDown<200)){var e=u.selectionStart,r=u.selectionEnd;u.value+="$",u.selectionEnd=r,u.selectionStart=e,n.state.fakedLastChar=!0}n.state.pasteIncoming=!0,t.fastPoll()}),Oo(u,"cut",a),Oo(u,"copy",a),Oo(e.scroller,"paste",function(r){if(mr(e,r))return;n.state.pasteIncoming=!0,t.focus()}),Oo(e.lineSpace,"selectstart",function(t){mr(e,t)||To(t)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=nn(e);if(e.options.moveInputWithCursor){var i=Bn(e,n.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+o.top-s.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+o.left-s.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;pu(n.cursorDiv,e.cursors),pu(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(this.contextMenuPending)return;var t,n,s=this.cm,o=s.doc;if(s.somethingSelected()){this.prevInput="";var u=o.sel.primary();t=Mu&&(u.to().line-u.from().line>100||(n=s.getSelection()).length>1e3);var a=t?"-":n||s.getSelection();this.textarea.value=a,s.state.focused&&Go(this.textarea),r&&i>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",r&&i>=9&&(this.hasSelection=null));this.inaccurateSelection=t},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!p||vu()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;if(e.pollingFast)return;e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,n)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(!e.state.focused||Ou(t)&&!n||wt(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var s=t.value;if(s==n&&!e.somethingSelected())return!1;if(r&&i>=9&&this.hasSelection===s||d&&/[\uf700-\uf7ff]/.test(s))return e.display.input.reset(),!1;s.charCodeAt(0)==8203&&e.doc.sel==e.display.selForContextMenu&&!n&&(n="โ€‹");var o=0,u=Math.min(n.length,s.length);while(o<u&&n.charCodeAt(o)==s.charCodeAt(o))++o;var a=this;return tr(e,function(){St(e,s.slice(o),n.length-o),s.length>1e3||s.indexOf("\n")>-1?t.value=a.prevInput="":a.prevInput=s}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){r&&i>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function d(){if(u.selectionStart!=null){var e=n.somethingSelected(),r=u.value="โ€‹"+(e?u.value:"");t.prevInput=e?"":"โ€‹",u.selectionStart=1,u.selectionEnd=r.length,o.selForContextMenu=n.doc.sel}}function v(){t.contextMenuPending=!1,t.wrapper.style.position="relative",u.style.cssText=h,r&&i<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l);if(u.selectionStart!=null){(!r||r&&i<9)&&d();var e=0,s=function(){o.selForContextMenu==n.doc.sel&&u.selectionStart==0?nr(n,_i.selectAll)(n):e++<10?o.detectingSelectAll=setTimeout(s,500):o.input.reset()};o.detectingSelectAll=setTimeout(s,200)}}var t=this,n=t.cm,o=n.display,u=t.textarea,f=gr(n,e),l=o.scroller.scrollTop;if(!f||a)return;var c=n.options.resetSelectionOnContextMenu;c&&n.doc.sel.contains(f)==-1&&nr(n,Kt)(n.doc,Bt(f),Uo);var h=u.style.cssText;t.wrapper.style.position="absolute",u.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(r?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(s)var p=window.scrollY;o.input.focus(),s&&window.scrollTo(null,p),o.input.reset(),n.somethingSelected()||(u.value=t.prevInput=" "),t.contextMenuPending=!0,o.selForContextMenu=n.doc.sel,clearTimeout(o.detectingSelectAll),r&&i>=9&&d();if(y){ko(e);var m=function(){Mo(window,"mouseup",m),setTimeout(v,20)};Oo(window,"mouseup",m)}else setTimeout(v,50)},setUneditable:eu,needsContentAttribute:!1},Nt.prototype),kt.prototype=nu({init:function(e){function i(e){if(n.somethingSelected())Et=n.getSelections(),e.type=="cut"&&n.replaceSelection("",null,"cut");else{var t=xt(n);Et=t.text,e.type=="cut"&&n.operation(function(){n.setSelections(t.ranges,0,Uo),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!h)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Et.join("\n"));else{var r=Ct(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Et.join("\n");var s=document.activeElement;Go(i),setTimeout(function(){n.display.lineSpace.removeChild(r),s.focus()},50)}}var t=this,n=t.cm,r=t.div=e.lineDiv;r.contentEditable="true",Tt(r),Oo(r,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),n.replaceSelection(t,null,"paste"))}),Oo(r,"compositionstart",function(e){var r=e.data;t.composing={sel:n.doc.sel,data:r,startData:r};if(!r)return;var i=n.doc.sel.primary(),s=n.getLine(i.head.line),o=s.indexOf(r,Math.max(0,i.head.ch-r.length));o>-1&&o<=i.head.ch&&(t.composing.sel=Bt(dt(i.head.line,o),dt(i.head.line,o+r.length)))}),Oo(r,"compositionupdate",function(e){t.composing.data=e.data}),Oo(r,"compositionend",function(e){var n=t.composing;if(!n)return;e.data!=n.startData&&!/\u200b/.test(e.data)&&(n.data=e.data),setTimeout(function(){n.handled||t.applyComposition(n),t.composing==n&&(t.composing=null)},50)}),Oo(r,"touchstart",function(){t.forceCompositionEnd()}),Oo(r,"input",function(){if(t.composing)return;t.pollContent()||tr(t.cm,function(){ur(n)})}),Oo(r,"copy",i),Oo(r,"cut",i)},prepareSelection:function(){var e=nn(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){if(!e||!this.cm.display.view.length)return;e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e)},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=Ot(this.cm,e.anchorNode,e.anchorOffset),r=Ot(this.cm,e.focusNode,e.focusOffset);if(n&&!n.bad&&r&&!r.bad&&vt(yt(n,r),t.from())==0&&vt(gt(n,r),t.to())==0)return;var i=Lt(this.cm,t.from()),s=Lt(this.cm,t.to());if(!i&&!s)return;var o=this.cm.display.view,u=e.rangeCount&&e.getRangeAt(0);if(!i)i={node:o[0].measure.map[2],offset:0};else if(!s){var a=o[o.length-1].measure,f=a.maps?a.maps[a.maps.length-1]:a.map;s={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}try{var l=cu(i.node,i.offset,s.offset,s.node)}catch(c){}l&&(e.removeAllRanges(),e.addRange(l),u&&e.anchorNode==null&&e.addRange(u)),this.rememberSelection()},showMultipleSelections:function(e){pu(this.cm.display.cursorDiv,e.cursors),pu(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return du(this.div,t)},focus:function(){this.cm.options.readOnly!="nocursor"&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}var e=this;this.selectionInEditor()?this.pollSelection():tr(this.cm,function(){e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,t)},pollSelection:function(){if(this.composing)return;var e=window.getSelection(),t=this.cm;if(e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset){this.rememberSelection();var n=Ot(t,e.anchorNode,e.anchorOffset),r=Ot(t,e.focusNode,e.focusOffset);n&&r&&tr(t,function(){Kt(t.doc,Bt(n,r),Uo);if(n.bad||r.bad)t.curOp.selectionChanged=!0})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var s;if(r.line==t.viewFrom||(s=lr(e,r.line))==0)var o=io(t.view[0].line),u=t.view[0].node;else var o=io(t.view[s].line),u=t.view[s-1].node.nextSibling;var a=lr(e,i.line);if(a==t.view.length-1)var f=t.viewTo-1,l=t.view[a].node;else var f=io(t.view[a+1].line)-1,l=t.view[a+1].node.previousSibling;var c=Au(_t(e,u,l,o,f)),h=to(e.doc,dt(o,0),dt(f,eo(e.doc,f).text.length));while(c.length>1&&h.length>1)if(Qo(c)==Qo(h))c.pop(),h.pop(),f--;else{if(c[0]!=h[0])break;c.shift(),h.shift(),o++}var p=0,d=0,v=c[0],m=h[0],g=Math.min(v.length,m.length);while(p<g&&v.charCodeAt(p)==m.charCodeAt(p))++p;var y=Qo(c),b=Qo(h),w=Math.min(y.length-(c.length==1?p:0),b.length-(h.length==1?p:0));while(d<w&&y.charCodeAt(y.length-d-1)==b.charCodeAt(b.length-d-1))++d;c[c.length-1]=y.slice(0,y.length-d),c[0]=c[0].slice(p);var E=dt(o,p),S=dt(f,h.length?Qo(h).length-d:0);if(c.length>1||c[0]||vt(E,S))return ai(e.doc,c,E,S,"+input"),!0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){if(!this.composing||this.composing.handled)return;this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus()},applyComposition:function(e){e.data&&e.data!=e.startData&&nr(this.cm,St)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),nr(this.cm,St)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},onContextMenu:eu,resetPosition:eu,needsContentAttribute:!0},kt.prototype),E.inputStyles={textarea:Nt,contenteditable:kt},Dt.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(vt(n.anchor,r.anchor)!=0||vt(n.head,r.head)!=0)return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Pt(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Dt(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(vt(t,r.from())>=0&&vt(e,r.to())<=0)return n}return-1}},Pt.prototype={from:function(){return yt(this.anchor,this.head)},to:function(){return gt(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Tn={left:0,right:0,top:0,bottom:0},Rn,Wn=null,Xn=0,br,wr,Cr=0,Mr=0,_r=null;r?_r=-0.53:e?_r=15:u?_r=-0.7:f&&(_r=-1/3);var Dr=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}};E.wheelEventPixels=function(e){var t=Dr(e);return t.x*=_r,t.y*=_r,t};var jr=new Xo,Rr=null,Qr=E.changeEnd=function(e){return e.text?dt(e.from.line+e.text.length-1,Qo(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};E.prototype={constructor:E,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t,Si.hasOwnProperty(e)&&nr(this,Si[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Fi(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:rr(function(e,t){var n=e.token?e:E.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:t&&t.opaque}),this.state.modeGen++,ur(this)}),removeOverlay:rr(function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||typeof e=="string"&&r.name==e){t.splice(n,1),this.state.modeGen++,ur(this);return}}}),indentLine:rr(function(e,t,n){typeof t!="string"&&typeof t!="number"&&(t==null?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract"),qt(this.doc,e)&&mi(this,e,t,n)}),indentSelection:rr(function(e){var t=this.doc.sel.ranges,n=-1;for(var r=0;r<t.length;r++){var i=t[r];if(!i.empty()){var s=i.from(),o=i.to(),u=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var a=u;a<n;++a)mi(this,a,e);var f=this.doc.sel.ranges;s.ch==0&&t.length==f.length&&f[r].from().ch>0&&Xt(this.doc,r,new Pt(s,f[r].to()),Uo)}else i.head.line>n&&(mi(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&di(this))}}),getTokenAt:function(e,t){return As(this,e,t)},getLineTokens:function(e,t){return As(this,dt(e),t,!0)},getTokenTypeAt:function(e){e=Ft(this.doc,e);var t=_s(this,eo(this.doc,e.line)),n=0,r=(t.length-1)/2,i=e.ch,s;if(i==0)s=t[2];else for(;;){var o=n+r>>1;if((o?t[o*2-1]:0)>=i)r=o;else{if(!(t[o*2+1]<i)){s=t[o*2+2];break}n=o+1}}var u=s?s.indexOf("cm-overlay "):-1;return u<0?s:u==0?null:s.slice(0,u-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?E.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!Ai.hasOwnProperty(t))return Ai;var r=Ai[t],i=this.getModeAt(e);if(typeof i[t]=="string")r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var s=0;s<i[t].length;s++){var o=r[i[t][s]];o&&n.push(o)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var s=0;s<r._global.length;s++){var u=r._global[s];u.pred(i,this)&&Yo(n,u.val)==-1&&n.push(u.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=jt(n,e==null?n.first+n.size-1:e),ln(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return e==null?n=r.head:typeof e=="object"?n=Ft(this.doc,e):n=e?r.from():r.to(),Bn(this,n,t||"page")},charCoords:function(e,t){return Hn(this,Ft(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Pn(this,e,t||"page"),In(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Pn(this,{top:e,left:0},t||"page").top,so(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n=!1,r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0);var i=eo(this.doc,e);return Dn(this,i,{top:0,left:0},t||"page").top+(n?this.doc.height-oo(i):0)},defaultTextHeight:function(){return Un(this.display)},defaultCharWidth:function(){return zn(this.display)},setGutterMarker:rr(function(e,t,n){return gi(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&uu(r)&&(e.gutterMarkers=null),!0})}),clearGutter:rr(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,ar(t,r,"gutter"),uu(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineWidget:rr(function(e,t,n){return Ss(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!qt(this.doc,e))return null;var t=e;e=eo(this.doc,e);if(!e)return null}else{var t=io(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=Bn(this,Ft(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="",i=="right"?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&ci(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:rr(Ur),triggerOnKeyPress:rr(Xr),triggerOnKeyUp:Wr,execCommand:function(e){if(_i.hasOwnProperty(e))return _i[e](this)},findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var s=0,o=Ft(this.doc,e);s<t;++s){o=bi(this.doc,o,i,n,r);if(o.hitSide)break}return o},moveH:rr(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?bi(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},Wo)}),deleteH:rr(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):yi(this,function(n){var i=bi(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,s=r;t<0&&(i=-1,t=-t);for(var o=0,u=Ft(this.doc,e);o<t;++o){var a=Bn(this,u,"div");s==null?s=a.left:a.left=s,u=wi(this,a,i,n);if(u.hitSide)break}return u},moveV:rr(function(e,t){var n=this,r=this.doc,i=[],s=!n.display.shift&&!r.extend&&r.sel.somethingSelected();r.extendSelectionsBy(function(o){if(s)return e<0?o.from():o.to();var u=Bn(n,o.head,"div");o.goalColumn!=null&&(u.left=o.goalColumn),i.push(u.left);var a=wi(n,u,e,t);return t=="page"&&o==r.sel.primary()&&pi(n,null,Hn(n,a,"div").top-u.top),a},Wo);if(i.length)for(var o=0;o<r.sel.ranges.length;o++)r.sel.ranges[o].goalColumn=i[o]}),findWordAt:function(e){var t=this.doc,n=eo(t,e.line).text,r=e.ch,i=e.ch;if(n){var s=this.getHelper(e,"wordChars");(e.xRel<0||i==n.length)&&r?--r:++i;var o=n.charAt(r),u=ou(o,s)?function(e){return ou(e,s)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ou(e)};while(r>0&&u(n.charAt(r-1)))--r;while(i<n.length&&u(n.charAt(i)))++i}return new Pt(dt(e.line,r),dt(e.line,i))},toggleOverwrite:function(e){if(e!=null&&e==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?yu(this.display.cursorDiv,"CodeMirror-overwrite"):gu(this.display.cursorDiv,"CodeMirror-overwrite"),_o(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==vu()},scrollTo:rr(function(e,t){(e!=null||t!=null)&&vi(this),e!=null&&(this.curOp.scrollLeft=e),t!=null&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-dn(this)-this.display.barHeight,width:e.scrollWidth-dn(this)-this.display.barWidth,clientHeight:mn(this),clientWidth:vn(this)}},scrollIntoView:rr(function(e,t){e==null?(e={from:this.doc.sel.primary().head,to:null},t==null&&(t=this.options.cursorScrollMargin)):typeof e=="number"?e={from:dt(e,0),to:null}:e.from==null&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0;if(e.from.line!=null)vi(this),this.curOp.scrollToPos=e;else{var n=hi(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:rr(function(e,t){function r(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e}var n=this;e!=null&&(n.display.wrapper.style.width=r(e)),t!=null&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&An(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){ar(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,_o(n,"refresh",this)}),operation:function(e){return tr(this,e)},refresh:rr(function(){var e=this.display.cachedTextHeight;ur(this),this.curOp.forceUpdate=!0,On(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),M(this),(e==null||Math.abs(e-Un(this.display))>.5)&&k(this),_o(this,"refresh",this)}),swapDoc:rr(function(e){var t=this.doc;return t.cm=null,Zs(this,e),On(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Po(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Io(E);var Ei=E.defaults={},Si=E.optionHandlers={},Ti=E.Init={toString:function(){return"CodeMirror.Init"}};xi("value","",function(e,t){e.setValue(t)},!0),xi("mode",null,function(e,t){e.doc.modeOption=t,x(e)},!0),xi("indentUnit",2,x,!0),xi("indentWithTabs",!1),xi("smartIndent",!0),xi("tabSize",4,function(e){T(e),On(e),ur(e)},!0),xi("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test("	")?"":"|	"),"g"),e.refresh()},!0),xi("specialCharPlaceholder",Fs,function(e){e.refresh()},!0),xi("electricChars",!0),xi("inputStyle",p?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),xi("rtlMoveVisually",!v),xi("wholeLineUpdateBefore",!0),xi("theme","default",function(e){L(e),A(e)},!0),xi("keyMap","default",function(e,t,n){var r=Fi(t),i=n!=E.Init&&Fi(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),xi("extraKeys",null),xi("lineWrapping",!1,N,!0),xi("gutters",[],function(e){P(e.options),A(e)},!0),xi("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?X(e.display)+"px":"0",e.refresh()},!0),xi("coverGutterNextToScrollbar",!1,function(e){I(e)},!0),xi("scrollbarStyle","native",function(e){F(e),I(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),xi("lineNumbers",!1,function(e){P(e.options),A(e)},!0),xi("firstLineNumber",1,A,!0),xi("lineNumberFormatter",function(e){return e},A,!0),xi("showCursorWhenSelecting",!1,tn,!0),xi("resetSelectionOnContextMenu",!0),xi("readOnly",!1,function(e,t){t=="nocursor"?($r(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),xi("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),xi("dragDrop",!0),xi("cursorBlinkRate",530),xi("cursorScrollMargin",0),xi("cursorHeight",1,tn,!0),xi("singleCursorHeightPerLine",!0,tn,!0),xi("workTime",100),xi("workDelay",100),xi("flattenSpans",!0,T,!0),xi("addModeClass",!1,T,!0),xi("pollInterval",100),xi("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),xi("historyEventDelay",1250),xi("viewportMargin",10,function(e){e.refresh()},!0),xi("maxHighlightLength",1e4,T,!0),xi("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),xi("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),xi("autofocus",null);var Ni=E.modes={},Ci=E.mimeModes={};E.defineMode=function(e,t){!E.defaults.mode&&e!="null"&&(E.defaults.mode=e),arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ni[e]=t},E.defineMIME=function(e,t){Ci[e]=t},E.resolveMode=function(e){if(typeof e=="string"&&Ci.hasOwnProperty(e))e=Ci[e];else if(e&&typeof e.name=="string"&&Ci.hasOwnProperty(e.name)){var t=Ci[e.name];typeof t=="string"&&(t={name:t}),e=tu(t,e),e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return E.resolveMode("application/xml");return typeof e=="string"?{name:e}:e||{name:"null"}},E.getMode=function(e,t){var t=E.resolveMode(t),n=Ni[t.name];if(!n)return E.getMode(e,"text/plain");var r=n(e,t);if(ki.hasOwnProperty(t.name)){var i=ki[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;r.hasOwnProperty(s)&&(r["_"+s]=r[s]),r[s]=i[s]}}r.name=t.name,t.helperType&&(r.helperType=t.helperType);if(t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r},E.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),E.defineMIME("text/plain","null");var ki=E.modeExtensions={};E.extendMode=function(e,t){var n=ki.hasOwnProperty(e)?ki[e]:ki[e]={};nu(t,n)},E.defineExtension=function(e,t){E.prototype[e]=t},E.defineDocExtension=function(e,t){Ks.prototype[e]=t},E.defineOption=xi;var Li=[];E.defineInitHook=function(e){Li.push(e)};var Ai=E.helpers={};E.registerHelper=function(e,t,n){Ai.hasOwnProperty(e)||(Ai[e]=E[e]={_global:[]}),Ai[e][t]=n},E.registerGlobalHelper=function(e,t,n,r){E.registerHelper(e,t,r),Ai[e]._global.push({pred:n,val:r})};var Oi=E.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},Mi=E.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};E.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var _i=E.commands={selectAll:function(e){e.setSelection(dt(e.firstLine(),0),dt(e.lastLine()),Uo)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Uo)},killLine:function(e){yi(e,function(t){if(t.empty()){var n=eo(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:dt(t.head.line+1,0)}:{from:t.head,to:dt(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){yi(e,function(t){return{from:dt(t.from().line,0),to:Ft(e.doc,dt(t.to().line+1,0))}})},delLineLeft:function(e){yi(e,function(e){return{from:dt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){yi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){yi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(dt(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(dt(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return qu(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return Uu(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Ru(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Wo)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Wo)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Uu(e,t.head):r},Wo)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("	")},insertSoftTab:function(e){var t=[],n=e.listSelections(),r=e.options.tabSize;for(var i=0;i<n.length;i++){var s=n[i].from(),o=Vo(e.getLine(s.line),s.ch,r);t.push((new Array(r-o%r+1)).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){tr(e,function(){var t=e.listSelections(),n=[];for(var r=0;r<t.length;r++){var i=t[r].head,s=eo(e.doc,i.line).text;if(s){i.ch==s.length&&(i=new dt(i.line,i.ch-1));if(i.ch>0)i=new dt(i.line,i.ch+1),e.replaceRange(s.charAt(i.ch-1)+s.charAt(i.ch-2),dt(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var o=eo(e.doc,i.line-1).text;o&&e.replaceRange(s.charAt(0)+"\n"+o.charAt(o.length-1),dt(i.line-1,o.length-1),dt(i.line,1),"+transpose")}}n.push(new Pt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){tr(e,function(){var t=e.listSelections().length;for(var n=0;n<t;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),di(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Di=E.keyMap={};Di.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"},Di.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"},Di.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"},Di.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"]},Di["default"]=d?Di.macDefault:Di.pcDefault,E.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}var i=Zo(n.split(" "),Pi);for(var s=0;s<i.length;s++){var o,u;s==i.length-1?(u=n,o=r):(u=i.slice(0,s+1).join(" "),o="...");var a=t[u];if(!a)t[u]=o;else if(a!=o)throw new Error("Inconsistent bindings for "+u)}delete e[n]}for(var f in t)e[f]=t[f];return e};var Hi=E.lookupKey=function(e,t,n,r){t=Fi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Hi(e,t.fallthrough,n,r);for(var s=0;s<t.fallthrough.length;s++){var o=Hi(e,t.fallthrough[s],n,r);if(o)return o}}},Bi=E.isModifierKey=function(e){var t=typeof e=="string"?e:Pu[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"},ji=E.keyName=function(e,t){if(a&&e.keyCode==34&&e["char"])return!1;var n=Pu[e.keyCode],r=n;return r==null||e.altGraphKey?!1:(e.altKey&&n!="Alt"&&(r="Alt-"+r),(g?e.metaKey:e.ctrlKey)&&n!="Ctrl"&&(r="Ctrl-"+r),(g?e.ctrlKey:e.metaKey)&&n!="Cmd"&&(r="Cmd-"+r),!t&&e.shiftKey&&n!="Shift"&&(r="Shift-"+r),r)};E.fromTextArea=function(e,t){function r(){e.value=a.getValue()}t=t?nu(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder);if(t.autofocus==null){var n=vu();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}if(e.form){Oo(e.form,"submit",r);if(!t.leaveSubmitMethodAlone){var i=e.form,s=i.submit;try{var o=i.submit=function(){r(),i.submit=s,i.submit(),i.submit=o}}catch(u){}}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(Mo(e.form,"submit",r),typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var a=E(function(t){e.parentNode.insertBefore(t,e.nextSibling)},t);return a};var Ii=E.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ii.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Vo(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Vo(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Vo(this.string,null,this.tabSize)-(this.lineStart?Vo(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if(typeof e!="string"){var s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var qi=0,Ri=E.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++qi};Io(Ri),Ri.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&Vn(e);if(Fo(this,"clear")){var n=this.find();n&&Po(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;s<this.lines.length;++s){var o=this.lines[s],u=Ki(o.markedSpans,this);e&&!this.collapsed?ar(e,io(o),"text"):e&&(u.to!=null&&(i=io(o)),u.from!=null&&(r=io(o))),o.markedSpans=Qi(o.markedSpans,u),u.from==null&&this.collapsed&&!gs(this.doc,o)&&e&&ro(o,Un(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var a=ps(this.lines[s]),f=_(a);f>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=f,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&ur(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Yt(e.doc)),e&&Po(e,"markerCleared",e,this),t&&Jn(e),this.parent&&this.parent.clear()},Ri.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);var n,r;for(var i=0;i<this.lines.length;++i){var s=this.lines[i],o=Ki(s.markedSpans,this);if(o.from!=null){n=dt(t?s:io(s),o.from);if(e==-1)return n}if(o.to!=null){r=dt(t?s:io(s),o.to);if(e==1)return r}}return n&&{from:n,to:r}},Ri.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;if(!e||!n)return;tr(n,function(){var r=e.line,i=io(e.line),s=En(n,i);s&&(Ln(s),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0;if(!gs(t.doc,r)&&t.height!=null){var o=t.height;t.height=null;var u=Es(t)-o;u&&ro(r,r.height+u)}})},Ri.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Yo(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ri.prototype.detachLine=function(e){this.lines.splice(Yo(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var qi=0,zi=E.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Io(zi),zi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Po(this,"clear")},zi.prototype.find=function(e,t){return this.primary.find(e,t)};var bs=E.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=e,this.node=t};Io(bs),bs.prototype.clear=function(){var e=this.cm,t=this.line.widgets,n=this.line,r=io(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var s=Es(this);tr(e,function(){ws(e,n,-s),ar(e,r,"widget"),ro(n,Math.max(0,n.height-s))})},bs.prototype.changed=function(){var e=this.height,t=this.cm,n=this.line;this.height=null;var r=Es(this)-e;if(!r)return;tr(t,function(){t.curOp.forceUpdate=!0,ws(t,n,r),ro(n,n.height+r)})};var xs=E.Line=function(e,t,n){this.text=e,ss(this,t),this.height=n?n(this):1};Io(xs),xs.prototype.lineNo=function(){return io(this)};var Ps={},Hs={};Vs.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Ns(i),Po(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},$s.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var s=Math.min(t,i-e),o=r.height;r.removeInner(e,s),this.height-=o-r.height,i==s&&(this.children.splice(n--,1),r.parent=null);if((t-=s)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Vs))){var u=[];this.collapse(u),this.children=[new Vs(u)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<=s){i.insertInner(e,t,n);if(i.lines&&i.lines.length>50){while(i.lines.length>50){var o=i.lines.splice(i.lines.length-25,25),u=new Vs(o);i.height-=u.height,this.children.splice(r+1,0,u),u.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new $s(t);if(!e.parent){var r=new $s(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=Yo(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e);if(i.iterN(e,o,n))return!0;if((t-=o)==0)break;e=0}else e-=s}}};var Js=0,Ks=E.Doc=function(e,t,n){if(!(this instanceof Ks))return new Ks(e,t,n);n==null&&(n=0),$s.call(this,[new Vs([new xs("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=dt(n,0);this.sel=Bt(r),this.history=new ao(null),this.id=++Js,this.modeOption=t,typeof e=="string"&&(e=Au(e)),Xs(this,{from:r,to:r,text:e}),Kt(this,Bt(r),Uo)};Ks.prototype=tu($s.prototype,{constructor:Ks,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=no(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:ir(function(e){var t=dt(this.first,0),n=this.first+this.size-1;ni(this,{from:t,to:dt(n,eo(this,n).text.length),text:Au(e),origin:"setValue",full:!0},!0),Kt(this,Bt(t))}),replaceRange:function(e,t,n,r){t=Ft(this,t),n=n?Ft(this,n):t,ai(this,e,t,n,r)},getRange:function(e,t,n){var r=to(this,Ft(this,e),Ft(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(qt(this,e))return eo(this,e)},getLineNumber:function(e){return io(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=eo(this,e)),ps(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Ft(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ir(function(e,t,n){Vt(this,Ft(this,typeof e=="number"?dt(e,t||0):e),null,n)}),setSelection:ir(function(e,t,n){Vt(this,Ft(this,e),Ft(this,t||e),n)}),extendSelection:ir(function(e,t,n){zt(this,Ft(this,e),t&&Ft(this,t),n)}),extendSelections:ir(function(e,t){Wt(this,Rt(this,e,t))}),extendSelectionsBy:ir(function(e,t){Wt(this,Zo(this.sel.ranges,e),t)}),setSelections:ir(function(e,t,n){if(!e.length)return;for(var r=0,i=[];r<e.length;r++)i[r]=new Pt(Ft(this,e[r].anchor),Ft(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Kt(this,Ht(i,t),n)}),addSelection:ir(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Pt(Ft(this,e),Ft(this,t||e))),Kt(this,Ht(r,r.length-1),n)}),getSelection:function(e){var t=this.sel.ranges,n;for(var r=0;r<t.length;r++){var i=to(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||"\n")},getSelections:function(e){var t=[],n=this.sel.ranges;for(var r=0;r<n.length;r++){var i=to(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||"\n")),t[r]=i}return t},replaceSelection:function(e,t,n){var r=[];for(var i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:ir(function(e,t,n){var r=[],i=this.sel;for(var s=0;s<i.ranges.length;s++){var o=i.ranges[s];r[s]={from:o.from(),to:o.to(),text:Au(e[s]),origin:n}}var u=t&&t!="end"&&ei(this,r,t);for(var s=r.length-1;s>=0;s--)ni(this,r[s]);u?Jt(this,u):this.cm&&di(this.cm)}),undo:ir(function(){ii(this,"undo")}),redo:ir(function(){ii(this,"redo")}),undoSelection:ir(function(){ii(this,"undo",!0)}),redoSelection:ir(function(){ii(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new ao(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:wo(this.history.done),undone:wo(this.history.undone)}},setHistory:function(e){var t=this.history=new ao(this.history.maxGeneration);t.done=wo(e.done.slice(0),null,!0),t.undone=wo(e.undone.slice(0),null,!0)},addLineClass:ir(function(e,t,n){return gi(this,e,t=="gutter"?"gutter":"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!e[r])e[r]=n;else{if(mu(n).test(e[r]))return!1;e[r]+=" "+n}return!0})}),removeLineClass:ir(function(e,t,n){return gi(this,e,t=="gutter"?"gutter":"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(n==null)e[r]=null;else{var s=i.match(mu(n));if(!s)return!1;var o=s.index+s[0].length;e[r]=i.slice(0,s.index)+(!s.index||o==i.length?"":" ")+i.slice(o)||null}return!0})}),markText:function(e,t,n){return Ui(this,Ft(this,e),Ft(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=Ft(this,e),Ui(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Ft(this,e);var t=[],n=eo(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=Ft(this,e),t=Ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(s){var o=s.markedSpans;if(o)for(var u=0;u<o.length;u++){var a=o[u];!(i==e.line&&e.ch>a.to||a.from==null&&i!=e.line||i==t.line&&a.from>t.ch)&&(!n||n(a.marker))&&r.push(a.marker.parent||a.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first;return this.iter(function(r){var i=r.text.length+1;if(i>e)return t=e,!0;e-=i,++n}),Ft(this,dt(n,t))},indexFromPos:function(e){e=Ft(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ks(no(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Ks(no(this,t,n),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Vi(r,Xi(this)),r},unlinkDoc:function(e){e instanceof E&&(e=e.doc);if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),$i(Xi(this));break}if(e.history==this.history){var r=[e.id];Ys(e,function(e){r.push(e.id)},!0),e.history=new ao(null),e.history.done=wo(this.history.done,r),e.history.undone=wo(this.history.undone,r)}},iterLinkedDocs:function(e){Ys(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ks.prototype.eachLine=Ks.prototype.iter;var Qs="iter insert remove copy getEditor".split(" ");for(var Gs in Ks.prototype)Ks.prototype.hasOwnProperty(Gs)&&Yo(Qs,Gs)<0&&(E.prototype[Gs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ks.prototype[Gs]));Io(Ks);var To=E.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},No=E.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ko=E.e_stop=function(e){To(e),No(e)},Oo=E.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}},Mo=E.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},_o=E.signal=function(e,t){var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);for(var i=0;i<n.length;++i)n[i].apply(null,r)},Do=null,qo=30,Ro=E.Pass={toString:function(){return"CodeMirror.Pass"}},Uo={scroll:!1},zo={origin:"*mouse"},Wo={origin:"+move"};Xo.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Vo=E.countColumn=function(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var s=r||0,o=i||0;;){var u=e.indexOf("	",s);if(u<0||u>=t)return o+(t-s);o+=u-s,o+=n-o%n,s=u+1}},Jo=[""],Go=function(e){e.select()};h?Go=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:r&&(Go=function(e){try{e.select()}catch(t){}});var iu=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,su=E.isWordChar=function(e){return/\w/.test(e)||e>"ย€"&&(e.toUpperCase()!=e.toLowerCase()||iu.test(e))},au=/[\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]/,cu;document.createRange?cu=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:cu=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var du=E.contains=function(e,t){t.nodeType==3&&(t=t.parentNode);if(e.contains)return e.contains(t);do{t.nodeType==11&&(t=t.host);if(t==e)return!0}while(t=t.parentNode)};r&&i<11&&(vu=function(){try{return document.activeElement}catch(e){return document.body}});var gu=E.rmClass=function(e,t){var n=e.className,r=mu(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},yu=E.addClass=function(e,t){var n=e.className;mu(t).test(n)||(e.className+=(n?" ":"")+t)},Eu=!1,Tu=function(){if(r&&i<9)return!1;var e=lu("div");return"draggable"in e||"dragDrop"in e}(),Nu,ku,Au=E.splitLines="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ou=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Mu=function(){var e=lu("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),_u=null,Pu={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};E.keyNames=Pu,function(){for(var e=0;e<10;e++)Pu[e+48]=Pu[e+96]=String(e);for(var e=65;e<=90;e++)Pu[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)Pu[e+111]=Pu[e+63235]="F"+e}();var Wu,Ku=function(){function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function f(e,t,n){this.level=e,this.from=t,this.to=n}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,l=[];for(var c=0,h;c<t;++c)l.push(h=n(e.charCodeAt(c)));for(var c=0,p=a;c<t;++c){var h=l[c];h=="m"?l[c]=p:p=h}for(var c=0,d=a;c<t;++c){var h=l[c];h=="1"&&d=="r"?l[c]="n":s.test(h)&&(d=h,h=="r"&&(l[c]="R"))}for(var c=1,p=l[0];c<t-1;++c){var h=l[c];h=="+"&&p=="1"&&l[c+1]=="1"?l[c]="1":h==","&&p==l[c+1]&&(p=="1"||p=="n")&&(l[c]=p),p=h}for(var c=0;c<t;++c){var h=l[c];if(h==",")l[c]="N";else if(h=="%"){for(var v=c+1;v<t&&l[v]=="%";++v);var m=c&&l[c-1]=="!"||v<t&&l[v]=="1"?"1":"N";for(var g=c;g<v;++g)l[g]=m;c=v-1}}for(var c=0,d=a;c<t;++c){var h=l[c];d=="L"&&h=="1"?l[c]="L":s.test(h)&&(d=h)}for(var c=0;c<t;++c)if(i.test(l[c])){for(var v=c+1;v<t&&i.test(l[v]);++v);var y=(c?l[c-1]:a)=="L",b=(v<t?l[v]:a)=="L",m=y||b?"L":"R";for(var g=c;g<v;++g)l[g]=m;c=v-1}var w=[],E;for(var c=0;c<t;)if(o.test(l[c])){var S=c;for(++c;c<t&&o.test(l[c]);++c);w.push(new f(0,S,c))}else{var x=c,T=w.length;for(++c;c<t&&l[c]!="L";++c);for(var g=x;g<c;)if(u.test(l[g])){x<g&&w.splice(T,0,new f(1,x,g));var N=g;for(++g;g<c&&u.test(l[g]);++g);w.splice(T,0,new f(2,N,g)),x=g}else++g;x<c&&w.splice(T,0,new f(1,x,c))}return w[0].level==1&&(E=e.match(/^\s+/))&&(w[0].from=E[0].length,w.unshift(new f(0,0,E[0].length))),Qo(w).level==1&&(E=e.match(/\s+$/))&&(Qo(w).to-=E[0].length,w.push(new f(0,t-E[0].length,t))),w[0].level!=Qo(w).level&&w.push(new f(w[0].level,t,t)),w}}();return E.version="5.0.0",E}),function(e){var t={prefilled:null,CapitalizeFirstLetter:!1,preventSubmitOnEnter:!0,isClearInputOnEsc:!0,externalTagId:!1,prefillIdFieldName:"Id",prefillValueFieldName:"Value",AjaxPush:null,AjaxPushAllTags:null,AjaxPushParameters:null,delimiters:[9,13,44],backspace:[8],maxTags:0,hiddenTagListName:null,hiddenTagListId:null,replace:!0,output:null,deleteTagsOnBackspace:!0,tagsContainer:null,tagCloseIcon:"x",tagClass:"",validator:null,onlyTagList:!1,tagList:null,fillInputOnTagRemove:!1},n={pushTag:function(t,n,i){var s=e(this),o=s.data("opts"),u,a,f,l,c=s.data("tlis"),h=s.data("tlid"),p,d,v,m,g,y,b,w;t=r.trimTag(t,o.delimiterChars);if(!t||t.length<=0)return;if(o.onlyTagList&&undefined!==o.tagList&&o.tagList){var E=o.tagList;e.each(E,function(e,t){E[e]=t.toLowerCase()});var S=e.inArray(t.toLowerCase(),E);if(-1===S)return}o.CapitalizeFirstLetter&&t.length>1&&(t=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase());if(o.validator&&!o.validator(t)){s.trigger("tm:invalid",t);return}if(o.maxTags>0&&c.length>=o.maxTags)return;u=!1,a=jQuery.map(c,function(e){return e.toLowerCase()}),p=e.inArray(t.toLowerCase(),a),-1!==p&&(u=!0);if(u){s.trigger("tm:duplicated",t);if(o.blinkClass)for(var x=0;x<6;++x)e("#"+s.data("tm_rndid")+"_"+h[p]).queue(function(t){e(this).toggleClass(o.blinkClass),t()}).delay(100);else e("#"+s.data("tm_rndid")+"_"+h[p]).stop().animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100).animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100).animate({backgroundColor:o.blinkBGColor_1},100).animate({backgroundColor:o.blinkBGColor_2},100)}else o.externalTagId===!0?(i===undefined&&e.error("externalTagId is not passed for tag -"+t),l=i):(f=Math.max.apply(null,h),f=f===-Infinity?0:f,l=++f),n||s.trigger("tm:pushing",[t,l]),c.push(t),h.push(l),n||o.AjaxPush!==null&&o.AjaxPushAllTags==null&&e.inArray(t,o.prefilled)===-1&&e.post(o.AjaxPush,e.extend({tag:t},o.AjaxPushParameters)),d=s.data("tm_rndid")+"_"+l,v=s.data("tm_rndid")+"_Remover_"+l,m=e("<span/>").text(t).html(),g='<span class="'+r.tagClasses.call(s)+'" id="'+d+'">',g+="<span>"+m+"</span>",g+='<a href="#" class="tm-tag-remove" id="'+v+'" TagIdToRemove="'+l+'">',g+=o.tagCloseIcon+"</a></span> ",y=e(g),o.tagsContainer!==null?e(o.tagsContainer).append(y):h.length>1?(w=s.siblings("#"+s.data("tm_rndid")+"_"+h[h.length-2]),w.after(y)):s.before(y),y.find("#"+v).on("click",s,function(t){t.preventDefault();var n=parseInt(e(this).attr("TagIdToRemove"));r.spliceTag.call(s,n,t.data)}),r.refreshHiddenTagList.call(s),n||s.trigger("tm:pushed",[t,l]),r.showOrHide.call(s);s.val("")},popTag:function(){var t=e(this),n,i,s=t.data("tlis"),o=t.data("tlid");o.length>0&&(n=o.pop(),i=s[s.length-1],t.trigger("tm:popping",[i,n]),s.pop(),e("#"+t.data("tm_rndid")+"_"+n).remove(),r.refreshHiddenTagList.call(t),t.trigger("tm:popped",[i,n]))},empty:function(){var t=e(this),n=t.data("tlis"),i=t.data("tlid"),s;while(i.length>0)s=i.pop(),n.pop(),e("#"+t.data("tm_rndid")+"_"+s).remove(),r.refreshHiddenTagList.call(t);t.trigger("tm:emptied",null),r.showOrHide.call(t)},tags:function(){var e=this,t=e.data("tlis");return t}},r={showOrHide:function(){var e=this,t=e.data("opts"),n=e.data("tlis");t.maxTags>0&&n.length<t.maxTags&&(e.show(),e.trigger("tm:show")),t.maxTags>0&&n.length>=t.maxTags&&(e.hide(),e.trigger("tm:hide"))},tagClasses:function(){var t=e(this),n=t.data("opts"),r=n.tagBaseClass,i=n.inputBaseClass,s;return s=r,t.attr("class")&&e.each(t.attr("class").split(" "),function(e,t){t.indexOf(i+"-")!==-1&&(s+=" "+r+t.substring(i.length))}),s+=n.tagClass?" "+n.tagClass:"",s},trimTag:function(t,n){var r;t=e.trim(t),r=0;for(r;r<t.length;r++)if(e.inArray(t.charCodeAt(r),n)!==-1)break;return t.substring(0,r)},refreshHiddenTagList:function(){var t=e(this),n=t.data("tlis"),r=t.data("lhiddenTagList");r&&e(r).val(n.join(t.data("opts").baseDelimiter)).change(),t.trigger("tm:refresh",n.join(t.data("opts").baseDelimiter))},killEvent:function(e){e.cancelBubble=!0,e.returnValue=!1,e.stopPropagation(),e.preventDefault()},keyInArray:function(t,n){return e.inArray(t.which,n)!==-1},applyDelimiter:function(t){var r=e(this);n.pushTag.call(r,e(this).val()),t.preventDefault()},prefill:function(t){var r=e(this),i=r.data("opts");e.each(t,function(e,t){i.externalTagId===!0?n.pushTag.call(r,t[i.prefillValueFieldName],!0,t[i.prefillIdFieldName]):n.pushTag.call(r,t,!0)})},pushAllTags:function(t,n){var r=e(this),i=r.data("opts"),s=r.data("tlis");i.AjaxPushAllTags&&(t.type!=="tm:pushed"||e.inArray(n,i.prefilled)===-1)&&e.post(i.AjaxPush,e.extend({tags:s.join(i.baseDelimiter)},i.AjaxPushParameters))},spliceTag:function(t){var n=this,i=n.data("tlis"),s=n.data("tlid"),o=e.inArray(t,s),u;-1!==o&&(u=i[o],n.trigger("tm:splicing",[u,t]),e("#"+n.data("tm_rndid")+"_"+t).remove(),i.splice(o,1),s.splice(o,1),r.refreshHiddenTagList.call(n),n.trigger("tm:spliced",[u,t])),r.showOrHide.call(n)},init:function(i){var s=e.extend({},t,i),o,u;return s.hiddenTagListName=s.hiddenTagListName===null?"hidden-"+this.attr("name"):s.hiddenTagListName,o=s.delimeters||s.delimiters,u=[9,13,17,18,19,37,38,39,40],s.delimiterChars=[],s.delimiterKeys=[],e.each(o,function(t,n){e.inArray(n,u)!==-1?s.delimiterKeys.push(n):s.delimiterChars.push(n)}),s.baseDelimiter=String.fromCharCode(s.delimiterChars[0]||44),s.tagBaseClass="tm-tag",s.inputBaseClass="tm-input",e.isFunction(s.validator)||(s.validator=null),this.each(function(){var t=e(this),i="",o="",u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";if(t.data("tagManager"))return!1;t.data("tagManager",!0);for(var a=0;a<5;a++)o+=u.charAt(Math.floor(Math.random()*u.length));t.data("tm_rndid",o),t.data("opts",s).data("tlis",[]).data("tlid",[]),s.output===null?(i=e("<input/>",{type:"hidden",name:s.hiddenTagListName}),t.after(i),t.data("lhiddenTagList",i)):t.data("lhiddenTagList",e(s.output)),s.AjaxPushAllTags&&(t.on("tm:spliced",r.pushAllTags),t.on("tm:popped",r.pushAllTags),t.on("tm:pushed",r.pushAllTags)),t.on("focus keypress",function(t){e(this).popover&&e(this).popover("hide")}),s.isClearInputOnEsc&&t.on("keyup",function(t){t.which===27&&(e(this).val(""),r.killEvent(t))}),t.on("keypress",function(e){r.keyInArray(e,s.delimiterChars)&&r.applyDelimiter.call(t,e)}),t.on("keydown",function(e){e.which===13&&s.preventSubmitOnEnter&&r.killEvent(e),r.keyInArray(e,s.delimiterKeys)&&r.applyDelimiter.call(t,e)}),s.deleteTagsOnBackspace&&t.on("keydown",function(i){r.keyInArray(i,s.backspace)&&e(this).val().length<=0&&(n.popTag.call(t),r.killEvent(i))}),s.fillInputOnTagRemove&&t.on("tm:popped",function(t,n){e(this).val(n)}),t.change(function(e){/webkit/.test(navigator.userAgent.toLowerCase())||t.focus(),r.killEvent(e)});if(s.prefilled!==null)typeof s.prefilled=="object"?r.prefill.call(t,s.prefilled):typeof s.prefilled=="string"?r.prefill.call(t,s.prefilled.split(s.baseDelimiter)):typeof s.prefilled=="function"&&r.prefill.call(t,s.prefilled());else if(s.output!==null){if(e(s.output)&&e(s.output).val())var f=e(s.output);r.prefill.call(t,e(s.output).val().split(s.baseDelimiter))}}),this}};e.fn.tagsManager=function(t){var i=e(this);return 0 in this?n[t]?n[t].apply(i,Array.prototype.slice.call(arguments,1)):typeof t=="object"||!t?r.init.apply(this,arguments):(e.error("Method "+t+" does not exist."),!1):this}}(jQuery),define("tagmanager",["jquery"],function(){}),define("form",["jquery","laconic","tagmanager"],function(e){function n(t,n){return e.el.label({"class":"control-label col-xs-2","for":t},n)}function r(t,n){var r={name:t,type:"checkbox"};return n=n||{},n.checked&&(r.checked="checked"),n.title&&(r.title=n.title),e.el.input(r)}function i(t,n){var r={name:t,type:"text","class":"form-control"};return n=n||{},n.placeholder&&(r.placeholder=n.placeholder),n.title&&(r.title=n.title),n.value&&(r.value=n.value),n.disabled&&(r.disabled=n.disabled),e.el.input(r)}function s(t,n,r){var i={name:t,type:"text","class":"tm-input tag-list"};n&&(i.placeholder=n);var s=e.el.input(i);return r&&e(s).data("prefilled",r),s}function o(t){return e.el.p({"class":"help-block"},"Make saved file public and give it a meaningful name")}function u(t,n){var r={name:t,"class":"form-control"};return n=n||{},n.placeholder&&(r.placeholder=n.placeholder),e.el.textarea(r,n.value||"")}var t={serializeAsObject:function(t){var n=t.serializeArray(0),r={};for(var i=0;i<n.length;i++){var s=n[i].name,o=n[i].value,u=t.find('[name="'+s+'"]'),a=u.prop("type");o!=""&&(a=="hidden"&&s.indexOf("hidden-")==0?(s=s.slice("hidden-".length),r[s]==undefined?r[s]=o.split(","):r[s]=o.split(",").concat(r[s])):a=="text"&&u.hasClass("tag-list")?o!=""&&(r[s]!==undefined?r[s].push(o):r[s]=[o]):a=="checkbox"?r[s]=o=="on"?!0:!1:r[s]=o)}return t.find("[type=checkbox]").each(function(){var t=e(this),n=t.prop("name");r[n]===undefined&&(r[n]=!1)}),r},showDialog:function(t){e(".trill_on_swish-event-receiver").trigger("dialog",t)},formBroadcast:function(t,n){e(".trill_on_swish-event-receiver").trigger(t,n)},fields:{fileName:function(t,s,u){var a=e.el.div({"class":"form-group"},n("name","Public | name"),e.el.div({"class":"col-xs-10"},e.el.div({"class":"input-group"},e.el.span({"class":"input-group-addon",title:"If checked, other users can find this program"},r("public",{checked:s})),i("name",{placeholder:"Name (leave empty for generated random name)",title:"Public name of your program",value:t,disabled:u})),o("Make saved file public or give it a meaningful name")));return a},title:function(t){var r=e.el.div({"class":"form-group"},n("title","Title"),e.el.div({"class":"col-xs-10"},i("title",{placeholder:"Descriptive title",value:t})));return r},author:function(t){var r=e.el.div({"class":"form-group"},n("author","Author"),e.el.div({"class":"col-xs-10"},i("author",{placeholder:"Your name",value:t})));return r},date:function(t,r,s){s=s||n;var o=e.el.div({"class":"form-group"},n(s,r),e.el.div({"class":"col-xs-10"},i(s,{disabled:!0,value:(new Date(t*1e3)).toLocaleString()})));return o},description:function(t){var r=e.el.div({"class":"form-group"},n("description","Description"),e.el.div({"class":"col-xs-10"},u("description",{value:t})));return r},commit_message:function(t){var r=e.el.div({"class":"form-group"},n("commit_message","Changes"),e.el.div({"class":"col-xs-10"},u("commit_message",{value:t,placeholder:"Describe your changes here"})));return r},tags:function(t){var r=e.el.div({"class":"form-group"},n("tags","Tags"),e.el.div({"class":"col-xs-10"},s("tags","Tags help finding this code",t)));return r},buttons:function(n){n=n||{};var r=n.label||"Save program",i=e.el.button({name:"save","class":"btn btn-primary"},r);e(i).on("click",function(r){var i=e(r.target).parents("form")[0],s=t.serializeAsObject(e(i));return n.action(r,s),e(r.target).parents(".modal").modal("hide"),r.preventDefault(),!1});var s=e.el.div({"class":"form-group"},e.el.div({"class":"col-xs-offset-2 col-xs-10"},i,e.el.button({name:"cancel","class":"btn btn-danger","data-dismiss":"modal"},"Cancel")));return s}},widgets:{glyphIconButton:function(t,n){var r={"class":"btn btn-info",type:"button"};return n.action&&(r["data-action"]=n.action),n.title&&(r.title=n.title),elem=e.el.button(r,e.el.span({"class":"glyphicon "+t})),elem}}};return t}),define("trill_on_swish_gitty",["jquery","config","form","laconic"],function(e,t,n){function r(t,n){function i(e){(t[e]||n[e])&&t[e]!=n[e]&&(r[e]={from:t[e],to:n[e]})}var r={};i("author"),i("title"),i("data"),i("public");if(d=s(t.tags,n.tags))r.tags=d;return e.isEmptyObject(r)?null:r}function i(t,n){var r={};for(var i in t)if(t.hasOwnProperty(i)){switch(typeof t[i]){case"object":if(e.isArray(t[i])&&!s(t[i],n[i]))continue;break;case"string":case"boolean":if(n[i]==t[i])continue}r[i]=t[i]}return r}function s(t,n){function s(e,t){var n=[];for(var r=0;r<t.length;r++)e.indexOf(t[r])<0&&n.push(t[r]);return n}var r,i={};return t=t||[],n=n||[],(r=s(t,n)).length>0&&(i.added=r),(r=s(n,t)).length>0&&(i.deleted=r),e.isEmptyObject(i)?null:i}return function(e){var i="trill_on_swish_gitty",s={_init:function(t){return this.each(function(){function u(t,n,r,i){var s={role:"presentation"},o=[];n&&o.push("active"),i&&o.push("disabled"),o!=[]&&(s.class=o.join(" "));var u=e.el.li(s,e.el.a({href:"#"+r,"data-toggle":"tab"},t));return u}var n=e(this),r=n.data(i)||{},s=t.meta,o;r.commits=[],r.commits[s.commit]=s,r.commit=s.commit,r.editor=t.editor,henabled=!Boolean(s.previous),o=e(e.el.div({"class":"tab-content"})),n.append(e.el.ul({"class":"nav nav-tabs"},u("Meta data",!0,"trill_on_swish_gitty-meta-data"),u("History",!1,"trill_on_swish_gitty-history",henabled),u("Changes",!1,"trill_on_swish_gitty-diff",henabled))),n.append(o),o.append(e.el.div({"class":"tab-pane fade in active trill_on_swish_gitty-meta-data",id:"trill_on_swish_gitty-meta-data"})),n.find('[href="#trill_on_swish_gitty-meta-data"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showMetaData")}),o.append(e.el.div({"class":"tab-pane fade trill_on_swish_gitty-history",id:"trill_on_swish_gitty-history"})),n.find('[href="#trill_on_swish_gitty-history"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showHistory")}),o.append(e.el.div({"class":"tab-pane fade trill_on_swish_gitty-diff",id:"trill_on_swish_gitty-diff"})),n.find('[href="#trill_on_swish_gitty-diff"]').on("show.bs.tab",function(e){n.trill_on_swish_gitty("showDiff")}),n.data(i,r),n.trill_on_swish_gitty("showMetaData")})},title:function(t){var n=e.el.span("File ",e.el.span({"class":"filename"},t.name));return t.symbolic!="HEAD"&&t.commit&&e(n).append("@",e.el.span({"class":"sha1 abbrev"},t.commit.substring(0,7))),n},showMetaData:function(){return this.each(function(){var t=e(this),r=t.data(i),s=t.find(".trill_on_swish_gitty-meta-data"),o,u=r.commits[r.commit];if(r.metaData==r.commit)return;r.metaData=r.commit,s.html(""),o=e.el.form({"class":"form-horizontal"},n.fields.fileName(u.name,u.public,!0),n.fields.title(u.title),n.fields.author(u.author),n.fields.date(u.time,"Date","date"),n.fields.tags(u.tags)),u.symbolic=="HEAD"&&e(o).append(n.fields.buttons({label:"Update meta data",action:function(e,t){return r.editor.prologEditor("save",t,"only-meta-data"),!1}})),s.append(o)})},showHistory:function(){return this.each(function(){var r=e(this),s=r.data(i),o=r.find(".trill_on_swish_gitty-history"),u=s.commits[s.commit],a;if(s.history)return;o.html(""),o.append(e.el.table({"class":"table table-striped table-condensed trill_on_swish_gitty-history","data-click-to-select":!0,"data-single-select":!0},e.el.tr(e.el.th("Comment"),e.el.th("Date"),e.el.th("Author"),e.el.th("Changed")))),a=n.widgets.glyphIconButton("glyphicon-play",{title:"Open the highlighted version in SWISH"}),o.append(a),e(a).on("click",function(t){var n=r.find("tr.success");if(n.length==1){var i=n.data("commit");s.commits[i].symbolic=="HEAD"?file=s.commits[i].name:file=i,r.parents(".trill_on_swish").trill_on_swish("playFile",file),e("#ajaxModal").modal("hide")}return!1});var f=t.http.locations.trill_on_swish_web_storage+"/"+encodeURI(u.name);e.ajax({url:f,contentType:"application/json",type:"GET",data:{format:"history",depth:6,to:s.commit},success:function(e){r.trill_on_swish_gitty("fillHistoryTable",e),s.history=s.commit},error:function(){alert("Failed to fetch history")}})})},fillHistoryTable:function(t){function f(t){var n,i,o=e.el.span();if(t.previous){if((n=s.commits[t.previous])&&(i=r(t,n)))for(var u in i)i.hasOwnProperty(u)&&e(o).append(e.el.span({"class":"change-type"},u))}else e(o).append("initial");return o}var n=this,s=this.data(i),o=this.find(".table.trill_on_swish_gitty-history");for(var u=0;u<t.length;u++){var a=t[u];s.commits[a.commit]||(s.commits[a.commit]=a)}for(var u=0;u<t.length;u++){var a=t[u],l;if(u==t.length-1&&a.previous&&!s.commit[a.previous])break;var c={"data-commit":a.commit};s.commit==a.commit&&(c.class="success"),l=e.el.tr(c,e.el.td({"class":"commit-message"},a.commit_message||"No comment"),e.el.td({"class":"date"},(new Date(a.time*1e3)).toLocaleString()),e.el.td({"class":"author"},a.author||"No author"),e.el.td({"class":"changes"},f(a))),o.append(l)}o.on("click","tr",function(t){var r=e(t.target).parents("tr"),i=r.data("commit");n.trill_on_swish_gitty("setCommit",i)})},setCommit:function(e){var t=this.data(i),n=this.parent(".modal-content").find("h2");return n.html(""),n.append(this.trill_on_swish_gitty("title",t.commits[e])),this.find("tr.success").removeClass("success"),this.find("tr[data-commit="+e+"]").addClass("success"),t.commit=e,this},showDiff:function(){return this.each(function(){var n=e(this),r=n.data(i);if(r.diff==r.commit)return;n.find(".trill_on_swish_gitty-diff").html("");var s=t.http.locations.trill_on_swish_web_storage+"/"+encodeURI(r.commit);e.ajax({url:s,contentType:"application/json",type:"GET",data:{format:"diff"},success:function(e){n.trill_on_swish_gitty("fillDiff",e),r.diff=r.commit},error:function(){alert("Failed to fetch diff")}})})},fillDiff:function(e){e.tags&&this.trill_on_swish_gitty("diffTags",e.tags),e.data&&this.trill_on_swish_gitty("udiffData",e.data)},diffTags:function(t){function s(t,n){i.append(e.el.span({"class":"diff-tag "+n},t))}var n=this.find(".trill_on_swish_gitty-diff"),r=e(e.el.div({"class":"diff-tags"},e.el.label("Tags"))),i=e(e.el.span({"class":"diff-tags"}));r.append(i);if(t.deleted.length){i.append("Removed: ");for(var o=0;o<t.deleted.length;o++)s(t.deleted[o],"deleted")}if(t.added.length){i.append(t.deleted.length?", ":"","Added: ");for(var o=0;o<t.added.length;o++)s(t.added[o],"added")}return n.append(r),this},udiffData:function(t){var n=this.find(".trill_on_swish_gitty-diff"),r=t.split("\n"),i=e(e.el.pre({"class":"udiff"}));for(var s=0;s<r.length;s++){var o=r[s],u={"@":"udiff-hdr"," ":"udiff-ctx","+":"udiff-add","-":"udiff-del"};i.append(e.el.span({"class":u[o.charAt(0)]},o),e.el.br())}n.append(i)}};e.fn.trill_on_swish_gitty=function(t){if(s[t])return s[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return s._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+i)}}(jQuery),{diffMeta:r,reduceMeta:i}}),define("modal",["config","preferences","jquery","laconic","bootstrap"],function(e,t){(function(n){function s(){var e=n.el.button({type:"button","class":"close","data-dismiss":"modal"});return n(e).html("&times;").on("click",function(e){var r=n(this).parents(".modal"),i=r.find("[data-notagain]");e.preventDefault();if(i&&i.prop("checked")){var s=i.attr("data-notagain");t.setNotAgain(s)}r.modal({show:!1})}),e}function o(e){return e.notagain&&t.persistent()?n.el.label(n.el.input({type:"checkbox","data-notagain":e.notagain,name:"dismiss"})," Don't show again!"):""}function u(){var e=n(this).find(".tm-input");e.each(function(){var e=n(this),t=e.data("prefilled"),r={};t&&(r.prefilled=t),e.tagsManager(r)})}var r="trill_on_swishModal",i={_init:function(e){return this.each(function(){var e=n(this);e.addClass("trill_on_swish-event-receiver"),e.on("trill_on_swish_help",function(t,n){e.trill_on_swishModal("showHelp",n)}),e.on("pldoc",function(t,n){e.trill_on_swishModal("showPlDoc",n)}),e.on("form",function(t,n){e.trill_on_swishModal("showForm",n)}),e.on("dialog",function(t,n){e.trill_on_swishModal("show",n)}),e.on("error",function(t,n){e.trill_on_swishModal("show",n)})})},showHelp:function(r){var i=this;if(r.notagain&&t.notagain(r.notagain))return;n.ajax({url:e.http.locations.trill_on_swish_help+"/"+r.file,dataType:"html",success:function(e){var t=n("<div>");t.html(e),i.trill_on_swishModal("show",n.extend({title:t.find("title").text(),body:t},r))}})},showForm:function(t){var r=this;n.ajax({url:e.http.locations.form+"/"+t.file,dataType:"html",success:function(e){var i=n("<div>");i.html(e),r.trill_on_swishModal("show",n.extend({title:i.find("legend").text(),body:i},t))}})},showPlDoc:function(t){function n(t){var n=t.name+"/"+t.arity;return e.http.locations.pldoc_doc_for+"?header=false&object="+encodeURIComponent(n)}function r(e,t){return e.parents("div.modal-dialog").addClass("swish-embedded-manual"),"<iframe class='swish-embedded-manual' onload='javascript:resizeIframe(this);' src='"+t+"'>"+"</iframe>"}var i={title:"SWI-Prolog manual",body:function(){return r(this,n(t))}};return this.trill_on_swishModal("show",i)},show:function(e){var r=n.el.div({"class":"modal-body"}),i=n.el.h2(),a=n.el.div({"class":"modal-content"},n.el.div({"class":"modal-header"},o(e),s(),i),r),f=n.el.div({"class":"modal fade",id:"ajaxModal",tabindex:-1,role:"dialog"},n.el.div({"class":"modal-dialog"},a));e.notagain&&t.persistent()&&n(a).append(n.el.div({"class":"modal-footer"},o(e))),r=n(r);if(typeof e.body=="function"){var l=e.body.call(r);l&&r.append(l)}else r.html(e.body);return n(i).html(e.title),n(f).modal({show:!0}).on("shown.bs.modal",u).on("hidden.bs.modal",function(){n(this).remove()}),this}};window.resizeIframe=function(e){e.style.height=0,e.style.height=e.contentWindow.document.body.scrollHeight+20+"px"},n.fn.trill_on_swishModal=function(e){if(i[e])return i[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return i._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+r)}})(jQuery)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/edit/matchbrackets",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e,t,i,o){var u=e.getLineHandle(t.line),a=t.ch-1,f=a>=0&&r[u.text.charAt(a)]||r[u.text.charAt(++a)];if(!f)return null;var l=f.charAt(1)==">"?1:-1;if(i&&l>0!=(a==t.ch))return null;var c=e.getTokenTypeAt(n(t.line,a+1)),h=s(e,n(t.line,a+(l>0?1:0)),l,c||null,o);return h==null?null:{from:n(t.line,a),to:h&&h.pos,match:h&&h.ch==f.charAt(0),forward:l>0}}function s(e,t,i,s,o){var u=o&&o.maxScanLineLength||1e4,a=o&&o.maxScanLines||1e3,f=[],l=o&&o.bracketRegex?o.bracketRegex:/[(){}[\]]/,c=i>0?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a);for(var h=t.line;h!=c;h+=i){var p=e.getLine(h);if(!p)continue;var d=i>0?0:p.length-1,v=i>0?p.length:-1;if(p.length>u)continue;h==t.line&&(d=t.ch-(i<0?1:0));for(;d!=v;d+=i){var m=p.charAt(d);if(l.test(m)&&(s===undefined||e.getTokenTypeAt(n(h,d+1))==s)){var g=r[m];if(g.charAt(1)==">"==i>0)f.push(m);else{if(!f.length)return{pos:n(h,d),ch:m};f.pop()}}}}return h-i==(i>0?e.lastLine():e.firstLine())?!1:null}function o(e,r,s){var o=e.state.matchBrackets.maxHighlightLineLength||1e3,u=[],a=e.listSelections();for(var f=0;f<a.length;f++){var l=a[f].empty()&&i(e,a[f].head,!1,s);if(l&&e.getLine(l.from.line).length<=o){var c=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";u.push(e.markText(l.from,n(l.from.line,l.from.ch+1),{className:c})),l.to&&e.getLine(l.to.line).length<=o&&u.push(e.markText(l.to,n(l.to.line,l.to.ch+1),{className:c}))}}if(u.length){t&&e.state.focused&&e.focus();var h=function(){e.operation(function(){for(var e=0;e<u.length;e++)u[e].clear()})};if(!r)return h;setTimeout(h,800)}}function a(e){e.operation(function(){u&&(u(),u=null),u=o(e,!1,e.state.matchBrackets)})}var t=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},u=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",a),n&&(t.state.matchBrackets=typeof n=="object"?n:{},t.on("cursorActivity",a))}),e.defineExtension("matchBrackets",function(){o(this,!0)}),e.defineExtension("findMatchingBracket",function(e,t,n){return i(this,e,t,n)}),e.defineExtension("scanForBracket",function(e,t,n,r){return s(this,e,t,n,r)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/comment/continuecomment",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function r(t){if(t.getOption("disableInput"))return e.Pass;var n=t.listSelections(),r,s=[];for(var o=0;o<n.length;o++){var u=n[o].head,a=t.getTokenAt(u);if(a.type!="comment")return e.Pass;var f=e.innerMode(t.getMode(),a.state).mode;if(!r)r=f;else if(r!=f)return e.Pass;var l=null;if(r.blockCommentStart&&r.blockCommentContinue){var c=a.string.indexOf(r.blockCommentEnd),h=t.getRange(e.Pos(u.line,0),e.Pos(u.line,a.end)),p;if(!(c!=-1&&c==a.string.length-r.blockCommentEnd.length&&u.ch>=c))if(a.string.indexOf(r.blockCommentStart)==0){l=h.slice(0,a.start);if(!/^\s*$/.test(l)){l="";for(var d=0;d<a.start;++d)l+=" "}}else(p=h.indexOf(r.blockCommentContinue))!=-1&&p+r.blockCommentContinue.length>a.start&&/^\s*$/.test(h.slice(0,p))&&(l=h.slice(0,p));l!=null&&(l+=r.blockCommentContinue)}if(l==null&&r.lineComment&&i(t)){var v=t.getLine(u.line),p=v.indexOf(r.lineComment);p>-1&&(l=v.slice(0,p),/\S/.test(l)?l=null:l+=r.lineComment+v.slice(p+r.lineComment.length).match(/^\s*/)[0])}if(l==null)return e.Pass;s[o]="\n"+l}t.operation(function(){for(var e=n.length-1;e>=0;e--)t.replaceRange(s[e],n[e].from(),n[e].to(),"+insert")})}function i(e){var t=e.getOption("continueComments");return t&&typeof t=="object"?t.continueLineComment!==!1:!0}var t=["clike","css","javascript"];for(var n=0;n<t.length;++n)e.extendMode(t[n],{blockCommentContinue:" * "});e.defineOption("continueComments",null,function(t,n,i){i&&i!=e.Init&&t.removeKeyMap("continueComment");if(n){var s="Enter";typeof n=="string"?s=n:typeof n=="object"&&n.key&&(s=n.key);var o={name:"continueComment"};o[s]=r,t.addKeyMap(o)}})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/comment/comment",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e){var t=e.search(n);return t==-1?0:t}var t={},n=/[^\s\u00a0]/,r=e.Pos;e.commands.toggleComment=function(e){var t=Infinity,n=e.listSelections(),i=null;for(var s=n.length-1;s>=0;s--){var o=n[s].from(),u=n[s].to();if(o.line>=t)continue;u.line>=t&&(u=r(t,0)),t=o.line,i==null?e.uncomment(o,u)?i="un":(e.lineComment(o,u),i="line"):i=="un"?e.uncomment(o,u):e.lineComment(o,u)}},e.defineExtension("lineComment",function(e,s,o){o||(o=t);var u=this,a=u.getModeAt(e),f=o.lineComment||a.lineComment;if(!f){if(o.blockCommentStart||a.blockCommentStart)o.fullLines=!0,u.blockComment(e,s,o);return}var l=u.getLine(e.line);if(l==null)return;var c=Math.min(s.ch!=0||s.line==e.line?s.line+1:s.line,u.lastLine()+1),h=o.padding==null?" ":o.padding,p=o.commentBlankLines||e.line==s.line;u.operation(function(){if(o.indent){var t=l.slice(0,i(l));for(var s=e.line;s<c;++s){var a=u.getLine(s),d=t.length;if(!p&&!n.test(a))continue;a.slice(0,d)!=t&&(d=i(a)),u.replaceRange(t+f+h,r(s,0),r(s,d))}}else for(var s=e.line;s<c;++s)(p||n.test(u.getLine(s)))&&u.replaceRange(f+h,r(s,0))})}),e.defineExtension("blockComment",function(e,i,s){s||(s=t);var o=this,u=o.getModeAt(e),a=s.blockCommentStart||u.blockCommentStart,f=s.blockCommentEnd||u.blockCommentEnd;if(!a||!f){(s.lineComment||u.lineComment)&&s.fullLines!=0&&o.lineComment(e,i,s);return}var l=Math.min(i.line,o.lastLine());l!=e.line&&i.ch==0&&n.test(o.getLine(l))&&--l;var c=s.padding==null?" ":s.padding;if(e.line>l)return;o.operation(function(){if(s.fullLines!=0){var t=n.test(o.getLine(l));o.replaceRange(c+f,r(l)),o.replaceRange(a+c,r(e.line,0));var h=s.blockCommentLead||u.blockCommentLead;if(h!=null)for(var p=e.line+1;p<=l;++p)(p!=l||t)&&o.replaceRange(h+c,r(p,0))}else o.replaceRange(f,i),o.replaceRange(a,e)})}),e.defineExtension("uncomment",function(e,i,s){s||(s=t);var o=this,u=o.getModeAt(e),a=Math.min(i.ch!=0||i.line==e.line?i.line:i.line-1,o.lastLine()),f=Math.min(e.line,a),l=s.lineComment||u.lineComment,c=[],h=s.padding==null?" ":s.padding,p;e:{if(!l)break e;for(var d=f;d<=a;++d){var v=o.getLine(d),m=v.indexOf(l);m>-1&&!/comment/.test(o.getTokenTypeAt(r(d,m+1)))&&(m=-1);if(!(m!=-1||d==a&&d!=f||!n.test(v)))break e;if(m>-1&&n.test(v.slice(0,m)))break e;c.push(v)}o.operation(function(){for(var e=f;e<=a;++e){var t=c[e-f],n=t.indexOf(l),i=n+l.length;if(n<0)continue;t.slice(i,i+h.length)==h&&(i+=h.length),p=!0,o.replaceRange("",r(e,n),r(e,i))}});if(p)return!0}var g=s.blockCommentStart||u.blockCommentStart,y=s.blockCommentEnd||u.blockCommentEnd;if(!g||!y)return!1;var b=s.blockCommentLead||u.blockCommentLead,w=o.getLine(f),E=a==f?w:o.getLine(a),S=w.indexOf(g),x=E.lastIndexOf(y);x==-1&&f!=a&&(E=o.getLine(--a),x=E.lastIndexOf(y));if(S==-1||x==-1||!/comment/.test(o.getTokenTypeAt(r(f,S+1)))||!/comment/.test(o.getTokenTypeAt(r(a,x+1))))return!1;var T=w.lastIndexOf(g,e.ch),N=T==-1?-1:w.slice(0,e.ch).indexOf(y,T+g.length);if(T!=-1&&N!=-1&&N+y.length!=e.ch)return!1;N=E.indexOf(y,i.ch);var C=E.slice(i.ch).lastIndexOf(g,N-i.ch);return T=N==-1||C==-1?-1:i.ch+C,N!=-1&&T!=-1&&T!=i.ch?!1:(o.operation(function(){o.replaceRange("",r(a,x-(h&&E.slice(x-h.length,x)==h?h.length:0)),r(a,x+y.length));var e=S+g.length;h&&w.slice(e,e+h.length)==h&&(e+=h.length),o.replaceRange("",r(f,S),r(f,e));if(b)for(var t=f+1;t<=a;++t){var i=o.getLine(t),s=i.indexOf(b);if(s==-1||n.test(i.slice(0,s)))continue;var u=s+b.length;h&&i.slice(u,u+h.length)==h&&(u+=h.length),o.replaceRange("",r(t,s),r(t,u))}}),!0)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/hint/show-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function i(e,t,n,i){if(e.async){var s=++r;e(t,function(e){r==s&&i(e)},n)}else i(e(t,n))}function s(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function o(e){return typeof e=="string"?e:e.text}function u(e,t){function s(e,r){var s;typeof r!="string"?s=function(e){return r(e,t)}:n.hasOwnProperty(r)?s=n[r]:s=r,i[e]=s}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=e.options.customKeys,i=r?{}:n;if(r)for(var o in r)r.hasOwnProperty(o)&&s(o,r[o]);var u=e.options.extraKeys;if(u)for(var o in u)u.hasOwnProperty(o)&&s(o,u[o]);return i}function a(e,t){while(t&&t!=e){if(t.nodeName.toUpperCase()==="LI"&&t.parentNode==e)return t;t=t.parentNode}}function f(r,i){this.completion=r,this.data=i;var s=this,f=r.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=i.selectedHint||0;var c=i.list;for(var h=0;h<c.length;++h){var p=l.appendChild(document.createElement("li")),d=c[h],v=t+(h!=this.selectedHint?"":" "+n);d.className!=null&&(v=d.className+" "+v),p.className=v,d.render?d.render(p,i,d):p.appendChild(document.createTextNode(d.displayText||o(d))),p.hintId=h}var m=f.cursorCoords(r.options.alignWithWord?i.from:null),g=m.left,y=m.bottom,b=!0;l.style.left=g+"px",l.style.top=y+"px";var w=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),E=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(r.options.container||document.body).appendChild(l);var S=l.getBoundingClientRect(),x=S.bottom-E;if(x>0){var T=S.bottom-S.top,N=m.top-(m.bottom-S.top);if(N-T>0)l.style.top=(y=m.top-T)+"px",b=!1;else if(T>E){l.style.height=E-5+"px",l.style.top=(y=m.bottom-S.top)+"px";var C=f.getCursor();i.from.ch!=C.ch&&(m=f.cursorCoords(C),l.style.left=(g=m.left)+"px",S=l.getBoundingClientRect())}}var k=S.right-w;k>0&&(S.right-S.left>w&&(l.style.width=w-5+"px",k-=S.right-S.left-w),l.style.left=(g=m.left-k)+"px"),f.addKeyMap(this.keyMap=u(r,{moveFocus:function(e,t){s.changeActive(s.selectedHint+e,t)},setFocus:function(e){s.changeActive(e)},menuSize:function(){return s.screenAmount()},length:c.length,close:function(){r.close()},pick:function(){s.pick()},data:i}));if(r.options.closeOnUnfocus){var L;f.on("blur",this.onBlur=function(){L=setTimeout(function(){r.close()},100)}),f.on("focus",this.onFocus=function(){clearTimeout(L)})}var A=f.getScrollInfo();return f.on("scroll",this.onScroll=function(){var e=f.getScrollInfo(),t=f.getWrapperElement().getBoundingClientRect(),n=y+A.top-e.top,i=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);b||(i+=l.offsetHeight);if(i<=t.top||i>=t.bottom)return r.close();l.style.top=n+"px",l.style.left=g+A.left-e.left+"px"}),e.on(l,"dblclick",function(e){var t=a(l,e.target||e.srcElement);t&&t.hintId!=null&&(s.changeActive(t.hintId),s.pick())}),e.on(l,"click",function(e){var t=a(l,e.target||e.srcElement);t&&t.hintId!=null&&(s.changeActive(t.hintId),r.options.completeOnSingleClick&&s.pick())}),e.on(l,"mousedown",function(){setTimeout(function(){f.focus()},20)}),e.signal(i,"select",c[0],l.firstChild),!0}var t="CodeMirror-hint",n="CodeMirror-hint-active";e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var r={hint:t};if(n)for(var i in n)r[i]=n[i];return e.showHint(r)};var r=0;e.defineExtension("showHint",function(t){if(this.listSelections().length>1||this.somethingSelected())return;this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new s(this,t),r=n.options.hint;if(!r)return;return e.signal(this,"startCompletion",this),i(r,this,n.options,function(e){n.showHints(e)})}),s.prototype={close:function(){if(!this.active())return;this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm)},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var r=t.list[n];r.hint?r.hint(this.cm,t,r):this.cm.replaceRange(o(r),r.from||t.from,r.to||t.to,"complete"),e.signal(t,"pick",r),this.close()},showHints:function(e){if(!e||!e.list.length||!this.active())return this.close();this.options.completeSingle&&e.list.length==1?this.pick(e,0):this.showWidget(e)},showWidget:function(t){function h(){if(s)return;s=!0,r.close(),r.cm.off("cursorActivity",m),t&&e.signal(t,"close")}function p(){if(s)return;e.signal(t,"update"),i(r.options.hint,r.cm,r.options,d)}function d(e){t=e;if(s)return;if(!t||!t.list.length)return h();r.widget&&r.widget.close(),r.widget=new f(r,t)}function v(){n&&(c(n),n=0)}function m(){v();var e=r.cm.getCursor(),t=r.cm.getLine(e.line);e.line!=u.line||t.length-e.ch!=a-u.ch||e.ch<u.ch||r.cm.somethingSelected()||e.ch&&o.test(t.charAt(e.ch-1))?r.close():(n=l(p),r.widget&&r.widget.close())}this.widget=new f(this,t),e.signal(t,"shown");var n=0,r=this,s,o=this.options.closeCharacters,u=this.cm.getCursor(),a=this.cm.getLine(u.line).length,l=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},c=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",m),this.onClose=h},buildOptions:function(e){var t=this.cm.options.hintOptions,n={};for(var r in l)n[r]=l[r];if(t)for(var r in t)t[r]!==undefined&&(n[r]=t[r]);if(e)for(var r in e)e[r]!==undefined&&(n[r]=e[r]);return n}},f.prototype={close:function(){if(this.completion.widget!=this)return;this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,r){t>=this.data.list.length?t=r?this.data.list.length-1:0:t<0&&(t=r?0:this.data.list.length-1);if(this.selectedHint==t)return;var i=this.hints.childNodes[this.selectedHint];i.className=i.className.replace(" "+n,""),i=this.hints.childNodes[this.selectedHint=t],i.className+=" "+n,i.offsetTop<this.hints.scrollTop?this.hints.scrollTop=i.offsetTop-3:i.offsetTop+i.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=i.offsetTop+i.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],i)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,n){var r=t.getHelpers(t.getCursor(),"hint"),i;if(r.length)for(var s=0;s<r.length;s++){var o=r[s](t,n);if(o&&o.list.length)return o}else if(i=t.getHelper(t.getCursor(),"hintWords")){if(i)return e.hint.fromList(t,{words:i})}else if(e.hint.anyword)return e.hint.anyword(t,n)}),e.registerHelper("hint","fromList",function(t,n){var r=t.getCursor(),i=t.getTokenAt(r),s=[];for(var o=0;o<n.words.length;o++){var u=n.words[o];u.slice(0,i.string.length)==i.string&&s.push(u)}if(s.length)return{list:s,from:e.Pos(r.line,i.start),to:e.Pos(r.line,i.end)}}),e.commands.autocomplete=e.showHint;var l={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/hint/anyword-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){var t=/[\w$]+/,n=500;e.registerHelper("hint","anyword",function(r,i){var s=i&&i.word||t,o=i&&i.range||n,u=r.getCursor(),a=r.getLine(u.line),f=u.ch,l=f;while(l&&s.test(a.charAt(l-1)))--l;var c=l!=f&&a.slice(l,f),h=[],p={},d=new RegExp(s.source,"g");for(var v=-1;v<=1;v+=2){var m=u.line,g=Math.min(Math.max(m+v*o,r.firstLine()),r.lastLine())+v;for(;m!=g;m+=v){var y=r.getLine(m),b;while(b=d.exec(y)){if(m==u.line&&b[0]===c)continue;(!c||b[0].lastIndexOf(c,0)==0)&&!Object.prototype.hasOwnProperty.call(p,b[0])&&(p[b[0]]=!0,h.push(b[0]))}}}return{list:h,from:e.Pos(u.line,l),to:e.Pos(u.line,f)}})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/display/placeholder",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder",n.appendChild(document.createTextNode(e.getOption("placeholder"))),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){s(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=s(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function s(e){return e.lineCount()===1&&e.getLine(0)===""}e.defineOption("placeholder","",function(n,s,o){var u=o&&o!=e.Init;if(s&&!u)n.on("blur",r),n.on("change",i),i(n);else if(!s&&u){n.off("blur",r),n.off("change",i),t(n);var a=n.getWrapperElement();a.className=a.className.replace(" CodeMirror-empty","")}s&&!n.hasFocus()&&r(n)})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/addon/runmode/runmode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.runMode=function(t,n,r,i){var s=e.getMode(e.defaults,n),o=/MSIE \d/.test(navigator.userAgent),u=o&&(document.documentMode==null||document.documentMode<9);if(r.nodeType==1){var a=i&&i.tabSize||e.defaults.tabSize,f=r,l=0;f.innerHTML="",r=function(e,t){if(e=="\n"){f.appendChild(document.createTextNode(u?"\r":e)),l=0;return}var n="";for(var r=0;;){var i=e.indexOf("	",r);if(i==-1){n+=e.slice(r),l+=e.length-r;break}l+=i-r,n+=e.slice(r,i);var s=a-l%a;l+=s;for(var o=0;o<s;++o)n+=" ";r=i+1}if(t){var c=f.appendChild(document.createElement("span"));c.className="cm-"+t.replace(/ +/g," cm-"),c.appendChild(document.createTextNode(n))}else f.appendChild(document.createTextNode(n))}}var c=e.splitLines(t),h=i&&i.state||e.startState(s);for(var p=0,d=c.length;p<d;++p){p&&r("\n");var v=new e.StringStream(c[p]);!v.string&&s.blankLine&&s.blankLine(h);while(!v.eol()){var m=s.token(v,h);r(v.current(),m,p,v.start,h),v.start=v.pos}}}}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/mode/xml/xml",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineMode("xml",function(t,n){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<")return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta"):(a=e.eat("/")?"closeTag":"openTag",t.tokenize=c,"tag bracket");if(r=="&"){var i;return e.eat("#")?e.eat("x")?i=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):i=e.eatWhile(/[\d]/)&&e.eat(";"):i=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag bracket";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(o.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName;if(!o.contextGrabbers.hasOwnProperty(n)||!o.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){return e=="openTag"?(n.tagStart=t.column(),b):e=="closeTag"?w:y}function b(e,t,n){return e=="word"?(n.tagName=t.current(),f="tag",x):(f="error",b)}function w(e,t,n){if(e=="word"){var r=t.current();return n.context&&n.context.tagName!=r&&o.implicitlyClosed.hasOwnProperty(n.context.tagName)&&m(n),n.context&&n.context.tagName==r?(f="tag",E):(f="tag error",S)}return f="error",S}function E(e,t,n){return e!="endTag"?(f="error",E):(m(n),y)}function S(e,t,n){return f="error",E(e,t,n)}function x(e,t,n){if(e=="word")return f="attribute",T;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||o.autoSelfClosers.hasOwnProperty(r)?g(n,r):(g(n,r),n.context=new v(n,r,i==n.indented)),y}return f="error",x}function T(e,t,n){return e=="equals"?N:(o.allowMissing||(f="error"),x(e,t,n))}function N(e,t,n){return e=="string"?C:e=="word"&&o.allowUnquoted?(f="string",x):(f="error",x(e,t,n))}function C(e,t,n){return e=="string"?C:x(e,t,n)}var r=t.indentUnit,i=n.multilineTagIndentFactor||1,s=n.multilineTagIndentPastTag;s==null&&(s=!0);var o=n.htmlMode?{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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},u=n.alignCDATA,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(t,n,a){var f=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+r;if(f&&f.noIndent)return e.Pass;if(t.tokenize!=c&&t.tokenize!=l)return a?a.match(/^(\s*)/)[0].length:0;if(t.tagName)return s?t.tagStart+t.tagName.length+2:t.tagStart+r*i;if(u&&/<!\[CDATA\[/.test(n))return 0;var h=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(h&&h[1])while(f){if(f.tagName==h[2]){f=f.prev;break}if(!o.implicitlyClosed.hasOwnProperty(f.tagName))break;f=f.prev}else if(h)while(f){var p=o.contextGrabbers[f.tagName];if(!p||!p.hasOwnProperty(h[2]))break;f=f.prev}while(f&&!f.startOfLine)f=f.prev;return f?f.indent+r:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),define("editorxml",["tos_cm/lib/codemirror","config","preferences","form","trill_on_swish_gitty","modal","tos_cm/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment","tos_cm/addon/comment/comment","tos_cm/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint","tos_cm/addon/display/placeholder","tos_cm/addon/runmode/runmode","tos_cm/mode/xml/xml","jquery","laconic"],function(e,t,n,r,i){(function(n){function u(e){var t=window.location.pathname;t!=e.url&&(window.history.pushState({location:e.url},"",e.url),document.title="TRILL on SWISH -- "+(e.file?e.file:"SWI-Prolog for SHaring"))}var s="xmlEditor",o={_init:function(t){return this.each(function(){var r=n(this),i={},o;t=n.extend({role:"source",placeholder:"Your ontology goes here (use RDF/XML format) ...",lineNumbers:!0,mode:"xml"},t),t.role!="query"&&(t.continueComments="Enter");if(o=r.children("textarea")[0]){var u=n(o).attr("data-file");u&&(i.file=u),window.trill_on_swish&&window.trill_on_swish.meta_data&&(i.meta=window.trill_on_swish.meta_data)}else o=n.el.textarea({placeholder:t.placeholder},r.text()),r.append(o);i.tos_cm=e.fromTextArea(o,t),console.log(e.defaults),console.log(i.tos_cm.getMode()),console.log(i.tos_cm.getOption("mode")),i.cleanGeneration=i.tos_cm.changeGeneration(),i.role=t.role,r.data(s,i),r.addClass("trill_on_swish-event-receiver"),i.role=="source"&&(r.on("source",function(e,t){r.xmlEditor("setSource",t)}),r.on("saveProgram",function(e,t){r.xmlEditor("save",t)}),r.on("fileInfo",function(){r.xmlEditor("info")}))})},getOption:function(e){var t=this;return t.data(s)[e]},getSource:function(){return this.data(s).tos_cm.getValue()},getSourceID:function(){var e=this.data(s).tos_cm;return null},setSource:function(e){var n=this.data(s);return typeof e=="string"&&(e={data:e}),this.data(s).tos_cm.setValue(e.data),n.role=="source"&&(e.meta?(n.file=e.meta.name,n.meta=e.meta):(n.file=null,n.meta=null),e.url||(e.url=t.http.locations.trill_on_swish),u(e)),this},load:function(e){if(e){var r=this,i=this.data(s);n.ajax({url:t.http.locations.trill_on_swish_web_storage+"/"+e,dataType:"text",success:function(t){r.xmlEditor("setSource",t),i.file=e},error:function(e,t){alert("Failed to load document: "+t)}})}return this},save:function(e,r){var o=this.data(s),a=t.http.locations.trill_on_swish_web_storage,f="POST",l;if(e=="as")return this.xmlEditor("saveAs"),this;o.file&&(!e||!e.name||e.name==o.file)&&(a+="/"+encodeURI(o.file),f="PUT");if(r=="only-meta-data"){e=i.reduceMeta(e,o.meta);if(n.isEmptyObject(e)){alert("No change");return}l={update:"meta-data"}}else if(f=="POST")l={data:this.xmlEditor("getSource"),type:"owl"},o.meta&&(l.previous=o.meta.commit);else if(!o.tos_cm.isClean(o.cleanGeneration))l={data:this.xmlEditor("getSource"),type:"owl"};else if(sameSet(o.meta.tags,e.tags)){alert("No change");return}return e&&(l.meta=e),n.ajax({url:a,dataType:"json",contentType:"application/json",type:f,data:JSON.stringify(l),success:function(e){e.error?alert(JSON.stringify(e)):(o.url=e.url,o.file=e.file,o.meta=e.meta,u(e))},error:function(){alert("Failed to save document")}}),this},saveAs:function(){function a(){this.append(n.el.form({"class":"form-horizontal"},r.fields.fileName(u?null:e.file,t.public),r.fields.title(t.title),r.fields.author(t.author),o?r.fields.commit_message():undefined,r.fields.tags(t.tags),r.fields.buttons({label:u?"Fork program":o?"Update program":"Save program",action:function(e,t){return console.log(t),i.xmlEditor("save",t),!1}})))}var e=this.data(s),t=e.meta||{},i=this,o=Boolean(e.file),u=e.meta&&t.symbolic!="HEAD";return t.public===undefined&&(t.public=!0),r.showDialog({title:u?"Fork from "+t.commit.substring(0,7):o?"Save new version":"Save program as",body:a}),this},info:function(){function u(){e.meta?(e.editor=i,this.trill_on_swish_gitty(e)):this.append(n.el.p("The source is not associated with a file. ","Use ",n.el.b("Save ...")," to save the source with meta information."))}var e=this.data(s),t=e.meta,i=this,o;return e.meta?o=n().trill_on_swish_gitty("title",e.meta):o="Local source",r.showDialog({title:o,body:u}),this},print:function(t){function i(e){var t=n.el.iframe({src:"about:blank"});n("body").append(t),n("body",t.contentWindow.document).append(e),t.contentWindow.print()}var r=n.el.pre({"class":"tos_cm-s-neo"});return t||(t=this.xmlEditor("getSource")),e.runMode(t,"application/xml",r),n.ajax({url:"/trill_on_swish/bower_components/codemirror/theme/neo.css",dataType:"text",success:function(e){i(n.el.div(n.el.style(e),r))},error:function(){i(r),console.log("ciao")}}),this},preference:function(e){var t=this.data(s);return e.name=="semantic-highlighting"&&t.tos_cm.setOption("prologHighlightServer",{enabled:e.value}),this},getExamples:function(e,t){var r=e?e:this.xmlEditor("getSource"),i,s=[];if(n.trim(r)=="")return null;t==0?i=[e]:i=r.match(/\/\*\* *<?examples>?[\s\S]*?\*\//igm);if(i)for(var o=0;o<i.length;o++){var u=i[o].match(/^ *\?-[\s\S]*?[^-#$&*+./:<=>?@\\^~]\.\s/gm);if(u)for(var a=0;a<u.length;a++){var f=u[a].replace(/^ *\?-\s*/,"").replace(/\s*$/,"").replace(/\\'/g,"'");s.push(f)}}return s},search:function(e,t){var n=this.data(s).tos_cm,r=n.firstLine(),i=n.lastLine(),o=[];for(var u=r;u<=i;u++){var a=n.getLine(u);if(a.search(e)>=0){o.push({line:u+1,text:a});if(t.max&&t.max===o.length)return o}}return o},gotoLine:function(e,t){function u(e){if(e._searchMarkers!==undefined){for(var t=0;t<e._searchMarkers.length;t++)e._searchMarkers[t].clear();e.off("cursorActivity",u)}e._searchMarkers=[]}var n=this.data(s),r=n.tos_cm,i=0,o;e-=1,o=t.regex,u(r),t=t||{},o&&(i=r.getLine(e).search(o),i<0&&(i=0)),r.setCursor({line:e,ch:i});var a=r.getScrollInfo().clientHeight,f=r.charCoords({line:e,ch:0},"local");r.scrollTo(null,(f.top+f.bottom-a)/2);if(o){function l(e,t){var n;while(n=o.exec(r.getLine(e)))r._searchMarkers.push(r.markText({line:e,ch:n.index},{line:e,ch:n.index+n[0].length},{className:t,clearOnEnter:!0,clearWhenEmpty:!0,title:"Search match"}))}l(e,"CodeMirror-search-match");if(t.showAllMatches){var c=r.getViewport();for(var h=c.from;h<c.to;h++)h!=e&&l(h,"CodeMirror-search-alt-match")}r._searchMarkers.length>0&&r.on("cursorActivity",u)}}};window.onpopstate=function(e){e.state?e.state.location&&(window.location=e.state.location):window.location.reload(!0)},n.fn.xmlEditor=function(e){if(o[e])return o[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return o._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+s)}})(jQuery)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/mode/prolog/prolog",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineMode("prolog",function(t,n){function r(e,t,n){return t.tokenize=n,n(e,t)}function p(e,t,n){if(n>0){while(n-->0)if(!t.test(e.next()))return!1}else while(t.test(e.peek()))e.next();return!0}function d(e){var t=e.next();if(o.test(t))return!0;switch(t){case"u":if(i.unicodeEscape)return p(e,a,4);return!1;case"U":if(i.unicodeEscape)return p(e,a,8);return!1;case null:return!0;case"c":return e.eatSpace(),!0;case"x":return p(e,a,2)}return u.test(t)?p(e,u,-1)?(e.peek()=="\\"&&e.next(),!0):!1:!1}function v(e,t,n){var r;while((r=e.next())!=null){if(r==n)return t.nesting.pop(),!1;if(r=="\\"&&!d(e))return!1}return i.multiLineQuoted}function m(e){var t=e.nesting.length;return t>0?e.nesting[t-1]:null}function g(e){var t=m(e);t?t.arg==0?t.arg=1:t.type=="control"&&(e.goalStart=!1):e.goalStart=!1}function y(e){var t=m(e);t&&!t.alignment&&t.arg!=undefined&&(t.arg==0?t.alignment=t.leftCol?t.leftCol+4:t.column+4:t.alignment=t.column+1)}function b(e){var t=m(e);t?t.arg?t.arg++:t.type=="control"&&(e.goalStart=!0):e.goalStart=!0}function w(e){var t=m(e);return t?t.type=="control"?!0:!1:e.inBody}function x(e,t,n){return E=e,S=n,t}function T(e){return e.eol()||/[\s%]/.test(e.peek())?!0:!1}function N(e,t){var n=e.next();if(n=="(")return t.lastType=="functor"?(t.nesting.push({functor:t.functorName,column:e.column(),leftCol:t.functorColumn,arg:0}),delete t.functorName,delete t.functorColumn):t.nesting.push({type:"control",closeColumn:e.column(),alignment:e.column()+4}),x("solo",null,"(");if(n=="{"&&t.lastType=="tag")return t.nesting.push({tag:t.tagName,column:e.column(),leftCol:t.tagColumn,arg:0}),delete t.tagName,delete t.tagColumn,x("dict_open",null);if(n=="/"&&e.eat("*"))return r(e,t,L);if(n=="%")return e.skipToEnd(),x("comment","comment");g(t);if(l.test(n)){switch(n){case")":t.nesting.pop();break;case"]":return t.nesting.pop(),x("list_close",null);case"}":var s=m(t),o=s&&s.tag?"dict_close":"brace_term_close";return t.nesting.pop(),x(o,null);case",":e.eol()&&(t.commaAtEOL=!0),b(t);case";":w(t)&&(t.goalStart=!0);break;case"[":return t.nesting.push({type:"list",closeColumn:e.column(),alignment:e.column()+2}),x("list_open",null);case"{":return i.quasiQuotations&&e.eat("|")?(t.nesting.push({type:"quasi-quotation",alignment:e.column()+1}),x("qq_open","qq_open")):(t.nesting.push({type:"curly",closeColumn:e.column(),alignment:e.column()+2}),x("brace_term_open",null));case"|":if(i.quasiQuotations){if(e.eat("|"))return t.tokenize=k,x("qq_sep","qq_sep");if(e.eat("}"))return t.nesting.pop(),x("qq_close","qq_close")}w(t)&&(t.goalStart=!0)}return x("solo",null,n)}if(n=='"'||n=="'"||n=="`")return t.nesting.push({type:"quoted",alignment:e.column()+1}),r(e,t,C(n));if(n=="0"){if(e.eat(/x/i))return e.eatWhile(/[\da-f]/i),x("number","number");if(e.eat(/o/i))return e.eatWhile(/[0-7]/i),x("number","number");if(e.eat(/'/)){var u=e.next();return u=="\\"&&!d(e)?x("error","error"):x("code","code")}}if(/\d/.test(n)||n=="-"&&e.eat(/\d/))return i.groupedIntegers?e.match(/^\d*((_|\s+)\d+)*(?:\.\d+)?(?:[eE][+\-]?\d+)?/):e.match(/^\d*(?:\.\d+)?(?:[eE][+\-]?\d+)?/),x(n=="-"?"neg-number":"number","number");if(f.test(n)){e.eatWhile(f);var a=e.current();if(a=="."&&T(e))return m(t)?x("fullstop","error",a):x("fullstop","fullstop",a);return c.test(a)?x("neck","neck",a):w(t)&&h.test(a)?(t.goalStart=!0,x("symbol","operator",a)):x("symbol","operator",a)}e.eatWhile(/[\w_]/);var p=e.current();if(e.peek()=="{"&&i.dicts)return t.tagName=p,t.tagColumn=e.column(),x("tag","tag",p);if(n=="_"){if(p.length==1)return x("var","anon",p);var v=p.charAt(1);return v==v.toUpperCase()?x("var","var-2",p):x("var","var",p)}return n==n.toUpperCase()?x("var","var",p):e.peek()=="("?(t.functorName=p,t.functorColumn=e.column(),x("functor","functor",p)):x("atom","atom",p)}function C(e){return function(t,n){if(!v(t,n,e)){n.tokenize=N;if(t.peek()=="("){var r=t.current();return n.functorName=r,x("functor","functor",r)}if(t.peek()=="{"&&i.dicts){var r=t.current();return n.tagName=r,x("tag","tag",r)}}return x(s[e],s[e])}}function k(e,t){var n=!1,r;while(r=e.next()){if(r=="}"&&n){t.tokenize=N,e.backUp(2);break}n=r=="|"}return x("qq_content","qq_content")}function L(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=N;break}n=r=="*"}return x("comment","comment")}var i={quasiQuotations:!0,dicts:!0,unicodeEscape:!0,multiLineQuoted:!0,groupedIntegers:!0},s={'"':"string","'":"qatom","`":"bqstring"},o=/[abref\\'"nrtsv]/,u=/[0-7]/,a=/[0-9a-fA-F]/,f=/[-#$&*+./:<=>?@\\^~]/,l=/[[\]{}(),;|!]/,c=/^(:-|-->)$/,h=/^(,|;|->|\*->|\\+|\|)$/,E,S;return{startState:function(){return{tokenize:N,inBody:!1,goalStart:!1,lastType:null,nesting:new Array,curTerm:null,curToken:null}},token:function(e,t){var r;t.curTerm==null&&n.metainfo&&(t.curTerm=0,t.curToken=0),e.sol()&&delete t.commaAtEOL;if(t.tokenize==N&&e.eatSpace())return e.eol()&&y(t),null;var i=t.tokenize(e,t);return e.eol()&&y(t),E=="neck"?(t.inBody=!0,t.goalStart=!0):E=="fullstop"&&(t.inBody=!1,t.goalStart=!1),t.lastType=E,typeof n.enrich=="function"&&(i=n.enrich(e,t,E,S,i)),i},indent:function(t,n){if(t.tokenize==L)return e.Pass;var r;return(r=m(t))?r.closeColumn&&!t.commaAtEOL?r.closeColumn:r.alignment:t.inBody?4:0},theme:"prolog",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"%"}}),e.defineMIME("text/x-prolog","prolog")}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("tos_cm/mode/prolog/prolog_query",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.commands.prologFireQuery=function(t){var n=t.getCursor("start"),r=t.getTokenAt(n,!0);return r.type=="fullstop"?t.prologFireQuery(t.getValue()):e.Pass},e.defineOption("prologQuery",null,function(t,n,r){r&&r!=e.Init&&t.removeKeyMap("prologQuery");if(typeof n=="function"){var i={name:"prologQuery",Enter:"prologFireQuery"};t.addKeyMap(i),t.prologFireQuery=n}})}),define("editorprolog",["tos_cm/lib/codemirror","config","preferences","form","trill_on_swish_gitty","modal","tos_cm/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment","tos_cm/addon/comment/comment","tos_cm/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint","tos_cm/addon/display/placeholder","tos_cm/addon/runmode/runmode","tos_cm/mode/prolog/prolog","tos_cm/mode/prolog/prolog_query","jquery","laconic"],function(e,t,n,r,i){(function(n){function u(e){var t=window.location.pathname;t!=e.url&&(window.history.pushState({location:e.url},"",e.url),document.title="TRILL on SWISH -- "+(e.file?e.file:"SWI-Prolog for SHaring"))}var s="prologEditor",o={_init:function(t){return this.each(function(){var r=n(this),i={},o;t=n.extend({role:"source",placeholder:"Your ontology goes here (use RDF/XML format) ...",lineNumbers:!0,mode:"prolog",theme:"prolog",matchBrackets:!0,prologKeys:!0},t),t.role!="query"&&(t.continueComments="Enter");if(o=r.children("textarea")[0]){var u=n(o).attr("data-file");u&&(i.file=u),window.trill_on_swish&&window.trill_on_swish.meta_data&&(i.meta=window.trill_on_swish.meta_data)}else o=n.el.textarea({placeholder:t.placeholder},r.text()),r.append(o);i.tos_cm=e.fromTextArea(o,t),console.log(e.defaults),console.log(i.tos_cm.getMode()),console.log(i.tos_cm.getOption("mode")),i.cleanGeneration=i.tos_cm.changeGeneration(),i.role=t.role,r.data(s,i),r.addClass("trill_on_swish-event-receiver"),i.role=="source"&&(r.on("source",function(e,t){r.prologEditor("setSource",t)}),r.on("saveProgram",function(e,t){r.prologEditor("save",t)}),r.on("fileInfo",function(){r.prologEditor("info")}))})},getOption:function(e){var t=this;return t.data(s)[e]},getSource:function(){return this.data(s).tos_cm.getValue()},getSourceID:function(){var e=this.data(s).tos_cm;return null},setSource:function(e){var n=this.data(s);return typeof e=="string"&&(e={data:e}),this.data(s).tos_cm.setValue(e.data),n.role=="source"&&(e.meta?(n.file=e.meta.name,n.meta=e.meta):(n.file=null,n.meta=null),e.url||(e.url=t.http.locations.trill_on_swish),u(e)),this},load:function(e){if(e){var r=this,i=this.data(s);n.ajax({url:t.http.locations.trill_on_swish_web_storage+"/"+e,dataType:"text",success:function(t){r.prologEditor("setSource",t),i.file=e},error:function(e,t){alert("Failed to load document: "+t)}})}return this},save:function(e,r){var o=this.data(s),a=t.http.locations.trill_on_swish_web_storage,f="POST",l;if(e=="as")return this.prologEditor("saveAs"),this;o.file&&(!e||!e.name||e.name==o.file)&&(a+="/"+encodeURI(o.file),f="PUT");if(r=="only-meta-data"){e=i.reduceMeta(e,o.meta);if(n.isEmptyObject(e)){alert("No change");return}l={update:"meta-data"}}else if(f=="POST")l={data:this.prologEditor("getSource"),type:"pl"},o.meta&&(l.previous=o.meta.commit);else if(!o.tos_cm.isClean(o.cleanGeneration))l={data:this.prologEditor("getSource"),type:"pl"};else if(sameSet(o.meta.tags,e.tags)){alert("No change");return}return e&&(l.meta=e),n.ajax({url:a,dataType:"json",contentType:"application/json",type:f,data:JSON.stringify(l),success:function(e){e.error?alert(JSON.stringify(e)):(o.url=e.url,o.file=e.file,o.meta=e.meta,u(e))},error:function(){alert("Failed to save document")}}),this},saveAs:function(){function a(){this.append(n.el.form({"class":"form-horizontal"},r.fields.fileName(u?null:e.file,t.public),r.fields.title(t.title),r.fields.author(t.author),o?r.fields.commit_message():undefined,r.fields.tags(t.tags),r.fields.buttons({label:u?"Fork program":o?"Update program":"Save program",action:function(e,t){return console.log(t),i.prologEditor("save",t),!1}})))}var e=this.data(s),t=e.meta||{},i=this,o=Boolean(e.file),u=e.meta&&t.symbolic!="HEAD";return t.public===undefined&&(t.public=!0),r.showDialog({title:u?"Fork from "+t.commit.substring(0,7):o?"Save new version":"Save program as",body:a}),this},info:function(){function u(){e.meta?(e.editor=i,this.trill_on_swish_gitty(e)):this.append(n.el.p("The source is not associated with a file. ","Use ",n.el.b("Save ...")," to save the source with meta information."))}var e=this.data(s),t=e.meta,i=this,o;return e.meta?o=n().trill_on_swish_gitty("title",e.meta):o="Local source",r.showDialog({title:o,body:u}),this},print:function(t){function i(e){var t=n.el.iframe({src:"about:blank"});n("body").append(t),n("body",t.contentWindow.document).append(e),t.contentWindow.print()}var r=n.el.pre({"class":"tos_cm-s-neo"});return t||(t=this.prologEditor("getSource")),e.runMode(t,"application/xml",r),n.ajax({url:"/trill_on_swish/bower_components/codemirror/theme/neo.css",dataType:"text",success:function(e){i(n.el.div(n.el.style(e),r))},error:function(){i(r),console.log("ciao")}}),this},preference:function(e){var t=this.data(s);return e.name=="semantic-highlighting"&&t.tos_cm.setOption("prologHighlightServer",{enabled:e.value}),this},getExamples:function(e,t){var r=e?e:this.prologEditor("getSource"),i,s=[];if(n.trim(r)=="")return null;t==0?i=[e]:i=r.match(/\/\*\* *<?examples>?[\s\S]*?\*\//igm);if(i)for(var o=0;o<i.length;o++){var u=i[o].match(/^ *\?-[\s\S]*?[^-#$&*+./:<=>?@\\^~]\.\s/gm);if(u)for(var a=0;a<u.length;a++){var f=u[a].replace(/^ *\?-\s*/,"").replace(/\s*$/,"").replace(/\\'/g,"'");s.push(f)}}return s},search:function(e,t){var n=this.data(s).tos_cm,r=n.firstLine(),i=n.lastLine(),o=[];for(var u=r;u<=i;u++){var a=n.getLine(u);if(a.search(e)>=0){o.push({line:u+1,text:a});if(t.max&&t.max===o.length)return o}}return o},gotoLine:function(e,t){function u(e){if(e._searchMarkers!==undefined){for(var t=0;t<e._searchMarkers.length;t++)e._searchMarkers[t].clear();e.off("cursorActivity",u)}e._searchMarkers=[]}var n=this.data(s),r=n.tos_cm,i=0,o;e-=1,o=t.regex,u(r),t=t||{},o&&(i=r.getLine(e).search(o),i<0&&(i=0)),r.setCursor({line:e,ch:i});var a=r.getScrollInfo().clientHeight,f=r.charCoords({line:e,ch:0},"local");r.scrollTo(null,(f.top+f.bottom-a)/2);if(o){function l(e,t){var n;while(n=o.exec(r.getLine(e)))r._searchMarkers.push(r.markText({line:e,ch:n.index},{line:e,ch:n.index+n[0].length},{className:t,clearOnEnter:!0,clearWhenEmpty:!0,title:"Search match"}))}l(e,"CodeMirror-search-match");if(t.showAllMatches){var c=r.getViewport();for(var h=c.from;h<c.to;h++)h!=e&&l(h,"CodeMirror-search-alt-match")}r._searchMarkers.length>0&&r.on("cursorActivity",u)}}};window.onpopstate=function(e){e.state?e.state.location&&(window.location=e.state.location):window.location.reload(!0)},n.fn.prologEditor=function(e){if(o[e])return o[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return o._init.apply(this,arguments);n.error("Method "+e+" does not exist on jQuery."+s)}})(jQuery)}),define("query",["jquery","laconic","editorprolog"],function(){(function(e){function r(t){return e(t).parents(".prolog-query-editor")}function i(t,n,i){var s=e.el.div({"class":"btn-group dropup"},e.el.button({"class":"btn btn-default btn-xs dropdown-toggle "+t,"data-toggle":"dropdown"},n,e.el.span({"class":"caret"})),e.el.ul({"class":"dropdown-menu "+t}));return e(s).on("click","a",function(){r(this).queryEditor("setQuery",e(this).text())}),s}function s(t){function o(t){var i=t.examples();e.isArray(i)&&r(n).queryEditor("setExamples",i,!0)}var n=i("examples","Examples",t),s=e(n).find("ul");if(typeof t.examples=="function")e(n).mousedown(function(e){e.which==1&&o(t)});else if(t.examples){var u=t.examples;for(var a=0;a<u.length;a++)s.append(e.el.li(e.el.a(u[a])))}return n}function o(e){return i("history","History",e)}function u(t){var n=e.el.button({"class":"clear-btn-query btn btn-default btn-xs"},"Clear");return e(n).on("click",function(){r(this).queryEditor("setQuery","")}),n}function a(t){var n=e.el.button({"class":"run-btn-query","class":"btn btn-default btn-primary btn-xs"},"Run!");return e(n).on("click",function(){r(this).queryEditor("run",undefined,f(this))}),n}function f(t){return e(t).parent().find("input").prop("checked")}function l(t){var n=e.el.span({"class":"run-chk-table"},e.el.input({type:"checkbox",name:"table"})," table results");return n}var t="queryEditor",n={_init:function(n){return this.each(function(){function p(){return e(c).find("input").prop("checked")}var r=e(this),i=e.extend({maxHistoryLength:50},n),f=e.el.div({"class":"query",style:"height:100%"}),c=l(n),h=e.el.table({"class":"prolog-query"},e.el.tr(e.el.td({"class":"prolog-prompt"},"?-"),e.el.td({colspan:2,style:"height:100%"},f),e.el.td()),e.el.tr(e.el.td(),e.el.td({"class":"buttons-left"},s(n),o(n),u(n)),e.el.td({"class":"buttons-right"},c,a(n))));r.addClass("prolog-query-editor trill_on_swish-event-receiver"),r.append(h),e(f).append(r.children("textarea")).prologEditor({role:"query",sourceID:n.sourceID,placeholder:"Your query goes here ...",lineNumbers:!1,lineWrapping:!0,prologQuery:function(e){r.queryEditor("run",e,p())}}),typeof n.examples=="object"&&n.examples[0]&&!e(f).prologEditor("getSource")&&e(f).prologEditor("setSource",n.examples[0]),r.on("source",function(e){typeof i.examples=="function"&&(exl=i.examples(),r.queryEditor("setQuery",exl&&exl[0]?exl[0]:""))}),r.data(t,i)})},setExamples:function(t,n){function i(e){var t;if((t=r.data("examples"))&&t.length==e.length){for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return!1}var r=this.find("ul.examples");t||(t=[]),n===undefined&&(n=!0);if(n&&i(t))return this;n===!0&&r.html("");for(var s=0;s<t.length;s++)r.append(e.el.li(e.el.a(t[s])));return r.data("examples",t.slice(0)),this},addHistory:function(t){function i(){return n.children().filter(function(){return e(this).text()==t})}var n=this.find("ul.history"),r=this.data("queryEditor");if(t){var s;(s=i())&&s.remove(),n.children().length>=r.maxHistoryLength&&n.children().first().remove(),n.append(e.el.li(e.el.a(t)))}return this},setQuery:function(e){return this.find(".query").prologEditor("setSource",e).focus()},getQuery:function(){return this.find(".query").prologEditor("getSource")},run:function(t,n){var r=this.data("queryEditor");t===undefined&&(t=this.queryEditor("getQuery")),t=e.trim(t);if(!t)return e(".trill_on_swish-event-receiver").trigger("trill_on_swish_help",{file:"query.html"}),this;e(".trill_on_swish-event-receiver").trigger("clearMessages");var i={query:t};return typeof r.source=="function"?i.source=r.source(t):typeof r.source=="string"&&(i.source=source),n&&(i.tabled=!0),this.queryEditor("addHistory",t),r.runner.prologRunners("run",i),this}};e.fn.queryEditor=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery)}),define("answer",["jquery","laconic"],function(){(function($){function answerHasOutput(e){return e.variables.length>0||e.residuals}function renderSubstitutions(e,t){t.push(', <span class="pl-comment">% where</span><br/>');for(var n=0;n<e.length;n++)t.push('<span class="where-binding">',"<span class='pl-var'>",e[n].var+"</span> = ",e[n].value,"</span>"),n<e.length-1&&t.push(",<br/>")}function renderAnswer(e){var t=[],n=e.variables;for(var r=0;r<n.length;r++){var i=n[r].variables;for(var s=0;s<i.length-1;s++)t.push("<span class='pl-ovar'>",i[s],"</span> = ","<span class='pl-var'>",i[s+1],"</span>, ");t.push("<span class='pl-ovar'>",i[i.length-1],"</span> = ",n[r].value),n[r].substitutions&&renderSubstitutions(n[r].substitutions,t),(r<n.length-1||e.residuals)&&t.push(",<br/>")}var o;if(o=e.residuals)for(var r=0;r<o.length;r++)t.push(o[r]),r<o.length-1&&t.push(",<br/>");return t.join("")}function renderTabledAnswer(e,t){function r(t){var n=e.variables;for(var r=0;r<n.length;r++){var i=n[r].variables;for(var s=0;s<i.length;s++)if(i[s]==t)return n[r]}return null}function u(){t.find("tr.projection th.residuals").length==0&&($("<th class='residuals'>Residual goals</th>").insertBefore(t.find("tr.projection th.answer-nth")),$("<td></td>").insertBefore(t.find("tr td.answer-nth")))}var n=[];for(var i=0;i<e.projection.length;i++){var s=e.projection[i],o=r(s);n.push("<td>"),o?(n.push(o.value),o.substitutions&&renderSubstitutions(o.substitutions,n)):n.push("<span class='pl-var'>",s,"</span>"),n.push("</td>")}var a;if(a=e.residuals){u(),n.push("<td>");for(var i=0;i<a.length;i++)n.push(a[i]),i<a.length-1&&n.push(",<br/>");n.push("</td>")}return e.nth&&n.push("<td class='answer-nth'>",e.nth,"</td>"),n.join("")}function evalScripts(elem){elem.find("script").each(function(){this.getAttribute("type")=="text/javascript"&&($.ajaxScript=$(this)),eval(this.textContent)}),$.ajaxScript&&delete $.ajaxScript}var pluginName="prologAnswer",methods={_init:function(e){return this.each(function(){var t=$(this);if(answerHasOutput(e))if(t.is("table")){var n=$.el.tr();n.innerHTML=renderTabledAnswer(e,t),evalScripts($(n)),t.append(n),$(n).find(".render-multi").renderMulti()}else t[0].innerHTML=renderAnswer(e),evalScripts(t),t.find(".render-multi").renderMulti();else t.append($.el.span({"class":"prolog-true"},"true"))})}};$.fn.prologAnswer=function(e){if(methods[e])return methods[e].apply(this,Array.prototype.slice.call(arguments,1));if(typeof e=="object"||!e)return methods._init.apply(this,arguments);$.error("Method "+e+" does not exist on jQuery."+pluginName)}})(jQuery),function(e){function s(){var t=e("#render-select");return t[0]||(t=e(e.el.form({id:"render-select",style:"display:none"})),t.on("click",function(){var n=e("input[name=render]:checked",e(this)).val();t.data("target").renderMulti("select",parseInt(n))}),t.hover(function(){r=!0,u()},function(){a()}),e("body").append(t)),t}function o(){if(!r){var e=s(),t=e.data("target");t&&(t.removeClass("render-selecting"),e.data("target",null)),e.hide(400)}}function u(){n=setTimeout(function(){o()},400)}function a(){r=!1,u()}var t="renderMulti",n=0,r=!1,i={_init:function(n){return this.each(function(){var n=e(this),r={current:0},i=[],s=e.el.div({"class":"render-multi-active"}),o=0;n.children().each(function(){var t=e(this).css("display");i.push(t),o++==0?n.css("display",t):e(this).hide()}),r.display=i,n.append(s),e(s).hover(function(e){n.renderMulti("showSelect",e)},function(e){n.renderMulti("hideSelect",e)}),n.data(t,r)})},selectMenu:function(){var n=this.data(t),r=["<label>View as</label><br>"],i=this.children(),s=0;for(var s=0;s<n.display.length;s++){var o=e(i[s]),u=o.attr("data-render");u||(s==0?u="Default rendered":u="Alt rendered ["+(s+1)+"]"),r.push("<input type='radio' name='render' value='",s,"'"),s==n.current&&r.push(" checked"),r.push("> ",u,"<br>")}return r.push("</form"),r.join("")},showSelect:function(e){var t=this,i=s(),o=this.offset(),u;r=!0,n&&(clearTimeout(n),n=0),(u=i.data("target"))&&u.removeClass("render-selecting"),i.data("target",t),i.html(this.renderMulti("selectMenu")),i.css({top:o.top+5+"px",left:o.left+5+"px"}).show(400),this.addClass("render-selecting")},hideSelect:function(e){a()},select:function(n){var r=this.data(t),i=this.children(),s=r.display[n];e(i[r.current]).hide(400),e(i[n]).show(400,function(){e(this).css("display",s)}),this.css("display",s),r.current=n,o()}};e.fn.renderMulti=function(n){if(i[n])return i[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n=="object"||!n)return i._init.apply(this,arguments);e.error("Method "+n+" does not exist on jQuery."+t)}}(jQuery)}),define("runner",["jquery","config","tos_cm/lib/codemirror","answer","laconic"],function(e,t,n){function r(t,n){n||(n={});var r=n.divClass,i=n.ulClass,o=e.el.div({"class":"btn-group dropdown"+(r?" "+r:"")},e.el.button({"class":"dropdown-toggle","data-toggle":"dropdown"},t),e.el.ul({"class":"dropdown-menu"+(i?" "+i:"")}));return n.actions&&s(e(o),n.client,n.actions),o}function s(t,n,r){function s(t){var r=e(t).data("action");return r&&r.call(n),!1}function o(t,n){var r=e.el.a(t);e(r).data("action",n),i.append(e.el.li(r))}var i=t.find(".dropdown-menu");for(var u in r)r.hasOwnProperty(u)&&o(u,r[u]);return i.on("click","a",function(){s(this)}),t}(function(e){var t="prologRunners",n={_init:function(n){return this.each(function(){function s(){var t=e.el.span();e(t).html("&#9776");var i=r(t,{divClass:"runners-menu",ulClass:"pull-right",client:n,actions:{"Collapse all":function(){this.find(".prolog-runner").prologRunner("toggleIconic",!0)},"Expand all":function(){this.find(".prolog-runner").prologRunner("toggleIconic",!1)},"Stop all":function(){this.find(".prolog-runner").prologRunner("stop")},Clear:function(){this.prologRunners("clear")}}});return i}var n=e(this),i={};i.stretch=e(e.el.div({"class":"stretch"})),i.inner=e(e.el.div({"class":"inner"})),n.append(s()),n.append(i.stretch),n.append(i.inner),n.on("pane.resize",function(){n.prologRunners("scrollToBottom",!0)}),n.data(t,i)})},run:function(t){var n=this.data("prologRunners");t.iconifyLast&&this.prologRunners("iconifyLast");var r=e.el.div({"class":"prolog-runner"});return n.inner.append(r),e(r).prologRunner(t),this.prologRunners("scrollToBottom"),this},clear:function(){this.find(".prolog-runner").prologRunner("close")},iconifyLast:function(){var t=e(this.inner).children().last();if(t.length==1){var n=t.prologRunner();n.alive()||n.toggleIconic(!0)}return this},scrollToBottom:function(t){return this.each(function(){var n=e(this),r=n.data("prologRunners"),i=r.inner.height(),s=n.height()-i-4-2;if(s>0||t!==!0)r.stretch.height(s>0?s:0),n.scrollTop(i)}),this}};e.fn.prologRunners=function(r){if(n[r])return n[r].apply(this,Array.prototype.slice.call(arguments,1));if(typeof r=="object"||!r)return n._init.apply(this,arguments);e.error("Method "+r+" does not exist on jQuery."+t)}})(jQuery),function(e){function f(t){return e(t).parents(".prolog-runners")}function l(e,t){var n=e.find(".runner-results");return n.append(t),this}function c(e){switch(e){case"running":case"wait-next":case"wait-input":return!0;default:return!1}}function h(t){var n=[{"class":"projection"}];for(i=0;i<t.length;i++)n.push(e.el.th({"class":"pl-pvar"},t[i]));n.push(e.el.th({"class":"answer-nth"},"No"));var r=e.el.table({"class":"prolog-answers"},e.el.tbody(e.el.tr.apply(this,n)));return r}function p(){var e=this.pengine.options.runner,t=e.data("prologRunner");this.pengine.ask("parse,query_call("+S(t.query.query)+")"),e.prologRunner("setState","running")}function d(){var t=this.pengine.options.runner;for(var n=0;n<this.data.length;n++){var r=this.data[n];this.projection&&(r.projection=this.projection),t.prologRunner("renderAnswer",r)}this.time>.1&&l(t,e.el.div({"class":"cputime"},e.el.span(this.time.toFixed(3)," seconds cpu time"))),t.prologRunner("setState",this.more?"wait-next":"true")}function v(){var t=this.pengine.options.runner;l(t,e.el.span({"class":"prolog-false"},"false")),t.prologRunner("setState","false")}function m(){var e=this.pengine.options.runner;e.prologRunner("setState","stopped")}function g(){var e=this.pengine.options.runner,t=this.data?this.data:"Please enter a Prolog term";e.prologRunner("setPrompt",t),e.prologRunner("setState","wait-input")}function y(){var t=this.pengine.options.runner;this.data=this.data.replace(new RegExp("'[-0-9a-f]{36}':","g"),""),this.location&&(this.data=this.data.replace(/pengine:\/\/[-0-9a-f]*\//,""),e(".trill_on_swish-event-receiver").trigger("source-error",this)),t.prologRunner("outputHTML",this.data),f(t).prologRunners("scrollToBottom")}function b(){var e=this.pengine.options.runner,t;this.code=="too_many_pengines"?t="Too many open queries.  Please complete some\nqueries by using |Next|, |Stop| or by\nclosing some queries.":t=String(this.data).replace(new RegExp("'"+this.pengine.id+"':","g"),""),e.prologRunner("error",t),e.prologRunner("setState","error")}function w(){var e=this.pengine.options.runner;e.prologRunner("error","** Execution aborted **"),e.prologRunner("setState","aborted")}function E(e){return e.variables.length>0||e.residuals}function S(t){return String(e.trim(t)).replace(/\.$/,"")}var o="prologRunner",u={59:"next",186:"next",32:"next",190:"stop",13:"stop",65:"stopOrAbort",27:"stopOrAbort",46:"close",112:"trill_on_swish_help"},a={_init:function(i){return this.each(function(){function a(){var t=e.el.button();return e(t).html("&times"),e(t).on("click",function(){s.prologRunner("close")}),t}function f(){var t=e.el.button("_");return e(t).on("click",function(){s.prologRunner("toggleIconic")}),t}function l(){var t=e.el.span({"class":"runner-state show-state idle"});return r(t)}function c(){function t(){s.prologRunner("next",1)}function n(){s.prologRunner("next",10)}function r(){s.prologRunner("next",100)}function i(){s.prologRunner("next",1e3)}function u(){o.prolog.stop()}function a(){o.prolog.abort()}function f(t,n){var r=e.el.button(n);return e(r).on("click",t),r}function l(){var t=e.el.input({"class":"prolog-input"}),n=e.el.button("Send");return e(t).keypress(function(n){var r;if(n.which==13&&(r=S(e(t).val()))!="")return e(t).val(""),n.preventDefault(),s.prologRunner("respond",r),!1;n.key!="Esc"&&n.stopPropagation()}),e(n).on("click",function(){var n;(n=S(e(t).val()))!=""&&s.prologRunner("respond",n)}),{input:t,button:n}}var c=l(),h=e.el.div({"class":"controller show-state"},e.el.div({"class":"running"},f(a,"Abort")),e.el.div({"class":"wait-next"},f(t,"Next"),f(n,"10"),f(r,"100"),f(i,"1,000")," ",f(u,"Stop")),e.el.div({"class":"wait-input"},f(a,"Abort"),c.button,e.el.span(c.input)));return h}var s=e(this),o={};s.addClass("prolog-runner");var h=e.el.span({"class":"query tos_cm-s-prolog"});return n.runMode(i.query,"prolog",h),s.append(e.el.div({"class":"runner-title ui-widget-header"},a(),f(),l(),h)),s.append(e.el.div({"class":"runner-results"})),s.append(c()),s.data("prologRunner",o),s.prologRunner("populateActionMenu"),s.keydown(function(e){s.prologRunner("getState")!="wait-input"&&u[e.which]&&(e.preventDefault(),s.prologRunner(u[e.which]))}),o.savedFocus=document.activeElement,s.attr("tabindex",-1),s.focus(),o.query=i,o.answers=0,require([t.http.locations.pengines+"/pengines.js"],function(){o.prolog=new Pengine({server:t.http.locations.pengines,runner:s,application:"trill_on_swish",src:"\n\n\n:- dynamic\n        classAssertion/2,\n        propertyAssertion/3,\n        subPropertyOf/2,\n        subClassOf/2,\n        equivalentClasses/1,\n        differentIndividuals/1,\n        sameIndividual/1,\n        intersectionOf/1,\n        unionOf/1,\n        propertyRange/2,\n        propertyDomain/2,\n        annotationAssertion/3,\n        exactCardinality/2,\n        exactCardinality/3,\n        maxCardinality/2,\n        maxCardinality/3,\n        minCardinality/2,\n        minCardinality/3.\n\n:- use_module(library(lists),[member/2]).\n:- use_module(library(pengines)).\n:- use_module(library(trill)).\n\n\n:- discontiguous(valid_axiom/1).\n:- discontiguous(axiompred/1).\n:- discontiguous(axiom_arguments/2).\n\n\nbuiltin_class('http://www.w3.org/2002/07/owl#Thing').\nbuiltin_class('http://www.w3.org/2002/07/owl#Nothing').\nis_class(C) :- class(C).\nis_class(C) :- builtin_class(C).\n\n\n% TODO: hasKey\n\n/****************************************\n  AXIOMS\n  ****************************************/\n\n%% entity(?IRI)\n% the fundamental building blocks of owl 2 ontologies, and they define the vocabulary (the named terms) of an ontology\n%\n% @see individual/1, property/1, class/1, datatype/1\nentity(A) :- individual(A).\nentity(A) :- property(A).\nentity(A) :- class(A).\nentity(A) :- datatype(A).\naxiom_arguments(entity,[iri]).\nvalid_axiom(entity(A)) :- subsumed_by([A],[iri]).\n\n%declarationAxiom(individual(A)) :- individual(A). % TODO - check this\ndeclarationAxiom(namedIndividual(A)) :- namedIndividual(A).\ndeclarationAxiom(objectProperty(A)) :- objectProperty(A).\ndeclarationAxiom(dataProperty(A)) :- dataProperty(A).\ndeclarationAxiom(annotationProperty(A)) :- annotationProperty(A).  % VV added 9/3/2010\ndeclarationAxiom(class(A)) :- class(A).\ndeclarationAxiom(datatype(A)) :- datatype(A).\n% TODO: check. here we treat the ontology declaration as an axiom;\n% this liberal definition of axiom allows us to iterate over axiom/1\n% to find every piece of information in the ontology.\ndeclarationAxiom(ontology(A)) :- ontology(A).\n\n%% class(?IRI)\n% Classes can be understood as sets of individuals\n:- dynamic(class/1).\n\naxiompred(class/1).\naxiom_arguments(class,[iri]).\nvalid_axiom(class(A)) :- subsumed_by([A],[iri]).\n\n%% datatype(?IRI)\n% Datatypes are entities that refer to sets of values described by a datatype map\n:- dynamic(datatype/1).\n\naxiompred(datatype/1).\naxiom_arguments(datatype,[iri]).\nvalid_axiom(datatype(A)) :- subsumed_by([A],[iri]).\n\n%% property(?IRI)\n% Properties connect individuals with either other individuals or with literals\n%\n% @see dataProperty/1, objectProperty/1, annotationProperty/1\nproperty(A) :- dataProperty(A).\nproperty(A) :- objectProperty(A).\nproperty(A) :- annotationProperty(A).\naxiom_arguments(property,[iri]).\nvalid_axiom(property(A)) :- subsumed_by([A],[iri]).\n\n%% objectProperty(?IRI)\n% Object properties connect pairs of individuals\n:- dynamic(objectProperty/1).\n\naxiompred(objectProperty/1).\naxiom_arguments(objectProperty,[iri]).\nvalid_axiom(objectProperty(A)) :- subsumed_by([A],[iri]).\n\n%% dataProperty(?IRI)\n% Data properties connect individuals with literals. In some knowledge representation systems, functional data properties are called attributes.\n:- dynamic(dataProperty/1).\n\naxiompred(dataProperty/1).\naxiom_arguments(dataProperty,[iri]).\nvalid_axiom(dataProperty(A)) :- subsumed_by([A],[iri]).\n\n%% annotationProperty(?IRI)\n% Annotation properties can be used to provide an annotation for an ontology, axiom, or an IRI\n:- dynamic(annotationProperty/1).\n\naxiompred(annotationProperty/1).\naxiom_arguments(annotationProperty,[iri]).\nvalid_axiom(annotationProperty(A)) :- subsumed_by([A],[iri]).\n\n\n%% individual(?IRI)\n% Individuals represent actual objects from the domain being modeled\n% @see anonymousIndividual/1, namedIndividual/1\nindividual(A) :- anonymousIndividual(A).\nindividual(A) :- namedIndividual(A).\n%individual(A) :- nonvar(A),iri(A),\\+property(A),\\+class(A),\\+ontology(A). % TODO: check: make individuals the default\naxiom_arguments(individual,[iri]).\nvalid_axiom(individual(A)) :- subsumed_by([A],[iri]).\n\n%% namedIndividual(?IRI)\n% Named individuals are given an explicit name that can be used in any ontology in the import closure to refer to the same individual\n:- dynamic(namedIndividual/1).\n\naxiompred(namedIndividual/1).\naxiom_arguments(namedIndividual,[iri]).\nvalid_axiom(namedIndividual(A)) :- subsumed_by([A],[iri]).\n\n%% anonymousIndividual(?IRI)\n% Anonymous individuals are local to the ontology they are contained in. Analagous to bnodes\n% @see construct/1\n:- dynamic(anonymousIndividual/1).\n\naxiompred(anonymousIndividual/1).\naxiom_arguments(anonymousIndividual,[iri]).\nvalid_axiom(anonymousIndividual(A)) :- subsumed_by([A],[iri]).\n\n%% construct(?IRI)\n% @see axiom/1, annotation/1, ontology/1\nconstruct(A) :- axiom(A).\nconstruct(A) :- annotation(A).\nconstruct(A) :- ontology(A).\naxiom_arguments(construct,[iri]).\nvalid_axiom(construct(A)) :- subsumed_by([A],[iri]).\n\n%% axiom(?Axiom)\n% The main component of an OWL 2 ontology is a set of axioms - statements that say what is true in the domain being modeled.\n% @see classAxiom/1, propertyAxiom/1, fact/1\naxiom(A) :- classAxiom(A).\naxiom(A) :- propertyAxiom(A).\naxiom(hasKey(A,B)) :- hasKey(A,B).\naxiom(A) :- fact(A).\naxiom(A) :- declarationAxiom(A).\n%axiom(annotation(A,B,C)) :-\n%	annotation(A,B,C). % CJM-treat annotations as axioms\naxiom_arguments(axiom,[axiom]).\nvalid_axiom(axiom(A)) :- subsumed_by([A],[axiom]).\n\n%% classAxiom(?Axiom)\n% OWL 2 provides axioms that allow relationships to be established between class expressions. This predicate reifies the actual axiom\n% @see equivalentClasses/1, disjointClasses/1, subClassOf/2, disjointUnion/2\nclassAxiom(equivalentClasses(A)) :- equivalentClasses(A).\nclassAxiom(disjointClasses(A)) :- disjointClasses(A).\nclassAxiom(subClassOf(A, B)) :- subClassOf(A, B).\nclassAxiom(disjointUnion(A, B)) :- disjointUnion(A, B).\naxiom_arguments(classAxiom,[axiom]).\nvalid_axiom(classAxiom(A)) :- subsumed_by([A],[axiom]).\n\n%% subClassOf(?SubClass:ClassExpression, ?SuperClass:ClassExpression)\n% A subclass axiom SubClassOf( CE1 CE2 ) states that the class expression CE1 is a subclass of the class expression CE2\n%\n%   @param SubClass a classExpression/1 representing the more specific class\n%   @param SuperClass a classExpression/1 representing the more general class\n:- dynamic(subClassOf/2).\n\naxiompred(subClassOf/2).\naxiom_arguments(subClassOf,[classExpression, classExpression]).\nvalid_axiom(subClassOf(A, B)) :- subsumed_by([A, B],[classExpression, classExpression]).\n\n\n%% equivalentClasses(?ClassExpressions:set(ClassExpression))\n% An equivalent classes axiom EquivalentClasses( CE1 ... CEn ) states that all of the class expressions CEi, 1 <= i <= n, are semantically equivalent to each other.\n:- dynamic(equivalentClasses/1).\n\naxiompred(equivalentClasses/1).\naxiom_arguments(equivalentClasses,[set(classExpression)]).\nvalid_axiom(equivalentClasses(A)) :- subsumed_by([A],[set(classExpression)]).\n\n%% disjointClasses(?ClassExpressions:set(ClassExpression))\n% A disjoint classes axiom DisjointClasses( CE1 ... CEn ) states that all of the class expressions CEi, 1 <= i <= n, are pairwise disjoint; that is, no individual can be at the same time an instance of both CEi and CEj for i != j\n:- dynamic(disjointClasses/1).\n\naxiompred(disjointClasses/1).\naxiom_arguments(disjointClasses,[set(classExpression)]).\nvalid_axiom(disjointClasses(A)) :- subsumed_by([A],[set(classExpression)]).\n\n%% disjointUnion(?ClassExpression, ?ClassExpressions:set(ClassExpression))\n% A disjoint union axiom DisjointUnion( C CE1 ... CEn ) states that a class C is a disjoint union of the class expressions CEi, 1 <= i <= n, all of which are pairwise disjoint.\n:- dynamic(disjointUnion/2).\n\naxiompred(disjointUnion/2).\naxiom_arguments(disjointUnion,[classExpression,set(classExpression)]).\nvalid_axiom(disjointUnion(A,B)) :- subsumed_by([A,B],[classExpression,set(classExpression)]).\n\n%% propertyAxiom(?Axiom)\n% OWL 2 provides axioms that can be used to characterize and establish relationships between object property expressions. This predicate reifies the actual axiom\n%\n% @see symmetricProperty/1, inverseFunctionalProperty/1, transitiveProperty/1, asymmetricProperty/1, subPropertyOf/2, functionalProperty/1, irreflexiveProperty/1, disjointProperties/1, propertyDomain/2, reflexiveProperty/1, propertyRange/2, equivalentProperties/1, inverseProperties/2\npropertyAxiom(symmetricProperty(A)) :- symmetricProperty(A).\npropertyAxiom(inverseFunctionalProperty(A)) :- inverseFunctionalProperty(A).\npropertyAxiom(transitiveProperty(A)) :- transitiveProperty(A).\npropertyAxiom(asymmetricProperty(A)) :- asymmetricProperty(A).\npropertyAxiom(subPropertyOf(A, B)) :- subPropertyOf(A, B).\npropertyAxiom(functionalProperty(A)) :- functionalProperty(A).\npropertyAxiom(irreflexiveProperty(A)) :- irreflexiveProperty(A).\npropertyAxiom(disjointProperties(A)) :- disjointProperties(A).\npropertyAxiom(propertyDomain(A, B)) :- propertyDomain(A, B).\npropertyAxiom(reflexiveProperty(A)) :- reflexiveProperty(A).\npropertyAxiom(propertyRange(A, B)) :- propertyRange(A, B).\npropertyAxiom(equivalentProperties(A)) :- equivalentProperties(A).\npropertyAxiom(inverseProperties(A, B)) :- inverseProperties(A, B).\naxiom_arguments(propertyAxiom,[axiom]).\nvalid_axiom(propertyAxiom(A)) :- subsumed_by([A],[axiom]).\n\n\n%% subPropertyOf(?Sub:PropertyExpression, ?Super:ObjectPropertyExpression)\n% subproperty axioms are analogous to subclass axioms\n% (extensional predicate - can be asserted)\n:- dynamic(subPropertyOf/2).\n\naxiompred(subPropertyOf/2).\naxiom_arguments(subPropertyOf,[propertyExpression, objectPropertyExpression]).\nvalid_axiom(subPropertyOf(A, B)) :- subsumed_by([A, B],[propertyExpression, objectPropertyExpression]).\n\n%% subObjectPropertyOf(?Sub:ObjectPropertyExpressionOrChain, ?Super:ObjectPropertyExpression)\n% The basic form is SubPropertyOf( OPE1 OPE2 ). This axiom states that the object property expression OPE1 is a subproperty of the object property expression OPE2 - that is, if an individual x is connected by OPE1 to an individual y, then x is also connected by OPE2 to y. The more complex form is SubPropertyOf( PropertyChain( OPE1 ... OPEn ) OPE ). This axiom states that, if an individual x is connected by a sequence of object property expressions OPE1, ..., OPEn with an individual y, then x is also connected with y by the object property expression OPE\nsubObjectPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[objectPropertyExpressionOrChain, objectPropertyExpression]).\naxiom_arguments(subObjectPropertyOf,[objectPropertyExpressionOrChain, objectPropertyExpression]).\nvalid_axiom(subObjectPropertyOf(A, B)) :- subsumed_by([A, B],[objectPropertyExpressionOrChain, objectPropertyExpression]).\n\n%% subDataPropertyOf(?Sub:DataPropertyExpression, ?Super:DataPropertyExpression)\n% A data subproperty axiom SubPropertyOf( DPE1 DPE2 ) states that the data property expression DPE1 is a subproperty of the data property expression DPE2 - that is, if an individual x is connected by OPE1 to a literal y, then x is connected by OPE2 to y as well.\nsubDataPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[dataPropertyExpression, dataPropertyExpression]).\naxiom_arguments(subDataPropertyOf,[dataPropertyExpression, dataPropertyExpression]).\nvalid_axiom(subDataPropertyOf(A, B)) :- subsumed_by([A, B],[dataPropertyExpression, dataPropertyExpression]).\n\n%% subAnnotationPropertyOf(?Sub:AnnotationProperty, ?Super:AnnotationProperty)\n% An annotation subproperty axiom SubPropertyOf( AP1 AP2 ) states that the annotation property AP1 is a subproperty of the annotation property AP2\nsubAnnotationPropertyOf(A, B) :- subPropertyOf(A, B),subsumed_by([A, B],[annotationProperty, annotationProperty]).\naxiom_arguments(subAnnotationPropertyOf,[annotationProperty, annotationProperty]).\nvalid_axiom(subAnnotationPropertyOf(A, B)) :- subsumed_by([A, B],[annotationProperty, annotationProperty]).\n\n%% equivalentProperties(?PropertyExpressions:set(PropertyExpression))\n% An equivalent object properties axiom EquivalentProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are semantically equivalent to each other\n% (extensional predicate - can be asserted)\n:- dynamic(equivalentProperties/1).\n\naxiompred(equivalentProperties/1).\naxiom_arguments(equivalentProperties,[set(propertyExpression)]).\nvalid_axiom(equivalentProperties(A)) :- subsumed_by([A],[set(propertyExpression)]).\n\n%% equivalentObjectProperties(?PropertyExpressions:set(ObjectPropertyExpression))\n% An equivalent object properties axiom EquivalentObjectProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are semantically equivalent to each other\nequivalentObjectProperties(A) :- equivalentProperties(A),subsumed_by([A],[set(objectPropertyExpression)]).\naxiom_arguments(equivalentObjectProperties,[set(objectPropertyExpression)]).\nvalid_axiom(equivalentObjectProperties(A)) :- subsumed_by([A],[set(objectPropertyExpression)]).\n\n%% equivalentDataProperties(?PropertyExpressions:set(DataPropertyExpression))\n% An equivalent data properties axiom EquivalentProperties( DPE1 ... DPEn ) states that all the data property expressions DPEi, 1 <= i <= n, are semantically equivalent to each other. This axiom allows one to use each DPEi as a synonym for each DPEj - that is, in any expression in the ontology containing such an axiom, DPEi can be replaced with DPEj without affecting the meaning of the ontology\nequivalentDataProperties(A) :- equivalentProperties(A),subsumed_by([A],[set(dataPropertyExpression)]).\naxiom_arguments(equivalentDataProperties,[set(dataPropertyExpression)]).\nvalid_axiom(equivalentDataProperties(A)) :- subsumed_by([A],[set(dataPropertyExpression)]).\n\n%% disjointProperties(?PropertyExpressions:set(PropertyExpression))\n% A disjoint properties axiom DisjointProperties( PE1 ... PEn ) states that all of the property expressions PEi, 1 <= i <= n, are pairwise disjoint\n% (extensional predicate - can be asserted)\n:- dynamic(disjointProperties/1).\n\naxiompred(disjointProperties/1).\naxiom_arguments(disjointProperties,[set(propertyExpression)]).\nvalid_axiom(disjointProperties(A)) :- subsumed_by([A],[set(propertyExpression)]).\n\n%% disjointObjectProperties(?PropertyExpressions:set(ObjectPropertyExpression))\n% A disjoint object properties axiom DisjointProperties( OPE1 ... OPEn ) states that all of the object property expressions OPEi, 1 <= i <= n, are pairwise disjoint; that is, no individual x can be connected to an individual y by both OPEi and OPEj for i != j.\ndisjointObjectProperties(A) :- disjointProperties(A),subsumed_by([A],[set(objectPropertyExpression)]).\naxiom_arguments(disjointObjectProperties,[set(objectPropertyExpression)]).\nvalid_axiom(disjointObjectProperties(A)) :- subsumed_by([A],[set(objectPropertyExpression)]).\n\n%% disjointDataProperties(?PropertyExpressions:set(DataPropertyExpression))\n% A disjoint data properties axiom DisjointProperties( DPE1 ... DPEn ) states that all of the data property expressions DPEi, 1 <= i <= n, are pairwise disjoint; that is, no individual x can be connected to a literal y by both DPEi and DPEj for i !- j.\ndisjointDataProperties(A) :- disjointProperties(A),subsumed_by([A],[set(dataPropertyExpression)]).\naxiom_arguments(disjointDataProperties,[set(dataPropertyExpression)]).\nvalid_axiom(disjointDataProperties(A)) :- subsumed_by([A],[set(dataPropertyExpression)]).\n\n%% inverseProperties(?ObjectPropertyExpression1:ObjectPropertyExpression, ?ObjectPropertyExpression2:ObjectPropertyExpression)\n% An inverse object properties axiom InverseProperties( OPE1 OPE2 ) states that the object property expression OPE1 is an inverse of the object property expression OPE2\n% (note there are no inverse data properties, as literals are not connected to individuals)\n% Example:\n% =|inverseProperties(partOf,hasPart)|=\n% (extensional predicate - can be asserted)\n:- dynamic(inverseProperties/2).\n\naxiompred(inverseProperties/2).\naxiom_arguments(inverseProperties,[objectPropertyExpression, objectPropertyExpression]).\nvalid_axiom(inverseProperties(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, objectPropertyExpression]).\n\n%% propertyDomain(?PropertyExpression, ?CE)\n%  A property domain axiom PropertyDomain( PE CE ) states that the\n%  domain of the property expression PE is CE\n% (extensional predicate - can be asserted)\n\n:- dynamic(propertyDomain/2).\n\naxiompred(propertyDomain/2).\naxiom_arguments(propertyDomain,[propertyExpression, classExpression]).\nvalid_axiom(propertyDomain(A, B)) :- subsumed_by([A, B],[propertyExpression, classExpression]).\n\n%% objectPropertyDomain(?ObjectPropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyDomain( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\nobjectPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[objectPropertyExpression, classExpression]).\naxiom_arguments(objectPropertyDomain,[objectPropertyExpression, classExpression]).\nvalid_axiom(objectPropertyDomain(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, classExpression]).\n\n%% dataPropertyDomain(?DataPropertyExpression, ?ClassExpression)\n% A data property domain axiom PropertyDomain( DPE CE ) states that the domain of the data property expression DPE is the class expression CE - that is, if an individual x is connected by DPE with some literal, then x is an instance of CE\ndataPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[dataPropertyExpression, classExpression]).\naxiom_arguments(dataPropertyDomain,[dataPropertyExpression, classExpression]).\nvalid_axiom(dataPropertyDomain(A, B)) :- subsumed_by([A, B],[dataPropertyExpression, classExpression]).\n\n%% annotationPropertyDomain(?AnnotationProperty, ?IRI)\n% An annotation property domain axiom PropertyDomain( AP U ) states that the domain of the annotation property AP is the IRI U. Such axioms have no effect on the Direct Semantics of OWL 2\nannotationPropertyDomain(A, B) :- propertyDomain(A, B),subsumed_by([A, B],[annotationProperty, iri]).\naxiom_arguments(annotationPropertyDomain,[annotationProperty, iri]).\nvalid_axiom(annotationPropertyDomain(A, B)) :- subsumed_by([A, B],[annotationProperty, iri]).\n\n%% propertyRange(?PropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyRange( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\n% (extensional predicate - can be asserted)\n:- dynamic(propertyRange/2).\n\naxiompred(propertyRange/2).\naxiom_arguments(propertyRange,[propertyExpression, classExpression]).\nvalid_axiom(propertyRange(A, B)) :- subsumed_by([A, B],[propertyExpression, classExpression]).\n\n%% objectPropertyRange(?ObjectPropertyExpression, ?ClassExpression)\n% An object property domain axiom PropertyRange( OPE CE ) states that the domain of the object property expression OPE is the class expression CE - that is, if an individual x is connected by OPE with some other individual, then x is an instance of CE\nobjectPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[objectPropertyExpression, classExpression]).\naxiom_arguments(objectPropertyRange,[objectPropertyExpression, classExpression]).\nvalid_axiom(objectPropertyRange(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, classExpression]).\n\n%% dataPropertyRange(?ObjectPropertyExpression, ?DataRange)\n% A data property range axiom PropertyRange( DPE DR ) states that the range of the data property expression DPE is the data range DR - that is, if some individual is connected by DPE with a literal x, then x is in DR. The arity of DR MUST be one\ndataPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[dataPropertyExpression, dataRange]).\naxiom_arguments(dataPropertyRange,[objectPropertyExpression, dataRange]).\nvalid_axiom(dataPropertyRange(A, B)) :- subsumed_by([A, B],[objectPropertyExpression, dataRange]).\n\n%% annotationPropertyRange(?AnnotationProperty, ?IRI)\n% An annotation property range axiom PropertyRange( AP U ) states that the range of the annotation property AP is the IRI U. Such axioms have no effect on the Direct Semantics of OWL 2\nannotationPropertyRange(A, B) :- propertyRange(A, B),subsumed_by([A, B],[annotationProperty, iri]).\naxiom_arguments(annotationPropertyRange,[annotationProperty, iri]).\nvalid_axiom(annotationPropertyRange(A, B)) :- subsumed_by([A, B],[annotationProperty, iri]).\n\n%% functionalProperty(?PropertyExpression)\n% An object property functionality axiom FunctionalProperty( OPE ) states that the object property expression OPE is functional - that is, for each individual x, there can be at most one distinct individual y such that x is connected by OPE to y\n% (extensional predicate - can be asserted)\n:- dynamic(functionalProperty/1).\n\naxiompred(functionalProperty/1).\naxiom_arguments(functionalProperty,[propertyExpression]).\nvalid_axiom(functionalProperty(A)) :- subsumed_by([A],[propertyExpression]).\n\n%% functionalObjectProperty(?ObjectPropertyExpression)\n% An object property functionality axiom FunctionalProperty( OPE ) states that the object property expression OPE is functional - that is, for each individual x, there can be at most one distinct individual y such that x is connected by OPE to y\nfunctionalObjectProperty(A) :- functionalProperty(A),subsumed_by([A],[objectPropertyExpression]).\naxiom_arguments(functionalObjectProperty,[objectPropertyExpression]).\nvalid_axiom(functionalObjectProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% functionalDataProperty(?DataPropertyExpression)\n% A data property functionality axiom FunctionalProperty( DPE ) states that the data property expression DPE is functional - that is, for each individual x, there can be at most one distinct literal y such that x is connected by DPE with y\nfunctionalDataProperty(A) :- functionalProperty(A),subsumed_by([A],[dataPropertyExpression]).\naxiom_arguments(functionalDataProperty,[dataPropertyExpression]).\nvalid_axiom(functionalDataProperty(A)) :- subsumed_by([A],[dataPropertyExpression]).\n\n%% inverseFunctionalProperty(?ObjectPropertyExpression)\n% An object property inverse functionality axiom InverseFunctionalProperty( OPE ) states that the object property expression OPE is inverse-functional - that is, for each individual x, there can be at most one individual y such that y is connected by OPE with x. Note there are no InverseFunctional DataProperties\n:- dynamic(inverseFunctionalProperty/1).\n\naxiompred(inverseFunctionalProperty/1).\naxiom_arguments(inverseFunctionalProperty,[objectPropertyExpression]).\nvalid_axiom(inverseFunctionalProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% reflexiveProperty(?ObjectPropertyExpression)\n% An object property reflexivity axiom ReflexiveProperty( OPE ) states that the object property expression OPE is reflexive - that is, each individual is connected by OPE to itself\n:- dynamic(reflexiveProperty/1).\n\naxiompred(reflexiveProperty/1).\naxiom_arguments(reflexiveProperty,[objectPropertyExpression]).\nvalid_axiom(reflexiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% irreflexiveProperty(?ObjectPropertyExpression)\n% An object property reflexivity axiom ReflexiveProperty( OPE ) states that the object property expression OPE is reflexive - that is, no individual is connected by OPE to itsel\n:- dynamic(irreflexiveProperty/1).\n\naxiompred(irreflexiveProperty/1).\naxiom_arguments(irreflexiveProperty,[objectPropertyExpression]).\nvalid_axiom(irreflexiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% symmetricProperty(?ObjectPropertyExpression)\n% An object property symmetry axiom SymmetricProperty( OPE ) states that the object property expression OPE is symmetric - that is, if an individual x is connected by OPE to an individual y, then y is also connected by OPE to x\n:- dynamic(symmetricProperty/1).\n\naxiompred(symmetricProperty/1).\naxiom_arguments(symmetricProperty,[objectPropertyExpression]).\nvalid_axiom(symmetricProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% asymmetricProperty(?ObjectPropertyExpression)\n% An object property asymmetry axiom AsymmetricProperty( OPE ) states that the object property expression OPE is asymmetric - that is, if an individual x is connected by OPE to an individual y, then y cannot be connected by OPE to x\n:- dynamic(asymmetricProperty/1).\n\naxiompred(asymmetricProperty/1).\naxiom_arguments(asymmetricProperty,[objectPropertyExpression]).\nvalid_axiom(asymmetricProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% transitiveProperty(?ObjectPropertyExpression)\n% An object property transitivity axiom TransitiveProperty( OPE ) states that the object property expression OPE is transitive - that is, if an individual x is connected by OPE to an individual y that is connected by OPE to an individual z, then x is also connected by OPE to z\n:- dynamic(transitiveProperty/1).\n\naxiompred(transitiveProperty/1).\naxiom_arguments(transitiveProperty,[objectPropertyExpression]).\nvalid_axiom(transitiveProperty(A)) :- subsumed_by([A],[objectPropertyExpression]).\n\n%% hasKey(?ClassExpression,?PropertyExpression)\n% A key axiom HasKey( CE PE1 ... PEn ) states that each (named) instance of the class expression CE is uniquely identified by the (data or object) property expressions PEi - that is, no two distinct (named) instances of CE can coincide on the values of all property expressions PEi\n:- dynamic(hasKey/2).\n\naxiompred(hasKey/2).\naxiom_arguments(hasKey,[classExpression,propertyExpression]).\nvalid_axiom(hasKey(CE,PE)) :- subsumed_by([CE,PE],[classExpression,propertyExpression]).\n\n\n%% fact(?Axiom)\n% OWL 2 supports a rich set of axioms for stating assertions - axioms about individuals that are often also called facts. The fact/1 predicate reifies the fact predicate\n%\n% @see annotationAssertion/3, differentIndividuals/1, negativePropertyAssertion/3, propertyAssertion/3, sameIndividual/1, classAssertion/2\nfact(annotationAssertion(A, B, C)) :- annotationAssertion(A, B, C).\nfact(differentIndividuals(A)) :- differentIndividuals(A).\nfact(negativePropertyAssertion(A, B, C)) :- negativePropertyAssertion(A, B, C).\nfact(propertyAssertion(A, B, C)) :- propertyAssertion(A, B, C).\nfact(sameIndividual(A)) :- sameIndividual(A).\nfact(classAssertion(A, B)) :- classAssertion(A, B).\naxiom_arguments(fact,[axiom]).\nvalid_axiom(fact(A)) :- subsumed_by([A],[axiom]).\n\n%% sameIndividual(?Individuals:set(Individual))\n% An individual equality axiom SameIndividual( a1 ... an ) states that all of the individuals ai, 1 <= i <= n, are equal to each other.\n% note that despite the name of this predicate, it accepts a list of individuals as argument\n:- dynamic(sameIndividual/1).\n\naxiompred(sameIndividual/1).\naxiom_arguments(sameIndividual,[set(individual)]).\nvalid_axiom(sameIndividual(A)) :- subsumed_by([A],[set(individual)]).\n\n%% differentIndividuals(?Individuals:set(Individual))\n% An individual inequality axiom DifferentIndividuals( a1 ... an ) states that all of the individuals ai, 1 <= i <= n, are different from each other\n:- dynamic(differentIndividuals/1).\n\naxiompred(differentIndividuals/1).\naxiom_arguments(differentIndividuals,[set(individual)]).\nvalid_axiom(differentIndividuals(A)) :- subsumed_by([A],[set(individual)]).\n\n%% classAssertion(?ClassExpression, ?Individual)\n% A class assertion ClassAssertion( CE a ) states that the individual a is an instance of the class expression CE\n:- dynamic(classAssertion/2).\n\naxiompred(classAssertion/2).\naxiom_arguments(classAssertion,[classExpression, individual]).\nvalid_axiom(classAssertion(A, B)) :- subsumed_by([A, B],[classExpression, individual]).\n\n%% propertyAssertion(?PropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A positive object property assertion PropertyAssertion( OPE a1 a2 ) states that the individual a1 is connected by the object property expression OPE to the individual a2\n% (extensional predicate - can be asserted)\n:- dynamic(propertyAssertion/3).\n\naxiompred(propertyAssertion/3).\naxiom_arguments(propertyAssertion,[propertyExpression, individual, individual]).\nvalid_axiom(propertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[propertyExpression, individual, individual]).\n\n%% objectPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A positive object property assertion PropertyAssertion( OPE a1 a2 ) states that the individual a1 is connected by the object property expression OPE to the individual a2\nobjectPropertyAssertion(A, B, C) :- propertyAssertion(A, B, C),subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\naxiom_arguments(objectPropertyAssertion,[objectPropertyExpression, individual, individual]).\nvalid_axiom(objectPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\n\n%% dataPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetValue:Literal)\n% A positive data property assertion PropertyAssertion( DPE a lt ) states that the individual a is connected by the data property expression DPE to the literal lt\ndataPropertyAssertion(A, B, C) :- propertyAssertion(A, B, C),subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\naxiom_arguments(dataPropertyAssertion,[objectPropertyExpression, individual, literal]).\nvalid_axiom(dataPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\n\n%% negativePropertyAssertion(?PropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A negative object property assertion NegativePropertyAssertion( OPE a1 a2 ) states that the individual a1 is not connected by the object property expression OPE to the individual a2\n% (extensional predicate - can be asserted)\n:- dynamic(negativePropertyAssertion/3).\n\naxiompred(negativePropertyAssertion/3).\naxiom_arguments(negativePropertyAssertion,[propertyExpression, individual, individual]).\nvalid_axiom(negativePropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[propertyExpression, individual, individual]).\n\n%% negativeObjectPropertyAssertion(?ObjectPropertyExpression, ?SourceIndividual:Individual, ?TargetIndividual:Individual)\n% A negative object property assertion NegativePropertyAssertion( OPE a1 a2 ) states that the individual a1 is not connected by the object property expression OPE to the individual a2\nnegativeObjectPropertyAssertion(A, B, C) :- negativePropertyAssertion(A, B, C),subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\naxiom_arguments(negativeObjectPropertyAssertion,[objectPropertyExpression, individual, individual]).\nvalid_axiom(negativeObjectPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[objectPropertyExpression, individual, individual]).\n\n%% negativeDataPropertyAssertion(?DataPropertyExpression, ?SourceIndividual:Individual, ?TargetValue:Literal)\n% A negative data property assertion NegativePropertyAssertion( DPE a lt ) states that the individual a is not connected by the data property expression DPE to the literal lt\nnegativeDataPropertyAssertion(A, B, C) :- negativePropertyAssertion(A, B, C),subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\naxiom_arguments(negativeDataPropertyAssertion,[dataPropertyExpression, individual, literal]).\nvalid_axiom(negativeDataPropertyAssertion(A, B, C)) :- subsumed_by([A, B, C],[dataPropertyExpression, individual, literal]).\n\n%% annotationAssertion(?AnnotationProperty, ?AnnotationSubject, ?AnnotationValue)\n% An annotation assertion AnnotationAssertion( AP as av ) states that the annotation subject as - an IRI or an anonymous individual - is annotated with the annotation property AP and the annotation value av\n:- dynamic(annotationAssertion/3).\n\naxiompred(annotationAssertion/3).\naxiom_arguments(annotationAssertion,[annotationProperty, annotationSubject, annotationValue]).\nvalid_axiom(annotationAssertion(A, B, C)) :- subsumed_by([A, B, C],[annotationProperty, annotationSubject, annotationValue]).\nannotationSubject(_).\nannotationValue(_).\n\n%% annotation(?IRI,?AnnotationProperty,?AnnotationValue)\n%\n% @see annotationAnnotation/3, ontologyAnnotation/3, axiomAnnotation/3\n:- dynamic(annotation/3).\n\naxiompred(annotation/3).\n\nannotation(annotationAnnotation(A, B, C)) :- annotationAnnotation(A, B, C).\nannotation(axiomAnnotation(A, B, C)) :- axiomAnnotation(A, B, C).\naxiom_arguments(annotation,[iri,annotationProperty,annotationValue]).\nvalid_axiom(annotation(A,B,C)) :- subsumed_by([A,B,C],[iri,annotationProperty,annotationValue]).\n\n%% ontologyAnnotation(?Ontology, ?AnnotationProperty, ?AnnotationValue)\nontologyAnnotation(Ontology,AP,AV) :-\n	annotation(Ontology,AP,AV),\n	ontology(Ontology).\naxiom_arguments(ontologyAnnotation,[ontology, annotationProperty, annotationValue]).\nvalid_axiom(ontologyAnnotation(A, B, C)) :- subsumed_by([A, B, C],[ontology, annotationProperty, annotationValue]).\n\n%% axiomAnnotation(?Axiom, ?AnnotationProperty, ?AnnotationValue)\naxiomAnnotation(Axiom,AP,AV) :-\n	annotation(Axiom,AP,AV),\n	axiom(Axiom).\naxiom_arguments(axiomAnnotation,[axiom, annotationProperty, annotationValue]).\nvalid_axiom(axiomAnnotation(A, B, C)) :- subsumed_by([A, B, C],[axiom, annotationProperty, annotationValue]).\n\n%% annotationAnnotation(?Annotation, ?AnnotationProperty, ?AnnotationValue)\nannotationAnnotation(Annotation,AP,AV) :-\n	annotation(Annotation,AP,AV),\n	annotation(Annotation).\naxiom_arguments(annotationAnnotation,[annotation, annotationProperty, annotationValue]).\nvalid_axiom(annotationAnnotation(A, B, C)) :- subsumed_by([A, B, C],[annotation, annotationProperty, annotationValue]).\n\n%% ontology(?IRI)\n% An ontology in OWL2 is a collection of OWL Axioms\n:- dynamic(ontology/1).\n\naxiompred(ontology/1).\naxiom_arguments(ontology,[iri]).\nvalid_axiom(ontology(A)) :- subsumed_by([A],[iri]).\n\n%% ontologyDirective(?OntologyIRI,?IRI)\n% @see ontologyImport/2, ontologyAxiom/2\nontologyDirective(A, B) :- ontologyImport(A, B).\nontologyDirective(A, B) :- ontologyAxiom(A, B).\nontologyDirective(A, B) :- ontologyVersionInfo(A, B).\naxiom_arguments(ontologyDirective,[ontology, iri]).\nvalid_axiom(ontologyDirective(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n%% ontologyAxiom(?Ontology, ?Axiom)\n% True if Ontology contains Axiom.\n% Axiom is a prolog term that is typically asserted and separately and can thus can be executed as a goal.\n% For example, an ontology http://example.org# will contain redundant assertions:\n% ==\n% subClassOf('http://example.org#a', 'http://example.org#b').\n% ontologyAxiom('http://example.org#', subClassOf('http://example.org#a','http://example.org#b')).\n% ==\n:- dynamic(ontologyAxiom/2).\n\naxiompred(ontologyAxiom/2).\naxiom_arguments(ontologyAxiom,[ontology, axiom]).\nvalid_axiom(ontologyAxiom(A, B)) :- subsumed_by([A, B],[ontology, axiom]).\n\n%% ontologyImport(?Ontology, ?IRI)\n% True of Ontology imports document IRI\n:- dynamic(ontologyImport/2).\n\naxiompred(ontologyImport/2).\naxiom_arguments(ontologyImport,[ontology, iri]).\nvalid_axiom(ontologyImport(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n%% ontologyVersionInfo(?Ontology, ?IRI)\n:- dynamic(ontologyVersionInfo/2).\n\naxiompred(ontologyVersionInfo/2).\naxiom_arguments(ontologyVersionInfo,[ontology, iri]).\nvalid_axiom(ontologyVersionInfo(A, B)) :- subsumed_by([A, B],[ontology, iri]).\n\n/****************************************\n  RESTRICTIONS ON AXIOMS\n  ****************************************/\n\n% 11.1\n% An object property expression OPE is simple in Ax if, for each object property expression OPE' such that OPE' ->* OPE holds, OPE' is not composite.\n% (The property hierarchy relation ->* is the reflexive-transitive closure of ->)\n%simpleObjectPropertyExpresion(OPE) :-\n%        objectPropertyExpression(OPE),\n\n\n/****************************************\n  EXPRESSIONS\n  ****************************************/\n\nsubsumed_by(X,_) :- var(X),!.\nsubsumed_by([],[]) :- !.\nsubsumed_by([I|IL],[T|TL]) :-\n	!,\n	subsumed_by(I,T),\n	subsumed_by(IL,TL).\nsubsumed_by(L,set(T)):-\n        !,\n        forall(member(I,L),\n               subsumed_by(I,T)).\nsubsumed_by(I,T):-\n        !,\n	G=..[T,I],\n	G.\n\n\n%% iri(?IRI)\n% true if IRI is an IRI. TODO: currently underconstrained, any atomic term can be an IRI\niri(IRI) :- atomic(IRI).	%\n\n%% literal(?Lit)\n% true if Lit is an rdf literal\n%literal(_).			% TODO\nliteral(literal(_)).			% TODO\n\npropertyExpression(E) :- objectPropertyExpression(E) ; dataPropertyExpression(E).\n\n%% objectPropertyExpression(?OPE)\n% true if OPE is an ObjectPropertyExpression\n% ObjectPropertyExpression := ObjectProperty | InverseObjectProperty\nobjectPropertyExpression(E) :- objectProperty(E) ; inverseObjectProperty(E).\n\n% give benefit of doubt; e.g. rdfs:label\n% in the OWL2 spec we have DataProperty := IRI\n% here dataProperty/1 is an asserted fact\nobjectPropertyExpression(E) :- nonvar(E),iri(E).\n\nobjectPropertyExpressionOrChain(propertyChain(PL)) :- forall(member(P,PL),objectPropertyExpression(P)).\nobjectPropertyExpressionOrChain(PE) :- objectPropertyExpression(PE).\n\n\ninverseObjectProperty(inverseOf(OP)) :- objectProperty(OP).\n\ndataPropertyExpression(E) :- dataProperty(E).\n\ndataPropertyExpression(DPEs) :-\n	(   is_list(DPEs)\n	->  forall(member(DPE,DPEs),\n		   dataPropertyExpression(DPE))\n	;   dataPropertyExpression(DPEs)).\n\n% give benefit of doubt; e.g. rdfs:label\n% in the OWL2 spec we have DataProperty := IRI\n% here dataProperty/1 is an asserted fact\ndataPropertyExpression(E) :- nonvar(E),iri(E).\n\n%already declared as entity\n%datatype(IRI) :- iri(IRI).\n\n%% dataRange(+DR) is semidet\ndataRange(DR) :-\n    datatype(DR) ;\n    dataIntersectionOf(DR );\n    dataUnionOf(DR) ;\n    dataComplementOf(DR) ;\n    dataOneOf(DR) ;\n    datatypeRestriction(DR).\n\n%% classExpression(+CE) is semidet\n%\n% true if CE is a class expression term, as defined in OWL2\n%\n% Example: =|classExpression(intersectionOf([car,someValuesFrom(hasColor,blue)])))|=\n%\n% Union of:\n%\n%    class/1 | objectIntersectionOf/1 | objectUnionOf/1 |\n%    objectComplementOf/1 | objectOneOf/1 | objectSomeValuesFrom/1 |\n%    objectAllValuesFrom/1 | objectHasValue/1 | objectHasSelf/1 |\n%    objectMinCardinality/1 | objectMaxCardinality/1 |\n%    objectExactCardinality/1 | dataSomeValuesFrom/1 |\n%    dataAllValuesFrom/1 | dataHasValue/1 | dataMinCardinality/1 |\n%    dataMaxCardinality/1 | dataExactCardinality/1\nclassExpression(CE):-\n        iri(CE) ;               % NOTE: added to allow cases where class is not imported\n    class(CE) ;\n    objectIntersectionOf(CE) ; objectUnionOf(CE) ; objectComplementOf(CE) ; objectOneOf(CE) ;\n    objectSomeValuesFrom(CE) ; objectAllValuesFrom(CE) ; objectHasValue(CE) ; objectHasSelf(CE) ;\n    objectMinCardinality(CE) ; objectMaxCardinality(CE) ; objectExactCardinality(CE) ;\n    dataSomeValuesFrom(CE) ; dataAllValuesFrom(CE) ; dataHasValue(CE) ;\n    dataMinCardinality(CE) ; dataMaxCardinality(CE) ; dataExactCardinality(CE).\n\n%% objectIntersectionOf(+CE) is semidet\n% true if CE is a term intersectionOf(ClassExpression:list)\n%\n% An intersection class expression IntersectionOf( CE1 ... CEn ) contains all individuals that are instances of all class expressions CEi for 1 <= i <= n.\nobjectIntersectionOf(intersectionOf(CEs)) :-\n	forall(member(CE,CEs),\n	       classExpression(CE)).\n\n%% objectUnionOf(+CE) is semidet\n% A union class expression UnionOf( CE1 ... CEn ) contains all individuals that are instances of at least one class expression CEi for 1 <= i <= n\nobjectUnionOf(unionOf(CEs)) :-\n	forall(member(CE,CEs),\n	       classExpression(CE)).\n\n%% objectComplementOf(+CE) is semidet\n%\nobjectComplementOf(complementOf(CE)) :-\n	classExpression(CE).\n\n%% objectOneOf(+CE) is semidet\n% An enumeration of individuals OneOf( a1 ... an ) contains exactly the individuals ai with 1 <= i <= n.\nobjectOneOf(oneOf(Is)) :-\n        is_list(Is). % TODO: check if we need to strengthen this check\n%objectOneOf(oneOf(Is)) :-\n%	forall(member(I,Is),\n%	       individual(I)).\n\n%% objectSomeValuesFrom(+R) is semidet\n% An existential class expression SomeValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE to an individual that is an instance of CE\nobjectSomeValuesFrom(someValuesFrom(OPE,CE)) :-\n	objectPropertyExpression(OPE),\n	classExpression(CE).\n\n%% objectAllValuesFrom(+R) is semidet\n% A universal class expression AllValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE only to individuals that are instances of CE\nobjectAllValuesFrom(allValuesFrom(OPE,CE)) :-\n	objectPropertyExpression(OPE),\n	classExpression(CE).\n\n%% objectHasValue(+R) is semidet\n% A has-value class expression HasValue( OPE a ) consists of an object property expression OPE and an individual a, and it contains all those individuals that are connected by OPE to a\nobjectHasValue(hasValue(OPE,I)) :-\n	objectPropertyExpression(OPE),\n	individual(I).\n\n%% objectHasSelf(+R) is semidet\n% A self-restriction HasSelf( OPE ) consists of an object property expression OPE, and it contains all those individuals that are connected by OPE to themselves\nobjectHasSelf(hasSelf(OPE)) :-\n	objectPropertyExpression(OPE).\n\n%% objectMinCardinality(+CR) is semidet\n% A minimum cardinality expression MinCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at least n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectMinCardinality(minCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectMinCardinality(minCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% objectMaxCardinality(+CR) is semidet\n% A maximum cardinality expression MaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at most n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectMaxCardinality(maxCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectMaxCardinality(maxCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n%% objectExactCardinality(+CR) is semidet\n% An exact cardinality expression ExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to exactly n different individuals that are instances of CE. If CE is missing, it is taken to be owl:Thing\nobjectExactCardinality(exactCardinality(C,OPE,CE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE),\n	classExpression(CE).\nobjectExactCardinality(exactCardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n% NON-NORMATIVE: we accept this in order to maximize compatibility with Thea1\nobjectExactCardinality(cardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% dataIntersectionOf(+DR:dataIntersectionOf) is semidet\n% An intersection data range IntersectionOf( DR1 ... DRn ) contains all data values that are contained in the value space of every data range DRi for 1 <= i <= n. All data ranges DRi must be of the same arity\ndataIntersectionOf(intersectionOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% dataUnionOf(+DR:dataUnionOf) is semidet\n% A union data range UnionOf( DR1 ... DRn ) contains all data values that are contained in the value space of at least one data range DRi for 1 <= i <= n. All data ranges DRi must be of the same arity\ndataUnionOf(unionOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% dataComplementOf(+DR:dataComplementOf) is semidet\n% A complement data range ComplementOf( DR ) contains all literals that are not contained in the data range DR\ndataComplementOf(complementOf(DR)) :-\n	dataRange(DR).\n\n%% dataOneOf(+DR:dataOneOf) is semidet\n% An enumeration of literals OneOf( lt1 ... ltn ) contains exactly the explicitly specified literals lti with 1 <= i <= n\ndataOneOf(oneOf(DRs)) :-\n	forall(member(DR,DRs),\n	       dataRange(DR)).\n\n%% datatypeRestriction(+DR) is semidet\n%\n% TODO: multiple args\ndatatypeRestriction(datatypeRestriction(DR,FacetValues)):-\n	datatype(DR),\n	FacetValues=[_|_].\n\n%% dataSomeValuesFrom(+DR) is semidet\ndataSomeValuesFrom(someValuesFrom(DPE,DR)):-\n	dataPropertyExpression(DPE),\n	dataRange(DR).\n\n%% dataAllValuesFrom(+DR) is semidet\ndataAllValuesFrom(allValuesFrom(DPE,DR)):-\n	dataPropertyExpression(DPE),\n	dataRange(DR).\n\n%% dataHasValue(+DR) is semidet\n% A has-value class expression HasValue( DPE lt ) consists of a data property expression DPE and a literal lt, and it contains all those individuals that are connected by DPE to lt. Each such class expression can be seen as a syntactic shortcut for the class expression SomeValuesFrom( DPE OneOf( lt ) )\ndataHasValue(hasValue(DPE,L)):-\n	dataPropertyExpression(DPE),\n	literal(L).\n\n%% dataMinCardinality(+DR) is semidet\n% A minimum cardinality expression MinCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to at least n different literals in DR. If DR is not present, it is taken to be rdfs:Literal\ndataMinCardinality(minCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataMinCardinality(minCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n\n\n\n%% dataMaxCardinality(+DR) is semidet\n% A maximum cardinality expression MaxCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to at most n different literals in DR. If DR is not present, it is taken to be rdfs:Literal.\ndataMaxCardinality(maxCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataMaxCardinality(maxCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n\n\n%% dataExactCardinality(+DR) is semidet\n% An exact cardinality expression ExactCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to exactly n different literals in DR. If DR is not present, it is taken to be rdfs:Literal\ndataExactCardinality(exactCardinality(C,DPE,DR)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE),\n	dataRange(DR).\ndataExactCardinality(exactCardinality(C,DPE)):-\n	number(C),\n	C>=0,\n	dataPropertyExpression(DPE).\n% NON-NORMATIVE: we accept this in order to maximize compatibility with Thea1\ndataExactCardinality(cardinality(C,OPE)):-\n	number(C),\n	C>=0,\n	objectPropertyExpression(OPE).\n\n\n%% valid_axiom(?Axiom) is nondet\n% true if Axiom passes typechecking\n\n\n%% is_valid_axiom(?Axiom) is semidet\n% true if Axiom passes typechecking\nis_valid_axiom(Axiom) :- \\+ \\+ valid_axiom(Axiom).\n\n\n/****************************************\n  VIEW PREDICATES\n  ****************************************/\n\n%% equivalent_to(?X,?Y)\n% note: this is currently slow for bound values of X and Y\nequivalent_to(X,Y) :- equivalentClasses(L),member(X,L),member(Y,L),X\\=Y.\nequivalent_to(X,Y) :- equivalentProperties(L),member(X,L),member(Y,L),X\\=Y.\n\ndisjoint_with(X,Y) :- disjointClasses(L),member(X,L),member(Y,L),X\\=Y.\n\n%% anyPropertyAssertion(?Property,?Entity,?Value)\n% subsumes propertyAssertion/3 and annotationAssertion/3\nanyPropertyAssertion(P,E,V) :- propertyAssertion(P,E,V).\nanyPropertyAssertion(P,E,V) :- annotationAssertion(P,E,V).\n\n\n%% labelAnnotation_value(?X,?Val)\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(type(_,Val))),atom(Val).\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(lang(_,Val))),atom(Val).\nlabelAnnotation_value(X,Val) :-\n        anyPropertyAssertion('http://www.w3.org/2000/01/rdf-schema#label', X, literal(Val)),atom(Val).\n\n/****************************************\n  META-PREDICATES\n  ****************************************/\n\n\n%% axiom_directly_about(?Ax,?About)\n% true if Ax is an axiom whose first argument is equal to About.\n%\n% e.g. axiom_directly_about( subClassOf(X,_), X).\n%\n% also include property assertions whose second argument is equal to About.\n%\n% e.g. axiom_directly_about( propertyAssertion(P,X,_), X).\n%\naxiom_directly_about(Ax,About) :-\n        axiom(Ax),\n        Ax =.. [_,Arg1|_],\n        (   is_list(Arg1)\n        ->  member(About,Arg1)\n        ;   About=Arg1).\naxiom_directly_about(Ax,About) :-\n	Ax=propertyAssertion(_,About,_),\n        axiom(Ax).\naxiom_directly_about(Ax,About) :-\n	Ax=annotationAssertion(_,About,_),\n        axiom(Ax).\naxiom_directly_about(Ax,About) :-\n	Ax=classAssertion(_,About),\n        axiom(Ax).\n\n\n%% axiom_directly_references(?Ax:axiom,?Ref)\n%\n% Ref may be\n%  - an axiom\n%  - a named entity\n%  - an expression\naxiom_directly_references(Ax,Ref) :-\n        axiom(Ax),\n        axiom_or_expression_references(Ax,Ref).\n\naxiom_or_expression_references(X,Ref) :-\n        X =.. [P|Args],\n        P\\=literal,\n        member(Arg,Args),\n        (   is_list(Arg)\n        ->  member(Ref,Arg)\n        ;   Ref=Arg).\n\naxiom_about(Ax,About) :-\n        axiom_directly_about(Ax,About).\naxiom_about(Ax,About) :-\n        axiom_directly_about(Ax,X),\n        axiom_about(X,About).\n\naxiom_references(Ax,Ref) :-\n        axiom_directly_references(Ax,Ref).\naxiom_references(Ax,Ref) :-\n        axiom_directly_references(Ax,X),\n        axiom_or_expression_references(X,Ref).\n\naxiom_contains_expression(Ax,Ex) :-\n        axiom_contains_expression(Ax,Ex,_).\naxiom_contains_expression(Ax,Ex,D) :-\n        axiom(Ax),\n        expression_has_subexpression(Ax,Ex,[],Chain),\n        length(Chain,D).\n\nexpression_has_subexpression(Ex,Ex,Accum,Accum).\nexpression_has_subexpression(Ex,SubEx,Accum,Results) :-\n        Ex =.. [F|Args],\n        member(A,Args),\n        expression_has_subexpression(A,SubEx,[F|Accum],Results).\n\n\n\n%% referenced_description(?Desc) is nondet\n% true if Desc is either a class or a class expression using the set of ontologies loaded.\n% Example: if the ontology contains\n% ==\n% subClassOf(a,intersectionOf([b,someValuesFrom(p,c)]))\n% ==\n% then Desc will be a member of [a, b, c, b and p some c, p some c]\nreferenced_description(C) :-\n        setof(C,referenced_description_1(C),Cs),\n        member(C,Cs).\n\nreferenced_description_1(C) :- class(C).\nreferenced_description_1(C) :-\n        subClassOf(A,B),\n        (   referenced_description(A,C)\n        ;   referenced_description(B,C)).\nreferenced_description_1(C) :-\n        equivalentClasses(L),\n        member(A,L),\n        referenced_description(A,C).\nreferenced_description_1(C) :-\n        classAssertion(A,_),\n        referenced_description(A,C).\n\n% TODO - this is incomplete\nreferenced_description(X,X) :- ground(X).\nreferenced_description(someValuesFrom(_,X),Y) :- referenced_description(X,Y).\nreferenced_description(allValuesFrom(_,X),Y) :- referenced_description(X,Y).\nreferenced_description(intersectionOf(L),Y) :- member(X,L),referenced_description(X,Y).\nreferenced_description(unionOf(L),Y) :- member(X,L),referenced_description(X,Y).\n\n\n/****************************************\n  UTILITY\n  ****************************************/\n\n\n:- dynamic assert_axiom_hook/1.\n\n%% assert_axiom(+Axiom:axiom)\n%\n% writes an axiom to the prolog database.\n% typically this will just be a matter of calling assert/1. However, in future we\n% will have different backing stores (rdf_db, sql), and in these cases calls to\n% this predicate will perform the appropriate actions.\n%\n% this also asserts ontologyAxiom/2, using nb_getval with current_ontology\nassert_axiom(Axiom) :-\n        assert_axiom_hook(Axiom),\n        !.\nassert_axiom(Axiom) :-\n        assert(Axiom),\n	(   nb_current(current_ontology,O)\n        ->  assert(ontologyAxiom(O,Axiom))\n        ;   true),\n        !.\n  \n%% assert_axiom(+Axiom:axiom,+Ontology:ontology) is det\n%\n% as assert_axiom/1, but also asserts to ontologyAxiom/2\nassert_axiom(Axiom,O) :-\n        assert(Axiom),\n	assert(ontologyAxiom(O,Axiom)),\n        !.\n\n\n:- dynamic retract_axiom_hook/1.\n\n%% retract_axiom(+Axiom:axiom)\n%\n% removes an axiom from the prolog database.\n% typically this will just be a matter of calling retract/1. However, in future we\n% will have different backing stores (rdf_db, sql), and in these cases calls to\n% this predicate will perform the appropriate actions.\n%\n% also removes ontologyAxiom/2 from ALL ontologies\nretract_axiom(Axiom) :-\n        retract_axiom_hook(Axiom),\n        !.\nretract_axiom(Axiom) :-\n        retractall(Axiom),\n	retractall(ontologyAxiom(_,Axiom)),\n        !.\n\n%% retract_axiom(+Axiom:axiom,+Ontology)\n% retracts axioms from a specified ontology\nretract_axiom(Axiom,Ontology) :-\n        \\+ var(Ontology),\n	retractall(ontologyAxiom(Ontology,Axiom)),\n        (   \\+ ontologyAxiom(_,Axiom)\n        ->  retractall(Axiom)\n        ;   true),              % still exists in other ontology..\n        !.\n\n\nretract_all_axioms :-\n        findall(A,axiom(A),Axioms),\n        maplist(retract,Axioms),\n        findall(ontologyAxiom(O,A),ontologyAxiom(O,A),OAxioms),\n        maplist(retract,OAxioms),\n	!.\n\n\nowl2_model_init :-\n	assert(annotationProperty('http://www.w3.org/2000/01/rdf-schema#label')),\n	assert(annotationProperty('http://www.w3.org/2000/01/rdf-schema#comment')).\n\nconsult_axioms(File) :-\n        consult(File).\n\naxiom_type(A,T) :- functor(A,T,_).\n\n/** <module> Ontology language axioms and expressions\n\n---+ Synopsis\n\n    Example OWL2 ontology as a prolog database:\n==\nclass(organism).\nclass(animal).\nclass(carnivore).\nclass(herbivore).\nobjectProperty(eats).\nsubClassOf(animal,organism).\nequivalentClasses([carnivore,intersectionOf([animal,someValuesFrom(eats,animal)])]).\ndisjointClasses([herbivore,carnivore]).\n==\n\nExample of use:\n\n==\n:- use_module(library(thea2/owl2_io)).\n:- use_module(library(thea2/owl2_model)).\n\nshow_superclasses(OntFile,Class) :-\n        load_axioms(OntFile),\n        forall(subClassOf(Class,Super),\n               writeln(Super)).\n==\n\n---+ Details\n\nThis module is a prolog model of the OWL2 language. It consists of predicates for both OWL2 axioms and expressions.\n\nThis model is intended to closely parallel Structural Specification and Functional-Style Syntax for OWL2 (http://www.w3.org/TR/owl2-syntax).\n\n* Axioms and Declarations are modeled as prolog predicates (e.g. SubClassOf --> subClassOf/2)\n* Class and Property Expressions are modeled as prolog terms. These can be checked via semi-deterministic predicates (e.g. objectIntersectionOf/1)\n* Axiom Annotations are modeled as prolog predicates taking a reified axiom clause head as an argument (axiomAnnotation/3)\n* The names should correspond exactly, with the leading uppercase character substituted for a lowercase (to avoid quoting in prolog) - the one exception is Import, which maps to the prolog predicate ontologyImport/2 (to avoid confusion with prolog import/1)\n* Axioms with variable arguments are modeled as prolog predicates that take prolog lists as arguments (e.g. equivalentClasses/1)\n* For programmatic convenience we provide additional abstract predicates that do not necessarily correspond to the OWL syntax (e.g. property/1,fact/1)\n\n\n---++ Axioms\n\nExtensional predicates are declared for all terminal axiom symbols in the functional syntax;  i.e. subPropertyOf/2, subClassOf/2.\nThese can be directly asserted, or compiled from a prolog file.\n\nThe terms from the OWL2 structural syntax are taken as primitive,\ni.e. they are extensional / unit-clauses, and designed to be asserted\nor compiled.\n\nSome predicates such as property/1 are intensional - these generalize\nover the OWL2 axioms are defined by prolog rules, and should not be\nasserted.  In this case property/1 is defined as annotationProperty/1\nor dataProperty/1 or objectProperty/1.\n\nFor the strong typed model, we also provide intensional predicates\nsuch as subObjectPropertyOf/2 - satisfaction of this predicate is\ndetermined at runtime based on type-checking, if subPropertyOf/2 holds.\n\n\n---++ Expressions and Type checking\n\nOWL Axioms can take either entities or expressions as arguments.\n Entities are simply prolog atoms corresponding to the IRI.\n Expressions are prolog terms;\n e.g. =|intersectionOf(a,someValuesFrom(inverseOf(p),b))|=\n\n (Class expressions are also known as Descriptions)\n\n Optional run-time checking of predicates using valid_axiom/1.\n\n For example =|subClassOf(intersectionOf(c1,c2),unionOf(c3,c4))|= is\n valid if c1,c2,c3,c4 are all class expressions, but\n =|subClassOf(p1,c1)|= is not valid if p1 is a property\n\n We can also make checks for specific types: e.g objectIntersectionOf/1\n\n---++ Annotations\n\n  In OWL Syntax, axiom annotations are written using an optional annotation list argument.\n  We opt not to do this here; instead we use axiomAnnotation/3 where the first argument is the reified predicate head.\n  E.g.\n\n==\nsubClassOf(cat,mammal).\naxiomAnnotation(SubClassOf(cat,mammal),author,linnaeus).\n==\n\n\n  ---++ Ontologies\n\n  We use a similar scheme for annotations:\n\n==\nsubClassOf(cat,mammal).\nontologyAxiom(linnaenTaxonomy,SubClassOf(cat,mammal)).\nontology(linnaenTaxonomy).\n==\n\nTODO: check edge cases, eg two ontologies have the same axioms but different annotations\n\n---++ IRIs\n\nBy default there is no type checking of IRIs, so =|class(polarBear)|=\nis allowed, even though polarBear is not an IRI - this makes for\nconvenience in working with example ontologies.\n\nSee prefix_IRIs/1 in owl2_util.pl for converting between short names\nand valid IRIs.\n\n---+ Open Issues\n\n---++ Enumeration of expressions\n\nWe provide semi-deterministic predicates of the form\n  ?type(+Expression).  Should the mode be extended to allow\n  enumeration of all descriptions/expressions? This would probably\n  require forcing all expressions to be bnodes OR possibly recursively\n  analyzing the term Axiom in a call axiom(Axiom)\n\n---++ Type checking\n\n  Is Tom Schrijvers type checking system going to be integrated into SWI and Yap? Should we use that?\n\n  I am attempting to put as much typing info in the pldoc comments,\n  but unsure of the conventions for complex terms.\n\n  LATEST: see owl2_metamodel.pl\n\n---++ Ontologies\n\n  continue using ontologyAxiom/2? Alternatively use builtin prolog module mechanism..?\n\n---+ See Also\n\n* owl2_from_rdf.pl\n* swrl.pl\n\n---+ Additional Information\n\n@see     README\n@license License\n\n*/\n\n:- use_module(library(debug)).\n:- use_module(library('semweb/rdf_db')).\n:- use_module(library('semweb/rdf_edit')).\n:- use_module(library('semweb/rdfs')).\n:- use_module(library('url')).\n:- use_module(library('http/http_open')).\n:- use_module(library(charsio)).\n\n:- dynamic(owl/4).\n%% blanknode(Node,Description,Used)\n% see owl_get_bnode/2\n% Node - bNodeId\n% Description - prolog term corresponding to owl Description\n% Used - used | shared\n:- dynamic(blanknode/3).\n:- dynamic(outstream/1).\n\n:- dynamic(aNN/3). % implements the ANN(X) function.\n:- dynamic(annotation_r_node/4).  % annotation_r_node(S,P,O,Node)\n:- dynamic(axiom_r_node/4).       % axiom_r_node(S,P,O,Node)\n:- dynamic(owl_repository/2). % implements a simple OWL repository: if URL not found, Ontology is read from a repository (local) RURL\n\n\n% we make this discontiguous so that the code can follow the structure of the document as much as possible\n\n:- discontiguous owl_parse_axiom/3.\n:- discontiguous dothislater/1.\n\n% hookable\n\n\n% -----------------------------------------------------------------------\n%                                UTILITY Predicates\n% -----------------------------------------------------------------------\n\n\n%%       owl_clear_as\n%\n%       Clears the prolog terms that store the Abstract Syntax\n%       implementation of the OWL ontology.\n\nowl_clear_as :-\n        debug(owl_parser,'Clearing abstract syntax',[]),\n        forall((axiompred(PredSpec),predspec_head(PredSpec,Head)),\n               retractall(Head)).\n\npredspec_head(Pred/A,Head) :- functor(Head,Pred,A).\n\nu_assert(Term) :-\n	call(Term), !; assert(Term).\n\n\nconvert(T,V,typed_value(T,V)).\n\n\n%%	rdf_2_owl(+Base, +Ont) is det\n%\n%       Converts RDF triples to OWL/4 triples so that\n%	their use can tracked by the OWL parser.\n\n\nrdf_2_owl(_Base,Ont) :-\n%	debug(owl_parser, 'Removing existing owl triples',[]),\n%	retractall(owl(_,_,_,Ont)),\n%  pengine_self(Self),\n%  pengine_property(Self,module(M)),\n	debug(owl_parser,'Copying RDF triples to OWL triples for Ontology ~w',[Ont]),\n	myrdf(X,Y,Z),\n%	owl_fix_no(X,X1), owl_fix_no(Y,Y1), owl_fix_no(Z,Z1),\n	assert(owl(X,Y,Z,Ont)), fail.\n\nrdf_2_owl(_,Ont) :-\n	owl_count(Ont,Z),\n	debug(owl_parser,'Number of owl triples copied: ~w',[Z]).\n\n\n%%	owl_count(?U).\n%       Returns/Checks the number of unused OWL triples.\n\nowl_count(O,U) :-\n	findall(1,owl(_,_,_,O),X), length(X,U).\n\n%% expand_and_assert(S,P,O) is det\n%\n% adds a owl(S,P,O,not_used) after expanding namespaces.\n% this is required for the triple replacement rules,\n% which use shortened rdfs/owl namespaces.\n% (or we could just use the expanded forms here which\n%  may be faster..)\nexpand_and_assert(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),!,\n	retractall(owl(X,Y,Z, used1)),\n	assert(owl(X,Y,Z, not_used)).\n\n\n%%       test_use_owl(+Triples:list) is nondet\n%\n%       As use_owl/1, but does not consume the triple.  If owl(S,P,O)\n%       in Triples has a non-ground variable then this will succeed\n%       non-deterministically.  If all variables are ground, then this\n%       will succeed semi-deterministically.\ntest_use_owl([]).\ntest_use_owl([owl(S,P,O)|Rest]) :-\n	test_use_owl(S,P,O),\n	test_use_owl(Rest).\n\n\n%%       test_use_owl(?S,?P,?O)\n%	As use_owl/3, but does not consume the triple. Expands the S,P,O.\n%\n%       If any of S, P or O is non-ground then this will succeed\n%       non-deterministically.  If all variables are ground, then this\n%       will succeed semi-deterministically.\ntest_use_owl(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),!,\n	owl(X,Y,Z, not_used).\n\ntest_use_owl(X1,Y1,Z1,named) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__').\n\n\n%%       use_owl(+Triples:list)\n%	Marks a list of OWL triples as used, but only if all match. Expands the S,P,O.\n\nuse_owl(Triples) :-\n        test_use_owl(Triples),\n        use_owl_2(Triples).\n\n% consume all triples; we have already tested the list and know that all match\nuse_owl_2([]).\nuse_owl_2([owl(S,P,O)|Triples]) :-\n        use_owl(S,P,O),\n        use_owl_2(Triples).\n\n\nuse_owl(X1,Y1,Z1) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	debug(owl_parser_detail,'using ~w ~w ~w',[X,Y,Z]),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used1)).\n\nuse_owl(X1,Y1,Z1,named) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__'),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used2)).\n\nuse_owl(X1,Y1,Z1,Term) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	debug(owl_parser_detail,'using ~w ~w ~w',[X,Y,Z]),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used(Term))).\n\n\n%%	use_owl(?S,?P,?O,+Named,Term)\n%\n%       Named = named: Same as use_owl/3, but marks only if S 	is Named URI (i.e. non blank node).\n\nuse_owl(X1,Y1,Z1,named,Term) :-\n	expand_ns(X1,X),\n	expand_ns(Y1,Y),\n	expand_ns(Z1,Z),\n	owl(X,Y,Z, not_used),\n	\\+ sub_string(X,0,2,_,'__'),\n	retract(owl(X,Y,Z, not_used)),\n	assert(owl(X,Y,Z,used(Term))).\n\n\n%%       expand_ns(+NS_URL, ?Full_URL)\n%\n%       Expands a 'namespaced' URI of the form ns:fragment to a full URI\n%       substituting the full expansion for ns from the ns/2 facts\nexpand_ns(NS_URL, Full_URL) :-\n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	uri_split(NS_URL,Short_NS,Term, ':'),\n	rdf_db:ns(Short_NS,Long_NS),!,\n	concat_atom([Long_NS,Term],Full_URL).\n\nexpand_ns(URL, URL).\n\n\n%%       collapse_ns(+FullURL, ?NSURL, +Char, +Options)\n%\n%	Collapses a full URI of the form Path#fragment to a Namespaced\n%	URI NS:fragment substituting the full expansion for ns from\n%	the ns/2 facts\n%	Char is either ':' for normal ns notation or '_' for builing\n%	prolog terms.\n%	Options supported: no_base(ShortNs): Use only term!\n\n\ncollapse_ns(FullURL, NSURL,Char,Options) :-\n	nonvar(FullURL),\n	FullURL \\= literal(_),\n	uri_split(FullURL,LongNS, Term, '#'),\n	concat(LongNS,'#',LongNS1),\n	rdf_db:ns(ShortNS,LongNS1),\n	(   member(no_base(ShortNS),Options), ! , NSURL = Term\n	;\n	concat_atom([ShortNS,Char,Term],NSURL)\n	),!.\n% CJM\ncollapse_ns(FullURL, NSURL,_Char,Options) :-\n	nonvar(FullURL),\n	\\+ FullURL = literal(_),\n	uri_split(FullURL,LongNS, Term, '#'),\n	member(no_base(LongNS),Options),\n        !,\n        NSURL = Term.\n\n\ncollapse_ns(URL, URL,_,_).\n\n\n\n%%       uri_split(+URI,-Namespace,-Term,+Split_Char) is det\n%\n%       Splits a URI into the Namespace and the Term parts\n%       separated by the Split_Char character.\n%       It supposes URI = concat(Namespace,Split_Char,Term)\n\nuri_split(URI,Namespace,Term,Split_Char) :-\n	sub_atom(URI,Start,_,After,Split_Char),\n	sub_atom(URI,0,Start,_,Namespace),\n	Start1 is Start + 1,\n	sub_atom(URI,Start1,After,_,Term).\n\n\n%%       owl_collect_linked_nodes(+Node,+Predicate, +InList,-OutList)\n\n%	Appends Node to the InList, and recursively, all other\n%	Nodes that are linked with the Predicate to the Node. The\n%	result is returned to OutList.\n\nowl_collect_linked_nodes(Node,Predicate,InList,OutList) :-\n	use_owl(Node,Predicate,A),!,\n	owl_collect_linked_nodes(Node,Predicate,InList,List1),\n	owl_collect_linked_nodes(A,Predicate,List1,OutList).\n\nowl_collect_linked_nodes(Node,Predicate,InList,OutList) :-\n	use_owl(A,Predicate,Node),!,\n	owl_collect_linked_nodes(Node,Predicate,InList,List1),\n	owl_collect_linked_nodes(A,Predicate,List1,OutList).\n\nowl_collect_linked_nodes(Node,_,List, [Node|List]) :-\n	\\+ memberchk(Node, List),!.\n\nowl_collect_linked_nodes(_,_,List, List) :- !.\n\n\n% ----------------------------------------------------------------\n%                OWL Parser implementation predicates\n% ----------------------------------------------------------------\n\n\n%%       owl_get_bnode(+Node,+Description)\n%\n%	if Node is a blank (not named) node, then it is asserted in\n%	the database as a blanknode(Node,Description,used) term.\n%	The purpose is to record when a blank node has been used, so\n%	subsequent uses of it will result in structure sharing.\n\nowl_get_bnode(Node,Description) :-\n	sub_string(Node,0,2,_,'__'),!,\n	\\+ blanknode(Node,_,_),\n	assert(blanknode(Node,Description, used)).\n\nowl_get_bnode(_,_).\n\n\n\n% -----------------------------------------------------------------------\n%                                Top Level  Predicates\n% -----------------------------------------------------------------------\n\n/*:- multifile owl2_io:load_axioms_hook/3.\n\nowl2_io:load_axioms_hook(File,owl,Opts) :-\n        owl_parse_rdf(File,Opts).\n\nowl2_io:load_axioms_hook(File,ttl,Opts) :-\n        ensure_loaded(library('semweb/rdf_turtle')),\n        owl_parse_rdf(File,Opts).\n*/\n%% owl_parse_rdf(+File)\n% as owl_parse_rdf/1 with empty Opts\nowl_parse_rdf(F):-\n	owl_parse_rdf(F,[]).\n\n%% owl_parse_rdf(+File,+Opts:list)\n% @param Opts\n%  * imports(ImportFlag:Boolean) if true, follow imports\n%  * clear(Clear) if Clear=complete, clears all axioms in owl2_model\nowl_parse_rdf(F,Opts):-\n	(   member(imports(Imports),Opts)\n	->  true\n	;   Imports=false),\n	(   member(clear(Clear),Opts)\n	->  true\n	;   Clear=false),\n	owl_parse(F,Clear,Clear,Imports),\n	debug(owl_parser,'parsed ~w',[F]).\n\n\n\n\n%% owl_parse(+URL, +RDF_Load_Mode, +OWL_Parse_Mode, +ImportFlag:boolean)\n%\n%  Top level: parse a set of RDF triples and produce an\n%  AS representation of an OWL ontology.\n%\n%	Calls the rdf_load_stream predicate to parse RDF stream in URL.\n%       If RDF_Load_Mode = complete it first retacts all rdf triples.\n%       If ImportFlag = true it handles owl:import clause at RDF level.\n%\n% This implements the mapping defined here:\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\nowl_parse(URL, RDF_Load_Mode, OWL_Parse_Mode,ImportFlag) :-\n	(   RDF_Load_Mode=complete\n	->  rdf_retractall(_,_,_), retractall(rdf_db:rdf_source(_,_,_,_))\n        ;   true),\n	(   OWL_Parse_Mode=complete\n        ->  owl_clear_as,retractall(blanknode(_,_,_)), retractall(owl(_,_,_,_))\n        ;   true),\n        !,\n        debug(owl_parser,'Loading stream ~w',[URL]),\n	owl_canonical_parse_2([URL],URL,ImportFlag,[],ProcessedIRIs),\n        debug(owl_parser,'rdf_db populated, the following IRIs were processed: ~w',[ProcessedIRIs]),\n	owl2_model_init,\n	owl_canonical_parse_3(ProcessedIRIs).\n\n%% owl_canonical_parse_2(+IRIs:list,+ParentIRI,+ImportFlag:boolean,+ProcessedURIsIn:list,?ProcessedURIsOut:list) is det\n% recursively parses all ontologies in IRIs into rdf_db, ensuring none are processed twice.\nowl_canonical_parse_2([],_,_,Processed,Processed) :- !.\n\nowl_canonical_parse_2([IRI|ToProcessRest],Parent,ImportFlag,ProcessedIn,ProcessedOut) :-\n	member(IRI,ProcessedIn),\n        !,\n	owl_canonical_parse_2(ToProcessRest,Parent,ImportFlag,ProcessedIn,ProcessedOut).\n\nowl_canonical_parse_2([IRI|ToProcessRest],Parent,ImportFlag,ProcessedIn,ProcessedOut) :-\n	% Get rdf triples, *Ontology* and Imports\n	rdf_load_stream(IRI,O,BaseURI,Imports),\n	(   nonvar(O)\n        ->  Ont = O\n        ;   Ont = Parent), % in the include case we may need to remove the import...\n        debug(owl_parser,'Commencing rdf_2_owl. Generating owl/4',[]),\n	rdf_2_owl(BaseURI,Ont),  	% move the RDF triples into the owl-Ont/4 facts\n	(   ImportFlag = true\n        ->  owl_canonical_parse_2(Imports,Ont,ImportFlag,[Ont|ProcessedIn],ProcessedIn1)\n        ;   ProcessedIn1=[Ont|ProcessedIn]),\n	owl_canonical_parse_2(ToProcessRest,Parent,ImportFlag,ProcessedIn1,ProcessedOut).\n\n\n%% owl_canonical_parse_3(+IRIs:list) is det\n% translate the current rdf_db into owl2_model axioms.\n% First owl/4 facts are populated, and then these are translated\n% according to:\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\n% (table references refer to this document).\n% we use an intermediate owl/4 database because the mapping\n% is non-monotonic, and triples are 'consumed'\nowl_canonical_parse_3([]).\n\nowl_canonical_parse_3([IRI|Rest]) :-\n	% Remove any existing not used owl fact\n	retractall(owl(_,_,_,not_used)),\n	% Copy the owl facts of the IRI document to the 'not_used'\n	forall(owl(S,P,O,IRI),assert(owl(S,P,O,not_used))),\n\n        debug(owl_parser,'Anon individuals in reification [see table 8]',[]),\n\n\n	collect_r_nodes,\n\n	% First parse the Ontology axiom\n        owl_parse_annotated_axioms(ontology/1),\n\n        debug(owl_parser,'Replacing patterns [see table 5]',[]),\n	% remove triples based on pattern match (Table 5)\n	(   forall((triple_remove(Pattern,Remove), test_use_owl(Pattern)),\n	        forall(member(owl(S,P,O),Remove),use_owl(S,P,O,removed))) -> true ; true),\n\n\n        % temporary fix to make up for bug in rdf parsing\n        % see email to JanW July-1-2009\n        forall((test_use_owl(S,P,BNode),\n                atom(BNode),\n                sub_atom(BNode,0,2,_,'__'),\n                test_use_owl(BNode,'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype',literal(_))),\n               (   use_owl(S,P,BNode,datatype_fix),\n                   use_owl(BNode,'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype',literal(_)),\n                   expand_and_assert(S,P,literal('')))),\n\n	% replace matched patterns (Table 6)\n        debug(owl_parser,'Replacing patterns [see table 6]',[]),\n	(   setof(ReplaceWith,\n                  Pattern^(   triple_replace(Pattern,ReplaceWith), % +Triples:list, ?Triples:list\n                              use_owl(Pattern),\n                              debug(owl_parser,'Replacing ~w ==> ~w [see table 6]',[Pattern,ReplaceWith])),\n                  ReplacementSetList)\n        ->  forall((member(ReplacementSet,ReplacementSetList),member(owl(S,P,O),ReplacementSet)),\n                   expand_and_assert(S,P,O))\n        ;   debug(owl_parser,'No replacements required',[])),\n\n        /*\n	forall(triple_replace(Pattern,ReplaceWith),\n               forall(use_owl(Pattern),\n                      forall(member(owl(S,P,O),ReplaceWith),\n                             (   expand_and_assert(S,P,O),\n                                 debug(owl_parser,'Replacing ~w ==> ~w [see table 6]',[Pattern,owl(S,P,O)]))))),\n        */\n\n	% continue with parsing using the rules...\n	% Table 8, get the set of RIND - anonymous individuals in reification\n	findall(X, (member(Y,['owl:Axiom','owl:Annotation',\n			      'owl:AllDisjointClasses','owl:AllDisljointProperties',\n			      'owl:AllDifferent','owl:NegativePropertyAssertion']),\n                    test_use_owl(X,'rdf:type',Y)\n                   ),\n                RIND),\n	nb_setval(rind,RIND),\n\n        % Table 9, row 5\n	% VV 10/3/2010 get the annotation properties before collecting the annotations.\n        debug(owl_parser,'asserting annotationProperty/1 for all APs',[]),\n	forall( test_use_owl(D,'rdf:type','owl:AnnotationProperty'),\n		assert_axiom(annotationProperty(D))),\n\n        % TODO - make this faster\n        debug(owl_parser,'Implements function ANN(x) 3.2.2 Table 10.',[]),\n	findall(_,ann(_,_),_), % find all annotations, assert annotation(X,AP,AV) axioms.\n\n        debug(owl_parser,'Commencing parse of annotated axioms',[]),\n        forall((axiompred(PredSpec),\\+dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_annotated_axioms(PredSpec)),\n        forall((axiompred(PredSpec),dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_annotated_axioms(PredSpec)),\n\n        debug(owl_parser_detail,'Commencing parse of unannotated axioms',[]),\n        forall((axiompred(PredSpec),\\+dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_nonannotated_axioms(PredSpec)),\n        forall((axiompred(PredSpec),dothislater(PredSpec),\\+omitthis(PredSpec)),\n               owl_parse_nonannotated_axioms(PredSpec)),!,\n	% annotation Assertion\n	parse_annotation_assertions,\n	forall(owl_parse_compatibility_DL(Axiom),assert_axiom(Axiom)),\n	owl_canonical_parse_3(Rest).\n\nrdf_db_to_owl :-\n	owl2_model_init,\n        findall(BaseURI,\n                (   rdf(Ont,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_),\n                    rdf_2_owl(BaseURI,Ont),\n                    owl_canonical_parse_3(IRIs)),\n                IRIs).\n\n%% translate_rdf_db(+IRI)\n% translates a graph in current rdf_db instance into an owl2_model.pl set of facts.\n% assumes that IRI has already been loaded using the semweb package\ntranslate_rdf_db(BaseURI) :-\n        rdf(Ont,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_),\n        !,\n        rdf_2_owl(BaseURI,Ont),\n        owl2_model_init,\n        owl_canonical_parse_3(BaseURI).\n\n\nomitthis(ontology/1).\n\n\nowl_parse_annotated_axioms(Pred/Arity) :-\n        debug(owl_parser_detail,'[ann] Parsing all of type: ~w',[Pred]),\n        functor(Head,Pred,Arity),\n%        forall(owl_parse_axiom(Mod:Head),\n%               (   debug(owl_parser_detail,' parsed: [~w] ~w',[Mod,Head]),\n%                   assert(Mod:Head))).\n	forall(owl_parse_axiom(Head,true,Annotations),\n	       (   assert_axiom(Head),\n	           debug(owl_parser_detail_anns,' parsed: ~w : anns: ~w',[Head,Annotations]),\n		   forall(member(X,Annotations),\n			  forall(aNN(X,AP,AV),\n				 assert_axiom(annotation(Head,AP,AV))\n		          )\n			 )\n	       )\n	      ),\n        debug(owl_parser_detail,'[ann] Done parsing all of type: ~w',[Pred]).\n\nowl_parse_nonannotated_axioms(Pred/Arity) :-\n        debug(owl_parser_detail,'[unann] Parsing all of type: ~w',[Pred]),\n        functor(Head,Pred,Arity),\n	forall(owl_parse_axiom(Head,false,_),\n	       assert_axiom(Head)\n	      ).\n\n\n\n%%       rdf_load_stream(+URL, -Ontology, -BaseURI, -Imports:list) is det\n%\n%	This predicate calls the rdf parser to parse the RDF/XML URL\n%	into RDF triples. URL can be a local file or a URL.\n%	The predicate returns all Imports based on the 	owl:imports predicate.\n%	Also the Ontology of the URL if an owl:Ontology exists, var\n%	otherise.\n%\n%       If owl_repository/2 is defined, then this is used to map URLs\n%       prior to loading.\n\n\nrdf_load_stream(URL,Ontology,BaseURI,Imports) :-\n        owl_repository(URL,RURL),\n        !,\n        % note: users responsibility to avoid infinite loops by avoid cycles in repository mappings!\n        rdf_load_stream(RURL,Ontology,BaseURI,Imports).\n\nrdf_load_stream(URL,Ontology,BaseURI,Imports) :-\n	BaseURI = URL,\n  	(   sub_atom(URL,0,4,_,'http')\n        ->  catch((http_open(URL,RDF_Stream,[]),\n	      rdf_load(RDF_Stream,[if(true),base_uri(BaseURI),blank_nodes(noshare),\n				   result(Action, Triples, MD5),register_namespaces(true)]),\n		   debug(owl_parser,' Loaded ~w stream: ~w Action: ~w Triples:~w MD5: ~w',[URL,RDF_Stream,Action,Triples,MD5]),\n                   close(RDF_Stream)),\n                  Message,\n                  throw(io_error(URL,'rdf_load/2 failed',Message))) % re-throw with more information\n        ;  RDF_Stream = URL, rdf_load(RDF_Stream,[blank_nodes(noshare),if(true),base_uri(BaseURI),register_namespaces(true)])\n	),\n        % collect all imports directives\n	(   rdf(Ontology,'http://www.w3.org/1999/02/22-rdf-syntax-ns#type','http://www.w3.org/2002/07/owl#Ontology',BaseURI:_)\n        ->  findall(I,rdf(Ontology,'http://www.w3.org/2002/07/owl#imports',I,BaseURI:_),Imports)\n	;   Imports = []\n	).\n\n\n\n% ----------------------------------------------------------------\n% 3 Mapping from RDF Graphs to the Structural Specification\n% ----------------------------------------------------------------\n\n/*\n\n  This section specifies the results of steps CP-2.2 and CP-3.3 of the\n  canonical parsing process from Section 3.6 of the OWL 2\n  Specification [OWL 2 Specification] on an ontology document D that\n  can be parsed into an RDF graph G. ...\n\n  */\n\n%       owl_description_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of descriptions for this Node.\n\nowl_description_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_description_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_description(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_description_list(Y,R).\n\n\n%       owl_individual_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of individuals for this Node.\n\nowl_individual_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_individual_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',F,first),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_individual_list(Y,R).\n\n%       owl_property_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of properties for this Node.\n\nowl_property_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_property_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_property_expression(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_property_list(Y,R).\n\n%       owl_datarange_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of dataranges for this Node.\n\nowl_datarange_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_datarange_list(X,[F|R]) :-\n	% use_owl(X,'rdf:type','rdf:List',list), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first),\n	owl_datarange(Element,F),\n	use_owl(X,'rdf:rest',Y,rest),\n	!,owl_datarange_list(Y,R).\n\n%       owl_datatype_restriction_list(+Node, -List)\n%\n%       If +Node is defined as rdf:type rdf:List, then List returns\n%       a prolog list of datatype restrictions for this Node.\n\nowl_datatype_restriction_list('http://www.w3.org/1999/02/22-rdf-syntax-ns#nil',[]) :- !.\n\nowl_datatype_restriction_list(X,[facetRestriction(W2,L)|R]) :-\n	% use_owl(X,'rdf:type','rdf:List'), % this is now removed from graph\n	use_owl(X,'rdf:first',Element,first_datatype_restr),\n	use_owl(Element,W,L,datatype_restr),\n	(   concat_atom([_,W2],'#',W)\n	->  true\n	;   W2=W),\n	use_owl(X,'rdf:rest',Y,rest_datatype_restr),\n	!,owl_datatype_restriction_list(Y,R).\n\n\n% 3.1 Extracting Declarations and the IRIs of the Directly Imported Ontology Documents\n% This section specifies the result of step CP-2.2 of the canonical parsing process on an RDF graph G\n\n\n% 3.1.2 Parsing of the Ontology Header and Declarations\n\n%  Table 4.\nowl_parse_axiom(ontology(O),AnnMode,List) :-\n        test_use_owl(O,'rdf:type','owl:Ontology'),\n	\\+ test_use_owl([owl(U,_W,O),owl(U,'rdf:type','owl:Ontology')]),\n	valid_axiom_annotation_mode(AnnMode,O,'rdf:type','owl:Ontology',List),\n        use_owl(O,'rdf:type','owl:Ontology',ontology),\n        nb_setval(current_ontology,O),\n	forall(use_owl(O,'owl:imports',IRI,ontology_import), assert_axiom(ontologyImport(O,IRI))),\n	forall(use_owl(O,'owl:versionInfo',IRI2,ontology_version_info), assert_axiom(ontologyVersionInfo(O,IRI2))),!. % Do Once\n\n\n% See table 5.\n% triple_remove(Pattern:list,Remove:list)\n% if Pattern is present, remove triples in Remove\ntriple_remove([owl(X,'rdf:type','owl:Ontology')],[owl(X,'rdf:type','owl:Ontology')]).\ntriple_remove([owl(X,'rdf:type','owl:Class'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','rdfs:Datatype'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:DataRange'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:Restriction'),owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','rdfs:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:Restriction'),owl(X,'rdf:type','owl:Class')],[owl(X,'rdf:type','owl:Class')]).\ntriple_remove([owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:FunctionalProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:InverseFunctionalProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:TransitiveProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:DatatypeProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:AnnotationProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','owl:OntologyProperty'),owl(X,'rdf:type','rdf:Property')],[owl(X,'rdf:type','rdf:Property')]).\ntriple_remove([owl(X,'rdf:type','rdf:List'),owl(X,'rdf:first',_Y),owl(X,'rdf:rest',_Z)],[owl(X,'rdf:type','rdf:List')]).\n/*\n   triple_remove([owl(X,'rdf:type','owl:Thing')],[owl(X,'rdf:type','owl:Thing')]).\n*/\n% See table 6.\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\ntriple_replace([owl(X,'rdf:type','owl:OntologyProperty')],[owl(X,'rdf:type','owl:AnnotationProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:InverseFunctionalProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:InverseFunctionalProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:TransitiveProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:TransitiveProperty')]).\ntriple_replace([owl(X,'rdf:type','owl:SymmetricProperty')],[owl(X,'rdf:type','owl:ObjectProperty'),owl(X,'rdf:type','owl:SymmetricProperty')]).\n\n% NOTE: this is not specified in table 6. However, we treat rdfs:Classes as equivalent to owl:Classes\ntriple_replace([owl(X,'rdf:type','rdfs:Class')],[owl(X,'rdf:type','owl:Class')]).\n\n% DECLARATIONS\n%\n% See table 7.\n% http://www.w3.org/TR/2008/WD-owl2-mapping-to-rdf-20081202/\n\n%% owl_parse_axiom(+AxiomSpec,+AnnMode:boolean,?AnnList:list) is det\n%\n% None\n%\nowl_parse_axiom(class(C),AnnMode,List) :-\n	test_use_owl(C,'rdf:type','owl:Class'),\n	valid_axiom_annotation_mode(AnnMode,C,'rdf:type','owl:Class',List),\n        (   use_owl(C,'rdf:type','owl:Class',named,class(C)) -> true ; use_owl(C,'rdf:type','rdfs:Class',named,class(C))),\n	\\+ class(C).\n\n\nowl_parse_axiom(datatype(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','rdf:Datatype'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:Datatype',List),\n        use_owl(D,'rdf:type','rdf:Datatype',datatype(D)).\n\n\nowl_parse_axiom(objectProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:ObjectProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','owl:ObjectProperty',List),\n        use_owl(D,'rdf:type','owl:ObjectProperty',objectProperty(D)),\n	\\+ objectProperty(D).\n\n\n% note the difference in names between syntax and rdf\nowl_parse_axiom(dataProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:DatatypeProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:DatatypeProperty',List),\n        use_owl(D,'rdf:type','owl:DatatypeProperty',dataProperty(D)),\n	\\+ dataProperty(D).\n\nowl_parse_axiom(annotationProperty(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:AnnotationProperty'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:AnnotationProperty',List),\n        use_owl(D,'rdf:type','owl:AnnotationProperty',annotationProperty(D)),\n	\\+ annotationProperty(D).\n\n\n% TODO: check this. do we need to assert individual axioms if all we have is an rdf:type?\nowl_parse_axiom(namedIndividual(D), AnnMode, List) :-\n        test_use_owl(D,'rdf:type','owl:NamedIndividual'),\n        valid_axiom_annotation_mode(AnnMode,D,'rdf:type','rdf:NamedIndividual',List),\n        use_owl(D,'rdf:type','owl:NamedIndividual',namedIndividual(D)).\n\n\n% Table 8. Identifying Anonymous Individuals in Reification\n% TODO\n\n\n% 3.2 Populating an Ontology\n\n\n% 3.2.1 Analyzing Declarations\n\n% 3.2.2 Parsing of Annotations\n\n%\n%       ann(?X, -Extension List)\n%\n%       Implements function ANN(x) 3.2.2 Table 10\n%\n%     The annotations in G are parsed next. The function ANN assigns a\n%     set of annotations ANN(x) to each IRI or blank node x. This\n%     function is initialized by setting ANN(x) = รข.. for each each IRI\n%     or blank node x. Next, the triple patterns from Table 10 are\n%     matched in G and, for each matched pattern, ANN(x) is extended\n%     with an annotation from the right column. Each time one of these\n%     triple patterns is matched, the matched triples are removed from\n%     G. This process is repeated until no further matches are\n%     possible\n\nann(X,Y) :-\n	ann(X,X,Y).\n\n\n\nann(X,X1, annotation(X1,Y,Z)) :-\n	annotationProperty(Y),\n        debug(owl_parser_detail,'annotation property: ~w',[Y]),\n        owl(X,Y,Z,not_used),\n        use_owl(X,Y,Z,annotationProperty(Y)),\n	u_assert(aNN(X1,Y,Z)),\n	ann2(X,Y,Z,X1).\n\n\nann2(X,Y,Z,X1) :-\n	annotation_r_node(X,Y,Z,W),\n	ann(W,annotation(X1,Y,Z),Term),\n        u_assert(Term).\n\nann2(X,Y,Z,X1) :-\n	axiom_r_node(X,Y,Z,W),\n	ann(W,annotation(X1,Y,Z),Term),\n        u_assert(Term).\n\n\nann2(_,_,_,_).\n\n\n% 3.2.4 Parsing of Expressions\n\nis_bnode(C) :-\n	atom(C),\n	sub_atom(C,0,2,_,'__').\n\n\n	% Table 11. Parsing Object Property Expressions\nowl_property_expression(C,C) :-\n	\\+ is_bnode(C), % better: IRI(C).\n	% VV added 10/3/2011\n	C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#first',\n	C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',\n        !.\n\nowl_property_expression(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	    true).\n\nowl_property_expression(P,inverseOf(Q)) :-\n        use_owl(P,'owl:inverseOf',Q,inverseof(P,Q)),\n        owl_get_bnode(P,inverseOf(Q)).\n\n\n% Table 12. Parsing of Data Ranges\n\nowl_datarange(D,D) :-\n	\\+ is_bnode(D),!.  % better: IRI(C).\n\nowl_datarange(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	true).\n\nowl_datarange(D,intersectionOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:intersectionOf',Y,datarange(D)),\n	%print(D-inter-Y),nl,\n        owl_datarange_list(Y,L),\n	owl_get_bnode(D,intersectionOf(L)).\n\nowl_datarange(D,unionOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:unionOf',Y,datarange(D)),\n        owl_datarange_list(Y,L),\n	owl_get_bnode(D,unionOf(L)).\n\n\nowl_datarange(D,complementOf(DY)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',dataRange(D)),\n	use_owl(D,'owl:datatypeComplementOf',Y,datacomplement(D)),\n        owl_datarange(Y,DY),\n	owl_get_bnode(D,complementOf(DY)).\n\n% Table 14, case 2\n owl_datarange(D,complementOf('rdfs:Literal')) :-\n	use_owl(D,'rdf:type','rdfs:DataRange',dataRange(D)),\n	use_owl(D,'owl:oneOf',[],oneOf(D)),\n	owl_get_bnode(D,complementOf('rdfs:Literal')).\n\nowl_datarange(D,oneOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',dataType(D)),\n	use_owl(D,'owl:oneOf',L1,oneOf(D)),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)).\n\n% Table 14, case 1\nowl_datarange(D,oneOf(L)) :-\n	use_owl(D,'rdf:type','rdfs:DataRange',datarange(D)),\n	use_owl(D,'owl:oneOf',L1,datarange(D)),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)).\n\n\nowl_datarange(D,datatypeRestriction(DY,L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datarange(D)),\n	use_owl(D,'owl:onDatatype',Y,datarange(D)),\n	owl_datarange(Y,DY),\n	use_owl(D,'owl:withRestrictions',L1,datarange(D)),\n	owl_datatype_restriction_list(L1,L),\n	owl_get_bnode(D,datatypeRestriction(DY,L)).\n\n% Table 13. Parsing of Class Expressions\n\n% ----------------------------------------------------------------------\n%       owl_description(+Node,-Description).\n%\n%	It implements OWL AS production rules for Descriptions.\n%         During the construction of the Description any blank node\n%         is recorded for later structure sharing checks.\n\nowl_description(C,C) :-\n	\\+ is_bnode(C),!. % better: IRI(C).\n\n\nowl_description(C,D) :-\n	blanknode(C,D,Use),\n	(   Use = used,\n	    retractall(blanknode(C,D,used)),\n	    assert(blanknode(C,D,shared))\n	;\n	    true),!.\n\n% TODO: this leaves behind classAssertions of type owlClass for the bnodes\nowl_description(D,intersectionOf(L)) :-\n	use_owl(D,'owl:intersectionOf',L1,intersectionOf(D)),\n	owl_description_list(L1,L),\n	\\+L = [],\n	owl_get_bnode(D,intersectionOf(L)),!.\n\nowl_description(D,unionOf(L)) :-\n	use_owl(D,'owl:unionOf',L1,union(D)),\n	owl_description_list(L1,L),\n	owl_get_bnode(D,unionOf(L)),!.\n\n\nowl_description(D,complementOf(Descr)) :-\n	use_owl(D,'owl:complementOf',D1,complementOf(D)),\n	owl_description(D1,Descr),\n	owl_get_bnode(D,complementOf(Descr)),!.\n\nowl_description(D,oneOf(L)) :-\n	use_owl(D,'owl:oneOf',L1,oneOf(D)),\n	(   use_owl(D,'rdf:type','owl:Class',oneOf(D,L)) ; true),\n	owl_individual_list(L1,L),\n	owl_get_bnode(D,oneOf(L)),!.\n\nowl_description(D,datatypeRestriction(DY,L)) :-\n	use_owl(D,'rdf:type','rdfs:Datatype',datatypeRestr(D)),\n	use_owl(D,'owl:onDatatype',Y,dataType(D)),\n	owl_datarange(Y,DY),\n	use_owl(D,'owl:withRestrictions',L1,withRestrictions(D)),\n	owl_datatype_restriction_list(L1,L),\n	owl_get_bnode(D,datatypeRestriction(DY,L)).\n\nowl_description(D,Restriction) :-\n	owl_restriction(D, Restriction),\n	owl_get_bnode(D,Restriction),!.\n\n\n% Table 15 - OWL DL compatibility class expressions\n%\nowl_description(D,Result) :-\n	\\+ is_bnode(D), % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',description(D)),\n	use_owl(D,'owl:unionOf',L,unionOf(L)),\n	owl_description_list(L,DL),\n	(   DL = [], Result = 'owl:Nothing' ;\n	    DL = [D1], Result = D1),\n	owl_get_bnode(D,Result),!.\n\nowl_description(D,Result) :-\n	\\+ is_bnode(D), % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',dl_compatibility_descr(D)),\n	use_owl(D,'owl:intersectionOf',L,intersectionOf(D)),\n	owl_description_list(L,DL),\n	(   DL = [], Result = 'owl:Thing' ;\n	    DL = [D1], Result = D1),\n	owl_get_bnode(D,Result),!.\n\nowl_description(D,Result) :-\n	\\+ is_bnode(D),!, % better: IRI(C).\n	use_owl(D,'rdf:type','owl:Class',dl_compatibility_descr(D)),\n	use_owl(D,'owl:oneOf',[],oneOf(D)),\n	Result = 'owl:Nothing',\n	owl_get_bnode(D,Result).\n\n% support older deprecated versions of OWL2 spec. See for example hydrology.owl\nonClass(E,D) :- use_owl(E,'http://www.w3.org/2006/12/owl2#onClass',D,onClass(E)).\nonClass(E,D) :- use_owl(E,'owl:onClass',D,onClass(E)).\n\nonDataRange(E,D) :- use_owl(E, 'owl:onDataRange',D,onDatarange(E)).\n\n\n%       owl_restriction(+Element,-Restriction).\n%\n%       If Element is defined as a owl:Restriction on property P then\n%       Restriction binds to a restriction(Property,Type) term,\n%	according to OWL Abstract syntax specification.\n\nowl_restriction(Element,Restriction) :-\n	use_owl(Element,'rdf:type','owl:Restriction',restriction(Element)),\n	(   use_owl(Element, 'owl:onProperty',PropertyID,onProperty(Element,PropertyID)) ;\n    	    use_owl(Element, 'owl:onProperties',PropertyID,onProperties(Element,PropertyID))\n	),\n	owl_restriction_type(Element,PropertyID, Restriction),\n        debug(owl_parser_detail,'Restriction: ~w',[Restriction]).\n\n\n\nowl_restriction_type(E, P, someValuesFrom(PX, DX)) :-\n	use_owl(E, 'owl:someValuesFrom',D,someValuesFrom(E,P)),\n	(   owl_description(D, DX) ; owl_datarange(D,DX)),\n        (   P = [_|_], owl_property_list(P,PX) ;  owl_property_expression(P, PX)).\n\n\nowl_restriction_type(E, P, allValuesFrom(PX,DX)) :-\n	use_owl(E, 'owl:allValuesFrom',D,allValuesFrom(E,P)),\n	(   owl_description(D, DX) ; owl_datarange(D,DX)),\n        (   P = [_|_], owl_property_list(P,PX) ;  owl_property_expression(P, PX)).\n\n\n% changed from thea value-->hasValue\nowl_restriction_type(E, P, hasValue(PX,Value)) :-\n	use_owl(E, 'owl:hasValue',Value,hasValue(E)),\n        owl_property_expression(P, PX).\n\n% VV:check if RDF parser returns a triple with O=true for\nowl_restriction_type(E, P, hasSelf(PX)) :-\n	use_owl(E, 'owl:hasSelf', true,hasSelf(E)),\n        owl_property_expression(P, PX).\n\n% Support of deprecated translations:\n% in the OWL2 RDF mapping, unqualified CRs use owl:{min,max}Cardinality\n% and QCQs use owl:{min,ax}QualifiedCardinality\n%\n% however, there appear to be some ontologies; e.g. Hydrology.owl.\n% that use an older mapping, where the same properties are used\n% for QCR and unqCR\n%\n% it is relatively easy to support this legacy ontologies; however\n% we must process these BEFORE unqualified cardinality restrictions.\n\nowl_restriction_type(E, P, exactCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:cardinality',Lit),\n        onClass(E,D),\n	owl_description(D, DX),!,\n	use_owl(E, 'owl:cardinality',Lit,cardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, minCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:minCardinality',Lit),\n        (   onClass(E,D),owl_description(D, DX)\n        ;   onDataRange(E,D), owl_datarange(D,DX)),\n	!,\n        % we are sure this is an old-style unqualified CR - now consume triples\n	use_owl(E, 'owl:minCardinality',Lit,minCardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, maxCardinality(N,PX,DX)) :-\n	test_use_owl(E, 'owl:maxCardinality',Lit),\n        (   onClass(E,D),owl_description(D, DX)\n        ;   onDataRange(E,D), owl_datarange(D,DX)),\n	!,\n        % we are sure this is an old-style unqualified CR - now consume triples\n	use_owl(E, 'owl:maxCardinality',Lit,maxCard(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\n% END OF Support of deprecated translations:\n\n% the following are all in the spec:\n\n% changed from Thea1->2: cardinality->exactCardinality\nowl_restriction_type(E, P,exactCardinality(N,PX)) :-\n	use_owl(E, 'owl:cardinality',Lit,cardinality(E)),\n        literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P,exactCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:qualifiedCardinality',Lit),literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX) ;\n	    onDataRange(E,D), owl_datarange(D,DX)\n	),\n        owl_property_expression(P, PX).\n\n\nowl_restriction_type(E, P, minCardinality(N,PX)) :-\n	use_owl(E, 'owl:minCardinality',Lit,cardinality(E)),literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, minCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:minQualifiedCardinality',Lit,cardinality(E)),literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX);\n	    onDataRange(E,D), owl_datarange(D,DX)\n	),\n        owl_property_expression(P, PX).\n\n\nowl_restriction_type(E, P, maxCardinality(N,PX)) :-\n	use_owl(E, 'owl:maxCardinality',Lit,maxCardinality(E)),literal_integer(Lit,N),\n        owl_property_expression(P, PX).\n\nowl_restriction_type(E, P, maxCardinality(N,PX,DX)) :-\n	use_owl(E, 'owl:maxQualifiedCardinality',Lit,cardinality(E,Lit)),\n	literal_integer(Lit,N),\n	(   onClass(E,D),owl_description(D, DX);\n	    onDataRange(E,D), owl_datarange(D,DX)),\n        owl_property_expression(P, PX).\n\n\n% Table 14. Parsing of Data Ranges for Compatibility with OWL DL\n% Included into owl_datarange clauses above\n\n% Table 15. Parsing of Class Expressions for Compatibility with OWL DL\n% Included into owl_dexcription clauses above\n\n% Table 16. Parsing of Axioms without Annotations\n% Declarations handled previously\n% CLASS AXIOMS\n% valid_axiom_annotation_mode: add clauses for the disjoint etc ....\n\ncollect_r_nodes :-\n	retractall(axiom_r_node(_,_,_,_)),\n	forall(( test_use_owl(Node,'rdf:type','owl:Axiom'),\n		 test_use_owl(Node,'owl:annotatedSource',S),\n		 test_use_owl(Node,'owl:annotatedProperty',P),\n		 test_use_owl(Node,'owl:annotatedTarget',O)),\n	       (assert(axiom_r_node(S,P,O,Node)),\n                debug(owl_parser_detail,'~w',[axiom_r_node(S,P,O,Node)]),\n		use_owl([owl(Node,'rdf:type','owl:Axiom'),\n			 owl(Node,'owl:annotatedSource',S),\n			 owl(Node,'owl:annotatedProperty',P),\n			 owl(Node,'owl:annotatedTarget',O)]))),\n\n	retractall(annotation_r_node(_,_,_,_)),\n	forall(( test_use_owl(W,'rdf:type','owl:Annotation'),\n		 test_use_owl(W,'owl:annotatedSource',S),\n		 test_use_owl(W,'owl:annotatedProperty',P),\n		 test_use_owl(W,'owl:annotatedTarget',O)),\n	       (assert(annotation_r_node(S,P,O,Node)),\n                debug(owl_parser_detail,'~w',[annotation_r_node(S,P,O,Node)]),\n		use_owl([owl(W,'rdf:type','owl:Annotation'),\n			 owl(W,'owl:annotatedSource',S),\n			 owl(W,'owl:annotatedProperty',P),\n			 owl(W,'owl:annotatedTarget',O)]))).\n\n%% valid_axiom_annotation_mode(+AnnMode,+S,+P,+O,?AnnotationNodes:list) is det\n% if AnnMode is true and annotation triples can be found then\n% unify AnnotationNodes with the Nodes that annotate the triple,\n% otherwise []\n\nvalid_axiom_annotation_mode(_Mode,S,P,O,List) :-\n        expand_ns(P,PE),\n        findall(Node,axiom_r_node(S,PE,O,Node),List).\n\n\nowl_parse_axiom(subClassOf(DX,DY),AnnMode,List) :-\n	test_use_owl(X,'rdfs:subClassOf',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'rdfs:subClassOf',Y,List),\n	use_owl(X,'rdfs:subClassOf',Y,subclassOf(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% Process each equivalentClass pair separately in order to capture\n% annotations. Block the maximally connected subgraph.\n% TODO. Process the equivalent(L) axioms to generate maximally connected\n% equivalentClasses(L) axioms. (but without annotations?)\n\nowl_parse_axiom(equivalentClasses(DL),AnnMode,List) :-\n	test_use_owl(X,'owl:equivalentClass',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:equivalentClass',Y,List),\n	use_owl(X,'owl:equivalentClass',Y,equivalentClass(X,Y)),\n        % maximally_connected_subgraph_over('owl:equivalentClass',L),\n        maplist(owl_description,[X,Y],DL),\n        debug(owl_parser_detail,'equivalentClasses Descs: ~w',[DL]).\n\n\nowl_parse_axiom(equivalentClasses([C,intersectionOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:intersectionOf',D1),\n	debug(owl_parser,'equivalent collection; intersection for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:intersectionOf',D1,List),\n	owl_description(C,intersectionOf(D)).\n\nowl_parse_axiom(equivalentClasses([C,unionOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:unionOf',D1),\n	debug(owl_parser,'equivalent collection; union for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:unionOf',D1,List),\n	owl_description(C,unionOf(D)).\n\nowl_parse_axiom(equivalentClasses([C,oneOf(D)]),AnnMode,List) :-\n	class(C),\n	test_use_owl(C,'owl:oneOf',D1),\n	debug(owl_parser,'equivalent collection; one of for ~w',[C]),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:oneOf',D1,List),\n	owl_description(C,oneOf(D)).\n\n\nowl_parse_axiom(equivalentClasses([C,D])) :-\n        % TODO: this could be made more efficient by enforcing order of building\n        (   test_use_owl(C,'rdf:type','owl:Class',named)\n        ;   test_use_owl(C,'rdf:type','rdfs:Class',named)\n        ;   class(C)),\n        owl_description(C,D),\n        C\\=D.\n\n% TODO. Process the disjointClasses(L) axioms to generate\n% larger set of disjoint: ie if N classes are pairwise DisJoint\n% then we can assert a disjointClasses for all N\n\nowl_parse_axiom(disjointClasses([DX,DY]),AnnMode,List) :-\n	test_use_owl(X,'owl:disjointWith',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:disjointWith',Y,List),\n	use_owl(X,'owl:disjointWith',Y,disjointWith(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% One of the cases where annotations are those of _x and we do not seek\n% for further annotation axioms. Par. 3.2.5.\n% Whatever the AnnNode, _x is returned (will be ignored if mode false\n\nowl_parse_axiom(disjointClasses(L),_AnnMode,[X]) :-\n        % TODO: X may be referred to in an annotation axiom??\n	use_owl(X,'rdf:type','owl:AllDisjointClasses',allDisjointClasses(X)),\n        use_owl(X,'owl:members',L1,members(L1)),\n        owl_description_list(L1,L).\n\n\nowl_parse_axiom(disjointUnion(DX,DY),AnnMode,List) :-\n	test_use_owl(X,'owl:disjointUnionOf',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:disjointUnionOf',Y,List),\n	use_owl(X,'owl:disjointUnionOf',Y,disjointUnionOf(X,Y)),\n        owl_description(X,DX),\n        owl_description_list(Y,DY).\n\n\n% PROPERTY AXIOMS\n\n\n% introduces bnode\nowl_parse_axiom(subPropertyOf(propertyChain(PL),QX),AnnMode,List) :-\n	test_use_owl(Q,'owl:propertyChainAxiom',L1),\n	valid_axiom_annotation_mode(AnnMode,Q,'owl:propertyChainAxiom',L1,List),\n	use_owl(Q,'owl:propertyChainAxiom',L1,propertyChainAxiom(Q)),\n	owl_property_list(L1,PL),\n        owl_property_expression(Q,QX).\n\nowl_parse_axiom(subPropertyOf(PX,QX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:subPropertyOf',Q),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:subPropertyOf',Q,List),\n	use_owl(P,'rdfs:subPropertyOf',Q,subPropertyOf(P,Q)),\n        owl_property_expression(P,PX),\n        owl_property_expression(Q,QX).\n\n\n% Process each equivalentProperty pair separately in order to capture\n% annotations. Block the maximally connected subgraph.\n% TODO. Process the equivalent(L) axioms to generate maximally connected\n% equivalentProperties(L) axioms. (but without annotations?)\n\nowl_parse_axiom(equivalentProperties(OPEL),AnnMode,List) :-\n	test_use_owl(X,'owl:equivalentProperty',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:equivalentProperty',Y,List),\n	use_owl(X,'owl:equivalentProperty',Y,equivProperty(X,Y)),\n	% maximally_connected_subgraph_over('owl:equivalentProperty',L),\n	maplist(owl_property_expression,[X,Y],OPEL).\n\n\n% TODO. Process the disjointProperties(L) axioms to generate\n% larger set of disjoint: ie if N properties are pairwise DisJoint\n% then we can assert a disjointClasses for all N\n\nowl_parse_axiom(disjointProperties([DX,DY]),AnnMode,List) :-\n	test_use_owl(X,'owl:propertyDisjointWith',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:propertyDisjointWith',Y,List),\n	use_owl(X,'owl:propertyDisjointWith',Y,propertyDisjointWith(X,Y)),\n        owl_description(X,DX),\n	owl_description(Y,DY).\n\n% One more of the cases where annotations are those of _x and we do not\n% seek for further annotation axioms. Par. 3.2.5. Whatever the AnnNode,\n% _x is returned (will be ignored if mode false)\n\nowl_parse_axiom(disjointProperties(L),_AnnMode,[X]) :-\n        % TODO: X may be referred to in an annotation axiom??\n	use_owl(X,'rdf:type','owl:AllDisjointProperties',allDisjointProps(X,L1)),\n        use_owl(X,'owl:members',L1,members(L1)),\n        L1 = [_,_|_],           % length >= 2\n        owl_property_list(L1,L).\n\n\nowl_parse_axiom(propertyDomain(PX,CX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:domain',C),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:domain',C,List),\n        use_owl(P,'rdfs:domain',C,domain(P,C)),\n	(   annotationProperty(P),CX = C ;\n	    owl_property_expression(P,PX),\n	    owl_description(C,CX)\n	).\n\n% We need to distinguish here between object and data property\n% Currently we first test if the range is a class, this means OPE\n% otherwise if it is a datarange it means a DPE.\n% Ideally we should also check possible declarations of OPE or DPE.\n\nowl_parse_axiom(propertyRange(PX,CX),AnnMode,List) :-\n	test_use_owl(P,'rdfs:range',C),\n	valid_axiom_annotation_mode(AnnMode,P,'rdfs:range',C,List),\n        use_owl(P,'rdfs:range',C,range(P,C)),\n	(   annotationProperty(P) -> PX = P, CX = C ;\n	    owl_property_expression(P,PX),\n            (   owl_description(C,CX) -> true ; owl_datarange(C,CX))\n	).\n\nowl_parse_axiom(inverseProperties(PX,QX),AnnMode,List) :-\n	test_use_owl(P,'owl:inverseOf',Q),\n	valid_axiom_annotation_mode(AnnMode,P,'owl:inverseOf',Q,List),\n	use_owl(P,'owl:inverseOf',Q,inverseOf(P,Q)),\n        owl_property_expression(P,PX),\n        owl_property_expression(Q,QX).\n\nowl_parse_axiom(functionalProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:FunctionalProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:FunctionalProperty',List),\n        use_owl(P,'rdf:type','owl:FunctionalProperty',functionalProperty(P)).\n\nowl_parse_axiom(inverseFunctionalProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:InverseFunctionalProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:InverseFunctionalProperty',List),\n        use_owl(P,'rdf:type','owl:InverseFunctionalProperty',inverseFunctionalProperty(P)).\n\nowl_parse_axiom(reflexiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:ReflexiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:ReflexiveProperty',List),\n        use_owl(P,'rdf:type','owl:ReflexiveProperty',reflexiveProperty(P)).\n\nowl_parse_axiom(irreflexiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:IrreflexiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:IrreflexiveProperty',List),\n        use_owl(P,'rdf:type','owl:IrreflexiveProperty',irreflexiveProperty(P)).\n\nowl_parse_axiom(symmetricProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:SymmetricProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:SymmetricProperty',List),\n        use_owl(P,'rdf:type','owl:SymmetricProperty',symmetricProperty(P)).\n\nowl_parse_axiom(asymmetricProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:AsymmetricProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:AsymmetricProperty',List),\n        use_owl(P,'rdf:type','owl:AsymmetricProperty',assymetricProperty(P)).\n\nowl_parse_axiom(transitiveProperty(P),AnnMode,List) :-\n	test_use_owl(P,'rdf:type','owl:TransitiveProperty'),\n	valid_axiom_annotation_mode(AnnMode,P,'rdf:type','owl:TransitiveProperty',List),\n	use_owl(P,'rdf:type','owl:TransitiveProperty',transitiveProperty(P)).\n\nowl_parse_axiom(hasKey(CX,L),AnnMode,List) :-\n	test_use_owl(C,'owl:hasKey',L1),\n	valid_axiom_annotation_mode(AnnMode,C,'owl:hasKey',L1,List),\n	use_owl(C,'owl:hasKey',L1,hasKey(C)),\n	owl_description(C,CX),\n        L1 = [_,_|_],           % length >= 2\n        owl_property_list(L1,L).\n\n% INDIVIDUALS\n\nowl_parse_axiom(sameIndividual([X,Y]),AnnMode,List) :-\n	test_use_owl(X,'owl:sameAs',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:sameAs',Y,List),\n	use_owl(X,'owl:sameAs',Y,sameAs(X,Y)).\n\nowl_parse_axiom(differentIndividuals([X,Y]),AnnMode,List) :-\n	test_use_owl(X,'owl:differentFrom',Y),\n	valid_axiom_annotation_mode(AnnMode,X,'owl:differentFrom',Y,List),\n	use_owl(X,'owl:differentFrom',Y,differentFrom(X,Y)).\n\nowl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-\n	use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(L)),\n	use_owl(X,'owl:distinctMembers',L1,distinctMembers(L)),\n        owl_individual_list(L1,L).\n\nowl_parse_axiom(differentIndividuals(L),_AnnMode,[X]) :-\n	use_owl(X,'rdf:type','owl:AllDifferent',allDifferent(X)),\n	use_owl(X,'owl:members',L1,members(L)),\n        owl_individual_list(L1,L).\n\n% make sure this is done before fetching classAssertion/2;\n% -- the annotationAssertion matching clause should preceded the classAssertion/2 matching clause\nowl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-\n	test_use_owl(X, 'rdf:type', 'owl:DeprecatedClass'),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedClass',List),\n	use_owl(X, 'rdf:type', 'owl:DeprecatedClass',deprecatedClass(X)).\n\n% make sure this is done before fetching propertyAssertion/3\n% this clause should precede it\nowl_parse_axiom(annotationAssertion('owl:deprecated', X, true),AnnMode,List) :-\n	test_use_owl(X, 'rdf:type', 'owl:DeprecatedProperty'),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type','owl:DeprecatedProperty',List),\n	use_owl(X, 'rdf:type', 'owl:DeprecatedProperty',deprecatedProperty(X)).\n\n% Table 17. Parsing of Annotated Axioms\n\ndothislater(annotationAssertion/3).\n% TODO - only on unnannotated pass?\n%\n\nowl_parse_axiom(annotationAssertion(P,A,B),AnnMode,List) :-\n        annotationProperty(P),\n        test_use_owl(A,P,B),         % B can be literal or individual\n        valid_axiom_annotation_mode(AnnMode,A,P,B,List),\n        use_owl(A,P,B,annotationProperty(P)).\n\n\ndothislater(classAssertion/2).\nowl_parse_axiom(classAssertion(CX,X),AnnMode,List) :-\n	test_use_owl(X,'rdf:type',C),\n        C\\='http://www.w3.org/2002/07/owl#DeprecatedClass',\n	% note: some ontologies may include a rdf:type with no\n	%  explicit class declaration. See testfiles/test_undeclared.owl\n	%class(C),\n	valid_axiom_annotation_mode(AnnMode,X,'rdf:type',C,List),\n	use_owl(X,'rdf:type',C,classAssertion(CX,X)),\n        % I added this to avoid class assertions for bNodes. Perhaps a better\n        % way is to simply consume the owl4/ triple at the time of translating\n        % the description? --CJM\n        C\\='http://www.w3.org/2002/07/owl#Class',\n        %\n        C\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#Property',\n        owl_description(C,CX).\n\ndothislater(propertyAssertion/3).\nowl_parse_axiom(propertyAssertion(PX,A,BX),AnnMode,List) :-\n        test_use_owl(A,P,B), % B can be literal or individual\n        P\\='http://www.w3.org/1999/02/22-rdf-syntax-ns#type',\n	% note: some ontologies may include a triples with no\n	%  explicit property declaration. See testfiles/test_undeclared.owl\n	%property(P),\n	valid_axiom_annotation_mode(AnnMode,A,P,B,List),\n        \\+ annotationProperty(P), % these triples should have been removed before, during ann parsing\n	owl_property_expression(P,PX), % can also be inverse\n	% next line added by VV 9/3/2011 for Jochem Liem to support ID-lists as PA objects\n	(   owl_individual_list(B,BX) -> true ; BX = B),\n        use_owl(A,P,B,propertyAssertion(PX,A,BX)).\n\n\nowl_parse_axiom(negativePropertyAssertion(PX,A,B),_,X) :-\n        use_owl(X,'rdf:type','owl:NegativePropertyAssertion',negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:sourceIndividual',A,negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:assertionProperty',P,negPropertyAssertion(PX,A,B)),\n        use_owl(X,'owl:targetValue',B,negPropertyAssertion(PX,A,B)),\n        owl_property_expression(P,PX).\n\n\n% process hooks; SWRL etc\n\n% Parsing annotationAssertions\n%\n\nparse_annotation_assertions :-\n	( nb_current(rind,RIND) -> true ; RIND = []),!,\n	forall((aNN(X,AP,AV),findall( aNN(annotation(X,AP,AV),AP1,AV1),\n				      aNN(annotation(X,AP,AV),AP1,AV1),ANN), \\+member(X,RIND), \\+name(X,[95, 95, 68, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110|_])),\n	       (   assert_axiom(annotationAssertion(AP,X,AV)),\n		  %  VV 10/3/2010 keep annotation/3\n		  % retract(annotation(X,AP,AV)),\n		   forall(member(aNN(_,AP1,AV1),ANN),\n			    assert_axiom(annotation(annotationAssertion(AP,X,AV),AP1,AV1))\n			 )\n	       )\n	      ),\n	% forall(aNN(X,Y,Z),assert(annotation(X,Y,Z))), VV remove 25/1/11\n	% annotation/3 axioms created already during owl_parse_annotated_axioms/1\n	retractall(aNN(_,_,_)).\n\n% Table 18. Parsing of Axioms for Compatibility with OWL DL\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,complementOf(CEY)])) :-\n	use_owl(X,'owl:complementOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description(Y,CEY).\n\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:unionOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Nothing' ; (DL=[CEY]->true;CEY = unionOf(DL))).\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:intersectionOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Thing' ; (DL=[CEY]->true;CEY = intersectionOf(DL))).\n\nowl_parse_compatibility_DL(equivalentClasses([CEX,CEY])) :-\n	use_owl(X,'owl:oneOf',Y,eq_classes),\n	owl_description(X,CEX),\n	owl_description_list(Y,DL),\n	(   DL = [] -> CEY = 'owl:Nothing' ; CEY = oneOf(DL)).\n\n% UTIL\n\n%% maximally_connected_subgraph_over(+P,?ConnectedSets) is semidet\nmaximally_connected_subgraph_over(P,CSet):-\n        maximally_connected_subgraph_over(P,[],CSetL),\n        member(CSet,CSetL).\n\n%% maximally_connected_subgraph_over(+P,+Used,?ListOfConnectedSets) is det\nmaximally_connected_subgraph_over(P,Used,[CSet|All]):-\n        test_use_owl(X,P,Y), % seed\n        \\+ member(X,Used),\n        \\+ member(Y,Used),\n        use_owl(X,P,Y,maximally_conected), % seed\n        !,\n        extend_set_over(P,[X,Y],CSet),\n        append(CSet,Used,Used2),\n        maximally_connected_subgraph_over(P,Used2,All).\nmaximally_connected_subgraph_over(_,_,[]).\n\n\n% det\nextend_set_over(P,L,L2):-\n        member(X,L),\n        test_use_owl(X,P,Y),\n        \\+ member(Y,L),\n        use_owl(X,P,Y,extend_set_over),\n        !,extend_set_over(P,[Y|L],L2).\nextend_set_over(P,L,L2):-\n        member(X,L),\n        test_use_owl(Y,P,X),\n        \\+ member(Y,L),\n        use_owl(Y,P,X,extend_set_over),\n        !,extend_set_over(P,[Y|L],L2).\nextend_set_over(_,L,L):- !.\n\nliteral_integer(literal(type,A),N) :- atom_number(A,N).\nliteral_integer(literal(type(_,A)),N) :- atom_number(A,N).\n\n%% time_goal(+Goal,?Time)\n%  calls Goal and unifies Time with the cputime taken\ntime_goal(Goal,Time):-\n        statistics(cputime,T1), Goal,\n        statistics(cputime,T2), Time is T2-T1.\n\ntimed_forall(Cond,Action) :-\n        forall(Cond,\n               (   time_goal(Action,Time),\n                   debug(owl2_bench,'Goal: ~w Time:~w',[Action,Time]))).\n\n\n/** <module> Translates an RDF database to OWL2 axioms\n  ---+ Synopsis 1\n==\n:- use_module(bio(owl2_from_rdf)).\n%\n==\n---+ Details\n---++ Hooks\n* owl_parse_axiom_hook/3\n---+ See Also\nThe file owl2_from_rdf.plt has some examples\n*/\nload_owl(String):-\n  pengine_self(Self),\n  pengine_property(Self,module(M)),\n  open_chars_stream(String,S),\n  process_rdf(stream(S), assert_list(M), [namespaces(NSList)]),\n  rdf_register_prefix('disponte','https://sites.google.com/a/unife.it/ml/disponte#',[keep(true)]),\n  assert(M:ns4query(NSList)),\n  close(S),\n  rdf_2_owl('ont','ont'),\n  owl_canonical_parse_3(['ont']),\n  parse_probabilistic_annotation_assertions.\n\nassert_list(_M,[], _):-!.\nassert_list(M,[H|T], Source) :-\n    H=..[_|Args],\n    H1=..[myrdf|Args],\n	assert(M:H1),\n        assert_list(M,T, Source).\n\n/*\nassert_list([], _):-!.\nassert_list([H|T], Source) :-\n	assert(H),\n        assert_list(T, Source).\n*/\n\nparse_probabilistic_annotation_assertions :-\n  forall(annotation(Ax,'https://sites.google.com/a/unife.it/ml/disponte#probability',literal(type(_Type, PV))),\n       (assert_axiom(annotationAssertion('https://sites.google.com/a/unife.it/ml/disponte#probability',Ax,literal(PV))))\n  ),\n  % forall(aNN(X,Y,Z),assert(annotation(X,Y,Z))), VV remove 25/1/11\n  % annotation/3 axioms created already during owl_parse_annotated_axioms/1\n  retractall(annotation(_,'https://sites.google.com/a/unife.it/ml/disponte#probability',_)).\n\nquery_call(Q):-\n  Q =.. [P|Args],\n  pengine_self(Self),\n  pengine_property(Self,module(M)),\n  M:ns4query(NSList),!,\n  retract(M:ns4query(NSList)),\n  expand_all_ns(Args,NSList,NewArgs),!,\n  NQ =.. [P|NewArgs],\n  call(NQ).\n\nexpand_all_ns([],_,[]).\nexpand_all_ns([H|T],NSList,[H|NewArgs]):-\n  check_query_arg(H),!,\n  expand_all_ns(T,NSList,NewArgs).\n\nexpand_all_ns([H|T],NSList,[NewArg|NewArgs]):-\n  expand_ns4query(H,NSList,NewArg),\n  expand_all_ns(T,NSList,NewArgs).\n\ncheck_query_arg(Arg) :-\n  atomic(Arg),!,\n  axiom(Ax),\n  Ax =.. [_|L],\n  flatten(L,L1),\n  member(Arg,L1),!.\n\nexpand_ns4query(NS_URL, [], NS_URL).\nexpand_ns4query(NS_URL, [Short_NSL=Long_NSL|_],Full_URL):- \n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	uri_split(NS_URL,Short_NS,Term, ':'),\n	Short_NS = Short_NSL,\n	Long_NS = Long_NSL,!,\n	concat_atom([Long_NS,Term],Full_URL).\n\nexpand_ns4query(NS_URL, [[]=Long_NSL|_],Full_URL):- \n	nonvar(NS_URL),\n	NS_URL \\= literal(_),\n	\\+ sub_atom(NS_URL,_,_,_,':'),\n	Long_NS = Long_NSL,!,\n	concat_atom([Long_NS,NS_URL],Full_URL).\n\nexpand_ns4query(NS_URL, [_|T],Full_URL):- \n  expand_ns4query(NS_URL, T,Full_URL),!.\nexpand_ns4query(URL,_, URL).\n\nparse:- \n  pengine_self(M),\n  set_prolog_flag(M:unknwon,fail),\n  load_owl('"+i.source+"').",destroy:!1,format:"json-html",oncreate:p,onsuccess:d,onfailure:v,onstop:m,onprompt:g,onoutput:y,onerror:b,onabort:w}),o.prolog.state="idle"}),this})},renderAnswer:function(t){var n=this.data("prologRunner"),r=++n.answers%2==0;if(n.query.tabled){if(n.answers!=1)return t.projection=n.projection,t.nth=n.answers,e(n.table).prologAnswer(t),this;if(t.projection&&t.projection.length>0){var i=h(t.projection);return l(this,i),n.table=i,n.projection=t.projection,t.nth=n.answers,e(n.table).prologAnswer(t),this}}var s=e.el.div({"class":"answer "+(r?"even":"odd")},e.el.span({"class":"answer-no"},n.answers));l(this,s),e(s).prologAnswer(t)},outputHTML:function(t){var n=e.el.span({"class":"output"});e(n).html(t),l(this,n)},error:function(t){l(this,e.el.pre({"class":"prolog-message msg-error"},t))},setPrompt:function(e){this.find(".controller input").attr("placeholder",e)},respond:function(t){var n=this.data("prologRunner");l(this,e.el.div({"class":"response"},t)),n.prolog.respond(t)},stop:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner");n.prolog.stop()})},stopOrAbort:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner"),r=t.prologRunner("getState");switch(r){case"running":case"wait-input":n.prolog.abort();break;case"wait-next":n.prolog.stop()}})},next:function(t){return this.each(function(){var n=e(this),r=n.data("prologRunner");r.prolog.next(t),n.prologRunner("setState","running")})},abort:function(){return this.each(function(){var t=e(this),n=t.data("prologRunner");n.prolog.abort()})},close:function(){if(this.length){var t=f(this);this.each(function(){var t=e(this),n=t.data("prologRunner");t.prologRunner("alive")&&n.prolog.destroy()}),this.remove(),t.prologRunners("scrollToBottom",!0)}return this},trill_on_swish_help:function(){e(".trill_on_swish-event-receiver").trigger("trill_on_swish_help",{file:"runner.html"})},toggleIconic:function(e){return e==undefined?this.toggleClass("iconic"):e?this.addClass("iconic"):this.removeClass("iconic"),f(this).prologRunners("scrollToBottom",!0),this},populateActionMenu:function(t){var n=this.find(".runner-title .btn-group.dropdown");return t=e.extend({"Re-run":function(){console.log("Re-Run ",this)}},t),s(n,this,t),this},setState:function(t){var n=this.data("prologRunner");if(n.prolog.state!=t){var r=this.find(".show-state");r.removeClass(n.prolog.state).addClass(t),n.prolog.state=t,!c(t)&&n.savedFocus?(e(n.savedFocus).focus(),n.savedFocus=null):t=="wait-input"&&this.find("input").focus(),c(t)||n.prolog.destroy()}if(t=="wait-next"||t=="true"){var i=f(this);setTimeout(function(){i.prologRunners("scrollToBottom")},100)}else f(this).prologRunners("scrollToBottom");return this},getState:function(){var e=this.data("prologRunner");return e.prolog?e.prolog.state:"idle"},alive:function(){return c(this.prologRunner("getState"))}};e.fn.prologRunner=function(t){if(a[t])return a[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return a._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+o)}}(jQuery)}),define("term",["jquery"],function(){function e(){$(this).next().toggleClass("fold"),$(this).remove()}$(document).on("click",".pl-functor, .pl-infix",function(){var t=$(this).parent();$(t).toggleClass("fold"),$(t).before('<span class="pl-ellipsis">...</span>').prev().click(e)})}),define("jswish",["jquery","config","preferences","jquery-ui","splitter","bootstrap","pane","navbar","search","editorxml","query","runner","modal","term","laconic"],function(e,t,n){n.setDefault("semantic-highlighting",!1),function(e){function s(t,n){e(".trill_on_swish-event-receiver").trigger(t,n)}function o(){e(".swish-logo").append(e.el.b(e.el.span({style:"color:darkblue"},"TRILL "),e.el.span({style:"color:maroon"},"on "),e.el.span({style:"color:darkblue"},"SWI"),e.el.span({style:"color:maroon"},"SH"))).css("margin-left","30px").css("font-size","24px").addClass("navbar-brand")}function u(){e("#modal").length==0&&(e("body").append(e.el.div({id:"modal"})),e("#modal").trill_on_swishModal())}function a(){e(".tile").tile(),e(window).resize(function(){e(".tile").tile("resize")}),e("body").on("click","button.close-pane",function(){closePane(e(this).parent())})}var n="trill_on_swish",r={newProgramText:"<!-- Your program goes here\n\n\n\n/** <examples>\n\n\n*/\n-->",menu:{File:{New:function(){s("source",{data:r.newProgramText})},"File group":"--","Save ...":function(){s("saveProgram","as")},"Info & history ...":function(){s("fileInfo")},Share:"--","Collaborate ...":function(){e("body").trill_on_swish("collaborate")},"Print group":"--","Print ...":function(){e(".prolog-editor").xmlEditor("print")}},Edit:{"Clear messages":function(){s("clearMessages")},Options:"--","Semantic highlighting":{preference:"semantic-highlighting",type:"checkbox"}},Examples:function(t,n){e("body").trill_on_swish("populateExamples",t,n)},Help:{"About ...":function(){s("trill_on_swish_help",{file:"about.html"})},Topics:"--","Help ...":function(){s("trill_on_swish_help",{file:"help.html"})},"Runner ...":function(){s("trill_on_swish_help",{file:"runner.html"})},Background:"--","SWISH Beware! ...":function(){s("trill_on_swish_help",{file:"beware.html"})},"SWISH Caveats ...":function(){s("trill_on_swish_help",{file:"caveats.html"})},"Prolog Background ...":function(){s("trill_on_swish_help",{file:"background.html"})}}}},i={_init:function(t){return o(),u(),a(),e("#search").search(),t=t||{},this.addClass("trill_on_swish"),this.each(function(){var i=e(this),o={};e("#navbar").navbar(r.menu),o.editor=e(".prolog-editor").xmlEditor(),o.runner=e(".prolog-runners").prologRunners(),o.query=e(".prolog-query").queryEditor({source:function(){return i.trill_on_swish("prologSource")},sourceID:function(){return o.editor.prologEditor("getSourceID")},examples:i.trill_on_swish("examples"),runner:o.runner}).trigger("source"),t.show_beware&&s("trill_on_swish_help",{file:"beware.html",notagain:"beware"}),i.data(n,o)})},trigger:function(e,t){return s(e,t),this},playFile:function(n){var r=t.http.locations.trill_on_swish_web_storage+"/"+n;return e.ajax({url:r,type:"GET",data:{format:"json"},success:function(e){e.url=r,s("source",e)},error:function(){alert("Failed to load example")}}),this},openExampleFunction:function(t){return function(){e.ajax({url:t.href,type:"GET",data:{format:"raw"},success:function(e){s("source",{data:e,url:t.href})},error:function(){alert("Failed to load example")}})}},populateExamples:function(n,r){var i=this;return e.ajax(t.http.locations.trill_on_swish_examples,{dataType:"json",success:function(t){for(var n=0;n<t.length;n++)e("#navbar").navbar("extendDropdown",r,t[n].title,i.trill_on_swish("openExampleFunction",t[n]))}}),this},prologSource:function(){var t=[],n;return(n=e(".prolog-editor").xmlEditor("getSource"))&&t.push(n),(n=e(".background.prolog.source").text())&&t.push(n),t.join("\n\n")},examples:function(){var t=e(".examples.prolog").text();return t?e().xmlEditor("getExamples",t,!1):function(){return e(".prolog-editor").xmlEditor("getExamples")}},collaborate:function(){var t=this;return e(this).attr("data-end-togetherjs-html","End collaboration"),require(["https://togetherjs.com/togetherjs-min.js"],function(){TogetherJS(t)}),this}};e.fn.trill_on_swish=function(t){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return i._init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery."+n)}}(jQuery)}),require.config({urlArgs:"ts="+(new Date).getTime(),waitSeconds:60,paths:{jquery:"../bower_components/jquery/dist/jquery.min","jquery-ui":"../bower_components/jquery-ui/jquery-ui.min",laconic:"../bower_components/laconic/laconic",bootstrap:"../bower_components/bootstrap/dist/js/bootstrap.min",typeahead:"../bower_components/typeahead.js/dist/typeahead.bundle.min",splitter:"../bower_components/jquery.splitter/js/jquery.splitter-0.14.0",tagmanager:"../bower_components/tagmanager/tagmanager","tos_cm/lib/codemirror":"../bower_components/codemirror/lib/codemirror","tos_cm/addon/edit/matchbrackets":"../bower_components/codemirror/addon/edit/matchbrackets","tos_cm/addon/comment/continuecomment":"../bower_components/codemirror/addon/comment/continuecomment","tos_cm/addon/comment/comment":"../bower_components/codemirror/addon/comment/comment","tos_cm/addon/hint/show-hint":"../bower_components/codemirror/addon/hint/show-hint","tos_cm/addon/hint/anyword-hint":"../bower_components/codemirror/addon/hint/anyword-hint","tos_cm/addon/display/placeholder":"../bower_components/codemirror/addon/display/placeholder","tos_cm/addon/runmode/runmode":"../bower_components/codemirror/addon/runmode/runmode","tos_cm/mode/xml/xml":"../bower_components/codemirror/mode/xml/xml","tos_cm/mode/erlang/erlang":"../bower_components/codemirror/mode/erlang/erlang","tos_cm/mode/prolog/prolog":"codemirror/mode/prolog/prolog","tos_cm/mode/prolog/prolog_keys":"codemirror/mode/prolog/prolog_keys","tos_cm/mode/prolog/prolog_query":"codemirror/mode/prolog/prolog_query","tos_cm/mode/prolog/prolog_server":"codemirror/mode/prolog/prolog_server","tos_cm/addon/hint/templates-hint":"codemirror/addon/hint/templates-hint","tos_cm/addon/hover/text-hover":"codemirror/addon/hover/text-hover","tos_cm/addon/hover/prolog-hover":"codemirror/addon/hover/prolog-hover","tos_cm/addon/hint/show-context-info":"codemirror/addon/hint/show-context-info","tos_cm/mode/prolog/prolog-template-hint":"codemirror/mode/prolog/prolog-template-hint"},shim:{bootstrap:{deps:["jquery"]},typeahead:{deps:["jquery"]},splitter:{deps:["jquery"]},laconic:{deps:["jquery"]},tagmanager:{deps:["jquery"]}}}),require(["jquery","config","jswish"],function(e,t,n){e(function(){e("body").trill_on_swish(t.trill_on_swish||{})})}),define("trill_on_swish",function(){});
\ No newline at end of file
diff --git a/web/js/trill_on_swish-min.js.gz b/web/js/trill_on_swish-min.js.gz
index d2fc525..5d5a0a0 100644
Binary files a/web/js/trill_on_swish-min.js.gz and b/web/js/trill_on_swish-min.js.gz differ