/**
 * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

/*!
 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
 * http://benalman.com/projects/jquery-dotimeout-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */

// Script: jQuery doTimeout: Like setTimeout, but better!
//
// *Version: 1.0, Last updated: 3/3/2010*
// 
// Project Home - http://benalman.com/projects/jquery-dotimeout-plugin/
// GitHub       - http://github.com/cowboy/jquery-dotimeout/
// Source       - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.js
// (Minified)   - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.min.js (1.0kb)
// 
// About: License
// 
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
// 
// About: Examples
// 
// These working examples, complete with fully commented code, illustrate a few
// ways in which this plugin can be used.
// 
// Debouncing      - http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/
// Delays, Polling - http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/
// Hover Intent    - http://benalman.com/code/projects/jquery-dotimeout/examples/hoverintent/
// 
// About: Support and Testing
// 
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
// 
// jQuery Versions - 1.3.2, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
// Unit Tests      - http://benalman.com/code/projects/jquery-dotimeout/unit/
// 
// About: Release History
// 
// 1.0 - (3/3/2010) Callback can now be a string, in which case it will call
//       the appropriate $.method or $.fn.method, depending on where .doTimeout
//       was called. Callback must now return `true` (not just a truthy value)
//       to poll.
// 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks
// 0.3 - (6/25/2009) Initial release

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

//! moment.js
//! version : 2.8.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com

// This code has been MODIFIED from the code licensed below to not replace the

// default browser split.  The license is reproduced here.

/*!
     * Cross-Browser Split 1.1.1
     * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
     * Available under the MIT License
     * ECMAScript compliant, uniform cross-browser split method
     */

// under the terms of the Apache2 license governing the MathJax project.

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */

//     Underscore.js 1.5.2
//     http://underscorejs.org
//     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

/*! jQuery UI - v1.10.4 - 2014-04-02
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */

// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.

/**
 * term.js - an xterm emulator
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */

//# sourceMappingURL=backbone-min.map;
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

/*!
 * Bootstrap v3.3.6 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under the MIT license
 */

!function(e,t){"function"==typeof define&&define.amd?define([],t):e.Thebe=t().Thebe}(this,function(){var requirejs,require,define;!function(e){function t(e,t){return _.call(e,t)}function i(e,t){var i,n,r,s,o,a,l,c,h,u,d,p=t&&t.split("/"),f=m.map,g=f&&f["*"]||{};if(e&&"."===e.charAt(0))if(t){for(e=e.split("/"),o=e.length-1,m.nodeIdCompat&&b.test(e[o])&&(e[o]=e[o].replace(b,"")),e=p.slice(0,p.length-1).concat(e),h=0;h<e.length;h+=1)if(d=e[h],"."===d)e.splice(h,1),h-=1;else if(".."===d){if(1===h&&(".."===e[2]||".."===e[0]))break;h>0&&(e.splice(h-1,2),h-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((p||g)&&f){for(i=e.split("/"),h=i.length;h>0;h-=1){if(n=i.slice(0,h).join("/"),p)for(u=p.length;u>0;u-=1)if(r=f[p.slice(0,u).join("/")],r&&(r=r[n])){s=r,a=h;break}if(s)break;!l&&g&&g[n]&&(l=g[n],c=h)}!s&&l&&(s=l,a=c),s&&(i.splice(0,a,s),e=i.join("/"))}return e}function n(t,i){return function(){var n=v.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),h.apply(e,n.concat([t,i]))}}function r(e){return function(t){return i(t,e)}}function s(e){return function(t){p[e]=t}}function o(i){if(t(f,i)){var n=f[i];delete f[i],g[i]=!0,c.apply(e,n)}if(!t(p,i)&&!t(g,i))throw new Error("No "+i);return p[i]}function a(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function l(e){return function(){return m&&m.config&&m.config[e]||{}}}var c,h,u,d,p={},f={},m={},g={},_=Object.prototype.hasOwnProperty,v=[].slice,b=/\.js$/;u=function(e,t){var n,s=a(e),l=s[0];return e=s[1],l&&(l=i(l,t),n=o(l)),l?e=n&&n.normalize?n.normalize(e,r(t)):i(e,t):(e=i(e,t),s=a(e),l=s[0],e=s[1],l&&(n=o(l))),{f:l?l+"!"+e:e,n:e,pr:l,p:n}},d={require:function(e){return n(e)},exports:function(e){var t=p[e];return"undefined"!=typeof t?t:p[e]={}},module:function(e){return{id:e,uri:"",exports:p[e],config:l(e)}}},c=function(i,r,a,l){var c,h,m,_,v,b,y=[],x=typeof a;if(l=l||i,"undefined"===x||"function"===x){for(r=!r.length&&a.length?["require","exports","module"]:r,v=0;v<r.length;v+=1)if(_=u(r[v],l),h=_.f,"require"===h)y[v]=d.require(i);else if("exports"===h)y[v]=d.exports(i),b=!0;else if("module"===h)c=y[v]=d.module(i);else if(t(p,h)||t(f,h)||t(g,h))y[v]=o(h);else{if(!_.p)throw new Error(i+" missing "+h);_.p.load(_.n,n(l,!0),s(h),{}),y[v]=p[h]}m=a?a.apply(p[i],y):void 0,i&&(c&&c.exports!==e&&c.exports!==p[i]?p[i]=c.exports:m===e&&b||(p[i]=m))}else i&&(p[i]=a)},requirejs=require=h=function(t,i,n,r,s){if("string"==typeof t)return d[t]?d[t](i):o(u(t,i).f);if(!t.splice){if(m=t,m.deps&&h(m.deps,m.callback),!i)return;i.splice?(t=i,i=n,n=null):t=e}return i=i||function(){},"function"==typeof n&&(n=r,r=s),r?c(e,t,i,n):setTimeout(function(){c(e,t,i,n)},4),h},h.config=function(e){return h(e)},requirejs._defined=p,define=function(e,i,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");i.splice||(n=i,i=[]),t(p,e)||t(f,e)||(f[e]=[e,i,n])},define.amd={jQuery:!0}}(),define("almond",function(){});var Jupyter=Jupyter||{},jprop=function(e,t){Object.defineProperty(Jupyter,e,{get:function(){return console.warn("accessing `"+e+'` is deprecated. Use `require("'+t+'")`'),require(t)},enumerable:!0,configurable:!1})},jglobal=function(e,t){Object.defineProperty(Jupyter,e,{get:function(){return console.warn("accessing `"+e+'` is deprecated. Use `require("'+t+'").'+e+"`"),require(t)[e]},enumerable:!0,configurable:!1})};define("base/js/namespace",[],function(){"use strict";return jprop("utils","base/js/utils"),jprop("security","base/js/security"),jprop("keyboard","base/js/keyboard"),jprop("dialog","base/js/dialog"),jprop("mathjaxutils","notebook/js/mathjaxutils"),jglobal("CommManager","services/kernels/comm"),jglobal("Comm","services/kernels/comm"),jglobal("NotificationWidget","base/js/notificationwidget"),jglobal("Kernel","services/kernels/kernel"),jglobal("Session","services/sessions/session"),jglobal("LoginWidget","auth/js/loginwidget"),jglobal("Page","base/js/page"),jglobal("TextCell","notebook/js/textcell"),jglobal("OutputArea","notebook/js/outputarea"),jglobal("KeyboardManager","notebook/js/keyboardmanager"),jglobal("Completer","notebook/js/completer"),jglobal("Notebook","notebook/js/notebook"),jglobal("Tooltip","notebook/js/tooltip"),jglobal("Toolbar","notebook/js/toolbar"),jglobal("SaveWidget","notebook/js/savewidget"),jglobal("Pager","notebook/js/pager"),jglobal("QuickHelp","notebook/js/quickhelp"),jglobal("MarkdownCell","notebook/js/textcell"),jglobal("RawCell","notebook/js/textcell"),jglobal("Cell","notebook/js/cell"),jglobal("MainToolBar","notebook/js/maintoolbar"),jglobal("NotebookNotificationArea","notebook/js/notificationarea"),jglobal("NotebookTour","notebook/js/tour"),jglobal("MenuBar","notebook/js/menubar"),jglobal("SessionList","tree/js/sessionlist"),jglobal("ClusterList","tree/js/clusterlist"),jglobal("ClusterItem","tree/js/clusterlist"),Jupyter.version="4.0.5",Jupyter._target="_blank",Jupyter});var IPython=Jupyter;!function(){var e,t,i,n;!function(){var r={},s={};e=function(e,t,i){r[e]={deps:t,callback:i}},n=i=t=function(e){function i(t){if("."!==t.charAt(0))return t;for(var i=t.split("/"),n=e.split("/").slice(0,-1),r=0,s=i.length;s>r;r++){var o=i[r];if(".."===o)n.pop();else{if("."===o)continue;n.push(o)}}return n.join("/")}if(n._eak_seen=r,s[e])return s[e];if(s[e]={},!r[e])throw new Error("Could not find module "+e);for(var o,a=r[e],l=a.deps,c=a.callback,h=[],u=0,d=l.length;d>u;u++)"exports"===l[u]?h.push(o={}):h.push(t(i(l[u])));var p=c.apply(this,h);return s[e]=o||p}}(),e("promise/all",["./utils","exports"],function(e,t){"use strict";function i(e){var t=this;if(!n(e))throw new TypeError("You must pass an array to all.");return new t(function(t,i){function n(e){return function(t){s(e,t)}}function s(e,i){a[e]=i,0===--l&&t(a)}var o,a=[],l=e.length;0===l&&t([]);for(var c=0;c<e.length;c++)o=e[c],o&&r(o.then)?o.then(n(c),i):s(c,o)})}var n=e.isArray,r=e.isFunction;t.all=i}),e("promise/asap",["exports"],function(e){"use strict";function t(){return function(){process.nextTick(r)}}function i(){var e=0,t=new l(r),i=document.createTextNode("");return t.observe(i,{characterData:!0}),function(){i.data=e=++e%2}}function n(){return function(){c.setTimeout(r,1)}}function r(){for(var e=0;e<h.length;e++){var t=h[e],i=t[0],n=t[1];i(n)}h=[]}function s(e,t){var i=h.push([e,t]);1===i&&o()}var o,a="undefined"!=typeof window?window:{},l=a.MutationObserver||a.WebKitMutationObserver,c="undefined"!=typeof global?global:void 0===this?window:this,h=[];o="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?t():l?i():n(),e.asap=s}),e("promise/config",["exports"],function(e){"use strict";function t(e,t){return 2!==arguments.length?i[e]:void(i[e]=t)}var i={instrument:!1};e.config=i,e.configure=t}),e("promise/polyfill",["./promise","./utils","exports"],function(e,t,i){"use strict";function n(){var e;e="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var t="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),s(t)}();t||(e.Promise=r)}var r=e.Promise,s=t.isFunction;i.polyfill=n}),e("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(e,t,i,n,r,s,o,a){"use strict";function l(e){if(!x(e))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof l))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],c(e,this)}function c(e,t){function i(e){f(t,e)}function n(e){g(t,e)}try{e(i,n)}catch(r){n(r)}}function h(e,t,i,n){var r,s,o,a,l=x(i);if(l)try{r=i(n),o=!0}catch(c){a=!0,s=c}else r=n,o=!0;p(t,r)||(l&&o?f(t,r):a?g(t,s):e===E?f(t,r):e===L&&g(t,r))}function u(e,t,i,n){var r=e._subscribers,s=r.length;r[s]=t,r[s+E]=i,r[s+L]=n}function d(e,t){for(var i,n,r=e._subscribers,s=e._detail,o=0;o<r.length;o+=3)i=r[o],n=r[o+t],h(t,i,n,s);e._subscribers=null}function p(e,t){var i,n=null;try{if(e===t)throw new TypeError("A promises callback cannot return that same promise.");if(y(t)&&(n=t.then,x(n)))return n.call(t,function(n){return i?!0:(i=!0,void(t!==n?f(e,n):m(e,n)))},function(t){return i?!0:(i=!0,void g(e,t))}),!0}catch(r){return i?!0:(g(e,r),!0)}return!1}function f(e,t){e===t?m(e,t):p(e,t)||m(e,t)}function m(e,t){e._state===M&&(e._state=D,e._detail=t,b.async(_,e))}function g(e,t){e._state===M&&(e._state=D,e._detail=t,b.async(v,e))}function _(e){d(e,e._state=E)}function v(e){d(e,e._state=L)}var b=e.config,y=(e.configure,t.objectOrFunction),x=t.isFunction,w=(t.now,i.all),k=n.race,C=r.resolve,T=s.reject,S=o.asap;b.async=S;var M=void 0,D=0,E=1,L=2;l.prototype={constructor:l,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(e,t){var i=this,n=new this.constructor(function(){});if(this._state){var r=arguments;b.async(function(){h(i._state,n,r[i._state-1],i._detail)})}else u(this,n,e,t);return n},"catch":function(e){return this.then(null,e)}},l.all=w,l.race=k,l.resolve=C,l.reject=T,a.Promise=l}),e("promise/race",["./utils","exports"],function(e,t){"use strict";function i(e){var t=this;if(!n(e))throw new TypeError("You must pass an array to race.");return new t(function(t,i){for(var n,r=0;r<e.length;r++)n=e[r],n&&"function"==typeof n.then?n.then(t,i):t(n)})}var n=e.isArray;t.race=i}),e("promise/reject",["exports"],function(e){"use strict";function t(e){var t=this;return new t(function(t,i){i(e)})}e.reject=t}),e("promise/resolve",["exports"],function(e){"use strict";function t(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=this;return new t(function(t){t(e)})}e.resolve=t}),e("promise/utils",["exports"],function(e){"use strict";function t(e){return i(e)||"object"==typeof e&&null!==e}function i(e){return"function"==typeof e}function n(e){return"[object Array]"===Object.prototype.toString.call(e)}var r=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=t,e.isFunction=i,e.isArray=n,e.now=r}),t("promise/polyfill").polyfill()}(),define("components/es6-promise/promise.min",function(){}),define("thebe/dotimeout",["jquery"],function(e){!function(e){"$:nomunge";function t(t){function n(){t?o.removeData(t):d&&delete i[d]}function s(){l.id=setTimeout(function(){l.fn()},p)}var o,a=this,l={},c=t?e.fn:e,h=arguments,u=4,d=h[1],p=h[2],f=h[3];if("string"!=typeof d&&(u--,d=t=0,p=h[1],f=h[2]),t?(o=a.eq(0),o.data(t,l=o.data(t)||{})):d&&(l=i[d]||(i[d]={})),l.id&&clearTimeout(l.id),delete l.id,f)l.fn=function(e){"string"==typeof f&&(f=c[f]),f.apply(a,r.call(h,u))!==!0||e?n():s()},s();else{if(l.fn)return void 0===p?n():l.fn(p===!1),!0;n()}}var i={},n="doTimeout",r=Array.prototype.slice;e[n]=function(){return t.apply(window,[0].concat(r.call(arguments)))},e.fn[n]=function(){var e=r.call(arguments),i=t.apply(this,[n+e[0]].concat(e));return"number"==typeof e[0]||"number"==typeof e[1]?this:i}}(jQuery)}),function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define("codemirror/lib/codemirror",[],e);this.CodeMirror=e()}}(function(){"use strict";function e(i,n){if(!(this instanceof e))return new e(i,n);this.options=n=n?Or(n):{},Or(Gs,n,!1),p(n);var r=n.value;"string"==typeof r&&(r=new vo(r,n.mode,null,n.lineSeparator)),this.doc=r;var s=new e.inputStyles[n.inputStyle](this),o=this.display=new t(i,r,s);o.wrapper.CodeMirror=this,c(this),a(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!ks&&o.input.focus(),_(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Sr,keySeq:null,specialChars:null};var l=this;ps&&11>fs&&setTimeout(function(){l.display.input.reset(!0)},20),Ft(this),Yr(),bt(this),this.curOp.forceUpdate=!0,Gn(this,r),n.autofocus&&!ks||l.hasFocus()?setTimeout(jr(pi,this),20):fi(this);for(var h in Ks)Ks.hasOwnProperty(h)&&Ks[h](this,n[h],Vs);w(this),n.finishInit&&n.finishInit(this);for(var u=0;u<Zs.length;++u)Zs[u](this);xt(this),ms&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function t(e,t,i){var n=this;this.input=i,n.scrollbarFiller=Hr("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Hr("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Hr("div",null,"CodeMirror-code"),n.selectionDiv=Hr("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Hr("div",null,"CodeMirror-cursors"),n.measure=Hr("div",null,"CodeMirror-measure"),n.lineMeasure=Hr("div",null,"CodeMirror-measure"),n.lineSpace=Hr("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Hr("div",[Hr("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Hr("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Hr("div",null,null,"position: absolute; height: "+Do+"px; width: 1px;"),n.gutters=Hr("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Hr("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Hr("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),ps&&8>fs&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ms||hs&&ks||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,i.init(n)}function i(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,$e(e,100),e.state.modeGen++,e.curOp&&Ot(e)}function r(e){e.options.lineWrapping?(Bo(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(qo(e.display.wrapper,"CodeMirror-wrap"),d(e)),o(e),Ot(e),ot(e),setTimeout(function(){v(e)},100)}function s(e){var t=_t(e.display),i=e.options.lineWrapping,n=i&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(r){if(bn(e.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o<r.widgets.length;o++)r.widgets[o].height&&(s+=r.widgets[o].height);return i?s+(Math.ceil(r.text.length/n)||1)*t:s+t}}function o(e){var t=e.doc,i=s(e);t.iter(function(e){var t=i(e);t!=e.height&&Qn(e,t)})}function a(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ot(e)}function l(e){c(e),Ot(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,i=e.options.gutters;Rr(t);for(var n=0;n<i.length;++n){var r=i[n],s=t.appendChild(Hr("div",null,"CodeMirror-gutter "+r));"CodeMirror-linenumbers"==r&&(e.display.lineGutter=s,s.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",h(e)}function h(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function u(e){if(0==e.height)return 0;for(var t,i=e.text.length,n=e;t=dn(n);){var r=t.find(0,!0);n=r.from.line,i+=r.from.ch-r.to.ch}for(n=e;t=pn(n);){var r=t.find(0,!0);i-=n.text.length-r.from.ch,n=r.to.line,i+=n.text.length-r.to.ch}return i}function d(e){var t=e.display,i=e.doc;t.maxLine=Kn(i,i.first),t.maxLineLength=u(t.maxLine),t.maxLineChanged=!0,i.iter(function(e){var i=u(e);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)})}function p(e){var t=Lr(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function f(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+qe(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?i:0,docHeight:n,scrollHeight:n+Ue(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function m(e,t,i){this.cm=i;var n=this.vert=Hr("div",[Hr("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=Hr("div",[Hr("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(r),Co(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Co(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedOverlay=!1,ps&&8>fs&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function _(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&qo(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Co(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,i){"horizontal"==i?ti(t,e):ei(t,e)},t),t.display.scrollbars.addClass&&Bo(t.display.wrapper,t.display.scrollbars.addClass)}function v(e,t){t||(t=f(e));var i=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var r=0;4>r&&i!=e.display.barWidth||n!=e.display.barHeight;r++)i!=e.display.barWidth&&e.options.lineWrapping&&P(e),b(e,f(e)),i=e.display.barWidth,n=e.display.barHeight}function b(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function y(e,t,i){var n=i&&null!=i.top?Math.max(0,i.top):e.scroller.scrollTop;n=Math.floor(n-We(e));var r=i&&null!=i.bottom?i.bottom:n+e.wrapper.clientHeight,s=Zn(t,n),o=Zn(t,r);if(i&&i.ensure){var a=i.ensure.from.line,l=i.ensure.to.line;s>a?(s=a,o=Zn(t,er(Kn(t,a))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=o&&(s=Zn(t,er(Kn(t,l))-e.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function x(e){var t=e.display,i=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,s=n+"px",o=0;o<i.length;o++)if(!i[o].hidden){e.options.fixedGutter&&i[o].gutter&&(i[o].gutter.style.left=s);var a=i[o].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=s}e.options.fixedGutter&&(t.gutters.style.left=n+r+"px")}}function w(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=k(e.options,t.first+t.size-1),n=e.display;if(i.length!=n.lineNumChars){var r=n.measure.appendChild(Hr("div",[Hr("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=r.firstChild.offsetWidth,o=r.offsetWidth-s;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(s,n.lineGutter.offsetWidth-o)+1,n.lineNumWidth=n.lineNumInnerWidth+o,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",h(e),!0}return!1}function k(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function C(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function T(e,t,i){var n=e.display;this.viewport=t,this.visible=y(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ye(e),this.force=i,this.dims=I(e),this.events=[]}function S(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ue(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ue(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var i=e.display,n=e.doc;if(t.editorIsHidden)return zt(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Rt(e))return!1;w(e)&&(zt(e),t.dims=I(e));var r=n.first+n.size,s=Math.max(t.visible.from-e.options.viewportMargin,n.first),o=Math.min(r,t.visible.to+e.options.viewportMargin);i.viewFrom<s&&s-i.viewFrom<20&&(s=Math.max(n.first,i.viewFrom)),i.viewTo>o&&i.viewTo-o<20&&(o=Math.min(r,i.viewTo)),Ls&&(s=_n(e.doc,s),o=vn(e.doc,o));var a=s!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Ht(e,s,o),i.viewOffset=er(Kn(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var l=Rt(e);if(!a&&0==l&&!t.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=Wr();return l>4&&(i.lineDiv.style.display="none"),O(e,i.updateLineNumbers,t.dims),l>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,c&&Wr()!=c&&c.offsetHeight&&c.focus(),Rr(i.cursorDiv),Rr(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,a&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,$e(e,400)),i.updateLineNumbers=null,!0}function D(e,t){for(var i=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ye(e)||(i&&null!=i.top&&(i={top:Math.min(e.doc.height+qe(e.display)-Ge(e),i.top)}),t.visible=y(e.display,e.doc,i),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){P(e);var r=f(e);Ie(e),L(e,r),v(e,r)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function E(e,t){var i=new T(e,t);if(M(e,i)){P(e),D(e,i);var n=f(e);Ie(e),L(e,n),v(e,n),i.finish()}}function L(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var i=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=i+"px",e.display.gutters.style.height=Math.max(i+Ue(e),t.clientHeight)+"px"}function P(e){for(var t=e.display,i=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var r,s=t.view[n];if(!s.hidden){if(ps&&8>fs){var o=s.node.offsetTop+s.node.offsetHeight;r=o-i,i=o}else{var a=s.node.getBoundingClientRect();r=a.bottom-a.top}var l=s.line.height-r;if(2>r&&(r=_t(t)),(l>.001||-.001>l)&&(Qn(s.line,r),A(s.line),s.rest))for(var c=0;c<s.rest.length;c++)A(s.rest[c])}}}function A(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function I(e){for(var t=e.display,i={},n={},r=t.gutters.clientLeft,s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o)i[e.options.gutters[o]]=s.offsetLeft+s.clientLeft+r,n[e.options.gutters[o]]=s.clientWidth;return{fixedPos:C(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function O(e,t,i){function n(t){var i=t.nextSibling;return ms&&Cs&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var r=e.display,s=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild,l=r.view,c=r.viewFrom,h=0;h<l.length;h++){var u=l[h];if(u.hidden);else if(u.node&&u.node.parentNode==o){for(;a!=u.node;)a=n(a);var d=s&&null!=t&&c>=t&&u.lineNumber;u.changes&&(Lr(u.changes,"gutter")>-1&&(d=!1),j(e,u,c,i)),d&&(Rr(u.lineNumber),u.lineNumber.appendChild(document.createTextNode(k(e.options,c)))),a=u.node.nextSibling}else{var p=q(e,u,c,i);o.insertBefore(p,a)}c+=u.size}for(;a;)a=n(a)}function j(e,t,i,n){for(var r=0;r<t.changes.length;r++){var s=t.changes[r];"text"==s?H(e,t):"gutter"==s?F(e,t,i,n):"class"==s?R(t):"widget"==s&&W(e,t,n)}t.changes=null}function z(e){return e.node==e.text&&(e.node=Hr("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),ps&&8>fs&&(e.node.style.zIndex=2)),e.node}function N(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var i=z(e);e.background=i.insertBefore(Hr("div",null,t),i.firstChild)}}function $(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function H(e,t){var i=t.text.className,n=$(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,R(t)):i&&(t.text.className=i)}function R(e){N(e),e.line.wrapClass?z(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 F(e,t,i,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var r=z(t);t.gutterBackground=Hr("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),r.insertBefore(t.gutterBackground,t.text)}var s=t.line.gutterMarkers;if(e.options.lineNumbers||s){var r=z(t),o=t.gutter=Hr("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(o),r.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),!e.options.lineNumbers||s&&s["CodeMirror-linenumbers"]||(t.lineNumber=o.appendChild(Hr("div",k(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),s)for(var a=0;a<e.options.gutters.length;++a){var l=e.options.gutters[a],c=s.hasOwnProperty(l)&&s[l];c&&o.appendChild(Hr("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[l]+"px; width: "+n.gutterWidth[l]+"px"))}}}function W(e,t,i){t.alignable&&(t.alignable=null);for(var n,r=t.node.firstChild;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&t.node.removeChild(r)}B(e,t,i)}function q(e,t,i,n){var r=$(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),R(t),F(e,t,i,n),B(e,t,n),t.node}function B(e,t,i){if(U(e,t.line,t,i,!0),t.rest)for(var n=0;n<t.rest.length;n++)U(e,t.rest[n],t,i,!1)}function U(e,t,i,n,r){if(t.widgets)for(var s=z(i),o=0,a=t.widgets;o<a.length;++o){var l=a[o],c=Hr("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Y(l,c,i,n),e.display.input.setUneditable(c),r&&l.above?s.insertBefore(c,i.gutter||i.text):s.appendChild(c),yr(l,"redraw")}}function Y(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var r=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(r-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=r+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function G(e){return Ps(e.line,e.ch)}function K(e,t){return As(e,t)<0?t:e}function V(e,t){return As(e,t)<0?e:t}function J(e){e.state.focused||(e.display.input.focus(),pi(e))}function Q(e){return e.options.readOnly||e.doc.cantEdit}function X(e,t,i,n,r){var s=e.doc;e.display.shift=!1,n||(n=s.sel);var o=e.state.pasteIncoming||"paste"==r,a=s.splitLines(t),l=null;if(o&&n.ranges.length>1)if(Is&&Is.join("\n")==t){if(n.ranges.length%Is.length==0){l=[];for(var c=0;c<Is.length;c++)l.push(s.splitLines(Is[c]))}}else a.length==n.ranges.length&&(l=Pr(a,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var h=n.ranges[c],u=h.from(),d=h.to();h.empty()&&(i&&i>0?u=Ps(u.line,u.ch-i):e.state.overwrite&&!o&&(d=Ps(d.line,Math.min(Kn(s,d.line).text.length,d.ch+Er(a).length))));var p=e.curOp.updateInput,f={from:u,to:d,text:l?l[c%l.length]:a,origin:r||(o?"paste":e.state.cutIncoming?"cut":"+input")};wi(e.doc,f),yr(e,"inputRead",e,f)}t&&!o&&ee(e,t),Oi(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Z(e,t){var i=e.clipboardData&&e.clipboardData.getData("text/plain");return i?(e.preventDefault(),Dt(t,function(){X(t,i,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var i=e.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(!(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)){var s=e.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a<s.electricChars.length;a++)if(t.indexOf(s.electricChars.charAt(a))>-1){o=zi(e,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(Kn(e.doc,r.head.line).text.slice(0,r.head.ch))&&(o=zi(e,r.head.line,"smart"));o&&yr(e,"electricInput",e,r.head.line)}}}function te(e){for(var t=[],i=[],n=0;n<e.doc.sel.ranges.length;n++){var r=e.doc.sel.ranges[n].head.line,s={anchor:Ps(r,0),head:Ps(r+1,0)};i.push(s),t.push(e.getRange(s.anchor,s.head))}return{text:t,ranges:i}}function ie(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function ne(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Sr,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function re(){var e=Hr("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Hr("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return ms?e.style.width="1000px":e.setAttribute("wrap","off"),ws&&(e.style.border="1px solid black"),ie(e),t}function se(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Sr,this.gracePeriod=!1}function oe(e,t){var i=Xe(e,t.line);if(!i||i.hidden)return null;var n=Kn(e.doc,t.line),r=Ve(i,n,t.line),s=tr(n),o="left";if(s){var a=os(s,t.ch);o=a%2?"right":"left"}var l=tt(r.map,t.ch,o);return l.offset="right"==l.collapse?l.end:l.start,l}function ae(e,t){return t&&(e.bad=!0),e}function le(e,t,i){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[i],!n)return ae(e.clipPos(Ps(e.display.viewTo-1)),!0);t=null,i=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var s=e.display.view[r];if(s.node==n)return ce(s,t,i)}}function ce(e,t,i){function n(t,i,n){for(var r=-1;r<(h?h.length:0);r++)for(var s=0>r?c.map:h[r],o=0;o<s.length;o+=3){var a=s[o+2];if(a==t||a==i){var l=Xn(0>r?e.line:e.rest[r]),u=s[o]+n;return(0>n||a!=t)&&(u=s[o+(n?1:0)]),Ps(l,u)}}}var r=e.text.firstChild,s=!1;if(!t||!Ro(r,t))return ae(Ps(Xn(e.line),0),!0);if(t==r&&(s=!0,t=r.childNodes[i],i=0,!t)){var o=e.rest?Er(e.rest):e.line;return ae(Ps(Xn(o),o.text.length),s)}var a=3==t.nodeType?t:null,l=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,i&&(i=a.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var c=e.measure,h=c.maps,u=n(a,l,i);if(u)return ae(u,s);for(var d=l.nextSibling,p=a?a.nodeValue.length-i:0;d;d=d.nextSibling){if(u=n(d,d.firstChild,0))return ae(Ps(u.line,u.ch-p),s);p+=d.textContent.length;
}for(var f=l.previousSibling,p=i;f;f=f.previousSibling){if(u=n(f,f.firstChild,-1))return ae(Ps(u.line,u.ch+p),s);p+=d.textContent.length}}function he(e,t,i,n,r){function s(e){return function(t){return t.id==e}}function o(t){if(1==t.nodeType){var i=t.getAttribute("cm-text");if(null!=i)return""==i&&(i=t.textContent.replace(/\u200b/g,"")),void(a+=i);var h,u=t.getAttribute("cm-marker");if(u){var d=e.findMarks(Ps(n,0),Ps(r+1,0),s(+u));return void(d.length&&(h=d[0].find())&&(a+=Vn(e.doc,h.from,h.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p<t.childNodes.length;p++)o(t.childNodes[p]);/^(pre|div|p)$/i.test(t.nodeName)&&(l=!0)}else if(3==t.nodeType){var f=t.nodeValue;if(!f)return;l&&(a+=c,l=!1),a+=f}}for(var a="",l=!1,c=e.doc.lineSeparator();o(t),t!=i;)t=t.nextSibling;return a}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function pe(e,t){var i=e[t];e.sort(function(e,t){return As(e.from(),t.from())}),t=Lr(e,i);for(var n=1;n<e.length;n++){var r=e[n],s=e[n-1];if(As(s.to(),r.from())>=0){var o=V(s.from(),r.from()),a=K(s.to(),r.to()),l=s.empty()?r.from()==r.head:s.from()==s.head;t>=n&&--t,e.splice(--n,2,new de(l?a:o,l?o:a))}}return new ue(e,t)}function fe(e,t){return new ue([new de(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Ps(e.first,0);var i=e.first+e.size-1;return t.line>i?Ps(i,Kn(e,i).text.length):_e(t,Kn(e,t.line).text.length)}function _e(e,t){var i=e.ch;return null==i||i>t?Ps(e.line,t):0>i?Ps(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function be(e,t){for(var i=[],n=0;n<t.length;n++)i[n]=ge(e,t[n]);return i}function ye(e,t,i,n){if(e.cm&&e.cm.display.shift||e.extend){var r=t.anchor;if(n){var s=As(i,r)<0;s!=As(n,r)<0?(r=i,i=n):s!=As(i,n)<0&&(i=n)}return new de(r,i)}return new de(n||i,i)}function xe(e,t,i,n){Me(e,new ue([ye(e,e.sel.primary(),t,i)],0),n)}function we(e,t,i){for(var n=[],r=0;r<e.sel.ranges.length;r++)n[r]=ye(e,e.sel.ranges[r],t[r],null);var s=pe(n,e.sel.primIndex);Me(e,s,i)}function ke(e,t,i,n){var r=e.sel.ranges.slice(0);r[t]=i,Me(e,pe(r,e.sel.primIndex),n)}function Ce(e,t,i,n){Me(e,fe(t,i),n)}function Te(e,t){var i={ranges:t.ranges,update:function(t){this.ranges=[];for(var i=0;i<t.length;i++)this.ranges[i]=new de(ge(e,t[i].anchor),ge(e,t[i].head))}};return So(e,"beforeSelectionChange",e,i),e.cm&&So(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?pe(i.ranges,i.ranges.length-1):t}function Se(e,t,i){var n=e.history.done,r=Er(n);r&&r.ranges?(n[n.length-1]=t,De(e,t,i)):Me(e,t,i)}function Me(e,t,i){De(e,t,i),lr(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function De(e,t,i){(Cr(e,"beforeSelectionChange")||e.cm&&Cr(e.cm,"beforeSelectionChange"))&&(t=Te(e,t));var n=i&&i.bias||(As(t.primary().head,e.sel.primary().head)<0?-1:1);Ee(e,Pe(e,t,n,!0)),i&&i.scroll===!1||!e.cm||Oi(e.cm)}function Ee(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,kr(e.cm)),yr(e,"cursorActivity",e))}function Le(e){Ee(e,Pe(e,e.sel,null,!1),Lo)}function Pe(e,t,i,n){for(var r,s=0;s<t.ranges.length;s++){var o=t.ranges[s],a=Ae(e,o.anchor,i,n),l=Ae(e,o.head,i,n);(r||a!=o.anchor||l!=o.head)&&(r||(r=t.ranges.slice(0,s)),r[s]=new de(a,l))}return r?pe(r,t.primIndex):t}function Ae(e,t,i,n){var r=!1,s=t,o=i||1;e.cantEdit=!1;e:for(;;){var a=Kn(e,s.line);if(a.markedSpans)for(var l=0;l<a.markedSpans.length;++l){var c=a.markedSpans[l],h=c.marker;if((null==c.from||(h.inclusiveLeft?c.from<=s.ch:c.from<s.ch))&&(null==c.to||(h.inclusiveRight?c.to>=s.ch:c.to>s.ch))){if(n&&(So(h,"beforeCursorEnter"),h.explicitlyCleared)){if(a.markedSpans){--l;continue}break}if(!h.atomic)continue;var u=h.find(0>o?-1:1);if(0==As(u,s)&&(u.ch+=o,u.ch<0?u=u.line>e.first?ge(e,Ps(u.line-1)):null:u.ch>a.text.length&&(u=u.line<e.first+e.size-1?Ps(u.line+1,0):null),!u)){if(r)return n?(e.cantEdit=!0,Ps(e.first,0)):Ae(e,t,i,!0);r=!0,u=t,o=-o}s=u;continue e}}return s}}function Ie(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Oe(e,t){for(var i=e.doc,n={},r=n.cursors=document.createDocumentFragment(),s=n.selection=document.createDocumentFragment(),o=0;o<i.sel.ranges.length;o++)if(t!==!1||o!=i.sel.primIndex){var a=i.sel.ranges[o],l=a.empty();(l||e.options.showCursorWhenSelecting)&&je(e,a,r),l||ze(e,a,s)}return n}function je(e,t,i){var n=dt(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),r=i.appendChild(Hr("div"," ","CodeMirror-cursor"));if(r.style.left=n.left+"px",r.style.top=n.top+"px",r.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var s=i.appendChild(Hr("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function ze(e,t,i){function n(e,t,i,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),a.appendChild(Hr("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==i?h-e:i)+"px; height: "+(n-t)+"px"))}function r(t,i,r){function s(i,n){return ut(e,Ps(t,i),"div",u,n)}var a,l,u=Kn(o,t),d=u.text.length;return Qr(tr(u),i||0,null==r?d:r,function(e,t,o){var u,p,f,m=s(e,"left");if(e==t)u=m,p=f=m.left;else{if(u=s(t-1,"right"),"rtl"==o){var g=m;m=u,u=g}p=m.left,f=u.right}null==i&&0==e&&(p=c),u.top-m.top>3&&(n(p,m.top,null,m.bottom),p=c,m.bottom<u.top&&n(p,m.bottom,null,u.top)),null==r&&t==d&&(f=h),(!a||m.top<a.top||m.top==a.top&&m.left<a.left)&&(a=m),(!l||u.bottom>l.bottom||u.bottom==l.bottom&&u.right>l.right)&&(l=u),c+1>p&&(p=c),n(p,u.top,f-p,u.bottom)}),{start:a,end:l}}var s=e.display,o=e.doc,a=document.createDocumentFragment(),l=Be(e.display),c=l.left,h=Math.max(s.sizerWidth,Ye(e)-s.sizer.offsetLeft)-l.right,u=t.from(),d=t.to();if(u.line==d.line)r(u.line,u.ch,d.ch);else{var p=Kn(o,u.line),f=Kn(o,d.line),m=mn(p)==mn(f),g=r(u.line,u.ch,m?p.text.length+1:null).end,_=r(d.line,m?0:null,d.ch).start;m&&(g.top<_.top-2?(n(g.right,g.top,null,g.bottom),n(c,_.top,_.left,_.bottom)):n(g.right,g.top,_.left-g.right,g.bottom)),g.bottom<_.top&&n(c,g.bottom,null,_.top)}i.appendChild(a)}function Ne(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function $e(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,jr(He,e))}function He(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,n=to(t.mode,Fe(e,t.frontier)),r=[];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,a=Pn(e,s,n,!0);s.styles=a.styles;var l=s.styleClasses,c=a.classes;c?s.styleClasses=c:l&&(s.styleClasses=null);for(var h=!o||o.length!=s.styles.length||l!=c&&(!l||!c||l.bgClass!=c.bgClass||l.textClass!=c.textClass),u=0;!h&&u<o.length;++u)h=o[u]!=s.styles[u];h&&r.push(t.frontier),s.stateAfter=to(t.mode,n)}else In(e,s.text,n),s.stateAfter=t.frontier%5==0?to(t.mode,n):null;return++t.frontier,+new Date>i?($e(e,e.options.workDelay),!0):void 0}),r.length&&Dt(e,function(){for(var t=0;t<r.length;t++)jt(e,r[t],"text")})}}function Re(e,t,i){for(var n,r,s=e.doc,o=i?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=s.first)return s.first;var l=Kn(s,a-1);if(l.stateAfter&&(!i||a<=s.frontier))return a;var c=Io(l.text,null,e.options.tabSize);(null==r||n>c)&&(r=a-1,n=c)}return r}function Fe(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState)return!0;var s=Re(e,t,i),o=s>n.first&&Kn(n,s-1).stateAfter;return o=o?to(n.mode,o):io(n.mode),n.iter(s,t,function(i){In(e,i.text,o);var a=s==t-1||s%5==0||s>=r.viewFrom&&s<r.viewTo;i.stateAfter=a?to(n.mode,o):null,++s}),i&&(n.frontier=s),o}function We(e){return e.lineSpace.offsetTop}function qe(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Be(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Fr(e.measure,Hr("pre","x")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ue(e){return Do-e.display.nativeBarWidth}function Ye(e){return e.display.scroller.clientWidth-Ue(e)-e.display.barWidth}function Ge(e){return e.display.scroller.clientHeight-Ue(e)-e.display.barHeight}function Ke(e,t,i){var n=e.options.lineWrapping,r=n&&Ye(e);if(!t.measure.heights||n&&t.measure.width!=r){var s=t.measure.heights=[];if(n){t.measure.width=r;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var l=o[a],c=o[a+1];Math.abs(l.bottom-c.bottom)>2&&s.push((l.bottom+c.top)/2-i.top)}}s.push(i.bottom-i.top)}}function Ve(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Xn(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Je(e,t){t=mn(t);var i=Xn(t),n=e.display.externalMeasured=new At(e.doc,t,i);n.lineN=i;var r=n.built=jn(e,n);return n.text=r.pre,Fr(e.display.lineMeasure,r.pre),n}function Qe(e,t,i,n){return et(e,Ze(e,t),i,n)}function Xe(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Nt(e,t)];var i=e.display.externalMeasured;return i&&t>=i.lineN&&t<i.lineN+i.size?i:void 0}function Ze(e,t){var i=Xn(t),n=Xe(e,i);n&&!n.text?n=null:n&&n.changes&&(j(e,n,i,I(e)),e.curOp.forceUpdate=!0),n||(n=Je(e,t));var r=Ve(n,t,i);return{line:t,view:n,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function et(e,t,i,n,r){t.before&&(i=-1);var s,o=i+(n||"");return t.cache.hasOwnProperty(o)?s=t.cache[o]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ke(e,t.view,t.rect),t.hasHeights=!0),s=it(e,t,i,n),s.bogus||(t.cache[o]=s)),{left:s.left,right:s.right,top:r?s.rtop:s.top,bottom:r?s.rbottom:s.bottom}}function tt(e,t,i){for(var n,r,s,o,a=0;a<e.length;a+=3){var l=e[a],c=e[a+1];if(l>t?(r=0,s=1,o="left"):c>t?(r=t-l,s=r+1):(a==e.length-3||t==c&&e[a+3]>t)&&(s=c-l,r=s-1,t>=c&&(o="right")),null!=r){if(n=e[a+2],l==c&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)for(;a&&e[a-2]==e[a-3]&&e[a-1].insertLeft;)n=e[(a-=3)+2],o="left";if("right"==i&&r==c-l)for(;a<e.length-3&&e[a+3]==e[a+4]&&!e[a+5].insertLeft;)n=e[(a+=3)+2],o="right";break}}return{node:n,start:r,end:s,collapse:o,coverStart:l,coverEnd:c}}function it(e,t,i,n){var r,s=tt(t.map,i,n),o=s.node,a=s.start,l=s.end,c=s.collapse;if(3==o.nodeType){for(var h=0;4>h;h++){for(;a&&$r(t.line.text.charAt(s.coverStart+a));)--a;for(;s.coverStart+l<s.coverEnd&&$r(t.line.text.charAt(s.coverStart+l));)++l;if(ps&&9>fs&&0==a&&l==s.coverEnd-s.coverStart)r=o.parentNode.getBoundingClientRect();else if(ps&&e.options.lineWrapping){var u=zo(o,a,l).getClientRects();r=u.length?u["right"==n?u.length-1:0]:Ns}else r=zo(o,a,l).getBoundingClientRect()||Ns;if(r.left||r.right||0==a)break;l=a,a-=1,c="right"}ps&&11>fs&&(r=nt(e.display.measure,r))}else{a>0&&(c=n="right");var u;r=e.options.lineWrapping&&(u=o.getClientRects()).length>1?u["right"==n?u.length-1:0]:o.getBoundingClientRect()}if(ps&&9>fs&&!a&&(!r||!r.left&&!r.right)){var d=o.parentNode.getClientRects()[0];r=d?{left:d.left,right:d.left+vt(e.display),top:d.top,bottom:d.bottom}:Ns}for(var p=r.top-t.rect.top,f=r.bottom-t.rect.top,m=(p+f)/2,g=t.view.measure.heights,h=0;h<g.length-1&&!(m<g[h]);h++);var _=h?g[h-1]:0,v=g[h],b={left:("right"==c?r.right:r.left)-t.rect.left,right:("left"==c?r.left:r.right)-t.rect.left,top:_,bottom:v};return r.left||r.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=p,b.rbottom=f),b}function nt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Jr(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*n,bottom:t.bottom*n}}function rt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function st(e){e.display.externalMeasure=null,Rr(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rt(e.display.view[t])}function ot(e){st(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function at(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function ct(e,t,i,n){if(t.widgets)for(var r=0;r<t.widgets.length;++r)if(t.widgets[r].above){var s=wn(t.widgets[r]);i.top+=s,i.bottom+=s}if("line"==n)return i;n||(n="local");var o=er(t);if("local"==n?o+=We(e.display):o-=e.display.viewOffset,"page"==n||"window"==n){var a=e.display.lineSpace.getBoundingClientRect();o+=a.top+("window"==n?0:lt());var l=a.left+("window"==n?0:at());i.left+=l,i.right+=l}return i.top+=o,i.bottom+=o,i}function ht(e,t,i){if("div"==i)return t;var n=t.left,r=t.top;if("page"==i)n-=at(),r-=lt();else if("local"==i||!i){var s=e.display.sizer.getBoundingClientRect();n+=s.left,r+=s.top}var o=e.display.lineSpace.getBoundingClientRect();return{left:n-o.left,top:r-o.top}}function ut(e,t,i,n,r){return n||(n=Kn(e.doc,t.line)),ct(e,n,Qe(e,n,t.ch,r),i)}function dt(e,t,i,n,r,s){function o(t,o){var a=et(e,r,t,o?"right":"left",s);return o?a.left=a.right:a.right=a.left,ct(e,n,a,i)}function a(e,t){var i=l[t],n=i.level%2;return e==Xr(i)&&t&&i.level<l[t-1].level?(i=l[--t],e=Zr(i)-(i.level%2?0:1),n=!0):e==Zr(i)&&t<l.length-1&&i.level<l[t+1].level&&(i=l[++t],e=Xr(i)-i.level%2,n=!1),n&&e==i.to&&e>i.from?o(e-1):o(e,n)}n=n||Kn(e.doc,t.line),r||(r=Ze(e,n));var l=tr(n),c=t.ch;if(!l)return o(c);var h=os(l,c),u=a(c,h);return null!=Xo&&(u.other=a(c,Xo)),u}function pt(e,t){var i=0,t=ge(e.doc,t);e.options.lineWrapping||(i=vt(e.display)*t.ch);var n=Kn(e.doc,t.line),r=er(n)+We(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function ft(e,t,i,n){var r=Ps(e,t);return r.xRel=n,i&&(r.outside=!0),r}function mt(e,t,i){var n=e.doc;if(i+=e.display.viewOffset,0>i)return ft(n.first,0,!0,-1);var r=Zn(n,i),s=n.first+n.size-1;if(r>s)return ft(n.first+n.size-1,Kn(n,s).text.length,!0,1);0>t&&(t=0);for(var o=Kn(n,r);;){var a=gt(e,o,r,t,i),l=pn(o),c=l&&l.find(0,!0);if(!l||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;r=Xn(o=c.to.line)}}function gt(e,t,i,n,r){function s(n){var r=dt(e,Ps(i,n),"line",t,c);return a=!0,o>r.bottom?r.left-l:o<r.top?r.left+l:(a=!1,r.left)}var o=r-er(t),a=!1,l=2*e.display.wrapper.clientWidth,c=Ze(e,t),h=tr(t),u=t.text.length,d=es(t),p=ts(t),f=s(d),m=a,g=s(p),_=a;if(n>g)return ft(i,p,_,1);for(;;){if(h?p==d||p==ls(t,d,1):1>=p-d){for(var v=f>n||g-n>=n-f?d:p,b=n-(v==d?f:g);$r(t.text.charAt(v));)++v;var y=ft(i,v,v==d?m:_,-1>b?-1:b>1?1:0);return y}var x=Math.ceil(u/2),w=d+x;if(h){w=d;for(var k=0;x>k;++k)w=ls(t,w,1)}var C=s(w);C>n?(p=w,g=C,(_=a)&&(g+=1e3),u=x):(d=w,f=C,m=a,u-=x)}}function _t(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Os){Os=Hr("pre");for(var t=0;49>t;++t)Os.appendChild(document.createTextNode("x")),Os.appendChild(Hr("br"));Os.appendChild(document.createTextNode("x"))}Fr(e.measure,Os);var i=Os.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),Rr(e.measure),i||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hr("span","xxxxxxxxxx"),i=Hr("pre",[t]);Fr(e.measure,i);var n=t.getBoundingClientRect(),r=(n.right-n.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function bt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Hs},$s?$s.ops.push(e.curOp):e.curOp.ownsGroup=$s={ops:[e.curOp],delayedCallbacks:[]}}function yt(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i]();for(var n=0;n<e.ops.length;n++){var r=e.ops[n];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++](r.cm)}}while(i<t.length)}function xt(e){var t=e.curOp,i=t.ownsGroup;if(i)try{yt(i)}finally{$s=null;for(var n=0;n<i.ops.length;n++)i.ops[n].cm.curOp=null;wt(i)}}function wt(e){for(var t=e.ops,i=0;i<t.length;i++)kt(t[i]);for(var i=0;i<t.length;i++)Ct(t[i]);for(var i=0;i<t.length;i++)Tt(t[i]);for(var i=0;i<t.length;i++)St(t[i]);for(var i=0;i<t.length;i++)Mt(t[i])}function kt(e){var t=e.cm,i=t.display;S(t),e.updateMaxLine&&d(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Tt(e){var t=e.cm,i=t.display;e.updatedDisplay&&P(t),e.barMeasure=f(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Ue(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ye(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function St(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ti(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&L(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&v(t,e.barMeasure),e.selectionChanged&&Ne(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==Wr()&&J(e.cm)}function Mt(e){var t=e.cm,i=t.display,n=t.doc;if(e.updatedDisplay&&D(t,e.update),null==i.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(i.wheelStartX=i.wheelStartY=null),null==e.scrollTop||i.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(i.scroller.scrollHeight-i.scroller.clientHeight,e.scrollTop)),i.scrollbars.setScrollTop(n.scrollTop),i.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||i.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(i.scroller.scrollWidth-Ye(t),e.scrollLeft)),i.scrollbars.setScrollLeft(n.scrollLeft),i.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var r=Li(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Ei(t,r)}var s=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(s)for(var a=0;a<s.length;++a)s[a].lines.length||So(s[a],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&So(o[a],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&So(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Dt(e,t){if(e.curOp)return t();bt(e);try{return t()}finally{xt(e)}}function Et(e,t){return function(){if(e.curOp)return t.apply(e,arguments);bt(e);try{return t.apply(e,arguments)}finally{xt(e)}}}function Lt(e){return function(){if(this.curOp)return e.apply(this,arguments);bt(this);try{return e.apply(this,arguments)}finally{xt(this)}}}function Pt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);bt(t);try{return e.apply(this,arguments)}finally{xt(t)}}}function At(e,t,i){this.line=t,this.rest=gn(t),this.size=this.rest?Xn(Er(this.rest))-i+1:1,this.node=this.text=null,this.hidden=bn(e,t)}function It(e,t,i){for(var n,r=[],s=t;i>s;s=n){var o=new At(e.doc,Kn(e.doc,s),s);n=s+o.size,r.push(o)}return r}function Ot(e,t,i,n){null==t&&(t=e.doc.first),null==i&&(i=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&i<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Ls&&_n(e.doc,t)<r.viewTo&&zt(e);else if(i<=r.viewFrom)Ls&&vn(e.doc,i+n)>r.viewFrom?zt(e):(r.viewFrom+=n,r.viewTo+=n);else if(t<=r.viewFrom&&i>=r.viewTo)zt(e);else if(t<=r.viewFrom){var s=$t(e,i,i+n,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=n):zt(e)}else if(i>=r.viewTo){var s=$t(e,t,t,-1);s?(r.view=r.view.slice(0,s.index),r.viewTo=s.lineN):zt(e)}else{var o=$t(e,t,t,-1),a=$t(e,i,i+n,1);o&&a?(r.view=r.view.slice(0,o.index).concat(It(e,o.lineN,a.lineN)).concat(r.view.slice(a.index)),r.viewTo+=n):zt(e)}var l=r.externalMeasured;l&&(i<l.lineN?l.lineN+=n:t<l.lineN+l.size&&(r.externalMeasured=null))}function jt(e,t,i){e.curOp.viewChanged=!0;var n=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var s=n.view[Nt(e,t)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==Lr(o,i)&&o.push(i)}}}function zt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Nt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var i=e.display.view,n=0;n<i.length;n++)if(t-=i[n].size,0>t)return n}function $t(e,t,i,n){var r,s=Nt(e,t),o=e.display.view;if(!Ls||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var a=0,l=e.display.viewFrom;s>a;a++)l+=o[a].size;if(l!=t){if(n>0){if(s==o.length-1)return null;r=l+o[s].size-t,s++}else r=l-t;t+=r,i+=r}for(;_n(e.doc,i)!=i;){if(s==(0>n?0:o.length-1))return null;i+=n*o[s-(0>n?1:0)].size,s+=n}return{index:s,lineN:i}}function Ht(e,t,i){var n=e.display,r=n.view;0==r.length||t>=n.viewTo||i<=n.viewFrom?(n.view=It(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=It(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Nt(e,t))),n.viewFrom=t,n.viewTo<i?n.view=n.view.concat(It(e,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,Nt(e,i)))),n.viewTo=i}function Rt(e){for(var t=e.display.view,i=0,n=0;n<t.length;n++){var r=t[n];r.hidden||r.node&&!r.changes||++i}return i}function Ft(e){function t(){r.activeTouch&&(s=setTimeout(function(){r.activeTouch=null},1e3),o=r.activeTouch,o.end=+new Date)}function i(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var i=t.left-e.left,n=t.top-e.top;return i*i+n*n>400}var r=e.display;Co(r.scroller,"mousedown",Et(e,Yt)),ps&&11>fs?Co(r.scroller,"dblclick",Et(e,function(t){if(!wr(e,t)){var i=Ut(e,t);if(i&&!Qt(e,t)&&!Bt(e.display,t)){xo(t);var n=e.findWordAt(i);xe(e.doc,n.anchor,n.head)}}})):Co(r.scroller,"dblclick",function(t){wr(e,t)||xo(t)}),Ds||Co(r.scroller,"contextmenu",function(t){mi(e,t)});var s,o={end:0};Co(r.scroller,"touchstart",function(e){if(!i(e)){clearTimeout(s);var t=+new Date;r.activeTouch={start:t,moved:!1,prev:t-o.end<=300?o:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),Co(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),Co(r.scroller,"touchend",function(i){var s=r.activeTouch;if(s&&!Bt(r,i)&&null!=s.left&&!s.moved&&new Date-s.start<300){var o,a=e.coordsChar(r.activeTouch,"page");o=!s.prev||n(s,s.prev)?new de(a,a):!s.prev.prev||n(s,s.prev.prev)?e.findWordAt(a):new de(Ps(a.line,0),ge(e.doc,Ps(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),xo(i)}t()}),Co(r.scroller,"touchcancel",t),Co(r.scroller,"scroll",function(){r.scroller.clientHeight&&(ei(e,r.scroller.scrollTop),ti(e,r.scroller.scrollLeft,!0),So(e,"scroll",e))}),Co(r.scroller,"mousewheel",function(t){ii(e,t)}),Co(r.scroller,"DOMMouseScroll",function(t){ii(e,t)}),Co(r.wrapper,"scroll",function(){r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={simple:function(t){wr(e,t)||ko(t)},start:function(t){Zt(e,t)},drop:Et(e,Xt)};var a=r.input.getField();Co(a,"keyup",function(t){hi.call(e,t)}),Co(a,"keydown",Et(e,li)),Co(a,"keypress",Et(e,ui)),Co(a,"focus",jr(pi,e)),Co(a,"blur",jr(fi,e))}function Wt(t,i,n){var r=n&&n!=e.Init;if(!i!=!r){var s=t.display.dragFunctions,o=i?Co:To;o(t.display.scroller,"dragstart",s.start),o(t.display.scroller,"dragenter",s.simple),o(t.display.scroller,"dragover",s.simple),o(t.display.scroller,"drop",s.drop)}}function qt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Bt(e,t){for(var i=vr(t);i!=e.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==e.sizer&&i!=e.mover)return!0}function Ut(e,t,i,n){var r=e.display;if(!i&&"true"==vr(t).getAttribute("cm-not-content"))return null;var s,o,a=r.lineSpace.getBoundingClientRect();try{s=t.clientX-a.left,o=t.clientY-a.top}catch(t){return null}var l,c=mt(e,s,o);if(n&&1==c.xRel&&(l=Kn(e.doc,c.line).text).length==c.ch){var h=Io(l,l.length,e.options.tabSize)-l.length;c=Ps(c.line,Math.max(0,Math.round((s-Be(e.display).left)/vt(e.display))-h))}return c}function Yt(e){var t=this,i=t.display;if(!(i.activeTouch&&i.input.supportsTouch()||wr(t,e))){if(i.shift=e.shiftKey,Bt(i,e))return void(ms||(i.scroller.draggable=!1,setTimeout(function(){i.scroller.draggable=!0},100)));if(!Qt(t,e)){var n=Ut(t,e);switch(window.focus(),br(e)){case 1:n?Gt(t,e,n):vr(e)==i.scroller&&xo(e);break;case 2:ms&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){i.input.focus()},20),xo(e);break;case 3:Ds?mi(t,e):di(t)}}}}function Gt(e,t,i){ps?setTimeout(jr(J,e),0):e.curOp.focus=Wr();var n,r=+new Date;zs&&zs.time>r-400&&0==As(zs.pos,i)?n="triple":js&&js.time>r-400&&0==As(js.pos,i)?(n="double",zs={time:r,pos:i}):(n="single",js={time:r,pos:i});var s,o=e.doc.sel,a=Cs?t.metaKey:t.ctrlKey;e.options.dragDrop&&Yo&&!Q(e)&&"single"==n&&(s=o.contains(i))>-1&&(As((s=o.ranges[s]).from(),i)<0||i.xRel>0)&&(As(s.to(),i)>0||i.xRel<0)?Kt(e,t,i,a):Vt(e,t,i,n,a)}function Kt(e,t,i,n){var r=e.display,s=+new Date,o=Et(e,function(a){ms&&(r.scroller.draggable=!1),e.state.draggingText=!1,To(document,"mouseup",o),To(r.scroller,"drop",o),Math.abs(t.clientX-a.clientX)+Math.abs(t.clientY-a.clientY)<10&&(xo(a),!n&&+new Date-200<s&&xe(e.doc,i),ms||ps&&9==fs?setTimeout(function(){document.body.focus(),r.input.focus()},20):r.input.focus())});ms&&(r.scroller.draggable=!0),e.state.draggingText=o,r.scroller.dragDrop&&r.scroller.dragDrop(),Co(document,"mouseup",o),Co(r.scroller,"drop",o)}function Vt(e,t,i,n,r){function s(t){if(0!=As(g,t))if(g=t,"rect"==n){for(var r=[],s=e.options.tabSize,o=Io(Kn(c,i.line).text,i.ch,s),a=Io(Kn(c,t.line).text,t.ch,s),l=Math.min(o,a),p=Math.max(o,a),f=Math.min(i.line,t.line),m=Math.min(e.lastLine(),Math.max(i.line,t.line));m>=f;f++){var _=Kn(c,f).text,v=Mr(_,l,s);l==p?r.push(new de(Ps(f,v),Ps(f,v))):_.length>v&&r.push(new de(Ps(f,v),Ps(f,Mr(_,p,s))))}r.length||r.push(new de(i,i)),Me(c,pe(d.ranges.slice(0,u).concat(r),u),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=h,y=b.anchor,x=t;if("single"!=n){if("double"==n)var w=e.findWordAt(t);else var w=new de(Ps(t.line,0),ge(c,Ps(t.line+1,0)));As(w.anchor,y)>0?(x=w.head,y=V(b.from(),w.anchor)):(x=w.anchor,y=K(b.to(),w.head))}var r=d.ranges.slice(0);r[u]=new de(ge(c,y),x),Me(c,pe(r,u),Po)}}function o(t){var i=++v,r=Ut(e,t,!0,"rect"==n);if(r)if(0!=As(r,g)){e.curOp.focus=Wr(),s(r);var a=y(l,c);(r.line>=a.to||r.line<a.from)&&setTimeout(Et(e,function(){v==i&&o(t)}),150)}else{var h=t.clientY<_.top?-20:t.clientY>_.bottom?20:0;h&&setTimeout(Et(e,function(){v==i&&(l.scroller.scrollTop+=h,o(t))}),50)}}function a(e){v=1/0,xo(e),l.input.focus(),To(document,"mousemove",b),To(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;xo(t);var h,u,d=c.sel,p=d.ranges;if(r&&!t.shiftKey?(u=c.sel.contains(i),h=u>-1?p[u]:new de(i,i)):(h=c.sel.primary(),u=c.sel.primIndex),t.altKey)n="rect",r||(h=new de(i,i)),i=Ut(e,t,!0,!0),u=-1;else if("double"==n){var f=e.findWordAt(i);h=e.display.shift||c.extend?ye(c,h,f.anchor,f.head):f}else if("triple"==n){var m=new de(Ps(i.line,0),ge(c,Ps(i.line+1,0)));h=e.display.shift||c.extend?ye(c,h,m.anchor,m.head):m}else h=ye(c,h,i);r?-1==u?(u=p.length,Me(c,pe(p.concat([h]),u),{scroll:!1,origin:"*mouse"})):p.length>1&&p[u].empty()&&"single"==n&&!t.shiftKey?(Me(c,pe(p.slice(0,u).concat(p.slice(u+1)),0)),d=c.sel):ke(c,u,h,Po):(u=0,Me(c,new ue([h],0),Po),d=c.sel);var g=i,_=l.wrapper.getBoundingClientRect(),v=0,b=Et(e,function(e){br(e)?o(e):a(e)}),x=Et(e,a);Co(document,"mousemove",b),Co(document,"mouseup",x)}function Jt(e,t,i,n,r){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&xo(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Cr(e,i))return _r(t);o-=l.top-a.viewOffset;for(var c=0;c<e.options.gutters.length;++c){var h=a.gutters.childNodes[c];if(h&&h.getBoundingClientRect().right>=s){var u=Zn(e.doc,o),d=e.options.gutters[c];return r(e,i,e,u,d,t),_r(t)}}}function Qt(e,t){return Jt(e,t,"gutterClick",!0,yr)}function Xt(e){var t=this;if(!wr(t,e)&&!Bt(t.display,e)){xo(e),ps&&(Rs=+new Date);var i=Ut(t,e,!0),n=e.dataTransfer.files;if(i&&!Q(t))if(n&&n.length&&window.FileReader&&window.File)for(var r=n.length,s=Array(r),o=0,a=function(e,n){var a=new FileReader;a.onload=Et(t,function(){if(s[n]=a.result,++o==r){i=ge(t.doc,i);var e={from:i,to:i,text:t.doc.splitLines(s.join(t.doc.lineSeparator())),origin:"paste"};wi(t.doc,e),Se(t.doc,fe(i,Ys(e)))}}),a.readAsText(e)},l=0;r>l;++l)a(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var s=e.dataTransfer.getData("Text");if(s){if(t.state.draggingText&&!(Cs?e.altKey:e.ctrlKey))var c=t.listSelections();if(De(t.doc,fe(i,i)),c)for(var l=0;l<c.length;++l)Di(t.doc,"",c[l].anchor,c[l].head,"drag");t.replaceSelection(s,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Zt(e,t){if(ps&&(!e.state.draggingText||+new Date-Rs<100))return void ko(t);if(!wr(e,t)&&!Bt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!bs)){var i=Hr("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",vs&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),vs&&i.parentNode.removeChild(i)}}function ei(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,hs||E(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),hs&&E(e),$e(e,100))}function ti(e,t,i){(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ii(e,t){var i=qs(t),n=i.x,r=i.y,s=e.display,o=s.scroller;if(n&&o.scrollWidth>o.clientWidth||r&&o.scrollHeight>o.clientHeight){if(r&&Cs&&ms)e:for(var a=t.target,l=s.view;a!=o;a=a.parentNode)for(var c=0;c<l.length;c++)if(l[c].node==a){e.display.currentWheelTarget=a;break e}if(n&&!hs&&!vs&&null!=Ws)return r&&ei(e,Math.max(0,Math.min(o.scrollTop+r*Ws,o.scrollHeight-o.clientHeight))),ti(e,Math.max(0,Math.min(o.scrollLeft+n*Ws,o.scrollWidth-o.clientWidth))),xo(t),void(s.wheelStartX=null);if(r&&null!=Ws){var h=r*Ws,u=e.doc.scrollTop,d=u+s.wrapper.clientHeight;0>h?u=Math.max(0,u+h-50):d=Math.min(e.doc.height,d+h+50),E(e,{top:u,bottom:d})}20>Fs&&(null==s.wheelStartX?(s.wheelStartX=o.scrollLeft,s.wheelStartY=o.scrollTop,s.wheelDX=n,s.wheelDY=r,setTimeout(function(){if(null!=s.wheelStartX){var e=o.scrollLeft-s.wheelStartX,t=o.scrollTop-s.wheelStartY,i=t&&s.wheelDY&&t/s.wheelDY||e&&s.wheelDX&&e/s.wheelDX;
s.wheelStartX=s.wheelStartY=null,i&&(Ws=(Ws*Fs+i)/(Fs+1),++Fs)}},200)):(s.wheelDX+=n,s.wheelDY+=r))}}function ni(e,t,i){if("string"==typeof t&&(t=no[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,r=!1;try{Q(e)&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),r=t(e)!=Eo}finally{e.display.shift=n,e.state.suppressEdits=!1}return r}function ri(e,t,i){for(var n=0;n<e.state.keyMaps.length;n++){var r=so(t,e.state.keyMaps[n],i,e);if(r)return r}return e.options.extraKeys&&so(t,e.options.extraKeys,i,e)||so(t,e.options.keyMap,i,e)}function si(e,t,i,n){var r=e.state.keySeq;if(r){if(oo(t))return"handled";Bs.set(50,function(){e.state.keySeq==r&&(e.state.keySeq=null,e.display.input.reset())}),t=r+" "+t}var s=ri(e,t,n);return"multi"==s&&(e.state.keySeq=t),"handled"==s&&yr(e,"keyHandled",e,t,i),("handled"==s||"multi"==s)&&(xo(i),Ne(e)),r&&!s&&/\'$/.test(t)?(xo(i),!0):!!s}function oi(e,t){var i=ao(t,!0);return i?t.shiftKey&&!e.state.keySeq?si(e,"Shift-"+i,t,function(t){return ni(e,t,!0)})||si(e,i,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?ni(e,t):void 0}):si(e,i,t,function(t){return ni(e,t)}):!1}function ai(e,t,i){return si(e,"'"+i+"'",t,function(t){return ni(e,t,!0)})}function li(e){var t=this;if(t.curOp.focus=Wr(),!wr(t,e)){ps&&11>fs&&27==e.keyCode&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=16==i||e.shiftKey;var n=oi(t,e);vs&&(Us=n?i:null,!n&&88==i&&!Vo&&(Cs?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=i||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||ci(t)}}function ci(e){function t(e){18!=e.keyCode&&e.altKey||(qo(i,"CodeMirror-crosshair"),To(document,"keyup",t),To(document,"mouseover",t))}var i=e.display.lineDiv;Bo(i,"CodeMirror-crosshair"),Co(document,"keyup",t),Co(document,"mouseover",t)}function hi(e){16==e.keyCode&&(this.doc.sel.shift=!1),wr(this,e)}function ui(e){var t=this;if(!(Bt(t.display,e)||wr(t,e)||e.ctrlKey&&!e.altKey||Cs&&e.metaKey)){var i=e.keyCode,n=e.charCode;if(vs&&i==Us)return Us=null,void xo(e);if(!vs||e.which&&!(e.which<10)||!oi(t,e)){var r=String.fromCharCode(null==n?i:n);ai(t,e,r)||t.display.input.onKeyPress(e)}}}function di(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,fi(e))},100)}function pi(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(So(e,"focus",e),e.state.focused=!0,Bo(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ms&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ne(e))}function fi(e){e.state.delayingBlurEvent||(e.state.focused&&(So(e,"blur",e),e.state.focused=!1,qo(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mi(e,t){Bt(e.display,t)||gi(e,t)||e.display.input.onContextMenu(t)}function gi(e,t){return Cr(e,"gutterContextMenu")?Jt(e,t,"gutterContextMenu",!1,So):!1}function _i(e,t){if(As(e,t.from)<0)return e;if(As(e,t.to)<=0)return Ys(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ys(t).ch-t.to.ch),Ps(i,n)}function vi(e,t){for(var i=[],n=0;n<e.sel.ranges.length;n++){var r=e.sel.ranges[n];i.push(new de(_i(r.anchor,t),_i(r.head,t)))}return pe(i,e.sel.primIndex)}function bi(e,t,i){return e.line==t.line?Ps(i.line,e.ch-t.ch+i.ch):Ps(i.line+(e.line-t.line),e.ch)}function yi(e,t,i){for(var n=[],r=Ps(e.first,0),s=r,o=0;o<t.length;o++){var a=t[o],l=bi(a.from,r,s),c=bi(Ys(a),r,s);if(r=a.to,s=c,"around"==i){var h=e.sel.ranges[o],u=As(h.head,h.anchor)<0;n[o]=new de(u?c:l,u?l:c)}else n[o]=new de(l,l)}return new ue(n,e.sel.primIndex)}function xi(e,t,i){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return i&&(n.update=function(t,i,n,r){t&&(this.from=ge(e,t)),i&&(this.to=ge(e,i)),n&&(this.text=n),void 0!==r&&(this.origin=r)}),So(e,"beforeChange",e,n),e.cm&&So(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function wi(e,t,i){if(e.cm){if(!e.cm.curOp)return Et(e.cm,wi)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(Cr(e,"beforeChange")||e.cm&&Cr(e.cm,"beforeChange"))||(t=xi(e,t,!0))){var n=Es&&!i&&sn(e,t.from,t.to);if(n)for(var r=n.length-1;r>=0;--r)ki(e,{from:n[r].from,to:n[r].to,text:r?[""]:t.text});else ki(e,t)}}function ki(e,t){if(1!=t.text.length||""!=t.text[0]||0!=As(t.from,t.to)){var i=vi(e,t);or(e,t,i,e.cm?e.cm.curOp.id:NaN),Si(e,t,i,tn(e,t));var n=[];Yn(e,function(e,i){i||-1!=Lr(n,e.history)||(gr(e.history,t),n.push(e.history)),Si(e,t,null,tn(e,t))})}}function Ci(e,t,i){if(!e.cm||!e.cm.state.suppressEdits){for(var n,r=e.history,s=e.sel,o="undo"==t?r.done:r.undone,a="undo"==t?r.undone:r.done,l=0;l<o.length&&(n=o[l],i?!n.ranges||n.equals(e.sel):n.ranges);l++);if(l!=o.length){for(r.lastOrigin=r.lastSelOrigin=null;n=o.pop(),n.ranges;){if(cr(n,a),i&&!n.equals(e.sel))return void Me(e,n,{clearRedo:!1});s=n}var c=[];cr(s,a),a.push({changes:c,generation:r.generation}),r.generation=n.generation||++r.maxGeneration;for(var h=Cr(e,"beforeChange")||e.cm&&Cr(e.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var u=n.changes[l];if(u.origin=t,h&&!xi(e,u,!1))return void(o.length=0);c.push(nr(e,u));var d=l?vi(e,u):Er(o);Si(e,u,d,rn(e,u)),!l&&e.cm&&e.cm.scrollIntoView({from:u.from,to:Ys(u)});var p=[];Yn(e,function(e,t){t||-1!=Lr(p,e.history)||(gr(e.history,u),p.push(e.history)),Si(e,u,null,rn(e,u))})}}}}function Ti(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Pr(e.sel.ranges,function(e){return new de(Ps(e.anchor.line+t,e.anchor.ch),Ps(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Ot(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;n<i.viewTo;n++)jt(e.cm,n,"gutter")}}function Si(e,t,i,n){if(e.cm&&!e.cm.curOp)return Et(e.cm,Si)(e,t,i,n);if(t.to.line<e.first)return void Ti(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var r=t.text.length-1-(e.first-t.from.line);Ti(e,r),t={from:Ps(e.first,0),to:Ps(t.to.line+r,t.to.ch),text:[Er(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:Ps(s,Kn(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vn(e,t.from,t.to),i||(i=vi(e,t)),e.cm?Mi(e.cm,t,n):qn(e,t,n),De(e,i,Lo)}}function Mi(e,t,i){var n=e.doc,r=e.display,o=t.from,a=t.to,l=!1,c=o.line;e.options.lineWrapping||(c=Xn(mn(Kn(n,o.line))),n.iter(c,a.line+1,function(e){return e==r.maxLine?(l=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&kr(e),qn(n,t,i,s(e)),e.options.lineWrapping||(n.iter(c,o.line+t.text.length,function(e){var t=u(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,o.line),$e(e,400);var h=t.text.length-(a.line-o.line)-1;t.full?Ot(e):o.line!=a.line||1!=t.text.length||Wn(e.doc,t)?Ot(e,o.line,a.line+1,h):jt(e,o.line,"text");var d=Cr(e,"changes"),p=Cr(e,"change");if(p||d){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};p&&yr(e,"change",e,f),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function Di(e,t,i,n,r){if(n||(n=i),As(n,i)<0){var s=n;n=i,i=s}"string"==typeof t&&(t=e.splitLines(t)),wi(e,{from:i,to:n,text:t,origin:r})}function Ei(e,t){if(!wr(e,"scrollCursorIntoView")){var i=e.display,n=i.sizer.getBoundingClientRect(),r=null;if(t.top+n.top<0?r=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!xs){var s=Hr("div","​",null,"position: absolute; top: "+(t.top-i.viewOffset-We(e.display))+"px; height: "+(t.bottom-t.top+Ue(e)+i.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(r),e.display.lineSpace.removeChild(s)}}}function Li(e,t,i,n){null==n&&(n=0);for(var r=0;5>r;r++){var s=!1,o=dt(e,t),a=i&&i!=t?dt(e,i):o,l=Ai(e,Math.min(o.left,a.left),Math.min(o.top,a.top)-n,Math.max(o.left,a.left),Math.max(o.bottom,a.bottom)+n),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=l.scrollTop&&(ei(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(s=!0)),null!=l.scrollLeft&&(ti(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(s=!0)),!s)break}return o}function Pi(e,t,i,n,r){var s=Ai(e,t,i,n,r);null!=s.scrollTop&&ei(e,s.scrollTop),null!=s.scrollLeft&&ti(e,s.scrollLeft)}function Ai(e,t,i,n,r){var s=e.display,o=_t(e.display);0>i&&(i=0);var a=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:s.scroller.scrollTop,l=Ge(e),c={};r-i>l&&(r=i+l);var h=e.doc.height+qe(s),u=o>i,d=r>h-o;if(a>i)c.scrollTop=u?0:i;else if(r>a+l){var p=Math.min(i,(d?h:r)-l);p!=a&&(c.scrollTop=p)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:s.scroller.scrollLeft,m=Ye(e)-(e.options.fixedGutter?s.gutters.offsetWidth:0),g=n-t>m;return g&&(n=t+m),10>t?c.scrollLeft=0:f>t?c.scrollLeft=Math.max(0,t-(g?0:10)):n>m+f-3&&(c.scrollLeft=n+(g?0:10)-m),c}function Ii(e,t,i){(null!=t||null!=i)&&ji(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=i&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+i)}function Oi(e){ji(e);var t=e.getCursor(),i=t,n=t;e.options.lineWrapping||(i=t.ch?Ps(t.line,t.ch-1):t,n=Ps(t.line,t.ch+1)),e.curOp.scrollToPos={from:i,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function ji(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=pt(e,t.from),n=pt(e,t.to),r=Ai(e,Math.min(i.left,n.left),Math.min(i.top,n.top)-t.margin,Math.max(i.right,n.right),Math.max(i.bottom,n.bottom)+t.margin);e.scrollTo(r.scrollLeft,r.scrollTop)}}function zi(e,t,i,n){var r,s=e.doc;null==i&&(i="add"),"smart"==i&&(s.mode.indent?r=Fe(e,t):i="prev");var o=e.options.tabSize,a=Kn(s,t),l=Io(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var c,h=a.text.match(/^\s*/)[0];if(n||/\S/.test(a.text)){if("smart"==i&&(c=s.mode.indent(r,a.text.slice(h.length),a.text),c==Eo||c>150)){if(!n)return;i="prev"}}else c=0,i="not";"prev"==i?c=t>s.first?Io(Kn(s,t-1).text,null,o):0:"add"==i?c=l+e.options.indentUnit:"subtract"==i?c=l-e.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var u="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/o);p;--p)d+=o,u+="	";if(c>d&&(u+=Dr(c-d)),u!=h)return Di(s,u,Ps(t,0),Ps(t,h.length),"+input"),a.stateAfter=null,!0;for(var p=0;p<s.sel.ranges.length;p++){var f=s.sel.ranges[p];if(f.head.line==t&&f.head.ch<h.length){var d=Ps(t,h.length);ke(s,p,new de(d,d));break}}}function Ni(e,t,i,n){var r=t,s=t;return"number"==typeof t?s=Kn(e,me(e,t)):r=Xn(t),null==r?null:(n(s,r)&&e.cm&&jt(e.cm,r,i),s)}function $i(e,t){for(var i=e.doc.sel.ranges,n=[],r=0;r<i.length;r++){for(var s=t(i[r]);n.length&&As(s.from,Er(n).to)<=0;){var o=n.pop();if(As(o.from,s.from)<0){s.from=o.from;break}}n.push(s)}Dt(e,function(){for(var t=n.length-1;t>=0;t--)Di(e.doc,"",n[t].from,n[t].to,"+delete");Oi(e)})}function Hi(e,t,i,n,r){function s(){var t=a+i;return t<e.first||t>=e.first+e.size?u=!1:(a=t,h=Kn(e,t))}function o(e){var t=(r?ls:cs)(h,l,i,!0);if(null==t){if(e||!s())return u=!1;l=r?(0>i?ts:es)(h):0>i?h.text.length:0}else l=t;return!0}var a=t.line,l=t.ch,c=i,h=Kn(e,a),u=!0;if("char"==n)o();else if("column"==n)o(!0);else if("word"==n||"group"==n)for(var d=null,p="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>i)||o(!m);m=!1){var g=h.text.charAt(l)||"\n",_=zr(g,f)?"w":p&&"\n"==g?"n":!p||/\s/.test(g)?null:"p";if(!p||m||_||(_="s"),d&&d!=_){0>i&&(i=1,o());break}if(_&&(d=_),i>0&&!o(!m))break}var v=Ae(e,Ps(a,l),c,!0);return u||(v.hitSide=!0),v}function Ri(e,t,i,n){var r,s=e.doc,o=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);r=t.top+i*(a-(0>i?1.5:.5)*_t(e.display))}else"line"==n&&(r=i>0?t.bottom+3:t.top-3);for(;;){var l=mt(e,o,r);if(!l.outside)break;if(0>i?0>=r:r>=s.height){l.hitSide=!0;break}r+=5*i}return l}function Fi(t,i,n,r){e.defaults[t]=i,n&&(Ks[t]=r?function(e,t,i){i!=Vs&&n(e,t,i)}:n)}function Wi(e){for(var t,i,n,r,s=e.split(/-(?!$)/),e=s[s.length-1],o=0;o<s.length-1;o++){var a=s[o];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else{if(!/^s(hift)$/i.test(a))throw new Error("Unrecognized modifier name: "+a);n=!0}}return t&&(e="Alt-"+e),i&&(e="Ctrl-"+e),r&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function qi(e){return"string"==typeof e?ro[e]:e}function Bi(e,t,i,n,r){if(n&&n.shared)return Ui(e,t,i,n,r);if(e.cm&&!e.cm.curOp)return Et(e.cm,Bi)(e,t,i,n,r);var s=new ho(e,r),o=As(t,i);if(n&&Or(n,s,!1),o>0||0==o&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=Hr("span",[s.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(fn(e,t.line,t,i,s)||t.line!=i.line&&fn(e,i.line,t,i,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ls=!0}s.addToHistory&&or(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var a,l=t.line,c=e.cm;if(e.iter(l,i.line+1,function(e){c&&s.collapsed&&!c.options.lineWrapping&&mn(e)==c.display.maxLine&&(a=!0),s.collapsed&&l!=t.line&&Qn(e,0),Xi(e,new Vi(s,l==t.line?t.ch:null,l==i.line?i.ch:null)),++l}),s.collapsed&&e.iter(t.line,i.line+1,function(t){bn(e,t)&&Qn(t,0)}),s.clearOnEnter&&Co(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(Es=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++co,s.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),s.collapsed)Ot(c,t.line,i.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(var h=t.line;h<=i.line;h++)jt(c,h,"text");s.atomic&&Le(c.doc),yr(c,"markerAdded",c,s)}return s}function Ui(e,t,i,n,r){n=Or(n),n.shared=!1;var s=[Bi(e,t,i,n,r)],o=s[0],a=n.widgetNode;return Yn(e,function(e){a&&(n.widgetNode=a.cloneNode(!0)),s.push(Bi(e,ge(e,t),ge(e,i),n,r));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;o=Er(s)}),new uo(s,o)}function Yi(e){return e.findMarks(Ps(e.first,0),e.clipPos(Ps(e.lastLine())),function(e){return e.parent})}function Gi(e,t){for(var i=0;i<t.length;i++){var n=t[i],r=n.find(),s=e.clipPos(r.from),o=e.clipPos(r.to);if(As(s,o)){var a=Bi(e,s,o,n.primary,n.primary.type);n.markers.push(a),a.parent=n}}}function Ki(e){for(var t=0;t<e.length;t++){var i=e[t],n=[i.primary.doc];Yn(i.primary.doc,function(e){n.push(e)});for(var r=0;r<i.markers.length;r++){var s=i.markers[r];-1==Lr(n,s.doc)&&(s.parent=null,i.markers.splice(r--,1))}}}function Vi(e,t,i){this.marker=e,this.from=t,this.to=i}function Ji(e,t){if(e)for(var i=0;i<e.length;++i){var n=e[i];if(n.marker==t)return n}}function Qi(e,t){for(var i,n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i}function Xi(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Zi(e,t,i){if(e)for(var n,r=0;r<e.length;++r){var s=e[r],o=s.marker,a=null==s.from||(o.inclusiveLeft?s.from<=t:s.from<t);if(a||s.from==t&&"bookmark"==o.type&&(!i||!s.marker.insertLeft)){var l=null==s.to||(o.inclusiveRight?s.to>=t:s.to>t);(n||(n=[])).push(new Vi(o,s.from,l?null:s.to))}}return n}function en(e,t,i){if(e)for(var n,r=0;r<e.length;++r){var s=e[r],o=s.marker,a=null==s.to||(o.inclusiveRight?s.to>=t:s.to>t);if(a||s.from==t&&"bookmark"==o.type&&(!i||s.marker.insertLeft)){var l=null==s.from||(o.inclusiveLeft?s.from<=t:s.from<t);(n||(n=[])).push(new Vi(o,l?null:s.from-t,null==s.to?null:s.to-t))}}return n}function tn(e,t){if(t.full)return null;var i=ve(e,t.from.line)&&Kn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Kn(e,t.to.line).markedSpans;if(!i&&!n)return null;var r=t.from.ch,s=t.to.ch,o=0==As(t.from,t.to),a=Zi(i,r,o),l=en(n,s,o),c=1==t.text.length,h=Er(t.text).length+(c?r:0);if(a)for(var u=0;u<a.length;++u){var d=a[u];if(null==d.to){var p=Ji(l,d.marker);p?c&&(d.to=null==p.to?null:p.to+h):d.to=r}}if(l)for(var u=0;u<l.length;++u){var d=l[u];if(null!=d.to&&(d.to+=h),null==d.from){var p=Ji(a,d.marker);p||(d.from=h,c&&(a||(a=[])).push(d))}else d.from+=h,c&&(a||(a=[])).push(d)}a&&(a=nn(a)),l&&l!=a&&(l=nn(l));var f=[a];if(!c){var m,g=t.text.length-2;if(g>0&&a)for(var u=0;u<a.length;++u)null==a[u].to&&(m||(m=[])).push(new Vi(a[u].marker,null,null));for(var u=0;g>u;++u)f.push(m);f.push(l)}return f}function nn(e){for(var t=0;t<e.length;++t){var i=e[t];null!=i.from&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function rn(e,t){var i=dr(e,t),n=tn(e,t);if(!i)return n;if(!n)return i;for(var r=0;r<i.length;++r){var s=i[r],o=n[r];if(s&&o)e:for(var a=0;a<o.length;++a){for(var l=o[a],c=0;c<s.length;++c)if(s[c].marker==l.marker)continue e;s.push(l)}else o&&(i[r]=o)}return i}function sn(e,t,i){var n=null;if(e.iter(t.line,i.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var i=e.markedSpans[t].marker;!i.readOnly||n&&-1!=Lr(n,i)||(n||(n=[])).push(i)}}),!n)return null;for(var r=[{from:t,to:i}],s=0;s<n.length;++s)for(var o=n[s],a=o.find(0),l=0;l<r.length;++l){var c=r[l];if(!(As(c.to,a.from)<0||As(c.from,a.to)>0)){var h=[l,1],u=As(c.from,a.from),d=As(c.to,a.to);(0>u||!o.inclusiveLeft&&!u)&&h.push({from:c.from,to:a.from}),(d>0||!o.inclusiveRight&&!d)&&h.push({from:a.to,to:c.to}),r.splice.apply(r,h),l+=h.length-1}}return r}function on(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function an(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function ln(e){return e.inclusiveLeft?-1:0}function cn(e){return e.inclusiveRight?1:0}function hn(e,t){var i=e.lines.length-t.lines.length;if(0!=i)return i;var n=e.find(),r=t.find(),s=As(n.from,r.from)||ln(e)-ln(t);if(s)return-s;var o=As(n.to,r.to)||cn(e)-cn(t);return o?o:t.id-e.id}function un(e,t){var i,n=Ls&&e.markedSpans;if(n)for(var r,s=0;s<n.length;++s)r=n[s],r.marker.collapsed&&null==(t?r.from:r.to)&&(!i||hn(i,r.marker)<0)&&(i=r.marker);return i}function dn(e){return un(e,!0)}function pn(e){return un(e,!1)}function fn(e,t,i,n,r){var s=Kn(e,t),o=Ls&&s.markedSpans;if(o)for(var a=0;a<o.length;++a){var l=o[a];if(l.marker.collapsed){var c=l.marker.find(0),h=As(c.from,i)||ln(l.marker)-ln(r),u=As(c.to,n)||cn(l.marker)-cn(r);if(!(h>=0&&0>=u||0>=h&&u>=0)&&(0>=h&&(As(c.to,i)>0||l.marker.inclusiveRight&&r.inclusiveLeft)||h>=0&&(As(c.from,n)<0||l.marker.inclusiveLeft&&r.inclusiveRight)))return!0}}}function mn(e){for(var t;t=dn(e);)e=t.find(-1,!0).line;return e}function gn(e){for(var t,i;t=pn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function _n(e,t){var i=Kn(e,t),n=mn(i);return i==n?t:Xn(n)}function vn(e,t){if(t>e.lastLine())return t;var i,n=Kn(e,t);if(!bn(e,n))return t;for(;i=pn(n);)n=i.find(1,!0).line;return Xn(n)+1}function bn(e,t){var i=Ls&&t.markedSpans;if(i)for(var n,r=0;r<i.length;++r)if(n=i[r],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&yn(e,t,n))return!0}}function yn(e,t,i){if(null==i.to){var n=i.marker.find(1,!0);return yn(e,n.line,Ji(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var r,s=0;s<t.markedSpans.length;++s)if(r=t.markedSpans[s],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(null==r.to||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&yn(e,t,r))return!0}function xn(e,t,i){er(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ii(e,null,i)}function wn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ro(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Fr(t.display.measure,Hr("div",[e.node],null,i))}return e.height=e.node.offsetHeight}function kn(e,t,i,n){var r=new po(e,i,n),s=e.cm;return s&&r.noHScroll&&(s.display.alignWidgets=!0),Ni(e,t,"widget",function(t){var i=t.widgets||(t.widgets=[]);if(null==r.insertAt?i.push(r):i.splice(Math.min(i.length-1,Math.max(0,r.insertAt)),0,r),r.line=t,s&&!bn(e,t)){var n=er(t)<e.scrollTop;Qn(t,t.height+wn(r)),n&&Ii(s,null,r.height),s.curOp.forceUpdate=!0}return!0}),r}function Cn(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),on(e),an(e,i);var r=n?n(e):1;r!=e.height&&Qn(e,r)}function Tn(e){e.parent=null,on(e)}function Sn(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";null==t[n]?t[n]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+i[2])}return e}function Mn(t,i){if(t.blankLine)return t.blankLine(i);if(t.innerMode){var n=e.innerMode(t,i);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Dn(t,i,n,r){for(var s=0;10>s;s++){r&&(r[0]=e.innerMode(t,n).mode);var o=t.token(i,n);if(i.pos>i.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}function En(e,t,i,n){function r(e){return{start:u.start,end:u.pos,string:u.current(),type:s||null,state:e?to(o.mode,h):h}}var s,o=e.doc,a=o.mode;t=ge(o,t);var l,c=Kn(o,t.line),h=Fe(e,t.line,i),u=new lo(c.text,e.options.tabSize);for(n&&(l=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,s=Dn(a,u,h),n&&l.push(r(!0));return n?l:r()}function Ln(e,t,i,n,r,s,o){var a=i.flattenSpans;null==a&&(a=e.options.flattenSpans);var l,c=0,h=null,u=new lo(t,e.options.tabSize),d=e.options.addModeClass&&[null];for(""==t&&Sn(Mn(i,n),s);!u.eol();){if(u.pos>e.options.maxHighlightLength?(a=!1,o&&In(e,t,n,u.pos),u.pos=t.length,l=null):l=Sn(Dn(i,u,n,d),s),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!a||h!=l){for(;c<u.start;)c=Math.min(u.start,c+5e4),r(c,h);h=l}u.start=u.pos}for(;c<u.pos;){var f=Math.min(u.pos,c+5e4);r(f,h),c=f}}function Pn(e,t,i,n){var r=[e.state.modeGen],s={};Ln(e,t.text,e.doc.mode,i,function(e,t){r.push(e,t)},s,n);for(var o=0;o<e.state.overlays.length;++o){var a=e.state.overlays[o],l=1,c=0;Ln(e,t.text,a.mode,!0,function(e,t){for(var i=l;e>c;){var n=r[l];n>e&&r.splice(l,1,e,r[l+1],n),l+=2,c=Math.min(e,n)}if(t)if(a.opaque)r.splice(i,l-i,e,"cm-overlay "+t),l=i+2;else for(;l>i;i+=2){var s=r[i+1];r[i+1]=(s?s+" ":"")+"cm-overlay "+t}},s)}return{styles:r,classes:s.bgClass||s.textClass?s:null}}function An(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Pn(e,t,t.stateAfter=Fe(e,Xn(t)));t.styles=n.styles,n.classes?t.styleClasses=n.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.frontier&&e.doc.frontier++}return t.styles}function In(e,t,i,n){var r=e.doc.mode,s=new lo(t,e.options.tabSize);for(s.start=s.pos=n||0,""==t&&Mn(r,i);!s.eol()&&s.pos<=e.options.maxHighlightLength;)Dn(r,s,i),s.start=s.pos}function On(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?go:mo;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=Hr("span",null,null,ms?"padding-right: .1px":null),n={pre:Hr("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,splitSpaces:(ps||ms)&&e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var s,o=r?t.rest[r-1]:t.line;n.pos=0,n.addToken=Nn,Vr(e.display.measure)&&(s=tr(o))&&(n.addToken=Hn(n.addToken,s)),n.map=[];var a=t!=e.display.externalMeasured&&Xn(o);Fn(o,n,An(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=Br(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=Br(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Kr(e.display.measure))),0==r?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return ms&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),So(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Br(n.pre.className,n.textClass||"")),n}function zn(e){var t=Hr("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nn(e,t,i,n,r,s,o){if(t){var a=e.splitSpaces?t.replace(/ {3,}/g,$n):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var h=document.createDocumentFragment(),u=0;;){l.lastIndex=u;var d=l.exec(t),p=d?d.index-u:t.length-u;if(p){var f=document.createTextNode(a.slice(u,u+p));ps&&9>fs?h.appendChild(Hr("span",[f])):h.appendChild(f),e.map.push(e.pos,e.pos+p,f),e.col+=p,e.pos+=p}if(!d)break;if(u+=p+1,"	"==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,f=h.appendChild(Hr("span",Dr(g),"cm-tab"));f.setAttribute("role","presentation"),f.setAttribute("cm-text","	"),e.col+=g}else if("\r"==d[0]||"\n"==d[0]){var f=h.appendChild(Hr("span","\r"==d[0]?"␍":"␤","cm-invalidchar"));f.setAttribute("cm-text",d[0]),e.col+=1}else{var f=e.cm.options.specialCharPlaceholder(d[0]);f.setAttribute("cm-text",d[0]),ps&&9>fs?h.appendChild(Hr("span",[f])):h.appendChild(f),e.col+=1}e.map.push(e.pos,e.pos+1,f),e.pos++}else{e.col+=t.length;var h=document.createTextNode(a);e.map.push(e.pos,e.pos+t.length,h),ps&&9>fs&&(c=!0),e.pos+=t.length}if(i||n||r||c||o){var _=i||"";n&&(_+=n),r&&(_+=r);var v=Hr("span",[h],_,o);return s&&(v.title=s),e.content.appendChild(v)}e.content.appendChild(h)}}function $n(e){for(var t=" ",i=0;i<e.length-2;++i)t+=i%2?" ":" ";return t+=" "}function Hn(e,t){return function(i,n,r,s,o,a,l){r=r?r+" cm-force-border":"cm-force-border";for(var c=i.pos,h=c+n.length;;){for(var u=0;u<t.length;u++){var d=t[u];if(d.to>c&&d.from<=c)break}if(d.to>=h)return e(i,n,r,s,o,a,l);e(i,n.slice(0,d.to-c),r,s,null,a,l),s=null,n=n.slice(d.to-c),c=d.to}}}function Rn(e,t,i,n){var r=!n&&i.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!n&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t}function Fn(e,t,i){var n=e.markedSpans,r=e.text,s=0;if(n)for(var o,a,l,c,h,u,d,p=r.length,f=0,m=1,g="",_=0;;){if(_==f){l=c=h=u=a="",d=null,_=1/0;for(var v=[],b=0;b<n.length;++b){var y=n[b],x=y.marker;"bookmark"==x.type&&y.from==f&&x.widgetNode?v.push(x):y.from<=f&&(null==y.to||y.to>f||x.collapsed&&y.to==f&&y.from==f)?(null!=y.to&&y.to!=f&&_>y.to&&(_=y.to,c=""),x.className&&(l+=" "+x.className),x.css&&(a=x.css),x.startStyle&&y.from==f&&(h+=" "+x.startStyle),x.endStyle&&y.to==_&&(c+=" "+x.endStyle),x.title&&!u&&(u=x.title),x.collapsed&&(!d||hn(d.marker,x)<0)&&(d=y)):y.from>f&&_>y.from&&(_=y.from)}if(d&&(d.from||0)==f){if(Rn(t,(null==d.to?p+1:d.to)-f,d.marker,null==d.from),null==d.to)return;d.to==f&&(d=!1)}if(!d&&v.length)for(var b=0;b<v.length;++b)Rn(t,0,v[b])}if(f>=p)break;for(var w=Math.min(p,_);;){if(g){var k=f+g.length;if(!d){var C=k>w?g.slice(0,w-f):g;t.addToken(t,C,o?o+l:l,h,f+C.length==_?c:"",u,a)}if(k>=w){g=g.slice(w-f),f=w;break}f=k,h=""}g=r.slice(s,s=i[m++]),o=On(i[m++],t.cm.options)}}else for(var m=1;m<i.length;m+=2)t.addToken(t,r.slice(s,s=i[m]),On(i[m+1],t.cm.options))}function Wn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Er(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qn(e,t,i,n){function r(e){return i?i[e]:null}function s(e,i,r){Cn(e,i,r,n),yr(e,"change",e,t)}function o(e,t){for(var i=e,s=[];t>i;++i)s.push(new fo(c[i],r(i),n));return s}var a=t.from,l=t.to,c=t.text,h=Kn(e,a.line),u=Kn(e,l.line),d=Er(c),p=r(c.length-1),f=l.line-a.line;if(t.full)e.insert(0,o(0,c.length)),e.remove(c.length,e.size-c.length);else if(Wn(e,t)){var m=o(0,c.length-1);s(u,u.text,p),f&&e.remove(a.line,f),m.length&&e.insert(a.line,m)}else if(h==u)if(1==c.length)s(h,h.text.slice(0,a.ch)+d+h.text.slice(l.ch),p);else{var m=o(1,c.length-1);m.push(new fo(d+h.text.slice(l.ch),p,n)),s(h,h.text.slice(0,a.ch)+c[0],r(0)),e.insert(a.line+1,m)}else if(1==c.length)s(h,h.text.slice(0,a.ch)+c[0]+u.text.slice(l.ch),r(0)),e.remove(a.line+1,f);else{s(h,h.text.slice(0,a.ch)+c[0],r(0)),s(u,d+u.text.slice(l.ch),p);var m=o(1,c.length-1);f>1&&e.remove(a.line+1,f-1),e.insert(a.line+1,m)}yr(e,"change",e,t)}function Bn(e){this.lines=e,this.parent=null;for(var t=0,i=0;t<e.length;++t)e[t].parent=this,i+=e[t].height;this.height=i}function Un(e){this.children=e;for(var t=0,i=0,n=0;n<e.length;++n){var r=e[n];t+=r.chunkSize(),i+=r.height,r.parent=this}this.size=t,this.height=i,this.parent=null}function Yn(e,t,i){function n(e,r,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var a=e.linked[o];if(a.doc!=r){var l=s&&a.sharedHist;(!i||l)&&(t(a.doc,l),n(a.doc,e,l))}}}n(e,null,!0)}function Gn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,o(e),i(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,Ot(e)}function Kn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var n=0;;++n){var r=i.children[n],s=r.chunkSize();if(s>t){i=r;break}t-=s}return i.lines[t]}function Vn(e,t,i){var n=[],r=t.line;return e.iter(t.line,i.line+1,function(e){var s=e.text;r==i.line&&(s=s.slice(0,i.ch)),r==t.line&&(s=s.slice(t.ch)),n.push(s),++r}),n}function Jn(e,t,i){var n=[];return e.iter(t,i,function(e){n.push(e.text)}),n}function Qn(e,t){var i=t-e.height;if(i)for(var n=e;n;n=n.parent)n.height+=i}function Xn(e){if(null==e.parent)return null;for(var t=e.parent,i=Lr(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var r=0;n.children[r]!=t;++r)i+=n.children[r].chunkSize();return i+t.first}function Zn(e,t){var i=e.first;e:do{for(var n=0;n<e.children.length;++n){var r=e.children[n],s=r.height;if(s>t){e=r;continue e}t-=s,i+=r.chunkSize()}return i}while(!e.lines);for(var n=0;n<e.lines.length;++n){var o=e.lines[n],a=o.height;if(a>t)break;t-=a}return i+n}function er(e){e=mn(e);for(var t=0,i=e.parent,n=0;n<i.lines.length;++n){var r=i.lines[n];if(r==e)break;t+=r.height}for(var s=i.parent;s;i=s,s=i.parent)for(var n=0;n<s.children.length;++n){var o=s.children[n];if(o==i)break;t+=o.height}return t}function tr(e){var t=e.order;return null==t&&(t=e.order=Zo(e.text)),t}function ir(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function nr(e,t){var i={from:G(t.from),to:Ys(t),text:Vn(e,t.from,t.to)};return hr(e,i,t.from.line,t.to.line+1),Yn(e,function(e){hr(e,i,t.from.line,t.to.line+1)},!0),i}function rr(e){for(;e.length;){var t=Er(e);if(!t.ranges)break;e.pop()}}function sr(e,t){return t?(rr(e.done),Er(e.done)):e.done.length&&!Er(e.done).ranges?Er(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Er(e.done)):void 0}function or(e,t,i,n){var r=e.history;r.undone.length=0;var s,o=+new Date;if((r.lastOp==n||r.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&r.lastModTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(s=sr(r,r.lastOp==n))){var a=Er(s.changes);0==As(t.from,t.to)&&0==As(t.from,a.to)?a.to=Ys(t):s.changes.push(nr(e,t))}else{var l=Er(r.done);for(l&&l.ranges||cr(e.sel,r.done),s={changes:[nr(e,t)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=o,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=t.origin,a||So(e,"historyAdded")}function ar(e,t,i,n){var r=t.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lr(e,t,i,n){var r=e.history,s=n&&n.origin;i==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||ar(e,s,Er(r.done),t))?r.done[r.done.length-1]=t:cr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=i,n&&n.clearRedo!==!1&&rr(r.undone)}function cr(e,t){var i=Er(t);i&&i.ranges&&i.equals(e)||t.push(e)}function hr(e,t,i,n){var r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),function(i){i.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=i.markedSpans),
++s})}function ur(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function dr(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var n=0,r=[];n<t.text.length;++n)r.push(ur(i[n]));return r}function pr(e,t,i){for(var n=0,r=[];n<e.length;++n){var s=e[n];if(s.ranges)r.push(i?ue.prototype.deepCopy.call(s):s);else{var o=s.changes,a=[];r.push({changes:a});for(var l=0;l<o.length;++l){var c,h=o[l];if(a.push({from:h.from,to:h.to,text:h.text}),t)for(var u in h)(c=u.match(/^spans_(\d+)$/))&&Lr(t,Number(c[1]))>-1&&(Er(a)[u]=h[u],delete h[u])}}}return r}function fr(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function mr(e,t,i,n){for(var r=0;r<e.length;++r){var s=e[r],o=!0;if(s.ranges){s.copied||(s=e[r]=s.deepCopy(),s.copied=!0);for(var a=0;a<s.ranges.length;a++)fr(s.ranges[a].anchor,t,i,n),fr(s.ranges[a].head,t,i,n)}else{for(var a=0;a<s.changes.length;++a){var l=s.changes[a];if(i<l.from.line)l.from=Ps(l.from.line+n,l.from.ch),l.to=Ps(l.to.line+n,l.to.ch);else if(t<=l.to.line){o=!1;break}}o||(e.splice(0,r+1),r=0)}}}function gr(e,t){var i=t.from.line,n=t.to.line,r=t.text.length-(n-i)-1;mr(e.done,i,n,r),mr(e.undone,i,n,r)}function _r(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function vr(e){return e.target||e.srcElement}function br(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Cs&&e.ctrlKey&&1==t&&(t=3),t}function yr(e,t){function i(e){return function(){e.apply(null,s)}}var n=e._handlers&&e._handlers[t];if(n){var r,s=Array.prototype.slice.call(arguments,2);$s?r=$s.delayedCallbacks:Mo?r=Mo:(r=Mo=[],setTimeout(xr,0));for(var o=0;o<n.length;++o)r.push(i(n[o]))}}function xr(){var e=Mo;Mo=null;for(var t=0;t<e.length;++t)e[t]()}function wr(e,t,i){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),So(e,i||t.type,e,t),_r(t)||t.codemirrorIgnore}function kr(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==Lr(i,t[n])&&i.push(t[n])}function Cr(e,t){var i=e._handlers&&e._handlers[t];return i&&i.length>0}function Tr(e){e.prototype.on=function(e,t){Co(this,e,t)},e.prototype.off=function(e,t){To(this,e,t)}}function Sr(){this.id=null}function Mr(e,t,i){for(var n=0,r=0;;){var s=e.indexOf("	",n);-1==s&&(s=e.length);var o=s-n;if(s==e.length||r+o>=t)return n+Math.min(o,t-r);if(r+=s-n,r+=i-r%i,n=s+1,r>=t)return n}}function Dr(e){for(;Oo.length<=e;)Oo.push(Er(Oo)+" ");return Oo[e]}function Er(e){return e[e.length-1]}function Lr(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}function Pr(e,t){for(var i=[],n=0;n<e.length;n++)i[n]=t(e[n],n);return i}function Ar(){}function Ir(e,t){var i;return Object.create?i=Object.create(e):(Ar.prototype=e,i=new Ar),t&&Or(t,i),i}function Or(e,t,i){t||(t={});for(var n in e)!e.hasOwnProperty(n)||i===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function jr(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function zr(e,t){return t?t.source.indexOf("\\w")>-1&&$o(e)?!0:t.test(e):$o(e)}function Nr(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function $r(e){return e.charCodeAt(0)>=768&&Ho.test(e)}function Hr(e,t,i,n){var r=document.createElement(e);if(i&&(r.className=i),n&&(r.style.cssText=n),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var s=0;s<t.length;++s)r.appendChild(t[s]);return r}function Rr(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Fr(e,t){return Rr(e).appendChild(t)}function Wr(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function qr(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Br(e,t){for(var i=e.split(" "),n=0;n<i.length;n++)i[n]&&!qr(i[n]).test(t)&&(t+=" "+i[n]);return t}function Ur(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),i=0;i<t.length;i++){var n=t[i].CodeMirror;n&&e(n)}}function Yr(){Uo||(Gr(),Uo=!0)}function Gr(){var e;Co(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ur(qt)},100))}),Co(window,"blur",function(){Ur(fi)})}function Kr(e){if(null==Fo){var t=Hr("span","​");Fr(e,Hr("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Fo=t.offsetWidth<=1&&t.offsetHeight>2&&!(ps&&8>fs))}var i=Fo?Hr("span","​"):Hr("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Vr(e){if(null!=Wo)return Wo;var t=Fr(e,document.createTextNode("AخA")),i=zo(t,0,1).getBoundingClientRect();if(!i||i.left==i.right)return!1;var n=zo(t,1,2).getBoundingClientRect();return Wo=n.right-i.right<3}function Jr(e){if(null!=Jo)return Jo;var t=Fr(e,Hr("span","x")),i=t.getBoundingClientRect(),n=zo(t,0,1).getBoundingClientRect();return Jo=Math.abs(i.left-n.left)>1}function Qr(e,t,i,n){if(!e)return n(t,i,"ltr");for(var r=!1,s=0;s<e.length;++s){var o=e[s];(o.from<i&&o.to>t||t==i&&o.to==t)&&(n(Math.max(o.from,t),Math.min(o.to,i),1==o.level?"rtl":"ltr"),r=!0)}r||n(t,i,"ltr")}function Xr(e){return e.level%2?e.to:e.from}function Zr(e){return e.level%2?e.from:e.to}function es(e){var t=tr(e);return t?Xr(t[0]):0}function ts(e){var t=tr(e);return t?Zr(Er(t)):e.text.length}function is(e,t){var i=Kn(e.doc,t),n=mn(i);n!=i&&(t=Xn(n));var r=tr(n),s=r?r[0].level%2?ts(n):es(n):0;return Ps(t,s)}function ns(e,t){for(var i,n=Kn(e.doc,t);i=pn(n);)n=i.find(1,!0).line,t=null;var r=tr(n),s=r?r[0].level%2?es(n):ts(n):n.text.length;return Ps(null==t?Xn(n):t,s)}function rs(e,t){var i=is(e,t.line),n=Kn(e.doc,i.line),r=tr(n);if(!r||0==r[0].level){var s=Math.max(0,n.text.search(/\S/)),o=t.line==i.line&&t.ch<=s&&t.ch;return Ps(i.line,o?0:s)}return i}function ss(e,t,i){var n=e[0].level;return t==n?!0:i==n?!1:i>t}function os(e,t){Xo=null;for(var i,n=0;n<e.length;++n){var r=e[n];if(r.from<t&&r.to>t)return n;if(r.from==t||r.to==t){if(null!=i)return ss(e,r.level,e[i].level)?(r.from!=r.to&&(Xo=i),n):(r.from!=r.to&&(Xo=n),i);i=n}}return i}function as(e,t,i,n){if(!n)return t+i;do t+=i;while(t>0&&$r(e.text.charAt(t)));return t}function ls(e,t,i,n){var r=tr(e);if(!r)return cs(e,t,i,n);for(var s=os(r,t),o=r[s],a=as(e,t,o.level%2?-i:i,n);;){if(a>o.from&&a<o.to)return a;if(a==o.from||a==o.to)return os(r,a)==s?a:(o=r[s+=i],i>0==o.level%2?o.to:o.from);if(o=r[s+=i],!o)return null;a=i>0==o.level%2?as(e,o.to,-1,n):as(e,o.from,1,n)}}function cs(e,t,i,n){var r=t+i;if(n)for(;r>0&&$r(e.text.charAt(r));)r+=i;return 0>r||r>e.text.length?null:r}var hs=/gecko\/\d/i.test(navigator.userAgent),us=/MSIE \d/.test(navigator.userAgent),ds=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ps=us||ds,fs=ps&&(us?document.documentMode||6:ds[1]),ms=/WebKit\//.test(navigator.userAgent),gs=ms&&/Qt\/\d+\.\d+/.test(navigator.userAgent),_s=/Chrome\//.test(navigator.userAgent),vs=/Opera\//.test(navigator.userAgent),bs=/Apple Computer/.test(navigator.vendor),ys=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),xs=/PhantomJS/.test(navigator.userAgent),ws=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ks=ws||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Cs=ws||/Mac/.test(navigator.platform),Ts=/win/i.test(navigator.platform),Ss=vs&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ss&&(Ss=Number(Ss[1])),Ss&&Ss>=15&&(vs=!1,ms=!0);var Ms=Cs&&(gs||vs&&(null==Ss||12.11>Ss)),Ds=hs||ps&&fs>=9,Es=!1,Ls=!1;m.prototype=Or({update:function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var r=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(i?n: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&&(0==n&&this.overlayHack(),this.checkedOverlay=!0),{right:i?n:0,bottom:t?n: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=Cs&&!ys?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,i=function(e){vr(e)!=t.vert&&vr(e)!=t.horiz&&Et(t.cm,Yt)(e)};Co(this.vert,"mousedown",i),Co(this.horiz,"mousedown",i)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Or({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},T.prototype.signal=function(e,t){Cr(e,t)&&this.events.push(arguments)},T.prototype.finish=function(){for(var e=0;e<this.events.length;e++)So.apply(null,this.events[e])};var Ps=e.Pos=function(e,t){return this instanceof Ps?(this.line=e,void(this.ch=t)):new Ps(e,t)},As=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Is=null;ne.prototype=Or({init:function(e){function t(e){if(n.somethingSelected())Is=n.getSelections(),i.inaccurateSelection&&(i.prevInput="",i.inaccurateSelection=!1,s.value=Is.join("\n"),jo(s));else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Is=t.text,"cut"==e.type?n.setSelections(t.ranges,null,Lo):(i.prevInput="",s.value=t.text.join("\n"),jo(s))}"cut"==e.type&&(n.state.cutIncoming=!0)}var i=this,n=this.cm,r=this.wrapper=re(),s=this.textarea=r.firstChild;e.wrapper.insertBefore(r,e.wrapper.firstChild),ws&&(s.style.width="0px"),Co(s,"input",function(){ps&&fs>=9&&i.hasSelection&&(i.hasSelection=null),i.poll()}),Co(s,"paste",function(e){return Z(e,n)?!0:(n.state.pasteIncoming=!0,void i.fastPoll())}),Co(s,"cut",t),Co(s,"copy",t),Co(e.scroller,"paste",function(t){Bt(e,t)||(n.state.pasteIncoming=!0,i.focus())}),Co(e.lineSpace,"selectstart",function(t){Bt(e,t)||xo(t)}),Co(s,"compositionstart",function(){var e=n.getCursor("from");i.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Co(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,i=e.doc,n=Oe(e);if(e.options.moveInputWithCursor){var r=dt(e,i.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+o.top-s.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+o.left-s.left))}return n},showSelection:function(e){var t=this.cm,i=t.display;Fr(i.cursorDiv,e.cursors),Fr(i.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,i,n=this.cm,r=n.doc;if(n.somethingSelected()){this.prevInput="";var s=r.sel.primary();t=Vo&&(s.to().line-s.from().line>100||(i=n.getSelection()).length>1e3);var o=t?"-":i||n.getSelection();this.textarea.value=o,n.state.focused&&jo(this.textarea),ps&&fs>=9&&(this.hasSelection=o)}else e||(this.prevInput=this.textarea.value="",ps&&fs>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!ks||Wr()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=i.poll();n||t?(i.pollingFast=!1,i.slowPoll()):(t=!0,i.polling.set(60,e))}var t=!1,i=this;i.pollingFast=!0,i.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||Ko(t)&&!i&&!this.composing||Q(e)||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==i&&!e.somethingSelected())return!1;if(ps&&fs>=9&&this.hasSelection===n||Cs&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var r=n.charCodeAt(0);if(8203!=r||i||(i="​"),8666==r)return this.reset(),this.cm.execCommand("undo")}for(var s=0,o=Math.min(i.length,n.length);o>s&&i.charCodeAt(s)==n.charCodeAt(s);)++s;var a=this;return Dt(e,function(){X(e,n.slice(s),i.length-s,null,a.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=a.prevInput="":a.prevInput=n,a.composing&&(a.composing.range.clear(),a.composing.range=e.markText(a.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ps&&fs>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=o.selectionStart){var e=r.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,s.selForContextMenu=r.doc.sel}}function i(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",o.style.cssText=h,ps&&9>fs&&s.scrollbars.setScrollTop(s.scroller.scrollTop=l),null!=o.selectionStart){(!ps||ps&&9>fs)&&t();var e=0,i=function(){s.selForContextMenu==r.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&"​"==n.prevInput?Et(r,no.selectAll)(r):e++<10?s.detectingSelectAll=setTimeout(i,500):s.input.reset()};s.detectingSelectAll=setTimeout(i,200)}}var n=this,r=n.cm,s=r.display,o=n.textarea,a=Ut(r,e),l=s.scroller.scrollTop;if(a&&!vs){var c=r.options.resetSelectionOnContextMenu;c&&-1==r.doc.sel.contains(a)&&Et(r,Me)(r.doc,fe(a),Lo);var h=o.style.cssText;if(n.wrapper.style.position="absolute",o.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ps?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",ms)var u=window.scrollY;if(s.input.focus(),ms&&window.scrollTo(null,u),s.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=!0,s.selForContextMenu=r.doc.sel,clearTimeout(s.detectingSelectAll),ps&&fs>=9&&t(),Ds){ko(e);var d=function(){To(window,"mouseup",d),setTimeout(i,20)};Co(window,"mouseup",d)}else setTimeout(i,50)}},setUneditable:Ar,needsContentAttribute:!1},ne.prototype),se.prototype=Or({init:function(e){function t(e){if(n.somethingSelected())Is=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Is=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Lo),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!ws)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Is.join("\n"));else{var i=re(),r=i.firstChild;n.display.lineSpace.insertBefore(i,n.display.lineSpace.firstChild),r.value=Is.join("\n");var s=document.activeElement;jo(r),setTimeout(function(){n.display.lineSpace.removeChild(i),s.focus()},50)}}var i=this,n=i.cm,r=i.div=e.lineDiv;r.contentEditable="true",ie(r),Co(r,"paste",function(e){Z(e,n)}),Co(r,"compositionstart",function(e){var t=e.data;if(i.composing={sel:n.doc.sel,data:t,startData:t},t){var r=n.doc.sel.primary(),s=n.getLine(r.head.line),o=s.indexOf(t,Math.max(0,r.head.ch-t.length));o>-1&&o<=r.head.ch&&(i.composing.sel=fe(Ps(r.head.line,o),Ps(r.head.line,o+t.length)))}}),Co(r,"compositionupdate",function(e){i.composing.data=e.data}),Co(r,"compositionend",function(e){var t=i.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||i.applyComposition(t),i.composing==t&&(i.composing=null)},50))}),Co(r,"touchstart",function(){i.forceCompositionEnd()}),Co(r,"input",function(){i.composing||i.pollContent()||Dt(i.cm,function(){Ot(n)})}),Co(r,"copy",t),Co(r,"cut",t)},prepareSelection:function(){var e=Oe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),i=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!i||i.bad||!n||n.bad||0!=As(V(i,n),t.from())||0!=As(K(i,n),t.to())){var r=oe(this.cm,t.from()),s=oe(this.cm,t.to());if(r||s){var o=this.cm.display.view,a=e.rangeCount&&e.getRangeAt(0);if(r){if(!s){var l=o[o.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;s={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else r={node:o[0].measure.map[2],offset:0};try{var h=zo(r.node,r.offset,s.offset,s.node)}catch(u){}h&&(e.removeAllRanges(),e.addRange(h),a&&null==e.anchorNode?e.addRange(a):hs&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Fr(this.cm.display.cursorDiv,e.cursors),Fr(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 Ro(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Dt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var i=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);i&&n&&Dt(t,function(){Me(t.doc,fe(i,n),Lo),(i.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,i=e.doc.sel.primary(),n=i.from(),r=i.to();if(n.line<t.viewFrom||r.line>t.viewTo-1)return!1;var s;if(n.line==t.viewFrom||0==(s=Nt(e,n.line)))var o=Xn(t.view[0].line),a=t.view[0].node;else var o=Xn(t.view[s].line),a=t.view[s-1].node.nextSibling;var l=Nt(e,r.line);if(l==t.view.length-1)var c=t.viewTo-1,h=t.lineDiv.lastChild;else var c=Xn(t.view[l+1].line)-1,h=t.view[l+1].node.previousSibling;for(var u=e.doc.splitLines(he(e,a,h,o,c)),d=Vn(e.doc,Ps(o,0),Ps(c,Kn(e.doc,c).text.length));u.length>1&&d.length>1;)if(Er(u)==Er(d))u.pop(),d.pop(),c--;else{if(u[0]!=d[0])break;u.shift(),d.shift(),o++}for(var p=0,f=0,m=u[0],g=d[0],_=Math.min(m.length,g.length);_>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var v=Er(u),b=Er(d),y=Math.min(v.length-(1==u.length?p:0),b.length-(1==d.length?p:0));y>f&&v.charCodeAt(v.length-f-1)==b.charCodeAt(b.length-f-1);)++f;u[u.length-1]=v.slice(0,v.length-f),u[0]=u[0].slice(p);var x=Ps(o,p),w=Ps(c,d.length?Er(d).length-f:0);return u.length>1||u[0]||As(x,w)?(Di(e.doc,u,x,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&Et(this.cm,X)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),Et(this.cm,X)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ar,resetPosition:Ar,needsContentAttribute:!0},se.prototype),e.inputStyles={textarea:ne,contenteditable:se},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],n=e.ranges[t];if(0!=As(i.anchor,n.anchor)||0!=As(i.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(G(this.ranges[t].anchor),G(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(As(t,n.from())>=0&&As(e,n.to())<=0)return i}return-1}},de.prototype={from:function(){return V(this.anchor,this.head)},to:function(){return K(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Os,js,zs,Ns={left:0,right:0,top:0,bottom:0},$s=null,Hs=0,Rs=0,Fs=0,Ws=null;ps?Ws=-.53:hs?Ws=15:_s?Ws=-.7:bs&&(Ws=-1/3);var qs=function(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==i&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:null==i&&(i=e.wheelDelta),{x:t,y:i}};e.wheelEventPixels=function(e){var t=qs(e);return t.x*=Ws,t.y*=Ws,t};var Bs=new Sr,Us=null,Ys=e.changeEnd=function(e){return e.text?Ps(e.from.line+e.text.length-1,Er(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var i=this.options,n=i[e];(i[e]!=t||"mode"==e)&&(i[e]=t,Ks.hasOwnProperty(e)&&Et(this,Ks[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qi(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,i=0;i<t.length;++i)if(t[i]==e||t[i].name==e)return t.splice(i,1),!0},addOverlay:Lt(function(t,i){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:i&&i.opaque}),this.state.modeGen++,Ot(this)}),removeOverlay:Lt(function(e){for(var t=this.state.overlays,i=0;i<t.length;++i){var n=t[i].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(i,1),this.state.modeGen++,void Ot(this)}}),indentLine:Lt(function(e,t,i){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&zi(this,e,t,i)}),indentSelection:Lt(function(e){for(var t=this.doc.sel.ranges,i=-1,n=0;n<t.length;n++){var r=t[n];if(r.empty())r.head.line>i&&(zi(this,r.head.line,e,!0),i=r.head.line,n==this.doc.sel.primIndex&&Oi(this));else{var s=r.from(),o=r.to(),a=Math.max(i,s.line);i=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;i>l;++l)zi(this,l,e);var c=this.doc.sel.ranges;0==s.ch&&t.length==c.length&&c[n].from().ch>0&&ke(this.doc,n,new de(s,c[n].to()),Lo)}}}),getTokenAt:function(e,t){return En(this,e,t)},getLineTokens:function(e,t){return En(this,Ps(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,i=An(this,Kn(this.doc,e.line)),n=0,r=(i.length-1)/2,s=e.ch;if(0==s)t=i[2];else for(;;){var o=n+r>>1;if((o?i[2*o-1]:0)>=s)r=o;else{if(!(i[2*o+1]<s)){t=i[2*o+2];break}n=o+1}}var a=t?t.indexOf("cm-overlay "):-1;return 0>a?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(t).state).mode:i},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var i=[];if(!eo.hasOwnProperty(t))return i;var n=eo[t],r=this.getModeAt(e);if("string"==typeof r[t])n[r[t]]&&i.push(n[r[t]]);else if(r[t])for(var s=0;s<r[t].length;s++){var o=n[r[t][s]];o&&i.push(o)}else r.helperType&&n[r.helperType]?i.push(n[r.helperType]):n[r.name]&&i.push(n[r.name]);for(var s=0;s<n._global.length;s++){var a=n._global[s];a.pred(r,this)&&-1==Lr(i,a.val)&&i.push(a.val)}return i},getStateAfter:function(e,t){var i=this.doc;return e=me(i,null==e?i.first+i.size-1:e),Fe(this,e+1,t)},cursorCoords:function(e,t){var i,n=this.doc.sel.primary();return i=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),dt(this,i,t||"page")},charCoords:function(e,t){return ut(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ht(this,e,t||"page"),mt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ht(this,{top:e,left:0},t||"page").top,Zn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var i,n=!1;if("number"==typeof e){var r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0),i=Kn(this.doc,e)}else i=e;return ct(this,i,{top:0,left:0},t||"page").top+(n?this.doc.height-er(i):0)},defaultTextHeight:function(){return _t(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Lt(function(e,t,i){return Ni(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=i,!i&&Nr(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Lt(function(e){var t=this,i=t.doc,n=i.first;i.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&(i.gutterMarkers[e]=null,jt(t,n,"gutter"),Nr(i.gutterMarkers)&&(i.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kn(this.doc,e),!e)return null}else{var t=Xn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,r){var s=this.display;e=dt(this,ge(this.doc,e));var o=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==n)o=e.top;else if("above"==n||"near"==n){var l=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(o=e.bottom),a+t.offsetWidth>c&&(a=c-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="","right"==r?(a=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),i&&Pi(this,a,o,a+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Lt(li),triggerOnKeyPress:Lt(ui),triggerOnKeyUp:hi,execCommand:function(e){return no.hasOwnProperty(e)?no[e](this):void 0},triggerElectric:Lt(function(e){ee(this,e)}),findPosH:function(e,t,i,n){var r=1;0>t&&(r=-1,t=-t);for(var s=0,o=ge(this.doc,e);t>s&&(o=Hi(this.doc,o,r,i,n),!o.hitSide);++s);return o},moveH:Lt(function(e,t){var i=this;i.extendSelectionsBy(function(n){return i.display.shift||i.doc.extend||n.empty()?Hi(i.doc,n.head,e,t,i.options.rtlMoveVisually):0>e?n.from():n.to()},Ao)}),deleteH:Lt(function(e,t){var i=this.doc.sel,n=this.doc;i.somethingSelected()?n.replaceSelection("",null,"+delete"):$i(this,function(i){var r=Hi(n,i.head,e,t,!1);return 0>e?{from:r,to:i.head}:{from:i.head,to:r}})}),findPosV:function(e,t,i,n){var r=1,s=n;0>t&&(r=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o;++o){var l=dt(this,a,"div");if(null==s?s=l.left:l.left=s,a=Ri(this,l,r,i),a.hitSide)break}return a},moveV:Lt(function(e,t){var i=this,n=this.doc,r=[],s=!i.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(o){if(s)return 0>e?o.from():o.to();var a=dt(i,o.head,"div");null!=o.goalColumn&&(a.left=o.goalColumn),r.push(a.left);var l=Ri(i,a,e,t);return"page"==t&&o==n.sel.primary()&&Ii(i,null,ut(i,l,"div").top-a.top),l},Ao),r.length)for(var o=0;o<n.sel.ranges.length;o++)n.sel.ranges[o].goalColumn=r[o]}),findWordAt:function(e){var t=this.doc,i=Kn(t,e.line).text,n=e.ch,r=e.ch;if(i){var s=this.getHelper(e,"wordChars");(e.xRel<0||r==i.length)&&n?--n:++r;for(var o=i.charAt(n),a=zr(o,s)?function(e){return zr(e,s)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!zr(e)};n>0&&a(i.charAt(n-1));)--n;for(;r<i.length&&a(i.charAt(r));)++r}return new de(Ps(e.line,n),Ps(e.line,r))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Bo(this.display.cursorDiv,"CodeMirror-overwrite"):qo(this.display.cursorDiv,"CodeMirror-overwrite"),So(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Wr()},scrollTo:Lt(function(e,t){(null!=e||null!=t)&&ji(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ue(this)-this.display.barHeight,width:e.scrollWidth-Ue(this)-this.display.barWidth,clientHeight:Ge(this),clientWidth:Ye(this)}},scrollIntoView:Lt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Ps(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)ji(this),this.curOp.scrollToPos=e;else{var i=Ai(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(i.scrollLeft,i.scrollTop)}}),setSize:Lt(function(e,t){function i(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=i(e)),null!=t&&(n.display.wrapper.style.height=i(t)),n.options.lineWrapping&&st(this);var r=n.display.viewFrom;n.doc.iter(r,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){jt(n,r,"widget");break}++r}),n.curOp.forceUpdate=!0,So(n,"refresh",this)}),operation:function(e){return Dt(this,e)},refresh:Lt(function(){var e=this.display.cachedTextHeight;Ot(this),this.curOp.forceUpdate=!0,ot(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),h(this),(null==e||Math.abs(e-_t(this.display))>.5)&&o(this),So(this,"refresh",this)}),swapDoc:Lt(function(e){var t=this.doc;return t.cm=null,Gn(this,e),ot(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,yr(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}},Tr(e);var Gs=e.defaults={},Ks=e.optionHandlers={},Vs=e.Init={toString:function(){return"CodeMirror.Init"}};Fi("value","",function(e,t){e.setValue(t)},!0),Fi("mode",null,function(e,t){e.doc.modeOption=t,i(e)},!0),Fi("indentUnit",2,i,!0),Fi("indentWithTabs",!1),Fi("smartIndent",!0),Fi("tabSize",4,function(e){n(e),ot(e),Ot(e)},!0),Fi("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var i=[],n=e.doc.first;e.doc.iter(function(e){for(var r=0;;){var s=e.text.indexOf(t,r);if(-1==s)break;r=s+t.length,i.push(Ps(n,s))}n++});for(var r=i.length-1;r>=0;r--)Di(e.doc,t,i[r],Ps(i[r].line,i[r].ch+t.length))}}),Fi("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,i,n){
t.state.specialChars=new RegExp(i.source+(i.test("	")?"":"|	"),"g"),n!=e.Init&&t.refresh()}),Fi("specialCharPlaceholder",zn,function(e){e.refresh()},!0),Fi("electricChars",!0),Fi("inputStyle",ks?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Fi("rtlMoveVisually",!Ts),Fi("wholeLineUpdateBefore",!0),Fi("theme","default",function(e){a(e),l(e)},!0),Fi("keyMap","default",function(t,i,n){var r=qi(i),s=n!=e.Init&&qi(n);s&&s.detach&&s.detach(t,r),r.attach&&r.attach(t,s||null)}),Fi("extraKeys",null),Fi("lineWrapping",!1,r,!0),Fi("gutters",[],function(e){p(e.options),l(e)},!0),Fi("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Fi("coverGutterNextToScrollbar",!1,function(e){v(e)},!0),Fi("scrollbarStyle","native",function(e){_(e),v(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Fi("lineNumbers",!1,function(e){p(e.options),l(e)},!0),Fi("firstLineNumber",1,l,!0),Fi("lineNumberFormatter",function(e){return e},l,!0),Fi("showCursorWhenSelecting",!1,Ie,!0),Fi("resetSelectionOnContextMenu",!0),Fi("lineWiseCopyCut",!0),Fi("readOnly",!1,function(e,t){"nocursor"==t?(fi(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),Fi("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Fi("dragDrop",!0,Wt),Fi("cursorBlinkRate",530),Fi("cursorScrollMargin",0),Fi("cursorHeight",1,Ie,!0),Fi("singleCursorHeightPerLine",!0,Ie,!0),Fi("workTime",100),Fi("workDelay",100),Fi("flattenSpans",!0,n,!0),Fi("addModeClass",!1,n,!0),Fi("pollInterval",100),Fi("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Fi("historyEventDelay",1250),Fi("viewportMargin",10,function(e){e.refresh()},!0),Fi("maxHighlightLength",1e4,n,!0),Fi("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Fi("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Fi("autofocus",null);var Js=e.modes={},Qs=e.mimeModes={};e.defineMode=function(t,i){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2)),Js[t]=i},e.defineMIME=function(e,t){Qs[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Qs.hasOwnProperty(t))t=Qs[t];else if(t&&"string"==typeof t.name&&Qs.hasOwnProperty(t.name)){var i=Qs[t.name];"string"==typeof i&&(i={name:i}),t=Ir(i,t),t.name=i.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,i){var i=e.resolveMode(i),n=Js[i.name];if(!n)return e.getMode(t,"text/plain");var r=n(t,i);if(Xs.hasOwnProperty(i.name)){var s=Xs[i.name];for(var o in s)s.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=s[o])}if(r.name=i.name,i.helperType&&(r.helperType=i.helperType),i.modeProps)for(var o in i.modeProps)r[o]=i.modeProps[o];return r},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Xs=e.modeExtensions={};e.extendMode=function(e,t){var i=Xs.hasOwnProperty(e)?Xs[e]:Xs[e]={};Or(t,i)},e.defineExtension=function(t,i){e.prototype[t]=i},e.defineDocExtension=function(e,t){vo.prototype[e]=t},e.defineOption=Fi;var Zs=[];e.defineInitHook=function(e){Zs.push(e)};var eo=e.helpers={};e.registerHelper=function(t,i,n){eo.hasOwnProperty(t)||(eo[t]=e[t]={_global:[]}),eo[t][i]=n},e.registerGlobalHelper=function(t,i,n,r){e.registerHelper(t,i,r),eo[t]._global.push({pred:n,val:r})};var to=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var n in t){var r=t[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i},io=e.startState=function(e,t,i){return e.startState?e.startState(t,i):!0};e.innerMode=function(e,t){for(;e.innerMode;){var i=e.innerMode(t);if(!i||i.mode==e)break;t=i.state,e=i.mode}return i||{mode:e,state:t}};var no=e.commands={selectAll:function(e){e.setSelection(Ps(e.firstLine(),0),Ps(e.lastLine()),Lo)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Lo)},killLine:function(e){$i(e,function(t){if(t.empty()){var i=Kn(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ps(t.head.line+1,0)}:{from:t.head,to:Ps(t.head.line,i)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){$i(e,function(t){return{from:Ps(t.from().line,0),to:ge(e.doc,Ps(t.to().line+1,0))}})},delLineLeft:function(e){$i(e,function(e){return{from:Ps(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){$i(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){$i(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Ps(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Ps(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return rs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return ns(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var i=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Ao)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var i=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Ao)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return n.ch<e.getLine(n.line).search(/\S/)?rs(e,t.head):n},Ao)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("	")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),n=e.options.tabSize,r=0;r<i.length;r++){var s=i[r].from(),o=Io(e.getLine(s.line),s.ch,n);t.push(new Array(n-o%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Dt(e,function(){for(var t=e.listSelections(),i=[],n=0;n<t.length;n++){var r=t[n].head,s=Kn(e.doc,r.line).text;if(s)if(r.ch==s.length&&(r=new Ps(r.line,r.ch-1)),r.ch>0)r=new Ps(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),Ps(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var o=Kn(e.doc,r.line-1).text;o&&e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),Ps(r.line-1,o.length-1),Ps(r.line,1),"+transpose")}i.push(new de(r,r))}e.setSelections(i)})},newlineAndIndent:function(e){Dt(e,function(){for(var t=e.listSelections().length,i=0;t>i;i++){var n=e.listSelections()[i];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),Oi(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},ro=e.keyMap={};ro.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"},ro.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"},ro.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"},ro.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"]},ro["default"]=Cs?ro.macDefault:ro.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if("..."==n){delete e[i];continue}for(var r=Pr(i.split(" "),Wi),s=0;s<r.length;s++){var o,a;s==r.length-1?(a=r.join(" "),o=n):(a=r.slice(0,s+1).join(" "),o="...");var l=t[a];if(l){if(l!=o)throw new Error("Inconsistent bindings for "+a)}else t[a]=o}delete e[i]}for(var c in t)e[c]=t[c];return e};var so=e.lookupKey=function(e,t,i,n){t=qi(t);var r=t.call?t.call(e,n):t[e];if(r===!1)return"nothing";if("..."===r)return"multi";if(null!=r&&i(r))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return so(e,t.fallthrough,i,n);for(var s=0;s<t.fallthrough.length;s++){var o=so(e,t.fallthrough[s],i,n);if(o)return o}}},oo=e.isModifierKey=function(e){var t="string"==typeof e?e:Qo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},ao=e.keyName=function(e,t){if(vs&&34==e.keyCode&&e["char"])return!1;var i=Qo[e.keyCode],n=i;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=i&&(n="Alt-"+n),(Ms?e.metaKey:e.ctrlKey)&&"Ctrl"!=i&&(n="Ctrl-"+n),(Ms?e.ctrlKey:e.metaKey)&&"Cmd"!=i&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=i&&(n="Shift-"+n),n)};e.fromTextArea=function(t,i){function n(){t.value=c.getValue()}if(i=i?Or(i):{},i.value=t.value,!i.tabindex&&t.tabIndex&&(i.tabindex=t.tabIndex),!i.placeholder&&t.placeholder&&(i.placeholder=t.placeholder),null==i.autofocus){var r=Wr();i.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}if(t.form&&(Co(t.form,"submit",n),!i.leaveSubmitMethodAlone)){var s=t.form,o=s.submit;try{var a=s.submit=function(){n(),s.submit=o,s.submit(),s.submit=a}}catch(l){}}i.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(To(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=o))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},i);return c};var lo=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};lo.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var i=t==e;else var i=t&&(e.test?e.test(t):e(t));return i?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Io(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Io(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Io(this.string,null,this.tabSize)-(this.lineStart?Io(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,i){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var r=function(e){return i?e.toLowerCase():e},s=this.string.substr(this.pos,e.length);return r(s)==r(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var co=0,ho=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++co};Tr(ho),ho.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&bt(e),Cr(this,"clear")){var i=this.find();i&&yr(this,"clear",i.from,i.to)}for(var n=null,r=null,s=0;s<this.lines.length;++s){var o=this.lines[s],a=Ji(o.markedSpans,this);e&&!this.collapsed?jt(e,Xn(o),"text"):e&&(null!=a.to&&(r=Xn(o)),null!=a.from&&(n=Xn(o))),o.markedSpans=Qi(o.markedSpans,a),null==a.from&&this.collapsed&&!bn(this.doc,o)&&e&&Qn(o,_t(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var l=mn(this.lines[s]),c=u(l);c>e.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Ot(e,n,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Le(e.doc)),e&&yr(e,"markerCleared",e,this),t&&xt(e),this.parent&&this.parent.clear()}},ho.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var i,n,r=0;r<this.lines.length;++r){var s=this.lines[r],o=Ji(s.markedSpans,this);if(null!=o.from&&(i=Ps(t?s:Xn(s),o.from),-1==e))return i;if(null!=o.to&&(n=Ps(t?s:Xn(s),o.to),1==e))return n}return i&&{from:i,to:n}},ho.prototype.changed=function(){var e=this.find(-1,!0),t=this,i=this.doc.cm;e&&i&&Dt(i,function(){var n=e.line,r=Xn(e.line),s=Xe(i,r);if(s&&(rt(s),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!bn(t.doc,n)&&null!=t.height){var o=t.height;t.height=null;var a=wn(t)-o;a&&Qn(n,n.height+a)}})},ho.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Lr(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ho.prototype.detachLine=function(e){if(this.lines.splice(Lr(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var co=0,uo=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Tr(uo),uo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();yr(this,"clear")}},uo.prototype.find=function(e,t){return this.primary.find(e,t)};var po=e.LineWidget=function(e,t,i){if(i)for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);this.doc=e,this.node=t};Tr(po),po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,n=Xn(i);if(null!=n&&t){for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(i.widgets=null);var s=wn(this);Qn(i,Math.max(0,i.height-s)),e&&Dt(e,function(){xn(e,i,-s),jt(e,n,"widget")})}},po.prototype.changed=function(){var e=this.height,t=this.doc.cm,i=this.line;this.height=null;var n=wn(this)-e;n&&(Qn(i,i.height+n),t&&Dt(t,function(){t.curOp.forceUpdate=!0,xn(t,i,n)}))};var fo=e.Line=function(e,t,i){this.text=e,an(this,t),this.height=i?i(this):1};Tr(fo),fo.prototype.lineNo=function(){return Xn(this)};var mo={},go={};Bn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,n=e+t;n>i;++i){var r=this.lines[i];this.height-=r.height,Tn(r),yr(r,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,i){for(var n=e+t;n>e;++e)if(i(this.lines[e]))return!0}},Un.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var n=this.children[i],r=n.chunkSize();if(r>e){var s=Math.min(t,r-e),o=n.height;if(n.removeInner(e,s),this.height-=o-n.height,r==s&&(this.children.splice(i--,1),n.parent=null),0==(t-=s))break;e=0}else e-=r}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Bn))){var a=[];this.collapse(a),this.children=[new Bn(a)],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,i){this.size+=t.length,this.height+=i;for(var n=0;n<this.children.length;++n){var r=this.children[n],s=r.chunkSize();if(s>=e){if(r.insertInner(e,t,i),r.lines&&r.lines.length>50){for(;r.lines.length>50;){var o=r.lines.splice(r.lines.length-25,25),a=new Bn(o);r.height-=a.height,this.children.splice(n+1,0,a),a.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Un(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=Lr(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Un(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var n=0;n<this.children.length;++n){var r=this.children[n],s=r.chunkSize();if(s>e){var o=Math.min(t,s-e);if(r.iterN(e,o,i))return!0;if(0==(t-=o))break;e=0}else e-=s}}};var _o=0,vo=e.Doc=function(e,t,i,n){if(!(this instanceof vo))return new vo(e,t,i,n);null==i&&(i=0),Un.call(this,[new Bn([new fo("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=i;var r=Ps(i,0);this.sel=fe(r),this.history=new ir(null),this.id=++_o,this.modeOption=t,this.lineSep=n,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:r,to:r,text:e}),Me(this,fe(r),Lo)};vo.prototype=Ir(Un.prototype,{constructor:vo,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,n=0;n<t.length;++n)i+=t[n].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Jn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Pt(function(e){var t=Ps(this.first,0),i=this.first+this.size-1;wi(this,{from:t,to:Ps(i,Kn(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Me(this,fe(t))}),replaceRange:function(e,t,i,n){t=ge(this,t),i=i?ge(this,i):t,Di(this,e,t,i,n)},getRange:function(e,t,i){var n=Vn(this,ge(this,e),ge(this,t));return i===!1?n:n.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kn(this,e):void 0},getLineNumber:function(e){return Xn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kn(this,e)),mn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t,i=this.sel.primary();return t=null==e||"head"==e?i.head:"anchor"==e?i.anchor:"end"==e||"to"==e||e===!1?i.to():i.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Pt(function(e,t,i){Ce(this,ge(this,"number"==typeof e?Ps(e,t||0):e),null,i)}),setSelection:Pt(function(e,t,i){Ce(this,ge(this,e),ge(this,t||e),i)}),extendSelection:Pt(function(e,t,i){xe(this,ge(this,e),t&&ge(this,t),i)}),extendSelections:Pt(function(e,t){we(this,be(this,e,t))}),extendSelectionsBy:Pt(function(e,t){we(this,Pr(this.sel.ranges,e),t)}),setSelections:Pt(function(e,t,i){if(e.length){for(var n=0,r=[];n<e.length;n++)r[n]=new de(ge(this,e[n].anchor),ge(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Me(this,pe(r,t),i)}}),addSelection:Pt(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new de(ge(this,e),ge(this,t||e))),Me(this,pe(n,n.length-1),i)}),getSelection:function(e){for(var t,i=this.sel.ranges,n=0;n<i.length;n++){var r=Vn(this,i[n].from(),i[n].to());t=t?t.concat(r):r}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,n=0;n<i.length;n++){var r=Vn(this,i[n].from(),i[n].to());e!==!1&&(r=r.join(e||this.lineSeparator())),t[n]=r}return t},replaceSelection:function(e,t,i){for(var n=[],r=0;r<this.sel.ranges.length;r++)n[r]=e;this.replaceSelections(n,t,i||"+input")},replaceSelections:Pt(function(e,t,i){for(var n=[],r=this.sel,s=0;s<r.ranges.length;s++){var o=r.ranges[s];n[s]={from:o.from(),to:o.to(),text:this.splitLines(e[s]),origin:i}}for(var a=t&&"end"!=t&&yi(this,n,t),s=n.length-1;s>=0;s--)wi(this,n[s]);a?Se(this,a):this.cm&&Oi(this.cm)}),undo:Pt(function(){Ci(this,"undo")}),redo:Pt(function(){Ci(this,"redo")}),undoSelection:Pt(function(){Ci(this,"undo",!0)}),redoSelection:Pt(function(){Ci(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){this.history=new ir(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:pr(this.history.done),undone:pr(this.history.undone)}},setHistory:function(e){var t=this.history=new ir(this.history.maxGeneration);t.done=pr(e.done.slice(0),null,!0),t.undone=pr(e.undone.slice(0),null,!0)},addLineClass:Pt(function(e,t,i){return Ni(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(qr(i).test(e[n]))return!1;e[n]+=" "+i}else e[n]=i;return!0})}),removeLineClass:Pt(function(e,t,i){return Ni(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",r=e[n];if(!r)return!1;if(null==i)e[n]=null;else{var s=r.match(qr(i));if(!s)return!1;var o=s.index+s[0].length;e[n]=r.slice(0,s.index)+(s.index&&o!=r.length?" ":"")+r.slice(o)||null}return!0})}),addLineWidget:Pt(function(e,t,i){return kn(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Bi(this,ge(this,e),ge(this,t),i,"range")},setBookmark:function(e,t){var i={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Bi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],i=Kn(this,e.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var r=i[n];(null==r.from||r.from<=e.ch)&&(null==r.to||r.to>=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,i){e=ge(this,e),t=ge(this,t);var n=[],r=e.line;return this.iter(e.line,t.line+1,function(s){var o=s.markedSpans;if(o)for(var a=0;a<o.length;a++){var l=o[a];r==e.line&&e.ch>l.to||null==l.from&&r!=e.line||r==t.line&&l.from>t.ch||i&&!i(l.marker)||n.push(l.marker.parent||l.marker)}++r}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var n=0;n<i.length;++n)null!=i[n].from&&e.push(i[n].marker)}),e},posFromIndex:function(e){var t,i=this.first;return this.iter(function(n){var r=n.text.length+1;return r>e?(t=e,!0):(e-=r,void++i)}),ge(this,Ps(i,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new vo(Jn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<i&&(i=e.to);var n=new vo(Jn(this,t,i),e.mode||this.modeOption,t,this.lineSep);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Gi(n,Yi(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var i=0;i<this.linked.length;++i){var n=this.linked[i];if(n.doc==t){this.linked.splice(i,1),t.unlinkDoc(this),Ki(Yi(this));break}}if(t.history==this.history){var r=[t.id];Yn(t,function(e){r.push(e.id)},!0),t.history=new ir(null),t.history.done=pr(this.history.done,r),t.history.undone=pr(this.history.undone,r)}},iterLinkedDocs:function(e){Yn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Go(e)},lineSeparator:function(){return this.lineSep||"\n"}}),vo.prototype.eachLine=vo.prototype.iter;var bo="iter insert remove copy getEditor constructor".split(" ");for(var yo in vo.prototype)vo.prototype.hasOwnProperty(yo)&&Lr(bo,yo)<0&&(e.prototype[yo]=function(e){return function(){return e.apply(this.doc,arguments)}}(vo.prototype[yo]));Tr(vo);var xo=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},wo=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ko=e.e_stop=function(e){xo(e),wo(e)},Co=e.on=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var n=e._handlers||(e._handlers={}),r=n[t]||(n[t]=[]);r.push(i)}},To=e.off=function(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var r=0;r<n.length;++r)if(n[r]==i){n.splice(r,1);break}}},So=e.signal=function(e,t){var i=e._handlers&&e._handlers[t];if(i)for(var n=Array.prototype.slice.call(arguments,2),r=0;r<i.length;++r)i[r].apply(null,n)},Mo=null,Do=30,Eo=e.Pass={toString:function(){return"CodeMirror.Pass"}},Lo={scroll:!1},Po={origin:"*mouse"},Ao={origin:"+move"};Sr.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Io=e.countColumn=function(e,t,i,n,r){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var s=n||0,o=r||0;;){var a=e.indexOf("	",s);if(0>a||a>=t)return o+(t-s);o+=a-s,o+=i-o%i,s=a+1}},Oo=[""],jo=function(e){e.select()};ws?jo=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ps&&(jo=function(e){try{e.select()}catch(t){}});var zo,No=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,$o=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||No.test(e))},Ho=/[\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]/;zo=document.createRange?function(e,t,i,n){var r=document.createRange();return r.setEnd(n||e,i),r.setStart(e,t),r}:function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(r){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};var Ro=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};ps&&11>fs&&(Wr=function(){try{return document.activeElement}catch(e){return document.body}});var Fo,Wo,qo=e.rmClass=function(e,t){var i=e.className,n=qr(t).exec(i);if(n){var r=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(r?n[1]+r:"")}},Bo=e.addClass=function(e,t){var i=e.className;qr(t).test(i)||(e.className+=(i?" ":"")+t)},Uo=!1,Yo=function(){if(ps&&9>fs)return!1;var e=Hr("div");return"draggable"in e||"dragDrop"in e}(),Go=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,i=[],n=e.length;n>=t;){var r=e.indexOf("\n",t);
-1==r&&(r=e.length);var s=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),o=s.indexOf("\r");-1!=o?(i.push(s.slice(0,o)),t+=o+1):(i.push(s),t=r+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Ko=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(i){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Vo=function(){var e=Hr("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Jo=null,Qo={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=Qo,function(){for(var e=0;10>e;e++)Qo[e+48]=Qo[e+96]=String(e);for(var e=65;90>=e;e++)Qo[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Qo[e+111]=Qo[e+63235]="F"+e}();var Xo,Zo=function(){function e(e){return 247>=e?i.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,i){this.level=e,this.from=t,this.to=i}var i="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/,c="L";return function(i){if(!r.test(i))return!1;for(var n,h=i.length,u=[],d=0;h>d;++d)u.push(n=e(i.charCodeAt(d)));for(var d=0,p=c;h>d;++d){var n=u[d];"m"==n?u[d]=p:p=n}for(var d=0,f=c;h>d;++d){var n=u[d];"1"==n&&"r"==f?u[d]="n":o.test(n)&&(f=n,"r"==n&&(u[d]="R"))}for(var d=1,p=u[0];h-1>d;++d){var n=u[d];"+"==n&&"1"==p&&"1"==u[d+1]?u[d]="1":","!=n||p!=u[d+1]||"1"!=p&&"n"!=p||(u[d]=p),p=n}for(var d=0;h>d;++d){var n=u[d];if(","==n)u[d]="N";else if("%"==n){for(var m=d+1;h>m&&"%"==u[m];++m);for(var g=d&&"!"==u[d-1]||h>m&&"1"==u[m]?"1":"N",_=d;m>_;++_)u[_]=g;d=m-1}}for(var d=0,f=c;h>d;++d){var n=u[d];"L"==f&&"1"==n?u[d]="L":o.test(n)&&(f=n)}for(var d=0;h>d;++d)if(s.test(u[d])){for(var m=d+1;h>m&&s.test(u[m]);++m);for(var v="L"==(d?u[d-1]:c),b="L"==(h>m?u[m]:c),g=v||b?"L":"R",_=d;m>_;++_)u[_]=g;d=m-1}for(var y,x=[],d=0;h>d;)if(a.test(u[d])){var w=d;for(++d;h>d&&a.test(u[d]);++d);x.push(new t(0,w,d))}else{var k=d,C=x.length;for(++d;h>d&&"L"!=u[d];++d);for(var _=k;d>_;)if(l.test(u[_])){_>k&&x.splice(C,0,new t(1,k,_));var T=_;for(++_;d>_&&l.test(u[_]);++_);x.splice(C,0,new t(2,T,_)),k=_}else++_;d>k&&x.splice(C,0,new t(1,k,d))}return 1==x[0].level&&(y=i.match(/^\s+/))&&(x[0].from=y[0].length,x.unshift(new t(0,0,y[0].length))),1==Er(x).level&&(y=i.match(/\s+$/))&&(Er(x).to-=y[0].length,x.push(new t(0,h-y[0].length,h))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Er(x).level&&x.push(new t(x[0].level,h,h)),x}}();return e.version="5.5.0",e}),function(e){function t(e,t,i){switch(arguments.length){case 2:return null!=e?e:t;case 3:return null!=e?e:null!=t?t:i;default:throw new Error("Implement me")}}function i(e,t){return Te.call(e,t)}function n(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function r(e){be.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function s(e,t){var i=!0;return d(function(){return i&&(r(e),i=!1),t.apply(this,arguments)},t)}function o(e,t){gt[e]||(r(t),gt[e]=!0)}function a(e,t){return function(i){return m(e.call(this,i),t)}}function l(e,t){return function(i){return this.localeData().ordinal(e.call(this,i),t)}}function c(){}function h(e,t){t!==!1&&P(e),p(this,e),this._d=new Date(+e._d)}function u(e){var t=C(e),i=t.year||0,n=t.quarter||0,r=t.month||0,s=t.week||0,o=t.day||0,a=t.hour||0,l=t.minute||0,c=t.second||0,h=t.millisecond||0;this._milliseconds=+h+1e3*c+6e4*l+36e5*a,this._days=+o+7*s,this._months=+r+3*n+12*i,this._data={},this._locale=be.localeData(),this._bubble()}function d(e,t){for(var n in t)i(t,n)&&(e[n]=t[n]);return i(t,"toString")&&(e.toString=t.toString),i(t,"valueOf")&&(e.valueOf=t.valueOf),e}function p(e,t){var i,n,r;if("undefined"!=typeof t._isAMomentObject&&(e._isAMomentObject=t._isAMomentObject),"undefined"!=typeof t._i&&(e._i=t._i),"undefined"!=typeof t._f&&(e._f=t._f),"undefined"!=typeof t._l&&(e._l=t._l),"undefined"!=typeof t._strict&&(e._strict=t._strict),"undefined"!=typeof t._tzm&&(e._tzm=t._tzm),"undefined"!=typeof t._isUTC&&(e._isUTC=t._isUTC),"undefined"!=typeof t._offset&&(e._offset=t._offset),"undefined"!=typeof t._pf&&(e._pf=t._pf),"undefined"!=typeof t._locale&&(e._locale=t._locale),Oe.length>0)for(i in Oe)n=Oe[i],r=t[n],"undefined"!=typeof r&&(e[n]=r);return e}function f(e){return 0>e?Math.ceil(e):Math.floor(e)}function m(e,t,i){for(var n=""+Math.abs(e),r=e>=0;n.length<t;)n="0"+n;return(r?i?"+":"":"-")+n}function g(e,t){var i={milliseconds:0,months:0};return i.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function _(e,t){var i;return t=z(t,e),e.isBefore(t)?i=g(e,t):(i=g(t,e),i.milliseconds=-i.milliseconds,i.months=-i.months),i}function v(e,t){return function(i,n){var r,s;return null===n||isNaN(+n)||(o(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),s=i,i=n,n=s),i="string"==typeof i?+i:i,r=be.duration(i,n),b(this,r,e),this}}function b(e,t,i,n){var r=t._milliseconds,s=t._days,o=t._months;n=null==n?!0:n,r&&e._d.setTime(+e._d+r*i),s&&pe(e,"Date",de(e,"Date")+s*i),o&&ue(e,de(e,"Month")+o*i),n&&be.updateOffset(e,s||o)}function y(e){return"[object Array]"===Object.prototype.toString.call(e)}function x(e){return"[object Date]"===Object.prototype.toString.call(e)||e instanceof Date}function w(e,t,i){var n,r=Math.min(e.length,t.length),s=Math.abs(e.length-t.length),o=0;for(n=0;r>n;n++)(i&&e[n]!==t[n]||!i&&S(e[n])!==S(t[n]))&&o++;return o+s}function k(e){if(e){var t=e.toLowerCase().replace(/(.)s$/,"$1");e=ct[e]||ht[t]||t}return e}function C(e){var t,n,r={};for(n in e)i(e,n)&&(t=k(n),t&&(r[t]=e[n]));return r}function T(t){var i,n;if(0===t.indexOf("week"))i=7,n="day";else{if(0!==t.indexOf("month"))return;i=12,n="month"}be[t]=function(r,s){var o,a,l=be._locale[t],c=[];if("number"==typeof r&&(s=r,r=e),a=function(e){var t=be().utc().set(n,e);return l.call(be._locale,t,r||"")},null!=s)return a(s);for(o=0;i>o;o++)c.push(a(o));return c}}function S(e){var t=+e,i=0;return 0!==t&&isFinite(t)&&(i=t>=0?Math.floor(t):Math.ceil(t)),i}function M(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function D(e,t,i){return ae(be([e,11,31+t-i]),t,i).week}function E(e){return L(e)?366:365}function L(e){return e%4===0&&e%100!==0||e%400===0}function P(e){var t;e._a&&-2===e._pf.overflow&&(t=e._a[Me]<0||e._a[Me]>11?Me:e._a[De]<1||e._a[De]>M(e._a[Se],e._a[Me])?De:e._a[Ee]<0||e._a[Ee]>24||24===e._a[Ee]&&(0!==e._a[Le]||0!==e._a[Pe]||0!==e._a[Ae])?Ee:e._a[Le]<0||e._a[Le]>59?Le:e._a[Pe]<0||e._a[Pe]>59?Pe:e._a[Ae]<0||e._a[Ae]>999?Ae:-1,e._pf._overflowDayOfYear&&(Se>t||t>De)&&(t=De),e._pf.overflow=t)}function A(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length&&t._pf.bigHour===e)),t._isValid}function I(e){return e?e.toLowerCase().replace("_","-"):e}function O(e){for(var t,i,n,r,s=0;s<e.length;){for(r=I(e[s]).split("-"),t=r.length,i=I(e[s+1]),i=i?i.split("-"):null;t>0;){if(n=j(r.slice(0,t).join("-")))return n;if(i&&i.length>=t&&w(r,i,!0)>=t-1)break;t--}s++}return null}function j(e){var t=null;if(!Ie[e]&&je)try{t=be.locale(),require("./locale/"+e),be.locale(t)}catch(i){}return Ie[e]}function z(e,t){var i,n;return t._isUTC?(i=t.clone(),n=(be.isMoment(e)||x(e)?+e:+be(e))-+i,i._d.setTime(+i._d+n),be.updateOffset(i,!1),i):be(e).local()}function N(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function $(e){var t,i,n=e.match(He);for(t=0,i=n.length;i>t;t++)mt[n[t]]?n[t]=mt[n[t]]:n[t]=N(n[t]);return function(r){var s="";for(t=0;i>t;t++)s+=n[t]instanceof Function?n[t].call(r,e):n[t];return s}}function H(e,t){return e.isValid()?(t=R(t,e.localeData()),ut[t]||(ut[t]=$(t)),ut[t](e)):e.localeData().invalidDate()}function R(e,t){function i(e){return t.longDateFormat(e)||e}var n=5;for(Re.lastIndex=0;n>=0&&Re.test(e);)e=e.replace(Re,i),Re.lastIndex=0,n-=1;return e}function F(e,t){var i,n=t._strict;switch(e){case"Q":return Qe;case"DDDD":return Ze;case"YYYY":case"GGGG":case"gggg":return n?et:qe;case"Y":case"G":case"g":return it;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return n?tt:Be;case"S":if(n)return Qe;case"SS":if(n)return Xe;case"SSS":if(n)return Ze;case"DDD":return We;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ye;case"a":case"A":return t._locale._meridiemParse;case"x":return Ve;case"X":return Je;case"Z":case"ZZ":return Ge;case"T":return Ke;case"SSSS":return Ue;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return n?Xe:Fe;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Fe;case"Do":return n?t._locale._ordinalParse:t._locale._ordinalParseLenient;default:return i=new RegExp(J(V(e.replace("\\","")),"i"))}}function W(e){e=e||"";var t=e.match(Ge)||[],i=t[t.length-1]||[],n=(i+"").match(at)||["-",0,0],r=+(60*n[1])+S(n[2]);return"+"===n[0]?-r:r}function q(e,t,i){var n,r=i._a;switch(e){case"Q":null!=t&&(r[Me]=3*(S(t)-1));break;case"M":case"MM":null!=t&&(r[Me]=S(t)-1);break;case"MMM":case"MMMM":n=i._locale.monthsParse(t,e,i._strict),null!=n?r[Me]=n:i._pf.invalidMonth=t;break;case"D":case"DD":null!=t&&(r[De]=S(t));break;case"Do":null!=t&&(r[De]=S(parseInt(t.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=t&&(i._dayOfYear=S(t));break;case"YY":r[Se]=be.parseTwoDigitYear(t);break;case"YYYY":case"YYYYY":case"YYYYYY":r[Se]=S(t);break;case"a":case"A":i._isPm=i._locale.isPM(t);break;case"h":case"hh":i._pf.bigHour=!0;case"H":case"HH":r[Ee]=S(t);break;case"m":case"mm":r[Le]=S(t);break;case"s":case"ss":r[Pe]=S(t);break;case"S":case"SS":case"SSS":case"SSSS":r[Ae]=S(1e3*("0."+t));break;case"x":i._d=new Date(S(t));break;case"X":i._d=new Date(1e3*parseFloat(t));break;case"Z":case"ZZ":i._useUTC=!0,i._tzm=W(t);break;case"dd":case"ddd":case"dddd":n=i._locale.weekdaysParse(t),null!=n?(i._w=i._w||{},i._w.d=n):i._pf.invalidWeekday=t;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":e=e.substr(0,1);case"gggg":case"GGGG":case"GGGGG":e=e.substr(0,2),t&&(i._w=i._w||{},i._w[e]=S(t));break;case"gg":case"GG":i._w=i._w||{},i._w[e]=be.parseTwoDigitYear(t)}}function B(e){var i,n,r,s,o,a,l;i=e._w,null!=i.GG||null!=i.W||null!=i.E?(o=1,a=4,n=t(i.GG,e._a[Se],ae(be(),1,4).year),r=t(i.W,1),s=t(i.E,1)):(o=e._locale._week.dow,a=e._locale._week.doy,n=t(i.gg,e._a[Se],ae(be(),o,a).year),r=t(i.w,1),null!=i.d?(s=i.d,o>s&&++r):s=null!=i.e?i.e+o:o),l=le(n,r,s,a,o),e._a[Se]=l.year,e._dayOfYear=l.dayOfYear}function U(e){var i,n,r,s,o=[];if(!e._d){for(r=G(e),e._w&&null==e._a[De]&&null==e._a[Me]&&B(e),e._dayOfYear&&(s=t(e._a[Se],r[Se]),e._dayOfYear>E(s)&&(e._pf._overflowDayOfYear=!0),n=ne(s,0,e._dayOfYear),e._a[Me]=n.getUTCMonth(),e._a[De]=n.getUTCDate()),i=0;3>i&&null==e._a[i];++i)e._a[i]=o[i]=r[i];for(;7>i;i++)e._a[i]=o[i]=null==e._a[i]?2===i?1:0:e._a[i];24===e._a[Ee]&&0===e._a[Le]&&0===e._a[Pe]&&0===e._a[Ae]&&(e._nextDay=!0,e._a[Ee]=0),e._d=(e._useUTC?ne:ie).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()+e._tzm),e._nextDay&&(e._a[Ee]=24)}}function Y(e){var t;e._d||(t=C(e._i),e._a=[t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],U(e))}function G(e){var t=new Date;return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function K(t){if(t._f===be.ISO_8601)return void X(t);t._a=[],t._pf.empty=!0;var i,n,r,s,o,a=""+t._i,l=a.length,c=0;for(r=R(t._f,t._locale).match(He)||[],i=0;i<r.length;i++)s=r[i],n=(a.match(F(s,t))||[])[0],n&&(o=a.substr(0,a.indexOf(n)),o.length>0&&t._pf.unusedInput.push(o),a=a.slice(a.indexOf(n)+n.length),c+=n.length),mt[s]?(n?t._pf.empty=!1:t._pf.unusedTokens.push(s),q(s,n,t)):t._strict&&!n&&t._pf.unusedTokens.push(s);t._pf.charsLeftOver=l-c,a.length>0&&t._pf.unusedInput.push(a),t._pf.bigHour===!0&&t._a[Ee]<=12&&(t._pf.bigHour=e),t._isPm&&t._a[Ee]<12&&(t._a[Ee]+=12),t._isPm===!1&&12===t._a[Ee]&&(t._a[Ee]=0),U(t),P(t)}function V(e){return e.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,n,r){return t||i||n||r})}function J(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(e){var t,i,r,s,o;if(0===e._f.length)return e._pf.invalidFormat=!0,void(e._d=new Date(NaN));for(s=0;s<e._f.length;s++)o=0,t=p({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._pf=n(),t._f=e._f[s],K(t),A(t)&&(o+=t._pf.charsLeftOver,o+=10*t._pf.unusedTokens.length,t._pf.score=o,(null==r||r>o)&&(r=o,i=t));d(e,i||t)}function X(e){var t,i,n=e._i,r=nt.exec(n);if(r){for(e._pf.iso=!0,t=0,i=st.length;i>t;t++)if(st[t][1].exec(n)){e._f=st[t][0]+(r[6]||" ");break}for(t=0,i=ot.length;i>t;t++)if(ot[t][1].exec(n)){e._f+=ot[t][0];break}n.match(Ge)&&(e._f+="Z"),K(e)}else e._isValid=!1}function Z(e){X(e),e._isValid===!1&&(delete e._isValid,be.createFromInputFallback(e))}function ee(e,t){var i,n=[];for(i=0;i<e.length;++i)n.push(t(e[i],i));return n}function te(t){var i,n=t._i;n===e?t._d=new Date:x(n)?t._d=new Date(+n):null!==(i=ze.exec(n))?t._d=new Date(+i[1]):"string"==typeof n?Z(t):y(n)?(t._a=ee(n.slice(0),function(e){return parseInt(e,10)}),U(t)):"object"==typeof n?Y(t):"number"==typeof n?t._d=new Date(n):be.createFromInputFallback(t)}function ie(e,t,i,n,r,s,o){var a=new Date(e,t,i,n,r,s,o);return 1970>e&&a.setFullYear(e),a}function ne(e){var t=new Date(Date.UTC.apply(null,arguments));return 1970>e&&t.setUTCFullYear(e),t}function re(e,t){if("string"==typeof e)if(isNaN(e)){if(e=t.weekdaysParse(e),"number"!=typeof e)return null}else e=parseInt(e,10);return e}function se(e,t,i,n,r){return r.relativeTime(t||1,!!i,e,n)}function oe(e,t,i){var n=be.duration(e).abs(),r=Ce(n.as("s")),s=Ce(n.as("m")),o=Ce(n.as("h")),a=Ce(n.as("d")),l=Ce(n.as("M")),c=Ce(n.as("y")),h=r<dt.s&&["s",r]||1===s&&["m"]||s<dt.m&&["mm",s]||1===o&&["h"]||o<dt.h&&["hh",o]||1===a&&["d"]||a<dt.d&&["dd",a]||1===l&&["M"]||l<dt.M&&["MM",l]||1===c&&["y"]||["yy",c];return h[2]=t,h[3]=+e>0,h[4]=i,se.apply({},h)}function ae(e,t,i){var n,r=i-t,s=i-e.day();return s>r&&(s-=7),r-7>s&&(s+=7),n=be(e).add(s,"d"),{week:Math.ceil(n.dayOfYear()/7),year:n.year()}}function le(e,t,i,n,r){var s,o,a=ne(e,0,1).getUTCDay();return a=0===a?7:a,i=null!=i?i:r,s=r-a+(a>n?7:0)-(r>a?7:0),o=7*(t-1)+(i-r)+s+1,{year:o>0?e:e-1,dayOfYear:o>0?o:E(e-1)+o}}function ce(t){var i,n=t._i,r=t._f;return t._locale=t._locale||be.localeData(t._l),null===n||r===e&&""===n?be.invalid({nullInput:!0}):("string"==typeof n&&(t._i=n=t._locale.preparse(n)),be.isMoment(n)?new h(n,!0):(r?y(r)?Q(t):K(t):te(t),i=new h(t),i._nextDay&&(i.add(1,"d"),i._nextDay=e),i))}function he(e,t){var i,n;if(1===t.length&&y(t[0])&&(t=t[0]),!t.length)return be();for(i=t[0],n=1;n<t.length;++n)t[n][e](i)&&(i=t[n]);return i}function ue(e,t){var i;return"string"==typeof t&&(t=e.localeData().monthsParse(t),"number"!=typeof t)?e:(i=Math.min(e.date(),M(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,i),e)}function de(e,t){return e._d["get"+(e._isUTC?"UTC":"")+t]()}function pe(e,t,i){return"Month"===t?ue(e,i):e._d["set"+(e._isUTC?"UTC":"")+t](i)}function fe(e,t){return function(i){return null!=i?(pe(this,e,i),be.updateOffset(this,t),this):de(this,e)}}function me(e){return 400*e/146097}function ge(e){return 146097*e/400}function _e(e){be.duration.fn[e]=function(){return this._data[e]}}function ve(e){"undefined"==typeof ender&&(ye=ke.moment,e?ke.moment=s("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",be):ke.moment=be)}for(var be,ye,xe,we="2.8.4",ke="undefined"!=typeof global?global:this,Ce=Math.round,Te=Object.prototype.hasOwnProperty,Se=0,Me=1,De=2,Ee=3,Le=4,Pe=5,Ae=6,Ie={},Oe=[],je="undefined"!=typeof module&&module&&module.exports,ze=/^\/?Date\((\-?\d+)/i,Ne=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,$e=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,He=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Re=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Fe=/\d\d?/,We=/\d{1,3}/,qe=/\d{1,4}/,Be=/[+\-]?\d{1,6}/,Ue=/\d+/,Ye=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Ge=/Z|[\+\-]\d\d:?\d\d/gi,Ke=/T/i,Ve=/[\+\-]?\d+/,Je=/[\+\-]?\d+(\.\d{1,3})?/,Qe=/\d/,Xe=/\d\d/,Ze=/\d{3}/,et=/\d{4}/,tt=/[+-]?\d{6}/,it=/[+-]?\d+/,nt=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,rt="YYYY-MM-DDTHH:mm:ssZ",st=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],ot=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],at=/([\+\-]|\d\d)/gi,lt=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),ct={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},ht={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},ut={},dt={s:45,m:45,h:22,d:26,M:11},pt="DDD w W M D d".split(" "),ft="M D H h m s w W".split(" "),mt={M:function(){return this.month()+1},MMM:function(e){return this.localeData().monthsShort(this,e)},MMMM:function(e){return this.localeData().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.localeData().weekdaysMin(this,e)},ddd:function(e){return this.localeData().weekdaysShort(this,e)},dddd:function(e){return this.localeData().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return m(this.year()%100,2)},YYYY:function(){return m(this.year(),4)},YYYYY:function(){return m(this.year(),5)},YYYYYY:function(){var e=this.year(),t=e>=0?"+":"-";return t+m(Math.abs(e),6)},gg:function(){return m(this.weekYear()%100,2)},gggg:function(){return m(this.weekYear(),4)},ggggg:function(){return m(this.weekYear(),5)},GG:function(){return m(this.isoWeekYear()%100,2)},GGGG:function(){return m(this.isoWeekYear(),4)},GGGGG:function(){return m(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return S(this.milliseconds()/100)},SS:function(){return m(S(this.milliseconds()/10),2)},SSS:function(){return m(this.milliseconds(),3)},SSSS:function(){return m(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+m(S(e/60),2)+":"+m(S(e)%60,2)},ZZ:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+m(S(e/60),2)+m(S(e)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},gt={},_t=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];pt.length;)xe=pt.pop(),mt[xe+"o"]=l(mt[xe],xe);for(;ft.length;)xe=ft.pop(),mt[xe+xe]=a(mt[xe],2);mt.DDDD=a(mt.DDD,3),d(c.prototype,{set:function(e){var t,i;for(i in e)t=e[i],"function"==typeof t?this[i]=t:this["_"+i]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e,t,i){var n,r,s;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;12>n;n++){if(r=be.utc([2e3,n]),i&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),i||this._monthsParse[n]||(s="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(s.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(i&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!i&&this._monthsParse[n].test(e))return n}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},weekdaysParse:function(e){var t,i,n;for(this._weekdaysParse||(this._weekdaysParse=[]),t=0;7>t;t++)if(this._weekdaysParse[t]||(i=be([2e3,1]).day(t),n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[t]=new RegExp(n.replace(".",""),"i")),this._weekdaysParse[t].test(e))return t},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},isPM:function(e){return"p"===(e+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(e,t,i){var n=this._calendar[e];return"function"==typeof n?n.apply(t,[i]):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,i,n){var r=this._relativeTime[i];return"function"==typeof r?r(e,t,i,n):r.replace(/%d/i,e)},pastFuture:function(e,t){var i=this._relativeTime[e>0?"future":"past"];return"function"==typeof i?i(t):i.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(e){return e},postformat:function(e){return e},week:function(e){return ae(e,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),be=function(t,i,r,s){var o;return"boolean"==typeof r&&(s=r,r=e),o={},o._isAMomentObject=!0,o._i=t,o._f=i,o._l=r,o._strict=s,o._isUTC=!1,o._pf=n(),ce(o)},be.suppressDeprecationWarnings=!1,be.createFromInputFallback=s("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),be.min=function(){var e=[].slice.call(arguments,0);return he("isBefore",e)},be.max=function(){var e=[].slice.call(arguments,0);return he("isAfter",e)},be.utc=function(t,i,r,s){var o;return"boolean"==typeof r&&(s=r,r=e),o={},o._isAMomentObject=!0,o._useUTC=!0,o._isUTC=!0,o._l=r,o._i=t,o._f=i,o._strict=s,o._pf=n(),ce(o).utc()},be.unix=function(e){return be(1e3*e)},be.duration=function(e,t){var n,r,s,o,a=e,l=null;return be.isDuration(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(a={},t?a[t]=e:a.milliseconds=e):(l=Ne.exec(e))?(n="-"===l[1]?-1:1,a={y:0,d:S(l[De])*n,h:S(l[Ee])*n,m:S(l[Le])*n,s:S(l[Pe])*n,ms:S(l[Ae])*n}):(l=$e.exec(e))?(n="-"===l[1]?-1:1,s=function(e){var t=e&&parseFloat(e.replace(",","."));return(isNaN(t)?0:t)*n},a={y:s(l[2]),M:s(l[3]),d:s(l[4]),h:s(l[5]),m:s(l[6]),s:s(l[7]),w:s(l[8])}):"object"==typeof a&&("from"in a||"to"in a)&&(o=_(be(a.from),be(a.to)),a={},a.ms=o.milliseconds,a.M=o.months),r=new u(a),be.isDuration(e)&&i(e,"_locale")&&(r._locale=e._locale),r},be.version=we,be.defaultFormat=rt,be.ISO_8601=function(){},be.momentProperties=Oe,be.updateOffset=function(){},be.relativeTimeThreshold=function(t,i){return dt[t]===e?!1:i===e?dt[t]:(dt[t]=i,!0)},be.lang=s("moment.lang is deprecated. Use moment.locale instead.",function(e,t){return be.locale(e,t)}),be.locale=function(e,t){var i;return e&&(i="undefined"!=typeof t?be.defineLocale(e,t):be.localeData(e),i&&(be.duration._locale=be._locale=i)),be._locale._abbr},be.defineLocale=function(e,t){return null!==t?(t.abbr=e,Ie[e]||(Ie[e]=new c),Ie[e].set(t),be.locale(e),Ie[e]):(delete Ie[e],null)},be.langData=s("moment.langData is deprecated. Use moment.localeData instead.",function(e){return be.localeData(e)}),be.localeData=function(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return be._locale;if(!y(e)){if(t=j(e))return t;e=[e]}return O(e)},be.isMoment=function(e){return e instanceof h||null!=e&&i(e,"_isAMomentObject")},be.isDuration=function(e){return e instanceof u};for(xe=_t.length-1;xe>=0;--xe)T(_t[xe]);be.normalizeUnits=function(e){return k(e)},be.invalid=function(e){var t=be.utc(NaN);return null!=e?d(t._pf,e):t._pf.userInvalidated=!0,t},be.parseZone=function(){return be.apply(null,arguments).parseZone()},be.parseTwoDigitYear=function(e){return S(e)+(S(e)>68?1900:2e3)},d(be.fn=h.prototype,{clone:function(){return be(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var e=be(this).utc();return 0<e.year()&&e.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():H(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):H(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return A(this)},isDSTShifted:function(){return this._a?this.isValid()&&w(this._a,(this._isUTC?be.utc(this._a):be(this._a)).toArray())>0:!1},parsingFlags:function(){return d({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(e){return this.zone(0,e)},local:function(e){return this._isUTC&&(this.zone(0,e),this._isUTC=!1,e&&this.add(this._dateTzOffset(),"m")),this},format:function(e){var t=H(this,e||be.defaultFormat);return this.localeData().postformat(t)},add:v(1,"add"),subtract:v(-1,"subtract"),diff:function(e,t,i){var n,r,s,o=z(e,this),a=6e4*(this.zone()-o.zone());return t=k(t),"year"===t||"month"===t?(n=432e5*(this.daysInMonth()+o.daysInMonth()),r=12*(this.year()-o.year())+(this.month()-o.month()),s=this-be(this).startOf("month")-(o-be(o).startOf("month")),s-=6e4*(this.zone()-be(this).startOf("month").zone()-(o.zone()-be(o).startOf("month").zone())),r+=s/n,"year"===t&&(r/=12)):(n=this-o,r="second"===t?n/1e3:"minute"===t?n/6e4:"hour"===t?n/36e5:"day"===t?(n-a)/864e5:"week"===t?(n-a)/6048e5:n),i?r:f(r)},from:function(e,t){return be.duration({to:this,from:e}).locale(this.locale()).humanize(!t)},fromNow:function(e){return this.from(be(),e)},calendar:function(e){var t=e||be(),i=z(t,this).startOf("day"),n=this.diff(i,"days",!0),r=-6>n?"sameElse":-1>n?"lastWeek":0>n?"lastDay":1>n?"sameDay":2>n?"nextDay":7>n?"nextWeek":"sameElse";return this.format(this.localeData().calendar(r,this,be(t)))},isLeapYear:function(){return L(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=re(e,this.localeData()),this.add(e-t,"d")):t},month:fe("Month",!0),startOf:function(e){switch(e=k(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e?this.weekday(0):"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(t){return t=k(t),t===e||"millisecond"===t?this:this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms")},isAfter:function(e,t){var i;return t=k("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=be.isMoment(e)?e:be(e),+this>+e):(i=be.isMoment(e)?+e:+be(e),i<+this.clone().startOf(t))},isBefore:function(e,t){var i;return t=k("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(e=be.isMoment(e)?e:be(e),+e>+this):(i=be.isMoment(e)?+e:+be(e),+this.clone().endOf(t)<i)},isSame:function(e,t){var i;return t=k(t||"millisecond"),"millisecond"===t?(e=be.isMoment(e)?e:be(e),+this===+e):(i=+be(e),+this.clone().startOf(t)<=i&&i<=+this.clone().endOf(t))},min:s("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(e){return e=be.apply(null,arguments),this>e?this:e}),max:s("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(e){return e=be.apply(null,arguments),e>this?this:e}),zone:function(e,t){var i,n=this._offset||0;return null==e?this._isUTC?n:this._dateTzOffset():("string"==typeof e&&(e=W(e)),Math.abs(e)<16&&(e=60*e),!this._isUTC&&t&&(i=this._dateTzOffset()),this._offset=e,this._isUTC=!0,null!=i&&this.subtract(i,"m"),n!==e&&(!t||this._changeInProgress?b(this,be.duration(n-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,be.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(e){return e=e?be(e).zone():0,(this.zone()-e)%60===0},daysInMonth:function(){return M(this.year(),this.month())},dayOfYear:function(e){var t=Ce((be(this).startOf("day")-be(this).startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},quarter:function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},weekYear:function(e){var t=ae(this,this.localeData()._week.dow,this.localeData()._week.doy).year;
return null==e?t:this.add(e-t,"y")},isoWeekYear:function(e){var t=ae(this,1,4).year;return null==e?t:this.add(e-t,"y")},week:function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},isoWeek:function(e){var t=ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},weekday:function(e){var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},isoWeekday:function(e){return null==e?this.day()||7:this.day(this.day()%7?e:e-7)},isoWeeksInYear:function(){return D(this.year(),1,4)},weeksInYear:function(){var e=this.localeData()._week;return D(this.year(),e.dow,e.doy)},get:function(e){return e=k(e),this[e]()},set:function(e,t){return e=k(e),"function"==typeof this[e]&&this[e](t),this},locale:function(t){var i;return t===e?this._locale._abbr:(i=be.localeData(t),null!=i&&(this._locale=i),this)},lang:s("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===e?this.localeData():this.locale(t)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),be.fn.millisecond=be.fn.milliseconds=fe("Milliseconds",!1),be.fn.second=be.fn.seconds=fe("Seconds",!1),be.fn.minute=be.fn.minutes=fe("Minutes",!1),be.fn.hour=be.fn.hours=fe("Hours",!0),be.fn.date=fe("Date",!0),be.fn.dates=s("dates accessor is deprecated. Use date instead.",fe("Date",!0)),be.fn.year=fe("FullYear",!0),be.fn.years=s("years accessor is deprecated. Use year instead.",fe("FullYear",!0)),be.fn.days=be.fn.day,be.fn.months=be.fn.month,be.fn.weeks=be.fn.week,be.fn.isoWeeks=be.fn.isoWeek,be.fn.quarters=be.fn.quarter,be.fn.toJSON=be.fn.toISOString,d(be.duration.fn=u.prototype,{_bubble:function(){var e,t,i,n=this._milliseconds,r=this._days,s=this._months,o=this._data,a=0;o.milliseconds=n%1e3,e=f(n/1e3),o.seconds=e%60,t=f(e/60),o.minutes=t%60,i=f(t/60),o.hours=i%24,r+=f(i/24),a=f(me(r)),r-=f(ge(a)),s+=f(r/30),r%=30,a+=f(s/12),s%=12,o.days=r,o.months=s,o.years=a},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return f(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},humanize:function(e){var t=oe(this,!e,this.localeData());return e&&(t=this.localeData().pastFuture(+this,t)),this.localeData().postformat(t)},add:function(e,t){var i=be.duration(e,t);return this._milliseconds+=i._milliseconds,this._days+=i._days,this._months+=i._months,this._bubble(),this},subtract:function(e,t){var i=be.duration(e,t);return this._milliseconds-=i._milliseconds,this._days-=i._days,this._months-=i._months,this._bubble(),this},get:function(e){return e=k(e),this[e.toLowerCase()+"s"]()},as:function(e){var t,i;if(e=k(e),"month"===e||"year"===e)return t=this._days+this._milliseconds/864e5,i=this._months+12*me(t),"month"===e?i:i/12;switch(t=this._days+Math.round(ge(this._months/12)),e){case"week":return t/7+this._milliseconds/6048e5;case"day":return t+this._milliseconds/864e5;case"hour":return 24*t+this._milliseconds/36e5;case"minute":return 24*t*60+this._milliseconds/6e4;case"second":return 24*t*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*t*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+e)}},lang:be.fn.lang,locale:be.fn.locale,toIsoString:s("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var e=Math.abs(this.years()),t=Math.abs(this.months()),i=Math.abs(this.days()),n=Math.abs(this.hours()),r=Math.abs(this.minutes()),s=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"")+(i?i+"D":"")+(n||r||s?"T":"")+(n?n+"H":"")+(r?r+"M":"")+(s?s+"S":""):"P0D"},localeData:function(){return this._locale}}),be.duration.fn.toString=be.duration.fn.toISOString;for(xe in lt)i(lt,xe)&&_e(xe.toLowerCase());be.duration.fn.asMilliseconds=function(){return this.as("ms")},be.duration.fn.asSeconds=function(){return this.as("s")},be.duration.fn.asMinutes=function(){return this.as("m")},be.duration.fn.asHours=function(){return this.as("h")},be.duration.fn.asDays=function(){return this.as("d")},be.duration.fn.asWeeks=function(){return this.as("weeks")},be.duration.fn.asMonths=function(){return this.as("M")},be.duration.fn.asYears=function(){return this.as("y")},be.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,i=1===S(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i}}),je?module.exports=be:"function"==typeof define&&define.amd?(define("moment",["require","exports","module"],function(e,t,i){return i.config&&i.config()&&i.config().noGlobal===!0&&(ke.moment=ye),be}),ve(!0)):ve()}.call(this),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/meta",["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["pgp"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy"]},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Jade",mime:"text/x-jade",mode:"jade",ext:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"kotlin",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps"},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["py","pyw"]},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"]},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"MariaDB",mime:"text/x-mariadb",mode:"sql"},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]}];for(var t=0;t<e.modeInfo.length;t++){var i=e.modeInfo[t];i.mimes&&(i.mime=i.mimes[0])}e.findModeByMIME=function(t){t=t.toLowerCase();for(var i=0;i<e.modeInfo.length;i++){var n=e.modeInfo[i];if(n.mime==t)return n;if(n.mimes)for(var r=0;r<n.mimes.length;r++)if(n.mimes[r]==t)return n}},e.findModeByExtension=function(t){for(var i=0;i<e.modeInfo.length;i++){var n=e.modeInfo[i];if(n.ext)for(var r=0;r<n.ext.length;r++)if(n.ext[r]==t)return n}},e.findModeByFileName=function(t){for(var i=0;i<e.modeInfo.length;i++){var n=e.modeInfo[i];if(n.file&&n.file.test(t))return n}var r=t.lastIndexOf("."),s=r>-1&&t.substring(r+1,t.length);return s?e.findModeByExtension(s):void 0},e.findModeByName=function(t){t=t.toLowerCase();for(var i=0;i<e.modeInfo.length;i++){var n=e.modeInfo[i];if(n.name.toLowerCase()==t)return n;if(n.alias)for(var r=0;r<n.alias.length;r++)if(n.alias[r].toLowerCase()==t)return n}}}),define("base/js/utils",["jquery","codemirror/lib/codemirror","moment","codemirror/mode/meta"],function(e,t,i){"use strict";function n(e){e.loaded.then(function(){if(e.data.load_extensions){var t=Object.getOwnPropertyNames(e.data.load_extensions);u.apply(this,t)}})}function r(e){return e.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\'/g,"&apos;").replace(/\"/g,"&quot;").replace(/`/g,"&#96;")}function s(e,t){var i=t.shift();if(f[i])e["class"]?e["class"]+=" "+f[i]:e["class"]=f[i];else if("38"==i||"48"==i){if(t.length<2)return void console.log("Not enough fields for VT100 color",t);var n,r,s,o=t.shift();if("5"==o){var a=parseInt(t.shift(),10);if(16>a){a%=8;var l=f[i[0]+(a%8).toString()];return void(e["class"]?e["class"]+=" "+l:e["class"]=l)}232>a?(a-=16,s=a%6,r=Math.floor(a/6)%6,n=Math.floor(a/36)%6,n=51*n,r=51*r,s=51*s):(a-=231,n=r=s=Math.floor(256*a/26))}else{if("2"!=o)return void console.log("unrecognized control",t);if(t.length>3)return void console.log("Not enough fields for RGB",t);n=t.shift(),r=t.shift(),s=t.shift()}if(void 0!==n){var c;c="38"==i?"color: ":"background-color: ",c=c+"rgb("+n+","+r+","+s+");",e.style?e.style+=" "+c:e.style=c}}}function o(e){var t=!1;return e.replace(/\033\[(0?[01]|22|39)?([;\d]+)?m/g,function(e,i,n){if(n){t=!0;for(var r=n.match(/\d+/g),o={};r.length>0;)s(o,r);var a="<span ";return Object.keys(o).map(function(e){a=a+" "+e+'="'+o[e]+'"'}),a+">"}return t?(t=!1,"</span>"):""})}function a(e){e=r(e);var t=/(?=(\033\[[\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;return e=e.replace(t,""),e=o(e)}function l(e){var t=e;do e=t,t=e.replace(/\r+\n/gm,"\n"),t=t.replace(/^.*\r+/gm,"");while(t.length<e.length);return e}function c(e){return e.replace(/(^|\s)(https?|ftp)(:[^'">\s]+)/gi,'$1<a target="_blank" href="$2$3">$2$3</a>')}var h=function(e){return new Promise(function(t,i){require(["nbextensions/"+e],function(i){console.log("Loaded extension: "+e);try{i.load_ipython_extension()}finally{t(i)}},function(e){i(e)})})},u=function(){return Promise.all(Array.prototype.map.call(arguments,h))["catch"](function(e){console.error("Failed to load extension"+(e.requireModules.length>1?"s":"")+":",e.requireModules,e)})},d=function(e,t,i){var n,r,s,o,a=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),c=0;t=new RegExp(t.source,l+"g");var h="undefined"==typeof/()??/.exec("")[1];for(h||(n=new RegExp("^"+t.source+"$(?!\\s)",l)),i="undefined"==typeof i?-1>>>0:i>>>0,r=t.exec(e);r&&(s=r.index+r[0].length,!(s>c&&(a.push(e.slice(c,r.index)),!h&&r.length>1&&r[0].replace(n,function(){for(var e=1;e<arguments.length-2;e++)"undefined"==typeof arguments[e]&&(r[e]=void 0)}),r.length>1&&r.index<e.length&&Array.prototype.push.apply(a,r.slice(1)),o=r[0].length,c=s,a.length>=i)));r=t.exec(e))t.lastIndex===r.index&&t.lastIndex++;return c===e.length?(o||!t.test(""))&&a.push(""):a.push(e.slice(c)),a.length>i?a.slice(0,i):a},p=function(){for(var e=[],t="0123456789ABCDEF",i=0;32>i;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[12]="4",e[16]=t.substr(3&e[16]|8,1);var n=e.join("");return n},f={"01":"ansibold",30:"ansiblack",31:"ansired",32:"ansigreen",33:"ansiyellow",34:"ansiblue",35:"ansipurple",36:"ansicyan",37:"ansigray",40:"ansibgblack",41:"ansibgred",42:"ansibggreen",43:"ansibgyellow",44:"ansibgblue",45:"ansibgpurple",46:"ansibgcyan",47:"ansibggray"},m=function(t){var i=e('<div style="display: none; width: 10000pt; padding:0; border:0;"></div>');e("body").append(i);var n=i.width()/1e4;return i.remove(),Math.floor(t*n)},g=function(e){return function(){var t=Object.create(e.prototype);return e.apply(t,arguments),t}},_=function(){for(var e="",t=0;t<arguments.length;t++)""!==arguments[t]&&(e.length>0&&"/"!=e[e.length-1]?e=e+"/"+arguments[t]:e+=arguments[t]);return e},v=function(e){var t=e.lastIndexOf("/");return-1===t?["",e]:[e.slice(0,t),e.slice(t+1)]},b=function(e){var t=document.createElement("a");return t.href=e,t},y=function(e){return e},x=function(){return y(_.apply(null,arguments))},w=function(e){var t=e.lastIndexOf(".");return t>0?[e.slice(0,t),e.slice(t)]:[e,""]},k=function(t){return e("<div/>").text(t).html()},C=function(t){var i=e("body").data(t);return i?decodeURIComponent(i):i},T=function(e,t){t||(t=e.getCursor());for(var i=t.ch,n=0;n<t.line;n++)i+=e.getLine(n).length+1;return i},S=function(e,t){var i,n,r,s=0;for(i=0,r=e.getLine(i);void 0!==r;i++,r=e.getLine(i)){if(n=r,!(s+r.length<t))return{line:i,ch:t-s};s+=r.length+1}return{line:i-1,ch:n.length-1}},M=function(){if("undefined"==typeof navigator)return"None";var e,t=navigator.appName,i=navigator.userAgent,n=i.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);return n&&null!==(e=i.match(/version\/([\.\d]+)/i))&&(n[2]=e[1]),n=n?[n[1],n[2]]:[t,navigator.appVersion,"-?"]}(),D=function(){if("undefined"==typeof navigator)return"None";var e="None";return-1!=navigator.appVersion.indexOf("Win")&&(e="Windows"),-1!=navigator.appVersion.indexOf("Mac")&&(e="MacOS"),-1!=navigator.appVersion.indexOf("X11")&&(e="UNIX"),-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),e}(),E=function(e){var t=new RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t?decodeURIComponent(t[1]||""):void 0},L=function(e,t){return 0!==e.has(t).length||e.is(t)},P=function(t){t=e(t);var i=e(document.activeElement);return i.length>0&&L(t,i)?!0:!1},A=function(t,i,n){return i=i||{},n=n||{},e.extend(!0,{},t.options_default,i,n)},I=function(e){return e.responseJSON&&e.responseJSON.traceback?e.responseJSON.traceback:e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText},O=function(e,t,i){var n="API request failed ("+e.status+"): ";console.log(e),n+=I(e),console.log(n)},j=function(e,i,n){var r="string"==typeof e?e:e.mode||e.name;if(t.modes.hasOwnProperty(r))return void i(e.name?e:r);var s=e&&e.mode&&e.mime&&e||t.findModeByName(r)||t.findModeByExtension(r.split(".").slice(-1))||t.findModeByMIME(r)||{mode:r,mime:r};require([["codemirror/mode",s.mode,s.mode].join("/")],function(){i(e.name?e:s.mime)},n)},z="XhrError",N=function(e,t,i){var n=new Error(I(e));return n.name=z,n.xhr=e,n.xhr_status=t,n.xhr_error=i,n},$=function(t,i){return i=i||{},new Promise(function(n,r){i.success=function(e,t,i){n(e)},i.error=function(e,t,i){O(e,t,i),r(N(e,t,i))},e.ajax(t,i)})},H=function(e,t){for(var i=Error.apply(this,[e]),n=Object.getOwnPropertyNames(i),r=0;r<n.length;r++)this[n[r]]=i[n[r]];return t instanceof H?this.error_stack=t.error_stack:this.error_stack=[t],this.error_stack.push(i),this};H.prototype=Object.create(Error.prototype,{});var R=function(e,t,i){return new Promise(function(n,r){t?require([t],function(i){void 0===i[e]?r(new Error("Class "+e+" not found in module "+t)):n(i[e])},r):i&&i[e]?n(i[e]):r(new Error("Class "+e+" not found in registry "))})},F=function(e){var t=Object.keys(e),i=[];return t.forEach(function(t){i.push(e[t])}),Promise.all(i).then(function(i){e={};for(var n=0;n<t.length;n++)e[t[n]]=i[n];return e})},W=function(e,t){return function(i){var n=new H(e,i);return t&&console.error(n),Promise.reject(n)}},q=function(t,i){var n=t.jquery?t:e(t);return arguments.length>1&&n.text(i),window.MathJax?n.map(function(){return MathJax.Hub.Queue(["Typeset",MathJax.Hub,this])}):void 0},B={};B.milliseconds={},B.milliseconds.s=1e3,B.milliseconds.m=60*B.milliseconds.s,B.milliseconds.h=60*B.milliseconds.m,B.milliseconds.d=24*B.milliseconds.h,B.thresholds={s:i.relativeTimeThreshold("s")*B.milliseconds.s,m:i.relativeTimeThreshold("m")*B.milliseconds.m,h:i.relativeTimeThreshold("h")*B.milliseconds.h,d:i.relativeTimeThreshold("d")*B.milliseconds.d},B.timeout_from_dt=function(e){return e<B.thresholds.s?10*B.milliseconds.s:e<B.thresholds.m?B.milliseconds.m:B.milliseconds.h};var U={load_extension:h,load_extensions:u,load_extensions_from_config:n,regex_split:d,uuid:p,fixConsole:a,fixCarriageReturn:l,autoLinkUrls:c,points_to_pixels:m,get_body_data:C,parse_url:b,url_path_split:v,url_path_join:_,url_join_encode:x,encode_uri_components:y,splitext:w,escape_html:k,always_new:g,to_absolute_cursor_pos:T,from_absolute_cursor_pos:S,browser:M,platform:D,get_url_param:E,is_or_has:L,is_focused:P,mergeopt:A,ajax_error_msg:I,log_ajax_error:O,requireCodeMirrorMode:j,XHR_ERROR:z,wrap_ajax_error:N,promising_ajax:$,WrappedError:H,load_class:R,resolve_promises_dict:F,reject:W,typeset:q,time:B};return U}),define("base/js/dialog",["require","codemirror/lib/codemirror","jquery"],function(e){"use strict";var t=e("codemirror/lib/codemirror"),i=e("jquery"),n=function(e){var t=i("<div/>").addClass("modal").addClass("fade").attr("role","dialog"),n=i("<div/>").addClass("modal-dialog").appendTo(t),r=i("<div/>").addClass("modal-content").appendTo(n);"string"==typeof e.body&&e.sanitize!==!1&&(e.body=i("<p/>").text(e.body)),r.append(i("<div/>").addClass("modal-header").append(i("<button>").attr("type","button").addClass("close").attr("data-dismiss","modal").attr("aria-hidden","true").html("&times;")).append(i("<h4/>").addClass("modal-title").text(e.title||""))).append(i("<div/>").addClass("modal-body").append(e.body||i("<p/>")));var s=i("<div/>").addClass("modal-footer");for(var o in e.buttons){var a=e.buttons[o],l=i("<button/>").addClass("btn btn-default btn-sm").attr("data-dismiss","modal").text(o);a.click&&l.click(i.proxy(a.click,r)),a["class"]&&l.addClass(a["class"]),s.append(l)}return r.append(s),t.on("shown.bs.modal",function(){setTimeout(function(){s.find("button").last().focus(),e.open&&i.proxy(e.open,t)()},0)}),(void 0===e.destroy||e.destroy)&&t.on("hidden.bs.modal",function(){t.remove()}),t.on("hidden.bs.modal",function(){if(e.notebook){var t=e.notebook.get_selected_cell();t&&t.select()}e.keyboard_manager&&(e.keyboard_manager.enable(),e.keyboard_manager.command_mode())}),e.keyboard_manager&&e.keyboard_manager.disable(),e.backdrop=e.backdrop||"static",t.modal(e)},r=function(e){i(".kernel-modal").modal("hide");var t=n(e);return t.addClass("kernel-modal"),t},s=function(e){e.name=e.name||"Cell";var r=i("<div/>").css("color","red"),s="Manually edit the JSON below to manipulate the metadata for this "+e.name+". We recommend putting custom metadata attributes in an appropriately named sub-structure, so they don't conflict with those of others.",o=i("<textarea/>").attr("rows","13").attr("cols","80").attr("name","metadata").text(JSON.stringify(e.md||{},null,2)),a=i("<div/>").attr("title","Edit the metadata").append(i("<form/>").append(i("<fieldset/>").append(i("<label/>").attr("for","metadata").text(s)).append(r).append(i("<br/>")).append(o))),l=t.fromTextArea(o[0],{lineNumbers:!0,matchBrackets:!0,indentUnit:2,autoIndent:!0,mode:"application/json"}),c=n({title:"Edit "+e.name+" Metadata",body:a,buttons:{OK:{"class":"btn-primary",click:function(){var t;try{t=JSON.parse(l.getValue())}catch(i){return console.log(i),r.text("WARNING: Could not save invalid JSON."),!1}e.callback(t)}},Cancel:{}},notebook:e.notebook,keyboard_manager:e.keyboard_manager});c.on("shown.bs.modal",function(){l.refresh()})},o={modal:n,kernel_modal:r,edit_metadata:s};return o}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/edit/matchbrackets",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,r){var s=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&a[s.text.charAt(l)]||a[s.text.charAt(++l)];if(!c)return null;var h=">"==c.charAt(1)?1:-1;if(n&&h>0!=(l==t.ch))return null;var u=e.getTokenTypeAt(o(t.line,l+1)),d=i(e,o(t.line,l+(h>0?1:0)),h,u||null,r);return null==d?null:{from:o(t.line,l),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:h>0}}function i(e,t,i,n,r){for(var s=r&&r.maxScanLineLength||1e4,l=r&&r.maxScanLines||1e3,c=[],h=r&&r.bracketRegex?r.bracketRegex:/[(){}[\]]/,u=i>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=u;d+=i){var p=e.getLine(d);if(p){var f=i>0?0:p.length-1,m=i>0?p.length:-1;if(!(p.length>s))for(d==t.line&&(f=t.ch-(0>i?1:0));f!=m;f+=i){var g=p.charAt(f);if(h.test(g)&&(void 0===n||e.getTokenTypeAt(o(d,f+1))==n)){var _=a[g];if(">"==_.charAt(1)==i>0)c.push(g);else{if(!c.length)return{pos:o(d,f),ch:g};c.pop()}}}}}return d-i==(i>0?e.lastLine():e.firstLine())?!1:null}function n(e,i,n){for(var r=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],l=e.listSelections(),c=0;c<l.length;c++){var h=l[c].empty()&&t(e,l[c].head,!1,n);if(h&&e.getLine(h.from.line).length<=r){var u=h.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";a.push(e.markText(h.from,o(h.from.line,h.from.ch+1),{className:u})),h.to&&e.getLine(h.to.line).length<=r&&a.push(e.markText(h.to,o(h.to.line,h.to.ch+1),{className:u}))}}if(a.length){s&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<a.length;e++)a[e].clear()})};if(!i)return d;setTimeout(d,800)}}function r(e){e.operation(function(){l&&(l(),l=null),l=n(e,!1,e.state.matchBrackets)})}var s=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),o=e.Pos,a={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,i,n){n&&n!=e.Init&&t.off("cursorActivity",r),i&&(t.state.matchBrackets="object"==typeof i?i:{},t.on("cursorActivity",r))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,i,n){return t(this,e,i,n)}),e.defineExtension("scanForBracket",function(e,t,n,r){return i(this,e,t,n,r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/edit/closebrackets",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:h[t]}function i(e){return function(t){return o(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var i=e.getModeAt(e.getCursor());return i.closeBrackets||t}function r(i){var r=n(i);if(!r||i.getOption("disableInput"))return e.Pass;for(var s=t(r,"pairs"),o=i.listSelections(),a=0;a<o.length;a++){if(!o[a].empty())return e.Pass;var c=l(i,o[a].head);if(!c||s.indexOf(c)%2!=0)return e.Pass}for(var a=o.length-1;a>=0;a--){var h=o[a].head;i.replaceRange("",u(h.line,h.ch-1),u(h.line,h.ch+1))}}function s(i){var r=n(i),s=r&&t(r,"explode");if(!s||i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=0;a<o.length;a++){if(!o[a].empty())return e.Pass;var c=l(i,o[a].head);if(!c||s.indexOf(c)%2!=0)return e.Pass}i.operation(function(){i.replaceSelection("\n\n",null),i.execCommand("goCharLeft"),o=i.listSelections();for(var e=0;e<o.length;e++){var t=o[e].head.line;i.indentLine(t,null,!0),i.indentLine(t+1,null,!0)}})}function o(i,r){var s=n(i);if(!s||i.getOption("disableInput"))return e.Pass;var o=t(s,"pairs"),l=o.indexOf(r);if(-1==l)return e.Pass;for(var h,d,p=t(s,"triples"),f=o.charAt(l+1)==r,m=i.listSelections(),g=l%2==0,_=0;_<m.length;_++){var v,b=m[_],y=b.head,d=i.getRange(y,u(y.line,y.ch+1));if(g&&!b.empty())v="surround";else if(!f&&g||d!=r)if(f&&y.ch>1&&p.indexOf(r)>=0&&i.getRange(u(y.line,y.ch-2),y)==r+r&&(y.ch<=2||i.getRange(u(y.line,y.ch-3),u(y.line,y.ch-2))!=r))v="addFour";else if(f){if(e.isWordChar(d)||!c(i,y,r))return e.Pass;v="both"}else{if(!g||i.getLine(y.line).length!=y.ch&&!a(d,o)&&!/\s/.test(d))return e.Pass;v="both"}else v=p.indexOf(r)>=0&&i.getRange(y,u(y.line,y.ch+3))==r+r+r?"skipThree":"skip";if(h){if(h!=v)return e.Pass}else h=v}var x=l%2?o.charAt(l-1):r,w=l%2?r:o.charAt(l+1);i.operation(function(){if("skip"==h)i.execCommand("goCharRight");else if("skipThree"==h)for(var e=0;3>e;e++)i.execCommand("goCharRight");else if("surround"==h){for(var t=i.getSelections(),e=0;e<t.length;e++)t[e]=x+t[e]+w;i.replaceSelections(t,"around")}else"both"==h?(i.replaceSelection(x+w,null),i.triggerElectric(x+w),i.execCommand("goCharLeft")):"addFour"==h&&(i.replaceSelection(x+x+x+x,"before"),i.execCommand("goCharRight"))})}function a(e,t){var i=t.lastIndexOf(e);return i>-1&&i%2==1}function l(e,t){var i=e.getRange(u(t.line,t.ch-1),u(t.line,t.ch+1));return 2==i.length?i:null}function c(t,i,n){var r=t.getLine(i.line),s=t.getTokenAt(i);if(/\bstring2?\b/.test(s.type))return!1;var o=new e.StringStream(r.slice(0,i.ch)+n+r.slice(i.ch),4);for(o.pos=o.start=s.start;;){var a=t.getMode().token(o,s.state);if(o.pos>=i.ch+1)return/\bstring2?\b/.test(a);o.start=o.pos}}var h={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},u=e.Pos;
e.defineOption("autoCloseBrackets",!1,function(t,i,n){n&&n!=e.Init&&(t.removeKeyMap(p),t.state.closeBrackets=null),i&&(t.state.closeBrackets=i,t.addKeyMap(p))});for(var d=h.pairs+"`",p={Backspace:r,Enter:s},f=0;f<d.length;f++)p["'"+d.charAt(f)+"'"]=i(d.charAt(f))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/comment/comment",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(n);return-1==t?0:t}var i={},n=/[^\s\u00a0]/,r=e.Pos;e.commands.toggleComment=function(e){for(var t=1/0,i=e.listSelections(),n=null,s=i.length-1;s>=0;s--){var o=i[s].from(),a=i[s].to();o.line>=t||(a.line>=t&&(a=r(t,0)),t=o.line,null==n?e.uncomment(o,a)?n="un":(e.lineComment(o,a),n="line"):"un"==n?e.uncomment(o,a):e.lineComment(o,a))}},e.defineExtension("lineComment",function(e,s,o){o||(o=i);var a=this,l=a.getModeAt(e),c=o.lineComment||l.lineComment;if(!c)return void((o.blockCommentStart||l.blockCommentStart)&&(o.fullLines=!0,a.blockComment(e,s,o)));var h=a.getLine(e.line);if(null!=h){var u=Math.min(0!=s.ch||s.line==e.line?s.line+1:s.line,a.lastLine()+1),d=null==o.padding?" ":o.padding,p=o.commentBlankLines||e.line==s.line;a.operation(function(){if(o.indent)for(var i=h.slice(0,t(h)),s=e.line;u>s;++s){var l=a.getLine(s),f=i.length;(p||n.test(l))&&(l.slice(0,f)!=i&&(f=t(l)),a.replaceRange(i+c+d,r(s,0),r(s,f)))}else for(var s=e.line;u>s;++s)(p||n.test(a.getLine(s)))&&a.replaceRange(c+d,r(s,0))})}}),e.defineExtension("blockComment",function(e,t,s){s||(s=i);var o=this,a=o.getModeAt(e),l=s.blockCommentStart||a.blockCommentStart,c=s.blockCommentEnd||a.blockCommentEnd;if(!l||!c)return void((s.lineComment||a.lineComment)&&0!=s.fullLines&&o.lineComment(e,t,s));var h=Math.min(t.line,o.lastLine());h!=e.line&&0==t.ch&&n.test(o.getLine(h))&&--h;var u=null==s.padding?" ":s.padding;e.line>h||o.operation(function(){if(0!=s.fullLines){var i=n.test(o.getLine(h));o.replaceRange(u+c,r(h)),o.replaceRange(l+u,r(e.line,0));var d=s.blockCommentLead||a.blockCommentLead;if(null!=d)for(var p=e.line+1;h>=p;++p)(p!=h||i)&&o.replaceRange(d+u,r(p,0))}else o.replaceRange(c,t),o.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,s){s||(s=i);var o,a=this,l=a.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,a.lastLine()),h=Math.min(e.line,c),u=s.lineComment||l.lineComment,d=[],p=null==s.padding?" ":s.padding;e:if(u){for(var f=h;c>=f;++f){var m=a.getLine(f),g=m.indexOf(u);if(g>-1&&!/comment/.test(a.getTokenTypeAt(r(f,g+1)))&&(g=-1),-1==g&&(f!=c||f==h)&&n.test(m))break e;if(g>-1&&n.test(m.slice(0,g)))break e;d.push(m)}if(a.operation(function(){for(var e=h;c>=e;++e){var t=d[e-h],i=t.indexOf(u),n=i+u.length;0>i||(t.slice(n,n+p.length)==p&&(n+=p.length),o=!0,a.replaceRange("",r(e,i),r(e,n)))}}),o)return!0}var _=s.blockCommentStart||l.blockCommentStart,v=s.blockCommentEnd||l.blockCommentEnd;if(!_||!v)return!1;var b=s.blockCommentLead||l.blockCommentLead,y=a.getLine(h),x=c==h?y:a.getLine(c),w=y.indexOf(_),k=x.lastIndexOf(v);if(-1==k&&h!=c&&(x=a.getLine(--c),k=x.lastIndexOf(v)),-1==w||-1==k||!/comment/.test(a.getTokenTypeAt(r(h,w+1)))||!/comment/.test(a.getTokenTypeAt(r(c,k+1))))return!1;var C=y.lastIndexOf(_,e.ch),T=-1==C?-1:y.slice(0,e.ch).indexOf(v,C+_.length);if(-1!=C&&-1!=T&&T+v.length!=e.ch)return!1;T=x.indexOf(v,t.ch);var S=x.slice(t.ch).lastIndexOf(_,T-t.ch);return C=-1==T||-1==S?-1:t.ch+S,-1!=T&&-1!=C&&C!=t.ch?!1:(a.operation(function(){a.replaceRange("",r(c,k-(p&&x.slice(k-p.length,k)==p?p.length:0)),r(c,k+v.length));var e=w+_.length;if(p&&y.slice(e,e+p.length)==p&&(e+=p.length),a.replaceRange("",r(h,w),r(h,e)),b)for(var t=h+1;c>=t;++t){var i=a.getLine(t),s=i.indexOf(b);if(-1!=s&&!n.test(i.slice(0,s))){var o=s+b.length;p&&i.slice(o,o+p.length)==p&&(o+=p.length),a.replaceRange("",r(t,s),r(t,o))}}}),!0)})}),define("notebook/js/cell",["jquery","base/js/utils","codemirror/lib/codemirror","codemirror/addon/edit/matchbrackets","codemirror/addon/edit/closebrackets","codemirror/addon/comment/comment"],function(e,t,i,n,r,s){"use strict";var o=i.scrollbarModel["native"].prototype.overlayHack;i.scrollbarModel["native"].prototype.overlayHack=function(){o.apply(this,arguments),/Mac/.test(navigator.platform)&&(this.horiz.style.minHeight="")};var a=function(e){e=e||{},this.keyboard_manager=e.keyboard_manager,this.events=e.events;var i=t.mergeopt(a,e.config);this.placeholder=i.placeholder||"",this.selected=!1,this.in_selection=!1,this.selection_anchor=!1,this.rendered=!1,this.mode="command";var n=this;this._metadata={},Object.defineProperty(this,"metadata",{get:function(){return n._metadata},set:function(e){n._metadata=e,n.celltoolbar&&n.celltoolbar.rebuild()}}),Object.defineProperty(this,"cm_config",{get:function(){return console.warn("Warning: accessing Cell.cm_config directly is deprecate."),n._options.cm_config}}),this.user_highlight="auto";var r={};this.class_config&&(r=this.class_config.get_sync("cm_config")),i.cm_config=t.mergeopt({},i.cm_config,r),this.cell_id=t.uuid(),this._options=i,this.element=null,this.cell_type=this.cell_type||null,this.code_mirror=null,this.create_element(),null!==this.element&&(this.element.data("cell",this),this.bind_events(),this.init_classes())};a.options_default={cm_config:{indentUnit:4,readOnly:!1,theme:"default",extraKeys:{"Cmd-Right":"goLineRight",End:"goLineRight","Cmd-Left":"goLineLeft"}}},"Safari"==t.browser[0]&&(a.options_default.cm_config.dragDrop=!1),a.prototype.create_element=function(){},a.prototype.init_classes=function(){this.in_selection?this.element.addClass("selected"):this.element.addClass("unselected"),this.rendered?this.element.addClass("rendered"):this.element.addClass("unrendered")},a.prototype.bind_events=function(){var e=this;e.element.click(function(t){e.selected||e.events.trigger("select.Cell",{cell:e})}),e.element.focusin(function(t){e.selected||e.events.trigger("select.Cell",{cell:e})}),this.code_mirror&&this.code_mirror.on("change",function(t,i){e.events.trigger("set_dirty.Notebook",{value:!0})}),this.code_mirror&&this.code_mirror.on("focus",function(t,i){e.events.trigger("edit_mode.Cell",{cell:e})}),this.code_mirror&&this.code_mirror.on("blur",function(t,i){e.events.trigger("command_mode.Cell",{cell:e})}),this.element.dblclick(function(){e.selected===!1&&this.events.trigger("select.Cell",{cell:e});var t=e.unrender();t&&e.focus_editor()})},a.prototype.handle_codemirror_keyevent=function(e,t){var i=this.keyboard_manager.edit_shortcuts,n=e.getCursor();0===n.line&&0===n.ch||38!==t.keyCode||(t._ipkmIgnore=!0);var r=e.lastLine();return 40!==t.keyCode||n.line===r&&n.ch===e.getLineHandle(r).text.length||(t._ipkmIgnore=!0),i.handles(t)?!0:!1},a.prototype.typeset=function(){t.typeset(this.element)},a.prototype.select=function(){return this.selected?!1:(this.element.addClass("selected"),this.element.removeClass("unselected"),this.selected=!0,this.in_selection=!0,!0)},a.prototype.unselect=function(e){var t=this.selected;return this.selected=!1,!e&&this.in_selection&&(this.in_selection=!1,this.selection_anchor=!1,this.element.addClass("unselected"),this.element.removeClass("selected")),t},a.prototype.execute=function(){},a.prototype.render=function(){return this.rendered?!1:(this.element.addClass("rendered"),this.element.removeClass("unrendered"),this.rendered=!0,!0)},a.prototype.unrender=function(){return this.rendered?(this.element.addClass("unrendered"),this.element.removeClass("rendered"),this.rendered=!1,!0):!1},a.prototype.handle_keyevent=function(e,t){return"command"===this.mode?!0:"edit"===this.mode?this.handle_codemirror_keyevent(e,t):void 0},a.prototype.at_top=function(){var e=this.code_mirror,t=e.getCursor();return 0===t.line&&0===t.ch?!0:!1},a.prototype.at_bottom=function(){var e=this.code_mirror,t=e.getCursor();return t.line===e.lineCount()-1&&t.ch===e.getLine(t.line).length?!0:!1},a.prototype.command_mode=function(){return"command"!==this.mode?(this.mode="command",!0):!1},a.prototype.edit_mode=function(){return"edit"!==this.mode?(this.mode="edit",!0):!1},a.prototype.ensure_focused=function(){this.element===document.activeElement||this.code_mirror.hasFocus()||this.focus_cell()},a.prototype.focus_cell=function(){this.element.focus()},a.prototype.focus_editor=function(){this.refresh(),this.code_mirror.focus()},a.prototype.refresh=function(){this.code_mirror&&this.code_mirror.refresh()},a.prototype.get_text=function(){},a.prototype.set_text=function(e){},a.prototype.toJSON=function(){var e={};return e.metadata=JSON.parse(JSON.stringify(this.metadata)),e.cell_type=this.cell_type,e},a.prototype.fromJSON=function(e){void 0!==e.metadata&&(this.metadata=e.metadata)},a.prototype.is_splittable=function(){return this.is_deletable()},a.prototype.is_mergeable=function(){return this.is_deletable()},a.prototype.is_deletable=function(){return this.metadata.deletable===!1?!1:!0},a.prototype.get_pre_cursor=function(){var e=this.code_mirror.getCursor(),t=this.code_mirror.getRange({line:0,ch:0},e);return t=t.replace(/^\n+/,"").replace(/\n+$/,"")},a.prototype.get_post_cursor=function(){var e=this.code_mirror.getCursor(),t=this.code_mirror.lineCount()-1,i=this.code_mirror.getLine(t).length,n={line:t,ch:i},r=this.code_mirror.getRange(e,n);return r=r.replace(/^\n+/,"").replace(/\n+$/,"")},a.prototype.show_line_numbers=function(e){this.code_mirror.setOption("lineNumbers",e),this.code_mirror.refresh()},a.prototype.toggle_line_numbers=function(){var e=this.code_mirror.getOption("lineNumbers");this.show_line_numbers(!e)},a.prototype.force_highlight=function(e){this.user_highlight=e,this.auto_highlight()},a.prototype.auto_highlight=function(){this._auto_highlight(this.class_config.get_sync("highlight_modes"))},a.prototype._auto_highlight=function(e){var n,r=this;if(void 0!==this.user_highlight&&"auto"!=this.user_highlight)return n=this.user_highlight,i.autoLoadMode(this.code_mirror,n),void this.code_mirror.setOption("mode",n);var s=this.code_mirror.getOption("mode",n),o=this.code_mirror.getLine(0);for(n in e)for(var a=e[n].reg,l=0;l<a.length;l++){var c=a[l];if("string"==typeof c&&(c=new RegExp(c)),null!==o.match(c)){if(s==n)return;if(0!==n.search("magic_"))return void t.requireCodeMirrorMode(n,function(e){r.code_mirror.setOption("mode",e)});var h=e[n].open||"%%",u=e[n].close||"%%end",d=n;if(n=d.substr(6),s==d)return;return void t.requireCodeMirrorMode(n,function(e){i.defineMode(d,function(t){return i.multiplexingMode(i.getMode(t,"text/plain"),{open:h,close:u,mode:i.getMode(t,e),delimStyle:"delimit"})}),r.code_mirror.setOption("mode",d)})}}var p;try{p=this._options.cm_config.mode}catch(f){p="text/plain"}s!==p&&this.code_mirror.setOption("mode",p)};var l=function(e){a.apply(this,arguments),this.cell_type="unrecognized",this.celltoolbar=null,this.data={},Object.seal(this)};return l.prototype=Object.create(a.prototype),l.prototype.is_mergeable=function(){return!1},l.prototype.is_splittable=function(){return!1},l.prototype.toJSON=function(){return JSON.parse(JSON.stringify(this.data))},l.prototype.fromJSON=function(e){this.data=e,void 0!==e.metadata?this.metadata=e.metadata:e.metadata=this.metadata,this.element.find(".inner_cell").find("a").text("Unrecognized cell type: "+e.cell_type)},l.prototype.create_element=function(){a.prototype.create_element.apply(this,arguments);var t=this.element=e("<div>").addClass("cell unrecognized_cell");t.attr("tabindex","2");var i=e("<div/>").addClass("prompt input_prompt");t.append(i);var n=e("<div/>").addClass("inner_cell");n.append(e("<a>").attr("href","#").text("Unrecognized cell type")),t.append(n),this.element=t},l.prototype.bind_events=function(){a.prototype.bind_events.apply(this,arguments);var e=this;this.element.find(".inner_cell").find("a").click(function(){e.events.trigger("unrecognized_cell.Cell",{cell:e})})},{Cell:a,UnrecognizedCell:l}});var CSS_PROP_BIT_QUANTITY=1,CSS_PROP_BIT_HASH_VALUE=2,CSS_PROP_BIT_NEGATIVE_QUANTITY=4,CSS_PROP_BIT_QSTRING=8,CSS_PROP_BIT_URL=16,CSS_PROP_BIT_UNRESERVED_WORD=64,CSS_PROP_BIT_UNICODE_RANGE=128,CSS_PROP_BIT_GLOBAL_NAME=512,CSS_PROP_BIT_PROPERTY_NAME=1024,cssSchema=function(){var e=[["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],["all-scroll","col-resize","crosshair","default","e-resize","hand","help","move","n-resize","ne-resize","no-drop","not-allowed","nw-resize","pointer","progress","row-resize","s-resize","se-resize","sw-resize","text","vertical-text","w-resize","wait"],["armenian","decimal","decimal-leading-zero","disc","georgian","lower-alpha","lower-greek","lower-latin","lower-roman","square","upper-alpha","upper-latin","upper-roman"],["100","200","300","400","500","600","700","800","900","bold","bolder","lighter"],["block-level","inline-level","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group"],["condensed","expanded","extra-condensed","extra-expanded","narrower","semi-condensed","semi-expanded","ultra-condensed","ultra-expanded","wider"],["inherit","inline","inline-block","inline-box","inline-flex","inline-grid","inline-list-item","inline-stack","inline-table","run-in"],["behind","center-left","center-right","far-left","far-right","left-side","leftwards","right-side","rightwards"],["large","larger","small","smaller","x-large","x-small","xx-large","xx-small"],["dashed","dotted","double","groove","outset","ridge","solid"],["ease","ease-in","ease-in-out","ease-out","linear","step-end","step-start"],["at","closest-corner","closest-side","ellipse","farthest-corner","farthest-side"],["baseline","middle","sub","super","text-bottom","text-top"],["caption","icon","menu","message-box","small-caption","status-bar"],["fast","faster","slow","slower","x-fast","x-slow"],["above","below","higher","level","lower"],["cursive","fantasy","monospace","sans-serif","serif"],["loud","silent","soft","x-loud","x-soft"],["no-repeat","repeat-x","repeat-y","round","space"],["blink","line-through","overline","underline"],["block","flex","grid","table"],["high","low","x-high","x-low"],["nowrap","pre","pre-line","pre-wrap"],["absolute","relative","static"],["alternate","alternate-reverse","reverse"],["border-box","content-box","padding-box"],["capitalize","lowercase","uppercase"],["child","female","male"],["=","opacity"],["backwards","forwards"],["bidi-override","embed"],["bottom","top"],["break-all","keep-all"],["clip","ellipsis"],["contain","cover"],["continuous","digits"],["end","start"],["flat","preserve-3d"],["hide","show"],["horizontal","vertical"],["inside","outside"],["italic","oblique"],["left","right"],["ltr","rtl"],["no-content","no-display"],["paused","running"],["suppress","unrestricted"],["thick","thin"],[","],["/"],["all"],["always"],["auto"],["avoid"],["both"],["break-word"],["center"],["circle"],["code"],["collapse"],["contents"],["fixed"],["hidden"],["infinite"],["inset"],["invert"],["justify"],["list-item"],["local"],["medium"],["mix"],["none"],["normal"],["once"],["repeat"],["scroll"],["separate"],["small-caps"],["spell-out"],["to"],["visible"]],t={animation:{cssPropBits:517,cssLitGroup:[e[10],e[24],e[29],e[45],e[48],e[54],e[63],e[71],e[72]],cssFns:["cubic-bezier()","steps()"]},"animation-delay":{cssPropBits:5,cssLitGroup:[e[48]],cssFns:[]},"animation-direction":{cssPropBits:0,cssLitGroup:[e[24],e[48],e[72]],cssFns:[]},"animation-duration":"animation-delay","animation-fill-mode":{cssPropBits:0,cssLitGroup:[e[29],e[48],e[54],e[71]],cssFns:[]},"animation-iteration-count":{cssPropBits:5,cssLitGroup:[e[48],e[63]],cssFns:[]},"animation-name":{cssPropBits:512,cssLitGroup:[e[48],e[71]],cssFns:[]},"animation-play-state":{cssPropBits:0,cssLitGroup:[e[45],e[48]],cssFns:[]},"animation-timing-function":{cssPropBits:0,cssLitGroup:[e[10],e[48]],cssFns:["cubic-bezier()","steps()"]},appearance:{cssPropBits:0,cssLitGroup:[e[71]],cssFns:[]},azimuth:{cssPropBits:5,cssLitGroup:[e[7],e[42],e[56]],cssFns:[]},"backface-visibility":{cssPropBits:0,cssLitGroup:[e[59],e[62],e[80]],cssFns:[]},background:{cssPropBits:23,cssLitGroup:[e[0],e[18],e[25],e[31],e[34],e[42],e[48],e[49],e[52],e[56],e[61],e[68],e[71],e[74],e[75]],cssFns:["image()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","rgb()","rgba()"]},"background-attachment":{cssPropBits:0,cssLitGroup:[e[48],e[61],e[68],e[75]],cssFns:[]},"background-color":{cssPropBits:2,cssLitGroup:[e[0]],cssFns:["rgb()","rgba()"]},"background-image":{cssPropBits:16,cssLitGroup:[e[48],e[71]],cssFns:["image()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()"]},"background-position":{cssPropBits:5,cssLitGroup:[e[31],e[42],e[48],e[56]],cssFns:[]},"background-repeat":{cssPropBits:0,cssLitGroup:[e[18],e[48],e[74]],cssFns:[]},"background-size":{cssPropBits:5,cssLitGroup:[e[34],e[48],e[52]],cssFns:[]},border:{cssPropBits:7,cssLitGroup:[e[0],e[9],e[47],e[62],e[64],e[69],e[71]],cssFns:["rgb()","rgba()"]},"border-bottom":"border","border-bottom-color":"background-color","border-bottom-left-radius":{cssPropBits:5,cssFns:[]},"border-bottom-right-radius":"border-bottom-left-radius","border-bottom-style":{cssPropBits:0,cssLitGroup:[e[9],e[62],e[64],e[71]],cssFns:[]},"border-bottom-width":{cssPropBits:5,cssLitGroup:[e[47],e[69]],cssFns:[]},"border-collapse":{cssPropBits:0,cssLitGroup:[e[59],e[76]],cssFns:[]},"border-color":"background-color","border-left":"border","border-left-color":"background-color","border-left-style":"border-bottom-style","border-left-width":"border-bottom-width","border-radius":{cssPropBits:5,cssLitGroup:[e[49]],cssFns:[]},"border-right":"border","border-right-color":"background-color","border-right-style":"border-bottom-style","border-right-width":"border-bottom-width","border-spacing":"border-bottom-left-radius","border-style":"border-bottom-style","border-top":"border","border-top-color":"background-color","border-top-left-radius":"border-bottom-left-radius","border-top-right-radius":"border-bottom-left-radius","border-top-style":"border-bottom-style","border-top-width":"border-bottom-width","border-width":"border-bottom-width",bottom:{cssPropBits:5,cssLitGroup:[e[52]],cssFns:[]},box:{cssPropBits:0,cssLitGroup:[e[60],e[71],e[72]],cssFns:[]},"box-shadow":{cssPropBits:7,cssLitGroup:[e[0],e[48],e[64],e[71]],cssFns:["rgb()","rgba()"]},"box-sizing":{cssPropBits:0,cssLitGroup:[e[25]],cssFns:[]},"caption-side":{cssPropBits:0,cssLitGroup:[e[31]],cssFns:[]},clear:{cssPropBits:0,cssLitGroup:[e[42],e[54],e[71]],cssFns:[]},clip:{cssPropBits:0,cssLitGroup:[e[52]],cssFns:["rect()"]},color:"background-color",content:{cssPropBits:8,cssLitGroup:[e[71],e[72]],cssFns:[]},cue:{cssPropBits:16,cssLitGroup:[e[71]],cssFns:[]},"cue-after":"cue","cue-before":"cue",cursor:{cssPropBits:16,cssLitGroup:[e[1],e[48],e[52]],cssFns:[]},direction:{cssPropBits:0,cssLitGroup:[e[43]],cssFns:[]},display:{cssPropBits:0,cssLitGroup:[e[4],e[6],e[20],e[52],e[67],e[71]],cssFns:[]},"display-extras":{cssPropBits:0,cssLitGroup:[e[67],e[71]],cssFns:[]},"display-inside":{cssPropBits:0,cssLitGroup:[e[20],e[52]],cssFns:[]},"display-outside":{cssPropBits:0,cssLitGroup:[e[4],e[71]],cssFns:[]},elevation:{cssPropBits:5,cssLitGroup:[e[15]],cssFns:[]},"empty-cells":{cssPropBits:0,cssLitGroup:[e[38]],cssFns:[]},filter:{cssPropBits:0,cssFns:["alpha()"]},"float":{cssPropBits:0,cssLitGroup:[e[42],e[71]],cssFns:[]},font:{cssPropBits:73,cssLitGroup:[e[3],e[8],e[13],e[16],e[41],e[48],e[49],e[69],e[72],e[77]],cssFns:[]},"font-family":{cssPropBits:72,cssLitGroup:[e[16],e[48]],cssFns:[]},"font-size":{cssPropBits:1,cssLitGroup:[e[8],e[69]],cssFns:[]},"font-stretch":{cssPropBits:0,cssLitGroup:[e[5],e[72]],cssFns:[]},"font-style":{cssPropBits:0,cssLitGroup:[e[41],e[72]],cssFns:[]},"font-variant":{cssPropBits:0,cssLitGroup:[e[72],e[77]],cssFns:[]},"font-weight":{cssPropBits:0,cssLitGroup:[e[3],e[72]],cssFns:[]},height:"bottom",left:"bottom","letter-spacing":{cssPropBits:5,cssLitGroup:[e[72]],cssFns:[]},"line-height":{cssPropBits:1,cssLitGroup:[e[72]],cssFns:[]},"list-style":{cssPropBits:16,cssLitGroup:[e[2],e[40],e[57],e[71]],cssFns:["image()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()"]},"list-style-image":{cssPropBits:16,cssLitGroup:[e[71]],cssFns:["image()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()"]},"list-style-position":{cssPropBits:0,cssLitGroup:[e[40]],cssFns:[]},"list-style-type":{cssPropBits:0,cssLitGroup:[e[2],e[57],e[71]],cssFns:[]},margin:"bottom","margin-bottom":"bottom","margin-left":"bottom","margin-right":"bottom","margin-top":"bottom","max-height":{cssPropBits:1,cssLitGroup:[e[52],e[71]],cssFns:[]},"max-width":"max-height","min-height":{cssPropBits:1,cssLitGroup:[e[52]],cssFns:[]},"min-width":"min-height",opacity:{cssPropBits:1,cssFns:[]},outline:{cssPropBits:7,cssLitGroup:[e[0],e[9],e[47],e[62],e[64],e[65],e[69],e[71]],cssFns:["rgb()","rgba()"]},"outline-color":{cssPropBits:2,cssLitGroup:[e[0],e[65]],cssFns:["rgb()","rgba()"]},"outline-style":"border-bottom-style","outline-width":"border-bottom-width",overflow:{cssPropBits:0,cssLitGroup:[e[52],e[62],e[75],e[80]],cssFns:[]},"overflow-wrap":{cssPropBits:0,cssLitGroup:[e[55],e[72]],cssFns:[]},"overflow-x":{cssPropBits:0,cssLitGroup:[e[44],e[52],e[62],e[75],e[80]],cssFns:[]},"overflow-y":"overflow-x",padding:"opacity","padding-bottom":"opacity","padding-left":"opacity","padding-right":"opacity","padding-top":"opacity","page-break-after":{cssPropBits:0,cssLitGroup:[e[42],e[51],e[52],e[53]],cssFns:[]},"page-break-before":"page-break-after","page-break-inside":{cssPropBits:0,cssLitGroup:[e[52],e[53]],cssFns:[]},pause:"border-bottom-left-radius","pause-after":"border-bottom-left-radius","pause-before":"border-bottom-left-radius",perspective:{cssPropBits:5,cssLitGroup:[e[71]],cssFns:[]},"perspective-origin":{cssPropBits:5,cssLitGroup:[e[31],e[42],e[56]],cssFns:[]},pitch:{cssPropBits:5,cssLitGroup:[e[21],e[69]],cssFns:[]},"pitch-range":"border-bottom-left-radius","play-during":{cssPropBits:16,cssLitGroup:[e[52],e[70],e[71],e[74]],cssFns:[]},position:{cssPropBits:0,cssLitGroup:[e[23]],cssFns:[]},quotes:{cssPropBits:8,cssLitGroup:[e[71]],cssFns:[]},resize:{cssPropBits:0,cssLitGroup:[e[39],e[54],e[71]],cssFns:[]},richness:"border-bottom-left-radius",right:"bottom",speak:{cssPropBits:0,cssLitGroup:[e[71],e[72],e[78]],cssFns:[]},"speak-header":{cssPropBits:0,cssLitGroup:[e[51],e[73]],cssFns:[]},"speak-numeral":{cssPropBits:0,cssLitGroup:[e[35]],cssFns:[]},"speak-punctuation":{cssPropBits:0,cssLitGroup:[e[58],e[71]],cssFns:[]},"speech-rate":{cssPropBits:5,cssLitGroup:[e[14],e[69]],cssFns:[]},stress:"border-bottom-left-radius","table-layout":{cssPropBits:0,cssLitGroup:[e[52],e[61]],cssFns:[]},"text-align":{cssPropBits:0,cssLitGroup:[e[42],e[56],e[66]],cssFns:[]},"text-decoration":{cssPropBits:0,cssLitGroup:[e[19],e[71]],cssFns:[]},"text-indent":"border-bottom-left-radius","text-overflow":{cssPropBits:8,cssLitGroup:[e[33]],cssFns:[]},"text-shadow":"box-shadow","text-transform":{cssPropBits:0,cssLitGroup:[e[26],e[71]],cssFns:[]},"text-wrap":{cssPropBits:0,cssLitGroup:[e[46],e[71],e[72]],cssFns:[]},top:"bottom",transform:{cssPropBits:0,cssLitGroup:[e[71]],cssFns:["matrix()","perspective()","rotate()","rotate3d()","rotatex()","rotatey()","rotatez()","scale()","scale3d()","scalex()","scaley()","scalez()","skew()","skewx()","skewy()","translate()","translate3d()","translatex()","translatey()","translatez()"]},"transform-origin":"perspective-origin","transform-style":{cssPropBits:0,cssLitGroup:[e[37]],cssFns:[]},transition:{cssPropBits:1029,cssLitGroup:[e[10],e[48],e[50],e[71]],cssFns:["cubic-bezier()","steps()"]},"transition-delay":"animation-delay","transition-duration":"animation-delay","transition-property":{cssPropBits:1024,cssLitGroup:[e[48],e[50]],cssFns:[]},"transition-timing-function":"animation-timing-function","unicode-bidi":{cssPropBits:0,cssLitGroup:[e[30],e[72]],cssFns:[]},"vertical-align":{cssPropBits:5,cssLitGroup:[e[12],e[31]],cssFns:[]},visibility:"backface-visibility","voice-family":{cssPropBits:8,cssLitGroup:[e[27],e[48]],cssFns:[]},volume:{cssPropBits:1,cssLitGroup:[e[17],e[69]],cssFns:[]},"white-space":{cssPropBits:0,cssLitGroup:[e[22],e[72]],cssFns:[]},width:"min-height","word-break":{cssPropBits:0,cssLitGroup:[e[32],e[72]],cssFns:[]},"word-spacing":"letter-spacing","word-wrap":"overflow-wrap","z-index":"bottom",zoom:"line-height","cubic-bezier()":"animation-delay","steps()":{cssPropBits:5,cssLitGroup:[e[36],e[48]],cssFns:[]},"image()":{cssPropBits:18,cssLitGroup:[e[0],e[48]],cssFns:["rgb()","rgba()"]},"linear-gradient()":{cssPropBits:7,cssLitGroup:[e[0],e[31],e[42],e[48],e[79]],cssFns:["rgb()","rgba()"]},"radial-gradient()":{cssPropBits:7,cssLitGroup:[e[0],e[11],e[31],e[42],e[48],e[56],e[57]],cssFns:["rgb()","rgba()"]},"repeating-linear-gradient()":"linear-gradient()","repeating-radial-gradient()":"radial-gradient()","rgb()":{cssPropBits:1,cssLitGroup:[e[48]],cssFns:[]},"rgba()":"rgb()","rect()":{cssPropBits:5,cssLitGroup:[e[48],e[52]],cssFns:[]},"alpha()":{cssPropBits:1,cssLitGroup:[e[28]],cssFns:[]},"matrix()":"animation-delay","perspective()":"border-bottom-left-radius","rotate()":"border-bottom-left-radius","rotate3d()":"animation-delay","rotatex()":"border-bottom-left-radius","rotatey()":"border-bottom-left-radius","rotatez()":"border-bottom-left-radius","scale()":"animation-delay","scale3d()":"animation-delay","scalex()":"border-bottom-left-radius","scaley()":"border-bottom-left-radius","scalez()":"border-bottom-left-radius","skew()":"animation-delay","skewx()":"border-bottom-left-radius","skewy()":"border-bottom-left-radius","translate()":"animation-delay","translate3d()":"animation-delay","translatex()":"border-bottom-left-radius","translatey()":"border-bottom-left-radius","translatez()":"border-bottom-left-radius"};for(var i in t)"string"==typeof t[i]&&Object.hasOwnProperty.call(t,i)&&(t[i]=t[t[i]]);return t}();"undefined"!=typeof window&&(window.cssSchema=cssSchema);var lexCss,decodeCss;!function(){function e(e){var t=parseInt(e.substring(1),16);return t>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):t==t?String.fromCharCode(t):e[1]<" "?"":e[1]}function t(e,t){return'"'+e.replace(/[\u0000-\u001f\\\"<>]/g,t)+'"'}function i(e){return r[e]||(r[e]="\\"+e.charCodeAt(0).toString(16)+" ")}function n(e){return s[e]||(s[e]=("">e?"%0":"%")+e.charCodeAt(0).toString(16))}var r={"\\":"\\\\"},s={"\\":"%5c"},o="[\\t\\n\\f ]",a=o+"*",l="[\\n\\f]",c="[\\ud800-\\udbff][\\udc00-\\udfff]",h="[\\u0080-\\ud7ff\\ue000-\\ufffd]|"+c,u="[0-9a-fA-F]{1,6}"+o+"?",d="(?:"+u+"|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|"+c+")",p="\\\\"+d,f="(?:[\\t\\x21\\x23-\\x26\\x28-\\x5b\\x5d-\\x7e]|"+h+"|"+p+")",m="[^'\"\\n\\f\\\\]|\\\\[\\s\\S]",g="\"(?:'|"+m+')*"|\'(?:"|'+m+")*'",_="[-+]?(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)",v="(?:[a-zA-Z_]|"+h+"|"+p+")",b="(?:[a-zA-Z0-9_-]|"+h+"|"+p+")",y="-?"+v+b+"*",x="(?:@?-?"+v+"|#)"+b+"*",w=_+"(?:%|"+y+")?",k="url[(]"+a+"(?:"+g+"|"+f+"*)"+a+"[)]",C="U[+][0-9A-F?]{1,6}(?:-[0-9A-F]{1,6})?",T="<!--",S="-->",M=o+"+",D="/(?:[*][^*]*[*]+(?:[^/][^*]*[*]+)*/|/[^\\n\\f]*)",E="(?!url[(])"+y+"[(]",L="[~|^$*]=",P="[^\"'\\\\/]|/(?![/*])",A="\\uFEFF",I=new RegExp([A,C,k,E,x,g,w,T,S,M,D,L,P].join("|"),"gi"),O=new RegExp("\\\\(?:"+d+"|"+l+")","g"),j=new RegExp("^url\\("+a+"[\"']?|[\"']?"+a+"\\)$","gi");decodeCss=function(t){return t.replace(O,e)},lexCss=function(e){e=""+e;for(var r=e.replace(/\r\n?/g,"\n").match(I)||[],s=0,o=" ",a=0,l=r.length;l>a;++a){var c=decodeCss(r[a]),h=c.length,u=c.charCodeAt(0);c=u=='"'.charCodeAt(0)||u=="'".charCodeAt(0)?t(c.substring(1,h-1),i):u=="/".charCodeAt(0)&&h>1||"\\"==c||c==S||c==T||"\ufeff"==c||u<=" ".charCodeAt(0)?" ":/url\(/i.test(c)?"url("+t(c.replace(j,""),n)+")":c,(o!=c||" "!=c)&&(r[s++]=o=c)}return r.length=s,r}}(),"undefined"!=typeof window&&(window.lexCss=lexCss,window.decodeCss=decodeCss);var URI=function(){function e(e){var t=(""+e).match(p);return t?new l(c(t[1]),c(t[2]),c(t[3]),c(t[4]),c(t[5]),c(t[6]),c(t[7])):null}function t(e,t,s,o,a,c,h){var u=new l(n(e,f),n(t,f),i(s),o>0?o.toString():null,n(a,m),null,i(h));return c&&("string"==typeof c?u.setRawQuery(c.replace(/[^?&=0-9A-Za-z_\-~.%]/g,r)):u.setAllParameters(c)),u}function i(e){return"string"==typeof e?encodeURIComponent(e):null}function n(e,t){return"string"==typeof e?encodeURI(e).replace(t,r):null}function r(e){var t=e.charCodeAt(0);return"%"+"0123456789ABCDEF".charAt(t>>4&15)+"0123456789ABCDEF".charAt(15&t)}function s(e){return e.replace(/(^|\/)\.(?:\/|$)/g,"$1").replace(/\/{2,}/g,"/")}function o(e){if(null===e)return null;for(var t,i=s(e),n=u;(t=i.replace(n,"$1"))!=i;i=t);return i}function a(e,t){var i=e.clone(),n=t.hasScheme();n?i.setRawScheme(t.getRawScheme()):n=t.hasCredentials(),n?i.setRawCredentials(t.getRawCredentials()):n=t.hasDomain(),n?i.setRawDomain(t.getRawDomain()):n=t.hasPort();var r=t.getRawPath(),s=o(r);if(n)i.setPort(t.getPort()),s=s&&s.replace(d,"");else if(n=!!r){if(47!==s.charCodeAt(0)){var a=o(i.getRawPath()||"").replace(d,""),l=a.lastIndexOf("/")+1;s=o((l?a.substring(0,l):"")+o(r)).replace(d,"")}}else s=s&&s.replace(d,""),s!==r&&i.setRawPath(s);return n?i.setRawPath(s):n=t.hasQuery(),n?i.setRawQuery(t.getRawQuery()):n=t.hasFragment(),n&&i.setRawFragment(t.getRawFragment()),i}function l(e,t,i,n,r,s,o){this.scheme_=e,this.credentials_=t,this.domain_=i,this.port_=n,this.path_=r,this.query_=s,this.fragment_=o,this.paramCache_=null}function c(e){return"string"==typeof e&&e.length>0?e:null}var h=new RegExp("(/|^)(?:[^./][^/]*|\\.{2,}(?:[^./][^/]*)|\\.{3,}[^/]*)/\\.\\.(?:/|$)"),u=new RegExp(h),d=/^(?:\.\.\/)*(?:\.\.$)?/;l.prototype.toString=function(){var e=[];return null!==this.scheme_&&e.push(this.scheme_,":"),null!==this.domain_&&(e.push("//"),null!==this.credentials_&&e.push(this.credentials_,"@"),e.push(this.domain_),null!==this.port_&&e.push(":",this.port_.toString())),null!==this.path_&&e.push(this.path_),null!==this.query_&&e.push("?",this.query_),null!==this.fragment_&&e.push("#",this.fragment_),e.join("")},l.prototype.clone=function(){return new l(this.scheme_,this.credentials_,this.domain_,this.port_,this.path_,this.query_,this.fragment_)},l.prototype.getScheme=function(){return this.scheme_&&decodeURIComponent(this.scheme_).toLowerCase()},l.prototype.getRawScheme=function(){return this.scheme_},l.prototype.setScheme=function(e){
return this.scheme_=n(e,f),this},l.prototype.setRawScheme=function(e){return this.scheme_=e?e:null,this},l.prototype.hasScheme=function(){return null!==this.scheme_},l.prototype.getCredentials=function(){return this.credentials_&&decodeURIComponent(this.credentials_)},l.prototype.getRawCredentials=function(){return this.credentials_},l.prototype.setCredentials=function(e){return this.credentials_=n(e,f),this},l.prototype.setRawCredentials=function(e){return this.credentials_=e?e:null,this},l.prototype.hasCredentials=function(){return null!==this.credentials_},l.prototype.getDomain=function(){return this.domain_&&decodeURIComponent(this.domain_)},l.prototype.getRawDomain=function(){return this.domain_},l.prototype.setDomain=function(e){return this.setRawDomain(e&&encodeURIComponent(e))},l.prototype.setRawDomain=function(e){return this.domain_=e?e:null,this.setRawPath(this.path_)},l.prototype.hasDomain=function(){return null!==this.domain_},l.prototype.getPort=function(){return this.port_&&decodeURIComponent(this.port_)},l.prototype.setPort=function(e){if(e){if(e=Number(e),e!==(65535&e))throw new Error("Bad port number "+e);this.port_=""+e}else this.port_=null;return this},l.prototype.hasPort=function(){return null!==this.port_},l.prototype.getPath=function(){return this.path_&&decodeURIComponent(this.path_)},l.prototype.getRawPath=function(){return this.path_},l.prototype.setPath=function(e){return this.setRawPath(n(e,m))},l.prototype.setRawPath=function(e){return e?(e=String(e),this.path_=!this.domain_||/^\//.test(e)?e:"/"+e):this.path_=null,this},l.prototype.hasPath=function(){return null!==this.path_},l.prototype.getQuery=function(){return this.query_&&decodeURIComponent(this.query_).replace(/\+/g," ")},l.prototype.getRawQuery=function(){return this.query_},l.prototype.setQuery=function(e){return this.paramCache_=null,this.query_=i(e),this},l.prototype.setRawQuery=function(e){return this.paramCache_=null,this.query_=e?e:null,this},l.prototype.hasQuery=function(){return null!==this.query_},l.prototype.setAllParameters=function(e){if("object"==typeof e&&!(e instanceof Array)&&(e instanceof Object||"[object Array]"!==Object.prototype.toString.call(e))){var t=[],i=-1;for(var n in e){var r=e[n];"string"==typeof r&&(t[++i]=n,t[++i]=r)}e=t}this.paramCache_=null;for(var s=[],o="",a=0;a<e.length;){var n=e[a++],r=e[a++];s.push(o,encodeURIComponent(n.toString())),o="&",r&&s.push("=",encodeURIComponent(r.toString()))}return this.query_=s.join(""),this},l.prototype.checkParameterCache_=function(){if(!this.paramCache_){var e=this.query_;if(e){for(var t=e.split(/[&\?]/),i=[],n=-1,r=0;r<t.length;++r){var s=t[r].match(/^([^=]*)(?:=(.*))?$/);i[++n]=decodeURIComponent(s[1]).replace(/\+/g," "),i[++n]=decodeURIComponent(s[2]||"").replace(/\+/g," ")}this.paramCache_=i}else this.paramCache_=[]}},l.prototype.setParameterValues=function(e,t){"string"==typeof t&&(t=[t]),this.checkParameterCache_();for(var i=0,n=this.paramCache_,r=[],s=0;s<n.length;s+=2)e===n[s]?i<t.length&&r.push(e,t[i++]):r.push(n[s],n[s+1]);for(;i<t.length;)r.push(e,t[i++]);return this.setAllParameters(r),this},l.prototype.removeParameter=function(e){return this.setParameterValues(e,[])},l.prototype.getAllParameters=function(){return this.checkParameterCache_(),this.paramCache_.slice(0,this.paramCache_.length)},l.prototype.getParameterValues=function(e){this.checkParameterCache_();for(var t=[],i=0;i<this.paramCache_.length;i+=2)e===this.paramCache_[i]&&t.push(this.paramCache_[i+1]);return t},l.prototype.getParameterMap=function(e){this.checkParameterCache_();for(var t={},i=0;i<this.paramCache_.length;i+=2){var n=this.paramCache_[i++],r=this.paramCache_[i++];n in t?t[n].push(r):t[n]=[r]}return t},l.prototype.getParameterValue=function(e){this.checkParameterCache_();for(var t=0;t<this.paramCache_.length;t+=2)if(e===this.paramCache_[t])return this.paramCache_[t+1];return null},l.prototype.getFragment=function(){return this.fragment_&&decodeURIComponent(this.fragment_)},l.prototype.getRawFragment=function(){return this.fragment_},l.prototype.setFragment=function(e){return this.fragment_=e?encodeURIComponent(e):null,this},l.prototype.setRawFragment=function(e){return this.fragment_=e?e:null,this},l.prototype.hasFragment=function(){return null!==this.fragment_};var p=new RegExp("^(?:([^:/?#]+):)?(?://(?:([^/?#]*)@)?([^/?#:@]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),f=/[#\/\?@]/g,m=/[\#\?]/g;return l.parse=e,l.create=t,l.resolve=a,l.collapse_dots=o,l.utils={mimeTypeOf:function(t){var i=e(t);return/\.html$/.test(i.getPath())?"text/html":"application/javascript"},resolve:function(t,i){return t?a(e(t),e(i)).toString():""+i}},l}();"undefined"!=typeof window&&(window.URI=URI);var sanitizeCssProperty=void 0,sanitizeCssSelectorList=void 0,sanitizeStylesheet=void 0,sanitizeStylesheetWithExternals=void 0,sanitizeMediaQuery=void 0;if(function(){function e(e){return"string"==typeof e?'url("'+e.replace(o,t)+'")':s}function t(e){return a[e]}function i(e,t){return e?URI.utils.resolve(e,t):t}function n(e,t,i){if(!i)return null;var n=(""+e).match(l);return!n||n[1]&&!c.test(n[1])?null:i(e,t)}function r(e){return e.replace(/^-(?:apple|css|epub|khtml|moz|mso?|o|rim|wap|webkit|xv)-(?=[a-z])/,"")}var s='url("about:blank")',o=/[\n\f\r\"\'()*<>]/g,a={"\n":"%0a","\f":"%0c","\r":"%0d",'"':"%22","'":"%27","(":"%28",")":"%29","*":"%2a","<":"%3c",">":"%3e"},l=new RegExp("^(?:([^:/?# ]+):)?"),c=/^(?:https?|mailto)$/i;sanitizeCssProperty=function(){function t(e){for(var t={},i=e.length;--i>=0;)for(var n=e[i],r=n.length;--r>=0;)t[n[r]]=o;return t}var o={};return function a(l,c,h,u,d){function p(e,t){for(var i=1,n=t+1,s=e.length;s>n&&i;){var o=e[n++];i+=")"===o?-1:/^[^"']*\($/.test(o)}if(!i)for(var l=e[t].toLowerCase(),c=r(l),d=e.splice(t,n-t,""),p=m.cssFns,f=0,g=p.length;g>f;++f)if(p[f].substring(0,c.length)==c)return d[0]=d[d.length-1]="",a(p[f],d,h,u),l+d.join(" ")+")";return""}var f=r(l),m=cssSchema[f];if(!m||"object"!=typeof m)return void(c.length=0);for(var g=m.cssPropBits,_=g&(CSS_PROP_BIT_URL|CSS_PROP_BIT_UNRESERVED_WORD),v=g&(CSS_PROP_BIT_GLOBAL_NAME|CSS_PROP_BIT_PROPERTY_NAME),b=NaN,y=0,x=0;y<c.length;++y){var w,k,C,T,S,M,D=c[y].toLowerCase(),E=D.charCodeAt(0);D=E===" ".charCodeAt(0)?"":E==='"'.charCodeAt(0)?_===CSS_PROP_BIT_URL?h?e(n(i(u,decodeCss(c[y].substring(1,D.length-1))),f,h)):"":g&CSS_PROP_BIT_QSTRING&&!(_&_-1)?D:"":"inherit"===D?D:(S=m.cssLitGroup,M=S?m.cssLitMap||(m.cssLitMap=t(S)):o,M[r(D)]===o?D:E==="#".charCodeAt(0)&&/^#(?:[0-9a-f]{3}){1,2}$/.test(D)?g&CSS_PROP_BIT_HASH_VALUE?D:"":"0".charCodeAt(0)<=E&&E<="9".charCodeAt(0)?g&CSS_PROP_BIT_QUANTITY?D:"":(w=D.charCodeAt(1),k=D.charCodeAt(2),C="0".charCodeAt(0)<=w&&w<="9".charCodeAt(0),T="0".charCodeAt(0)<=k&&k<="9".charCodeAt(0),E==="+".charCodeAt(0)&&(C||w===".".charCodeAt(0)&&T)?g&CSS_PROP_BIT_QUANTITY?(C?"":"0")+D.substring(1):"":E==="-".charCodeAt(0)&&(C||w===".".charCodeAt(0)&&T)?g&CSS_PROP_BIT_NEGATIVE_QUANTITY?(C?"-":"-0")+D.substring(1):g&CSS_PROP_BIT_QUANTITY?"0":"":E===".".charCodeAt(0)&&C?g&CSS_PROP_BIT_QUANTITY?"0"+D:"":'url("'===D.substring(0,5)?h&&g&CSS_PROP_BIT_URL?e(n(i(u,c[y].substring(5,D.length-2)),f,h)):"":"("===D.charAt(D.length-1)?p(c,y):v&&/^-?[a-z_][\w\-]*$/.test(D)&&!/__$/.test(D)?d&&v===CSS_PROP_BIT_GLOBAL_NAME?c[y]+d:v===CSS_PROP_BIT_PROPERTY_NAME&&cssSchema[D]&&"number"==typeof cssSchema[D].cssPropBits?D:"":/^\w+$/.test(D)&&_===CSS_PROP_BIT_UNRESERVED_WORD&&g&CSS_PROP_BIT_QSTRING?b+1===x?(c[b]=c[b].substring(0,c[b].length-1)+" "+D+'"',D=""):(b=x,'"'+D+'"'):"")),D&&(c[x++]=D)}1===x&&c[0]===s&&(x=0),c.length=x}}();var h=new RegExp("^(active|after|before|blank|checked|default|disabled|drop|empty|enabled|first|first-child|first-letter|first-line|first-of-type|fullscreen|focus|hover|in-range|indeterminate|invalid|last-child|last-of-type|left|link|only-child|only-of-type|optional|out-of-range|placeholder-shown|read-only|read-write|required|right|root|scope|user-error|valid|visited)$"),u={};u[">"]=u["+"]=u["~"]=u,sanitizeCssSelectorList=function(e,t,i){function n(n,r){function s(i,n,r){var s,o,c,u,p,f=!0;if(s="",n>i)if(p=e[i],"*"===p)++i,s=p;else if(/^[a-zA-Z]/.test(p)){var m=l(p.toLowerCase(),[]);m&&("tagName"in m&&(p=m.tagName),++i,s=p)}for(o="",c="",u="";f&&n>i;++i)if(p=e[i],"#"===p.charAt(0))/^#_|__$|[^\w#:\-]/.test(p)?f=!1:o+=p+a;else if("."===p)++i<n&&/^[0-9A-Za-z:_\-]+$/.test(p=e[i])&&!/^_|__$/.test(p)?o+="."+p:f=!1;else if(n>i+1&&"["===e[i]){++i;var g=e[i++].toLowerCase(),_=html4.ATTRIBS[s+"::"+g];_!==+_&&(_=html4.ATTRIBS["*::"+g]);var v;t.virtualizeAttrName?(v=t.virtualizeAttrName(s,g),"string"!=typeof v&&(f=!1,v=g),f&&_!==+_&&(_=html4.atype.NONE)):(v=g,_!==+_&&(f=!1));var b="",y="",x=!1;switch(/^[~^$*|]?=$/.test(e[i])&&(b=e[i++],y=e[i++],/^[0-9A-Za-z:_\-]+$/.test(y)?y='"'+y+'"':"]"===y&&(y='""',--i),/^"([^\"\\]|\\.)*"$/.test(y)||(f=!1),x="i"===e[i],x&&++i),"]"!==e[i]&&(++i,f=!1),_){case html4.atype.CLASSES:case html4.atype.LOCAL_NAME:case html4.atype.NONE:break;case html4.atype.GLOBAL_NAME:case html4.atype.ID:case html4.atype.IDREF:"="!==b&&"~="!==b&&"$="!==b||'""'==y||x?"|="===b||""===b||(f=!1):y='"'+y.substring(1,y.length-1)+a+'"';break;case html4.atype.URI:case html4.atype.URI_FRAGMENT:""!==b&&(f=!1);break;default:f=!1}f&&(c+="["+v.replace(/[^\w-]/g,"\\$&")+b+y+(x?" i]":"]"))}else{if(!(n>i&&":"===e[i]))break;if(p=e[++i],!h.test(p))break;u+=":"+p}if(i!==n&&(f=!1),f){var w=(s+o).replace(/[^ .*#\w-]/g,"\\$&")+c+u+r;w&&d.push(w)}return f}" "===e[n]&&++n,r-1!==n&&" "===e[r]&&--r;for(var d=[],p=n,f=!0,m=n;f&&r>m;++m){var g=e[m];(u[g]===u||" "===g)&&(s(p,m,g)?p=m+1:f=!1)}if(s(p,r,"")||(f=!1),f){if(d.length){var _=d.join("");null!==o&&(_="."+o+" "+_),c.push(_)}return!0}return!i||i(e.slice(n,r))}var r,s,o=t.containerClass,a=t.idSuffix,l=t.tagPolicy,c=[],d=0,p=0;for(r=0;r<e.length;++r)s=e[r],("("==s||"["==s?(++p,0):")"==s||"]"==s?(p&&--p,0):" "==e[r]&&(p||u[e[r-1]]===u||u[e[r+1]]===u))||(e[d++]=e[r]);e.length=d;var f=e.length,m=0;for(r=0;f>r;++r)if(","===e[r]){if(!n(m,r))return null;m=r+1}return n(m,f)?c:null},function(){var e="(?:all|aural|braille|embossed|handheld|print|projection|screen|speech|tty|tv)",t="(?:(?:min-|max-)?(?:(?:device-)?(?:aspect-ratio|height|width)|color(?:-index)?|monochrome|orientation|resolution)|grid|hover|luminosity|pointer|scan|script)",i="(?:p[cxt]|[cem]m|in|dpi|dppx|dpcm|%)",n="-?(?:[a-z]\\w+(?:-\\w+)*|\\d+(?: / \\d+|(?:\\.\\d+)?"+i+"?))",r="\\( "+t+" (?:: "+n+" )?\\)",s="(?:(?:(?:(?:only|not) )?"+e+"|"+r+")(?: and ?"+r+")*)",o=/^\w/,a=new RegExp("^"+s+"(?: , "+s+")*$","i");sanitizeMediaQuery=function(e){e=e.slice();for(var t=e.length,i=0,n=0;t>n;++n){var r=e[n];" "!=r&&(e[i++]=r)}e.length=i;var s=e.join(" ");return s=s.length?a.test(s)?o.test(s)?s:"not all , "+s:"not all":""}}(),function(){function e(e){var t,i=/^\s*["]([^"]*)["]\s*$/,n=/^\s*[']([^']*)[']\s*$/,r=/^\s*url\s*[(]["]([^"]*)["][)]\s*$/,s=/^\s*url\s*[(][']([^']*)['][)]\s*$/,o=/^\s*url\s*[(]([^)]*)[)]\s*$/;return(t=i.exec(e))?t[1]:(t=n.exec(e))?t[1]:(t=r.exec(e))?t[1]:(t=s.exec(e))?t[1]:(t=o.exec(e))?t[1]:null}function t(r,s,o,a,l,c,h){function u(){m=f.length&&null===f[f.length-1]}var d=void 0,p=h||[0],f=[],m=!1;return parseCssStylesheet(s,{startStylesheet:function(){d=[]},endStylesheet:function(){},startAtrule:function(s,h){if(m)s=null;else if("@media"===s)d.push("@media"," ",sanitizeMediaQuery(h));else if("@keyframes"===s||"@-webkit-keyframes"===s){var u=h[0];1!==h.length||/__$|[^\w\-]/.test(u)?s=null:(d.push(s," ",u+o.idSuffix),s="@keyframes")}else if("@import"===s&&h.length>0)if(s=null,"function"==typeof c){var g=sanitizeMediaQuery(h.slice(1));if("not all"!==g){++p[0];var _=[];d.push(_);var v=n(i(r,e(h[0])),function(e){var i=t(v,e.html,o,a,l,c,p);--p[0];var n=g?{toString:function(){return"@media "+g+" {"+i.result+"}"}}:i.result;_[0]=n,c(n,!!p[0])},l)}}else window.console&&window.console.log("@import "+h.join(" ")+" elided");m=!s,f.push(s)},endAtrule:function(){f.pop(),m||d.push(";"),u()},startBlock:function(){m||d.push("{")},endBlock:function(){m||(d.push("}"),m=!0)},startRuleset:function(e){if(!m){var t=void 0;if("@keyframes"===f[f.length-1])t=e.join(" ").match(/^ *(?:from|to|\d+(?:\.\d+)?%) *(?:, *(?:from|to|\d+(?:\.\d+)?%) *)*$/i),m=!t,t&&(t=t[0].replace(/ +/g,""));else{var i=sanitizeCssSelectorList(e,o);i&&i.length?t=i.join(", "):m=!0}m||d.push(t,"{")}f.push(null)},endRuleset:function(){f.pop(),m||d.push("}"),u()},declaration:function(e,t){if(!m){var i=!1,n=t.length;n>=2&&"!"===t[n-2]&&"important"===t[n-1].toLowerCase()&&(i=!0,t.length-=2),sanitizeCssProperty(e,t,a,r,o.idSuffix),t.length&&d.push(e,":",t.join(" "),i?" !important;":";")}}}),{result:{toString:function(){return d.join("")}},moreToCome:!!p[0]}}sanitizeStylesheet=function(e,i,n,r){return t(e,i,n,r,void 0,void 0).result.toString()},sanitizeStylesheetWithExternals=function(e,i,n,r,s,o){return t(e,i,n,r,s,o)}}()}(),"undefined"!=typeof window&&(window.sanitizeCssProperty=sanitizeCssProperty,window.sanitizeCssSelectorList=sanitizeCssSelectorList,window.sanitizeStylesheet=sanitizeStylesheet,window.sanitizeMediaQuery=sanitizeMediaQuery),"i"!=="I".toLowerCase())throw"I/i problem";var parseCssStylesheet,parseCssDeclarations;!function(){function e(e,i,r,s){if(r>i){var o=e[i];return"@"===o.charAt(0)?t(e,i,r,s,!0):n(e,i,r,s)}return i}function t(e,t,n,r,s){for(var o=t++;n>t&&"{"!==e[t]&&";"!==e[t];)++t;if(n>t&&(s||";"===e[t])){var a=o+1,l=t;n>a&&" "===e[a]&&++a,l>a&&" "===e[l-1]&&--l,r.startAtrule&&r.startAtrule(e[o].toLowerCase(),e.slice(a,l)),t="{"===e[t]?i(e,t,n,r):t+1,r.endAtrule&&r.endAtrule()}return t}function i(e,r,s,o){for(++r,o.startBlock&&o.startBlock();s>r;){var a=e[r].charAt(0);if("}"==a){++r;break}" "===a||";"===a?r+=1:r="@"===a?t(e,r,s,o,!1):"{"===a?i(e,r,s,o):n(e,r,s,o)}return o.endBlock&&o.endBlock(),r}function n(e,t,i,n){var s=t,a=r(e,t,i,!0);if(0>a)return a=~a,a===s?a+1:a;var l=e[a];if("{"!==l)return a===s?a+1:a;for(t=a+1,a>s&&" "===e[a-1]&&--a,n.startRuleset&&n.startRuleset(e.slice(s,a));i>t;){if(l=e[t],"}"===l){++t;break}" "===l?t+=1:t=o(e,t,i,n)}return n.endRuleset&&n.endRuleset(),t}function r(e,t,i,n){for(var r,s=[],o=-1;i>t;++t)if(r=e[t].charAt(0),"["===r||"("===r)s[++o]=r;else if("]"===r&&"["===s[o]||")"===r&&"("===s[o])--o;else if("{"===r||"}"===r||";"===r||"@"===r||":"===r&&!n)break;return o>=0&&(t=~(t+1)),t}function s(e,t,i){for(;i>t&&";"!==e[t]&&"}"!==e[t];)++t;return i>t&&";"===e[t]?t+1:t}function o(e,t,i,n){var o=e[t++];if(!a.test(o))return s(e,t,i);var l;if(i>t&&" "===e[t]&&++t,t==i||":"!==e[t])return s(e,t,i);++t,i>t&&" "===e[t]&&++t;var c=t,h=r(e,t,i,!1);if(0>h)h=~h;else{for(var u=[],d=0,p=c;h>p;++p)l=e[p]," "!==l&&(u[d++]=l);if(i>h){do{if(l=e[h],";"===l||"}"===l)break;d=0}while(++h<i);";"===l&&++h}d&&n.declaration&&n.declaration(o.toLowerCase(),u)}return h}parseCssStylesheet=function(t,i){var n=lexCss(t);i.startStylesheet&&i.startStylesheet();for(var r=0,s=n.length;s>r;)r=" "===n[r]?r+1:e(n,r,s,i);i.endStylesheet&&i.endStylesheet()};var a=/^-?[a-z]/i;parseCssDeclarations=function(e,t){for(var i=lexCss(e),n=0,r=i.length;r>n;)n=" "!==i[n]?o(i,n,r,t):n+1}}(),"undefined"!=typeof window&&(window.parseCssStylesheet=parseCssStylesheet,window.parseCssDeclarations=parseCssDeclarations);var html4={};if(html4.atype={NONE:0,URI:1,URI_FRAGMENT:11,SCRIPT:2,STYLE:3,HTML:12,ID:4,IDREF:5,IDREFS:6,GLOBAL_NAME:7,LOCAL_NAME:8,CLASSES:9,FRAME_TARGET:10,MEDIA_QUERY:13},html4.atype=html4.atype,html4.ATTRIBS={"*::class":9,"*::dir":0,"*::draggable":0,"*::hidden":0,"*::id":4,"*::inert":0,"*::itemprop":0,"*::itemref":6,"*::itemscope":0,"*::lang":0,"*::onblur":2,"*::onchange":2,"*::onclick":2,"*::ondblclick":2,"*::onerror":2,"*::onfocus":2,"*::onkeydown":2,"*::onkeypress":2,"*::onkeyup":2,"*::onload":2,"*::onmousedown":2,"*::onmousemove":2,"*::onmouseout":2,"*::onmouseover":2,"*::onmouseup":2,"*::onreset":2,"*::onscroll":2,"*::onselect":2,"*::onsubmit":2,"*::ontouchcancel":2,"*::ontouchend":2,"*::ontouchenter":2,"*::ontouchleave":2,"*::ontouchmove":2,"*::ontouchstart":2,"*::onunload":2,"*::spellcheck":0,"*::style":3,"*::title":0,"*::translate":0,"a::accesskey":0,"a::coords":0,"a::href":1,"a::hreflang":0,"a::name":7,"a::onblur":2,"a::onfocus":2,"a::shape":0,"a::tabindex":0,"a::target":10,"a::type":0,"area::accesskey":0,"area::alt":0,"area::coords":0,"area::href":1,"area::nohref":0,"area::onblur":2,"area::onfocus":2,"area::shape":0,"area::tabindex":0,"area::target":10,"audio::controls":0,"audio::loop":0,"audio::mediagroup":5,"audio::muted":0,"audio::preload":0,"audio::src":1,"bdo::dir":0,"blockquote::cite":1,"br::clear":0,"button::accesskey":0,"button::disabled":0,"button::name":8,"button::onblur":2,"button::onfocus":2,"button::tabindex":0,"button::type":0,"button::value":0,"canvas::height":0,"canvas::width":0,"caption::align":0,"col::align":0,"col::char":0,"col::charoff":0,"col::span":0,"col::valign":0,"col::width":0,"colgroup::align":0,"colgroup::char":0,"colgroup::charoff":0,"colgroup::span":0,"colgroup::valign":0,"colgroup::width":0,"command::checked":0,"command::command":5,"command::disabled":0,"command::icon":1,"command::label":0,"command::radiogroup":0,"command::type":0,"data::value":0,"del::cite":1,"del::datetime":0,"details::open":0,"dir::compact":0,"div::align":0,"dl::compact":0,"fieldset::disabled":0,"font::color":0,"font::face":0,"font::size":0,"form::accept":0,"form::action":1,"form::autocomplete":0,"form::enctype":0,"form::method":0,"form::name":7,"form::novalidate":0,"form::onreset":2,"form::onsubmit":2,"form::target":10,"h1::align":0,"h2::align":0,"h3::align":0,"h4::align":0,"h5::align":0,"h6::align":0,"hr::align":0,"hr::noshade":0,"hr::size":0,"hr::width":0,"iframe::align":0,"iframe::frameborder":0,"iframe::height":0,"iframe::marginheight":0,"iframe::marginwidth":0,"iframe::width":0,"img::align":0,"img::alt":0,"img::border":0,"img::height":0,"img::hspace":0,"img::ismap":0,"img::name":7,"img::src":1,"img::usemap":11,"img::vspace":0,"img::width":0,"input::accept":0,"input::accesskey":0,"input::align":0,"input::alt":0,"input::autocomplete":0,"input::checked":0,"input::disabled":0,"input::inputmode":0,"input::ismap":0,"input::list":5,"input::max":0,"input::maxlength":0,"input::min":0,"input::multiple":0,"input::name":8,"input::onblur":2,"input::onchange":2,"input::onfocus":2,"input::onselect":2,"input::placeholder":0,"input::readonly":0,"input::required":0,"input::size":0,"input::src":1,"input::step":0,"input::tabindex":0,"input::type":0,"input::usemap":11,"input::value":0,"ins::cite":1,"ins::datetime":0,"label::accesskey":0,"label::for":5,"label::onblur":2,"label::onfocus":2,"legend::accesskey":0,"legend::align":0,"li::type":0,"li::value":0,"map::name":7,"menu::compact":0,"menu::label":0,"menu::type":0,"meter::high":0,"meter::low":0,"meter::max":0,"meter::min":0,"meter::value":0,"ol::compact":0,"ol::reversed":0,"ol::start":0,"ol::type":0,"optgroup::disabled":0,"optgroup::label":0,"option::disabled":0,"option::label":0,"option::selected":0,"option::value":0,"output::for":6,"output::name":8,"p::align":0,"pre::width":0,"progress::max":0,"progress::min":0,"progress::value":0,"q::cite":1,"select::autocomplete":0,"select::disabled":0,"select::multiple":0,"select::name":8,"select::onblur":2,"select::onchange":2,"select::onfocus":2,"select::required":0,"select::size":0,"select::tabindex":0,"source::type":0,"table::align":0,"table::bgcolor":0,"table::border":0,"table::cellpadding":0,"table::cellspacing":0,"table::frame":0,"table::rules":0,"table::summary":0,"table::width":0,"tbody::align":0,"tbody::char":0,"tbody::charoff":0,"tbody::valign":0,"td::abbr":0,"td::align":0,"td::axis":0,"td::bgcolor":0,"td::char":0,"td::charoff":0,"td::colspan":0,"td::headers":6,"td::height":0,"td::nowrap":0,"td::rowspan":0,"td::scope":0,"td::valign":0,"td::width":0,"textarea::accesskey":0,"textarea::autocomplete":0,"textarea::cols":0,"textarea::disabled":0,"textarea::inputmode":0,"textarea::name":8,"textarea::onblur":2,"textarea::onchange":2,"textarea::onfocus":2,"textarea::onselect":2,"textarea::placeholder":0,"textarea::readonly":0,"textarea::required":0,"textarea::rows":0,"textarea::tabindex":0,"textarea::wrap":0,"tfoot::align":0,"tfoot::char":0,"tfoot::charoff":0,"tfoot::valign":0,"th::abbr":0,"th::align":0,"th::axis":0,"th::bgcolor":0,"th::char":0,"th::charoff":0,"th::colspan":0,"th::headers":6,"th::height":0,"th::nowrap":0,"th::rowspan":0,"th::scope":0,"th::valign":0,"th::width":0,"thead::align":0,"thead::char":0,"thead::charoff":0,"thead::valign":0,"tr::align":0,"tr::bgcolor":0,"tr::char":0,"tr::charoff":0,"tr::valign":0,"track::default":0,"track::kind":0,"track::label":0,"track::srclang":0,"ul::compact":0,"ul::type":0,"video::controls":0,"video::height":0,"video::loop":0,"video::mediagroup":5,"video::muted":0,"video::poster":1,"video::preload":0,"video::src":1,"video::width":0},html4.ATTRIBS=html4.ATTRIBS,html4.eflags={OPTIONAL_ENDTAG:1,EMPTY:2,CDATA:4,RCDATA:8,UNSAFE:16,FOLDABLE:32,SCRIPT:64,STYLE:128,VIRTUALIZED:256},html4.eflags=html4.eflags,html4.ELEMENTS={a:0,abbr:0,acronym:0,address:0,applet:272,area:2,article:0,aside:0,audio:0,b:0,base:274,basefont:274,bdi:0,bdo:0,big:0,blockquote:0,body:305,br:2,button:0,canvas:0,caption:0,center:0,cite:0,code:0,col:2,colgroup:1,command:2,data:0,datalist:0,dd:1,del:0,details:0,dfn:0,dialog:272,dir:0,div:0,dl:0,dt:1,em:0,fieldset:0,figcaption:0,figure:0,font:0,footer:0,form:0,frame:274,frameset:272,h1:0,h2:0,h3:0,h4:0,h5:0,h6:0,head:305,header:0,hgroup:0,hr:2,html:305,i:0,iframe:4,img:2,input:2,ins:0,isindex:274,kbd:0,keygen:274,label:0,legend:0,li:1,link:274,map:0,mark:0,menu:0,meta:274,meter:0,nav:0,nobr:0,noembed:276,noframes:276,noscript:276,object:272,ol:0,optgroup:0,option:1,output:0,p:1,param:274,pre:0,progress:0,q:0,s:0,samp:0,script:84,section:0,select:0,small:0,source:2,span:0,strike:0,strong:0,style:148,sub:0,summary:0,sup:0,table:0,tbody:1,td:1,textarea:8,tfoot:1,th:1,thead:1,time:0,title:280,tr:1,track:2,tt:0,u:0,ul:0,"var":0,video:0,wbr:2},html4.ELEMENTS=html4.ELEMENTS,html4.ELEMENT_DOM_INTERFACES={a:"HTMLAnchorElement",abbr:"HTMLElement",acronym:"HTMLElement",address:"HTMLElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLBaseFontElement",bdi:"HTMLElement",bdo:"HTMLElement",big:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",center:"HTMLElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",command:"HTMLCommandElement",data:"HTMLElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",isindex:"HTMLUnknownElement",kbd:"HTMLElement",keygen:"HTMLKeygenElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map:"HTMLMapElement",mark:"HTMLElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",nobr:"HTMLElement",noembed:"HTMLElement",noframes:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",section:"HTMLElement",select:"HTMLSelectElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strike:"HTMLElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableDataCellElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableHeaderCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",tt:"HTMLElement",u:"HTMLElement",ul:"HTMLUListElement","var":"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"},html4.ELEMENT_DOM_INTERFACES=html4.ELEMENT_DOM_INTERFACES,html4.ueffects={NOT_LOADED:0,SAME_DOCUMENT:1,NEW_DOCUMENT:2},html4.ueffects=html4.ueffects,html4.URIEFFECTS={"a::href":2,"area::href":2,"audio::src":1,"blockquote::cite":0,"command::icon":1,"del::cite":0,"form::action":2,"img::src":1,"input::src":1,"ins::cite":0,"q::cite":0,"video::poster":1,"video::src":1},html4.URIEFFECTS=html4.URIEFFECTS,html4.ltypes={UNSANDBOXED:2,SANDBOXED:1,DATA:0},html4.ltypes=html4.ltypes,html4.LOADERTYPES={"a::href":2,"area::href":2,"audio::src":2,"blockquote::cite":2,"command::icon":1,"del::cite":2,"form::action":2,"img::src":1,"input::src":1,"ins::cite":2,"q::cite":2,"video::poster":1,"video::src":2},html4.LOADERTYPES=html4.LOADERTYPES,"undefined"!=typeof window&&(window.html4=html4),"i"!=="I".toLowerCase())throw"I/i problem";var html=function(e){function t(e){if(L.hasOwnProperty(e))return L[e];var t=e.match(P);if(t)return String.fromCharCode(parseInt(t[1],10));if(t=e.match(A))return String.fromCharCode(parseInt(t[1],16));if(O&&I.test(e)){O.innerHTML="&"+e+";";var i=O.textContent;return L[e]=i,i}return"&"+e+";"}function i(e,i){return t(i)}function n(e){return e.replace(j,"")}function r(e){return e.replace(z,i)}function s(e){return(""+e).replace($,"&amp;").replace(R,"&lt;").replace(F,"&gt;").replace(W,"&#34;")}function o(e){return e.replace(H,"&amp;$1").replace(R,"&lt;").replace(F,"&gt;")}function a(e){var t={cdata:e.cdata||e.cdata,comment:e.comment||e.comment,endDoc:e.endDoc||e.endDoc,endTag:e.endTag||e.endTag,pcdata:e.pcdata||e.pcdata,rcdata:e.rcdata||e.rcdata,startDoc:e.startDoc||e.startDoc,startTag:e.startTag||e.startTag};return function(e,i){return l(e,t,i)}}function l(e,t,i){var n=u(e),r={noMoreGT:!1,noMoreEndComments:!1};h(t,n,0,r,i)}function c(e,t,i,n,r){return function(){h(e,t,i,n,r)}}function h(t,i,n,r,s){try{t.startDoc&&0==n&&t.startDoc(s);for(var o,a,l,h=n,u=i.length;u>h;){var m=i[h++],g=i[h];switch(m){case"&":N.test(g)?(t.pcdata&&t.pcdata("&"+g,s,Y,c(t,i,h,r,s)),h++):t.pcdata&&t.pcdata("&amp;",s,Y,c(t,i,h,r,s));break;case"</":(o=/^([-\w:]+)[^\'\"]*/.exec(g))?o[0].length===g.length&&">"===i[h+1]?(h+=2,l=o[1].toLowerCase(),t.endTag&&t.endTag(l,s,Y,c(t,i,h,r,s))):h=d(i,h,t,s,Y,r):t.pcdata&&t.pcdata("&lt;/",s,Y,c(t,i,h,r,s));break;case"<":if(o=/^([-\w:]+)\s*\/?/.exec(g))if(o[0].length===g.length&&">"===i[h+1]){h+=2,l=o[1].toLowerCase(),t.startTag&&t.startTag(l,[],s,Y,c(t,i,h,r,s));var _=e.ELEMENTS[l];if(_&U){var v={name:l,next:h,eflags:_};h=f(i,v,t,s,Y,r)}}else h=p(i,h,t,s,Y,r);else t.pcdata&&t.pcdata("&lt;",s,Y,c(t,i,h,r,s));break;case"<!--":if(!r.noMoreEndComments){for(a=h+1;u>a&&(">"!==i[a]||!/--$/.test(i[a-1]));a++);if(u>a){if(t.comment){var b=i.slice(h,a).join("");t.comment(b.substr(0,b.length-2),s,Y,c(t,i,a+1,r,s))}h=a+1}else r.noMoreEndComments=!0}r.noMoreEndComments&&t.pcdata&&t.pcdata("&lt;!--",s,Y,c(t,i,h,r,s));break;case"<!":if(/^\w/.test(g)){if(!r.noMoreGT){for(a=h+1;u>a&&">"!==i[a];a++);u>a?h=a+1:r.noMoreGT=!0}r.noMoreGT&&t.pcdata&&t.pcdata("&lt;!",s,Y,c(t,i,h,r,s))}else t.pcdata&&t.pcdata("&lt;!",s,Y,c(t,i,h,r,s));break;case"<?":if(!r.noMoreGT){for(a=h+1;u>a&&">"!==i[a];a++);u>a?h=a+1:r.noMoreGT=!0}r.noMoreGT&&t.pcdata&&t.pcdata("&lt;?",s,Y,c(t,i,h,r,s));break;case">":t.pcdata&&t.pcdata("&gt;",s,Y,c(t,i,h,r,s));break;case"":break;default:t.pcdata&&t.pcdata(m,s,Y,c(t,i,h,r,s))}}t.endDoc&&t.endDoc(s)}catch(y){if(y!==Y)throw y}}function u(e){var t=/(<\/|<\!--|<[!?]|[&<>])/g;if(e+="",B)return e.split(t);for(var i,n=[],r=0;null!==(i=t.exec(e));)n.push(e.substring(r,i.index)),n.push(i[0]),r=i.index+i[0].length;return n.push(e.substring(r)),n}function d(e,t,i,n,r,s){var o=m(e,t);return o?(i.endTag&&i.endTag(o.name,n,r,c(i,e,t,s,n)),o.next):e.length}function p(e,t,i,n,r,s){var o=m(e,t);return o?(i.startTag&&i.startTag(o.name,o.attrs,n,r,c(i,e,o.next,s,n)),o.eflags&U?f(e,o,i,n,r,s):o.next):e.length}function f(t,i,n,r,s,a){var l=t.length;G.hasOwnProperty(i.name)||(G[i.name]=new RegExp("^"+i.name+"(?:[\\s\\/]|$)","i"));for(var h=G[i.name],u=i.next,d=i.next+1;l>d&&("</"!==t[d-1]||!h.test(t[d]));d++);l>d&&(d-=1);var p=t.slice(u,d).join("");if(i.eflags&e.eflags.CDATA)n.cdata&&n.cdata(p,r,s,c(n,t,d,a,r));else{if(!(i.eflags&e.eflags.RCDATA))throw new Error("bug");n.rcdata&&n.rcdata(o(p),r,s,c(n,t,d,a,r))}return d}function m(t,i){var n=/^([-\w:]+)/.exec(t[i]),r={};r.name=n[1].toLowerCase(),r.eflags=e.ELEMENTS[r.name];for(var s=t[i].substr(n[0].length),o=i+1,a=t.length;a>o&&">"!==t[o];o++)s+=t[o];if(!(o>=a)){for(var l=[];""!==s;)if(n=q.exec(s)){if(n[4]&&!n[5]||n[6]&&!n[7]){for(var c=n[4]||n[6],h=!1,u=[s,t[o++]];a>o;o++){if(h){if(">"===t[o])break}else 0<=t[o].indexOf(c)&&(h=!0);u.push(t[o])}if(o>=a)break;s=u.join("");continue}var d=n[1].toLowerCase(),p=n[2]?g(n[3]):"";l.push(d,p),s=s.substr(n[0].length)}else s=s.replace(/^[\s\S][^a-z\s]*/,"");return r.attrs=l,r.next=o+1,r}}function g(e){var t=e.charCodeAt(0);return(34===t||39===t)&&(e=e.substr(1,e.length-2)),r(n(e))}function _(t){var i,n,r=function(e,t){n||t.push(e)};return a({startDoc:function(e){i=[],n=!1},startTag:function(r,o,a){if(!n&&e.ELEMENTS.hasOwnProperty(r)){var l=e.ELEMENTS[r];if(!(l&e.eflags.FOLDABLE)){var c=t(r,o);if(!c)return void(n=!(l&e.eflags.EMPTY));if("object"!=typeof c)throw new Error("tagPolicy did not return object (old API?)");if(!("attribs"in c))throw new Error("tagPolicy gave no attribs");o=c.attribs;var h,u;if("tagName"in c?(u=c.tagName,h=e.ELEMENTS[u]):(u=r,h=l),l&e.eflags.OPTIONAL_ENDTAG){var d=i[i.length-1];!d||d.orig!==r||d.rep===u&&r===u||a.push("</",d.rep,">")}l&e.eflags.EMPTY||i.push({orig:r,rep:u}),a.push("<",u);for(var p=0,f=o.length;f>p;p+=2){var m=o[p],g=o[p+1];null!==g&&void 0!==g&&a.push(" ",m,'="',s(g),'"')}a.push(">"),l&e.eflags.EMPTY&&!(h&e.eflags.EMPTY)&&a.push("</",u,">")}}},endTag:function(t,r){if(n)return void(n=!1);if(e.ELEMENTS.hasOwnProperty(t)){var s=e.ELEMENTS[t];if(!(s&(e.eflags.EMPTY|e.eflags.FOLDABLE))){var o;if(s&e.eflags.OPTIONAL_ENDTAG)for(o=i.length;--o>=0;){var a=i[o].orig;if(a===t)break;if(!(e.ELEMENTS[a]&e.eflags.OPTIONAL_ENDTAG))return}else for(o=i.length;--o>=0&&i[o].orig!==t;);if(0>o)return;for(var l=i.length;--l>o;){var c=i[l].rep;e.ELEMENTS[c]&e.eflags.OPTIONAL_ENDTAG||r.push("</",c,">")}o<i.length&&(t=i[o].rep),i.length=o,r.push("</",t,">")}}},pcdata:r,rcdata:r,cdata:r,endDoc:function(e){for(;i.length;i.length--)e.push("</",i[i.length-1].rep,">")}})}function v(e,t,i,n,r){if(!r)return null;try{var s=URI.parse(""+e);if(s&&(!s.hasScheme()||K.test(s.getScheme()))){var o=r(s,t,i,n);return o?o.toString():null}}catch(a){return null}return null}function b(e,t,i,n,r){if(i||e(t+" removed",{change:"removed",tagName:t}),n!==r){var s="changed";n&&!r?s="removed":!n&&r&&(s="added"),e(t+"."+i+" "+s,{change:s,tagName:t,attribName:i,oldValue:n,newValue:r})}}function y(e,t,i){var n;return n=t+"::"+i,e.hasOwnProperty(n)?e[n]:(n="*::"+i,e.hasOwnProperty(n)?e[n]:void 0)}function x(t,i){return y(e.LOADERTYPES,t,i)}function w(t,i){return y(e.URIEFFECTS,t,i)}function k(t,i,n,r,s){for(var o=0;o<i.length;o+=2){var a,l=i[o],c=i[o+1],h=c,u=null;if(a=t+"::"+l,(e.ATTRIBS.hasOwnProperty(a)||(a="*::"+l,e.ATTRIBS.hasOwnProperty(a)))&&(u=e.ATTRIBS[a]),null!==u)switch(u){case e.atype.NONE:break;case e.atype.SCRIPT:c=null,s&&b(s,t,l,h,c);
break;case e.atype.STYLE:if("undefined"==typeof M){c=null,s&&b(s,t,l,h,c);break}var d=[];M(c,{declaration:function(t,i){var r=t.toLowerCase();D(r,i,n?function(t){return v(t,e.ueffects.SAME_DOCUMENT,e.ltypes.SANDBOXED,{TYPE:"CSS",CSS_PROP:r},n)}:null),i.length&&d.push(r+": "+i.join(" "))}}),c=d.length>0?d.join(" ; "):null,s&&b(s,t,l,h,c);break;case e.atype.ID:case e.atype.IDREF:case e.atype.IDREFS:case e.atype.GLOBAL_NAME:case e.atype.LOCAL_NAME:case e.atype.CLASSES:c=r?r(c):c,s&&b(s,t,l,h,c);break;case e.atype.URI:c=v(c,w(t,l),x(t,l),{TYPE:"MARKUP",XML_ATTR:l,XML_TAG:t},n),s&&b(s,t,l,h,c);break;case e.atype.URI_FRAGMENT:c&&"#"===c.charAt(0)?(c=c.substring(1),c=r?r(c):c,null!==c&&void 0!==c&&(c="#"+c)):c=null,s&&b(s,t,l,h,c);break;default:c=null,s&&b(s,t,l,h,c)}else c=null,s&&b(s,t,l,h,c);i[o+1]=c}return i}function C(t,i,n){return function(r,s){return e.ELEMENTS[r]&e.eflags.UNSAFE?void(n&&b(n,r,void 0,void 0,void 0)):{attribs:k(r,s,t,i,n)}}}function T(e,t){var i=[];return _(t)(e,i),i.join("")}function S(e,t,i,n){var r=C(t,i,n);return T(e,r)}var M,D,E;"undefined"!=typeof window&&(M=window.parseCssDeclarations,D=window.sanitizeCssProperty,E=window.cssSchema);var L={lt:"<",LT:"<",gt:">",GT:">",amp:"&",AMP:"&",quot:'"',apos:"'",nbsp:" "},P=/^#(\d+)$/,A=/^#x([0-9A-Fa-f]+)$/,I=/^[A-Za-z][A-za-z0-9]+$/,O="undefined"!=typeof window&&window.document?window.document.createElement("textarea"):null,j=/\0/g,z=/&(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/g,N=/^(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/,$=/&/g,H=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,R=/[<]/g,F=/>/g,W=/\"/g,q=new RegExp("^\\s*([-.:\\w]+)(?:\\s*(=)\\s*((\")[^\"]*(\"|$)|(')[^']*('|$)|(?=[a-z][-\\w]*\\s*=)|[^\"'\\s]*))?","i"),B=3==="a,b".split(/(,)/).length,U=e.eflags.CDATA|e.eflags.RCDATA,Y={},G={},K=/^(?:https?|mailto)$/i,V={};return V.escapeAttrib=V.escapeAttrib=s,V.makeHtmlSanitizer=V.makeHtmlSanitizer=_,V.makeSaxParser=V.makeSaxParser=a,V.makeTagPolicy=V.makeTagPolicy=C,V.normalizeRCData=V.normalizeRCData=o,V.sanitize=V.sanitize=S,V.sanitizeAttribs=V.sanitizeAttribs=k,V.sanitizeWithPolicy=V.sanitizeWithPolicy=T,V.unescapeEntities=V.unescapeEntities=r,V}(html4),html_sanitize=html.sanitize;if("undefined"!=typeof window&&(window.html=html,window.html_sanitize=html_sanitize),define("components/google-caja/html-css-sanitizer-minified",function(){}),define("base/js/security",["jquery","components/google-caja/html-css-sanitizer-minified"],function(e,t){"use strict";var i,n=function(e){return e};window&&window.html&&(i=window.html,i.html4=window.html4,i.sanitizeStylesheet=window.sanitizeStylesheet);var r=function(e,t,n,r,s){for(var o=i.html4.ATTRIBS,a=0;a<t.length;a+=2){var l=t[a];if("data-"==l.substr(0,5)){var c="*::"+l;o.hasOwnProperty(c)||(o[c]=0)}}return i.sanitizeAttribs(e,t,n,r,s)},s=function(e,t){return i.sanitizeStylesheet(window.location.pathname,e,{containerClass:null,idSuffix:"",tagPolicy:t,virtualizeAttrName:n},n)},o=function(t,i){var n=e("<div/>").append(t),r=n.find("style");return r.length?(r.each(function(e,t){t.innerHTML=s(t.innerHTML,i)}),n.html()):t},a=function(e,t){var s=i.html4;t?(s.ELEMENTS.style&=~s.eflags.UNSAFE,s.ATTRIBS.style=s.atype.STYLE):(s.ELEMENTS.style|=s.eflags.UNSAFE,s.ATTRIBS.style=s.atype.SCRIPT);var a=function(e,t){console.log("HTML Sanitizer",e,t)},l=function(e,t){return s.ELEMENTS[e]&s.eflags.UNSAFE?void a(e+" removed",{change:"removed",tagName:e}):{attribs:r(e,t,n,n,a)}},c=i.sanitizeWithPolicy(e,l);return t&&(c=o(result.sanitized,l)),c},l={caja:i,sanitize_html:a};return l}),define("services/config",["jquery","base/js/utils"],function(e,t){"use strict";var i=function(e,t){this.section_name=e,this.base_url=t.base_url,this.data={};var i=this;this._one_load_finished=!1,this.loaded=new Promise(function(e,t){i._finish_firstload=e})};i.prototype.api_url=function(){return t.url_join_encode(this.base_url,"api/config",this.section_name)},i.prototype._load_done=function(){this._one_load_finished||(this._one_load_finished=!0,this._finish_firstload())},i.prototype.load=function(){return new Promise(function(e,t){e({})})},i.prototype.update=function(i){e.extend(!0,this.data,i);var n=this;return t.promising_ajax(this.api_url(),{processData:!1,type:"PATCH",data:JSON.stringify(i),dataType:"json",contentType:"application/json"}).then(function(e){return n.data=e,n._load_done(),e})};var n=function(e,t,i){this.section=e,this.defaults=t,this.classname=i};return n.prototype._class_data=function(){return this.classname?this.section.data[this.classname]||{}:this.section.data},n.prototype.get=function(e){return this.section.loaded.then(function(){return this._class_data()[e]||this.defaults[e]})},n.prototype.get_sync=function(e){return this._class_data()[e]||this.defaults[e]},n.prototype.set=function(e,t){var i={};if(i[e]=t,this.classname){var n={};return n[this.classname]=i,this.section.update(n)}return this.section.update(i)},{ConfigSection:i,ConfigWithDefaults:n}}),define("notebook/js/mathjaxutils",["jquery","base/js/utils","base/js/dialog"],function(e,t,i){"use strict";var n=function(){if(window.MathJax)MathJax.Hub.Config({tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,processEnvironments:!0},displayAlign:"center","HTML-CSS":{availableFonts:[],imageFont:null,preferredFont:null,webFont:"STIX-Web",styles:{".MathJax_Display":{margin:0}},linebreaks:{automatic:!0}}}),MathJax.Hub.Configured();else if(""!==window.mathjax_url){var t=e("<div/>").append(e("<p/></p>").addClass("dialog").text("Math/LaTeX rendering will be disabled.")).append(e("<p></p>").addClass("dialog").text("If you have administrative access to the notebook server and a working internet connection, you can install a local copy of MathJax for offline use with the following command on the server at a Python or Jupyter prompt:")).append(e("<pre></pre>").addClass("dialog").text(">>> from Jupyter.external import mathjax; mathjax.install_mathjax()")).append(e("<p></p>").addClass("dialog").text("This will try to install MathJax into the Jupyter source directory.")).append(e("<p></p>").addClass("dialog").text("If Jupyter is installed to a location that requires administrative privileges to write, you will need to make this call as an administrator, via 'sudo'.")).append(e("<p></p>").addClass("dialog").text("When you start the notebook server, you can instruct it to disable MathJax support altogether:")).append(e("<pre></pre>").addClass("dialog").text("$ ipython notebook --no-mathjax")).append(e("<p></p>").addClass("dialog").text("which will prevent this dialog from appearing."));i.modal({title:"Failed to retrieve MathJax from '"+window.mathjax_url+"'",body:t,buttons:{OK:{"class":"btn-danger"}}})}},r="$",s=/(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i,o=function(e,i,n,r,s){var o=s.slice(e,i+1).join("").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");for("msie"===t.browser&&(o=o.replace(/(%[^\n]*)\n/g,"$1<br/>\n"));i>e;)s[i]="",i--;return s[e]="@@"+r.length+"@@",n&&(o=n(o)),r.push(o),s},a=function(e){var i,n,a,l,c,h=[],u=/`/.test(e);u?(e=e.replace(/~/g,"~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,function(e){return e.replace(/\$/g,"~D")}),c=function(e){return e.replace(/~([TD])/g,function(e,t){return{T:"~",D:"$"}[t]})}):c=function(e){return e};for(var d=t.regex_split(e.replace(/\r\n?/g,"\n"),s),p=1,f=d.length;f>p;p+=2){var m=d[p];"@"===m.charAt(0)?(d[p]="@@"+h.length+"@@",h.push(m)):i?m===n?l?a=p:(d=o(i,p,c,h,d),i=null,n=null,a=null):m.match(/\n.*\n/)?(a&&(p=a,d=o(i,p,c,h,d)),i=null,n=null,a=null,l=0):"{"===m?l++:"}"===m&&l&&l--:m===r||"$$"===m?(i=p,n=m,l=0):"begin"===m.substr(1,5)&&(i=p,n="\\end"+m.substr(6),l=0)}return a&&(d=o(i,a,c,h,d),i=null,n=null,a=null),[c(d.join("")),h]},l=function(e,t){return e=e.replace(/@@(\d+)@@/g,function(e,i){return t[i]})},c={init:n,remove_math:a,replace_math:l};return c}),define("base/js/events",["base/js/namespace","jquery"],function(e,t){"use strict";var i=function(){},n=new i;return e.Events=i,e.events=n,t([n])}),define("notebook/js/celltoolbar",["base/js/namespace","jquery","base/js/events"],function(e,t,i){"use strict";var n=function(e){return n._instances.push(this),this.notebook=e.notebook,this.cell=e.cell,this.create_element(),this.rebuild(),this};return n.prototype.create_element=function(){this.inner_element=t("<div/>").addClass("celltoolbar"),this.element=t("<div/>").addClass("ctb_hideshow").append(this.inner_element)},n.global_hide=function(){t("body").removeClass("ctb_global_show")},n.global_show=function(){t("body").addClass("ctb_global_show")},n.prototype.hide=function(){this.element.removeClass("ctb_show")},n.prototype.show=function(){this.element.addClass("ctb_show")},n._callback_dict={},n._ui_controls_list=[],n._instances=[],n._presets={},n.register_callback=function(e,t,i){n._callback_dict[e]=i?{callback:t,cell_types:i}:t},n.register_preset=function(e,t,r){n._presets[e]=t,i.trigger("preset_added.CellToolbar",{name:e}),r&&r.metadata&&r.metadata.celltoolbar===e&&n.activate_preset(e)},n.unregister_preset=function(e){return n._presets[e]?(delete n._presets[e],i.trigger("unregistered_preset.CellToolbar",{name:e}),!0):!1},n.list_presets=function(){var e=[];for(var t in n._presets)e.push(t);return e},n.activate_preset=function(e){var t=n._presets[e];void 0!==t&&(n._ui_controls_list=t,n.rebuild_all()),i.trigger("preset_activated.CellToolbar",{name:e})},n.rebuild_all=function(){for(var e=0;e<n._instances.length;e++)n._instances[e].rebuild()},n.prototype.rebuild=function(){this.inner_element.empty(),this.ui_controls_list=[];for(var e=n._callback_dict,i=n._ui_controls_list,r=0;r<i.length;r++){var s=i[r],o=e[s];if(o){if("object"==typeof o){if(-1===o.cell_types.indexOf(this.cell.cell_type))continue;o=o.callback}var a=t("<div/>").addClass("button_container");try{o(a,this.cell,this),this.ui_controls_list.push(s)}catch(l){console.log("Error in cell toolbar callback "+s,l);continue}this.inner_element.append(a)}}this.ui_controls_list.length?this.show():this.hide()},n.utils={},n.utils.checkbox_ui_generator=function(e,i,n){return function(r,s,o){var a=t(r),l=t("<input/>").attr("type","checkbox"),c=t("<label/>").append(t("<span/>").text(e));c.append(l),l.attr("checked",n(s)),l.click(function(){var e=n(s);i(s,!e),l.attr("checked",!e)}),a.append(t("<span/>").append(c))}},n.utils.input_ui_generator=function(i,n,r){return function(s,o,a){var l=t(s),c=t("<input/>").attr("type","text"),h=t("<label/>").append(t("<span/>").text(i));h.append(c),c.attr("value",r(o)),c.keyup(function(){n(o,c.val())}),l.append(t("<span/>").append(h)),e.keyboard_manager.register_events(c)}},n.utils.select_ui_generator=function(e,i,n,r){return r=r||"",function(s,o,a){for(var l=t(s),c=t("<label/>").append(t("<span/>").text(r)),h=t("<select/>"),u=0;u<e.length;u++){var d=t("<option/>").attr("value",e[u][1]).text(e[u][0]);h.append(d)}h.val(n(o)),h.change(function(){i(o,h.val())}),l.append(t("<span/>").append(c).append(h))}},e.CellToolbar=n,{CellToolbar:n}}),function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||c.defaults,this.rules=h.normal,this.options.gfm&&(this.options.tables?this.rules=h.tables:this.rules=h.gfm)}function t(e,t){if(this.options=t||c.defaults,this.links=e,this.rules=u.normal,this.renderer=this.options.renderer||new i,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=u.breaks:this.rules=u.gfm:this.options.pedantic&&(this.rules=u.pedantic)}function i(e){this.options=e||{}}function n(e){this.tokens=[],this.token=null,this.options=e||c.defaults,this.options.renderer=this.options.renderer||new i,this.renderer=this.options.renderer,this.renderer.options=this.options}function r(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function s(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function o(e,t){return e=e.source,t=t||"",function i(n,r){return n?(r=r.source||r,r=r.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(n,r),i):new RegExp(e,t)}}function a(){}function l(e){for(var t,i,n=1;n<arguments.length;n++){t=arguments[n];for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}function c(t,i,s){if(s||"function"==typeof i){s||(s=i,i=null),i=l({},c.defaults,i||{});var o,a,h=i.highlight,u=0;try{o=e.lex(t,i)}catch(d){return s(d)}a=o.length;var p=function(e){if(e)return i.highlight=h,s(e);var t;try{t=n.parse(o,i)}catch(r){e=r}return i.highlight=h,e?s(e):s(null,t)};if(!h||h.length<3)return p();if(delete i.highlight,!a)return p();for(;u<o.length;u++)!function(e){return"code"!==e.type?--a||p():h(e.text,e.lang,function(t,i){return t?p(t):null==i||i===e.text?--a||p():(e.text=i,e.escaped=!0,void(--a||p()))})}(o[u])}else try{return i&&(i=l({},c.defaults,i)),n.parse(e.lex(t,i),i)}catch(d){if(d.message+="\nPlease report this to https://github.com/chjj/marked.",(i||c.defaults).silent)return"<p>An error occured:</p><pre>"+r(d.message+"",!0)+"</pre>";throw d}}var h={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:a,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:a,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:a,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};h.bullet=/(?:[*+-]|\d+\.)/,h.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,h.item=o(h.item,"gm")(/bull/g,h.bullet)(),h.list=o(h.list)(/bull/g,h.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+h.def.source+")")(),h.blockquote=o(h.blockquote)("def",h.def)(),h._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",h.html=o(h.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,h._tag)(),h.paragraph=o(h.paragraph)("hr",h.hr)("heading",h.heading)("lheading",h.lheading)("blockquote",h.blockquote)("tag","<"+h._tag)("def",h.def)(),h.normal=l({},h),h.gfm=l({},h.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),h.gfm.paragraph=o(h.paragraph)("(?!","(?!"+h.gfm.fences.source.replace("\\1","\\2")+"|"+h.list.source.replace("\\1","\\3")+"|")(),h.tables=l({},h.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=h,e.lex=function(t,i){var n=new e(i);return n.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,i){for(var n,r,s,o,a,l,c,u,d,e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),s[0].length>1&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:s.replace(/\n+$/,"")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if(t&&(s=this.rules.nptable.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].split(/ *\| */);this.tokens.push(l)}else if(s=this.rules.lheading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"hr"});else if(s=this.rules.blockquote.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),this.token(s,t,!0),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),o=s[2],this.tokens.push({type:"list_start",ordered:o.length>1}),s=s[0].match(this.rules.item),n=!1,d=s.length,u=0;d>u;u++)l=s[u],c=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==d-1&&(a=h.bullet.exec(s[u+1])[0],o===a||o.length>1&&a.length>1||(e=s.slice(u+1).join("\n")+e,u=d-1)),r=n||/\n\n(?!\s*$)/.test(l),u!==d-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),this.tokens.push({type:r?"loose_item_start":"list_item_start"}),this.token(l,!1,i),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(s=this.rules.html.exec(e))e=e.substring(s[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(!i&&t&&(s=this.rules.def.exec(e)))e=e.substring(s[0].length),this.tokens.links[s[1].toLowerCase()]={href:s[2],title:s[3]};else if(t&&(s=this.rules.table.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(t&&(s=this.rules.paragraph.exec(e)))e=e.substring(s[0].length),this.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var u={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:a,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:a,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};u._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,u._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=o(u.link)("inside",u._inside)("href",u._href)(),u.reflink=o(u.reflink)("inside",u._inside)(),u.normal=l({},u),u.pedantic=l({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=l({},u.normal,{escape:o(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=l({},u.gfm,{br:o(u.br)("{2,}","*")(),text:o(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,i,n){var r=new t(i,n);return r.output(e)},t.prototype.output=function(e){for(var t,i,n,s,o="";e;)if(s=this.rules.escape.exec(e))e=e.substring(s[0].length),o+=s[1];else if(s=this.rules.autolink.exec(e))e=e.substring(s[0].length),"@"===s[2]?(i=":"===s[1].charAt(6)?this.mangle(s[1].substring(7)):this.mangle(s[1]),n=this.mangle("mailto:")+i):(i=r(s[1]),n=i),o+=this.renderer.link(n,null,i);else if(this.inLink||!(s=this.rules.url.exec(e))){if(s=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(s[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(s[0])&&(this.inLink=!1),e=e.substring(s[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):r(s[0]):s[0];else if(s=this.rules.link.exec(e))e=e.substring(s[0].length),this.inLink=!0,o+=this.outputLink(s,{href:s[2],title:s[3]}),this.inLink=!1;else if((s=this.rules.reflink.exec(e))||(s=this.rules.nolink.exec(e))){if(e=e.substring(s[0].length),t=(s[2]||s[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=s[0].charAt(0),e=s[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(s,t),this.inLink=!1}else if(s=this.rules.strong.exec(e))e=e.substring(s[0].length),o+=this.renderer.strong(this.output(s[2]||s[1]));else if(s=this.rules.em.exec(e))e=e.substring(s[0].length),o+=this.renderer.em(this.output(s[2]||s[1]));else if(s=this.rules.code.exec(e))e=e.substring(s[0].length),o+=this.renderer.codespan(r(s[2],!0));else if(s=this.rules.br.exec(e))e=e.substring(s[0].length),o+=this.renderer.br();else if(s=this.rules.del.exec(e))e=e.substring(s[0].length),o+=this.renderer.del(this.output(s[1]));else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),o+=this.renderer.text(r(this.smartypants(s[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(s[0].length),i=r(s[1]),n=i,o+=this.renderer.link(n,null,i);return o},t.prototype.outputLink=function(e,t){var i=r(t.href),n=t.title?r(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(i,n,this.output(e[1])):this.renderer.image(i,n,r(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,i="",n=e.length,r=0;n>r;r++)t=e.charCodeAt(r),Math.random()>.5&&(t="x"+t.toString(16)),i+="&#"+t+";";return i},i.prototype.code=function(e,t,i){if(this.options.highlight){var n=this.options.highlight(e,t);null!=n&&n!==e&&(i=!0,e=n)}return t?'<pre><code class="'+this.options.langPrefix+r(t,!0)+'">'+(i?e:r(e,!0))+"\n</code></pre>\n":"<pre><code>"+(i?e:r(e,!0))+"\n</code></pre>"},i.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,i){return"<h"+t+' id="'+this.options.headerPrefix+i.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},i.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.prototype.list=function(e,t){var i=t?"ol":"ul";return"<"+i+">\n"+e+"</"+i+">\n"},i.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},i.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},i.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},i.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},i.prototype.tablecell=function(e,t){var i=t.header?"th":"td",n=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return n+e+"</"+i+">\n"},i.prototype.strong=function(e){return"<strong>"+e+"</strong>"},i.prototype.em=function(e){return"<em>"+e+"</em>"},i.prototype.codespan=function(e){return"<code>"+e+"</code>"},i.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.prototype.del=function(e){return"<del>"+e+"</del>"},i.prototype.link=function(e,t,i){if(this.options.sanitize){try{var n=decodeURIComponent(s(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:"))return""}var o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>"},i.prototype.image=function(e,t,i){var n='<img src="'+e+'" alt="'+i+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},i.prototype.text=function(e){return e},n.parse=function(e,t,i){var r=new n(t,i);return r.parse(e)},n.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var i="";this.next();)i+=this.tok();return i},n.prototype.next=function(){return this.token=this.tokens.pop()},n.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},n.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},n.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,i,n,r,s="",o="";for(i="",e=0;e<this.token.header.length;e++)n={header:!0,align:this.token.align[e]},i+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(s+=this.renderer.tablerow(i),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],i="",r=0;r<t.length;r++)i+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});o+=this.renderer.tablerow(i)}return this.renderer.table(s,o);case"blockquote_start":for(var o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":for(var o="",a=this.token.ordered;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,a);case"list_item_start":for(var o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(var o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},a.exec=a,c.options=c.setOptions=function(e){return l(c.defaults,e),c},c.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new i,xhtml:!1},c.Parser=n,c.parser=n.parse,c.Renderer=i,c.Lexer=e,c.lexer=e.lex,c.InlineLexer=t,c.inlineLexer=t.output,c.parse=c,"undefined"!=typeof module&&"object"==typeof exports?module.exports=c:"function"==typeof define&&define.amd?define("components/marked/lib/marked",[],function(){return c}):this.marked=c}.call(function(){return this||("undefined"!=typeof window?window:global)}()),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/xml/xml",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,i){function n(e,t){function i(i){return t.tokenize=i,i(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?i(o("atom","]]>")):null:e.match("--")?i(o("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),i(a(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=o("meta","?>"),"meta"):(k=e.eat("/")?"closeTag":"openTag",t.tokenize=r,"tag bracket");if("&"==n){var s;return s=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),s?"atom":"error"}return e.eatWhile(/[^&<]/),null}function r(e,t){var i=e.next();if(">"==i||"/"==i&&e.eat(">"))return t.tokenize=n,k=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return k="equals",null;if("<"==i){t.tokenize=n,t.state=u,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(i)?(t.tokenize=s(i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,i){for(;!t.eol();)if(t.next()==e){i.tokenize=r;break}return"string"};return t.isInAttribute=!0,t}function o(e,t){return function(i,r){for(;!i.eol();){if(i.match(t)){r.tokenize=n;break}i.next()}return e}}function a(e){return function(t,i){for(var r;null!=(r=t.next());){if("<"==r)return i.tokenize=a(e+1),i.tokenize(t,i);if(">"==r){if(1==e){i.tokenize=n;break}return i.tokenize=a(e-1),i.tokenize(t,i)}}return"meta"}}function l(e,t,i){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=i,(T.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var i;;){if(!e.context)return;if(i=e.context.tagName,!T.contextGrabbers.hasOwnProperty(i)||!T.contextGrabbers[i].hasOwnProperty(t))return;c(e)}}function u(e,t,i){return"openTag"==e?(i.tagStart=t.column(),d):"closeTag"==e?p:u}function d(e,t,i){return"word"==e?(i.tagName=t.current(),C="tag",g):(C="error",d)}function p(e,t,i){if("word"==e){var n=t.current();return i.context&&i.context.tagName!=n&&T.implicitlyClosed.hasOwnProperty(i.context.tagName)&&c(i),i.context&&i.context.tagName==n?(C="tag",f):(C="tag error",m)}return C="error",m}function f(e,t,i){return"endTag"!=e?(C="error",f):(c(i),u)}function m(e,t,i){return C="error",f(e,t,i)}function g(e,t,i){if("word"==e)return C="attribute",_;if("endTag"==e||"selfcloseTag"==e){var n=i.tagName,r=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==e||T.autoSelfClosers.hasOwnProperty(n)?h(i,n):(h(i,n),i.context=new l(i,n,r==i.indented)),u}return C="error",g}function _(e,t,i){return"equals"==e?v:(T.allowMissing||(C="error"),g(e,t,i))}function v(e,t,i){return"string"==e?b:"word"==e&&T.allowUnquoted?(C="string",g):(C="error",g(e,t,i))}function b(e,t,i){return"string"==e?b:g(e,t,i)}var y=t.indentUnit,x=i.multilineTagIndentFactor||1,w=i.multilineTagIndentPastTag;null==w&&(w=!0);var k,C,T=i.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},S=i.alignCDATA;return n.isInText=!0,{startState:function(){return{tokenize:n,state:u,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;k=null;var i=t.tokenize(e,t);return(i||k)&&"comment"!=i&&(C=null,t.state=t.state(k||i,e,t),C&&(i="error"==C?i+" error":C)),i},indent:function(t,i,s){var o=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+y;if(o&&o.noIndent)return e.Pass;if(t.tokenize!=r&&t.tokenize!=n)return s?s.match(/^(\s*)/)[0].length:0;if(t.tagName)return w?t.tagStart+t.tagName.length+2:t.tagStart+y*x;if(S&&/<!\[CDATA\[/.test(i))return 0;var a=i&&/^<(\/)?([\w_:\.-]*)/.exec(i);if(a&&a[1])for(;o;){if(o.tagName==a[2]){o=o.prev;break}if(!T.implicitlyClosed.hasOwnProperty(o.tagName))break;
o=o.prev}else if(a)for(;o;){var l=T.contextGrabbers[o.tagName];if(!l||!l.hasOwnProperty(a[2]))break;o=o.prev}for(;o&&!o.startOfLine;)o=o.prev;return o?o.indent+y:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:i.htmlMode?"html":"xml",helperType:i.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})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define("codemirror/mode/markdown/markdown",["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,i){function n(i){if(e.findModeByName){var n=e.findModeByName(i);n&&(i=n.mime||n.mimes[0])}var r=e.getMode(t,i);return"null"==r.name?null:r}function r(e,t,i){return t.f=t.inline=i,i(e,t)}function s(e,t,i){return t.f=t.block=i,i(e,t)}function o(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,x||e.f!=l||(e.f=p,e.block=a),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.thisLineHasContent=!1,null}function a(e,t){var s=e.sol(),o=t.list!==!1,a=t.indentedCode;t.indentedCode=!1,o&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.indentation>0?(t.list=null,t.listDepth=Math.floor(t.indentation/4)):(t.list=!1,t.listDepth=0));var l=null;if(t.indentationDiff>=4)return e.skipToEnd(),a||!t.prevLineHasContent?(t.indentation-=4,t.indentedCode=!0,T):null;if(e.eatSpace())return null;if((l=e.match(B))&&l[1].length<=6)return t.header=l[1].length,i.highlightFormatting&&(t.formatting="header"),t.f=t.inline,u(t);if(t.prevLineHasContent&&!t.quote&&!o&&!a&&(l=e.match(U)))return t.header="="==l[0].charAt(0)?1:2,i.highlightFormatting&&(t.formatting="header"),t.f=t.inline,u(t);if(e.eat(">"))return t.quote=s?1:t.quote+1,i.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),u(t);if("["===e.peek())return r(e,t,_);if(e.match(R,!0))return t.hr=!0,L;if((!t.prevLineHasContent||o)&&(e.match(F,!1)||e.match(W,!1))){var h=null;return e.match(F,!0)?h="ul":(e.match(W,!0),h="ol"),t.indentation+=4,t.list=!0,t.listDepth++,i.taskLists&&e.match(q,!1)&&(t.taskList=!0),t.f=t.inline,i.highlightFormatting&&(t.formatting=["list","list-"+h]),u(t)}return i.fencedCodeBlocks&&e.match(/^```[ \t]*([\w+#]*)/,!0)?(t.localMode=n(RegExp.$1),t.localMode&&(t.localState=t.localMode.startState()),t.f=t.block=c,i.highlightFormatting&&(t.formatting="code-block"),t.code=!0,u(t)):r(e,t,t.inline)}function l(e,t){var i=w.token(e,t.htmlState);return(x&&null===t.htmlState.tagStart&&!t.htmlState.context&&t.htmlState.tokenize.isInText||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=p,t.block=a,t.htmlState=null),i}function c(e,t){return e.sol()&&e.match("```",!1)?(t.localMode=t.localState=null,t.f=t.block=h,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),T)}function h(e,t){e.match("```"),t.block=a,t.f=p,i.highlightFormatting&&(t.formatting="code-block"),t.code=!0;var n=u(t);return t.code=!1,n}function u(e){var t=[];if(e.formatting){t.push(A),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++)t.push(A+"-"+e.formatting[n]),"header"===e.formatting[n]&&t.push(A+"-"+e.formatting[n]+"-"+e.header),"quote"===e.formatting[n]&&(!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=e.quote?t.push(A+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(z,"url"):(e.strong&&t.push($),e.em&&t.push(N),e.strikethrough&&t.push(H),e.linkText&&t.push(j),e.code&&t.push(T)),e.header&&(t.push(C),t.push(C+"-"+e.header)),e.quote&&(t.push(S),!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=e.quote?t.push(S+"-"+e.quote):t.push(S+"-"+i.maxBlockquoteDepth)),e.list!==!1){var r=(e.listDepth-1)%3;r?1===r?t.push(D):t.push(E):t.push(M)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){return e.match(Y,!0)?u(t):void 0}function p(t,n){var r=n.text(t,n);if("undefined"!=typeof r)return r;if(n.list)return n.list=null,u(n);if(n.taskList){var o="x"!==t.match(q,!0)[1];return o?n.taskOpen=!0:n.taskClosed=!0,i.highlightFormatting&&(n.formatting="task"),n.taskList=!1,u(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return i.highlightFormatting&&(n.formatting="header"),u(n);var a=t.sol(),c=t.next();if("\\"===c&&(t.next(),i.highlightFormatting)){var h=u(n);return h?h+" formatting-escape":"formatting-escape"}if(n.linkTitle){n.linkTitle=!1;var d=c;"("===c&&(d=")"),d=(d+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var p="^\\s*(?:[^"+d+"\\\\]+|\\\\\\\\|\\\\.)"+d;if(t.match(new RegExp(p),!0))return z}if("`"===c){var g=n.formatting;i.highlightFormatting&&(n.formatting="code");var _=u(n),v=t.pos;t.eatWhile("`");var b=1+t.pos-v;return n.code?b===k?(n.code=!1,_):(n.formatting=g,u(n)):(k=b,n.code=!0,u(n))}if(n.code)return u(n);if("!"===c&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),n.inline=n.f=m,P;if("["===c&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,i.highlightFormatting&&(n.formatting="link"),u(n);if("]"===c&&n.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){i.highlightFormatting&&(n.formatting="link");var h=u(n);return n.linkText=!1,n.inline=n.f=m,h}if("<"===c&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=f,i.highlightFormatting&&(n.formatting="link");var h=u(n);return h?h+=" ":h="",h+I}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=f,i.highlightFormatting&&(n.formatting="link");var h=u(n);return h?h+=" ":h="",h+O}if("<"===c&&t.match(/^(!--|\w)/,!1)){var y=t.string.indexOf(">",t.pos);if(-1!=y){var x=t.string.substring(t.start,y);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(w),s(t,n,l)}if("<"===c&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var C=!1;if(!i.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var T=t.pos-2;if(T>=0){var S=t.string.charAt(T);"_"!==S&&S.match(/(\w)/,!1)&&(C=!0)}}if("*"===c||"_"===c&&!C)if(a&&" "===t.peek());else{if(n.strong===c&&t.eat(c)){i.highlightFormatting&&(n.formatting="strong");var _=u(n);return n.strong=!1,_}if(!n.strong&&t.eat(c))return n.strong=c,i.highlightFormatting&&(n.formatting="strong"),u(n);if(n.em===c){i.highlightFormatting&&(n.formatting="em");var _=u(n);return n.em=!1,_}if(!n.em)return n.em=c,i.highlightFormatting&&(n.formatting="em"),u(n)}else if(" "===c&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return u(n);t.backUp(1)}if(i.strikethrough)if("~"===c&&t.eatWhile(c)){if(n.strikethrough){i.highlightFormatting&&(n.formatting="strikethrough");var _=u(n);return n.strikethrough=!1,_}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,i.highlightFormatting&&(n.formatting="strikethrough"),u(n)}else if(" "===c&&t.match(/^~~/,!0)){if(" "===t.peek())return u(n);t.backUp(2)}return" "===c&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),u(n)}function f(e,t){var n=e.next();if(">"===n){t.f=t.inline=p,i.highlightFormatting&&(t.formatting="link");var r=u(t);return r?r+=" ":r="",r+I}return e.match(/^[^>]+/,!0),I}function m(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=g("("===n?")":"]"),i.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,u(t)):"error"}function g(e){return function(t,n){var r=t.next();if(r===e){n.f=n.inline=p,i.highlightFormatting&&(n.formatting="link-string");var s=u(n);return n.linkHref=!1,s}return t.match(y(e),!0)&&t.backUp(1),n.linkHref=!0,u(n)}}function _(e,t){return e.match(/^[^\]]*\]:/,!1)?(t.f=v,e.next(),i.highlightFormatting&&(t.formatting="link"),t.linkText=!0,u(t)):r(e,t,p)}function v(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,i.highlightFormatting&&(t.formatting="link");var n=u(t);return t.linkText=!1,n}return e.match(/^[^\]]+/,!0),j}function b(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=p,z+" url")}function y(e){return G[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),G[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),G[e]}var x=e.modes.hasOwnProperty("xml"),w=e.getMode(t,x?{name:"xml",htmlMode:!0}:"text/plain");void 0===i.highlightFormatting&&(i.highlightFormatting=!1),void 0===i.maxBlockquoteDepth&&(i.maxBlockquoteDepth=0),void 0===i.underscoresBreakWords&&(i.underscoresBreakWords=!0),void 0===i.fencedCodeBlocks&&(i.fencedCodeBlocks=!1),void 0===i.taskLists&&(i.taskLists=!1),void 0===i.strikethrough&&(i.strikethrough=!1);var k=0,C="header",T="comment",S="quote",M="variable-2",D="variable-3",E="keyword",L="hr",P="tag",A="formatting",I="link",O="link",j="link",z="string",N="em",$="strong",H="strikethrough",R=/^([*\-_])(?:\s*\1){2,}\s*$/,F=/^[*\-+]\s+/,W=/^[0-9]+([.)])\s+/,q=/^\[(x| )\](?=\s)/,B=/^(#+)(?: |$)/,U=/^ *(?:\={1,}|-{1,})\s*$/,Y=/^[^#!\[\]*_\\<>` "'(~]+/,G=[],K={startState:function(){return{f:a,prevLineHasContent:!1,thisLineHasContent:!1,block:a,htmlState:null,indentation:0,inline:p,text:d,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(t){return{f:t.f,prevLineHasContent:t.prevLineHasContent,thisLineHasContent:t.thisLineHasContent,block:t.block,htmlState:t.htmlState&&e.copyState(w,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listDepth:t.listDepth,quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside}},token:function(e,t){if(t.formatting=!1,e.sol()){var i=!!t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||i)return t.prevLineHasContent=!1,o(t),i?this.token(e,t):null;t.prevLineHasContent=t.thisLineHasContent,t.thisLineHasContent=!0,t.taskList=!1,t.code=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length,r=4*Math.floor((n-t.indentation)/4);r>4&&(r=4);var s=t.indentation+r;if(t.indentationDiff=s-t.indentation,t.indentation=s,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==l?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:K}},blankLine:o,getType:u,fold:"markdown"};return K},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/mode/overlay",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,i,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(i),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(i,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,r){return(e!=r.streamSeen||Math.min(r.basePos,r.overlayPos)<e.start)&&(r.streamSeen=e,r.basePos=r.overlayPos=e.start),e.start==r.basePos&&(r.baseCur=t.token(e,r.base),r.basePos=e.pos),e.start==r.overlayPos&&(e.pos=e.start,r.overlayCur=i.token(e,r.overlay),r.overlayPos=e.pos),e.pos=Math.min(r.basePos,r.overlayPos),null==r.overlayCur?r.baseCur:null!=r.baseCur&&r.overlay.combineTokens||n&&null==r.overlay.combineTokens?r.baseCur+" "+r.overlayCur:r.overlayCur},indent:t.indent&&function(e,i){return t.indent(e.base,i)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),i.blankLine&&i.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define("codemirror/mode/gfm/gfm",["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("gfm",function(t,i){function n(e){return e.code=!1,null}var r=0,s={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```/)?(t.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var n=1+e.pos-i;return t.code?n===r&&(t.code=!1):(r=n,t.code=!0),null}if(t.code)return e.next(),null;if(e.eatSpace())return t.ateSpace=!0,null;if(e.sol()||t.ateSpace){if(t.ateSpace=!1,e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}return e.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:n},o={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var a in i)o[a]=i[a];return o.name="markdown",e.overlayMode(e.getMode(t,o),s)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/mode/multiplex",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(t){function i(e,t,i,n){if("string"==typeof t){var r=e.indexOf(t,i);return n&&r>-1?r+t.length:r}var s=t.exec(i?e.slice(i):e);return s?s.index+i+(n?s[0].length:0):-1}var n=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(i){return{outer:e.copyState(t,i.outer),innerActive:i.innerActive,inner:i.innerActive&&e.copyState(i.innerActive.mode,i.inner)}},token:function(r,s){if(s.innerActive){var o=s.innerActive,a=r.string;if(!o.close&&r.sol())return s.innerActive=s.inner=null,this.token(r,s);var l=o.close?i(a,o.close,r.pos,o.parseDelimiters):-1;if(l==r.pos&&!o.parseDelimiters)return r.match(o.close),s.innerActive=s.inner=null,o.delimStyle;l>-1&&(r.string=a.slice(0,l));var c=o.mode.token(r,s.inner);return l>-1&&(r.string=a),l==r.pos&&o.parseDelimiters&&(s.innerActive=s.inner=null),o.innerStyle&&(c=c?c+" "+o.innerStyle:o.innerStyle),c}for(var h=1/0,a=r.string,u=0;u<n.length;++u){var d=n[u],l=i(a,d.open,r.pos);if(l==r.pos)return d.parseDelimiters||r.match(d.open),s.innerActive=d,s.inner=e.startState(d.mode,t.indent?t.indent(s.outer,""):0),d.delimStyle;-1!=l&&h>l&&(h=l)}h!=1/0&&(r.string=a.slice(0,h));var p=t.token(r,s.outer);return h!=1/0&&(r.string=a),p},indent:function(i,n){var r=i.innerActive?i.innerActive.mode:t;return r.indent?r.indent(i.innerActive?i.inner:i.outer,n):e.Pass},blankLine:function(i){var r=i.innerActive?i.innerActive.mode:t;if(r.blankLine&&r.blankLine(i.innerActive?i.inner:i.outer),i.innerActive)"\n"===i.innerActive.close&&(i.innerActive=i.inner=null);else for(var s=0;s<n.length;++s){var o=n[s];"\n"===o.open&&(i.innerActive=o,i.inner=e.startState(o.mode,r.indent?r.indent(i.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/python/python",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function i(e){return e.scopes[e.scopes.length-1]}var n=t(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],s=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],o={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},a={builtins:["ascii","bytes","exec","print"],keywords:["nonlocal","False","True","None","async","await"]};e.registerHelper("hintWords","python",r.concat(s)),e.defineMode("python",function(l,c){function h(e,t){if(e.sol()&&"py"==i(t).type){var n=i(t).offset;if(e.eatSpace()){var r=e.indentation();return r>n?p(e,t,"py"):n>r&&f(e,t)&&(t.errorToken=!0),null}var s=u(e,t);return n>0&&f(e,t)&&(s+=" "+g),s}return u(e,t)}function u(e,t){if(e.eatSpace())return null;var i=e.peek();if("#"==i)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^\d+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var s=!1;if(e.match(/^0x[0-9a-f]+/i)&&(s=!0),e.match(/^0b[01]+/i)&&(s=!0),e.match(/^0o[0-7]+/i)&&(s=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),s=!0),e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}return e.match(S)?(t.tokenize=d(e.current()),t.tokenize(e,t)):e.match(y)||e.match(b)?null:e.match(v)||e.match(x)?"operator":e.match(_)?null:e.match(M)||e.match(n)?"keyword":e.match(D)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(w)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),g)}function d(e){function t(t,r){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),i&&t.eol())return n}else{if(t.match(e))return r.tokenize=h,n;t.eat(/['"]/)}if(i){if(c.singleLineStringErrors)return g;r.tokenize=h}return n}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var i=1==e.length,n="string";return t.isString=!0,t}function p(e,t,n){var r=0,s=null;if("py"==n)for(;"py"!=i(t).type;)t.scopes.pop();r=i(t).offset+("py"==n?l.indentUnit:k),"py"==n||e.match(/^(\s|#.*)*$/,!1)||(s=e.column()+1),t.scopes.push({offset:r,type:n,align:s})}function f(e,t){for(var n=e.indentation();i(t).offset>n;){if("py"!=i(t).type)return!0;t.scopes.pop()}return i(t).offset!=n}function m(e,t){var n=t.tokenize(e,t),r=e.current();if("."==r)return n=e.match(w,!1)?null:g,null==n&&"meta"==t.lastStyle&&(n="meta"),n;if("@"==r)return c.version&&3==parseInt(c.version,10)?e.match(w,!1)?"meta":"operator":e.match(w,!1)?"meta":g;"variable"!=n&&"builtin"!=n||"meta"!=t.lastStyle||(n="meta"),("pass"==r||"return"==r)&&(t.dedent+=1),"lambda"==r&&(t.lambda=!0),":"!=r||t.lambda||"py"!=i(t).type||p(e,t,"py");var s=1==r.length?"[({".indexOf(r):-1;if(-1!=s&&p(e,t,"])}".slice(s,s+1)),s="])}".indexOf(r),-1!=s){if(i(t).type!=r)return g;t.scopes.pop()}return t.dedent>0&&e.eol()&&"py"==i(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}var g="error",_=c.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),v=c.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),b=c.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),y=c.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");if(c.version&&3==parseInt(c.version,10))var x=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"),w=c.identifiers||new RegExp("^[_A-Za-z¡-][_A-Za-z0-9¡-]*");else var x=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),w=c.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*");var k=c.hangingIndent||l.indentUnit,C=r,T=s;if(void 0!=c.extra_keywords&&(C=C.concat(c.extra_keywords)),void 0!=c.extra_builtins&&(T=T.concat(c.extra_builtins)),c.version&&3==parseInt(c.version,10)){C=C.concat(a.keywords),T=T.concat(a.builtins);var S=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{C=C.concat(o.keywords),T=T.concat(o.builtins);var S=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var M=t(C),D=t(T),E={startState:function(e){return{tokenize:h,scopes:[{offset:e||0,type:"py",align:null}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var i=t.errorToken;i&&(t.errorToken=!1);var n=m(e,t);t.lastStyle=n;var r=e.current();return r&&n&&(t.lastToken=r),e.eol()&&t.lambda&&(t.lambda=!1),i?n+" "+g:n},indent:function(t,n){if(t.tokenize!=h)return t.tokenize.isString?e.Pass:0;var r=i(t),s=n&&n.charAt(0)==r.type;return null!=r.align?r.align-(s?1:0):s&&t.scopes.length>1?t.scopes[t.scopes.length-2].offset:r.offset},closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return E}),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/stex/stex",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("stex",function(){function e(e,t){e.cmdState.push(t)}function t(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function i(e){var t=e.cmdState.pop();t&&t.closeBracket()}function n(e){for(var t=e.cmdState,i=t.length-1;i>=0;i--){var n=t[i];if("DEFAULT"!=n.name)return n}return{styleIdentifier:function(){return null}}}function r(e,t,i){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=i,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}function s(e,t){e.f=t}function o(i,r){var o;if(i.match(/^\\[a-zA-Z@]+/)){var h=i.current().slice(1);return o=c[h]||c.DEFAULT,o=new o,e(r,o),s(r,l),o.style}if(i.match(/^\\[$&%#{}_]/))return"tag";if(i.match(/^\\[,;!\/\\]/))return"tag";if(i.match("\\["))return s(r,function(e,t){return a(e,t,"\\]")}),"keyword";if(i.match("$$"))return s(r,function(e,t){return a(e,t,"$$")}),"keyword";if(i.match("$"))return s(r,function(e,t){return a(e,t,"$")}),"keyword";var u=i.next();return"%"==u?(i.skipToEnd(),"comment"):"}"==u||"]"==u?(o=t(r))?(o.closeBracket(u),s(r,l),"bracket"):"error":"{"==u||"["==u?(o=c.DEFAULT,o=new o,e(r,o),"bracket"):/\d/.test(u)?(i.eatWhile(/[\w.%]/),"atom"):(i.eatWhile(/[\w\-_]/),o=n(r),"begin"==o.name&&(o.argument=i.current()),o.styleIdentifier())}function a(e,t,i){if(e.eatSpace())return null;if(e.match(i))return s(t,o),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variable-2";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var n=e.next();return"{"==n||"}"==n||"["==n||"]"==n||"("==n||")"==n?"bracket":"%"==n?(e.skipToEnd(),"comment"):"error"}function l(e,n){var r,a=e.peek();return"{"==a||"["==a?(r=t(n),r.openBracket(a),e.eat(a),s(n,o),"bracket"):/[ \t\r]/.test(a)?(e.eat(a),null):(s(n,o),i(n),o(e,n))}var c={};return c.importmodule=r("importmodule","tag",["string","builtin"]),c.documentclass=r("documentclass","tag",["","atom"]),c.usepackage=r("usepackage","tag",["atom"]),c.begin=r("begin","tag",["atom"]),c.end=r("end","tag",["atom"]),c.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:o}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=o,e.cmdState.length=0},lineComment:"%"}}),e.defineMIME("text/x-stex","stex"),e.defineMIME("text/x-latex","stex")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("codemirror/lib/codemirror"),require("codemirror/addon/mode/multiplex"),require("codemirror/mode/gfm/gfm"),require("codemirror/mode/stex/stex")):"function"==typeof define&&define.amd?define("notebook/js/codemirror-ipythongfm",["codemirror/lib/codemirror","codemirror/addon/mode/multiplex","codemirror/mode/python/python","codemirror/mode/stex/stex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ipythongfm",function(t,i){var n=e.getMode(t,"gfm"),r=e.getMode(t,"stex");return e.multiplexingMode(n,{open:"$",close:"$",mode:r,delimStyle:"delimit"},{open:"$$",close:"$$",mode:r,delimStyle:"delimit"},{open:"\\(",close:"\\)",mode:r,delimStyle:"delimit"},{open:"\\[",close:"\\]",mode:r,delimStyle:"delimit"})},"gfm"),e.defineMIME("text/x-ipythongfm","ipythongfm")}),define("notebook/js/textcell",["base/js/utils","jquery","notebook/js/cell","base/js/security","services/config","notebook/js/mathjaxutils","notebook/js/celltoolbar","components/marked/lib/marked","codemirror/lib/codemirror","codemirror/mode/gfm/gfm","notebook/js/codemirror-ipythongfm"],function(e,t,i,n,r,s,o,a,l,c,h){"use strict";var u=i.Cell,d=function(t){t=t||{},this.notebook=t.notebook,this.events=t.events,this.config=t.config;var i=e.mergeopt(d,this.config);u.apply(this,[{config:i,keyboard_manager:t.keyboard_manager,events:this.events}]),this.cell_type=this.cell_type||"text",s=s,this.rendered=!1};d.prototype=Object.create(u.prototype),d.options_default={cm_config:{extraKeys:{Tab:"indentMore","Shift-Tab":"indentLess"},mode:"htmlmixed",lineWrapping:!0}},d.prototype.create_element=function(){u.prototype.create_element.apply(this,arguments);var e=this,i=t("<div>").addClass("cell text_cell");i.attr("tabindex","2");var n=t("<div/>").addClass("prompt input_prompt");i.append(n);var r=t("<div/>").addClass("inner_cell");this.celltoolbar=new o.CellToolbar({cell:this,notebook:this.notebook}),r.append(this.celltoolbar.element);var s=t("<div/>").addClass("input_area");this.code_mirror=new l(s.get(0),this._options.cm_config),this.code_mirror.on("focus",function(){e.keyboard_manager&&e.keyboard_manager.enable()}),this.code_mirror.on("keydown",t.proxy(this.handle_keyevent,this));var a=t("<div/>").addClass("text_cell_render rendered_html").attr("tabindex","-1");r.append(s).append(a),i.append(r),this.element=i},d.prototype.select=function(){var e=u.prototype.select.apply(this);return e&&"edit"===this.mode&&this.code_mirror.refresh(),e},d.prototype.unrender=function(){var e=u.prototype.unrender.apply(this);if(e){this.element;this.get_text()===this.placeholder&&this.set_text(""),this.refresh()}return e},d.prototype.execute=function(){this.render()},d.prototype.get_text=function(){return this.code_mirror.getValue()},d.prototype.set_text=function(e){this.code_mirror.setValue(e),this.unrender(),this.code_mirror.refresh()},d.prototype.get_rendered=function(){return this.element.find("div.text_cell_render").html()},d.prototype.set_rendered=function(e){this.element.find("div.text_cell_render").html(e)},d.prototype.fromJSON=function(e){u.prototype.fromJSON.apply(this,arguments),e.cell_type===this.cell_type&&void 0!==e.source&&(this.set_text(e.source),this.code_mirror.clearHistory(),this.set_rendered(e.rendered||""),this.rendered=!1,this.render())},d.prototype.toJSON=function(){var e=u.prototype.toJSON.apply(this);return e.source=this.get_text(),e.source==this.placeholder&&(e.source=""),e};var p=function(i){i=i||{};var n=e.mergeopt(p,{});this.class_config=new r.ConfigWithDefaults(i.config,{},"MarkdownCell"),d.apply(this,[t.extend({},i,{config:n})]),this.cell_type="markdown"};p.options_default={cm_config:{mode:"ipythongfm"},placeholder:"Type *Markdown* and LaTeX: $\\alpha^2$"},p.prototype=Object.create(d.prototype),p.prototype.set_heading_level=function(e){e=e||1;var t=this.get_text();t=t.replace(/^(#*)\s?/,new Array(e+1).join("#")+" "),this.set_text(t),this.refresh(),this.rendered&&this.render()},p.prototype.render=function(){var e=d.prototype.render.apply(this);if(e){var i=this,r=this.get_text(),o=null;""===r&&(r=this.placeholder);var l=s.remove_math(r);r=l[0],o=l[1],a(r,function(e,r){r=s.replace_math(r,o),r=n.sanitize_html(r),r=t(t.parseHTML(r)),r.find(":header").addBack(":header").each(function(e,i){i=t(i);var n=i.text().replace(/ /g,"-");i.attr("id",n),i.append(t("<a/>").addClass("anchor-link").attr("href","#"+n).text("¶"))}),r.find("a[href]").not('[href^="#"]').attr("target","_blank"),i.set_rendered(r),i.typeset(),i.events.trigger("rendered.MarkdownCell",{cell:i})})}return e};var f=function(i){i=i||{};var n=e.mergeopt(f,{});d.apply(this,[t.extend({},i,{config:n})]),this.class_config=new r.ConfigWithDefaults(i.config,f.config_defaults,"RawCell"),this.cell_type="raw"};f.options_default={placeholder:"Write raw LaTeX or other formats here, for use with nbconvert. It will not be rendered in the notebook. When passing through nbconvert, a Raw Cell's content is added to the output unmodified."},f.config_defaults={highlight_modes:{diff:{reg:[/^diff/]}}},f.prototype=Object.create(d.prototype),f.prototype.bind_events=function(){d.prototype.bind_events.apply(this);var e=this;this.element.focusout(function(){e.auto_highlight(),e.render()}),this.code_mirror.on("focus",function(){e.unrender()})},f.prototype.render=function(){var e=d.prototype.render.apply(this);if(e){var t=this.get_text();""===t&&(t=this.placeholder),this.set_text(t),this.element.removeClass("rendered"),this.auto_highlight()}return e};var m={TextCell:d,MarkdownCell:p,RawCell:f};return m}),function(){var e=this,t=e._,i={},n=Array.prototype,r=Object.prototype,s=Function.prototype,o=n.push,a=n.slice,l=n.concat,c=r.toString,h=r.hasOwnProperty,u=n.forEach,d=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,_=n.some,v=n.indexOf,b=n.lastIndexOf,y=Array.isArray,x=Object.keys,w=s.bind,k=function(e){return e instanceof k?e:this instanceof k?void(this._wrapped=e):new k(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=k),exports._=k):e._=k,k.VERSION="1.5.2";var C=k.each=k.forEach=function(e,t,n){if(null!=e)if(u&&e.forEach===u)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,s=e.length;s>r;r++)if(t.call(n,e[r],r,e)===i)return}else for(var o=k.keys(e),r=0,s=o.length;s>r;r++)if(t.call(n,e[o[r]],o[r],e)===i)return};k.map=k.collect=function(e,t,i){var n=[];return null==e?n:d&&e.map===d?e.map(t,i):(C(e,function(e,r,s){n.push(t.call(i,e,r,s))}),n)};var T="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,t,i,n){var r=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return n&&(t=k.bind(t,n)),r?e.reduce(t,i):e.reduce(t);if(C(e,function(e,s,o){r?i=t.call(n,i,e,s,o):(i=e,r=!0)}),!r)throw new TypeError(T);return i},k.reduceRight=k.foldr=function(e,t,i,n){var r=arguments.length>2;if(null==e&&(e=[]),f&&e.reduceRight===f)return n&&(t=k.bind(t,n)),r?e.reduceRight(t,i):e.reduceRight(t);var s=e.length;if(s!==+s){var o=k.keys(e);s=o.length}if(C(e,function(a,l,c){l=o?o[--s]:--s,
r?i=t.call(n,i,e[l],l,c):(i=e[l],r=!0)}),!r)throw new TypeError(T);return i},k.find=k.detect=function(e,t,i){var n;return S(e,function(e,r,s){return t.call(i,e,r,s)?(n=e,!0):void 0}),n},k.filter=k.select=function(e,t,i){var n=[];return null==e?n:m&&e.filter===m?e.filter(t,i):(C(e,function(e,r,s){t.call(i,e,r,s)&&n.push(e)}),n)},k.reject=function(e,t,i){return k.filter(e,function(e,n,r){return!t.call(i,e,n,r)},i)},k.every=k.all=function(e,t,n){t||(t=k.identity);var r=!0;return null==e?r:g&&e.every===g?e.every(t,n):(C(e,function(e,s,o){return(r=r&&t.call(n,e,s,o))?void 0:i}),!!r)};var S=k.some=k.any=function(e,t,n){t||(t=k.identity);var r=!1;return null==e?r:_&&e.some===_?e.some(t,n):(C(e,function(e,s,o){return r||(r=t.call(n,e,s,o))?i:void 0}),!!r)};k.contains=k.include=function(e,t){return null==e?!1:v&&e.indexOf===v?-1!=e.indexOf(t):S(e,function(e){return e===t})},k.invoke=function(e,t){var i=a.call(arguments,2),n=k.isFunction(t);return k.map(e,function(e){return(n?t:e[t]).apply(e,i)})},k.pluck=function(e,t){return k.map(e,function(e){return e[t]})},k.where=function(e,t,i){return k.isEmpty(t)?i?void 0:[]:k[i?"find":"filter"](e,function(e){for(var i in t)if(t[i]!==e[i])return!1;return!0})},k.findWhere=function(e,t){return k.where(e,t,!0)},k.max=function(e,t,i){if(!t&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&k.isEmpty(e))return-1/0;var n={computed:-1/0,value:-1/0};return C(e,function(e,r,s){var o=t?t.call(i,e,r,s):e;o>n.computed&&(n={value:e,computed:o})}),n.value},k.min=function(e,t,i){if(!t&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&k.isEmpty(e))return 1/0;var n={computed:1/0,value:1/0};return C(e,function(e,r,s){var o=t?t.call(i,e,r,s):e;o<n.computed&&(n={value:e,computed:o})}),n.value},k.shuffle=function(e){var t,i=0,n=[];return C(e,function(e){t=k.random(i++),n[i-1]=n[t],n[t]=e}),n},k.sample=function(e,t,i){return arguments.length<2||i?e[k.random(e.length-1)]:k.shuffle(e).slice(0,Math.max(0,t))};var M=function(e){return k.isFunction(e)?e:function(t){return t[e]}};k.sortBy=function(e,t,i){var n=M(t);return k.pluck(k.map(e,function(e,t,r){return{value:e,index:t,criteria:n.call(i,e,t,r)}}).sort(function(e,t){var i=e.criteria,n=t.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return e.index-t.index}),"value")};var D=function(e){return function(t,i,n){var r={},s=null==i?k.identity:M(i);return C(t,function(i,o){var a=s.call(n,i,o,t);e(r,a,i)}),r}};k.groupBy=D(function(e,t,i){(k.has(e,t)?e[t]:e[t]=[]).push(i)}),k.indexBy=D(function(e,t,i){e[t]=i}),k.countBy=D(function(e,t){k.has(e,t)?e[t]++:e[t]=1}),k.sortedIndex=function(e,t,i,n){i=null==i?k.identity:M(i);for(var r=i.call(n,t),s=0,o=e.length;o>s;){var a=s+o>>>1;i.call(n,e[a])<r?s=a+1:o=a}return s},k.toArray=function(e){return e?k.isArray(e)?a.call(e):e.length===+e.length?k.map(e,k.identity):k.values(e):[]},k.size=function(e){return null==e?0:e.length===+e.length?e.length:k.keys(e).length},k.first=k.head=k.take=function(e,t,i){return null==e?void 0:null==t||i?e[0]:a.call(e,0,t)},k.initial=function(e,t,i){return a.call(e,0,e.length-(null==t||i?1:t))},k.last=function(e,t,i){return null==e?void 0:null==t||i?e[e.length-1]:a.call(e,Math.max(e.length-t,0))},k.rest=k.tail=k.drop=function(e,t,i){return a.call(e,null==t||i?1:t)},k.compact=function(e){return k.filter(e,k.identity)};var E=function(e,t,i){return t&&k.every(e,k.isArray)?l.apply(i,e):(C(e,function(e){k.isArray(e)||k.isArguments(e)?t?o.apply(i,e):E(e,t,i):i.push(e)}),i)};k.flatten=function(e,t){return E(e,t,[])},k.without=function(e){return k.difference(e,a.call(arguments,1))},k.uniq=k.unique=function(e,t,i,n){k.isFunction(t)&&(n=i,i=t,t=!1);var r=i?k.map(e,i,n):e,s=[],o=[];return C(r,function(i,n){(t?n&&o[o.length-1]===i:k.contains(o,i))||(o.push(i),s.push(e[n]))}),s},k.union=function(){return k.uniq(k.flatten(arguments,!0))},k.intersection=function(e){var t=a.call(arguments,1);return k.filter(k.uniq(e),function(e){return k.every(t,function(t){return k.indexOf(t,e)>=0})})},k.difference=function(e){var t=l.apply(n,a.call(arguments,1));return k.filter(e,function(e){return!k.contains(t,e)})},k.zip=function(){for(var e=k.max(k.pluck(arguments,"length").concat(0)),t=new Array(e),i=0;e>i;i++)t[i]=k.pluck(arguments,""+i);return t},k.object=function(e,t){if(null==e)return{};for(var i={},n=0,r=e.length;r>n;n++)t?i[e[n]]=t[n]:i[e[n][0]]=e[n][1];return i},k.indexOf=function(e,t,i){if(null==e)return-1;var n=0,r=e.length;if(i){if("number"!=typeof i)return n=k.sortedIndex(e,t),e[n]===t?n:-1;n=0>i?Math.max(0,r+i):i}if(v&&e.indexOf===v)return e.indexOf(t,i);for(;r>n;n++)if(e[n]===t)return n;return-1},k.lastIndexOf=function(e,t,i){if(null==e)return-1;var n=null!=i;if(b&&e.lastIndexOf===b)return n?e.lastIndexOf(t,i):e.lastIndexOf(t);for(var r=n?i:e.length;r--;)if(e[r]===t)return r;return-1},k.range=function(e,t,i){arguments.length<=1&&(t=e||0,e=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((t-e)/i),0),r=0,s=new Array(n);n>r;)s[r++]=e,e+=i;return s};var L=function(){};k.bind=function(e,t){var i,n;if(w&&e.bind===w)return w.apply(e,a.call(arguments,1));if(!k.isFunction(e))throw new TypeError;return i=a.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,i.concat(a.call(arguments)));L.prototype=e.prototype;var r=new L;L.prototype=null;var s=e.apply(r,i.concat(a.call(arguments)));return Object(s)===s?s:r}},k.partial=function(e){var t=a.call(arguments,1);return function(){return e.apply(this,t.concat(a.call(arguments)))}},k.bindAll=function(e){var t=a.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return C(t,function(t){e[t]=k.bind(e[t],e)}),e},k.memoize=function(e,t){var i={};return t||(t=k.identity),function(){var n=t.apply(this,arguments);return k.has(i,n)?i[n]:i[n]=e.apply(this,arguments)}},k.delay=function(e,t){var i=a.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},k.defer=function(e){return k.delay.apply(k,[e,1].concat(a.call(arguments,1)))},k.throttle=function(e,t,i){var n,r,s,o=null,a=0;i||(i={});var l=function(){a=i.leading===!1?0:new Date,o=null,s=e.apply(n,r)};return function(){var c=new Date;a||i.leading!==!1||(a=c);var h=t-(c-a);return n=this,r=arguments,0>=h?(clearTimeout(o),o=null,a=c,s=e.apply(n,r)):o||i.trailing===!1||(o=setTimeout(l,h)),s}},k.debounce=function(e,t,i){var n,r,s,o,a;return function(){s=this,r=arguments,o=new Date;var l=function(){var c=new Date-o;t>c?n=setTimeout(l,t-c):(n=null,i||(a=e.apply(s,r)))},c=i&&!n;return n||(n=setTimeout(l,t)),c&&(a=e.apply(s,r)),a}},k.once=function(e){var t,i=!1;return function(){return i?t:(i=!0,t=e.apply(this,arguments),e=null,t)}},k.wrap=function(e,t){return function(){var i=[e];return o.apply(i,arguments),t.apply(this,i)}},k.compose=function(){var e=arguments;return function(){for(var t=arguments,i=e.length-1;i>=0;i--)t=[e[i].apply(this,t)];return t[0]}},k.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},k.keys=x||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var i in e)k.has(e,i)&&t.push(i);return t},k.values=function(e){for(var t=k.keys(e),i=t.length,n=new Array(i),r=0;i>r;r++)n[r]=e[t[r]];return n},k.pairs=function(e){for(var t=k.keys(e),i=t.length,n=new Array(i),r=0;i>r;r++)n[r]=[t[r],e[t[r]]];return n},k.invert=function(e){for(var t={},i=k.keys(e),n=0,r=i.length;r>n;n++)t[e[i[n]]]=i[n];return t},k.functions=k.methods=function(e){var t=[];for(var i in e)k.isFunction(e[i])&&t.push(i);return t.sort()},k.extend=function(e){return C(a.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},k.pick=function(e){var t={},i=l.apply(n,a.call(arguments,1));return C(i,function(i){i in e&&(t[i]=e[i])}),t},k.omit=function(e){var t={},i=l.apply(n,a.call(arguments,1));for(var r in e)k.contains(i,r)||(t[r]=e[r]);return t},k.defaults=function(e){return C(a.call(arguments,1),function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])}),e},k.clone=function(e){return k.isObject(e)?k.isArray(e)?e.slice():k.extend({},e):e},k.tap=function(e,t){return t(e),e};var P=function(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof k&&(e=e._wrapped),t instanceof k&&(t=t._wrapped);var r=c.call(e);if(r!=c.call(t))return!1;switch(r){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var s=i.length;s--;)if(i[s]==e)return n[s]==t;var o=e.constructor,a=t.constructor;if(o!==a&&!(k.isFunction(o)&&o instanceof o&&k.isFunction(a)&&a instanceof a))return!1;i.push(e),n.push(t);var l=0,h=!0;if("[object Array]"==r){if(l=e.length,h=l==t.length)for(;l--&&(h=P(e[l],t[l],i,n)););}else{for(var u in e)if(k.has(e,u)&&(l++,!(h=k.has(t,u)&&P(e[u],t[u],i,n))))break;if(h){for(u in t)if(k.has(t,u)&&!l--)break;h=!l}}return i.pop(),n.pop(),h};k.isEqual=function(e,t){return P(e,t,[],[])},k.isEmpty=function(e){if(null==e)return!0;if(k.isArray(e)||k.isString(e))return 0===e.length;for(var t in e)if(k.has(e,t))return!1;return!0},k.isElement=function(e){return!(!e||1!==e.nodeType)},k.isArray=y||function(e){return"[object Array]"==c.call(e)},k.isObject=function(e){return e===Object(e)},C(["Arguments","Function","String","Number","Date","RegExp"],function(e){k["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),k.isArguments(arguments)||(k.isArguments=function(e){return!(!e||!k.has(e,"callee"))}),"function"!=typeof/./&&(k.isFunction=function(e){return"function"==typeof e}),k.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},k.isNaN=function(e){return k.isNumber(e)&&e!=+e},k.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},k.isNull=function(e){return null===e},k.isUndefined=function(e){return void 0===e},k.has=function(e,t){return h.call(e,t)},k.noConflict=function(){return e._=t,this},k.identity=function(e){return e},k.times=function(e,t,i){for(var n=Array(Math.max(0,e)),r=0;e>r;r++)n[r]=t.call(i,r);return n},k.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var A={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};A.unescape=k.invert(A.escape);var I={escape:new RegExp("["+k.keys(A.escape).join("")+"]","g"),unescape:new RegExp("("+k.keys(A.unescape).join("|")+")","g")};k.each(["escape","unescape"],function(e){k[e]=function(t){return null==t?"":(""+t).replace(I[e],function(t){return A[e][t]})}}),k.result=function(e,t){if(null!=e){var i=e[t];return k.isFunction(i)?i.call(e):i}},k.mixin=function(e){C(k.functions(e),function(t){var i=k[t]=e[t];k.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),$.call(this,i.apply(k,e))}})};var O=0;k.uniqueId=function(e){var t=++O+"";return e?e+t:t},k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var j=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;k.template=function(e,t,i){var n;i=k.defaults({},i,k.templateSettings);var r=new RegExp([(i.escape||j).source,(i.interpolate||j).source,(i.evaluate||j).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(r,function(t,i,n,r,a){return o+=e.slice(s,a).replace(N,function(e){return"\\"+z[e]}),i&&(o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(o+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+t.length,t}),o+="';\n",i.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{n=new Function(i.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(t)return n(t,k);var l=function(e){return n.call(this,e,k)};return l.source="function("+(i.variable||"obj")+"){\n"+o+"}",l},k.chain=function(e){return k(e).chain()};var $=function(e){return this._chain?k(e).chain():e};k.mixin(k),C(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];k.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!=e&&"splice"!=e||0!==i.length||delete i[0],$.call(this,i)}}),C(["concat","join","slice"],function(e){var t=n[e];k.prototype[e]=function(){return $.call(this,t.apply(this._wrapped,arguments))}}),k.extend(k.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(e){return function(){var t;return t||e._}}(this)),define("base/js/keyboard",["jquery","base/js/utils","underscore"],function(e,t,i){"use strict";var n={a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,"1 !":49,"2 @":50,"3 #":51,"4 $":52,"5 %":53,"6 ^":54,"7 &":55,"8 *":56,"9 (":57,"0 )":48,"[ {":219,"] }":221,"` ~":192,", <":188,". >":190,"/ ?":191,"\\ |":220,"' \"":222,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,subtract:109,decimal:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f11:122,f12:123,f13:124,f14:125,f15:126,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,meta:91,capslock:20,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,numlock:144},r={"; :":59,"= +":61,"- _":173,meta:224},s={"; :":186,"= +":187,"- _":189},o=t.browser[0],a=t.platform;"Firefox"===o||"Opera"===o||"Netscape"===o?e.extend(n,r):("Safari"===o||"Chrome"===o||"MSIE"===o)&&e.extend(n,s);var l={},c={};for(var h in n){var u=h.split(" ");if(1===u.length){var d=u[0];l[d]=n[d],c[n[d]]=d}else{var p=u[0],f=u[1];l[p]=n[h],l[f]=n[h],c[n[h]]=p}}var m=function(e){return c[l[e]]},g=function(e){if(e="MacOS"===a?e.toLowerCase().replace("cmdtrl-","cmd-"):e.toLowerCase().replace("cmdtrl-","ctrl-"),e=e.toLowerCase().replace("cmd","meta"),e=e.replace(/-$/,"_"),e=e.replace(/,$/,"comma"),-1!==e.indexOf(",")){var t=e.split(",");return t=i.map(t,g),e}e=e.replace(/comma/g,",");var n=e.split("-");if(1===n.length)return m(n[0]);var r=n.slice(0,-1),s=m(n[n.length-1]);return r.sort(),r.join("-")+"-"+s},_=function(t,i){i=i||"keydown",t=g(t),t=t.replace(/-$/,"_");var n=t.split("-"),r=n.slice(0,-1),s=n[n.length-1],o={which:l[s]};return-1!==r.indexOf("alt")&&(o.altKey=!0),-1!==r.indexOf("ctrl")&&(o.ctrlKey=!0),-1!==r.indexOf("meta")&&(o.metaKey=!0),-1!==r.indexOf("shift")&&(o.shiftKey=!0),e.Event(i,o)},v=function(e){var t=c[e.which];return(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&("alt"===t||"ctrl"===t||"meta"===t||"shift"===t)},b=function(e){var t="",i=c[e.which];return e.altKey&&"alt"!==i&&(t+="alt-"),e.ctrlKey&&"ctrl"!==i&&(t+="ctrl-"),e.metaKey&&"meta"!==i&&(t+="meta-"),e.shiftKey&&"shift"!==i&&(t+="shift-"),t+=i},y=function(e,t,i,n){this._shortcuts={},this.delay=e||800,this.events=t,this.actions=i,this.actions.extend_env(n),this._queue=[],this._cleartimeout=null,Object.seal(this)};y.prototype.clearsoon=function(){var e=this;clearTimeout(this._cleartimeout),this._cleartimeout=setTimeout(function(){e.clearqueue()},this.delay)},y.prototype.clearqueue=function(){this._queue=[],clearTimeout(this._cleartimeout)};var x=function(e){var t={};for(var i in e){var n=e[i];if("string"==typeof n)t[i]=n;else{var r=x(n);for(var s in r)t[i+","+s]=r[s]}}return t};y.prototype.help=function(){var e=[],t=x(this._shortcuts);for(var i in t){var n=this.actions.get(t[i]),r=n.help||"== no help ==",s=n.help_index;if(r){var o=n.shortstring||i;e.push({shortcut:o,help:r,help_index:s})}}return e.sort(function(e,t){return e.help_index===t.help_index?0:void 0===e.help_index||e.help_index>t.help_index?1:-1}),e},y.prototype.clear_shortcuts=function(){this._shortcuts={}},y.prototype.get_shortcut=function(e){return"string"==typeof e&&(e=e.split(",")),this._get_leaf(e,this._shortcuts)},y.prototype._get_leaf=function(e,t){return 1===e.length?t[e[0]]:"string"!=typeof t[e[0]]?this._get_leaf(e.slice(1),t[e[0]]):null},y.prototype.set_shortcut=function(e,t){if("string"!=typeof t)throw new Error("action is not a string",t);return"string"==typeof e&&(e=e.split(",")),this._set_leaf(e,t,this._shortcuts)},y.prototype._is_leaf=function(e,t){if(1===e.length)return"string"==typeof t[e[0]];var i=t[e[0]];return this._is_leaf(e.slice(1),i)},y.prototype._remove_leaf=function(e,t,n){if(1===e.length){var r=t[e[0]];if("string"!=typeof r)throw"try to delete non-leaf";delete t[e[0]]}else this._remove_leaf(e.slice(1),t[e[0]],n),0===i.keys(t[e[0]]).length&&delete t[e[0]]},y.prototype._set_leaf=function(e,t,i){var n=i[e[0]];return 1===e.length?(void 0!==n&&"string"!=typeof n&&console.warn("[warning], you are overriting a long shortcut with a shorter one"),i[e[0]]=t,!0):"string"==typeof n?(console.warn("you are trying to set a shortcut that will be shadowedby a more specific one. Aborting for :",t,"the follwing will take precedence",n),!1):(i[e[0]]=i[e[0]]||{},this._set_leaf(e.slice(1),t,i[e[0]]),!0)},y.prototype.add_shortcut=function(e,t,i){var n=this.actions.get_name(t);if(!n)throw new Error("does not know how to deal with",t);e=g(e),this.set_shortcut(e,n),i||this.events.trigger("rebuild.QuickHelp")},y.prototype.add_shortcuts=function(e){for(var t in e)this.add_shortcut(t,e[t],!0);this.events.trigger("rebuild.QuickHelp")},y.prototype.remove_shortcut=function(e,t){e=g(e),"string"==typeof e&&(e=e.split(","));try{this._remove_leaf(e,this._shortcuts),t||this.events.trigger("rebuild.QuickHelp")}catch(i){throw new Error("trying to remove a non-existent shortcut",e)}},y.prototype.call_handler=function(e){if(this.clearsoon(),v(e))return!0;var t=b(e);this._queue.push(t);var i=this.get_shortcut(this._queue);return"undefined"==typeof i||null===i?(this.clearqueue(),!0):this.actions.exists(i)?(e.preventDefault(),this.clearqueue(),this.actions.call(i,e)):!1},y.prototype.handles=function(e){var t=b(e),i=this.get_shortcut(this._queue.concat(t));return"undefined"!=typeof i};var w={keycodes:l,inv_keycodes:c,ShortcutManager:y,normalize_key:m,normalize_shortcut:g,shortcut_to_event:_,event_to_shortcut:b};return w}),function(e,t){function i(t,i){var r,s,o,a=t.nodeName.toLowerCase();return"area"===a?(r=t.parentNode,s=r.name,t.href&&s&&"map"===r.nodeName.toLowerCase()?(o=e("img[usemap=#"+s+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(a)?!t.disabled:"a"===a?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var r=0,s=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,r,s=e(this[0]);s.length&&s[0]!==document;){if(n=s.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(r=parseInt(s.css("zIndex"),10),!isNaN(r)&&0!==r))return r;s=s.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++r)})},removeUniqueId:function(){return this.each(function(){s.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function r(t,i,n,r){return e.each(s,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),r&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var s="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),a={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?a["inner"+n].call(this):this.each(function(){e(this).css(o,r(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?a["outer"+n].call(this,t):this.each(function(){e(this).css(o,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(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var r,s=e.ui[t].prototype;for(r in n)s.plugins[r]=s.plugins[r]||[],s.plugins[r].push([i,n[r]])},call:function(e,t,i){var n,r=e.plugins[t];if(r&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;r.length>n;n++)e.options[r[n][0]]&&r[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",r=!1;return t[n]>0?!0:(t[n]=1,r=t[n]>0,t[n]=0,r)}})}(jQuery),function(e,t){var i=0,n=Array.prototype.slice,r=e.cleanData;e.cleanData=function(t){for(var i,n=0;null!=(i=t[n]);n++)try{e(i).triggerHandler("remove")}catch(s){}r(t)},e.widget=function(i,n,r){var s,o,a,l,c={},h=i.split(".")[0];i=i.split(".")[1],s=h+"-"+i,r||(r=n,n=e.Widget),e.expr[":"][s.toLowerCase()]=function(t){return!!e.data(t,s)},e[h]=e[h]||{},o=e[h][i],a=e[h][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new a(e,i)},e.extend(a,o,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),l=new n,l.options=e.widget.extend({},l.options),e.each(r,function(i,r){return e.isFunction(r)?(c[i]=function(){var e=function(){return n.prototype[i].apply(this,arguments)},t=function(e){return n.prototype[i].apply(this,e)};return function(){var i,n=this._super,s=this._superApply;return this._super=e,this._superApply=t,i=r.apply(this,arguments),this._super=n,this._superApply=s,i}}(),t):(c[i]=r,t)}),a.prototype=e.widget.extend(l,{widgetEventPrefix:o?l.widgetEventPrefix||i:i},c,{constructor:a,namespace:h,widgetName:i,widgetFullName:s}),o?(e.each(o._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,a,i._proto)}),delete o._childConstructors):n._childConstructors.push(a),e.widget.bridge(i,a)},e.widget.extend=function(i){for(var r,s,o=n.call(arguments,1),a=0,l=o.length;l>a;a++)for(r in o[a])s=o[a][r],o[a].hasOwnProperty(r)&&s!==t&&(i[r]=e.isPlainObject(s)?e.isPlainObject(i[r])?e.widget.extend({},i[r],s):e.widget.extend({},s):s);return i},e.widget.bridge=function(i,r){var s=r.prototype.widgetFullName||i;e.fn[i]=function(o){var a="string"==typeof o,l=n.call(arguments,1),c=this;return o=!a&&l.length?e.widget.extend.apply(null,[o].concat(l)):o,a?this.each(function(){var n,r=e.data(this,s);return r?e.isFunction(r[o])&&"_"!==o.charAt(0)?(n=r[o].apply(r,l),n!==r&&n!==t?(c=n&&n.jquery?c.pushStack(n.get()):n,!1):t):e.error("no such method '"+o+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; attempted to call method '"+o+"'")}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():e.data(this,s,new r(o,this))}),c}},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=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),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._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.widgetName).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(i,n){var r,s,o,a=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(a={},r=i.split("."),i=r.shift(),r.length){for(s=a[i]=e.widget.extend({},this.options[i]),o=0;r.length-1>o;o++)s[r[o]]=s[r[o]]||{},s=s[r[o]];if(i=r.pop(),1===arguments.length)return s[i]===t?null:s[i];s[i]=n}else{if(1===arguments.length)return this.options[i]===t?null:this.options[i];a[i]=n}return this._setOptions(a),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 ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,n,r){var s,o=this;"boolean"!=typeof i&&(r=n,n=i,i=!1),r?(n=s=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,s=this.widget()),e.each(r,function(r,a){function l(){return i||o.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):t}"string"!=typeof a&&(l.guid=a.guid=a.guid||l.guid||e.guid++);var c=r.match(/^(\w+)\s*(.*)$/),h=c[1]+o.eventNamespace,u=c[2];u?s.delegate(u,h,l):n.bind(h,l)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(i,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,i,n){var r,s,o=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],s=i.originalEvent)for(r in s)r in i||(i[r]=s[r]);return this.element.trigger(i,n),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,r,s){"string"==typeof r&&(r={effect:r});var o,a=r?r===!0||"number"==typeof r?i:r.effect||i:t;r=r||{},"number"==typeof r&&(r={duration:r}),o=!e.isEmptyObject(r),r.complete=s,r.delay&&n.delay(r.delay),o&&e.effects&&e.effects.effect[a]?n[t](r):a!==t&&n[a]?n[a](r.duration,r.easing,s):n.queue(function(i){e(this)[t](),s&&s.call(n[0]),i()})}})}(jQuery),function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.4",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(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var n=this,r=1===i.which,s="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return r&&!s&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):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 e(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)),!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}})}(jQuery),function(e,t){function i(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function n(t,i){return parseInt(e.css(t,i),10)||0}function r(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()
}}e.ui=e.ui||{};var s,o=Math.max,a=Math.abs,l=Math.round,c=/left|center|right/,h=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(s!==t)return s;var i,n,r=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=r.children()[0];return e("body").append(r),i=o.offsetWidth,r.css("overflow","scroll"),n=o.offsetWidth,i===n&&(n=r[0].clientWidth),r.remove(),s=i-n},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),n=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),r="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,s="scroll"===n||"auto"===n&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:r?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),n=e.isWindow(i[0]),r=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:n,isDocument:r,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return f.apply(this,arguments);t=e.extend({},t);var s,p,m,g,_,v,b=e(t.of),y=e.position.getWithinInfo(t.within),x=e.position.getScrollInfo(y),w=(t.collision||"flip").split(" "),k={};return v=r(b),b[0].preventDefault&&(t.at="left top"),p=v.width,m=v.height,g=v.offset,_=e.extend({},g),e.each(["my","at"],function(){var e,i,n=(t[this]||"").split(" ");1===n.length&&(n=c.test(n[0])?n.concat(["center"]):h.test(n[0])?["center"].concat(n):["center","center"]),n[0]=c.test(n[0])?n[0]:"center",n[1]=h.test(n[1])?n[1]:"center",e=u.exec(n[0]),i=u.exec(n[1]),k[this]=[e?e[0]:0,i?i[0]:0],t[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===t.at[0]?_.left+=p:"center"===t.at[0]&&(_.left+=p/2),"bottom"===t.at[1]?_.top+=m:"center"===t.at[1]&&(_.top+=m/2),s=i(k.at,p,m),_.left+=s[0],_.top+=s[1],this.each(function(){var r,c,h=e(this),u=h.outerWidth(),d=h.outerHeight(),f=n(this,"marginLeft"),v=n(this,"marginTop"),C=u+f+n(this,"marginRight")+x.width,T=d+v+n(this,"marginBottom")+x.height,S=e.extend({},_),M=i(k.my,h.outerWidth(),h.outerHeight());"right"===t.my[0]?S.left-=u:"center"===t.my[0]&&(S.left-=u/2),"bottom"===t.my[1]?S.top-=d:"center"===t.my[1]&&(S.top-=d/2),S.left+=M[0],S.top+=M[1],e.support.offsetFractions||(S.left=l(S.left),S.top=l(S.top)),r={marginLeft:f,marginTop:v},e.each(["left","top"],function(i,n){e.ui.position[w[i]]&&e.ui.position[w[i]][n](S,{targetWidth:p,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:r,collisionWidth:C,collisionHeight:T,offset:[s[0]+M[0],s[1]+M[1]],my:t.my,at:t.at,within:y,elem:h})}),t.using&&(c=function(e){var i=g.left-S.left,n=i+p-u,r=g.top-S.top,s=r+m-d,l={target:{element:b,left:g.left,top:g.top,width:p,height:m},element:{element:h,left:S.left,top:S.top,width:u,height:d},horizontal:0>n?"left":i>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};u>p&&p>a(i+n)&&(l.horizontal="center"),d>m&&m>a(r+s)&&(l.vertical="middle"),l.important=o(a(i),a(n))>o(a(r),a(s))?"horizontal":"vertical",t.using.call(this,e,l)}),h.offset(e.extend(S,{using:c}))})},e.ui.position={fit:{left:function(e,t){var i,n=t.within,r=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,a=e.left-t.collisionPosition.marginLeft,l=r-a,c=a+t.collisionWidth-s-r;t.collisionWidth>s?l>0&&0>=c?(i=e.left+l+t.collisionWidth-s-r,e.left+=l-i):e.left=c>0&&0>=l?r:l>c?r+s-t.collisionWidth:r:l>0?e.left+=l:c>0?e.left-=c:e.left=o(e.left-a,e.left)},top:function(e,t){var i,n=t.within,r=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,a=e.top-t.collisionPosition.marginTop,l=r-a,c=a+t.collisionHeight-s-r;t.collisionHeight>s?l>0&&0>=c?(i=e.top+l+t.collisionHeight-s-r,e.top+=l-i):e.top=c>0&&0>=l?r:l>c?r+s-t.collisionHeight:r:l>0?e.top+=l:c>0?e.top-=c:e.top=o(e.top-a,e.top)}},flip:{left:function(e,t){var i,n,r=t.within,s=r.offset.left+r.scrollLeft,o=r.width,l=r.isWindow?r.scrollLeft:r.offset.left,c=e.left-t.collisionPosition.marginLeft,h=c-l,u=c+t.collisionWidth-o-l,d="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,f=-2*t.offset[0];0>h?(i=e.left+d+p+f+t.collisionWidth-o-s,(0>i||a(h)>i)&&(e.left+=d+p+f)):u>0&&(n=e.left-t.collisionPosition.marginLeft+d+p+f-l,(n>0||u>a(n))&&(e.left+=d+p+f))},top:function(e,t){var i,n,r=t.within,s=r.offset.top+r.scrollTop,o=r.height,l=r.isWindow?r.scrollTop:r.offset.top,c=e.top-t.collisionPosition.marginTop,h=c-l,u=c+t.collisionHeight-o-l,d="top"===t.my[1],p=d?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>h?(n=e.top+p+f+m+t.collisionHeight-o-s,e.top+p+f+m>h&&(0>n||a(h)>n)&&(e.top+=p+f+m)):u>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-l,e.top+p+f+m>u&&(i>0||u>a(i))&&(e.top+=p+f+m))}},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,i,n,r,s,o=document.getElementsByTagName("body")[0],a=document.createElement("div");t=document.createElement(o?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in n)t.style[s]=n[s];t.appendChild(a),i=o||document.documentElement,i.insertBefore(t,i.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",r=e(a).offset().left,e.support.offsetFractions=r>10&&11>r,t.innerHTML="",i.removeChild(t)}()}(jQuery),function(e){var t=0,i={},n={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",n.height=n.paddingTop=n.paddingBottom=n.borderTopWidth=n.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.4",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},_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(),content: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-helper-reset 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").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?void this._activate(t):("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()),void("disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)))},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,n=this.headers.length,r=this.headers.index(t.target),s=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:s=this.headers[(r+1)%n];break;case i.LEFT:case i.UP:s=this.headers[(r-1+n)%n];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:s=this.headers[0];break;case i.END:s=this.headers[n-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(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,n=this.options,r=n.heightStyle,s=this.element.parent(),o=this.accordionId="ui-accordion-"+(this.element.attr("id")||++t);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(t){var i=e(this),n=i.attr("id"),r=i.next(),s=r.attr("id");n||(n=o+"-header-"+t,i.attr("id",n)),s||(s=o+"-panel-"+t,r.attr("id",s)),i.attr("aria-controls",s),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?(i=s.height(),this.element.siblings(":visible").each(function(){var t=e(this),n=t.css("position");"absolute"!==n&&"fixed"!==n&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===r&&(i=0,this.headers.next().each(function(){i=Math.max(i,e(this).css("height","").height())}).height(i))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,n=this.active,r=e(t.currentTarget),s=r[0]===n[0],o=s&&i.collapsible,a=o?e():r.next(),l=n.next(),c={oldHeader:n,oldPanel:l,newHeader:o?e():r,newPanel:a};t.preventDefault(),s&&!i.collapsible||this._trigger("beforeActivate",t,c)===!1||(i.active=o?!1:this.headers.index(r),this.active=s?e():r,this._toggle(c),n.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),s||(r.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&r.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),r.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,n=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=n,this.options.animate?this._animate(i,n,t):(n.hide(),i.show(),this._toggleComplete(t)),n.attr({"aria-hidden":"true"}),n.prev().attr("aria-selected","false"),i.length&&n.length?n.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,r){var s,o,a,l=this,c=0,h=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=h&&u.down||u,p=function(){l._toggleComplete(r)};return"number"==typeof d&&(a=d),"string"==typeof d&&(o=d),o=o||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(i,{duration:a,easing:o,step:function(e,t){t.now=Math.round(e)}}),void e.hide().animate(n,{duration:a,easing:o,complete:p,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?c+=i.now:"content"!==l.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-c),c=0)}})):t.animate(i,a,o,p):e.animate(n,a,o,p)},_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)}})}(jQuery),function(e){e.widget("ui.autocomplete",{version:"1.10.4",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,i,n,r=this.element[0].nodeName.toLowerCase(),s="textarea"===r,o="input"===r;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(r){if(this.element.prop("readOnly"))return t=!0,n=!0,void(i=!0);t=!1,n=!1,i=!1;var s=e.ui.keyCode;switch(r.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",r);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",r);break;case s.UP:t=!0,this._keyEvent("previous",r);break;case s.DOWN:t=!0,this._keyEvent("next",r);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,r.preventDefault(),this.menu.select(r));break;case s.TAB:this.menu.active&&this.menu.select(r);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(r),r.preventDefault());break;default:i=!0,this._searchTimeout(r)}},keypress:function(n){if(t)return t=!1,void((!this.isMultiLine||this.menu.element.is(":visible"))&&n.preventDefault());if(!i){var r=e.ui.keyCode;switch(n.keyCode){case r.PAGE_UP:this._move("previousPage",n);break;case r.PAGE_DOWN:this._move("nextPage",n);break;case r.UP:this._keyEvent("previous",n);break;case r.DOWN:this._keyEvent("next",n)}}},input:function(e){return n?(n=!1,void e.preventDefault()):void this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(e),void this._change(e))}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(n){n.target===t.element[0]||n.target===i||e.contains(i,n.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});var n=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",t,{item:n})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value):this.liveRegion.text(n.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),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=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,n=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,n){n(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,r){n.xhr&&n.xhr.abort(),n.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){r(e)},error:function(){r([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(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({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.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,i){var n=this;e.each(i,function(e,i){n._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.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._value(this.term),void this.menu.blur()):void this.menu[e](t):void this.search(null,t)},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,i){var n=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return n.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(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})}(jQuery),function(e){var t,i="ui-button ui-widget ui-state-default ui-corner-all",n="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",r=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},s=function(t){var i=t.name,n=t.form,r=e([]);return i&&(i=i.replace(/'/g,"\\'"),r=n?e(n).find("[name='"+i+"']"):e("[name='"+i+"']",t.ownerDocument).filter(function(){return!this.form})),r};e.widget("ui.button",{version:"1.10.4",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,r),"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 n=this,o=this.options,a="checkbox"===this.type||"radio"===this.type,l=a?"":"ui-state-active";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(i).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===t&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(l)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),a&&this.element.bind("change"+this.eventNamespace,function(){n.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled)return!1;e(this).addClass("ui-state-active"),n.buttonElement.attr("aria-pressed","true");var t=n.element[0];s(t).not(t).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),t=this,void n.document.one("mouseup",function(){t=null}))}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:void e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:void((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"))}).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",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;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"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(i+" ui-state-active "+n).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.element.prop("disabled",!!t),void(t&&this.buttonElement.removeClass("ui-state-focus"))):void this._resetButton()},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?s(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 void(this.options.label&&this.element.val(this.options.label));var t=this.buttonElement.removeClass(n),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,s=r.primary&&r.secondary,o=[];r.primary||r.secondary?(this.options.text&&o.push("ui-button-text-icon"+(s?"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||(o.push(s?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):o.push("ui-button-text-only"),t.addClass(o.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.4",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");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().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")}})}(jQuery),function(e,t){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.dpDiv=n(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"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(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(s.inline?t.parent()[0]:s.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 r(t,i){e.extend(t,i);for(var n in i)null==i[n]&&(t[n]=i[n]);return t}e.extend(e.ui,{datepicker:{version:"1.10.4"}});var s,o="datepicker";e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var n,r,s;n=t.nodeName.toLowerCase(),r="div"===n||"span"===n,t.id||(this.uuid+=1,t.id="dp"+this.uuid),s=this._newInst(e(t),r),s.settings=e.extend({},i||{}),"input"===n?this._connectDatepicker(t,s):r&&this._inlineDatepicker(t,s)},_newInst:function(t,i){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:i,dpDiv:i?n(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var n=e(t);i.append=e([]),i.trigger=e([]),n.hasClass(this.markerClassName)||(this._attachments(n,i),
n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,o,i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var n,r,s,o=this._get(i,"appendText"),a=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[a?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),n=this._get(i,"showOn"),("focus"===n||"both"===n)&&t.focus(this._showDatepicker),("button"===n||"both"===n)&&(r=this._get(i,"buttonText"),s=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:s,alt:r,title:r}):e("<button type='button'></button>").addClass(this._triggerClass).html(s?e("<img/>").attr({src:s,alt:r,title:r}):r)),t[a?"before":"after"](i.trigger),i.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,i,n,r,s=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,n=0,r=0;e.length>r;r++)e[r].length>i&&(i=e[r].length,n=r);return n},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,i){var n=e(t);n.hasClass(this.markerClassName)||(n.addClass(this.markerClassName).append(i.dpDiv),e.data(t,o,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,n,s,a){var l,c,h,u,d,p=this._dialogInst;return p||(this.uuid+=1,l="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+l+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},e.data(this._dialogInput[0],o,p)),r(p.settings,s||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(c=document.documentElement.clientWidth,h=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[c/2-100+u,h/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],o,p),this},_destroyDatepicker:function(t){var i,n=e(t),r=e.data(t,o);n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,o),"input"===i?(r.append.remove(),r.trigger.remove(),n.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&n.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,n,r=e(t),s=e.data(t,o);r.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(n=r.children("."+this._inlineClass),n.children().removeClass("ui-state-disabled"),n.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 i,n,r=e(t),s=e.data(t,o);r.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(n=r.children("."+this._inlineClass),n.children().addClass("ui-state-disabled"),n.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,o)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,n,s){var o,a,l,c,h=this._getInst(i);return 2===arguments.length&&"string"==typeof n?"defaults"===n?e.extend({},e.datepicker._defaults):h?"all"===n?e.extend({},h.settings):this._get(h,n):null:(o=n||{},"string"==typeof n&&(o={},o[n]=s),h&&(this._curInst===h&&this._hideDatepicker(),a=this._getDateDatepicker(i,!0),l=this._getMinMaxDate(h,"min"),c=this._getMinMaxDate(h,"max"),r(h.settings,o),null!==l&&o.dateFormat!==t&&o.minDate===t&&(h.settings.minDate=this._formatDate(h,l)),null!==c&&o.dateFormat!==t&&o.maxDate===t&&(h.settings.maxDate=this._formatDate(h,c)),"disabled"in o&&(o.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(e(i),h),this._autoSize(h),this._setDate(h,a),this._updateAlternate(h),this._updateDatepicker(h)),t)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,n,r,s=e.datepicker._getInst(t.target),o=!0,a=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 r=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",s.dpDiv),r[0]&&e.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,r[0]),i=e.datepicker._get(s,"onSelect"),i?(n=e.datepicker._formatDate(s),i.apply(s.input?s.input[0]:null,[n,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,a?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,a?-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(i){var n,r,s=e.datepicker._getInst(i.target);return e.datepicker._get(s,"constrainInput")?(n=e.datepicker._possibleChars(e.datepicker._get(s,"dateFormat")),r=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">r||!n||n.indexOf(r)>-1):t},_doKeyUp:function(t){var i,n=e.datepicker._getInst(t.target);if(n.input.val()!==n.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(n,"dateFormat"),n.input?n.input.val():null,e.datepicker._getFormatConfig(n)),i&&(e.datepicker._setDateFromField(n),e.datepicker._updateAlternate(n),e.datepicker._updateDatepicker(n))}catch(r){}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 i,n,s,o,a,l,c;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),s=n?n.apply(t,[t,i]):{},s!==!1&&(r(i.settings,s),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),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,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),a=e.datepicker._checkOffset(i,a,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),c=e.datepicker._get(i,"duration"),i.dpDiv.zIndex(e(t).zIndex()+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),c):i.dpDiv[l||"show"](l?c:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,s=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,n=this._getNumberOfMonths(t),r=n[1],o=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),r>1&&t.dpDiv.addClass("ui-datepicker-multi-"+r).css("width",o*r+"em"),t.dpDiv[(1!==n[0]||1!==n[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&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=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,i,n){var r=t.dpDiv.outerWidth(),s=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,l=document.documentElement.clientWidth+(n?0:e(document).scrollLeft()),c=document.documentElement.clientHeight+(n?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?r-o:0,i.left-=n&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=n&&i.top===t.input.offset().top+a?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+r>l&&l>r?Math.abs(i.left+r-l):0),i.top-=Math.min(i.top,i.top+s>c&&c>s?Math.abs(s+a):0),i},_findPos:function(t){for(var i,n=this._getInst(t),r=this._get(n,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[r?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,n,r,s,a=this._curInst;!a||t&&a!==e.data(t,o)||this._datepickerShowing&&(i=this._get(a,"showAnim"),n=this._get(a,"duration"),r=function(){e.datepicker._tidyDialog(a)},e.effects&&(e.effects.effect[i]||e.effects[i])?a.dpDiv.hide(i,e.datepicker._get(a,"showOptions"),n,r):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?n:null,r),i||r(),this._datepickerShowing=!1,s=this._get(a,"onClose"),s&&s.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),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 i=e(t.target),n=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==n)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,n){var r=e(t),s=this._getInst(r[0]);this._isDisabledDatepicker(r[0])||(this._adjustInstDate(s,i+("M"===n?this._get(s,"showCurrentAtPos"):0),n),this._updateDatepicker(s))},_gotoToday:function(t){var i,n=e(t),r=this._getInst(n[0]);this._get(r,"gotoCurrent")&&r.currentDay?(r.selectedDay=r.currentDay,r.drawMonth=r.selectedMonth=r.currentMonth,r.drawYear=r.selectedYear=r.currentYear):(i=new Date,r.selectedDay=i.getDate(),r.drawMonth=r.selectedMonth=i.getMonth(),r.drawYear=r.selectedYear=i.getFullYear()),this._notifyChange(r),this._adjustDate(n)},_selectMonthYear:function(t,i,n){var r=e(t),s=this._getInst(r[0]);s["selected"+("M"===n?"Month":"Year")]=s["draw"+("M"===n?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(r)},_selectDay:function(t,i,n,r){var s,o=e(t);e(r).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(s=this._getInst(o[0]),s.selectedDay=s.currentDay=e("a",r).html(),s.selectedMonth=s.currentMonth=i,s.selectedYear=s.currentYear=n,this._selectDate(t,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var n,r=e(t),s=this._getInst(r[0]);i=null!=i?i:this._formatDate(s),s.input&&s.input.val(i),this._updateAlternate(s),n=this._get(s,"onSelect"),n?n.apply(s.input?s.input[0]:null,[i,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 i,n,r,s=this._get(t,"altField");s&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),n=this._getDate(t),r=this.formatDate(i,n,this._getFormatConfig(t)),e(s).each(function(){e(this).val(r)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(i,n,r){if(null==i||null==n)throw"Invalid arguments";if(n="object"==typeof n?""+n:n+"",""===n)return null;var s,o,a,l,c=0,h=(r?r.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof h?h:(new Date).getFullYear()%100+parseInt(h,10),d=(r?r.dayNamesShort:null)||this._defaults.dayNamesShort,p=(r?r.dayNames:null)||this._defaults.dayNames,f=(r?r.monthNamesShort:null)||this._defaults.monthNamesShort,m=(r?r.monthNames:null)||this._defaults.monthNames,g=-1,_=-1,v=-1,b=-1,y=!1,x=function(e){var t=i.length>s+1&&i.charAt(s+1)===e;return t&&s++,t},w=function(e){var t=x(e),i="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,r=RegExp("^\\d{1,"+i+"}"),s=n.substring(c).match(r);if(!s)throw"Missing number at position "+c;return c+=s[0].length,parseInt(s[0],10)},k=function(i,r,s){var o=-1,a=e.map(x(i)?s:r,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(a,function(e,i){var r=i[1];return n.substr(c,r.length).toLowerCase()===r.toLowerCase()?(o=i[0],c+=r.length,!1):t}),-1!==o)return o+1;throw"Unknown name at position "+c},C=function(){if(n.charAt(c)!==i.charAt(s))throw"Unexpected literal at position "+c;c++};for(s=0;i.length>s;s++)if(y)"'"!==i.charAt(s)||x("'")?C():y=!1;else switch(i.charAt(s)){case"d":v=w("d");break;case"D":k("D",d,p);break;case"o":b=w("o");break;case"m":_=w("m");break;case"M":_=k("M",f,m);break;case"y":g=w("y");break;case"@":l=new Date(w("@")),g=l.getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"!":l=new Date((w("!")-this._ticksTo1970)/1e4),g=l.getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"'":x("'")?C():y=!0;break;default:C()}if(n.length>c&&(a=n.substr(c),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=g?0:-100)),b>-1)for(_=1,v=b;o=this._getDaysInMonth(g,_-1),!(o>=v);)_++,v-=o;if(l=this._daylightSavingAdjust(new Date(g,_-1,v)),l.getFullYear()!==g||l.getMonth()+1!==_||l.getDate()!==v)throw"Invalid date";return l},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,i){if(!t)return"";var n,r=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,s=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,a=(i?i.monthNames:null)||this._defaults.monthNames,l=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},c=function(e,t,i){var n=""+t;if(l(e))for(;i>n.length;)n="0"+n;return n},h=function(e,t,i,n){return l(e)?n[t]:i[t]},u="",d=!1;if(t)for(n=0;e.length>n;n++)if(d)"'"!==e.charAt(n)||l("'")?u+=e.charAt(n):d=!1;else switch(e.charAt(n)){case"d":u+=c("d",t.getDate(),2);break;case"D":u+=h("D",t.getDay(),r,s);break;case"o":u+=c("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=c("m",t.getMonth()+1,2);break;case"M":u+=h("M",t.getMonth(),o,a);break;case"y":u+=l("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=e.charAt(n)}return u},_possibleChars:function(e){var t,i="",n=!1,r=function(i){var n=e.length>t+1&&e.charAt(t+1)===i;return n&&t++,n};for(t=0;e.length>t;t++)if(n)"'"!==e.charAt(t)||r("'")?i+=e.charAt(t):n=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":r("'")?i+="'":n=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,i){return e.settings[i]!==t?e.settings[i]:this._defaults[i]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),n=e.lastVal=e.input?e.input.val():null,r=this._getDefaultDate(e),s=r,o=this._getFormatConfig(e);try{s=this.parseDate(i,n,o)||r}catch(a){n=t?"":n}e.selectedDay=s.getDate(),e.drawMonth=e.selectedMonth=s.getMonth(),e.drawYear=e.selectedYear=s.getFullYear(),e.currentDay=n?s.getDate():0,e.currentMonth=n?s.getMonth():0,e.currentYear=n?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,i,n){var r=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(n){}for(var r=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,s=r.getFullYear(),o=r.getMonth(),a=r.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,c=l.exec(i);c;){switch(c[2]||"d"){case"d":case"D":a+=parseInt(c[1],10);break;case"w":case"W":a+=7*parseInt(c[1],10);break;case"m":case"M":o+=parseInt(c[1],10),a=Math.min(a,e.datepicker._getDaysInMonth(s,o));break;case"y":case"Y":s+=parseInt(c[1],10),a=Math.min(a,e.datepicker._getDaysInMonth(s,o))}c=l.exec(i)}return new Date(s,o,a)},o=null==i||""===i?n:"string"==typeof i?s(i):"number"==typeof i?isNaN(i)?n:r(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?n: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,i){var n=!t,r=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(),r===e.selectedMonth&&s===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(n?"":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 i=this._get(t,"stepMonths"),n="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(n,-i,"M")},next:function(){e.datepicker._adjustDate(n,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(n)},selectDay:function(){return e.datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(n,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,n,r,s,o,a,l,c,h,u,d,p,f,m,g,_,v,b,y,x,w,k,C,T,S,M,D,E,L,P,A,I,O,j,z,N,$,H,R=new Date,F=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),W=this._get(e,"isRTL"),q=this._get(e,"showButtonPanel"),B=this._get(e,"hideIfNoPrevNext"),U=this._get(e,"navigationAsDateFormat"),Y=this._getNumberOfMonths(e),G=this._get(e,"showCurrentAtPos"),K=this._get(e,"stepMonths"),V=1!==Y[0]||1!==Y[1],J=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(e,"min"),X=this._getMinMaxDate(e,"max"),Z=e.drawMonth-G,ee=e.drawYear;if(0>Z&&(Z+=12,ee--),X)for(t=this._daylightSavingAdjust(new Date(X.getFullYear(),X.getMonth()-Y[0]*Y[1]+1,X.getDate())),t=Q&&Q>t?Q:t;this._daylightSavingAdjust(new Date(ee,Z,1))>t;)Z--,0>Z&&(Z=11,ee--);for(e.drawMonth=Z,e.drawYear=ee,i=this._get(e,"prevText"),i=U?this.formatDate(i,this._daylightSavingAdjust(new Date(ee,Z-K,1)),this._getFormatConfig(e)):i,n=this._canAdjustMonth(e,-1,ee,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"e":"w")+"'>"+i+"</span></a>":B?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"e":"w")+"'>"+i+"</span></a>",r=this._get(e,"nextText"),r=U?this.formatDate(r,this._daylightSavingAdjust(new Date(ee,Z+K,1)),this._getFormatConfig(e)):r,s=this._canAdjustMonth(e,1,ee,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+r+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"w":"e")+"'>"+r+"</span></a>":B?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+r+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"w":"e")+"'>"+r+"</span></a>",o=this._get(e,"currentText"),a=this._get(e,"gotoCurrent")&&e.currentDay?J:F,o=U?this.formatDate(o,a,this._getFormatConfig(e)):o,l=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>",c=q?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(W?l:"")+(this._isInRange(e,a)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(W?"":l)+"</div>":"",h=parseInt(this._get(e,"firstDay"),10),h=isNaN(h)?0:h,u=this._get(e,"showWeek"),d=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),v=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),y="",w=0;Y[0]>w;w++){for(k="",this.maxRows=4,C=0;Y[1]>C;C++){if(T=this._daylightSavingAdjust(new Date(ee,Z,e.selectedDay)),S=" ui-corner-all",M="",V){if(M+="<div class='ui-datepicker-group",Y[1]>1)switch(C){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(W?"right":"left");break;case Y[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(W?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?W?s:n:"")+(/all|right/.test(S)&&0===w?W?n:s:"")+this._generateMonthYearHeader(e,Z,ee,Q,X,w>0||C>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead><tr>",D=u?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)E=(x+h)%7,D+="<th"+((x+h+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+d[E]+"'>"+p[E]+"</span></th>";for(M+=D+"</tr></thead><tbody>",L=this._getDaysInMonth(ee,Z),ee===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,L)),P=(this._getFirstDayOfMonth(ee,Z)-h+7)%7,A=Math.ceil((P+L)/7),I=V&&this.maxRows>A?this.maxRows:A,this.maxRows=I,O=this._daylightSavingAdjust(new Date(ee,Z,1-P)),j=0;I>j;j++){for(M+="<tr>",z=u?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(O)+"</td>":"",x=0;7>x;x++)N=g?g.apply(e.input?e.input[0]:null,[O]):[!0,""],$=O.getMonth()!==Z,H=$&&!v||!N[0]||Q&&Q>O||X&&O>X,z+="<td class='"+((x+h+6)%7>=5?" ui-datepicker-week-end":"")+($?" ui-datepicker-other-month":"")+(O.getTime()===T.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===O.getTime()&&b.getTime()===T.getTime()?" "+this._dayOverClass:"")+(H?" "+this._unselectableClass+" ui-state-disabled":"")+($&&!_?"":" "+N[1]+(O.getTime()===J.getTime()?" "+this._currentClass:"")+(O.getTime()===F.getTime()?" ui-datepicker-today":""))+"'"+($&&!_||!N[2]?"":" title='"+N[2].replace(/'/g,"&#39;")+"'")+(H?"":" data-handler='selectDay' data-event='click' data-month='"+O.getMonth()+"' data-year='"+O.getFullYear()+"'")+">"+($&&!_?"&#xa0;":H?"<span class='ui-state-default'>"+O.getDate()+"</span>":"<a class='ui-state-default"+(O.getTime()===F.getTime()?" ui-state-highlight":"")+(O.getTime()===J.getTime()?" ui-state-active":"")+($?" ui-priority-secondary":"")+"' href='#'>"+O.getDate()+"</a>")+"</td>",O.setDate(O.getDate()+1),O=this._daylightSavingAdjust(O);M+=z+"</tr>"}Z++,Z>11&&(Z=0,ee++),M+="</tbody></table>"+(V?"</div>"+(Y[0]>0&&C===Y[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}y+=k}return y+=c,e._keyEvent=!1,y},_generateMonthYearHeader:function(e,t,i,n,r,s,o,a){var l,c,h,u,d,p,f,m,g=this._get(e,"changeMonth"),_=this._get(e,"changeYear"),v=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(s||!g)y+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(l=n&&n.getFullYear()===i,c=r&&r.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",h=0;12>h;h++)(!l||h>=n.getMonth())&&(!c||r.getMonth()>=h)&&(y+="<option value='"+h+"'"+(h===t?" selected='selected'":"")+">"+a[h]+"</option>");y+="</select>"}if(v||(b+=y+(!s&&g&&_?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",s||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(e,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?d+parseInt(e,10):parseInt(e,10);return isNaN(t)?d:t},f=p(u[0]),m=Math.max(f,p(u[1]||"")),f=n?Math.max(f,n.getFullYear()):f,m=r?Math.min(m,r.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),v&&(b+=(!s&&g&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(e,t,i){var n=e.drawYear+("Y"===i?t:0),r=e.drawMonth+("M"===i?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(n,r))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(n,r,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=i&&i>t?i:t;return n&&r>n?n:r},_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,i,n){var r=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(i,n+(0>t?t:r[0]*r[1]),1));return 0>t&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var i,n,r=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),o=null,a=null,l=this._get(e,"yearRange");return l&&(i=l.split(":"),n=(new Date).getFullYear(),o=parseInt(i[0],10),a=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=n),i[1].match(/[+\-].*/)&&(a+=n)),(!r||t.getTime()>=r.getTime())&&(!s||t.getTime()<=s.getTime())&&(!o||t.getFullYear()>=o)&&(!a||a>=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,i,n){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var r=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(n,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),r,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 i=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(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.4"}(jQuery),function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0
};e.widget("ui.dialog",{version:"1.10.4",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 i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},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},_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},_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 i,n=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._destroyOverlay(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(r){}this._hide(this.uiDialog,this.options.hide,function(){n._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!t&&this._trigger("focus",e),i},open:function(){var t=this;return this._isOpen?void(this._moveToTop()&&this._focusTabbable()):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),void this._trigger("open"))},_focusTabbable:function(){var 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 i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_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(),void this.close(t);if(t.keyCode===e.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),n=i.filter(":first"),r=i.filter(":last");t.target!==r[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==n[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(r.focus(1),t.preventDefault()):(n.focus(1),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,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?void this.uiDialog.removeClass("ui-dialog-buttons"):(e.each(i,function(i,n){var r,s;n=e.isFunction(n)?{click:n,text:i}:n,n=e.extend({type:"button"},n),r=n.click,n.click=function(){r.apply(t.element[0],arguments)},s={icons:n.icons,text:n.showText},delete n.icons,delete n.showText,e("<button></button>",n).button(s).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),void this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,r){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",n,t(r))},drag:function(e,n){i._trigger("drag",e,t(n))},stop:function(r,s){n.position=[s.position.left-i.document.scrollLeft(),s.position.top-i.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",r,t(s))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,n=this.options,r=n.resizable,s=this.uiDialog.css("position"),o="string"==typeof r?r:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:n.maxWidth,maxHeight:n.maxHeight,minWidth:n.minWidth,minHeight:this._minHeight(),handles:o,start:function(n,r){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",n,t(r))},resize:function(e,n){i._trigger("resize",e,t(n))},stop:function(r,s){n.height=e(this).height(),n.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",r,t(s))}}).css("position",s)},_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(n){var r=this,s=!1,o={};e.each(n,function(e,n){r._setOption(e,n),e in t&&(s=!0),e in i&&(o[e]=n)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",o)},_setOption:function(e,t){var i,n,r=this.uiDialog;"dialogClass"===e&&r.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&&(i=r.is(":data(ui-draggable)"),i&&!t&&r.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=r.is(":data(ui-resizable)"),n&&!t&&r.resizable("destroy"),n&&"string"==typeof t&&r.resizable("option","handles",t),n||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,n=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),n.minWidth>n.width&&(n.width=n.minWidth),e=this.uiDialog.css({height:"auto",width:n.width}).outerHeight(),t=Math.max(0,n.minHeight-e),i="number"==typeof n.maxHeight?Math.max(0,n.maxHeight-e):"none","auto"===n.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,n.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=this,i=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(n){t._allowInteraction(n)||(n.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,i=this.options.position,n=[],r=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(n=i.split?i.split(" "):[i[0],i[1]],1===n.length&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(r[e]=n[e],n[e]=t)}),i={my:n[0]+(0>r[0]?r[0]:"+"+r[0])+" "+n[1]+(0>r[1]?r[1]:"+"+r[1]),at:n.join(" ")}),i=e.extend({},e.ui.dialog.prototype.options.position,i)):i=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(i),t||this.uiDialog.hide()}})}(jQuery),function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.4",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||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=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(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var n=this._uiHash();if(this._trigger("drag",t,n)===!1)return this._mouseUp({}),!1;this.position=n.position}return 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"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,n=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!n||"valid"===this.options.revert&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),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},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_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(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.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.element.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.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,i,n,r=this.options;return r.containment?"window"===r.containment?void(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()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===r.containment?void(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):r.containment.constructor===Array?void(this.containment=r.containment):("parent"===r.containment&&(r.containment=this.helper[0].parentNode),i=e(r.containment),n=i[0],void(n&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i))):void(this.containment=null)},_convertPositionTo:function(t,i){i||(i=this.position);var n="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*n}},_generatePosition:function(t){var i,n,r,s,o=this.options,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=t.pageX,c=t.pageY;return this.offset.scroll||(this.offset.scroll={top:a.scrollTop(),left:a.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(n=this.relative_container.offset(),i=[this.containment[0]+n.left,this.containment[1]+n.top,this.containment[2]+n.left,this.containment[3]+n.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(c=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(c=i[3]+this.offset.click.top)),o.grid&&(r=o.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,c=i?r-this.offset.click.top>=i[1]||r-this.offset.click.top>i[3]?r:r-this.offset.click.top>=i[1]?r-o.grid[1]:r+o.grid[1]:r,s=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=i?s-this.offset.click.left>=i[0]||s-this.offset.click.left>i[2]?s:s-this.offset.click.left>=i[0]?s-o.grid[0]:s+o.grid[0]:s)),{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():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},_trigger:function(t,i,n){return n=n||this._uiHash(),e.ui.plugin.call(this,t,[i,n]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,n)},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,i){var n=e(this).data("ui-draggable"),r=n.options,s=e.extend({},i,{item:n.element});n.sortables=[],e(r.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(n.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,s))})},stop:function(t,i){var n=e(this).data("ui-draggable"),r=e.extend({},i,{item:n.element});e.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,r))})},drag:function(t,i){var n=e(this).data("ui-draggable"),r=this;e.each(n.sortables,function(){var s=!1,o=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(s=!0,e.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(s=!1),s})),s?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(r).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",t),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),n._trigger("fromSortable",t),n.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var n=e(i.helper),r=e(this).data("ui-draggable").options;n.css("opacity")&&(r._opacity=n.css("opacity")),n.css("opacity",r.opacity)},stop:function(t,i){var n=e(this).data("ui-draggable").options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),n=i.options,r=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(n.axis&&"x"===n.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?i.scrollParent[0].scrollTop=r=i.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-i.overflowOffset.top<n.scrollSensitivity&&(i.scrollParent[0].scrollTop=r=i.scrollParent[0].scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?i.scrollParent[0].scrollLeft=r=i.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-i.overflowOffset.left<n.scrollSensitivity&&(i.scrollParent[0].scrollLeft=r=i.scrollParent[0].scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(document).scrollTop()<n.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(document).scrollLeft()<n.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed)))),r!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),n=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:n.top,left:n.left})})},drag:function(t,i){var n,r,s,o,a,l,c,h,u,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,_=g+p.helperProportions.width,v=i.offset.top,b=v+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)a=p.snapElements[u].left,l=a+p.snapElements[u].width,c=p.snapElements[u].top,h=c+p.snapElements[u].height,a-m>_||g>l+m||c-m>b||v>h+m||!e.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(c-b),r=m>=Math.abs(h-v),s=m>=Math.abs(a-_),o=m>=Math.abs(l-g),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),r&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),s&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=n||r||s||o,"outer"!==f.snapMode&&(n=m>=Math.abs(c-v),r=m>=Math.abs(h-b),s=m>=Math.abs(a-g),o=m>=Math.abs(l-_),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),r&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),s&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(n||r||s||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=n||r||s||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,n=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});n.length&&(t=parseInt(e(n[0]).css("zIndex"),10)||0,e(n).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+n.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var n=e(i.helper),r=e(this).data("ui-draggable").options;n.css("zIndex")&&(r._zIndex=n.css("zIndex")),n.css("zIndex",r.zIndex)},stop:function(t,i){var n=e(this).data("ui-draggable").options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}})}(jQuery),function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.4",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,i=this.options,n=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions=function(){return arguments.length?void(t=arguments[0]):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},e.ui.ddmanager.droppables[i.scope]=e.ui.ddmanager.droppables[i.scope]||[],e.ui.ddmanager.droppables[i.scope].push(this),i.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var n=i||e.ui.ddmanager.current,r=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===n.options.scope&&t.accept.call(t.element[0],n.currentItem||n.element)&&e.ui.intersect(n,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(r=!0,!1):void 0}),r?!1:this.accept.call(this.element[0],n.currentItem||n.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(n)),
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(e,i,n){if(!i.offset)return!1;var r,s,o=(e.positionAbs||e.position.absolute).left,a=(e.positionAbs||e.position.absolute).top,l=o+e.helperProportions.width,c=a+e.helperProportions.height,h=i.offset.left,u=i.offset.top,d=h+i.proportions().width,p=u+i.proportions().height;switch(n){case"fit":return o>=h&&d>=l&&a>=u&&p>=c;case"intersect":return o+e.helperProportions.width/2>h&&d>l-e.helperProportions.width/2&&a+e.helperProportions.height/2>u&&p>c-e.helperProportions.height/2;case"pointer":return r=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,s=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(s,u,i.proportions().height)&&t(r,h,i.proportions().width);case"touch":return(a>=u&&p>=a||c>=u&&p>=c||u>a&&c>p)&&(o>=h&&d>=o||l>=h&&d>=l||h>o&&l>d);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var n,r,s=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(n=0;s.length>n;n++)if(!(s[n].options.disabled||t&&!s[n].accept.call(s[n].element[0],t.currentItem||t.element))){for(r=0;a.length>r;r++)if(a[r]===s[n].element[0]){s[n].proportions().height=0;continue e}s[n].visible="none"!==s[n].element.css("display"),s[n].visible&&("mousedown"===o&&s[n]._activate.call(s[n],i),s[n].offset=s[n].element.offset(),s[n].proportions({width:s[n].element[0].offsetWidth,height:s[n].element[0].offsetHeight}))}},drop:function(t,i){var n=!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=this._drop.call(this,i)||n),!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,i)))}),n},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,r,s,o=e.ui.intersect(t,this,this.options.tolerance),a=!o&&this.isover?"isout":o&&!this.isover?"isover":null;a&&(this.options.greedy&&(r=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===r}),s.length&&(n=e.data(s[0],"ui-droppable"),n.greedyChild="isover"===a)),n&&"isover"===a&&(n.isover=!1,n.isout=!0,n._out.call(n,i)),this[a]=!0,this["isout"===a?"isover":"isout"]=!1,this["isover"===a?"_over":"_out"].call(this,i),n&&"isout"===a&&(n.isout=!1,n.isover=!0,n._over.call(n,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}}(jQuery),function(e,t){var i="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var n=u[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:e>n.max?n.max:e)}function n(i){var n=c(),r=n._rgba=[];return i=i.toLowerCase(),f(l,function(e,s){var o,a=s.re.exec(i),l=a&&s.parse(a),c=s.space||"rgba";return l?(o=n[c](l),n[h[c].cache]=o[h[c].cache],r=n._rgba=o._rgba,!1):t}),r.length?("0,0,0,0"===r.join()&&e.extend(r,s.transparent),n):s[i]}function r(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var s,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",a=/^([\-+])=\s*(\d+\.?\d*)/,l=[{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]]}}],c=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},h={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"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=c.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(h,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),c.fn=e.extend(c.prototype,{parse:function(r,o,a,l){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(o),o=t);var u=this,d=e.type(r),p=this._rgba=[];return o!==t&&(r=[r,o,a,l],d="array"),"string"===d?this.parse(n(r)||s._default):"array"===d?(f(h.rgba.props,function(e,t){p[t.idx]=i(r[t.idx],t)}),this):"object"===d?(r instanceof c?f(h,function(e,t){r[t.cache]&&(u[t.cache]=r[t.cache].slice())}):f(h,function(t,n){var s=n.cache;f(n.props,function(e,t){if(!u[s]&&n.to){if("alpha"===e||null==r[e])return;u[s]=n.to(u._rgba)}u[s][t.idx]=i(r[e],t,!0)}),u[s]&&0>e.inArray(null,u[s].slice(0,3))&&(u[s][3]=1,n.from&&(u._rgba=n.from(u[s])))}),this):t},is:function(e){var i=c(e),n=!0,r=this;return f(h,function(e,s){var o,a=i[s.cache];return a&&(o=r[s.cache]||s.to&&s.to(r._rgba)||[],f(s.props,function(e,i){return null!=a[i.idx]?n=a[i.idx]===o[i.idx]:t})),n}),n},_space:function(){var e=[],t=this;return f(h,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=c(e),r=n._space(),s=h[r],o=0===this.alpha()?c("transparent"):this,a=o[s.cache]||s.to(o._rgba),l=a.slice();return n=n[s.cache],f(s.props,function(e,r){var s=r.idx,o=a[s],c=n[s],h=u[r.type]||{};null!==c&&(null===o?l[s]=c:(h.mod&&(c-o>h.mod/2?o+=h.mod:o-c>h.mod/2&&(o-=h.mod)),l[s]=i((c-o)*t+o,r)))}),this[r](l)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=c(t)._rgba;return c(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=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===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,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()}}),c.fn.parse.prototype=c.fn,h.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,s=e[2]/255,o=e[3],a=Math.max(n,r,s),l=Math.min(n,r,s),c=a-l,h=a+l,u=.5*h;return t=l===a?0:n===a?60*(r-s)/c+360:r===a?60*(s-n)/c+120:60*(n-r)/c+240,i=0===c?0:.5>=u?c/h:c/(2-h),[Math.round(t)%360,i,u,null==o?1:o]},h.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,i=e[1],n=e[2],s=e[3],o=.5>=n?n*(1+i):n+i-n*i,a=2*n-o;return[Math.round(255*r(a,o,t+1/3)),Math.round(255*r(a,o,t)),Math.round(255*r(a,o,t-1/3)),s]},f(h,function(n,r){var s=r.props,o=r.cache,l=r.to,h=r.from;c.fn[n]=function(n){if(l&&!this[o]&&(this[o]=l(this._rgba)),n===t)return this[o].slice();var r,a=e.type(n),u="array"===a||"object"===a?n:arguments,d=this[o].slice();return f(s,function(e,t){var n=u["object"===a?e:t.idx];null==n&&(n=d[t.idx]),d[t.idx]=i(n,t)}),h?(r=c(h(d)),r[o]=d,r):c(d)},f(s,function(t,i){c.fn[t]||(c.fn[t]=function(r){var s,o=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,c=this[l](),h=c[i.idx];return"undefined"===o?h:("function"===o&&(r=r.call(this,h),o=e.type(r)),null==r&&i.empty?this:("string"===o&&(s=a.exec(r),s&&(r=h+parseFloat(s[2])*("+"===s[1]?1:-1))),c[i.idx]=r,this[l](c)))})})}),c.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,r){var s,o,a="";if("transparent"!==r&&("string"!==e.type(r)||(s=n(r)))){if(r=c(s||r),!d.rgba&&1!==r._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===a||"transparent"===a)&&o&&o.style;)try{a=e.css(o,"backgroundColor"),o=o.parentNode}catch(l){}r=r.blend(a&&"transparent"!==a?a:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(l){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=c(t.elem,i),t.end=c(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},c.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"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"}}(jQuery),function(){function i(t){var i,n,r=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,s={};if(r&&r.length&&r[0]&&r[r[0]])for(n=r.length;n--;)i=r[n],"string"==typeof r[i]&&(s[e.camelCase(i)]=r[i]);else for(i in r)"string"==typeof r[i]&&(s[i]=r[i]);return s}function n(t,i){var n,r,o={};for(n in i)r=i[n],t[n]!==r&&(s[n]||(e.fx.step[n]||!isNaN(parseFloat(r)))&&(o[n]=r));return o}var r=["add","remove","toggle"],s={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,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,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(t,s,o,a){var l=e.speed(s,o,a);return this.queue(function(){var s,o=e(this),a=o.attr("class")||"",c=l.children?o.find("*").addBack():o;c=c.map(function(){var t=e(this);return{el:t,start:i(this)}}),s=function(){e.each(r,function(e,i){t[i]&&o[i+"Class"](t[i])})},s(),c=c.map(function(){return this.end=i(this.el[0]),this.diff=n(this.start,this.end),this}),o.attr("class",a),c=c.map(function(){var t=this,i=e.Deferred(),n=e.extend({},l,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,n),i.promise()}),e.when.apply(e,c.get()).done(function(){s(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,n,r,s){return n?e.effects.animateClass.call(this,{add:i},n,r,s):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,n,r,s){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},n,r,s):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(i){return function(n,r,s,o,a){return"boolean"==typeof r||r===t?s?e.effects.animateClass.call(this,r?{add:n}:{remove:n},s,o,a):i.apply(this,arguments):e.effects.animateClass.call(this,{toggle:n},r,s,o)}}(e.fn.toggleClass),switchClass:function(t,i,n,r,s){return e.effects.animateClass.call(this,{add:i,remove:t},n,r,s)}})}(),function(){function n(t,i,n,r){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(r=i,n=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(r=n,n=i,i={}),e.isFunction(n)&&(r=n,n=null),i&&e.extend(t,i),n=n||i.duration,t.duration=e.fx.off?0:"number"==typeof n?n:n in e.fx.speeds?e.fx.speeds[n]:e.fx.speeds._default,t.complete=r||i.complete,t}function r(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.10.4",save:function(e,t){for(var n=0;t.length>n;n++)null!==t[n]&&e.data(i+t[n],e[0].style[t[n]])},restore:function(e,n){var r,s;for(s=0;n.length>s;s++)null!==n[s]&&(r=e.data(i+n[s]),r===t&&(r=""),e.css(n[s],r))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,n;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":n=0;break;case"center":n=.5;break;case"right":n=1;break;default:n=e[1]/t.width}return{x:n,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},n=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),r={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(o){s=document.body}return t.wrap(n),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),n=t.parent(),"static"===t.css("position")?(n.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,n){i[n]=t.css(n),isNaN(parseInt(i[n],10))&&(i[n]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(r),n.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,n,r){return r=r||{},e.each(i,function(e,i){var s=t.cssUnit(i);s[0]>0&&(r[i]=s[0]*n+s[1])}),r}}),e.fn.extend({effect:function(){function t(t){function n(){e.isFunction(s)&&s.call(r[0]),e.isFunction(t)&&t()}var r=e(this),s=i.complete,a=i.mode;(r.is(":hidden")?"hide"===a:"show"===a)?(r[a](),n()):o.call(r[0],i,n)}var i=n.apply(this,arguments),r=i.mode,s=i.queue,o=e.effects.effect[i.effect];return e.fx.off||!o?r?this[r](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):s===!1?this.each(t):this.queue(s||"fx",t)},show:function(e){return function(t){if(r(t))return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(t){if(r(t))return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(t){if(r(t)||"boolean"==typeof t)return e.apply(this,arguments);var i=n.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),n=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(n=[parseFloat(i),t])}),n}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=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,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()}(jQuery),function(e){var t=/up|down|vertical/,i=/up|left|vertical|horizontal/;e.effects.effect.blind=function(n,r){var s,o,a,l=e(this),c=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(l,n.mode||"hide"),u=n.direction||"up",d=t.test(u),p=d?"height":"width",f=d?"top":"left",m=i.test(u),g={},_="show"===h;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),c):e.effects.save(l,c),l.show(),s=e.effects.createWrapper(l).css({overflow:"hidden"}),o=s[p](),a=parseFloat(s.css(f))||0,g[p]=_?o:0,m||(l.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),g[f]=_?a:o+a),_&&(s.css(p,0),m||s.css(f,a+o)),s.animate(g,{duration:n.duration,easing:n.easing,queue:!1,complete:function(){"hide"===h&&l.hide(),e.effects.restore(l,c),e.effects.removeWrapper(l),r()}})}}(jQuery),function(e){e.effects.effect.bounce=function(t,i){var n,r,s,o=e(this),a=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(o,t.mode||"effect"),c="hide"===l,h="show"===l,u=t.direction||"up",d=t.distance,p=t.times||5,f=2*p+(h||c?1:0),m=t.duration/f,g=t.easing,_="up"===u||"down"===u?"top":"left",v="up"===u||"left"===u,b=o.queue(),y=b.length;for((h||c)&&a.push("opacity"),e.effects.save(o,a),o.show(),e.effects.createWrapper(o),d||(d=o["top"===_?"outerHeight":"outerWidth"]()/3),h&&(s={opacity:1},s[_]=0,o.css("opacity",0).css(_,v?2*-d:2*d).animate(s,m,g)),c&&(d/=Math.pow(2,p-1)),s={},s[_]=0,n=0;p>n;n++)r={},r[_]=(v?"-=":"+=")+d,o.animate(r,m,g).animate(s,m,g),d=c?2*d:d/2;c&&(r={opacity:0},r[_]=(v?"-=":"+=")+d,o.animate(r,m,g)),o.queue(function(){c&&o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),o.dequeue()}}(jQuery),function(e){e.effects.effect.clip=function(t,i){var n,r,s,o=e(this),a=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(o,t.mode||"hide"),c="show"===l,h=t.direction||"vertical",u="vertical"===h,d=u?"height":"width",p=u?"top":"left",f={};e.effects.save(o,a),o.show(),n=e.effects.createWrapper(o).css({overflow:"hidden"}),r="IMG"===o[0].tagName?n:o,s=r[d](),c&&(r.css(d,0),r.css(p,s/2)),f[d]=c?s:0,f[p]=c?0:s/2,r.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){c||o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),i()}})}}(jQuery),function(e){e.effects.effect.drop=function(t,i){var n,r=e(this),s=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(r,t.mode||"hide"),a="show"===o,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",h="up"===l||"left"===l?"pos":"neg",u={opacity:a?1:0};e.effects.save(r,s),r.show(),e.effects.createWrapper(r),n=t.distance||r["top"===c?"outerHeight":"outerWidth"](!0)/2,a&&r.css("opacity",0).css(c,"pos"===h?-n:n),u[c]=(a?"pos"===h?"+=":"-=":"pos"===h?"-=":"+=")+n,r.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),i()}})}}(jQuery),function(e){e.effects.effect.explode=function(t,i){function n(){b.push(this),b.length===u*d&&r()}function r(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var s,o,a,l,c,h,u=t.pieces?Math.round(Math.sqrt(t.pieces)):3,d=u,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(s=0;u>s;s++)for(l=g.top+s*v,h=s-(u-1)/2,o=0;d>o;o++)a=g.left+o*_,c=o-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*_,top:-s*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:a+(m?c*_:0),top:l+(m?h*v:0),opacity:m?0:1}).animate({left:a+(m?0:c*_),top:l+(m?0:h*v),opacity:m?1:0},t.duration||500,t.easing,n)}}(jQuery),function(e){e.effects.effect.fade=function(t,i){var n=e(this),r=e.effects.setMode(n,t.mode||"toggle");n.animate({opacity:r},{queue:!1,duration:t.duration,easing:t.easing,complete:i})}}(jQuery),function(e){e.effects.effect.fold=function(t,i){var n,r,s=e(this),o=["position","top","bottom","left","right","height","width"],a=e.effects.setMode(s,t.mode||"hide"),l="show"===a,c="hide"===a,h=t.size||15,u=/([0-9]+)%/.exec(h),d=!!t.horizFirst,p=l!==d,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},_={};e.effects.save(s,o),s.show(),n=e.effects.createWrapper(s).css({overflow:"hidden"}),r=p?[n.width(),n.height()]:[n.height(),n.width()],u&&(h=parseInt(u[1],10)/100*r[c?0:1]),l&&n.css(d?{height:0,width:h}:{height:h,width:0}),g[f[0]]=l?r[0]:h,_[f[1]]=l?r[1]:0,n.animate(g,m,t.easing).animate(_,m,t.easing,function(){c&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()})}}(jQuery),function(e){e.effects.effect.highlight=function(t,i){var n=e(this),r=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(n,t.mode||"show"),o={backgroundColor:n.css("backgroundColor")};"hide"===s&&(o.opacity=0),e.effects.save(n,r),n.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&n.hide(),e.effects.restore(n,r),i()}})}}(jQuery),function(e){e.effects.effect.pulsate=function(t,i){var n,r=e(this),s=e.effects.setMode(r,t.mode||"show"),o="show"===s,a="hide"===s,l=o||"hide"===s,c=2*(t.times||5)+(l?1:0),h=t.duration/c,u=0,d=r.queue(),p=d.length;for((o||!r.is(":visible"))&&(r.css("opacity",0).show(),u=1),n=1;c>n;n++)r.animate({opacity:u},h,t.easing),u=1-u;r.animate({opacity:u},h,t.easing),r.queue(function(){a&&r.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,c+1))),r.dequeue()}}(jQuery),function(e){e.effects.effect.puff=function(t,i){var n=e(this),r=e.effects.setMode(n,t.mode||"hide"),s="hide"===r,o=parseInt(t.percent,10)||150,a=o/100,l={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:r,complete:i,percent:s?o:100,from:s?l:{height:l.height*a,width:l.width*a,outerHeight:l.outerHeight*a,outerWidth:l.outerWidth*a}}),n.effect(t)},e.effects.effect.scale=function(t,i){var n=e(this),r=e.extend(!0,{},t),s=e.effects.setMode(n,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===s?0:100),a=t.direction||"both",l=t.origin,c={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},h={y:"horizontal"!==a?o/100:1,x:"vertical"!==a?o/100:1};r.effect="size",r.queue=!1,r.complete=i,"effect"!==s&&(r.origin=l||["middle","center"],r.restore=!0),r.from=t.from||("show"===s?{height:0,width:0,outerHeight:0,outerWidth:0}:c),r.to={height:c.height*h.y,width:c.width*h.x,outerHeight:c.outerHeight*h.y,outerWidth:c.outerWidth*h.x},r.fade&&("show"===s&&(r.from.opacity=0,r.to.opacity=1),"hide"===s&&(r.from.opacity=1,r.to.opacity=0)),n.effect(r)},e.effects.effect.size=function(t,i){var n,r,s,o=e(this),a=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["position","top","bottom","left","right","overflow","opacity"],c=["width","height","overflow"],h=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],_=o.css("position"),v=f?a:l,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),n={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||n):(o.from=t.from||("show"===p?b:n),o.to=t.to||("hide"===p?b:n)),s={from:{y:o.from.height/n.height,x:o.from.width/n.width},to:{y:o.to.height/n.height,x:o.to.width/n.width}},("box"===m||"both"===m)&&(s.from.y!==s.to.y&&(v=v.concat(u),o.from=e.effects.setTransition(o,u,s.from.y,o.from),o.to=e.effects.setTransition(o,u,s.to.y,o.to)),s.from.x!==s.to.x&&(v=v.concat(d),o.from=e.effects.setTransition(o,d,s.from.x,o.from),o.to=e.effects.setTransition(o,d,s.to.x,o.to))),("content"===m||"both"===m)&&s.from.y!==s.to.y&&(v=v.concat(h).concat(c),o.from=e.effects.setTransition(o,h,s.from.y,o.from),o.to=e.effects.setTransition(o,h,s.to.y,o.to)),e.effects.save(o,v),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(r=e.effects.getBaseline(g,n),o.from.top=(n.outerHeight-o.outerHeight())*r.y,o.from.left=(n.outerWidth-o.outerWidth())*r.x,o.to.top=(n.outerHeight-o.to.outerHeight)*r.y,o.to.left=(n.outerWidth-o.to.outerWidth)*r.x),o.css(o.from),("content"===m||"both"===m)&&(u=u.concat(["marginTop","marginBottom"]).concat(h),d=d.concat(["marginLeft","marginRight"]),c=a.concat(u).concat(d),o.find("*[width]").each(function(){var i=e(this),n={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,c),i.from={height:n.height*s.from.y,width:n.width*s.from.x,outerHeight:n.outerHeight*s.from.y,outerWidth:n.outerWidth*s.from.x},i.to={height:n.height*s.to.y,width:n.width*s.to.x,outerHeight:n.height*s.to.y,outerWidth:n.width*s.to.x},s.from.y!==s.to.y&&(i.from=e.effects.setTransition(i,u,s.from.y,i.from),i.to=e.effects.setTransition(i,u,s.to.y,i.to)),s.from.x!==s.to.x&&(i.from=e.effects.setTransition(i,d,s.from.x,i.from),i.to=e.effects.setTransition(i,d,s.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,c)})})),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,v),f||("static"===_?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var n=parseInt(i,10),r=e?o.to.left:o.to.top;return"auto"===i?r+"px":n+r+"px"})})),e.effects.removeWrapper(o),i()}})}}(jQuery),function(e){e.effects.effect.shake=function(t,i){var n,r=e(this),s=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(r,t.mode||"effect"),a=t.direction||"left",l=t.distance||20,c=t.times||3,h=2*c+1,u=Math.round(t.duration/h),d="up"===a||"down"===a?"top":"left",p="up"===a||"left"===a,f={},m={},g={},_=r.queue(),v=_.length;for(e.effects.save(r,s),r.show(),e.effects.createWrapper(r),f[d]=(p?"-=":"+=")+l,m[d]=(p?"+=":"-=")+2*l,g[d]=(p?"-=":"+=")+2*l,r.animate(f,u,t.easing),n=1;c>n;n++)r.animate(m,u,t.easing).animate(g,u,t.easing);r.animate(m,u,t.easing).animate(f,u/2,t.easing).queue(function(){"hide"===o&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),i()}),v>1&&_.splice.apply(_,[1,0].concat(_.splice(v,h+1))),r.dequeue()}}(jQuery),function(e){e.effects.effect.slide=function(t,i){var n,r=e(this),s=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(r,t.mode||"show"),a="show"===o,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",h="up"===l||"left"===l,u={};e.effects.save(r,s),r.show(),n=t.distance||r["top"===c?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),a&&r.css(c,h?isNaN(n)?"-"+n:-n:n),u[c]=(a?h?"+=":"-=":h?"-=":"+=")+n,r.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&r.hide(),e.effects.restore(r,s),e.effects.removeWrapper(r),i()}})}}(jQuery),function(e){e.effects.effect.transfer=function(t,i){var n=e(this),r=e(t.to),s="fixed"===r.css("position"),o=e("body"),a=s?o.scrollTop():0,l=s?o.scrollLeft():0,c=r.offset(),h={top:c.top-a,left:c.left-l,height:r.innerHeight(),width:r.innerWidth()},u=n.offset(),d=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:u.top-a,left:u.left-l,height:n.innerHeight(),width:n.innerWidth(),position:s?"fixed":"absolute"}).animate(h,t.duration,t.easing,function(){d.remove(),i()})}}(jQuery),function(e){e.widget("ui.menu",{version:"1.10.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left 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 ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var i=e(t.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.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){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},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(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").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").children("a").removeUniqueId().removeClass("ui-corner-all 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){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,r,s,o,a,l=!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:l=!1,r=this.previousFilter||"",s=String.fromCharCode(t.keyCode),o=!1,clearTimeout(this.filterTimer),s===r?o=!0:s=r+s,a=RegExp("^"+i(s),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return a.test(e(this).children("a").text())}),n=o&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(s=String.fromCharCode(t.keyCode),a=RegExp("^"+i(s),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return a.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousFilter=s,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}l&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e));
},refresh:function(){var t,i=this.options.icons.submenu,n=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.prev("a"),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=n.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-\u2014\u2013\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".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),this._super(e,t)},focus:function(e,t){var i,n;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),n=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",n.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,n,r,s,o,a;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,n=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,r=t.offset().top-this.activeMenu.offset().top-i-n,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),a=t.height(),0>r?this.activeMenu.scrollTop(s+r):r+a>o&&this.activeMenu.scrollTop(s+r-o+a))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").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 i=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(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var n=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));n.length||(n=this.element),this._close(n),this.blur(t),this.activeMenu=n},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("a.ui-state-active").removeClass("ui-state-active")},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 ").children(".ui-menu-item").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,i){var n;this.active&&(n="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),n&&n.length&&this.active||(n=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,n)},nextPage:function(t){var i,n,r;return this.active?void(this.isLastItem()||(this._hasScroll()?(n=this.active.offset().top,r=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-n-r}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]()))):void this.next(t)},previousPage:function(t){var i,n,r;return this.active?void(this.isFirstItem()||(this._hasScroll()?(n=this.active.offset().top,r=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n+r>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first()))):void this.next(t)},_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 i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})}(jQuery),function(e,t){e.widget("ui.progressbar",{version:"1.10.4",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 e===t?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),t)},_constrainedValue:function(e){return e===t&&(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)),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,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.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")}})}(jQuery),function(e){function t(e){return parseInt(e,10)||0}function i(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.4",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},_create:function(){var t,i,n,r,s,o=this,a=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.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.data("ui-resizable")),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=a.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={},i=0;t.length>i;i++)n=e.trim(t[i]),s="ui-resizable-"+n,r=e("<div class='ui-resizable-handle "+s+"'></div>"),r.css({zIndex:a.zIndex}),"se"===n&&r.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[n]=".ui-resizable-"+n,this.element.append(r);this._renderAxis=function(t){var i,n,r,s;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(n=e(this.handles[i],this.element),s=/sw|ne|nw|se|n|s/.test(i)?n.outerHeight():n.outerWidth(),r=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(r,s),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(r=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=r&&r[1]?r[1]:"se")}),a.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){a.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){a.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=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&&(i(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),i(this.originalElement),this},_mouseCapture:function(t){var i,n,r=!1;for(i in this.handles)n=e(this.handles[i])[0],(n===t.target||e.contains(n,t.target))&&(r=!0);return!this.options.disabled&&r},_mouseStart:function(i){var n,r,s,o=this.options,a=this.element.position(),l=this.element;return this.resizing=!0,/absolute/.test(l.css("position"))?l.css({position:"absolute",top:l.css("top"),left:l.css("left")}):l.is(".ui-draggable")&&l.css({position:"absolute",top:a.top,left:a.left}),this._renderProxy(),n=t(this.helper.css("left")),r=t(this.helper.css("top")),o.containment&&(n+=e(o.containment).scrollLeft()||0,r+=e(o.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:l.width(),height:l.height()},this.originalSize=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalPosition={left:n,top:r},this.sizeDiff={width:l.outerWidth()-l.width(),height:l.outerHeight()-l.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===s?this.axis+"-resize":s),l.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(t){var i,n=this.helper,r={},s=this.originalMousePosition,o=this.axis,a=this.position.top,l=this.position.left,c=this.size.width,h=this.size.height,u=t.pageX-s.left||0,d=t.pageY-s.top||0,p=this._change[o];return p?(i=p.apply(this,[t,u,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==a&&(r.top=this.position.top+"px"),this.position.left!==l&&(r.left=this.position.left+"px"),this.size.width!==c&&(r.width=this.size.width+"px"),this.size.height!==h&&(r.height=this.size.height+"px"),n.css(r),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,n,r,s,o,a,l,c=this.options,h=this;return this._helper&&(i=this._proportionallyResizeElements,n=i.length&&/textarea/i.test(i[0].nodeName),r=n&&e.ui.hasScroll(i[0],"left")?0:h.sizeDiff.height,s=n?0:h.sizeDiff.width,o={width:h.helper.width()-s,height:h.helper.height()-r},a=parseInt(h.element.css("left"),10)+(h.position.left-h.originalPosition.left)||null,l=parseInt(h.element.css("top"),10)+(h.position.top-h.originalPosition.top)||null,c.animate||this.element.css(e.extend(o,{top:l,left:a})),h.helper.height(h.size.height),h.helper.width(h.size.width),this._helper&&!c.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,n,r,s,o,a=this.options;o={minWidth:i(a.minWidth)?a.minWidth:0,maxWidth:i(a.maxWidth)?a.maxWidth:1/0,minHeight:i(a.minHeight)?a.minHeight:0,maxHeight:i(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||e)&&(t=o.minHeight*this.aspectRatio,r=o.minWidth/this.aspectRatio,n=o.maxHeight*this.aspectRatio,s=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),r>o.minHeight&&(o.minHeight=r),o.maxWidth>n&&(o.maxWidth=n),o.maxHeight>s&&(o.maxHeight=s)),this._vBoundaries=o},_updateCache:function(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,n=this.size,r=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(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=i(e.width)&&t.maxWidth&&t.maxWidth<e.width,s=i(e.height)&&t.maxHeight&&t.maxHeight<e.height,o=i(e.width)&&t.minWidth&&t.minWidth>e.width,a=i(e.height)&&t.minHeight&&t.minHeight>e.height,l=this.originalPosition.left+this.originalSize.width,c=this.position.top+this.size.height,h=/sw|nw|w/.test(n),u=/nw|ne|n/.test(n);return o&&(e.width=t.minWidth),a&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),s&&(e.height=t.maxHeight),o&&h&&(e.left=l-t.minWidth),r&&h&&(e.left=l-t.maxWidth),a&&u&&(e.top=c-t.minHeight),s&&u&&(e.top=c-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},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,n,r,s=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(r=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[r.css("borderTopWidth"),r.css("borderRightWidth"),r.css("borderBottomWidth"),r.css("borderLeftWidth")],n=[r.css("paddingTop"),r.css("paddingRight"),r.css("paddingBottom"),r.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(n[t],10)||0);r.css({height:s.height()-this.borderDif[0]-this.borderDif[2]||0,width:s.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=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:++i.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 i=this.originalSize,n=this.originalPosition;return{left:n.left+t,width:i.width-t}},n:function(e,t,i){var n=this.originalSize,r=this.originalPosition;return{top:r.top+i,height:n.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},sw:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,n]))},ne:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},nw:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,n]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,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 i=e(this).data("ui-resizable"),n=i.options,r=i._proportionallyResizeElements,s=r.length&&/textarea/i.test(r[0].nodeName),o=s&&e.ui.hasScroll(r[0],"left")?0:i.sizeDiff.height,a=s?0:i.sizeDiff.width,l={width:i.size.width-a,height:i.size.height-o},c=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,h=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(l,h&&c?{top:h,left:c}:{}),{duration:n.animateDuration,easing:n.animateEasing,step:function(){var n={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};r&&r.length&&e(r[0]).css({width:n.width,height:n.height}),i._updateCache(n),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var i,n,r,s,o,a,l,c=e(this).data("ui-resizable"),h=c.options,u=c.element,d=h.containment,p=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(c.containerElement=e(p),/document/.test(d)||d===document?(c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(p),n=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){n[e]=t(i.css("padding"+r))}),c.containerOffset=i.offset(),c.containerPosition=i.position(),c.containerSize={height:i.innerHeight()-n[3],width:i.innerWidth()-n[1]},r=c.containerOffset,s=c.containerSize.height,o=c.containerSize.width,a=e.ui.hasScroll(p,"left")?p.scrollWidth:o,l=e.ui.hasScroll(p)?p.scrollHeight:s,c.parentData={element:p,left:r.left,top:r.top,width:a,height:l}))},resize:function(t){var i,n,r,s,o=e(this).data("ui-resizable"),a=o.options,l=o.containerOffset,c=o.position,h=o._aspectRatio||t.shiftKey,u={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),c.left<(o._helper?l.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-l.left:o.position.left-u.left),h&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=a.helper?l.left:0),c.top<(o._helper?l.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-l.top:o.position.top),h&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?l.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-u.left:o.offset.left-u.left)+o.sizeDiff.width),n=Math.abs((o._helper?o.offset.top-u.top:o.offset.top-l.top)+o.sizeDiff.height),r=o.containerElement.get(0)===o.element.parent().get(0),s=/relative|absolute/.test(o.containerElement.css("position")),r&&s&&(i-=Math.abs(o.parentData.left)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,h&&(o.size.height=o.size.width/o.aspectRatio)),n+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-n,h&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.containerOffset,r=t.containerPosition,s=t.containerElement,o=e(t.helper),a=o.offset(),l=o.outerWidth()-t.sizeDiff.width,c=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(s.css("position"))&&e(this).css({left:a.left-r.left-n.left,width:l,height:c}),t._helper&&!i.animate&&/static/.test(s.css("position"))&&e(this).css({left:a.left-r.left-n.left,width:l,height:c})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,n=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 i.alsoResize||i.alsoResize.parentNode?n(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],n(i.alsoResize)):e.each(i.alsoResize,function(e){n(e)})},resize:function(t,i){var n=e(this).data("ui-resizable"),r=n.options,s=n.originalSize,o=n.originalPosition,a={height:n.size.height-s.height||0,width:n.size.width-s.width||0,top:n.position.top-o.top||0,left:n.position.left-o.left||0},l=function(t,n){e(t).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),s={},o=n&&n.length?n:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(r[t]||0)+(a[t]||0);i&&i>=0&&(s[t]=i||null)}),t.css(s)})};"object"!=typeof r.alsoResize||r.alsoResize.nodeType?l(r.alsoResize):e.each(r.alsoResize,function(e,t){l(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:n.height,width:n.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,n=t.size,r=t.originalSize,s=t.originalPosition,o=t.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=a[0]||1,c=a[1]||1,h=Math.round((n.width-r.width)/l)*l,u=Math.round((n.height-r.height)/c)*c,d=r.width+h,p=r.height+u,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,_=i.minHeight&&i.minHeight>p;i.grid=a,g&&(d+=l),_&&(p+=c),f&&(d-=l),m&&(p-=c),/^(se|s|e)$/.test(o)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.top=s.top-u):/^(sw)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.left=s.left-h):(p-c>0?(t.size.height=p,t.position.top=s.top-u):(t.size.height=c,t.position.top=s.top+r.height-c),d-l>0?(t.size.width=d,t.position.left=s.left-h):(t.size.width=l,t.position.left=s.left+r.width-l))}})}(jQuery),function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.4",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,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.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 i=this,n=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(n.filter,this.element[0]),this._trigger("start",t),e(n.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),n.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var n=e.data(this,"selectable-item");n.startselected=!0,t.metaKey||t.ctrlKey||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",t,{unselecting:n.element}))}),e(t.target).parents().addBack().each(function(){var n,r=e.data(this,"selectable-item");return r?(n=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected"),r.$element.removeClass(n?"ui-unselecting":"ui-selected").addClass(n?"ui-selecting":"ui-unselecting"),r.unselecting=!n,r.selecting=n,r.selected=n,n?i._trigger("selecting",t,{selecting:r.element}):i._trigger("unselecting",t,{unselecting:r.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,n=this,r=this.options,s=this.opos[0],o=this.opos[1],a=t.pageX,l=t.pageY;return s>a&&(i=a,a=s,s=i),o>l&&(i=l,l=o,o=i),this.helper.css({left:s,top:o,width:a-s,height:l-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),c=!1;i&&i.element!==n.element[0]&&("touch"===r.tolerance?c=!(i.left>a||s>i.right||i.top>l||o>i.bottom):"fit"===r.tolerance&&(c=i.left>s&&a>i.right&&i.top>o&&l>i.bottom),c?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,n._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),n._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,n._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-unselecting"),n.unselecting=!1,n.startselected=!1,i._trigger("unselected",t,{unselected:n.element})}),e(".ui-selecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-selecting").addClass("ui-selected"),n.selecting=!1,n.selected=!0,n.startselected=!0,i._trigger("selected",t,{selected:n.element})}),this._trigger("stop",t),this.helper.remove(),!1}})}(jQuery),function(e){var t=5;e.widget("ui.slider",e.ui.mouse,{version:"1.10.4",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},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),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,i,n=this.options,r=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),s="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(i=n.values&&n.values.length||1,r.length>i&&(r.slice(i).remove(),r=r.slice(0,i)),t=r.length;i>t;t++)o.push(s);this.handles=r.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,i="";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),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){var e=this.handles.add(this.range).filter("a");this._off(e),this._on(e,this._handleEvents),this._hoverable(e),this._focusable(e)},_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 i,n,r,s,o,a,l,c,h=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},n=this._normValueFromMouse(i),r=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(n-h.values(t));(r>i||r===i&&(t===h._lastChangedValue||h.values(t)===u.min))&&(r=i,s=e(this),o=t)}),a=this._start(t,o),a===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),l=s.offset(),c=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=c?{left:0,top:0}:{left:t.pageX-l.left-s.width()/2,top:t.pageY-l.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,n),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!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,i,n,r,s;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),n=i/t,n>1&&(n=1),0>n&&(n=0),"vertical"===this.orientation&&(n=1-n),r=this._valueMax()-this._valueMin(),s=this._valueMin()+n*r,this._trimAlignValue(s)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var n,r,s;this.options.values&&this.options.values.length?(n=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>n||1===t&&n>i)&&(i=n),i!==this.values(t)&&(r=this.values(),r[t]=i,s=this._trigger("slide",e,{handle:this.handles[t],value:i,values:r}),n=this.values(t?0:1),s!==!1&&this.values(t,i))):i!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:i}),s!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,i){var n,r,s;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),void this._change(null,t);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(n=this.options.values,r=arguments[0],s=0;n.length>s;s+=1)n[s]=this._trimAlignValue(r[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,i){var n,r=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(r=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),n=0;r>n;n+=1)this._change(null,n);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,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,i,n;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),n=0;i.length>n;n+=1)i[n]=this._trimAlignValue(i[n]);return i}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,i=(e-this._valueMin())%t,n=e-i;return 2*Math.abs(i)>=t&&(n+=i>0?t:-t),parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,n,r,s,o=this.options.range,a=this.options,l=this,c=this._animateOff?!1:a.animate,h={};this.options.values&&this.options.values.length?this.handles.each(function(n){i=100*((l.values(n)-l._valueMin())/(l._valueMax()-l._valueMin())),h["horizontal"===l.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[c?"animate":"css"](h,a.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===n&&l.range.stop(1,1)[c?"animate":"css"]({left:i+"%"},a.animate),1===n&&l.range[c?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:a.animate})):(0===n&&l.range.stop(1,1)[c?"animate":"css"]({bottom:i+"%"},a.animate),1===n&&l.range[c?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:a.animate}))),t=i}):(n=this.value(),r=this._valueMin(),s=this._valueMax(),i=s!==r?100*((n-r)/(s-r)):0,h["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[c?"animate":"css"](h,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range[c?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:a.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[c?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range[c?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:a.animate}))},_handleEvents:{keydown:function(i){var n,r,s,o,a=e(i.target).data("ui-slider-handle-index");switch(i.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(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(i.target).addClass("ui-state-active"),n=this._start(i,a),n===!1))return}switch(o=this.options.step,r=s=this.options.values&&this.options.values.length?this.values(a):this.value(),i.keyCode){case e.ui.keyCode.HOME:s=this._valueMin();break;case e.ui.keyCode.END:s=this._valueMax();break;case e.ui.keyCode.PAGE_UP:s=this._trimAlignValue(r+(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.PAGE_DOWN:s=this._trimAlignValue(r-(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(r===this._valueMax())return;s=this._trimAlignValue(r+o);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(r===this._valueMin())return;s=this._trimAlignValue(r-o)}this._slide(i,a,s)},click:function(e){e.preventDefault()},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}})}(jQuery),function(e){function t(e,t,i){return e>t&&t+i>e}function i(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.4",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},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var n=null,r=!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?(n=e(this),!1):void 0}),e.data(t.target,s.widgetName+"-item")===s&&(n=e(t.target)),n&&(!this.options.handle||i||(e(this.options.handle,n).find("*").addBack().each(function(){this===t.target&&(r=!0)}),r))?(this.currentItem=n,this._removeCurrentsFromItems(),!0):!1)},_mouseStart:function(t,i,n){var r,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]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!n)for(r=this.containers.length-1;r>=0;r--)this.containers[r]._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 i,n,r,s,o=this.options,a=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?a=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(a=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?a=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(a=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),a!==!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"),i=this.items.length-1;i>=0;i--)if(n=this.items[i],r=n.item[0],s=this._intersectsWithPointer(n),s&&n.instance===this.currentContainer&&r!==this.currentItem[0]&&this.placeholder[1===s?"next":"prev"]()[0]!==r&&!e.contains(this.placeholder[0],r)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],r):!0)){if(this.direction=1===s?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(n))break;this._rearrange(t,n),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,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var n=this,r=this.placeholder.offset(),s=this.options.axis,o={};s&&"x"!==s||(o.left=r.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),s&&"y"!==s||(o.top=r.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){n._clear(t)})}else this._clear(t,i);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 i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&n.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!n.length&&t.key&&n.push(t.key+"="),n.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},i.each(function(){n.push(e(t.item||this).attr(t.attribute||"id")||"")}),n},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,n=this.positionAbs.top,r=n+this.helperProportions.height,s=e.left,o=s+e.width,a=e.top,l=a+e.height,c=this.offset.click.top,h=this.offset.click.left,u="x"===this.options.axis||n+c>a&&l>n+c,d="y"===this.options.axis||t+h>s&&o>t+h,p=u&&d;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>i-this.helperProportions.width/2&&n+this.helperProportions.height/2>a&&l>r-this.helperProportions.height/2},_intersectsWithPointer:function(e){var i="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),n="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=i&&n,s=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return r?this.floating?o&&"right"===o||"down"===s?2:1:s&&("down"===s?2:1):!1},_intersectsWithSides:function(e){var i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),n=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?"right"===s&&n||"left"===s&&!n:r&&("down"===r&&i||"up"===r&&!i)},_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.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){a.push(this)}var n,r,s,o,a=[],l=[],c=this._connectWith();if(c&&t)for(n=c.length-1;n>=0;n--)for(s=e(c[n]),r=s.length-1;r>=0;r--)o=e.data(s[r],this.widgetFullName),o&&o!==this&&!o.options.disabled&&l.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(l.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]),n=l.length-1;n>=0;n--)l[n][0].each(i);return e(a)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,n,r,s,o,a,l,c,h=this.items,u=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(r=e(d[i]),n=r.length-1;n>=0;n--)s=e.data(r[n],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(u.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(i=u.length-1;i>=0;i--)for(o=u[i][1],a=u[i][0],n=0,c=a.length;c>n;n++)l=e(a[n]),l.data(this.widgetName+"-item",o),h.push({item:l,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,n,r,s;for(i=this.items.length-1;i>=0;i--)n=this.items[i],n.instance!==this.currentContainer&&this.currentContainer&&n.item[0]!==this.currentItem[0]||(r=this.options.toleranceElement?e(this.options.toleranceElement,n.item):n.item,t||(n.width=r.outerWidth(),n.height=r.outerHeight()),s=r.offset(),n.left=s.left,n.top=s.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)s=this.containers[i].element.offset(),this.containers[i].containerCache.left=s.left,this.containers[i].containerCache.top=s.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,n=t.options;n.placeholder&&n.placeholder.constructor!==String||(i=n.placeholder,n.placeholder={element:function(){var n=t.currentItem[0].nodeName.toLowerCase(),r=e("<"+n+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===n?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(r)}):"img"===n&&r.attr("src",t.currentItem.attr("src")),i||r.css("visibility","hidden"),r},update:function(e,r){(!i||n.forcePlaceholderSize)&&(r.height()||r.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),r.width()||r.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(n.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),n.placeholder.update(t,t.placeholder)},_contactContainers:function(n){var r,s,o,a,l,c,h,u,d,p,f=null,m=null;for(r=this.containers.length-1;r>=0;r--)if(!e.contains(this.currentItem[0],this.containers[r].element[0]))if(this._intersectsWith(this.containers[r].containerCache)){if(f&&e.contains(this.containers[r].element[0],f.element[0]))continue;f=this.containers[r],m=r}else this.containers[r].containerCache.over&&(this.containers[r]._trigger("out",n,this._uiHash(this)),this.containers[r].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,a=null,p=f.floating||i(this.currentItem),l=p?"left":"top",c=p?"width":"height",h=this.positionAbs[l]+this.offset.click[l],s=this.items.length-1;s>=0;s--)e.contains(this.containers[m].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(!p||t(this.positionAbs.top+this.offset.click.top,this.items[s].top,this.items[s].height))&&(u=this.items[s].item.offset()[l],d=!1,Math.abs(u-h)>Math.abs(u+this.items[s][c]-h)&&(d=!0,u+=this.items[s][c]),o>Math.abs(u-h)&&(o=Math.abs(u-h),a=this.items[s],this.direction=d?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;a?this._rearrange(n,a,null,!0):this._rearrange(n,null,this.containers[m].element,!0),this._trigger("change",n,this._uiHash()),this.containers[m]._trigger("change",n,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return n.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(n[0]),n[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")}),(!n[0].style.width||i.forceHelperSize)&&n.width(this.currentItem.width()),(!n[0].style.height||i.forceHelperSize)&&n.height(this.currentItem.height()),n},_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]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.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,i,n,r=this.options;"parent"===r.containment&&(r.containment=this.helper[0].parentNode),("document"===r.containment||"window"===r.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===r.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===r.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(r.containment)||(t=e(r.containment)[0],i=e(r.containment).offset(),n="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(n?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,i.top+(n?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,i){i||(i=this.position);var n="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(r[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:r.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:r.scrollLeft())*n}},_generatePosition:function(t){var i,n,r=this.options,s=t.pageX,o=t.pageY,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(a[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&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)),r.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/r.grid[1])*r.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-r.grid[1]:i+r.grid[1]:i,n=this.originalPageX+Math.round((s-this.originalPageX)/r.grid[0])*r.grid[0],s=this.containment?n-this.offset.click.left>=this.containment[0]&&n-this.offset.click.left<=this.containment[2]?n:n-this.offset.click.left>=this.containment[0]?n-r.grid[0]:n+r.grid[0]:n)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:a.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:a.scrollLeft())}},_rearrange:function(e,t,i,n){i?i[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 r=this.counter;this._delay(function(){r===this.counter&&this.refreshPositions(!n)})},_clear:function(e,t){function i(e,t,i){return function(n){i._trigger(e,n,t._uiHash(t))}}this.reverting=!1;var n,r=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(n in this._storedCSS)("auto"===this._storedCSS[n]||"static"===this._storedCSS[n])&&(this._storedCSS[n]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&r.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||r.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(r.push(function(e){this._trigger("remove",e,this._uiHash())}),r.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),r.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),n=this.containers.length-1;n>=0;n--)t||r.push(i("deactivate",this,this.containers[n])),this.containers[n].containerCache.over&&(r.push(i("out",this,this.containers[n])),this.containers[n].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,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),n=0;r.length>n;n++)r[n].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(n=0;r.length>n;n++)r[n].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})}(jQuery),function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.10.4",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={},i=this.element;return e.each(["min","max","step"],function(e,n){var r=i.attr(n);void 0!==r&&r.length&&(t[n]=r)}),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?void delete this.cancelBlur:(this._stop(),this._refresh(),void(this.previous!==this.element.val()&&this._trigger("change",e)))},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 i(){
var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.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:void this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t):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 i=this.options,n=e.ui.keyCode;switch(t.keyCode){case n.UP:return this._repeat(null,1,t),!0;case n.DOWN:return this._repeat(null,-1,t),!0;case n.PAGE_UP:return this._repeat(null,i.page,t),!0;case n.PAGE_DOWN:return this._repeat(null,-i.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,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(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,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,n=this.options;return t=null!==n.min?n.min:0,i=e-t,i=Math.round(i/n.step)*n.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==n.max&&e>n.max?n.max:null!==n.min&&n.min>e?n.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 i=this._parse(this.element.val());return this.options[e]=t,void this.element.val(this._format(i))}("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&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_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())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),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:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?void t(this._value).call(this,e):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(e,t){function i(){return++r}function n(e){return e=e.cloneNode(!1),e.hash.length>1&&decodeURIComponent(e.href.replace(s,""))===decodeURIComponent(location.href.replace(s,""))}var r=0,s=/#.*$/;e.widget("ui.tabs",{version:"1.10.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > 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._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.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(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,n=this.options.collapsible,r=location.hash.substring(1);return null===i&&(r&&this.tabs.each(function(n,s){return e(s).attr("aria-controls")===r?(i=n,!1):t}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=n?!1:0)),!n&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(i){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),s=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:s=!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 i.preventDefault(),clearTimeout(this.activating),this._activate(r),t;case e.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r),t;default:return}i.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,s),i.ctrlKey||(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(i){return i.altKey&&i.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):t},_findNextTab:function(t,i){function n(){return t>r&&(t=0),0>t&&(t=r),t}for(var r=this.tabs.length-1;-1!==e.inArray(n(),this.options.disabled);)t=i?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,i){return"active"===e?(this._activate(i),t):"disabled"===e?(this._setupDisabled(i),t):(this._super(e,i),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(i),"heightStyle"===e&&this._setupHeightStyle(i),t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.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",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),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(i,r){var s,o,a,l=e(r).uniqueId().attr("id"),c=e(r).closest("li"),h=c.attr("aria-controls");n(r)?(s=r.hash,o=t.element.find(t._sanitizeSelector(s))):(a=t._tabId(c),s="#"+a,o=t.element.find(s),o.length||(o=t._createPanel(a),o.insertAfter(t.panels[i-1]||t.tablist)),o.attr("aria-live","polite")),o.length&&(t.panels=t.panels.add(o)),h&&c.data("ui-tabs-aria-controls",h),c.attr({"aria-controls":s.substring(1),"aria-labelledby":l}),o.attr("aria-labelledby",l)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_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 i,n=0;i=this.tabs[n];n++)t===!0||-1!==e.inArray(n,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,n=this.element.parent();"fill"===t?(i=n.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),n=t.css("position");"absolute"!==n&&"fixed"!==n&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,n=this.active,r=e(t.currentTarget),s=r.closest("li"),o=s[0]===n[0],a=o&&i.collapsible,l=a?e():this._getPanelForTab(s),c=n.length?this._getPanelForTab(n):e(),h={oldTab:n,oldPanel:c,newTab:a?e():s,newPanel:l};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,h)===!1||(i.active=a?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),c.length||l.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(s),t),this._toggle(t,h))},_toggle:function(t,i){function n(){s.running=!1,s._trigger("activate",t,i)}function r(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&s.options.show?s._show(o,s.options.show,n):(o.show(),n())}var s=this,o=i.newPanel,a=i.oldPanel;this.running=!0,a.length&&this.options.hide?this._hide(a,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),a.hide(),r()),a.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),o.length&&a.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,n=this._findActive(t);n[0]!==this.active[0]&&(n.length||(n=this.active),i=n.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,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.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),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var n=this.options.disabled;n!==!1&&(i===t?n=!1:(i=this._getIndex(i),n=e.isArray(n)?e.map(n,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(n))},disable:function(i){var n=this.options.disabled;if(n!==!0){if(i===t)n=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,n))return;n=e.isArray(n)?e.merge([i],n).sort():[i]}this._setupDisabled(n)}},load:function(t,i){t=this._getIndex(t);var r=this,s=this.tabs.eq(t),o=s.find(".ui-tabs-anchor"),a=this._getPanelForTab(s),l={tab:s,panel:a};n(o[0])||(this.xhr=e.ajax(this._ajaxSettings(o,i,l)),this.xhr&&"canceled"!==this.xhr.statusText&&(s.addClass("ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){a.html(e),r._trigger("load",i,l)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&r.panels.stop(!1,!0),s.removeClass("ui-tabs-loading"),a.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)})))},_ajaxSettings:function(t,i,n){var r=this;return{url:t.attr("href"),beforeSend:function(t,s){return r._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:s},n))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}(jQuery),function(e){function t(t,i){var n=(t.attr("aria-describedby")||"").split(/\s+/);n.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(n.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),n=(t.attr("aria-describedby")||"").split(/\s+/),r=e.inArray(i,n);-1!==r&&n.splice(r,1),t.removeData("ui-tooltip-id"),n=e.trim(n.join(" ")),n?t.attr("aria-describedby",n):t.removeAttr("aria-describedby")}var n=0;e.widget("ui.tooltip",{version:"1.10.4",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},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var n=this;return"disabled"===t?(this[i?"_disable":"_enable"](),void(this.options[t]=i)):(this._super(t,i),void("content"===t&&e.each(this.tooltips,function(e,t){n._updateContent(t)})))},_disable:function(){var t=this;e.each(this.tooltips,function(i,n){var r=e.Event("blur");r.target=r.currentTarget=n[0],t.close(r,!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")).attr("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 i=this,n=e(t?t.target:this.element).closest(this.options.items);n.length&&!n.data("ui-tooltip-id")&&(n.attr("title")&&n.data("ui-tooltip-title",n.attr("title")),n.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&n.parents().each(function(){var t,n=e(this);n.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),n.attr("title")&&(n.uniqueId(),i.parents[this.id]={element:this,title:n.attr("title")},n.attr("title",""))}),this._updateContent(n,t))},_updateContent:function(e,t){var i,n=this.options.content,r=this,s=t?t.type:null;return"string"==typeof n?this._open(t,e,n):(i=n.call(e[0],function(i){e.data("ui-tooltip-open")&&r._delay(function(){t&&(t.type=s),this._open(t,e,i)})}),void(i&&this._open(t,e,i)))},_open:function(i,n,r){function s(e){c.of=e,o.is(":hidden")||o.position(c)}var o,a,l,c=e.extend({},this.options.position);if(r){if(o=this._find(n),o.length)return void o.find(".ui-tooltip-content").html(r);n.is("[title]")&&(i&&"mouseover"===i.type?n.attr("title",""):n.removeAttr("title")),o=this._tooltip(n),t(n,o.attr("id")),o.find(".ui-tooltip-content").html(r),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:s}),s(i)):o.position(e.extend({of:n},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(l=this.delayedShow=setInterval(function(){o.is(":visible")&&(s(c.of),clearInterval(l))},e.fx.interval)),this._trigger("open",i,{tooltip:o}),a={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=n[0],this.close(i,!0)}},remove:function(){this._removeTooltip(o)}},i&&"mouseover"!==i.type||(a.mouseleave="close"),i&&"focusin"!==i.type||(a.focusout="close"),this._on(!0,n,a)}},close:function(t){var n=this,r=e(t?t.currentTarget:this.element),s=this._find(r);this.closing||(clearInterval(this.delayedShow),r.data("ui-tooltip-title")&&r.attr("title",r.data("ui-tooltip-title")),i(r),s.stop(!0),this._hide(s,this.options.hide,function(){n._removeTooltip(e(this))}),r.removeData("ui-tooltip-open"),this._off(r,"mouseleave focusout keyup"),r[0]!==this.element[0]&&this._off(r,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:s}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+n++,r=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(r),r.appendTo(this.document[0].body),this.tooltips[i]=t,r},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,n){var r=e.Event("blur");r.target=r.currentTarget=n[0],t.close(r,!0),e("#"+i).remove(),n.data("ui-tooltip-title")&&(n.attr("title",n.data("ui-tooltip-title")),n.removeData("ui-tooltip-title"))})}})}(jQuery),define("jqueryui",["jquery"],function(e){return function(){var t;return t||e.$}}(this)),define("notebook/js/outputarea",["jqueryui","base/js/utils","base/js/security","base/js/keyboard","notebook/js/mathjaxutils","components/marked/lib/marked"],function($,utils,security,keyboard,mathjaxutils,marked){"use strict";function _get_metadata_key(e,t,i){var n=e[i];return n&&void 0!==n[t]?n[t]:e[t]}function dblclick_to_reset_size(e){e.dblclick(function(){e.hasClass("unconfined")?e.removeClass("unconfined"):e.addClass("unconfined")})}var OutputArea=function(e){this.selector=e.selector,this.events=e.events,this.keyboard_manager=e.keyboard_manager,this.wrapper=$(e.selector),this.outputs=[],this.collapsed=!1,this.scrolled=!1,this.scroll_state="auto",this.trusted=!0,this.clear_queued=null,void 0===e.prompt_area?this.prompt_area=!0:this.prompt_area=e.prompt_area,this.create_elements(),this.style(),this.bind_events()};OutputArea.prototype.create_elements=function(){this.element=$("<div/>"),this.collapse_button=$("<div/>"),this.prompt_overlay=$("<div/>"),this.wrapper.append(this.prompt_overlay),this.wrapper.append(this.element),this.wrapper.append(this.collapse_button)},OutputArea.prototype.style=function(){this.collapse_button.hide(),this.prompt_overlay.hide(),this.wrapper.addClass("output_wrapper"),this.element.addClass("output"),this.collapse_button.addClass("btn btn-default output_collapsed"),this.collapse_button.attr("title","click to expand output"),this.collapse_button.text(". . ."),this.prompt_overlay.addClass("out_prompt_overlay prompt"),this.prompt_overlay.attr("title","click to expand output; double click to hide output"),this.collapse()},OutputArea.prototype._should_scroll=function(){var e;if(this.scroll_state===!1)return!1;if(e=this.scroll_state===!0?OutputArea.minimum_scroll_threshold:OutputArea.auto_scroll_threshold,0>=e)return!1;var t=this.element.css("font-size"),i=Math.floor(1.5*parseInt(t.replace("px","")));return this.element.height()>e*i},OutputArea.prototype.bind_events=function(){var e=this;this.prompt_overlay.dblclick(function(){e.toggle_output()}),this.prompt_overlay.click(function(){e.toggle_scroll()}),this.element.resize(function(){"Firefox"!==utils.browser[0]&&!e.scrolled&&e._should_scroll()&&e.scroll_area()}),this.collapse_button.click(function(){e.expand()})},OutputArea.prototype.collapse=function(){this.collapsed||(this.element.hide(),this.prompt_overlay.hide(),this.element.html()&&this.collapse_button.show(),this.collapsed=!0,this.scroll_state="auto")},OutputArea.prototype.expand=function(){this.collapsed&&(this.collapse_button.hide(),this.element.show(),this.prompt_area&&this.prompt_overlay.show(),this.collapsed=!1,this.scroll_if_long())},OutputArea.prototype.toggle_output=function(){this.collapsed?this.expand():this.collapse()},OutputArea.prototype.scroll_area=function(){this.element.addClass("output_scroll"),this.prompt_overlay.attr("title","click to unscroll output; double click to hide"),this.scrolled=!0},OutputArea.prototype.unscroll_area=function(){this.element.removeClass("output_scroll"),this.prompt_overlay.attr("title","click to scroll output; double click to hide"),this.scrolled=!1},OutputArea.prototype.scroll_if_long=function(){var e=this._should_scroll();!this.scrolled&&e?this.scroll_area():this.scrolled&&!e&&this.unscroll_area()},OutputArea.prototype.toggle_scroll=function(){"auto"==this.scroll_state?this.scroll_state=!this.scrolled:this.scroll_state=!this.scroll_state,this.scrolled?this.unscroll_area():this.scroll_if_long()},OutputArea.prototype.typeset=function(){utils.typeset(this.element)},OutputArea.prototype.handle_output=function(e){var t={},i=t.output_type=e.header.msg_type,n=e.content;if("stream"===i)t.text=n.text,t.name=n.name;else if("display_data"===i)t.data=n.data,t.metadata=n.metadata;else if("execute_result"===i)t.data=n.data,t.metadata=n.metadata,t.execution_count=n.execution_count;else{if("error"!==i)return void console.log("unhandled output message",e);t.ename=n.ename,t.evalue=n.evalue,t.traceback=n.traceback}this.events.trigger("output_message.OutputArea",[i,e,this]),this.append_output(t)},OutputArea.output_types=["application/javascript","text/html","text/markdown","text/latex","image/svg+xml","image/png","image/jpeg","application/pdf","text/plain"],OutputArea.prototype.validate_mimebundle=function(e){"object"!=typeof e.data&&(console.warn("mimebundle missing data",e),e.data={}),"object"!=typeof e.metadata&&(console.warn("mimebundle missing metadata",e),e.metadata={});var t=e.data;return $.map(OutputArea.output_types,function(e){"application/json"!==e&&void 0!==t[e]&&"string"!=typeof t[e]&&(console.log("Invalid type for "+e,t[e]),delete t[e])}),e},OutputArea.prototype.append_output=function(e){this.expand();var t=!1;this.clear_queued&&(this.clear_output(!1),t=!0);var i=!0;switch(e.output_type){case"execute_result":e=this.validate_mimebundle(e),this.append_execute_result(e);break;case"stream":i=this.append_stream(e);break;case"error":this.append_error(e);break;case"display_data":e=this.validate_mimebundle(e);break;default:console.log("unrecognized output type: "+e.output_type),this.append_unrecognized(e)}var n=this,r=function(e){t&&n.element.height(""),n.element.trigger("resize")};"display_data"===e.output_type?this.append_display_data(e,r):r(),i&&this.outputs.push(e)},OutputArea.prototype.create_output_area=function(){var e=$("<div/>").addClass("output_area");return this.prompt_area&&e.append($("<div/>").addClass("prompt")),e},OutputArea.prototype.create_output_subarea=function(e,t,i){var n=$("<div/>").addClass("output_subarea").addClass(t);if(_get_metadata_key(e,"isolated",i)){var r=$("<iframe/>").addClass("box-flex1");return r.css({height:1,width:"100%",display:"block"}),r.attr("frameborder",0),r.attr("scrolling","auto"),r.on("load",function(){this.contentDocument.open(),this.contentDocument.write(n.html()),this.contentDocument.close();var e=this.contentDocument.body;r.height(e.scrollHeight+"px")}),r.append=function(e){n.append(e)},r}return n},OutputArea.prototype._append_javascript_error=function(e,t){var i="Javascript error adding output!";void 0!==t&&t.append($("<div/>").text(i).addClass("js-error")).append($("<div/>").text(e.toString()).addClass("js-error")).append($("<div/>").text("See your browser Javascript console for more details.").addClass("js-error"))},OutputArea.prototype._safe_append=function(e){try{this.element.append(e)}catch(t){console.log(t);var e=this.create_output_area(),i=$("<div/>").addClass("output_subarea");e.append(i),this._append_javascript_error(t,i),this.element.append(e)}this.element.trigger("changed")},OutputArea.prototype.append_execute_result=function(e){var t=e.execution_count||" ",i=this.create_output_area();this.prompt_area&&i.find("div.prompt").addClass("output_prompt").text("Out["+t+"]:");var n=this.append_mime_type(e,i);n&&n.addClass("output_result"),this._safe_append(i),(void 0!==e.data["text/latex"]||void 0!==e.data["text/html"]||void 0!==e.data["text/markdown"])&&this.typeset()},OutputArea.prototype.append_error=function(e){var t=e.traceback;if(void 0!==t&&t.length>0){for(var i="",n=t.length,r=0;n>r;r++)i=i+t[r]+"\n";i+="\n";var s=this.create_output_area(),o=OutputArea.append_map["text/plain"];o&&o.apply(this,[i,{},s]).addClass("output_error"),this._safe_append(s)}},OutputArea.prototype.append_stream=function(e){var t=e.text;if("string"!=typeof t)return console.error("Stream output is invalid (missing text)",e),!1;var i="output_"+e.name;if(this.outputs.length>0){var n=this.outputs[this.outputs.length-1];if("stream"==n.output_type&&e.name==n.name){n.text=utils.fixCarriageReturn(n.text+e.text);var r=this.element.find("div."+i).last().find("pre"),s=utils.fixConsole(n.text);return s=utils.autoLinkUrls(s),r.html(s),!1}}if(!t.replace("\r",""))return!0;var o=this.create_output_area(),a=OutputArea.append_map["text/plain"];return a&&a.apply(this,[t,{},o]).addClass("output_stream "+i),this._safe_append(o),!0},OutputArea.prototype.append_unrecognized=function(e){var t=this,i=this.create_output_area(),n=$("<div/>").addClass("output_subarea output_unrecognized");i.append(n),n.append($("<a>").attr("href","#").text("Unrecognized output: "+e.output_type).click(function(){t.events.trigger("unrecognized_output.OutputArea",{output:e})})),this._safe_append(i)},OutputArea.prototype.append_display_data=function(e,t){var i=this.create_output_area();this.append_mime_type(e,i,t)&&(this._safe_append(i),(void 0!==e.data["text/latex"]||void 0!==e.data["text/html"]||void 0!==e.data["text/markdown"])&&this.typeset())},OutputArea.safe_outputs={"text/plain":!0,"text/latex":!0,"image/png":!0,"image/jpeg":!0},OutputArea.prototype.append_mime_type=function(e,t,i){for(var n=0;n<OutputArea.display_order.length;n++){var r=OutputArea.display_order[n],s=OutputArea.append_map[r];if(void 0!==e.data[r]&&s){var o=e.data[r];if(!this.trusted&&!OutputArea.safe_outputs[r]){if("text/html"!==r&&"text/svg"!==r){console.log("Ignoring untrusted "+r+" output.");continue}o=security.sanitize_html(o)}var a=e.metadata||{},l=s.apply(this,[o,a,t,i]);return["image/png","image/jpeg"].indexOf(r)<0&&void 0!==i&&setTimeout(i,0),this.events.trigger("output_appended.OutputArea",[r,o,a,l]),l}}return null};var append_html=function(e,t,i){var n="text/html",r=this.create_output_subarea(t,"output_html rendered_html",n);return this.keyboard_manager.register_events(r),r.append(e),dblclick_to_reset_size(r.find("img")),i.append(r),r},append_markdown=function(e,t,i){var n="text/markdown",r=this.create_output_subarea(t,"output_markdown rendered_html",n),s=mathjaxutils.remove_math(e),o=s[0],a=s[1];return marked(o,function(e,t){t=mathjaxutils.replace_math(t,a),r.append(t)}),dblclick_to_reset_size(r.find("img")),i.append(r),r},append_javascript=function(js,md,element){var type="application/javascript",toinsert=this.create_output_subarea(md,"output_javascript rendered_html",type);this.keyboard_manager.register_events(toinsert),element.append(toinsert),element=toinsert;try{eval(js)}catch(err){console.log(err),this._append_javascript_error(err,toinsert)}return toinsert},append_text=function(e,t,i){var n="text/plain",r=this.create_output_subarea(t,"output_text",n);return e=utils.fixConsole(e),e=utils.fixCarriageReturn(e),e=utils.autoLinkUrls(e),r.append($("<pre/>").html(e)),i.append(r),r},append_svg=function(e,t,i){var n="image/svg+xml",r=this.create_output_subarea(t,"output_svg",n),s=$("<div />").html(e).find("svg"),o=$("<div />"),a=s.attr("width"),l=s.attr("height");return s.width("100%").height("100%"),o.width(a).height(l),o.append(s),r.append(o),i.append(r),r},set_width_height=function(e,t,i){var n=_get_metadata_key(t,"height",i);void 0!==n&&e.attr("height",n);var r=_get_metadata_key(t,"width",i);
void 0!==r&&e.attr("width",r),_get_metadata_key(t,"unconfined",i)&&e.addClass("unconfined")},append_png=function(e,t,i,n){var r="image/png",s=this.create_output_subarea(t,"output_png",r),o=$("<img/>");return void 0!==n&&o.on("load",function(){n(o)}),o[0].src="data:image/png;base64,"+e,set_width_height(o,t,"image/png"),dblclick_to_reset_size(o),s.append(o),i.append(s),s},append_jpeg=function(e,t,i,n){var r="image/jpeg",s=this.create_output_subarea(t,"output_jpeg",r),o=$("<img/>");return void 0!==n&&o.on("load",function(){n(o)}),o[0].src="data:image/jpeg;base64,"+e,set_width_height(o,t,"image/jpeg"),dblclick_to_reset_size(o),s.append(o),i.append(s),s},append_pdf=function(e,t,i){var n="application/pdf",r=this.create_output_subarea(t,"output_pdf",n),s=$("<a/>").attr("href","data:application/pdf;base64,"+e);return s.attr("target","_blank"),s.text("View PDF"),r.append(s),i.append(r),r},append_latex=function(e,t,i){var n="text/latex",r=this.create_output_subarea(t,"output_latex",n);return r.append(e),i.append(r),r};return OutputArea.prototype.append_raw_input=function(e){var t=this;this.expand();var i=e.content,n=this.create_output_area();$("div.output_subarea.raw_input_container").remove();var r=i.password?"password":"text";n.append($("<div/>").addClass("box-flex1 output_subarea raw_input_container").append($("<pre/>").addClass("raw_input_prompt").text(i.prompt).append($("<input/>").addClass("raw_input").attr("type",r).attr("size",47).keydown(function(e,i){return e.which===keyboard.keycodes.enter?(t._submit_raw_input(),!1):void 0})))),this.element.append(n);var s=n.find("input.raw_input");this.keyboard_manager.register_events(s),s.focus()},OutputArea.prototype._submit_raw_input=function(e){var t=this.element.find("div.raw_input_container"),i=t.find("pre.raw_input_prompt"),n=t.find("input.raw_input"),r=n.val(),s=r;"password"==n.attr("type")&&(s="········");var o={output_type:"stream",name:"stdout",text:i.text()+s+"\n"};t.parent().remove(),this.append_output(o,!1),this.events.trigger("send_input_reply.Kernel",r)},OutputArea.prototype.handle_clear_output=function(e){this.clear_output(e.content.wait||!1)},OutputArea.prototype.clear_output=function(e,t){if(!e){if(!t&&this.clear_queued){var i=this.element.height();this.element.height(i),this.clear_queued=!1}return this.element.find("img").off("load"),this.element.html(""),this.element.trigger("changed"),this.outputs=[],this.trusted=!0,void this.unscroll_area()}this.clear_queued&&this.clear_output(!1),this.clear_queued=!0},OutputArea.prototype.fromJSON=function(e,t){var i=e.length;t=t||{};for(var n=0;i>n;n++)this.append_output(e[n]);void 0!==t.collapsed&&(t.collapsed?this.collapse():this.expand()),void 0!==t.scrolled&&(this.scroll_state=t.scrolled,t.scrolled?this.scroll_if_long():this.unscroll_area())},OutputArea.prototype.toJSON=function(){return this.outputs},OutputArea.auto_scroll_threshold=100,OutputArea.minimum_scroll_threshold=20,OutputArea.display_order=["application/javascript","text/html","text/markdown","text/latex","image/svg+xml","image/png","image/jpeg","application/pdf","text/plain"],OutputArea.append_map={"text/plain":append_text,"text/html":append_html,"text/markdown":append_markdown,"image/svg+xml":append_svg,"image/png":append_png,"image/jpeg":append_jpeg,"text/latex":append_latex,"application/javascript":append_javascript,"application/pdf":append_pdf},{OutputArea:OutputArea}}),define("notebook/js/contexthint",["codemirror/lib/codemirror"],function(e){"use strict";var t=function(e,t){if(!Array.prototype.indexOf){for(var i=e.length;i--;)if(e[i]===t)return!0;return!1}return-1!=e.indexOf(t)};e.contextHint=function(e){for(var t=e.getCursor(),i=e.getTokenAt(t),r=[],s=n(i,e),o=0;o<s.length;o++)r.push({str:s[o],type:"context",from:{line:t.line,ch:i.start},to:{line:t.line,ch:i.end}});return r};var i=function(e){function i(e){t(n,e)||n.push(e)}for(var n=[],r=e.lineCount(),s=0;r>s;s++)for(var o=e.getLine(s),a=1;a<o.length;a++){var l=e.getTokenAt({line:s,ch:a});null!==l.className&&i(l.string),a=l.end}return n},n=function(e,t){var n=i(t),r=function(t){return 0===t.indexOf(e.string)&&t!=e.string},s=n.filter(r);return s};return{contextHint:e.contextHint}}),define("notebook/js/completer",["jquery","base/js/utils","base/js/keyboard","notebook/js/contexthint","codemirror/lib/codemirror"],function(e,t,i,n){"use strict";function r(e,t){if(1==e.length)return e[0];for(var i=[],n=10,r=0;r<e.length;r++){var s=e[r].str,a=0;if(t===!0)for(;"%"==s.substr(0,1);)a+=1,s=s.substring(1);n=Math.min(n,a),i.push(s)}if(i.length>1){var l,c,h;for(i=i.slice(0).sort(),l=i[0],h=l.length,c=i.pop();h&&-1==c.indexOf(l);)l=l.substring(0,--h);return""===l||0!==c.indexOf(l)?{str:o("",n),type:"computed",from:e[0].from,to:e[0].to}:{str:o(l,n),type:"computed",from:e[0].from,to:e[0].to}}return null}var s=i.keycodes,o=function(e,t){for(var i=0;t>i;i++)e="%"+e;return e},a=function(e,t){for(var i=0;i<t.length;i++)if(t[i].trim().substr(-e.length)==e)return!0;return!1},l=function(e,t){this.cell=e,this.editor=e.code_mirror;var i=this;t.on("kernel_busy.Kernel",function(){i.skip_kernel_completion=!0}),t.on("kernel_idle.Kernel",function(){i.skip_kernel_completion=!1})};return l.prototype.startCompletion=function(){this.editor.somethingSelected()||this.editor.getSelections().length>1||(this.done=!1,this.carry_on_completion(!0))},l.reinvoke_re=/[%0-9a-z._\/\\:~-]/i,l.prototype.reinvoke=function(e,t,i){return l.reinvoke_re.test(e)},l.prototype.carry_on_completion=function(i){var n=this.editor.getCursor(),r=(this.editor.getLine(n.line),this.editor.getRange({line:n.line,ch:n.ch-1},n));if(!this.reinvoke(r)&&!i)return void this.close();if(this.autopick=!1,i&&(this.autopick=!0),!(this.editor.somethingSelected()||this.editor.getSelections().length>1)){var s=t.to_absolute_cursor_pos(this.editor,n);this.skip_kernel_completion?this.finish_completing({content:{matches:[],cursor_start:s,cursor_end:s}}):this.cell.kernel.complete(this.editor.getValue(),s,e.proxy(this.finish_completing,this))}},l.prototype.finish_completing=function(i){var r=i.content,s=r.cursor_start,o=r.cursor_end,l=r.matches,c=this.editor.getCursor();null===o&&(o=t.to_absolute_cursor_pos(this.editor,c),null===s?s=o:0>s&&(s=o+s));var h,u=n.contextHint(this.editor),d=[];for(h=0;h<u.length;h++)a(u[h].str,l)||d.push(u[h]);var p=t.from_absolute_cursor_pos(this.editor,s),f=t.from_absolute_cursor_pos(this.editor,o);for(h=l.length-1;h>=0;--h)d.unshift({str:l[h],type:"introspection",from:p,to:f});if(this.raw_result=d,this.raw_result&&this.raw_result.length){if(this.autopick&&1==this.raw_result.length)return void this.insert(this.raw_result[0]);if(1==this.raw_result.length){var m=this.raw_result[0].str,g=this.editor.getRange({line:c.line,ch:c.ch-m.length},c);if(g==m)return void this.close()}if(!this.visible){this.complete=e("<div/>").addClass("completions"),this.complete.attr("id","complete"),this.sel=e("<select/>").attr("tabindex",-1).attr("multiple","true"),this.complete.append(this.sel),this.visible=!0,e("body").append(this.complete);var _=this;this.sel.dblclick(function(){_.pick()}),this.sel.focus(function(){_.editor.focus()}),this._handle_keydown=function(e,t){_.keydown(t)},this.editor.on("keydown",this._handle_keydown),this._handle_keypress=function(e,t){_.keypress(t)},this.editor.on("keypress",this._handle_keypress)}this.sel.attr("size",Math.min(10,this.raw_result.length));var v,b=this.editor.cursorCoords(t.from_absolute_cursor_pos(this.editor,s)),y=b.left-3,x=this.complete.height(),w=e(window).height();return v=b.bottom+x+5>w?b.top-x-4:b.bottom+1,this.complete.css("left",y+"px"),this.complete.css("top",v+"px"),this.sel.text(""),this.build_gui_list(this.raw_result),!0}},l.prototype.insert=function(e){this.editor.replaceRange(e.str,e.from,e.to)},l.prototype.build_gui_list=function(t){for(var i=0;i<t.length;++i){var n=e("<option/>").text(t[i].str).addClass(t[i].type);this.sel.append(n)}this.sel.children().first().attr("selected","true"),this.sel.scrollTop(0)},l.prototype.close=function(){this.done=!0,e("#complete").remove(),this.editor.off("keydown",this._handle_keydown),this.editor.off("keypress",this._handle_keypress),this.visible=!1},l.prototype.pick=function(){this.insert(this.raw_result[this.sel[0].selectedIndex]),this.close()},l.prototype.keydown=function(e){var t,i,n=e.keyCode;if(n==s.enter)e.codemirrorIgnore=!0,e._ipkmIgnore=!0,e.preventDefault(),this.pick();else if(n==s.esc||n==s.backspace)e.codemirrorIgnore=!0,e._ipkmIgnore=!0,e.preventDefault(),this.close();else if(n==s.tab){var o=r(this.raw_result,!0);""!==o.str&&this.insert(o),this.close(),this.carry_on_completion()}else n==s.up||n==s.down?(e.codemirrorIgnore=!0,e._ipkmIgnore=!0,e.preventDefault(),t=this.sel.find("option"),i=this.sel[0].selectedIndex,n==s.up&&i--,n==s.down&&i++,i=Math.min(Math.max(i,0),t.length-1),this.sel[0].selectedIndex=i):n==s.pageup||n==s.pagedown?(e._ipkmIgnore=!0,t=this.sel.find("option"),i=this.sel[0].selectedIndex,n==s.pageup?i-=10:i+=10,i=Math.min(Math.max(i,0),t.length-1),this.sel[0].selectedIndex=i):(n==s.left||n==s.right)&&this.close()},l.prototype.keypress=function(e){var t=this,i=e.keyCode;0!==e.charCode&&i!=s.tab&&i!=s.enter&&(this.close(),this.editor.focus(),setTimeout(function(){t.carry_on_completion()},50))},{Completer:l}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("codemirror/lib/codemirror"),require("codemirror/mode/python/python")):"function"==typeof define&&define.amd?define("notebook/js/codemirror-ipython",["codemirror/lib/codemirror","codemirror/mode/python/python"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ipython",function(t,i){var n={};for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r]);return n.name="python",n.singleOperators=new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"),3===n.version?n.identifiers=new RegExp("^[_A-Za-z¡-][_A-Za-z0-9¡-]*"):2===n.version&&(n.identifiers=new RegExp("^[_A-Za-z][_A-Za-z0-9]*")),e.getMode(t,n)},"python"),e.defineMIME("text/x-ipython","ipython")}),define("notebook/js/codecell",["base/js/namespace","jquery","base/js/utils","base/js/keyboard","services/config","notebook/js/cell","notebook/js/outputarea","notebook/js/completer","notebook/js/celltoolbar","codemirror/lib/codemirror","codemirror/mode/python/python","notebook/js/codemirror-ipython"],function(e,t,i,n,r,s,o,a,l,c,h,u){"use strict";var d=s.Cell,p=function(e,t){return e.line===t.line&&e.ch===t.ch};c.commands.delSpaceToPrevTabStop=function(e){var t=e.getCursor(!0),i=e.getCursor(!1);!p(t,i);if(!p(t,i))return void e.replaceRange("",t,i);var n=e.getCursor(),r=(e.getLine(n.line),e.getOption("tabSize")),s=n.ch-(Math.ceil(n.ch/r)-1)*r;t={ch:n.ch-s,line:n.line};var o=e.getRange(t,n);null!==o.match(/^\ +$/)?e.replaceRange("",t,n):e.deleteH(-1,"char")};var f=n.keycodes,m=function(e,i){this.kernel=e||null,this.notebook=i.notebook,this.collapsed=!1,this.events=i.events,this.tooltip=i.tooltip,this.config=i.config,this.class_config=new r.ConfigWithDefaults(this.config,m.config_defaults,"CodeCell"),this.input_prompt_number=null,this.celltoolbar=null,this.output_area=null,this.last_msg_id=null,this.completer=null,d.apply(this,[{config:t.extend({},m.options_default),keyboard_manager:i.keyboard_manager,events:this.events}]),this.cell_type="code";var n=this;this.element.focusout(function(){n.auto_highlight()})};return m.options_default={cm_config:{extraKeys:{Tab:"indentMore","Shift-Tab":"indentLess",Backspace:"delSpaceToPrevTabStop","Cmd-/":"toggleComment","Ctrl-/":"toggleComment"},mode:"text",viewportMargin:1/0,scrollPastEnd:!0,lineNumbers:!0,matchBrackets:!0,lineWrapping:!0,autoCloseBrackets:!0},highlight_modes:{magic_javascript:{reg:["^%%javascript"]},magic_perl:{reg:["^%%perl"]},magic_ruby:{reg:["^%%ruby"]},magic_python:{reg:["^%%python3?"]},magic_shell:{reg:["^%%bash"]},magic_r:{reg:["^%%R"]},"magic_text/x-cython":{reg:["^%%cython"]}}},m.config_defaults=m.options_default,m.msg_cells={},m.prototype=Object.create(d.prototype),m.prototype.create_element=function(){d.prototype.create_element.apply(this,arguments);var e=this,i=t("<div></div>").addClass("cell code_cell");i.attr("tabindex","2");var n=t("<div></div>").addClass("input");this.input=n;var r=t("<div/>").addClass("prompt input_prompt"),s=t("<div/>").addClass("inner_cell");this.celltoolbar=new l.CellToolbar({cell:this,notebook:this.notebook}),s.append(this.celltoolbar.element);var h=t("<div/>").addClass("input_area"),u=this._options.cm_config;u.theme=this.notebook.codemirror_theme_name,this.code_mirror=new c(h.get(0),u),this.code_mirror.on("focus",function(){e.keyboard_manager&&e.keyboard_manager.enable()}),this.code_mirror.on("keydown",t.proxy(this.handle_keyevent,this)),t(this.code_mirror.getInputField()).attr("spellcheck","false"),s.append(h),n.append(r).append(s);var p=t("<div></div>");i.append(n).append(p),this.element=i,this.output_area=new o.OutputArea({selector:p,prompt_area:!0,events:this.events,keyboard_manager:this.keyboard_manager}),this.completer=new a.Completer(this,this.events)},m.prototype.bind_events=function(){d.prototype.bind_events.apply(this);var e=this;this.element.focusout(function(){e.auto_highlight()})},m.prototype.handle_codemirror_keyevent=function(e,t){var i=this,n=null;"keydown"===t.type&&t.which!==f.tab&&(n=this.tooltip.remove_and_cancel_tooltip());var r=e.getCursor();if(t.keyCode===f.enter&&this.auto_highlight(),t.which===f.down&&"keypress"===t.type&&this.tooltip.time_before_tooltip>=0)this.tooltip.pending(i,!0);else{if(n&&t.which===f.esc&&"keydown"===t.type)return this.tooltip._hidden||this.tooltip.remove_and_cancel_tooltip(!0),t.codemirrorIgnore=!0,t._ipkmIgnore=!0,t.preventDefault(),!0;if(t.keyCode===f.tab&&"keydown"===t.type&&t.shiftKey){if(e.somethingSelected()||1!==e.getSelections().length){var s=e.getCursor("anchor"),o=e.getCursor("head");if(s.line!==o.line)return!1}var a=e.getRange({line:r.line,ch:0},r);return""===a.trim()?!1:(this.tooltip.request(i),t.codemirrorIgnore=!0,t.preventDefault(),!0)}if(t.keyCode===f.tab&&"keydown"===t.type){if(this.tooltip.remove_and_cancel_tooltip(),e.somethingSelected()||e.getSelections().length>1)return!1;var a=e.getRange({line:r.line,ch:0},r);return""===a.trim()?!1:(t.codemirrorIgnore=!0,t.preventDefault(),!0)}}return d.prototype.handle_codemirror_keyevent.apply(this,[e,t])},m.prototype.set_kernel=function(e){this.kernel=e},m.prototype.execute=function(e){if(!this.kernel||!this.kernel.is_connected())return void console.log("Can't execute, kernel is not connected.");this.output_area.clear_output(!0,!0),void 0===e&&(e=!0);var t=this.last_msg_id;if(t&&(this.kernel.clear_callbacks_for_msg(t),t&&delete m.msg_cells[t]),0===this.get_text().trim().length)return void this.set_input_prompt(null);this.set_input_prompt("*"),this.element.addClass("running");var i=this.get_callbacks();this.last_msg_id=this.kernel.execute(this.get_text(),i,{silent:!1,store_history:!0,stop_on_error:e}),m.msg_cells[this.last_msg_id]=this,this.render(),this.events.trigger("execute.CodeCell",{cell:this})},m.prototype.get_callbacks=function(){var e=this;return{shell:{reply:t.proxy(this._handle_execute_reply,this),payload:{set_next_input:t.proxy(this._handle_set_next_input,this),page:t.proxy(this._open_with_pager,this)}},iopub:{output:function(){e.output_area.handle_output.apply(e.output_area,arguments)},clear_output:function(){e.output_area.handle_clear_output.apply(e.output_area,arguments)}},input:t.proxy(this._handle_input_request,this)}},m.prototype._open_with_pager=function(e){this.events.trigger("open_with_text.Pager",e)},m.prototype._handle_execute_reply=function(e){this.set_input_prompt(e.content.execution_count),this.element.removeClass("running"),this.events.trigger("set_dirty.Notebook",{value:!0})},m.prototype._handle_set_next_input=function(e){var t={cell:this,text:e.text,replace:e.replace};this.events.trigger("set_next_input.Notebook",t)},m.prototype._handle_input_request=function(e){this.output_area.append_raw_input(e)},m.prototype.select=function(){var e=d.prototype.select.apply(this);return e&&(this.code_mirror.refresh(),this.auto_highlight()),e},m.prototype.render=function(){var e=d.prototype.render.apply(this);return e},m.prototype.select_all=function(){var e={line:0,ch:0},t=this.code_mirror.lineCount(),i=this.code_mirror.getLine(t-1),n={line:t-1,ch:i.length};this.code_mirror.setSelection(e,n)},m.prototype.collapse_output=function(){this.output_area.collapse()},m.prototype.expand_output=function(){this.output_area.expand(),this.output_area.unscroll_area()},m.prototype.scroll_output=function(){this.output_area.expand(),this.output_area.scroll_if_long()},m.prototype.toggle_output=function(){this.output_area.toggle_output()},m.prototype.toggle_output_scroll=function(){this.output_area.toggle_scroll()},m.input_prompt_classical=function(e,t){var i;return i=void 0===e||null===e?"&nbsp;":encodeURIComponent(e),"In&nbsp;["+i+"]:"},m.input_prompt_continuation=function(e,t){for(var i=[m.input_prompt_classical(e,t)],n=1;t>n;n++)i.push(["...:"]);return i.join("<br/>")},m.input_prompt_function=m.input_prompt_classical,m.prototype.set_input_prompt=function(e){var t=1;void 0!==this.code_mirror&&(t=this.code_mirror.lineCount()),this.input_prompt_number=e;var i=m.input_prompt_function(this.input_prompt_number,t);this.element.find("div.input_prompt").html(i)},m.prototype.clear_input=function(){this.code_mirror.setValue("")},m.prototype.get_text=function(){return this.code_mirror.getValue()},m.prototype.set_text=function(e){return this.code_mirror.setValue(e)},m.prototype.clear_output=function(e){this.output_area.clear_output(e),this.set_input_prompt()},m.prototype.fromJSON=function(e){d.prototype.fromJSON.apply(this,arguments),"code"===e.cell_type&&(void 0!==e.source&&(this.set_text(e.source),this.code_mirror.clearHistory(),this.auto_highlight()),this.set_input_prompt(e.execution_count),this.output_area.trusted=e.metadata.trusted||!1,this.output_area.fromJSON(e.outputs,e.metadata))},m.prototype.toJSON=function(){var e=d.prototype.toJSON.apply(this);e.source=this.get_text(),isFinite(this.input_prompt_number)?e.execution_count=this.input_prompt_number:e.execution_count=null;var t=this.output_area.toJSON();return e.outputs=t,e.metadata.trusted=this.output_area.trusted,e.metadata.collapsed=this.output_area.collapsed,"auto"===this.output_area.scroll_state?delete e.metadata.scrolled:e.metadata.scrolled=this.output_area.scroll_state,e},m.prototype.unselect=function(e){var t=d.prototype.unselect.apply(this,[e]);return t&&(this.tooltip.remove_and_cancel_tooltip(!0),null!==this.completer&&this.completer.close()),t},e.CodeCell=m,{CodeCell:m}}),define("services/kernels/comm",["jquery","base/js/utils"],function(e,t){"use strict";var i=function(e){this.comms={},this.targets={},void 0!==e&&this.init_kernel(e)};i.prototype.init_kernel=function(t){this.kernel=t;for(var i=["comm_open","comm_msg","comm_close"],n=0;n<i.length;n++){var r=i[n];t.register_iopub_handler(r,e.proxy(this[r],this))}},i.prototype.new_comm=function(e,t,i,r,s){var o=new n(e,s);return this.register_comm(o),o.open(t,i,r),o},i.prototype.register_target=function(e,t){this.targets[e]=t},i.prototype.unregister_target=function(e,t){delete this.targets[e]},i.prototype.register_comm=function(e){return this.comms[e.comm_id]=Promise.resolve(e),e.kernel=this.kernel,e.comm_id},i.prototype.unregister_comm=function(e){delete this.comms[e.comm_id]},i.prototype.comm_open=function(e){var i=e.content,r=this,s=i.comm_id;return this.comms[s]=t.load_class(i.target_name,i.target_module,this.targets).then(function(o){var a=new n(i.target_name,s);a.kernel=r.kernel;try{var l=o(a,e)}catch(c){a.close(),r.unregister_comm(a);var h=new t.WrappedError("Exception opening new comm",c);return console.error(h),Promise.reject(h)}return Promise.resolve(l).then(function(){return a})},t.reject("Could not open comm",!0)),this.comms[s]},i.prototype.comm_close=function(e){var t=e.content;if(void 0===this.comms[t.comm_id])return void console.error("Comm promise not found for comm id "+t.comm_id);var i=this;return this.comms[t.comm_id]=this.comms[t.comm_id].then(function(t){i.unregister_comm(t);try{t.handle_close(e)}catch(n){console.log("Exception closing comm: ",n,n.stack,e)}}),this.comms[t.comm_id]},i.prototype.comm_msg=function(e){var t=e.content;return void 0===this.comms[t.comm_id]?void console.error("Comm promise not found for comm id "+t.comm_id):(this.comms[t.comm_id]=this.comms[t.comm_id].then(function(t){try{t.handle_msg(e)}catch(i){console.log("Exception handling comm msg: ",i,i.stack,e)}return t}),this.comms[t.comm_id])};var n=function(e,i){this.target_name=e,this.comm_id=i||t.uuid(),this._msg_callback=this._close_callback=null};return n.prototype.open=function(e,t,i){var n={comm_id:this.comm_id,target_name:this.target_name,data:e||{}};return this.kernel.send_shell_message("comm_open",n,t,i)},n.prototype.send=function(e,t,i,n){var r={comm_id:this.comm_id,data:e||{}};return this.kernel.send_shell_message("comm_msg",r,t,i,n)},n.prototype.close=function(e,t,i){var n={comm_id:this.comm_id,data:e||{}};return this.kernel.send_shell_message("comm_close",n,t,i)},n.prototype._register_callback=function(e,t){this["_"+e+"_callback"]=t},n.prototype.on_msg=function(e){this._register_callback("msg",e)},n.prototype.on_close=function(e){this._register_callback("close",e)},n.prototype._callback=function(e,t){var i=this["_"+e+"_callback"];if(i)try{i(t)}catch(n){console.log("Exception in Comm callback",n,n.stack,t)}},n.prototype.handle_msg=function(e){this._callback("msg",e)},n.prototype.handle_close=function(e){this._callback("close",e)},{CommManager:i,Comm:n}}),define("services/kernels/serialize",["underscore"],function(e){"use strict";var t=function(e){var t,i=new DataView(e),n=i.getUint32(0),r=[];for(t=1;n>=t;t++)r.push(i.getUint32(4*t));var s=new Uint8Array(e.slice(r[0],r[1])),o=JSON.parse(new TextDecoder("utf8").decode(s));o.buffers=[];var a,l;for(t=1;n>t;t++)a=r[t],l=r[t+1]||e.byteLength,o.buffers.push(new DataView(e.slice(a,l)));return o},i=function(e){if(e instanceof Blob){var i=new FileReader,n=new Promise(function(e,n){i.onload=function(){var i=t(this.result);e(i)}});return i.readAsArrayBuffer(e),n}var r=t(e);return r},n=function(e){return"string"==typeof e?Promise.resolve(JSON.parse(e)):Promise.resolve(i(e))},r=function(t){t=e.clone(t);var i,n=[],r=[];for(i=0;i<t.buffers.length;i++){var s=t.buffers[i];r.push(s.buffer instanceof ArrayBuffer?s.buffer:s)}delete t.buffers;var o=new TextEncoder("utf8").encode(JSON.stringify(t));r.unshift(o);var a=r.length;for(n.push(4*(a+1)),i=0;i+1<r.length;i++)n.push(n[n.length-1]+r[i].byteLength);var l=new Uint8Array(n[n.length-1]+r[r.length-1].byteLength),c=new DataView(l.buffer);for(c.setUint32(0,a),i=0;i<n.length;i++)c.setUint32(4*(i+1),n[i]);for(i=0;i<r.length;i++)l.set(new Uint8Array(r[i]),n[i]);return l.buffer},s=function(e){return e.buffers&&e.buffers.length?r(e):JSON.stringify(e)},o={deserialize:n,serialize:s};return o}),define("services/kernels/kernel",["jquery","base/js/utils","./comm","./serialize","base/js/events"],function(e,t,i,n,r){"use strict";var s=function(e,n,s){this.events=r,this.id=null,this.name=s,this.ws=null,this.kernel_service_url=e,this.kernel_url=null,this.base_ws_url=n||t.get_body_data("wsUrl"),this.base_ws_url||(this.base_ws_url=location.protocol.replace("http","ws")+"//"+location.host),this.ws_url=null,this.username="username",this.session_id=t.uuid(),this._msg_callbacks={},this._msg_queue=Promise.resolve(),this.info_reply={},"undefined"!=typeof WebSocket?this.WebSocket=WebSocket:"undefined"!=typeof MozWebSocket?this.WebSocket=MozWebSocket:alert("Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config."),this.bind_events(),this.init_iopub_handlers(),this.comm_manager=new i.CommManager(this),this.last_msg_id=null,this.last_msg_callbacks={},this._autorestart_attempt=0,this._reconnect_attempt=0,this.reconnect_limit=5};return s.prototype._get_msg=function(e,i,n,r){var s={header:{msg_id:t.uuid(),username:this.username,session:this.session_id,msg_type:e,version:"5.0"},metadata:n||{},content:i,buffers:r||[],parent_header:{}};return s},s.prototype.bind_events=function(){var e=this;this.events.on("send_input_reply.Kernel",function(t,i){e.send_input_reply(i)});var t=function(e,t){};this.events.on("kernel_created.Kernel",t),this.events.on("kernel_reconnecting.Kernel",t),this.events.on("kernel_connected.Kernel",t),this.events.on("kernel_starting.Kernel",t),this.events.on("kernel_restarting.Kernel",t),this.events.on("kernel_autorestarting.Kernel",t),this.events.on("kernel_interrupting.Kernel",t),this.events.on("kernel_disconnected.Kernel",t),this.events.on("kernel_ready.Kernel",t),this.events.on("kernel_killed.Kernel",t),this.events.on("kernel_dead.Kernel",t),this.events.on("kernel_ready.Kernel",function(){e._autorestart_attempt=0}),this.events.on("kernel_connected.Kernel",function(){e._reconnect_attempt=0})},s.prototype.init_iopub_handlers=function(){var t=["stream","display_data","execute_result","error"];this._iopub_handlers={},this.register_iopub_handler("status",e.proxy(this._handle_status_message,this)),this.register_iopub_handler("clear_output",e.proxy(this._handle_clear_output,this)),this.register_iopub_handler("execute_input",e.proxy(this._handle_input_message,this));for(var i=0;i<t.length;i++)this.register_iopub_handler(t[i],e.proxy(this._handle_output_message,this))},s.prototype.list=function(t,i){e.ajax(this.kernel_service_url,{processData:!1,cache:!1,type:"GET",dataType:"json",success:t,error:this._on_error(i)})},s.prototype.start=function(t,i,n){var r=this.kernel_service_url,s=e.param(t||{});""!==s&&(r=r+"?"+s),this.events.trigger("kernel_starting.Kernel",{kernel:this});var o=this,a=function(e,t,n){o.events.trigger("kernel_created.Kernel",{kernel:o}),o._kernel_created(e),i&&i(e,t,n)};return e.ajax(r,{processData:!1,cache:!1,type:"POST",data:JSON.stringify({name:this.name}),contentType:"application/json",dataType:"json",success:this._on_success(a),error:this._on_error(n)}),r},s.prototype.get_info=function(t,i){e.ajax(this.kernel_url,{processData:!1,cache:!1,type:"GET",dataType:"json",success:this._on_success(t),error:this._on_error(i)})},s.prototype.kill=function(t,i){this.events.trigger("kernel_killed.Kernel",{kernel:this}),this._kernel_dead(),e.ajax(this.kernel_url,{processData:!1,cache:!1,type:"DELETE",dataType:"json",success:this._on_success(t),error:this._on_error(i)})},s.prototype.interrupt=function(i,n){this.events.trigger("kernel_interrupting.Kernel",{kernel:this});var r=this,s=function(e,t,n){r.kernel_info(),i&&i(e,t,n)},o=t.url_join_encode(this.kernel_url,"interrupt");e.ajax(o,{processData:!1,cache:!1,type:"POST",contentType:!1,dataType:"json",success:this._on_success(s),error:this._on_error(n)})},s.prototype.restart=function(i,n){this.events.trigger("kernel_restarting.Kernel",{kernel:this}),this.stop_channels();var r=this,s=function(e,t,n){r.events.trigger("kernel_created.Kernel",{kernel:r}),r._kernel_created(e),i&&i(e,t,n)},o=function(e,t,i){r.events.trigger("kernel_dead.Kernel",{kernel:r}),r._kernel_dead(),n&&n(e,t,i)},a=t.url_join_encode(this.kernel_url,"restart");e.ajax(a,{processData:!1,cache:!1,type:"POST",contentType:!1,dataType:"json",success:this._on_success(s),error:this._on_error(o)})},s.prototype.reconnect=function(){this.is_connected()||(this._reconnect_attempt=this._reconnect_attempt+1,this.events.trigger("kernel_reconnecting.Kernel",{kernel:this,attempt:this._reconnect_attempt}),this.start_channels())},s.prototype.keep_alive=function(){var e=this.kernel_service_url.replace("kernels","keepalive");this._keep_alive_helper(e)},s.prototype._keep_alive_helper=function(t){var i=this;e.ajax(t,{processData:!1,cache:!1,type:"GET",dataType:"json",success:function(){setTimeout(function(){i._keep_alive_helper(t)},5e3)},error:function(){console.log("Error in keep alive")}})},s.prototype._on_success=function(e){var i=this;return function(n,r,s){n?n.url?(i.url=n.url,i.name=n.name,i.ws_url=n.url,i.base_ws_url=i.ws_url.replace("/channels",""),i.kernel_url=i.base_ws_url.replace("ws","http"),i.keep_alive()):(i.id=n.id,i.name=n.name,i.kernel_url=t.url_join_encode(i.kernel_service_url,i.id),null!=this.base_ws_url&&(i.base_ws_url=i.ws_url.replace("/channels","")),i.ws_url=t.url_join_encode(i.kernel_url.replace("http","ws"),"channels")):i.kernel_url=t.url_join_encode(i.kernel_service_url,i.id),e&&e(n,r,s)}},s.prototype._on_error=function(e){return function(i,n,r){t.log_ajax_error(i,n,r),e&&e(i,n,r)}},s.prototype._kernel_created=function(e){e.url?(this.url=e.url,this.kernel_url=e.url):(this.id=e.id,this.kernel_url=t.url_join_encode(this.kernel_service_url,this.id)),this.start_channels()},s.prototype._kernel_connected=function(){this.events.trigger("kernel_connected.Kernel",{kernel:this});var e=this;this.kernel_info(function(t){e.info_reply=t.content,e.events.trigger("kernel_ready.Kernel",{kernel:e})})},s.prototype._kernel_dead=function(){this.stop_channels()},s.prototype.start_channels=function(){var t=this;this.stop_channels();var i=this.base_ws_url+this.kernel_url;this.ws=new this.WebSocket(this.ws_url+"?session_id="+t.session_id);var n=!1,r=function(e){n||(n=!0,e.wasClean||t.get_info(function(){t._ws_closed(i,!1)},function(){t.events.trigger("kernel_dead.Kernel",{kernel:t}),t._kernel_dead()}))},s=function(e){n||(n=!0,e.wasClean||t._ws_closed(i,!1))},o=function(e){n||(n=!0,t._ws_closed(i,!0))};this.ws.onopen=e.proxy(this._ws_opened,this),this.ws.onclose=r,this.ws.onerror=o,setTimeout(function(){null!==t.ws&&(t.ws.onclose=s)},1e3),this.ws.onmessage=e.proxy(this._handle_ws_message,this)},s.prototype._ws_opened=function(e){this.is_connected()&&this._kernel_connected()},s.prototype._ws_closed=function(e,t){this.stop_channels(),this.events.trigger("kernel_disconnected.Kernel",{kernel:this}),t&&(console.log("WebSocket connection failed: ",e),this.events.trigger("kernel_connection_failed.Kernel",{kernel:this,base_ws_url:e,attempt:this._reconnect_attempt})),this._schedule_reconnect()},s.prototype._schedule_reconnect=function(){if(this._reconnect_attempt<this.reconnect_limit){var t=Math.pow(2,this._reconnect_attempt);console.log("Connection lost, reconnecting in "+t+" seconds."),setTimeout(e.proxy(this.reconnect,this),1e3*t)}else this.events.trigger("kernel_connection_dead.Kernel",{kernel:this,reconnect_attempt:this._reconnect_attempt}),console.log("Failed to reconnect, giving up.")},s.prototype.stop_channels=function(){var e=this,t=function(){e.ws&&e.ws.readyState===WebSocket.CLOSED&&(e.ws=null)};null!==this.ws&&(this.ws.readyState===WebSocket.OPEN?(this.ws.onclose=t,this.ws.close()):t())},s.prototype.is_connected=function(){return null===this.ws?!1:this.ws.readyState!==WebSocket.OPEN?!1:!0},s.prototype.is_fully_disconnected=function(){return null===this.ws},s.prototype.send_shell_message=function(e,t,i,r,s){if(!this.is_connected())throw new Error("kernel is not connected");var o=this._get_msg(e,t,r,s);return o.channel="shell",this.ws.send(n.serialize(o)),this.set_callbacks_for_msg(o.header.msg_id,i),o.header.msg_id},s.prototype.kernel_info=function(e){var t;return e&&(t={shell:{reply:e}}),this.send_shell_message("kernel_info_request",{},t)},s.prototype.inspect=function(e,t,i){var n;i&&(n={shell:{reply:i}});var r={code:e,cursor_pos:t,detail_level:0};return this.send_shell_message("inspect_request",r,n)},s.prototype.execute=function(t,i,n){var r={code:t,silent:!0,store_history:!1,user_expressions:{},allow_stdin:!1};return i=i||{},void 0!==i.input&&(r.allow_stdin=!0),e.extend(!0,r,n),this.events.trigger("execution_request.Kernel",{kernel:this,content:r}),this.send_shell_message("execute_request",r,i)},s.prototype.complete=function(e,t,i){var n;i&&(n={shell:{reply:i}});var r={code:e,cursor_pos:t};return this.send_shell_message("complete_request",r,n)},s.prototype.send_input_reply=function(e){if(!this.is_connected())throw new Error("kernel is not connected");var t={value:e};this.events.trigger("input_reply.Kernel",{kernel:this,content:t});var i=this._get_msg("input_reply",t);
return i.channel="stdin",this.ws.send(n.serialize(i)),i.header.msg_id},s.prototype.register_iopub_handler=function(e,t){this._iopub_handlers[e]=t},s.prototype.get_iopub_handler=function(e){return this._iopub_handlers[e]},s.prototype.get_callbacks_for_msg=function(e){return e==this.last_msg_id?this.last_msg_callbacks:this._msg_callbacks[e]},s.prototype.clear_callbacks_for_msg=function(e){void 0!==this._msg_callbacks[e]&&delete this._msg_callbacks[e]},s.prototype._finish_shell=function(e){var t=this._msg_callbacks[e];void 0!==t&&(t.shell_done=!0,t.iopub_done&&this.clear_callbacks_for_msg(e))},s.prototype._finish_iopub=function(e){var t=this._msg_callbacks[e];void 0!==t&&(t.iopub_done=!0,t.shell_done&&this.clear_callbacks_for_msg(e))},s.prototype.set_callbacks_for_msg=function(e,t){if(this.last_msg_id=e,t){var i=this._msg_callbacks[e]=this.last_msg_callbacks={};i.shell=t.shell,i.iopub=t.iopub,i.input=t.input,i.shell_done=!t.shell,i.iopub_done=!t.iopub}else this.last_msg_callbacks={}},s.prototype._handle_ws_message=function(e){var i=this;this._msg_queue=this._msg_queue.then(function(){return n.deserialize(e.data)}).then(function(e){return i._finish_ws_message(e)})["catch"](t.reject("Couldn't process kernel message",!0))},s.prototype._finish_ws_message=function(e){switch(e.channel){case"shell":return this._handle_shell_reply(e);case"iopub":return this._handle_iopub_message(e);case"stdin":return this._handle_input_request(e);default:console.error("unrecognized message channel",e.channel,e)}},s.prototype._handle_shell_reply=function(e){this.events.trigger("shell_reply.Kernel",{kernel:this,reply:e});var t=this,i=e.content,n=(e.metadata,e.parent_header.msg_id),r=this.get_callbacks_for_msg(n),s=Promise.resolve();if(r&&r.shell){var o=r.shell;return this._finish_shell(n),void 0!==o.reply&&(s=s.then(function(){return o.reply(e)})),i.payload&&o.payload&&(s=s.then(function(){return t._handle_payloads(i.payload,o.payload,e)})),s}},s.prototype._handle_payloads=function(e,t,i){for(var n=[],r=e.length,s=0;r>s;s++){var o=e[s],a=t[o.source];a&&n.push(a(o,i))}return Promise.all(n)},s.prototype._handle_status_message=function(e){var t=e.content.execution_state,i=e.parent_header.msg_id,n=this.get_callbacks_for_msg(i);if(n&&n.iopub&&n.iopub.status)try{n.iopub.status(e)}catch(r){console.log("Exception in status msg handler",r,r.stack)}if("busy"===t)this.events.trigger("kernel_busy.Kernel",{kernel:this});else if("idle"===t)this._finish_iopub(i),this.events.trigger("kernel_idle.Kernel",{kernel:this});else if("starting"===t){this.events.trigger("kernel_starting.Kernel",{kernel:this});var s=this;this.kernel_info(function(e){s.info_reply=e.content,s.events.trigger("kernel_ready.Kernel",{kernel:s})})}else"restarting"===t?(this._autorestart_attempt=this._autorestart_attempt+1,this.events.trigger("kernel_restarting.Kernel",{kernel:this}),this.events.trigger("kernel_autorestarting.Kernel",{kernel:this,attempt:this._autorestart_attempt})):"dead"===t&&(this.events.trigger("kernel_dead.Kernel",{kernel:this}),this._kernel_dead())},s.prototype._handle_clear_output=function(e){var t=this.get_callbacks_for_msg(e.parent_header.msg_id);if(t&&t.iopub){var i=t.iopub.clear_output;i&&i(e)}},s.prototype._handle_output_message=function(e){var t=this.get_callbacks_for_msg(e.parent_header.msg_id);if(!t||!t.iopub)return void this.events.trigger("received_unsolicited_message.Kernel",e);var i=t.iopub.output;i&&i(e)},s.prototype._handle_input_message=function(e){var t=this.get_callbacks_for_msg(e.parent_header.msg_id);t||this.events.trigger("received_unsolicited_message.Kernel",e)},s.prototype._handle_iopub_message=function(e){var t=this.get_iopub_handler(e.header.msg_type);return void 0!==t?t(e):void 0},s.prototype._handle_input_request=function(e){var t=e.header,i=(e.content,e.metadata,t.msg_type);if("input_request"!==i)return void console.log("Invalid input request!",e);var n=this.get_callbacks_for_msg(e.parent_header.msg_id);n&&n.input&&n.input(e)},{Kernel:s}}),define("services/sessions/session",["jquery","base/js/utils","services/kernels/kernel"],function(e,t,i){"use strict";var n=function(e){this.id=null,this.notebook_model={path:e.notebook_path},this.kernel_model={id:null,name:e.kernel_name},this.base_url=e.base_url,this.ws_url=e.ws_url,this.session_service_url=t.url_join_encode(this.base_url,"api/sessions"),this.session_url=null,this.notebook=e.notebook,this.kernel=null,this.events=e.notebook.events,this.bind_events()};n.prototype.bind_events=function(){var e=this,t=function(e,t){};this.events.on("kernel_created.Session",t),this.events.on("kernel_dead.Session",t),this.events.on("kernel_killed.Session",t),this.events.on("kernel_dead.Kernel",function(){e["delete"]()})},n.prototype.list=function(t,i){e.ajax(this.session_service_url,{processData:!1,cache:!1,type:"GET",dataType:"json",success:t,error:this._on_error(i)})},n.prototype.start=function(n,r){var s=this,o=function(e,r,o){if(s.kernel)s.kernel.name=s.kernel_model.name;else{var a=t.url_path_join(s.base_url,"api/kernels");s.kernel=new i.Kernel(a,s.ws_url,s.kernel_model.name)}s.events.trigger("kernel_created.Session",{session:s,kernel:s.kernel}),s.kernel._kernel_created(e.kernel),n&&n(e,r,o)},a=function(e,t,i){s.events.trigger("kernel_dead.Session",{session:s,xhr:e,status:t,error:i}),r&&r(e,t,i)};e.ajax(this.session_service_url,{processData:!1,cache:!1,type:"POST",data:JSON.stringify(this._get_model()),contentType:"application/json",dataType:"json",success:this._on_success(o),error:this._on_error(a)})},n.prototype.get_info=function(t,i){e.ajax(this.session_url,{processData:!1,cache:!1,type:"GET",dataType:"json",success:this._on_success(t),error:this._on_error(i)})},n.prototype.rename_notebook=function(t,i,n){void 0!==t&&(this.notebook_model.path=t),e.ajax(this.session_url,{processData:!1,cache:!1,type:"PATCH",data:JSON.stringify(this._get_model()),contentType:"application/json",dataType:"json",success:this._on_success(i),error:this._on_error(n)})},n.prototype["delete"]=function(t,i){this.kernel&&(this.events.trigger("kernel_killed.Session",{session:this,kernel:this.kernel}),this.kernel._kernel_dead()),e.ajax(this.session_url,{processData:!1,cache:!1,type:"DELETE",dataType:"json",success:this._on_success(t),error:this._on_error(i)})},n.prototype.restart=function(e,t,i){var n=this,r=function(){e&&e.notebook_path&&(n.notebook_model.path=e.notebook_path),e&&e.kernel_name&&(n.kernel_model.name=e.kernel_name),n.kernel_model.id=null,n.start(t,i)};this["delete"](r,r)},n.prototype._get_model=function(){return{notebook:this.notebook_model,kernel:this.kernel_model}},n.prototype._update_model=function(e){e&&e.id&&(this.id=e.id,this.session_url=t.url_join_encode(this.session_service_url,this.id)),e&&e.notebook&&(this.notebook_model.path=e.notebook.path),e&&e.kernel&&(this.kernel_model.name=e.kernel.name,this.kernel_model.id=e.kernel.id)},n.prototype._on_success=function(e){var t=this;return function(i,n,r){t._update_model(i),e&&e(i,n,r)}},n.prototype._on_error=function(e){return function(i,n,r){t.log_ajax_error(i,n,r),e&&e(i,n,r)}};var r=function(e){this.name="SessionAlreadyStarting",this.message=e||""};return r.prototype=Error.prototype,{Session:n,SessionAlreadyStarting:r}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/runmode/runmode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.runMode=function(t,i,n,r){var s=e.getMode(e.defaults,i),o=/MSIE \d/.test(navigator.userAgent),a=o&&(null==document.documentMode||document.documentMode<9);if(1==n.nodeType){var l=r&&r.tabSize||e.defaults.tabSize,c=n,h=0;c.innerHTML="",n=function(e,t){if("\n"==e)return c.appendChild(document.createTextNode(a?"\r":e)),void(h=0);for(var i="",n=0;;){var r=e.indexOf("	",n);if(-1==r){i+=e.slice(n),h+=e.length-n;break}h+=r-n,i+=e.slice(n,r);var s=l-h%l;h+=s;for(var o=0;s>o;++o)i+=" ";n=r+1}if(t){var u=c.appendChild(document.createElement("span"));u.className="cm-"+t.replace(/ +/g," cm-"),u.appendChild(document.createTextNode(i))}else c.appendChild(document.createTextNode(i))}}for(var u=e.splitLines(t),d=r&&r.state||e.startState(s),p=0,f=u.length;f>p;++p){p&&n("\n");var m=new e.StringStream(u[p]);for(!m.string&&s.blankLine&&s.blankLine(d);!m.eol();){var g=s.token(m,d);n(m.current(),g,p,m.start,d),m.start=m.pos}}}}),define("notebook/js/tooltip",["jquery","base/js/utils"],function(e,t){"use strict";var i=function(t){var i=this;this.events=t,this.time_before_tooltip=1200,this.tooltip=e("#tooltip"),this._hidden=!0,this._old_cell=null,this._old_request=null,this._consecutive_counter=0,this._sticky=!1,this._hide_if_no_docstring=!1,this.buttons=e("<div/>").addClass("tooltipbuttons"),this.text=e("<div/>").addClass("tooltiptext").addClass("smalltooltip");var n=e("<a/>").attr("href","#").addClass("ui-corner-all").attr("role","button").attr("id","expanbutton").attr("title","Grow the tooltip vertically (press shift-tab twice)").click(function(){i.expand(),event.preventDefault()}).append(e("<span/>").text("Expand").addClass("ui-icon").addClass("ui-icon-plus")),r=e("<a/>").attr("href","#").attr("role","button").addClass("ui-button").attr("title","show the current docstring in pager (press shift-tab 4 times)"),s=e("<span/>").text("Open in Pager").addClass("ui-icon").addClass("ui-icon-arrowstop-l-n");r.append(s),r.click(function(){i.showInPager(i._old_cell),event.preventDefault()});var o=e("<a/>").attr("href","#").attr("role","button").addClass("ui-button"),a=e("<span/>").text("Close").addClass("ui-icon").addClass("ui-icon-close");o.append(a),o.click(function(){i.remove_and_cancel_tooltip(!0),event.preventDefault()}),this._clocklink=e("<a/>").attr("href","#"),this._clocklink.attr("role","button"),this._clocklink.addClass("ui-button"),this._clocklink.attr("title","Tooltip will linger for 10 seconds while you type");var l=e("<span/>").text("Close");l.addClass("ui-icon"),l.addClass("ui-icon-clock"),this._clocklink.append(l),this._clocklink.click(function(){i.cancel_stick(),event.preventDefault()}),this.buttons.append(o),this.buttons.append(n),this.buttons.append(r),this.buttons.append(this._clocklink),this._clocklink.hide(),this.arrow=e("<div/>").addClass("pretooltiparrow"),this.tooltip.append(this.buttons),this.tooltip.append(this.arrow),this.tooltip.append(this.text),this.tabs_functions=[function(e,t,n){i._request_tooltip(e,t,n)},function(){i.expand()},function(){i.stick()},function(e){i.cancel_stick(),i.showInPager(e)}],this.reset_tabs_function=function(e,t){this._old_cell=e?e:null,this._old_request=t?t:null,this._consecutive_counter=0}};return i.prototype.is_visible=function(){return!this._hidden},i.prototype.showInPager=function(e){this.events.trigger("open_with_text.Pager",this._reply.content),this.remove_and_cancel_tooltip()},i.prototype.expand=function(){this.text.removeClass("smalltooltip"),this.text.addClass("bigtooltip"),e("#expanbutton").hide("slow")},i.prototype._hide=function(){this._hidden=!0,this.tooltip.fadeOut("fast"),e("#expanbutton").show("slow"),this.text.removeClass("bigtooltip"),this.text.addClass("smalltooltip"),this.text.scrollTop(0),this.code_mirror=null},i.prototype.remove_and_cancel_tooltip=function(e){return this.cancel_pending(),this._hidden?!1:((e||!this._sticky)&&(this.cancel_stick(),this._hide()),this.reset_tabs_function(),!0)},i.prototype.cancel_pending=function(){null!==this._tooltip_timeout&&(clearTimeout(this._tooltip_timeout),this._tooltip_timeout=null)},i.prototype.pending=function(e,t){var i=this;this._tooltip_timeout=setTimeout(function(){i.request(e,t)},i.time_before_tooltip)},i.last_token_re=/[a-z_][0-9a-z._]*$/gi,i.prototype._request_tooltip=function(t,i,n){var r=e.proxy(this._show,this);t.kernel.inspect(i,n,r)},i.prototype.request=function(e,i){this.cancel_pending();var n=e.code_mirror,r=n.getCursor(),s=t.to_absolute_cursor_pos(n,r),o=e.get_text();this._hide_if_no_docstring=i,n.somethingSelected()&&(o=n.getSelection()),this.code_mirror=n,this._old_cell==e&&this._old_request==o&&this._hidden===!1?this._consecutive_counter++:(this.cancel_stick(),this.reset_tabs_function(e,o)),this.tabs_functions[this._consecutive_counter](e,o,s),this._consecutive_counter==this.tabs_functions.length&&this.reset_tabs_function(e,o,r)},i.prototype.cancel_stick=function(){clearTimeout(this._stick_timeout),this._stick_timeout=null,this._clocklink.hide("slow"),this._sticky=!1},i.prototype.stick=function(e){e=void 0!==e?e:10;var t=this;this._sticky=!0,this._clocklink.show("slow"),this._stick_timeout=setTimeout(function(){t._sticky=!1,t._clocklink.hide("slow")},1e3*e)},i.prototype._show=function(i){this._reply=i;var n=i.content;if(n.found){this.name=n.name;var r=e(this.code_mirror.getWrapperElement()).position(),s=this.code_mirror.cursorCoords(!1,"local"),o=this.code_mirror.cursorCoords(!0,"local"),a=(o.left+s.left)/2,l=Math.max(a-450,0),c=a-l-24,h=r.left+l+"px",u=r.top+o.bottom+10+"px";this._hidden===!1?this.tooltip.animate({left:h,top:u}):(this.tooltip.css({left:h}),this.tooltip.css({top:u})),this.arrow.animate({left:c+"px"}),this._hidden=!1,this.tooltip.fadeIn("fast"),this.text.children().remove();var d=e("<pre/>").html(t.fixConsole(n.data["text/plain"]));this.text.append(d),this.text.scrollTop(0)}},{Tooltip:i}}),define("notebook/js/celltoolbarpresets/default",["jquery","notebook/js/celltoolbar","base/js/dialog"],function(e,t,i){"use strict";var n=t.CellToolbar,r=function(e){i.edit_metadata({md:e.metadata,callback:function(t){e.metadata=t},name:"Cell",notebook:this.notebook,keyboard_manager:this.keyboard_manager})},s=function(t,i){var n=e(t),s=e("<button/>").addClass("btn btn-default btn-xs").text("Edit Metadata").click(function(){return r(i),!1});n.append(s)},o=function(t){n.register_callback("default.rawedit",s),r=e.proxy(r,{notebook:t,keyboard_manager:t.keyboard_manager});var i=[];i.push("default.rawedit"),n.register_preset("Edit Metadata",i,t)};return{register:o}}),define("notebook/js/celltoolbarpresets/rawcell",["jquery","notebook/js/celltoolbar","base/js/dialog","base/js/keyboard"],function(e,t,i,n){"use strict";var r=t.CellToolbar,s=[],o=r.utils.select_ui_generator([["None","-"],["LaTeX","text/latex"],["reST","text/restructuredtext"],["HTML","text/html"],["Markdown","text/markdown"],["Python","text/x-python"],["Custom","dialog"]],function(t,i){if("-"===i)delete t.metadata.raw_mimetype;else if("dialog"===i){var r=e("<div/>").append(e("<p/>").text("Set the MIME type of the raw cell:")).append(e("<br/>")).append(e("<input/>").attr("type","text").attr("size","25").val(t.metadata.raw_mimetype||"-"));r.modal({title:"Raw Cell MIME Type",body:r,buttons:{Cancel:{},OK:{"class":"btn-primary",click:function(){console.log(t),t.metadata.raw_mimetype=e(this).find("input").val(),console.log(t.metadata)}}},open:function(t,i){var r=e(this);r.find('input[type="text"]').keydown(function(e,t){return e.which===n.keycodes.enter?(r.find(".btn-primary").first().click(),!1):void 0}),r.find('input[type="text"]').focus().select()}})}else t.metadata.raw_mimetype=i},function(e){return e.metadata.raw_mimetype||""},"Raw NBConvert Format"),a=function(e){r.register_callback("raw_cell.select",o,["raw"]),s.push("raw_cell.select"),r.register_preset("Raw Cell Format",s,e)};return{register:a}}),define("notebook/js/celltoolbarpresets/slideshow",["jquery","notebook/js/celltoolbar"],function(e,t){"use strict";var i=t.CellToolbar,n=[],r=i.utils.select_ui_generator([["-","-"],["Slide","slide"],["Sub-Slide","subslide"],["Fragment","fragment"],["Skip","skip"],["Notes","notes"]],function(e,t){void 0===e.metadata.slideshow&&(e.metadata.slideshow={}),e.metadata.slideshow.slide_type=t},function(e){var t=e.metadata.slideshow;return void 0===t?void 0:t.slide_type},"Slide Type"),s=function(e){i.register_callback("slideshow.select",r),n.push("slideshow.select"),i.register_preset("Slideshow",n,e)};return{register:s}}),define("notebook/js/scrollmanager",["jquery"],function(e){"use strict";var t=function(t,i){this.notebook=t,this.element=e("#site"),i=i||{},this.animation_speed=i.animation_speed||250};t.prototype.scroll=function(e){return this.scroll_some(e),!1},t.prototype.scroll_to=function(t){this.element.animate({scrollTop:e(t).offset().top+this.element.scrollTop()-this.element.offset().top},this.animation_speed)},t.prototype.scroll_some=function(e){this.element.animate({scrollTop:this.element.scrollTop()+e*this.element.height()},this.animation_speed)},t.prototype.get_first_visible_cell=function(){var e=this.notebook.ncells(),t=this.notebook.get_cell(0).element.offset().top,i=this.notebook.get_cell(e-1).element.offset().top,n=(i-t)/e,r=Math.ceil(this.element.scrollTop()/n);for(r=Math.min(Math.max(r,0),e-1);this.notebook.get_cell(r).element.offset().top-t<this.element.scrollTop()&&e-1>r;)r+=1;for(;this.notebook.get_cell(r).element.offset().top-t>this.element.scrollTop()-50&&r>=0;)r-=1;return Math.min(r+1,e-1)};var i=function(e,i){t.apply(this,[e,i])};i.prototype=Object.create(t.prototype),i.prototype.is_target=function(e){return!1},i.prototype.scroll=function(e){for(var i=this.notebook.ncells(),n=this.get_first_visible_cell()+e;n>=0&&i>n&&!this.is_target(n);)n+=e;return 0>n||n>=i?t.prototype.scroll.apply(this,[e]):(this.scroll_to(this.notebook.get_cell(n).element),!1)};var n=function(e,t){i.apply(this,[e,t])};n.prototype=Object.create(i.prototype),n.prototype.is_target=function(e){var t=this.notebook.get_cell(e);return t.metadata&&t.metadata.slideshow&&t.metadata.slideshow.slide_type&&("slide"===t.metadata.slideshow.slide_type||"subslide"===t.metadata.slideshow.slide_type)};var r=function(e,i){t.apply(this,[e,i]),i=i||{},this._level=i.heading_level||1};return r.prototype=Object.create(t.prototype),r.prototype.scroll=function(i){var n,r=e();for(n=1;n<=this._level;n++)r=r.add("#notebook-container h"+n);var s=this.notebook.get_cell(0).element.offset().top,o=this.element.scrollTop(),a=0;for(n=-1;o>=a&&n<r.length;)++n<r.length&&(a=e(r[n]).offset().top-s);return n--,(0>n||o>e(r[n]).offset().top-s+30)&&0>i&&(i+=1),n+=i,n>=0&&n<r.length?(this.scroll_to(r[n]),!1):t.prototype.scroll.apply(this,[i])},{ScrollManager:t,SlideScrollManager:n,HeadingScrollManager:r,TargetScrollManager:i}}),define("notebook/js/notebook",["require","base/js/namespace","jquery","base/js/utils","base/js/dialog","notebook/js/cell","notebook/js/textcell","notebook/js/codecell","moment","services/config","services/sessions/session","notebook/js/celltoolbar","components/marked/lib/marked","codemirror/lib/codemirror","codemirror/addon/runmode/runmode","notebook/js/mathjaxutils","base/js/keyboard","notebook/js/tooltip","notebook/js/celltoolbarpresets/default","notebook/js/celltoolbarpresets/rawcell","notebook/js/celltoolbarpresets/slideshow","notebook/js/scrollmanager"],function(e){"use strict";var t=e("base/js/namespace"),i=e("jquery"),n=e("base/js/utils"),r=e("base/js/dialog"),s=e("notebook/js/cell"),o=e("notebook/js/textcell"),a=e("notebook/js/codecell"),l=e("moment"),c=e("services/config"),h=e("services/sessions/session"),u=e("notebook/js/celltoolbar"),d=e("components/marked/lib/marked"),p=e("codemirror/lib/codemirror"),f=(e("codemirror/addon/runmode/runmode"),e("notebook/js/mathjaxutils")),m=(e("base/js/keyboard"),e("notebook/js/tooltip")),g=e("notebook/js/celltoolbarpresets/default"),_=e("notebook/js/celltoolbarpresets/rawcell"),v=e("notebook/js/celltoolbarpresets/slideshow"),b=e("notebook/js/scrollmanager"),y=function(e,t){this.config=t.config,this.class_config=new c.ConfigWithDefaults(this.config,y.options_default,"Notebook"),this.base_url=t.base_url,this.notebook_path=t.notebook_path,this.notebook_name=t.notebook_name,this.events=t.events,this.keyboard_manager=t.keyboard_manager,this.contents=t.contents,this.save_widget=t.save_widget,this.tooltip=new m.Tooltip(this.events),this.ws_url=t.ws_url,this._session_starting=!1,this.last_modified=null,this.scroll_manager=new b.ScrollManager(this),this.keyboard_manager.notebook=this,this.save_widget.notebook=this,f.init(),d&&d.setOptions({gfm:!0,tables:!0,langPrefix:"cm-s-ipython language-",highlight:function(e,t,i){return t?void n.requireCodeMirrorMode(t,function(n){var r=document.createElement("div"),s=p.getMode({},n);if(!s)return console.log("No CodeMirror mode: "+t),void i(null,e);try{p.runMode(e,n,r),i(null,r.innerHTML)}catch(o){console.log("Failed to highlight "+t+" code",o),i(o,e)}},function(n){console.log("No CodeMirror mode: "+t),i(n,e)}):i?void i(null,e):e}}),this.element=i(e),this.element.scroll(),this.element.data("notebook",this),this.next_prompt_number=1,this.session=null,this.kernel=null,this.kernel_busy=!1,this.clipboard=null,this.undelete_backup=null,this.undelete_index=null,this.undelete_below=!1,this.paste_enabled=!1,this.writable=!1,this.mode="command",this.set_dirty(!1),this.metadata={},this._checkpoint_after_save=!1,this.last_checkpoint=null,this.checkpoints=[],this.autosave_interval=0,this.autosave_timer=null,this.minimum_autosave_interval=12e4,this.notebook_name_blacklist_re=/[\/\\:]/,this.nbformat=4,this.nbformat_minor=this.current_nbformat_minor=0,this.codemirror_mode="text",this.create_elements(),this.bind_events(),this.kernel_selector=null,this.dirty=null,this.trusted=null,this._fully_loaded=!1,g.register(this),_.register(this),v.register(this),this.codemirror_theme_name=t.codemirror_theme_name,Object.seal(this)};y.options_default={default_cell_type:"code"},y.prototype.create_elements=function(){var e=this;this.element.attr("tabindex","-1"),this.container=i("<div/>").addClass("container").attr("id","notebook-container");var t=i("<div/>").addClass("end_space");t.dblclick(function(t){var i=e.ncells();e.insert_cell_below("code",i-1)}),this.element.append(this.container),this.container.after(t)},y.prototype.bind_events=function(){var e=this;this.events.on("set_next_input.Notebook",function(t,i){if(i.replace)i.cell.set_text(i.text),i.cell.clear_output();else{var n=e.find_cell_index(i.cell),r=e.insert_cell_below("code",n);r.set_text(i.text)}e.dirty=!0}),this.events.on("unrecognized_cell.Cell",function(){e.warn_nbformat_minor()}),this.events.on("unrecognized_output.OutputArea",function(){e.warn_nbformat_minor()}),this.events.on("set_dirty.Notebook",function(t,i){e.dirty=i.value}),this.events.on("trust_changed.Notebook",function(t,i){e.trusted=i}),this.events.on("select.Cell",function(t,i){var n=e.find_cell_index(i.cell);e.select(n)}),this.events.on("edit_mode.Cell",function(t,i){e.handle_edit_mode(i.cell)}),this.events.on("command_mode.Cell",function(t,i){e.handle_command_mode(i.cell)}),this.events.on("spec_changed.Kernel",function(t,i){e.metadata.kernelspec={name:i.name,display_name:i.spec.display_name,language:i.spec.language},e.session&&e.session.kernel&&e.session.kernel.name===i.name||e.start_session(i.name)}),this.events.on("kernel_ready.Kernel",function(t,i){var n=i.kernel.info_reply;if(!n.language_info)return void delete e.metadata.language_info;var r=n.language_info;e.metadata.language_info=r;var s=r.codemirror_mode||r.name||"null";e.set_codemirror_mode(s)}),this.events.on("kernel_idle.Kernel",function(){e.kernel_busy=!1}),this.events.on("kernel_busy.Kernel",function(){e.kernel_busy=!0});var t=function(t){var n=i("#ipython-main-app").height(),r=i("div#pager_splitter").outerHeight(!0),s=n-r;e.element.animate({height:s+"px"},t)};this.element.bind("collapse_pager",function(e,i){var n=void 0!==i&&void 0!==i.duration?i.duration:"fast";t(n)});var n=function(t){var n=i("#ipython-main-app").height(),r=i("div#pager_splitter").outerHeight(!0),s=i("div#pager").outerHeight(!0),o=n-s-r;e.element.animate({height:o+"px"},t)};this.element.bind("expand_pager",function(e,t){var i=void 0!==t&&void 0!==t.duration?t.duration:"fast";n(i)})},y.prototype.warn_nbformat_minor=function(e){var t="v"+this.nbformat+".",i=t+this.nbformat_minor,n=t+this.current_nbformat_minor,s="This notebook is version "+i+", but we only fully support up to "+n+".  You can still work with this notebook, but cell and output types introduced in later notebook versions will not be available.";r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Newer Notebook",body:s,buttons:{OK:{"class":"btn-danger"}}})},y.prototype.set_dirty=function(e){void 0===e&&(e=!0),this.dirty!==e&&this.events.trigger("set_dirty.Notebook",{value:e})},y.prototype.scroll_to_cell=function(e,t){return this.scroll_cell_percent(e,0,t)},y.prototype.scroll_cell_percent=function(e,t,i){var n=this.get_cells();i=i||0,t=t||0,e=Math.min(n.length-1,e),e=Math.max(0,e);var r=this.scroll_manager.element,s=r.height(),o=r.scrollTop(),a=r.offset().top,l=n[e].element.offset().top,c=o+l-(a+.01*t*s);return this.scroll_manager.element.animate({scrollTop:c},i),c},y.prototype.scroll_to_bottom=function(){this.scroll_manager.element.animate({scrollTop:this.element.get(0).scrollHeight},0)},y.prototype.scroll_to_top=function(){this.scroll_manager.element.animate({scrollTop:0},0)},y.prototype.edit_metadata=function(){var e=this;r.edit_metadata({md:this.metadata,callback:function(t){e.metadata=t},name:"Notebook",notebook:this,keyboard_manager:this.keyboard_manager})},y.prototype.get_cell_elements=function(){return this.container.find(".cell").not(".cell .cell")},y.prototype.get_cell_element=function(e){var t=null,i=this.get_cell_elements().eq(e);return 0!==i.length&&(t=i),t},y.prototype.get_msg_cell=function(e){return a.CodeCell.msg_cells[e]||null},y.prototype.ncells=function(){return this.get_cell_elements().length},y.prototype.get_cells=function(){return this.get_cell_elements().toArray().map(function(e){return i(e).data("cell")})},y.prototype.get_cell=function(e){var t=null,i=this.get_cell_element(e);return null!==i&&(t=i.data("cell")),t},y.prototype.get_next_cell=function(e){var t=null,i=this.find_cell_index(e);return this.is_valid_cell_index(i+1)&&(t=this.get_cell(i+1)),t},y.prototype.get_prev_cell=function(e){var t=null,i=this.find_cell_index(e);return null!==i&&i>0&&(t=this.get_cell(i-1)),t},y.prototype.find_cell_index=function(e){var t=null;return this.get_cell_elements().filter(function(n){i(this).data("cell")===e&&(t=n)}),t},y.prototype.index_or_selected=function(e){var t;return void 0===e||null===e?(t=this.get_selected_index(),null===t&&(t=0)):t=e,t},y.prototype.get_selected_cell=function(){var e=this.get_selected_index();return this.get_cell(e)},y.prototype.is_valid_cell_index=function(e){return null!==e&&e>=0&&e<this.ncells()?!0:!1},y.prototype.get_selected_index=function(){var e=null;return this.get_cell_elements().filter(function(t){i(this).data("cell").selected===!0&&(e=t)}),e},y.prototype.get_selection_anchor=function(){var e=null;return this.get_cell_elements().filter(function(t){i(this).data("cell").selection_anchor===!0&&(e=t)}),e},y.prototype.get_selected_cells=function(){return this.get_cells().filter(function(e){return e.in_selection})},y.prototype.get_selected_indices=function(){var e=[];return this.get_cell_elements().filter(function(t){i(this).data("cell").in_selection===!0&&e.push(t)}),e},y.prototype.select=function(e){if(this.is_valid_cell_index(e)){var t=this.get_selected_index();null!==t&&e!==t&&"command"!==this.mode&&this.command_mode();for(var i=this.get_selected_cells(),n=0;n<i.length;n++)i[n].unselect();var r=this._select(e);r.selection_anchor=!0}return this},y.prototype._select=function(e){var t=this.get_cell(e);return t.select(),this.events.trigger("selected_cell_type_changed.Notebook",{cell_type:t.cell_type}),t},y.prototype.select_next=function(){var e=this.get_selected_index();return this.select(e+1),this},y.prototype.select_prev=function(){var e=this.get_selected_index();return this.select(e-1),this},y.prototype.extend_selection=function(e){var t=this.get_selection_anchor(),i=this.get_selected_index(),n=i>t?"down":"up",r=i!==t&&e!==n,s="up"===e?-1:1,o=i+s;return 0>o||o>=this.ncells()?!1:("command"!==this.mode&&this.command_mode(),this.get_cell(i).unselect(!r),this._select(o),!0)},y.prototype.reset_selection=function(){for(var e=this.get_selected_cells(),t=0;t<e.length;t++)e[t].selected||e[t].unselect()},y.prototype.get_edit_index=function(){var e=null;return this.get_cell_elements().filter(function(t){"edit"===i(this).data("cell").mode&&(e=t)}),e},y.prototype.handle_command_mode=function(e){"command"!==this.mode&&(e.command_mode(),this.mode="command",this.events.trigger("command_mode.Notebook"),this.keyboard_manager.command_mode())},y.prototype.command_mode=function(){var e=this.get_cell(this.get_edit_index());e&&"command"!==this.mode&&e.code_mirror.getInputField().blur()},y.prototype.handle_edit_mode=function(e){e&&"edit"!==this.mode&&(e.edit_mode(),this.mode="edit",this.reset_selection(),this.events.trigger("edit_mode.Notebook"),this.keyboard_manager.edit_mode())},y.prototype.edit_mode=function(){var e=this.get_selected_cell();e&&"edit"!==this.mode&&(e.unrender(),e.focus_editor())},y.prototype.ensure_focused=function(){var e=this.get_selected_cell();null!==e&&e.ensure_focused()},y.prototype.focus_cell=function(){var e=this.get_selected_cell();null!==e&&e.focus_cell()},y.prototype.move_cell_up=function(e){var t=this.index_or_selected(e);if(this.is_valid_cell_index(t)&&t>0){var i=this.get_cell_element(t-1),n=this.get_cell_element(t);if(null!==i&&null!==n){n.detach(),i.before(n),this.select(t-1);var r=this.get_selected_cell();r.focus_cell()}this.set_dirty(!0)}return this},y.prototype.move_cell_down=function(e){var t=this.index_or_selected(e);if(this.is_valid_cell_index(t)&&this.is_valid_cell_index(t+1)){var i=this.get_cell_element(t+1),n=this.get_cell_element(t);if(null!==i&&null!==n){n.detach(),i.after(n),this.select(t+1);var r=this.get_selected_cell();r.focus_cell()}}return this.set_dirty(),this},y.prototype._unsafe_delete_cell=function(e){var t=this.index_or_selected(e);this.get_cell(t);if(i("#undelete_cell").addClass("disabled"),this.is_valid_cell_index(t)){var n=(this.ncells(),this.get_cell_element(t));n.remove(),this.set_dirty(!0)}return this},y.prototype.delete_cell=function(e){var t=this.index_or_selected(e),n=this.get_cell(t);if(!n.is_deletable())return this;if(this.undelete_backup=n.toJSON(),i("#undelete_cell").removeClass("disabled"),this.is_valid_cell_index(t)){var r=this.ncells(),s=this.get_cell_element(t);s.remove(),0===t?(1===r&&this.insert_cell_below("code"),this.select(0),this.undelete_index=0,this.undelete_below=!1):t===r-1&&0!==t?(this.select(t-1),this.undelete_index=t-1,this.undelete_below=!0):(this.select(t),this.undelete_index=t,this.undelete_below=!1),this.events.trigger("delete.Cell",{cell:n,index:t}),this.set_dirty(!0)}return this},y.prototype.undelete_cell=function(){if(null!==this.undelete_backup&&null!==this.undelete_index){var e=this.get_selected_index();this.undelete_index<e&&(e+=1),this.undelete_index>=this.ncells()?this.select(this.ncells()-1):this.select(this.undelete_index);var t=this.undelete_backup,n=null;n=this.undelete_below?this.insert_cell_below(t.cell_type):this.insert_cell_above(t.cell_type),n.fromJSON(t),this.undelete_below?this.select(e+1):this.select(e),this.undelete_backup=null,this.undelete_index=null}i("#undelete_cell").addClass("disabled")},y.prototype.insert_cell_at_index=function(e,t){var i=this.ncells();t=Math.min(t,i),t=Math.max(t,0);var n=null;if(e=e||this.class_config.get_sync("default_cell_type"),"above"===e?e=t>0?this.get_cell(t-1).cell_type:"code":"below"===e?e=i>t?this.get_cell(t).cell_type:"code":"selected"===e&&(e=this.get_selected_cell().cell_type),0===i||this.is_valid_cell_index(t)||t===i){var r={events:this.events,config:this.config,keyboard_manager:this.keyboard_manager,notebook:this,tooltip:this.tooltip};switch(e){case"code":n=new a.CodeCell(this.kernel,r),n.set_input_prompt();break;case"markdown":n=new o.MarkdownCell(r);break;case"raw":n=new o.RawCell(r);break;default:console.log("Unrecognized cell type: ",e,s),n=new s.UnrecognizedCell(r)}this._insert_element_at_index(n.element,t)&&(n.render(),this.events.trigger("create.Cell",{cell:n,index:t}),n.refresh(),this.set_dirty(!0))}return n},y.prototype._insert_element_at_index=function(e,t){if(void 0===e)return!1;var i=this.ncells();if(0===i)this.container.append(e);else if(i===t)this.get_cell_element(t-1).after(e);else{
if(!this.is_valid_cell_index(t))return!1;this.get_cell_element(t).before(e)}return null!==this.undelete_index&&t<=this.undelete_index&&(this.undelete_index=this.undelete_index+1,this.set_dirty(!0)),!0},y.prototype.insert_cell_above=function(e,t){return t=this.index_or_selected(t),this.insert_cell_at_index(e,t)},y.prototype.insert_cell_below=function(e,t){return t=this.index_or_selected(t),this.insert_cell_at_index(e,t+1)},y.prototype.insert_cell_at_bottom=function(e){var t=this.ncells();return this.insert_cell_below(e,t-1)},y.prototype.to_code=function(e){var t=this.index_or_selected(e);if(this.is_valid_cell_index(t)){var i=this.get_cell(t);if(!(i instanceof a.CodeCell)){var n=this.insert_cell_below("code",t),r=i.get_text();r===i.placeholder&&(r=""),n.metadata=i.metadata,n.set_text(r),n.code_mirror.clearHistory(),i.element.remove(),this.select(t);var s=i.code_mirror.getCursor();n.code_mirror.setCursor(s),this.set_dirty(!0)}}},y.prototype.to_markdown=function(e){var t=this.index_or_selected(e);if(this.is_valid_cell_index(t)){var i=this.get_cell(t);if(!(i instanceof o.MarkdownCell)){var n=this.insert_cell_below("markdown",t),r=i.get_text();r===i.placeholder&&(r=""),n.metadata=i.metadata,n.unrender(),n.set_text(r),n.code_mirror.clearHistory(),i.element.remove(),this.select(t),i instanceof o.TextCell&&i.rendered&&n.render();var s=i.code_mirror.getCursor();n.code_mirror.setCursor(s),this.set_dirty(!0)}}},y.prototype.to_raw=function(e){var t=this.index_or_selected(e);if(this.is_valid_cell_index(t)){var i=null,n=this.get_cell(t);if(!(n instanceof o.RawCell)){i=this.insert_cell_below("raw",t);var r=n.get_text();r===n.placeholder&&(r=""),i.metadata=n.metadata,i.unrender(),i.set_text(r),i.code_mirror.clearHistory(),n.element.remove(),this.select(t);var s=n.code_mirror.getCursor();i.code_mirror.setCursor(s),this.set_dirty(!0)}}},y.prototype._warn_heading=function(){r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Use markdown headings",body:i("<p/>").text("Jupyter no longer uses special heading cells. Instead, write your headings in Markdown cells using # characters:").append(i("<pre/>").text("## This is a level 2 heading")),buttons:{OK:{}}})},y.prototype.to_heading=function(e,t){this.to_markdown(e),t=t||1;var i=this.index_or_selected(e);if(this.is_valid_cell_index(i)){var n=this.get_cell(i);n.set_heading_level(t),this.set_dirty(!0)}},y.prototype.enable_paste=function(){var e=this;this.paste_enabled||(i("#paste_cell_replace").removeClass("disabled").on("click",function(){e.paste_cell_replace()}),i("#paste_cell_above").removeClass("disabled").on("click",function(){e.paste_cell_above()}),i("#paste_cell_below").removeClass("disabled").on("click",function(){e.paste_cell_below()}),this.paste_enabled=!0)},y.prototype.disable_paste=function(){this.paste_enabled&&(i("#paste_cell_replace").addClass("disabled").off("click"),i("#paste_cell_above").addClass("disabled").off("click"),i("#paste_cell_below").addClass("disabled").off("click"),this.paste_enabled=!1)},y.prototype.cut_cell=function(){this.copy_cell(),this.delete_cell()},y.prototype.copy_cell=function(){var e=this.get_selected_cell();this.clipboard=e.toJSON(),void 0!==this.clipboard.metadata.deletable&&delete this.clipboard.metadata.deletable,this.enable_paste()},y.prototype.paste_cell_replace=function(){if(null!==this.clipboard&&this.paste_enabled){var e=this.clipboard,t=this.insert_cell_above(e.cell_type);t.fromJSON(e);var i=this.get_next_cell(t);this.delete_cell(this.find_cell_index(i)),this.select(this.find_cell_index(t))}},y.prototype.paste_cell_above=function(){if(null!==this.clipboard&&this.paste_enabled){var e=this.clipboard,t=this.insert_cell_above(e.cell_type);t.fromJSON(e),t.focus_cell()}},y.prototype.paste_cell_below=function(){if(null!==this.clipboard&&this.paste_enabled){var e=this.clipboard,t=this.insert_cell_below(e.cell_type);t.fromJSON(e),t.focus_cell()}},y.prototype.split_cell=function(){var e=this.get_selected_cell();if(e.is_splittable()){var t=e.get_pre_cursor(),i=e.get_post_cursor();e.set_text(i);var n=this.insert_cell_above(e.cell_type);n.unrender(),n.set_text(t)}},y.prototype.merge_cells=function(e,t){if(!(e.length<=1)){for(var i=0;i<e.length;i++)if(!this.get_cell(e[i]).is_mergeable())return;var n=this.get_cell(t?e.pop():e.shift()),r=[];for(i=0;i<e.length;i++)r.push(this.get_cell(e[i]).get_text());if(t?r.push(n.get_text()):r.unshift(n.get_text()),n instanceof a.CodeCell)n.set_text(r.join("\n\n"));else{var s=n.rendered;n.unrender(),n.set_text(r.join("\n\n")),s&&n.render()}for(e.sort(function(e,t){return t-e}),i=0;i<e.length;i++)this.delete_cell(e[i]);this.select(this.find_cell_index(n))}},y.prototype.merge_selected_cells=function(){this.merge_cells(this.get_selected_indices())},y.prototype.merge_cell_above=function(){var e=this.get_selected_index();this.merge_cells([e-1,e],!0)},y.prototype.merge_cell_below=function(){var e=this.get_selected_index();this.merge_cells([e,e+1],!1)},y.prototype.collapse_output=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.collapse_output(),this.set_dirty(!0))},y.prototype.collapse_all_output=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.collapse_output()}),this.set_dirty(!0)},y.prototype.expand_output=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.expand_output(),this.set_dirty(!0))},y.prototype.expand_all_output=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.expand_output()}),this.set_dirty(!0)},y.prototype.clear_output=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.clear_output(),this.set_dirty(!0))},y.prototype.clear_all_output=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.clear_output()}),this.set_dirty(!0)},y.prototype.scroll_output=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.scroll_output(),this.set_dirty(!0))},y.prototype.scroll_all_output=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.scroll_output()}),this.set_dirty(!0)},y.prototype.toggle_output=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.toggle_output(),this.set_dirty(!0))},y.prototype.toggle_all_output=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.toggle_output()}),this.set_dirty(!0)},y.prototype.toggle_output_scroll=function(e){var t=this.index_or_selected(e),i=this.get_cell(t);null!==i&&i instanceof a.CodeCell&&(i.toggle_output_scroll(),this.set_dirty(!0))},y.prototype.toggle_all_output_scroll=function(){this.get_cells().map(function(e,t){e instanceof a.CodeCell&&e.toggle_output_scroll()}),this.set_dirty(!0)},y.prototype.cell_toggle_line_numbers=function(){this.get_selected_cell().toggle_line_numbers()},y.prototype._dispatch_mode=function(e,t){this.codemirror_mode=t,a.CodeCell.options_default.cm_config.mode=t,this.get_cells().map(function(t,i){"code"===t.cell_type&&(t.code_mirror.setOption("mode",e),t._options.cm_config.mode=e)})};var x=function(e,t){return((e||{}).name||e)===((t||{}).name||t)};return y.prototype.set_codemirror_mode=function(e){if(!x(e,this.codemirror_mode)){var t=this;n.requireCodeMirrorMode(e,function(i){t._dispatch_mode(i,e)},function(){x(e,this.codemirror_mode)&&t._dispatch_mode("null","null")})}},y.prototype.start_session=function(e){if(this._session_starting)throw new h.SessionAlreadyStarting;this._session_starting=!0;var t={base_url:this.base_url,ws_url:this.ws_url,notebook_path:this.notebook_path,notebook_name:this.notebook_name,kernel_name:e,notebook:this},n=i.proxy(this._session_started,this),r=i.proxy(this._session_start_failed,this);null!==this.session?this.session.restart(t,n,r):(this.session=new h.Session(t),this.session.start(n,r))},y.prototype._session_started=function(){this._session_starting=!1,this.kernel=this.session.kernel;for(var e=this.ncells(),t=0;e>t;t++){var i=this.get_cell(t);i instanceof a.CodeCell&&i.set_kernel(this.session.kernel)}},y.prototype._session_start_failed=function(e,t,i){this._session_starting=!1,n.log_ajax_error(e,t,i)},y.prototype.restart_kernel=function(){var e=this;r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Restart kernel or continue running?",body:i("<p/>").text("Do you want to restart the current kernel?  You will lose all variables defined in it."),buttons:{"Continue running":{},"Clear all outputs & restart":{"class":"btn-danger",click:function(){e.clear_all_output(),e.kernel.restart()}},Restart:{"class":"btn-warning",click:function(){e.kernel.restart()}}}})},y.prototype.execute_cell=function(){var e=this.get_selected_cell();e.execute(),this.command_mode(),this.set_dirty(!0)},y.prototype.execute_cell_and_insert_below=function(){var e=this.get_selected_cell(),t=this.find_cell_index(e);return e.execute(),t===this.ncells()-1?(this.command_mode(),this.insert_cell_below(),this.select(t+1),this.edit_mode(),this.scroll_to_bottom(),void this.set_dirty(!0)):(this.command_mode(),this.insert_cell_below(),this.select(t+1),this.edit_mode(),void this.set_dirty(!0))},y.prototype.execute_cell_and_select_below=function(){var e=this.get_selected_cell(),t=this.find_cell_index(e);return e.execute(),t===this.ncells()-1?(this.command_mode(),this.insert_cell_below(),this.select(t+1),this.edit_mode(),this.scroll_to_bottom(),void this.set_dirty(!0)):(this.command_mode(),this.select(t+1),this.focus_cell(),void this.set_dirty(!0))},y.prototype.execute_cells_below=function(){this.execute_cell_range(this.get_selected_index(),this.ncells()),this.scroll_to_bottom()},y.prototype.execute_cells_above=function(){this.execute_cell_range(0,this.get_selected_index())},y.prototype.execute_all_cells=function(){this.execute_cell_range(0,this.ncells()),this.scroll_to_bottom()},y.prototype.execute_cell_range=function(e,t){this.command_mode();for(var i=e;t>i;i++)this.select(i),this.execute_cell()},y.prototype.get_notebook_name=function(){var e=n.splitext(this.notebook_name)[0];return e},y.prototype.set_notebook_name=function(e){var t=n.url_path_split(this.notebook_path)[0];this.notebook_name=e,this.notebook_path=n.url_path_join(t,e)},y.prototype.test_notebook_name=function(e){return e=e||"",e.length>0&&!this.notebook_name_blacklist_re.test(e)?!0:!1},y.prototype.fromJSON=function(e){var t,i=e.content,n=this.ncells();for(t=0;n>t;t++)this._unsafe_delete_cell(0);this.metadata=i.metadata,this.notebook_name=e.name,this.notebook_path=e.path;var r=!0;if(void 0!==this.metadata.language_info){var s=this.metadata.language_info,o=s.codemirror_mode||s.name||"null";this.set_codemirror_mode(o)}var a=i.cells;n=a.length;var l=null,c=null;for(t=0;n>t;t++)l=a[t],c=this.insert_cell_at_index(l.cell_type,t),c.fromJSON(l),"code"!==c.cell_type||c.output_area.trusted||(r=!1);r!==this.trusted&&(this.trusted=r,this.events.trigger("trust_changed.Notebook",r))},y.prototype.toJSON=function(){delete this.metadata.orig_nbformat,delete this.metadata.orig_nbformat_minor;for(var e=this.get_cells(),t=e.length,i=new Array(t),n=!0,r=0;t>r;r++){var s=e[r];"code"!==s.cell_type||s.output_area.trusted||(n=!1),i[r]=s.toJSON()}var o={cells:i,metadata:this.metadata,nbformat:this.nbformat,nbformat_minor:this.nbformat_minor};return n!==this.trusted&&(this.trusted=n,this.events.trigger("trust_changed.Notebook",n)),o},y.prototype.set_autosave_interval=function(e){var t=this;this.autosave_timer&&clearInterval(this.autosave_timer),this.writable||(e=0),this.autosave_interval=this.minimum_autosave_interval=e,e?(this.autosave_timer=setInterval(function(){t.dirty&&t.save_notebook()},e),this.events.trigger("autosave_enabled.Notebook",e)):(this.autosave_timer=null,this.events.trigger("autosave_disabled.Notebook"))},y.prototype.save_notebook=function(e){if(void 0===e&&(e=!0),!this._fully_loaded)return void this.events.trigger("notebook_save_failed.Notebook",new Error("Load failed, save is disabled"));if(!this.writable)return void this.events.trigger("notebook_save_failed.Notebook",new Error("Notebook is read-only"));this.events.trigger("before_save.Notebook");var t={type:"notebook",content:this.toJSON()},n=(new Date).getTime(),s=this,o=function(){return s.contents.save(s.notebook_path,t).then(i.proxy(s.save_notebook_success,s,n),function(e){s.events.trigger("notebook_save_failed.Notebook",e)})};return e?this.contents.get(this.notebook_path,{content:!1}).then(function(e){var t=new Date(e.last_modified);return t>s.last_modified?void r.modal({notebook:s,keyboard_manager:s.keyboard_manager,title:"Notebook changed",body:"The notebook file has changed on disk since the last time we opened or saved it. Do you want to overwrite the file on disk with the version open here, or load the version on disk (reload the page) ?",buttons:{Reload:{"class":"btn-warning",click:function(){window.location.reload()}},Cancel:{},Overwrite:{"class":"btn-danger",click:function(){o()}}}}):o()},function(e){return o()}):o()},y.prototype.save_notebook_success=function(e,t){if(this.set_dirty(!1),this.last_modified=new Date(t.last_modified),t.message){var n=i("<div>"),s="Notebook validation failed";n.append(i("<p>").text("The save operation succeeded, but the notebook does not appear to be valid. The validation error was:")).append(i("<div>").addClass("validation-error").append(i("<pre>").text(t.message))),r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:s,body:n,buttons:{OK:{"class":"btn-primary"}}})}this.events.trigger("notebook_saved.Notebook"),this._update_autosave_interval(e),this._checkpoint_after_save&&(this.create_checkpoint(),this._checkpoint_after_save=!1)},y.prototype._update_autosave_interval=function(e){var t=(new Date).getTime()-e;if(this.autosave_interval){var i=Math.max(10*t,this.minimum_autosave_interval);i=1e4*Math.round(i/1e4),i!==this.autosave_interval&&this.set_autosave_interval(i)}},y.prototype.trust_notebook=function(){var e=i("<div>").append(i("<p>").text("A trusted Jupyter notebook may execute hidden malicious code ").append(i("<strong>").append(i("<em>").text("when you open it"))).append(".").append(" Selecting trust will immediately reload this notebook in a trusted state.").append(" For more information, see the ").append(i("<a>").attr("href","http://ipython.org/ipython-doc/2/notebook/security.html").text("Jupyter security documentation")).append(".")),t=this;r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Trust this notebook?",body:e,buttons:{Cancel:{},Trust:{"class":"btn-danger",click:function(){for(var e=t.get_cells(),i=0;i<e.length;i++){var n=e[i];"code"===n.cell_type&&(n.output_area.trusted=!0)}t.events.on("notebook_saved.Notebook",function(){window.location.reload()}),t.save_notebook()}}}})},y.prototype.copy_notebook=function(){var e=this,i=this.base_url,r=window.open("",t._target),s=n.url_path_split(this.notebook_path)[0];this.contents.copy(this.notebook_path,s).then(function(e){r.location=n.url_join_encode(i,"notebooks",e.path)},function(t){r.close(),e.events.trigger("notebook_copy_failed",t)})},y.prototype.ensure_extension=function(e){var t=n.splitext(this.notebook_path)[1];return t.length&&e.slice(-t.length)!==t&&(e+=t),e},y.prototype.rename=function(e){e=this.ensure_extension(e);var t=this,i=n.url_path_split(this.notebook_path)[0],r=n.url_path_join(i,e);return this.contents.rename(this.notebook_path,r).then(function(e){t.notebook_name=e.name,t.notebook_path=e.path,t.last_modified=new Date(e.last_modified),t.session.rename_notebook(e.path),t.events.trigger("notebook_renamed.Notebook",e)})},y.prototype["delete"]=function(){this.contents["delete"](this.notebook_path)},y.prototype.load_notebook=function(e,t){this.notebook_path=e,this.notebook_name=n.url_path_split(this.notebook_path)[1],this.events.trigger("notebook_loading.Notebook"),t||(t="ipython");var i={mimetype:null,writable:!0,name:"blank.ipynb",format:"json",created:"2015-03-31T18:35:40.310440+00:00",content:{nbformat_minor:0,cells:[],nbformat:4,metadata:{kernelspec:{display_name:"Python 2",name:"python2",language:"python"},language_info:{mimetype:"text/x-python",nbconvert_exporter:"python",version:"2.7.6",name:"python",file_extension:".py",pygments_lexer:"ipython2",codemirror_mode:{name:t}}}},last_modified:"2015-03-26T20:44:44+00:00",path:"blank.ipynb",type:"notebook"};this.load_notebook_success(i)},y.prototype.load_notebook_success=function(e){var t,s;try{this.fromJSON(e)}catch(o){t=o,console.log("Notebook failed to load from JSON:",o)}if(t||e.message){var a,l=i("<div>");t?(a="Notebook failed to load",l.append(i("<p>").text("The error was: ")).append(i("<div>").addClass("js-error").text(t.toString())).append(i("<p>").text("See the error console for details."))):a="Notebook validation failed",e.message&&(s=t?"The notebook also failed validation:":"An invalid notebook may not function properly. The validation error was:",l.append(i("<p>").text(s)).append(i("<div>").addClass("validation-error").append(i("<pre>").text(e.message)))),r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:a,body:l,buttons:{OK:{"class":"btn-primary"}}})}0===this.ncells()?(this.insert_cell_below("code"),this.edit_mode(0)):(this.select(0),this.handle_command_mode(this.get_cell(0))),this.set_dirty(!1),this.scroll_to_top(),this.writable=e.writable||!1,this.last_modified=new Date(e.last_modified);var c=e.content,h=c.metadata.orig_nbformat;c.metadata.orig_nbformat_minor;if(void 0!==h&&c.nbformat!==h){var d;d=c.nbformat>h?" an older notebook format ":" a newer notebook format ",s="This notebook has been converted from"+d+"(v"+h+") to the current notebook format (v"+c.nbformat+"). The next time you save this notebook, the current notebook format will be used.",s+=c.nbformat>h?" Older versions of Jupyter may not be able to read the new format.":" Some features of the original notebook may not be available.",s+=" To preserve the original version, close the notebook without saving it.",r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Notebook converted",body:s,buttons:{OK:{"class":"btn-primary"}}})}else this.nbformat_minor<c.nbformat_minor&&(this.nbformat_minor=c.nbformat_minor);if(null===this.session){var p=n.get_url_param("kernel_name");p?this.kernel_selector.set_kernel(p):this.metadata.kernelspec?this.kernel_selector.set_kernel(this.metadata.kernelspec):this.metadata.language?(this.kernel_selector.set_kernel({name:"(No name)",language:this.metadata.language}),delete this.metadata.language):this.start_session()}this.list_checkpoints(),this.metadata.celltoolbar?(u.CellToolbar.global_show(),u.CellToolbar.activate_preset(this.metadata.celltoolbar)):u.CellToolbar.global_hide(),this.writable||(this.set_autosave_interval(0),this.events.trigger("notebook_read_only.Notebook")),this._fully_loaded=!0,this.events.trigger("notebook_loaded.Notebook")},y.prototype.set_kernelselector=function(e){this.kernel_selector=e},y.prototype.load_notebook_error=function(e){this.events.trigger("notebook_load_failed.Notebook",e);var t;e.name===n.XHR_ERROR&&500===e.xhr.status?(n.log_ajax_error(e.xhr,e.xhr_status,e.xhr_error),t="An unknown error occurred while loading this notebook. This version can load notebook formats v"+this.nbformat+" or earlier. See the server log for details."):(t=e.message,console.warn("Error stack trace while loading notebook was:"),console.warn(e.stack)),r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Error loading notebook",body:t,buttons:{OK:{}}})},y.prototype.save_checkpoint=function(){this._checkpoint_after_save=!0,this.save_notebook()},y.prototype.add_checkpoint=function(e){for(var t=!1,i=0;i<this.checkpoints.length;i++){var n=this.checkpoints[i];if(n.id===e.id){t=!0,this.checkpoints[i]=e;break}}t||this.checkpoints.push(e),this.last_checkpoint=this.checkpoints[this.checkpoints.length-1]},y.prototype.list_checkpoints=function(){var e=this;this.contents.list_checkpoints(this.notebook_path).then(i.proxy(this.list_checkpoints_success,this),function(t){e.events.trigger("list_checkpoints_failed.Notebook",t)})},y.prototype.list_checkpoints_success=function(e){this.checkpoints=e,e.length?this.last_checkpoint=e[e.length-1]:this.last_checkpoint=null,this.events.trigger("checkpoints_listed.Notebook",[e])},y.prototype.create_checkpoint=function(){var e=this;this.contents.create_checkpoint(this.notebook_path).then(i.proxy(this.create_checkpoint_success,this),function(t){e.events.trigger("checkpoint_failed.Notebook",t)})},y.prototype.create_checkpoint_success=function(e){this.add_checkpoint(e),this.events.trigger("checkpoint_created.Notebook",e)},y.prototype.restore_checkpoint_dialog=function(e){var t=this;if(e=e||this.last_checkpoint,!e)return void console.log("restore dialog, but no checkpoint to restore to!");var n=i("<div/>").append(i("<p/>").addClass("p-space").text("Are you sure you want to revert the notebook to the latest checkpoint?").append(i("<strong/>").text(" This cannot be undone."))).append(i("<p/>").addClass("p-space").text("The checkpoint was last updated at:")).append(i("<p/>").addClass("p-space").text(l(e.last_modified).format("LLLL")+" ("+l(e.last_modified).fromNow()+")").css("text-align","center"));r.modal({notebook:this,keyboard_manager:this.keyboard_manager,title:"Revert notebook to checkpoint",body:n,buttons:{Revert:{"class":"btn-danger",click:function(){t.restore_checkpoint(e.id)}},Cancel:{}}})},y.prototype.restore_checkpoint=function(e){this.events.trigger("notebook_restoring.Notebook",e);var t=this;this.contents.restore_checkpoint(this.notebook_path,e).then(i.proxy(this.restore_checkpoint_success,this),function(e){t.events.trigger("checkpoint_restore_failed.Notebook",e)})},y.prototype.restore_checkpoint_success=function(){this.events.trigger("checkpoint_restored.Notebook"),this.load_notebook(this.notebook_path)},y.prototype.delete_checkpoint=function(e){this.events.trigger("notebook_restoring.Notebook",e);var t=this;this.contents.delete_checkpoint(this.notebook_path,e).then(i.proxy(this.delete_checkpoint_success,this),function(e){t.events.trigger("checkpoint_delete_failed.Notebook",e)})},y.prototype.delete_checkpoint_success=function(){this.events.trigger("checkpoint_deleted.Notebook"),this.load_notebook(this.notebook_path)},{Notebook:y}}),define("thebe/default_css",[],function(){return{css:".thebe-spinner-three-bounce.thebe-spinner{margin:0 auto;text-align:center}.thebe-spinner-three-bounce div{width:10px;height:10px;background-color:#333;border-radius:100%;display:inline-block;-webkit-animation:thebe-threeBounceDelay 1.4s infinite ease-in-out;animation:thebe-threeBounceDelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.thebe-spinner-three-bounce div:nth-child(1){-webkit-animation-delay:-0.3s;animation-delay:-0.3s}.thebe-spinner-three-bounce div:nth-child(2){-webkit-animation-delay:-0.16s;animation-delay:-0.16s}@-webkit-keyframes thebe-threeBounceDelay{0%,80%,100%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes thebe-threeBounceDelay{0%,80%,100%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}.thebe-spinner{float:right;padding-left:10px}div.input_area .CodeMirror{height:auto !important}.CodeMirror-scroll{height:auto !important;overflow-y:hidden;overflow-x:auto}div.cell .prompt.input_prompt{display:none}div.cell .output pre{word-wrap:break-word}.CodeMirror{font-family:monospace;height:300px}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.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:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black}.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:none}100%{background:#7e7}}@-webkit-keyframes blink{0%{background:#7e7}50%{background:none}100%{background:#7e7}}@keyframes blink{0%{background:#7e7}50%{background:none}100%{background:#7e7}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,0.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:none;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-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{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;*zoom:1;*display:inline}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;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}.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-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}.cm-searching{background:#ffa;background:rgba(255,255,0,0.4)}.CodeMirror span{*vertical-align:text-bottom}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}"}}),define("contents",["require","jquery","base/js/utils"],function(e){"use strict";var t=e("jquery"),i=e("base/js/utils"),n=function(e){this.base_url=e.base_url};return n.DIRECTORY_NOT_EMPTY_ERROR="DirectoryNotEmptyError",n.DirectoryNotEmptyError=function(){this.message="A directory must be empty before being deleted."},n.DirectoryNotEmptyError.prototype=Object.create(Error.prototype),n.DirectoryNotEmptyError.prototype.name=n.DIRECTORY_NOT_EMPTY_ERROR,n.prototype.api_url=function(){var e=[this.base_url,"api/contents"].concat(Array.prototype.slice.apply(arguments));return i.url_join_encode.apply(null,e)},n.prototype.create_basic_error_handler=function(e){return e?function(t,n,r){e(i.wrap_ajax_error(t,n,r))}:i.log_ajax_error},n.prototype.get=function(e,n){var r={processData:!1,cache:!1,type:"GET",dataType:"json"},s=this.api_url(e),o={};return n.type&&(o.type=n.type),n.format&&(o.format=n.format),n.content===!1&&(o.content="0"),i.promising_ajax(s+"?"+t.param(o),r)},n.prototype.new_untitled=function(e,t){var n=JSON.stringify({ext:t.ext,type:t.type}),r={processData:!1,type:"POST",data:n,dataType:"json"};return i.promising_ajax(this.api_url(e),r)},n.prototype["delete"]=function(e){var t={processData:!1,type:"DELETE",dataType:"json"},r=this.api_url(e);return i.promising_ajax(r,t)["catch"](function(e){if(400===e.xhr.status)throw new n.DirectoryNotEmptyError;throw e})},n.prototype.rename=function(e,t){var n={path:t},r={processData:!1,type:"PATCH",data:JSON.stringify(n),dataType:"json",contentType:"application/json"},s=this.api_url(e);return i.promising_ajax(s,r)},n.prototype.save=function(e,t){var n={processData:!1,type:"PUT",dataType:"json",data:JSON.stringify(t),contentType:"application/json"},r=this.api_url(e);return i.promising_ajax(r,n)},n.prototype.copy=function(e,t){var n=this.api_url(t),r={processData:!1,type:"POST",data:JSON.stringify({copy_from:e}),dataType:"json"};return i.promising_ajax(n,r)},n.prototype.create_checkpoint=function(e){var t=this.api_url(e,"checkpoints"),n={type:"POST",dataType:"json"};return i.promising_ajax(t,n)},n.prototype.list_checkpoints=function(e){var t=this.api_url(e,"checkpoints"),n={type:"GET",cache:!1,dataType:"json"};return i.promising_ajax(t,n)},n.prototype.restore_checkpoint=function(e,t){var n=this.api_url(e,"checkpoints",t),r={type:"POST"};return i.promising_ajax(n,r)},n.prototype.delete_checkpoint=function(e,t){var n=this.api_url(e,"checkpoints",t),r={type:"DELETE"};return i.promising_ajax(n,r)},n.prototype.list_contents=function(e){return this.get(e,{type:"directory"})},{Contents:n}}),define("base/js/page",["jquery","base/js/events"],function(e,t){"use strict";var i=function(){this.bind_events()};return i.prototype.bind_events=function(){var i=e.proxy(this._resize_site,this);e(window).resize(i),e(document).ready(i),t.on("resize-header.Page",i)},i.prototype.show=function(){this.show_header(),this.show_site()},i.prototype.show_header=function(){e("div#header").css("display","block")},i.prototype.show_site=function(){e("div#site").css("display","block"),this._resize_site()},i.prototype._resize_site=function(){e("div#site").height(e(window).height()-e("#header").height())},{Page:i}}),define("notebook/js/actions",["require"],function(e){"use strict";var t=function(e){this.env=e||{},Object.seal(this)},i={"run-select-next":{icon:"fa-step-forward",help:"run cell, select below",help_index:"ba",handler:function(e){e.notebook.execute_cell_and_select_below()}},"execute-in-place":{help:"run cell",help_index:"bb",handler:function(e){e.notebook.execute_cell()}},"execute-and-insert-after":{help:"run cell, insert below",help_index:"bc",handler:function(e){e.notebook.execute_cell_and_insert_below()}},"go-to-command-mode":{help:"command mode",help_index:"aa",handler:function(e){e.notebook.command_mode()}},"split-cell-at-cursor":{help:"split cell",help_index:"ea",handler:function(e){e.notebook.split_cell()}},"enter-edit-mode":{help_index:"aa",handler:function(e){e.notebook.edit_mode()}},"select-previous-cell":{help:"select cell above",help_index:"da",handler:function(e){var t=e.notebook.get_selected_index();0!==t&&null!==t&&(e.notebook.select_prev(),e.notebook.focus_cell())}},"select-next-cell":{help:"select cell below",help_index:"db",handler:function(e){var t=e.notebook.get_selected_index();t!==e.notebook.ncells()-1&&null!==t&&(e.notebook.select_next(),e.notebook.focus_cell())}},"extend-selection-previous":{help:"extend selection above",help_index:"dc",handler:function(e){var t=e.notebook.get_selected_index();0!==t&&null!==t&&(e.notebook.extend_selection("up"),
e.notebook.focus_cell())}},"extend-selection-next":{help:"extend selection below",help_index:"dd",handler:function(e){var t=e.notebook.get_selected_index();t!==e.notebook.ncells()-1&&null!==t&&(e.notebook.extend_selection("down"),e.notebook.focus_cell())}},"reset-selection":{help:"clear selected cells",help_index:"de",handler:function(e){e.notebook.reset_selection()}},"cut-selected-cell":{icon:"fa-cut",help_index:"ee",handler:function(e){var t=e.notebook.get_selected_index();e.notebook.cut_cell(),e.notebook.select(t)}},"copy-selected-cell":{icon:"fa-copy",help_index:"ef",handler:function(e){e.notebook.copy_cell()}},"paste-cell-before":{help:"paste cell above",help_index:"eg",handler:function(e){e.notebook.paste_cell_above()}},"paste-cell-after":{help:"paste cell below",icon:"fa-paste",help_index:"eh",handler:function(e){e.notebook.paste_cell_below()}},"insert-cell-before":{help:"insert cell above",help_index:"ec",handler:function(e){e.notebook.insert_cell_above(),e.notebook.select_prev(),e.notebook.focus_cell()}},"insert-cell-after":{help:"insert cell below",icon:"fa-plus",help_index:"ed",handler:function(e){e.notebook.insert_cell_below(),e.notebook.select_next(),e.notebook.focus_cell()}},"change-selected-cell-to-code-cell":{help:"to code",help_index:"ca",handler:function(e){e.notebook.to_code()}},"change-selected-cell-to-markdown-cell":{help:"to markdown",help_index:"cb",handler:function(e){e.notebook.to_markdown()}},"change-selected-cell-to-raw-cell":{help:"to raw",help_index:"cc",handler:function(e){e.notebook.to_raw()}},"change-selected-cell-to-heading-1":{help:"to heading 1",help_index:"cd",handler:function(e){e.notebook.to_heading(void 0,1)}},"change-selected-cell-to-heading-2":{help:"to heading 2",help_index:"ce",handler:function(e){e.notebook.to_heading(void 0,2)}},"change-selected-cell-to-heading-3":{help:"to heading 3",help_index:"cf",handler:function(e){e.notebook.to_heading(void 0,3)}},"change-selected-cell-to-heading-4":{help:"to heading 4",help_index:"cg",handler:function(e){e.notebook.to_heading(void 0,4)}},"change-selected-cell-to-heading-5":{help:"to heading 5",help_index:"ch",handler:function(e){e.notebook.to_heading(void 0,5)}},"change-selected-cell-to-heading-6":{help:"to heading 6",help_index:"ci",handler:function(e){e.notebook.to_heading(void 0,6)}},"toggle-output-visibility-selected-cell":{help:"toggle output",help_index:"gb",handler:function(e){e.notebook.toggle_output()}},"toggle-output-scrolling-selected-cell":{help:"toggle output scrolling",help_index:"gc",handler:function(e){e.notebook.toggle_output_scroll()}},"move-selected-cell-down":{icon:"fa-arrow-down",help_index:"eb",handler:function(e){e.notebook.move_cell_down()}},"move-selected-cell-up":{icon:"fa-arrow-up",help_index:"ea",handler:function(e){e.notebook.move_cell_up()}},"toggle-line-number-selected-cell":{help:"toggle line numbers",help_index:"ga",handler:function(e){e.notebook.cell_toggle_line_numbers()}},"show-keyboard-shortcut-help-dialog":{help_index:"ge",handler:function(e){e.quick_help.show_keyboard_shortcuts()}},"delete-cell":{help:"delete selected cell",help_index:"ej",handler:function(e){e.notebook.delete_cell()}},"interrupt-kernel":{icon:"fa-stop",help_index:"ha",handler:function(e){e.notebook.kernel.interrupt()}},"restart-kernel":{icon:"fa-repeat",help_index:"hb",handler:function(e){e.notebook.restart_kernel()}},"undo-last-cell-deletion":{help_index:"ei",handler:function(e){e.notebook.undelete_cell()}},"merge-selected-cell-with-cell-after":{help:"merge cell below",help_index:"ek",handler:function(e){e.notebook.merge_cell_below()}},"merge-selected-cells":{help:"merge selected cells",help_index:"el",handler:function(e){e.notebook.merge_selected_cells()}},"close-pager":{help_index:"gd",handler:function(e){e.pager.collapse()}}},n={ignore:{handler:function(){return!0}},"move-cursor-up-or-previous-cell":{handler:function(e,t){var i=e.notebook.get_selected_index(),n=e.notebook.get_cell(i),r=e.notebook.get_selected_cell().code_mirror,s=r.getCursor();return n&&n.at_top()&&0!==i&&0===s.ch&&(t&&t.preventDefault(),e.notebook.command_mode(),e.notebook.select_prev(),e.notebook.edit_mode(),r=e.notebook.get_selected_cell().code_mirror,r.setCursor(r.lastLine(),0)),!1}},"move-cursor-down-or-next-cell":{handler:function(e,t){var i=e.notebook.get_selected_index(),n=e.notebook.get_cell(i);if(n.at_bottom()&&i!==e.notebook.ncells()-1){t&&t.preventDefault(),e.notebook.command_mode(),e.notebook.select_next(),e.notebook.edit_mode();var r=e.notebook.get_selected_cell().code_mirror;r.setCursor(0,0)}return!1}},"scroll-down":{handler:function(e,t){return t&&t.preventDefault(),e.notebook.scroll_manager.scroll(1)}},"scroll-up":{handler:function(e,t){return t&&t.preventDefault(),e.notebook.scroll_manager.scroll(-1)}},"scroll-cell-center":{help:"Scroll the current cell to the center",handler:function(e,t){t&&t.preventDefault();var i=e.notebook.get_selected_index();return e.notebook.scroll_cell_percent(i,50,0)}},"scroll-cell-top":{help:"Scroll the current cell to the top",handler:function(e,t){t&&t.preventDefault();var i=e.notebook.get_selected_index();return e.notebook.scroll_cell_percent(i,0,0)}},"save-notebook":{help:"Save and Checkpoint",help_index:"fb",icon:"fa-save",handler:function(e,t){return e.notebook.save_checkpoint(),t&&t.preventDefault(),!1}}},r=function(e,t,i){return e["ipython."+t]={},e["ipython."+t].help=i[t].help||t.replace(/-/g," "),e["ipython."+t].help_index=i[t].help_index,e["ipython."+t].icon=i[t].icon,i[t].handler},s=function(){var e,t={};for(e in i)if(i.hasOwnProperty(e)){var s=r(t,e,i);!function(e,i){t["ipython."+e].handler=function(e,t){return i(e),t&&t.preventDefault(),!1}}(e,s)}for(e in n)if(n.hasOwnProperty(e)){var s=r(t,e,n);!function(e,i){t["ipython."+e].handler=function(e,t){return i(e,t)}}(e,s)}return t};return t.prototype._actions=s(),t.prototype.extend_env=function(e){for(var t in e)this.env[t]=e[t]},t.prototype.register=function(e,t,i){e=this.normalise(e),t||(t="autogenerated-"+String(e.handler)),i=i||"auto";var n=i+"."+t;return this._actions[n]=e,n},t.prototype.normalise=function(e){if("function"==typeof e&&(e={handler:e}),"function"!=typeof e.handler)throw"unknown datatype, cannot register";var t=e;return e={},e.handler=t.handler,e.help=t.help||"",e.icon=t.icon||"",e.help_index=t.help_index||"",e},t.prototype.get_name=function(e){return"string"==typeof e?this.exists(e)?e:null:this.register(e)},t.prototype.get=function(e){return this._actions[e]},t.prototype.call=function(e,t,i){return this._actions[e].handler(i||this.env,t)},t.prototype.exists=function(e){return"undefined"!=typeof this._actions[e]},{init:t}}),define("notebook/js/kernelselector",["jquery","base/js/namespace","base/js/dialog","base/js/utils"],function(e,t,i,n){"use strict";var r=function(i,n){var r=this;this.selector=i,this.notebook=n,this.notebook.set_kernelselector(this),this.events=n.events,this.current_selection=null,this.kernelspecs={},void 0!==this.selector&&(this.element=e(i),this.request_kernelspecs()),this.bind_events(),t.kernelselector=this,this._finish_load=null,this._loaded=!1,this.loaded=new Promise(function(e){r._finish_load=e}),Object.seal(this)};r.prototype.request_kernelspecs=function(){var t=n.url_join_encode(this.notebook.base_url,"api/kernelspecs");n.promising_ajax(t).then(e.proxy(this._got_kernelspecs,this))};var s=function(e){return Object.keys(e).sort(function(t,i){var n=e[t].spec.display_name,r=e[i].spec.display_name;return n===r?0:n>r?1:-1})};return r.prototype._got_kernelspecs=function(t){var i=this;this.kernelspecs=t.kernelspecs;var n=e("#menu-change-kernel-submenu"),r=e("#menu-new-notebook-submenu"),o=s(t.kernelspecs);o.map(function(s){var o=t.kernelspecs[s];n.append(e("<li>").attr("id","kernel-submenu-"+o.name).append(e("<a>").attr("href","#").click(function(){i.set_kernel(o.name)}).text(o.spec.display_name))),r.append(e("<li>").attr("id","new-notebook-submenu-"+o.name).append(e("<a>").attr("href","#").click(function(){i.new_notebook(o.name)}).text(o.spec.display_name)))}),this._loaded=!0,this._finish_load()},r.prototype._spec_changed=function(t,i){var n=this;this.current_selection=i.name;var r=e("#new-notebook-submenu-"+i.name),s=r.parent();s.children().length>1&&(s.append(s.children("li[class!='divider']").sort(function(t,i){var n=e("a",t).text(),r=e("a",i).text();return n===r?0:n>r?1:-1})),s.children("li[class='divider']").length||s.prepend(e("<li>").attr("class","divider")),s.prepend(r));var o=this.element.find("img.current_kernel_logo");e("#kernel_indicator").find(".kernel_indicator_name").text(i.spec.display_name),i.resources["logo-64x64"]?(o.attr("src",i.resources["logo-64x64"]),o.show()):o.hide();var a=i.resources["kernel.css"];a?e("#kernel-css").attr("href",a):e("#kernel-css").attr("href",""),i.resources["kernel.js"]&&(require([i.resources["kernel.js"]],function(e){e&&e.onload?e.onload():console.warn("Kernel "+i.name+" has a kernel.js file that does not contain any asynchronous module definition. This is undefined behavior and not recommended.")},function(e){console.warn("Failed to load kernel.js from ",i.resources["kernel.js"],e)}),this.events.on("spec_changed.Kernel",function(e,t){i.name!=t.name&&(console.warn("kernelspec %s had custom kernel.js. Forcing page reload for %s.",i.name,t.name),n.notebook.save_notebook().then(function(){window.location.reload()}))}))},r.prototype.set_kernel=function(e){var t=this;return"string"==typeof e&&(e={name:e}),this._loaded?void this._set_kernel(e):this.loaded.then(function(){t._set_kernel(e)})},r.prototype._set_kernel=function(e){if(e.name!==this.current_selection){var t=this.kernelspecs,i=t[e.name];if(void 0===i){var n=s(t),r=[];if(e.language&&e.language.length>0&&n.map(function(i){t[i].spec.language.toLowerCase()===e.language.toLowerCase()&&r.push(i)}),1===r.length&&(i=t[r[0]],console.log("No exact match found for "+e.name+", using only kernel that matches language="+e.language,i),this.events.trigger("spec_match_found.Kernel",{selected:e,found:i})),void 0===i)return void this.events.trigger("spec_not_found.Kernel",{selected:e,matches:r,available:n})}if(this.notebook._session_starting&&this.notebook.session.kernel.name!==i.name)return void console.error("Cannot change kernel while waiting for pending session start.");this.current_selection=i.name,this.events.trigger("spec_changed.Kernel",i)}},r.prototype._spec_not_found=function(t,n){var r=this,s=e("<select>").addClass("form-control");console.warn("Kernelspec not found:",n);var o;o=n.matches.length>1?n.matches:n.available,o.map(function(t){var i=r.kernelspecs[t];s.append(e("<option/>").attr("value",i.name).text(i.spec.display_name||i.name))});var a=e("<form>").addClass("form-inline").append(e("<span>").text("I couldn't find a kernel matching "+(n.selected.display_name||n.selected.name)+". Please select a kernel:")).append(s);i.modal({title:"Kernel not found",body:a,buttons:{"Continue without kernel":{"class":"btn-danger",click:function(){r.events.trigger("no_kernel.Kernel")}},OK:{"class":"btn-primary",click:function(){r.set_kernel(s.val())}}}})},r.prototype.new_notebook=function(e){var r=window.open("",t._target),s=this,o=n.url_path_split(s.notebook.notebook_path)[0];s.notebook.contents.new_untitled(o,{type:"notebook"}).then(function(t){var i=n.url_join_encode(s.notebook.base_url,"notebooks",t.path);i+="?kernel_name="+e,r.location=i},function(e){r.close(),i.modal({title:"Creating Notebook Failed",body:"The error was: "+e.message,buttons:{OK:{"class":"btn-primary"}}})})},r.prototype.lock_switch=function(){console.warn("switching kernel is not guaranteed to work !")},r.prototype.bind_events=function(){var t=this;this.events.on("spec_changed.Kernel",e.proxy(this._spec_changed,this)),this.events.on("spec_not_found.Kernel",e.proxy(this._spec_not_found,this)),this.events.on("kernel_created.Session",function(e,i){t.set_kernel(i.kernel.name)});var i=this.element.find("img.current_kernel_logo");i.on("load",function(){i.show()}),i.on("error",function(){i.hide()})},{KernelSelector:r}}),define("terminal/js/terminado",[],function(){"use strict";function e(e,t,i){var n=new WebSocket(i);Terminal.brokenBold=!0;var r=new Terminal({cols:t.cols,rows:t.rows,screenKeys:!1,useStyle:!1});return n.onopen=function(i){n.send(JSON.stringify(["set_size",t.rows,t.cols,window.innerHeight,window.innerWidth])),r.on("data",function(e){n.send(JSON.stringify(["stdin",e]))}),r.on("title",function(e){document.title=e}),r.open(e),n.onmessage=function(e){var t=JSON.parse(e.data);switch(t[0]){case"stdout":r.write(t[1]);break;case"disconnect":r.write("\r\n\r\n[CLOSED]\r\n")}}},{socket:n,term:r}}return{make_terminal:e}}),function(){function e(){this._events=this._events||{}}function t(){e.call(this)}function i(e){var n=this;if(!(this instanceof i))return new i(arguments[0],arguments[1],arguments[2]);t.call(this),"number"==typeof e&&(e={cols:arguments[0],rows:arguments[1],handler:arguments[2]}),e=e||{},u(d(i.defaults),function(t){null==e[t]&&(e[t]=i.options[t],i[t]!==i.defaults[t]&&(e[t]=i[t])),n[t]=e[t]}),8===e.colors.length?e.colors=e.colors.concat(i._colors.slice(8)):16===e.colors.length?e.colors=e.colors.concat(i._colors.slice(16)):10===e.colors.length?e.colors=e.colors.slice(0,-2).concat(i._colors.slice(8,-2),e.colors.slice(-2)):18===e.colors.length&&(e.colors=e.colors.slice(0,-2).concat(i._colors.slice(16,-2),e.colors.slice(-2))),this.colors=e.colors,this.options=e,this.parent=e.body||e.parent||(p?p.getElementsByTagName("body")[0]:null),this.cols=e.cols||e.geometry[0],this.rows=e.rows||e.geometry[1],this.setRawMode,this.isTTY=!0,this.isRaw=!0,this.columns=this.cols,this.rows=this.rows,e.handler&&this.on("data",e.handler),this.ybase=0,this.ydisp=0,this.x=0,this.y=0,this.cursorState=0,this.cursorHidden=!1,this.convertEol,this.state=0,this.queue="",this.scrollTop=0,this.scrollBottom=this.rows-1,this.applicationKeypad=!1,this.applicationCursor=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!1,this.normal=null,this.prefixMode=!1,this.selectMode=!1,this.visualMode=!1,this.searchMode=!1,this.searchDown,this.entry="",this.entryPrefix="Search: ",this._real,this._selected,this._textarea,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.decLocator,this.x10Mouse,this.vt200Mouse,this.vt300Mouse,this.normalMouse,this.mouseEvents,this.sendFocus,this.utfMouse,this.sgrMouse,this.urxvtMouse,this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.lines=[];for(var r=this.rows;r--;)this.lines.push(this.blankLine());this.tabs,this.setupStops()}function n(e,t,i,n){e.addEventListener(t,i,n||!1)}function r(e,t,i,n){e.removeEventListener(t,i,n||!1)}function s(e){return e.preventDefault&&e.preventDefault(),e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,!1}function o(e,t){function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i}function a(e){var t=e.getElementsByTagName("body")[0],i=e.createElement("div");i.className="terminal";var n=e.createElement("div"),r=e.createElement("span");r.innerHTML="hello world",n.appendChild(r),i.appendChild(n),t.appendChild(i);var s=r.scrollWidth;r.style.fontWeight="bold";var o=r.scrollWidth;return t.removeChild(i),s!==o}function l(e,t){for(var i=e.length;i--;)if(e[i]===t)return i;return-1}function c(e){return"＀">=e?!1:e>="！"&&"ﾾ">=e||e>="ￂ"&&"ￇ">=e||e>="ￊ"&&"ￏ">=e||e>="ￒ"&&"ￗ">=e||e>="ￚ"&&"ￜ">=e||e>="￠"&&"￦">=e||e>="￨"&&"￮">=e}function h(e,t,n){var r=e<<16|t<<8|n;if(null!=h._cache[r])return h._cache[r];for(var s,o,a,l,c,u=1/0,d=-1,p=0;p<i.vcolors.length;p++){if(s=i.vcolors[p],o=s[0],a=s[1],l=s[2],c=h.distance(e,t,n,o,a,l),0===c){d=p;break}u>c&&(u=c,d=p)}return h._cache[r]=d}function u(e,t,i){if(e.forEach)return e.forEach(t,i);for(var n=0;n<e.length;n++)t.call(i,e[n],n,e)}function d(e){if(Object.keys)return Object.keys(e);var t,i=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.push(t);return i}var p=this.document;e.prototype.addListener=function(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)},e.prototype.on=e.prototype.addListener,e.prototype.removeListener=function(e,t){if(this._events[e])for(var i=this._events[e],n=i.length;n--;)if(i[n]===t||i[n].listener===t)return void i.splice(n,1)},e.prototype.off=e.prototype.removeListener,e.prototype.removeAllListeners=function(e){this._events[e]&&delete this._events[e]},e.prototype.once=function(e,t){function i(){var n=Array.prototype.slice.call(arguments);return this.removeListener(e,i),t.apply(this,n)}return i.listener=t,this.on(e,i)},e.prototype.emit=function(e){if(this._events[e])for(var t=Array.prototype.slice.call(arguments,1),i=this._events[e],n=i.length,r=0;n>r;r++)i[r].apply(this,t)},e.prototype.listeners=function(e){return this._events[e]=this._events[e]||[]},o(t,e),t.prototype.pipe=function(e,t){function i(){o.removeListener("data",n),o.removeListener("error",r),o.removeListener("end",s),e.removeListener("error",r),e.removeListener("close",i)}var n,r,s,o=this;return o.on("data",n=function(t){e.write(t)}),o.on("error",r=function(e){if(i(),!this.listeners("error").length)throw e}),o.on("end",s=function(){e.end(),i()}),e.on("error",r),e.on("close",i),e.emit("pipe",o),e};var f=0,m=1,g=2,_=3,v=4,b=5,y=6,x={type:"udk"};o(i,t),i.tangoColors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],i.xtermColors=["#000000","#cd0000","#00cd00","#cdcd00","#0000ee","#cd00cd","#00cdcd","#e5e5e5","#7f7f7f","#ff0000","#00ff00","#ffff00","#5c5cff","#ff00ff","#00ffff","#ffffff"],i.colors=function(){function e(e,i,n){r.push("#"+t(e)+t(i)+t(n))}function t(e){return e=e.toString(16),e.length<2?"0"+e:e}var n,r=i.tangoColors.slice(),s=[0,95,135,175,215,255];for(n=0;216>n;n++)e(s[n/36%6|0],s[n/6%6|0],s[n%6]);for(n=0;24>n;n++)s=8+10*n,e(s,s,s);return r}(),i.colors[256]="#000000",i.colors[257]="#f0f0f0",i._colors=i.colors.slice(),i.vcolors=function(){for(var e,t=[],n=i.colors,r=0;256>r;r++)e=parseInt(n[r].substring(1),16),t.push([e>>16&255,e>>8&255,255&e]);return t}(),i.defaults={colors:i.colors,convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!0,visualBell:!1,popOnBell:!1,scrollback:1e3,screenKeys:!1,debug:!1,useStyle:!1},i.options={},u(d(i.defaults),function(e){i[e]=i.defaults[e],i.options[e]=i.defaults[e]}),i.focus=null,i.prototype.focus=function(){i.focus!==this&&(i.focus&&i.focus.blur(),this.sendFocus&&this.send("[I"),this.showCursor(),i.focus=this)},i.prototype.blur=function(){i.focus===this&&(this.cursorState=0,this.refresh(this.y,this.y),this.sendFocus&&this.send("[O"),i.focus=null)},i.prototype.initGlobal=function(){var e=this.document;i._boundDocs=i._boundDocs||[],~l(i._boundDocs,e)||(i._boundDocs.push(e),i.bindPaste(e),i.bindKeys(e),i.bindCopy(e),this.isMobile&&this.fixMobile(e),this.useStyle&&i.insertStyle(e,this.colors[256],this.colors[257]))},i.bindPaste=function(e){var t=e.defaultView;n(t,"paste",function(e){var t=i.focus;if(t)return e.clipboardData?t.send(e.clipboardData.getData("text/plain")):t.context.clipboardData&&t.send(t.context.clipboardData.getData("Text")),t.element.contentEditable="inherit",s(e)})},i.bindKeys=function(e){n(e,"keydown",function(e){if(i.focus){var t=e.target||e.srcElement;if(t)return t===i.focus.element||t===i.focus.context||t===i.focus.document||t===i.focus.body||t===i._textarea||t===i.focus.parent?i.focus.keyDown(e):void 0}},!0),n(e,"keypress",function(e){if(i.focus){var t=e.target||e.srcElement;if(t)return t===i.focus.element||t===i.focus.context||t===i.focus.document||t===i.focus.body||t===i._textarea||t===i.focus.parent?i.focus.keyPress(e):void 0}},!0),n(e,"mousedown",function(e){if(i.focus){var t=e.target||e.srcElement;if(t){do if(t===i.focus.element)return;while(t=t.parentNode);i.focus.blur()}}})},i.bindCopy=function(e){var t=e.defaultView;n(t,"copy",function(e){var t=i.focus;if(t&&t._selected){var n=t.getCopyTextarea(),r=t.grabText(t._selected.x1,t._selected.x2,t._selected.y1,t._selected.y2);t.emit("copy",r),n.focus(),n.textContent=r,n.value=r,n.setSelectionRange(0,r.length),k(function(){t.element.focus(),t.focus()},1)}})},i.prototype.fixMobile=function(e){var t=this,r=e.createElement("textarea");r.style.position="absolute",r.style.left="-32000px",r.style.top="-32000px",r.style.width="0px",r.style.height="0px",r.style.opacity="0",r.style.backgroundColor="transparent",r.style.borderStyle="none",r.style.outlineStyle="none",r.autocapitalize="none",r.autocorrect="off",e.getElementsByTagName("body")[0].appendChild(r),i._textarea=r,k(function(){r.focus()},1e3),this.isAndroid&&n(r,"change",function(){var e=r.textContent||r.value;r.value="",r.textContent="",t.send(e+"\r")})},i.insertStyle=function(e,t,i){var n=e.getElementById("term-style");if(!n){var r=e.getElementsByTagName("head")[0];if(r){var n=e.createElement("style");n.id="term-style",n.innerHTML=".terminal {\n  float: left;\n  border: "+t+' solid 5px;\n  font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;\n  font-size: 11px;\n  color: '+i+";\n  background: "+t+";\n}\n\n.terminal-cursor {\n  color: "+t+";\n  background: "+i+";\n}\n",r.insertBefore(n,r.firstChild)}}},i.prototype.open=function(e){var t,r=this,s=0;if(this.parent=e||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");for(this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.getElementsByTagName("body")[0],this.context.navigator&&this.context.navigator.userAgent&&(this.isMac=!!~this.context.navigator.userAgent.indexOf("Mac"),this.isIpad=!!~this.context.navigator.userAgent.indexOf("iPad"),this.isIphone=!!~this.context.navigator.userAgent.indexOf("iPhone"),this.isAndroid=!!~this.context.navigator.userAgent.indexOf("Android"),this.isMobile=this.isIpad||this.isIphone||this.isAndroid,this.isMSIE=!!~this.context.navigator.userAgent.indexOf("MSIE")),this.element=this.document.createElement("div"),this.element.className="terminal",this.element.style.outline="none",this.element.setAttribute("tabindex",0),this.element.setAttribute("spellcheck","false"),this.element.style.backgroundColor=this.colors[256],this.element.style.color=this.colors[257],this.children=[];s<this.rows;s++)t=this.document.createElement("div"),this.element.appendChild(t),this.children.push(t);this.parent.appendChild(this.element),this.refresh(0,this.rows-1),"useEvents"in this.options&&!this.options.useEvents||this.initGlobal(),"useFocus"in this.options&&!this.options.useFocus||(this.focus(),this.startBlink(),n(this.element,"focus",function(){r.focus(),r.isMobile&&i._textarea.focus()}),n(this.element,"mousedown",function(){r.focus()}),n(this.element,"mousedown",function(e){var t=null!=e.button?+e.button:null!=e.which?e.which-1:null;r.isMSIE&&(t=1===t?0:4===t?1:t),2===t&&(r.element.contentEditable="true",k(function(){r.element.contentEditable="inherit"},1))},!0)),"useMouse"in this.options&&!this.options.useMouse||this.bindMouse(),"useFocus"in this.options&&!this.options.useFocus||k(function(){r.element.focus()},100),null==i.brokenBold&&(i.brokenBold=a(this.document)),this.emit("open")},i.prototype.setRawMode=function(e){this.isRaw=!!e},i.prototype.bindMouse=function(){function e(e){var t,i;if(t=a(e),i=l(e))switch(o(t,i),e.type){case"mousedown":u=t;break;case"mouseup":u=32;break;case d:}}function t(e){var t,i=u;t=l(e),t&&(i+=32,o(i,t))}function i(e,t){if(h.utfMouse){if(2047===t)return e.push(0);127>t?e.push(t):(t>2047&&(t=2047),e.push(192|t>>6),e.push(128|63&t))}else{if(255===t)return e.push(0);t>127&&(t=127),e.push(t)}}function o(e,t){if(h.vt300Mouse){e&=3,t.x-=32,t.y-=32;var n="[24";if(0===e)n+="1";else if(1===e)n+="3";else if(2===e)n+="5";else{if(3===e)return;n+="0"}return n+="~["+t.x+","+t.y+"]\r",void h.send(n)}if(h.decLocator)return e&=3,t.x-=32,t.y-=32,0===e?e=2:1===e?e=4:2===e?e=6:3===e&&(e=3),void h.send("["+e+";"+(3===e?4:0)+";"+t.y+";"+t.x+";"+(t.page||0)+"&w");if(h.urxvtMouse)return t.x-=32,t.y-=32,t.x++,t.y++,void h.send("["+e+";"+t.x+";"+t.y+"M");if(h.sgrMouse)return t.x-=32,t.y-=32,void h.send("[<"+(3===(3&e)?-4&e:e)+";"+t.x+";"+t.y+(3===(3&e)?"m":"M"));var n=[];i(n,e),i(n,t.x),i(n,t.y),h.send("[M"+w.fromCharCode.apply(w,n))}function a(e){var t,i,n,r,s;switch(e.type){case"mousedown":t=null!=e.button?+e.button:null!=e.which?e.which-1:null,h.isMSIE&&(t=1===t?0:4===t?1:t);break;case"mouseup":t=3;break;case"DOMMouseScroll":t=e.detail<0?64:65;break;case"mousewheel":t=e.wheelDeltaY>0?64:65}return i=e.shiftKey?4:0,n=e.metaKey?8:0,r=e.ctrlKey?16:0,s=i|n|r,h.vt200Mouse?s&=r:h.normalMouse||(s=0),t=32+(s<<2)+t}function l(e){var t,i,n,r,s;if(null!=e.pageX){for(t=e.pageX,i=e.pageY,s=h.element;s&&s!==h.document.documentElement;)t-=s.offsetLeft,i-=s.offsetTop,s="offsetParent"in s?s.offsetParent:s.parentNode;return n=h.element.clientWidth,r=h.element.clientHeight,t=Math.round(t/n*h.cols),i=Math.round(i/r*h.rows),0>t&&(t=0),t>h.cols&&(t=h.cols),0>i&&(i=0),i>h.rows&&(i=h.rows),t+=32,i+=32,{x:t,y:i,type:e.type===d?"mousewheel":e.type}}}var c=this.element,h=this,u=32,d="onmousewheel"in this.context?"mousewheel":"DOMMouseScroll";n(c,"mousedown",function(i){return h.mouseEvents?(e(i),h.focus(),h.normalMouse&&n(h.document,"mousemove",t),h.x10Mouse||n(h.document,"mouseup",function o(i){return e(i),h.normalMouse&&r(h.document,"mousemove",t),r(h.document,"mouseup",o),s(i)}),s(i)):void 0}),n(c,d,function(t){return h.mouseEvents&&!(h.x10Mouse||h.vt300Mouse||h.decLocator)?(e(t),s(t)):void 0}),n(c,d,function(e){return h.mouseEvents||h.applicationKeypad?void 0:("DOMMouseScroll"===e.type?h.scrollDisp(e.detail<0?-5:5):h.scrollDisp(e.wheelDeltaY>0?-5:5),s(e))})},i.prototype.close=i.prototype.destroySoon=i.prototype.destroy=function(){this.destroyed||(this._blink&&(clearInterval(this._blink),delete this._blink),this.readable=!1,this.writable=!1,this.destroyed=!0,this._events={},this.handler=function(){},this.write=function(){},this.end=function(){},this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.emit("end"),this.emit("close"),this.emit("finish"),this.emit("destroy"))},i.prototype.refresh=function(e,t){var n,r,s,o,a,l,h,u,d,p,f,m,g,_;for(t-e>=this.rows/2&&(_=this.element.parentNode,_&&_.removeChild(this.element)),h=this.cols,r=e,t>=this.lines.length&&(this.log("`end` is too large. Most likely a bad CSR."),t=this.lines.length-1);t>=r;r++){for(g=r+this.ydisp,o=this.lines[g],a="",n=r!==this.y||!this.cursorState||this.ydisp!==this.ybase&&!this.selectMode||this.cursorHidden?-1:this.x,d=this.defAttr,s=0;h>s;s++){switch(u=o[s][0],l=o[s][1],s===n&&(u=-1),u!==d&&(d!==this.defAttr&&(a+="</span>"),u!==this.defAttr&&(-1===u?a+='<span class="reverse-video terminal-cursor">':(a+='<span style="',p=511&u,f=u>>9&511,m=u>>18,1&m&&(i.brokenBold||(a+="font-weight:bold;"),8>f&&(f+=8)),2&m&&(a+="text-decoration:underline;"),4&m&&(2&m?(a=a.slice(0,-1),a+=" blink;"):a+="text-decoration:blink;"),8&m&&(p=u>>9&511,f=511&u,1&m&&8>f&&(f+=8)),16&m&&(a+="visibility:hidden;"),256!==p&&(a+="background-color:"+this.colors[p]+";"),257!==f&&(a+="color:"+this.colors[f]+";"),a+='">'))),l){case"&":a+="&amp;";break;case"<":a+="&lt;";break;case">":a+="&gt;";break;default:" ">=l?a+="&nbsp;":(c(l)&&s++,a+=l)}d=u}d!==this.defAttr&&(a+="</span>"),this.children[r].innerHTML=a}_&&_.appendChild(this.element)},i.prototype._cursorBlink=function(){i.focus===this&&(this.cursorState^=1,this.refresh(this.y,this.y))},i.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.y,this.y))},i.prototype.startBlink=function(){if(this.cursorBlink){var e=this;this._blinker=function(){e._cursorBlink()},this._blink=C(this._blinker,500)}},i.prototype.refreshBlink=function(){this.cursorBlink&&this._blink&&(clearInterval(this._blink),this._blink=C(this._blinker,500))},i.prototype.scroll=function(){var e;++this.ybase===this.scrollback&&(this.ybase=this.ybase/2|0,this.lines=this.lines.slice(-(this.ybase+this.rows)+1)),this.ydisp=this.ybase,e=this.ybase+this.rows-1,e-=this.rows-1-this.scrollBottom,e===this.lines.length?this.lines.push(this.blankLine()):this.lines.splice(e,0,this.blankLine()),0!==this.scrollTop&&(0!==this.ybase&&(this.ybase--,this.ydisp=this.ybase),this.lines.splice(this.ybase+this.scrollTop,1)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)},i.prototype.scrollDisp=function(e){this.ydisp+=e,this.ydisp>this.ybase?this.ydisp=this.ybase:this.ydisp<0&&(this.ydisp=0),this.refresh(0,this.rows-1)},i.prototype.write=function(e){var t,n,r,s=e.length,o=0;for(this.refreshStart=this.y,this.refreshEnd=this.y,this.ybase!==this.ydisp&&(this.ydisp=this.ybase,this.maxRange());s>o;o++,this.lch=r)switch(r=e[o],this.state){case f:switch(r){case"":this.bell();break;case"\n":case"\x0B":case"\f":this.convertEol&&(this.x=0),this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll());break;case"\r":this.x=0;break;case"\b":this.x>0&&this.x--;break;case"	":this.x=this.nextStop();break;case"":this.setgLevel(1);break;case"":this.setgLevel(0);break;case"":this.state=m;break;default:if(r>=" "&&(this.charset&&this.charset[r]&&(r=this.charset[r]),this.x>=this.cols&&(this.x=0,this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll())),this.lines[this.y+this.ybase][this.x]=[this.curAttr,r],this.x++,this.updateRange(this.y),c(r))){if(t=this.y+this.ybase,this.cols<2||this.x>=this.cols){this.lines[t][this.x-1]=[this.curAttr," "];break}this.lines[t][this.x]=[this.curAttr," "],this.x++}}break;case m:switch(r){case"[":this.params=[],this.currentParam=0,this.state=g;break;case"]":this.params=[],this.currentParam=0,this.state=_;break;case"P":this.params=[],this.prefix="",this.currentParam="",this.state=b;break;case"_":this.state=y;break;case"^":this.state=y;break;case"c":this.reset();break;case"E":this.x=0;case"D":this.index();break;case"M":this.reverseIndex();break;case"%":this.setgLevel(0),this.setgCharset(0,i.charsets.US),this.state=f,o++;break;case"(":case")":case"*":case"+":case"-":case".":switch(r){case"(":this.gcharset=0;break;case")":this.gcharset=1;break;case"*":this.gcharset=2;break;case"+":this.gcharset=3;break;case"-":this.gcharset=1;break;case".":this.gcharset=2}this.state=v;break;case"/":this.gcharset=3,this.state=v,o--;break;case"N":break;case"O":break;case"n":this.setgLevel(2);break;case"o":this.setgLevel(3);break;case"|":this.setgLevel(3);break;case"}":this.setgLevel(2);break;case"~":this.setgLevel(1);break;case"7":this.saveCursor(),this.state=f;break;case"8":this.restoreCursor(),this.state=f;break;case"#":this.state=f,o++;break;case"H":this.tabSet();break;case"=":this.log("Serial port requested application keypad."),this.applicationKeypad=!0,this.state=f;break;case">":this.log("Switching back to normal keypad."),this.applicationKeypad=!1,this.state=f;break;default:this.state=f,this.error("Unknown ESC control: %s.",r)}break;case v:switch(r){case"0":n=i.charsets.SCLD;break;case"A":n=i.charsets.UK;break;case"B":n=i.charsets.US;break;case"4":n=i.charsets.Dutch;break;case"C":case"5":n=i.charsets.Finnish;break;case"R":n=i.charsets.French;break;case"Q":n=i.charsets.FrenchCanadian;break;case"K":n=i.charsets.German;break;case"Y":n=i.charsets.Italian;break;case"E":case"6":n=i.charsets.NorwegianDanish;break;case"Z":n=i.charsets.Spanish;break;case"H":case"7":n=i.charsets.Swedish;break;case"=":n=i.charsets.Swiss;break;case"/":n=i.charsets.ISOLatin,o++;break;default:n=i.charsets.US}this.setgCharset(this.gcharset,n),this.gcharset=null,this.state=f;break;case _:if(""===this.lch&&"\\"===r||""===r){switch(""===this.lch&&("string"==typeof this.currentParam?this.currentParam=this.currentParam.slice(0,-1):"number"==typeof this.currentParam&&(this.currentParam=(this.currentParam-("".charCodeAt(0)-48))/10)),this.params.push(this.currentParam),this.params[0]){case 0:case 1:case 2:this.params[1]&&(this.title=this.params[1],this.handleTitle(this.title));break;case 3:break;case 4:case 5:break;
case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:break;case 46:break;case 50:break;case 51:break;case 52:break;case 104:case 105:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:}this.params=[],this.currentParam=0,this.state=f}else this.params.length?this.currentParam+=r:r>="0"&&"9">=r?this.currentParam=10*this.currentParam+r.charCodeAt(0)-48:";"===r&&(this.params.push(this.currentParam),this.currentParam="");break;case g:if("?"===r||">"===r||"!"===r){this.prefix=r;break}if(r>="0"&&"9">=r){this.currentParam=10*this.currentParam+r.charCodeAt(0)-48;break}if("$"===r||'"'===r||" "===r||"'"===r){this.postfix=r;break}if(this.params.push(this.currentParam),this.currentParam=0,";"===r)break;switch(this.state=f,r){case"A":this.cursorUp(this.params);break;case"B":this.cursorDown(this.params);break;case"C":this.cursorForward(this.params);break;case"D":this.cursorBackward(this.params);break;case"H":this.cursorPos(this.params);break;case"J":this.eraseInDisplay(this.params);break;case"K":this.eraseInLine(this.params);break;case"m":this.prefix||this.charAttributes(this.params);break;case"n":this.prefix||this.deviceStatus(this.params);break;case"@":this.insertChars(this.params);break;case"E":this.cursorNextLine(this.params);break;case"F":this.cursorPrecedingLine(this.params);break;case"G":this.cursorCharAbsolute(this.params);break;case"L":this.insertLines(this.params);break;case"M":this.deleteLines(this.params);break;case"P":this.deleteChars(this.params);break;case"X":this.eraseChars(this.params);break;case"`":this.charPosAbsolute(this.params);break;case"a":this.HPositionRelative(this.params);break;case"c":this.sendDeviceAttributes(this.params);break;case"d":this.linePosAbsolute(this.params);break;case"e":this.VPositionRelative(this.params);break;case"f":this.HVPosition(this.params);break;case"h":this.setMode(this.params);break;case"l":this.resetMode(this.params);break;case"r":this.setScrollRegion(this.params);break;case"s":this.saveCursor(this.params);break;case"u":this.restoreCursor(this.params);break;case"I":this.cursorForwardTab(this.params);break;case"S":this.scrollUp(this.params);break;case"T":this.params.length<2&&!this.prefix&&this.scrollDown(this.params);break;case"Z":this.cursorBackwardTab(this.params);break;case"b":this.repeatPrecedingCharacter(this.params);break;case"g":this.tabClear(this.params);break;case"p":switch(this.prefix){case"!":this.softReset(this.params)}break;default:this.error("Unknown CSI code: %s.",r)}this.prefix="",this.postfix="";break;case b:if(""===this.lch&&"\\"===r||""===r){if("tmux;"===this.prefix&&""===r){this.currentParam+=r;continue}""===this.lch&&("string"==typeof this.currentParam?this.currentParam=this.currentParam.slice(0,-1):"number"==typeof this.currentParam&&(this.currentParam=(this.currentParam-("".charCodeAt(0)-48))/10)),this.params.push(this.currentParam);var a=this.params[this.params.length-1];switch(this.prefix){case x:this.emit("udk",{clearAll:0===this.params[0],eraseBelow:1===this.params[0],lockKeys:0===this.params[1],dontLockKeys:1===this.params[1],keyList:(this.params[2]+"").split(";").map(function(e){return e=e.split("/"),{keyCode:e[0],hexKeyValue:e[1]}})});break;case"$q":var l=0;switch(a){case'"q':a='0"q',l=1;break;case'"p':a='61;0"p',l=1;break;case"r":a=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r",l=1;break;case"m":l=0;break;default:this.error("Unknown DCS Pt: %s.",a),l=0}this.send("P"+l+"$r"+a+"\\");break;case"+p":this.emit("set terminfo",{name:this.params[0]});break;case"+q":var l=!1;this.send("P"+ +l+"+r"+a+"\\");break;case"tmux;":this.emit("passthrough",a);break;default:this.error("Unknown DCS prefix: %s.",a)}this.currentParam=0,this.prefix="",this.state=f}else this.currentParam+=r,this.prefix||(/^\d*;\d*\|/.test(this.currentParam)?(this.prefix=x,this.params=this.currentParam.split(/[;|]/).map(function(e){return e.length?+e:0}).slice(0,-1),this.currentParam=""):(/^[$+][a-zA-Z]/.test(this.currentParam)||/^\w+;\x1b/.test(this.currentParam))&&(this.prefix=this.currentParam,this.currentParam=""));break;case y:(""===this.lch&&"\\"===r||""===r)&&(this.state=f)}return this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd),!0},i.prototype.writeln=function(e){return this.write(e+"\r\n")},i.prototype.end=function(e){var t=!0;return e&&(t=this.write(e)),this.destroySoon(),t},i.prototype.resume=function(){},i.prototype.pause=function(){},i.prototype.keyDown=function(e){var t,i=this;switch(e.keyCode){case 8:if(e.altKey){t="";break}if(e.shiftKey){t="\b";break}t="";break;case 9:if(e.shiftKey){t="[Z";break}t="	";break;case 13:t="\r";break;case 27:t="";break;case 37:if(this.applicationCursor){t="OD";break}if(e.ctrlKey){t="[5D";break}t="[D";break;case 39:if(this.applicationCursor){t="OC";break}if(e.ctrlKey){t="[5C";break}t="[C";break;case 38:if(this.applicationCursor){t="OA";break}if(e.ctrlKey)return this.scrollDisp(-1),s(e);t="[A";break;case 40:if(this.applicationCursor){t="OB";break}if(e.ctrlKey)return this.scrollDisp(1),s(e);t="[B";break;case 46:t="[3~";break;case 45:t="[2~";break;case 36:if(this.applicationKeypad){t="OH";break}t="OH";break;case 35:if(this.applicationKeypad){t="OF";break}t="OF";break;case 33:if(e.shiftKey)return this.scrollDisp(-(this.rows-1)),s(e);t="[5~";break;case 34:if(e.shiftKey)return this.scrollDisp(this.rows-1),s(e);t="[6~";break;case 112:t="OP";break;case 113:t="OQ";break;case 114:t="OR";break;case 115:t="OS";break;case 116:t="[15~";break;case 117:t="[17~";break;case 118:t="[18~";break;case 119:t="[19~";break;case 120:t="[20~";break;case 121:t="[21~";break;case 122:t="[23~";break;case 123:t="[24~";break;default:if(e.ctrlKey)if(e.keyCode>=65&&e.keyCode<=90){if(this.screenKeys&&!this.prefixMode&&!this.selectMode&&65===e.keyCode)return this.enterPrefix(),s(e);if(this.prefixMode&&86===e.keyCode)return void this.leavePrefix();if((this.prefixMode||this.selectMode)&&67===e.keyCode)return void(this.visualMode&&k(function(){i.leaveVisual()},1));t=w.fromCharCode(e.keyCode-64)}else 32===e.keyCode?t=w.fromCharCode(0):e.keyCode>=51&&e.keyCode<=55?t=w.fromCharCode(e.keyCode-51+27):56===e.keyCode?t=w.fromCharCode(127):219===e.keyCode?t=w.fromCharCode(27):221===e.keyCode&&(t=w.fromCharCode(29));else e.altKey&&(e.keyCode>=65&&e.keyCode<=90?t=""+w.fromCharCode(e.keyCode+32):192===e.keyCode?t="`":e.keyCode>=48&&e.keyCode<=57&&(t=""+(e.keyCode-48)))}return t?this.prefixMode?(this.leavePrefix(),s(e)):this.selectMode?(this.keySelect(e,t),s(e)):(this.emit("keydown",e),this.emit("key",t,e),this.showCursor(),this.handler(t),s(e)):!0},i.prototype.setgLevel=function(e){this.glevel=e,this.charset=this.charsets[e]},i.prototype.setgCharset=function(e,t){this.charsets[e]=t,this.glevel===e&&(this.charset=t)},i.prototype.keyPress=function(e){var t;if(s(e),e.charCode)t=e.charCode;else if(null==e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!t||e.ctrlKey||e.altKey||e.metaKey?!1:(t=w.fromCharCode(t),this.prefixMode?(this.leavePrefix(),this.keyPrefix(e,t),!1):this.selectMode?(this.keySelect(e,t),!1):(this.emit("keypress",t,e),this.emit("key",t,e),this.showCursor(),this.handler(t),!1))},i.prototype.send=function(e){var t=this;this.queue||k(function(){t.handler(t.queue),t.queue=""},1),this.queue+=e},i.prototype.bell=function(){if(this.emit("bell"),this.visualBell){var e=this;this.element.style.borderColor="white",k(function(){e.element.style.borderColor=""},10),this.popOnBell&&this.focus()}},i.prototype.log=function(){if(this.debug&&this.context.console&&this.context.console.log){var e=Array.prototype.slice.call(arguments);this.context.console.log.apply(this.context.console,e)}},i.prototype.error=function(){if(this.debug&&this.context.console&&this.context.console.error){var e=Array.prototype.slice.call(arguments);this.context.console.error.apply(this.context.console,e)}},i.prototype.resize=function(e,t){var i,n,r,s,o;if(1>e&&(e=1),1>t&&(t=1),s=this.cols,e>s)for(o=[this.defAttr," "],r=this.lines.length;r--;)for(;this.lines[r].length<e;)this.lines[r].push(o);else if(s>e)for(r=this.lines.length;r--;)for(;this.lines[r].length>e;)this.lines[r].pop();if(this.setupStops(s),this.cols=e,this.columns=e,s=this.rows,t>s)for(n=this.element;s++<t;)this.lines.length<t+this.ybase&&this.lines.push(this.blankLine()),this.children.length<t&&(i=this.document.createElement("div"),n.appendChild(i),this.children.push(i));else if(s>t)for(;s-- >t;)if(this.lines.length>t+this.ybase&&this.lines.pop(),this.children.length>t){if(n=this.children.pop(),!n)continue;n.parentNode.removeChild(n)}this.rows=t,this.y>=t&&(this.y=t-1),this.x>=e&&(this.x=e-1),this.scrollTop=0,this.scrollBottom=t-1,this.refresh(0,this.rows-1),this.normal=null,this.emit("resize")},i.prototype.updateRange=function(e){e<this.refreshStart&&(this.refreshStart=e),e>this.refreshEnd&&(this.refreshEnd=e)},i.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},i.prototype.setupStops=function(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this.cols;e+=8)this.tabs[e]=!0},i.prototype.prevStop=function(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this.cols?this.cols-1:0>e?0:e},i.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this.cols;);return e>=this.cols?this.cols-1:0>e?0:e},i.prototype.eraseAttr=function(){return-512&this.defAttr|511&this.curAttr},i.prototype.eraseRight=function(e,t){for(var i=this.lines[this.ybase+t],n=[this.eraseAttr()," "];e<this.cols;e++)i[e]=n;this.updateRange(t)},i.prototype.eraseLeft=function(e,t){var i=this.lines[this.ybase+t],n=[this.eraseAttr()," "];for(e++;e--;)i[e]=n;this.updateRange(t)},i.prototype.eraseLine=function(e){this.eraseRight(0,e)},i.prototype.blankLine=function(e){for(var t=e?this.eraseAttr():this.defAttr,i=[t," "],n=[],r=0;r<this.cols;r++)n[r]=i;return n},i.prototype.ch=function(e){return e?[this.eraseAttr()," "]:[this.defAttr," "]},i.prototype.is=function(e){var t=this.termName;return 0===(t+"").indexOf(e)},i.prototype.handler=function(e){this.emit("data",e)},i.prototype.handleTitle=function(e){this.emit("title",e)},i.prototype.index=function(){this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll()),this.state=f},i.prototype.reverseIndex=function(){var e;this.y--,this.y<this.scrollTop&&(this.y++,this.lines.splice(this.y+this.ybase,0,this.blankLine(!0)),e=this.rows-1-this.scrollBottom,this.lines.splice(this.rows-1+this.ybase-e+1,1),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)),this.state=f},i.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols,i.call(this,this.options),this.refresh(0,this.rows-1)},i.prototype.tabSet=function(){this.tabs[this.x]=!0,this.state=f},i.prototype.cursorUp=function(e){var t=e[0];1>t&&(t=1),this.y-=t,this.y<0&&(this.y=0)},i.prototype.cursorDown=function(e){var t=e[0];1>t&&(t=1),this.y+=t,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.cursorForward=function(e){var t=e[0];1>t&&(t=1),this.x+=t,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.cursorBackward=function(e){var t=e[0];1>t&&(t=1),this.x-=t,this.x<0&&(this.x=0)},i.prototype.cursorPos=function(e){var t,i;t=e[0]-1,i=e.length>=2?e[1]-1:0,0>t?t=0:t>=this.rows&&(t=this.rows-1),0>i?i=0:i>=this.cols&&(i=this.cols-1),this.x=i,this.y=t},i.prototype.eraseInDisplay=function(e){var t;switch(e[0]){case 0:for(this.eraseRight(this.x,this.y),t=this.y+1;t<this.rows;t++)this.eraseLine(t);break;case 1:for(this.eraseLeft(this.x,this.y),t=this.y;t--;)this.eraseLine(t);break;case 2:for(t=this.rows;t--;)this.eraseLine(t);break;case 3:}},i.prototype.eraseInLine=function(e){switch(e[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y)}},i.prototype.charAttributes=function(e){if(1===e.length&&0===e[0])return void(this.curAttr=this.defAttr);for(var t,i=e.length,n=0,r=this.curAttr>>18,s=this.curAttr>>9&511,o=511&this.curAttr;i>n;n++)t=e[n],t>=30&&37>=t?s=t-30:t>=40&&47>=t?o=t-40:t>=90&&97>=t?(t+=8,s=t-90):t>=100&&107>=t?(t+=8,o=t-100):0===t?(r=this.defAttr>>18,s=this.defAttr>>9&511,o=511&this.defAttr):1===t?r|=1:4===t?r|=2:5===t?r|=4:7===t?r|=8:8===t?r|=16:22===t?r&=-2:24===t?r&=-3:25===t?r&=-5:27===t?r&=-9:28===t?r&=-17:39===t?s=this.defAttr>>9&511:49===t?o=511&this.defAttr:38===t?2===e[n+1]?(n+=2,s=h(255&e[n],255&e[n+1],255&e[n+2]),-1===s&&(s=511),n+=2):5===e[n+1]&&(n+=2,t=255&e[n],s=t):48===t?2===e[n+1]?(n+=2,o=h(255&e[n],255&e[n+1],255&e[n+2]),-1===o&&(o=511),n+=2):5===e[n+1]&&(n+=2,t=255&e[n],o=t):100===t?(s=this.defAttr>>9&511,o=511&this.defAttr):this.error("Unknown SGR attribute: %d.",t);this.curAttr=r<<18|s<<9|o},i.prototype.deviceStatus=function(e){if(this.prefix){if("?"===this.prefix)switch(e[0]){case 6:this.send("[?"+(this.y+1)+";"+(this.x+1)+"R");break;case 15:break;case 25:break;case 26:break;case 53:}}else switch(e[0]){case 5:this.send("[0n");break;case 6:this.send("["+(this.y+1)+";"+(this.x+1)+"R")}},i.prototype.insertChars=function(e){var t,i,n,r;for(t=e[0],1>t&&(t=1),i=this.y+this.ybase,n=this.x,r=[this.eraseAttr()," "];t--&&n<this.cols;)this.lines[i].splice(n++,0,r),this.lines[i].pop()},i.prototype.cursorNextLine=function(e){var t=e[0];1>t&&(t=1),this.y+=t,this.y>=this.rows&&(this.y=this.rows-1),this.x=0},i.prototype.cursorPrecedingLine=function(e){var t=e[0];1>t&&(t=1),this.y-=t,this.y<0&&(this.y=0),this.x=0},i.prototype.cursorCharAbsolute=function(e){var t=e[0];1>t&&(t=1),this.x=t-1},i.prototype.insertLines=function(e){var t,i,n;for(t=e[0],1>t&&(t=1),i=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n+1;t--;)this.lines.splice(i,0,this.blankLine(!0)),this.lines.splice(n,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},i.prototype.deleteLines=function(e){var t,i,n;for(t=e[0],1>t&&(t=1),i=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n;t--;)this.lines.splice(n+1,0,this.blankLine(!0)),this.lines.splice(i,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},i.prototype.deleteChars=function(e){var t,i,n;for(t=e[0],1>t&&(t=1),i=this.y+this.ybase,n=[this.eraseAttr()," "];t--;)this.lines[i].splice(this.x,1),this.lines[i].push(n)},i.prototype.eraseChars=function(e){var t,i,n,r;for(t=e[0],1>t&&(t=1),i=this.y+this.ybase,n=this.x,r=[this.eraseAttr()," "];t--&&n<this.cols;)this.lines[i][n++]=r},i.prototype.charPosAbsolute=function(e){var t=e[0];1>t&&(t=1),this.x=t-1,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.HPositionRelative=function(e){var t=e[0];1>t&&(t=1),this.x+=t,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.sendDeviceAttributes=function(e){e[0]>0||(this.prefix?">"===this.prefix&&(this.is("xterm")?this.send("[>0;276;0c"):this.is("rxvt-unicode")?this.send("[>85;95;0c"):this.is("linux")?this.send(e[0]+"c"):this.is("screen")&&this.send("[>83;40003;0c")):this.is("xterm")||this.is("rxvt-unicode")||this.is("screen")?this.send("[?1;2c"):this.is("linux")&&this.send("[?6c"))},i.prototype.linePosAbsolute=function(e){var t=e[0];1>t&&(t=1),this.y=t-1,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.VPositionRelative=function(e){var t=e[0];1>t&&(t=1),this.y+=t,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.HVPosition=function(e){e[0]<1&&(e[0]=1),e[1]<1&&(e[1]=1),this.y=e[0]-1,this.y>=this.rows&&(this.y=this.rows-1),this.x=e[1]-1,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.setMode=function(e){if("object"!=typeof e)if(this.prefix){if("?"===this.prefix)switch(e){case 1:this.applicationCursor=!0;break;case 2:this.setgCharset(0,i.charsets.US),this.setgCharset(1,i.charsets.US),this.setgCharset(2,i.charsets.US),this.setgCharset(3,i.charsets.US);break;case 3:this.savedCols=this.cols,this.resize(132,this.rows);break;case 6:this.originMode=!0;break;case 7:this.wraparoundMode=!0;break;case 12:break;case 66:this.log("Serial port requested application keypad."),this.applicationKeypad=!0;break;case 9:case 1e3:case 1002:case 1003:this.x10Mouse=9===e,this.vt200Mouse=1e3===e,this.normalMouse=e>1e3,this.mouseEvents=!0,this.element.style.cursor="default",this.log("Binding to mouse events.");break;case 1004:this.sendFocus=!0;break;case 1005:this.utfMouse=!0;break;case 1006:this.sgrMouse=!0;break;case 1015:this.urxvtMouse=!0;break;case 25:this.cursorHidden=!1;break;case 1049:case 47:case 1047:if(!this.normal){var t={lines:this.lines,ybase:this.ybase,ydisp:this.ydisp,x:this.x,y:this.y,scrollTop:this.scrollTop,scrollBottom:this.scrollBottom,tabs:this.tabs};this.reset(),this.normal=t,this.showCursor()}}}else switch(e){case 4:this.insertMode=!0;break;case 20:}else for(var n=e.length,r=0;n>r;r++)this.setMode(e[r])},i.prototype.resetMode=function(e){if("object"!=typeof e)if(this.prefix){if("?"===this.prefix)switch(e){case 1:this.applicationCursor=!1;break;case 3:132===this.cols&&this.savedCols&&this.resize(this.savedCols,this.rows),delete this.savedCols;break;case 6:this.originMode=!1;break;case 7:this.wraparoundMode=!1;break;case 12:break;case 66:this.log("Switching back to normal keypad."),this.applicationKeypad=!1;break;case 9:case 1e3:case 1002:case 1003:this.x10Mouse=!1,this.vt200Mouse=!1,this.normalMouse=!1,this.mouseEvents=!1,this.element.style.cursor="";break;case 1004:this.sendFocus=!1;break;case 1005:this.utfMouse=!1;break;case 1006:this.sgrMouse=!1;break;case 1015:this.urxvtMouse=!1;break;case 25:this.cursorHidden=!0;break;case 1049:case 47:case 1047:this.normal&&(this.lines=this.normal.lines,this.ybase=this.normal.ybase,this.ydisp=this.normal.ydisp,this.x=this.normal.x,this.y=this.normal.y,this.scrollTop=this.normal.scrollTop,this.scrollBottom=this.normal.scrollBottom,this.tabs=this.normal.tabs,this.normal=null,this.refresh(0,this.rows-1),this.showCursor())}}else switch(e){case 4:this.insertMode=!1;break;case 20:}else for(var t=e.length,i=0;t>i;i++)this.resetMode(e[i])},i.prototype.setScrollRegion=function(e){this.prefix||(this.scrollTop=(e[0]||1)-1,this.scrollBottom=(e[1]||this.rows)-1,this.x=0,this.y=0)},i.prototype.saveCursor=function(e){this.savedX=this.x,this.savedY=this.y},i.prototype.restoreCursor=function(e){this.x=this.savedX||0,this.y=this.savedY||0},i.prototype.cursorForwardTab=function(e){for(var t=e[0]||1;t--;)this.x=this.nextStop()},i.prototype.scrollUp=function(e){for(var t=e[0]||1;t--;)this.lines.splice(this.ybase+this.scrollTop,1),this.lines.splice(this.ybase+this.scrollBottom,0,this.blankLine());this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)},i.prototype.scrollDown=function(e){for(var t=e[0]||1;t--;)this.lines.splice(this.ybase+this.scrollBottom,1),this.lines.splice(this.ybase+this.scrollTop,0,this.blankLine());this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)},i.prototype.initMouseTracking=function(e){},i.prototype.resetTitleModes=function(e){},i.prototype.cursorBackwardTab=function(e){for(var t=e[0]||1;t--;)this.x=this.prevStop()},i.prototype.repeatPrecedingCharacter=function(e){for(var t=e[0]||1,i=this.lines[this.ybase+this.y],n=i[this.x-1]||[this.defAttr," "];t--;)i[this.x++]=n},i.prototype.tabClear=function(e){var t=e[0];0>=t?delete this.tabs[this.x]:3===t&&(this.tabs={})},i.prototype.mediaCopy=function(e){},i.prototype.setResources=function(e){},i.prototype.disableModifiers=function(e){},i.prototype.setPointerMode=function(e){},i.prototype.softReset=function(e){this.cursorHidden=!1,this.insertMode=!1,this.originMode=!1,this.wraparoundMode=!1,this.applicationKeypad=!1,this.applicationCursor=!1,this.scrollTop=0,this.scrollBottom=this.rows-1,this.curAttr=this.defAttr,this.x=this.y=0,this.charset=null,this.glevel=0,this.charsets=[null]},i.prototype.requestAnsiMode=function(e){},i.prototype.requestPrivateMode=function(e){},i.prototype.setConformanceLevel=function(e){},i.prototype.loadLEDs=function(e){},i.prototype.setCursorStyle=function(e){},i.prototype.setCharProtectionAttr=function(e){},i.prototype.restorePrivateValues=function(e){},i.prototype.setAttrInRectangle=function(e){for(var t,i,n=e[0],r=e[1],s=e[2],o=e[3],a=e[4];s+1>n;n++)for(t=this.lines[this.ybase+n],i=r;o>i;i++)t[i]=[a,t[i][1]];this.updateRange(e[0]),this.updateRange(e[2])},i.prototype.savePrivateValues=function(e){},i.prototype.manipulateWindow=function(e){},i.prototype.reverseAttrInRectangle=function(e){},i.prototype.setTitleModeFeature=function(e){},i.prototype.setWarningBellVolume=function(e){},i.prototype.setMarginBellVolume=function(e){},i.prototype.copyRectangle=function(e){},i.prototype.enableFilterRectangle=function(e){},i.prototype.requestParameters=function(e){},i.prototype.selectChangeExtent=function(e){},i.prototype.fillRectangle=function(e){for(var t,i,n=e[0],r=e[1],s=e[2],o=e[3],a=e[4];o+1>r;r++)for(t=this.lines[this.ybase+r],i=s;a>i;i++)t[i]=[t[i][0],w.fromCharCode(n)];this.updateRange(e[1]),this.updateRange(e[3])},i.prototype.enableLocatorReporting=function(e){e[0]>0},i.prototype.eraseRectangle=function(e){var t,i,n,r=e[0],s=e[1],o=e[2],a=e[3];for(n=[this.eraseAttr()," "];o+1>r;r++)for(t=this.lines[this.ybase+r],i=s;a>i;i++)t[i]=n;this.updateRange(e[0]),this.updateRange(e[2])},i.prototype.setLocatorEvents=function(e){},i.prototype.selectiveEraseRectangle=function(e){},i.prototype.requestLocatorPosition=function(e){},i.prototype.insertColumns=function(){for(var e,t=params[0],i=this.ybase+this.rows,n=[this.eraseAttr()," "];t--;)for(e=this.ybase;i>e;e++)this.lines[e].splice(this.x+1,0,n),this.lines[e].pop();this.maxRange()},i.prototype.deleteColumns=function(){for(var e,t=params[0],i=this.ybase+this.rows,n=[this.eraseAttr()," "];t--;)for(e=this.ybase;i>e;e++)this.lines[e].splice(this.x,1),this.lines[e].push(n);this.maxRange()},i.prototype.enterPrefix=function(){this.prefixMode=!0},i.prototype.leavePrefix=function(){this.prefixMode=!1},i.prototype.enterSelect=function(){this._real={x:this.x,y:this.y,ydisp:this.ydisp,ybase:this.ybase,cursorHidden:this.cursorHidden,lines:this.copyBuffer(this.lines),write:this.write},this.write=function(){},this.selectMode=!0,this.visualMode=!1,this.cursorHidden=!1,this.refresh(this.y,this.y)},i.prototype.leaveSelect=function(){this.x=this._real.x,this.y=this._real.y,this.ydisp=this._real.ydisp,this.ybase=this._real.ybase,this.cursorHidden=this._real.cursorHidden,this.lines=this._real.lines,this.write=this._real.write,delete this._real,this.selectMode=!1,this.visualMode=!1,this.refresh(0,this.rows-1)},i.prototype.enterVisual=function(){this._real.preVisual=this.copyBuffer(this.lines),this.selectText(this.x,this.x,this.ydisp+this.y,this.ydisp+this.y),this.visualMode=!0},i.prototype.leaveVisual=function(){this.lines=this._real.preVisual,delete this._real.preVisual,delete this._selected,this.visualMode=!1,this.refresh(0,this.rows-1)},i.prototype.enterSearch=function(e){this.entry="",this.searchMode=!0,this.searchDown=e,this._real.preSearch=this.copyBuffer(this.lines),this._real.preSearchX=this.x,this._real.preSearchY=this.y;for(var t=this.ydisp+this.rows-1,i=0;i<this.entryPrefix.length;i++)this.lines[t][i]=[-512&this.defAttr|4,this.entryPrefix[i]];this.y=this.rows-1,this.x=this.entryPrefix.length,this.refresh(this.rows-1,this.rows-1)},i.prototype.leaveSearch=function(){this.searchMode=!1,this._real.preSearch&&(this.lines=this._real.preSearch,this.x=this._real.preSearchX,this.y=this._real.preSearchY,delete this._real.preSearch,delete this._real.preSearchX,delete this._real.preSearchY),this.refresh(this.rows-1,this.rows-1)},i.prototype.copyBuffer=function(e){for(var e=e||this.lines,t=[],i=0;i<e.length;i++){t[i]=[];for(var n=0;n<e[i].length;n++)t[i][n]=[e[i][n][0],e[i][n][1]]}return t},i.prototype.getCopyTextarea=function(e){var t=this._copyTextarea,i=this.document;return t||(t=i.createElement("textarea"),t.style.position="absolute",t.style.left="-32000px",t.style.top="-32000px",t.style.width="0px",t.style.height="0px",t.style.opacity="0",t.style.backgroundColor="transparent",t.style.borderStyle="none",t.style.outlineStyle="none",i.getElementsByTagName("body")[0].appendChild(t),this._copyTextarea=t),t},i.prototype.copyText=function(e){var t=this,i=this.getCopyTextarea();this.emit("copy",e),i.focus(),i.textContent=e,i.value=e,i.setSelectionRange(0,e.length),k(function(){t.element.focus(),t.focus()},1)},i.prototype.selectText=function(e,t,i,n){var r,s,o,a,l,c,h,u,d;if(this._selected){for(r=this._selected.x1,s=this._selected.x2,o=this._selected.y1,a=this._selected.y2,o>a&&(l=s,s=r,r=l,l=a,a=o,o=l),r>s&&o===a&&(l=s,s=r,r=l),h=o;a>=h;h++)for(c=0,u=this.cols-1,h===o&&(c=r),h===a&&(u=s);u>=c;c++)null!=this.lines[h][c].old&&(d=this.lines[h][c].old,delete this.lines[h][c].old,this.lines[h][c]=[d,this.lines[h][c][1]]);i=this._selected.y1,e=this._selected.x1}for(i=Math.max(i,0),i=Math.min(i,this.ydisp+this.rows-1),n=Math.max(n,0),n=Math.min(n,this.ydisp+this.rows-1),this._selected={x1:e,x2:t,y1:i,y2:n},i>n&&(l=t,t=e,e=l,l=n,n=i,i=l),e>t&&i===n&&(l=t,t=e,e=l),h=i;n>=h;h++)for(c=0,u=this.cols-1,h===i&&(c=e),h===n&&(u=t);u>=c;c++)d=this.lines[h][c][0],this.lines[h][c]=[-512&d|261636,this.lines[h][c][1]],this.lines[h][c].old=d;i-=this.ydisp,n-=this.ydisp,i=Math.max(i,0),i=Math.min(i,this.rows-1),n=Math.max(n,0),n=Math.min(n,this.rows-1),this.refresh(0,this.rows-1)},i.prototype.grabText=function(e,t,i,n){var r,s,o,a,l,h="",u="";for(i>n&&(l=t,t=e,e=l,l=n,n=i,i=l),e>t&&i===n&&(l=t,t=e,e=l),o=i;n>=o;o++){for(s=0,a=this.cols-1,o===i&&(s=e),o===n&&(a=t);a>=s;s++)r=this.lines[o][s][1]," "!==r?(u&&(h+=u,u=""),h+=r,c(r)&&s++):u+=r;u="",h+="\n"}for(s=t,o=n;s<this.cols;s++)if(" "!==this.lines[o][s][1]){h=h.slice(0,-1);break}return h},i.prototype.keyPrefix=function(e,t){"k"===t||"&"===t?this.destroy():"p"===t||"]"===t?this.emit("request paste"):"c"===t?this.emit("request create"):t>="0"&&"9">=t?(t=+t-1,~t||(t=9),this.emit("request term",t)):"n"===t?this.emit("request term next"):"P"===t?this.emit("request term previous"):":"===t?this.emit("request command mode"):"["===t&&this.enterSelect()},i.prototype.keySelect=function(e,t){if(this.showCursor(),this.searchMode||"n"===t||"N"===t)return this.keySearch(e,t);if(""===t){var i=this.ydisp+this.y;return this.ydisp===this.ybase?(this.y=Math.min(this.y+(this.rows-1)/2|0,this.rows-1),this.refresh(0,this.rows-1)):this.scrollDisp((this.rows-1)/2|0),void(this.visualMode&&this.selectText(this.x,this.x,i,this.ydisp+this.y))}if(""===t){var i=this.ydisp+this.y;return 0===this.ydisp?(this.y=Math.max(this.y-(this.rows-1)/2|0,0),this.refresh(0,this.rows-1)):this.scrollDisp(-(this.rows-1)/2|0),void(this.visualMode&&this.selectText(this.x,this.x,i,this.ydisp+this.y))}if(""===t){var i=this.ydisp+this.y;return this.scrollDisp(this.rows-1),void(this.visualMode&&this.selectText(this.x,this.x,i,this.ydisp+this.y))}if(""===t){var i=this.ydisp+this.y;return this.scrollDisp(-(this.rows-1)),void(this.visualMode&&this.selectText(this.x,this.x,i,this.ydisp+this.y))}if("k"===t||"[A"===t){var i=this.ydisp+this.y;return this.y--,this.y<0&&(this.y=0,this.scrollDisp(-1)),void(this.visualMode?this.selectText(this.x,this.x,i,this.ydisp+this.y):this.refresh(this.y,this.y+1))}if("j"===t||"[B"===t){var i=this.ydisp+this.y;return this.y++,this.y>=this.rows&&(this.y=this.rows-1,this.scrollDisp(1)),void(this.visualMode?this.selectText(this.x,this.x,i,this.ydisp+this.y):this.refresh(this.y-1,this.y))}if("h"===t||"[D"===t){var n=this.x;return this.x--,this.x<0&&(this.x=0),void(this.visualMode?this.selectText(n,this.x,this.ydisp+this.y,this.ydisp+this.y):this.refresh(this.y,this.y))}if("l"===t||"[C"===t){var n=this.x;return this.x++,this.x>=this.cols&&(this.x=this.cols-1),void(this.visualMode?this.selectText(n,this.x,this.ydisp+this.y,this.ydisp+this.y):this.refresh(this.y,this.y))}if("v"===t||" "===t)return void(this.visualMode?this.leaveVisual():this.enterVisual());if("y"!==t){if("q"===t||""===t)return void(this.visualMode?this.leaveVisual():this.leaveSelect());if("w"===t||"W"===t){for(var r=this.x,s=this.y,o=this.ydisp,n=this.x,i=this.y,a=this.ydisp,l=!1;;){for(var c=this.lines[a+i];n<this.cols;){if(c[n][1]<=" ")l=!0;else if(l)break;n++}if(n>=this.cols&&(n=this.cols-1),!(n===this.cols-1&&c[n][1]<=" "))break;if(n=0,++i>=this.rows&&(i--,++a>this.ybase)){a=this.ybase,n=this.x;break}}return this.x=n,this.y=i,this.scrollDisp(-this.ydisp+a),void(this.visualMode&&this.selectText(r,this.x,s+o,this.ydisp+this.y))}if("b"===t||"B"===t){for(var r=this.x,s=this.y,o=this.ydisp,n=this.x,i=this.y,a=this.ydisp;;){for(var c=this.lines[a+i],l=n>0&&c[n][1]>" "&&c[n-1][1]>" ";n>=0;){if(c[n][1]<=" "){if(l&&n+1<this.cols&&c[n+1][1]>" "){n++;break}l=!0}n--}if(0>n&&(n=0),0!==n||!(c[n][1]<=" ")&&l)break;if(n=this.cols-1,--i<0&&(i++,--a<0)){a++,n=0;break}}return this.x=n,this.y=i,this.scrollDisp(-this.ydisp+a),void(this.visualMode&&this.selectText(r,this.x,s+o,this.ydisp+this.y))}if("e"===t||"E"===t){var n=this.x+1,i=this.y,a=this.ydisp;for(n>=this.cols&&n--;;){for(var c=this.lines[a+i];n<this.cols&&c[n][1]<=" ";)n++;for(;n<this.cols;){if(c[n][1]<=" "&&n-1>=0&&c[n-1][1]>" "){n--;break}n++}if(n>=this.cols&&(n=this.cols-1),!(n===this.cols-1&&c[n][1]<=" "))break;if(n=0,++i>=this.rows&&(i--,++a>this.ybase)){a=this.ybase;break}}return this.x=n,this.y=i,this.scrollDisp(-this.ydisp+a),void(this.visualMode&&this.selectText(r,this.x,s+o,this.ydisp+this.y))}if("^"===t||"0"===t){var r=this.x;if("0"===t)this.x=0;else if("^"===t){for(var c=this.lines[this.ydisp+this.y],n=0;n<this.cols&&!(c[n][1]>" ");)n++;n>=this.cols&&(n=this.cols-1),this.x=n}return void(this.visualMode?this.selectText(r,this.x,this.ydisp+this.y,this.ydisp+this.y):this.refresh(this.y,this.y))}if("$"===t){for(var r=this.x,c=this.lines[this.ydisp+this.y],n=this.cols-1;n>=0;){if(c[n][1]>" "){this.visualMode&&n<this.cols-1&&n++;break}n--}return 0>n&&(n=0),this.x=n,void(this.visualMode?this.selectText(r,this.x,this.ydisp+this.y,this.ydisp+this.y):this.refresh(this.y,this.y))}if("g"===t||"G"===t){var r=this.x,s=this.y,o=this.ydisp;return"g"===t?(this.x=0,this.y=0,this.scrollDisp(-this.ydisp)):"G"===t&&(this.x=0,this.y=this.rows-1,this.scrollDisp(this.ybase)),void(this.visualMode&&this.selectText(r,this.x,s+o,this.ydisp+this.y))}if("H"===t||"M"===t||"L"===t){var r=this.x,s=this.y;return"H"===t?(this.x=0,this.y=0):"M"===t?(this.x=0,this.y=this.rows/2|0):"L"===t&&(this.x=0,this.y=this.rows-1),void(this.visualMode?this.selectText(r,this.x,this.ydisp+s,this.ydisp+this.y):(this.refresh(s,s),this.refresh(this.y,this.y)))}if("{"===t||"}"===t){var c,h,r=this.x,s=this.y,o=this.ydisp,u=!1,d=!1,p=-1,i=this.y+("{"===t?-1:1),a=this.ydisp;for("{"===t?0>i&&(i++,a>0&&a--):"}"===t&&i>=this.rows&&(i--,a<this.ybase&&a++);;){for(c=this.lines[a+i],h=0;h<this.cols;h++){if(c[h][1]>" "){-1===p&&(p=0),u=!0;break}if(h===this.cols-1){-1===p?p=1:0===p?d=!0:1===p&&u&&(d=!0);break}}if(d)break;if("{"===t){if(i--,0>i){if(i++,!(a>0))break;a--}}else if("}"===t&&(i++,i>=this.rows)){if(i--,!(a<this.ybase))break;a++}}return d||("{"===t?(i=0,a=0):"}"===t&&(i=this.rows-1,a=this.ybase)),this.x=0,this.y=i,this.scrollDisp(-this.ydisp+a),void(this.visualMode&&this.selectText(r,this.x,s+o,this.ydisp+this.y))}return"/"===t||"?"===t?void(this.visualMode||this.enterSearch("/"===t)):!1}if(this.visualMode){var f=this.grabText(this._selected.x1,this._selected.x2,this._selected.y1,this._selected.y2);this.copyText(f),this.leaveVisual()}},i.prototype.keySearch=function(e,t){if(""===t)return void this.leaveSearch();if("\r"===t||!this.searchMode&&("n"===t||"N"===t)){this.leaveSearch();var i=this.entry;if(!i)return void this.refresh(0,this.rows-1);for(var n,r,s,o=this.x,a=this.y,l=this.ydisp,c=!1,h=!1,u=this.x+1,d=this.ydisp+this.y,p="N"===t?this.searchDown:!this.searchDown;;){for(n=this.lines[d];u<this.cols;){for(s=0;s<i.length&&!(u+s>=this.cols)&&n[u+s][1]===i[s];s++)if(n[u+s][1]===i[s]&&s===i.length-1){c=!0;break}if(c)break;u+=s+1}if(c)break;if(u=0,p){if(d--,0>d){if(h)break;h=!0,d=this.ybase+this.rows-1}}else if(d++,d>this.ybase+this.rows-1){if(h)break;h=!0,d=0}}return c?(d-this.ybase<0?(r=d,d=0,r>this.ybase&&(d=r-this.ybase,r=this.ybase)):(r=this.ybase,d-=this.ybase),this.x=u,this.y=d,this.scrollDisp(-this.ydisp+r),
void(this.visualMode&&this.selectText(o,this.x,a+l,this.ydisp+this.y))):void this.refresh(0,this.rows-1)}if("\b"===t||""===t){if(0===this.entry.length)return;var f=this.ydisp+this.rows-1;this.entry=this.entry.slice(0,-1);var s=this.entryPrefix.length+this.entry.length;return this.lines[f][s]=[this.lines[f][s][0]," "],this.x--,this.refresh(this.rows-1,this.rows-1),void this.refresh(this.y,this.y)}if(1===t.length&&t>=" "&&"~">=t){var f=this.ydisp+this.rows-1;this.entry+=t;var s=this.entryPrefix.length+this.entry.length-1;return this.lines[f][s]=[-512&this.defAttr|4,t],this.x++,this.refresh(this.rows-1,this.rows-1),void this.refresh(this.y,this.y)}return!1},i.charsets={},i.charsets.SCLD={"`":"◆",a:"▒",b:"	",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"␤",i:"\x0B",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},i.charsets.UK=null,i.charsets.US=null,i.charsets.Dutch=null,i.charsets.Finnish=null,i.charsets.French=null,i.charsets.FrenchCanadian=null,i.charsets.German=null,i.charsets.Italian=null,i.charsets.NorwegianDanish=null,i.charsets.Spanish=null,i.charsets.Swedish=null,i.charsets.Swiss=null,i.charsets.ISOLatin=null;var w=this.String,k=this.setTimeout,C=this.setInterval;h._cache={},h.distance=function(e,t,i,n,r,s){return Math.pow(30*(e-n),2)+Math.pow(59*(t-r),2)+Math.pow(11*(i-s),2)},i.EventEmitter=e,i.Stream=t,i.inherits=o,i.on=n,i.off=r,i.cancel=s,"undefined"!=typeof module?module.exports=i:this.Terminal=i}.call(function(){return this||("undefined"!=typeof window?window:global)}()),define("components/term.js/src/term",function(){}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/ruby/ruby",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},i=0,n=e.length;n>i;++i)t[e[i]]=!0;return t}function i(e,t,i){return i.tokenize.push(e),e(t,i)}function n(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var n,r=e.next();if("`"==r||"'"==r||'"'==r)return i(o(r,"string",'"'==r||"`"==r),e,t);if("/"==r){var s=e.current().length;if(e.skipTo("/")){var h=e.current().length;e.backUp(e.current().length-s);for(var u=0;e.current().length<h;){var d=e.next();if("("==d?u+=1:")"==d&&(u-=1),0>u)break}if(e.backUp(e.current().length-s),0==u)return i(o(r,"string-2",!0),e,t)}return"operator"}if("%"==r){var f="string",m=!0;e.eat("s")?f="atom":e.eat(/[WQ]/)?f="string":e.eat(/[r]/)?f="string-2":e.eat(/[wxq]/)&&(f="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),i(o(g,f,m,!0),e,t)):"operator"}if("#"==r)return e.skipToEnd(),"comment";if("<"==r&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return i(a(n[1]),e,t);if("0"==r)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number";if(/\d/.test(r))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==r){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==r)return e.eat("'")?i(o("'","atom",!1),e,t):e.eat('"')?i(o('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==r&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==r)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(r))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=r||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(r))return c=r,null;if("-"==r&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(r)){var _=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=r||_||(c="."),"operator"}return null}return c="|",null}function r(e){return e||(e=1),function(t,i){if("}"==t.peek()){if(1==e)return i.tokenize.pop(),i.tokenize[i.tokenize.length-1](t,i);i.tokenize[i.tokenize.length-1]=r(e-1)}else"{"==t.peek()&&(i.tokenize[i.tokenize.length-1]=r(e+1));return n(t,i)}}function s(){var e=!1;return function(t,i){return e?(i.tokenize.pop(),i.tokenize[i.tokenize.length-1](t,i)):(e=!0,n(t,i))}}function o(e,t,i,n){return function(o,a){var l,c=!1;for("read-quoted-paused"===a.context.type&&(a.context=a.context.prev,o.eat("}"));null!=(l=o.next());){if(l==e&&(n||!c)){a.tokenize.pop();break}if(i&&"#"==l&&!c){if(o.eat("{")){"}"==e&&(a.context={prev:a.context,type:"read-quoted-paused"}),a.tokenize.push(r());break}if(/[@\$]/.test(o.peek())){a.tokenize.push(s());break}}c=!c&&"\\"==l}return t}}function a(e){return function(t,i){return t.match(e)?i.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,h=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),u=t(["def","class","case","for","while","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){c=null,e.sol()&&(t.indented=e.indentation());var i,n=t.tokenize[t.tokenize.length-1](e,t),r=c;if("ident"==n){var s=e.current();n="."==t.lastTok?"property":h.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(s)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(r=s,u.propertyIsEnumerable(s)?i="indent":d.propertyIsEnumerable(s)?i="dedent":"if"!=s&&"unless"!=s||e.column()!=e.indentation()?"do"==s&&t.context.indented<t.indented&&(i="indent"):i="indent")}return(c||n&&"comment"!=n)&&(t.lastTok=r),"|"==c&&(t.varList=!t.varList),"indent"==i||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||n,indented:t.indented}:("dedent"==i||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==n),n},indent:function(t,i){if(t.tokenize[t.tokenize.length-1]!=n)return 0;var r=i&&i.charAt(0),s=t.context,o=s.type==p[r]||"keyword"==s.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(i);return s.indented+(o?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricChars:"}de",lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/css/css",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=!0;return t}function i(e,t){for(var i,n=!1;null!=(i=e.next());){if(n&&"/"==i){t.tokenize=null;break}n="*"==i}return["comment","comment"]}e.defineMode("css",function(t,i){function n(e,t){return p=t,e}function r(e,t){var i=e.next();if(g[i]){var r=g[i](e,t);if(r!==!1)return r}return"@"==i?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==i||("~"==i||"|"==i)&&e.eat("=")?n(null,"compare"):'"'==i||"'"==i?(t.tokenize=s(i),t.tokenize(e,t)):"#"==i?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==i?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(i)||"."==i&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==i?/[,+>*\/]/.test(i)?n(null,"select-op"):"."==i&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(i)?n(null,i):"u"==i&&e.match(/rl(-prefix)?\(/)||"d"==i&&e.match("omain(")||"r"==i&&e.match("egexp(")?(e.backUp(1),t.tokenize=o,n("property","word")):/[\w\\\-]/.test(i)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function s(e){return function(t,i){for(var r,s=!1;null!=(r=t.next());){if(r==e&&!s){")"==e&&t.backUp(1);break}s=!s&&"\\"==r}return(r==e||!s&&")"!=e)&&(i.tokenize=null),n("string","string")}}function o(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=s(")"),n(null,"(")}function a(e,t,i){this.type=e,this.indent=t,this.prev=i}function l(e,t,i){return e.context=new a(i,t.indentation()+m,e.context),i}function c(e){return e.context=e.context.prev,e.context.type}function h(e,t,i){return M[i.context.type](e,t,i)}function u(e,t,i,n){for(var r=n||1;r>0;r--)i.context=i.context.prev;return h(e,t,i)}function d(e){var t=e.current().toLowerCase();f=T.hasOwnProperty(t)?"atom":C.hasOwnProperty(t)?"keyword":"variable"}i.propertyKeywords||(i=e.resolveMode("text/css"));var p,f,m=t.indentUnit,g=i.tokenHooks,_=i.documentTypes||{},v=i.mediaTypes||{},b=i.mediaFeatures||{},y=i.propertyKeywords||{},x=i.nonStandardPropertyKeywords||{},w=i.fontProperties||{},k=i.counterDescriptors||{},C=i.colorKeywords||{},T=i.valueKeywords||{},S=i.allowNested,M={};return M.top=function(e,t,i){if("{"==e)return l(i,t,"block");if("}"==e&&i.context.prev)return c(i);if(/@(media|supports|(-moz-)?document)/.test(e))return l(i,t,"atBlock");if(/@(font-face|counter-style)/.test(e))return i.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(i,t,"at");if("hash"==e)f="builtin";else if("word"==e)f="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(i,t,"interpolation");if(":"==e)return"pseudo";if(S&&"("==e)return l(i,t,"parens")}return i.context.type},M.block=function(e,t,i){if("word"==e){var n=t.current().toLowerCase();return y.hasOwnProperty(n)?(f="property","maybeprop"):x.hasOwnProperty(n)?(f="string-2","maybeprop"):S?(f=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(f+=" error","maybeprop")}return"meta"==e?"block":S||"hash"!=e&&"qualifier"!=e?M.top(e,t,i):(f="error","block")},M.maybeprop=function(e,t,i){return":"==e?l(i,t,"prop"):h(e,t,i)},M.prop=function(e,t,i){if(";"==e)return c(i);if("{"==e&&S)return l(i,t,"propBlock");if("}"==e||"{"==e)return u(e,t,i);if("("==e)return l(i,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return l(i,t,"interpolation")}else f+=" error";return"prop"},M.propBlock=function(e,t,i){return"}"==e?c(i):"word"==e?(f="property","maybeprop"):i.context.type},M.parens=function(e,t,i){return"{"==e||"}"==e?u(e,t,i):")"==e?c(i):"("==e?l(i,t,"parens"):"interpolation"==e?l(i,t,"interpolation"):("word"==e&&d(t),"parens")},M.pseudo=function(e,t,i){return"word"==e?(f="variable-3",i.context.type):h(e,t,i)},M.atBlock=function(e,t,i){if("("==e)return l(i,t,"atBlock_parens");if("}"==e)return u(e,t,i);if("{"==e)return c(i)&&l(i,t,S?"block":"top");if("word"==e){var n=t.current().toLowerCase();f="only"==n||"not"==n||"and"==n||"or"==n?"keyword":_.hasOwnProperty(n)?"tag":v.hasOwnProperty(n)?"attribute":b.hasOwnProperty(n)?"property":y.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"string-2":T.hasOwnProperty(n)?"atom":C.hasOwnProperty(n)?"keyword":"error"}return i.context.type},M.atBlock_parens=function(e,t,i){return")"==e?c(i):"{"==e||"}"==e?u(e,t,i,2):M.atBlock(e,t,i)},M.restricted_atBlock_before=function(e,t,i){return"{"==e?l(i,t,"restricted_atBlock"):"word"==e&&"@counter-style"==i.stateArg?(f="variable","restricted_atBlock_before"):h(e,t,i)},M.restricted_atBlock=function(e,t,i){return"}"==e?(i.stateArg=null,c(i)):"word"==e?(f="@font-face"==i.stateArg&&!w.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==i.stateArg&&!k.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},M.keyframes=function(e,t,i){return"word"==e?(f="variable","keyframes"):"{"==e?l(i,t,"top"):h(e,t,i)},M.at=function(e,t,i){return";"==e?c(i):"{"==e||"}"==e?u(e,t,i):("word"==e?f="tag":"hash"==e&&(f="builtin"),"at")},M.interpolation=function(e,t,i){return"}"==e?c(i):"{"==e||";"==e?u(e,t,i):("word"==e?f="variable":"variable"!=e&&"("!=e&&")"!=e&&(f="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new a("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var i=(t.tokenize||r)(e,t);return i&&"object"==typeof i&&(p=i[1],i=i[0]),f=i,t.state=M[t.state](p,e,t),f},indent:function(e,t){var i=e.context,n=t&&t.charAt(0),r=i.indent;return"prop"!=i.type||"}"!=n&&")"!=n||(i=i.prev),!i.prev||("}"!=n||"block"!=i.type&&"top"!=i.type&&"interpolation"!=i.type&&"restricted_atBlock"!=i.type)&&(")"!=n||"parens"!=i.type&&"atBlock_parens"!=i.type)&&("{"!=n||"at"!=i.type&&"atBlock"!=i.type)||(r=i.indent-m,i=i.prev),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],r=t(n),s=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(s),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],l=t(a),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],h=t(c),u=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],d=t(u),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],f=t(p),m=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],g=t(m),_=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],v=t(_),b=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],y=t(b),x=n.concat(s).concat(a).concat(c).concat(u).concat(_).concat(b);e.registerHelper("hintWords","css",x),e.defineMIME("text/css",{documentTypes:r,mediaTypes:o,mediaFeatures:l,propertyKeywords:h,nonStandardPropertyKeywords:d,fontProperties:f,counterDescriptors:g,colorKeywords:v,valueKeywords:y,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=i,i(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,propertyKeywords:h,nonStandardPropertyKeywords:d,colorKeywords:v,valueKeywords:y,fontProperties:f,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=i,i(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,propertyKeywords:h,nonStandardPropertyKeywords:d,colorKeywords:v,valueKeywords:y,fontProperties:f,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=i,i(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/coffeescript/coffeescript",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function i(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var i=t.scope.offset;if(e.eatSpace()){var n=e.indentation();return n>i&&"coffee"==t.scope.type?"indent":i>n?"dedent":null}i>0&&a(e,t)}if(e.eatSpace())return null;var o=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=s,t.tokenize(e,t);if("#"===o)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(v))return t.tokenize=r(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=r(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(h)||e.match(f)?"operator":e.match(u)?"punctuation":e.match(x)?"atom":e.match(_)?"keyword":e.match(d)?"variable":e.match(p)?"property":(e.next(),c)}function r(e,i,r){return function(s,o){for(;!s.eol();)if(s.eatWhile(/[^'"\/\\]/),s.eat("\\")){if(s.next(),i&&s.eol())return r}else{if(s.match(e))return o.tokenize=n,r;s.eat(/['"\/]/)}return i&&(t.singleLineStringErrors?r=c:o.tokenize=n),r}}function s(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function o(t,i,n){n=n||"coffee";for(var r=0,s=!1,o=null,a=i.scope;a;a=a.prev)if("coffee"===a.type||"}"==a.type){r=a.offset+e.indentUnit;break}"coffee"!==n?(s=null,o=t.column()+t.current().length):i.scope.align&&(i.scope.align=!1),i.scope={offset:r,type:n,prev:i.scope,align:s,alignOffset:o}}function a(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var i=e.indentation(),n=!1,r=t.scope;r;r=r.prev)if(i===r.offset){
n=!0;break}if(!n)return!0;for(;t.scope.prev&&t.scope.offset!==i;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var i=t.tokenize(e,t),n=e.current();if("."===n)return i=t.tokenize(e,t),n=e.current(),/^\.[\w$]+$/.test(n)?"variable":c;"return"===n&&(t.dedent=!0),("->"!==n&&"=>"!==n||t.lambda||e.peek())&&"indent"!==i||o(e,t);var r="[({".indexOf(n);if(-1!==r&&o(e,t,"])}".slice(r,r+1)),m.exec(n)&&o(e,t),"then"==n&&a(e,t),"dedent"===i&&a(e,t))return c;if(r="])}".indexOf(n),-1!==r){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==n&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),i}var c="error",h=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,u=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,d=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/,f=i(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],_=i(m.concat(g));m=i(m);var v=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,y=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],x=i(y),w={startState:function(e){return{tokenize:n,scope:{offset:e||0,type:"coffee",prev:null,align:!1},lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var i=null===t.scope.align&&t.scope;i&&e.sol()&&(i.align=!1);var n=l(e,t);return i&&n&&"comment"!=n&&(i.align=!0),t.lastToken={style:n,content:e.current()},e.eol()&&e.lambda&&(t.lambda=!1),n},indent:function(e,t){if(e.tokenize!=n)return 0;var i=e.scope,r=t&&"])}".indexOf(t.charAt(0))>-1;if(r)for(;"coffee"==i.type&&i.prev;)i=i.prev;var s=r&&i.type===t.charAt(0);return i.align?i.alignOffset-(s?1:0):(s?i.prev:i).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/addon/mode/simple",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+"in simple mode")}function i(e,t){if(!e)return/(?:)/;var i="";return e instanceof RegExp?(e.ignoreCase&&(i="i"),e=e.source):e=String(e),new RegExp((t===!1?"":"^")+"(?:"+e+")",i)}function n(e){if(!e)return null;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],i=0;i<e.length;i++)t.push(e[i]&&e[i].replace(/\./g," "));return t}function r(e,r){(e.next||e.push)&&t(r,e.next||e.push),this.regex=i(e.regex),this.token=n(e.token),this.data=e}function s(e,t){return function(i,n){if(n.pending){var r=n.pending.shift();return 0==n.pending.length&&(n.pending=null),i.pos+=r.text.length,r.token}if(n.local){if(n.local.end&&i.match(n.local.end)){var s=n.local.endToken||null;return n.local=n.localState=null,s}var o,s=n.local.mode.token(i,n.localState);return n.local.endScan&&(o=n.local.endScan.exec(i.current()))&&(i.pos=i.start+o.index),s}for(var l=e[n.state],c=0;c<l.length;c++){var h=l[c],u=(!h.data.sol||i.sol())&&i.match(h.regex);if(u){if(h.data.next?n.state=h.data.next:h.data.push?((n.stack||(n.stack=[])).push(n.state),n.state=h.data.push):h.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),h.data.mode&&a(t,n,h.data.mode,h.token),h.data.indent&&n.indent.push(i.indentation()+t.indentUnit),h.data.dedent&&n.indent.pop(),u.length>2){n.pending=[];for(var d=2;d<u.length;d++)u[d]&&n.pending.push({text:u[d],token:h.token[d-1]});return i.backUp(u[0].length-(u[1]?u[1].length:0)),h.token[0]}return h.token&&h.token.join?h.token[0]:h.token}}return i.next(),null}}function o(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var i=0;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n)||!o(e[n],t[n]))return!1;i++}for(var n in t)t.hasOwnProperty(n)&&i--;return 0==i}function a(t,n,r,s){var a;if(r.persistent)for(var l=n.persistentStates;l&&!a;l=l.next)(r.spec?o(r.spec,l.spec):r.mode==l.mode)&&(a=l);var c=a?a.mode:r.mode||e.getMode(t,r.spec),h=a?a.state:e.startState(c);r.persistent&&!a&&(n.persistentStates={mode:c,spec:r.spec,state:h,next:n.persistentStates}),n.localState=h,n.local={mode:c,end:r.end&&i(r.end),endScan:r.end&&r.forceEnd!==!1&&i(r.end,!1),endToken:s&&s.join?s[s.length-1]:s}}function l(e,t){for(var i=0;i<t.length;i++)if(t[i]===e)return!0}function c(t,i){return function(n,r,s){if(n.local&&n.local.mode.indent)return n.local.mode.indent(n.localState,r,s);if(null==n.indent||n.local||i.dontIndentStates&&l(n.state,i.dontIndentStates)>-1)return e.Pass;var o=n.indent.length-1,a=t[n.state];e:for(;;){for(var c=0;c<a.length;c++){var h=a[c];if(h.data.dedent&&h.data.dedentIfLineStart!==!1){var u=h.regex.exec(r);if(u&&u[0]){o--,(h.next||h.push)&&(a=t[h.next||h.push]),r=r.slice(u[0].length);continue e}}}break}return 0>o?0:n.indent[o]}}e.defineSimpleMode=function(t,i){e.defineMode(t,function(t){return e.simpleMode(t,i)})},e.simpleMode=function(i,n){t(n,"start");var o={},a=n.meta||{},l=!1;for(var h in n)if(h!=a&&n.hasOwnProperty(h))for(var u=o[h]=[],d=n[h],p=0;p<d.length;p++){var f=d[p];u.push(new r(f,n)),(f.indent||f.dedent)&&(l=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:l?[]:null}},copyState:function(t){var i={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(i.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(i.stack=t.stack.slice(0));for(var n=t.persistentStates;n;n=n.next)i.persistentStates={mode:n.mode,spec:n.spec,state:n.state==t.localState?i.localState:e.copyState(n.mode,n.state),next:i.persistentStates};return i},token:s(o,i),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(o,a)};if(a)for(var g in a)a.hasOwnProperty(g)&&(m[g]=a[g]);return m}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define("codemirror/mode/dockerfile/dockerfile",["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],i="("+t.join("|")+")",n=new RegExp(i+"\\s*$","i"),r=new RegExp(i+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:n,token:"variable-2"},{regex:r,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}]}),e.defineMIME("text/x-dockerfile","dockerfile")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/go/go",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("go",function(e){function t(e,t){var r=e.next();if('"'==r||"'"==r||"`"==r)return t.tokenize=i(r),t.tokenize(e,t);if(/[\d\.]/.test(r))return"."==r?e.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==r?e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^0[0-7]+/):e.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(r))return a=r,null;if("/"==r){if(e.eat("*"))return t.tokenize=n,n(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(u.test(r))return e.eatWhile(u),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var s=e.current();return c.propertyIsEnumerable(s)?(("case"==s||"default"==s)&&(a="case"),"keyword"):h.propertyIsEnumerable(s)?"atom":"variable"}function i(e){return function(i,n){for(var r,s=!1,o=!1;null!=(r=i.next());){if(r==e&&!s){o=!0;break}s=!s&&"\\"==r}return(o||!s&&"`"!=e)&&(n.tokenize=t),"string"}}function n(e,i){for(var n,r=!1;n=e.next();){if("/"==n&&r){i.tokenize=t;break}r="*"==n}return"comment"}function r(e,t,i,n,r){this.indented=e,this.column=t,this.type=i,this.align=n,this.prev=r}function s(e,t,i){return e.context=new r(e.indented,t,i,null,e.context)}function o(e){if(e.context.prev){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}}var a,l=e.indentUnit,c={"break":!0,"case":!0,chan:!0,"const":!0,"continue":!0,"default":!0,defer:!0,"else":!0,fallthrough:!0,"for":!0,func:!0,go:!0,"goto":!0,"if":!0,"import":!0,"interface":!0,map:!0,"package":!0,range:!0,"return":!0,select:!0,struct:!0,"switch":!0,type:!0,"var":!0,bool:!0,"byte":!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,"int":!0,uint:!0,uintptr:!0},h={"true":!0,"false":!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,imag:!0,len:!0,make:!0,"new":!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},u=/[+\-*&^%:=<>!|\/]/;return{startState:function(e){return{tokenize:null,context:new r((e||0)-l,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,i){var n=i.context;if(e.sol()&&(null==n.align&&(n.align=!1),i.indented=e.indentation(),i.startOfLine=!0,"case"==n.type&&(n.type="}")),e.eatSpace())return null;a=null;var r=(i.tokenize||t)(e,i);return"comment"==r?r:(null==n.align&&(n.align=!0),"{"==a?s(i,e.column(),"}"):"["==a?s(i,e.column(),"]"):"("==a?s(i,e.column(),")"):"case"==a?n.type="case":"}"==a&&"}"==n.type?n=o(i):a==n.type&&o(i),i.startOfLine=!1,r)},indent:function(e,i){if(e.tokenize!=t&&null!=e.tokenize)return 0;var n=e.context,r=i&&i.charAt(0);if("case"==n.type&&/^(?:case|default)\b/.test(i))return e.context.type="}",n.indented;var s=r==n.type;return n.align?n.column+(s?0:1):n.indented+(s?0:l)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),e.defineMIME("text/x-go","go")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/javascript/javascript",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,i){function n(e){for(var t,i=!1,n=!1;null!=(t=e.next());){if(!i){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}i=!i&&"\\"==t}}function r(e,t,i){return _e=e,ve=i,t}function s(e,t){var i=e.next();if('"'==i||"'"==i)return t.tokenize=o(i),t.tokenize(e,t);if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return r("number","number");if("."==i&&e.match(".."))return r("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return r(i);if("="==i&&e.eat(">"))return r("=>","operator");if("0"==i&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),r("number","number");if(/\d/.test(i))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),r("number","number");if("/"==i)return e.eat("*")?(t.tokenize=a,a(e,t)):e.eat("/")?(e.skipToEnd(),r("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),r("regexp","string-2")):(e.eatWhile(Se),r("operator","operator",e.current()));if("`"==i)return t.tokenize=l,l(e,t);if("#"==i)return e.skipToEnd(),r("error","error");if(Se.test(i))return e.eatWhile(Se),r("operator","operator",e.current());if(Ce.test(i)){e.eatWhile(Ce);var s=e.current(),c=Te.propertyIsEnumerable(s)&&Te[s];return c&&"."!=t.lastType?r(c.type,c.style,s):r("variable","variable",s)}}function o(e){return function(t,i){var n,o=!1;if(xe&&"@"==t.peek()&&t.match(Me))return i.tokenize=s,r("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||o);)o=!o&&"\\"==n;return o||(i.tokenize=s),r("string","string")}}function a(e,t){for(var i,n=!1;i=e.next();){if("/"==i&&n){t.tokenize=s;break}n="*"==i}return r("comment","comment")}function l(e,t){for(var i,n=!1;null!=(i=e.next());){if(!n&&("`"==i||"$"==i&&e.eat("{"))){t.tokenize=s;break}n=!n&&"\\"==i}return r("quasi","string-2",e.current())}function c(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var i=e.string.indexOf("=>",e.start);if(!(0>i)){for(var n=0,r=!1,s=i-1;s>=0;--s){var o=e.string.charAt(s),a=De.indexOf(o);if(a>=0&&3>a){if(!n){++s;break}if(0==--n)break}else if(a>=3&&6>a)++n;else if(Ce.test(o))r=!0;else{if(/["'\/]/.test(o))return;if(r&&!n){++s;break}}}r&&!n&&(t.fatArrowAt=s)}}function h(e,t,i,n,r,s){this.indented=e,this.column=t,this.type=i,this.prev=r,this.info=s,null!=n&&(this.align=n)}function u(e,t){for(var i=e.localVars;i;i=i.next)if(i.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var i=n.vars;i;i=i.next)if(i.name==t)return!0}function d(e,t,i,n,r){var s=e.cc;for(Le.state=e,Le.stream=r,Le.marked=null,Le.cc=s,Le.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var o=s.length?s.pop():we?w:x;if(o(i,n)){for(;s.length&&s[s.length-1].lex;)s.pop()();return Le.marked?Le.marked:"variable"==i&&u(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)Le.cc.push(arguments[e])}function f(){return p.apply(null,arguments),!0}function m(e){function t(t){for(var i=t;i;i=i.next)if(i.name==e)return!0;return!1}var n=Le.state;if(n.context){if(Le.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;i.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){Le.state.context={prev:Le.state.context,vars:Le.state.localVars},Le.state.localVars=Pe}function _(){Le.state.localVars=Le.state.context.vars,Le.state.context=Le.state.context.prev}function v(e,t){var i=function(){var i=Le.state,n=i.indented;if("stat"==i.lexical.type)n=i.lexical.indented;else for(var r=i.lexical;r&&")"==r.type&&r.align;r=r.prev)n=r.indented;i.lexical=new h(n,Le.stream.column(),e,null,i.lexical,t)};return i.lex=!0,i}function b(){var e=Le.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function y(e){function t(i){return i==e?f():";"==e?p():f(t)}return t}function x(e,t){return"var"==e?f(v("vardef",t.length),B,y(";"),b):"keyword a"==e?f(v("form"),w,x,b):"keyword b"==e?f(v("form"),x,b):"{"==e?f(v("}"),R,b):";"==e?f():"if"==e?("else"==Le.state.lexical.info&&Le.state.cc[Le.state.cc.length-1]==b&&Le.state.cc.pop()(),f(v("form"),w,x,b,V)):"function"==e?f(te):"for"==e?f(v("form"),J,x,b):"variable"==e?f(v("stat"),I):"switch"==e?f(v("form"),w,v("}","switch"),y("{"),R,b,b):"case"==e?f(w,y(":")):"default"==e?f(y(":")):"catch"==e?f(v("form"),g,y("("),ie,y(")"),x,b,_):"module"==e?f(v("form"),g,ae,_,b):"class"==e?f(v("form"),ne,b):"export"==e?f(v("form"),le,b):"import"==e?f(v("form"),ce,b):p(v("stat"),w,y(";"),b)}function w(e){return C(e,!1)}function k(e){return C(e,!0)}function C(e,t){if(Le.state.fatArrowAt==Le.stream.start){var i=t?A:P;if("("==e)return f(g,v(")"),$(U,")"),b,y("=>"),i,_);if("variable"==e)return p(g,U,y("=>"),i,_)}var n=t?D:M;return Ee.hasOwnProperty(e)?f(n):"function"==e?f(te,n):"keyword c"==e?f(t?S:T):"("==e?f(v(")"),T,me,y(")"),b,n):"operator"==e||"spread"==e?f(t?k:w):"["==e?f(v("]"),pe,b,n):"{"==e?H(j,"}",null,n):"quasi"==e?p(E,n):f()}function T(e){return e.match(/[;\}\)\],]/)?p():p(w)}function S(e){return e.match(/[;\}\)\],]/)?p():p(k)}function M(e,t){return","==e?f(w):D(e,t,!1)}function D(e,t,i){var n=0==i?M:D,r=0==i?w:k;return"=>"==e?f(g,i?A:P,_):"operator"==e?/\+\+|--/.test(t)?f(n):"?"==t?f(w,y(":"),r):f(r):"quasi"==e?p(E,n):";"!=e?"("==e?H(k,")","call",n):"."==e?f(O,n):"["==e?f(v("]"),T,y("]"),b,n):void 0:void 0}function E(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?f(E):f(w,L)}function L(e){return"}"==e?(Le.marked="string-2",Le.state.tokenize=l,f(E)):void 0}function P(e){return c(Le.stream,Le.state),p("{"==e?x:w)}function A(e){return c(Le.stream,Le.state),p("{"==e?x:k)}function I(e){return":"==e?f(b,x):p(M,y(";"),b)}function O(e){return"variable"==e?(Le.marked="property",f()):void 0}function j(e,t){return"variable"==e||"keyword"==Le.style?(Le.marked="property",f("get"==t||"set"==t?z:N)):"number"==e||"string"==e?(Le.marked=xe?"property":Le.style+" property",f(N)):"jsonld-keyword"==e?f(N):"["==e?f(w,y("]"),N):void 0}function z(e){return"variable"!=e?p(N):(Le.marked="property",f(te))}function N(e){return":"==e?f(k):"("==e?p(te):void 0}function $(e,t){function i(n){if(","==n){var r=Le.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),f(e,i)}return n==t?f():f(y(t))}return function(n){return n==t?f():p(e,i)}}function H(e,t,i){for(var n=3;n<arguments.length;n++)Le.cc.push(arguments[n]);return f(v(t,i),$(e,t),b)}function R(e){return"}"==e?f():p(x,R)}function F(e){return ke&&":"==e?f(q):void 0}function W(e,t){return"="==t?f(k):void 0}function q(e){return"variable"==e?(Le.marked="variable-3",f()):void 0}function B(){return p(U,F,G,K)}function U(e,t){return"variable"==e?(m(t),f()):"["==e?H(U,"]"):"{"==e?H(Y,"}"):void 0}function Y(e,t){return"variable"!=e||Le.stream.match(/^\s*:/,!1)?("variable"==e&&(Le.marked="property"),f(y(":"),U,G)):(m(t),f(G))}function G(e,t){return"="==t?f(k):void 0}function K(e){return","==e?f(B):void 0}function V(e,t){return"keyword b"==e&&"else"==t?f(v("form","else"),x,b):void 0}function J(e){return"("==e?f(v(")"),Q,y(")"),b):void 0}function Q(e){return"var"==e?f(B,y(";"),Z):";"==e?f(Z):"variable"==e?f(X):p(w,y(";"),Z)}function X(e,t){return"in"==t||"of"==t?(Le.marked="keyword",f(w)):f(M,Z)}function Z(e,t){return";"==e?f(ee):"in"==t||"of"==t?(Le.marked="keyword",f(w)):p(w,y(";"),ee)}function ee(e){")"!=e&&f(w)}function te(e,t){return"*"==t?(Le.marked="keyword",f(te)):"variable"==e?(m(t),f(te)):"("==e?f(g,v(")"),$(ie,")"),b,x,_):void 0}function ie(e){return"spread"==e?f(ie):p(U,F,W)}function ne(e,t){return"variable"==e?(m(t),f(re)):void 0}function re(e,t){return"extends"==t?f(w,re):"{"==e?f(v("}"),se,b):void 0}function se(e,t){return"variable"==e||"keyword"==Le.style?"static"==t?(Le.marked="keyword",f(se)):(Le.marked="property","get"==t||"set"==t?f(oe,te,se):f(te,se)):"*"==t?(Le.marked="keyword",f(se)):";"==e?f(se):"}"==e?f():void 0}function oe(e){return"variable"!=e?p():(Le.marked="property",f())}function ae(e,t){return"string"==e?f(x):"variable"==e?(m(t),f(de)):void 0}function le(e,t){return"*"==t?(Le.marked="keyword",f(de,y(";"))):"default"==t?(Le.marked="keyword",f(w,y(";"))):p(x)}function ce(e){return"string"==e?f():p(he,de)}function he(e,t){return"{"==e?H(he,"}"):("variable"==e&&m(t),"*"==t&&(Le.marked="keyword"),f(ue))}function ue(e,t){return"as"==t?(Le.marked="keyword",f(he)):void 0}function de(e,t){return"from"==t?(Le.marked="keyword",f(w)):void 0}function pe(e){return"]"==e?f():p(k,fe)}function fe(e){return"for"==e?p(me,y("]")):","==e?f($(S,"]")):p($(k,"]"))}function me(e){return"for"==e?f(J,me):"if"==e?f(w,me):void 0}function ge(e,t){return"operator"==e.lastType||","==e.lastType||Se.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var _e,ve,be=t.indentUnit,ye=i.statementIndent,xe=i.jsonld,we=i.json||xe,ke=i.typescript,Ce=i.wordCharacters||/[\w$\xa1-\uffff]/,Te=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),i=e("keyword b"),n=e("keyword c"),r=e("operator"),s={type:"atom",style:"atom"},o={"if":e("if"),"while":t,"with":t,"else":i,"do":i,"try":i,"finally":i,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":r,"typeof":r,"instanceof":r,"true":s,"false":s,"null":s,undefined:s,NaN:s,Infinity:s,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(ke){var a={type:"variable",style:"variable-3"},l={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:a,number:a,bool:a,any:a};for(var c in l)o[c]=l[c]}return o}(),Se=/[+\-*&%=<>!?|~^]/,Me=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,De="([{}])",Ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Le={state:null,column:null,marked:null,cc:null},Pe={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:s,lastType:"sof",cc:[],lexical:new h((e||0)-be,0,"block",!1),localVars:i.localVars,context:i.localVars&&{vars:i.localVars},indented:0};return i.globalVars&&"object"==typeof i.globalVars&&(t.globalVars=i.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),c(e,t)),t.tokenize!=a&&e.eatSpace())return null;var i=t.tokenize(e,t);return"comment"==_e?i:(t.lastType="operator"!=_e||"++"!=ve&&"--"!=ve?_e:"incdec",d(t,i,_e,ve,e))},indent:function(t,n){if(t.tokenize==a)return e.Pass;if(t.tokenize!=s)return 0;var r=n&&n.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l];if(c==b)o=o.prev;else if(c!=V)break}"stat"==o.type&&"}"==r&&(o=o.prev),ye&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var h=o.type,u=r==h;return"vardef"==h?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==h&&"{"==r?o.indented:"form"==h?o.indented+be:"stat"==h?o.indented+(ge(t,n)?ye||be:0):"switch"!=o.info||u||0==i.doubleIndentSwitch?o.align?o.column+(u?0:1):o.indented+(u?0:be):o.indented+(/^(?:case|default)\b/.test(n)?be:2*be)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:we?null:"/*",blockCommentEnd:we?null:"*/",lineComment:we?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:we?"json":"javascript",jsonldMode:xe,jsonMode:we}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/julia/julia",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("julia",function(e,t){function i(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e){var t=r(e);return"["==t||"{"==t?!0:!1}function r(e){return 0==e.scopes.length?null:e.scopes[e.scopes.length-1]}function s(e,t){var i=t.leaving_expr;if(e.sol()&&(i=!1),t.leaving_expr=!1,i&&e.match(/^'+/))return"operator";if(e.match(/^\.{2,3}/))return"operator";if(e.eatSpace())return null;var s=e.peek();if("#"===s)return e.skipToEnd(),"comment";"["===s&&t.scopes.push("["),"{"===s&&t.scopes.push("{");var a=r(t);"["===a&&"]"===s&&(t.scopes.pop(),t.leaving_expr=!0),"{"===a&&"}"===s&&(t.scopes.pop(),t.leaving_expr=!0),")"===s&&(t.leaving_expr=!0);var d;if(!n(t)&&(d=e.match(b,!1))&&t.scopes.push(d),!n(t)&&e.match(y,!1)&&t.scopes.pop(),n(t)&&e.match(/^end/))return"number";if(e.match(/^=>/))return"operator";if(e.match(/^[0-9\.]/,!1)){var p=RegExp(/^im\b/),f=!1;if(e.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)&&(f=!0),e.match(/^\d+\.(?!\.)\d*/)&&(f=!0),e.match(/^\.\d+/)&&(f=!0),f)return e.match(p),t.leaving_expr=!0,"number";var m=!1;if(e.match(/^0x[0-9a-f]+/i)&&(m=!0),e.match(/^0b[01]+/i)&&(m=!0),e.match(/^0o[0-7]+/i)&&(m=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^0(?![\dx])/i)&&(m=!0),m)return e.match(p),t.leaving_expr=!0,"number"}return e.match(/^(::)|(<:)/)?"operator":!i&&e.match(w)?"string":e.match(c)?"operator":e.match(g)?(t.tokenize=o(e.current()),t.tokenize(e,t)):e.match(x)?"meta":e.match(h)?null:e.match(_)?"keyword":e.match(v)?"builtin":e.match(u)?(t.leaving_expr=!0,"variable"):(e.next(),l)}function o(e){function i(i,o){for(;!i.eol();)if(i.eatWhile(/[^'"\\]/),i.eat("\\")){if(i.next(),n&&i.eol())return r}else{if(i.match(e))return o.tokenize=s,r;i.eat(/['"]/)}if(n){if(t.singleLineStringErrors)return l;o.tokenize=s}return r}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,r="string";return i.isString=!0,i}function a(e,t){var i=t.tokenize(e,t),n=e.current();return"."===n?(i=e.match(u,!1)?null:l,null===i&&"meta"===t.lastStyle&&(i="meta"),i):i}var l="error",c=t.operators||/^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/,h=t.delimiters||/^[;,()[\]{}]/,u=t.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/,d=["begin","function","type","immutable","let","macro","for","while","quote","if","else","elseif","try","finally","catch","do"],p=["end","else","elseif","catch","finally"],f=["if","else","elseif","while","for","begin","let","end","do","try","catch","finally","return","break","continue","global","local","const","export","import","importall","using","function","macro","module","baremodule","type","immutable","quote","typealias","abstract","bitstype","ccall"],m=["true","false","enumerate","open","close","nothing","NaN","Inf","print","println","Int","Int8","Uint8","Int16","Uint16","Int32","Uint32","Int64","Uint64","Int128","Uint128","Bool","Char","Float16","Float32","Float64","Array","Vector","Matrix","String","UTF8String","ASCIIString","error","warn","info","@printf"],g=/^(`|'|"{3}|([br]?"))/,_=i(f),v=i(m),b=i(d),y=i(p),x=/^@[_A-Za-z][_A-Za-z0-9]*/,w=/^:[_A-Za-z][_A-Za-z0-9]*/,k={startState:function(){return{tokenize:s,scopes:[],leaving_expr:!1}},token:function(e,t){var i=a(e,t);return t.lastStyle=i,i},indent:function(e,t){var i=0;return("end"==t||"]"==t||"}"==t||"else"==t||"elseif"==t||"catch"==t||"finally"==t)&&(i=-1),4*(e.scopes.length+i)},lineComment:"#",fold:"indent",electricChars:"edlsifyh]}"};return k}),e.defineMIME("text/x-julia","julia")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/haskell/haskell",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("haskell",function(e,t){function i(e,t,i){return t(i),i(e,t)}function n(e,t){if(e.eatWhile(m))return null;var n=e.next();if(f.test(n)){if("{"==n&&e.eat("-")){var o="comment";return e.eat("#")&&(o="meta"),i(e,t,r(o,1))}return null}if("'"==n)return e.eat("\\")?e.next():e.next(),e.eat("'")?"string":"error";if('"'==n)return i(e,t,s);if(l.test(n))return e.eatWhile(d),e.eat(".")?"qualifier":"variable-2";if(a.test(n))return e.eatWhile(d),"variable";if(c.test(n)){if("0"==n){if(e.eat(/[xX]/))return e.eatWhile(h),"integer";if(e.eat(/[oO]/))return e.eatWhile(u),"number"}e.eatWhile(c);var o="number";return e.match(/^\.\d+/)&&(o="number"),e.eat(/[eE]/)&&(o="number",e.eat(/[-+]/),e.eatWhile(c)),o}if("."==n&&e.eat("."))return"keyword";if(p.test(n)){if("-"==n&&e.eat(/-/)&&(e.eatWhile(/-/),!e.eat(p)))return e.skipToEnd(),"comment";var o="variable";return":"==n&&(o="variable-2"),e.eatWhile(p),o}return"error"}function r(e,t){return 0==t?n:function(i,s){for(var o=t;!i.eol();){var a=i.next();if("{"==a&&i.eat("-"))++o;else if("-"==a&&i.eat("}")&&(--o,0==o))return s(n),e}return s(r(e,o)),e}}function s(e,t){for(;!e.eol();){var i=e.next();if('"'==i)return t(n),"string";if("\\"==i){if(e.eol()||e.eat(m))return t(o),"string";e.eat("&")||e.next()}}return t(n),"error"}function o(e,t){return e.eat("\\")?i(e,t,s):(e.next(),t(n),"error")}var a=/[a-z_]/,l=/[A-Z]/,c=/\d/,h=/[0-9A-Fa-f]/,u=/[0-7]/,d=/[a-z_A-Z0-9'\xa1-\uffff]/,p=/[-!#$%&*+.\/<=>?@\\^|~:]/,f=/[(),;[\]`{}]/,m=/[ \t\v\f]/,g=function(){function e(e){return function(){for(var t=0;t<arguments.length;t++)i[arguments[t]]=e}}var i={};e("keyword")("case","class","data","default","deriving","do","else","foreign","if","import","in","infix","infixl","infixr","instance","let","module","newtype","of","then","type","where","_"),e("keyword")("..",":","::","=","\\",'"',"<-","->","@","~","=>"),e("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<=","=<<","==",">",">=",">>",">>=","^","^^","||","*","**"),e("builtin")("Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),e("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3");var n=t.overrideKeywords;if(n)for(var r in n)n.hasOwnProperty(r)&&(i[r]=n[r]);return i}();return{startState:function(){return{f:n}},copyState:function(e){return{f:e.f}},token:function(e,t){var i=t.f(e,function(e){t.f=e}),n=e.current();return g.hasOwnProperty(n)?g[n]:i},blockCommentStart:"{-",blockCommentEnd:"-}",lineComment:"--"}}),e.defineMIME("text/x-haskell","haskell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/r/r",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),i={},n=0;n<t.length;++n)i[t[n]]=!0;return i}function i(e,t){o=null;var i=e.next();if("#"==i)return e.skipToEnd(),"comment";if("0"==i&&e.eat("x"))return e.eatWhile(/[\da-f]/i),"number";if("."==i&&e.eat(/\d/))return e.match(/\d*(?:e[+\-]?\d+)?/),"number";if(/\d/.test(i))return e.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/),"number";if("'"==i||'"'==i)return t.tokenize=n(i),"string";if("."==i&&e.match(/.[.\d]+/))return"keyword";if(/[\w\.]/.test(i)&&"_"!=i){e.eatWhile(/[\w\.]/);var r=e.current();return a.propertyIsEnumerable(r)?"atom":c.propertyIsEnumerable(r)?(h.propertyIsEnumerable(r)&&!e.match(/\s*if(\s+|$)/,!1)&&(o="block"),"keyword"):l.propertyIsEnumerable(r)?"builtin":"variable"}return"%"==i?(e.skipTo("%")&&e.next(),"variable-2"):"<"==i&&e.eat("-")?"arrow":"="==i&&t.ctx.argList?"arg-is":u.test(i)?"$"==i?"dollar":(e.eatWhile(u),"operator"):/[\(\){}\[\];]/.test(i)?(o=i,";"==i?"semi":null):null}function n(e){return function(t,n){if(t.eat("\\")){var r=t.next();return"x"==r?t.match(/^[a-f0-9]{2}/i):("u"==r||"U"==r)&&t.eat("{")&&t.skipTo("}")?t.next():"u"==r?t.match(/^[a-f0-9]{4}/i):"U"==r?t.match(/^[a-f0-9]{8}/i):/[0-7]/.test(r)&&t.match(/^[0-7]{1,2}/),
"string-2"}for(var s;null!=(s=t.next());){if(s==e){n.tokenize=i;break}if("\\"==s){t.backUp(1);break}}return"string"}}function r(e,t,i){e.ctx={type:t,indent:e.indent,align:null,column:i.column(),prev:e.ctx}}function s(e){e.indent=e.ctx.indent,e.ctx=e.ctx.prev}var o,a=t("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"),l=t("list quote bquote eval return call parse deparse"),c=t("if else repeat while function for in next break"),h=t("if else repeat while function for"),u=/[+\-*\/^<>=!&|~$:]/;return{startState:function(){return{tokenize:i,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var i=t.tokenize(e,t);"comment"!=i&&null==t.ctx.align&&(t.ctx.align=!0);var n=t.ctx.type;return";"!=o&&"{"!=o&&"}"!=o||"block"!=n||s(t),"{"==o?r(t,"}",e):"("==o?(r(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==o?r(t,"]",e):"block"==o?r(t,"block",e):o==n&&s(t),t.afterIdent="variable"==i||"keyword"==i,i},indent:function(t,n){if(t.tokenize!=i)return 0;var r=n&&n.charAt(0),s=t.ctx,o=r==s.type;return"block"==s.type?s.indent+("{"==r?0:e.indentUnit):s.align?s.column+(o?0:1):s.indent+(o?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/shell/shell",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var i=t.split(" "),n=0;n<i.length;n++)r[i[n]]=e}function t(e,t){if(e.eatSpace())return null;var o=e.sol(),a=e.next();if("\\"===a)return e.next(),null;if("'"===a||'"'===a||"`"===a)return t.tokens.unshift(i(a)),n(e,t);if("#"===a)return o&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===a)return t.tokens.unshift(s),n(e,t);if("+"===a||"="===a)return"operator";if("-"===a)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(a)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var l=e.current();return"="===e.peek()&&/\w+/.test(l)?"def":r.hasOwnProperty(l)?r[l]:null}function i(e){return function(t,i){for(var n,r=!1,o=!1;null!=(n=t.next());){if(n===e&&!o){r=!0;break}if("$"===n&&!o&&"'"!==e){o=!0,t.backUp(1),i.tokens.unshift(s);break}o=!o&&"\\"===n}return(r||!o)&&i.tokens.shift(),"`"===e||")"===e?"quote":"string"}}function n(e,i){return(i.tokens[0]||t)(e,i)}var r={};e("atom","true false"),e("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),e("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo tee telnet top touch vi vim wall wc wget who write yes zsh");var s=function(e,t){t.tokens.length>1&&e.eat("$");var r=e.next(),s=/\w/;return"{"===r&&(s=/[^}]/),"("===r?(t.tokens[0]=i(")"),n(e,t)):(/\d/.test(r)||(e.eatWhile(s),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/clike/clike",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},i=e.split(" "),n=0;n<i.length;++n)t[i[n]]=!0;return t}function i(e,t){if(!t.startOfLine)return!1;for(;;){if(!e.skipTo("\\")){e.skipToEnd(),t.tokenize=null;break}if(e.next(),e.eol()){t.tokenize=i;break}}return"meta"}function n(e,t){return"variable-3"==t.prevToken?"variable-3":!1}function r(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var i=e.match(/"([^\s\\()]{0,16})\(/);return i?(t.cpp11RawStringDelim=i[1],t.tokenize=a,a(e,t)):!1}return e.match(/(u8|u|U|L)/)?e.match(/["']/,!1)?"string":!1:(e.next(),!1)}function s(e){var t=/(\w+)::(\w+)$/.exec(e);return t&&t[1]==t[2]}function o(e,t){for(var i;null!=(i=e.next());)if('"'==i&&!e.eat('"')){t.tokenize=null;break}return"string"}function a(e,t){var i=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),n=e.match(new RegExp(".*?\\)"+i+'"'));return n?t.tokenize=null:e.skipToEnd(),"string"}function l(t,i){function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}"string"==typeof t&&(t=[t]);var r=[];n(i.keywords),n(i.types),n(i.builtin),n(i.atoms),r.length&&(i.helperType=t[0],e.registerHelper("hintWords",t[0],r));for(var s=0;s<t.length;++s)e.defineMIME(t[s],i)}function c(e,t){for(var i=!1;!e.eol();){if(!i&&e.match('"""')){t.tokenize=null;break}i="\\"==e.next()&&!i}return"string"}e.defineMode("clike",function(t,i){function n(e,t){var i=e.next();if(k[i]){var n=k[i](e,t);if(n!==!1)return n}if('"'==i||"'"==i)return t.tokenize=r(i),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(i))return d=i,null;if(/\d/.test(i))return e.eatWhile(/[\w\.]/),"number";if("/"==i){if(e.eat("*"))return t.tokenize=s,s(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(D.test(i))return e.eatWhile(D),"operator";if(e.eatWhile(/[\w\$_\xa1-\uffff]/),M)for(;e.match(M);)e.eatWhile(/[\w\$_\xa1-\uffff]/);var o=e.current();return _.propertyIsEnumerable(o)?(y.propertyIsEnumerable(o)&&(d="newstatement"),x.propertyIsEnumerable(o)&&(p=!0),"keyword"):v.propertyIsEnumerable(o)?"variable-3":b.propertyIsEnumerable(o)?(y.propertyIsEnumerable(o)&&(d="newstatement"),"builtin"):w.propertyIsEnumerable(o)?"atom":"variable"}function r(e){return function(t,i){for(var n,r=!1,s=!1;null!=(n=t.next());){if(n==e&&!r){s=!0;break}r=!r&&"\\"==n}return(s||!r&&!C)&&(i.tokenize=null),"string"}}function s(e,t){for(var i,n=!1;i=e.next();){if("/"==i&&n){t.tokenize=null;break}n="*"==i}return"comment"}function o(e,t,i,n,r){this.indented=e,this.column=t,this.type=i,this.align=n,this.prev=r}function a(e){return"statement"==e||"switchstatement"==e||"namespace"==e}function l(e,t,i){var n=e.indented;return e.context&&a(e.context.type)&&!a(i)&&(n=e.context.indented),e.context=new o(n,t,i,null,e.context)}function c(e){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}function h(e,t){return"variable"==t.prevToken||"variable-3"==t.prevToken?!0:/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,e.start))?!0:void 0}function u(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.type)return!1;e=e.prev}}var d,p,f=t.indentUnit,m=i.statementIndentUnit||f,g=i.dontAlignCalls,_=i.keywords||{},v=i.types||{},b=i.builtin||{},y=i.blockKeywords||{},x=i.defKeywords||{},w=i.atoms||{},k=i.hooks||{},C=i.multiLineStrings,T=i.indentStatements!==!1,S=i.indentSwitch!==!1,M=i.namespaceSeparator,D=/[+\-*&%=<>!?|\/]/;return{startState:function(e){return{tokenize:null,context:new o((e||0)-f,0,"top",!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;d=p=null;var s=(t.tokenize||n)(e,t);if("comment"==s||"meta"==s)return s;if(null==r.align&&(r.align=!0),";"==d||":"==d||","==d)for(;a(t.context.type);)c(t);else if("{"==d)l(t,e.column(),"}");else if("["==d)l(t,e.column(),"]");else if("("==d)l(t,e.column(),")");else if("}"==d){for(;a(r.type);)r=c(t);for("}"==r.type&&(r=c(t));a(r.type);)r=c(t)}else if(d==r.type)c(t);else if(T&&(("}"==r.type||"top"==r.type)&&";"!=d||a(r.type)&&"newstatement"==d)){var o="statement";"newstatement"==d&&S&&"switch"==e.current()?o="switchstatement":"keyword"==s&&"namespace"==e.current()&&(o="namespace"),l(t,e.column(),o)}if("variable"==s&&("def"==t.prevToken||i.typeFirstDefinitions&&h(e,t)&&u(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),k.token){var f=k.token(e,t,s);void 0!==f&&(s=f)}return"def"==s&&i.styleDefs===!1&&(s="variable"),t.startOfLine=!1,t.prevToken=p?"def":s||d,s},indent:function(t,i){if(t.tokenize!=n&&null!=t.tokenize)return e.Pass;var r=t.context,s=i&&i.charAt(0);a(r.type)&&"}"==s&&(r=r.prev);var o=s==r.type,l=r.prev&&"switchstatement"==r.prev.type;return a(r.type)?r.indented+("{"==s?0:m):!r.align||g&&")"==r.type?")"!=r.type||o?r.indented+(o?0:f)+(o||!l||/^(?:case|default)\b/.test(i)?0:f):r.indented+m:r.column+(o?0:1)},electricInput:S?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var h="auto if break case register continue return default do sizeof static else struct switch extern typedef float union for goto while enum const volatile",u="int long char short double float unsigned signed void size_t ptrdiff_t";l(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(h),types:t(u+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:t("case do else for if switch while struct"),defKeywords:t("struct"),typeFirstDefinitions:!0,atoms:t("null true false"),hooks:{"#":i,"*":n},modeProps:{fold:["brace","include"]}}),l(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(h+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:t(u+" bool wchar_t"),blockKeywords:t("catch class do else finally for if struct switch try while"),defKeywords:t("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":i,"*":n,u:r,U:r,L:r,R:r,token:function(e,t,i){return"variable"!=i||"("!=e.peek()||";"!=t.prevToken&&null!=t.prevToken&&"}"!=t.prevToken||!s(e.current())?void 0:"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),l("text/x-java",{name:"clike",keywords:t("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:t("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:t("catch class do else finally for if switch try while"),defKeywords:t("class interface package enum"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),l("text/x-csharp",{name:"clike",keywords:t("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:t("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),defKeywords:t("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=o,o(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),l("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:t("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),defKeywords:t("class def object package trait type val var"),atoms:t("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=c,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),l(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":i},modeProps:{fold:["brace","include"]}}),l("text/x-nesc",{name:"clike",keywords:t(h+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:t(u),blockKeywords:t("case do else for if switch while struct"),atoms:t("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),l("text/x-objectivec",{name:"clike",keywords:t(h+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:t(u),atoms:t("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":i},modeProps:{fold:"brace"}}),l("text/x-squirrel",{name:"clike",keywords:t("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:t(u),blockKeywords:t("case catch class else for foreach if switch try while"),defKeywords:t("function local class"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":i},modeProps:{fold:["brace","include"]}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/jinja2/jinja2",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jinja2",function(){function e(e,o){var a=e.peek();if(o.incomment)return e.skipTo("#}")?(e.eatWhile(/\#|}/),o.incomment=!1):e.skipToEnd(),"comment";if(o.intag){if(o.operator){if(o.operator=!1,e.match(r))return"atom";if(e.match(s))return"number"}if(o.sign){if(o.sign=!1,e.match(r))return"atom";if(e.match(s))return"number"}if(o.instring)return a==o.instring&&(o.instring=!1),e.next(),"string";if("'"==a||'"'==a)return o.instring=a,e.next(),"string";if(e.match(o.intag+"}")||e.eat("-")&&e.match(o.intag+"}"))return o.intag=!1,"tag";if(e.match(i))return o.operator=!0,"operator";if(e.match(n))o.sign=!0;else if(e.eat(" ")||e.sol()){if(e.match(t))return"keyword";if(e.match(r))return"atom";if(e.match(s))return"number";e.sol()&&e.next()}else e.next();return"variable"}if(e.eat("{")){if(a=e.eat("#"))return o.incomment=!0,e.skipTo("#}")?(e.eatWhile(/\#|}/),o.incomment=!1):e.skipToEnd(),"comment";if(a=e.eat(/\{|%/))return o.intag=a,"{"==a&&(o.intag="}"),e.eat("-"),"tag"}e.next()}var t=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","plural"],i=/^[+\-*&%=<>!?|~^]/,n=/^[:\[\(\{]/,r=["true","false"],s=/^(\d[+\-\*\/])?\d+(\.\d+)?/;return t=new RegExp("(("+t.join(")|(")+"))\\b"),r=new RegExp("(("+r.join(")|(")+"))\\b"),{startState:function(){return{tokenize:e}},token:function(e,t){return t.tokenize(e,t)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define("codemirror/mode/htmlmixed/htmlmixed",["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,i){function n(e,t){var i=t.htmlState.tagName;i&&(i=i.toLowerCase());var n=a.token(e,t.htmlState);if("script"==i&&/\btag\b/.test(n)&&">"==e.current()){var r=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);r=r?r[1]:"",r&&/[\"\']/.test(r.charAt(0))&&(r=r.slice(1,r.length-1));for(var h=0;h<c.length;++h){var u=c[h];if("string"==typeof u.matches?r==u.matches:u.matches.test(r)){u.mode&&(t.token=s,t.localMode=u.mode,t.localState=u.mode.startState&&u.mode.startState(a.indent(t.htmlState,"")));break}}}else"style"==i&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=o,t.localMode=l,t.localState=l.startState(a.indent(t.htmlState,"")));return n}function r(e,t,i){var n=e.current(),r=n.search(t);return r>-1?e.backUp(n.length-r):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),i}function s(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):r(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function o(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):r(e,/<\/\s*style\s*>/,l.token(e,t.localState))}var a=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:i.multilineTagIndentFactor,multilineTagIndentPastTag:i.multilineTagIndentPastTag}),l=e.getMode(t,"css"),c=[],h=i&&i.scriptTypes;if(c.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),h)for(var u=0;u<h.length;++u){var d=h[u];c.push({matches:d.matches,mode:d.mode&&e.getMode(t,d.mode)})}return c.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=a.startState();return{token:n,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var i=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:i,htmlState:e.copyState(a,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,i){return!t.localMode||/^\s*<\//.test(i)?a.indent(t.htmlState,i):t.localMode.indent?t.localMode.indent(t.localState,i):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||a}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define("codemirror/mode/php/php",["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},i=e.split(" "),n=0;n<i.length;++n)t[i[n]]=!0;return t}function i(e,t,r){return 0==e.length?n(t):function(s,o){for(var a=e[0],l=0;l<a.length;l++)if(s.match(a[l][0]))return o.tokenize=i(e.slice(1),t),a[l][1];return o.tokenize=n(t,r),"string"}}function n(e,t){return function(i,n){return r(i,n,e,t)}}function r(e,t,n,r){if(r!==!1&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(r!==!1&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=i([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,r)),e.match(/\-\>\w/,!1)&&(t.tokenize=i([[["->",null]],[[/[\w]+/,"variable"]]],n,r)),"variable-2";for(var s=!1;!e.eol()&&(s||r===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!s&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}s="\\"==e.next()&&!s}return"string"}var s="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",o="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",a="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
e.registerHelper("hintWords","php",[s,o,a].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(s),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(o),builtin:t(a),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){if(e.match(/<</)){var i=e.eat("'");e.eatWhile(/[\w\.]/);var r=e.current().slice(3+(i?1:0));if(i&&e.eat("'"),r)return(t.tokStack||(t.tokStack=[])).push(r,0),t.tokenize=n(r,i?!1:!0),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,i){function n(e,t){var i=t.curMode==s;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),i)return i&&null==t.php.tokenize&&e.match("?>")?(t.curMode=r,t.curState=t.html,"meta"):s.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=s,t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else if(t.pending&&e.pos<t.pending.end){e.pos=t.pending.end;var n=t.pending.style}else var n=r.token(e,t.curState);t.pending&&(t.pending=null);var o,a=e.current(),l=a.search(/<\?/);return-1!=l&&("string"==n&&(o=a.match(/[\'\"]$/))&&!/\?>/.test(a)?t.pending=o[0]:t.pending={end:e.pos,style:n},e.backUp(a.length-l)),n}var r=e.getMode(t,"text/html"),s=e.getMode(t,l);return{startState:function(){var t=e.startState(r),n=e.startState(s);return{html:t,php:n,curMode:i.startOpen?s:r,curState:i.startOpen?n:t,pending:null}},copyState:function(t){var i,n=t.html,o=e.copyState(r,n),a=t.php,l=e.copyState(s,a);return i=t.curMode==r?o:l,{html:o,php:l,curMode:t.curMode,curState:i,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=s&&/^\s*<\//.test(t)||e.curMode==s&&/^\?>/.test(t)?r.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("codemirror/mode/sql/sql",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,i){function n(e,t){var i=e.next();if(f[i]){var n=f[i](e,t);if(n!==!1)return n}if(1==p.hexNumber&&("0"==i&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==i||"X"==i)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==i||"B"==i)&&e.match(/^'[01]+'/)||"0"==i&&e.match(/^b[01]+/)))return"number";if(i.charCodeAt(0)>47&&i.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==i&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==i||'"'==i&&p.doubleQuote)return t.tokenize=r(i),t.tokenize(e,t);if((1==p.nCharCast&&("n"==i||"N"==i)||1==p.charsetCast&&"_"==i&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(i))return null;if(p.commentSlashSlash&&"/"==i&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==i||"-"==i&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==i&&e.eat("*"))return t.tokenize=s,t.tokenize(e,t);if("."!=i){if(d.test(i))return e.eatWhile(d),null;if("{"==i&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var o=e.current().toLowerCase();return m.hasOwnProperty(o)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(o)?"atom":h.hasOwnProperty(o)?"builtin":u.hasOwnProperty(o)?"keyword":l.hasOwnProperty(o)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function r(e){return function(t,i){for(var r,s=!1;null!=(r=t.next());){if(r==e&&!s){i.tokenize=n;break}s=!s&&"\\"==r}return"string"}}function s(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=n;break}}return"comment"}function o(e,t,i){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:i}}function a(e){e.indent=e.context.indent,e.context=e.context.prev}var l=i.client||{},c=i.atoms||{"false":!0,"true":!0,"null":!0},h=i.builtin||{},u=i.keywords||{},d=i.operatorChars||/^[*+\-%<>!=&|~^]/,p=i.support||{},f=i.hooks||{},m=i.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:n,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var i=t.tokenize(e,t);if("comment"==i)return i;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?o(e,t,")"):"["==n?o(e,t,"]"):t.context&&t.context.type==n&&a(t),i},indent:function(i,n){var r=i.context;if(!r)return e.Pass;var s=n.charAt(0)==r.type;return r.align?r.col+(s?0:1):r.indent+(s?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function i(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function n(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function r(e){for(var t={},i=e.split(" "),n=0;n<i.length;++n)t[i[n]]=!0;return t}var s="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where ";e.defineMIME("text/x-sql",{name:"sql",keywords:r(s+"begin"),builtin:r("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:r("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:r("date time timestamp"),support:r("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:r("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:r(s+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:r("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:r("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:r("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":i}}),e.defineMIME("text/x-mysql",{name:"sql",client:r("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:r(s+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:r("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:r("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:r("date time timestamp"),support:r("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":i,"`":t,"\\":n}}),e.defineMIME("text/x-mariadb",{name:"sql",client:r("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:r(s+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:r("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:r("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:r("date time timestamp"),support:r("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":i,"`":t,"\\":n}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:r("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:r("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:r("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:r("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:r("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:r("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:r("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:r("date time timestamp"),support:r("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:r("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:r("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:r("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:r("date timestamp"),support:r("ODBCdotTable doubleQuote binaryNumber hexNumber")})}()}),function(e){var t="object"==typeof self&&self.self==self&&self||"object"==typeof global&&global.global==global&&global;if("function"==typeof define&&define.amd)define("backbone",["underscore","jquery","exports"],function(i,n,r){t.Backbone=e(t,r,i,n)});else if("undefined"!=typeof exports){var i,n=require("underscore");try{i=require("jquery")}catch(r){}e(t,exports,n,i)}else t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}(function(e,t,i,n){var r=e.Backbone,s=[],o=s.slice;t.VERSION="1.2.0",t.$=n,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=t.Events={},l=/\s+/,c=function(e,t,n,r,s){var o,a=0;if(n&&"object"==typeof n)for(o=i.keys(n);a<o.length;a++)t=e(t,o[a],n[o[a]],s);else if(n&&l.test(n))for(o=n.split(l);a<o.length;a++)t=e(t,o[a],r,s);else t=e(t,n,r,s);return t};a.on=function(e,t,i){return h(this,e,t,i)};var h=function(e,t,i,n,r){if(e._events=c(u,e._events||{},t,i,{context:n,ctx:e,listening:r}),r){var s=e._listeners||(e._listeners={});s[r.id]=r}return e};a.listenTo=function(e,t,n){if(!e)return this;var r=e._listenId||(e._listenId=i.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),o=s[r];if(!o){var a=this._listenId||(this._listenId=i.uniqueId("l"));o=s[r]={obj:e,objId:r,id:a,listeningTo:s,count:0}}return h(e,t,n,this,o),this};var u=function(e,t,i,n){if(i){var r=e[t]||(e[t]=[]),s=n.context,o=n.ctx,a=n.listening;a&&a.count++,r.push({callback:i,context:s,ctx:s||o,listening:a})}return e};a.off=function(e,t,i){return this._events?(this._events=c(d,this._events,e,t,{context:i,listeners:this._listeners}),this):this},a.stopListening=function(e,t,n){var r=this._listeningTo;if(!r)return this;for(var s=e?[e._listenId]:i.keys(r),o=0;o<s.length;o++){var a=r[s[o]];if(!a)break;a.obj.off(t,n,this)}return i.isEmpty(r)&&(this._listeningTo=void 0),this};var d=function(e,t,n,r){if(e){var s,o=0,a=r.context,l=r.listeners;if(t||n||a){for(var c=t?[t]:i.keys(e);o<c.length;o++){t=c[o];var h=e[t];if(!h)break;for(var u=[],d=0;d<h.length;d++){var p=h[d];n&&n!==p.callback&&n!==p.callback._callback||a&&a!==p.context?u.push(p):(s=p.listening,s&&0===--s.count&&(delete l[s.id],delete s.listeningTo[s.objId]))}u.length?e[t]=u:delete e[t]}return i.size(e)?e:void 0}for(var f=i.keys(l);o<f.length;o++)s=l[f[o]],delete l[s.id],delete s.listeningTo[s.objId]}};a.once=function(e,t,n){var r=c(p,{},e,t,i.bind(this.off,this));return this.on(r,void 0,n)},a.listenToOnce=function(e,t,n){var r=c(p,{},t,n,i.bind(this.stopListening,this,e));return this.listenTo(e,r)};var p=function(e,t,n,r){if(n){var s=e[t]=i.once(function(){r(t,s),n.apply(this,arguments)});s._callback=n}return e};a.trigger=function(e){if(!this._events)return this;for(var t=Math.max(0,arguments.length-1),i=Array(t),n=0;t>n;n++)i[n]=arguments[n+1];return c(f,this._events,e,void 0,i),this};var f=function(e,t,i,n){if(e){var r=e[t],s=e.all;r&&s&&(s=s.slice()),r&&m(r,n),s&&m(s,[t].concat(n))}return e},m=function(e,t){var i,n=-1,r=e.length,s=t[0],o=t[1],a=t[2];switch(t.length){case 0:for(;++n<r;)(i=e[n]).callback.call(i.ctx);return;case 1:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s);return;case 2:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s,o);return;case 3:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s,o,a);return;default:for(;++n<r;)(i=e[n]).callback.apply(i.ctx,t);return}},g=function(e,t,n){switch(e){case 1:return function(){return i[t](this[n])};case 2:return function(e){return i[t](this[n],e)};case 3:return function(e,r){return i[t](this[n],e,r)};case 4:return function(e,r,s){return i[t](this[n],e,r,s)};default:return function(){var e=o.call(arguments);return e.unshift(this[n]),i[t].apply(i,e)}}},_=function(e,t,n){i.each(t,function(t,r){i[r]&&(e.prototype[r]=g(t,r,n))})};a.bind=a.on,a.unbind=a.off,i.extend(t,a);var v=t.Model=function(e,t){var n=e||{};t||(t={}),this.cid=i.uniqueId(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{}),n=i.defaults({},n,i.result(this,"defaults")),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};i.extend(v.prototype,a,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(e){return i.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return i.escape(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!i.iteratee(e,this)(this.attributes)},set:function(e,t,n){var r,s,o,a,l,c,h,u;if(null==e)return this;if("object"==typeof e?(s=e,n=t):(s={})[e]=t,n||(n={}),!this._validate(s,n))return!1;o=n.unset,l=n.silent,a=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=i.clone(this.attributes),this.changed={}),u=this.attributes,h=this._previousAttributes,this.idAttribute in s&&(this.id=s[this.idAttribute]);for(r in s)t=s[r],i.isEqual(u[r],t)||a.push(r),i.isEqual(h[r],t)?delete this.changed[r]:this.changed[r]=t,o?delete u[r]:u[r]=t;if(!l){a.length&&(this._pending=n);for(var d=0;d<a.length;d++)this.trigger("change:"+a[d],this,u[a[d]],n)}if(c)return this;if(!l)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,i.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,i.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!i.isEmpty(this.changed):i.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?i.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var s in e)i.isEqual(r[s],t=e[s])||((n||(n={}))[s]=t);return n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(e){e=e?i.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,n=e.success;return e.success=function(i){return t.set(t.parse(i,e),e)?(n&&n.call(e.context,t,i,e),void t.trigger("sync",t,i,e)):!1},R(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,s,o,a,l=this.attributes;if(null==e||"object"==typeof e?(r=e,n=t):(r={})[e]=t,n=i.extend({validate:!0},n),a=n.wait,r&&!a){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;r&&a&&(this.attributes=i.extend({},l,r)),void 0===n.parse&&(n.parse=!0);var c=this,h=n.success;return n.success=function(e){c.attributes=l;var t=n.parse?c.parse(e,n):e;return a&&(t=i.extend(r||{},t)),i.isObject(t)&&!c.set(t,n)?!1:(h&&h.call(n.context,c,e,n),void c.trigger("sync",c,e,n))},R(this,n),s=this.isNew()?"create":n.patch?"patch":"update","patch"!==s||n.attrs||(n.attrs=r),o=this.sync(s,this,n),r&&a&&(this.attributes=l),o},destroy:function(e){e=e?i.clone(e):{};var t=this,n=e.success,r=e.wait,s=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(i){r&&s(),n&&n.call(e.context,t,i,e),t.isNew()||t.trigger("sync",t,i,e)};var o=!1;return this.isNew()?i.defer(e.success):(R(this,e),o=this.sync("delete",this,e)),r||s(),o},url:function(){var e=i.result(this,"urlRoot")||i.result(this.collection,"url")||H();if(this.isNew())return e;var t=this.id||this.attributes[this.idAttribute];return e.replace(/([^\/])$/,"$1/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},i.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=i.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,i.extend(t,{validationError:n})),!1):!0}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};_(v,b,"attributes");var y=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,i.extend({silent:!0},t))},x={add:!0,remove:!0,merge:!0},w={add:!0,remove:!1};i.extend(y.prototype,a,{model:v,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,i.extend({merge:!1},t,w))},remove:function(e,t){var n,r=!i.isArray(e);return e=r?[e]:i.clone(e),t||(t={}),n=this._removeModels(e,t),!t.silent&&n&&this.trigger("update",this,t),r?e[0]:e},set:function(e,t){t=i.defaults({},t,x),t.parse&&(e=this.parse(e,t));var n=!i.isArray(e);e=n?e?[e]:[]:e.slice();var r,s,o,a,l,c=t.at;null!=c&&(c=+c),0>c&&(c+=this.length+1);for(var h=this.comparator&&null==c&&t.sort!==!1,u=i.isString(this.comparator)?this.comparator:null,d=[],p=[],f={},m=t.add,g=t.merge,_=t.remove,v=!h&&m&&_?[]:!1,b=!1,y=0;y<e.length;y++){if(o=e[y],a=this.get(o))_&&(f[a.cid]=!0),g&&o!==a&&(o=this._isModel(o)?o.attributes:o,t.parse&&(o=a.parse(o,t)),a.set(o,t),h&&!l&&a.hasChanged(u)&&(l=!0)),e[y]=a;else if(m){if(s=e[y]=this._prepareModel(o,t),!s)continue;d.push(s),this._addReference(s,t)}s=a||s,s&&(r=this.modelId(s.attributes),!v||!s.isNew()&&f[r]||(v.push(s),b=b||!this.models[y]||s.cid!==this.models[y].cid),f[r]=!0)}if(_){for(var y=0;y<this.length;y++)f[(s=this.models[y]).cid]||p.push(s);p.length&&this._removeModels(p,t)}if(d.length||b)if(h&&(l=!0),this.length+=d.length,null!=c)for(var y=0;y<d.length;y++)this.models.splice(c+y,0,d[y]);else{v&&(this.models.length=0);for(var w=v||d,y=0;y<w.length;y++)this.models.push(w[y])}if(l&&this.sort({silent:!0}),!t.silent){for(var k=null!=c?i.clone(t):t,y=0;y<d.length;y++)null!=c&&(k.index=c+y),(s=d[y]).trigger("add",s,this,k);(l||b)&&this.trigger("sort",this,t),(d.length||p.length)&&this.trigger("update",this,t)}return n?e[0]:e},reset:function(e,t){t=t?i.clone(t):{};for(var n=0;n<this.models.length;n++)this._removeReference(this.models[n],t);return t.previousModels=this.models,this._reset(),e=this.add(e,i.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,i.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,i.extend({
at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return o.apply(this.models,arguments)},get:function(e){if(null!=e){var t=this.modelId(this._isModel(e)?e.attributes:e);return this._byId[e]||this._byId[t]||this._byId[e.cid]}},at:function(e){return 0>e&&(e+=this.length),this.models[e]},where:function(e,t){var n=i.matches(e);return this[t?"find":"filter"](function(e){return n(e.attributes)})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),i.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(i.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return i.invoke(this.models,"get",e)},fetch:function(e){e=e?i.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,n=this;return e.success=function(i){var r=e.reset?"reset":"set";n[r](i,e),t&&t.call(e.context,n,i,e),n.trigger("sync",n,i,e)},R(this,e),this.sync("read",this,e)},create:function(e,t){t=t?i.clone(t):{};var n=t.wait;if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);var r=this,s=t.success;return t.success=function(e,t,i){n&&r.add(e,i),s&&s.call(i.context,e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;t=t?i.clone(t):{},t.collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeModels:function(e,t){for(var i,n,r,s=!1,i=0,o=0;i<e.length;i++){var r=e[i]=this.get(e[i]);if(r){var a=this.modelId(r.attributes);null!=a&&delete this._byId[a],delete this._byId[r.cid];var n=this.indexOf(r);this.models.splice(n,1),this.length--,t.silent||(t.index=n,r.trigger("remove",r,this,t)),e[o++]=r,this._removeReference(r,t),s=!0}}return e.length!==o&&(e=e.slice(0,o)),s},_isModel:function(e){return e instanceof v},_addReference:function(e,t){this._byId[e.cid]=e;var i=this.modelId(e.attributes);null!=i&&(this._byId[i]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,i,n){if("add"!==e&&"remove"!==e||i===this){if("destroy"===e&&this.remove(t,n),"change"===e){var r=this.modelId(t.previousAttributes()),s=this.modelId(t.attributes);r!==s&&(null!=r&&delete this._byId[r],null!=s&&(this._byId[s]=t))}this.trigger.apply(this,arguments)}}});var k={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:2,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};_(y,k,"models");var C=["groupBy","countBy","sortBy","indexBy"];i.each(C,function(e){i[e]&&(y.prototype[e]=function(t,n){var r=i.isFunction(t)?t:function(e){return e.get(t)};return i[e](this.models,r,n)})});var T=t.View=function(e){this.cid=i.uniqueId("view"),e||(e={}),i.extend(this,i.pick(e,M)),this._ensureElement(),this.initialize.apply(this,arguments)},S=/^(\S+)\s*(.*)$/,M=["model","collection","el","id","attributes","className","tagName","events"];i.extend(T.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0]},delegateEvents:function(e){if(!e&&!(e=i.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];if(i.isFunction(n)||(n=this[e[t]]),n){var r=t.match(S);this.delegate(r[1],r[2],i.bind(n,this))}}return this},delegate:function(e,t,i){this.$el.on(e+".delegateEvents"+this.cid,t,i)},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(e,t,i){this.$el.off(e+".delegateEvents"+this.cid,t,i)},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(i.result(this,"el"));else{var e=i.extend({},i.result(this,"attributes"));this.id&&(e.id=i.result(this,"id")),this.className&&(e["class"]=i.result(this,"className")),this.setElement(this._createElement(i.result(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){this.$el.attr(e)}}),t.sync=function(e,n,r){var s=D[e];i.defaults(r||(r={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var o={type:s,dataType:"json"};if(r.url||(o.url=i.result(n,"url")||H()),null!=r.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(o.contentType="application/json",o.data=JSON.stringify(r.attrs||n.toJSON(r))),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&("PUT"===s||"DELETE"===s||"PATCH"===s)){o.type="POST",r.emulateJSON&&(o.data._method=s);var a=r.beforeSend;r.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",s),a?a.apply(this,arguments):void 0}}"GET"===o.type||r.emulateJSON||(o.processData=!1);var l=r.error;r.error=function(e,t,i){r.textStatus=t,r.errorThrown=i,l&&l.call(r.context,e,t,i)};var c=r.xhr=t.ajax(i.extend(o,r));return n.trigger("request",n,c,r),c};var D={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var E=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},L=/\((.*?)\)/g,P=/(\(\?)?:\w+/g,A=/\*\w+/g,I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(E.prototype,a,{initialize:function(){},route:function(e,n,r){i.isRegExp(e)||(e=this._routeToRegExp(e)),i.isFunction(n)&&(r=n,n=""),r||(r=this[n]);var s=this;return t.history.route(e,function(i){var o=s._extractParameters(e,i);s.execute(r,o,n)!==!1&&(s.trigger.apply(s,["route:"+n].concat(o)),s.trigger("route",n,o),t.history.trigger("route",s,n,o))}),this},execute:function(e,t,i){e&&e.apply(this,t)},navigate:function(e,i){return t.history.navigate(e,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var e,t=i.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(I,"\\$&").replace(L,"(?:$1)?").replace(P,function(e,t){return t?e:"([^/?]+)"}).replace(A,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return i.map(n,function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null})}});var O=t.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},j=/^[#\/]|\s+$/g,z=/^\/+|\/+$/g,N=/#.*$/;O.started=!1,i.extend(O.prototype,a,{interval:50,atRoot:function(){var e=this.location.pathname.replace(/[^\/]$/,"$&/");return e===this.root&&!this.getSearch()},matchRoot:function(){var e=this.decodeFragment(this.location.pathname),t=e.slice(0,this.root.length-1)+"/";return t===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){var e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){var e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(j,"")},start:function(e){if(O.started)throw new Error("Backbone.history has already been started");if(O.started=!0,this.options=i.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window,this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(z,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){var n=document.createElement("iframe");n.src="javascript:0",n.style.display="none",n.tabIndex=-1;var r=document.body;this.iframe=r.insertBefore(n,r.firstChild).contentWindow,this.iframe.document.open().close(),this.iframe.location.hash="#"+this.fragment}var s=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};return this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe.frameElement),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),O.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe)),t===this.fragment?!1:(this.iframe&&this.navigate(t),void this.loadUrl())},loadUrl:function(e){return this.matchRoot()?(e=this.fragment=this.getFragment(e),i.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})):!1},navigate:function(e,t){if(!O.started)return!1;t&&t!==!0||(t={trigger:!!t}),e=this.getFragment(e||"");var i=this.root;(""===e||"?"===e.charAt(0))&&(i=i.slice(0,-1)||"/");var n=i+e;if(e=this.decodeFragment(e.replace(N,"")),this.fragment!==e){if(this.fragment=e,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe)&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,i){if(i){var n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}}),t.history=new O;var $=function(e,t){var n,r=this;n=e&&i.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},i.extend(n,r,t);var s=function(){this.constructor=n};return s.prototype=r.prototype,n.prototype=new s,e&&i.extend(n.prototype,e),n.__super__=r.prototype,n};v.extend=y.extend=E.extend=T.extend=O.extend=$;var H=function(){throw new Error('A "url" property or function must be specified')},R=function(e,t){var i=t.error;t.error=function(n){i&&i.call(t.context,e,n,t),e.trigger("error",e,n,t)}};return t}),define("nbextensions/widgets/widgets/js/manager",["underscore","backbone","base/js/utils","base/js/namespace","services/kernels/comm"],function(e,t,i,n,r){"use strict";var s=function(t,n){s._managers.push(this),this.keyboard_manager=n.keyboard_manager,this.notebook=n,this.comm_manager=t,this.comm_target_name="ipython.widget",this._models={},this.comm_manager.register_target(this.comm_target_name,e.bind(this._handle_comm_open,this));var r=this;s._load_callback&&Promise.resolve().then(function(){return s._load_callback.call(r)}).then(function(e){r.set_state(e)})["catch"](i.reject("Error loading widget manager state",!0)),this.notebook.events.on("before_save.Notebook",function(){var e=s._save_callback,t=s._get_state_options;e&&r.get_state(t).then(function(t){e.call(r,t)})["catch"](i.reject("Could not call widget save state callback.",!0))})};s._model_types={},s._view_types={},s._managers=[],s._load_callback=null,s._save_callback=null,s.register_widget_model=function(e,t){s._model_types[e]=t},s.register_widget_view=function(e,t){s._view_types[e]=t},s.set_state_callbacks=function(e,t,n){s._load_callback=e,s._save_callback=t,s._get_state_options=n,s._managers.forEach(function(t){e&&Promise.resolve().then(function(){return e.call(t)}).then(function(e){t.set_state(e)})["catch"](i.reject("Error loading widget manager state",!0))})};var o=[window.location.protocol,"//",window.location.host,window.location.pathname].join(""),a="widgets:"+o;return s.set_state_callbacks(function(){return localStorage[a]?JSON.parse(localStorage[a]):{}},function(e){localStorage[a]=JSON.stringify(e)}),s.prototype.display_view=function(e,t){var n=this.get_msg_cell(e.parent_header.msg_id);return null===n?Promise.reject(new Error("Could not determine where the display message was from.  Widget will not be displayed")):this.display_view_in_cell(n,t)["catch"](i.reject("Could not display view",!0))},s.prototype.display_view_in_cell=function(e,t){if(e.widgetarea){var n=this;return e.widgetarea.display_widget_view(this.create_view(t,{cell:e,cell_index:n.notebook.find_cell_index(e)})).then(function(e){return n._handle_display_view(e),e.trigger("displayed"),e})["catch"](i.reject("Could not create or display view",!0))}return Promise.reject(new Error("Cell does not have a `widgetarea` defined"))},s.prototype._handle_display_view=function(e){if(this.keyboard_manager&&(this.keyboard_manager.register_events(e.el),e.additional_elements))for(var t=0;t<e.additional_elements.length;t++)this.keyboard_manager.register_events(e.additional_elements[t])},s.prototype.create_view=function(e,t){e.state_change=e.state_change.then(function(){return i.load_class(e.get("_view_name"),e.get("_view_module"),s._view_types).then(function(i){t=t||{},void 0!==t.parent&&(t.cell=t.parent.options.cell);var n={model:e,options:t},r=new i(n);return r.listenTo(e,"destroy",r.remove),Promise.resolve(r.render()).then(function(){return r})})["catch"](i.reject("Couldn't create a view for model id '"+String(e.id)+"'",!0))});var n=i.uuid();return e.views[n]=e.state_change,e.state_change.then(function(e){e.once("remove",function(){delete e.model.views[n]},this)}),e.state_change},s.prototype.get_msg_cell=function(e){var t=null;if(this.notebook&&(t=this.notebook.get_msg_cell(e)),null!==t)return t;var i=this.comm_manager.kernel;if(i){var n=i.get_callbacks_for_msg(e);if(n&&n.iopub&&void 0!==n.iopub.get_cell)return n.iopub.get_cell()}return null},s.prototype.callbacks=function(t){var i={};if(t&&t.options.cell){var n=t.options.cell,r=null,s=null;n.output_area&&(r=e.bind(n.output_area.handle_output,n.output_area),s=e.bind(n.output_area.handle_clear_output,n.output_area));i={iopub:{output:r,clear_output:s,get_cell:function(){return n}}}}return i},s.prototype.get_model=function(e){return this._models[e]},s.prototype._handle_comm_open=function(e,t){return this.new_model({model_name:t.content.data._model_name,model_module:t.content.data._model_module,comm:e}).then(function(e){return e._deserialize_state(t.content.data).then(function(t){return e.set_state(t),e})})["catch"](i.reject("Couldn't create a model.",!0))},s.prototype.create_model=function(e){return console.warn("WidgetManager.create_model is deprecated. Use WidgetManager.new_widget"),this.new_widget(e)},s.prototype.new_widget=function(e){return e.comm||(e.comm=this.comm_manager.new_comm("ipython.widget",{widget_class:e.widget_class},e.model_id)),this.new_model(e).then(function(e){return e.request_state()})},s.prototype.new_model=function(e){var t=this,n=e.model_id||e.comm.comm_id,r=i.load_class(e.model_name,e.model_module,s._model_types).then(function(i){var r=new i(t,n,e.comm);return r.once("comm:close",function(){delete t._models[n]}),r.name=e.model_name,r.module=e.model_module,r},function(e){delete t._models[n];var r=new i.WrappedError("Couldn't create model",e);return Promise.reject(r)});return this._models[n]=r,r},s.prototype.get_state=function(e){return i.resolve_promises_dict(this._models).then(function(t){var n={},r=[];for(var s in t)if(t.hasOwnProperty(s)){var o=t[s],a=!(e&&e.only_displayed)||Object.keys(o.views).length>0,l=e&&e.not_live||o.comm_live;a&&l&&(n[s]={model_name:o.name,model_module:o.module,state:o.get_state(),views:[]},function(e){r.push(i.resolve_promises_dict(o.views).then(function(t){for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];void 0!==n.options.cell_index&&e.views.push(n.options.cell_index)}}))}(n[s]))}return Promise.all(r).then(function(){return n})})["catch"](i.reject("Could not get state of widget manager",!0))},s.prototype.set_state=function(t){var n=this;return this._get_connected_kernel().then(function(i){var s=n._get_comm_info(i).then(function(n){return Promise.all(e.map(Object.keys(t),function(e){if(n.hasOwnProperty(e)){var s=new r.Comm(i.widget_manager.comm_target_name,e);return i.comm_manager.register_comm(s),i.widget_manager.new_model({comm:s,model_name:t[e].model_name,model_module:t[e].model_module}).then(function(e){return e.request_state()})}return i.widget_manager.new_model({model_id:e,model_name:t[e].model_name,model_module:t[e].model_module}).then(function(i){return i._deserialize_state(t[e].state).then(function(e){return i.set_state(e),i})})}))});return s.then(function(i){return Promise.all(e.map(i,function(i){return Promise.all(e.map(t[i.id].views,function(e){var t=n.notebook.get_cell(e);return n.display_view_in_cell(t,i)}))}))})})["catch"](i.reject("Could not set widget manager state.",!0))},s.prototype._get_connected_kernel=function(){var e=this;return new Promise(function(t,i){e.comm_manager&&e.comm_manager.kernel&&e.comm_manager.kernel.is_connected()?t(e.comm_manager.kernel):e.notebook.events.on("kernel_connected.Kernel",function(e,i){t(i.kernel)})})},s.prototype._get_comm_info=function(e){var t=this;return new Promise(function(e,i){var n=t.comm_manager.new_comm("ipython.widget",{widget_class:"ipywidgets.CommInfo"},"comm_info");n.on_msg(function(t){var i=t.content.data;i.content&&"custom"===i.method&&e(i.content.comms)})})},n.WidgetManager=s,{WidgetManager:s}}),define("nbextensions/widgets/widgets/js/widget",["nbextensions/widgets/widgets/js/manager","underscore","backbone","base/js/utils","base/js/namespace"],function(e,t,i,n,r){"use strict";var s=function p(e,i){var r;return t.isArray(e)?(r=[],t.each(e,function(e,t){r.push(p(e,i))}),Promise.all(r)):e instanceof Object?(r={},t.each(e,function(e,t){r[t]=p(e,i)}),n.resolve_promises_dict(r)):"string"==typeof e&&"IPY_MODEL_"===e.slice(0,10)?i.widget_manager.get_model(e.slice(10,e.length)):Promise.resolve(e)},o=i.Model.extend({constructor:function(e,i,n){o.__super__.constructor.apply(this),this.widget_manager=e,this.state_change=Promise.resolve(),this._buffered_state_diff={},this.pending_msgs=0,this.msg_buffer=null,this.state_lock=null,this.id=i,this.isNew=function(){return!1},this.views={},this._resolve_received_state={},n?(this.comm=n,n.model=this,n.on_close(t.bind(this._handle_comm_closed,this)),n.on_msg(t.bind(this._handle_comm_msg,this)),this.set_comm_live(!0)):this.comm_live=!1;var r=this,s=function(){r.set_comm_live(!1)};e.notebook.events.on("kernel_disconnected.Kernel",s),e.notebook.events.on("kernel_killed.Kernel",s),e.notebook.events.on("kernel_restarting.Kernel",s),e.notebook.events.on("kernel_dead.Kernel",s)},send:function(e,t,i){if(void 0!==this.comm){var n={method:"custom",content:e};this.comm.send(n,t,{},i),this.pending_msgs++}},request_state:function(e){if(!this.comm)return void console.error("Could not request_state because comm doesn't exist!");var t=this.comm.send({method:"request_state"},e||this.widget_manager.callbacks()),i=this;return new Promise(function(e){i._resolve_received_state[t]=e})},set_comm_live:function(e){(void 0===this.comm_live||this.comm_live!=e)&&(this.comm_live=e,this.trigger(e?"comm:live":"comm:dead",{model:this}))},close:function(e){this.comm&&!e&&this.comm.close(),this.stopListening(),this.trigger("destroy",this),delete this.comm.model,delete this.comm,delete this.model_id,t.each(this.views,function(e,t,i){e.then(function(e){e.remove(),delete i[t]})})},_handle_comm_closed:function(e){this.trigger("comm:close"),this.close(!0)},_deserialize_state:function(e){var t=this.constructor.serializers;if(t){var i={};for(var r in e)t[r]&&t[r].deserialize?i[r]=t[r].deserialize(e[r],this):i[r]=e[r]}else i=e;return n.resolve_promises_dict(i)},_handle_comm_msg:function(e){var t=e.content.data.method,i=this;switch(t){case"update":this.state_change=this.state_change.then(function(){for(var t=e.content.data.state||{},n=e.content.data.buffers||[],r=e.buffers||[],s=0;s<n.length;s++)t[n[s]]=r[s];return i._deserialize_state(t)}).then(function(e){i.set_state(e)})["catch"](n.reject("Couldn't process update msg for model id '"+String(i.id)+"'",!0)).then(function(){var t=e.parent_header.msg_id;void 0!==i._resolve_received_state[t]&&(i._resolve_received_state[t](i),delete i._resolve_received_state[t])})["catch"](n.reject("Couldn't resolve state request promise",!0));break;case"custom":this.trigger("msg:custom",e.content.data.content,e.buffers);break;case"display":this.state_change=this.state_change.then(function(){i.widget_manager.display_view(e,i)})["catch"](n.reject("Could not process display view msg",!0))}},set_state:function(e){this.state_lock=e;try{o.__super__.set.call(this,e)}finally{this.state_lock=null}},get_state:function(){return t.clone(this.attributes)},_handle_status:function(e,t){if(void 0!==this.comm&&"idle"===e.content.execution_state)if(null!==this.msg_buffer&&(this.get("msg_throttle")||1)===this.pending_msgs){var i={method:"backbone",sync_method:"update",sync_data:this.msg_buffer};this.comm.send(i,t),this.msg_buffer=null}else--this.pending_msgs},callbacks:function(e){var t=this.widget_manager.callbacks(e);void 0===t.iopub&&(t.iopub={});var i=this;return t.iopub.status=function(e){i._handle_status(e,t)},t},set:function(e,i,n){var r=o.__super__.set.apply(this,arguments);return this._buffered_state_diff=t.extend(this._buffered_state_diff,this.changedAttributes()||{}),r},sync:function(e,i,n){var r=n.error||function(){console.error("Backbone sync error:",arguments)};if(void 0===this.comm)return r(),!1;var s="patch"===e?n.attrs:i.get_state(n);if(null!==this.state_lock)for(var o=Object.keys(this.state_lock),a=0;a<o.length;a++){var l=o[a];s[l]===this.state_lock[l]&&delete s[l]}if(t.size(s)>0){var c=n.callbacks||this.callbacks();if(this.pending_msgs>=(this.get("msg_throttle")||1)){switch(e){case"patch":this.msg_buffer=t.extend(this.msg_buffer||{},s);break;case"update":case"create":this.msg_buffer=s;break;default:return r(),!1}this.msg_buffer_callbacks=c}else this.send_sync_message(s,c),this.pending_msgs++}this._buffered_state_diff={}},send_sync_message:function(e,t){var i=this,r=this.constructor.serializers;if(r)for(var s in e)r[s]&&r[s].serialize&&(e[s]=r[s].serialize(e[s],this));n.resolve_promises_dict(e).then(function(e){for(var n=Object.keys(e),r=[],s=[],o=0;o<n.length;o++){var a=n[o],l=e[a];l&&(l.buffer instanceof ArrayBuffer||l instanceof ArrayBuffer)&&(r.push(l),s.push(a),delete e[a])}i.comm.send({method:"backbone",sync_data:e,buffer_keys:s},t,{},r)})["catch"](function(e){return i.pending_msgs--,n.reject("Couldn't send widget sync message",!0)(e)})},save_changes:function(e){this.comm_live&&this.save(this._buffered_state_diff,{patch:!0,callbacks:e})},on_some_change:function(e,t,i){this.on("change",function(){e.some(this.hasChanged,this)&&t.apply(i,arguments)},this)},toJSON:function(e){return"IPY_MODEL_"+this.id}});e.WidgetManager.register_widget_model("WidgetModel",o);var a={initialize:function(e){this.listenTo(this.model,"change",this.update,this),this.listenTo(this.model,"comm:live",function(){this.trigger("comm:live",this)},this),this.listenTo(this.model,"comm:dead",function(){this.trigger("comm:dead",this)},this),this.options=e.options;var t=this;this.displayed=new Promise(function(e,i){t.once("displayed",e)})},update:function(){},create_child_view:function(e,i){return i=t.extend({parent:this},i||{}),this.model.widget_manager.create_view(e,i)["catch"](n.reject("Couldn't create child view",!0))},callbacks:function(){return this.model.callbacks(this)},render:function(){},send:function(e,t){this.model.send(e,this.callbacks(),t)},touch:function(){this.model.save_changes(this.callbacks())},after_displayed:function(e,i){console.log("`WidgetView.after_displayed` is deprecated. Use the WidgetView.displayed promise instead."),this.displayed.then(t.bind(e,i))},remove:function(){h.__super__.remove.apply(this,arguments),this.trigger("remove")}},l={initialize:function(e){a.initialize.apply(this,[e]),this.listenTo(this.model,"change:visible",this.update_visible,this),this.listenTo(this.model,"change:_css",this.update_css,this),this.listenTo(this.model,"change:_dom_classes",function(e,t){var i=e.previous("_dom_classes");this.update_classes(i,t)},this),this.listenTo(this.model,"change:color",function(e,t){this.update_attr("color",t)},this),this.listenTo(this.model,"change:background_color",function(e,t){this.update_attr("background",t)},this),this.listenTo(this.model,"change:width",function(e,t){this.update_attr("width",t)},this),this.listenTo(this.model,"change:height",function(e,t){this.update_attr("height",t)},this),this.listenTo(this.model,"change:border_color",function(e,t){this.update_attr("border-color",t)},this),this.listenTo(this.model,"change:border_width",function(e,t){this.update_attr("border-width",t)},this),this.listenTo(this.model,"change:border_style",function(e,t){this.update_attr("border-style",t)},this),this.listenTo(this.model,"change:font_style",function(e,t){this.update_attr("font-style",t)},this),this.listenTo(this.model,"change:font_weight",function(e,t){this.update_attr("font-weight",t)},this),this.listenTo(this.model,"change:font_size",function(e,t){this.update_attr("font-size",this._default_px(t))},this),this.listenTo(this.model,"change:font_family",function(e,t){this.update_attr("font-family",t)},this),this.listenTo(this.model,"change:padding",function(e,t){this.update_attr("padding",t)},this),this.listenTo(this.model,"change:margin",function(e,t){this.update_attr("margin",this._default_px(t))},this),this.listenTo(this.model,"change:border_radius",function(e,t){this.update_attr("border-radius",this._default_px(t))},this),this.displayed.then(t.bind(function(){this.update_visible(this.model,this.model.get("visible")),this.update_classes([],this.model.get("_dom_classes")),this.update_attr("color",this.model.get("color")),this.update_attr("background",this.model.get("background_color")),this.update_attr("width",this.model.get("width")),this.update_attr("height",this.model.get("height")),this.update_attr("border-color",this.model.get("border_color")),this.update_attr("border-width",this.model.get("border_width")),this.update_attr("border-style",this.model.get("border_style")),this.update_attr("font-style",this.model.get("font_style")),this.update_attr("font-weight",this.model.get("font_weight")),this.update_attr("font-size",this._default_px(this.model.get("font_size"))),this.update_attr("font-family",this.model.get("font_family")),this.update_attr("padding",this.model.get("padding")),this.update_attr("margin",this._default_px(this.model.get("margin"))),this.update_attr("border-radius",this._default_px(this.model.get("border_radius"))),this.update_css(this.model,this.model.get("_css"))},this))},_default_px:function(e){return e&&/^\d+\.?(\d+)?$/.test(e.trim())?e.trim()+"px":e},update_attr:function(e,t){this.el.style[e]=t},update_visible:function(e,t){switch(t){case null:void 0!==this._old_display&&(this.el.style.display=this._old_display),this.el.style.visibility="hidden";break;case!1:this._old_display=this.el.style.display||"",this.el.style.display="none";break;case!0:void 0!==this._old_display&&(this.el.style.display=this._old_display),this.el.style.visibility=""}},update_css:function(e,i){if(void 0!==i)for(var n=0;n<i.length;n++){var r=i[n][0],s=this.el.querySelectorAll(r)||[this.el];if(s.length>0){var o=i[n][1],a=i[n][2];t.each(s,function(e){e.style[o]=a})}}},update_classes:function(e,i,n){void 0===n&&(n=this.el),t.difference(e,i).map(function(e){n.classList.remove(e)}),t.difference(i,e).map(function(e){n.classList.add(e)})},update_mapped_classes:function(e,t,i,n){var r=i;void 0===r&&(r=this.model.previous(t));var s=e[r]?e[r]:[];r=this.model.get(t);var o=e[r]?e[r]:[];this.update_classes(s,o,n||this.el)},typeset:function(e,t){n.typeset.apply(null,arguments)}},c=function(e,t,i){this.initialize.apply(this,arguments)};t.extend(c.prototype,{initialize:function(e,t,i){this._handler_context=i||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=t||function(e){e.remove()}},update:function(e,t,i,n){var r=i||this._remove_view,s=t||this._create_view;n=n||this._handler_context;for(var o=0;o<e.length&&!(o>=this._models.length||e[o]!==this._models[o]);o++);for(var a=o,l=this.views.splice(a,this.views.length-a),c=0;c<l.length;c++)l[c].then(function(e){r.call(n,e)});for(;o<e.length;o++)this.views.push(Promise.resolve(s.call(n,e[o])));this._models=e.slice()},remove:function(){var e=this;return Promise.all(this.views).then(function(t){for(var i=0;i<e.views.length;i++)e._remove_view.call(e._handler_context,t[i]);e.views=[],e._models=[]})}});var h=i.View.extend(a),u=h.extend(l),d={unpack_models:s,WidgetModel:o,WidgetViewMixin:a,DOMWidgetViewMixin:l,ViewList:c,WidgetView:h,DOMWidgetView:u};return d}),define("nbextensions/widgets/widgets/js/widget_link",["nbextensions/widgets/widgets/js/widget","jquery"],function(e,t){var i=e.WidgetModel.extend({update_value:function(e,t){if(!this.updating){this.updating=!0;try{t[0]&&(t[0].set(t[1],e[0].get(e[1])),t[0].save_changes())}finally{this.updating=!1}}},cleanup:function(){this.source&&(this.stopListening(this.source[0],"change:"+this.source[1],null,this),this.stopListening(this.source[0],"destroy",null,this)),this.target&&(this.stopListening(this.target[0],"change:"+this.target[1],null,this),this.stopListening(this.target[0],"destroy",null,this))}},{serializers:_.extend({target:{deserialize:e.unpack_models},source:{deserialize:e.unpack_models}},e.WidgetModel.serializers)}),n=i.extend({initialize:function(){this.on("change",this.update_bindings,this)},update_bindings:function(){this.cleanup(),this.source=this.get("source"),this.target=this.get("target"),this.source&&(this.listenTo(this.source[0],"change:"+this.source[1],function(){this.update_value(this.source,this.target)},this),this.update_value(this.source,this.target),this.listenToOnce(this.source[0],"destroy",this.cleanup,this)),this.target&&(this.listenTo(this.target[0],"change:"+this.target[1],function(){this.update_value(this.target,this.source)},this),this.listenToOnce(this.target[0],"destroy",this.cleanup,this))}}),r=i.extend({initialize:function(){this.on("change",this.update_bindings,this)},update_bindings:function(){this.cleanup(),this.source=this.get("source"),this.target=this.get("target"),this.source&&(this.listenTo(this.source[0],"change:"+this.source[1],function(){this.update_value(this.source,this.target)},this),this.update_value(this.source,this.target),this.listenToOnce(this.source[0],"destroy",this.cleanup,this)),this.target&&this.listenToOnce(this.target[0],"destroy",this.cleanup,this)}});return{LinkModel:n,DirectionalLinkModel:r}}),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");
+function(e){"use strict";var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1||t[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return{end:t[i]};return!1}e.fn.emulateTransitionEnd=function(t){var i=!1,n=this;e(this).one("bsTransitionEnd",function(){i=!0});var r=function(){i||e(n).trigger(e.support.transition.end)};return setTimeout(r,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){"use strict";function t(t){return this.each(function(){var i=e(this),r=i.data("bs.alert");r||i.data("bs.alert",r=new n(this)),"string"==typeof t&&r[t].call(i)})}var i='[data-dismiss="alert"]',n=function(t){e(t).on("click",i,this.close)};n.VERSION="3.3.6",n.TRANSITION_DURATION=150,n.prototype.close=function(t){function i(){o.detach().trigger("closed.bs.alert").remove()}var r=e(this),s=r.attr("data-target");s||(s=r.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var o=e(s);t&&t.preventDefault(),o.length||(o=r.closest(".alert")),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",i).emulateTransitionEnd(n.TRANSITION_DURATION):i())};var r=e.fn.alert;e.fn.alert=t,e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.bs.alert.data-api",i,n.prototype.close)}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.button"),s="object"==typeof t&&t;r||n.data("bs.button",r=new i(this,s)),"toggle"==t?r.toggle():t&&r.setState(t)})}var i=function(t,n){this.$element=e(t),this.options=e.extend({},i.DEFAULTS,n),this.isLoading=!1};i.VERSION="3.3.6",i.DEFAULTS={loadingText:"loading..."},i.prototype.setState=function(t){var i="disabled",n=this.$element,r=n.is("input")?"val":"html",s=n.data();t+="Text",null==s.resetText&&n.data("resetText",n[r]()),setTimeout(e.proxy(function(){n[r](null==s[t]?this.options[t]:s[t]),"loadingText"==t?(this.isLoading=!0,n.addClass(i).attr(i,i)):this.isLoading&&(this.isLoading=!1,n.removeClass(i).removeAttr(i))},this),0)},i.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(e=!1),t.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(e=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),e&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=t,e.fn.button.Constructor=i,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(i){var n=e(i.target);n.hasClass("btn")||(n=n.closest(".btn")),t.call(n,"toggle"),e(i.target).is('input[type="radio"]')||e(i.target).is('input[type="checkbox"]')||i.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){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.carousel"),s=e.extend({},i.DEFAULTS,n.data(),"object"==typeof t&&t),o="string"==typeof t?t:s.slide;r||n.data("bs.carousel",r=new i(this,s)),"number"==typeof t?r.to(t):o?r[o]():s.interval&&r.pause().cycle()})}var i=function(t,i){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,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))};i.VERSION="3.3.6",i.TRANSITION_DURATION=600,i.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},i.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()}},i.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},i.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},i.prototype.getItemForDirection=function(e,t){var i=this.getItemIndex(t),n="prev"==e&&0===i||"next"==e&&i==this.$items.length-1;if(n&&!this.options.wrap)return t;var r="prev"==e?-1:1,s=(i+r)%this.$items.length;return this.$items.eq(s)},i.prototype.to=function(e){var t=this,i=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)}):i==e?this.pause().cycle():this.slide(e>i?"next":"prev",this.$items.eq(e))},i.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},i.prototype.next=function(){return this.sliding?void 0:this.slide("next")},i.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},i.prototype.slide=function(t,n){var r=this.$element.find(".item.active"),s=n||this.getItemForDirection(t,r),o=this.interval,a="next"==t?"left":"right",l=this;if(s.hasClass("active"))return this.sliding=!1;var c=s[0],h=e.Event("slide.bs.carousel",{relatedTarget:c,direction:a});if(this.$element.trigger(h),!h.isDefaultPrevented()){if(this.sliding=!0,o&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var u=e(this.$indicators.children()[this.getItemIndex(s)]);u&&u.addClass("active")}var d=e.Event("slid.bs.carousel",{relatedTarget:c,direction:a});return e.support.transition&&this.$element.hasClass("slide")?(s.addClass(t),s[0].offsetWidth,r.addClass(a),s.addClass(a),r.one("bsTransitionEnd",function(){s.removeClass([t,a].join(" ")).addClass("active"),r.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(d)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(r.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(d)),o&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=t,e.fn.carousel.Constructor=i,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this};var r=function(i){var n,r=e(this),s=e(r.attr("data-target")||(n=r.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var o=e.extend({},s.data(),r.data()),a=r.attr("data-slide-to");a&&(o.interval=!1),t.call(s,o),a&&s.data("bs.carousel").to(a),i.preventDefault()}};e(document).on("click.bs.carousel.data-api","[data-slide]",r).on("click.bs.carousel.data-api","[data-slide-to]",r),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var i=e(this);t.call(i,i.data())})})}(jQuery),+function(e){"use strict";function t(t){var i,n=t.attr("data-target")||(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return e(n)}function i(t){return this.each(function(){var i=e(this),r=i.data("bs.collapse"),s=e.extend({},n.DEFAULTS,i.data(),"object"==typeof t&&t);!r&&s.toggle&&/show|hide/.test(t)&&(s.toggle=!1),r||i.data("bs.collapse",r=new n(this,s)),"string"==typeof t&&r[t]()})}var n=function(t,i){this.$element=e(t),this.options=e.extend({},n.DEFAULTS,i),this.$trigger=e('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][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()};n.VERSION="3.3.6",n.TRANSITION_DURATION=350,n.DEFAULTS={toggle:!0},n.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},n.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,r=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(r&&r.length&&(t=r.data("bs.collapse"),t&&t.transitioning))){var s=e.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){r&&r.length&&(i.call(r,"hide"),t||r.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 a=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return a.call(this);var l=e.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",e.proxy(a,this)).emulateTransitionEnd(n.TRANSITION_DURATION)[o](this.$element[0][l])}}}},n.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 i=this.dimension();this.$element[i](this.$element[i]())[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 r=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return e.support.transition?void this.$element[i](0).one("bsTransitionEnd",e.proxy(r,this)).emulateTransitionEnd(n.TRANSITION_DURATION):r.call(this)}}},n.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},n.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(i,n){var r=e(n);this.addAriaAndCollapsedClass(t(r),r)},this)).end()},n.prototype.addAriaAndCollapsedClass=function(e,t){var i=e.hasClass("in");e.attr("aria-expanded",i),t.toggleClass("collapsed",!i).attr("aria-expanded",i)};var r=e.fn.collapse;e.fn.collapse=i,e.fn.collapse.Constructor=n,e.fn.collapse.noConflict=function(){return e.fn.collapse=r,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(n){var r=e(this);r.attr("data-target")||n.preventDefault();var s=t(r),o=s.data("bs.collapse"),a=o?"toggle":r.data();i.call(s,a)})}(jQuery),+function(e){"use strict";function t(t){var i=t.attr("data-target");i||(i=t.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var n=i&&e(i);return n&&n.length?n:t.parent()}function i(i){i&&3===i.which||(e(r).remove(),e(s).each(function(){var n=e(this),r=t(n),s={relatedTarget:this};r.hasClass("open")&&(i&&"click"==i.type&&/input|textarea/i.test(i.target.tagName)&&e.contains(r[0],i.target)||(r.trigger(i=e.Event("hide.bs.dropdown",s)),i.isDefaultPrevented()||(n.attr("aria-expanded","false"),r.removeClass("open").trigger(e.Event("hidden.bs.dropdown",s)))))}))}function n(t){return this.each(function(){var i=e(this),n=i.data("bs.dropdown");n||i.data("bs.dropdown",n=new o(this)),"string"==typeof t&&n[t].call(i)})}var r=".dropdown-backdrop",s='[data-toggle="dropdown"]',o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.VERSION="3.3.6",o.prototype.toggle=function(n){var r=e(this);if(!r.is(".disabled, :disabled")){var s=t(r),o=s.hasClass("open");if(i(),!o){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&e(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(e(this)).on("click",i);var a={relatedTarget:this};if(s.trigger(n=e.Event("show.bs.dropdown",a)),n.isDefaultPrevented())return;r.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger(e.Event("shown.bs.dropdown",a))}return!1}},o.prototype.keydown=function(i){if(/(38|40|27|32)/.test(i.which)&&!/input|textarea/i.test(i.target.tagName)){var n=e(this);if(i.preventDefault(),i.stopPropagation(),!n.is(".disabled, :disabled")){var r=t(n),o=r.hasClass("open");if(!o&&27!=i.which||o&&27==i.which)return 27==i.which&&r.find(s).trigger("focus"),n.trigger("click");var a=" li:not(.disabled):visible a",l=r.find(".dropdown-menu"+a);if(l.length){var c=l.index(i.target);38==i.which&&c>0&&c--,40==i.which&&c<l.length-1&&c++,~c||(c=0),l.eq(c).trigger("focus")}}}};var a=e.fn.dropdown;e.fn.dropdown=n,e.fn.dropdown.Constructor=o,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=a,this},e(document).on("click.bs.dropdown.data-api",i).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",".dropdown-menu",o.prototype.keydown)}(jQuery),+function(e){"use strict";function t(t,n){return this.each(function(){var r=e(this),s=r.data("bs.modal"),o=e.extend({},i.DEFAULTS,r.data(),"object"==typeof t&&t);s||r.data("bs.modal",s=new i(this,o)),"string"==typeof t?s[t](n):o.show&&s.show(n)})}var i=function(t,i){this.options=i,this.$body=e(document.body),this.$element=e(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};i.VERSION="3.3.6",i.TRANSITION_DURATION=300,i.BACKDROP_TRANSITION_DURATION=150,i.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},i.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},i.prototype.show=function(t){var n=this,r=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(r),this.isShown||r.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.$dialog.on("mousedown.dismiss.bs.modal",function(){n.$element.one("mouseup.dismiss.bs.modal",function(t){e(t.target).is(n.$element)&&(n.ignoreBackdropClick=!0)})}),this.backdrop(function(){var r=e.support.transition&&n.$element.hasClass("fade");n.$element.parent().length||n.$element.appendTo(n.$body),n.$element.show().scrollTop(0),n.adjustDialog(),r&&n.$element[0].offsetWidth,n.$element.addClass("in"),n.enforceFocus();var s=e.Event("shown.bs.modal",{relatedTarget:t});r?n.$dialog.one("bsTransitionEnd",function(){n.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(i.TRANSITION_DURATION):n.$element.trigger("focus").trigger(s)}))},i.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").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(i.TRANSITION_DURATION):this.hideModal())},i.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))},i.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")},i.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},i.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")})},i.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},i.prototype.backdrop=function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=e.support.transition&&r;if(this.$backdrop=e(document.createElement("div")).addClass("modal-backdrop "+r).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){n.removeBackdrop(),t&&t()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):o()}else t&&t()},i.prototype.handleUpdate=function(){this.adjustDialog()},i.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:""})},i.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},i.prototype.checkScrollbar=function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.scrollbarWidth=this.measureScrollbar()},i.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},i.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},i.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 n=e.fn.modal;e.fn.modal=t,e.fn.modal.Constructor=i,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(i){var n=e(this),r=n.attr("href"),s=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},s.data(),n.data());n.is("a")&&i.preventDefault(),s.one("show.bs.modal",function(e){e.isDefaultPrevented()||s.one("hidden.bs.modal",function(){n.is(":visible")&&n.trigger("focus")})}),t.call(s,o,this)})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.tooltip"),s="object"==typeof t&&t;(r||!/destroy|hide/.test(t))&&(r||n.data("bs.tooltip",r=new i(this,s)),"string"==typeof t&&r[t]())})}var i=function(e,t){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",e,t)};i.VERSION="3.3.6",i.TRANSITION_DURATION=150,i.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}},i.prototype.init=function(t,i,n){if(this.enabled=!0,this.type=t,this.$element=e(i),this.options=this.getOptions(n),this.$viewport=this.options.viewport&&e(e.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var r=this.options.trigger.split(" "),s=r.length;s--;){var o=r[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=o){var a="hover"==o?"mouseenter":"focusin",l="hover"==o?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.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},i.prototype.getDelegateOptions=function(){var t={},i=this.getDefaults();return this._options&&e.each(this._options,function(e,n){i[e]!=n&&(t[e]=n)}),t},i.prototype.enter=function(t){var i=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,i)),t instanceof e.Event&&(i.inState["focusin"==t.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState?void(i.hoverState="in"):(clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show())},i.prototype.isInStateTrue=function(){for(var e in this.inState)if(this.inState[e])return!0;return!1},i.prototype.leave=function(t){var i=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,i)),t instanceof e.Event&&(i.inState["focusout"==t.type?"focus":"hover"]=!1),i.isInStateTrue()?void 0:(clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide())},i.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var n=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!n)return;var r=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 a="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(a);c&&(a=a.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(a).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var h=this.getPosition(),u=s[0].offsetWidth,d=s[0].offsetHeight;if(c){var p=a,f=this.getPosition(this.$viewport);a="bottom"==a&&h.bottom+d>f.bottom?"top":"top"==a&&h.top-d<f.top?"bottom":"right"==a&&h.right+u>f.width?"left":"left"==a&&h.left-u<f.left?"right":a,s.removeClass(p).addClass(a)}var m=this.getCalculatedOffset(a,h,u,d);this.applyPlacement(m,a);var g=function(){var e=r.hoverState;r.$element.trigger("shown.bs."+r.type),r.hoverState=null,"out"==e&&r.leave(r)};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",g).emulateTransitionEnd(i.TRANSITION_DURATION):g()}},i.prototype.applyPlacement=function(t,i){var n=this.tip(),r=n[0].offsetWidth,s=n[0].offsetHeight,o=parseInt(n.css("margin-top"),10),a=parseInt(n.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(a)&&(a=0),t.top+=o,t.left+=a,e.offset.setOffset(n[0],e.extend({using:function(e){n.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),n.addClass("in");var l=n[0].offsetWidth,c=n[0].offsetHeight;"top"==i&&c!=s&&(t.top=t.top+s-c);var h=this.getViewportAdjustedDelta(i,t,l,c);h.left?t.left+=h.left:t.top+=h.top;var u=/top|bottom/.test(i),d=u?2*h.left-r+l:2*h.top-s+c,p=u?"offsetWidth":"offsetHeight";n.offset(t),this.replaceArrow(d,n[0][p],u)},i.prototype.replaceArrow=function(e,t,i){this.arrow().css(i?"left":"top",50*(1-e/t)+"%").css(i?"top":"left","")},i.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")},i.prototype.hide=function(t){function n(){"in"!=r.hoverState&&s.detach(),r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type),t&&t()}var r=this,s=e(this.$tip),o=e.Event("hide.bs."+this.type);return this.$element.trigger(o),o.isDefaultPrevented()?void 0:(s.removeClass("in"),e.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",n).emulateTransitionEnd(i.TRANSITION_DURATION):n(),this.hoverState=null,this)},i.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","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(t){t=t||this.$element;var i=t[0],n="BODY"==i.tagName,r=i.getBoundingClientRect();null==r.width&&(r=e.extend({},r,{width:r.right-r.left,height:r.bottom-r.top}));var s=n?{top:0,left:0}:t.offset(),o={scroll:n?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},a=n?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},r,o,a,s)},i.prototype.getCalculatedOffset=function(e,t,i,n){return"bottom"==e?{top:t.top+t.height,left:t.left+t.width/2-i/2}:"top"==e?{top:t.top-n,left:t.left+t.width/2-i/2}:"left"==e?{top:t.top+t.height/2-n/2,left:t.left-i}:{top:t.top+t.height/2-n/2,left:t.left+t.width}},i.prototype.getViewportAdjustedDelta=function(e,t,i,n){var r={top:0,left:0};if(!this.$viewport)return r;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var a=t.top-s-o.scroll,l=t.top+s-o.scroll+n;a<o.top?r.top=o.top-a:l>o.top+o.height&&(r.top=o.top+o.height-l)}else{var c=t.left-s,h=t.left+s+i;c<o.left?r.left=o.left-c:h>o.right&&(r.left=o.left+o.width-h)}return r},i.prototype.getTitle=function(){var e,t=this.$element,i=this.options;return e=t.attr("data-original-title")||("function"==typeof i.title?i.title.call(t[0]):i.title)},i.prototype.getUID=function(e){do e+=~~(1e6*Math.random());while(document.getElementById(e));return e},i.prototype.tip=function(){if(!this.$tip&&(this.$tip=e(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(t){var i=this;t&&(i=e(t.currentTarget).data("bs."+this.type),i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,i))),t?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)},i.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type),e.$tip&&e.$tip.detach(),e.$tip=null,e.$arrow=null,e.$viewport=null})};var n=e.fn.tooltip;e.fn.tooltip=t,e.fn.tooltip.Constructor=i,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.popover"),s="object"==typeof t&&t;(r||!/destroy|hide/.test(t))&&(r||n.data("bs.popover",r=new i(this,s)),"string"==typeof t&&r[t]())})}var i=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");i.VERSION="3.3.6",i.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>'}),i.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),i.prototype.constructor=i,i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),i=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof i?"html":"append":"text"](i),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},i.prototype.hasContent=function(){return this.getTitle()||this.getContent()},i.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)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var n=e.fn.popover;e.fn.popover=t,e.fn.popover.Constructor=i,e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(jQuery),+function(e){"use strict";function t(i,n){this.$body=e(document.body),this.$scrollElement=e(e(i).is(document.body)?window:i),this.options=e.extend({},t.DEFAULTS,n),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e.proxy(this.process,this)),this.refresh(),this.process()}function i(i){return this.each(function(){var n=e(this),r=n.data("bs.scrollspy"),s="object"==typeof i&&i;r||n.data("bs.scrollspy",r=new t(this,s)),"string"==typeof i&&r[i]()})}t.VERSION="3.3.6",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=this,i="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),e.isWindow(this.$scrollElement[0])||(i="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=e(this),r=t.data("target")||t.attr("href"),s=/^#./.test(r)&&e(r);return s&&s.length&&s.is(":visible")&&[[s[i]().top+n,r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),n=this.options.offset+i-this.$scrollElement.height(),r=this.offsets,s=this.targets,o=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),t>=n)return o!=(e=s[s.length-1])&&this.activate(e);if(o&&t<r[0])return this.activeTarget=null,this.clear();for(e=r.length;e--;)o!=s[e]&&t>=r[e]&&(void 0===r[e+1]||t<r[e+1])&&this.activate(s[e])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var i=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(i).parents("li").addClass("active");n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate.bs.scrollspy");
},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var n=e.fn.scrollspy;e.fn.scrollspy=i,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);i.call(t,t.data())})})}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.tab");r||n.data("bs.tab",r=new i(this)),"string"==typeof t&&r[t]()})}var i=function(t){this.element=e(t)};i.VERSION="3.3.6",i.TRANSITION_DURATION=150,i.prototype.show=function(){var t=this.element,i=t.closest("ul:not(.dropdown-menu)"),n=t.data("target");if(n||(n=t.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=i.find(".active:last a"),s=e.Event("hide.bs.tab",{relatedTarget:t[0]}),o=e.Event("show.bs.tab",{relatedTarget:r[0]});if(r.trigger(s),t.trigger(o),!o.isDefaultPrevented()&&!s.isDefaultPrevented()){var a=e(n);this.activate(t.closest("li"),i),this.activate(a,a.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:r[0]})})}}},i.prototype.activate=function(t,n,r){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),a?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),r&&r()}var o=n.find("> .active"),a=r&&e.support.transition&&(o.length&&o.hasClass("fade")||!!n.find("> .fade").length);o.length&&a?o.one("bsTransitionEnd",s).emulateTransitionEnd(i.TRANSITION_DURATION):s(),o.removeClass("in")};var n=e.fn.tab;e.fn.tab=t,e.fn.tab.Constructor=i,e.fn.tab.noConflict=function(){return e.fn.tab=n,this};var r=function(i){i.preventDefault(),t.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',r).on("click.bs.tab.data-api",'[data-toggle="pill"]',r)}(jQuery),+function(e){"use strict";function t(t){return this.each(function(){var n=e(this),r=n.data("bs.affix"),s="object"==typeof t&&t;r||n.data("bs.affix",r=new i(this,s)),"string"==typeof t&&r[t]()})}var i=function(t,n){this.options=e.extend({},i.DEFAULTS,n),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=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.6",i.RESET="affix affix-top affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(e,t,i,n){var r=this.$target.scrollTop(),s=this.$element.offset(),o=this.$target.height();if(null!=i&&"top"==this.affixed)return i>r?"top":!1;if("bottom"==this.affixed)return null!=i?r+this.unpin<=s.top?!1:"bottom":e-n>=r+o?!1:"bottom";var a=null==this.affixed,l=a?r:s.top,c=a?o:t;return null!=i&&i>=r?"top":null!=n&&l+c>=e-n?"bottom":!1},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("affix");var e=this.$target.scrollTop(),t=this.$element.offset();return this.pinnedOffset=t.top-e},i.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),n=this.options.offset,r=n.top,s=n.bottom,o=Math.max(e(document).height(),e(document.body).height());"object"!=typeof n&&(s=r=n),"function"==typeof r&&(r=n.top(this.$element)),"function"==typeof s&&(s=n.bottom(this.$element));var a=this.getState(o,t,r,s);if(this.affixed!=a){null!=this.unpin&&this.$element.css("top","");var l="affix"+(a?"-"+a:""),c=e.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=a,this.unpin="bottom"==a?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==a&&this.$element.offset({top:o-t-s})}};var n=e.fn.affix;e.fn.affix=t,e.fn.affix.Constructor=i,e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var i=e(this),n=i.data();n.offset=n.offset||{},null!=n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!=n.offsetTop&&(n.offset.top=n.offsetTop),t.call(i,n)})})}(jQuery),define("bootstrap",["jquery"],function(e){return function(){var t;return t||e.bootstrap}}(this)),define("nbextensions/widgets/widgets/js/widget_bool",["nbextensions/widgets/widgets/js/widget","jquery","bootstrap"],function(e,t){var i=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-checkbox"),this.$label=t("<div />").addClass("widget-label").appendTo(this.$el).hide(),this.$checkbox=t("<input />").attr("type","checkbox").appendTo(this.$el).click(t.proxy(this.handle_click,this)),this.update()},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$checkbox.css(e,t)},handle_click:function(){var e=this.model.get("value");this.model.set("value",!e,{updated_view:this}),this.touch()},update:function(e){if(this.$checkbox.prop("checked",this.model.get("value")),void 0===e||e.updated_view!=this){this.$checkbox.prop("disabled",this.model.get("disabled"));var t=this.model.get("description");0===t.trim().length?this.$label.hide():(this.typeset(this.$label,t),this.$label.show())}return i.__super__.update.apply(this)}}),n=e.DOMWidgetView.extend({render:function(){var e=this;this.setElement(t("<button />").addClass("btn btn-default").attr("type","button").on("click",function(t){t.preventDefault(),e.handle_click()})),this.$el.attr("data-toggle","tooltip"),this.listenTo(this.model,"change:button_style",function(e,t){this.update_button_style()},this),this.update_button_style(""),this.update()},update_button_style:function(e){var t={primary:["btn-primary"],success:["btn-success"],info:["btn-info"],warning:["btn-warning"],danger:["btn-danger"]};this.update_mapped_classes(t,"button_style",e)},update:function(e){if(this.model.get("value")?this.$el.addClass("active"):this.$el.removeClass("active"),void 0===e||e.updated_view!=this){this.$el.prop("disabled",this.model.get("disabled")),this.$el.attr("title",this.model.get("tooltip"));var i=this.model.get("description"),r=this.model.get("icon");0===i.trim().length&&0===r.trim().length?this.$el.html("&nbsp;"):(this.$el.text(i),t('<i class="fa"></i>').prependTo(this.$el).addClass(r))}return n.__super__.update.apply(this)},handle_click:function(e){var t=this.model.get("value");this.model.set("value",!t,{updated_view:this}),this.touch()}}),r=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-valid"),this.listenTo(this.model,"change",this.update,this),this.update()},update:function(){var e,i,n;this.model.get("value")?(e="fa-check",i="green",n=""):(e="fa-close",i="red",n=this.model.get("readout")),this.$el.text(n),t('<i class="fa"></i>').prependTo(this.$el).addClass(e);var r=this;this.displayed.then(function(){r.$el.css("color",i)})}});return{CheckboxView:i,ToggleButtonView:n,ValidView:r}}),define("nbextensions/widgets/widgets/js/widget_button",["nbextensions/widgets/widgets/js/widget","jquery","bootstrap"],function(e,t){var i=e.DOMWidgetView.extend({render:function(){this.setElement(t("<button />").addClass("btn btn-default")),this.$el.attr("data-toggle","tooltip"),this.listenTo(this.model,"change:button_style",function(e,t){this.update_button_style()},this),this.update_button_style(""),this.update()},update:function(){this.$el.prop("disabled",this.model.get("disabled")),this.$el.attr("title",this.model.get("tooltip"));var e=this.model.get("description"),n=this.model.get("icon");return 0===e.trim().length&&0===n.trim().length?this.$el.html("&nbsp;"):(this.$el.text(e),t('<i class="fa"></i>').prependTo(this.$el).addClass(n)),i.__super__.update.apply(this)},update_button_style:function(e){var t={primary:["btn-primary"],success:["btn-success"],info:["btn-info"],warning:["btn-warning"],danger:["btn-danger"]};this.update_mapped_classes(t,"button_style",e)},events:{click:"_handle_click"},_handle_click:function(){this.send({event:"click"})}});return{ButtonView:i}}),define("nbextensions/widgets/widgets/js/widget_box",["nbextensions/widgets/widgets/js/widget","jqueryui","underscore","base/js/utils","bootstrap"],function(e,t,i,n){"use strict";var r=e.WidgetModel.extend({},{serializers:i.extend({children:{deserialize:e.unpack_models}},e.WidgetModel.serializers)}),s=e.WidgetModel.extend({},{serializers:i.extend({child:{deserialize:e.unpack_models}},e.WidgetModel.serializers)}),o=e.WidgetView.extend({initialize:function(){o.__super__.initialize.apply(this,arguments),this.$box=this.$el,this.child_promise=Promise.resolve()},render:function(){var e=this.set_child(this.model.get("child"));return this.listenTo(this.model,"change:child",function(e,t){this.set_child(t)}),e},remove:function(){o.__super__.remove.apply(this,arguments);var e=this;this.child_promise.then(function(){e.child&&e.child.remove()})},set_child:function(e){if(this.child&&this.child.remove(),e){var t=this;this.child_promise=this.child_promise.then(function(){return t.create_child_view(e).then(function(e){return 0===t.$box.length?void console.error("Widget place holder does not exist"):(t.$box.empty().append(e.el),t.displayed.then(function(){e.trigger("displayed")}),t.child=e,void t.trigger("child:created"))})["catch"](n.reject("Couldn't add child view to proxy",!0))})}return this.child_promise}}),a=o.extend({initialize:function(){a.__super__.initialize.apply(this,arguments),this.update_selector(this.model,this.model.get("selector")),this.listenTo(this.model,"change:selector",this.update_selector)},update_selector:function(e,i){this.$box=i?t(i):this.$el,this.set_child(this.model.get("child"))}}),l=e.DOMWidgetView.extend({initialize:function(){l.__super__.initialize.apply(this,arguments),this.children_views=new e.ViewList(this.add_child_model,null,this),this.listenTo(this.model,"change:children",function(e,t){this.children_views.update(t)},this),this.listenTo(this.model,"change:overflow_x",this.update_overflow_x,this),this.listenTo(this.model,"change:overflow_y",this.update_overflow_y,this),this.listenTo(this.model,"change:box_style",this.update_box_style,this)},update_attr:function(e,t){this.$box.css(e,t)},render:function(){this.$box=this.$el,this.$box.addClass("widget-box"),this.children_views.update(this.model.get("children")),this.update_overflow_x(),this.update_overflow_y(),this.update_box_style("")},update_overflow_x:function(){this.$box.css("overflow-x",this.model.get("overflow_x"))},update_overflow_y:function(){this.$box.css("overflow-y",this.model.get("overflow_y"))},update_box_style:function(e){var t={success:["alert","alert-success"],info:["alert","alert-info"],warning:["alert","alert-warning"],danger:["alert","alert-danger"]};this.update_mapped_classes(t,"box_style",e,this.$box[0])},add_child_model:function(e){var i=this,r=t("<div/>");return i.$box.append(r),this.create_child_view(e).then(function(e){return r.replaceWith(e.el),i.displayed.then(function(){e.trigger("displayed")}),e})["catch"](n.reject("Couldn't add child view to box",!0))},remove:function(){l.__super__.remove.apply(this,arguments),this.children_views.remove()}}),c=l.extend({render:function(){c.__super__.render.apply(this),this.listenTo(this.model,"change:orientation",this.update_orientation,this),this.listenTo(this.model,"change:flex",this._flex_changed,this),this.listenTo(this.model,"change:pack",this._pack_changed,this),this.listenTo(this.model,"change:align",this._align_changed,this),this._flex_changed(),this._pack_changed(),this._align_changed(),this.update_orientation()},update_orientation:function(){var e=this.model.get("orientation");"vertical"==e?this.$box.removeClass("hbox").addClass("vbox"):this.$box.removeClass("vbox").addClass("hbox")},_flex_changed:function(){this.model.previous("flex")&&this.$box.removeClass("box-flex"+this.model.previous("flex")),this.$box.addClass("box-flex"+this.model.get("flex"))},_pack_changed:function(){this.model.previous("pack")&&this.$box.removeClass(this.model.previous("pack")),this.$box.addClass(this.model.get("pack"))},_align_changed:function(){this.model.previous("align")&&this.$box.removeClass("align-"+this.model.previous("align")),this.$box.addClass("align-"+this.model.get("align"))}});return{BoxModel:r,ProxyModel:s,BoxView:l,FlexBoxView:c,ProxyView:o,PlaceProxyView:a}}),define("nbextensions/widgets/widgets/js/widget_int",["nbextensions/widgets/widgets/js/widget","jqueryui","base/js/keyboard","bootstrap"],function(e,t,i){var n=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-slider"),this.$label=t("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$slider=t("<div />").slider({}).addClass("slider"),this.$slider_container=t("<div />").addClass("widget-hslider").append(this.$slider),this.$el.append(this.$slider_container),this.$readout=t("<div/>").appendTo(this.$el).addClass("widget-readout").attr("contentEditable",!0).hide(),this.listenTo(this.model,"change:slider_color",function(e,t){this.$slider.find("a").css("background",t)},this),this.$slider.find("a").css("background",this.model.get("slider_color")),this.update()},update_attr:function(e,t){"color"==e?this.$readout.css(e,t):"font"==e.substring(0,4)?this.$readout.css(e,t):"border"==e.substring(0,6)?(this.$slider.find("a").css(e,t),this.$slider_container.css(e,t)):"width"==e||"height"==e||"background"==e?this.$slider_container.css(e,t):"padding"==e||"margin"==e?this.$el.css(e,t):this.$slider.css(e,t)},update:function(e){if(void 0===e||e.updated_view!=this){var t=["step","disabled"],i=this;i.$slider.slider({}),_.each(t,function(e,t){var n=i.model.get(e);void 0!==n&&i.$slider.slider("option",e,n)});var r=this.model.get("max"),s=this.model.get("min");r>=s&&(void 0!==r&&this.$slider.slider("option","max",r),void 0!==s&&this.$slider.slider("option","min",s));var o=this.model.get("_range");void 0!==o&&this.$slider.slider("option","range",o);var a=this.model.get("orientation"),s=this.model.get("min"),r=this.model.get("max");this.model.get("_range")?this.$slider.slider("option","values",[s,s]):this.$slider.slider("option","value",s),this.$slider.slider("option","orientation",a);var l=this.model.get("value");this.model.get("_range")?(this.$slider.slider("option","values",l),this.$readout.text(l.join("-"))):(l>r?l=r:s>l&&(l=s),this.$slider.slider("option","value",l),this.$readout.text(l)),this.model.get("value")!=l&&(this.model.set("value",l,{updated_view:this}),this.touch()),"vertical"==a?(this.$slider_container.removeClass("widget-hslider").addClass("widget-vslider"),this.$el.removeClass("widget-hbox").addClass("widget-vbox")):(this.$slider_container.removeClass("widget-vslider").addClass("widget-hslider"),this.$el.removeClass("widget-vbox").addClass("widget-hbox"));var c=this.model.get("description");0===c.length?this.$label.hide():(this.typeset(this.$label,c),this.$label.show());var h=this.model.get("readout");h?this.$readout.show():this.$readout.hide()}return n.__super__.update.apply(this)},events:{slide:"handleSliderChange","blur [contentEditable=true]":"handleTextChange","keydown [contentEditable=true]":"handleKeyDown"},handleKeyDown:function(e){e.keyCode==i.keycodes.enter&&(e.preventDefault(),this.handleTextChange())},handleTextChange:function(){var e=this.$readout.text(),t=this.model.get("min"),i=this.model.get("max");if(this.model.get("_range")){var n=this._range_regex.exec(e);if(n){var r=[this._parse_value(n[1]),this._parse_value(n[2])];isNaN(r[0])||isNaN(r[1])||r[0]>r[1]?this.$readout.text(this.model.get("value").join("-")):(r=[Math.max(Math.min(r[0],i),t),Math.max(Math.min(r[1],i),t)],r[0]!=this.model.get("value")[0]||r[1]!=this.model.get("value")[1]?(this.$readout.text(r.join("-")),this.model.set("value",r,{updated_view:this}),this.touch()):this.$readout.text(this.model.get("value").join("-")))}else this.$readout.text(this.model.get("value").join("-"))}else{var s=this._parse_value(e);isNaN(s)?this.$readout.text(this.model.get("value")):(s=Math.max(Math.min(s,i),t),s!=this.model.get("value")?(this.$readout.text(s),this.model.set("value",s,{updated_view:this}),this.touch()):this.$readout.text(this.model.get("value")))}},_parse_value:parseInt,_range_regex:/^\s*([+-]?\d+)\s*[-:]\s*([+-]?\d+)/,handleSliderChange:function(e,t){var i;this.model.get("_range")?(i=t.values.map(this._validate_slide_value),this.$readout.text(i.join("-"))):(i=this._validate_slide_value(t.value),this.$readout.text(i)),this.model.set("value",i,{updated_view:this}),this.touch()},_validate_slide_value:function(e){return~~e}}),r=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-numeric-text"),this.$label=t("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$textbox=t('<input type="text" />').addClass("form-control").addClass("widget-numeric-text").appendTo(this.$el),this.update()},update:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.get("value");this._parse_value(this.$textbox.val())!=t&&this.$textbox.val(t),this.model.get("disabled")?this.$textbox.attr("disabled","disabled"):this.$textbox.removeAttr("disabled");var i=this.model.get("description");0===i.length?this.$label.hide():(this.typeset(this.$label,i),this.$label.show())}return r.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$textbox.css(e,t)},events:{"keyup input":"handleChanging","paste input":"handleChanging","cut input":"handleChanging","change input":"handleChanged"},handleChanging:function(e){var t=0,i=e.target.value.trim();""!==i&&(["-","-.",".","+.","+"].indexOf(i)>=0||(t=this._parse_value(e.target.value)),isNaN(t)?e.target.value=this.model.get("value"):isNaN(t)||(void 0!==this.model.get("max")&&(t=Math.min(this.model.get("max"),t)),void 0!==this.model.get("min")&&(t=Math.max(this.model.get("min"),t)),t!=this.model.get("value")&&(this.model.set("value",t,{updated_view:this}),this.touch())))},handleChanged:function(e){(""===e.target.value.trim()||e.target.value!==this.model.get("value"))&&(e.target.value=this.model.get("value"))},_parse_value:parseInt}),s=e.DOMWidgetView.extend({render:function(){this.$label=t("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$progress=t("<div />").addClass("progress").css("position","relative").appendTo(this.$el),this.$bar=t("<div />").addClass("progress-bar").css({position:"absolute",bottom:0,left:0}).appendTo(this.$progress),this.update(),this.listenTo(this.model,"change:bar_style",function(e,t){this.update_bar_style()},this),this.update_bar_style("")},update:function(){var e=this.model.get("value"),t=this.model.get("max"),i=this.model.get("min"),n=this.model.get("orientation"),r=100*(e-i)/(t-i);"horizontal"===n?(this.$el.removeClass("widget-vbox").addClass("widget-hbox"),this.$progress.removeClass("widget-vprogress"),this.$progress.addClass("widget-hprogress"),this.$bar.css({width:r+"%",height:"100%"})):(this.$el.removeClass("widget-hbox").addClass("widget-vbox"),this.$progress.removeClass("widget-hprogress"),this.$progress.addClass("widget-vprogress"),this.$bar.css({width:"100%",height:r+"%"}));var o=this.model.get("description");return 0===o.length?this.$label.hide():(this.typeset(this.$label,o),this.$label.show()),s.__super__.update.apply(this)},update_bar_style:function(e){var t={success:["progress-bar-success"],info:["progress-bar-info"],warning:["progress-bar-warning"],danger:["progress-bar-danger"]};this.update_mapped_classes(t,"bar_style",e,this.$bar[0])},update_attr:function(e,t){"border"==e.substring(0,6)||"width"==e||"height"==e||"background"==e||"margin"==e||"padding"==e?this.$progress.css(e,t):"color"==e?this.$bar.css("background",t):"padding"==e||"margin"==e?this.$el.css(e,t):this.$bar.css(e,t)}});return{IntSliderView:n,IntTextView:r,ProgressView:s}}),define("nbextensions/widgets/widgets/js/widget_float",["nbextensions/widgets/widgets/js/widget","nbextensions/widgets/widgets/js/widget_int"],function(e,t){var i=t.IntSliderView,n=t.IntTextView,r=i.extend({_parse_value:parseFloat,_range_regex:/^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)\s*[-:]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/,_validate_slide_value:function(e){return e}}),s=n.extend({_parse_value:parseFloat});return{FloatSliderView:r,FloatTextView:s}}),define("nbextensions/widgets/widgets/js/widget_image",["nbextensions/widgets/widgets/js/widget","jquery"],function(e,t){var i=e.DOMWidgetView.extend({render:function(){this.setElement(t("<img />")),this.update()},update:function(){var e="data:image/"+this.model.get("format")+";base64,"+this.model.get("_b64value");this.$el.attr("src",e);var t=this.model.get("width");void 0!==t&&t.length>0?this.$el.attr("width",t):this.$el.removeAttr("width");var n=this.model.get("height");return void 0!==n&&n.length>0?this.$el.attr("height",n):this.$el.removeAttr("height"),i.__super__.update.apply(this)}});return{ImageView:i}}),define("nbextensions/widgets/widgets/js/widget_output",["nbextensions/widgets/widgets/js/widget","jquery","notebook/js/outputarea"],function(e,t,i){"use strict";var n=e.DOMWidgetView.extend({initialize:function(e){n.__super__.initialize.apply(this,[e]),this.listenTo(this.model,"msg:custom",this._handle_route_msg,this)},render:function(){this.output_area=new i.OutputArea({selector:this.$el,prompt_area:!1,events:this.model.widget_manager.notebook.events,keyboard_manager:this.model.widget_manager.keyboard_manager});var e=this;this.output_area.element.on("changed",function(){e.model.set("contents",e.output_area.element.html())}),this.listenTo(this.model,"change:contents",function(){var e=this.model.get("contents");this.output_area.element.html()!=e&&this.output_area.element.html(e)},this),this.output_area.element.html(this.model.get("contents"))},_handle_route_msg:function(e){if(e){var t=e.msg_type;"clear_output"==t?this.output_area.handle_clear_output(e):this.output_area.handle_output(e)}}});return{OutputView:n}}),define("nbextensions/widgets/widgets/js/widget_selection",["nbextensions/widgets/widgets/js/widget","base/js/utils","jquery","underscore","bootstrap"],function(e,t,i,n){var r=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-dropdown"),this.$label=i("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$buttongroup=i("<div />").addClass("widget_item").addClass("btn-group").appendTo(this.$el),this.$droplabel=i("<button />").addClass("btn btn-default").addClass("widget-combo-btn").html("&nbsp;").appendTo(this.$buttongroup),this.$dropbutton=i("<button />").addClass("btn btn-default").addClass("dropdown-toggle").addClass("widget-combo-carrot-btn").attr("data-toggle","dropdown").append(i("<span />").addClass("caret")).appendTo(this.$buttongroup),this.$droplist=i("<ul />").addClass("dropdown-menu").appendTo(this.$buttongroup),this.listenTo(this.model,"change:button_style",function(e,t){this.update_button_style()},this),this.update_button_style(""),this.update()},update:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.get("selected_label");0===t.trim().length?this.$droplabel.html("&nbsp;"):this.$droplabel.text(t);var s=this.model.get("_options_labels"),o=i("<ul />").addClass("dropdown-menu");o.attr("style",this.$droplist.attr("style"));var a=this;n.each(s,function(e,t){var n=i('<a href="#"/>').text(e).on("click",i.proxy(a.handle_click,a));o.append(i("<li />").append(n))}),this.$droplist.replaceWith(o),this.$droplist.remove(),this.$droplist=o,this.model.get("disabled")?(this.$buttongroup.attr("disabled","disabled"),this.$droplabel.attr("disabled","disabled"),this.$dropbutton.attr("disabled","disabled"),this.$droplist.attr("disabled","disabled")):(this.$buttongroup.removeAttr("disabled"),this.$droplabel.removeAttr("disabled"),this.$dropbutton.removeAttr("disabled"),this.$droplist.removeAttr("disabled"));var l=this.model.get("description");0===l.length?this.$label.hide():(this.typeset(this.$label,l),this.$label.show())}return r.__super__.update.apply(this)},update_button_style:function(e){var t={primary:["btn-primary"],success:["btn-success"],info:["btn-info"],warning:["btn-warning"],danger:["btn-danger"]};this.update_mapped_classes(t,"button_style",e,this.$droplabel[0]),this.update_mapped_classes(t,"button_style",e,this.$dropbutton[0])},update_attr:function(e,t){"border"==e.substring(0,6)||"background"==e||"color"==e?(this.$droplabel.css(e,t),this.$dropbutton.css(e,t),this.$droplist.css(e,t)):"width"==e?(this.$droplist.css(e,t),this.$droplabel.css(e,t)):"padding"==e?(this.$droplist.css(e,t),this.$buttongroup.css(e,t)):"margin"==e?this.$buttongroup.css(e,t):"height"==e?(this.$droplabel.css(e,t),this.$dropbutton.css(e,t)):"padding"==e||"margin"==e?this.$el.css(e,t):(this.$droplist.css(e,t),this.$droplabel.css(e,t))},handle_click:function(e){this.model.set("selected_label",i(e.target).text(),{updated_view:this}),this.touch(),e.stopPropagation(),e.preventDefault(),this.$buttongroup.removeClass("open")}}),s=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-radio"),this.$label=i("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$container=i("<div />").appendTo(this.$el).addClass("widget-radio-box"),this.update()},update:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.get("_options_labels"),r=this.model.get("disabled"),o=this;n.each(t,function(e,t){var n=' :input[data-value="'+encodeURIComponent(e)+'"]';if(0===o.$el.find(n).length){var s=i("<label />").addClass("radio").text(e).appendTo(o.$container);i("<input />").attr("type","radio").addClass(o.model).val(e).attr("data-value",encodeURIComponent(e)).prependTo(s).on("click",i.proxy(o.handle_click,o))}var a=o.$container.find(n);o.model.get("selected_label")==e?a.prop("checked",!0):a.prop("checked",!1),a.prop("disabled",r)}),this.$container.find("input").each(function(e,r){var s=i(r).val(),o=!1;n.each(t,function(e,t){return e==s?(o=!0,!1):void 0}),o||i(r).parent().remove()});var a=this.model.get("description");0===a.length?this.$label.hide():(this.$label.text(a),this.typeset(this.$label,a),this.$label.show())}return s.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$container.css(e,t)},handle_click:function(e){this.model.set("selected_label",i(e.target).val(),{updated_view:this}),this.touch()}}),o=e.DOMWidgetView.extend({initialize:function(){this._css_state={},o.__super__.initialize.apply(this,arguments)},render:function(){this.$el.addClass("widget-hbox widget-toggle-buttons"),this.$label=i("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$buttongroup=i("<div />").addClass("btn-group").appendTo(this.$el),this.listenTo(this.model,"change:button_style",function(e,t){this.update_button_style()},this),this.update_button_style(""),this.update()},update:function(e){if(void 0===e||e.updated_view!=this){var r,s=this.model.get("_options_labels"),a=this.model.get("icons"),l=this.model.previous("icons")||[],c=this.model.get("disabled"),h=this;n.each(s,function(e,n){r=0!==e.trim().length||a[n]&&0!==a[n].trim().length?t.escape_html(e):"&nbsp;";var s='[data-value="'+encodeURIComponent(e)+'"]',o=h.$buttongroup.find(s),u=o.find(".fa");o.length||(o=i("<button/>").attr("type","button").addClass("btn btn-default").html(r).appendTo(h.$buttongroup).attr("data-value",encodeURIComponent(e)).attr("data-toggle","tooltip").attr("value",e).on("click",i.proxy(h.handle_click,h)),h.update_style_traits(o),u=i('<i class="fa"></i>').prependTo(o)),h.model.get("selected_label")==e?o.addClass("active"):o.removeClass("active"),o.prop("disabled",c),o.attr("title",h.model.get("tooltips")[n]),u.removeClass(l[n]).addClass(a[n])}),this.$buttongroup.find("button").each(function(e,t){var r=i(t).attr("value"),o=!1;n.each(s,function(e,t){return e==r?(o=!0,!1):void 0}),o||i(t).remove()});var u=this.model.get("description");0===u.length?this.$label.hide():(this.$label.text(),this.typeset(this.$label,u),this.$label.show())}return o.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):(this._css_state[e]=t,this.update_style_traits())},update_style_traits:function(e){for(var t in this._css_state)this._css_state.hasOwnProperty(t)&&("margin"==t?this.$buttongroup.css(t,this._css_state[t]):"width"!=t&&(e?e.css(t,this._css_state[t]):this.$buttongroup.find("button").css(t,this._css_state[t])))},update_button_style:function(e){var t={primary:["btn-primary"],success:["btn-success"],info:["btn-info"],warning:["btn-warning"],danger:["btn-danger"]};this.update_mapped_classes(t,"button_style",e,this.$buttongroup.find("button")[0])},handle_click:function(e){this.model.set("selected_label",i(e.target).attr("value"),{updated_view:this}),this.touch()}}),a=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-select"),this.$label=i("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$listbox=i("<select />").addClass("widget-listbox form-control").attr("size",6).appendTo(this.$el).on("change",i.proxy(this.handle_change,this)),this.update()},update:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.get("_options_labels"),r=this;n.each(t,function(e,t){var n='option[data-value="'+encodeURIComponent(e)+'"]';0===r.$listbox.find(n).length&&i("<option />").text(e.replace(/ /g," ")).attr("data-value",encodeURIComponent(e)).val(e).on("click",i.proxy(r.handle_click,r)).appendTo(r.$listbox)}),this.$listbox.val(this.model.get("selected_label"));var s=this.model.get("disabled");this.$listbox.prop("disabled",s),this.$listbox.find("option").each(function(e,r){var s=i(r).val(),o=!1;n.each(t,function(e,t){return e==s?(o=!0,!1):void 0}),o||i(r).remove()});var o=this.model.get("description");0===o.length?this.$label.hide():(this.typeset(this.$label,o),this.$label.show())}return a.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$listbox.css(e,t)},handle_click:function(e){this.$listbox.val(i(e.target).val()).change()},handle_change:function(e){this.model.set("selected_label",this.$listbox.val(),{updated_view:this}),this.touch()}}),l=a.extend({render:function(){return l.__super__.render.apply(this),this.$el.removeClass("widget-select").addClass("widget-select-multiple"),this.$listbox.attr("multiple",!0).on("change",i.proxy(this.handle_change,this)),this.$listbox.val(this.model.get("selected_labels")),this},update:function(){l.__super__.update.apply(this,arguments),this.$listbox.val(this.model.get("selected_labels"))},handle_click:function(){},handle_change:function(e){this.model.set("selected_labels",(this.$listbox.val()||[]).slice(),{updated_view:this}),this.touch()}});return{DropdownView:r,RadioButtonsView:s,ToggleButtonsView:o,SelectView:a,SelectMultipleView:l}}),define("nbextensions/widgets/widgets/js/widget_selectioncontainer",["nbextensions/widgets/widgets/js/widget","base/js/utils","jquery","bootstrap"],function(e,t,i){var n=e.DOMWidgetView.extend({initialize:function(){n.__super__.initialize.apply(this,arguments),this.containers=[],this.model_containers={},this.children_views=new e.ViewList(this.add_child_view,this.remove_child_view,this),this.listenTo(this.model,"change:children",function(e,t){this.children_views.update(t)},this)},render:function(){var e="panel-group"+t.uuid();this.$el.attr("id",e).addClass("panel-group"),this.listenTo(this.model,"change:selected_index",function(e,t,i){this.update_selected_index(i)},this),this.listenTo(this.model,"change:_titles",function(e,t,i){this.update_titles(i)},this),this.on("displayed",function(){this.update_titles()},this),this.children_views.update(this.model.get("children"))},update:function(e){return this.update_titles(),
this.update_selected_index(e),n.__super__.update.apply(this)},update_titles:function(){var e=this.model.get("_titles"),t=this;_.each(e,function(e,i){var n=t.containers[i];void 0!==n&&n.children(".panel-heading").find(".accordion-toggle").text(e)})},update_selected_index:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.previous("selected_index"),i=this.model.get("selected_index");t>=0&&t<this.containers.length&&this.containers[t].children(".panel-collapse").collapse("hide"),i>=0&&i<this.containers.length&&this.containers[i].children(".panel-collapse").collapse("show")}},remove_child_view:function(e){var t=e.model,i=this.model_containers[t.id];this.containers.splice(i.container_index,1),delete this.model_containers[t.id],i.remove()},add_child_view:function(e){var n=this.containers.length,r=t.uuid(),s=i("<div />").addClass("panel panel-default").appendTo(this.$el),o=i("<div />").addClass("panel-heading").appendTo(s),a=this,l=(i("<a />").addClass("accordion-toggle").attr("data-toggle","collapse").attr("data-parent","#"+this.$el.attr("id")).attr("href","#"+r).click(function(e){a.model.set("selected_index",n,{updated_view:a}),a.touch()}).text("Page "+n).appendTo(o),i("<div />",{id:r}).addClass("panel-collapse collapse").appendTo(s)),c=i("<div />").addClass("panel-body").appendTo(l),h=this.containers.push(s)-1;s.container_index=h,this.model_containers[e.id]=s;var u=i("<div/>");return c.append(u),this.create_child_view(e).then(function(e){return u.replaceWith(e.$el),a.update(),a.update_titles(),a.displayed.then(function(){e.trigger("displayed")}),e})["catch"](t.reject("Couldn't add child view to box",!0))},remove:function(){n.__super__.remove.apply(this,arguments),this.children_views.remove()}}),r=e.DOMWidgetView.extend({initialize:function(){r.__super__.initialize.apply(this,arguments),this.containers=[],this.children_views=new e.ViewList(this.add_child_view,this.remove_child_view,this),this.listenTo(this.model,"change:children",function(e,t){this.children_views.update(t)},this)},render:function(){var e="tabs"+t.uuid();this.$tabs=i("<div />",{id:e}).addClass("nav").addClass("nav-tabs").appendTo(this.$el),this.$tab_contents=i("<div />",{id:e+"Content"}).addClass("tab-content").appendTo(this.$el),this.children_views.update(this.model.get("children"))},update_attr:function(e,t){-1!==["padding","margin","height","width"].indexOf(e)?this.$el.css(e,t):this.$tabs.css(e,t)},remove_child_view:function(e){this.containers.splice(e.parent_tab.tab_text_index,1),e.parent_tab.remove(),e.parent_container.remove(),e.remove()},add_child_view:function(e){var n=this.containers.length,r=t.uuid(),s=this,o=i("<li />").css("list-style-type","none").appendTo(this.$tabs),a=i("<a />").attr("href","#"+r).attr("data-toggle","tab").text("Page "+n).appendTo(o).click(function(e){s.model.set("selected_index",n,{updated_view:s}),s.touch(),s.select_page(n)});o.tab_text_index=s.containers.push(a)-1;var l=i("<div />"),c=i("<div />",{id:r}).addClass("tab-pane").addClass("fade").append(l).appendTo(s.$tab_contents);return this.update(),this.create_child_view(e).then(function(e){return l.replaceWith(e.$el),e.parent_tab=o,e.parent_container=c,s.displayed.then(function(){e.trigger("displayed"),s.update()}),e})["catch"](t.reject("Couldn't add child view to box",!0))},update:function(e){return this.update_titles(),this.update_selected_index(e),r.__super__.update.apply(this)},update_titles:function(){var e=this.model.get("_titles"),t=this;_.each(e,function(e,i){var n=t.containers[i];void 0!==n&&n.text(e)})},update_selected_index:function(e){if(void 0===e||e.updated_view!=this){var t=this.model.get("selected_index");t>=0&&t<this.containers.length&&this.select_page(t)}},select_page:function(e){this.$tabs.find("li").removeClass("active"),this.containers[e].tab("show")},remove:function(){r.__super__.remove.apply(this,arguments),this.children_views.remove()}});return{AccordionView:n,TabView:r}}),define("nbextensions/widgets/widgets/js/widget_string",["nbextensions/widgets/widgets/js/widget","jquery","bootstrap"],function(e,t){var i=e.DOMWidgetView.extend({render:function(){this.update()},update:function(){return this.$el.html(this.model.get("value")),i.__super__.update.apply(this)}}),n=e.DOMWidgetView.extend({render:function(){this.update()},update:function(){return this.typeset(this.$el,this.model.get("value")),n.__super__.update.apply(this)}}),r=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-textarea"),this.$label=t("<div />").appendTo(this.$el).addClass("widget-label").hide(),this.$textbox=t("<textarea />").attr("rows",5).addClass("widget-text form-control").appendTo(this.$el),this.update(),this.listenTo(this.model,"msg:custom",t.proxy(this._handle_textarea_msg,this)),this.listenTo(this.model,"change:placeholder",function(e,t,i){this.update_placeholder(t)},this),this.update_placeholder()},_handle_textarea_msg:function(e){"scroll_to_bottom"==e.method&&this.scroll_to_bottom()},update_placeholder:function(e){e||(e=this.model.get("placeholder")),this.$textbox.attr("placeholder",e)},scroll_to_bottom:function(){this.$textbox.scrollTop(this.$textbox[0].scrollHeight)},update:function(e){if(void 0===e||e.updated_view!=this){this.$textbox.val(this.model.get("value"));var t=this.model.get("disabled");this.$textbox.prop("disabled",t);var i=this.model.get("description");0===i.length?this.$label.hide():(this.typeset(this.$label,i),this.$label.show())}return r.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$textbox.css(e,t)},events:{"keyup textarea":"handleChanging","paste textarea":"handleChanging","cut textarea":"handleChanging"},handleChanging:function(e){this.model.set("value",e.target.value,{updated_view:this}),this.touch()}}),s=e.DOMWidgetView.extend({render:function(){this.$el.addClass("widget-hbox widget-text"),this.$label=t("<div />").addClass("widget-label").appendTo(this.$el).hide(),this.$textbox=t('<input type="text" />').addClass("input").addClass("widget-text form-control").appendTo(this.$el),this.update(),this.listenTo(this.model,"change:placeholder",function(e,t,i){this.update_placeholder(t)},this),this.update_placeholder()},update_placeholder:function(e){e||(e=this.model.get("placeholder")),this.$textbox.attr("placeholder",e)},update:function(e){if(void 0===e||e.updated_view!=this){this.$textbox.val()!=this.model.get("value")&&this.$textbox.val(this.model.get("value"));var t=this.model.get("disabled");this.$textbox.prop("disabled",t);var i=this.model.get("description");0===i.length?this.$label.hide():(this.typeset(this.$label,i),this.$label.show())}return s.__super__.update.apply(this)},update_attr:function(e,t){"padding"==e||"margin"==e?this.$el.css(e,t):this.$textbox.css(e,t)},events:{"keyup input":"handleChanging","paste input":"handleChanging","cut input":"handleChanging","keypress input":"handleKeypress","blur input":"handleBlur","focusout input":"handleFocusOut"},handleChanging:function(e){this.model.set("value",e.target.value,{updated_view:this}),this.touch()},handleKeypress:function(e){return 13==e.keyCode?(this.send({event:"submit"}),e.stopPropagation(),e.preventDefault(),!1):void 0},handleBlur:function(e){return null===e.relatedTarget?(e.stopPropagation(),e.preventDefault(),!1):void 0},handleFocusOut:function(e){return null===e.relatedTarget?(e.stopPropagation(),e.preventDefault(),!1):void 0}});return{HTMLView:i,LatexView:n,TextareaView:r,TextView:s}}),define("nbextensions/widgets/widgets/js/widget_controller",["nbextensions/widgets/widgets/js/widget","base/js/utils"],function(e,t){"use strict";var i=e.DOMWidgetView.extend({render:function(){this.$support=$("<div />").css({position:"relative",margin:"1px",width:"16px",height:"16px",border:"1px solid black",background:"lightgray"}).appendTo(this.$el),this.$bar=$("<div />").css({position:"absolute",width:"100%",bottom:0,background:"gray"}).appendTo(this.$support),this.$label=$("<div />").text(this.model.get("description")).css("text-align","center").appendTo(this.$el),this.update()},update:function(){this.$bar.css("height",100*this.model.get("value")+"%")}}),n=e.DOMWidgetView.extend({render:function(){this.$el.css({width:"16px",padding:"4px"}),this.$support=$("<div />").css({position:"relative",margin:"1px",width:"4px",height:"64px",border:"1px solid black",background:"lightgray"}).appendTo(this.$el),this.$bullet=$("<div />").css({position:"absolute",margin:"-4px",width:"10px",height:"10px",background:"gray"}).appendTo(this.$support),this.$label=$("<div />").text(this.model.get("description")).css("text-align","center").appendTo(this.$el),this.update()},update:function(){this.$bullet.css("top",50*(this.model.get("value")+1)+"%")}}),r=e.WidgetModel.extend({initialize:function(){void 0===navigator.getGamepads?(this.readout="This browser does not support gamepads.",console.error(this.readout)):(this.readout="Connect gamepad and press any button.",this.wait_loop())},wait_loop:function(){var e=this.get("index"),t=navigator.getGamepads()[e];if(t){this.index=e;var i=this;this.setup(t).then(function(e){i.set(e),i.save_changes(),window.requestAnimationFrame(i.update_loop.bind(i))})}else window.requestAnimationFrame(this.wait_loop.bind(this))},setup:function(e){this.set({name:e.id,mapping:e.mapping,connected:e.connected,timestamp:e.timestamp});var i=this;return t.resolve_promises_dict({buttons:Promise.all(e.buttons.map(function(e,t){return i._create_button_model(t)})),axes:Promise.all(e.axes.map(function(e,t){return i._create_axis_model(t)}))})},update_loop:function(){var e=this.get("index"),t=navigator.getGamepads()[e];t&&this.index===e?(this.set({timestamp:t.timestamp,connected:t.connected}),this.save_changes(),this.get("buttons").forEach(function(e,i){e.set({value:t.buttons[i].value,pressed:t.buttons[i].pressed}),e.save_changes()}),this.get("axes").forEach(function(e,i){e.set("value",t.axes[i]),e.save_changes()}),window.requestAnimationFrame(this.update_loop.bind(this))):this.reset_gamepad()},reset_gamepad:function(){this.get("buttons").forEach(function(e){e.close()}),this.get("axes").forEach(function(e){e.close()}),this.set({name:"",mapping:"",connected:!1,timestamp:0,buttons:[],axes:[]}),this.save_changes(),window.requestAnimationFrame(this.wait_loop.bind(this))},_create_button_model:function(e){return this.widget_manager.new_widget({model_name:"WidgetModel",widget_class:"ipywidgets.widgets.widget_controller.Button"}).then(function(t){return t.set("description",e),t})},_create_axis_model:function(e){return this.widget_manager.new_widget({model_name:"WidgetModel",widget_class:"ipywidgets.widgets.widget_controller.Axis"}).then(function(t){return t.set("description",e),t})}},{serializers:_.extend({buttons:{deserialize:e.unpack_models},axes:{deserialize:e.unpack_models}},e.WidgetModel.serializers)}),s=e.DOMWidgetView.extend({initialize:function(){s.__super__.initialize.apply(this,arguments),this.button_views=new e.ViewList(this.add_button,null,this),this.listenTo(this.model,"change:buttons",function(e,t){this.button_views.update(t)},this),this.axis_views=new e.ViewList(this.add_axis,null,this),this.listenTo(this.model,"change:axes",function(e,t){this.axis_views.update(t)},this),this.listenTo(this.model,"change:name",this.update_label,this)},render:function(){this.$box=this.$el,this.$label=$("<div />").appendTo(this.$box),this.$axis_box=$("<div />").css("display","flex").appendTo(this.$box),this.$button_box=$("<div />").css("display","flex").appendTo(this.$box),this.button_views.update(this.model.get("buttons")),this.axis_views.update(this.model.get("axes")),this.update_label()},update_label:function(){this.$label.text(this.model.get("name")||this.model.readout)},add_button:function(e){var i=this,n=$("<div/>");return i.$button_box.append(n),this.create_child_view(e).then(function(e){return n.replaceWith(e.el),i.displayed.then(function(){e.trigger("displayed")}),e})["catch"](t.reject("Could not add button view",!0))},add_axis:function(e){var i=this,n=$("<div/>");return i.$axis_box.append(n),this.create_child_view(e).then(function(e){return n.replaceWith(e.el),i.displayed.then(function(){e.trigger("displayed")}),e})["catch"](t.reject("Could not add axis view",!0))},remove:function(){s.__super__.remove.apply(this,arguments),this.button_views.remove(),this.axis_views.remove()}});return{ControllerButton:i,ControllerAxis:n,Controller:r,ControllerView:s}}),define("nbextensions/widgets/widgets/js/init",["nbextensions/widgets/widgets/js/manager","nbextensions/widgets/widgets/js/widget","nbextensions/widgets/widgets/js/widget_link","nbextensions/widgets/widgets/js/widget_bool","nbextensions/widgets/widgets/js/widget_button","nbextensions/widgets/widgets/js/widget_box","nbextensions/widgets/widgets/js/widget_float","nbextensions/widgets/widgets/js/widget_image","nbextensions/widgets/widgets/js/widget_int","nbextensions/widgets/widgets/js/widget_output","nbextensions/widgets/widgets/js/widget_selection","nbextensions/widgets/widgets/js/widget_selectioncontainer","nbextensions/widgets/widgets/js/widget_string","nbextensions/widgets/widgets/js/widget_controller"],function(e,t){for(var i=2;i<arguments.length;i++){var n=arguments[i];for(var r in n)if(n.hasOwnProperty(r)){var s=n[r];s.prototype instanceof t.WidgetModel?e.WidgetManager.register_widget_model(r,s):s.prototype instanceof t.WidgetView&&e.WidgetManager.register_widget_view(r,s)}}return{WidgetManager:e.WidgetManager}}),define("nbextensions/widgets/notebook/js/widgetarea",["jquery","base/js/events"],function(e,t){var i=function(e){this.widget_views=[],this._cell=e,this._widgets_live=!0,this.disposed=!1,this._create_elements(),this._bind_events(),t.trigger("create.WidgetArea",{widgetarea:this,cell:e})};return i.prototype.display_widget_view=function(t){var i=e("<div/>");this.widget_subarea.append(i);var n=this;return t.then(function(e){return n.widget_area.show(),i.replaceWith(e.el),n.widget_views.push(e),e.model.comm_live?n._widget_live(e):n._widget_dead(e),e.on("comm:live",n._widget_live,n),e.on("comm:dead",n._widget_dead,n),e})},i.prototype.dispose=function(){this._clear(),this.disposed=!0},i.prototype._create_elements=function(){var t=e("<div/>").addClass("widget-area").hide();this.widget_area=t;var i=e("<div/>").addClass("prompt").appendTo(t),n=e("<div/>").addClass("widget-subarea").appendTo(t);this.widget_subarea=n;var r=this;e("<button />").addClass("close").html("&times;").click(function(){t.slideUp("",function(){for(var e=0;e<r.widget_views.length;e++){var t=r.widget_views[e];t.remove(),t.off("comm:live",r._widget_live),t.off("comm:dead",r._widget_dead)}r.widget_views=[],n.html("")})}).appendTo(i);if(!this._cell.input)throw new Error("Cell does not have an `input` element.  Is it not a CodeCell?");this._cell.input.after(t)},i.prototype._bind_events=function(){var e=this;t.on("execute.CodeCell",function(t,i){i.cell===e._cell&&e._clear()})},i.prototype._widget_dead=function(e){this._widgets_live&&(this._widgets_live=!1,this.widget_area.addClass("connection-problems"))},i.prototype._widget_live=function(e){if(!this._widgets_live){for(var t=0;t<this.widget_views.length;t++)if(!this.widget_views[t].model.comm_live)return;this._widgets_live=!0,this.widget_area.removeClass("connection-problems")}},i.prototype._clear=function(){for(var e=0;e<this.widget_views.length;e++){var t=this.widget_views[e];t.remove(),t.off("comm:live",this._widget_live),t.off("comm:dead",this._widget_dead)}this.widget_views=[],this.widget_subarea.html(""),this.widget_subarea.height(""),this.widget_area.height(""),this.widget_area.hide()},{WidgetArea:i}}),define("nbextensions/widgets/notebook/js/extension",["nbextensions/widgets/widgets/js/init","nbextensions/widgets/notebook/js/widgetarea","base/js/events","base/js/namespace"],function(e,t,i,n){"use strict";function r(){n.notebook&&n.notebook.kernel&&a(n.notebook.kernel),i.on("kernel_created.Kernel kernel_created.Session",function(e,t){a(t.kernel)});for(var e=n.notebook.get_cells(),t=0;t<e.length;t++)l(e[t]);i.on("create.Cell",function(e,t){l(t.cell)}),i.on("delete.Cell",function(e,t){t.cell&&t.cell.widgetarea&&t.cell.widgetarea.dispose()})}function s(){var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",n.notebook.base_url+"nbextensions/widgets/widgets/css/widgets.min.css"),document.getElementsByTagName("head")[0].appendChild(e)}function o(){s(),r(),console.log("loaded widgets")}var a=function(t){if(t.comm_manager&&void 0===t.widget_manager){var i=new e.WidgetManager(t.comm_manager,n.notebook);t.widget_manager=i}},l=function(e){if("code"===e.cell_type){var i=new t.WidgetArea(e);e.widgetarea=i}};return{load_ipython_extension:o}}),define("custom/custom",function(){});var bind=function(e,t){return function(){return e.apply(t,arguments)}},indexOf=[].indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(t in this&&this[t]===e)return t;return-1};return define("main",["base/js/namespace","jquery","components/es6-promise/promise.min","thebe/dotimeout","notebook/js/notebook","thebe/default_css","contents","services/config","base/js/utils","base/js/page","base/js/events","notebook/js/actions","notebook/js/kernelselector","services/kernels/kernel","codemirror/lib/codemirror","terminal/js/terminado","components/term.js/src/term","codemirror/mode/ruby/ruby","codemirror/mode/css/css","codemirror/mode/coffeescript/coffeescript","codemirror/mode/dockerfile/dockerfile","codemirror/mode/go/go","codemirror/mode/javascript/javascript","codemirror/mode/julia/julia","codemirror/mode/python/python","codemirror/mode/haskell/haskell","codemirror/mode/r/r","codemirror/mode/shell/shell","codemirror/mode/clike/clike","codemirror/mode/jinja2/jinja2","codemirror/mode/php/php","codemirror/mode/sql/sql","nbextensions/widgets/notebook/js/extension","custom/custom"],function(e,t,i,n,r,s,o,a,l,c,h,u,d,p,f,m,g,v){var b;return b=function(){function i(e){var i,n,r,s;if(this.options=null!=e?e:{},this.track=bind(this.track,this),this.setup_resources=bind(this.setup_resources,this),this.start_terminal_backend=bind(this.start_terminal_backend,this),this.start_terminal=bind(this.start_terminal,this),this.start_notebook=bind(this.start_notebook,this),this.start_kernel=bind(this.start_kernel,this),this.before_first_run=bind(this.before_first_run,this),this.run_cell=bind(this.run_cell,this),this.get_controls_html=bind(this.get_controls_html,this),this.controls_html=bind(this.controls_html,this),this.show_cell_state=bind(this.show_cell_state,this),this.set_state=bind(this.set_state,this),this.build_thebe=bind(this.build_thebe,this),this.spawn_handler=bind(this.spawn_handler,this),this.call_spawn=bind(this.call_spawn,this),this.has_kernel_connected=!1,this.server_error=!1,r=_.defaults(this.options,this.default_options),this.selector=r.selector,this.url=r.url,this.debug=r.debug,this.setup_constants(),s=[this.get_param_from_qs("url"),this.get_param_from_qs("tmpnb_mode")],n=s[0],i=s[1],n&&(this.url=n),"true"===i&&(this.options.tmpnb_mode=!0),"false"===i&&(this.options.tmpnb_mode=!1),this.url&&(this.url=this.url.replace(/\/?$/,"/")),"//"===this.url.slice(0,2)&&(this.url=window.location.protocol+this.url),this.options.tmpnb_mode&&(this.log("Thebe is in tmpnb mode"),this.tmpnb_url=this.url,this.url=""),this.cells=[],this.events=h,this.setup_resources(),this.setup_user_events(),this.options.terminal_mode){if(1!==t(this.selector).length)throw new Error("You should have one, and only one "+this.selector+" element in terminal mode. Change the selector option or change your html.");this.start_terminal()}else this.start_notebook()}return i.prototype.default_options={selector:"pre[data-executable]",url:"//192.168.59.103:8000/",tmpnb_mode:!0,kernel_name:"python2",append_kernel_controls_to:!1,inject_css:!0,load_css:!0,load_mathjax:!0,next_cell_shortcut:32,run_cell_shortcut:13,not_executable_selector:"pre[data-not-executable]",read_only_selector:"pre[data-read-only]",error_addendum:!0,add_interrupt_button:!1,codemirror_mode_name:"ipython",codemirror_theme_name:"default",terminal_mode:!1,container_selector:"body",image_name:"jupyter/notebook",debug:!1},i.prototype.spawn_path="api/spawn/",i.prototype.stats_path="api/stats",i.prototype.start_state="start",i.prototype.idle_state="idle",i.prototype.busy_state="busy",i.prototype.ran_state="ran",i.prototype.full_state="full",i.prototype.cant_state="cant",i.prototype.disc_state="disconnected",i.prototype.gaveup_state="gaveup",i.prototype.user_error="user_error",i.prototype.interrupt_state="interrupt",i.prototype.ui={},i.prototype.setup_constants=function(){return this.error_states=[this.disc_state,this.full_state,this.cant_state,this.gaveup_state],this.ui[this.start_state]="Starting server...",this.ui[this.idle_state]="Run",this.ui[this.busy_state]='Working <div class="thebe-spinner thebe-spinner-three-bounce"><div></div> <div></div> <div></div></div>',this.ui[this.ran_state]="Run Again",this.ui[this.user_error]="Run Again",this.ui[this.interrupt_state]="Interrupted. Run Again?",this.ui[this.full_state]="Server is Full :-(",this.ui[this.cant_state]="Can't connect to server",this.ui[this.disc_state]="Disconnected from Server<br>Attempting to reconnect",this.ui[this.gaveup_state]="Disconnected!<br>Click to try again",this.options.error_addendum===!1?this.ui.error_addendum="":this.options.error_addendum===!0?this.ui.error_addendum="<button data-action='run-above'>Run All Above</button> <div class='thebe-message'>It looks like there was an error. You might need to run the code examples above for this one to work.</div>":this.ui.error_addendum=this.options.error_addendum},i.prototype.call_spawn=function(e){var t,i,n;return this.log("call spawn"),this.track("call_spawn"),(null!=(n=this.kernel)?n.ws:void 0)&&this.log("HAZ WEBSOCKET?"),t=new XMLHttpRequest,t.open("POST",this.tmpnb_url+this.spawn_path,!0),i=JSON.stringify({image_name:this.options.image_name}),t.onreadystatechange=function(i){return function(n){return 4===t.readyState?i.spawn_handler(n,e):void 0}}(this),t.onerror=function(e){return function(t){return e.log("Cannot connect to tmpnb server",!0),e.set_state(e.cant_state),e.track("call_spawn_fail")}}(this),t.send(i)},i.prototype.check_server=function(e){return null==e&&(e=new XMLHttpRequest),e.open("GET",this.tmpnb_url+this.stats_path,!0),e.onerror=function(e){return function(i){return e.track("check_server_error"),e.log("Checked and cannot connect to tmpnb server!"+i.target.status,!0),e.server_error=!0,t(".thebe_controls").remove()}}(this),e.onload=function(e){return function(t){return e.log("Tmpnb server seems to be up")}}(this),e.send()},i.prototype.spawn_handler=function(e,t){var i,n,r;if(this.log("spawn handler called"),0===(r=e.target.status)||405===r)return this.log("Cannot connect to tmpnb server, status: "+e.target.status,!0),this.set_state(this.cant_state);try{i=JSON.parse(e.target.responseText)}catch(s){this.log(i),this.log("Couldn't parse spawn response"),this.track("call_spawn_error")}return"full"===i.status?(this.log("tmpnb server full",!0),this.set_state(this.full_state),this.track("call_spawn_full")):(n=i.url.match(/(https?:\/\/.[^\/]+)(.*)/i),n&&(this.tmpnb_url=n[1],i.url=n[2]),this.url=this.tmpnb_url+i.url+"/",this.log("tmpnb says we should use"),this.log(this.url),this.options.terminal_mode?this.start_terminal_backend(t):this.start_kernel(t),this.track("call_spawn_success"))},i.prototype.build_thebe=function(){var e,i;return this.notebook.writable=!1,this.notebook._unsafe_delete_cell(0),this.notebook.container=t(this.options.container_selector),t(this.selector).add(this.options.not_executable_selector).each(function(e){return function(i,n){var r,s,o,a;return r=e.notebook.insert_cell_at_bottom("code"),o=t(n).attr("id"),r.set_text(t(n).text().trim()),t(n).is(e.options.read_only_selector)&&(r.read_only=!0,r.code_mirror.setOption("readOnly",!0)),a=t("<div class='thebe_wrap'></div>"),s=t("<div class='thebe_controls' data-cell-id='"+i+"'>"+e.controls_html()+"</div>"),a.append(r.element.children()),t(n).replaceWith(r.element.empty().append(a)),e.cells.push(r),e.server_error||t(a).append(s),t(n).is(e.options.not_executable_selector)&&s.html(""),o&&r.element.attr("id",o),r.element.removeAttr("tabindex"),r.element.off("dblclick")}}(this)),this.notebook_el.hide(),e=!1,this.events.on("edit_mode.Cell",function(t){return function(t,i){return e=!0}}(this)),i=function(e){return t(e.currentTarget).find(".thebe_controls").data("cell-id")},t("div.code_cell").on("keydown",function(t){return function(n){var r,s;return n.which===t.options.next_cell_shortcut&&n.shiftKey===!0?(r=i(n),r===t.cells.length-1&&(r=-1),s=t.cells[r+1],s.focus_editor(),!1):n.which===t.options.run_cell_shortcut&&n.shiftKey===!0?(r=i(n),t.run_cell(r),!1):(e&&(r=i(n),t.track("cell_edit",{cell_id:r}),e=!1),!0)}}(this)),t(window).on("keydown",function(e){return function(t){return 67===t.which&&t.ctrlKey?e.kernel.interrupt():void 0}}(this)),this.events.on("kernel_connected.Kernel",function(e){return function(){var t,i,n,r,s,o;if(""===e.has_kernel_connected){for(s=e.cells,o=[],i=n=0,r=s.length;r>n;i=++n)t=s[i],o.push(e.show_cell_state(e.idle_state,i));return o}}}(this)),this.events.on("kernel_idle.Kernel",function(e){return function(){return e.set_state(e.idle_state),t.doTimeout("thebe_idle_state",300,function(){var i,n,r,s,o,a,l,c;if(e.state===e.idle_state){for(i=t(".thebe_controls button[data-state='busy']").parent().map(function(){return t(this).data("cell-id")}),s=0,a=i.length;a>s;s++)n=i[s],e.show_cell_state(e.idle_state,n);for(r=t(".thebe_controls button[data-state='interrupt']").parent().map(function(){return t(this).data("cell-id")}),o=0,l=r.length;l>o;o++)n=r[o],e.cells[n].output_area.clear_output(!1);return!1}return c=e.state,indexOf.call(e.error_states,c)<0?!0:!1})}}(this)),this.events.on("kernel_busy.Kernel",function(e){return function(){return e.set_state(e.busy_state)}}(this)),this.events.on("kernel_reconnecting.Kernel",function(e){return function(t,i){var n;return e.log("Reconnect attempt #"+i.attempt),i.attempt<5?(n=Math.pow(2,i.attempt),e.set_state(e.disc_state,n)):e.set_state(e.gaveup_state)}}(this)),this.events.on("output_message.OutputArea",function(e){return function(i,n,r,s){var o,a;return o=t(s.element).parents(".code_cell").find(".thebe_controls"),a=o.data("cell-id"),"error"===n?(e.log("Error executing cell #"+a),"KeyboardInterrupt"===r.content.ename?(e.log("KeyboardInterrupt by User"),e.show_cell_state(e.interrupt_state,a)):e.show_cell_state(e.user_error,a)):void 0}}(this))},i.prototype.set_state=function(e,i){var n,r;return this.state=e,null==i&&(i=""),this.log("Thebe: "+this.state),r=this.state,indexOf.call(this.error_states,r)>=0&&(n=this.ui[this.state],i&&(n+=" in "+i+" seconds"),t(".thebe_controls").html(this.controls_html(this.state,n)),this.state===this.disc_state)?t(".thebe_controls button").prop("disabled",!0):void 0},i.prototype.show_cell_state=function(e,i){return this.set_state(e),this.log("show cell state: "+e+" for "+i),this.cells[i].last_msg_id&&e===this.idle_state&&(e=this.ran_state),t(".thebe_controls[data-cell-id="+i+"]").html(this.controls_html(e))},i.prototype.controls_html=function(e,t){var i;return null==e&&(e=this.idle_state),null==t&&(t=!1),t||(t=this.ui[e]),i="<button data-action='run' data-state='"+e+"'>"+t+"</button>",this.options.add_interrupt_button&&e===this.busy_state&&(i+="<button data-action='interrupt'>Interrupt</button>"),e===this.user_error&&(i+=this.ui.error_addendum),i},i.prototype.get_controls_html=function(e){return t(e.element).find(".thebe_controls").html()},i.prototype.kernel_controls_html=function(){return"<button data-action='run-above'>Run All</button> <button data-action='interrupt'>Interrupt</button> <button data-action='restart'>Restart</button>"},i.prototype.run_cell=function(e,t){var i,n,r,s,o,a,l,c;if(null==t&&(t=!1),this.track("run_cell",{cell_id:e,end_id:t}),(o=this.state)===this.gaveup_state||o===this.cant_state)this.log("Lets reconnect thebe to the server"),this.has_kernel_connected="",this.url="";else if(a=this.state,indexOf.call(this.error_states.concat(this.start_state),a)>=0)return void this.log("Not attempting to reconnect thebe to server, state: "+this.state);if(i=this.cells[e],this.get_controls_html(i)){if(!this.has_kernel_connected)return this.show_cell_state(this.start_state,e),this.before_first_run(function(n){return function(){var r,s,o,a,l;if(n.show_cell_state(n.busy_state,e),i.execute(),t){for(a=n.cells.slice(e+1,+t+1||9e9),l=[],r=s=0,o=a.length;o>s;r=++s)i=a[r],n.get_controls_html(i)&&(n.show_cell_state(n.busy_state,r+1),l.push(i.execute()));return l}}}(this));if(this.show_cell_state(this.busy_state,e),i.execute(),t){for(l=this.cells.slice(e+1,+t+1||9e9),c=[],n=r=0,s=l.length;s>r;n=++r)i=l[n],this.get_controls_html(i)&&(this.show_cell_state(this.busy_state,n+1),c.push(i.execute()));return c}}},i.prototype.before_first_run=function(e){var i;return this.url?this.start_kernel(e):this.call_spawn(e),this.options.append_kernel_controls_to&&!t(".kernel_controls").length?(i=t("<div class='kernel_controls'></div>"),i.html(this.kernel_controls_html()).appendTo(this.options.append_kernel_controls_to)):void 0},i.prototype.setup_user_events=function(){return t("body").on("click","div.thebe_controls button, div.kernel_controls button",function(e){return function(i){var n,r,s;switch(r=t(i.currentTarget),s=r.parent().data("cell-id"),n=r.data("action"),i.shiftKey&&(n="shift-"+n),n){case"run":return e.run_cell(s);case"shift-run":case"run-above":return s||(s=e.cells.length),e.log("exec from top to cell #"+s),e.run_cell(0,s);case"interrupt":return e.kernel.interrupt();case"restart":if(confirm("Are you sure you want to restart the kernel? Your work will be lost."))return e.kernel.restart()}}}(this))},i.prototype.start_kernel=function(e){return this.log("start_kernel with "+this.url),this.kernel=new p.Kernel(this.url+"api/kernels","",this.notebook,this.options.kernel_name),this.kernel.name=this.options.kernel_name,this.kernel.start(),this.notebook.kernel=this.kernel,this.events.on("kernel_ready.Kernel",function(t){return function(){var i,n,r,s,o;for(t.has_kernel_connected=!0,t.log("kernel ready"),o=t.cells,n=r=0,s=o.length;s>r;n=++r)i=o[n],i.set_kernel(t.kernel);return e()}}(this))},i.prototype.start_notebook=function(){var i,n,s,a;return o={list_checkpoints:function(){return new Promise(function(e,t){return e({})})}},s={edit_mode:function(){},command_mode:function(){},register_events:function(){},enable:function(){},disable:function(){}},s.edit_shortcuts={handles:function(){}},a={update_document_title:function(){},contents:function(){}},n={data:{data:{}}},i={ws_url:"",base_url:"",notebook_path:"",notebook_name:""},this.notebook_el=t('<div id="notebook"></div>').prependTo("body"),this.notebook=new r.Notebook("div#notebook",t.extend({events:this.events,keyboard_manager:s,save_widget:a,contents:o,config:n,codemirror_theme_name:this.options.codemirror_theme_name},i)),this.notebook.kernel_selector={set_kernel:function(){}},this.events.trigger("app_initialized.NotebookApp"),this.notebook.load_notebook(i.notebook_path,this.options.codemirror_mode_name),e.notebook=this.notebook,l.load_extension("widgets/notebook/js/extension"),this.build_thebe()},i.prototype.start_terminal=function(){return t(this.selector).one("click",function(e){return function(t){return e.url?e.start_terminal_backend():e.call_spawn(function(){})}}(this))},i.prototype.start_terminal_backend=function(){var e;return e=new XMLHttpRequest,e.open("POST",this.url+"api/terminals",!0),e.onreadystatechange=function(t){return function(i){return 4===e.readyState?t.terminal_start_handler(i):void 0}}(this),e.onerror=function(e){return function(t){return e.log("Cannot connect to jupyter server to start terminal",!0),e.set_state(e.cant_state),e.track("start_terminal_fail")}}(this),e.send()},i.prototype.terminal_start_handler=function(e){var i,n,r,s,o,a,l,c;return n=JSON.parse(e.target.responseText),l=n.name,c=this.url.replace("http","ws")+("terminals/websocket/"+l),this.log("Thebe is in terminal mode, i.e. not running as a notebook",!0),
t(this.selector).html(""),this.setup_dummy_term_div(),o=function(){return 1*t("#dummy-screen")[0].offsetHeight/25},s=function(){return 1.02*t("#dummy-screen-rows")[0].offsetWidth/80},i=function(e){return function(){var i,n,r,a;return n=t(e.selector).height(),a=t(e.selector).width(),r=Math.min(1e3,Math.max(20,Math.floor(n/o()))),i=Math.min(1e3,Math.max(40,Math.floor(a/s())-1)),{rows:r,cols:i}}}(this),r=i(),a=m.make_terminal(t(this.selector)[0],r,c),window.onresize=function(e){return function(){var n;return n=i(),a.term.resize(n.cols,n.rows),a.socket.send(JSON.stringify(["set_size",n.rows,n.cols,t(e.selector).height(),t(e.selector).width()]))}}(this)},i.prototype.setup_dummy_term_div=function(){var e;return e='<div style="position:absolute; left:-1000em">\n<pre id="dummy-screen" style="border: solid 5px white;" class="terminal">0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n<span id="dummy-screen-rows" style="">01234567890123456789012345678901234567890123456789012345678901234567890123456789</span>\n</pre>\n</div>',t("body").append(e)},i.prototype.setup_resources=function(){var e,i;return window.mathjax_url="",this.options.load_mathjax&&(e=document.createElement("script"),e.type="text/javascript",e.src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",document.getElementsByTagName("head")[0].appendChild(e)),this.options.inject_css&&t("<style>"+s.css+"</style>").appendTo("head"),this.options.load_css&&(i=["https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.css"],t.when(t.each(i,function(e,i){return t.get(i,function(){return t("<link>",{rel:"stylesheet",type:"text/css",href:i}).appendTo("head")})}))),t(document).ajaxError(function(e){return function(t,i,n,r){var s;return s=e.options.tmpnb_mode?e.tmpnb_url:e.url,-1!==n.url.indexOf(s)?(e.log("Ajax Error!"),e.set_state(e.disc_state)):void 0}}(this))},i.prototype.fix_cm_indent=function(e){var t,i;return i=e.code_mirror.defaultCharWidth(),t=4,e.code_mirror.on("renderLine",function(e,n,r){var s;return s=f.countColumn(n.text,null,e.getOption("tabSize"))*i,r.style.textIndent="-"+s+"px",r.style.paddingLeft=t+s+"px"}),e.code_mirror.refresh()},i.prototype.get_param_from_qs=function(e){var t,i;return e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=new RegExp("[\\?&]"+e+"=([^&#]*)"),i=t.exec(location.search),null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))},i.prototype.log=function(e,t){return null==t&&(t=!1),this.debug?t?console.log("%c"+e,"color: blue; font-size: 12px"):console.log(e):t?console.log(e):void 0},i.prototype.track=function(e,i){return null==i&&(i={}),i.name=e,i.kernel=this.options.kernel_name,this.server_error&&(i.server_error=!0),this.has_kernel_connected&&(i.has_kernel_connected=!0),t(window.document).trigger("thebe_tracking_event",i)},i}(),window.Thebe=b,t(function(){var e;return t("body").data("runnable")?e=new b:void 0}),{Thebe:b}}),define("jquery",[],function(){return jQuery}),require("main")});