text: /**
   * skylark-jotted - A version of jotted( html/css/js playground) that ported to running on skylarkjs.
   * @author Hudaokeji, Inc.
   * @version v0.9.0
   * @link https://github.com/skylark-integration/skylark-jotted/
   * @license MIT
   */
  !function(factory,globals){var define=globals.define,require=globals.require,isAmd="function"==typeof define&&define.amd,isCmd=!isAmd&&"undefined"!=typeof exports;if(!isAmd&&!define){var map={};define=globals.define=function(e,t,i){"function"==typeof i?(map[e]={factory:i,deps:t.map(function(t){return function(e,t){if("."!==e[0])return e;var i=t.split("/"),n=e.split("/");i.pop();for(var r=0;r<n.length;r++)"."!=n[r]&&(".."==n[r]?i.pop():i.push(n[r]));return i.join("/")}(t,e)}),resolved:!1,exports:null},require(e)):map[e]={factory:null,resolved:!0,exports:i}},require=globals.require=function(e){if(!map.hasOwnProperty(e))throw new Error("Module "+e+" has not been defined");var t=map[e];if(!t.resolved){var i=[];t.deps.forEach(function(e){i.push(require(e))}),t.exports=t.factory.apply(globals,i)||null,t.resolved=!0}return t.exports}}if(!define)throw new Error("The module utility (ex: requirejs or skylark-utils) is not loaded!");if(function(define,require){define("skylark-langx-ns/_attach",[],function(){return function(e,t,i){"string"==typeof t&&(t=t.split("."));for(var n=t.length,r=e,s=0,o=t[s++];s<n;)r=r[o]=r[o]||{},o=t[s++];return r[o]=i}}),define("skylark-langx-ns/ns",["./_attach"],function(e){var t={attach:function(i,n){return e(t,i,n)}};return t}),define("skylark-langx-ns/main",["./ns"],function(e){return e}),define("skylark-langx-ns",["skylark-langx-ns/main"],function(e){return e}),define("skylark-langx/skylark",["skylark-langx-ns"],function(e){return e}),define("skylark-langx-types/types",["skylark-langx-ns"],function(e){var t,i={}.toString,n=(t={},"Boolean Number String Function Array Date RegExp Object Error Symbol".split(" ").forEach(function(e){t["[object "+e+"]"]=e.toLowerCase()}),function(e){return null==e?String(e):t[i.call(e)]||"object"});function r(e){var t;for(t in e)if(null!==e[t])return!1;return!0}function s(e){return"function"==n(e)}function o(e){return e&&e.nodeType}function l(e){return"number"==typeof e}function a(e){return"object"==n(e)}function c(e){return"string"==typeof e}function h(e){return e&&e==e.window}return e.attach("langx.types",{isArray:function(e){return e&&e.constructor===Array},isArrayLike:function(e){return!c(e)&&!o(e)&&"number"==typeof e.length&&!s(e)},isBoolean:function(e){return"boolean"==typeof e},isDefined:function(e){return void 0!==e},isDocument:function(e){return null!=e&&e.nodeType==e.DOCUMENT_NODE},isEmpty:r,isEmptyObject:r,isFunction:s,isHtmlNode:o,isNull:function(e){return"null"===n(e)},isNumber:l,isNumeric:l,isObject:a,isPlainObject:function(e){return a(e)&&!h(e)&&Object.getPrototypeOf(e)==Object.prototype},isString:c,isSameOrigin:function(e){if(e){var t=location.protocol+"//"+location.hostname;return location.port&&(t+=":"+location.port),e.startsWith(t)}},isSymbol:function(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag},isUndefined:function(e){return void 0===e},isWindow:h,type:n})}),define("skylark-langx-types/main",["./types"],function(e){return e}),define("skylark-langx-types",["skylark-langx-types/main"],function(e){return e}),define("skylark-langx-numbers/numbers",["skylark-langx-ns","skylark-langx-types"],function(e,t){var i=t.isObject,n=t.isSymbol,r=1/0,s=1.7976931348623157e308,o=NaN,l=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,h=/^0o[0-7]+$/i,u=parseInt;function d(e){if(!e)return 0===e?e:0;if((e=f(e))===r||e===-r){var t=e<0?-1:1;return t*s}return e==e?e:0}function f(e){if("number"==typeof e)return e;if(n(e))return o;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=c.test(e);return r||h.test(e)?u(e.slice(2),r?2:8):a.test(e)?o:+e}return e.attach("langx.numbers",{toFinite:d,toNumber:f,toInteger:function(e){var t=d(e),i=t%1;return t==t?i?t-i:t:0}})}),define("skylark-langx-numbers/main",["./numbers"],function(e){return e}),define("skylark-langx-numbers",["skylark-langx-numbers/main"],function(e){return e}),define("skylark-langx-objects/objects",["skylark-langx-ns/ns","skylark-langx-ns/_attach","skylark-langx-types","skylark-langx-numbers"],function(e,t,i,n){var r,s,o=Object.prototype.hasOwnProperty,l=Array.prototype.slice,a=i.isBoolean,c=i.isFunction,h=i.isObject,u=i.isPlainObject,d=i.isArray,f=i.isArrayLike,g=i.isString,p=n.toInteger;var m,v,y="undefined"!=typeof Symbol?Symbol.prototype:null;function w(e){if(!h(e))return[];var t=[];for(var i in e)t.push(i);return t}function b(e,t){if(!d(t))return null!=e&&o.call(e,t);for(var i=t.length,n=0;n<i;n++){var r=t[n];if(null==e||!o.call(e,r))return!1;e=e[r]}return!!i}function C(e,t,i,n){for(var r in t)n&&void 0!==e[r]||(i&&(u(t[r])||d(t[r]))?(u(t[r])&&!u(e[r])&&(e[r]={}),d(t[r])&&!d(e[r])&&(e[r]=[]),C(e[r],t[r],i,n)):void 0!==t[r]&&(e[r]=t[r]));return e}function k(e){var t=l.call(arguments,0),i=t.shift(),n=!1;return a(t[t.length-1])&&(n=t.pop()),{target:i,sources:t,deep:n}}function x(){var e=k.apply(this,arguments);return e.sources.forEach(function(t){C(e.target,t,e.deep,!1)}),e.target}function S(e){for(var t=w(e),i=t.length,n=Array(i),r=0;r<i;r++)n[r]=e[t[r]];return n}return r=function(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&s(e,t,i,n)},s=function(e,t,i,n){var s=toString.call(e);if(s!==toString.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+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 Symbol]":return y.valueOf.call(e)===y.valueOf.call(t)}var o="[object Array]"===s;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,a=t.constructor;if(l!==a&&!(c(l)&&l instanceof l&&c(a)&&a instanceof a)&&"constructor"in e&&"constructor"in t)return!1}i=i||[],n=n||[];for(var h=i.length;h--;)if(i[h]===e)return n[h]===t;if(i.push(e),n.push(t),o){if((h=e.length)!==t.length)return!1;for(;h--;)if(!r(e[h],t[h],i,n))return!1}else{var u,d=Object.keys(e);if(h=d.length,Object.keys(t).length!==h)return!1;for(;h--;)if(u=d[h],void 0===t[u]||!r(e[u],t[u],i,n))return!1}return i.pop(),n.pop(),!0},e.attach("langx.objects",{allKeys:w,attach:t,clone:function e(t,i){var n;if(void 0===t||null===t)n=t;else if(i&&t.clone)n=t.clone();else if(d(t)){n=[];for(var r=0;r<t.length;r++)n.push(e(t[r]))}else if(u(t))for(var s in n={},t)n[s]=e(t[s]);else n=t;return n},defaults:(m=w,v=!0,function(e){var t=arguments.length;if(v&&(e=Object(e)),t<2||null==e)return e;for(var i=1;i<t;i++)for(var n=arguments[i],r=m(n),s=r.length,o=0;o<s;o++){var l=r[o];v&&void 0!==e[l]||(e[l]=n[l])}return e}),each:function(e,t){var i,n,r,s;if(e)if(void 0===(i=e.length)){for(n in e)if(e.hasOwnProperty(n)&&(s=e[n],!1===t.call(s,n,s)))break}else for(r=0;r<i&&(s=e[r],!1!==t.call(s,r,s));r++);return this},extend:function(e){var t,i=l.call(arguments,1);"boolean"==typeof e&&(t=e,e=i.shift());0==i.length&&(i=[e],e=this);return i.forEach(function(i){x(e,i,t)}),e},has:b,isEqual:function(e,t){return r(e,t)},includes:function(e,t,i,n){e=f(e)?e:S(e),i=i&&!n?p(i):0;var r=e.length;i<0&&(i=nativeMax(r+i,0));return g(e)?i<=r&&e.indexOf(t,i)>-1:!!r&&baseIndexOf(e,t,i)>-1},isMatch:function(e,t){var i=i(t),n=i.length;if(null==e)return!n;for(var r=Object(e),s=0;s<n;s++){var o=i[s];if(t[o]!==r[o]||!(o in r))return!1}return!0},keys:function(e){if(h(e))return[];var t=[];for(var i in e)b(e,i)&&t.push(i);return t},mixin:x,omit:function(e,t,i){if(!e)return null;for(var n=x({},e),r=1;r<arguments.length;r++){var s=arguments[r];s in e&&delete n[s]}return n},pick:function(e,t,i){if(!e)return null;for(var n={},r=1;r<arguments.length;r++){var s=arguments[r];s in e&&(n[s]=e[s])}return n},removeItem:function(e,t){if(d(e)){var i=e.indexOf(t);-1!=i&&e.splice(i,1)}else if(u(e))for(var n in e)if(e[n]==t){delete e[n];break}return this},result:function(e,t,i){d(t)||(t=t.split("."));var n=t.length;if(!n)return c(i)?i.call(e):i;for(var r=0;r<n;r++){var s=null==e?void 0:e[t[r]];void 0===s&&(s=i,r=n),e=c(s)?s.call(e):s}return e},safeMixin:function(){var e=k.apply(this,arguments);return e.sources.forEach(function(t){C(e.target,t,e.deep,!0)}),e.target},values:S})}),define("skylark-langx-objects/main",["./objects"],function(e){return e}),define("skylark-langx-objects",["skylark-langx-objects/main"],function(e){return e}),define("skylark-langx-arrays/arrays",["skylark-langx-ns/ns","skylark-langx-types","skylark-langx-objects"],function(e,t,i){var n=Array.prototype.filter,r=t.isArrayLike;function s(e,t,i,n){for(var r=e.length,s=i+(n?1:-1);n?s--:++s<r;)if(t(e[s],s,e))return s;return-1}function o(e){return e!=e}function l(e){if(r(e)){for(var t=[],i=0;i<e.length;i++){var n=e[i];if(r(n))for(var s=0;s<n.length;s++)t.push(n[s]);else t.push(n)}return t}return e}return e.attach("langx.arrays",{baseFindIndex:s,baseIndexOf:function(e,t,i){if(t!=t)return s(e,o,i);var n=i-1,r=e.length;for(;++n<r;)if(e[n]===t)return n;return-1},compact:function(e){return n.call(e,function(e){return null!=e})},first:function(e,t){return t?e.slice(0,t):e[0]},filter:function(e,t){return n.call(e,t)},flatten:l,grep:function(e,t){var n=[];return i.each(e,function(e,i){t(i,e)&&n.push(i)}),n},inArray:function(e,t){if(!t)return-1;var i;if(t.indexOf)return t.indexOf(e);i=t.length;for(;i--;)if(t[i]===e)return i;return-1},makeArray:function(e,t,i){if(r(e))return(i||[]).concat(Array.prototype.slice.call(e,t||0));return[e]},merge:function(e,t){var i=t.length,n=e.length,r=0;if("number"==typeof i)for(;r<i;r++)e[n++]=t[r];else for(;void 0!==t[r];)e[n++]=t[r++];return e.length=n,e},forEach:function(e,t){if(e.forEach)return e.forEach(t);for(var i=0;i<e.length;i++)t(e[i],i)},map:function(e,t){var i,n,s,o=[];if(r(e))for(n=0;n<e.length;n++)null!=(i=t.call(e[n],e[n],n))&&o.push(i);else for(s in e)null!=(i=t.call(e[s],e[s],s))&&o.push(i);return l(o)},reduce:function(e,t,i){return Array.prototype.reduce.call(e,t,i)},uniq:function(e){return n.call(e,function(t,i){return e.indexOf(t)==i})}})}),define("skylark-langx-arrays/main",["./arrays"],function(e){return e}),define("skylark-langx-arrays",["skylark-langx-arrays/main"],function(e){return e}),define("skylark-langx-funcs/funcs",["skylark-langx-ns/ns","skylark-langx-types","skylark-langx-objects"],function(e,t,i){var n=i.mixin,r=Array.prototype.slice,s=t.isFunction,o=t.isString;var l=function(){function e(){}return function(t,i){e.prototype=t;var r=new e;return e.prototype=null,i&&n(r,i),r}}(),a={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};return e.attach("langx.funcs",{debounce:function(e,t){var i;return function(){var n=this,r=arguments;i&&clearTimeout(i),i=setTimeout(function(){i=null,e.apply(n,r)},t)}},delegate:l,defer:function(e){requestAnimationFrame?requestAnimationFrame(e):setTimeoutout(e);return this},noop:function(){},proxy:function e(t,i){var n=2 in arguments&&r.call(arguments,2);if(s(t)){return function(){return t.apply(i,n?n.concat(r.call(arguments)):arguments)}}if(o(i))return n?(n.unshift(t[i],t),e.apply(null,n)):e(t[i],t);throw new TypeError("expected function")},returnTrue:function(){return!0},returnFalse:function(){return!1},templateSettings:a,template:function(e,t,n){!t&&n&&(t=n);t=i.defaults({},t,a);var r,s=RegExp([(t.escape||noMatch).source,(t.interpolate||noMatch).source,(t.evaluate||noMatch).source].join("|")+"|$","g"),o=0,l="__p+='";e.replace(s,function(t,i,n,r,s){return l+=e.slice(o,s).replace(escapeRegExp,escapeChar),o=s+t.length,i?l+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":n?l+="'+\n((__t=("+n+"))==null?'':__t)+\n'":r&&(l+="';\n"+r+"\n__p+='"),t}),l+="';\n",t.variable||(l="with(obj||{}){\n"+l+"}\n");l="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+l+"return __p;\n";try{r=new Function(t.variable||"obj","_",l)}catch(e){throw e.source=l,e}var c=function(e){return r.call(this,e,_)},h=t.variable||"obj";return c.source="function("+h+"){\n"+l+"}",c}})}),define("skylark-langx-funcs/main",["./funcs"],function(e){return e}),define("skylark-langx-funcs",["skylark-langx-funcs/main"],function(e){return e}),define("skylark-langx-async/Deferred",["skylark-langx-arrays","skylark-langx-funcs","skylark-langx-objects"],function(e,t,i){"use strict";var n=Symbol?Symbol():"__pglisteners",r=Symbol?Symbol():"__pgnotifies",s=Array.prototype.slice,o=t.proxy,l=e.makeArray,a=i.result,c=i.mixin;c(Promise.prototype,{always:function(e){return this.then(e,e),this},done:function(){for(var e=0;e<arguments.length;e++)this.then(arguments[e]);return this},fail:function(e){return this.catch(e),this}});var h=function(){var e=this,t=this.promise=new Promise(function(t,i){e._resolve=t,e._reject=i});u(t,e),this[n]=[],this[r]=[]};function u(e,t){var i={state:function(){return t.isResolved()?"resolved":t.isRejected()?"rejected":"pending"},then:function(e,t,i){return i&&this.progress(i),u(Promise.prototype.then.call(this,e&&function(t){return t&&void 0!==t.__ctx__?e.apply(t.__ctx__,t):e(t)},t&&function(e){return e&&void 0!==e.__ctx__?t.apply(e.__ctx__,e):t(e)}))},progress:function(e){return t[r].forEach(function(t){e(t)}),t[n].push(e),this}};return i.pipe=i.then,c(e,i)}return h.prototype.resolve=function(e){var t=s.call(arguments);return this.resolveWith(null,t)},h.prototype.resolveWith=function(e,t){return(t=t?l(t):[]).__ctx__=e,this._resolve(t),this._resolved=!0,this},h.prototype.notify=function(e){try{return this[r].push(e),this[n].forEach(function(t){return t(e)})}catch(e){this.reject(e)}return this},h.prototype.reject=function(e){var t=s.call(arguments);return this.rejectWith(null,t)},h.prototype.rejectWith=function(e,t){return(t=t?l(t):[]).__ctx__=e,this._reject(t),this._rejected=!0,this},h.prototype.isResolved=function(){return!!this._resolved},h.prototype.isRejected=function(){return!!this._rejected},h.prototype.then=function(e,t,i){var n=a(this,"promise");return n.then(e,t,i)},h.prototype.progress=function(e){var t=a(this,"promise");return t.progress(e)},h.prototype.catch=function(e){var t=a(this,"promise");return t.catch(e)},h.prototype.done=function(){var e=a(this,"promise");return e.done.apply(e,arguments)},h.prototype.fail=function(e){var t=a(this,"promise");return t.fail(e)},h.all=function(e){var t=new h;return Promise.all(e).then(t.resolve.bind(t),t.reject.bind(t)),a(t,"promise")},h.first=function(e){return u(Promise.race(e))},h.when=function(e,t,i,n){var r=e&&"function"==typeof e.then,s=r&&e instanceof Promise;if(!r)return arguments.length>1?t?t(e):e:(new h).resolve(e);if(!s){var l=new h(e.cancel);e.then(o(l.resolve,l),o(l.reject,l),l.notify),e=l.promise}return t||i||n?e.then(t,i,n):e},h.reject=function(e){var t=new h;return t.reject(e),t.promise},h.immediate=h.resolve=function(e){var t=new h;return t.resolve.apply(t,arguments),t.promise},h}),define("skylark-langx-klass/klass",["skylark-langx-ns/ns","skylark-langx-types","skylark-langx-objects","skylark-langx-arrays"],function(e,t,i,n){var r=n.uniq,s=i.has,o=i.mixin,l=t.isArray,a=t.isDefined;var c=function(){function e(){return this._construct?this._construct.apply(this,arguments):this.init?this.init.apply(this,arguments):void 0}return function i(n,c,h,u){l(c)&&(u=h,h=c,c=null),c=c||Object,a(h)&&!l(h)&&(u=h,h=!1);var d=c;h&&(h=function(e,t){var i=[];return t.forEach(function(e){if(s(e,"__mixins__"))throw new Error("nested mixins");for(var t=[];e;)t.unshift(e),e=e.superclass;i=i.concat(t)}),(i=(i=r(i)).filter(function(t){for(var i=e;i;){if(t===i)return!1;if(s(i,"__mixins__"))for(var n=i.__mixins__,r=0;r<n.length;r++)if(n[r]===t)return!1;i=i.superclass}return!0})).length>0&&i}(d,h)),h&&(d=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=new Function;r.prototype=Object.create(i.prototype),r.__proto__=i,r.superclass=null,o(r.prototype,t[n].prototype),r.prototype.__mixin__=t[n],i=r}return i}(d,h));var f=n.klassName||"",g=new Function("return function "+f+"() {var inst = this, ctor = arguments.callee;if (!(inst instanceof ctor)) {inst = Object.create(ctor.prototype);}return ctor._constructor.apply(inst, arguments) || inst;}")();return g.prototype=Object.create(d.prototype),g.prototype.constructor=g,g.superclass=c,g.__proto__=d,g._constructor||(g._constructor=e),h&&(g.__mixins__=h),g.partial||(g.partial=function(e,i){return function(e,i,n){var r=e.prototype,s=e.superclass.prototype,o=n&&n.noOverrided;n&&n.overrides;for(var l in i)if("constructor"!==l){var a=i[l];"function"==typeof i[l]?r[l]=a._constructor||o||"function"!=typeof s[l]?a:function(e,t,i){return function(){var e=this.overrided;this.overrided=i;var n=t.apply(this,arguments);return this.overrided=e,n}}(0,a,s[l]):t.isPlainObject(a)&&null!==a&&a.get?Object.defineProperty(r,l,a):r[l]=a}return e}(this,e,i)}),g.inherit||(g.inherit=function(e,t,n){return i(e,this,t,n)}),g.partial(n,u),g}}();return e.attach("langx.klass",c)}),define("skylark-langx-klass/main",["./klass"],function(e){return e}),define("skylark-langx-klass",["skylark-langx-klass/main"],function(e){return e}),define("skylark-langx-emitter/Emitter",["skylark-langx-ns/ns","skylark-langx-types","skylark-langx-objects","skylark-langx-arrays","skylark-langx-klass"],function(e,t,i,n,r){var s=Array.prototype.slice,o=n.compact,l=t.isDefined,a=t.isPlainObject,c=t.isFunction,h=t.isString,u=t.isEmptyObject,d=i.mixin,f=i.safeMixin;function g(e){var t=(""+e).split(".");return{name:t[0],ns:t.slice(1).join(" ")}}var p=r({on:function(e,t,i,n,r,s){var o=this,l=this._hub||(this._hub={});return a(e)?(r=n,each(e,function(e,n){o.on(e,t,i,n,r,s)}),this):(h(t)||c(n)||(r=n,n=i,i=t,t=void 0),c(i)&&(r=n,n=i,i=null),h(e)&&(e=e.split(/\s/)),e.forEach(function(e){var o=g(e),a=o.name,c=o.ns;(l[a]||(l[a]=[])).push({fn:n,selector:t,data:i,ctx:r,ns:c,one:s})}),this)},one:function(e,t,i,n,r){return this.on(e,t,i,n,r,1)},emit:function(e){if(!this._hub)return this;var t=this;h(e)&&(e=new CustomEvent(e)),Object.defineProperty(e,"target",{value:this});var i=s.call(arguments,1);return i=l(i)?[e].concat(i):[e],[e.type||e.name,"all"].forEach(function(n){var r=g(n),s=r.name,l=r.ns,a=t._hub[s];if(a){for(var c=a.length,h=!1,u=0;u<c;u++){var f=a[u];(!l||f.ns&&f.ns.startsWith(l))&&(e.data?f.data&&(e.data=d({},f.data,e.data)):e.data=f.data||null,f.fn.apply(f.ctx,i),f.one&&(a[u]=null,h=!0))}h&&(t._hub[n]=o(a))}}),this},listened:function(e){var t=(this._hub||(this._events={}))[e]||[];return t.length>0},listenTo:function(e,t,i,n){if(!e)return this;h(i)&&(i=this[i]),n?e.one(t,i,this):e.on(t,i,this);for(var r,s=this._listeningTo||(this._listeningTo=[]),o=0;o<s.length;o++)if(s[o].obj==e){r=s[o];break}r||s.push(r={obj:e,events:{}});var l=r.events,a=l[t]=l[t]||[];return-1==a.indexOf(i)&&a.push(i),this},listenToOnce:function(e,t,i){return this.listenTo(e,t,i,1)},off:function(e,t){var i=this._hub||(this._hub={});return h(e)&&(e=e.split(/\s/)),e.forEach(function(e){var n=g(e),r=n.name,s=n.ns,o=i[r];if(o){var l=[];if(t||s)for(var a=0,c=o.length;a<c;a++)t&&o[a].fn!==t&&o[a].fn._!==t?l.push(o[a]):!s||o[a].ns&&0==o[a].ns.indexOf(s)||l.push(o[a]);l.length?i[r]=l:delete i[r]}}),this},unlistenTo:function(e,t,i){var n=this._listeningTo;if(!n)return this;for(var r=0;r<n.length;r++){var s=n[r];if(!e||e==s.obj){var l=s.events;for(var a in l)if(!t||t==a){for(var c=l[a],h=0;h<c.length;h++)i&&i!=c[r]||(s.obj.off(a,c[r],this),c[r]=null);c=l[a]=o(c),u(c)&&(l[a]=null)}u(l)&&(n[r]=null)}}return n=this._listeningTo=o(n),u(n)&&(this._listeningTo=null),this}});return p.prototype.trigger=p.prototype.emit,p.createEvent=function(e,t){var i=new CustomEvent(e,t);return f(i,t)},e.attach("langx.Emitter",p)}),define("skylark-langx-emitter/Evented",["skylark-langx-ns/ns","./Emitter"],function(e,t){return e.attach("langx.Evented",t)}),define("skylark-net-http/http",["skylark-langx-ns/ns"],function(e){return e.attach("net.http",{})}),define("skylark-net-http/Xhr",["skylark-langx-ns/ns","skylark-langx-types","skylark-langx-objects","skylark-langx-arrays","skylark-langx-funcs","skylark-langx-async/Deferred","skylark-langx-emitter/Evented","./http"],function(skylark,types,objects,arrays,funcs,Deferred,Evented,http){var each=objects.each,mixin=objects.mixin,noop=funcs.noop,isArray=types.isArray,isFunction=types.isFunction,isPlainObject=types.isPlainObject,type=types.type,getAbsoluteUrl=function(e){return a||(a=document.createElement("a")),a.href=e,a.href},a,Xhr=function(){var jsonpID=0,key,name,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/,XhrDefaultOptions={async:!0,type:"GET",beforeSend:noop,success:noop,error:noop,complete:noop,context:null,global:!0,accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:"application/json",xml:"application/xml, text/xml",html:"text/html",text:"text/plain"},crossDomain:!1,timeout:0,processData:!1,cache:!0,xhrFields:{withCredentials:!0}};function mimeToDataType(e){if(e&&(e=e.split(";",2)[0]),e){if(e==htmlType)return"html";if(e==jsonType)return"json";if(scriptTypeRE.test(e))return"script";if(xmlTypeRE.test(e))return"xml"}return"text"}function appendQuery(e,t){return""==t?e:(e+"&"+t).replace(/[&?]{1,2}/,"?")}function serializeData(e){e.data=e.data||e.query,e.processData&&e.data&&"string"!=type(e.data)&&(e.data=param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=appendQuery(e.url,e.data),e.data=void 0)}function serialize(e,t,i,n){var r,s=isArray(t),o=isPlainObject(t);each(t,function(t,l){r=type(l),n&&(t=i?n:n+"["+(o||"object"==r||"array"==r?t:"")+"]"),!n&&s?e.add(l.name,l.value):"array"==r||!i&&"object"==r?serialize(e,l,i,t):e.add(t,l)})}var param=function(e,t){var i=[];return i.add=function(e,t){isFunction(t)&&(t=t()),null==t&&(t=""),this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},serialize(i,e,t),i.join("&").replace(/%20/g,"+")},Xhr=Evented.inherit({klassName:"Xhr",_request:function(args){var _=this._,self=this,options=mixin({},XhrDefaultOptions,_.options,args),xhr=_.xhr=new XMLHttpRequest;serializeData(options),options.beforeSend&&options.beforeSend.call(this,xhr,options);var dataType=options.dataType||options.handleAs,mime=options.mimeType||options.accepts[dataType],headers=options.headers,xhrFields=options.xhrFields,isFormData=options.data&&options.data instanceof FormData,basicAuthorizationToken=options.basicAuthorizationToken,type=options.type,url=options.url,async=options.async,user=options.user,password=options.password,deferred=new Deferred,contentType=!isFormData&&"application/x-www-form-urlencoded";if(xhrFields)for(name in xhrFields)xhr[name]=xhrFields[name];mime&&mime.indexOf(",")>-1&&(mime=mime.split(",",2)[0]),mime&&xhr.overrideMimeType&&xhr.overrideMimeType(mime);var finish=function(){xhr.onloadend=noop,xhr.onabort=noop,xhr.onprogress=noop,xhr.ontimeout=noop,xhr=null},onloadend=function(){var result,error=!1;if(xhr.status>=200&&xhr.status<300||304==xhr.status||0==xhr.status&&getAbsoluteUrl(url).startsWith("file:")){dataType=dataType||mimeToDataType(options.mimeType||xhr.getResponseHeader("content-type")),result=xhr.responseText;try{"script"==dataType?eval(result):"xml"==dataType?result=xhr.responseXML:"json"==dataType?result=blankRE.test(result)?null:JSON.parse(result):"blob"==dataType?result=Blob([xhrObj.response]):"arraybuffer"==dataType&&(result=xhr.reponse)}catch(e){error=e}error?deferred.reject(error,xhr.status,xhr):deferred.resolve(result,xhr.status,xhr)}else deferred.reject(new Error(xhr.statusText),xhr.status,xhr);finish()},onabort=function(){deferred&&deferred.reject(new Error("abort"),xhr.status,xhr),finish()},ontimeout=function(){deferred&&deferred.reject(new Error("timeout"),xhr.status,xhr),finish()},onprogress=function(e){deferred&&deferred.notify(e,xhr.status,xhr)};if(xhr.onloadend=onloadend,xhr.onabort=onabort,xhr.ontimeout=ontimeout,xhr.onprogress=onprogress,xhr.open(type,url,async,user,password),headers)for(var key in headers){var value=headers[key];"content-type"===key.toLowerCase()?contentType=value:xhr.setRequestHeader(key,value)}return contentType&&!1!==contentType&&xhr.setRequestHeader("Content-Type",contentType),headers&&"X-Requested-With"in headers||xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),basicAuthorizationToken&&xhr.setRequestHeader("Authorization",basicAuthorizationToken),xhr.send(options.data?options.data:null),deferred.promise},abort:function(){var e=this._,t=e.xhr;t&&t.abort()},request:function(e){return this._request(e)},get:function(e){return(e=e||{}).type="GET",this._request(e)},post:function(e){return(e=e||{}).type="POST",this._request(e)},patch:function(e){return(e=e||{}).type="PATCH",this._request(e)},put:function(e){return(e=e||{}).type="PUT",this._request(e)},del:function(e){return(e=e||{}).type="DELETE",this._request(e)},init:function(e){this._={options:e||{}}}});return["request","get","post","put","del","patch"].forEach(function(e){Xhr[e]=function(t,i){var n=new Xhr({url:t});return n[e](i)}}),Xhr.defaultOptions=XhrDefaultOptions,Xhr.param=param,Xhr}();return http.Xhr=Xhr}),define("skylark-jotted/util",["skylark-net-http/Xhr"],function(e){"use strict";function t(e={},t={}){var i={};return Object.keys(e).forEach(function(t){i[t]=e[t]}),Object.keys(t).forEach(function(n){void 0!==i[n]?i[n]=e[n]:i[n]=t[n]}),i}function i(e,t,n,r,s){n[e](t,function(e,t,n,r,s){return function(t,o){t&&r.push(t),++e<n.length?i(e,o,n,r,s):s(r,o)}}.apply(this,arguments))}function n(e,t){if(!e.className)return!1;var i=" "+e.className+" ";return t=" "+t+" ",-1!==i.indexOf(t)}var r={html:"html",css:"css",js:"javascript",less:"less",styl:"stylus",coffee:"coffeescript"};return{extend:t,fetch:function(t,i){e.get(t).then(function(e){i(null,e)},function(e){i(e)})},seq:function(e,t,n=function(){}){var r=[];if(!e.length)return n(r,t);i(0,t,e,r,n)},debounce:function(e,t){var i=null,n=null;return function(){i?n=!0:e.apply(this,arguments),clearTimeout(i),i=setTimeout(()=>{n&&e.apply(this,arguments),i=null,n=null},t)}},log:function(){console.log(arguments)},getMode:function(e="",i="",n={}){var s=t(n,r);for(let e in s){let t=e.length;if(i.slice(-t++)==="."+e)return s[e]}for(let t in s)if(e===t)return s[t];return e},data:function(e,t){return e.getAttribute("data-"+t)},hasClass:n,addClass:function(e,t){if(n(e,t))return e.className;e.className&&(t=" "+t);return e.className+=t,e.className},removeClass:function(e,t){var i=" "+t,n=t+" ";-1!==e.className.indexOf(i)?e.className=e.className.replace(i,""):-1!==e.className.indexOf(n)?e.className=e.className.replace(n,""):e.className=e.className.replace(t,"");return e.className}}}),define("skylark-jotted/template",[],function(){"use strict";return{container:function(){return'\n    <ul class="jotted-nav">\n      <li class="jotted-nav-item jotted-nav-item-result">\n        <a href="#" data-jotted-type="result">\n          Result\n        </a>\n      </li>\n      <li class="jotted-nav-item jotted-nav-item-html">\n        <a href="#" data-jotted-type="html">\n          HTML\n        </a>\n      </li>\n      <li class="jotted-nav-item jotted-nav-item-css">\n        <a href="#" data-jotted-type="css">\n          CSS\n        </a>\n      </li>\n      <li class="jotted-nav-item jotted-nav-item-js">\n        <a href="#" data-jotted-type="js">\n          JavaScript\n        </a>\n      </li>\n    </ul>\n    <div class="jotted-pane jotted-pane-result"><iframe></iframe></div>\n    <div class="jotted-pane jotted-pane-html"></div>\n    <div class="jotted-pane jotted-pane-css"></div>\n    <div class="jotted-pane jotted-pane-js"></div>\n  '},paneActiveClass:function(e){return`jotted-pane-active-${e}`},containerClass:function(){return"jotted"},hasFileClass:function(e){return`jotted-has-${e}`},editorClass:function(e){return`jotted-editor jotted-editor-${e}`},editorContent:function(e,t=""){return`\n    <textarea data-jotted-type="${e}" data-jotted-file="${t}"></textarea>\n    <div class="jotted-status"></div>\n  `},statusMessage:function(e){return`\n    <p>${e}</p>\n  `},statusClass:function(e){return`jotted-status-${e}`},statusActiveClass:function(e){return`jotted-status-active-${e}`},pluginClass:function(e){return`jotted-plugin-${e}`},statusLoading:function(e){return`Loading <strong>${e}</strong>..`},statusFetchError:function(e){return`There was an error loading <strong>${e}</strong>.`}}}),define("skylark-jotted/plugin",["./util","./template"],function(e,t){"use strict";var i=[];return{register:function(e,t){t._id=e,i.push(t)},init:function(){this._get("options").plugins.forEach(n=>{let r,s,o={};"string"==typeof n?s=n:"object"==typeof n&&(s=n.name,o=n.options||{}),r=function(e){for(let t in i){let n=i[t];if(n._id===e)return n}throw new Error(`Plugin ${e} is not registered.`)}(s),this._get("plugins")[n]=new r(this,o),e.addClass(this._get("$container"),t.pluginClass(s))})}}}),define("skylark-jotted/pubsoup",["./util"],function(e){"use strict";return class{constructor(){this.topics={},this.callbacks={}}find(e){return this.topics[e]=this.topics[e]||[],this.topics[e]}subscribe(e,t,i=90){var n=this.find(e);t._priority=i,n.push(t),n.sort(function(e,t){return e._priority>t._priority?1:t._priority>e._priority?-1:0})}remover(e,t){e.forEach(function(){if(t){var i=[].indexOf.call(e,t);-1!==i&&e.splice(i,1)}else e.length=0})}unsubscribe(e,t){var i=this.find(e);this.remover(i,t),this.callbacks[e]=this.callbacks[e]||[],this.remover(this.callbacks[e],t)}publish(t,i={}){var n=this.find(t),r=[];n.forEach(function(e){r.push(e)}),e.seq(r,i,this.runCallbacks(t))}runCallbacks(e){return(t,i)=>{this.callbacks[e]=this.callbacks[e]||[],this.callbacks[e].forEach(e=>{e(t,i)})}}done(e,t=function(){}){this.callbacks[e]=this.callbacks[e]||[],this.callbacks[e].push(t)}}}),define("skylark-jotted/plugins/render",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{});var n=!!("srcdoc"in document.createElement("iframe")),r=t.$container.querySelector(".jotted-pane-result iframe");window.addEventListener("message",this.domready.bind(this)),t.on("change",this.change.bind(this),100),this.supportSrcdoc=n,this.content={html:"",css:"",js:""},this.frameContent="",this.$resultFrame=r,this.callbacks=[],this.index=0,this.lastCallback=(()=>{})}template(e="",t="",i=""){return`\n      <!doctype html>\n      <html>\n        <head>\n          <script>\n            (function () {\n              window.addEventListener('DOMContentLoaded', function () {\n                window.parent.postMessage(JSON.stringify({\n                  type: 'jotted-dom-ready'\n                }), '*')\n              })\n            }())\n          <\/script>\n\n          <style>${e}</style>\n        </head>\n        <body>\n          ${t}\n\n          \x3c!--\n            Jotted:\n            Empty script tag prevents malformed HTML from breaking the next script.\n          --\x3e\n          <script><\/script>\n          <script>${i}<\/script>\n        </body>\n      </html>\n    `}change(e,t){this.content[e.type]=e.content;var i=this.frameContent;if(this.frameContent=this.template(this.content.css,this.content.html,this.content.js),this.lastCallback=(()=>{this.lastCallback=(()=>{}),t(null,e)}),!0===e.forceRender||this.frameContent!==i)if(this.supportSrcdoc){var n=document.createElement("iframe");this.$resultFrame.parentNode.replaceChild(n,this.$resultFrame),this.$resultFrame=n,this.$resultFrame.contentWindow.document.open(),this.$resultFrame.contentWindow.document.write(this.frameContent),this.$resultFrame.contentWindow.document.close()}else{this.$resultFrame.setAttribute("data-srcdoc",this.frameContent);var r='javascript:window.frameElement.getAttribute("data-srcdoc");';this.$resultFrame.setAttribute("src",r),this.$resultFrame.contentWindow&&(this.$resultFrame.contentWindow.location=r)}else t(null,e)}domready(e){if(e.source===this.$resultFrame.contentWindow){var t={};try{t=JSON.parse(e.data)}catch(e){}"jotted-dom-ready"===t.type&&this.lastCallback()}}}}),define("skylark-jotted/plugins/scriptless",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{});t.on("change",this.change.bind(this)),this.runScriptTypes=["application/javascript","application/ecmascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]}change(e,t){if("html"!==e.type)return t(null,e);var i=document.createElement("div");i.innerHTML=e.content;var n=null,r=i.querySelectorAll("script");for(let e=0;e<r.length;e++)(n=r[e].getAttribute("type"))&&-1===this.runScriptTypes.indexOf(n)||r[e].parentNode.removeChild(r[e]);e.content=i.innerHTML,t(null,e)}}}),define("skylark-ace/lib/regexp",["require","exports","module"],function(e,t,i){var n,r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},s=void 0===r.exec.call(/()??/,"")[1],o=(n=/^/g,r.test.call(n,""),!n.lastIndex);o&&s||(RegExp.prototype.exec=function(e){var t,i,n,l=r.exec.apply(this,arguments);if("string"==typeof e&&l){if(!s&&l.length>1&&function(e,t,i){if(Array.prototype.indexOf)return e.indexOf(t,i);for(var n=i||0;n<e.length;n++)if(e[n]===t)return n;return-1}(l,"")>-1&&(i=RegExp(this.source,r.replace.call(((n=this).global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),"g","")),r.replace.call(e.slice(l.index),i,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(l[e]=void 0)})),this._xregexp&&this._xregexp.captureNames)for(var a=1;a<l.length;a++)(t=this._xregexp.captureNames[a-1])&&(l[t]=l[a]);!o&&this.global&&!l[0].length&&this.lastIndex>l.index&&this.lastIndex--}return l},o||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t}))}),define("skylark-ace/lib/es5-shim",["require","exports","module"],function(e,t,i){function n(){}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError("Function.prototype.bind called on incompatible "+t);var i=d.call(arguments,1),r=function(){if(this instanceof r){var n=t.apply(this,i.concat(d.call(arguments)));return Object(n)===n?n:this}return t.apply(e,i.concat(d.call(arguments)))};return t.prototype&&(n.prototype=t.prototype,r.prototype=new n,n.prototype=null),r});var r,s,o,l,a,c=Function.prototype.call,h=Array.prototype,u=Object.prototype,d=h.slice,f=c.bind(u.toString),g=c.bind(u.hasOwnProperty);if((a=g(u,"__defineGetter__"))&&(r=c.bind(u.__defineGetter__),s=c.bind(u.__defineSetter__),o=c.bind(u.__lookupGetter__),l=c.bind(u.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t,i=[];if(i.splice.apply(i,e(20)),i.splice.apply(i,e(26)),t=i.length,i.splice(5,0,"XXX"),i.length,t+1==i.length)return!0}()){var p=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?p.apply(this,[void 0===e?0:e,void 0===t?this.length-e:t].concat(d.call(arguments,2))):[]}}else Array.prototype.splice=function(e,t){var i=this.length;e>0?e>i&&(e=i):void 0==e?e=0:e<0&&(e=Math.max(i+e,0)),e+t<i||(t=i-e);var n=this.slice(e,e+t),r=d.call(arguments,2),s=r.length;if(e===i)s&&this.push.apply(this,r);else{var o=Math.min(t,i-e),l=e+o,a=l+s-o,c=i-l,h=i-o;if(a<l)for(var u=0;u<c;++u)this[a+u]=this[l+u];else if(a>l)for(u=c;u--;)this[a+u]=this[l+u];if(s&&e===h)this.length=h,this.push.apply(this,r);else for(this.length=h+s,u=0;u<s;++u)this[e+u]=r[u]}return n};Array.isArray||(Array.isArray=function(e){return"[object Array]"==f(e)});var m,v,y=Object("a"),w="a"!=y[0]||!(0 in y);if(Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=arguments[1],r=-1,s=i.length>>>0;if("[object Function]"!=f(e))throw new TypeError;for(;++r<s;)r in i&&e.call(n,i[r],r,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=i.length>>>0,r=Array(n),s=arguments[1];if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");for(var o=0;o<n;o++)o in i&&(r[o]=e.call(s,i[o],o,t));return r}),Array.prototype.filter||(Array.prototype.filter=function(e){var t,i=E(this),n=w&&"[object String]"==f(this)?this.split(""):i,r=n.length>>>0,s=[],o=arguments[1];if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");for(var l=0;l<r;l++)l in n&&(t=n[l],e.call(o,t,l,i)&&s.push(t));return s}),Array.prototype.every||(Array.prototype.every=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=i.length>>>0,r=arguments[1];if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");for(var s=0;s<n;s++)if(s in i&&!e.call(r,i[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=i.length>>>0,r=arguments[1];if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");for(var s=0;s<n;s++)if(s in i&&e.call(r,i[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var r,s=0;if(arguments.length>=2)r=arguments[1];else for(;;){if(s in i){r=i[s++];break}if(++s>=n)throw new TypeError("reduce of empty array with no initial value")}for(;s<n;s++)s in i&&(r=e.call(void 0,r,i[s],s,t));return r}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=E(this),i=w&&"[object String]"==f(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=f(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var r,s=n-1;if(arguments.length>=2)r=arguments[1];else for(;;){if(s in i){r=i[s--];break}if(--s<0)throw new TypeError("reduceRight of empty array with no initial value")}do{s in this&&(r=e.call(void 0,r,i[s],s,t))}while(s--);return r}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(e){var t=w&&"[object String]"==f(this)?this.split(""):E(this),i=t.length>>>0;if(!i)return-1;var n=0;for(arguments.length>1&&(n=_(arguments[1])),n=n>=0?n:Math.max(0,i+n);n<i;n++)if(n in t&&t[n]===e)return n;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(e){var t=w&&"[object String]"==f(this)?this.split(""):E(this),i=t.length>>>0;if(!i)return-1;var n=i-1;for(arguments.length>1&&(n=Math.min(n,_(arguments[1]))),n=n>=0?n:i-Math.abs(n);n>=0;n--)if(n in t&&e===t[n])return n;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:u)}),!Object.getOwnPropertyDescriptor){Object.getOwnPropertyDescriptor=function(e,t){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+e);if(g(e,t)){var i;if(i={enumerable:!0,configurable:!0},a){var n=e.__proto__;e.__proto__=u;var r=o(e,t),s=l(e,t);if(e.__proto__=n,r||s)return r&&(i.get=r),s&&(i.set=s),i}return i.value=e[t],i}}}(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),Object.create)||(m=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var i;if(null===e)i=m();else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,(i=new n).__proto__=e}return void 0!==t&&Object.defineProperties(i,t),i});function b(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(e){}}if(Object.defineProperty){var C=b({}),k="undefined"==typeof document||b(document.createElement("div"));if(!C||!k)var x=Object.defineProperty}if(!Object.defineProperty||x){Object.defineProperty=function(e,t,i){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.defineProperty called on non-object: "+e);if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError("Property description must be an object: "+i);if(x)try{return x.call(Object,e,t,i)}catch(e){}if(g(i,"value"))if(a&&(o(e,t)||l(e,t))){var n=e.__proto__;e.__proto__=u,delete e[t],e[t]=i.value,e.__proto__=n}else e[t]=i.value;else{if(!a)throw new TypeError("getters & setters can not be defined on this javascript engine");g(i,"get")&&r(e,t,i.get),g(i,"set")&&s(e,t,i.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var i in t)g(t,i)&&Object.defineProperty(e,i,t[i]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(e){Object.freeze=(v=Object.freeze,function(e){return"function"==typeof e?e:v(e)})}if(Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;for(var t="";g(e,t);)t+="?";e[t]=!0;var i=g(e,t);return delete e[t],i}),!Object.keys){var S=!0,$=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],L=$.length;for(var A in{toString:null})S=!1;Object.keys=function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var t=[];for(var i in e)g(e,i)&&t.push(i);if(S)for(var n=0,r=L;n<r;n++){var s=$[n];g(e,s)&&t.push(s)}return t}}Date.now||(Date.now=function(){return(new Date).getTime()});var M="\t\n\v\f\r   ᠎             　\u2028\u2029\ufeff";if(!String.prototype.trim||M.trim()){M="["+M+"]";var T=new RegExp("^"+M+M+"*"),R=new RegExp(M+M+"*$");String.prototype.trim=function(){return String(this).replace(T,"").replace(R,"")}}function _(e){return(e=+e)!=e?e=0:0!==e&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}var E=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),define("skylark-ace/lib/fixoldbrowsers",["require","exports","module","./regexp","./es5-shim"],function(e,t,i){e("./regexp"),e("./es5-shim"),"undefined"==typeof Element||Element.prototype.remove||Object.defineProperty(Element.prototype,"remove",{enumerable:!1,writable:!0,configurable:!0,value:function(){this.parentNode&&this.parentNode.removeChild(this)}})}),define("skylark-ace/lib/useragent",["require","exports","module"],function(e,t,i){if(t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS},"object"==typeof navigator){var n=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),r=navigator.userAgent;t.isWin="win"==n,t.isMac="mac"==n,t.isLinux="linux"==n,t.isIE="Microsoft Internet Explorer"==navigator.appName||navigator.appName.indexOf("MSAppHost")>=0?parseFloat((r.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((r.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=r.match(/ Gecko\/\d+/),t.isOpera=window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(r.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(r.split(" Chrome/")[1])||void 0,t.isEdge=parseFloat(r.split(" Edge/")[1])||void 0,t.isAIR=r.indexOf("AdobeAIR")>=0,t.isIPad=r.indexOf("iPad")>=0,t.isAndroid=r.indexOf("Android")>=0,t.isChromeOS=r.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(r)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIPad||t.isAndroid}}),define("skylark-ace/lib/dom",["require","exports","module","./useragent"],function(e,t,i){var n=e("./useragent");if(t.buildDom=function e(t,i,n){if("string"==typeof t&&t){var r=document.createTextNode(t);return i&&i.appendChild(r),r}if(!Array.isArray(t))return t;if("string"!=typeof t[0]||!t[0]){for(var s=[],o=0;o<t.length;o++){var l=e(t[o],i,n);l&&s.push(l)}return s}var a=document.createElement(t[0]),c=t[1],h=1;c&&"object"==typeof c&&!Array.isArray(c)&&(h=2);for(var o=h;o<t.length;o++)e(t[o],a,n);return 2==h&&Object.keys(c).forEach(function(e){var t=c[e];"class"===e?a.className=Array.isArray(t)?t.join(" "):t:"function"==typeof t||"value"==e?a[e]=t:"ref"===e?n&&(n[t]=a):null!=t&&a.setAttribute(e,t)}),i&&i.appendChild(a),a},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||"http://www.w3.org/1999/xhtml",e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){var i=t?t.ownerDocument:document;return i.createTextNode(e)},t.createFragment=function(e){var t=e?e.ownerDocument:document;return t.createDocumentFragment()},t.hasCssClass=function(e,t){var i=(e.className+"").split(/\s+/g);return-1!==i.indexOf(t)},t.addCssClass=function(e,i){t.hasCssClass(e,i)||(e.className+=" "+i)},t.removeCssClass=function(e,t){for(var i=e.className.split(/\s+/g);;){var n=i.indexOf(t);if(-1==n)break;i.splice(n,1)}e.className=i.join(" ")},t.toggleCssClass=function(e,t){for(var i=e.className.split(/\s+/g),n=!0;;){var r=i.indexOf(t);if(-1==r)break;n=!1,i.splice(r,1)}return n&&i.push(t),e.className=i.join(" "),n},t.setCssClass=function(e,i,n){n?t.addCssClass(e,i):t.removeCssClass(e,i)},t.hasCssString=function(e,t){var i,n=0;if(t=t||document,i=t.querySelectorAll("style"))for(;n<i.length;)if(i[n++].id===e)return!0},t.importCssString=function(e,i,n){var r=n;n&&n.getRootNode&&(r=n.getRootNode())&&r!=n||(r=document);var s=r.ownerDocument||r;if(i&&t.hasCssString(i,r))return null;i&&(e+="\n/*# sourceURL=ace/css/"+i+" */");var o=t.createElement("style");o.appendChild(s.createTextNode(e)),i&&(o.id=i),r==s&&(r=t.getDocumentHead(s)),r.insertBefore(o,r.firstChild)},t.importCssStylsheet=function(e,i){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(i))},t.scrollbarWidth=function(e){var i=t.createElement("ace_inner");i.style.width="100%",i.style.minWidth="0px",i.style.height="200px",i.style.display="block";var n=t.createElement("ace_outer"),r=n.style;r.position="absolute",r.left="-10000px",r.overflow="hidden",r.width="200px",r.minWidth="0px",r.height="150px",r.display="block",n.appendChild(i);var s=e.documentElement;s.appendChild(n);var o=i.offsetWidth;r.overflow="scroll";var l=i.offsetWidth;return o==l&&(l=n.clientWidth),s.removeChild(n),o-l},"undefined"==typeof document&&(t.importCssString=function(){}),t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,i){e[t]!==i&&(e[t]=i)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=!n.isWin||"undefined"!=typeof window&&window.devicePixelRatio>=1.5,"undefined"!=typeof document){var r=document.createElement("div");t.HI_DPI&&void 0!==r.style.transform&&(t.HAS_CSS_TRANSFORMS=!0),n.isEdge||void 0===r.style.animationName||(t.HAS_CSS_ANIMATION=!0),r=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,i){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(i)+"px)"}:t.translate=function(e,t,i){e.style.top=Math.round(i)+"px",e.style.left=Math.round(t)+"px"}}),define("skylark-ace/lib/oop",["require","exports","module"],function(e,t,i){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var i in t)e[i]=t[i];return e},t.implement=function(e,i){t.mixin(e,i)}}),define("skylark-ace/lib/keys",["require","exports","module","./oop"],function(e,t,i){var n=e("./oop"),r=function(){var e,t,i={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}};for(t in i.FUNCTION_KEYS)e=i.FUNCTION_KEYS[t].toLowerCase(),i[e]=parseInt(t,10);for(t in i.PRINTABLE_KEYS)e=i.PRINTABLE_KEYS[t].toLowerCase(),i[e]=parseInt(t,10);return n.mixin(i,i.MODIFIER_KEYS),n.mixin(i,i.PRINTABLE_KEYS),n.mixin(i,i.FUNCTION_KEYS),i.enter=i.return,i.escape=i.esc,i.del=i.delete,i[173]="-",function(){for(var e=["cmd","ctrl","alt","shift"],t=Math.pow(2,e.length);t--;)i.KEY_MODS[t]=e.filter(function(e){return t&i.KEY_MODS[e]}).join("-")+"-"}(),i.KEY_MODS[0]="",i.KEY_MODS[-1]="input-",i}();n.mixin(t,r),t.keyCodeToString=function(e){var t=r[e];return"string"!=typeof t&&(t=String.fromCharCode(e)),t.toLowerCase()}}),define("skylark-ace/lib/event",["require","exports","module","./keys","./useragent"],function(e,t,i){var n=e("./keys"),r=e("./useragent"),s=null,o=0;t.addListener=function(e,t,i){if(e.addEventListener)return e.addEventListener(t,i,!1);if(e.attachEvent){var n=function(){i.call(e,window.event)};i._wrapper=n,e.attachEvent("on"+t,n)}},t.removeListener=function(e,t,i){if(e.removeEventListener)return e.removeEventListener(t,i,!1);e.detachEvent&&e.detachEvent("on"+t,i._wrapper||i)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||r.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,i,n){function r(e){i&&i(e),n&&n(e),t.removeListener(document,"mousemove",i,!0),t.removeListener(document,"mouseup",r,!0),t.removeListener(document,"dragstart",r,!0)}return t.addListener(document,"mousemove",i,!0),t.addListener(document,"mouseup",r,!0),t.addListener(document,"dragstart",r,!0),r},t.addTouchMoveListener=function(e,i){var n,r;t.addListener(e,"touchstart",function(e){var t=e.touches,i=t[0];n=i.clientX,r=i.clientY}),t.addListener(e,"touchmove",function(e){var t=e.touches;if(!(t.length>1)){var s=t[0];e.wheelX=n-s.clientX,e.wheelY=r-s.clientY,n=s.clientX,r=s.clientY,i(e)}})},t.addMouseWheelListener=function(e,i){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){void 0!==e.wheelDeltaX?(e.wheelX=-e.wheelDeltaX/8,e.wheelY=-e.wheelDeltaY/8):(e.wheelX=0,e.wheelY=-e.wheelDelta/8),i(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=.35*e.deltaX||0,e.wheelY=.35*e.deltaY||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=5*(e.deltaX||0),e.wheelY=5*(e.deltaY||0)}i(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=5*(e.detail||0),e.wheelY=0):(e.wheelX=0,e.wheelY=5*(e.detail||0)),i(e)})},t.addMultiMouseDownListener=function(e,i,n,s){var o,l,a,c=0,h={2:"dblclick",3:"tripleclick",4:"quadclick"};function u(e){if(0!==t.getButton(e)?c=0:e.detail>1?++c>4&&(c=1):c=1,r.isIE){var u=Math.abs(e.clientX-o)>5||Math.abs(e.clientY-l)>5;a&&!u||(c=1),a&&clearTimeout(a),a=setTimeout(function(){a=null},i[c-1]||600),1==c&&(o=e.clientX,l=e.clientY)}if(e._clicks=c,n[s]("mousedown",e),c>4)c=0;else if(c>1)return n[s](h[c],e)}function d(e){c=2,a&&clearTimeout(a),a=setTimeout(function(){a=null},i[c-1]||600),n[s]("mousedown",e),n[s](h[c],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){t.addListener(e,"mousedown",u),r.isOldIE&&t.addListener(e,"dblclick",d)})};var l=!r.isMac||!r.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};function a(e,t,i){var a=l(t);if(!r.isMac&&s){if(t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(a|=8),s.altGr){if(3==(3&a))return;s.altGr=0}if(18===i||17===i){var c="location"in t?t.location:t.keyLocation;if(17===i&&1===c)1==s[i]&&(o=t.timeStamp);else if(18===i&&3===a&&2===c){var h=t.timeStamp-o;h<50&&(s.altGr=!0)}}}if(i in n.MODIFIER_KEYS&&(i=-1),8&a&&i>=91&&i<=93&&(i=-1),!a&&13===i){var c="location"in t?t.location:t.keyLocation;if(3===c&&(e(t,a,-i),t.defaultPrevented))return}if(r.isChromeOS&&8&a){if(e(t,a,i),t.defaultPrevented)return;a&=-9}return!!(a||i in n.FUNCTION_KEYS||i in n.PRINTABLE_KEYS)&&e(t,a,i)}function c(){s=Object.create(null)}if(t.getModifierString=function(e){return n.KEY_MODS[l(e)]},t.addCommandKeyListener=function(e,i){var n=t.addListener;if(r.isOldGecko||r.isOpera&&!("KeyboardEvent"in window)){var o=null;n(e,"keydown",function(e){o=e.keyCode}),n(e,"keypress",function(e){return a(i,e,o)})}else{var l=null;n(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=a(i,e,e.keyCode);return l=e.defaultPrevented,t}),n(e,"keypress",function(e){l&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),l=null)}),n(e,"keyup",function(e){s[e.keyCode]=null}),s||(c(),n(window,"focus",c))}},"object"==typeof window&&window.postMessage&&!r.isOldIE){var h=1;t.nextTick=function(e,i){i=i||window;var n="zero-timeout-message-"+h++,r=function(s){s.data==n&&(t.stopPropagation(s),t.removeListener(i,"message",r),e())};t.addListener(i,"message",r),i.postMessage(n,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,i){return setTimeout(function i(){t.$idleBlocked?setTimeout(i,100):e()},i)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),define("skylark-ace/range",["require","exports","module"],function(e,t,i){var n=function(e,t,i,n){this.start={row:e,column:t},this.end={row:i,column:n}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return 0==this.compare(e,t)},this.compareRange=function(e){var t,i=e.end,n=e.start;return 1==(t=this.compare(i.row,i.column))?1==(t=this.compare(n.row,n.column))?2:0==t?1:0:-1==t?-2:-1==(t=this.compare(n.row,n.column))?-1:1==t?42:0},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},this.intersects=function(e){var t=this.compareRange(e);return-1==t||0==t||1==t},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return 0==this.compare(e,t)&&(!this.isEnd(e,t)&&!this.isStart(e,t))},this.insideStart=function(e,t){return 0==this.compare(e,t)&&!this.isEnd(e,t)},this.insideEnd=function(e,t){return 0==this.compare(e,t)&&!this.isStart(e,t)},this.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:t>this.end.column?1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var i={row:t+1,column:0};else if(this.end.row<e)var i={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return n.fromPoints(r||this.start,i||this.end)},this.extend=function(e,t){var i=this.compare(e,t);if(0==i)return this;if(-1==i)var r={row:e,column:t};else var s={row:e,column:t};return n.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return n.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new n(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new n(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),i=e.documentToScreenPosition(this.end);return new n(t.row,t.column,i.row,i.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(n.prototype),n.fromPoints=function(e,t){return new n(e.row,e.column,t.row,t.column)},n.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},n.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=n}),define("skylark-ace/lib/lang",["require","exports","module"],function(e,t,i){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var i="";t>0;)1&t&&(i+=e),(t>>=1)&&(e+=e);return i};var n=/^\s\s*/,r=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(n,"")},t.stringTrimRight=function(e){return e.replace(r,"")},t.copyObject=function(e){var t={};for(var i in e)t[i]=e[i];return t},t.copyArray=function(e){for(var t=[],i=0,n=e.length;i<n;i++)e[i]&&"object"==typeof e[i]?t[i]=this.copyObject(e[i]):t[i]=e[i];return t},t.deepCopy=function e(t){if("object"!=typeof t||!t)return t;var i;if(Array.isArray(t)){i=[];for(var n=0;n<t.length;n++)i[n]=e(t[n]);return i}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var n in i={},t)i[n]=e(t[n]);return i},t.arrayToMap=function(e){for(var t={},i=0;i<e.length;i++)t[e[i]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var i in e)t[i]=e[i];return t},t.arrayRemove=function(e,t){for(var i=0;i<=e.length;i++)t===e[i]&&e.splice(i,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var i=[];return e.replace(t,function(e){i.push({offset:arguments[arguments.length-2],length:e.length})}),i},t.deferredCall=function(e){var t=null,i=function(){t=null,e()},n=function(e){return n.cancel(),t=setTimeout(i,e||0),n};return n.schedule=n,n.call=function(){return this.cancel(),e(),n},n.cancel=function(){return clearTimeout(t),t=null,n},n.isPending=function(){return t},n},t.delayedCall=function(e,t){var i=null,n=function(){i=null,e()},r=function(e){null==i&&(i=setTimeout(n,e||t))};return r.delay=function(e){i&&clearTimeout(i),i=setTimeout(n,e||t)},r.schedule=r,r.call=function(){this.cancel(),e()},r.cancel=function(){i&&clearTimeout(i),i=null},r.isPending=function(){return i},r}}),define("skylark-ace/keyboard/textinput",["require","exports","module","../lib/event","../lib/useragent","../lib/dom","../lib/lang","../lib/keys"],function(e,t,i){var n=e("../lib/event"),r=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),l=r.isChrome<18,a=r.isIE,c=r.isChrome>63,h=e("../lib/keys"),u=h.KEY_MODS,d=r.isIOS,f=d?/\s/:/\n/;t.TextInput=function(e,t){var i=s.createElement("textarea");i.className="ace_text-input",i.setAttribute("wrap","off"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck",!1),i.style.opacity="0",e.insertBefore(i,e.firstChild);var g=!1,p=!1,m=!1,v=!1,y="";r.isMobile||(i.style.fontSize="1px");var w=!1,b=!1,C="",k=0,x=0;try{var S=document.activeElement===i}catch(e){}n.addListener(i,"blur",function(e){b||(t.onBlur(e),S=!1)}),n.addListener(i,"focus",function(e){if(!b){if(S=!0,r.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),r.isEdge?setTimeout($):$()}}),this.$focusScroll=!1,this.focus=function(){if(y||c||"browser"==this.$focusScroll)return i.focus({preventScroll:!0});var e=i.style.top;i.style.position="fixed",i.style.top="0px";try{var t=0!=i.getBoundingClientRect().top}catch(e){return}var n=[];if(t)for(var r=i.parentElement;r&&1==r.nodeType;)n.push(r),r.setAttribute("ace_nocontext",!0),r=!r.parentElement&&r.getRootNode?r.getRootNode().host:r.parentElement;i.focus({preventScroll:!0}),t&&n.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){i.style.position="","0px"==i.style.top&&(i.style.top=e)},0)},this.blur=function(){i.blur()},this.isFocused=function(){return S},t.on("beforeEndOperation",function(){t.curOp&&"insertstring"==t.curOp.command.name||(m&&(C=i.value="",W()),$())});var $=d?function(e){if(S&&(!g||e)&&!v){e||(e="");var n="\n ab"+e+"cde fg\n";n!=i.value&&(i.value=C=n);var r=4+(e.length||(t.selection.isEmpty()?0:1));4==k&&x==r||i.setSelectionRange(4,r),k=4,x=r}}:function(){if(!m&&!v&&(S||A)){m=!0;var e=t.selection,n=e.getRange(),r=e.cursor.row,s=n.start.column,o=n.end.column,l=t.session.getLine(r);if(n.start.row!=r){var a=t.session.getLine(r-1);s=n.start.row<r-1?0:s,o+=a.length+1,l=a+"\n"+l}else if(n.end.row!=r){var c=t.session.getLine(r+1);o=n.end.row>r+1?c.length:o,o+=l.length+1,l=l+"\n"+c}l.length>400&&(s<400&&o<400?l=l.slice(0,400):(l="\n",s=0,o=1));var h=l+"\n\n";if(h!=C&&(i.value=C=h,k=x=h.length),A&&(k=i.selectionStart,x=i.selectionEnd),x!=o||k!=s||i.selectionEnd!=x)try{i.setSelectionRange(s,o),k=s,x=o}catch(e){}m=!1}};S&&t.onFocus();var L=null;this.setInputHandler=function(e){L=e},this.getInputHandler=function(){return L};var A=!1,M=function(e,n){if(A&&(A=!1),p)return $(),e&&t.onPaste(e),p=!1,"";for(var r=i.selectionStart,s=i.selectionEnd,o=k,l=C.length-x,a=e,c=e.length-r,h=e.length-s,u=0;o>0&&C[u]==e[u];)u++,o--;for(a=a.slice(u),u=1;l>0&&C.length-u>k-1&&C[C.length-u]==e[e.length-u];)u++,l--;return c-=u-1,h-=u-1,a=a.slice(0,a.length-u+1),n||c!=a.length||o||l||h?(v=!0,a&&!o&&!l&&!c&&!h||w?t.onTextInput(a):t.onTextInput(a,{extendLeft:o,extendRight:l,restoreStart:c,restoreEnd:h}),v=!1,C=e,k=r,x=s,a):""},T=function(e){if(m)return D();var t=i.value,n=M(t,!0);(t.length>500||f.test(n))&&$()},R=function(e,t,i){var n=e.clipboardData||window.clipboardData;if(n&&!l){var r=a||i?"Text":"text/plain";try{return t?!1!==n.setData(r,t):n.getData(r)}catch(e){if(!i)return R(e,t,!0)}}},_=function(e,r){var s=t.getCopyText();if(!s)return n.preventDefault(e);R(e,s)?(d&&($(s),g=s,setTimeout(function(){g=!1},10)),r?t.onCut():t.onCopy(),n.preventDefault(e)):(g=!0,i.value=s,i.select(),setTimeout(function(){g=!1,$(),r?t.onCut():t.onCopy()}))},E=function(e){_(e,!0)},O=function(e){_(e,!1)},F=function(e){var s=R(e);"string"==typeof s?(s&&t.onPaste(s,e),r.isIE&&setTimeout($),n.preventDefault(e)):(i.value="",p=!0)};n.addCommandKeyListener(i,t.onCommandKey.bind(t)),n.addListener(i,"select",function(e){m||(g?g=!1:function(e){return 0===e.selectionStart&&e.selectionEnd>=C.length&&e.value===C&&C&&e.selectionEnd!==x}(i)&&(t.selectAll(),$()))}),n.addListener(i,"input",T),n.addListener(i,"cut",E),n.addListener(i,"copy",O),n.addListener(i,"paste",F),"oncut"in i&&"oncopy"in i&&"onpaste"in i||n.addListener(e,"keydown",function(e){if((!r.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:O(e);break;case 86:F(e);break;case 88:E(e)}});var D=function(){if(m&&t.onCompositionUpdate&&!t.$readOnly){if(w)return P();if(m.useTextareaForIME)t.onCompositionUpdate(i.value);else{var e=i.value;M(e),m.markerRange&&(m.context&&(m.markerRange.start.column=m.selectionStart=m.context.compositionStartOffset),m.markerRange.end.column=m.markerRange.start.column+x-m.selectionStart)}}},W=function(e){t.onCompositionEnd&&!t.$readOnly&&(m=!1,t.onCompositionEnd(),t.off("mousedown",P),e&&T())};function P(){b=!0,i.blur(),i.focus(),b=!1}var I,N=o.delayedCall(D,50).schedule.bind(null,null);function H(){clearTimeout(I),I=setTimeout(function(){y&&(i.style.cssText=y,y=""),null==t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}n.addListener(i,"compositionstart",function(e){if(m||!t.onCompositionStart||t.$readOnly)return;if(m={},w)return;setTimeout(D,0),t.on("mousedown",P);var n=t.getSelectionRange();n.end.row=n.start.row,n.end.column=n.start.column,m.markerRange=n,m.selectionStart=k,t.onCompositionStart(m),m.useTextareaForIME?(i.value="",C="",k=0,x=0):(i.msGetInputContext&&(m.context=i.msGetInputContext()),i.getInputContext&&(m.context=i.getInputContext()))}),n.addListener(i,"compositionupdate",D),n.addListener(i,"keyup",function(e){27==e.keyCode&&i.value.length<i.selectionStart&&(m||(C=i.value),k=x=-1,$());N()}),n.addListener(i,"keydown",N),n.addListener(i,"compositionend",W),this.getElement=function(){return i},this.setCommandMode=function(e){w=e,i.readOnly=!1},this.setReadOnly=function(e){w||(i.readOnly=e)},this.setCopyWithEmptySelection=function(e){e},this.onContextMenu=function(e){A=!0,$(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){y||(y=i.style.cssText),i.style.cssText=(o?"z-index:100000;":"")+(r.isIE?"opacity:0.1;":"")+"text-indent: -"+(k+x)*t.renderer.characterWidth*.5+"px;";var l=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),c=l.top+(parseInt(a.borderTopWidth)||0),h=l.left+(parseInt(l.borderLeftWidth)||0),u=l.bottom-c-i.clientHeight-2,d=function(e){i.style.left=e.clientX-h-2+"px",i.style.top=Math.min(e.clientY-c-2,u)+"px"};d(e),"mousedown"==e.type&&(t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(I),r.isWin&&n.capture(t.container,d,H))},this.onContextMenuClose=H;var B=function(e){t.textInput.onContextMenu(e),H()};n.addListener(i,"mouseup",B),n.addListener(i,"mousedown",function(e){e.preventDefault(),H()}),n.addListener(t.renderer.scroller,"contextmenu",B),n.addListener(i,"contextmenu",B),d&&function(e,t,i){var n=null,r=!1;i.addEventListener("keydown",function(e){n&&clearTimeout(n),r=!0},!0),i.addEventListener("keyup",function(e){n=setTimeout(function(){r=!1},100)},!0);var s=function(e){if(document.activeElement===i&&!r&&!m&&!g){var n=i.selectionStart,s=i.selectionEnd,o=null,l=0;console.log(n,s),0==n?o=h.up:1==n?o=h.home:s>x&&"\n"==C[s]?o=h.end:n<k&&" "==C[n-1]?(o=h.left,l=u.option):n<k||n==k&&x!=k&&n==s?o=h.left:s>x&&C.slice(0,s).split("\n").length>2?o=h.down:s>x&&" "==C[s-1]?(o=h.right,l=u.option):(s>x||s==x&&x!=k&&n==s)&&(o=h.right),n!==s&&(l|=u.shift),o&&(t.onCommandKey(null,l,o),k=n,x=s,$(""))}};document.addEventListener("selectionchange",s),t.on("destroy",function(){document.removeEventListener("selectionchange",s)})}(0,t,i)}}),define("skylark-ace/mouse/default_handlers",["require","exports","module","../lib/useragent"],function(e,t,i){var n=e("../lib/useragent");function r(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),t.setDefaultHandler("touchmove",this.onTouchMove.bind(e));["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function s(e,t){if(e.start.row==e.end.row)var i=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var i=2*t.row-e.start.row-e.end.row;else var i=t.column-4;return i<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}(function(){this.onMouseDown=function(e){var t=e.inSelection(),i=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,s=e.getButton();if(0!==s){var o=r.getSelectionRange(),l=o.isEmpty();return(l||1==s)&&r.selection.moveToPosition(i),void(2==s&&(r.textInput.onContextMenu(e.domEvent),n.isMozilla||e.preventDefault()))}return this.mousedownEvent.time=Date.now(),!t||r.isFocused()||(r.focus(),!this.$focusTimeout||this.$clickSelection||r.inMultiSelectMode)?(this.captureMouse(e),this.startSelect(i,e.domEvent._clicks>1),e.preventDefault()):(this.setState("focusWait"),void this.captureMouse(e))},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var i=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?i.selection.selectToPosition(e):t||i.selection.moveToPosition(e),t||this.select(),i.renderer.scroller.setCapture&&i.renderer.scroller.setCapture(),i.setStyle("ace_selecting"),this.setState("select"))},this.select=function(){var e,t=this.editor,i=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var n=this.$clickSelection.comparePoint(i);if(-1==n)e=this.$clickSelection.end;else if(1==n)e=this.$clickSelection.start;else{var r=s(this.$clickSelection,i);i=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(i),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,i=this.editor,n=i.renderer.screenToTextCoordinates(this.x,this.y),r=i.selection[e](n.row,n.column);if(this.$clickSelection){var o=this.$clickSelection.comparePoint(r.start),l=this.$clickSelection.comparePoint(r.end);if(-1==o&&l<=0)t=this.$clickSelection.end,r.end.row==n.row&&r.end.column==n.column||(n=r.start);else if(1==l&&o>=0)t=this.$clickSelection.start,r.start.row==n.row&&r.start.column==n.column||(n=r.end);else if(-1==o&&1==l)n=r.end,t=r.start;else{var a=s(this.$clickSelection,n);n=a.cursor,t=a.anchor}i.selection.setSelectionAnchor(t.row,t.column)}i.selection.selectToPosition(n),i.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e,t,i,n,r=(e=this.mousedownEvent.x,t=this.mousedownEvent.y,i=this.x,n=this.y,Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))),s=Date.now();(r>0||s-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),i=this.editor,n=i.session,r=n.getBracketRange(t);r?(r.isEmpty()&&(r.start.column--,r.end.column++),this.setState("select")):(r=i.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=r,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),i=this.editor;this.setState("selectByLines");var n=i.getSelectionRange();n.isMultiLine()&&n.contains(t.row,t.column)?(this.$clickSelection=i.selection.getLineRange(n.start.row),this.$clickSelection.end=i.selection.getLineRange(n.end.row).end):this.$clickSelection=i.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var i=this.$lastScroll,n=e.domEvent.timeStamp,r=n-i.t,s=r?e.wheelX/r:i.vx,o=r?e.wheelY/r:i.vy;r<550&&(s=(s+i.vx)/2,o=(o+i.vy)/2);var l=Math.abs(s/o),a=!1;if(l>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(a=!0),l<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(a=!0),a)i.allowed=n;else if(n-i.allowed<550){var c=Math.abs(s)<=1.5*Math.abs(i.vx)&&Math.abs(o)<=1.5*Math.abs(i.vy);c?(a=!0,i.allowed=n):i.allowed=0}return i.t=n,i.vx=s,i.vy=o,a?(t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()):void 0}},this.onTouchMove=function(e){this.editor._emit("mousewheel",e)}}).call(r.prototype),t.DefaultHandlers=r}),define("skylark-ace/tooltip",["require","exports","module","./lib/oop","./lib/dom"],function(e,t,i){e("./lib/oop");var n=e("./lib/dom");function r(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}(function(){this.$init=function(){return this.$element=n.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){this.getElement().textContent=e},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){n.addCssClass(this.getElement(),e)},this.show=function(e,t,i){null!=e&&this.setText(e),null!=t&&null!=i&&this.setPosition(t,i),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth},this.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)}}).call(r.prototype),t.Tooltip=r}),define("skylark-ace/mouse/default_gutter_handler",["require","exports","module","../lib/dom","../lib/oop","../lib/event","../tooltip"],function(e,t,i){var n=e("../lib/dom"),r=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;function l(e){o.call(this,e)}r.inherits(l,o),function(){this.setPosition=function(e,t){var i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,r=this.getWidth(),s=this.getHeight();t+=15,(e+=15)+r>i&&(e-=e+r-i),t+s>n&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(l.prototype),t.GutterHandler=function(e){var t,i,r,o=e.editor,a=o.renderer.$gutterLayer,c=new l(o.container);function h(){t&&(t=clearTimeout(t)),r&&(c.hide(),r=null,o._signal("hideGutterTooltip",c),o.removeEventListener("mousewheel",h))}function u(e){c.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(t){if(o.isFocused()&&0==t.getButton()){var i=a.getRegion(t);if("foldWidgets"!=i){var n=t.getDocumentPosition().row,r=o.session.selection;if(t.getShiftKey())r.selectTo(n,0);else{if(2==t.domEvent.detail)return o.selectAll(),t.preventDefault();e.$clickSelection=o.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}}),e.editor.setDefaultHandler("guttermousemove",function(s){var l=s.domEvent.target||s.domEvent.srcElement;if(n.hasCssClass(l,"ace_fold-widget"))return h();r&&e.$tooltipFollowsMouse&&u(s),i=s,t||(t=setTimeout(function(){t=null,i&&!e.isMousePressed?function(){var t=i.getDocumentPosition().row,n=a.$annotations[t];if(!n)return h();var s=o.session.getLength();if(t==s){var l=o.renderer.pixelToScreenCoordinates(0,i.y).row,d=i.$pos;if(l>o.session.documentToScreenRow(d.row,d.column))return h()}if(r==n)return;if(r=n.text.join("<br/>"),c.setHtml(r),c.show(),o._signal("showGutterTooltip",c),o.on("mousewheel",h),e.$tooltipFollowsMouse)u(i);else{var f=i.domEvent.target,g=f.getBoundingClientRect(),p=c.getElement().style;p.left=g.right+"px",p.top=g.bottom+"px"}}():h()},50))}),s.addListener(o.renderer.$gutter,"mouseout",function(e){i=null,r&&!t&&(t=setTimeout(function(){t=null,h()},50))}),o.on("changeSession",h)}}),define("skylark-ace/mouse/mouse_event",["require","exports","module","../lib/event","../lib/useragent"],function(e,t,i){var n=e("../lib/event"),r=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){n.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){n.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var i=this.getDocumentPosition();this.$inSelection=t.contains(i.row,i.column)}return this.$inSelection},this.getButton=function(){return n.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=r.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define("skylark-ace/mouse/dragdrop_handler",["require","exports","module","../lib/dom","../lib/event","../lib/useragent"],function(e,t,i){var n=e("../lib/dom"),r=e("../lib/event"),s=e("../lib/useragent"),o=200,l=200,a=5;function c(e){var t=e.editor,i=n.createElement("img");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(i.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c,u,d,f,g,p,m,v,y,w,b,C=t.container,k=0;function x(){var e=p;(function(e,i){var n=Date.now(),r=!i||e.row!=i.row,s=!i||e.column!=i.column;if(!w||r||s)t.moveCursorToPosition(e),w=n,b={x:u,y:d};else{var o=h(b.x,b.y,u,d);o>a?w=null:n-w>=l&&(t.renderer.scrollCursorIntoView(),w=null)}})(p=t.renderer.screenToTextCoordinates(u,d),e),function(e,i){var n=Date.now(),r=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,l=t.renderer.scroller.getBoundingClientRect(),a={x:{left:u-l.left,right:l.right-u},y:{top:d-l.top,bottom:l.bottom-d}},c=Math.min(a.x.left,a.x.right),h=Math.min(a.y.top,a.y.bottom),f={row:e.row,column:e.column};c/s<=2&&(f.column+=a.x.left<a.x.right?-3:2);h/r<=1&&(f.row+=a.y.top<a.y.bottom?-1:1);var g=e.row!=f.row,p=e.column!=f.column,m=!i||e.row!=i.row;g||p&&!m?y?n-y>=o&&t.renderer.scrollCursorIntoView(f):y=n:y=null}(p,e)}function S(){g=t.selection.toOrientedRange(),c=t.session.addMarker(g,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(f),x(),f=setInterval(x,20),k=0,r.addListener(document,"mousemove",A)}function $(){clearInterval(f),t.session.removeMarker(c),c=null,t.selection.fromOrientedRange(g),t.isFocused()&&!v&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),g=null,p=null,k=0,y=null,w=null,r.removeListener(document,"mousemove",A)}this.onDragStart=function(e){if(this.cancelDrag||!C.draggable){var n=this;return setTimeout(function(){n.startSelect(),n.captureMouse(e)},0),e.preventDefault()}g=t.getSelectionRange();var r=e.dataTransfer;r.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(i),i.scrollTop=0),r.setDragImage&&r.setDragImage(i,0,0),s.isOpera&&t.container.removeChild(i),r.clearData(),r.setData("Text",t.session.getTextRange()),v=!0,this.setState("drag")},this.onDragEnd=function(e){if(C.draggable=!1,v=!1,this.setState(null),!t.getReadOnly()){var i=e.dataTransfer.dropEffect;m||"move"!=i||t.session.remove(t.getSelectionRange()),t.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!t.getReadOnly()&&M(e.dataTransfer))return u=e.clientX,d=e.clientY,c||S(),k++,e.dataTransfer.dropEffect=m=T(e),r.preventDefault(e)},this.onDragOver=function(e){if(!t.getReadOnly()&&M(e.dataTransfer))return u=e.clientX,d=e.clientY,c||(S(),k++),null!==L&&(L=null),e.dataTransfer.dropEffect=m=T(e),r.preventDefault(e)},this.onDragLeave=function(e){if(--k<=0&&c)return $(),m=null,r.preventDefault(e)},this.onDrop=function(e){if(p){var i=e.dataTransfer;if(v)switch(m){case"move":g=g.contains(p.row,p.column)?{start:p,end:p}:t.moveText(g,p);break;case"copy":g=t.moveText(g,p,!0)}else{var n=i.getData("Text");g={start:p,end:t.session.insert(p,n)},t.focus(),m=null}return $(),r.preventDefault(e)}},r.addListener(C,"dragstart",this.onDragStart.bind(e)),r.addListener(C,"dragend",this.onDragEnd.bind(e)),r.addListener(C,"dragenter",this.onDragEnter.bind(e)),r.addListener(C,"dragover",this.onDragOver.bind(e)),r.addListener(C,"dragleave",this.onDragLeave.bind(e)),r.addListener(C,"drop",this.onDrop.bind(e));var L=null;function A(){null==L&&(L=setTimeout(function(){null!=L&&c&&$()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return"text/plain"==e||"Text"==e})}function T(e){var t=["copy","copymove","all","uninitialized"],i=s.isMac?e.altKey:e.ctrlKey,n="uninitialized";try{n=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return i&&t.indexOf(n)>=0?r="copy":["move","copymove","linkmove","all","uninitialized"].indexOf(n)>=0?r="move":t.indexOf(n)>=0&&(r="copy"),r}}function h(e,t,i,n){return Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))}(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var i=s.isWin?"default":"move";e.renderer.setCursorStyle(i),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&"dragReady"==this.state){var i=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);i>3&&t.dragDrop()}if("dragWait"===this.state){var i=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);i>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,i=e.inSelection(),n=e.getButton(),r=e.domEvent.detail||1;if(1===r&&0===n&&i){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;if("unselectable"in o&&(o.unselectable="on"),t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var l=t.container;l.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(c.prototype),t.DragdropHandler=c}),define("skylark-ace/lib/net",["require","exports","module","./dom"],function(e,t,i){var n=e("./dom");t.get=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4===i.readyState&&t(i.responseText)},i.send(null)},t.loadScript=function(e,t){var i=n.getDocumentHead(),r=document.createElement("script");r.src=e,i.appendChild(r),r.onload=r.onreadystatechange=function(e,i){!i&&r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(r=r.onload=r.onreadystatechange=null,i||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),define("skylark-ace/lib/event_emitter",["require","exports","module"],function(e,t,i){var n={},r=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};n._emit=n._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var i=this._eventRegistry[e]||[],n=this._defaultHandlers[e];if(i.length||n){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=r),t.preventDefault||(t.preventDefault=s),i=i.slice();for(var o=0;o<i.length&&(i[o](t,this),!t.propagationStopped);o++);return n&&!t.defaultPrevented?n(t,this):void 0}},n._signal=function(e,t){var i=(this._eventRegistry||{})[e];if(i){i=i.slice();for(var n=0;n<i.length;n++)i[n](t,this)}},n.once=function(e,t){var i=this;if(this.addEventListener(e,function n(){i.removeEventListener(e,n),t.apply(null,arguments)}),!t)return new Promise(function(e){t=e})},n.setDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i||(i=this._defaultHandlers={_disabled_:{}}),i[e]){var n=i[e],r=i._disabled_[e];r||(i._disabled_[e]=r=[]),r.push(n);var s=r.indexOf(t);-1!=s&&r.splice(s,1)}i[e]=t},n.removeDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i){var n=i._disabled_[e];if(i[e]==t)n&&this.setDefaultHandler(e,n.pop());else if(n){var r=n.indexOf(t);-1!=r&&n.splice(r,1)}}},n.on=n.addEventListener=function(e,t,i){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];return n||(n=this._eventRegistry[e]=[]),-1==n.indexOf(t)&&n[i?"unshift":"push"](t),t},n.off=n.removeListener=n.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];if(i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}},n.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=n}),define("skylark-ace/lib/app_config",["require","exports","module","./oop","./event_emitter"],function(e,t,i){"no use strict";var n=e("./oop"),r=e("./event_emitter").EventEmitter,s={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};if(e)Array.isArray(e)||(t=e,e=Object.keys(t));else{var i=this.$options;e=Object.keys(i).filter(function(e){return!i[e].hidden})}return e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]!==t){var i=this.$options[e];if(!i)return o('misspelled option "'+e+'"');if(i.forwardTo)return this[i.forwardTo]&&this[i.forwardTo].setOption(e,t);i.handlesSet||(this["$"+e]=t),i&&i.set&&i.set.call(this,t)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:o('misspelled option "'+e+'"')}};function o(e){"undefined"!=typeof console&&console.warn&&console.warn.apply(console,arguments)}function l(e,t){var i=new Error(e);i.data=t,"object"==typeof console&&console.error&&console.error(i),setTimeout(function(){throw i})}var a=function(){this.$defaultOptions={}};(function(){n.implement(this,r),this.defineOptions=function(e,t,i){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(i).forEach(function(t){var n=i[t];"string"==typeof n&&(n={forwardTo:n}),n.name||(n.name=t),e.$options[n.name]=n,"initialValue"in n&&(e["$"+n.name]=n.initialValue)}),n.implement(e,s),this},this.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var i=e.$options[t];"value"in i&&e.setOption(t,i.value)})},this.setDefaultValue=function(e,t,i){var n=this.$defaultOptions[e]||(this.$defaultOptions[e]={});n[t]&&(n.forwardTo?this.setDefaultValue(n.forwardTo,t,i):n[t].value=i)},this.setDefaultValues=function(e,t){Object.keys(t).forEach(function(i){this.setDefaultValue(e,i,t[i])},this)},this.warn=o,this.reportError=l}).call(a.prototype),t.AppConfig=a}),define("skylark-ace/config",["require","exports","module","./lib/lang","./lib/oop","./lib/net","./lib/app_config"],function(e,t,i){"no use strict";var n=e("./lib/lang"),r=(e("./lib/oop"),e("./lib/net")),s=e("./lib/app_config").AppConfig;i.exports=t=new s;var o=function(){return this||"undefined"!=typeof window&&window}(),l={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0};t.get=function(e){if(!l.hasOwnProperty(e))throw new Error("Unknown config key: "+e);return l[e]},t.set=function(e,t){if(!l.hasOwnProperty(e))throw new Error("Unknown config key: "+e);l[e]=t},t.all=function(){return n.copyObject(l)},t.$modes={},t.moduleUrl=function(e,t){if(l.$moduleUrls[e])return l.$moduleUrls[e];var i=e.split("/"),n="snippets"==(t=t||i[i.length-2]||"")?"/":"-",r=i[i.length-1];if("worker"==t&&"-"==n){var s=new RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");r=r.replace(s,"")}(!r||r==t)&&i.length>1&&(r=i[i.length-2]);var o=l[t+"Path"];return null==o?o=l.basePath:"/"==n&&(t=n=""),o&&"/"!=o.slice(-1)&&(o+="/"),o+t+n+r+this.get("suffix")},t.setModuleUrl=function(e,t){return l.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(i,n){var s,o;Array.isArray(i)&&(o=i[0],i=i[1]);try{s=e(i)}catch(e){}if(s&&!t.$loading[i])return n&&n(s);if(t.$loading[i]||(t.$loading[i]=[]),t.$loading[i].push(n),!(t.$loading[i].length>1)){var l=function(){e([i],function(e){t._emit("load.module",{name:i,module:e});var n=t.$loading[i];t.$loading[i]=null,n.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return l();r.loadScript(t.moduleUrl(i,o),l),a()}};var a=function(){l.basePath||l.workerPath||l.modePath||l.themePath||Object.keys(l.$moduleUrls).length||(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),a=function(){})};t.init=function(n){if(!o||!o.document)return;l.packaged=n||e.packaged||i.packaged||o.define&&define.packaged;for(var r={},s="",a=document.currentScript||document._currentScript,c=(a&&a.ownerDocument||document).getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h],d=u.src||u.getAttribute("src");if(d){for(var f=u.attributes,g=0,p=f.length;g<p;g++){var m=f[g];0===m.name.indexOf("data-ace-")&&(r[(y=m.name.replace(/^data-ace-/,""),y.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=m.value)}var v=d.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);v&&(s=v[1])}}var y;s&&(r.base=r.base||s,r.packaged=!0);for(var w in r.basePath=r.base,r.workerPath=r.workerPath||r.base,r.modePath=r.modePath||r.base,r.themePath=r.themePath||r.base,delete r.base,r)void 0!==r[w]&&t.set(w,r[w])}}),define("skylark-ace/mouse/mouse_handler",["require","exports","module","../lib/event","../lib/useragent","./default_handlers","./default_gutter_handler","./mouse_event","./dragdrop_handler","../config"],function(e,t,i){var n=e("../lib/event"),r=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,l=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,c=e("../config"),h=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var i=function(t){var i=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());i&&window.focus(),e.focus()},l=e.renderer.getMouseEventTarget();n.addListener(l,"click",this.onMouseEvent.bind(this,"click")),n.addListener(l,"mousemove",this.onMouseMove.bind(this,"mousemove")),n.addMultiMouseDownListener([l,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent"),n.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),n.addTouchMoveListener(e.container,this.onTouchMove.bind(this,"touchmove"));var c=e.renderer.$gutter;n.addListener(c,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),n.addListener(c,"click",this.onMouseEvent.bind(this,"gutterclick")),n.addListener(c,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),n.addListener(c,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),n.addListener(l,"mousedown",i),n.addListener(c,"mousedown",i),r.isIE&&e.renderer.scrollBarV&&(n.addListener(e.renderer.scrollBarV.element,"mousedown",i),n.addListener(e.renderer.scrollBarH.element,"mousedown",i)),e.on("mousemove",function(i){if(!t.state&&!t.$dragDelay&&t.$dragEnabled){var n=e.renderer.screenToTextCoordinates(i.x,i.y),r=e.session.selection.getRange(),s=e.renderer;!r.isEmpty()&&r.insideStart(n.row,n.column)?s.setCursorStyle("default"):s.setCursorStyle("")}})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new l(t,this.editor))},this.onMouseMove=function(e,t){var i=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;i&&i.length&&this.editor._emit(e,new l(t,this.editor))},this.onMouseWheel=function(e,t){var i=new l(t,this.editor);i.speed=2*this.$scrollSpeed,i.wheelX=t.wheelX,i.wheelY=t.wheelY,this.editor._emit(e,i)},this.onTouchMove=function(e,t){var i=new l(t,this.editor);i.speed=1,i.wheelX=t.wheelX,i.wheelY=t.wheelY,this.editor._emit(e,i)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var i=this.editor,s=this.editor.renderer;s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=null);var o=this,a=function(e){if(e){if(r.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new l(e,o.editor),o.$mouseMoved=!0}},c=function(e){i.off("beforeEndOperation",u),clearInterval(d),h(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",null==s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=!0,s.$moveTextAreaToCursor()),o.isMousePressed=!1,o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),i.endOperation()},h=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(r.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){c(e)});var u=function(e){o.releaseMouse&&i.curOp.command.name&&i.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};i.on("beforeEndOperation",u),i.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=a,o.releaseMouse=n.capture(this.editor.container,a,c);var d=setInterval(h,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){t&&t.domEvent&&"contextmenu"!=t.domEvent.type||(this.editor.off("nativecontextmenu",e),t&&t.domEvent&&n.stopEvent(t.domEvent))}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(h.prototype),c.defineOptions(h.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:r.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=h}),define("skylark-ace/mouse/fold_handler",["require","exports","module","../lib/dom"],function(e,t,i){var n=e("../lib/dom");t.FoldHandler=function(e){e.on("click",function(t){var i=t.getDocumentPosition(),r=e.session,s=r.getFoldAt(i.row,i.column,1);s&&(t.getAccelKey()?r.removeFold(s):r.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&n.hasCssClass(o,"ace_inline_button")&&n.hasCssClass(o,"ace_toggle_wrap")&&(r.setOption("wrap",!0),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,r=e.session;r.foldWidgets&&r.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,r=e.session,s=r.getParentFoldRangeData(n,!0),o=s.range||s.firstRange;if(o){n=o.start.row;var l=r.getFoldAt(n,r.getLine(n).length,1);l?r.removeFold(l):(r.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}}),define("skylark-ace/keyboard/keybinding",["require","exports","module","../lib/keys","../lib/event"],function(e,t,i){var n=e("../lib/keys"),r=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){for(;t[t.length-1]&&t[t.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},this.addKeyboardHandler=function(e,t){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var i=this.$handlers.indexOf(e);-1!=i&&this.$handlers.splice(i,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==i&&e.attach&&e.attach(this.$editor)}},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return-1!=t&&(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(i){return i.getStatusText&&i.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,i,n){for(var s,o=!1,l=this.$editor.commands,a=this.$handlers.length;a--&&!((s=this.$handlers[a].handleKeyboard(this.$data,e,t,i,n))&&s.command&&((o="null"==s.command||l.exec(s.command,this.$editor,s.args,n))&&n&&-1!=e&&1!=s.passEvent&&1!=s.command.passEvent&&r.stopEvent(n),o)););return o||-1!=e||(s={command:"insertstring"},o=l.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,i){var r=n.keyCodeToString(i);this.$callKeyboardHandlers(t,r,i,e)},this.onTextInput=function(e){this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),define("skylark-ace/lib/bidiutil",["require","exports","module"],function(e,t,i){var n=0,r=0,s=!1,o=!1,l=!1,a=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],c=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],h=1,u=0,d=1,f=2,g=3,p=4,m=5,v=6,y=7,w=8,b=9,C=10,k=11,x=12,S=13,$=14,L=15,A=16,M=17,T=18,R=[T,T,T,T,T,T,T,T,T,v,m,v,w,m,T,T,T,T,T,T,T,T,T,T,T,T,T,T,m,m,m,v,w,p,p,k,k,k,p,p,p,p,p,C,b,C,b,b,f,f,f,f,f,f,f,f,f,f,b,p,p,p,p,p,p,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,p,p,p,p,p,p,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,p,p,p,p,T,T,T,T,T,T,m,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,b,p,k,k,k,k,p,p,p,p,u,p,p,T,p,p,k,k,f,f,p,u,p,p,p,f,u,p,p,p,p,p],_=[w,w,w,w,w,w,w,w,w,w,w,T,T,T,u,d,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,w,m,S,$,L,A,M,b,k,k,k,k,k,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,b,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,w];function E(e,t,i){if(!(r<e))if(1!=e||n!=h||o)for(var s,l,a,c,u=i.length,d=0;d<u;){if(t[d]>=e){for(s=d+1;s<u&&t[s]>=e;)s++;for(l=d,a=s-1;l<a;l++,a--)c=i[l],i[l]=i[a],i[a]=c;d=s}d++}else i.reverse()}function O(e,t,i,r){var a,c,h,R,_=t[r];switch(_){case u:case d:s=!1;case p:case g:return _;case f:return s?g:f;case y:return s=!0,!0,d;case w:return p;case b:return r<1||r+1>=t.length||(a=i[r-1])!=f&&a!=g||(c=t[r+1])!=f&&c!=g?p:(s&&(c=g),c==a?c:p);case C:return(a=r>0?i[r-1]:m)==f&&r+1<t.length&&t[r+1]==f?f:p;case k:if(r>0&&i[r-1]==f)return f;if(s)return p;for(R=r+1,h=t.length;R<h&&t[R]==k;)R++;return R<h&&t[R]==f?f:p;case x:for(h=t.length,R=r+1;R<h&&t[R]==x;)R++;if(R<h){var E=e[r],O=E>=1425&&E<=2303||64286==E;if(a=t[R],O&&(a==d||a==y))return d}return r<1||(a=t[r-1])==m?p:i[r-1];case m:return s=!1,o=!0,n;case v:return l=!0,p;case S:case $:case A:case M:case L:s=!1;case T:return p}}function F(e){var t=e.charCodeAt(0),i=t>>8;return 0==i?t>191?u:R[t]:5==i?/[\u0591-\u05f4]/.test(e)?d:u:6==i?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?x:/[\u0660-\u0669\u066b-\u066c]/.test(e)?g:1642==t?k:/[\u06f0-\u06f9]/.test(e)?f:y:32==i&&t<=8287?_[255&t]:254==i&&t>=65136?y:p}t.L=u,t.R=d,t.EN=f,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="·",t.doBidiReorder=function(e,i,u){if(e.length<2)return{};var f=e.split(""),b=new Array(f.length),C=new Array(f.length),k=[];n=u?h:0,function(e,t,i,h){var u=n?c:a,d=null,f=null,g=null,p=0,y=null,b=-1,C=null,k=null,x=[];if(!h)for(C=0,h=[];C<i;C++)h[C]=F(e[C]);for(r=n,s=!1,!1,o=!1,l=!1,k=0;k<i;k++){if(d=p,x[k]=f=O(e,h,x,k),p=u[d][f],y=240&p,p&=15,t[k]=g=u[p][5],y>0)if(16==y){for(C=b;C<k;C++)t[C]=1;b=-1}else b=-1;if(u[p][6])-1==b&&(b=k);else if(b>-1){for(C=b;C<k;C++)t[C]=g;b=-1}h[k]==m&&(t[k]=0),r|=g}if(l)for(C=0;C<i;C++)if(h[C]==v){t[C]=n;for(var S=C-1;S>=0&&h[S]==w;S--)t[S]=n}}(f,k,f.length,i);for(var x=0;x<b.length;b[x]=x,x++);E(2,k,b),E(1,k,b);for(var x=0;x<b.length-1;x++)i[x]===g?k[x]=t.AN:k[x]===d&&(i[x]>y&&i[x]<S||i[x]===p||i[x]===T)?k[x]=t.ON_R:x>0&&"ل"===f[x-1]&&/\u0622|\u0623|\u0625|\u0627/.test(f[x])&&(k[x-1]=k[x]=t.R_H,x++);f[f.length-1]===t.DOT&&(k[f.length-1]=t.B),"‫"===f[0]&&(k[0]=t.RLE);for(var x=0;x<b.length;x++)C[x]=k[b[x]];return{logicalFromVisual:b,bidiLevels:C}},t.hasBidiCharacters=function(e,t){for(var i=!1,n=0;n<e.length;n++)t[n]=F(e.charAt(n)),i||t[n]!=d&&t[n]!=y&&t[n]!=g||(i=!0);return i},t.getVisualFromLogicalIdx=function(e,t){for(var i=0;i<t.logicalFromVisual.length;i++)if(t.logicalFromVisual[i]==e)return i;return 0}}),define("skylark-ace/bidihandler",["require","exports","module","./lib/bidiutil","./lib/lang"],function(e,t,i){var n=e("./lib/bidiutil"),r=e("./lib/lang"),s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=n,this.charWidths=[],this.EOL="¬",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="¶",this.RLE="‫",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=s.test(e.getValue())};(function(){this.isBidiRow=function(e,t,i){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,i),this.updateBidiMap()),this.bidiMap.bidiLevels)},this.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&s.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},this.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var i=this.session.$getRowCacheIndex(t,this.currentRow);i>=0&&(e=this.session.$docRowCache[i])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length)for(var i,n=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(i=this.session.$getRowCacheIndex(t,this.currentRow-e-1))===n;)n=i,e++;else e=this.currentRow;return e},this.updateRowLine=function(e,t){void 0===e&&(e=this.getDocumentRow());var i=e===this.session.getLength()-1,s=i?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(void 0===t&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[n.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t])),t==o.length&&(this.line+=this.showInvisibles?s:n.DOT)}else this.line+=this.showInvisibles?s:n.DOT;var l,a=this.session,c=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,t){return"\t"===e||a.isFullWidth(e.charCodeAt(0))?(l="\t"===e?a.getScreenTabSize(t+c):2,c+=l-1,r.stringRepeat(n.DOT,l)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==n.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},this.updateBidiMap=function(){var e=[];n.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=n.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},this.markAsDirty=function(){this.currentRow=null},this.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,i=e.$measureCharWidth("ה");this.charWidths[n.L]=this.charWidths[n.EN]=this.charWidths[n.ON_R]=t,this.charWidths[n.R]=this.charWidths[n.AN]=i,this.charWidths[n.R_H]=.45*i,this.charWidths[n.B]=this.charWidths[n.RLE]=0,this.currentRow=null}},this.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},this.setEolChar=function(e){this.EOL=e},this.setContentWidth=function(e){this.contentWidth=e},this.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},this.setRtlDirection=function(e,t){for(var i=e.getCursorPosition(),n=e.selection.getSelectionAnchor().row;n<=i.row;n++)t||e.session.getLine(n).charAt(0)!==e.session.$bidiHandler.RLE?t&&e.session.getLine(n).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:n},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(n,0,1)},this.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,i=e>t?this.session.getOverwrite()?e:e-1:t,r=n.getVisualFromLogicalIdx(i,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[r]%2!=0&&r++;for(var l=0;l<r;l++)o+=this.charWidths[s[l]];return!this.session.getOverwrite()&&e>t&&s[r]%2==0&&(o+=this.charWidths[s[r]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var i,n=this.bidiMap,r=n.bidiLevels,s=[],o=0,l=Math.min(e,t)-this.wrapIndent,a=Math.max(e,t)-this.wrapIndent,c=!1,h=!1,u=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var d,f=0;f<r.length;f++)d=n.logicalFromVisual[f],i=r[f],(c=d>=l&&d<a)&&!h?u=o:!c&&h&&s.push({left:u,width:o-u}),o+=this.charWidths[i],h=c;if(c&&f===r.length&&s.push({left:u,width:o-u}),this.isRtlDir)for(var g=0;g<s.length;g++)s[g].left+=this.rtlLineOffset;return s},this.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,e=Math.max(e,0),i=0,n=0,r=this.bidiMap.bidiLevels,s=this.charWidths[r[n]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>i+s/2;){if(i+=s,n===r.length-1){s=0;break}s=this.charWidths[r[++n]]}return n>0&&r[n-1]%2!=0&&r[n]%2==0?(e<i&&n--,t=this.bidiMap.logicalFromVisual[n]):n>0&&r[n-1]%2==0&&r[n]%2!=0?t=1+(e>i?this.bidiMap.logicalFromVisual[n]:this.bidiMap.logicalFromVisual[n-1]):this.isRtlDir&&n===r.length-1&&0===s&&r[n-1]%2==0||!this.isRtlDir&&0===n&&r[n]%2!=0?t=1+this.bidiMap.logicalFromVisual[n]:(n>0&&r[n-1]%2!=0&&0!==s&&n--,t=this.bidiMap.logicalFromVisual[n]),0===t&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o}),define("skylark-ace/selection",["require","exports","module","./lib/oop","./lib/lang","./lib/event_emitter","./range"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,l=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),t.$isEmpty||t.$silent||t._emit("changeSelection"),t.$keepDesiredColumnOnChange||e.old.column==e.value.column||(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,t.$isEmpty||t.$silent||t._emit("changeSelection")})};(function(){n.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var i=t?e.end:e.start,n=t?e.start:e.end;this.$setSelection(i.row,i.column,n.row,n.column)},this.$setSelection=function(e,t,i,n){var r=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(i,n),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||r!=this.$isEmpty||s)&&this._emit("changeSelection")},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(void 0===t){var i=e||this.lead;e=i.row,t=i.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var i,n="number"==typeof e?e:this.lead.row,r=this.session.getFoldLine(n);return r?(n=r.start.row,i=r.end.row):i=n,!0===t?new o(n,0,i,this.session.getLine(i).length):new o(n,0,i+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,i){var n=e.column,r=e.column+t;return i<0&&(n=e.column-t,r=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(n,r).split(" ").length-1==t},this.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var i=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,i,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-i):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var i=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,i,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,i):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,i=this.session.documentToScreenRow(e,t),n=this.session.screenToDocumentPosition(i,0),r=this.session.getDisplayLine(e,null,n.row,n.column),s=r.match(/^\s*/);s[0].length==t||this.session.$useEmacsStyleLineStart||(n.column+=s[0].length),this.moveCursorToPosition(n)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var i=this.session.getLine(t.row);if(t.column==i.length){var n=i.search(/\s+$/);n>0&&(t.column=n)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,i=this.doc.getLine(e),n=i.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(e,t,1);if(r)this.moveCursorTo(r.end.row,r.end.column);else{if(this.session.nonTokenRe.exec(n)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,n=i.substring(t)),t>=i.length)return this.moveCursorTo(e,i.length),this.moveCursorRight(),void(e<this.doc.getLength()-1&&this.moveCursorWordRight());this.session.tokenRe.exec(n)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)}},this.moveCursorLongWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))this.moveCursorTo(e.start.row,e.start.column);else{var n=this.session.getFoldStringAt(t,i,-1);null==n&&(n=this.doc.getLine(t).substring(0,i));var s=r.stringReverse(n);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(s)&&(i-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),i<=0)return this.moveCursorTo(t,0),this.moveCursorLeft(),void(t>0&&this.moveCursorWordLeft());this.session.tokenRe.exec(s)&&(i-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,i)}},this.$shortWordEndIndex=function(e){var t,i=0,n=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,this.session.tokenRe.exec(e))i=this.session.tokenRe.lastIndex;else{for(;(t=e[i])&&n.test(t);)i++;if(i<1)for(r.lastIndex=0;(t=e[i])&&!r.test(t);)if(r.lastIndex=0,i++,n.test(t)){if(i>2){i--;break}for(;(t=e[i])&&n.test(t);)i++;if(i>2)break}}return r.lastIndex=0,i},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,i=this.doc.getLine(e),n=i.substring(t),r=this.session.getFoldAt(e,t,1);if(r)return this.moveCursorTo(r.end.row,r.end.column);if(t==i.length){var s=this.doc.getLength();do{e++,n=this.doc.getLine(e)}while(e<s&&/^\s*$/.test(n));/^\s+/.test(n)||(n=""),t=0}var o=this.$shortWordEndIndex(n);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))return this.moveCursorTo(e.start.row,e.start.column);var n=this.session.getLine(t).substring(0,i);if(0===i){do{t--,n=this.doc.getLine(t)}while(t>0&&/^\s*$/.test(n));i=n.length,/\s+$/.test(n)||(n="")}var s=r.stringReverse(n),o=this.$shortWordEndIndex(s);return this.moveCursorTo(t,i-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var i,n=this.session.documentToScreenPosition(this.lead.row,this.lead.column);0===t&&(0!==e&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(i=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(i/this.session.$bidiHandler.charWidths[0])):i=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var r=this.session.screenToDocumentPosition(n.row+e,n.column,i);0!==e&&0===t&&r.row===this.lead.row&&r.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[r.row]&&(r.row>0||e>0)&&r.row++,this.moveCursorTo(r.row,r.column+t,0===t)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,i){var n=this.session.getFoldAt(e,t,1);n&&(e=n.start.row,t=n.start.column),this.$keepDesiredColumnOnChange=!0;var r=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(r.charAt(t))&&r.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,i||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,i){var n=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(n.row,n.column,i)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var i=this.getCursor();return o.fromPoints(t,i)}catch(e){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(void 0==e.start){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var i=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(i.cursor=i.start),this.addRange(i,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(l.prototype),t.Selection=l}),define("skylark-ace/tokenizer",["require","exports","module","./config"],function(e,t,i){var n=e("./config"),r=2e3,s=function(e){for(var t in this.states=e,this.regExps={},this.matchMappings={},this.states){for(var i=this.states[t],n=[],r=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",l=[],a=0;a<i.length;a++){var c=i[a];if(c.defaultToken&&(s.defaultToken=c.defaultToken),c.caseInsensitive&&(o="gi"),null!=c.regex){c.regex instanceof RegExp&&(c.regex=c.regex.toString().slice(1,-1));var h=c.regex,u=new RegExp("(?:("+h+")|(.))").exec("a").length-2;Array.isArray(c.token)?1==c.token.length||1==u?c.token=c.token[0]:u-1!=c.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:c,groupCount:u-1}),c.token=c.token[0]):(c.tokenArray=c.token,c.token=null,c.onMatch=this.$arrayTokens):"function"!=typeof c.token||c.onMatch||(c.onMatch=u>1?this.$applyToken:c.token),u>1&&(/\\\d/.test(c.regex)?h=c.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+r+1)}):(u=1,h=this.removeCapturingGroups(c.regex)),c.splitRegex||"string"==typeof c.token||l.push(c)),s[r]=a,r+=u,n.push(h),c.onMatch||(c.onMatch=null)}}n.length||(s[0]=0,n.push("$")),l.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+n.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){r=0|e},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),i=this.token.apply(this,t);if("string"==typeof i)return[{type:i,value:e}];for(var n=[],r=0,s=i.length;r<s;r++)t[r]&&(n[n.length]={type:i[r],value:t[r]});return n},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var i=[],n=this.tokenArray,r=0,s=n.length;r<s;r++)t[r+1]&&(i[i.length]={type:n[r],value:t[r+1]});return i},this.removeCapturingGroups=function(e){var t=e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e});return t},this.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var i=0,n=!1,r={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,s,o,l,a){return n?n="]"!=l:l?n=!0:o?(i==r.stack&&(r.end=a+1,r.stack=-1),i--):s&&(i++,1!=s.length&&(r.stack=i,r.start=a)),e}),null!=r.end&&/^\)*$/.test(e.substr(r.end))&&(e=e.substring(0,r.start)+e.substr(r.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var i=t.slice(0);"#tmp"===(t=i[0])&&(i.shift(),t=i.shift())}else var i=[];var n=t||"start",s=this.states[n];s||(n="start",s=this.states[n]);var o=this.matchMappings[n],l=this.regExps[n];l.lastIndex=0;for(var a,c=[],h=0,u=0,d={type:null,value:""};a=l.exec(e);){var f=o.defaultToken,g=null,p=a[0],m=l.lastIndex;if(m-p.length>h){var v=e.substring(h,m-p.length);d.type==f?d.value+=v:(d.type&&c.push(d),d={type:f,value:v})}for(var y=0;y<a.length-2;y++)if(void 0!==a[y+1]){g=s[o[y]],f=g.onMatch?g.onMatch(p,n,i,e):g.token,g.next&&(n="string"==typeof g.next?g.next:g.next(n,i),(s=this.states[n])||(this.reportError("state doesn't exist",n),n="start",s=this.states[n]),o=this.matchMappings[n],h=m,(l=this.regExps[n]).lastIndex=m),g.consumeLineEnd&&(h=m);break}if(p)if("string"==typeof f)g&&!1===g.merge||d.type!==f?(d.type&&c.push(d),d={type:f,value:p}):d.value+=p;else if(f){d.type&&c.push(d),d={type:null,value:""};for(var y=0;y<f.length;y++)c.push(f[y])}if(h==e.length)break;if(h=m,u++>r){for(u>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});h<e.length;)d.type&&c.push(d),d={value:e.substring(h,h+=2e3),type:"overflow"};n="start",i=[];break}}return d.type&&c.push(d),i.length>1&&i[0]!==n&&i.unshift("#tmp",n),{tokens:c,state:i.length?i:n}},this.reportError=n.reportError}).call(s.prototype),t.Tokenizer=s}),define("skylark-ace/mode/text_highlight_rules",["require","exports","module","../lib/lang"],function(e,t,i){var n=e("../lib/lang"),r=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(t)for(var i in e){for(var n=e[i],r=0;r<n.length;r++){var s=n[r];(s.next||s.onMatch)&&("string"==typeof s.next&&0!==s.next.indexOf(t)&&(s.next=t+s.next),s.nextState&&0!==s.nextState.indexOf(t)&&(s.nextState=t+s.nextState))}this.$rules[t+i]=n}else for(var i in e)this.$rules[i]=e[i]},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,i,r,s){var o="function"==typeof e?(new e).getRules():e;if(r)for(var l=0;l<r.length;l++)r[l]=t+r[l];else for(var a in r=[],o)r.push(t+a);if(this.addRules(o,t),i)for(var c=Array.prototype[s?"push":"unshift"],l=0;l<r.length;l++)c.apply(this.$rules[r[l]],n.deepCopy(i));this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return("start"!=e||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){var i=0,n=this.$rules;Object.keys(n).forEach(function r(s){var o=n[s];o.processed=!0;for(var l=0;l<o.length;l++){var a=o[l],c=null;Array.isArray(a)&&(c=a,a={}),!a.regex&&a.start&&(a.regex=a.start,a.next||(a.next=[]),a.next.push({defaultToken:a.token},{token:a.token+".end",regex:a.end||a.start,next:"pop"}),a.token=a.token+".start",a.push=!0);var h=a.next||a.push;if(h&&Array.isArray(h)){var u=a.stateName;u||("string"!=typeof(u=a.token)&&(u=u[0]||""),n[u]&&(u+=i++)),n[u]=h,a.next=u,r(u)}else"pop"==h&&(a.next=t);if(a.push&&(a.nextState=a.next||a.push,a.next=e,delete a.push),a.rules)for(var d in a.rules)n[d]?n[d].push&&n[d].push.apply(n[d],a.rules[d]):n[d]=a.rules[d];var f="string"==typeof a?a:a.include;if(f&&(c=Array.isArray(f)?f.map(function(e){return n[e]}):n[f]),c){var g=[l,1].concat(c);a.noEscape&&(g=g.filter(function(e){return!e.next})),o.splice.apply(o,g),l--}a.keywordMap&&(a.token=this.createKeywordMapper(a.keywordMap,a.defaultToken||"text",a.caseInsensitive),delete a.defaultToken)}},this)},this.createKeywordMapper=function(e,t,i,n){var r=Object.create(null);return Object.keys(e).forEach(function(t){var s=e[t];i&&(s=s.toLowerCase());for(var o=s.split(n||"|"),l=o.length;l--;)r[o[l]]=t}),Object.getPrototypeOf(r)&&(r.__proto__=null),this.$keywordList=Object.keys(r),e=null,i?function(e){return r[e.toLowerCase()]||t}:function(e){return r[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(r.prototype),t.TextHighlightRules=r}),define("skylark-ace/mode/behaviour",["require","exports","module"],function(e,t,i){var n=function(){this.$behaviours={}};(function(){this.add=function(e,t,i){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=i},this.addBehaviours=function(e){for(var t in e)for(var i in e[t])this.add(t,i,e[t][i])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"==typeof e)var i=(new e).getBehaviours(t);else var i=e.getBehaviours(t);this.addBehaviours(i)},this.getBehaviours=function(e){if(e){for(var t={},i=0;i<e.length;i++)this.$behaviours[e[i]]&&(t[e[i]]=this.$behaviours[e[i]]);return t}return this.$behaviours}}).call(n.prototype),t.Behaviour=n}),define("skylark-ace/token_iterator",["require","exports","module","./range"],function(e,t,i){var n=e("./range").Range,r=function(e,t,i){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var n=e.getTokenAt(t,i);this.$tokenIndex=n?n.index:-1};(function(){this.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){var e;for(this.$tokenIndex+=1;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,i=e[t].start;if(void 0!==i)return i;for(i=0;t>0;)i+=e[t-=1].value.length;return i},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new n(this.$row,t,this.$row,t+e.value.length)}}).call(r.prototype),t.TokenIterator=r}),define("skylark-ace/mode/behaviour/cstyle",["require","exports","module","../../lib/oop","../behaviour","../../token_iterator","../../lib/lang"],function(e,t,i){var n,r=e("../../lib/oop"),s=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,l=e("../../lib/lang"),a=["text","paren.rparen","punctuation.operator"],c=["text","paren.rparen","punctuation.operator","comment"],h={},u={'"':'"',"'":"'"},d=function(e){var t=-1;if(e.multiSelect&&(t=e.selection.index,h.rangeCount!=e.multiSelect.rangeCount&&(h={rangeCount:e.multiSelect.rangeCount})),h[t])return n=h[t];n=h[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},f=function(e,t,i,n){var r=e.end.row-e.start.row;return{text:i+t+n,selection:[0,e.start.column+1,r,e.end.column+(r?0:1)]}},g=function(e){this.add("braces","insertion",function(t,i,r,s,o){var a=r.getCursorPosition(),c=s.doc.getLine(a.row);if("{"==o){d(r);var h=r.getSelectionRange(),u=s.doc.getTextRange(h);if(""!==u&&"{"!==u&&r.getWrapBehavioursEnabled())return f(h,u,"{","}");if(g.isSaneInsertion(r,s))return/[\]\}\)]/.test(c[a.column])||r.inMultiSelectMode||e&&e.braces?(g.recordAutoInsert(r,s,"}"),{text:"{}",selection:[1,1]}):(g.recordMaybeInsert(r,s,"{"),{text:"{",selection:[1,1]})}else if("}"==o){d(r);var p=c.substring(a.column,a.column+1);if("}"==p){var m=s.$findOpeningBracket("}",{column:a.column+1,row:a.row});if(null!==m&&g.isAutoInsertedClosing(a,c,o))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if("\n"==o||"\r\n"==o){d(r);var v="";g.isMaybeInsertedClosing(a,c)&&(v=l.stringRepeat("}",n.maybeInsertedBrackets),g.clearMaybeInsertedClosing());var p=c.substring(a.column,a.column+1);if("}"===p){var y=s.findMatchingBracket({row:a.row,column:a.column+1},"}");if(!y)return null;var w=this.$getIndent(s.getLine(y.row))}else{if(!v)return void g.clearMaybeInsertedClosing();var w=this.$getIndent(c)}var b=w+s.getTabString();return{text:"\n"+b+"\n"+w+v,selection:[1,b.length,1,b.length]}}g.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,i,r,s){var o=r.doc.getTextRange(s);if(!s.isMultiLine()&&"{"==o){d(i);var l=r.doc.getLine(s.start.row),a=l.substring(s.end.column,s.end.column+1);if("}"==a)return s.end.column++,s;n.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,i,n,r){if("("==r){d(i);var s=i.getSelectionRange(),o=n.doc.getTextRange(s);if(""!==o&&i.getWrapBehavioursEnabled())return f(s,o,"(",")");if(g.isSaneInsertion(i,n))return g.recordAutoInsert(i,n,")"),{text:"()",selection:[1,1]}}else if(")"==r){d(i);var l=i.getCursorPosition(),a=n.doc.getLine(l.row),c=a.substring(l.column,l.column+1);if(")"==c){var h=n.$findOpeningBracket(")",{column:l.column+1,row:l.row});if(null!==h&&g.isAutoInsertedClosing(l,a,r))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,i,n,r){var s=n.doc.getTextRange(r);if(!r.isMultiLine()&&"("==s){d(i);var o=n.doc.getLine(r.start.row),l=o.substring(r.start.column+1,r.start.column+2);if(")"==l)return r.end.column++,r}}),this.add("brackets","insertion",function(e,t,i,n,r){if("["==r){d(i);var s=i.getSelectionRange(),o=n.doc.getTextRange(s);if(""!==o&&i.getWrapBehavioursEnabled())return f(s,o,"[","]");if(g.isSaneInsertion(i,n))return g.recordAutoInsert(i,n,"]"),{text:"[]",selection:[1,1]}}else if("]"==r){d(i);var l=i.getCursorPosition(),a=n.doc.getLine(l.row),c=a.substring(l.column,l.column+1);if("]"==c){var h=n.$findOpeningBracket("]",{column:l.column+1,row:l.row});if(null!==h&&g.isAutoInsertedClosing(l,a,r))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,i,n,r){var s=n.doc.getTextRange(r);if(!r.isMultiLine()&&"["==s){d(i);var o=n.doc.getLine(r.start.row),l=o.substring(r.start.column+1,r.start.column+2);if("]"==l)return r.end.column++,r}}),this.add("string_dquotes","insertion",function(e,t,i,n,r){var s=n.$mode.$quotes||u;if(1==r.length&&s[r]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(r))return;d(i);var o=r,l=i.getSelectionRange(),a=n.doc.getTextRange(l);if(!(""===a||1==a.length&&s[a])&&i.getWrapBehavioursEnabled())return f(l,a,o,o);if(!a){var c=i.getCursorPosition(),h=n.doc.getLine(c.row),g=h.substring(c.column-1,c.column),p=h.substring(c.column,c.column+1),m=n.getTokenAt(c.row,c.column),v=n.getTokenAt(c.row,c.column+1);if("\\"==g&&m&&/escape/.test(m.type))return null;var y,w=m&&/string|escape/.test(m.type),b=!v||/string|escape/.test(v.type);if(p==o)(y=w!==b)&&/string\.end/.test(v.type)&&(y=!1);else{if(w&&!b)return null;if(w&&b)return null;var C=n.$mode.tokenRe;C.lastIndex=0;var k=C.test(g);C.lastIndex=0;var x=C.test(g);if(k||x)return null;if(p&&!/[\s;,.})\]\\]/.test(p))return null;y=!0}return{text:y?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,i,n,r){var s=n.$mode.$quotes||u,o=n.doc.getTextRange(r);if(!r.isMultiLine()&&s.hasOwnProperty(o)){d(i);var l=n.doc.getLine(r.start.row),a=l.substring(r.start.column+1,r.start.column+2);if(a==o)return r.end.column++,r}})};g.isSaneInsertion=function(e,t){var i=e.getCursorPosition(),n=new o(t,i.row,i.column);if(!this.$matchTokenType(n.getCurrentToken()||"text",a)){var r=new o(t,i.row,i.column+1);if(!this.$matchTokenType(r.getCurrentToken()||"text",a))return!1}return n.stepForward(),n.getCurrentTokenRow()!==i.row||this.$matchTokenType(n.getCurrentToken()||"text",c)},g.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},g.recordAutoInsert=function(e,t,i){var r=e.getCursorPosition(),s=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,s,n.autoInsertedLineEnd[0])||(n.autoInsertedBrackets=0),n.autoInsertedRow=r.row,n.autoInsertedLineEnd=i+s.substr(r.column),n.autoInsertedBrackets++},g.recordMaybeInsert=function(e,t,i){var r=e.getCursorPosition(),s=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,s)||(n.maybeInsertedBrackets=0),n.maybeInsertedRow=r.row,n.maybeInsertedLineStart=s.substr(0,r.column)+i,n.maybeInsertedLineEnd=s.substr(r.column),n.maybeInsertedBrackets++},g.isAutoInsertedClosing=function(e,t,i){return n.autoInsertedBrackets>0&&e.row===n.autoInsertedRow&&i===n.autoInsertedLineEnd[0]&&t.substr(e.column)===n.autoInsertedLineEnd},g.isMaybeInsertedClosing=function(e,t){return n.maybeInsertedBrackets>0&&e.row===n.maybeInsertedRow&&t.substr(e.column)===n.maybeInsertedLineEnd&&t.substr(0,e.column)==n.maybeInsertedLineStart},g.popAutoInsertedClosing=function(){n.autoInsertedLineEnd=n.autoInsertedLineEnd.substr(1),n.autoInsertedBrackets--},g.clearMaybeInsertedClosing=function(){n&&(n.maybeInsertedBrackets=0,n.maybeInsertedRow=-1)},r.inherits(g,s),t.CstyleBehaviour=g}),define("skylark-ace/unicode",["require","exports","module"],function(e,t,i){for(var n=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],r=0,s=[],o=0;o<n.length;o+=2)s.push(r+=n[o]),n[o+1]&&s.push(45,r+=n[o+1]);t.wordChars=String.fromCharCode.apply(null,s)}),define("skylark-ace/mode/text",["require","exports","module","../config","../tokenizer","./text_highlight_rules","./behaviour/cstyle","../unicode","../lib/lang","../token_iterator","../range"],function(e,t,i){var n=e("../config"),r=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,l=e("../unicode"),a=e("../lib/lang"),c=e("../token_iterator").TokenIterator,h=e("../range").Range,u=function(){this.HighlightRules=s};(function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+l.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+l.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new r(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,i,n){var r=t.doc,s=!0,o=!0,l=1/0,c=t.getTabSize(),h=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var u=this.lineCommentStart.map(a.escapeRegExp).join("|"),d=this.lineCommentStart[0];else var u=a.escapeRegExp(this.lineCommentStart),d=this.lineCommentStart;u=new RegExp("^(\\s*)(?:"+u+") ?"),h=t.getUseSoftTabs();var f=function(e,t){var i=e.match(u);if(i){var n=i[1].length,s=i[0].length;v(e,n,s)||" "!=i[0][s-1]||s--,r.removeInLine(t,n,s)}},g=d+" ",p=function(e,t){s&&!/\S/.test(e)||(v(e,l,l)?r.insertInLine({row:t,column:l},g):r.insertInLine({row:t,column:l},d))},m=function(e,t){return u.test(e)},v=function(e,t,i){for(var n=0;t--&&" "==e.charAt(t);)n++;if(n%c!=0)return!1;for(var n=0;" "==e.charAt(i++);)n++;return c>2?n%c!=c-1:n%c==0}}else{if(!this.blockComment)return!1;var d=this.blockComment.start,y=this.blockComment.end,u=new RegExp("^(\\s*)(?:"+a.escapeRegExp(d)+")"),w=new RegExp("(?:"+a.escapeRegExp(y)+")\\s*$"),p=function(e,t){m(e,t)||s&&!/\S/.test(e)||(r.insertInLine({row:t,column:e.length},y),r.insertInLine({row:t,column:l},d))},f=function(e,t){var i;(i=e.match(w))&&r.removeInLine(t,e.length-i[0].length,e.length),(i=e.match(u))&&r.removeInLine(t,i[1].length,i[0].length)},m=function(e,i){if(u.test(e))return!0;for(var n=t.getTokens(i),r=0;r<n.length;r++)if("comment"===n[r].type)return!0}}function b(e){for(var t=i;t<=n;t++)e(r.getLine(t),t)}var C=1/0;b(function(e,t){var i=e.search(/\S/);-1!==i?(i<l&&(l=i),o&&!m(e,t)&&(o=!1)):C>e.length&&(C=e.length)}),l==1/0&&(l=C,s=!1,o=!1),h&&l%c!=0&&(l=Math.floor(l/c)*c),b(o?f:p)},this.toggleBlockComment=function(e,t,i,n){var r=this.blockComment;if(r){!r.start&&r[0]&&(r=r[0]);var s,o,l=new c(t,n.row,n.column),a=l.getCurrentToken(),u=(t.selection,t.selection.toOrientedRange());if(a&&/comment/.test(a.type)){for(var d,f;a&&/comment/.test(a.type);){var g=a.value.indexOf(r.start);if(-1!=g){var p=l.getCurrentTokenRow(),m=l.getCurrentTokenColumn()+g;d=new h(p,m,p,m+r.start.length);break}a=l.stepBackward()}for(var l=new c(t,n.row,n.column),a=l.getCurrentToken();a&&/comment/.test(a.type);){var g=a.value.indexOf(r.end);if(-1!=g){var p=l.getCurrentTokenRow(),m=l.getCurrentTokenColumn()+g;f=new h(p,m,p,m+r.end.length);break}a=l.stepForward()}f&&t.remove(f),d&&(t.remove(d),s=d.start.row,o=-r.start.length)}else o=r.start.length,s=i.start.row,t.insert(i.end,r.end),t.insert(i.start,r.start);u.start.row==s&&(u.start.column+=o),u.end.row==s&&(u.end.column+=o),t.selection.fromOrientedRange(u)}},this.getNextLineIndent=function(e,t,i){return this.$getIndent(t)},this.checkOutdent=function(e,t,i){return!1},this.autoOutdent=function(e,t,i){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var t in this.$embeds=[],this.$modes={},e)if(e[t]){var i=e[t],r=i.prototype.$id,s=n.$modes[r];s||(n.$modes[r]=s=new i),n.$modes[t]||(n.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}for(var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],t=0;t<o.length;t++)!function(e){var i=o[t],n=e[i];e[o[t]]=function(){return this.$delegator(i,arguments,n)}}(this)},this.$delegator=function(e,t,i){var n=t[0]||"start";if("string"!=typeof n){if(Array.isArray(n[2])){var r=n[2][n[2].length-1],s=this.$modes[r];if(s)return s[e].apply(s,[n[1]].concat([].slice.call(t,1)))}n=n[0]||"start"}for(var o=0;o<this.$embeds.length;o++)if(this.$modes[this.$embeds[o]]){var l=n.split(this.$embeds[o]);if(!l[0]&&l[1]){t[0]=l[1];var s=this.$modes[this.$embeds[o]];return s[e].apply(s,t)}}var a=i.apply(this,t);return i?a:void 0},this.transformAction=function(e,t,i,n,r){if(this.$behaviour){var s=this.$behaviour.getBehaviours();for(var o in s)if(s[o][t]){var l=s[o][t].apply(this,arguments);if(l)return l}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,i=[];for(var n in t)for(var r=t[n],s=0,o=r.length;s<o;s++)if("string"==typeof r[s].token)/keyword|support|storage/.test(r[s].token)&&i.push(r[s].regex);else if("object"==typeof r[s].token)for(var l=0,a=r[s].token.length;l<a;l++)if(/keyword|support|storage/.test(r[s].token[l])){var n=r[s].regex.match(/\(.+?\)/g)[l];i.push(n.substr(1,n.length-2))}this.completionKeywords=i}return e?i.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,i,n){var r=this.$keywordList||this.$createKeywordList();return r.map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call(u.prototype),t.Mode=u}),define("skylark-ace/apply_delta",["require","exports","module"],function(e,t,i){t.applyDelta=function(e,t,i){var n=t.start.row,r=t.start.column,s=e[n]||"";switch(t.action){case"insert":var o=t.lines;if(1===o.length)e[n]=s.substring(0,r)+t.lines[0]+s.substring(r);else{var l=[n,1].concat(t.lines);e.splice.apply(e,l),e[n]=s.substring(0,r)+e[n],e[n+t.lines.length-1]+=s.substring(r)}break;case"remove":var a=t.end.column,c=t.end.row;n===c?e[n]=s.substring(0,r)+s.substring(a):e.splice(n,c-n+1,s.substring(0,r)+e[c].substring(a))}}}),define("skylark-ace/anchor",["require","exports","module","./lib/oop","./lib/event_emitter"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,i){this.$onChange=this.onChange.bind(this),this.attach(e),void 0===i?this.setPosition(t.row,t.column):this.setPosition(t,i)};(function(){function e(e,t,i){var n=i?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&n}n.implement(this,r),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(t){if(!(t.start.row==t.end.row&&t.start.row!=this.row||t.start.row>this.row)){var i=function(t,i,n){var r="insert"==t.action,s=(r?1:-1)*(t.end.row-t.start.row),o=(r?1:-1)*(t.end.column-t.start.column),l=t.start,a=r?l:t.end;if(e(i,l,n))return{row:i.row,column:i.column};if(e(a,i,!n))return{row:i.row+s,column:i.column+(i.row==a.row?o:0)};return{row:l.row,column:l.column}}(t,{row:this.row,column:this.column},this.$insertRight);this.setPosition(i.row,i.column,!0)}},this.setPosition=function(e,t,i){var n;if(n=i?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=n.row||this.column!=n.column){var r={row:this.row,column:this.column};this.row=n.row,this.column=n.column,this._signal("change",{old:r,value:n})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var i={};return e>=this.document.getLength()?(i.row=Math.max(0,this.document.getLength()-1),i.column=this.document.getLine(i.row).length):e<0?(i.row=0,i.column=0):(i.row=e,i.column=Math.min(this.document.getLine(i.row).length,Math.max(0,t))),t<0&&(i.column=0),i}}).call(s.prototype)}),define("skylark-ace/document",["require","exports","module","./lib/oop","./apply_delta","./lib/event_emitter","./range","./anchor"],function(e,t,i){var n=e("./lib/oop"),r=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,l=e("./anchor").Anchor,a=function(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){n.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new l(this,e,t)},0==="aaa".split(/a/).length?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(t=this.getLines(e.start.row,e.end.row))[0]=(t[0]||"").substring(e.start.column);var i=t.length-1;e.end.row-e.start.row==i&&(t[i]=t[i].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var i=this.clippedPos(e.row,e.column),n=this.pos(e.row,e.column+t.length);return this.applyDelta({start:i,end:n,action:"insert",lines:[t]},!0),this.clonePos(n)},this.clippedPos=function(e,t){var i=this.getLength();void 0===e?e=i:e<0?e=0:e>=i&&(e=i-1,t=void 0);var n=this.getLine(e);return void 0==t&&(t=n.length),t=Math.min(Math.max(t,0),n.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){var i=0;(e=Math.min(Math.max(e,0),this.getLength()))<this.getLength()?(t=t.concat([""]),i=0):(t=[""].concat(t),e--,i=this.$lines[e].length),this.insertMergedLines({row:e,column:i},t)},this.insertMergedLines=function(e,t){var i=this.clippedPos(e.row,e.column),n={row:i.row+t.length-1,column:(1==t.length?i.column:0)+t[t.length-1].length};return this.applyDelta({start:i,end:n,action:"insert",lines:t}),this.clonePos(n)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),i=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:i,action:"remove",lines:this.getLinesForRange({start:t,end:i})}),this.clonePos(t)},this.removeInLine=function(e,t,i){var n=this.clippedPos(e,t),r=this.clippedPos(e,i);return this.applyDelta({start:n,end:r,action:"remove",lines:this.getLinesForRange({start:n,end:r})},!0),this.clonePos(n)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1);var i=(t=Math.min(Math.max(0,t),this.getLength()-1))==this.getLength()-1&&e>0,n=t<this.getLength()-1,r=i?e-1:e,s=i?this.getLine(r).length:0,l=n?t+1:t,a=n?0:this.getLine(l).length,c=new o(r,s,l,a),h=this.$lines.slice(e,t+1);return this.applyDelta({start:c.start,end:c.end,action:"remove",lines:this.getLinesForRange(c)}),h},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){return e instanceof o||(e=o.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty()?e.start:t==this.getTextRange(e)?e.end:(this.remove(e),t?this.insert(e.start,t):e.start)},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var i="insert"==e.action;(i?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))||(i&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(r(this.$lines,e,t),this._signal("change",e)))},this.$splitAndapplyLargeDelta=function(e,t){for(var i=e.lines,n=i.length-t+1,r=e.start.row,s=e.start.column,o=0,l=0;o<n;o=l){l+=t-1;var a=i.slice(o,l);a.push(""),this.applyDelta({start:this.pos(r+o,s),end:this.pos(r+l,s=0),action:e.action,lines:a},!0)}e.lines=i.slice(o),e.start.row=r+o,e.start.column=s,this.applyDelta(e,!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,r=t||0,s=i.length;r<s;r++)if((e-=i[r].length+n)<0)return{row:r,column:e+i[r].length+n};return{row:s-1,column:e+i[s-1].length+n}},this.positionToIndex=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,r=0,s=Math.min(e.row,i.length),o=t||0;o<s;++o)r+=i[o].length+n;return r+e.column}}).call(a.prototype),t.Document=a}),define("skylark-ace/background_tokenizer",["require","exports","module","./lib/oop","./lib/event_emitter"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,s=function(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var i=this;this.$worker=function(){if(i.running){for(var e=new Date,t=i.currentLine,n=-1,r=i.doc,s=t;i.lines[t];)t++;var o=r.getLength(),l=0;for(i.running=!1;t<o;){i.$tokenizeRow(t),n=t;do{t++}while(i.lines[t]);if(++l%5==0&&new Date-e>20){i.running=setTimeout(i.$worker,20);break}}i.currentLine=t,-1==n&&(n=t),s<=n&&i.fireUpdateEvent(s,n)}}};(function(){n.implement(this,r),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var i={first:e,last:t};this._signal("update",{data:i})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,i=e.end.row-t;if(0===i)this.lines[t]=null;else if("remove"==e.action)this.lines.splice(t,i+1,null),this.states.splice(t,i+1,null);else{var n=Array(i+1);n.unshift(t,1),this.lines.splice.apply(this.lines,n),this.states.splice.apply(this.states,n)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),i=this.states[e-1],n=this.tokenizer.getLineTokens(t,i,e);return this.states[e]+""!=n.state+""?(this.states[e]=n.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=n.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define("skylark-ace/search_highlight",["require","exports","module","./lib/lang","./lib/oop","./range"],function(e,t,i){var n=e("./lib/lang"),r=(e("./lib/oop"),e("./range").Range),s=function(e,t,i){this.setRegexp(e),this.clazz=t,this.type=i||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},this.update=function(e,t,i,s){if(this.regExp)for(var o=s.firstRow,l=s.lastRow,a=o;a<=l;a++){var c=this.cache[a];null==c&&((c=n.getMatchOffsets(i.getLine(a),this.regExp)).length>this.MAX_RANGES&&(c=c.slice(0,this.MAX_RANGES)),c=c.map(function(e){return new r(a,e.offset,a,e.offset+e.length)}),this.cache[a]=c.length?c:"");for(var h=c.length;h--;)t.drawSingleLineMarker(e,c[h].toScreenRange(i),this.clazz,s)}}}).call(s.prototype),t.SearchHighlight=s}),define("skylark-ace/edit_session/fold_line",["require","exports","module","../range"],function(e,t,i){var n=e("../range").Range;function r(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var i=t[t.length-1];this.range=new n(t[0].start.row,t[0].start.column,i.end.row,i.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,i){var n,r,s=0,o=this.folds,l=!0;null==t&&(t=this.end.row,i=this.end.column);for(var a=0;a<o.length;a++){if(n=o[a],-1==(r=n.range.compareStart(t,i)))return void e(null,t,i,s,l);if(!e(null,n.start.row,n.start.column,s,l)&&e(n.placeholder,n.start.row,n.start.column,s)||0===r)return;l=!n.sameRow,s=n.end.column}e(null,t,i,s,l)},this.getNextFoldTo=function(e,t){for(var i,n,r=0;r<this.folds.length;r++){if(i=this.folds[r],-1==(n=i.range.compareEnd(e,t)))return{fold:i,kind:"after"};if(0===n)return{fold:i,kind:"inside"}}return null},this.addRemoveChars=function(e,t,i){var n,r,s=this.getNextFoldTo(e,t);if(s)if(n=s.fold,"inside"==s.kind&&n.start.column!=t&&n.start.row!=e)window.console&&window.console.log(e,t,n);else if(n.start.row==e){var o=(r=this.folds).indexOf(n);for(0===o&&(this.start.column+=i);o<r.length;o++){if((n=r[o]).start.column+=i,!n.sameRow)return;n.end.column+=i}this.end.column+=i}},this.split=function(e,t){var i=this.getNextFoldTo(e,t);if(!i||"inside"==i.kind)return null;var n=i.fold,s=this.folds,o=this.foldData,l=s.indexOf(n),a=s[l-1];this.end.row=a.end.row,this.end.column=a.end.column,s=s.splice(l,s.length-l);var c=new r(o,s);return o.splice(o.indexOf(this)+1,0,c),c},this.merge=function(e){for(var t=e.folds,i=0;i<t.length;i++)this.addFold(t[i]);var n=this.foldData;n.splice(n.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push("  "+t.toString())}),e.push("]"),e.join("\n")},this.idxToPosition=function(e){for(var t=0,i=0;i<this.folds.length;i++){var n=this.folds[i];if((e-=n.start.column-t)<0)return{row:n.start.row,column:n.start.column+e};if((e-=n.placeholder.length)<0)return n.start;t=n.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(r.prototype),t.FoldLine=r}),define("skylark-ace/range_list",["require","exports","module","./range"],function(e,t,i){var n=e("./range").Range,r=n.comparePoints,s=function(){this.ranges=[]};(function(){this.comparePoints=r,this.pointIndex=function(e,t,i){for(var n=this.ranges,s=i||0;s<n.length;s++){var o=n[s],l=r(e,o.end);if(!(l>0)){var a=r(e,o.start);return 0===l?t&&0!==a?-s-2:s:a>0||0===a&&!t?s:-s-1}}return-s-1},this.add=function(e){var t=!e.isEmpty(),i=this.pointIndex(e.start,t);i<0&&(i=-i-1);var n=this.pointIndex(e.end,t,i);return n<0?n=-n-1:n++,this.ranges.splice(i,n-i,e)},this.addList=function(e){for(var t=[],i=e.length;i--;)t.push.apply(t,this.add(e[i]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){for(var e,t=[],i=this.ranges,n=(i=i.sort(function(e,t){return r(e.start,t.start)}))[0],s=1;s<i.length;s++){e=n,n=i[s];var o=r(e.end,n.start);o<0||(0!=o||e.isEmpty()||n.isEmpty())&&(r(e.end,n.end)<0&&(e.end.row=n.end.row,e.end.column=n.end.column),i.splice(s,1),t.push(n),n=e,s--)}return this.ranges=i,t},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var i=this.ranges;if(i[0].start.row>t||i[i.length-1].start.row<e)return[];var n=this.pointIndex({row:e,column:0});n<0&&(n=-n-1);var r=this.pointIndex({row:t,column:0},n);r<0&&(r=-r-1);for(var s=[],o=n;o<r;o++)s.push(i[o]);return s},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},this.$onChange=function(e){for(var t=e.start,i=e.end,n=t.row,r=i.row,s=this.ranges,o=0,l=s.length;o<l;o++){var a=s[o];if(a.end.row>=n)break}if("insert"==e.action)for(var c=r-n,h=-t.column+i.column;o<l;o++){var a=s[o];if(a.start.row>n)break;if(a.start.row==n&&a.start.column>=t.column&&(a.start.column==t.column&&this.$insertRight||(a.start.column+=h,a.start.row+=c)),a.end.row==n&&a.end.column>=t.column){if(a.end.column==t.column&&this.$insertRight)continue;a.end.column==t.column&&h>0&&o<l-1&&a.end.column>a.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=h),a.end.column+=h,a.end.row+=c}}else for(var c=n-r,h=t.column-i.column;o<l;o++){var a=s[o];if(a.start.row>r)break;a.end.row<r&&(n<a.end.row||n==a.end.row&&t.column<a.end.column)?(a.end.row=n,a.end.column=t.column):a.end.row==r?a.end.column<=i.column?(c||a.end.column>t.column)&&(a.end.column=t.column,a.end.row=t.row):(a.end.column+=h,a.end.row+=c):a.end.row>r&&(a.end.row+=c),a.start.row<r&&(n<a.start.row||n==a.start.row&&t.column<a.start.column)?(a.start.row=n,a.start.column=t.column):a.start.row==r?a.start.column<=i.column?(c||a.start.column>t.column)&&(a.start.column=t.column,a.start.row=t.row):(a.start.column+=h,a.start.row+=c):a.start.row>r&&(a.start.row+=c)}if(0!=c&&o<l)for(;o<l;o++){var a=s[o];a.start.row+=c,a.end.row+=c}}}).call(s.prototype),t.RangeList=s}),define("skylark-ace/edit_session/fold",["require","exports","module","../range","../range_list","../lib/oop"],function(e,t,i){e("../range").Range;var n=e("../range_list").RangeList,r=e("../lib/oop"),s=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};function o(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function l(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}r.inherits(s,n),function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new s(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(!this.range.isEqual(e)){if(!this.range.containsRange(e))throw new Error("A fold can't intersect already existing fold"+e.range+this.range);var t,i;t=e,i=this.start,o(t.start,i),o(t.end,i);for(var n=e.start.row,r=e.start.column,s=0,l=-1;s<this.subFolds.length&&1==(l=this.subFolds[s].range.compare(n,r));s++);var a=this.subFolds[s];if(0==l)return a.addSubFold(e);for(var n=e.range.end.row,r=e.range.end.column,c=s,l=-1;c<this.subFolds.length&&1==(l=this.subFolds[c].range.compare(n,r));c++);this.subFolds[c];if(0==l)throw new Error("A fold can't intersect already existing fold"+e.range+this.range);this.subFolds.splice(s,c-s,e);return e.setFoldLine(this.foldLine),e}},this.restoreRange=function(e){return function(e,t){l(e.start,t),l(e.end,t)}(e,this.start)}}.call(s.prototype)}),define("skylark-ace/edit_session/folding",["require","exports","module","../range","./fold_line","./fold","../token_iterator"],function(e,t,i){var n=e("../range").Range,r=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=function(){this.getFoldAt=function(e,t,i){var n=this.getFoldLine(e);if(!n)return null;for(var r=n.folds,s=0;s<r.length;s++){var o=r[s];if(o.range.contains(e,t)){if(1==i&&o.range.isEnd(e,t))continue;if(-1==i&&o.range.isStart(e,t))continue;return o}}},this.getFoldsInRange=function(e){var t=e.start,i=e.end,n=this.$foldData,r=[];t.column+=1,i.column-=1;for(var s=0;s<n.length;s++){var o=n[s].range.compareRange(e);if(2!=o){if(-2==o)break;for(var l=n[s].folds,a=0;a<l.length;a++){var c=l[a];if(-2==(o=c.range.compareRange(e)))break;if(2!=o){if(42==o)break;r.push(c)}}}}return t.column-=1,i.column+=1,r},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){for(var e=[],t=this.$foldData,i=0;i<t.length;i++)for(var n=0;n<t[i].folds.length;n++)e.push(t[i].folds[n]);return e},this.getFoldStringAt=function(e,t,i,n){if(!(n=n||this.getFoldLine(e)))return null;for(var r,s,o={end:{column:0}},l=0;l<n.folds.length;l++){var a=(s=n.folds[l]).range.compareEnd(e,t);if(-1==a){r=this.getLine(s.start.row).substring(o.end.column,s.start.column);break}if(0===a)return null;o=s}return r||(r=this.getLine(s.start.row).substring(o.end.column)),-1==i?r.substring(0,t-o.end.column):1==i?r.substring(t-o.end.column):r},this.getFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0);n<i.length;n++){var r=i[n];if(r.start.row<=e&&r.end.row>=e)return r;if(r.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0);n<i.length;n++){var r=i[n];if(r.end.row>=e)return r}return null},this.getFoldedRowCount=function(e,t){for(var i=this.$foldData,n=t-e+1,r=0;r<i.length;r++){var s=i[r],o=s.end.row,l=s.start.row;if(o>=t){l<t&&(l>=e?n-=t-l:n=0);break}o>=e&&(n-=l>=e?o-l:o-e+1)}return n},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var i,n=this.$foldData,o=!1;e instanceof s?i=e:(i=new s(t,e)).collapseChildren=t.collapseChildren,this.$clipRangeToDocument(i.range);var l=i.start.row,a=i.start.column,c=i.end.row,h=i.end.column;if(!(l<c||l==c&&a<=h-2))throw new Error("The range has to be at least 2 characters width");var u=this.getFoldAt(l,a,1),d=this.getFoldAt(c,h,-1);if(u&&d==u)return u.addSubFold(i);u&&!u.range.isStart(l,a)&&this.removeFold(u),d&&!d.range.isEnd(c,h)&&this.removeFold(d);var f=this.getFoldsInRange(i.range);f.length>0&&(this.removeFolds(f),f.forEach(function(e){i.addSubFold(e)}));for(var g=0;g<n.length;g++){var p=n[g];if(c==p.start.row){p.addFold(i),o=!0;break}if(l==p.end.row){if(p.addFold(i),o=!0,!i.sameRow){var m=n[g+1];if(m&&m.start.row==c){p.merge(m);break}}break}if(c<=p.start.row)break}return o||(p=this.$addFoldLine(new r(this.$foldData,i))),this.$useWrapMode?this.$updateWrapData(p.start.row,p.start.row):this.$updateRowLengthCache(p.start.row,p.start.row),this.$modified=!0,this._signal("changeFold",{data:i,action:"add"}),i},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,i=t.start.row,n=t.end.row,r=this.$foldData,s=t.folds;if(1==s.length)r.splice(r.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))s.pop(),t.end.row=s[s.length-1].end.row,t.end.column=s[s.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))s.shift(),t.start.row=s[0].start.row,t.start.column=s[0].start.column;else if(e.sameRow)s.splice(s.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);(s=o.folds).shift(),o.start.row=s[0].start.row,o.start.column=s[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(i,n):this.$updateRowLengthCache(i,n)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var i,r;if(null==e?(i=new n(0,0,this.getLength(),0),t=!0):i="number"==typeof e?new n(e,0,e,this.getLine(e).length):"row"in e?n.fromPoints(e,e):e,r=this.getFoldsInRangeList(i),t)this.removeFolds(r);else for(var s=r;s.length;)this.expandFolds(s),s=this.getFoldsInRangeList(i);if(r.length)return r},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var i=this.getFoldLine(e,t);return i?i.end.row:e},this.getRowFoldStart=function(e,t){var i=this.getFoldLine(e,t);return i?i.start.row:e},this.getFoldDisplayLine=function(e,t,i,n,r){null==n&&(n=e.start.row),null==r&&(r=0),null==t&&(t=e.end.row),null==i&&(i=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,i,l){if(!(t<n)){if(t==n){if(i<r)return;l=Math.max(r,l)}o+=null!=e?e:s.getLine(t).substring(l,i)}},t,i),o},this.getDisplayLine=function(e,t,i,n){var r,s=this.getFoldLine(e);return s?this.getFoldDisplayLine(s,e,t,i,n):(r=this.doc.getLine(e)).substring(n||0,t||r.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var i=t.folds.map(function(e){return e.clone()});return new r(e,i)})},this.toggleFold=function(e){var t,i,n=this.selection,r=n.getRange();if(r.isEmpty()){var s=r.start;if(t=this.getFoldAt(s.row,s.column))return void this.expandFold(t);(i=this.findMatchingBracket(s))?1==r.comparePoint(i)?r.end=i:(r.start=i,r.start.column++,r.end.column--):(i=this.findMatchingBracket({row:s.row,column:s.column+1}))?(1==r.comparePoint(i)?r.end=i:r.start=i,r.start.column++):r=this.getCommentFoldRange(s.row,s.column)||r}else{var o=this.getFoldsInRange(r);if(e&&o.length)return void this.expandFolds(o);1==o.length&&(t=o[0])}if(t||(t=this.getFoldAt(r.start.row,r.start.column)),t&&t.range.toString()==r.toString())this.expandFold(t);else{var l="...";if(!r.isMultiLine()){if((l=this.getTextRange(r)).length<4)return;l=l.trim().substring(0,2)+".."}this.addFold(l,r)}},this.getCommentFoldRange=function(e,t,i){var r=new o(this,e,t),s=r.getCurrentToken(),l=s.type;if(s&&/^comment|string/.test(l)){"comment"==(l=l.match(/comment|string/)[0])&&(l+="|doc-start");var a=new RegExp(l),c=new n;if(1!=i){do{s=r.stepBackward()}while(s&&a.test(s.type));r.stepForward()}if(c.start.row=r.getCurrentTokenRow(),c.start.column=r.getCurrentTokenColumn()+2,r=new o(this,e,t),-1!=i){var h=-1;do{if(s=r.stepForward(),-1==h){var u=this.getState(r.$row);a.test(u)||(h=r.$row)}else if(r.$row>h)break}while(s&&a.test(s.type));s=r.stepBackward()}else s=r.getCurrentToken();return c.end.row=r.getCurrentTokenRow(),c.end.column=r.getCurrentTokenColumn()+s.value.length-2,c}},this.foldAll=function(e,t,i){void 0==i&&(i=1e5);var n=this.foldWidgets;if(n){t=t||this.getLength();for(var r=e=e||0;r<t;r++)if(null==n[r]&&(n[r]=this.getFoldWidget(r)),"start"==n[r]){var s=this.getFoldWidgetRange(r);if(s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e){r=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=i)}catch(e){}}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){this.$foldMode!=e&&(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),e&&"manual"!=this.$foldStyle?(this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)):this.foldWidgets=null)},this.getParentFoldRangeData=function(e,t){var i=this.foldWidgets;if(!i||t&&i[e])return{};for(var n,r=e-1;r>=0;){var s=i[r];if(null==s&&(s=i[r]=this.getFoldWidget(r)),"start"==s){var o=this.getFoldWidgetRange(r);if(n||(n=o),o&&o.end.row>=e)break}r--}return{range:-1!==r&&o,firstRange:n}},this.onFoldWidgetClick=function(e,t){var i={children:(t=t.domEvent).shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},n=this.$toggleFoldWidget(e,i);if(!n){var r=t.target||t.srcElement;r&&/ace_fold-widget/.test(r.className)&&(r.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(this.getFoldWidget){var i=this.getFoldWidget(e),n=this.getLine(e),r="end"===i?-1:1,s=this.getFoldAt(e,-1===r?0:n.length,r);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()&&(s=this.getFoldAt(o.start.row,o.start.column,1))&&o.isEqual(s.range))return this.removeFold(s),s;if(t.siblings){var l=this.getParentFoldRangeData(e);if(l.range)var a=l.range.start.row+1,c=l.range.end.row;this.foldAll(a,c,t.all?1e4:0)}else t.children?(c=o?o.end.row:this.getLength(),this.foldAll(e+1,c,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o}},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var i=this.$toggleFoldWidget(t,{});if(!i){var n=this.getParentFoldRangeData(t,!0);if(i=n.range||n.firstRange){t=i.start.row;var r=this.getFoldAt(t,this.getLine(t).length,1);r?this.removeFold(r):this.addFold("...",i)}}},this.updateFoldWidgets=function(e){var t=e.start.row,i=e.end.row-t;if(0===i)this.foldWidgets[t]=null;else if("remove"==e.action)this.foldWidgets.splice(t,i+1,null);else{var n=Array(i+1);n.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,n)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}}),define("skylark-ace/edit_session/bracket_match",["require","exports","module","../token_iterator","../range"],function(e,t,i){var n=e("../token_iterator").TokenIterator,r=e("../range").Range;t.BracketMatch=function(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var i=t||this.getLine(e.row).charAt(e.column-1);if(""==i)return null;var n=i.match(/([\(\[\{])|([\)\]\}])/);return n?n[1]?this.$findClosingBracket(n[1],e):this.$findOpeningBracket(n[2],e):null},this.getBracketRange=function(e){var t,i=this.getLine(e.row),n=!0,s=i.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);if(o||(s=i.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1),!o)return null;if(o[1]){var l=this.$findClosingBracket(o[1],e);if(!l)return null;t=r.fromPoints(e,l),n||(t.end.column++,t.start.column--),t.cursor=t.end}else{var l=this.$findOpeningBracket(o[2],e);if(!l)return null;t=r.fromPoints(l,e),n||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,i){var r=this.$brackets[e],s=1,o=new n(this,t.row,t.column),l=o.getCurrentToken();if(l||(l=o.stepForward()),l){i||(i=new RegExp("(\\.?"+l.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));for(var a=t.column-o.getCurrentTokenColumn()-2,c=l.value;;){for(;a>=0;){var h=c.charAt(a);if(h==r){if(0==(s-=1))return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else h==e&&(s+=1);a-=1}do{l=o.stepBackward()}while(l&&!i.test(l.type));if(null==l)break;c=l.value,a=c.length-1}return null}},this.$findClosingBracket=function(e,t,i){var r=this.$brackets[e],s=1,o=new n(this,t.row,t.column),l=o.getCurrentToken();if(l||(l=o.stepForward()),l){i||(i=new RegExp("(\\.?"+l.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));for(var a=t.column-o.getCurrentTokenColumn();;){for(var c=l.value,h=c.length;a<h;){var u=c.charAt(a);if(u==r){if(0==(s-=1))return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else u==e&&(s+=1);a+=1}do{l=o.stepForward()}while(l&&!i.test(l.type));if(null==l)break;a=0}return null}}}}),define("skylark-ace/edit_session",["require","exports","module","./lib/oop","./lib/lang","./bidihandler","./config","./lib/event_emitter","./selection","./mode/text","./range","./document","./background_tokenizer","./search_highlight","./edit_session/folding","./edit_session/bracket_match"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/lang"),s=e("./bidihandler").BidiHandler,o=e("./config"),l=e("./lib/event_emitter").EventEmitter,a=e("./selection").Selection,c=e("./mode/text").Mode,h=e("./range").Range,u=e("./document").Document,d=e("./background_tokenizer").BackgroundTokenizer,f=e("./search_highlight").SearchHighlight,g=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.id="session"+ ++g.$uid,this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof e&&e.getLine||(e=new u(e)),this.setDocument(e),this.selection=new a(this),this.$bidiHandler=new s(this),o.resetOptions(this),this.setMode(t),o._signal("session",this)};g.$uid=0,function(){n.implement(this,l),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e)return this.$docRowCache=[],void(this.$screenRowCache=[]);var t=this.$docRowCache.length,i=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>i&&(this.$docRowCache.splice(i,t),this.$screenRowCache.splice(i,t))},this.$getRowCacheIndex=function(e,t){for(var i=0,n=e.length-1;i<=n;){var r=i+n>>1,s=e[r];if(t>s)i=r+1;else{if(!(t<s))return r;n=r-1}}return i-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer&&this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var i,n=this.bgTokenizer.getTokens(e),r=0;if(null==t){var s=n.length-1;r=this.getLine(e).length}else for(var s=0;s<n.length&&!((r+=n[s].value.length)>=t);s++);return(i=n[s])?(i.index=s,i.start=r-i.value.length,i):null},this.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=r.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?r.stringRepeat(" ",this.getTabSize()):"\t"},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},this.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.addMarker=function(e,t,i,n){var r=this.$markerId++,s={range:e,type:i||"line",renderer:"function"==typeof i?i:null,clazz:t,inFront:!!n,id:r};return n?(this.$frontMarkers[r]=s,this._signal("changeFrontMarker")):(this.$backMarkers[r]=s,this._signal("changeBackMarker")),r},this.addDynamicMarker=function(e,t){if(e.update){var i=this.$markerId++;return e.id=i,e.inFront=!!t,t?(this.$frontMarkers[i]=e,this._signal("changeFrontMarker")):(this.$backMarkers[i]=e,this._signal("changeBackMarker")),e}},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var i=t.inFront?this.$frontMarkers:this.$backMarkers;delete i[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")}},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new f(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,i,n){"number"!=typeof t&&(i=t,t=e),i||(i="ace_step");var r=new h(e,0,t,1/0);return r.id=this.addMarker(r,i,"fullLine",n),r},this.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);this.$autoNewLine=t?t[1]:"\n"},this.getWordRange=function(e,t){var i=this.getLine(e),n=!1;if(t>0&&(n=!!i.charAt(t-1).match(this.tokenRe)),n||(n=!!i.charAt(t).match(this.tokenRe)),n)var r=this.tokenRe;else if(/^\s+$/.test(i.slice(t-1,t+1)))var r=/\s/;else var r=this.nonTokenRe;var s=t;if(s>0){do{s--}while(s>=0&&i.charAt(s).match(r));s++}for(var o=t;o<i.length&&i.charAt(o).match(r);)o++;return new h(e,s,e,o)},this.getAWordRange=function(e,t){for(var i=this.getWordRange(e,t),n=this.getLine(i.end.row);n.charAt(i.end.column).match(/[ \t]/);)i.end.column+=1;return i},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},this.$modes=o.$modes,this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var i=e,n=i.path}else n=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new c),this.$modes[n]&&!i)return this.$onChangeMode(this.$modes[n]),void(t&&t());this.$modeId=n,o.loadModule(["mode",n],function(e){if(this.$modeId!==n)return t&&t();this.$modes[n]&&!i?this.$onChangeMode(this.$modes[n]):e&&e.Mode&&(e=new e.Mode(i),i||(this.$modes[n]=e,e.$id=n),this.$onChangeMode(e)),t&&t()}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},this.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var i=e.getTokenizer();if(void 0!==i.addEventListener){var n=this.onReloadTokenizer.bind(this);i.addEventListener("update",n)}if(this.bgTokenizer)this.bgTokenizer.setTokenizer(i);else{this.bgTokenizer=new d(i);var r=this;this.bgTokenizer.addEventListener("update",function(e){r._signal("tokenizerUpdate",e)})}this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode"))}},this.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},this.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){o.warn("Could not load worker",e),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),i=this.$rowLengthCache,n=0,r=0,s=this.$foldData[r],o=s?s.start.row:1/0,l=t.length,a=0;a<l;a++){if(a>o){if((a=s.end.row+1)>=l)break;s=this.$foldData[r++],o=s?s.start.row:1/0}null==i[a]&&(i[a]=this.$getStringScreenWidth(t[a])[0]),i[a]>n&&(n=i[a])}this.screenWidth=n}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=e.length-1;-1!=i;i--){var n=e[i];"insert"==n.action||"remove"==n.action?this.doc.revertDelta(n):n.folds&&this.addFolds(n.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},this.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=0;i<e.length;i++){var n=e[i];"insert"!=n.action&&"remove"!=n.action||this.doc.applyDelta(n)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t){function i(e){return t?"insert"!==e.action:"insert"===e.action}for(var n,r,s=0;s<e.length;s++){var o=e[s];o.start&&(n?i(o)?(r=o.start,-1==n.compare(r.row,r.column)&&n.setStart(r),r=o.end,1==n.compare(r.row,r.column)&&n.setEnd(r),!0):(r=o.start,-1==n.compare(r.row,r.column)&&(n=h.fromPoints(o.start,o.start)),!1):i(o)?(n=h.fromPoints(o.start,o.end),!0):(n=h.fromPoints(o.start,o.start),!1))}return n},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,i){var n=this.getTextRange(e),r=this.getFoldsInRange(e),s=h.fromPoints(t,t);if(!i){this.remove(e);var o=e.start.row-e.end.row,l=o?-e.end.column:e.start.column-e.end.column;l&&(s.start.row==e.end.row&&s.start.column>e.end.column&&(s.start.column+=l),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=l)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}if(s.end=this.insert(s.start,n),r.length){var a=e.start,c=s.start,o=c.row-a.row,l=c.column-a.column;this.addFolds(r.map(function(e){return(e=e.clone()).start.row==a.row&&(e.start.column+=l),e.end.row==a.row&&(e.end.column+=l),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,i){i=i.replace(/\t/g,this.getTabString());for(var n=e;n<=t;n++)this.doc.insertInLine({row:n,column:0},i)},this.outdentRows=function(e){for(var t=e.collapseRows(),i=new h(0,0,0,0),n=this.getTabSize(),r=t.start.row;r<=t.end.row;++r){var s=this.getLine(r);i.start.row=r,i.end.row=r;for(var o=0;o<n&&" "==s.charAt(o);++o);o<n&&"\t"==s.charAt(o)?(i.start.column=o,i.end.column=o+1):(i.start.column=0,i.end.column=o),this.remove(i)}},this.$moveLines=function(e,t,i){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),i<0){var n=this.getRowFoldStart(e+i);if(n<0)return 0;var r=n-e}else if(i>0){var n=this.getRowFoldEnd(t+i);if(n>this.doc.getLength()-1)return 0;var r=n-t}else{e=this.$clipRowToDocument(e);var r=(t=this.$clipRowToDocument(t))-e+1}var s=new h(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return(e=e.clone()).start.row+=r,e.end.row+=r,e}),l=0==i?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+r,l),o.length&&this.addFolds(o),r},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),e<0)e=0,t=0;else{var i=this.doc.getLength();e>=i?(e=i-1,t=this.doc.getLine(i-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){this.$wrapLimitRange.min===e&&this.$wrapLimitRange.max===t||(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},this.adjustWrapLimit=function(e,t){var i=this.$wrapLimitRange;i.max<0&&(i={min:t,max:t});var n=this.$constrainWrapLimit(e,i.min,i.max);return n!=this.$wrapLimit&&n>1&&(this.$wrapLimit=n,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},this.$constrainWrapLimit=function(e,t,i){return t&&(e=Math.max(t,e)),i&&(e=Math.min(i,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,i=e.action,n=e.start,r=e.end,s=n.row,o=r.row,l=o-s,a=null;if(this.$updating=!0,0!=l)if("remove"===i){this[t?"$wrapData":"$rowLengthCache"].splice(s,l);var c=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var h=this.getFoldLine(r.row),u=0;if(h){h.addRemoveChars(r.row,r.column,n.column-r.column),h.shiftRow(-l);var d=this.getFoldLine(s);d&&d!==h&&(d.merge(h),h=d),u=c.indexOf(h)+1}for(;u<c.length;u++){var h=c[u];h.start.row>=r.row&&h.shiftRow(-l)}o=s}else{var f=Array(l);f.unshift(s,0);var g=t?this.$wrapData:this.$rowLengthCache;g.splice.apply(g,f);var c=this.$foldData,h=this.getFoldLine(s),u=0;if(h){var p=h.range.compareInside(n.row,n.column);0==p?(h=h.split(n.row,n.column))&&(h.shiftRow(l),h.addRemoveChars(o,0,r.column-n.column)):-1==p&&(h.addRemoveChars(s,0,r.column-n.column),h.shiftRow(l)),u=c.indexOf(h)+1}for(;u<c.length;u++){var h=c[u];h.start.row>=s&&h.shiftRow(l)}}else{l=Math.abs(e.start.column-e.end.column),"remove"===i&&(a=this.getFoldsInRange(e),this.removeFolds(a),l=-l);var h=this.getFoldLine(s);h&&h.addRemoveChars(s,n.column,l)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,i){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(i,n){var r,s,o=this.doc.getAllLines(),l=this.getTabSize(),a=this.$wrapData,c=this.$wrapLimit,h=i;for(n=Math.min(n,o.length-1);h<=n;)(s=this.getFoldLine(h,s))?(r=[],s.walk(function(i,n,s,l){var a;if(null!=i){(a=this.$getDisplayTokens(i,r.length))[0]=e;for(var c=1;c<a.length;c++)a[c]=t}else a=this.$getDisplayTokens(o[n].substring(l,s),r.length);r=r.concat(a)}.bind(this),s.end.row,o[s.end.row].length+1),a[s.start.row]=this.$computeWrapSplits(r,c,l),h=s.end.row+1):(r=this.$getDisplayTokens(o[h]),a[h]=this.$computeWrapSplits(r,c,l),h++)};var e=3,t=4,i=10,s=11,a=12;function u(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}this.$computeWrapSplits=function(n,r,o){if(0==n.length)return[];var l=[],c=n.length,h=0,u=0,d=this.$wrapAsCode,f=this.$indentedSoftWrap,g=r<=Math.max(2*o,8)||!1===f?0:Math.floor(r/2);function p(e){for(var t=e-h,r=h;r<e;r++){var c=n[r];12!==c&&2!==c||(t-=1)}l.length||(m=function(){var e=0;if(0===g)return e;if(f)for(var t=0;t<n.length;t++){var r=n[t];if(r==i)e+=1;else{if(r!=s){if(r==a)continue;break}e+=o}}d&&!1!==f&&(e+=o);return Math.min(e,g)}(),l.indent=m),u+=t,l.push(u),h=e}for(var m=0;c-h>r-m;){var v=h+r-m;if(n[v-1]>=i&&n[v]>=i)p(v);else if(n[v]!=e&&n[v]!=t){for(var y=Math.max(v-(r-(r>>2)),h-1);v>y&&n[v]<e;)v--;if(d){for(;v>y&&n[v]<e;)v--;for(;v>y&&9==n[v];)v--}else for(;v>y&&n[v]<i;)v--;v>y?p(++v):(2==n[v=h+r]&&v--,p(v-m))}else{for(;v!=h-1&&n[v]!=e;v--);if(v>h){p(v);continue}for(v=h+r;v<n.length&&n[v]==t;v++);if(v==n.length)break;p(v)}}return l},this.$getDisplayTokens=function(e,t){var n,r=[];t=t||0;for(var o=0;o<e.length;o++){var l=e.charCodeAt(o);if(9==l){n=this.getScreenTabSize(r.length+t),r.push(s);for(var c=1;c<n;c++)r.push(a)}else 32==l?r.push(i):l>39&&l<48||l>57&&l<64?r.push(9):l>=4352&&u(l)?r.push(1,2):r.push(1)}return r},this.$getStringScreenWidth=function(e,t,i){if(0==t)return[0,0];var n,r;for(null==t&&(t=1/0),i=i||0,r=0;r<e.length&&(9==(n=e.charCodeAt(r))?i+=this.getScreenTabSize(i):n>=4352&&u(n)?i+=2:i+=1,!(i>t));r++);return[i,r]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),i=this.$wrapData[t.row];return i.length&&i[0]<t.column?i.indent:0}return 0},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var i=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(i)},this.getDocumentLastRowColumnPosition=function(e,t){var i=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(i,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:void 0},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t,i){if(e<0)return{row:0,column:0};var n,r,s=0,o=0,l=0,a=0,c=this.$screenRowCache,h=this.$getRowCacheIndex(c,e),u=c.length;if(u&&h>=0)var l=c[h],s=this.$docRowCache[h],d=e>c[u-1];else var d=!u;for(var f=this.getLength()-1,g=this.getNextFoldLine(s),p=g?g.start.row:1/0;l<=e&&(a=this.getRowLength(s),!(l+a>e||s>=f));)l+=a,++s>p&&(s=g.end.row+1,g=this.getNextFoldLine(s,g),p=g?g.start.row:1/0),d&&(this.$docRowCache.push(s),this.$screenRowCache.push(l));if(g&&g.start.row<=s)n=this.getFoldDisplayLine(g),s=g.start.row;else{if(l+a<=e||s>f)return{row:f,column:this.getLine(f).length};n=this.getLine(s),g=null}var m=0,v=Math.floor(e-l);if(this.$useWrapMode){var y=this.$wrapData[s];y&&(r=y[v],v>0&&y.length&&(m=y.indent,o=y[v-1]||y[y.length-1],n=n.substring(o)))}return void 0!==i&&this.$bidiHandler.isBidiRow(l+v,s,v)&&(t=this.$bidiHandler.offsetToCol(i)),o+=this.$getStringScreenWidth(n,t-m)[1],this.$useWrapMode&&o>=r&&(o=r-1),g?g.idxToPosition(o):{row:s,column:o}},this.documentToScreenPosition=function(e,t){if(void 0===t)var i=this.$clipPositionToDocument(e.row,e.column);else i=this.$clipPositionToDocument(e,t);e=i.row,t=i.column;var n=0,r=null,s=null;(s=this.getFoldAt(e,t,1))&&(e=s.start.row,t=s.start.column);var o,l=0,a=this.$docRowCache,c=this.$getRowCacheIndex(a,e),h=a.length;if(h&&c>=0)var l=a[c],n=this.$screenRowCache[c],u=e>a[h-1];else var u=!h;for(var d=this.getNextFoldLine(l),f=d?d.start.row:1/0;l<e;){if(l>=f){if((o=d.end.row+1)>e)break;d=this.getNextFoldLine(o,d),f=d?d.start.row:1/0}else o=l+1;n+=this.getRowLength(l),l=o,u&&(this.$docRowCache.push(l),this.$screenRowCache.push(n))}var g="";d&&l>=f?(g=this.getFoldDisplayLine(d,e,t),r=d.start.row):(g=this.getLine(e).substring(0,t),r=e);var p=0;if(this.$useWrapMode){var m=this.$wrapData[r];if(m){for(var v=0;g.length>=m[v];)n++,v++;g=g.substring(m[v-1]||0,g.length),p=v>0?m.indent:0}}return{row:n,column:p+this.$getStringScreenWidth(g)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode)for(var i=this.$wrapData.length,n=0,r=0,t=this.$foldData[r++],s=t?t.start.row:1/0;n<i;){var o=this.$wrapData[n];e+=o?o.length+1:1,++n>s&&(n=t.end.row+1,t=this.$foldData[r++],s=t?t.start.row:1/0)}else{e=this.getLength();for(var l=this.$foldData,r=0;r<l.length;r++)t=l[r],e-=t.end.row-t.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(t,i,n){if(0===i)return[0,0];var r,s;for(i||(i=1/0),n=n||0,s=0;s<t.length&&(r=t.charAt(s),!((n+="\t"===r?this.getScreenTabSize(n):e.getCharacterWidth(r))>i));s++);return[n,s]})},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()},this.isFullWidth=u}.call(g.prototype),e("./edit_session/folding").Folding.call(g.prototype),e("./edit_session/bracket_match").BracketMatch.call(g.prototype),o.defineOptions(g.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){(e="auto"==e?"text"!=this.$mode.type:"text"!=e)!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){e=parseInt(e),isNaN(e)||this.$tabSize===e||(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=g}),define("skylark-ace/search",["require","exports","module","./lib/lang","./lib/oop","./range"],function(e,t,i){var n=e("./lib/lang"),r=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return r.mixin(this.$options,e),this},this.getOptions=function(){return n.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,i=this.$matchIterator(e,t);if(!i)return!1;var n=null;return i.forEach(function(e,i,r,o){return n=new s(e,i,r,o),!(i==o&&t.start&&t.start.start&&0!=t.skipCurrent&&n.isEqual(t.start))||(n=null,!1)}),n},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var i=t.range,r=i?e.getLines(i.start.row,i.end.row):e.doc.getAllLines(),o=[],l=t.re;if(t.$isMultiLine){var a,c=l.length,h=r.length-c;e:for(var u=l.offset||0;u<=h;u++){for(var d=0;d<c;d++)if(-1==r[u+d].search(l[d]))continue e;var f=r[u],g=r[u+c-1],p=f.length-f.match(l[0])[0].length,m=g.match(l[c-1])[0].length;a&&a.end.row===u&&a.end.column>p||(o.push(a=new s(u,p,u+c-1,m)),c>2&&(u=u+c-2))}}else for(var v=0;v<r.length;v++)for(var y=n.getMatchOffsets(r[v],l),d=0;d<y.length;d++){var w=y[d];o.push(new s(v,w.offset,v,w.offset+w.length))}if(i){for(var b=i.start.column,C=i.start.column,v=0,d=o.length-1;v<d&&o[v].start.column<b&&o[v].start.row==i.start.row;)v++;for(;v<d&&o[d].end.column>C&&o[d].end.row==i.end.row;)d--;for(o=o.slice(v,d+1),v=0,d=o.length;v<d;v++)o[v].start.row+=i.start.row,o[v].end.row+=i.start.row}return o},this.replace=function(e,t){var i=this.$options,n=this.$assembleRegExp(i);if(i.$isMultiLine)return t;if(n){var r=n.exec(e);if(!r||r[0].length!=e.length)return null;if(t=e.replace(n,t),i.preserveCase){t=t.split("");for(var s=Math.min(e.length,e.length);s--;){var o=e[s];o&&o.toLowerCase()!=o?t[s]=t[s].toUpperCase():t[s]=t[s].toLowerCase()}t=t.join("")}return t}},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var i=e.needle;if(!e.needle)return e.re=!1;e.regExp||(i=n.escapeRegExp(i)),e.wholeWord&&(i=function(e,t){function i(e){return/\w/.test(e)||t.regExp?"\\b":""}return i(e[0])+e+i(e[e.length-1])}(i,e));var r=e.caseSensitive?"gm":"gmi";if(e.$isMultiLine=!t&&/[\n\r]/.test(i),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(i,r);try{var s=new RegExp(i,r)}catch(e){s=!1}return e.re=s},this.$assembleMultilineRegExp=function(e,t){for(var i=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),n=[],r=0;r<i.length;r++)try{n.push(new RegExp(i[r],t))}catch(e){return!1}return n},this.$matchIterator=function(e,t){var i=this.$assembleRegExp(t);if(!i)return!1;var n=1==t.backwards,r=0!=t.skipCurrent,s=t.range,o=t.start;o||(o=s?s[n?"end":"start"]:e.selection.getRange()),o.start&&(o=o[r!=n?"end":"start"]);var l=s?s.start.row:0,a=s?s.end.row:e.getLength()-1;if(n)var c=function(e){var i=o.row;if(!u(i,o.column,e)){for(i--;i>=l;i--)if(u(i,Number.MAX_VALUE,e))return;if(0!=t.wrap)for(i=a,l=o.row;i>=l;i--)if(u(i,Number.MAX_VALUE,e))return}};else var c=function(e){var i=o.row;if(!u(i,o.column,e)){for(i+=1;i<=a;i++)if(u(i,0,e))return;if(0!=t.wrap)for(i=l,a=o.row;i<=a;i++)if(u(i,0,e))return}};if(t.$isMultiLine)var h=i.length,u=function(t,r,s){var o=n?t-h+1:t;if(!(o<0)){var l=e.getLine(o),a=l.search(i[0]);if(!(!n&&a<r||-1===a)){for(var c=1;c<h;c++)if(-1==(l=e.getLine(o+c)).search(i[c]))return;var u=l.match(i[h-1])[0].length;if(!(n&&u>r))return!!s(o,a,o+h-1,u)||void 0}}};else if(n)var u=function(t,n,r){var s,o=e.getLine(t),l=[],a=0;for(i.lastIndex=0;s=i.exec(o);){var c=s[0].length;if(a=s.index,!c){if(a>=o.length)break;i.lastIndex=a+=1}if(s.index+c>n)break;l.push(s.index,c)}for(var h=l.length-1;h>=0;h-=2){var u=l[h-1],c=l[h];if(r(t,u,t,u+c))return!0}};else var u=function(t,n,r){var s,o,l=e.getLine(t);for(i.lastIndex=n;o=i.exec(l);){var a=o[0].length;if(s=o.index,r(t,s,t,s+a))return!0;if(!a&&(i.lastIndex=s+=1,s>=l.length))return!1}};return{forEach:c}}}).call(o.prototype),t.Search=o}),define("skylark-ace/keyboard/hash_handler",["require","exports","module","../lib/keys","../lib/useragent"],function(e,t,i){var n=e("../lib/keys"),r=e("../lib/useragent"),s=n.KEY_MODS;function o(e,t){this.platform=t||(r.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function l(e,t){o.call(this,e,t),this.$singleCommand=!1}l.prototype=o.prototype,function(){function e(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var i=e&&("string"==typeof e?e:e.name);e=this.commands[i],t||delete this.commands[i];var n=this.commandKeyBinding;for(var r in n){var s=n[r];if(s==e)delete n[r];else if(Array.isArray(s)){var o=s.indexOf(e);-1!=o&&(s.splice(o,1),1==s.length&&(n[r]=s[0]))}}},this.bindKey=function(e,t,i){if("object"==typeof e&&e&&(void 0==i&&(i=e.position),e=e[this.platform]),e)return"function"==typeof t?this.addCommand({exec:t,bindKey:e,name:t.name||e}):void e.split("|").forEach(function(e){var n="";if(-1!=e.indexOf(" ")){var r=e.split(/\s+/);e=r.pop(),r.forEach(function(e){var t=this.parseKeys(e),i=s[t.hashId]+t.key;n+=(n?" ":"")+i,this._addCommandToBinding(n,"chainKeys")},this),n+=" "}var o=this.parseKeys(e),l=s[o.hashId]+o.key;this._addCommandToBinding(n+l,t,i)},this)},this._addCommandToBinding=function(t,i,n){var r,s=this.commandKeyBinding;if(i)if(!s[t]||this.$singleCommand)s[t]=i;else{Array.isArray(s[t])?-1!=(r=s[t].indexOf(i))&&s[t].splice(r,1):s[t]=[s[t]],"number"!=typeof n&&(n=e(i));var o=s[t];for(r=0;r<o.length;r++){var l=o[r],a=e(l);if(a>n)break}o.splice(r,0,i)}else delete s[t]},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var i=e[t];if(i){if("string"==typeof i)return this.bindKey(i,t);"function"==typeof i&&(i={exec:i}),"object"==typeof i&&(i.name||(i.name=t),this.addCommand(i))}},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),i=t.pop(),r=n[i];if(n.FUNCTION_KEYS[r])i=n.FUNCTION_KEYS[r].toLowerCase();else{if(!t.length)return{key:i,hashId:-1};if(1==t.length&&"shift"==t[0])return{key:i.toUpperCase(),hashId:-1}}for(var s=0,o=t.length;o--;){var l=n.KEY_MODS[t[o]];if(null==l)return"undefined"!=typeof console&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=l}return{key:i,hashId:s}},this.findKeyCommand=function(e,t){var i=s[e]+t;return this.commandKeyBinding[i]},this.handleKeyboard=function(e,t,i,n){if(!(n<0)){var r=s[t]+i,o=this.commandKeyBinding[r];return e.$keyChain&&(e.$keyChain+=" "+r,o=this.commandKeyBinding[e.$keyChain]||o),!o||"chainKeys"!=o&&"chainKeys"!=o[o.length-1]?(e.$keyChain&&(t&&4!=t||1!=i.length?(-1==t||n>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-r.length-1)),{command:o}):(e.$keyChain=e.$keyChain||r,{command:"null"})}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=l}),define("skylark-ace/commands/command_manager",["require","exports","module","../lib/oop","../keyboard/hash_handler","../lib/event_emitter"],function(e,t,i){var n=e("../lib/oop"),r=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){r.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};n.inherits(o,r),function(){n.implement(this,s),this.exec=function(e,t,i){if(Array.isArray(e)){for(var n=e.length;n--;)if(this.exec(e[n],t,i))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(0!=this.$checkCommandState&&e.isAvailable&&!e.isAvailable(t))return!1;var r={editor:t,command:e,args:i};return r.returnValue=this._emit("exec",r),this._signal("afterExec",r),!1!==r.returnValue},this.toggleRecording=function(e){if(!this.$inReplay)return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}}},this.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define("skylark-ace/commands/default_commands",["require","exports","module","../lib/lang","../config","../range"],function(e,t,i){var n=e("../lib/lang"),r=e("../config"),s=e("../range").Range;function o(e,t){return{win:e,mac:t}}t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){r.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){r.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){r.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){"number"!=typeof t&&(t=parseInt(prompt("Enter line number:"),10)),isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:o("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",bindKey:o("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",exec:function(e){},readOnly:!0},{name:"cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),i=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",i),i.isEmpty()||e.session.remove(i),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",exec:function(e,t){e.insert(n.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",bindKey:o(null,null),exec:function(e){for(var t=e.selection.isBackwards(),i=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),r=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(i.row).length,l=e.session.doc.getTextRange(e.selection.getRange()),a=l.replace(/\n\s*/," ").length,c=e.session.doc.getLine(i.row),h=i.row+1;h<=r.row+1;h++){var u=n.stringTrimLeft(n.stringTrimRight(e.session.doc.getLine(h)));0!==u.length&&(u=" "+u),c+=u}r.row+1<e.session.doc.getLength()-1&&(c+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new s(i.row,0,r.row+2,0),c),a>0?(e.selection.moveCursorTo(i.row,i.column),e.selection.selectTo(i.row,i.column+a)):(o=e.session.doc.getLine(i.row).length>o?o+1:o,e.selection.moveCursorTo(i.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,i=e.session.doc.getLine(t).length,n=e.selection.rangeList.ranges,r=[];n.length<1&&(n=[e.selection.getRange()]);for(var o=0;o<n.length;o++)o==n.length-1&&(n[o].end.row===t&&n[o].end.column===i||r.push(new s(n[o].end.row,n[o].end.column,t,i))),0===o?0===n[o].start.row&&0===n[o].start.column||r.push(new s(0,0,n[o].start.row,n[o].start.column)):r.push(new s(n[o-1].end.row,n[o-1].end.column,n[o].start.row,n[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var o=0;o<r.length;o++)e.selection.addRange(r[o],!1)},readOnly:!0,scrollIntoView:"none"}]}),define("skylark-ace/clipboard",["require","exports","module"],function(e,t,i){i.exports={lineMode:!1}}),define("skylark-ace/editor",["require","exports","module","./lib/fixoldbrowsers","./lib/oop","./lib/dom","./lib/lang","./lib/useragent","./keyboard/textinput","./mouse/mouse_handler","./mouse/fold_handler","./keyboard/keybinding","./edit_session","./search","./range","./lib/event_emitter","./commands/command_manager","./commands/default_commands","./config","./token_iterator","./clipboard"],function(e,t,i){e("./lib/fixoldbrowsers");var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./lib/lang"),o=e("./lib/useragent"),l=e("./keyboard/textinput").TextInput,a=e("./mouse/mouse_handler").MouseHandler,c=e("./mouse/fold_handler").FoldHandler,h=e("./keyboard/keybinding").KeyBinding,u=e("./edit_session").EditSession,d=e("./search").Search,f=e("./range").Range,g=e("./lib/event_emitter").EventEmitter,p=e("./commands/command_manager").CommandManager,m=e("./commands/default_commands").commands,v=e("./config"),y=e("./token_iterator").TokenIterator,w=e("./clipboard"),b=function(e,t,i){var n=e.getContainerElement();this.container=n,this.renderer=e,this.id="editor"+ ++b.$uid,this.commands=new p(o.isMac?"mac":"win",m),"object"==typeof document&&(this.textInput=new l(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new a(this),new c(this)),this.keyBinding=new h(this),this.$search=(new d).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||i&&i.session||new u("")),v.resetOptions(this),i&&this.setOptions(i),v._signal("editor",this)};b.$uid=0,function(){n.implement(this,g),this.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this,!0)),this.on("change",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp=this.session.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop},this.curOp.selectionBefore=this.selection.toJSON()},this.endOperation=function(e){if(this.curOp){if(e&&!1===e.returnValue)return this.curOp=null;if(1==e&&this.curOp.command&&"mouse"==this.curOp.command.name)return;if(this._signal("beforeEndOperation"),!this.curOp)return;var t=this.curOp.command,i=t&&t.scrollIntoView;if(i){switch(i){case"center-animate":i="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var n=this.selection.getRange(),r=this.renderer.layerConfig;(n.start.row>=r.lastRow||n.end.row<=r.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==i&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,i=this.$mergeableCommands,n=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var r=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),n=n&&this.mergeNextCommand&&(!/\s/.test(r)||/\s/.test(t.args)),this.mergeNextCommand=!0}else n=n&&-1!==i.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(n=!1),n?this.session.mergeUndoDeltas=!0:-1!==i.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},this.setKeyboardHandler=function(e,t){if(e&&"string"==typeof e&&"ace"!=e){this.$keybindingId=e;var i=this;v.loadModule(["keybinding",e],function(n){i.$keybindingId==e&&i.keyBinding.setKeyboardHandler(n&&n.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange);var i=this.session.getSelection();i.off("changeCursor",this.$onCursorChange),i.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&e.bgTokenizer&&e.bgTokenizer.scheduleStart()}},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||r.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){if(this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null),!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(t&&t.bgTokenizer){var i=t.findMatchingBracket(e.getCursorPosition());if(i)var n=new f(i.row,i.column,i.row,i.column+1);else if(t.$mode.getMatching)var n=t.$mode.getMatching(e.session);n&&(t.$bracketHighlight=t.addMarker(n,"ace_bracket","text"))}},50)}},this.$highlightTags=function(){if(!this.$highlightTagPending){var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(t&&t.bgTokenizer){var i=e.getCursorPosition(),n=new y(e.session,i.row,i.column),r=n.getCurrentToken();if(!r||!/\b(?:tag-open|tag-name)/.test(r.type))return t.removeMarker(t.$tagHighlight),void(t.$tagHighlight=null);if(-1==r.type.indexOf("tag-open")||(r=n.stepForward())){var s=r.value,o=0,l=n.stepBackward();if("<"==l.value)do{l=r,(r=n.stepForward())&&r.value===s&&-1!==r.type.indexOf("tag-name")&&("<"===l.value?o++:"</"===l.value&&o--)}while(r&&o>=0);else{do{r=l,l=n.stepBackward(),r&&r.value===s&&-1!==r.type.indexOf("tag-name")&&("<"===l.value?o++:"</"===l.value&&o--)}while(l&&o<=0);n.stepForward()}if(!r)return t.removeMarker(t.$tagHighlight),void(t.$tagHighlight=null);var a=n.getCurrentTokenRow(),c=n.getCurrentTokenColumn(),h=new f(a,c,a,c+r.value.length),u=t.$backMarkers[t.$tagHighlight];t.$tagHighlight&&void 0!=u&&0!==h.compareRange(u.range)&&(t.removeMarker(t.$tagHighlight),t.$tagHighlight=null),t.$tagHighlight||(t.$tagHighlight=t.addMarker(h,"ace_bracket","text"))}}},50)}},this.focus=function(){var e=this;setTimeout(function(){e.isFocused()||e.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},this.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(e){var t=this.session.$useWrapMode,i=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,i,t),this._signal("change",e),this.$cursorChange(),this.$updateHighlightActiveLine()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$highlightBrackets(),this.$highlightTags(),this.$updateHighlightActiveLine(),this._signal("changeSelection")},this.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),!this.renderer.$maxLines||1!==this.session.getLength()||this.renderer.$minLines>1||(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var i=new f(e.row,e.column,e.row,1/0);i.id=t.addMarker(i,"ace_active-line","screenLine"),t.$highlightLineMarker=i}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;if(t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var i=this.selection.getRange(),n=this.getSelectionStyle();t.$selectionMarker=t.addMarker(i,"ace_selection",n)}var r=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(r),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!t.isEmpty()&&!t.isMultiLine()){var i=t.start.column,n=t.end.column,r=e.getLine(t.start.row),s=r.substring(i,n);if(!(s.length>5e3)&&/[\w\d]/.test(s)){var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),l=r.substring(i-1,n+1);if(o.test(l))return o}}},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),i=!1;if(!e&&this.$copyWithEmptySelection){i=!0;for(var n=this.selection.getAllRanges(),r=0;r<n.length;r++){var s=n[r];r&&n[r-1].start.row==s.start.row||(e+=this.session.getLine(s.start.row)+t)}}var o={text:e};return this._signal("copy",o),w.lineMode=i?o.text:"",o.text},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e,t){var i={text:e,event:t};this.commands.exec("paste",this,i)},this.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var t=e.text,i=t==w.lineMode,n=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)i?n.insert({row:this.selection.lead.row,column:0},t):this.insert(t);else if(i)this.selection.rangeList.ranges.forEach(function(e){n.insert({row:e.start.row,column:0},t)});else{var r=t.split(/\r\n|\r|\n/),s=this.selection.rangeList.ranges;if(r.length>s.length||r.length<2||!r[1])return this.commands.exec("insertstring",this,t);for(var o=s.length;o--;){var l=s[o];l.isEmpty()||n.remove(l),n.insert(l.start,r[o])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var i=this.session,n=i.getMode(),r=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=n.transformAction(i.getState(r.row),"insertion",this,i,e);s&&(e!==s.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),e=s.text)}if("\t"==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var o=new f.fromPoints(r,r);o.end.column+=e.length,this.session.remove(o)}}else{var o=this.getSelectionRange();r=this.session.remove(o),this.clearSelection()}if("\n"==e||"\r\n"==e){var l=i.getLine(r.row);if(r.column>l.search(/\S|$/)){var a=l.substr(r.column).search(/\S|$/);i.doc.removeInLine(r.row,r.column,r.column+a)}}this.clearSelection();var c=r.column,h=i.getState(r.row),l=i.getLine(r.row),u=n.checkOutdent(h,l,e);i.insert(r,e);if(s&&s.selection&&(2==s.selection.length?this.selection.setSelectionRange(new f(r.row,c+s.selection[0],r.row,c+s.selection[1])):this.selection.setSelectionRange(new f(r.row+s.selection[0],s.selection[1],r.row+s.selection[2],s.selection[3]))),i.getDocument().isNewLine(e)){var d=n.getNextLineIndent(h,l.slice(0,r.column),i.getTabString());i.insert({row:r.row+1,column:0},d)}u&&n.autoOutdent(h,i,r.row)},this.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var i=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(i):i(),this.endOperation()},this.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var i=this.selection.getRange();i.start.column-=t.extendLeft,i.end.column+=t.extendRight,this.selection.setRange(i),e||i.isEmpty()||this.remove()}if(!e&&this.selection.isEmpty()||this.insert(e,!0),t.restoreStart||t.restoreEnd){var i=this.selection.getRange();i.start.column-=t.restoreStart,i.end.column-=t.restoreEnd,this.selection.setRange(i)}},this.onCommandKey=function(e,t,i){this.keyBinding.onCommandKey(e,t,i)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var i=this.session,n=i.getState(t.start.row),r=i.getMode().transformAction(n,"deletion",this,i,t);if(0===t.end.column){var s=i.getTextRange(t);if("\n"==s[s.length-1]){var o=i.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}r&&(t=r)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(this.selection.isEmpty()){var e=this.getCursorPosition(),t=e.column;if(0!==t){var i,n,r=this.session.getLine(e.row);t<r.length?(i=r.charAt(t)+r.charAt(t-1),n=new f(e.row,t-1,e.row,t+1)):(i=r.charAt(t-1)+r.charAt(t-2),n=new f(e.row,t-2,e.row,t)),this.session.replace(n,i),this.session.selection.moveToPosition(n.end)}}},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(!(t.start.row<t.end.row)){if(t.start.column<t.end.column){var i=e.getTextRange(t);if(!/^\s+$/.test(i)){var n=this.$getSelectedRows();return void e.indentRows(n.first,n.last,"\t")}}var r=e.getLine(t.start.row),o=t.start,l=e.getTabSize(),a=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var c=l-a%l,h=s.stringRepeat(" ",c);else{for(var c=a%l;" "==r[t.start.column-1]&&c;)t.start.column--,c--;this.selection.setSelectionRange(t),h="\t"}return this.insert(h)}var n=this.$getSelectedRows();e.indentRows(n.first,n.last,"\t")},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last,"\t")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){for(var e=this.$getSelectedRows(),t=this.session,i=[],n=e.first;n<=e.last;n++)i.push(t.getLine(n));i.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0});for(var r=new f(0,0,0,0),n=e.first;n<=e.last;n++){var s=t.getLine(n);r.start.row=n,r.end.row=n,r.end.column=s.length,t.replace(r,i[n-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),i=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,i,e)},this.getNumberAt=function(e,t){var i=/[\-]?[0-9]+(?:\.[0-9]+)?/g;i.lastIndex=0;for(var n=this.session.getLine(e);i.lastIndex<t;){var r=i.exec(n);if(r.index<=t&&r.index+r[0].length>=t){var s={value:r[0],start:r.index,end:r.index+r[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,i=this.selection.getCursor().column,n=new f(t,i-1,t,i),r=this.session.getTextRange(n);if(!isNaN(parseFloat(r))&&isFinite(r)){var s=this.getNumberAt(t,i);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,l=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,l),o!==s.end&&i<o?e*=Math.pow(10,s.end-i-1):e*=Math.pow(10,s.end-i),a+=e;var c=(a/=Math.pow(10,l)).toFixed(l),h=new f(t,s.start,t,s.end);this.session.replace(h,c),this.moveCursorTo(t,Math.max(s.start+1,i+c.length-s.value.length))}}else this.toggleWord()},this.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],this.toggleWord=function(){var e=this.selection.getCursor().row,t=this.selection.getCursor().column;this.selection.selectWord();var i=this.getSelectedText(),n=this.selection.getWordRange().start.column,r=i.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=t-n-1;o<0&&(o=0);var l=0,a=0,c=this;i.match(/[A-Za-z0-9_]+/)&&r.forEach(function(t,r){a=l+t.length,o>=l&&o<=a&&(i=t,c.selection.clearSelection(),c.moveCursorTo(e,l+n),c.selection.selectTo(e,a+n)),l=a});for(var h,u=this.$toggleWordPairs,d=0;d<u.length;d++)for(var f=u[d],g=0;g<=1;g++){var p=+!g,m=i.match(new RegExp("^\\s?_?("+s.escapeRegExp(f[g])+")\\s?$","i"));if(m){var v=i.match(new RegExp("([_]|^|\\s)("+s.escapeRegExp(m[1])+")($|\\s)","g"));v&&(h=i.replace(new RegExp(s.escapeRegExp(f[g]),"i"),function(e){var t=f[p];return e.toUpperCase()==e?t=t.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(t=t.substr(0,0)+f[p].charAt(0).toUpperCase()+t.substr(1)),t}),this.insert(h),h="")}}},this.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,i=e.getRange(),n=e.isBackwards();if(i.isEmpty()){var r=i.start.row;t.duplicateLines(r,r)}else{var s=n?i.start:i.end,o=t.insert(s,t.getTextRange(i),!1);i.start=s,i.end=o,e.setSelectionRange(i,n)}},this.moveLinesDown=function(){this.$moveLines(1,!1)},this.moveLinesUp=function(){this.$moveLines(-1,!1)},this.moveText=function(e,t,i){return this.session.moveText(e,t,i)},this.copyLinesUp=function(){this.$moveLines(-1,!0)},this.copyLinesDown=function(){this.$moveLines(1,!0)},this.$moveLines=function(e,t){var i,n,r=this.selection;if(!r.inMultiSelectMode||this.inVirtualSelectionMode){var s=r.toOrientedRange();i=this.$getSelectedRows(s),n=this.session.$moveLines(i.first,i.last,t?0:e),t&&-1==e&&(n=0),s.moveBy(n,0),r.fromOrientedRange(s)}else{var o=r.rangeList.ranges;r.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var l=0,a=0,c=o.length,h=0;h<c;h++){var u=h;o[h].moveBy(l,0);for(var d=(i=this.$getSelectedRows(o[h])).first,f=i.last;++h<c;){a&&o[h].moveBy(a,0);var g=this.$getSelectedRows(o[h]);if(t&&g.first!=f)break;if(!t&&g.first>f+1)break;f=g.last}for(h--,l=this.session.$moveLines(d,f,t?0:e),t&&-1==e&&(u=h+1);u<=h;)o[u].moveBy(l,0),u++;t||(l=0),a+=l}r.fromOrientedRange(r.ranges[0]),r.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(e)},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var i=this.renderer,n=this.renderer.layerConfig,r=e*Math.floor(n.height/n.lineHeight);!0===t?this.selection.$moveSelection(function(){this.moveCursorBy(r,0)}):!1===t&&(this.selection.moveCursorBy(r,0),this.selection.clearSelection());var s=i.scrollTop;i.scrollBy(0,r*n.lineHeight),null!=t&&i.scrollCursorIntoView(null,.5),i.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,i,n){this.renderer.scrollToLine(e,t,i,n)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.selection.selectAll()},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var i=this.getCursorPosition(),n=new y(this.session,i.row,i.column),r=n.getCurrentToken(),s=r||n.stepForward();if(s){var o,l,a=!1,c={},h=i.column-s.start,u={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g)){for(;h<s.value.length&&!a;h++)if(u[s.value[h]])switch(l=u[s.value[h]]+"."+s.type.replace("rparen","lparen"),isNaN(c[l])&&(c[l]=0),s.value[h]){case"(":case"[":case"{":c[l]++;break;case")":case"]":case"}":c[l]--,-1===c[l]&&(o="bracket",a=!0)}}else-1!==s.type.indexOf("tag-name")&&(isNaN(c[s.value])&&(c[s.value]=0),"<"===r.value?c[s.value]++:"</"===r.value&&c[s.value]--,-1===c[s.value]&&(o="tag",a=!0));a||(r=s,s=n.stepForward(),h=0)}while(s&&!a);if(o){var d,g;if("bracket"===o)(d=this.session.getBracketRange(i))||(d=new f(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+h-1,n.getCurrentTokenRow(),n.getCurrentTokenColumn()+h-1),g=d.start,(t||g.row===i.row&&Math.abs(g.column-i.column)<2)&&(d=this.session.getBracketRange(g)));else if("tag"===o){if(!s||-1===s.type.indexOf("tag-name"))return;var p=s.value;if(0===(d=new f(n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2,n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2)).compare(i.row,i.column)){a=!1;do{s=r,(r=n.stepBackward())&&(-1!==r.type.indexOf("tag-close")&&d.setEnd(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+1),s.value===p&&-1!==s.type.indexOf("tag-name")&&("<"===r.value?c[p]++:"</"===r.value&&c[p]--,0===c[p]&&(a=!0)))}while(r&&!a)}s&&s.type.indexOf("tag-name")&&(g=d.start).row==i.row&&Math.abs(g.column-i.column)<2&&(g=d.end)}(g=d&&d.cursor||g)&&(e?d&&t?this.selection.setRange(d):d&&d.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(g.row,g.column):this.selection.moveTo(g.row,g.column))}}},this.gotoLine=function(e,t,i){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,i)},this.navigateTo=function(e,t){this.selection.moveTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},this.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(e,t){t&&this.$search.set(t);var i=this.$search.find(this.session),n=0;return i?(this.$tryReplace(i,e)&&(n=1),this.selection.setSelectionRange(i),this.renderer.scrollSelectionIntoView(i.start,i.end),n):n},this.replaceAll=function(e,t){t&&this.$search.set(t);var i=this.$search.findAll(this.session),n=0;if(!i.length)return n;var r=this.getSelectionRange();this.selection.moveTo(0,0);for(var s=i.length-1;s>=0;--s)this.$tryReplace(i[s],e)&&n++;return this.selection.setSelectionRange(r),n},this.$tryReplace=function(e,t){var i=this.session.getTextRange(e);return null!==(t=this.$search.replace(i,t))?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,i){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&n.mixin(t,e);var r=this.selection.getRange();null==t.needle&&((e=this.session.getTextRange(r)||this.$search.$options.needle)||(r=this.session.getWordRange(r.start.row,r.start.column),e=this.session.getTextRange(r)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:r});var s=this.$search.find(this.session);return t.preventScroll?s:s?(this.revealRange(s,i),s):(t.backwards?r.start=r.end:r.end=r.start,void this.selection.setRange(r))},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var i=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==t&&this.renderer.animateScrolling(i)},this.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy()},this.setAutoScrollEditorIntoView=function(e){if(e){var t,i=this,n=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var r=this.$scrollAnchor;r.style.cssText="position:absolute",this.container.insertBefore(r,this.container.firstChild);var s=this.on("changeSelection",function(){n=!0}),o=this.renderer.on("beforeRender",function(){n&&(t=i.renderer.container.getBoundingClientRect())}),l=this.renderer.on("afterRender",function(){if(n&&t&&(i.isFocused()||i.searchBox&&i.searchBox.isFocused())){var e=i.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,l=s.top-o.offset;null!=(n=s.top>=0&&l+t.top<0||!(s.top<o.height&&s.top+t.top+o.lineHeight>window.innerHeight)&&null)&&(r.style.top=l+"px",r.style.left=s.left+"px",r.style.height=o.lineHeight+"px",r.scrollIntoView(n)),n=t=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",l),this.renderer.off("beforeRender",o))}}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&"wide"!=e,r.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e)))}}.call(b.prototype),v.defineOptions(b.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?C.attach(this):C.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?C.attach(this):C.detach(this)}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var C={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"·":""))+""},getWidth:function(e,t,i){return Math.max(t.toString().length,(i.lastRow+1).toString().length,2)*i.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=b}),define("skylark-ace/undomanager",["require","exports","module","./range"],function(e,t,i){var n=function(){this.$maxRev=0,this.$fromUndo=!1,this.reset()};(function(){this.addSession=function(e){this.$session=e},this.add=function(e,t,i){this.$fromUndo||e!=this.$lastDelta&&(!1!==t&&this.lastDeltas||(this.lastDeltas=[],this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev),"remove"!=e.action&&"insert"!=e.action||(this.$lastDelta=e),this.lastDeltas.push(e))},this.addSelection=function(e,t){this.selections.push({value:e,rev:t||this.$rev})},this.startNewGroup=function(){return this.lastDeltas=null,this.$rev},this.markIgnored=function(e,t){null==t&&(t=this.$rev+1);for(var i=this.$undoStack,n=i.length;n--;){var r=i[n][0];if(r.id<=e)break;r.id<t&&(r.ignore=!0)}this.lastDeltas=null},this.getSelection=function(e,t){for(var i=this.selections,n=i.length;n--;){var r=i[n];if(r.rev<e)return t&&(r=i[n+1]),r}},this.getRevision=function(){return this.$rev},this.getDeltas=function(e,t){null==t&&(t=this.$rev+1);for(var i=this.$undoStack,n=null,r=0,s=i.length;s--;){var o=i[s][0];if(o.id<t&&!n&&(n=s+1),o.id<=e){r=s+1;break}}return i.slice(r,n)},this.getChangedRanges=function(e,t){null==t&&(t=this.$rev+1)},this.getChangedLines=function(e,t){null==t&&(t=this.$rev+1)},this.undo=function(e,t){this.lastDeltas=null;var i=this.$undoStack;if(function(e,t){for(var i=t;i--;){var n=e[i];if(n&&!n[0].ignore){for(;i<t-1;){var r=h(e[i],e[i+1]);e[i]=r[0],e[i+1]=r[1],i++}return!0}}}(i,i.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var n=i.pop(),r=null;return n&&n.length&&(r=e.undoChanges(n,t),this.$redoStack.push(n),this.$syncRev()),this.$fromUndo=!1,r}},this.redo=function(e,t){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var i=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);!function(e,t){for(var i=0;i<t.length;i++)for(var n=t[i],r=0;r<n.length;r++)p(e,n[r])}(this.$redoStack,i),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var n=this.$redoStack.pop(),r=null;return n&&(r=e.redoChanges(n,t),this.$undoStack.push(n),this.$syncRev()),this.$fromUndo=!1,r},this.$syncRev=function(){var e=this.$undoStack,t=e[e.length-1],i=t&&t[0].id||0;this.$redoStackBaseRev=i,this.$rev=i},this.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},this.canUndo=function(){return this.$undoStack.length>0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},this.isAtBookmark=function(){return this.$rev===this.mark},this.toJSON=function(){},this.fromJSON=function(){},this.hasUndo=this.canUndo,this.hasRedo=this.canRedo,this.isClean=this.isAtBookmark,this.markClean=this.bookmark,this.$prettyPrint=function(e){return e?l(e):l(this.$undoStack)+"\n---\n"+l(this.$redoStack)}}).call(n.prototype);var r=e("./range").Range,s=r.comparePoints;r.comparePoints;function o(e){return{row:e.row,column:e.column}}function l(e){if(e=e||this,Array.isArray(e))return e.map(l).join("\n");var t="";return e.action?(t="insert"==e.action?"+":"-",t+="["+e.lines+"]"):e.value&&(t=Array.isArray(e.value)?e.value.map(a).join("\n"):a(e.value)),e.start&&(t+=a(e)),(e.id||e.rev)&&(t+="\t("+(e.id||e.rev)+")"),t}function a(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function c(e,t){var i="insert"==e.action,n="insert"==t.action;if(i&&n)if(s(t.start,e.end)>=0)d(t,e,-1);else{if(!(s(t.start,e.start)<=0))return null;d(e,t,1)}else if(i&&!n)if(s(t.start,e.end)>=0)d(t,e,-1);else{if(!(s(t.end,e.start)<=0))return null;d(e,t,-1)}else if(!i&&n)if(s(t.start,e.start)>=0)d(t,e,1);else{if(!(s(t.start,e.start)<=0))return null;d(e,t,1)}else if(!i&&!n)if(s(t.start,e.start)>=0)d(t,e,1);else{if(!(s(t.end,e.start)<=0))return null;d(e,t,-1)}return[t,e]}function h(e,t){for(var i=e.length;i--;)for(var n=0;n<t.length;n++)if(!c(e[i],t[n])){for(;i<e.length;){for(;n--;)c(t[n],e[i]);n=t.length,i++}return[e,t]}return e.selectionBefore=t.selectionBefore=e.selectionAfter=t.selectionAfter=null,[t,e]}function u(e,t){var i="insert"==e.action,n="insert"==t.action;if(i&&n)s(e.start,t.start)<0?d(t,e,1):d(e,t,1);else if(i&&!n)s(e.start,t.end)>=0?d(e,t,-1):s(e.start,t.start)<=0?d(t,e,1):(d(e,r.fromPoints(t.start,e.start),-1),d(t,e,1));else if(!i&&n)s(t.start,e.end)>=0?d(t,e,-1):s(t.start,e.start)<=0?d(e,t,1):(d(t,r.fromPoints(e.start,t.start),-1),d(e,t,1));else if(!i&&!n)if(s(t.start,e.end)>=0)d(t,e,-1);else{var o,l;if(!(s(t.end,e.start)<=0))return s(e.start,t.start)<0&&(o=e,e=g(e,t.start)),s(e.end,t.end)>0&&(l=g(e,t.end)),f(t.end,e.start,e.end,-1),l&&!o&&(e.lines=l.lines,e.start=l.start,e.end=l.end,l=e),[t,o,l].filter(Boolean);d(e,t,-1)}return[t,e]}function d(e,t,i){f(e.start,t.start,t.end,i),f(e.end,t.start,t.end,i)}function f(e,t,i,n){e.row==(1==n?t:i).row&&(e.column+=n*(i.column-t.column)),e.row+=n*(i.row-t.row)}function g(e,t){var i=e.lines,n=e.end;e.end=o(t);var r=e.end.row-e.start.row,s=i.splice(r,i.length),l=r?t.column:t.column-e.start.column;i.push(s[0].substring(0,l)),s[0]=s[0].substr(l);var a={start:o(t),end:n,lines:s,action:e.action};return a}function p(e,t){t=function(e){return{start:o(e.start),end:o(e.end),action:e.action,lines:e.lines.slice()}}(t);for(var i=e.length;i--;){for(var n=e[i],r=0;r<n.length;r++){var s=n[r],l=u(s,t);t=l[0],2!=l.length&&(l[2]?(n.splice(r+1,1,l[1],l[2]),r++):l[1]||(n.splice(r,1),r--))}n.length||e.splice(i,1)}return e}t.UndoManager=n}),define("skylark-ace/layer/lines",["require","exports","module","../lib/dom"],function(e,t,i){var n=e("../lib/dom"),r=function(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0};(function(){this.moveContainer=function(e){n.translate(this.element,0,-e.firstRowScreen*e.lineHeight%this.canvasHeight-e.offset*this.$offsetCoefficient)},this.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},this.computeLineTop=function(e,t,i){var n=t.firstRowScreen*t.lineHeight,r=Math.floor(n/this.canvasHeight),s=i.documentToScreenRow(e,0)*t.lineHeight;return s-r*this.canvasHeight},this.computeLineHeight=function(e,t,i){return t.lineHeight*i.getRowLength(e)},this.getLength=function(){return this.cells.length},this.get=function(e){return this.cells[e]},this.shift=function(){this.$cacheCell(this.cells.shift())},this.pop=function(){this.$cacheCell(this.cells.pop())},this.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var t=n.createFragment(this.element),i=0;i<e.length;i++)t.appendChild(e[i].element);this.element.appendChild(t)}else this.cells.push(e),this.element.appendChild(e.element)},this.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var t=n.createFragment(this.element),i=0;i<e.length;i++)t.appendChild(e[i].element);this.element.firstChild?this.element.insertBefore(t,this.element.firstChild):this.element.appendChild(t)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},this.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},this.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},this.createCell=function(e,t,i,r){var s=this.cellCache.pop();if(!s){var o=n.createElement("div");r&&r(o),this.element.appendChild(o),s={element:o,text:"",row:e}}return s.row=e,s}}).call(r.prototype),t.Lines=r}),define("skylark-ace/layer/gutter",["require","exports","module","../lib/dom","../lib/oop","../lib/lang","../lib/event_emitter","./lines"],function(e,t,i){var n=e("../lib/dom"),r=e("../lib/oop"),s=e("../lib/lang"),o=e("../lib/event_emitter").EventEmitter,l=e("./lines").Lines,a=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new l(this.element),this.$lines.$offsetCoefficient=1};function c(e){var t=document.createTextNode("");e.appendChild(t);var i=n.createElement("span");return e.appendChild(i),e}(function(){r.implement(this,o),this.setSession=function(e){this.session&&this.session.removeEventListener("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var i=e[t],n=i.row,r=this.$annotations[n];r||(r=this.$annotations[n]={text:[]});var o=i.text;o=o?s.escapeHTML(o):i.html||"",-1===r.text.indexOf(o)&&r.text.push(o);var l=i.type;"error"==l?r.className=" ace_error":"warning"==l&&" ace_error"!=r.className?r.className=" ace_warning":"info"!=l||r.className||(r.className=" ace_info")}},this.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.start.row,i=e.end.row-t;if(0===i);else if("remove"==e.action)this.$annotations.splice(t,i+1,null);else{var n=new Array(i+1);n.unshift(t,1),this.$annotations.splice.apply(this.$annotations,n)}}},this.update=function(e){this.config=e;var t=this.session,i=e.firstRow,n=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1);this.oldLastRow=n,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var r=t.getNextFoldLine(i),s=r?r.start.row:1/0,o=null,l=-1,a=i;;){if(a>s&&(a=r.end.row+1,r=t.getNextFoldLine(a,r),s=r?r.start.row:1/0),a>n){for(;this.$lines.getLength()>l+1;)this.$lines.pop();break}(o=this.$lines.get(++l))?o.row=a:(o=this.$lines.createCell(a,e,this.session,c),this.$lines.push(o)),this.$renderCell(o,e,r,a),a++}this._signal("afterRender"),this.$updateGutterWidth(e)},this.$updateGutterWidth=function(e){var t=this.session,i=t.gutterRenderer||this.$renderer,n=t.$firstLineNumber,r=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||t.$useWrapMode)&&(r=t.getLength()+n-1);var s=i?i.getWidth(t,r,e):r.toString().length*e.characterWidth,o=this.$padding||this.$computePadding();(s+=o.left+o.right)===this.gutterWidth||isNaN(s)||(this.gutterWidth=s,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",s))},this.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},this.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var i=0;i<t.length;i++){var n=t[i];if(n.row>=this.$cursorRow){if(n.row>this.$cursorRow){var r=this.session.getFoldLine(this.$cursorRow);if(!(i>0&&r&&r.start.row==t[i-1].row))break;n=t[i-1]}n.element.className="ace_gutter-active-line "+n.element.className,this.$cursorCell=n;break}}}}},this.scrollLines=function(e){var t=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var i=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),n=this.oldLastRow;if(this.oldLastRow=i,!t||n<e.firstRow)return this.update(e);if(i<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(n>i)for(var r=this.session.getFoldedRowCount(i+1,n);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,t.firstRow-1)),i>n&&this.$lines.push(this.$renderLines(e,n+1,i)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},this.$renderLines=function(e,t,i){for(var n=[],r=t,s=this.session.getNextFoldLine(r),o=s?s.start.row:1/0;r>o&&(r=s.end.row+1,s=this.session.getNextFoldLine(r,s),o=s?s.start.row:1/0),!(r>i);){var l=this.$lines.createCell(r,e,this.session,c);this.$renderCell(l,e,s,r),n.push(l),r++}return n},this.$renderCell=function(e,t,i,r){var s=e.element,o=this.session,l=s.childNodes[0],a=s.childNodes[1],c=o.$firstLineNumber,h=o.$breakpoints,u=o.$decorations,d=o.gutterRenderer||this.$renderer,f=this.$showFoldWidgets&&o.foldWidgets,g=i?i.start.row:Number.MAX_VALUE,p="ace_gutter-cell ";if(this.$highlightGutterLine&&(r==this.$cursorRow||i&&r<this.$cursorRow&&r>=g&&this.$cursorRow<=i.end.row)&&(p+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),h[r]&&(p+=h[r]),u[r]&&(p+=u[r]),this.$annotations[r]&&(p+=this.$annotations[r].className),s.className!=p&&(s.className=p),f){var m=f[r];null==m&&(m=f[r]=o.getFoldWidget(r))}if(m){var p="ace_fold-widget ace_"+m;"start"==m&&r==g&&r<i.end.row?p+=" ace_closed":p+=" ace_open",a.className!=p&&(a.className=p);var v=t.lineHeight+"px";n.setStyle(a.style,"height",v),n.setStyle(a.style,"display","inline-block")}else a&&n.setStyle(a.style,"display","none");var y=(d?d.getText(o,r):r+c).toString();return y!==l.data&&(l.data=y),n.setStyle(e.element.style,"height",this.$lines.computeLineHeight(r,t,o)+"px"),n.setStyle(e.element.style,"top",this.$lines.computeLineTop(r,t,o)+"px"),e.text=y,e},this.$fixedWidth=!1,this.$highlightGutterLine=!0,this.$renderer="",this.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},this.$showLineNumbers=!0,this.$renderer="",this.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},this.getShowLineNumbers=function(){return this.$showLineNumbers},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?n.addCssClass(this.element,"ace_folding-enabled"):n.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=n.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),i=this.element.getBoundingClientRect();return e.x<t.left+i.left?"markers":this.$showFoldWidgets&&e.x>i.right-t.right?"foldWidgets":void 0}}).call(a.prototype),t.Gutter=a}),define("skylark-ace/layer/marker",["require","exports","module","../range","../lib/dom"],function(e,t,i){var n=e("../range").Range,r=e("../lib/dom"),s=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.elt=function(e,t){var i=-1!=this.i&&this.element.childNodes[this.i];i?this.i++:(i=document.createElement("div"),this.element.appendChild(i),this.i=-1),i.style.cssText=t,i.className=e},this.update=function(e){if(e){var t;for(var i in this.config=e,this.i=0,this.markers){var n=this.markers[i];if(n.range){var r=n.range.clipRows(e.firstRow,e.lastRow);if(!r.isEmpty())if(r=r.toScreenRange(this.session),n.renderer){var s=this.$getTop(r.start.row,e),o=this.$padding+r.start.column*e.characterWidth;n.renderer(t,r,o,s,e)}else"fullLine"==n.type?this.drawFullLineMarker(t,r,n.clazz,e):"screenLine"==n.type?this.drawScreenLineMarker(t,r,n.clazz,e):r.isMultiLine()?"text"==n.type?this.drawTextMarker(t,r,n.clazz,e):this.drawMultiLineMarker(t,r,n.clazz,e):this.drawSingleLineMarker(t,r,n.clazz+" ace_start ace_br15",e)}else n.update(t,this,this.session,e)}if(-1!=this.i)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(e,t,i,r,s){for(var o=this.session,l=t.start.row,a=t.end.row,c=l,h=0,u=0,d=o.getScreenLastRowColumn(c),f=new n(c,t.start.column,c,u);c<=a;c++)f.start.row=f.end.row=c,f.start.column=c==l?t.start.column:o.getRowWrapIndent(c),f.end.column=d,h=u,u=d,d=c+1<a?o.getScreenLastRowColumn(c+1):c==a?0:t.end.column,this.drawSingleLineMarker(e,f,i+(c==l?" ace_start":"")+" ace_br"+((c==l||c==l+1&&t.start.column?1:0)|(h<u?2:0)|(u>d?4:0)|(c==a?8:0)),r,c==a?0:1,s)},this.drawMultiLineMarker=function(e,t,i,n,r){var s=this.$padding,o=n.lineHeight,l=this.$getTop(t.start.row,n),a=s+t.start.column*n.characterWidth;if(r=r||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var c=t.clone();c.end.row=c.start.row,c.end.column=this.session.getLine(c.start.row).length,this.drawBidiSingleLineMarker(e,c,i+" ace_br1 ace_start",n,null,r)}else this.elt(i+" ace_br1 ace_start","height:"+o+"px;right:0;top:"+l+"px;left:"+a+"px;"+(r||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var c=t.clone();c.start.row=c.end.row,c.start.column=0,this.drawBidiSingleLineMarker(e,c,i+" ace_br12",n,null,r)}else{l=this.$getTop(t.end.row,n);var h=t.end.column*n.characterWidth;this.elt(i+" ace_br12","height:"+o+"px;width:"+h+"px;top:"+l+"px;left:"+s+"px;"+(r||""))}if(!((o=(t.end.row-t.start.row-1)*n.lineHeight)<=0)){l=this.$getTop(t.start.row+1,n);var u=(t.start.column?1:0)|(t.end.column?0:8);this.elt(i+(u?" ace_br"+u:""),"height:"+o+"px;right:0;top:"+l+"px;left:"+s+"px;"+(r||""))}},this.drawSingleLineMarker=function(e,t,i,n,r,s){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,i,n,r,s);var o=n.lineHeight,l=(t.end.column+(r||0)-t.start.column)*n.characterWidth,a=this.$getTop(t.start.row,n),c=this.$padding+t.start.column*n.characterWidth;this.elt(i,"height:"+o+"px;width:"+l+"px;top:"+a+"px;left:"+c+"px;"+(s||""))},this.drawBidiSingleLineMarker=function(e,t,i,n,r,s){var o=n.lineHeight,l=this.$getTop(t.start.row,n),a=this.$padding,c=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);c.forEach(function(e){this.elt(i,"height:"+o+"px;width:"+e.width+(r||0)+"px;top:"+l+"px;left:"+(a+e.left)+"px;"+(s||""))},this)},this.drawFullLineMarker=function(e,t,i,n,r){var s=this.$getTop(t.start.row,n),o=n.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,n)-s),this.elt(i,"height:"+o+"px;top:"+s+"px;left:0;right:0;"+(r||""))},this.drawScreenLineMarker=function(e,t,i,n,r){var s=this.$getTop(t.start.row,n),o=n.lineHeight;this.elt(i,"height:"+o+"px;top:"+s+"px;left:0;right:0;"+(r||""))}}).call(s.prototype),t.Marker=s}),define("skylark-ace/layer/text",["require","exports","module","../lib/oop","../lib/dom","../lib/lang","./lines","../lib/event_emitter"],function(e,t,i){var n=e("../lib/oop"),r=e("../lib/dom"),s=e("../lib/lang"),o=e("./lines").Lines,l=e("../lib/event_emitter").EventEmitter,a=function(e){this.dom=r,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)};(function(){n.implement(this,l),this.EOF_CHAR="¶",this.EOL_CHAR_LF="¬",this.EOL_CHAR_CRLF="¤",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="—",this.SPACE_CHAR="·",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc,t="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode(),i=t?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=i)return this.EOL_CHAR=i,!0},this.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],i=1;i<e+1;i++)if(this.showInvisibles){var n=this.dom.createElement("span");n.className="ace_invisible ace_invisible_tab",n.textContent=s.stringRepeat(this.TAB_CHAR,i),t.push(n)}else t.push(this.dom.createTextNode(s.stringRepeat(" ",i),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",o="",l="";if(this.showInvisibles){r+=" ace_invisible",o=" ace_invisible_space",l=" ace_invisible_tab";var a=s.stringRepeat(this.SPACE_CHAR,this.tabSize),c=s.stringRepeat(this.TAB_CHAR,this.tabSize)}else var a=s.stringRepeat(" ",this.tabSize),c=a;var n=this.dom.createElement("span");n.className=r+o,n.textContent=a,this.$tabStrings[" "]=n;var n=this.dom.createElement("span");n.className=r+l,n.textContent=c,this.$tabStrings["\t"]=n}},this.updateLines=function(e,t,i){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var n=Math.max(t,e.firstRow),r=Math.min(i,e.lastRow),s=this.element.childNodes,o=0,l=e.firstRow;l<n;l++){var a=this.session.getFoldLine(l);if(a){if(a.containsRow(n)){n=a.start.row;break}l=a.end.row}o++}for(var c=!1,l=n,a=this.session.getNextFoldLine(l),h=a?a.start.row:1/0;l>h&&(l=a.end.row+1,a=this.session.getNextFoldLine(l,a),h=a?a.start.row:1/0),!(l>r);){var u=s[o++];if(u){this.dom.removeChildren(u),this.$renderLine(u,l,l==h&&a);var d=e.lineHeight*this.session.getRowLength(l)+"px";u.style.height!=d&&(c=!0,u.style.height=d)}l++}if(c)for(;o<this.$lines.cells.length;){var f=this.$lines.cells[o++];f.element.style.top=this.$lines.computeLineTop(f.row,e,this.session)+"px"}},this.scrollLines=function(e){var t=this.config;if(this.config=e,this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var i=e.lastRow,n=t?t.lastRow:-1;if(!t||n<e.firstRow)return this.update(e);if(i<t.firstRow)return this.update(e);if(!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,t.firstRow-1)),e.lastRow>t.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow))},this.$renderLinesFragment=function(e,t,i){for(var n=[],s=t,o=this.session.getNextFoldLine(s),l=o?o.start.row:1/0;s>l&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),l=o?o.start.row:1/0),!(s>i);){var a=this.$lines.createCell(s,e,this.session),c=a.element;this.dom.removeChildren(c),r.setStyle(c.style,"height",this.$lines.computeLineHeight(s,e,this.session)+"px"),r.setStyle(c.style,"top",this.$lines.computeLineTop(s,e,this.session)+"px"),this.$renderLine(c,s,s==l&&o),this.$useLineGroups()?c.className="ace_line_group":c.className="ace_line",n.push(a),s++}return n},this.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var t=e.firstRow,i=e.lastRow,n=this.$lines;n.getLength();)n.pop();n.push(this.$renderLinesFragment(e,t,i))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,i,n){for(var o,l=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,a=this.dom.createFragment(this.element),c=0;o=l.exec(n);){var h=o[1],u=o[2],d=o[3],f=o[4],g=o[5];if(this.showInvisibles||!u){var p=c!=o.index?n.slice(c,o.index):"";if(c=o.index+o[0].length,p&&a.appendChild(this.dom.createTextNode(p,this.element)),h){var m=this.session.getScreenTabSize(t+o.index);a.appendChild(this.$tabStrings[m].cloneNode(!0)),t+=m-1}else if(u)if(this.showInvisibles){var v=this.dom.createElement("span");v.className="ace_invisible ace_invisible_space",v.textContent=s.stringRepeat(this.SPACE_CHAR,u.length),a.appendChild(v)}else a.appendChild(this.com.createTextNode(u,this.element));else if(d){var v=this.dom.createElement("span");v.className="ace_invisible ace_invisible_space ace_invalid",v.textContent=s.stringRepeat(this.SPACE_CHAR,d.length),a.appendChild(v)}else if(f){this.showInvisibles&&this.SPACE_CHAR;t+=1;var v=this.dom.createElement("span");v.style.width=2*this.config.characterWidth+"px",v.className=this.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",v.textContent=this.showInvisibles?this.SPACE_CHAR:"",a.appendChild(v)}else if(g){t+=1;var v=r.createElement("span");v.style.width=2*this.config.characterWidth+"px",v.className="ace_cjk",v.textContent=g,a.appendChild(v)}}}if(a.appendChild(this.dom.createTextNode(c?n.slice(c):n,this.element)),this.$textToken[i.type])e.appendChild(a);else{var y="ace_"+i.type.replace(/\./g," ace_"),v=this.dom.createElement("span");"fold"==i.type&&(v.style.width=i.value.length*this.config.characterWidth+"px"),v.className=y,v.appendChild(a),e.appendChild(v)}return t+n.length},this.renderIndentGuide=function(e,t,i){var n=t.search(this.$indentGuideRe);if(n<=0||n>=i)return t;if(" "==t[0]){for(var r=(n-=n%this.tabSize)/this.tabSize,s=0;s<r;s++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return t.substr(n)}if("\t"==t[0]){for(var s=0;s<n;s++)e.appendChild(this.$tabStrings["\t"].cloneNode(!0));return t.substr(n)}return t},this.$createLineElement=function(e){var t=this.dom.createElement("div");return t.className="ace_line",t.style.height=this.config.lineHeight+"px",t},this.$renderWrappedLine=function(e,t,i){var n=0,r=0,o=i[0],l=0,a=this.$createLineElement();e.appendChild(a);for(var c=0;c<t.length;c++){var h=t[c],u=h.value;if(0==c&&this.displayIndentGuides){if(n=u.length,!(u=this.renderIndentGuide(a,u,o)))continue;n-=u.length}if(n+u.length<o)l=this.$renderToken(a,l,h,u),n+=u.length;else{for(;n+u.length>=o;)l=this.$renderToken(a,l,h,u.substring(0,o-n)),u=u.substring(o-n),n=o,a=this.$createLineElement(),e.appendChild(a),a.appendChild(this.dom.createTextNode(s.stringRepeat(" ",i.indent),this.element)),l=0,o=i[++r]||Number.MAX_VALUE;0!=u.length&&(n+=u.length,l=this.$renderToken(a,l,h,u))}}},this.$renderSimpleLine=function(e,t){var i=0,n=t[0],r=n.value;this.displayIndentGuides&&(r=this.renderIndentGuide(e,r)),r&&(i=this.$renderToken(e,i,n,r));for(var s=1;s<t.length;s++){if(n=t[s],r=n.value,i+r.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,i,n,r);i=this.$renderToken(e,i,n,r)}},this.$renderOverflowMessage=function(e,t,i,n){this.$renderToken(e,t,i,n.slice(0,this.MAX_LINE_LENGTH-t));var r=this.dom.createElement("span");r.className="ace_inline_button ace_keyword ace_toggle_wrap",r.style.position="absolute",r.style.right="0",r.textContent="<click to see more...>",e.appendChild(r)},this.$renderLine=function(e,t,i){if(i||0==i||(i=this.session.getFoldLine(t)),i)var n=this.$getFoldLineTokens(t,i);else var n=this.session.getTokens(t);var r=e;if(n.length){var s=this.session.getRowSplitData(t);if(s&&s.length){this.$renderWrappedLine(e,n,s);var r=e.lastChild}else{var r=e;this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r)),this.$renderSimpleLine(r,n)}}else this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r));if(this.showInvisibles&&r){i&&(t=i.end.row);var o=this.dom.createElement("span");o.className="ace_invisible ace_invisible_eol",o.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,r.appendChild(o)}},this.$getFoldLineTokens=function(e,t){var i=this.session,n=[];var r=i.getTokens(e);return t.walk(function(e,t,s,o,l){null!=e?n.push({type:"fold",value:e}):(l&&(r=i.getTokens(t)),r.length&&function(e,t,i){var r=0,s=0;for(;s+e[r].value.length<t;)if(s+=e[r].value.length,++r==e.length)return;if(s!=t){var o=e[r].value.substring(t-s);o.length>i-t&&(o=o.substring(0,i-t)),n.push({type:e[r].type,value:o}),s=t+o.length,r+=1}for(;s<i&&r<e.length;){var o=e[r].value;o.length+s>i?n.push({type:e[r].type,value:o.substring(0,i-s)}):n.push(e[r]),s+=o.length,r+=1}}(r,o,s))},t.end.row,this.session.getLine(t.end.row).length),n},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){}}).call(a.prototype),t.Text=a}),define("skylark-ace/layer/cursor",["require","exports","module","../lib/dom"],function(e,t,i){var n=e("../lib/dom"),r=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),n.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)};(function(){this.$updateOpacity=function(e){for(var t=this.cursors,i=t.length;i--;)n.setStyle(t[i].style,"opacity",e?"":"0")},this.$startCssAnimation=function(){for(var e=this.cursors,t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){n.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){n.removeCssClass(this.element,"ace_animate-blinking")},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,n.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},this.addCursor=function(){var e=n.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,n.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,n.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&n.removeCssClass(this.element,"ace_smooth-blinking"),e(!0),this.isBlinking&&this.blinkInterval&&this.isVisible)if(this.smoothBlinking&&setTimeout(function(){n.addCssClass(this.element,"ace_smooth-blinking")}.bind(this)),n.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}else this.$stopCssAnimation()},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var i=this.session.documentToScreenPosition(e),n=this.$padding+(this.session.$bidiHandler.isBidiRow(i.row,e.row)?this.session.$bidiHandler.getPosLeft(i.column):i.column*this.config.characterWidth),r=(i.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:n,top:r}},this.isCursorInView=function(e,t){return e.top>=0&&e.top<t.maxHeight},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,i=0,r=0;void 0!==t&&0!==t.length||(t=[{cursor:null}]);for(var i=0,s=t.length;i<s;i++){var o=this.getPixelPosition(t[i].cursor,!0);if(!((o.top>e.height+e.offset||o.top<0)&&i>1)){var l=this.cursors[r++]||this.addCursor(),a=l.style;this.drawCursor?this.drawCursor(l,o,e,t[i],this.session):this.isCursorInView(o,e)?(n.setStyle(a,"display","block"),n.translate(l,o.left,o.top),n.setStyle(a,"width",Math.round(e.characterWidth)+"px"),n.setStyle(a,"height",e.lineHeight+"px")):n.setStyle(a,"display","none")}}for(;this.cursors.length>r;)this.removeCursor();var c=this.session.getOverwrite();this.$setOverwrite(c),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?n.addCssClass(this.element,"ace_overwrite-cursors"):n.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(r.prototype),t.Cursor=r}),define("skylark-ace/scrollbar",["require","exports","module","./lib/oop","./lib/dom","./lib/event","./lib/event_emitter"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,l=function(e){this.element=r.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=r.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){n.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(l.prototype);var a=function(e,t){l.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=r.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};n.inherits(a,l),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>32768?(this.coeff=32768/e,e=32768):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(a.prototype);var c=function(e,t){l.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};n.inherits(c,l),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(c.prototype),t.ScrollBar=a,t.ScrollBarV=a,t.ScrollBarH=c,t.VScrollBar=a,t.HScrollBar=c}),define("skylark-ace/renderloop",["require","exports","module","./lib/event"],function(e,t,i){var n=e("./lib/event"),r=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var i=this;this._flush=function(e){i.pending=!1;var t=i.changes;if(t&&(n.blockIdle(100),i.changes=0,i.onRender(t)),i.changes){if(i.$recursionLimit--<0)return;i.schedule()}else i.$recursionLimit=2}};(function(){this.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(n.nextFrame(this._flush),this.pending=!0)},this.clear=function(e){var t=this.changes;return this.changes=0,t}}).call(r.prototype),t.RenderLoop=r}),define("skylark-ace/layer/font_metrics",["require","exports","module","../lib/oop","../lib/dom","../lib/lang","../lib/event","../lib/useragent","../lib/event_emitter"],function(e,t,i){var n=e("../lib/oop"),r=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),l=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,c="function"==typeof ResizeObserver,h=200,u=t.FontMetrics=function(e){this.el=r.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=r.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=r.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.innerHTML=s.stringRepeat("X",256),this.$characterSize={width:0,height:0},c?this.$addObserver():this.checkForSizeChanges()};(function(){n.implement(this,a),this.$characterSize={width:0,height:0},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",l.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){var i=t[0].contentRect;e.checkForSizeChanges({height:i.height,width:i.width/256})}),this.$observer.observe(this.$measureNode)},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=o.onIdle(function t(){e.checkForSizeChanges(),o.onIdle(t,500)},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/256};return 0===t.width||0===t.height?null:t},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,256);var t=this.$main.getBoundingClientRect();return t.width/256},this.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},this.$getZoom=function e(t){return t?(window.getComputedStyle(t).zoom||1)*e(t.parentElement):1},this.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=r.buildDom([e(0,0),e(h,0),e(0,h),e(h,h)],this.el)},this.transformCoordinates=function(e,t){if(e){var i=this.$getZoom(this.el);e=o(1/i,e)}function n(e,t,i){var n=e[1]*t[0]-e[0]*t[1];return[(-t[1]*i[0]+t[0]*i[1])/n,(+e[1]*i[0]-e[0]*i[1])/n]}function r(e,t){return[e[0]-t[0],e[1]-t[1]]}function s(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function l(e){var t=e.getBoundingClientRect();return[t.left,t.top]}this.els||this.$initTransformMeasureNodes();var a=l(this.els[0]),c=l(this.els[1]),u=l(this.els[2]),d=l(this.els[3]),f=n(r(d,c),r(d,u),r(s(c,u),s(d,a))),g=o(1+f[0],r(c,a)),p=o(1+f[1],r(u,a));if(t){var m=t,v=f[0]*m[0]/h+f[1]*m[1]/h+1,y=s(o(m[0],g),o(m[1],p));return s(o(1/v/h,y),a)}var w=r(e,a),b=n(r(g,o(f[0],w)),r(p,o(f[1],w)),w);return o(h,b)}}).call(u.prototype)}),define("skylark-ace/css/editor.css",[],function(){return'/*\r\nstyles = []\r\nfor (var i = 1; i < 16; i++) {\r\n    styles.push(".ace_br" + i + "{" + (\r\n        ["top-left", "top-right", "bottom-right", "bottom-left"]\r\n    ).map(function(x, j) {\r\n        return i & (1<<j) ? "border-" + x + "-radius: 3px;" : "" \r\n    }).filter(Boolean).join(" ") + "}")\r\n}\r\nstyles.join("\\n")\r\n*/\r\n.ace_br1 {border-top-left-radius    : 3px;}\r\n.ace_br2 {border-top-right-radius   : 3px;}\r\n.ace_br3 {border-top-left-radius    : 3px; border-top-right-radius:    3px;}\r\n.ace_br4 {border-bottom-right-radius: 3px;}\r\n.ace_br5 {border-top-left-radius    : 3px; border-bottom-right-radius: 3px;}\r\n.ace_br6 {border-top-right-radius   : 3px; border-bottom-right-radius: 3px;}\r\n.ace_br7 {border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px;}\r\n.ace_br8 {border-bottom-left-radius : 3px;}\r\n.ace_br9 {border-top-left-radius    : 3px; border-bottom-left-radius:  3px;}\r\n.ace_br10{border-top-right-radius   : 3px; border-bottom-left-radius:  3px;}\r\n.ace_br11{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-left-radius:  3px;}\r\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}\r\n.ace_br13{border-top-left-radius    : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}\r\n.ace_br14{border-top-right-radius   : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}\r\n.ace_br15{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\r\n\r\n\r\n.ace_editor {\r\n    position: relative;\r\n    overflow: hidden;\r\n    font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;\r\n    direction: ltr;\r\n    text-align: left;\r\n    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n}\r\n\r\n.ace_scroller {\r\n    position: absolute;\r\n    overflow: hidden;\r\n    top: 0;\r\n    bottom: 0;\r\n    background-color: inherit;\r\n    -ms-user-select: none;\r\n    -moz-user-select: none;\r\n    -webkit-user-select: none;\r\n    user-select: none;\r\n    cursor: text;\r\n}\r\n\r\n.ace_content {\r\n    position: absolute;\r\n    box-sizing: border-box;\r\n    min-width: 100%;\r\n    contain: style size layout;\r\n}\r\n\r\n.ace_dragging .ace_scroller:before{\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    right: 0;\r\n    bottom: 0;\r\n    content: \'\';\r\n    background: rgba(250, 250, 250, 0.01);\r\n    z-index: 1000;\r\n}\r\n.ace_dragging.ace_dark .ace_scroller:before{\r\n    background: rgba(0, 0, 0, 0.01);\r\n}\r\n\r\n.ace_selecting, .ace_selecting * {\r\n    cursor: text !important;\r\n}\r\n\r\n.ace_gutter {\r\n    position: absolute;\r\n    overflow : hidden;\r\n    width: auto;\r\n    top: 0;\r\n    bottom: 0;\r\n    left: 0;\r\n    cursor: default;\r\n    z-index: 4;\r\n    -ms-user-select: none;\r\n    -moz-user-select: none;\r\n    -webkit-user-select: none;\r\n    user-select: none;\r\n    contain: style size layout;\r\n}\r\n\r\n.ace_gutter-active-line {\r\n    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n}\r\n\r\n.ace_scroller.ace_scroll-left {\r\n    box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\r\n}\r\n\r\n.ace_gutter-cell {\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    right: 0;\r\n    padding-left: 19px;\r\n    padding-right: 6px;\r\n    background-repeat: no-repeat;\r\n}\r\n\r\n.ace_gutter-cell.ace_error {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\r\n    background-repeat: no-repeat;\r\n    background-position: 2px center;\r\n}\r\n\r\n.ace_gutter-cell.ace_warning {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\r\n    background-position: 2px center;\r\n}\r\n\r\n.ace_gutter-cell.ace_info {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\r\n    background-position: 2px center;\r\n}\r\n.ace_dark .ace_gutter-cell.ace_info {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\r\n}\r\n\r\n.ace_scrollbar {\r\n    contain: strict;\r\n    position: absolute;\r\n    right: 0;\r\n    bottom: 0;\r\n    z-index: 6;\r\n}\r\n\r\n.ace_scrollbar-inner {\r\n    position: absolute;\r\n    cursor: text;\r\n    left: 0;\r\n    top: 0;\r\n}\r\n\r\n.ace_scrollbar-v{\r\n    overflow-x: hidden;\r\n    overflow-y: scroll;\r\n    top: 0;\r\n}\r\n\r\n.ace_scrollbar-h {\r\n    overflow-x: scroll;\r\n    overflow-y: hidden;\r\n    left: 0;\r\n}\r\n\r\n.ace_print-margin {\r\n    position: absolute;\r\n    height: 100%;\r\n}\r\n\r\n.ace_text-input {\r\n    position: absolute;\r\n    z-index: 0;\r\n    width: 0.5em;\r\n    height: 1em;\r\n    opacity: 0;\r\n    background: transparent;\r\n    -moz-appearance: none;\r\n    appearance: none;\r\n    border: none;\r\n    resize: none;\r\n    outline: none;\r\n    overflow: hidden;\r\n    font: inherit;\r\n    padding: 0 1px;\r\n    margin: 0 -1px;\r\n    contain: strict;\r\n    -ms-user-select: text;\r\n    -moz-user-select: text;\r\n    -webkit-user-select: text;\r\n    user-select: text;\r\n    /*with `pre-line` chrome inserts &nbsp; instead of space*/\r\n    white-space: pre!important;\r\n}\r\n.ace_text-input.ace_composition {\r\n    background: transparent;\r\n    color: inherit;\r\n    z-index: 1000;\r\n    opacity: 1;\r\n}\r\n.ace_composition_placeholder { color: transparent }\r\n.ace_composition_marker { \r\n    border-bottom: 1px solid;\r\n    position: absolute;\r\n    border-radius: 0;\r\n    margin-top: 1px;\r\n}\r\n\r\n[ace_nocontext=true] {\r\n    transform: none!important;\r\n    filter: none!important;\r\n    perspective: none!important;\r\n    clip-path: none!important;\r\n    mask : none!important;\r\n    contain: none!important;\r\n    perspective: none!important;\r\n    mix-blend-mode: initial!important;\r\n    z-index: auto;\r\n}\r\n\r\n.ace_layer {\r\n    z-index: 1;\r\n    position: absolute;\r\n    overflow: hidden;\r\n    /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/\r\n    word-wrap: normal;\r\n    white-space: pre;\r\n    height: 100%;\r\n    width: 100%;\r\n    box-sizing: border-box;\r\n    /* setting pointer-events: auto; on node under the mouse, which changes\r\n        during scroll, will break mouse wheel scrolling in Safari */\r\n    pointer-events: none;\r\n}\r\n\r\n.ace_gutter-layer {\r\n    position: relative;\r\n    width: auto;\r\n    text-align: right;\r\n    pointer-events: auto;\r\n    height: 1000000px;\r\n    contain: style size layout;\r\n}\r\n\r\n.ace_text-layer {\r\n    font: inherit !important;\r\n    position: absolute;\r\n    height: 1000000px;\r\n    width: 1000000px;\r\n    contain: style size layout;\r\n}\r\n\r\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\r\n    contain: style size layout;\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    right: 0;\r\n}\r\n\r\n.ace_hidpi .ace_text-layer,\r\n.ace_hidpi .ace_gutter-layer,\r\n.ace_hidpi .ace_content,\r\n.ace_hidpi .ace_gutter {\r\n    contain: strict;\r\n    will-change: transform;\r\n}\r\n.ace_hidpi .ace_text-layer > .ace_line, \r\n.ace_hidpi .ace_text-layer > .ace_line_group {\r\n    contain: strict;\r\n}\r\n\r\n.ace_cjk {\r\n    display: inline-block;\r\n    text-align: center;\r\n}\r\n\r\n.ace_cursor-layer {\r\n    z-index: 4;\r\n}\r\n\r\n.ace_cursor {\r\n    z-index: 4;\r\n    position: absolute;\r\n    box-sizing: border-box;\r\n    border-left: 2px solid;\r\n    /* workaround for smooth cursor repaintng whole screen in chrome */\r\n    transform: translatez(0);\r\n}\r\n\r\n.ace_multiselect .ace_cursor {\r\n    border-left-width: 1px;\r\n}\r\n\r\n.ace_slim-cursors .ace_cursor {\r\n    border-left-width: 1px;\r\n}\r\n\r\n.ace_overwrite-cursors .ace_cursor {\r\n    border-left-width: 0;\r\n    border-bottom: 1px solid;\r\n}\r\n\r\n.ace_hidden-cursors .ace_cursor {\r\n    opacity: 0.2;\r\n}\r\n\r\n.ace_smooth-blinking .ace_cursor {\r\n    transition: opacity 0.18s;\r\n}\r\n\r\n.ace_animate-blinking .ace_cursor {\r\n    animation-duration: 1000ms;\r\n    animation-timing-function: step-end;\r\n    animation-name: blink-ace-animate;\r\n    animation-iteration-count: infinite;\r\n}\r\n\r\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\r\n    animation-duration: 1000ms;\r\n    animation-timing-function: ease-in-out;\r\n    animation-name: blink-ace-animate-smooth;\r\n}\r\n    \r\n@keyframes blink-ace-animate {\r\n    from, to { opacity: 1; }\r\n    60% { opacity: 0; }\r\n}\r\n\r\n@keyframes blink-ace-animate-smooth {\r\n    from, to { opacity: 1; }\r\n    45% { opacity: 1; }\r\n    60% { opacity: 0; }\r\n    85% { opacity: 0; }\r\n}\r\n\r\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\r\n    position: absolute;\r\n    z-index: 3;\r\n}\r\n\r\n.ace_marker-layer .ace_selection {\r\n    position: absolute;\r\n    z-index: 5;\r\n}\r\n\r\n.ace_marker-layer .ace_bracket {\r\n    position: absolute;\r\n    z-index: 6;\r\n}\r\n\r\n.ace_marker-layer .ace_active-line {\r\n    position: absolute;\r\n    z-index: 2;\r\n}\r\n\r\n.ace_marker-layer .ace_selected-word {\r\n    position: absolute;\r\n    z-index: 4;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.ace_line .ace_fold {\r\n    box-sizing: border-box;\r\n\r\n    display: inline-block;\r\n    height: 11px;\r\n    margin-top: -2px;\r\n    vertical-align: middle;\r\n\r\n    background-image:\r\n        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\r\n        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\r\n    background-repeat: no-repeat, repeat-x;\r\n    background-position: center center, top left;\r\n    color: transparent;\r\n\r\n    border: 1px solid black;\r\n    border-radius: 2px;\r\n\r\n    cursor: pointer;\r\n    pointer-events: auto;\r\n}\r\n\r\n.ace_dark .ace_fold {\r\n}\r\n\r\n.ace_fold:hover{\r\n    background-image:\r\n        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\r\n        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\r\n}\r\n\r\n.ace_tooltip {\r\n    background-color: #FFF;\r\n    background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\r\n    border: 1px solid gray;\r\n    border-radius: 1px;\r\n    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\r\n    color: black;\r\n    max-width: 100%;\r\n    padding: 3px 4px;\r\n    position: fixed;\r\n    z-index: 999999;\r\n    box-sizing: border-box;\r\n    cursor: default;\r\n    white-space: pre;\r\n    word-wrap: break-word;\r\n    line-height: normal;\r\n    font-style: normal;\r\n    font-weight: normal;\r\n    letter-spacing: normal;\r\n    pointer-events: none;\r\n}\r\n\r\n.ace_folding-enabled > .ace_gutter-cell {\r\n    padding-right: 13px;\r\n}\r\n\r\n.ace_fold-widget {\r\n    box-sizing: border-box;\r\n\r\n    margin: 0 -12px 0 1px;\r\n    display: none;\r\n    width: 11px;\r\n    vertical-align: top;\r\n\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\r\n    background-repeat: no-repeat;\r\n    background-position: center;\r\n\r\n    border-radius: 3px;\r\n    \r\n    border: 1px solid transparent;\r\n    cursor: pointer;\r\n}\r\n\r\n.ace_folding-enabled .ace_fold-widget {\r\n    display: inline-block;   \r\n}\r\n\r\n.ace_fold-widget.ace_end {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\r\n}\r\n\r\n.ace_fold-widget.ace_closed {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\r\n}\r\n\r\n.ace_fold-widget:hover {\r\n    border: 1px solid rgba(0, 0, 0, 0.3);\r\n    background-color: rgba(255, 255, 255, 0.2);\r\n    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\r\n}\r\n\r\n.ace_fold-widget:active {\r\n    border: 1px solid rgba(0, 0, 0, 0.4);\r\n    background-color: rgba(0, 0, 0, 0.05);\r\n    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\r\n}\r\n/**\r\n * Dark version for fold widgets\r\n */\r\n.ace_dark .ace_fold-widget {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\r\n}\r\n.ace_dark .ace_fold-widget.ace_end {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\r\n}\r\n.ace_dark .ace_fold-widget.ace_closed {\r\n    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\r\n}\r\n.ace_dark .ace_fold-widget:hover {\r\n    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\r\n    background-color: rgba(255, 255, 255, 0.1);\r\n}\r\n.ace_dark .ace_fold-widget:active {\r\n    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\r\n}\r\n\r\n.ace_inline_button {\r\n    border: 1px solid lightgray;\r\n    display: inline-block;\r\n    margin: -1px 8px;\r\n    padding: 0 5px;\r\n    pointer-events: auto;\r\n    cursor: pointer;\r\n}\r\n.ace_inline_button:hover {\r\n    border-color: gray;\r\n    background: rgba(200,200,200,0.2);\r\n    display: inline-block;\r\n    pointer-events: auto;\r\n}\r\n\r\n.ace_fold-widget.ace_invalid {\r\n    background-color: #FFB4B4;\r\n    border-color: #DE5555;\r\n}\r\n\r\n.ace_fade-fold-widgets .ace_fold-widget {\r\n    transition: opacity 0.4s ease 0.05s;\r\n    opacity: 0;\r\n}\r\n\r\n.ace_fade-fold-widgets:hover .ace_fold-widget {\r\n    transition: opacity 0.05s ease 0.05s;\r\n    opacity:1;\r\n}\r\n\r\n.ace_underline {\r\n    text-decoration: underline;\r\n}\r\n\r\n.ace_bold {\r\n    font-weight: bold;\r\n}\r\n\r\n.ace_nobold .ace_bold {\r\n    font-weight: normal;\r\n}\r\n\r\n.ace_italic {\r\n    font-style: italic;\r\n}\r\n\r\n\r\n.ace_error-marker {\r\n    background-color: rgba(255, 0, 0,0.2);\r\n    position: absolute;\r\n    z-index: 9;\r\n}\r\n\r\n.ace_highlight-marker {\r\n    background-color: rgba(255, 255, 0,0.2);\r\n    position: absolute;\r\n    z-index: 8;\r\n}\r\n'}),define("skylark-ace/virtual_renderer",["require","exports","module","./lib/oop","./lib/dom","./config","./layer/gutter","./layer/marker","./layer/text","./layer/cursor","./scrollbar","./scrollbar","./renderloop","./layer/font_metrics","./lib/event_emitter","./css/editor.css","./lib/useragent"],function(e,t,i){var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./config"),o=e("./layer/gutter").Gutter,l=e("./layer/marker").Marker,a=e("./layer/text").Text,c=e("./layer/cursor").Cursor,h=e("./scrollbar").HScrollBar,u=e("./scrollbar").VScrollBar,d=e("./renderloop").RenderLoop,f=e("./layer/font_metrics").FontMetrics,g=e("./lib/event_emitter").EventEmitter,p=e("./css/editor.css"),m=e("./lib/useragent"),v=m.isIE;r.importCssString(p,"ace_editor.css");var y=function(e,t){var i=this;this.container=e||r.createElement("div"),r.addCssClass(this.container,"ace_editor"),r.HI_DPI&&r.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),this.$gutter=r.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=r.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=r.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new l(this.content);var n=this.$textLayer=new a(this.content);this.canvas=n.element,this.$markerFront=new l(this.content),this.$cursorLayer=new c(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new u(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){i.$scrollAnimation||i.session.setScrollTop(e.data-i.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){i.$scrollAnimation||i.session.setScrollLeft(e.data-i.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new f(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){i.updateCharacterSize(),i.onResize(!0,i.gutterWidth,i.$size.width,i.$size.height),i._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!m.isIOS,this.$loop=new d(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,n.implement(this,g),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},this.updateLines=function(e,t,i){if(void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t},this.$changedLines.lastRow<this.layerConfig.firstRow){if(!i)return;this.$changedLines.lastRow=this.layerConfig.lastRow}this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,i,n){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=e?1:0;var r=this.container;n||(n=r.clientHeight||r.scrollHeight),i||(i=r.clientWidth||r.scrollWidth);var s=this.$updateCachedSize(e,t,i,n);if(!this.$size.scrollerHeight||!i&&!n)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null}},this.$updateCachedSize=function(e,t,i,n){n-=this.$extraHeight||0;var s=0,o=this.$size,l={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};if(n&&(e||o.height!=n)&&(o.height=n,s|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",s|=this.CHANGE_SCROLL),i&&(e||o.width!=i)){s|=this.CHANGE_SIZE,o.width=i,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,r.setStyle(this.scrollBarH.element.style,"left",t+"px"),r.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),o.scrollerWidth=Math.max(0,i-t-this.scrollBarV.getWidth()-this.margin.h),r.setStyle(this.$gutter.style,"left",this.margin.left+"px");var a=this.scrollBarV.getWidth()+"px";r.setStyle(this.scrollBarH.element.style,"right",a),r.setStyle(this.scroller.style,"right",a),r.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(s|=this.CHANGE_FULL)}return o.$dirty=!i||!n,s&&this._signal("resize",l),s},this.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-2*this.$padding,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=r.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=r.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){var e=this.textarea.style;if(this.$keepTextAreaAtCursor){var t=this.$cursorLayer.$pixelPos;if(t){var i=this.$composition;i&&i.markerRange&&(t=this.$cursorLayer.getPixelPosition(i.markerRange.start,!0));var n=this.layerConfig,s=t.top,o=t.left;s-=n.offset;var l=i&&i.useTextareaForIME?this.lineHeight:v?0:1;if(s<0||s>n.height-l)r.translate(this.textarea,0,0);else{var a=1;if(i)if(i.useTextareaForIME){var c=this.textarea.value;a=this.characterWidth*this.session.$getStringScreenWidth(c)[0],l+=2}else s+=this.lineHeight+2;else s+=this.lineHeight;(o-=this.scrollLeft)>this.$size.scrollerWidth-a&&(o=this.$size.scrollerWidth-a),o+=this.gutterWidth+this.margin.left,r.setStyle(e,"height",l+"px"),r.setStyle(e,"width",a+"px"),r.translate(this.textarea,Math.min(o,this.$size.scrollerWidth-a),Math.min(s,this.$size.height-l))}}}else r.translate(this.textarea,-100,0)},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(0===this.layerConfig.offset?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,i=this.session.documentToScreenRow(t,0)*e.lineHeight;return i-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,i,n){var r=this.scrollMargin;r.top=0|e,r.bottom=0|t,r.right=0|n,r.left=0|i,r.v=r.top+r.bottom,r.h=r.left+r.right,r.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-r.top),this.updateFull()},this.setMargin=function(e,t,i,n){var r=this.margin;r.top=0|e,r.bottom=0|t,r.right=0|n,r.left=0|i,r.v=r.top+r.bottom,r.h=r.left+r.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){if(this.$changes&&(e|=this.$changes,this.$changes=0),this.session&&this.container.offsetWidth&&!this.$frozen&&(e||t)){if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender"),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var i=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),i.firstRow!=this.layerConfig.firstRow&&i.firstRowScreen==this.layerConfig.firstRowScreen){var n=this.scrollTop+(i.firstRow-this.layerConfig.firstRow)*this.lineHeight;n>0&&(this.scrollTop=n,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}i=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),r.translate(this.content,-this.scrollLeft,-i.offset);var s=i.width+2*this.$padding+"px",o=i.minHeight+"px";r.setStyle(this.content.style,"width",s),r.setStyle(this.content.style,"height",o)}if(e&this.CHANGE_H_SCROLL&&(r.translate(this.content,-this.scrollLeft,-i.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left"),e&this.CHANGE_FULL)return this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),void this._signal("afterRender");if(e&this.CHANGE_SCROLL)return e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(i):this.$textLayer.scrollLines(i),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(i):this.$gutterLayer.scrollLines(i)),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),void this._signal("afterRender");e&this.CHANGE_TEXT?(this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(i):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?this.$showGutter&&this.$gutterLayer.update(i):e&this.CHANGE_CURSOR&&this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(i),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(i),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(i),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(i),this._signal("afterRender")}else this.$changes|=e},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,i=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(i+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&i>this.$maxPixelHeight&&(i=this.$maxPixelHeight);var n=i<=2*this.lineHeight,r=!n&&e>t;if(i!=this.desiredHeight||this.$size.height!=this.desiredHeight||r!=this.$vScroll){r!=this.$vScroll&&(this.$vScroll=r,this.scrollBarV.setVisible(r));var s=this.container.clientWidth;this.container.style.height=i+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,i),this.desiredHeight=i,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,i=t.height<=2*this.lineHeight,n=this.session.getScreenLength(),r=n*this.lineHeight,s=this.$getLongestLine(),o=!i&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),l=this.$horizScroll!==o;l&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var c=t.scrollerHeight+this.lineHeight,h=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;r+=h;var u=this.scrollMargin;this.session.setScrollTop(Math.max(-u.top,Math.min(this.scrollTop,r-t.scrollerHeight+u.bottom))),this.session.setScrollLeft(Math.max(-u.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+u.right)));var d=!i&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-r+h<0||this.scrollTop>u.top),f=a!==d;f&&(this.$vScroll=d,this.scrollBarV.setVisible(d));var g,p,m=this.scrollTop%this.lineHeight,v=Math.ceil(c/this.lineHeight)-1,y=Math.max(0,Math.round((this.scrollTop-m)/this.lineHeight)),w=y+v,b=this.lineHeight;y=e.screenToDocumentRow(y,0);var C=e.getFoldLine(y);C&&(y=C.start.row),g=e.documentToScreenRow(y,0),p=e.getRowLength(y)*b,w=Math.min(e.screenToDocumentRow(w,0),e.getLength()-1),c=t.scrollerHeight+e.getRowLength(w)*b+p,m=this.scrollTop-g*b;var k=0;return(this.layerConfig.width!=s||l)&&(k=this.CHANGE_H_SCROLL),(l||f)&&(k=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),f&&(s=this.$getLongestLine())),this.layerConfig={width:s,padding:this.$padding,firstRow:y,firstRowScreen:g,lastRow:w,lineHeight:b,characterWidth:this.characterWidth,minHeight:c,maxHeight:r,offset:m,gutterOffset:b?Math.max(0,Math.ceil((m+t.height-t.scrollerHeight)/b)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),k},this.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var i=this.layerConfig;if(!(e>i.lastRow+1||t<i.firstRow))return t===1/0?(this.$showGutter&&this.$gutterLayer.update(i),void this.$textLayer.update(i)):(this.$textLayer.updateLines(i,e,t),!0)}},this.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,i){this.scrollCursorIntoView(e,i),this.scrollCursorIntoView(t,i)},this.scrollCursorIntoView=function(e,t,i){if(0!==this.$size.scrollerHeight){var n=this.$cursorLayer.getPixelPosition(e),r=n.left,s=n.top,o=i&&i.top||0,l=i&&i.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&a+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),0===s&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-l<s+this.lineHeight&&(t&&a+this.$size.scrollerHeight-l<s-this.lineHeight&&(s+=t*this.$size.scrollerHeight),this.session.setScrollTop(s+this.lineHeight+l-this.$size.scrollerHeight));var c=this.scrollLeft;c>r?(r<this.$padding+2*this.layerConfig.characterWidth&&(r=-this.scrollMargin.left),this.session.setScrollLeft(r)):c+this.$size.scrollerWidth<r+this.characterWidth?this.session.setScrollLeft(Math.round(r+this.characterWidth-this.$size.scrollerWidth)):c<=this.$padding&&r-c<this.characterWidth&&this.session.setScrollLeft(0)}},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},this.alignCursor=function(e,t){"number"==typeof e&&(e={row:e,column:0});var i=this.$cursorLayer.getPixelPosition(e),n=this.$size.scrollerHeight-this.lineHeight,r=i.top-n*(t||0);return this.session.setScrollTop(r),r},this.STEPS=8,this.$calcSteps=function(e,t){var i,n,r=0,s=this.STEPS,o=[];for(r=0;r<s;++r)o.push((i=r/this.STEPS,n=e,(t-e)*(Math.pow(i-1,3)+1)+n));return o},this.scrollToLine=function(e,t,i,n){var r=this.$cursorLayer.getPixelPosition({row:e,column:0}),s=r.top;t&&(s-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(s),!1!==i&&this.animateScrolling(o,n)},this.animateScrolling=function(e,t){var i=this.scrollTop;if(this.$animatedScroll){var n=this;if(e!=i){if(this.$scrollAnimation){var r=this.$scrollAnimation.steps;if(r.length&&(e=r[0])==i)return}var s=n.$calcSteps(e,i);this.$scrollAnimation={from:e,to:i,steps:s},clearInterval(this.$timer),n.session.setScrollTop(s.shift()),n.session.$scrollTop=i,this.$timer=setInterval(function(){s.length?(n.session.setScrollTop(s.shift()),n.session.$scrollTop=i):null!=i?(n.session.$scrollTop=-1,n.session.setScrollTop(i),i=null):(n.$timer=clearInterval(n.$timer),n.$scrollAnimation=null,t&&t())},10)}}},this.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},this.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(t)},this.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},this.isScrollableBy=function(e,t){return t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right||void 0)))},this.pixelToScreenCoordinates=function(e,t){var i;if(this.$hasCssTransforms){i={top:0,left:0};var n=this.$fontMetrics.transformCoordinates([e,t]);e=n[1]-this.gutterWidth-this.margin.left,t=n[0]}else i=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-i.left-this.$padding,s=r/this.characterWidth,o=Math.floor((t+this.scrollTop-i.top)/this.lineHeight),l=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:l,side:s-l>0?1:-1,offsetX:r}},this.screenToTextCoordinates=function(e,t){var i;if(this.$hasCssTransforms){i={top:0,left:0};var n=this.$fontMetrics.transformCoordinates([e,t]);e=n[1]-this.gutterWidth-this.margin.left,t=n[0]}else i=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-i.left-this.$padding,s=r/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),l=Math.floor((t+this.scrollTop-i.top)/this.lineHeight);return this.session.screenToDocumentPosition(l,Math.max(o,0),r)},this.textToScreenCoordinates=function(e,t){var i=this.scroller.getBoundingClientRect(),n=this.session.documentToScreenPosition(e,t),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e)?this.session.$bidiHandler.getPosLeft(n.column):Math.round(n.column*this.characterWidth)),s=n.row*this.lineHeight;return{pageX:i.left+r-this.scrollLeft,pageY:i.top+s-this.scrollTop}},this.visualizeFocus=function(){r.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){r.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText,e.keepTextAreaAtCursor=this.$keepTextAreaAtCursor),e.useTextareaForIME=this.$useTextareaForIME,this.$useTextareaForIME?(this.$keepTextAreaAtCursor=!0,r.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},this.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},this.hideComposition=function(){this.$composition&&(this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),r.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null,this.$cursorLayer.element.style.display="")},this.addToken=function(e,t,i,n){var r=this.session;r.bgTokenizer.lines[i]=null;var s={type:t,value:e},o=r.getTokens(i);if(null==n)o.push(s);else for(var l=0,a=0;a<o.length;a++){var c=o[a];if(l+=c.value.length,n<=l){var h=c.value.length-(l-n),u=c.value.slice(0,h),d=c.value.slice(h);o.splice(a,1,{type:c.type,value:u},s,{type:c.type,value:d});break}}this.updateLines(i,i)},this.setTheme=function(e,t){var i=this;if(this.$themeId=e,i._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)o(e);else{var n=e||this.$options.theme.initialValue;s.loadModule(["theme",n],o)}function o(n){if(i.$themeId!=e)return t&&t();if(!n||!n.cssClass)throw new Error("couldn't load module "+e+" or it didn't call define");n.$id&&(i.$themeId=n.$id),r.importCssString(n.cssText,n.cssClass,i.container),i.theme&&r.removeCssClass(i.container,i.theme.cssClass);var s="padding"in n?n.padding:"padding"in(i.theme||{})?4:i.$padding;i.$padding&&s!=i.$padding&&i.setPadding(s),i.$theme=n.cssClass,i.theme=n,r.addCssClass(i.container,n.cssClass),r.setCssClass(i.container,"ace_dark",n.isDark),i.$size&&(i.$size.width=0,i.$updateSizeAsync()),i._dispatchEvent("themeLoaded",{theme:n}),t&&t()}},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){r.setCssClass(this.container,e,!1!==t)},this.unsetStyle=function(e){r.removeCssClass(this.container,e)},this.setCursorStyle=function(e){r.setStyle(this.scroller.style,"cursor",e)},this.setMouseCursor=function(e){r.setStyle(this.scroller.style,"cursor",e)},this.attachToShadowRoot=function(){r.importCssString(p,"ace_editor.css",this.container)},this.destroy=function(){this.$fontMetrics.destroy(),this.$cursorLayer.destroy()}}).call(y.prototype),s.defineOptions(y.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){r.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!m.isMobile&&!m.isIE}}),t.VirtualRenderer=y}),define("skylark-ace/worker/worker_client",["require","exports","module","../lib/oop","../lib/net","../lib/event_emitter","../config"],function(e,t,i){var n=e("../lib/oop"),r=e("../lib/net"),s=e("../lib/event_emitter").EventEmitter,o=e("../config");function l(e){if("undefined"==typeof Worker)return{postMessage:function(){},terminate:function(){}};if(o.get("loadWorkerFromBlob")){var t=function(e){var t="importScripts('"+r.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(e){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,n=new i;return n.append(t),n.getBlob("application/javascript")}}(e),i=window.URL||window.webkitURL,n=i.createObjectURL(t);return new Worker(n)}return new Worker(e)}var a=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){n.implement(this,s),this.$createWorkerFromOldConfig=function(t,i,n,r,s){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),o.get("packaged")||!e.toUrl)r=r||o.moduleUrl(i,"worker");else{var a=this.$normalizePath;r=r||a(e.toUrl("ace/worker/worker.js",null,"_"));var c={};t.forEach(function(t){c[t]=a(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=l(r),s&&this.send("importScripts",s),this.$worker.postMessage({init:!0,tlns:c,module:i,classname:n}),this.$worker},this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var i=this.callbacks[t.id];i&&(i(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return r.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,i){if(i){var n=this.callbackId++;this.callbacks[n]=i,t.push(n)}this.send(e,t)},this.emit=function(e,t){try{t.data&&t.data.err&&(t.data.err={message:t.data.err.message,stack:t.data.err.stack,code:t.data.err.code}),this.$worker.postMessage({event:e,data:{data:t.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(a.prototype);t.UIWorkerClient=function(e,t,i){var n=null,r=!1,l=Object.create(s),c=[],h=new a({messageBuffer:c,terminate:function(){},postMessage:function(e){c.push(e),n&&(r?setTimeout(u):u())}});h.setEmitSync=function(e){r=e};var u=function(){var e=c.shift();e.command?n[e.command].apply(n,e.args):e.event&&l._signal(e.event,e.data)};return l.postMessage=function(e){h.onMessage({data:e})},l.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},l.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){for(n=new e[i](l);c.length;)u()}),h},t.WorkerClient=a,t.createWorker=l}),define("skylark-ace/placeholder",["require","exports","module","./range","./lib/event_emitter","./lib/oop"],function(e,t,i){var n=e("./range").Range,r=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,i,n,r,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=r,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=n,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=i;var l=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=l.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,r),this.setup=function(){var e=this,t=this.doc,i=this.session;this.selectionBefore=i.selection.toJSON(),i.selection.inMultiSelectMode&&i.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var r=this.pos;r.$insertRight=!0,r.detach(),r.markerId=i.addMarker(new n(r.row,r.column,r.row,r.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(i){var n=t.createAnchor(i.row,i.column);n.$insertRight=!0,n.detach(),e.others.push(n)}),i.setUndoSelect(!1)},this.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(i){i.markerId=e.addMarker(new n(i.row,i.column,i.row,i.column+t.length),t.othersClass,null,!1)})}},this.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},this.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var i="insert"===e.action?t.end.column-t.start.column:t.start.column-t.end.column,r=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;if(this.updateAnchors(e),r&&(this.length+=i),r&&!this.session.$fromUndo)if("insert"===e.action)for(var o=this.others.length-1;o>=0;o--){var l=this.others[o],a={row:l.row,column:l.column+s};this.doc.insertMergedLines(a,e.lines)}else if("remove"===e.action)for(var o=this.others.length-1;o>=0;o--){var l=this.others[o],a={row:l.row,column:l.column+s};this.doc.remove(new n(a.row,a.column,a.row,a.column-i))}this.$updating=!1,this.updateMarkers()}},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,i=function(i,r){t.removeMarker(i.markerId),i.markerId=t.addMarker(new n(i.row,i.column,i.row,i.column+e.length),r,null,!1)};i(this.pos,this.mainClass);for(var r=this.others.length;r--;)i(this.others[r],this.othersClass)}},this.onCursorChange=function(e){if(!this.$updating&&this.session){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,i=0;i<t;i++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}}}).call(o.prototype),t.PlaceHolder=o}),define("skylark-ace/mouse/multi_select_handler",["require","exports","module","../lib/event","../lib/useragent"],function(e,t,i){var n=e("../lib/event"),r=e("../lib/useragent");function s(e,t){return e.row==t.row&&e.column==t.column}t.onMouseDown=function(e){var t=e.domEvent,i=t.altKey,o=t.shiftKey,l=t.ctrlKey,a=e.getAccelKey(),c=e.getButton();l&&r.isMac&&(c=t.button);if(e.editor.inMultiSelectMode&&2==c)return void e.editor.textInput.onContextMenu(e.domEvent);if(!l&&!i&&!a)return void(0===c&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode());if(0!==c)return;var h,u=e.editor,d=u.selection,f=u.inMultiSelectMode,g=e.getDocumentPosition(),p=d.getCursor(),m=e.inSelection()||d.isEmpty()&&s(g,p),v=e.x,y=e.y,w=u.session,b=u.renderer.pixelToScreenCoordinates(v,y),C=b;if(u.$mouseHandler.$enableJumpToDef)l&&i||a&&i?h=o?"block":"add":i&&u.$blockSelectEnabled&&(h="block");else if(a&&!i){if(h="add",!f&&o)return}else i&&u.$blockSelectEnabled&&(h="block");h&&r.isMac&&t.ctrlKey&&u.$mouseHandler.cancelContextMenu();if("add"==h){if(!f&&m)return;if(!f){var k=d.toOrientedRange();u.addSelectionMarker(k)}var x=d.rangeList.rangeAtPoint(g);u.inVirtualSelectionMode=!0,o&&(x=null,k=d.ranges[0]||k,u.removeSelectionMarker(k)),u.once("mouseup",function(){var e=d.toOrientedRange();x&&e.isEmpty()&&s(x.cursor,e.cursor)?d.substractPoint(e.cursor):(o?d.substractPoint(k.cursor):k&&(u.removeSelectionMarker(k),d.addRange(k)),d.addRange(e)),u.inVirtualSelectionMode=!1})}else if("block"==h){var S;e.stop(),u.inVirtualSelectionMode=!0;var $=[],L=function(){var e=u.renderer.pixelToScreenCoordinates(v,y),t=w.screenToDocumentPosition(e.row,e.column,e.offsetX);s(C,e)&&s(t,d.lead)||(C=e,u.selection.moveToPosition(t),u.renderer.scrollCursorIntoView(),u.removeSelectionMarkers($),$=d.rectangularRangeBlock(C,b),u.$mouseHandler.$clickSelection&&1==$.length&&$[0].isEmpty()&&($[0]=u.$mouseHandler.$clickSelection.clone()),$.forEach(u.addSelectionMarker,u),u.updateSelectionMarkers())};f&&!a?d.toSingleRange():!f&&a&&(S=d.toOrientedRange(),u.addSelectionMarker(S)),o?b=w.documentToScreenPosition(d.lead):d.moveToPosition(g),C={row:-1,column:-1};var A=L;n.capture(u.container,function(e){v=e.clientX,y=e.clientY},function(e){L(),clearInterval(M),u.removeSelectionMarkers($),$.length||($=[d.toOrientedRange()]);S&&(u.removeSelectionMarker(S),d.toSingleRange(S));for(var t=0;t<$.length;t++)d.addRange($[t]);u.inVirtualSelectionMode=!1,u.$mouseHandler.$clickSelection=null});var M=setInterval(function(){A()},20);return e.preventDefault()}}}),define("skylark-ace/commands/multi_select_commands",["require","exports","module","../keyboard/hash_handler"],function(e,t,i){t.defaultCommands=[{name:"addCursorAbove",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"splitIntoLines",exec:function(e){e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"alignCursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var n=e("../keyboard/hash_handler").HashHandler;t.keyboardHandler=new n(t.multiSelectCommands)}),define("skylark-ace/multi_select",["require","exports","module","./range_list","./range","./selection","./mouse/multi_select_handler","./lib/event","./lib/lang","./commands/multi_select_commands","./search","./edit_session","./editor","./config"],function(e,t,i){var n=e("./range_list").RangeList,r=e("./range").Range,s=e("./selection").Selection,o=e("./mouse/multi_select_handler").onMouseDown,l=e("./lib/event"),a=e("./lib/lang"),c=e("./commands/multi_select_commands");t.commands=c.defaultCommands.concat(c.multiSelectCommands);var h=e("./search").Search,u=new h;var d=e("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(d.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var i=this.toOrientedRange();if(this.rangeList.add(i),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(i),this.$onAddRange(i)}e.cursor||(e.cursor=e.end);var n=this.rangeList.add(e);return this.$onAddRange(e),n.length&&this.$onRemoveRange(n),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var i=e.length;i--;){var n=this.ranges.indexOf(e[i]);this.ranges.splice(n,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(t=t||this.ranges[0])&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new n,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],i=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)}else{var i=this.getRange(),n=this.isBackwards(),s=i.start.row,o=i.end.row;if(s==o){if(n)var l=i.end,a=i.start;else var l=i.start,a=i.end;return this.addRange(r.fromPoints(a,a)),void this.addRange(r.fromPoints(l,l))}var c=[],h=this.getLineRange(s,!0);h.start.column=i.start.column,c.push(h);for(var u=s+1;u<o;u++)c.push(this.getLineRange(u,!0));(h=this.getLineRange(o,!0)).end.column=i.end.column,c.push(h),c.forEach(this.addRange,this)}},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],i=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)}else{var n=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(n,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,i){var n=[],s=e.column<t.column;if(s)var o=e.column,l=t.column,a=e.offsetX,c=t.offsetX;else var o=t.column,l=e.column,a=t.offsetX,c=e.offsetX;var h,u,d,f=e.row<t.row;if(f)var g=e.row,p=t.row;else var g=t.row,p=e.row;o<0&&(o=0),g<0&&(g=0),g==p&&(i=!0);for(var m=g;m<=p;m++){var v=r.fromPoints(this.session.screenToDocumentPosition(m,o,a),this.session.screenToDocumentPosition(m,l,c));if(v.isEmpty()){if(h&&(u=v.end,d=h,u.row==d.row&&u.column==d.column))break;h=v.end}v.cursor=s?v.start:v.end,n.push(v)}if(f&&n.reverse(),!i){for(var y=n.length-1;n[y].isEmpty()&&y>0;)y--;if(y>0)for(var w=0;n[w].isEmpty();)w++;for(var b=y;b>=w;b--)n[b].isEmpty()&&n.splice(b,1)}return n}}.call(s.prototype);var f=e("./editor").Editor;function g(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",o),e.commands.addCommands(c.defaultCommands),function(e){var t=e.textInput.getElement(),i=!1;function n(t){i&&(e.renderer.setMouseCursor(""),i=!1)}l.addListener(t,"keydown",function(t){var r=18==t.keyCode&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&r?i||(e.renderer.setMouseCursor("crosshair"),i=!0):i&&n()}),l.addListener(t,"keyup",n),l.addListener(t,"blur",n)}(e))}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,i=e.length;i--;){var n=e[i];if(n.marker){this.session.removeMarker(n.marker);var r=t.indexOf(n);-1!=r&&t.splice(r,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(c.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(c.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var t=e.command,i=e.editor;if(i.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?n=i.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?n=i.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(i.exitMultiSelectMode(),n=t.exec(i,e.args||{})):n=t.multiSelectAction(i,e.args||{});else{var n=t.exec(i,e.args||{});i.multiSelect.addRange(i.multiSelect.toOrientedRange()),i.multiSelect.mergeOverlappingRanges()}return n}},this.forEachSelection=function(e,t,i){if(!this.inVirtualSelectionMode){var n,r=i&&i.keepOrder,o=1==i||i&&i.$byLines,l=this.session,a=this.selection,c=a.rangeList,h=(r?a:c).ranges;if(!h.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var u=a._eventRegistry;a._eventRegistry={};var d=new s(l);this.inVirtualSelectionMode=!0;for(var f=h.length;f--;){if(o)for(;f>0&&h[f].start.row==h[f-1].end.row;)f--;d.fromOrientedRange(h[f]),d.index=f,this.selection=l.selection=d;var g=e.exec?e.exec(this,t||{}):e(this,t||{});n||void 0===g||(n=g),d.toOrientedRange(h[f])}d.detach(),this.selection=l.selection=a,this.inVirtualSelectionMode=!1,a._eventRegistry=u,a.mergeOverlappingRanges(),a.ranges[0]&&a.fromOrientedRange(a.ranges[0]);var p=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),p&&p.from==p.to&&this.renderer.animateScrolling(p.from),n}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,i=[],n=0;n<t.length;n++)i.push(this.session.getTextRange(t[n]));var r=this.session.getDocument().getNewLineCharacter();(e=i.join(r)).length==(i.length-1)*r.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,t){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var i=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&t==this.multiSelect.anchor)return;var n=t==this.multiSelect.anchor?i.cursor==i.start?i.end:i.start:i.cursor;n.row!=t.row||this.session.$clipPositionToDocument(n.row,n.column).column!=t.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(e,t,i){if((t=t||{}).needle=e||t.needle,void 0==t.needle){var n=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(n)}this.$search.set(t);var r=this.$search.findAll(this.session);if(!r.length)return 0;var s=this.multiSelect;i||s.toSingleRange(r[0]);for(var o=r.length;o--;)s.addRange(r[o],!0);return n&&s.rangeList.rangeAtPoint(n.start)&&s.addRange(n,!0),r.length},this.selectMoreLines=function(e,t){var i=this.selection.toOrientedRange(),n=i.cursor==i.end,s=this.session.documentToScreenPosition(i.cursor);this.selection.$desiredColumn&&(s.column=this.selection.$desiredColumn);var o=this.session.screenToDocumentPosition(s.row+e,s.column);if(i.isEmpty())var l=o;else var a=this.session.documentToScreenPosition(n?i.end:i.start),l=this.session.screenToDocumentPosition(a.row+e,a.column);if(n){var c=r.fromPoints(o,l);c.cursor=c.start}else{var c=r.fromPoints(l,o);c.cursor=c.end}if(c.desiredColumn=s.column,this.selection.inMultiSelectMode){if(t)var h=i.cursor}else this.selection.addRange(i);this.selection.addRange(c),h&&this.selection.substractPoint(h)},this.transposeSelections=function(e){for(var t=this.session,i=t.multiSelect,n=i.ranges,r=n.length;r--;){var s=n[r];if(s.isEmpty()){var o=t.getWordRange(s.start.row,s.start.column);s.start.row=o.start.row,s.start.column=o.start.column,s.end.row=o.end.row,s.end.column=o.end.column}}i.mergeOverlappingRanges();for(var l=[],r=n.length;r--;){var s=n[r];l.unshift(t.getTextRange(s))}e<0?l.unshift(l.pop()):l.push(l.shift());for(var r=n.length;r--;){var s=n[r],o=s.clone();t.replace(s,l[r]),s.start.row=o.start.row,s.start.column=o.start.column}i.fromOrientedRange(i.ranges[0])},this.selectMore=function(e,t,i){var n=this.session,r=n.multiSelect,s=r.toOrientedRange();if(!s.isEmpty()||((s=n.getWordRange(s.start.row,s.start.column)).cursor=-1==e?s.start:s.end,this.multiSelect.addRange(s),!i)){var o=n.getTextRange(s),l=function(e,t,i){return u.$options.wrap=!0,u.$options.needle=t,u.$options.backwards=-1==i,u.find(e)}(n,o,e);l&&(l.cursor=-1==e?l.start:l.end,this.session.unfold(l),this.multiSelect.addRange(l),this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(s.cursor)}},this.alignCursors=function(){var e=this.session,t=e.multiSelect,i=t.ranges,n=-1,s=i.filter(function(e){if(e.cursor.row==n)return!0;n=e.cursor.row});if(i.length&&s.length!=i.length-1){s.forEach(function(e){t.substractPoint(e.cursor)});var o=0,l=1/0,c=i.map(function(t){var i=t.cursor,n=e.getLine(i.row),r=n.substr(i.column).search(/\S/g);return-1==r&&(r=0),i.column>o&&(o=i.column),r<l&&(l=r),r});i.forEach(function(t,i){var n=t.cursor,s=o-n.column,h=c[i]-l;s>h?e.insert(n,a.stringRepeat(" ",s-h)):e.remove(new r(n.row,n.column,n.row,n.column-s+h)),t.start.column=t.end.column=o,t.start.row=t.end.row=n.row,t.cursor=t.end}),t.fromOrientedRange(i[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var h=this.selection.getRange(),u=h.start.row,d=h.end.row,f=u==d;if(f){var g,p=this.session.getLength();do{g=this.session.getLine(d)}while(/[=:]/.test(g)&&++d<p);do{g=this.session.getLine(u)}while(/[=:]/.test(g)&&--u>0);u<0&&(u=0),d>=p&&(d=p-1)}var m=this.session.removeFullLines(u,d);m=this.$reAlignText(m,f),this.session.insert({row:u,column:0},m.join("\n")+"\n"),f||(h.start.column=0,h.end.column=m[m.length-1].length),this.selection.setRange(h)}},this.$reAlignText=function(e,t){var i,n,r,s=!0,o=!0;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?null==i?(i=t[1].length,n=t[2].length,r=t[3].length,t):(i+n+r!=t[1].length+t[2].length+t[3].length&&(o=!1),i!=t[1].length&&(s=!1),i>t[1].length&&(i=t[1].length),n<t[2].length&&(n=t[2].length),r>t[3].length&&(r=t[3].length),t):[e]}).map(t?c:s?o?function(e){return e[2]?l(i+n-e[2].length)+e[2]+l(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}:c:function(e){return e[2]?l(i)+e[2]+l(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]});function l(e){return a.stringRepeat(" ",e)}function c(e){return e[2]?l(i)+e[2]+l(n-e[2].length+r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(f.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var i=e.oldSession;i&&(i.multiSelect.off("addRange",this.$onAddRange),i.multiSelect.off("removeRange",this.$onRemoveRange),i.multiSelect.off("multiSelect",this.$onMultiSelect),i.multiSelect.off("singleSelect",this.$onSingleSelect),i.multiSelect.lead.off("change",this.$checkMultiselectChange),i.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=g,e("./config").defineOptions(f.prototype,"editor",{enableMultiselect:{set:function(e){g(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),define("skylark-ace/mode/folding/fold_mode",["require","exports","module","../../range"],function(e,t,i){var n=e("../../range").Range,r=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,i){var n=e.getLine(i);return this.foldingStartMarker.test(n)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(n)?"end":""},this.getFoldWidgetRange=function(e,t,i){return null},this.indentationBlock=function(e,t,i){var r=/\S/,s=e.getLine(t),o=s.search(r);if(-1!=o){for(var l=i||s.length,a=e.getLength(),c=t,h=t;++t<a;){var u=e.getLine(t).search(r);if(-1!=u){if(u<=o)break;h=t}}if(h>c){var d=e.getLine(h).length;return new n(c,l,h,d)}}},this.openingBracketBlock=function(e,t,i,r,s){var o={row:i,column:r+1},l=e.$findClosingBracket(t,o,s);if(l){var a=e.foldWidgets[l.row];return null==a&&(a=e.getFoldWidget(l.row)),"start"==a&&l.row>o.row&&(l.row--,l.column=e.getLine(l.row).length),n.fromPoints(o,l)}},this.closingBracketBlock=function(e,t,i,r,s){var o={row:i,column:r},l=e.$findOpeningBracket(t,o);if(l)return l.column++,o.column--,n.fromPoints(l,o)}}).call(r.prototype)}),define("skylark-ace/theme/textmate.css",[],function(){return'.ace-tm .ace_gutter {\r\n  background: #f0f0f0;\r\n  color: #333;\r\n}\r\n\r\n.ace-tm .ace_print-margin {\r\n  width: 1px;\r\n  background: #e8e8e8;\r\n}\r\n\r\n.ace-tm .ace_fold {\r\n    background-color: #6B72E6;\r\n}\r\n\r\n.ace-tm {\r\n  background-color: #FFFFFF;\r\n  color: black;\r\n}\r\n\r\n.ace-tm .ace_cursor {\r\n  color: black;\r\n}\r\n        \r\n.ace-tm .ace_invisible {\r\n  color: rgb(191, 191, 191);\r\n}\r\n\r\n.ace-tm .ace_storage,\r\n.ace-tm .ace_keyword {\r\n  color: blue;\r\n}\r\n\r\n.ace-tm .ace_constant {\r\n  color: rgb(197, 6, 11);\r\n}\r\n\r\n.ace-tm .ace_constant.ace_buildin {\r\n  color: rgb(88, 72, 246);\r\n}\r\n\r\n.ace-tm .ace_constant.ace_language {\r\n  color: rgb(88, 92, 246);\r\n}\r\n\r\n.ace-tm .ace_constant.ace_library {\r\n  color: rgb(6, 150, 14);\r\n}\r\n\r\n.ace-tm .ace_invalid {\r\n  background-color: rgba(255, 0, 0, 0.1);\r\n  color: red;\r\n}\r\n\r\n.ace-tm .ace_support.ace_function {\r\n  color: rgb(60, 76, 114);\r\n}\r\n\r\n.ace-tm .ace_support.ace_constant {\r\n  color: rgb(6, 150, 14);\r\n}\r\n\r\n.ace-tm .ace_support.ace_type,\r\n.ace-tm .ace_support.ace_class {\r\n  color: rgb(109, 121, 222);\r\n}\r\n\r\n.ace-tm .ace_keyword.ace_operator {\r\n  color: rgb(104, 118, 135);\r\n}\r\n\r\n.ace-tm .ace_string {\r\n  color: rgb(3, 106, 7);\r\n}\r\n\r\n.ace-tm .ace_comment {\r\n  color: rgb(76, 136, 107);\r\n}\r\n\r\n.ace-tm .ace_comment.ace_doc {\r\n  color: rgb(0, 102, 255);\r\n}\r\n\r\n.ace-tm .ace_comment.ace_doc.ace_tag {\r\n  color: rgb(128, 159, 191);\r\n}\r\n\r\n.ace-tm .ace_constant.ace_numeric {\r\n  color: rgb(0, 0, 205);\r\n}\r\n\r\n.ace-tm .ace_variable {\r\n  color: rgb(49, 132, 149);\r\n}\r\n\r\n.ace-tm .ace_xml-pe {\r\n  color: rgb(104, 104, 91);\r\n}\r\n\r\n.ace-tm .ace_entity.ace_name.ace_function {\r\n  color: #0000A2;\r\n}\r\n\r\n\r\n.ace-tm .ace_heading {\r\n  color: rgb(12, 7, 255);\r\n}\r\n\r\n.ace-tm .ace_list {\r\n  color:rgb(185, 6, 144);\r\n}\r\n\r\n.ace-tm .ace_meta.ace_tag {\r\n  color:rgb(0, 22, 142);\r\n}\r\n\r\n.ace-tm .ace_string.ace_regex {\r\n  color: rgb(255, 0, 0)\r\n}\r\n\r\n.ace-tm .ace_marker-layer .ace_selection {\r\n  background: rgb(181, 213, 255);\r\n}\r\n.ace-tm.ace_multiselect .ace_selection.ace_start {\r\n  box-shadow: 0 0 3px 0px white;\r\n}\r\n.ace-tm .ace_marker-layer .ace_step {\r\n  background: rgb(252, 255, 0);\r\n}\r\n\r\n.ace-tm .ace_marker-layer .ace_stack {\r\n  background: rgb(164, 229, 101);\r\n}\r\n\r\n.ace-tm .ace_marker-layer .ace_bracket {\r\n  margin: -1px 0 0 -1px;\r\n  border: 1px solid rgb(192, 192, 192);\r\n}\r\n\r\n.ace-tm .ace_marker-layer .ace_active-line {\r\n  background: rgba(0, 0, 0, 0.07);\r\n}\r\n\r\n.ace-tm .ace_gutter-active-line {\r\n    background-color : #dcdcdc;\r\n}\r\n\r\n.ace-tm .ace_marker-layer .ace_selected-word {\r\n  background: rgb(250, 250, 255);\r\n  border: 1px solid rgb(200, 200, 250);\r\n}\r\n\r\n.ace-tm .ace_indent-guide {\r\n  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\r\n}\r\n'}),define("skylark-ace/theme/textmate",["require","exports","module","./textmate.css","../lib/dom"],function(e,t,i){t.isDark=!1,t.cssClass="ace-tm",t.cssText=e("./textmate.css"),t.$id="ace/theme/textmate";var n=e("../lib/dom");n.importCssString(t.cssText,t.cssClass)}),define("skylark-ace/line_widgets",["require","exports","module","./lib/oop","./lib/dom","./range"],function(e,t,i){e("./lib/oop");var n=e("./lib/dom");e("./range").Range;function r(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}(function(){this.getRowLength=function(e){var t;return t=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},this.detach=function(e){var t=this.editor;if(t){this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var i=this.session.lineWidgets;i&&i.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},this.updateOnFold=function(e,t){var i=t.lineWidgets;if(i&&e.action){for(var n=e.data,r=n.start.row,s=n.end.row,o="add"==e.action,l=r+1;l<s;l++)i[l]&&(i[l].hidden=o);i[s]&&(o?i[r]?i[s].hidden=o:i[r]=i[s]:(i[r]==i[s]&&(i[r]=void 0),i[s].hidden=o))}},this.updateOnChange=function(e){var t=this.session.lineWidgets;if(t){var i=e.start.row,n=e.end.row-i;if(0===n);else if("remove"==e.action){var r=t.splice(i+1,n);r.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var s=new Array(n);s.unshift(i,0),t.splice.apply(t,s),this.$updateRows()}}},this.$updateRows=function(){var e=this.session.lineWidgets;if(e){var t=!0;e.forEach(function(e,i){if(e)for(t=!1,e.row=i;e.$oldWidget;)e.$oldWidget.row=i,e=e.$oldWidget}),t&&(this.session.lineWidgets=null)}},this.addLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e.session=this.session;var i=this.editor.renderer;e.html&&!e.el&&(e.el=n.createElement("div"),e.el.innerHTML=e.html),e.el&&(n.addCssClass(e.el,"ace_lineWidgetContainer"),e.el.style.position="absolute",e.el.style.zIndex=5,i.container.appendChild(e.el),e._inDocument=!0),e.coverGutter||(e.el.style.zIndex=3),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight),null==e.rowCount&&(e.rowCount=e.pixelHeight/i.layerConfig.lineHeight);var r=this.session.getFoldAt(e.row,0);if(e.$fold=r,r){var s=this.session.lineWidgets;e.row!=r.end.row||s[r.start.row]?e.hidden=!0:s[r.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,i),this.onWidgetChanged(e),e},this.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(e){}if(this.session.lineWidgets){var t=this.session.lineWidgets[e.row];if(t==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else for(;t;){if(t.$oldWidget==e){t.$oldWidget=e.$oldWidget;break}t=t.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},this.getWidgetsAtRow=function(e){for(var t=this.session.lineWidgets,i=t&&t[e],n=[];i;)n.push(i),i=i.$oldWidget;return n},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var i=this.session._changedWidgets,n=t.layerConfig;if(i&&i.length){for(var r=1/0,s=0;s<i.length;s++){var o=i[s];if(o&&o.el&&o.session==this.session){if(!o._inDocument){if(this.session.lineWidgets[o.row]!=o)continue;o._inDocument=!0,t.container.appendChild(o.el)}o.h=o.el.offsetHeight,o.fixedWidth||(o.w=o.el.offsetWidth,o.screenWidth=Math.ceil(o.w/n.characterWidth));var l=o.h/n.lineHeight;o.coverLine&&(l-=this.session.getRowLineCount(o.row))<0&&(l=0),o.rowCount!=l&&(o.rowCount=l,o.row<r&&(r=o.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},this.renderWidgets=function(e,t){var i=t.layerConfig,n=this.session.lineWidgets;if(n){for(var r=Math.min(this.firstRow,i.firstRow),s=Math.max(this.lastRow,i.lastRow,n.length);r>0&&!n[r];)r--;this.firstRow=i.firstRow,this.lastRow=i.lastRow,t.$cursorLayer.config=i;for(var o=r;o<=s;o++){var l=n[o];if(l&&l.el)if(l.hidden)l.el.style.top=-100-(l.pixelHeight||0)+"px";else{l._inDocument||(l._inDocument=!0,t.container.appendChild(l.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;l.coverLine||(a+=i.lineHeight*this.session.getRowLineCount(l.row)),l.el.style.top=a-i.offset+"px";var c=l.coverGutter?0:t.gutterWidth;l.fixedWidth||(c-=t.scrollLeft),l.el.style.left=c+"px",l.fullWidth&&l.screenWidth&&(l.el.style.minWidth=i.width+2*i.padding+"px"),l.fixedWidth?l.el.style.right=t.scrollBar.getWidth()+"px":l.el.style.right=""}}}}}).call(r.prototype),t.LineWidgets=r}),define("skylark-ace/ext/error_marker",["require","exports","module","../line_widgets","../lib/dom","../range"],function(e,t,i){var n=e("../line_widgets").LineWidgets,r=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var i=e.session;i.widgetManager||(i.widgetManager=new n(i),i.widgetManager.attach(e));var o=e.getCursorPosition(),l=o.row,a=i.widgetManager.getWidgetsAtRow(l).filter(function(e){return"errorMarker"==e.type})[0];a?a.destroy():l-=t;var c,h=function(e,t,i){var n=e.getAnnotations().sort(s.comparePoints);if(!n.length)return;var r=function(e,t,i){var n=0,r=e.length-1;for(;n<=r;){var s=n+r>>1,o=i(t,e[s]);if(o>0)n=s+1;else{if(!(o<0))return s;r=s-1}}return-(n+1)}(n,{row:t,column:-1},s.comparePoints);r<0&&(r=-r-1);r>=n.length?r=i>0?0:n.length-1:0===r&&i<0&&(r=n.length-1);var o=n[r];if(!o||!i)return;if(o.row===t){do{o=n[r+=i]}while(o&&o.row===t);if(!o)return n.slice()}var l=[];t=o.row;do{l[i<0?"unshift":"push"](o),o=n[r+=i]}while(o&&o.row==t);return l.length&&l}(i,l,t);if(h){var u=h[0];o.column=(u.pos&&"number"!=typeof u.column?u.pos.sc:u.column)||0,o.row=u.row,c=e.renderer.$gutterLayer.$annotations[o.row]}else{if(a)return;c={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(o.row),e.selection.moveToPosition(o);var d={row:o.row,fixedWidth:!0,coverGutter:!0,el:r.createElement("div"),type:"errorMarker"},f=d.el.appendChild(r.createElement("div")),g=d.el.appendChild(r.createElement("div"));g.className="error_widget_arrow "+c.className;var p=e.renderer.$cursorLayer.getPixelPosition(o).left;g.style.left=p+e.renderer.gutterWidth-5+"px",d.el.className="error_widget_wrapper",f.className="error_widget "+c.className,f.innerHTML=c.text.join("<br>"),f.appendChild(r.createElement("div"));var m=function(e,t,i){if(0===t&&("esc"===i||"return"===i))return d.destroy(),{command:"null"}};d.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(m),i.widgetManager.removeLineWidget(d),e.off("changeSelection",d.destroy),e.off("changeSession",d.destroy),e.off("mouseup",d.destroy),e.off("change",d.destroy))},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",d.destroy),e.on("changeSession",d.destroy),e.on("mouseup",d.destroy),e.on("change",d.destroy),e.session.widgetManager.addLineWidget(d),d.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:d.el.offsetHeight})},r.importCssString("    .error_widget_wrapper {        background: inherit;        color: inherit;        border:none    }    .error_widget {        border-top: solid 2px;        border-bottom: solid 2px;        margin: 5px 0;        padding: 10px 40px;        white-space: pre-wrap;    }    .error_widget.ace_error, .error_widget_arrow.ace_error{        border-color: #ff5a5a    }    .error_widget.ace_warning, .error_widget_arrow.ace_warning{        border-color: #F1D817    }    .error_widget.ace_info, .error_widget_arrow.ace_info{        border-color: #5a5a5a    }    .error_widget.ace_ok, .error_widget_arrow.ace_ok{        border-color: #5aaa5a    }    .error_widget_arrow {        position: absolute;        border: solid 5px;        border-top-color: transparent!important;        border-right-color: transparent!important;        border-left-color: transparent!important;        top: -5px;    }","")}),define("skylark-ace/main",["require","exports","module","./lib/fixoldbrowsers","./lib/dom","./lib/event","./range","./editor","./edit_session","./undomanager","./virtual_renderer","./worker/worker_client","./keyboard/hash_handler","./placeholder","./multi_select","./mode/folding/fold_mode","./theme/textmate","./ext/error_marker","./config"],function(e,t,i){e("./lib/fixoldbrowsers");var n=e("./lib/dom"),r=e("./lib/event"),s=e("./range").Range,o=e("./editor").Editor,l=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,c=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,"function"==typeof define&&(t.define=define),t.edit=function(e,i){if("string"==typeof e){var s=e;if(!(e=document.getElementById(s)))throw new Error("ace.edit can't find div #"+s)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var l="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;l=a.value,e=n.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(l=e.textContent,e.innerHTML="");var h=t.createEditSession(l),u=new o(new c(e),h,i),d={document:h,editor:u,onResize:u.resize.bind(u,null)};return a&&(d.textarea=a),r.addListener(window,"resize",d.onResize),u.on("destroy",function(){r.removeListener(window,"resize",d.onResize),d.editor.container.env=null}),u.container.env=u.env=d,u},t.createEditSession=function(e,t){var i=new l(e,t);return i.setUndoManager(new a),i},t.Range=s,t.Editor=o,t.EditSession=l,t.UndoManager=a,t.VirtualRenderer=c,t.version="1.4.3"}),define("skylark-ace",["skylark-ace/main"],function(e){return e}),define("skylark-jotted/plugins/ace",["skylark-ace","../util"],function(e,t){"use strict";return class{constructor(i,n){var r;this.editor={},this.jotted=i,n=t.extend(n,{});var s=i.$container.querySelectorAll(".jotted-editor");for(r=0;r<s.length;r++){let i=s[r].querySelector("textarea"),o=t.data(i,"jotted-type"),l=t.data(i,"jotted-file"),a=document.createElement("div");s[r].appendChild(a),this.editor[o]=e.edit(a);let c=this.editor[o],h=t.extend(n);c.getSession().setMode("ace/mode/"+t.getMode(o,l)),c.getSession().setOptions(h),c.$blockScrolling=1/0}i.on("change",this.change.bind(this),1)}editorChange(e){return()=>{this.jotted.trigger("change",e)}}change(e,t){var i=this.editor[e.type];e.aceEditor||(i.getSession().setValue(e.content),e.aceEditor=i,i.on("change",this.editorChange(e))),e.content=i.getValue(),t(null,e)}}}),define("skylark-codemirror/cm",["skylark-langx/skylark"],function(e){var t=e.itg=e.itg||{};return t.cm={}}),define("skylark-codemirror/primitives/util/browser",[],function(){"use strict";let e=navigator.userAgent,t=navigator.platform,i=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),s=/Edge\/(\d+)/.exec(e),o=n||r||s,l=o&&(n?document.documentMode||6:+(s||r)[1]),a=!s&&/WebKit\//.test(e),c=a&&/Qt\/\d+\.\d+/.test(e),h=!s&&/Chrome\//.test(e),u=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),g=/PhantomJS/.test(e),p=!s&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=p||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=p||/Mac/.test(t),w=/\bCrOS\b/.test(e),b=/win/i.test(t),C=u&&e.match(/Version\/(\d*\.\d*)/);C&&(C=Number(C[1])),C&&C>=15&&(u=!1,a=!0);let k=y&&(c||u&&(null==C||C<12.11)),x=i||o&&l>=9;return{gecko:i,ie:o,ie_version:l,webkit:a,chrome:h,presto:u,safari:d,mac_geMountainLion:f,phantom:g,ios:p,android:m,mobile:v,mac:y,chromeOS:w,windows:b,flipCtrlCmd:k,captureRightClick:x}}),define("skylark-codemirror/primitives/util/dom",["./browser"],function(e){"use strict";function t(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}let i;function n(e){for(let t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function r(e,t,i,n){let 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(let e=0;e<t.length;++e)r.appendChild(t[e]);return r}i=document.createRange?function(e,t,i,n){let r=document.createRange();return r.setEnd(n||e,i),r.setStart(e,t),r}:function(e,t,i){let n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};let s=function(e){e.select()};return e.ios?s=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:e.ie&&(s=function(e){try{e.select()}catch(e){}}),{classTest:t,rmClass:function(e,i){let n=e.className,r=t(i).exec(n);if(r){let t=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(t?r[1]+t:"")}},removeChildren:n,removeChildrenAndAdd:function(e,t){return n(e).appendChild(t)},elt:r,eltP:function(e,t,i,n){let s=r(e,t,i,n);return s.setAttribute("role","presentation"),s},range:i,contains:function(e,t){3==t.nodeType&&(t=t.parentNode);if(e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)},activeElt:function(){let e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e},addClass:function(e,i){let n=e.className;t(i).test(n)||(e.className+=(n?" ":"")+i)},joinClasses:function(e,i){let n=e.split(" ");for(let e=0;e<n.length;e++)n[e]&&!t(n[e]).test(i)&&(i+=" "+n[e]);return i},selectInput:s}}),define("skylark-codemirror/primitives/util/misc",[],function(){"use strict";function e(e,t,i){t||(t={});for(let n in e)!e.hasOwnProperty(n)||!1===i&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}let t=[""];function i(e){return e[e.length-1]}function n(){}let r=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function s(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||r.test(e))}let o=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function l(e){return e.charCodeAt(0)>=768&&o.test(e)}return{bind:function(e){let t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}},copyObj:e,countColumn:function(e,t,i,n,r){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(let s=n||0,o=r||0;;){let n=e.indexOf("\t",s);if(n<0||n>=t)return o+(t-s);o+=n-s,o+=i-o%i,s=n+1}},Delayed:class{constructor(){this.id=null}set(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}},indexOf:function(e,t){for(let i=0;i<e.length;++i)if(e[i]==t)return i;return-1},scrollerGap:30,Pass:{toString:function(){return"CodeMirror.Pass"}},sel_dontScroll:{scroll:!1},sel_mouse:{origin:"*mouse"},sel_move:{origin:"+move"},findColumn:function(e,t,i){for(let n=0,r=0;;){let s=e.indexOf("\t",n);-1==s&&(s=e.length);let o=s-n;if(s==e.length||r+o>=t)return n+Math.min(o,t-r);if(r+=s-n,n=s+1,(r+=i-r%i)>=t)return n}},spaceStr:function(e){for(;t.length<=e;)t.push(i(t)+" ");return t[e]},lst:i,map:function(e,t){let i=[];for(let n=0;n<e.length;n++)i[n]=t(e[n],n);return i},insertSorted:function(e,t,i){let n=0,r=i(t);for(;n<e.length&&i(e[n])<=r;)n++;e.splice(n,0,t)},createObj:function(t,i){let r;Object.create?r=Object.create(t):(n.prototype=t,r=new n);i&&e(i,r);return r},isWordCharBasic:s,isWordChar:function(e,t){return t?!!(t.source.indexOf("\\w")>-1&&s(e))||t.test(e):s(e)},isEmpty:function(e){for(let t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0},isExtendingChar:l,skipExtendingChars:function(e,t,i){for(;(i<0?t>0:t<e.length)&&l(e.charAt(t));)t+=i;return t},findFirst:function(e,t,i){let n=t>i?-1:1;for(;;){if(t==i)return t;let r=(t+i)/2,s=n<0?Math.ceil(r):Math.floor(r);if(s==t)return e(s)?t:i;e(s)?i=s:t=s+n}}}}),define("skylark-codemirror/primitives/display/Display",["../util/browser","../util/dom","../util/misc"],function(e,t,i){"use strict";return{Display:function(n,r,s){let o=this;this.input=s,o.scrollbarFiller=t.elt("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=t.elt("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=t.eltP("div",null,"CodeMirror-code"),o.selectionDiv=t.elt("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=t.elt("div",null,"CodeMirror-cursors"),o.measure=t.elt("div",null,"CodeMirror-measure"),o.lineMeasure=t.elt("div",null,"CodeMirror-measure"),o.lineSpace=t.eltP("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");let l=t.eltP("div",[o.lineSpace],"CodeMirror-lines");o.mover=t.elt("div",[l],null,"position: relative"),o.sizer=t.elt("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=t.elt("div",null,null,"position: absolute; height: "+i.scrollerGap+"px; width: 1px;"),o.gutters=t.elt("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=t.elt("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=t.elt("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),e.ie&&e.ie_version<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0);e.webkit||e.gecko&&e.mobile||(o.scroller.draggable=!0);n&&(n.appendChild?n.appendChild(o.wrapper):n(o.wrapper));o.viewFrom=o.viewTo=r.first,o.reportedViewFrom=o.reportedViewTo=r.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,s.init(o)}}}),define("skylark-codemirror/primitives/line/utils_line",["../util/misc"],function(e){"use strict";return{getLine:function(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");let i=e;for(;!i.lines;)for(let e=0;;++e){let n=i.children[e],r=n.chunkSize();if(t<r){i=n;break}t-=r}return i.lines[t]},getBetween:function(e,t,i){let n=[],r=t.line;return e.iter(t.line,i.line+1,e=>{let 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},getLines:function(e,t,i){let n=[];return e.iter(t,i,e=>{n.push(e.text)}),n},updateLineHeight:function(e,t){let i=t-e.height;if(i)for(let t=e;t;t=t.parent)t.height+=i},lineNo:function(t){if(null==t.parent)return null;let i=t.parent,n=e.indexOf(i.lines,t);for(let e=i.parent;e;i=e,e=e.parent)for(let t=0;e.children[t]!=i;++t)n+=e.children[t].chunkSize();return n+i.first},lineAtHeight:function(e,t){let i=e.first;e:do{for(let n=0;n<e.children.length;++n){let r=e.children[n],s=r.height;if(t<s){e=r;continue e}t-=s,i+=r.chunkSize()}return i}while(!e.lines);let n=0;for(;n<e.lines.length;++n){let i=e.lines[n],r=i.height;if(t<r)break;t-=r}return i+n},isLine:function(e,t){return t>=e.first&&t<e.first+e.size},lineNumberFor:function(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}}}),define("skylark-codemirror/primitives/line/pos",["./utils_line"],function(e){"use strict";function t(e,i,n=null){if(!(this instanceof t))return new t(e,i,n);this.line=e,this.ch=i,this.sticky=n}function i(e,t){return e.line-t.line||e.ch-t.ch}function n(i,n){if(n.line<i.first)return t(i.first,0);let r=i.first+i.size-1;return n.line>r?t(r,e.getLine(i,r).text.length):function(e,i){let n=e.ch;return null==n||n>i?t(e.line,i):n<0?t(e.line,0):e}(n,e.getLine(i,n.line).text.length)}return{Pos:t,cmp:i,equalCursorPos:function(e,t){return e.sticky==t.sticky&&0==i(e,t)},copyPos:function(e){return t(e.line,e.ch)},maxPos:function(e,t){return i(e,t)<0?t:e},minPos:function(e,t){return i(e,t)<0?e:t},clipLine:function(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))},clipPos:n,clipPosArray:function(e,t){let i=[];for(let r=0;r<t.length;r++)i[r]=n(e,t[r]);return i}}}),define("skylark-codemirror/primitives/line/saw_special_spans",[],function(){"use strict";let e=!1,t=!1;return{sawReadOnlySpans:e,sawCollapsedSpans:t,seeReadOnlySpans:function(){e=!0},seeCollapsedSpans:function(){t=!0}}}),define("skylark-codemirror/primitives/line/spans",["../util/misc","./pos","./saw_special_spans","./utils_line"],function(e,t,i,n){"use strict";function r(e,t,i){this.marker=e,this.from=t,this.to=i}function s(e,t){if(e)for(let i=0;i<e.length;++i){let n=e[i];if(n.marker==t)return n}}function o(e){for(let t=0;t<e.length;++t){let i=e[t];null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function l(e){return e.inclusiveLeft?-1:0}function a(e){return e.inclusiveRight?1:0}function c(e,i){let n=e.lines.length-i.lines.length;if(0!=n)return n;let r=e.find(),s=i.find(),o=t.cmp(r.from,s.from)||l(e)-l(i);if(o)return-o;let c=t.cmp(r.to,s.to)||a(e)-a(i);return c||i.id-e.id}function h(e,t){let n,r=i.sawCollapsedSpans&&e.markedSpans;if(r)for(let e,i=0;i<r.length;++i)(e=r[i]).marker.collapsed&&null==(t?e.from:e.to)&&(!n||c(n,e.marker)<0)&&(n=e.marker);return n}function u(e){return h(e,!0)}function d(e){return h(e,!1)}function f(e){let t;for(;t=u(e);)e=t.find(-1,!0).line;return e}function g(e,t){let n=i.sawCollapsedSpans&&t.markedSpans;if(n)for(let i,r=0;r<n.length;++r)if((i=n[r]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&p(e,t,i))return!0}}function p(e,t,i){if(null==i.to){let t=i.marker.find(1,!0);return p(e,t.line,s(t.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(let n,r=0;r<t.markedSpans.length;++r)if((n=t.markedSpans[r]).marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(null==n.to||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&p(e,t,n))return!0}function m(e){if(0==e.height)return 0;let t,i=e.text.length,n=e;for(;t=u(n);){let e=t.find(0,!0);n=e.from.line,i+=e.from.ch-e.to.ch}for(n=e;t=d(n);){let e=t.find(0,!0);i-=n.text.length-e.from.ch,n=e.to.line,i+=n.text.length-e.to.ch}return i}return{MarkedSpan:r,getMarkedSpanFor:s,removeMarkedSpan:function(e,t){let i;for(let n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i},addMarkedSpan:function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)},stretchSpansOverChange:function(i,l){if(l.full)return null;let a=n.isLine(i,l.from.line)&&n.getLine(i,l.from.line).markedSpans,c=n.isLine(i,l.to.line)&&n.getLine(i,l.to.line).markedSpans;if(!a&&!c)return null;let h=l.from.ch,u=l.to.ch,d=0==t.cmp(l.from,l.to),f=function(e,t,i){let n;if(e)for(let s=0;s<e.length;++s){let o=e[s],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==l.type&&(!i||!o.marker.insertLeft)){let e=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new r(l,o.from,e?null:o.to))}}return n}(a,h,d),g=function(e,t,i){let n;if(e)for(let s=0;s<e.length;++s){let o=e[s],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!i||o.marker.insertLeft)){let e=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new r(l,e?null:o.from-t,null==o.to?null:o.to-t))}}return n}(c,u,d),p=1==l.text.length,m=e.lst(l.text).length+(p?h:0);if(f)for(let e=0;e<f.length;++e){let t=f[e];if(null==t.to){let e=s(g,t.marker);e?p&&(t.to=null==e.to?null:e.to+m):t.to=h}}if(g)for(let e=0;e<g.length;++e){let t=g[e];if(null!=t.to&&(t.to+=m),null==t.from){let e=s(f,t.marker);e||(t.from=m,p&&(f||(f=[])).push(t))}else t.from+=m,p&&(f||(f=[])).push(t)}f&&(f=o(f));g&&g!=f&&(g=o(g));let v=[f];if(!p){let e,t=l.text.length-2;if(t>0&&f)for(let t=0;t<f.length;++t)null==f[t].to&&(e||(e=[])).push(new r(f[t].marker,null,null));for(let i=0;i<t;++i)v.push(e);v.push(g)}return v},removeReadOnlyRanges:function(i,n,r){let s=null;if(i.iter(n.line,r.line+1,t=>{if(t.markedSpans)for(let i=0;i<t.markedSpans.length;++i){let n=t.markedSpans[i].marker;!n.readOnly||s&&-1!=e.indexOf(s,n)||(s||(s=[])).push(n)}}),!s)return null;let o=[{from:n,to:r}];for(let e=0;e<s.length;++e){let i=s[e],n=i.find(0);for(let e=0;e<o.length;++e){let r=o[e];if(t.cmp(r.to,n.from)<0||t.cmp(r.from,n.to)>0)continue;let s=[e,1],l=t.cmp(r.from,n.from),a=t.cmp(r.to,n.to);(l<0||!i.inclusiveLeft&&!l)&&s.push({from:r.from,to:n.from}),(a>0||!i.inclusiveRight&&!a)&&s.push({from:n.to,to:r.to}),o.splice.apply(o,s),e+=s.length-3}}return o},detachMarkedSpans:function(e){let t=e.markedSpans;if(!t)return;for(let i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null},attachMarkedSpans:function(e,t){if(!t)return;for(let i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t},compareCollapsedMarkers:c,collapsedSpanAtStart:u,collapsedSpanAtEnd:d,collapsedSpanAround:function(e,t){let n,r=i.sawCollapsedSpans&&e.markedSpans;if(r)for(let e=0;e<r.length;++e){let i=r[e];i.marker.collapsed&&(null==i.from||i.from<t)&&(null==i.to||i.to>t)&&(!n||c(n,i.marker)<0)&&(n=i.marker)}return n},conflictingCollapsedRange:function(e,r,s,o,c){let h=n.getLine(e,n.lineNo),u=i.sawCollapsedSpans&&h.markedSpans;if(u)for(let e=0;e<u.length;++e){let i=u[e];if(!i.marker.collapsed)continue;let n=i.marker.find(0),r=t.cmp(n.from,s)||l(i.marker)-l(c),h=t.cmp(n.to,o)||a(i.marker)-a(c);if(!(r>=0&&h<=0||r<=0&&h>=0)&&(r<=0&&(i.marker.inclusiveRight&&c.inclusiveLeft?t.cmp(n.to,s)>=0:t.cmp(n.to,s)>0)||r>=0&&(i.marker.inclusiveRight&&c.inclusiveLeft?t.cmp(n.from,o)<=0:t.cmp(n.from,o)<0)))return!0}},visualLine:f,visualLineEnd:function(e){let t;for(;t=d(e);)e=t.find(1,!0).line;return e},visualLineContinued:function(e){let t,i;for(;t=d(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i},visualLineNo:function(e,t){let i=n.getLine(e,t),r=f(i);return i==r?t:n.lineNo(r)},visualLineEndNo:function(e,t){if(t>e.lastLine())return t;let i,r=n.getLine(e,t);if(!g(e,r))return t;for(;i=d(r);)r=i.find(1,!0).line;return n.lineNo(r)+1},lineIsHidden:g,heightAtLine:function(e){let t=0,i=(e=f(e)).parent;for(let n=0;n<i.lines.length;++n){let r=i.lines[n];if(r==e)break;t+=r.height}for(let e=i.parent;e;e=(i=e).parent)for(let n=0;n<e.children.length;++n){let r=e.children[n];if(r==i)break;t+=r.height}return t},lineLength:m,findMaxLine:function(e){let t=e.display,i=e.doc;t.maxLine=n.getLine(i,i.first),t.maxLineLength=m(t.maxLine),t.maxLineChanged=!0,i.iter(e=>{let i=m(e);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)})}}}),define("skylark-codemirror/primitives/util/bidi",["./misc"],function(e){"use strict";let t=null;let i=function(){let t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(e){return e<=247?t.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?i.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}let r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function c(e,t,i){this.level=e,this.from=t,this.to=i}return function(t,i){let h="ltr"==i?"L":"R";if(0==t.length||"ltr"==i&&!r.test(t))return!1;let u=t.length,d=[];for(let e=0;e<u;++e)d.push(n(t.charCodeAt(e)));for(let e=0,t=h;e<u;++e){let i=d[e];"m"==i?d[e]=t:t=i}for(let e=0,t=h;e<u;++e){let i=d[e];"1"==i&&"r"==t?d[e]="n":o.test(i)&&(t=i,"r"==i&&(d[e]="R"))}for(let e=1,t=d[0];e<u-1;++e){let i=d[e];"+"==i&&"1"==t&&"1"==d[e+1]?d[e]="1":","!=i||t!=d[e+1]||"1"!=t&&"n"!=t||(d[e]=t),t=i}for(let e=0;e<u;++e){let t=d[e];if(","==t)d[e]="N";else if("%"==t){let t;for(t=e+1;t<u&&"%"==d[t];++t);let i=e&&"!"==d[e-1]||t<u&&"1"==d[t]?"1":"N";for(let n=e;n<t;++n)d[n]=i;e=t-1}}for(let e=0,t=h;e<u;++e){let i=d[e];"L"==t&&"1"==i?d[e]="L":o.test(i)&&(t=i)}for(let e=0;e<u;++e)if(s.test(d[e])){let t;for(t=e+1;t<u&&s.test(d[t]);++t);let i="L"==(e?d[e-1]:h),n="L"==(t<u?d[t]:h),r=i==n?i?"L":"R":h;for(let i=e;i<t;++i)d[i]=r;e=t-1}let f,g=[];for(let e=0;e<u;)if(l.test(d[e])){let t=e;for(++e;e<u&&l.test(d[e]);++e);g.push(new c(0,t,e))}else{let t=e,i=g.length;for(++e;e<u&&"L"!=d[e];++e);for(let n=t;n<e;)if(a.test(d[n])){t<n&&g.splice(i,0,new c(1,t,n));let r=n;for(++n;n<e&&a.test(d[n]);++n);g.splice(i,0,new c(2,r,n)),t=n}else++n;t<e&&g.splice(i,0,new c(1,t,e))}return"ltr"==i&&(1==g[0].level&&(f=t.match(/^\s+/))&&(g[0].from=f[0].length,g.unshift(new c(0,0,f[0].length))),1==e.lst(g).level&&(f=t.match(/\s+$/))&&(e.lst(g).to-=f[0].length,g.push(new c(0,u-f[0].length,u)))),"rtl"==i?g.reverse():g}}();return{iterateBidiSections:function(e,t,i,n){if(!e)return n(t,i,"ltr",0);let r=!1;for(let s=0;s<e.length;++s){let 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",s),r=!0)}r||n(t,i,"ltr")},bidiOther:t,getBidiPartAt:function(e,i,n){let r;t=null;for(let s=0;s<e.length;++s){let o=e[s];if(o.from<i&&o.to>i)return s;o.to==i&&(o.from!=o.to&&"before"==n?r=s:t=s),o.from==i&&(o.from!=o.to&&"before"!=n?r=s:t=s)}return null!=r?r:t},getOrder:function(e,t){let n=e.order;null==n&&(n=e.order=i(e.text,t));return n}}}),define("skylark-codemirror/primitives/util/event",["./browser","./misc"],function(e,t){"use strict";const i=[];let n=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{let r=e._handlers||(e._handlers={});r[t]=(r[t]||i).concat(n)}};function r(e,t){return e._handlers&&e._handlers[t]||i}function s(e,i,n){if(e.removeEventListener)e.removeEventListener(i,n,!1);else if(e.detachEvent)e.detachEvent("on"+i,n);else{let r=e._handlers,s=r&&r[i];if(s){let e=t.indexOf(s,n);e>-1&&(r[i]=s.slice(0,e).concat(s.slice(e+1)))}}}function o(e,t){let i=r(e,t);if(!i.length)return;let n=Array.prototype.slice.call(arguments,2);for(let e=0;e<i.length;++e)i[e].apply(null,n)}function l(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function a(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function c(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}return{on:n,getHandlers:r,off:s,signal:o,signalDOMEvent:function(e,t,i){"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}});return o(e,i||t.type,e,t),c(t)||t.codemirrorIgnore},signalCursorActivity:function(e){let i=e._handlers&&e._handlers.cursorActivity;if(!i)return;let n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(let e=0;e<i.length;++e)-1==t.indexOf(n,i[e])&&n.push(i[e])},hasHandler:function(e,t){return r(e,t).length>0},eventMixin:function(e){e.prototype.on=function(e,t){n(this,e,t)},e.prototype.off=function(e,t){s(this,e,t)}},e_preventDefault:l,e_stopPropagation:a,e_defaultPrevented:c,e_stop:function(e){l(e),a(e)},e_target:function(e){return e.target||e.srcElement},e_button:function(t){let i=t.which;null==i&&(1&t.button?i=1:2&t.button?i=3:4&t.button&&(i=2));e.mac&&t.ctrlKey&&1==i&&(i=3);return i}}}),define("skylark-codemirror/primitives/util/feature_detection",["./dom","./browser"],function(e,t){"use strict";let i,n,r=function(){if(t.ie&&t.ie_version<9)return!1;let i=e.elt("div");return"draggable"in i||"dragDrop"in i}();let s=3!="\n\nb".split(/\n/).length?e=>{let t=0,i=[],n=e.length;for(;t<=n;){let n=e.indexOf("\n",t);-1==n&&(n=e.length);let r=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),s=r.indexOf("\r");-1!=s?(i.push(r.slice(0,s)),t+=s+1):(i.push(r),t=n+1)}return i}:e=>e.split(/\r\n?|\n/),o=window.getSelection?e=>{try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:e=>{let t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},l=(()=>{let t=e.elt("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)})(),a=null;return{dragAndDrop:r,zeroWidthElement:function(n){if(null==i){let r=e.elt("span","​");e.removeChildrenAndAdd(n,e.elt("span",[r,document.createTextNode("x")])),0!=n.firstChild.offsetHeight&&(i=r.offsetWidth<=1&&r.offsetHeight>2&&!(t.ie&&t.ie_version<8))}let r=i?e.elt("span","​"):e.elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r},hasBadBidiRects:function(t){if(null!=n)return n;let i=e.removeChildrenAndAdd(t,document.createTextNode("AخA")),r=e.range(i,0,1).getBoundingClientRect(),s=e.range(i,1,2).getBoundingClientRect();return e.removeChildren(t),!(!r||r.left==r.right)&&(n=s.right-r.right<3)},splitLinesAuto:s,hasSelection:o,hasCopyEvent:l,hasBadZoomedRects:function(t){if(null!=a)return a;let i=e.removeChildrenAndAdd(t,e.elt("span","x")),n=i.getBoundingClientRect(),r=e.range(i,0,1).getBoundingClientRect();return a=Math.abs(n.left-r.left)>1}}}),define("skylark-codemirror/primitives/modes",["./util/misc"],function(e){"use strict";let t={},i={};function n(t){if("string"==typeof t&&i.hasOwnProperty(t))t=i[t];else if(t&&"string"==typeof t.name&&i.hasOwnProperty(t.name)){let n=i[t.name];"string"==typeof n&&(n={name:n}),(t=e.createObj(n,t)).name=n.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return n("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return n("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}let r={};return{modes:t,mimeModes:i,defineMode:function(e,i){arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2));t[e]=i},defineMIME:function(e,t){i[e]=t},resolveMode:n,getMode:function e(i,s){s=n(s);let o=t[s.name];if(!o)return e(i,"text/plain");let l=o(i,s);if(r.hasOwnProperty(s.name)){let e=r[s.name];for(let t in e)e.hasOwnProperty(t)&&(l.hasOwnProperty(t)&&(l["_"+t]=l[t]),l[t]=e[t])}l.name=s.name;s.helperType&&(l.helperType=s.helperType);if(s.modeProps)for(let e in s.modeProps)l[e]=s.modeProps[e];return l},modeExtensions:r,extendMode:function(t,i){let n=r.hasOwnProperty(t)?r[t]:r[t]={};e.copyObj(i,n)},copyState:function(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);let i={};for(let e in t){let n=t[e];n instanceof Array&&(n=n.concat([])),i[e]=n}return i},innerMode:function(e,t){let i;for(;e.innerMode&&(i=e.innerMode(t))&&i.mode!=e;)t=i.state,e=i.mode;return i||{mode:e,state:t}},startState:function(e,t,i){return!e.startState||e.startState(t,i)}}}),define("skylark-codemirror/primitives/util/StringStream",["./misc"],function(e){"use strict";return class{constructor(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i}eol(){return this.pos>=this.string.length}sol(){return this.pos==this.lineStart}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t,i=this.string.charAt(this.pos);if(t="string"==typeof e?i==e:i&&(e.test?e.test(i):e(i)))return++this.pos,i}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=e.countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?e.countColumn(this.string,this.lineStart,this.tabSize):0)}indentation(){return e.countColumn(this.string,null,this.tabSize)-(this.lineStart?e.countColumn(this.string,this.lineStart,this.tabSize):0)}match(e,t,i){if("string"!=typeof e){let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}{let n=e=>i?e.toLowerCase():e,r=this.string.substr(this.pos,e.length);if(n(r)==n(e))return!1!==t&&(this.pos+=e.length),!0}}current(){return this.string.slice(this.start,this.pos)}hideFirstChars(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}lookAhead(e){let t=this.lineOracle;return t&&t.lookAhead(e)}baseToken(){let e=this.lineOracle;return e&&e.baseToken(this.pos)}}}),define("skylark-codemirror/primitives/line/highlight",["../util/misc","../modes","../util/StringStream","./utils_line","./pos"],function(e,t,i,n,r){"use strict";class s{constructor(e,t){this.state=e,this.lookAhead=t}}class o{constructor(e,t,i,n){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1}lookAhead(e){let t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t}baseToken(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;let t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}}nextLine(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--}static fromSaved(e,i,n){return i instanceof s?new o(e,t.copyState(e.mode,i.state),n,i.lookAhead):new o(e,t.copyState(e.mode,i),n)}save(e){let i=!1!==e?t.copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new s(i,this.maxLookAhead):i}}function l(e,t,i,n){let r=[e.state.modeGen],s={};g(e,t.text,e.doc.mode,i,(e,t)=>r.push(e,t),s,n);let o=i.state;for(let n=0;n<e.state.overlays.length;++n){i.baseTokens=r;let l=e.state.overlays[n],a=1,c=0;i.state=!0,g(e,t.text,l.mode,i,(e,t)=>{let i=a;for(;c<e;){let t=r[a];t>e&&r.splice(a,1,e,r[a+1],t),a+=2,c=Math.min(e,t)}if(t)if(l.opaque)r.splice(i,a-i,e,"overlay "+t),a=i+2;else for(;i<a;i+=2){let e=r[i+1];r[i+1]=(e?e+" ":"")+"overlay "+t}},s),i.state=o,i.baseTokens=null,i.baseTokenPos=1}return{styles:r,classes:s.bgClass||s.textClass?s:null}}function a(i,r,l){let a=i.doc,h=i.display;if(!a.mode.startState)return new o(a,!0,r);let u=function(t,i,r){let o,l,a=t.doc,c=r?-1:i-(t.doc.mode.innerMode?1e3:100);for(let h=i;h>c;--h){if(h<=a.first)return a.first;let i=n.getLine(a,h-1),c=i.stateAfter;if(c&&(!r||h+(c instanceof s?c.lookAhead:0)<=a.modeFrontier))return h;let u=e.countColumn(i.text,null,t.options.tabSize);(null==l||o>u)&&(l=h-1,o=u)}return l}(i,r,l),d=u>a.first&&n.getLine(a,u-1).stateAfter,f=d?o.fromSaved(a,d,u):new o(a,t.startState(a.mode),u);return a.iter(u,r,e=>{c(i,e.text,f);let t=f.line;e.stateAfter=t==r-1||t%5==0||t>=h.viewFrom&&t<h.viewTo?f.save():null,f.nextLine()}),l&&(a.modeFrontier=f.line),f}function c(e,t,n,r){let s=e.doc.mode,o=new i(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&h(s,n.state);!o.eol();)u(s,o,n.state),o.start=o.pos}function h(e,i){if(e.blankLine)return e.blankLine(i);if(!e.innerMode)return;let n=t.innerMode(e,i);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}function u(e,i,n,r){for(let s=0;s<10;s++){r&&(r[0]=t.innerMode(e,n).mode);let s=e.token(i,n);if(i.pos>i.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}class d{constructor(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i}}function f(e,t){if(e)for(;;){let i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);let 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 g(e,t,n,r,s,o,l){let a=n.flattenSpans;null==a&&(a=e.options.flattenSpans);let d,g=0,p=null,m=new i(t,e.options.tabSize,r),v=e.options.addModeClass&&[null];for(""==t&&f(h(n,r.state),o);!m.eol();){if(m.pos>e.options.maxHighlightLength?(a=!1,l&&c(e,t,r,m.pos),m.pos=t.length,d=null):d=f(u(n,m,r.state,v),o),v){let e=v[0].name;e&&(d="m-"+(d?e+" "+d:e))}if(!a||p!=d){for(;g<m.start;)g=Math.min(m.start,g+5e3),s(g,p);p=d}m.start=m.pos}for(;g<m.pos;){let e=Math.min(m.pos,g+5e3);s(e,p),g=e}}return{highlightLine:l,getLineStyles:function(e,i,r){if(!i.styles||i.styles[0]!=e.state.modeGen){let s=a(e,n.lineNo(i)),o=i.text.length>e.options.maxHighlightLength&&t.copyState(e.doc.mode,s.state),c=l(e,i,s);o&&(s.state=o),i.stateAfter=s.save(!o),i.styles=c.styles,c.classes?i.styleClasses=c.classes:i.styleClasses&&(i.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return i.styles},getContextBefore:a,processLine:c,takeToken:function(e,s,o,l){let c,h=e.doc,f=h.mode;s=r.clipPos(h,s);let g,p=n.getLine(h,s.line),m=a(e,s.line,o),v=new i(p.text,e.options.tabSize,m);l&&(g=[]);for(;(l||v.pos<s.ch)&&!v.eol();)v.start=v.pos,c=u(f,v,m.state),l&&g.push(new d(v,c,t.copyState(h.mode,m.state)));return l?g:new d(v,c,m.state)},retreatFrontier:function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;let i=e.first;for(let r=t-1;r>i;r--){let o=n.getLine(e,r).stateAfter;if(o&&(!(o instanceof s)||r+o.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}}),define("skylark-codemirror/primitives/line/line_data",["../util/bidi","../util/browser","../util/dom","../util/event","../util/feature_detection","../util/misc","./highlight","./spans","./utils_line"],function(e,t,i,n,r,s,o,l,a){"use strict";class c{constructor(e,t,i){this.text=e,l.attachMarkedSpans(this,t),this.height=i?i(this):1}lineNo(){return a.lineNo(this)}}n.eventMixin(c);let h={},u={};function d(e,t){if(!e||/^\s*$/.test(e))return null;let i=t.addModeClass?u:h;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function f(e,n,r,o,l,a,c){if(!n)return;let h,u=e.splitSpaces?function(e,t){if(e.length>1&&!/  /.test(e))return e;let i=t,n="";for(let t=0;t<e.length;t++){let r=e.charAt(t);" "!=r||!i||t!=e.length-1&&32!=e.charCodeAt(t+1)||(r=" "),n+=r,i=" "==r}return n}(n,e.trailingSpace):n,d=e.cm.state.specialChars,f=!1;if(d.test(n)){h=document.createDocumentFragment();let r=0;for(;;){d.lastIndex=r;let o,l=d.exec(n),a=l?l.index-r:n.length-r;if(a){let n=document.createTextNode(u.slice(r,r+a));t.ie&&t.ie_version<9?h.appendChild(i.elt("span",[n])):h.appendChild(n),e.map.push(e.pos,e.pos+a,n),e.col+=a,e.pos+=a}if(!l)break;if(r+=a+1,"\t"==l[0]){let t=e.cm.options.tabSize,n=t-e.col%t;(o=h.appendChild(i.elt("span",s.spaceStr(n),"cm-tab"))).setAttribute("role","presentation"),o.setAttribute("cm-text","\t"),e.col+=n}else"\r"==l[0]||"\n"==l[0]?((o=h.appendChild(i.elt("span","\r"==l[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",l[0]),e.col+=1):((o=e.cm.options.specialCharPlaceholder(l[0])).setAttribute("cm-text",l[0]),t.ie&&t.ie_version<9?h.appendChild(i.elt("span",[o])):h.appendChild(o),e.col+=1);e.map.push(e.pos,e.pos+1,o),e.pos++}}else e.col+=n.length,h=document.createTextNode(u),e.map.push(e.pos,e.pos+n.length,h),t.ie&&t.ie_version<9&&(f=!0),e.pos+=n.length;if(e.trailingSpace=32==u.charCodeAt(n.length-1),r||o||l||f||a){let t=r||"";o&&(t+=o),l&&(t+=l);let n=i.elt("span",[h],t,a);if(c)for(let e in c)c.hasOwnProperty(e)&&"style"!=e&&"class"!=e&&n.setAttribute(e,c[e]);return e.content.appendChild(n)}e.content.appendChild(h)}function g(e,t){return(i,n,r,s,o,l,a)=>{r=r?r+" cm-force-border":"cm-force-border";let c=i.pos,h=c+n.length;for(;;){let u;for(let e=0;e<t.length&&!((u=t[e]).to>c&&u.from<=c);e++);if(u.to>=h)return e(i,n,r,s,o,l,a);e(i,n.slice(0,u.to-c),r,s,null,l,a),s=null,n=n.slice(u.to-c),c=u.to}}}function p(e,t,i,n){let 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,e.trailingSpace=!1}function m(e,t,i){let n=e.markedSpans,r=e.text,s=0;if(!n){for(let e=1;e<i.length;e+=2)t.addToken(t,r.slice(s,s=i[e]),d(i[e+1],t.cm.options));return}let o,l,a,c,h,u,f,g=r.length,m=0,v=1,y="",w=0;for(;;){if(w==m){a=c=h=l="",f=null,u=null,w=1/0;let e,i=[];for(let t=0;t<n.length;++t){let r=n[t],s=r.marker;if("bookmark"==s.type&&r.from==m&&s.widgetNode)i.push(s);else if(r.from<=m&&(null==r.to||r.to>m||s.collapsed&&r.to==m&&r.from==m)){if(null!=r.to&&r.to!=m&&w>r.to&&(w=r.to,c=""),s.className&&(a+=" "+s.className),s.css&&(l=(l?l+";":"")+s.css),s.startStyle&&r.from==m&&(h+=" "+s.startStyle),s.endStyle&&r.to==w&&(e||(e=[])).push(s.endStyle,r.to),s.title&&((f||(f={})).title=s.title),s.attributes)for(let e in s.attributes)(f||(f={}))[e]=s.attributes[e];s.collapsed&&(!u||n.compareCollapsedMarkers(u.marker,s)<0)&&(u=r)}else r.from>m&&w>r.from&&(w=r.from)}if(e)for(let t=0;t<e.length;t+=2)e[t+1]==w&&(c+=" "+e[t]);if(!u||u.from==m)for(let e=0;e<i.length;++e)p(t,0,i[e]);if(u&&(u.from||0)==m){if(p(t,(null==u.to?g+1:u.to)-m,u.marker,null==u.from),null==u.to)return;u.to==m&&(u=!1)}}if(m>=g)break;let e=Math.min(g,w);for(;;){if(y){let i=m+y.length;if(!u){let n=i>e?y.slice(0,e-m):y;t.addToken(t,n,o?o+a:a,h,m+n.length==w?c:"",l,f)}if(i>=e){y=y.slice(e-m),m=e;break}m=i,h=""}y=r.slice(s,s=i[v++]),o=d(i[v++],t.cm.options)}}}function v(e,t,i){this.line=t,this.rest=l.visualLineContinued(t),this.size=this.rest?a.lineNo(s.lst(this.rest))-i+1:1,this.node=this.text=null,this.hidden=l.lineIsHidden(e,t)}return{Line:c,updateLine:function(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null);e.styles&&(e.styles=null);null!=e.order&&(e.order=null);l.detachMarkedSpans(e),l.attachMarkedSpans(e,i);let r=n?n(e):1;r!=e.height&&a.updateLineHeight(e,r)},cleanUpLine:function(e){e.parent=null,l.detachMarkedSpans(e)},buildLineContent:function(s,l){let c=i.eltP("span",null,null,t.webkit?"padding-right: .1px":null),h={pre:i.eltP("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:s,trailingSpace:!1,splitSpaces:s.getOption("lineWrapping")};l.measure={};for(let t=0;t<=(l.rest?l.rest.length:0);t++){let n,c=t?l.rest[t-1]:l.line;h.pos=0,h.addToken=f,r.hasBadBidiRects(s.display.measure)&&(n=e.getOrder(c,s.doc.direction))&&(h.addToken=g(h.addToken,n)),h.map=[];let u=l!=s.display.externalMeasured&&a.lineNo(c);m(c,h,o.getLineStyles(s,c,u)),c.styleClasses&&(c.styleClasses.bgClass&&(h.bgClass=i.joinClasses(c.styleClasses.bgClass,h.bgClass||"")),c.styleClasses.textClass&&(h.textClass=i.joinClasses(c.styleClasses.textClass,h.textClass||""))),0==h.map.length&&h.map.push(0,0,h.content.appendChild(r.zeroWidthElement(s.display.measure))),0==t?(l.measure.map=h.map,l.measure.cache={}):((l.measure.maps||(l.measure.maps=[])).push(h.map),(l.measure.caches||(l.measure.caches=[])).push({}))}if(t.webkit){let e=h.content.lastChild;(/\bcm-tab\b/.test(e.className)||e.querySelector&&e.querySelector(".cm-tab"))&&(h.content.className="cm-tab-wrap-hack")}n.signal(s,"renderLine",s,l.line,h.pre),h.pre.className&&(h.textClass=i.joinClasses(h.pre.className,h.textClass||""));return h},defaultSpecialCharPlaceholder:function(e){let t=i.elt("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t},LineView:v,buildViewArray:function(e,t,i){let n,r=[];for(let s=t;s<i;s=n){let t=new v(e.doc,a.getLine(e.doc,s),s);n=s+t.size,r.push(t)}return r}}}),define("skylark-codemirror/primitives/util/operation_group",["./event"],function(e){"use strict";let t=null;let i=null;function n(){let e=i;i=null;for(let t=0;t<e.length;++t)e[t]()}return{pushOperation:function(e){t?t.ops.push(e):e.ownsGroup=t={ops:[e],delayedCallbacks:[]}},finishOperation:function(e,i){let n=e.ownsGroup;if(!n)return;try{!function(e){let t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(let t=0;t<e.ops.length;t++){let i=e.ops[t];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(i<t.length)}(n)}finally{t=null,i(n)}},signalLater:function(r,s){let o=e.getHandlers(r,s);if(!o.length)return;let l,a=Array.prototype.slice.call(arguments,2);t?l=t.delayedCallbacks:i?l=i:(l=i=[],setTimeout(n,0));for(let e=0;e<o.length;++e)l.push(()=>o[e].apply(null,a))}}}),define("skylark-codemirror/primitives/display/update_line",["../line/line_data","../line/utils_line","../util/browser","../util/dom","../util/operation_group"],function(e,t,i,n,r){"use strict";function s(e){return e.node==e.text&&(e.node=n.elt("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),i.ie&&i.ie_version<8&&(e.node.style.zIndex=2)),e.node}function o(t,i){let n=t.display.externalMeasured;return n&&n.line==i.line?(t.display.externalMeasured=null,i.measure=n.measure,n.built):e.buildLineContent(t,i)}function l(e,t){let i=t.text.className,n=o(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,a(e,t)):i&&(t.text.className=i)}function a(e,t){!function(e,t){let i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;i&&(i+=" CodeMirror-linebackground");if(t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){let r=s(t);t.background=r.insertBefore(n.elt("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?s(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");let i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function c(e,i,r,o){if(i.gutter&&(i.node.removeChild(i.gutter),i.gutter=null),i.gutterBackground&&(i.node.removeChild(i.gutterBackground),i.gutterBackground=null),i.line.gutterClass){let t=s(i);i.gutterBackground=n.elt("div",null,"CodeMirror-gutter-background "+i.line.gutterClass,`left: ${e.options.fixedGutter?o.fixedPos:-o.gutterTotalWidth}px; width: ${o.gutterTotalWidth}px`),e.display.input.setUneditable(i.gutterBackground),t.insertBefore(i.gutterBackground,i.text)}let l=i.line.gutterMarkers;if(e.options.lineNumbers||l){let a=s(i),c=i.gutter=n.elt("div",null,"CodeMirror-gutter-wrapper",`left: ${e.options.fixedGutter?o.fixedPos:-o.gutterTotalWidth}px`);if(e.display.input.setUneditable(c),a.insertBefore(c,i.text),i.line.gutterClass&&(c.className+=" "+i.line.gutterClass),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(i.lineNumber=c.appendChild(n.elt("div",t.lineNumberFor(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt",`left: ${o.gutterLeft["CodeMirror-linenumbers"]}px; width: ${e.display.lineNumInnerWidth}px`))),l)for(let t=0;t<e.options.gutters.length;++t){let i=e.options.gutters[t],r=l.hasOwnProperty(i)&&l[i];r&&c.appendChild(n.elt("div",[r],"CodeMirror-gutter-elt",`left: ${o.gutterLeft[i]}px; width: ${o.gutterWidth[i]}px`))}}}function h(e,t,i){t.alignable&&(t.alignable=null);for(let e,i=t.node.firstChild;i;i=e)e=i.nextSibling,"CodeMirror-linewidget"==i.className&&t.node.removeChild(i);u(e,t,i)}function u(e,t,i){if(d(e,t.line,t,i,!0),t.rest)for(let n=0;n<t.rest.length;n++)d(e,t.rest[n],t,i,!1)}function d(e,t,i,o,l){if(!t.widgets)return;let a=s(i);for(let s=0,c=t.widgets;s<c.length;++s){let t=c[s],h=n.elt("div",[t.node],"CodeMirror-linewidget");t.handleMouseEvents||h.setAttribute("cm-ignore-events","true"),f(t,h,i,o),e.display.input.setUneditable(h),l&&t.above?a.insertBefore(h,i.gutter||i.text):a.appendChild(h),r.signalLater(t,"redraw")}}function f(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);let 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"))}return{updateLineForChanges:function(e,t,i,n){for(let r=0;r<t.changes.length;r++){let s=t.changes[r];"text"==s?l(e,t):"gutter"==s?c(e,t,i,n):"class"==s?a(e,t):"widget"==s&&h(e,t,n)}t.changes=null},buildLineElement:function(e,t,i,n){let r=o(e,t);t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass);r.textClass&&(t.textClass=r.textClass);return a(e,t),c(e,t,i,n),u(e,t,n),t.node}}}),define("skylark-codemirror/primitives/measurement/widgets",["../util/dom","../util/event"],function(e,t){"use strict";return{widgetHeight:function(t){if(null!=t.height)return t.height;let i=t.doc.cm;if(!i)return 0;if(!e.contains(document.body,t.node)){let n="position: relative;";t.coverGutter&&(n+="margin-left: -"+i.display.gutters.offsetWidth+"px;"),t.noHScroll&&(n+="width: "+i.display.wrapper.clientWidth+"px;"),e.removeChildrenAndAdd(i.display.measure,e.elt("div",[t.node],null,n))}return t.height=t.node.parentNode.offsetHeight},eventInWidget:function(e,i){for(let n=t.e_target(i);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}}}),define("skylark-codemirror/primitives/measurement/position_measurement",["../line/line_data","../line/pos","../line/spans","../line/utils_line","../util/bidi","../util/browser","../util/dom","../util/event","../util/feature_detection","../util/misc","../display/update_line","./widgets"],function(e,t,i,n,r,s,o,l,a,c,h,u){"use strict";function d(e){return e.lineSpace.offsetTop}function f(e){if(e.cachedPaddingH)return e.cachedPaddingH;let t=o.removeChildrenAndAdd(e.measure,o.elt("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 g(e){return c.scrollerGap-e.display.nativeBarWidth}function p(e){return e.display.scroller.clientWidth-g(e)-e.display.barWidth}function m(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(let i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(let t=0;t<e.rest.length;t++)if(n.lineNo(e.rest[t])>i)return{map:e.measure.maps[t],cache:e.measure.caches[t],before:!0}}function v(e,t,i,n){return b(e,w(e,t),i,n)}function y(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[z(e,t)];let i=e.display.externalMeasured;return i&&t>=i.lineN&&t<i.lineN+i.size?i:void 0}function w(t,r){let s=n.lineNo(r),l=y(t,s);l&&!l.text?l=null:l&&l.changes&&(h.updateLineForChanges(t,l,s,N(t)),t.curOp.forceUpdate=!0),l||(l=function(t,r){r=i.visualLine(r);let s=n.lineNo(r),l=t.display.externalMeasured=new e.LineView(t.doc,r,s);l.lineN=s;let a=l.built=e.buildLineContent(t,l);return l.text=a.pre,o.removeChildrenAndAdd(t.display.lineMeasure,a.pre),l}(t,r));let a=m(l,r,s);return{line:r,view:l,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function b(e,t,i,n,r){t.before&&(i=-1);let l,h=i+(n||"");return t.cache.hasOwnProperty(h)?l=t.cache[h]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,i){let n=e.options.lineWrapping,r=n&&p(e);if(!t.measure.heights||n&&t.measure.width!=r){let e=t.measure.heights=[];if(n){t.measure.width=r;let n=t.text.firstChild.getClientRects();for(let t=0;t<n.length-1;t++){let r=n[t],s=n[t+1];Math.abs(r.bottom-s.bottom)>2&&e.push((r.bottom+s.top)/2-i.top)}}e.push(i.bottom-i.top)}}(e,t.view,t.rect),t.hasHeights=!0),(l=function(e,t,i,n){let r,l=x(t.map,i,n),h=l.node,u=l.start,d=l.end,f=l.collapse;if(3==h.nodeType){for(let e=0;e<4;e++){for(;u&&c.isExtendingChar(t.line.text.charAt(l.coverStart+u));)--u;for(;l.coverStart+d<l.coverEnd&&c.isExtendingChar(t.line.text.charAt(l.coverStart+d));)++d;if((r=s.ie&&s.ie_version<9&&0==u&&d==l.coverEnd-l.coverStart?h.parentNode.getBoundingClientRect():S(o.range(h,u,d).getClientRects(),n)).left||r.right||0==u)break;d=u,u-=1,f="right"}s.ie&&s.ie_version<11&&(r=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!a.hasBadZoomedRects(e))return t;let 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}}(e.display.measure,r))}else{let t;u>0&&(f=n="right"),r=e.options.lineWrapping&&(t=h.getClientRects()).length>1?t["right"==n?t.length-1:0]:h.getBoundingClientRect()}if(s.ie&&s.ie_version<9&&!u&&(!r||!r.left&&!r.right)){let t=h.parentNode.getClientRects()[0];r=t?{left:t.left,right:t.left+I(e.display),top:t.top,bottom:t.bottom}:k}let g=r.top-t.rect.top,p=r.bottom-t.rect.top,m=(g+p)/2,v=t.view.measure.heights,y=0;for(;y<v.length-1&&!(m<v[y]);y++);let w=y?v[y-1]:0,b=v[y],C={left:("right"==f?r.right:r.left)-t.rect.left,right:("left"==f?r.left:r.right)-t.rect.left,top:w,bottom:b};r.left||r.right||(C.bogus=!0);e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=p);return C}(e,t,i,n)).bogus||(t.cache[h]=l)),{left:l.left,right:l.right,top:r?l.rtop:l.top,bottom:r?l.rbottom:l.bottom}}let C,k={left:0,right:0,top:0,bottom:0};function x(e,t,i){let n,r,s,o,l,a;for(let c=0;c<e.length;c+=3)if(l=e[c],a=e[c+1],t<l?(r=0,s=1,o="left"):t<a?s=(r=t-l)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(r=(s=a-l)-1,t>=a&&(o="right")),null!=r){if(n=e[c+2],l==a&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],o="left";if("right"==i&&r==a-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],o="right";break}return{node:n,start:r,end:s,collapse:o,coverStart:l,coverEnd:a}}function S(e,t){let i=k;if("left"==t)for(let t=0;t<e.length&&(i=e[t]).left==i.right;t++);else for(let t=e.length-1;t>=0&&(i=e[t]).left==i.right;t--);return i}function $(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(let t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function L(e){e.display.externalMeasure=null,o.removeChildren(e.display.lineMeasure);for(let t=0;t<e.display.view.length;t++)$(e.display.view[t])}function A(){return s.chrome&&s.android?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function M(){return s.chrome&&s.android?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function T(e){let t=0;if(e.widgets)for(let i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=u.widgetHeight(e.widgets[i]));return t}function R(e,t,n,r,s){if(!s){let e=T(t);n.top+=e,n.bottom+=e}if("line"==r)return n;r||(r="local");let o=i.heightAtLine(t);if("local"==r?o+=d(e.display):o-=e.display.viewOffset,"page"==r||"window"==r){let t=e.display.lineSpace.getBoundingClientRect();o+=t.top+("window"==r?0:M());let i=t.left+("window"==r?0:A());n.left+=i,n.right+=i}return n.top+=o,n.bottom+=o,n}function _(e,t,i,s,o,l){function a(t,n){let r=b(e,o,t,n?"right":"left",l);return n?r.left=r.right:r.right=r.left,R(e,s,r,i)}s=s||n.getLine(e.doc,t.line),o||(o=w(e,s));let c=r.getOrder(s,e.doc.direction),h=t.ch,u=t.sticky;if(h>=s.text.length?(h=s.text.length,u="before"):h<=0&&(h=0,u="after"),!c)return a("before"==u?h-1:h,"before"==u);function d(e,t,i){let n=c[t],r=1==n.level;return a(i?e-1:e,r!=i)}let f=r.getBidiPartAt(c,h,u),g=r.bidiOther,p=d(h,f,"before"==u);return null!=g&&(p.other=d(h,g,"before"!=u)),p}function E(e,i,n,r,s){let o=t.Pos(e,i,n);return o.xRel=s,r&&(o.outside=!0),o}function O(e,t,r){let s=e.doc;if((r+=e.display.viewOffset)<0)return E(s.first,0,null,!0,-1);let o=n.lineAtHeight(s,r),l=s.first+s.size-1;if(o>l)return E(s.first+s.size-1,n.getLine(s,l).text.length,null,!0,1);t<0&&(t=0);let a=n.getLine(s,o);for(;;){let l=W(e,a,o,t,r),c=i.collapsedSpanAround(a,l.ch+(l.xRel>0?1:0));if(!c)return l;let h=c.find(1);if(h.line==o)return h;a=n.getLine(s,o=h.line)}}function F(e,t,i,n){n-=T(t);let r=t.text.length,s=c.findFirst(t=>b(e,i,t-1).bottom<=n,r,0);return r=c.findFirst(t=>b(e,i,t).top>n,s,r),{begin:s,end:r}}function D(e,t,i,n){return!(e.bottom<=i)&&(e.top>i||(n?e.left:e.right)>t)}function W(e,n,s,o,l){l-=i.heightAtLine(n);let a=w(e,n),h=T(n),d=0,f=n.text.length,g=!0,p=r.getOrder(n,e.doc.direction);if(p){let i=(e.options.lineWrapping?function(e,t,i,n,r,s,o){let{begin:l,end:a}=F(e,t,n,o);/\s/.test(t.text.charAt(a-1))&&a--;let c=null,h=null;for(let t=0;t<r.length;t++){let i=r[t];if(i.from>=a||i.to<=l)continue;let o=1!=i.level,u=b(e,n,o?Math.min(a,i.to)-1:Math.max(l,i.from)).right,d=u<s?s-u+1e9:u-s;(!c||h>d)&&(c=i,h=d)}c||(c=r[r.length-1]);c.from<l&&(c={from:l,to:c.to,level:c.level});c.to>a&&(c={from:c.from,to:a,level:c.level});return c}:function(e,i,n,r,s,o,l){let a=c.findFirst(a=>{let c=s[a],h=1!=c.level;return D(_(e,t.Pos(n,h?c.to:c.from,h?"before":"after"),"line",i,r),o,l,!0)},0,s.length-1),h=s[a];if(a>0){let c=1!=h.level,u=_(e,t.Pos(n,c?h.from:h.to,c?"after":"before"),"line",i,r);D(u,o,l,!0)&&u.top>l&&(h=s[a-1])}return h})(e,n,s,a,p,o,l);g=1!=i.level,d=g?i.from:i.to-1,f=g?i.to:i.from-1}let m,v,y=null,C=null,k=c.findFirst(t=>{let i=b(e,a,t);return i.top+=h,i.bottom+=h,!!D(i,o,l,!1)&&(i.top<=l&&i.left<=o&&(y=t,C=i),!0)},d,f),x=!1;if(C){let e=o-C.left<C.right-o,t=e==g;k=y+(t?0:1),v=t?"after":"before",m=e?C.left:C.right}else{g||k!=f&&k!=d||k++,v=0==k?"after":k==n.text.length?"before":b(e,a,k-(g?1:0)).bottom+u.widgetHeight<=l==g?"after":"before";let i=_(e,t.Pos(s,k,v),"line",n,a);m=i.left,x=l<i.top||l>=i.bottom}return k=c.skipExtendingChars(n.text,k,1),E(s,k,v,x,o-m)}function P(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==C){C=o.elt("pre");for(let e=0;e<49;++e)C.appendChild(document.createTextNode("x")),C.appendChild(o.elt("br"));C.appendChild(document.createTextNode("x"))}o.removeChildrenAndAdd(e.measure,C);let t=C.offsetHeight/50;return t>3&&(e.cachedTextHeight=t),o.removeChildren(e.measure),t||1}function I(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;let t=o.elt("span","xxxxxxxxxx"),i=o.elt("pre",[t]);o.removeChildrenAndAdd(e.measure,i);let n=t.getBoundingClientRect(),r=(n.right-n.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function N(e){let t=e.display,i={},n={},r=t.gutters.clientLeft;for(let 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:H(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function H(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function B(e){let t=P(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/I(e.display)-3);return s=>{if(i.lineIsHidden(e.doc,s))return 0;let o=0;if(s.widgets)for(let e=0;e<s.widgets.length;e++)s.widgets[e].height&&(o+=s.widgets[e].height);return n?o+(Math.ceil(s.text.length/r)||1)*t:o+t}}function z(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;let i=e.display.view;for(let e=0;e<i.length;e++)if((t-=i[e].size)<0)return e}return{paddingTop:d,paddingVert:function(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight},paddingH:f,scrollGap:g,displayWidth:p,displayHeight:function(e){return e.display.scroller.clientHeight-g(e)-e.display.barHeight},mapFromLineView:m,measureChar:v,findViewForLine:y,prepareMeasureForLine:w,measureCharPrepared:b,nodeAndOffsetInLineMap:x,clearLineMeasurementCacheFor:$,clearLineMeasurementCache:L,clearCaches:function(e){L(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0);e.display.lineNumChars=null},intoCoordSystem:R,fromCoordSystem:function(e,t,i){if("div"==i)return t;let n=t.left,r=t.top;if("page"==i)n-=A(),r-=M();else if("local"==i||!i){let t=e.display.sizer.getBoundingClientRect();n+=t.left,r+=t.top}let s=e.display.lineSpace.getBoundingClientRect();return{left:n-s.left,top:r-s.top}},charCoords:function(e,t,i,r,s){r||(r=n.getLine(e.doc,t.line));return R(e,r,v(e,r,t.ch,s),i)},cursorCoords:_,estimateCoords:function(e,r){let s=0;r=t.clipPos(e.doc,r),e.options.lineWrapping||(s=I(e.display)*r.ch);let o=n.getLine(e.doc,r.line),l=i.heightAtLine(o)+d(e.display);return{left:s,right:s,top:l,bottom:l+o.height}},coordsChar:O,wrappedLineExtentChar:function(e,t,i,n){i||(i=w(e,t));let r=R(e,t,b(e,i,n),"line").top;return F(e,t,i,r)},textHeight:P,charWidth:I,getDimensions:N,compensateForHScroll:H,estimateHeight:B,estimateLineHeights:function(e){let t=e.doc,i=B(e);t.iter(e=>{let t=i(e);t!=e.height&&n.updateLineHeight(e,t)})},posFromMouse:function(e,i,r,s){let o=e.display;if(!r&&"true"==l.e_target(i).getAttribute("cm-not-content"))return null;let a,h,u=o.lineSpace.getBoundingClientRect();try{a=i.clientX-u.left,h=i.clientY-u.top}catch(i){return null}let d,g=O(e,a,h);if(s&&1==g.xRel&&(d=n.getLine(e.doc,g.line).text).length==g.ch){let i=c.countColumn(d,d.length,e.options.tabSize)-d.length;g=t.Pos(g.line,Math.max(0,Math.round((a-f(e.display).left)/I(e.display))-i))}return g},findViewIndex:z}}),define("skylark-codemirror/primitives/display/selection",["../line/pos","../line/spans","../line/utils_line","../measurement/position_measurement","../util/bidi","../util/dom"],function(e,t,i,n,r,s){"use strict";function o(e,t,i){let r=n.cursorCoords(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=i.appendChild(s.elt("div"," ","CodeMirror-cursor"));if(o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){let e=i.appendChild(s.elt("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));e.style.display="",e.style.left=r.other.left+"px",e.style.top=r.other.top+"px",e.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function l(e,t){return e.top-t.top||e.left-t.left}function a(o,a,c){let h=o.display,u=o.doc,d=document.createDocumentFragment(),f=n.paddingH(o.display),g=f.left,p=Math.max(h.sizerWidth,n.displayWidth(o)-h.sizer.offsetLeft)-f.right,m="ltr"==u.direction;function v(e,t,i,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),d.appendChild(s.elt("div",null,"CodeMirror-selected",`position: absolute; left: ${e}px;\n                             top: ${t}px; width: ${null==i?p-e:i}px;\n                             height: ${n-t}px`))}function y(t,s,a){let c,h,d=i.getLine(u,t),f=d.text.length;function y(i,r){return n.charCoords(o,e.Pos(t,i),"div",d,r)}function w(e,t,i){let r=n.wrappedLineExtentChar(o,d,null,e),s="ltr"==t==("after"==i)?"left":"right",l="after"==i?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1);return y(l,s)[s]}let b=r.getOrder(d,u.direction);return r.iterateBidiSections(b,s||0,null==a?f:a,(e,t,i,n)=>{let r="ltr"==i,o=y(e,r?"left":"right"),u=y(t-1,r?"right":"left"),d=null==s&&0==e,C=null==a&&t==f,k=0==n,x=!b||n==b.length-1;if(u.top-o.top<=3){let e=(m?d:C)&&k,t=(m?C:d)&&x,i=e?g:(r?o:u).left,n=t?p:(r?u:o).right;v(i,o.top,n-i,o.bottom)}else{let n,s,l,a;r?(n=m&&d&&k?g:o.left,s=m?p:w(e,i,"before"),l=m?g:w(t,i,"after"),a=m&&C&&x?p:u.right):(n=m?w(e,i,"before"):g,s=!m&&d&&k?p:o.right,l=!m&&C&&x?g:u.left,a=m?w(t,i,"after"):p),v(n,o.top,s-n,o.bottom),o.bottom<u.top&&v(g,o.bottom,null,u.top),v(l,u.top,a-l,u.bottom)}(!c||l(o,c)<0)&&(c=o),l(u,c)<0&&(c=u),(!h||l(o,h)<0)&&(h=o),l(u,h)<0&&(h=u)}),{start:c,end:h}}let w=a.from(),b=a.to();if(w.line==b.line)y(w.line,w.ch,b.ch);else{let e=i.getLine(u,w.line),n=i.getLine(u,b.line),r=t.visualLine(e)==t.visualLine(n),s=y(w.line,w.ch,r?e.text.length+1:null).end,o=y(b.line,r?0:null,b.ch).start;r&&(s.top<o.top-2?(v(s.right,s.top,null,s.bottom),v(g,o.top,o.left,o.bottom)):v(s.right,s.top,o.left-s.right,s.bottom)),s.bottom<o.top&&v(g,s.bottom,null,o.top)}c.appendChild(d)}return{updateSelection:function(e){e.display.input.showSelection(e.display.input.prepareSelection())},prepareSelection:function(e,t=!0){let i=e.doc,n={},r=n.cursors=document.createDocumentFragment(),s=n.selection=document.createDocumentFragment();for(let n=0;n<i.sel.ranges.length;n++){if(!t&&n==i.sel.primIndex)continue;let l=i.sel.ranges[n];if(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)continue;let c=l.empty();(c||e.options.showCursorWhenSelecting)&&o(e,l.head,r),c||a(e,l,s)}return n},drawSelectionCursor:o,restartBlink:function(e){if(!e.state.focused)return;let t=e.display;clearInterval(t.blinker);let i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(()=>t.cursorDiv.style.visibility=(i=!i)?"":"hidden",e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}}),define("skylark-codemirror/primitives/display/focus",["./selection","../util/browser","../util/dom","../util/event"],function(e,t,i,n){"use strict";function r(r,s){r.state.delayingBlurEvent&&(r.state.delayingBlurEvent=!1),"nocursor"!=r.options.readOnly&&(r.state.focused||(n.signal(r,"focus",r,s),r.state.focused=!0,i.addClass(r.display.wrapper,"CodeMirror-focused"),r.curOp||r.display.selForContextMenu==r.doc.sel||(r.display.input.reset(),t.webkit&&setTimeout(()=>r.display.input.reset(!0),20)),r.display.input.receivedFocus()),e.restartBlink(r))}function s(e,t){e.state.delayingBlurEvent||(e.state.focused&&(n.signal(e,"blur",e,t),e.state.focused=!1,i.rmClass(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(()=>{e.state.focused||(e.display.shift=!1)},150))}return{ensureFocus:function(e){e.state.focused||(e.display.input.focus(),r(e))},delayBlurEvent:function(e){e.state.delayingBlurEvent=!0,setTimeout(()=>{e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,s(e))},100)},onFocus:r,onBlur:s}}),define("skylark-codemirror/primitives/display/update_lines",["../line/spans","../line/utils_line","../measurement/position_measurement","../util/browser"],function(e,t,i,n){"use strict";function r(e){if(e.widgets)for(let t=0;t<e.widgets.length;++t){let i=e.widgets[t],n=i.node.parentNode;n&&(i.height=n.offsetHeight)}}return{updateHeightsInViewport:function(e){let s=e.display,o=s.lineDiv.offsetTop;for(let l=0;l<s.view.length;l++){let a,c=s.view[l],h=e.options.lineWrapping,u=0;if(c.hidden)continue;if(n.ie&&n.ie_version<8){let e=c.node.offsetTop+c.node.offsetHeight;a=e-o,o=e}else{let e=c.node.getBoundingClientRect();a=e.bottom-e.top,!h&&c.text.firstChild&&(u=c.text.firstChild.getBoundingClientRect().right-e.left-1)}let d=c.line.height-a;if((d>.005||d<-.005)&&(t.updateLineHeight(c.line,a),r(c.line),c.rest))for(let e=0;e<c.rest.length;e++)r(c.rest[e]);if(u>e.display.sizerWidth){let t=Math.ceil(u/i.charWidth(e.display));t>e.display.maxLineLength&&(e.display.maxLineLength=t,e.display.maxLine=c.line,e.display.maxLineChanged=!0)}}},visibleLines:function(n,r,s){let o=s&&null!=s.top?Math.max(0,s.top):n.scroller.scrollTop;o=Math.floor(o-i.paddingTop(n));let l=s&&null!=s.bottom?s.bottom:o+n.wrapper.clientHeight,a=t.lineAtHeight(r,o),c=t.lineAtHeight(r,l);if(s&&s.ensure){let i=s.ensure.from.line,o=s.ensure.to.line;i<a?(a=i,c=t.lineAtHeight(r,e.heightAtLine(t.getLine(r,i))+n.wrapper.clientHeight)):Math.min(o,r.lastLine())>=c&&(a=t.lineAtHeight(r,e.heightAtLine(t.getLine(r,o))-n.wrapper.clientHeight),c=o)}return{from:a,to:Math.max(c,a+1)}}}}),define("skylark-codemirror/primitives/display/view_tracking",["../line/line_data","../line/saw_special_spans","../line/spans","../measurement/position_measurement","../util/misc"],function(e,t,i,n,r){"use strict";function s(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function o(e,r,s,o){let l,a=n.findViewIndex(e,r),c=e.display.view;if(!t.sawCollapsedSpans||s==e.doc.first+e.doc.size)return{index:a,lineN:s};let h=e.display.viewFrom;for(let e=0;e<a;e++)h+=c[e].size;if(h!=r){if(o>0){if(a==c.length-1)return null;l=h+c[a].size-r,a++}else l=h-r;r+=l,s+=l}for(;i.visualLineNo(e.doc,s)!=s;){if(a==(o<0?0:c.length-1))return null;s+=o*c[a-(o<0?1:0)].size,a+=o}return{index:a,lineN:s}}return{regChange:function(n,r,l,a){null==r&&(r=n.doc.first);null==l&&(l=n.doc.first+n.doc.size);a||(a=0);let c=n.display;a&&l<c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>r)&&(c.updateLineNumbers=r);if(n.curOp.viewChanged=!0,r>=c.viewTo)t.sawCollapsedSpans&&i.visualLineNo(n.doc,r)<c.viewTo&&s(n);else if(l<=c.viewFrom)t.sawCollapsedSpans&&i.visualLineEndNo(n.doc,l+a)>c.viewFrom?s(n):(c.viewFrom+=a,c.viewTo+=a);else if(r<=c.viewFrom&&l>=c.viewTo)s(n);else if(r<=c.viewFrom){let e=o(n,l,l+a,1);e?(c.view=c.view.slice(e.index),c.viewFrom=e.lineN,c.viewTo+=a):s(n)}else if(l>=c.viewTo){let e=o(n,r,r,-1);e?(c.view=c.view.slice(0,e.index),c.viewTo=e.lineN):s(n)}else{let t=o(n,r,r,-1),i=o(n,l,l+a,1);t&&i?(c.view=c.view.slice(0,t.index).concat(e.buildViewArray(n,t.lineN,i.lineN)).concat(c.view.slice(i.index)),c.viewTo+=a):s(n)}let h=c.externalMeasured;h&&(l<h.lineN?h.lineN+=a:r<h.lineN+h.size&&(c.externalMeasured=null))},regLineChange:function(e,t,i){e.curOp.viewChanged=!0;let s=e.display,o=e.display.externalMeasured;o&&t>=o.lineN&&t<o.lineN+o.size&&(s.externalMeasured=null);if(t<s.viewFrom||t>=s.viewTo)return;let l=s.view[n.findViewIndex(e,t)];if(null==l.node)return;let a=l.changes||(l.changes=[]);-1==r.indexOf(a,i)&&a.push(i)},resetView:s,adjustView:function(t,i,r){let s=t.display;0==s.view.length||i>=s.viewTo||r<=s.viewFrom?(s.view=e.buildViewArray(t,i,r),s.viewFrom=i):(s.viewFrom>i?s.view=e.buildViewArray(t,i,s.viewFrom).concat(s.view):s.viewFrom<i&&(s.view=s.view.slice(n.findViewIndex(t,i))),s.viewFrom=i,s.viewTo<r?s.view=s.view.concat(e.buildViewArray(t,s.viewTo,r)):s.viewTo>r&&(s.view=s.view.slice(0,n.findViewIndex(t,r))));s.viewTo=r},countDirtyView:function(e){let t=e.display.view,i=0;for(let e=0;e<t.length;e++){let n=t[e];n.hidden||n.node&&!n.changes||++i}return i}}}),define("skylark-codemirror/primitives/display/update_display",["../line/saw_special_spans","../line/spans","../line/utils_line","../measurement/position_measurement","../util/browser","../util/dom","../util/event","../util/misc","./update_line","./selection","./update_lines","./view_tracking"],function(e,t,i,n,r,s,o,l,a,c,h,u){"use strict";class d{constructor(e,t,i){let r=e.display;this.viewport=t,this.visible=h.visibleLines(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=n.displayWidth(e),this.force=i,this.dims=n.getDimensions(e),this.events=[]}signal(e,t){o.hasHandler(e,t)&&this.events.push(arguments)}finish(){for(let e=0;e<this.events.length;e++)o.signal.apply(null,this.events[e])}}function f(o,c){let h=o.display,d=o.doc;if(c.editorIsHidden)return u.resetView(o),!1;if(!c.force&&c.visible.from>=h.viewFrom&&c.visible.to<=h.viewTo&&(null==h.updateLineNumbers||h.updateLineNumbers>=h.viewTo)&&h.renderedView==h.view&&0==u.countDirtyView(o))return!1;o.maybeUpdateLineNumberWidth()&&(u.resetView(o),c.dims=n.getDimensions(o));let f=d.first+d.size,g=Math.max(c.visible.from-o.options.viewportMargin,d.first),p=Math.min(f,c.visible.to+o.options.viewportMargin);h.viewFrom<g&&g-h.viewFrom<20&&(g=Math.max(d.first,h.viewFrom)),h.viewTo>p&&h.viewTo-p<20&&(p=Math.min(f,h.viewTo)),e.sawCollapsedSpans&&(g=t.visualLineNo(o.doc,g),p=t.visualLineEndNo(o.doc,p));let m=g!=h.viewFrom||p!=h.viewTo||h.lastWrapHeight!=c.wrapperHeight||h.lastWrapWidth!=c.wrapperWidth;u.adjustView(o,g,p),h.viewOffset=t.heightAtLine(i.getLine(o.doc,h.viewFrom)),o.display.mover.style.top=h.viewOffset+"px";let v=u.countDirtyView(o);if(!m&&0==v&&!c.force&&h.renderedView==h.view&&(null==h.updateLineNumbers||h.updateLineNumbers>=h.viewTo))return!1;let y=function(e){if(e.hasFocus())return null;let t=s.activeElt();if(!t||!s.contains(e.display.lineDiv,t))return null;let i={activeElt:t};if(window.getSelection){let t=window.getSelection();t.anchorNode&&t.extend&&s.contains(e.display.lineDiv,t.anchorNode)&&(i.anchorNode=t.anchorNode,i.anchorOffset=t.anchorOffset,i.focusNode=t.focusNode,i.focusOffset=t.focusOffset)}return i}(o);return v>4&&(h.lineDiv.style.display="none"),function(e,t,n){let o=e.display,c=e.options.lineNumbers,h=o.lineDiv,u=h.firstChild;function d(t){let i=t.nextSibling;return r.webkit&&r.mac&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}let f=o.view,g=o.viewFrom;for(let r=0;r<f.length;r++){let o=f[r];if(o.hidden);else if(o.node&&o.node.parentNode==h){for(;u!=o.node;)u=d(u);let r=c&&null!=t&&t<=g&&o.lineNumber;o.changes&&(l.indexOf(o.changes,"gutter")>-1&&(r=!1),a.updateLineForChanges(e,o,g,n)),r&&(s.removeChildren(o.lineNumber),o.lineNumber.appendChild(document.createTextNode(i.lineNumberFor(e.options,g)))),u=o.node.nextSibling}else{let t=a.buildLineElement(e,o,g,n);h.insertBefore(t,u)}g+=o.size}for(;u;)u=d(u)}(o,h.updateLineNumbers,c.dims),v>4&&(h.lineDiv.style.display=""),h.renderedView=h.view,function(e){if(!e||!e.activeElt||e.activeElt==s.activeElt())return;if(e.activeElt.focus(),e.anchorNode&&s.contains(document.body,e.anchorNode)&&s.contains(document.body,e.focusNode)){let t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}(y),s.removeChildren(h.cursorDiv),s.removeChildren(h.selectionDiv),h.gutters.style.height=h.sizer.style.minHeight=0,m&&(h.lastWrapHeight=c.wrapperHeight,h.lastWrapWidth=c.wrapperWidth,o.startWorker(400)),h.updateLineNumbers=null,!0}function g(e,t){let i=t.viewport;for(let r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=n.displayWidth(e)||(i&&null!=i.top&&(i={top:Math.min(e.doc.height+n.paddingVert(e.display)-n.displayHeight(e),i.top)}),t.visible=h.visibleLines(e.display,e.doc,i),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&f(e,t);r=!1){h.updateHeightsInViewport(e);let i=e.measureForScrollbars();c.updateSelection(e),e.updateScrollbars(i),p(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function p(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+n.scrollGap(e)+"px"}return{DisplayUpdate:d,maybeClipScrollbars:function(e){let t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=n.scrollGap(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=n.scrollGap(e)+"px",t.scrollbarsClipped=!0)},updateDisplayIfNeeded:f,postUpdateDisplay:g,updateDisplaySimple:function(e,t){let i=new d(e,t);if(f(e,i)){h.updateHeightsInViewport(e),g(e,i);let t=e.measureForScrollbars();c.updateSelection(e),e.updateScrollbars(t),p(e,t),i.finish()}},updateGutterSpace:function(e){let t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"},setDocumentHeight:p}}),define("skylark-codemirror/primitives/display/gutters",["../util/dom","../util/misc","./update_display"],function(e,t,i){"use strict";return{updateGutters:function(t){let n=t.display.gutters,r=t.options.gutters;e.removeChildren(n);let s=0;for(;s<r.length;++s){let i=r[s],o=n.appendChild(e.elt("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(t.display.lineGutter=o,o.style.width=(t.display.lineNumWidth||1)+"px")}n.style.display=s?"":"none",i.updateGutterSpace(t)},setGuttersForLineNumbers:function(e){let i=t.indexOf(e.gutters,"CodeMirror-linenumbers");-1==i&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):i>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(i,1))}}}),define("skylark-codemirror/primitives/display/line_numbers",["../line/utils_line","../measurement/position_measurement","../util/dom","./update_display"],function(e,t,i,n){"use strict";return{alignHorizontally:function(e){let i=e.display,n=i.view;if(!(i.alignWidgets||i.gutters.firstChild&&e.options.fixedGutter))return;let r=t.compensateForHScroll(i)-i.scroller.scrollLeft+e.doc.scrollLeft,s=i.gutters.offsetWidth,o=r+"px";for(let t=0;t<n.length;t++)if(!n[t].hidden){e.options.fixedGutter&&(n[t].gutter&&(n[t].gutter.style.left=o),n[t].gutterBackground&&(n[t].gutterBackground.style.left=o));let i=n[t].alignable;if(i)for(let e=0;e<i.length;e++)i[e].style.left=o}e.options.fixedGutter&&(i.gutters.style.left=r+s+"px")},maybeUpdateLineNumberWidth:function(t){if(!t.options.lineNumbers)return!1;let r=t.doc,s=e.lineNumberFor(t.options,r.first+r.size-1),o=t.display;if(s.length!=o.lineNumChars){let e=o.measure.appendChild(i.elt("div",[i.elt("div",s)],"CodeMirror-linenumber CodeMirror-gutter-elt")),r=e.firstChild.offsetWidth,l=e.offsetWidth-r;return o.lineGutter.style.width="",o.lineNumInnerWidth=Math.max(r,o.lineGutter.offsetWidth-l)+1,o.lineNumWidth=o.lineNumInnerWidth+l,o.lineNumChars=o.lineNumInnerWidth?s.length:-1,o.lineGutter.style.width=o.lineNumWidth+"px",n.updateGutterSpace(t),!0}return!1}}}),define("skylark-codemirror/primitives/display/scrolling",["../line/pos","../measurement/position_measurement","../util/browser","../util/dom","../util/event","./line_numbers","./update_display"],function(e,t,i,n,r,s,o){"use strict";function l(e,i){let n=e.display,r=t.textHeight(e.display);i.top<0&&(i.top=0);let s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=t.displayHeight(e),l={};i.bottom-i.top>o&&(i.bottom=i.top+o);let a=e.doc.height+t.paddingVert(n),c=i.top<r,h=i.bottom>a-r;if(i.top<s)l.scrollTop=c?0:i.top;else if(i.bottom>s+o){let e=Math.min(i.top,(h?a:i.bottom)-o);e!=s&&(l.scrollTop=e)}let u=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,d=t.displayWidth(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),f=i.right-i.left>d;return f&&(i.right=i.left+d),i.left<10?l.scrollLeft=0:i.left<u?l.scrollLeft=Math.max(0,i.left-(f?0:10)):i.right>d+u-3&&(l.scrollLeft=i.right+(f?0:10)-d),l}function a(e,t,i){null==t&&null==i||c(e),null!=t&&(e.curOp.scrollLeft=t),null!=i&&(e.curOp.scrollTop=i)}function c(e){let i=e.curOp.scrollToPos;if(i){e.curOp.scrollToPos=null;let n=t.estimateCoords(e,i.from),r=t.estimateCoords(e,i.to);h(e,n,r,i.margin)}}function h(e,t,i,n){let r=l(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});a(e,r.scrollLeft,r.scrollTop)}function u(e,t){Math.abs(e.doc.scrollTop-t)<2||(i.gecko||o.updateDisplaySimple(e,{top:t}),d(e,t,!0),i.gecko&&o.updateDisplaySimple(e),e.startWorker(e,100))}function d(e,t,i){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function f(e,t,i,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,s.alignHorizontally(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}return{maybeScrollWindow:function(e,s){if(r.signalDOMEvent(e,"scrollCursorIntoView"))return;let o=e.display,l=o.sizer.getBoundingClientRect(),a=null;s.top+l.top<0?a=!0:s.bottom+l.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1);if(null!=a&&!i.phantom){let i=n.elt("div","​",null,`position: absolute;\n                         top: ${s.top-o.viewOffset-t.paddingTop(e.display)}px;\n                         height: ${s.bottom-s.top+t.scrollGap(e)+o.barHeight}px;\n                         left: ${s.left}px; width: ${Math.max(2,s.right-s.left)}px;`);e.display.lineSpace.appendChild(i),i.scrollIntoView(a),e.display.lineSpace.removeChild(i)}},scrollPosIntoView:function(i,n,r,s){null==s&&(s=0);let o;i.options.lineWrapping||n!=r||(n=n.ch?e.Pos(n.line,"before"==n.sticky?n.ch-1:n.ch,"after"):n,r="before"==n.sticky?e.Pos(n.line,n.ch+1,"before"):n);for(let e=0;e<5;e++){let e=!1,a=t.cursorCoords(i,n),c=r&&r!=n?t.cursorCoords(i,r):a;o={left:Math.min(a.left,c.left),top:Math.min(a.top,c.top)-s,right:Math.max(a.left,c.left),bottom:Math.max(a.bottom,c.bottom)+s};let h=l(i,o),d=i.doc.scrollTop,g=i.doc.scrollLeft;if(null!=h.scrollTop&&(u(i,h.scrollTop),Math.abs(i.doc.scrollTop-d)>1&&(e=!0)),null!=h.scrollLeft&&(f(i,h.scrollLeft),Math.abs(i.doc.scrollLeft-g)>1&&(e=!0)),!e)break}return o},scrollIntoView:function(e,t){let i=l(e,t);null!=i.scrollTop&&u(e,i.scrollTop);null!=i.scrollLeft&&f(e,i.scrollLeft)},addToScrollTop:function(e,t){if(null==t)return;c(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t},ensureCursorVisible:function(e){c(e);let t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}},scrollToCoords:a,scrollToRange:function(e,t){c(e),e.curOp.scrollToPos=t},scrollToCoordsRange:h,updateScrollTop:u,setScrollTop:d,setScrollLeft:f}}),define("skylark-codemirror/primitives/display/scrollbars",["../util/dom","../util/event","../measurement/position_measurement","../util/browser","./update_lines","../util/misc","./scrolling"],function(e,t,i,n,r,s,o){"use strict";function l(e){let t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+i.paddingVert(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+i.scrollGap(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function a(e,t){let 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",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",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=""}let c={native:class{constructor(i,r,s){this.cm=s;let o=this.vert=e.elt("div",[e.elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),l=this.horiz=e.elt("div",[e.elt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");o.tabIndex=l.tabIndex=-1,i(o),i(l),t.on(o,"scroll",()=>{o.clientHeight&&r(o.scrollTop,"vertical")}),t.on(l,"scroll",()=>{l.clientWidth&&r(l.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,n.ie&&n.ie_version<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}update(e){let 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";let i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";let t=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:t?n:0}}setScrollLeft(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}setScrollTop(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}zeroWidthHack(){let e=n.mac&&!n.mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new s.Delayed,this.disableVert=new s.Delayed}enableZeroWidthBar(e,t,i){e.style.pointerEvents="auto",t.set(1e3,function n(){let r=e.getBoundingClientRect();let s="vert"==i?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);s!=e?e.style.pointerEvents="none":t.set(1e3,n)})}clear(){let e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},null:class{update(){return{bottom:0,right:0}}setScrollLeft(){}setScrollTop(){}clear(){}}};return{measureForScrollbars:l,updateScrollbars:function(e,t){t||(t=l(e));let i=e.display.barWidth,n=e.display.barHeight;a(e,t);for(let t=0;t<4&&i!=e.display.barWidth||n!=e.display.barHeight;t++)i!=e.display.barWidth&&e.options.lineWrapping&&r.updateHeightsInViewport(e),a(e,l(e)),i=e.display.barWidth,n=e.display.barHeight},scrollbarModel:c,initScrollbars:function(i){i.display.scrollbars&&(i.display.scrollbars.clear(),i.display.scrollbars.undefined&&e.rmClass(i.display.wrapper,i.display.scrollbars.undefined));i.display.scrollbars=new c[i.options.scrollbarStyle](e=>{i.display.wrapper.insertBefore(e,i.display.scrollbarFiller),t.on(e,"mousedown",()=>{i.state.focused&&setTimeout(()=>i.display.input.focus(),0)}),e.setAttribute("cm-not-content","true")},(e,t)=>{"horizontal"==t?o.setScrollLeft(i,e):o.updateScrollTop(i,e)},i),i.display.scrollbars.undefined&&e.addClass(i.display.wrapper,i.display.scrollbars.undefined)}}}),define("skylark-codemirror/primitives/display/operations",["../line/pos","../line/spans","../measurement/position_measurement","../util/event","../util/dom","../util/operation_group","./focus","./scrollbars","./selection","./scrolling","./update_display","./update_lines"],function(e,t,i,n,r,s,o,l,a,c,h,u){"use strict";let d=0;function f(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++d},s.pushOperation(e.curOp)}function g(e){let t=e.curOp;t&&s.finishOperation(t,e=>{for(let t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){let t=e.ops;for(let e=0;e<t.length;e++)p(t[e]);for(let e=0;e<t.length;e++)i=t[e],i.updatedDisplay=i.mustUpdate&&h.updateDisplayIfNeeded(i.cm,i.update);var i;for(let e=0;e<t.length;e++)m(t[e]);for(let e=0;e<t.length;e++)v(t[e]);for(let e=0;e<t.length;e++)y(t[e])}(e)})}function p(e){let i=e.cm,n=i.display;h.maybeClipScrollbars(i),e.updateMaxLine&&t.findMaxLine(i),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&i.options.lineWrapping,e.update=e.mustUpdate&&new h.DisplayUpdate(i,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function m(e){let t=e.cm,n=t.display;e.updatedDisplay&&u.updateHeightsInViewport(t),e.barMeasure=l.measureForScrollbars(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=i.measureChar(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+i.scrollGap(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-i.displayWidth(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function v(e){let t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&c.setScrollLeft(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);let i=e.focus&&e.focus==r.activeElt();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&l.updateScrollbars(t,e.barMeasure),e.updatedDisplay&&h.setDocumentHeight(t,e.barMeasure),e.selectionChanged&&a.restartBlink(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&o.ensureFocus(e.cm)}function y(t){let i=t.cm,r=i.display,s=i.doc;if(t.updatedDisplay&&h.postUpdateDisplay(i,t.update),null==r.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=t.scrollTop&&c.setScrollTop(i,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&c.setScrollLeft(i,t.scrollLeft,!0,!0),t.scrollToPos){let n=c.scrollPosIntoView(i,e.clipPos(s,t.scrollToPos.from),e.clipPos(s,t.scrollToPos.to),t.scrollToPos.margin);c.maybeScrollWindow(i,n)}let o=t.maybeHiddenMarkers,l=t.maybeUnhiddenMarkers;if(o)for(let e=0;e<o.length;++e)o[e].lines.length||n.signal(o[e],"hide");if(l)for(let e=0;e<l.length;++e)l[e].lines.length&&n.signal(l[e],"unhide");r.wrapper.offsetHeight&&(s.scrollTop=i.display.scroller.scrollTop),t.changeObjs&&n.signal(i,"changes",i,t.changeObjs),t.update&&t.update.finish()}return{startOperation:f,endOperation:g,runInOp:function(e,t){if(e.curOp)return t();f(e);try{return t()}finally{g(e)}},operation:function(e,t){return function(){if(e.curOp)return t.apply(e,arguments);f(e);try{return t.apply(e,arguments)}finally{g(e)}}},methodOp:function(e){return function(){if(this.curOp)return e.apply(this,arguments);f(this);try{return e.apply(this,arguments)}finally{g(this)}}},docMethodOp:function(e){return function(){let t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);f(t);try{return e.apply(this,arguments)}finally{g(t)}}}}}),define("skylark-codemirror/primitives/display/scroll_events",["../util/browser","../util/event","./update_display","./scrolling"],function(e,t,i,n){"use strict";let r=0,s=null;function o(e){let 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}}return e.ie?s=-.53:e.gecko?s=15:e.chrome?s=-.7:e.safari&&(s=-1/3),{wheelEventPixels:function(e){let t=o(e);return t.x*=s,t.y*=s,t},onScrollWheel:function(l,a){let c=o(a),h=c.x,u=c.y,d=l.display,f=d.scroller,g=f.scrollWidth>f.clientWidth,p=f.scrollHeight>f.clientHeight;if(!(h&&g||u&&p))return;if(u&&e.mac&&e.webkit)e:for(let e=a.target,t=d.view;e!=f;e=e.parentNode)for(let i=0;i<t.length;i++)if(t[i].node==e){l.display.currentWheelTarget=e;break e}if(h&&!e.gecko&&!e.presto&&null!=s)return u&&p&&n.updateScrollTop(l,Math.max(0,f.scrollTop+u*s)),n.setScrollLeft(l,Math.max(0,f.scrollLeft+h*s)),(!u||u&&p)&&t.e_preventDefault(a),void(d.wheelStartX=null);if(u&&null!=s){let e=u*s,t=l.doc.scrollTop,n=t+d.wrapper.clientHeight;e<0?t=Math.max(0,t+e-50):n=Math.min(l.doc.height,n+e+50),i.updateDisplaySimple(l,{top:t,bottom:n})}r<20&&(null==d.wheelStartX?(d.wheelStartX=f.scrollLeft,d.wheelStartY=f.scrollTop,d.wheelDX=h,d.wheelDY=u,setTimeout(()=>{if(null==d.wheelStartX)return;let e=f.scrollLeft-d.wheelStartX,t=f.scrollTop-d.wheelStartY,i=t&&d.wheelDY&&t/d.wheelDY||e&&d.wheelDX&&e/d.wheelDX;d.wheelStartX=d.wheelStartY=null,i&&(s=(s*r+i)/(r+1),++r)},200)):(d.wheelDX+=h,d.wheelDY+=u))}}}),define("skylark-codemirror/primitives/display/highlight_worker",["../line/highlight","../modes","../util/misc","./operations","./view_tracking"],function(e,t,i,n,r){"use strict";function s(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,i.bind(o,e))}function o(i){let o=i.doc;if(o.highlightFrontier>=i.display.viewTo)return;let l=+new Date+i.options.workTime,a=e.getContextBefore(i,o.highlightFrontier),c=[];o.iter(a.line,Math.min(o.first+o.size,i.display.viewTo+500),n=>{if(a.line>=i.display.viewFrom){let r=n.styles,s=n.text.length>i.options.maxHighlightLength?t.copyState(o.mode,a.state):null,l=e.highlightLine(i,n,a,!0);s&&(a.state=s),n.styles=l.styles;let h=n.styleClasses,u=l.classes;u?n.styleClasses=u:h&&(n.styleClasses=null);let d=!r||r.length!=n.styles.length||h!=u&&(!h||!u||h.bgClass!=u.bgClass||h.textClass!=u.textClass);for(let e=0;!d&&e<r.length;++e)d=r[e]!=n.styles[e];d&&c.push(a.line),n.stateAfter=a.save(),a.nextLine()}else n.text.length<=i.options.maxHighlightLength&&e.processLine(i,n.text,a),n.stateAfter=a.line%5==0?a.save():null,a.nextLine();if(+new Date>l)return s(i,i.options.workDelay),!0}),o.highlightFrontier=a.line,o.modeFrontier=Math.max(o.modeFrontier,a.line),c.length&&n.runInOp(i,()=>{for(let e=0;e<c.length;e++)r.regLineChange(i,c[e],"text")})}return{startWorker:s}}),define("skylark-codemirror/primitives/model/selection",["../line/pos","../util/misc"],function(e,t){"use strict";class i{constructor(e,t){this.ranges=e,this.primIndex=t}primary(){return this.ranges[this.primIndex]}equals(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(let i=0;i<this.ranges.length;i++){let n=this.ranges[i],r=t.ranges[i];if(!e.equalCursorPos(n.anchor,r.anchor)||!e.equalCursorPos(n.head,r.head))return!1}return!0}deepCopy(){let t=[];for(let i=0;i<this.ranges.length;i++)t[i]=new n(e.copyPos(this.ranges[i].anchor),e.copyPos(this.ranges[i].head));return new i(t,this.primIndex)}somethingSelected(){for(let e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1}contains(t,i){i||(i=t);for(let n=0;n<this.ranges.length;n++){let r=this.ranges[n];if(e.cmp(i,r.from())>=0&&e.cmp(t,r.to())<=0)return n}return-1}}class n{constructor(e,t){this.anchor=e,this.head=t}from(){return e.minPos(this.anchor,this.head)}to(){return e.maxPos(this.anchor,this.head)}empty(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}}return{Selection:i,Range:n,normalizeSelection:function(r,s,o){let l=r&&r.options.selectionsMayTouch,a=s[o];s.sort((e,t)=>e.cmp(e.from(),t.from())),o=t.indexOf(s,a);for(let t=1;t<s.length;t++){let i=s[t],r=s[t-1],a=e.cmp(r.to(),i.from());if(l&&!i.empty()?a>0:a>=0){let l=e.minPos(r.from(),i.from()),a=e.maxPos(r.to(),i.to()),c=r.empty()?i.from()==i.head:r.from()==r.head;t<=o&&--o,s.splice(--t,2,new n(c?a:l,c?l:a))}}return new i(s,o)},simpleSelection:function(e,t){return new i([new n(e,t||e)],0)}}}),define("skylark-codemirror/primitives/model/change_measurement",["../line/pos","../util/misc","./selection"],function(e,t,i){"use strict";function n(i){return i.text?e.Pos(i.from.line+i.text.length-1,t.lst(i.text).length+(1==i.text.length?i.from.ch:0)):i.to}function r(t,i){if(e.cmp(t,i.from)<0)return t;if(e.cmp(t,i.to)<=0)return n(i);let r=t.line+i.text.length-(i.to.line-i.from.line)-1,s=t.ch;return t.line==i.to.line&&(s+=n(i).ch-i.to.ch),e.Pos(r,s)}function s(t,i,n){return t.line==i.line?e.Pos(n.line,t.ch-i.ch+n.ch):e.Pos(n.line+(t.line-i.line),t.ch)}return{changeEnd:n,computeSelAfterChange:function(e,t){let n=[];for(let s=0;s<e.sel.ranges.length;s++){let o=e.sel.ranges[s];n.push(new i.Range(r(o.anchor,t),r(o.head,t)))}return i.normalizeSelection(e.cm,n,e.sel.primIndex)},computeReplacedSel:function(t,r,o){let l=[],a=e.Pos(t.first,0),c=a;for(let h=0;h<r.length;h++){let u=r[h],d=s(u.from,a,c),f=s(n(u),a,c);if(a=u.to,c=f,"around"==o){let n=t.sel.ranges[h],r=e.cmp(n.head,n.anchor)<0;l[h]=new i.Range(r?f:d,r?d:f)}else l[h]=new i.Range(d,d)}return new i.Selection(l,t.sel.primIndex)}}}),define("skylark-codemirror/primitives/display/mode_state",["../modes","./view_tracking"],function(e,t){"use strict";function i(e){e.doc.iter(e=>{e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,e.startWorker(e,100),e.state.modeGen++,e.curOp&&t.regChange(e)}return{loadMode:function(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),i(t)},resetModeState:i}}),define("skylark-codemirror/primitives/model/document_data",["../display/mode_state","../display/operations","../display/view_tracking","../line/line_data","../line/spans","../line/utils_line","../measurement/position_measurement","../util/dom","../util/misc","../util/operation_group"],function(e,t,i,n,r,s,o,l,a,c){"use strict";function h(e,t){return 0==t.from.ch&&0==t.to.ch&&""==a.lst(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function u(e){("rtl"==e.doc.direction?l.addClass:l.rmClass)(e.display.lineDiv,"CodeMirror-rtl")}return{isWholeLineUpdate:h,updateDoc:function(e,t,i,r){function o(e){return i?i[e]:null}function l(e,i,s){n.updateLine(e,i,s,r),c.signalLater(e,"change",e,t)}function u(e,t){let i=[];for(let s=e;s<t;++s)i.push(new n.Line(g[s],o(s),r));return i}let d=t.from,f=t.to,g=t.text,p=s.getLine(e,d.line),m=s.getLine(e,f.line),v=a.lst(g),y=o(g.length-1),w=f.line-d.line;if(t.full)e.insert(0,u(0,g.length)),e.remove(g.length,e.size-g.length);else if(h(e,t)){let t=u(0,g.length-1);l(m,m.text,y),w&&e.remove(d.line,w),t.length&&e.insert(d.line,t)}else if(p==m)if(1==g.length)l(p,p.text.slice(0,d.ch)+v+p.text.slice(f.ch),y);else{let t=u(1,g.length-1);t.push(new n.Line(v+p.text.slice(f.ch),y,r)),l(p,p.text.slice(0,d.ch)+g[0],o(0)),e.insert(d.line+1,t)}else if(1==g.length)l(p,p.text.slice(0,d.ch)+g[0]+m.text.slice(f.ch),o(0)),e.remove(d.line+1,w);else{l(p,p.text.slice(0,d.ch)+g[0],o(0)),l(m,v+m.text.slice(f.ch),y);let t=u(1,g.length-1);w>1&&e.remove(d.line+1,w-1),e.insert(d.line+1,t)}c.signalLater(e,"change",e,t)},linkedDocs:function(e,t,i){!function e(n,r,s){if(n.linked)for(let o=0;o<n.linked.length;++o){let l=n.linked[o];if(l.doc==r)continue;let a=s&&l.sharedHist;i&&!a||(t(l.doc,a),e(l.doc,n,a))}}(e,null,!0)},attachDoc:function(t,n){if(n.cm)throw new Error("This document is already in use.");t.doc=n,n.cm=t,o.estimateLineHeights(t),e.loadMode(t),u(t),t.options.lineWrapping||r.findMaxLine(t);t.options.mode=n.modeOption,i.regChange(t)},directionChanged:function(e){t.runInOp(e,()=>{u(e),i.regChange(e)})}}}),define("skylark-codemirror/primitives/model/history",["../line/pos","../line/spans","../line/utils_line","../util/event","../util/misc","./change_measurement","./document_data","./selection"],function(e,t,i,n,r,s,o,l){"use strict";function a(t,n){let r={from:e.copyPos(n.from),to:s.changeEnd(n),text:i.getBetween(t,n.from,n.to)};return u(t,r,n.from.line,n.to.line+1),o.linkedDocs(t,e=>u(e,r,n.from.line,n.to.line+1),!0),r}function c(e){for(;e.length;){let t=r.lst(e);if(!t.ranges)break;e.pop()}}function h(e,t){let i=r.lst(t);i&&i.ranges&&i.equals(e)||t.push(e)}function u(e,t,i,n){let r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),i=>{i.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=i.markedSpans),++s})}function d(e){if(!e)return null;let t;for(let 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}return{History:function(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},historyChangeFromChange:a,addChangeToHistory:function(t,i,o,l){let u=t.history;u.undone.length=0;let d,f,g=+new Date;if((u.lastOp==l||u.lastOrigin==i.origin&&i.origin&&("+"==i.origin.charAt(0)&&u.lastModTime>g-(t.cm?t.cm.options.historyEventDelay:500)||"*"==i.origin.charAt(0)))&&(d=function(e,t){if(t)return c(e.done),r.lst(e.done);if(e.done.length&&!r.lst(e.done).ranges)return r.lst(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),r.lst(e.done)}(u,u.lastOp==l)))f=r.lst(d.changes),0==e.cmp(i.from,i.to)&&0==e.cmp(i.from,f.to)?f.to=s.changeEnd(i):d.changes.push(a(t,i));else{let e=r.lst(u.done);for(e&&e.ranges||h(t.sel,u.done),d={changes:[a(t,i)],generation:u.generation},u.done.push(d);u.done.length>u.undoDepth;)u.done.shift(),u.done[0].ranges||u.done.shift()}u.done.push(o),u.generation=++u.maxGeneration,u.lastModTime=u.lastSelTime=g,u.lastOp=u.lastSelOp=l,u.lastOrigin=u.lastSelOrigin=i.origin,f||n.signal(t,"historyAdded")},addSelectionToHistory:function(e,t,i,n){let s=e.history,o=n&&n.origin;i==s.lastSelOp||o&&s.lastSelOrigin==o&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==o||function(e,t,i,n){let 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)}(e,o,r.lst(s.done),t))?s.done[s.done.length-1]=t:h(t,s.done);s.lastSelTime=+new Date,s.lastSelOrigin=o,s.lastSelOp=i,n&&!1!==n.clearRedo&&c(s.undone)},pushSelectionToHistory:h,mergeOldSpans:function(e,i){let n=function(e,t){let i=t["spans_"+e.id];if(!i)return null;let n=[];for(let e=0;e<t.text.length;++e)n.push(d(i[e]));return n}(e,i),r=t.stretchSpansOverChange(e,i);if(!n)return r;if(!r)return n;for(let e=0;e<n.length;++e){let t=n[e],i=r[e];if(t&&i)e:for(let e=0;e<i.length;++e){let n=i[e];for(let e=0;e<t.length;++e)if(t[e].marker==n.marker)continue e;t.push(n)}else i&&(n[e]=i)}return n},copyHistoryArray:function(e,t,i){let n=[];for(let o=0;o<e.length;++o){let a=e[o];if(a.ranges){n.push(i?l.Selection.prototype.deepCopy.call(a):a);continue}let c=a.changes,h=[];n.push({changes:h});for(let e=0;e<c.length;++e){let i,n=c[e];if(h.push({from:n.from,to:n.to,text:n.text}),t)for(var s in n)(i=s.match(/^spans_(\d+)$/))&&r.indexOf(t,Number(i[1]))>-1&&(r.lst(h)[s]=n[s],delete n[s])}}return n}}}),define("skylark-codemirror/primitives/model/selection_updates",["../util/operation_group","../display/scrolling","../line/pos","../line/utils_line","../util/event","../util/misc","./history","./selection"],function(e,t,i,n,r,s,o,l){"use strict";function a(e,t,n,r){if(r){let r=e.anchor;if(n){let e=i.cmp(t,r)<0;e!=i.cmp(n,r)<0?(r=t,t=n):e!=i.cmp(t,n)<0&&(t=n)}return new l.Range(r,t)}return new l.Range(n||t,t)}function c(e,t,i){h(e,t,i),o.addSelectionToHistory(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function h(e,n,s){(r.hasHandler(e,"beforeSelectionChange")||e.cm&&r.hasHandler(e.cm,"beforeSelectionChange"))&&(n=function(e,t,n){let s={ranges:t.ranges,update:function(t){this.ranges=[];for(let n=0;n<t.length;n++)this.ranges[n]=new l.Range(i.clipPos(e,t[n].anchor),i.clipPos(e,t[n].head))},origin:n&&n.origin};r.signal(e,"beforeSelectionChange",e,s),e.cm&&r.signal(e.cm,"beforeSelectionChange",e.cm,s);return s.ranges!=t.ranges?l.normalizeSelection(e.cm,s.ranges,s.ranges.length-1):t}(e,n,s));let o=s&&s.bias||(i.cmp(n.primary().head,e.sel.primary().head)<0?-1:1);u(e,d(e,n,o,!0)),s&&!1===s.scroll||!e.cm||t.ensureCursorVisible(e.cm)}function u(t,i){i.equals(t.sel)||(t.sel=i,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,r.signalCursorActivity(t.cm)),e.signalLater(t,"cursorActivity",t))}function d(e,t,i,n){let r;for(let s=0;s<t.ranges.length;s++){let o=t.ranges[s],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[s],c=g(e,o.anchor,a&&a.anchor,i,n),h=g(e,o.head,a&&a.head,i,n);(r||c!=o.anchor||h!=o.head)&&(r||(r=t.ranges.slice(0,s)),r[s]=new l.Range(c,h))}return r?l.normalizeSelection(e.cm,r,t.primIndex):t}function f(e,t,s,o,l){let a=n.getLine(e,t.line);if(a.markedSpans)for(let n=0;n<a.markedSpans.length;++n){let c=a.markedSpans[n],h=c.marker;if((null==c.from||(h.inclusiveLeft?c.from<=t.ch:c.from<t.ch))&&(null==c.to||(h.inclusiveRight?c.to>=t.ch:c.to>t.ch))){if(l&&(r.signal(h,"beforeCursorEnter"),h.explicitlyCleared)){if(a.markedSpans){--n;continue}break}if(!h.atomic)continue;if(s){let n,r=h.find(o<0?1:-1);if((o<0?h.inclusiveRight:h.inclusiveLeft)&&(r=p(e,r,-o,r&&r.line==t.line?a:null)),r&&r.line==t.line&&(n=i.cmp(r,s))&&(o<0?n<0:n>0))return f(e,r,t,o,l)}let c=h.find(o<0?-1:1);return(o<0?h.inclusiveLeft:h.inclusiveRight)&&(c=p(e,c,o,c.line==t.line?a:null)),c?f(e,c,t,o,l):null}}return t}function g(e,t,n,r,s){let o=r||1,l=f(e,t,n,o,s)||!s&&f(e,t,n,o,!0)||f(e,t,n,-o,s)||!s&&f(e,t,n,-o,!0);return l||(e.cantEdit=!0,i.Pos(e.first,0))}function p(e,t,r,s){return r<0&&0==t.ch?t.line>e.first?i.clipPos(e,i.Pos(t.line-1)):null:r>0&&t.ch==(s||n.getLine(e,t.line)).text.length?t.line<e.first+e.size-1?i.Pos(t.line+1,0):null:new i.Pos(t.line,t.ch+r)}return{extendRange:a,extendSelection:function(e,t,i,n,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend));c(e,new l.Selection([a(e.sel.primary(),t,i,r)],0),n)},extendSelections:function(e,t,i){let n=[],r=e.cm&&(e.cm.display.shift||e.extend);for(let i=0;i<e.sel.ranges.length;i++)n[i]=a(e.sel.ranges[i],t[i],null,r);let s=l.normalizeSelection(e.cm,n,e.sel.primIndex);c(e,s,i)},replaceOneSelection:function(e,t,i,n){let r=e.sel.ranges.slice(0);r[t]=i,c(e,l.normalizeSelection(e.cm,r,e.sel.primIndex),n)},setSimpleSelection:function(e,t,i,n){c(e,l.simpleSelection(t,i),n)},setSelectionReplaceHistory:function(e,t,i){let n=e.history.done,r=s.lst(n);r&&r.ranges?(n[n.length-1]=t,h(e,t,i)):c(e,t,i)},setSelection:c,setSelectionNoUndo:h,reCheckSelection:function(e){u(e,d(e,e.sel,null,!1))},skipAtomic:g,selectAll:function(e){e.setSelection(i.Pos(e.firstLine(),0),i.Pos(e.lastLine()),s.sel_dontScroll)}}}),define("skylark-codemirror/primitives/model/changes",["../line/highlight","../display/highlight_worker","../display/operations","../display/view_tracking","../line/pos","../line/saw_special_spans","../line/spans","../line/utils_line","../measurement/position_measurement","../util/event","../util/misc","../util/operation_group","./change_measurement","./document_data","./history","./selection","./selection_updates"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m){"use strict";function v(e,t,i){let n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:()=>n.canceled=!0};return i&&(n.update=((t,i,s,o)=>{t&&(n.from=r.clipPos(e,t)),i&&(n.to=r.clipPos(e,i)),s&&(n.text=s),void 0!==o&&(n.origin=o)})),c.signal(e,"beforeChange",e,n),e.cm&&c.signal(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function y(e,t,n){if(e.cm){if(!e.cm.curOp)return i.operation(e.cm,y)(e,t,n);if(e.cm.state.suppressEdits)return}if((c.hasHandler(e,"beforeChange")||e.cm&&c.hasHandler(e.cm,"beforeChange"))&&!(t=v(e,t,!0)))return;let r=s.sawReadOnlySpans&&!n&&o.removeReadOnlyRanges(e,t.from,t.to);if(r)for(let i=r.length-1;i>=0;--i)w(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else w(e,t)}function w(e,t){if(1==t.text.length&&""==t.text[0]&&0==r.cmp(t.from,t.to))return;let i=d.computeSelAfterChange(e,t);g.addChangeToHistory(e,t,i,e.cm?e.cm.curOp.id:NaN),C(e,t,i,o.stretchSpansOverChange(e,t));let n=[];f.linkedDocs(e,(e,i)=>{i||-1!=h.indexOf(n,e.history)||(S(e.history,t),n.push(e.history)),C(e,t,null,o.stretchSpansOverChange(e,t))})}function b(e,t){if(0!=t&&(e.first+=t,e.sel=new p.Selection(h.map(e.sel.ranges,e=>new p.Range(r.Pos(e.anchor.line+t,e.anchor.ch),r.Pos(e.head.line+t,e.head.ch))),e.sel.primIndex),e.cm)){n.regChange(e.cm,e.first,e.first-t,t);for(let t=e.cm.display,i=t.viewFrom;i<t.viewTo;i++)t.regLineChange(e.cm,i,"gutter")}}function C(s,g,p,v){if(s.cm&&!s.cm.curOp)return i.operation(s.cm,C)(s,g,p,v);if(g.to.line<s.first)return void b(s,g.text.length-1-(g.to.line-g.from.line));if(g.from.line>s.lastLine())return;if(g.from.line<s.first){let e=g.text.length-1-(s.first-g.from.line);b(s,e),g={from:r.Pos(s.first,0),to:r.Pos(g.to.line+e,g.to.ch),text:[h.lst(g.text)],origin:g.origin}}let y=s.lastLine();g.to.line>y&&(g={from:g.from,to:r.Pos(y,l.getLine(s,y).text.length),text:[g.text[0]],origin:g.origin}),g.removed=l.getBetween(s,g.from,g.to),p||(p=d.computeSelAfterChange(s,g)),s.cm?function(i,r,s){let h=i.doc,d=i.display,g=r.from,p=r.to,m=!1,v=g.line;i.options.lineWrapping||(v=l.lineNo(o.visualLine(l.getLine(h,g.line))),h.iter(v,p.line+1,e=>{if(e==d.maxLine)return m=!0,!0}));h.sel.contains(r.from,r.to)>-1&&c.signalCursorActivity(i);f.updateDoc(h,r,s,a.estimateHeight(i)),i.options.lineWrapping||(h.iter(v,g.line+r.text.length,e=>{let t=o.lineLength(e);t>d.maxLineLength&&(d.maxLine=e,d.maxLineLength=t,d.maxLineChanged=!0,m=!1)}),m&&(i.curOp.updateMaxLine=!0));e.retreatFrontier(h,g.line),t.startWorker(i,400);let y=r.text.length-(p.line-g.line)-1;r.full?n.regChange(i):g.line!=p.line||1!=r.text.length||f.isWholeLineUpdate(i.doc,r)?n.regChange(i,g.line,p.line+1,y):n.regLineChange(i,g.line,"text");let w=c.hasHandler(i,"changes"),b=c.hasHandler(i,"change");if(b||w){let e={from:g,to:p,text:r.text,removed:r.removed,origin:r.origin};b&&u.signalLater(i,"change",i,e),w&&(i.curOp.changeObjs||(i.curOp.changeObjs=[])).push(e)}i.display.selForContextMenu=null}(s.cm,g,v):f.updateDoc(s,g,v),m.setSelectionNoUndo(s,p,h.sel_dontScroll)}function k(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function x(e,t,i,n){for(let s=0;s<e.length;++s){let o=e[s],l=!0;if(o.ranges){o.copied||((o=e[s]=o.deepCopy()).copied=!0);for(let e=0;e<o.ranges.length;e++)k(o.ranges[e].anchor,t,i,n),k(o.ranges[e].head,t,i,n)}else{for(let e=0;e<o.changes.length;++e){let s=o.changes[e];if(i<s.from.line)s.from=r.Pos(s.from.line+n,s.from.ch),s.to=r.Pos(s.to.line+n,s.to.ch);else if(t<=s.to.line){l=!1;break}}l||(e.splice(0,s+1),s=0)}}}function S(e,t){let i=t.from.line,n=t.to.line,r=t.text.length-(n-i)-1;x(e.done,i,n,r),x(e.undone,i,n,r)}return{makeChange:y,makeChangeFromHistory:function(e,t,i){let n=e.cm&&e.cm.state.suppressEdits;if(n&&!i)return;let r,s=e.history,o=e.sel,l="undo"==t?s.done:s.undone,a="undo"==t?s.undone:s.done,u=0;for(;u<l.length&&(r=l[u],i?!r.ranges||r.equals(e.sel):r.ranges);u++);if(u==l.length)return;for(s.lastOrigin=s.lastSelOrigin=null;;){if(!(r=l.pop()).ranges){if(n)return void l.push(r);break}if(g.pushSelectionToHistory(r,a),i&&!r.equals(e.sel))return void m.setSelection(e,r,{clearRedo:!1});o=r}let p=[];g.pushSelectionToHistory(o,a),a.push({changes:p,generation:s.generation}),s.generation=r.generation||++s.maxGeneration;let y=c.hasHandler(e,"beforeChange")||e.cm&&c.hasHandler(e.cm,"beforeChange");for(let i=r.changes.length-1;i>=0;--i){let n=r.changes[i];if(n.origin=t,y&&!v(e,n,!1))return void(l.length=0);p.push(g.historyChangeFromChange(e,n));let s=i?d.computeSelAfterChange(e,n):h.lst(l);C(e,n,s,g.mergeOldSpans(e,n)),!i&&e.cm&&e.cm.scrollIntoView({from:n.from,to:d.changeEnd(n)});let o=[];f.linkedDocs(e,(e,t)=>{t||-1!=h.indexOf(o,e.history)||(S(e.history,n),o.push(e.history)),C(e,n,null,g.mergeOldSpans(e,n))})}},replaceRange:function(e,t,i,n,s){n||(n=i);r.cmp(n,i)<0&&([i,n]=[n,i]);"string"==typeof t&&(t=e.splitLines(t));y(e,{from:i,to:n,text:t,origin:s})},changeLine:function(e,t,i,s){let o=t,a=t;"number"==typeof t?a=l.getLine(e,r.clipLine(e,t)):o=l.lineNo(t);if(null==o)return null;s(a,o)&&e.cm&&n.regLineChange(e.cm,o,i);return a}}}),define("skylark-codemirror/primitives/model/chunk",["../line/line_data","../util/misc","../util/operation_group"],function(e,t,i){"use strict";function n(e){this.lines=e,this.parent=null;let t=0;for(let i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}function r(e){this.children=e;let t=0,i=0;for(let n=0;n<e.length;++n){let r=e[n];t+=r.chunkSize(),i+=r.height,r.parent=this}this.size=t,this.height=i,this.parent=null}return n.prototype={chunkSize(){return this.lines.length},removeInner(t,n){for(let r=t,s=t+n;r<s;++r){let t=this.lines[r];this.height-=t.height,e.cleanUpLine(t),i.signalLater(t,"delete")}this.lines.splice(t,n)},collapse(e){e.push.apply(e,this.lines)},insertInner(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(let e=0;e<t.length;++e)t[e].parent=this},iterN(e,t,i){for(let n=e+t;e<n;++e)if(i(this.lines[e]))return!0}},r.prototype={chunkSize(){return this.size},removeInner(e,t){this.size-=t;for(let i=0;i<this.children.length;++i){let n=this.children[i],r=n.chunkSize();if(e<r){let 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 n))){let e=[];this.collapse(e),this.children=[new n(e)],this.children[0].parent=this}},collapse(e){for(let t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner(e,t,i){this.size+=t.length,this.height+=i;for(let r=0;r<this.children.length;++r){let s=this.children[r],o=s.chunkSize();if(e<=o){if(s.insertInner(e,t,i),s.lines&&s.lines.length>50){let e=s.lines.length%25+25;for(let t=e;t<s.lines.length;){let e=new n(s.lines.slice(t,t+=25));s.height-=e.height,this.children.splice(++r,0,e),e.parent=this}s.lines=s.lines.slice(0,e),this.maybeSpill()}break}e-=o}},maybeSpill(){if(this.children.length<=10)return;let e=this;do{let i=e.children.splice(e.children.length-5,5),n=new r(i);if(e.parent){e.size-=n.size,e.height-=n.height;let i=t.indexOf(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{let t=new r(e.children);t.parent=e,e.children=[t,n],e=t}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN(e,t,i){for(let n=0;n<this.children.length;++n){let r=this.children[n],s=r.chunkSize();if(e<s){let n=Math.min(t,s-e);if(r.iterN(e,n,i))return!0;if(0==(t-=n))break;e=0}else e-=s}}},{LeafChunk:n,BranchChunk:r}}),define("skylark-codemirror/primitives/model/line_widget",["../display/operations","../display/scrolling","../display/view_tracking","../line/spans","../line/utils_line","../measurement/widgets","./changes","../util/event","../util/operation_group"],function(e,t,i,n,r,s,o,l,a){"use strict";class c{constructor(e,t,i){if(i)for(let e in i)i.hasOwnProperty(e)&&(this[e]=i[e]);this.doc=e,this.node=t}clear(){let t=this.doc.cm,n=this.line.widgets,o=this.line,l=r.lineNo(o);if(null==l||!n)return;for(let e=0;e<n.length;++e)n[e]==this&&n.splice(e--,1);n.length||(o.widgets=null);let c=s.widgetHeight(this);r.updateLineHeight(o,Math.max(0,o.height-c)),t&&(e.runInOp(t,()=>{h(t,o,-c),i.regLineChange(t,l,"widget")}),a.signalLater(t,"lineWidgetCleared",t,this,l))}changed(){let t=this.height,i=this.doc.cm,o=this.line;this.height=null;let l=s.widgetHeight(this)-t;l&&(n.lineIsHidden(this.doc,o)||r.updateLineHeight(o,o.height+l),i&&e.runInOp(i,()=>{i.curOp.forceUpdate=!0,h(i,o,l),a.signalLater(i,"lineWidgetChanged",i,this,r.lineNo(o))}))}}function h(e,i,r){n.heightAtLine(i)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&t.addToScrollTop(e,r)}return l.eventMixin(c),{LineWidget:c,addLineWidget:function(e,i,l,h){let u=new c(e,l,h),d=e.cm;d&&u.noHScroll&&(d.display.alignWidgets=!0);o.changeLine(e,i,"widget",i=>{let o=i.widgets||(i.widgets=[]);if(null==u.insertAt?o.push(u):o.splice(Math.min(o.length-1,Math.max(0,u.insertAt)),0,u),u.line=i,d&&!n.lineIsHidden(e,i)){let o=n.heightAtLine(i)<e.scrollTop;r.updateLineHeight(i,i.height+s.widgetHeight(u)),o&&t.addToScrollTop(d,u.height),d.curOp.forceUpdate=!0}return!0}),d&&a.signalLater(d,"lineWidgetAdded",d,u,"number"==typeof i?i:r.lineNo(i));return u}}}),define("skylark-codemirror/primitives/model/mark_text",["../util/dom","../util/event","../display/operations","../line/pos","../line/utils_line","../measurement/position_measurement","../line/saw_special_spans","../line/spans","../util/misc","../util/operation_group","../measurement/widgets","../display/view_tracking","./document_data","./history","./selection_updates"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g){"use strict";let p=0;class m{constructor(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++p}clear(){if(this.explicitlyCleared)return;let e=this.doc.cm,n=e&&!e.curOp;if(n&&i.startOperation(e),t.hasHandler(this,"clear")){let e=this.find();e&&c.signalLater(this,"clear",e.from,e.to)}let o=null,a=null;for(let t=0;t<this.lines.length;++t){let i=this.lines[t],n=l.getMarkedSpanFor(i.markedSpans,this);e&&!this.collapsed?u.regLineChange(e,r.lineNo(i),"text"):e&&(null!=n.to&&(a=r.lineNo(i)),null!=n.from&&(o=r.lineNo(i))),i.markedSpans=l.removeMarkedSpan(i.markedSpans,n),null==n.from&&this.collapsed&&!l.lineIsHidden(this.doc,i)&&e&&r.updateLineHeight(i,s.textHeight(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(let t=0;t<this.lines.length;++t){let i=l.visualLine(this.lines[t]),n=l.lineLength(i);n>e.display.maxLineLength&&(e.display.maxLine=i,e.display.maxLineLength=n,e.display.maxLineChanged=!0)}null!=o&&e&&this.collapsed&&u.regChange(e,o,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&g.reCheckSelection(e.doc)),e&&c.signalLater(e,"markerCleared",e,this,o,a),n&&i.endOperation(e),this.parent&&this.parent.clear()}find(e,t){let i,s;null==e&&"bookmark"==this.type&&(e=1);for(let o=0;o<this.lines.length;++o){let a=this.lines[o],c=l.getMarkedSpanFor(a.markedSpans,this);if(null!=c.from&&(i=n.Pos(t?a:r.lineNo(a),c.from),-1==e))return i;if(null!=c.to&&(s=n.Pos(t?a:r.lineNo(a),c.to),1==e))return s}return i&&{from:i,to:s}}changed(){let e=this.find(-1,!0),t=this,n=this.doc.cm;e&&n&&i.runInOp(n,()=>{let i=e.line,o=r.lineNo(e.line),a=s.findViewForLine(n,o);if(a&&(s.clearLineMeasurementCacheFor(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!l.lineIsHidden(t.doc,i)&&null!=t.height){let e=t.height;t.height=null;let n=h.widgetHeight(t)-e;n&&r.updateLineHeight(i,i.height+n)}c.signalLater(n,"markerChanged",n,this)})}attachLine(e){if(!this.lines.length&&this.doc.cm){let e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=a.indexOf(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)}detachLine(e){if(this.lines.splice(a.indexOf(this.lines,e),1),!this.lines.length&&this.doc.cm){let e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}}}function v(s,h,w,b,C){if(b&&b.shared)return function(e,t,i,r,s){(r=a.copyObj(r)).shared=!1;let o=[v(e,t,i,r,s)],l=o[0],c=r.widgetNode;return d.linkedDocs(e,e=>{c&&(r.widgetNode=c.cloneNode(!0)),o.push(v(e,n.clipPos(e,t),n.clipPos(e,i),r,s));for(let t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;l=a.lst(o)}),new y(o,l)}(s,h,w,b,C);if(s.cm&&!s.cm.curOp)return i.operation(s.cm,v)(s,h,w,b,C);let k=new m(s,C),x=n.cmp(h,w);if(b&&a.copyObj(b,k,!1),x>0||0==x&&!1!==k.clearWhenEmpty)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=e.eltP("span",[k.replacedWith],"CodeMirror-widget"),b.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),b.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(l.conflictingCollapsedRange(s,h.line,h,w,k)||h.line!=w.line&&l.conflictingCollapsedRange(s,w.line,h,w,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");o.seeCollapsedSpans()}k.addToHistory&&f.addChangeToHistory(s,{from:h,to:w,origin:"markText"},s.sel,NaN);let S,$=h.line,L=s.cm;if(s.iter($,w.line+1,e=>{L&&k.collapsed&&!L.options.lineWrapping&&l.visualLine(e)==L.display.maxLine&&(S=!0),k.collapsed&&$!=h.line&&r.updateLineHeight(e,0),l.addMarkedSpan(e,new l.MarkedSpan(k,$==h.line?h.ch:null,$==w.line?w.ch:null)),++$}),k.collapsed&&s.iter(h.line,w.line+1,e=>{l.lineIsHidden(s,e)&&r.updateLineHeight(e,0)}),k.clearOnEnter&&t.on(k,"beforeCursorEnter",()=>k.clear()),k.readOnly&&(o.seeReadOnlySpans(),(s.history.done.length||s.history.undone.length)&&s.clearHistory()),k.collapsed&&(k.id=++p,k.atomic=!0),L){if(S&&(L.curOp.updateMaxLine=!0),k.collapsed)u.regChange(L,h.line,w.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(let e=h.line;e<=w.line;e++)u.regLineChange(L,e,"text");k.atomic&&g.reCheckSelection(L.doc),c.signalLater(L,"markerAdded",L,k)}return k}t.eventMixin(m);class y{constructor(e,t){this.markers=e,this.primary=t;for(let t=0;t<e.length;++t)e[t].parent=this}clear(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(let e=0;e<this.markers.length;++e)this.markers[e].clear();c.signalLater(this,"clear")}}find(e,t){return this.primary.find(e,t)}}return t.eventMixin(y),{TextMarker:m,markText:v,SharedTextMarker:y,findSharedMarkers:function(e){return e.findMarks(n.Pos(e.first,0),e.clipPos(n.Pos(e.lastLine())),e=>e.parent)},copySharedMarkers:function(e,t){for(let i=0;i<t.length;i++){let r=t[i],s=r.find(),o=e.clipPos(s.from),l=e.clipPos(s.to);if(n.cmp(o,l)){let t=v(e,o,l,r.primary,r.primary.type);r.markers.push(t),t.parent=r}}},detachSharedMarkers:function(e){for(let t=0;t<e.length;t++){let i=e[t],n=[i.primary.doc];d.linkedDocs(i.primary.doc,e=>n.push(e));for(let e=0;e<i.markers.length;e++){let r=i.markers[e];-1==t.indexOf(n,r.doc)&&(r.parent=null,i.markers.splice(e--,1))}}}}}),define("skylark-codemirror/primitives/model/Doc",["../edit/CodeMirror","../display/operations","../line/line_data","../line/pos","../line/spans","../line/utils_line","../util/dom","../util/feature_detection","../util/misc","../display/scrolling","./changes","./change_measurement","./chunk","./document_data","./history","./line_widget","./mark_text","./selection","./selection_updates"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m,v,y){"use strict";let w=0,b=function(e,t,r,s,o){if(!(this instanceof b))return new b(e,t,r,s,o);null==r&&(r=0),d.BranchChunk.call(this,[new d.LeafChunk([new i.Line("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;let l=n.Pos(r,0);this.sel=v.simpleSelection(l),this.history=new g.History(null),this.id=++w,this.modeOption=t,this.lineSep=s,this.direction="rtl"==o?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),f.updateDoc(this,{from:l,to:l,text:e}),y.setSelection(this,v.simpleSelection(l),a.sel_dontScroll)};return b.prototype=a.createObj(d.BranchChunk.prototype,{constructor:b,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){let i=0;for(let e=0;e<t.length;++e)i+=t[e].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){let t=s.getLines(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:t.docMethodOp(function(e){let t=n.Pos(this.first,0),i=this.first+this.size-1;h.makeChange(this,{from:t,to:n.Pos(i,s.getLine(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&c.scrollToCoords(this.cm,0,0),y.setSelection(this,v.simpleSelection(t),a.sel_dontScroll)}),replaceRange:function(e,t,i,r){t=n.clipPos(this,t),i=i?n.clipPos(this,i):t,h.replaceRange(this,e,t,i,r)},getRange:function(e,t,i){let r=s.getBetween(this,n.clipPos(this,e),n.clipPos(this,t));return!1===i?r:r.join(i||this.lineSeparator())},getLine:function(e){let t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(s.isLine(this,e))return s.getLine(this,e)},getLineNumber:function(e){return s.lineNo(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=s.getLine(this,e)),r.visualLine(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return n.clipPos(this,e)},getCursor:function(e){let t,i=this.sel.primary();return t=null==e||"head"==e?i.head:"anchor"==e?i.anchor:"end"==e||"to"==e||!1===e?i.to():i.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:t.docMethodOp(function(e,t,i){y.setSimpleSelection(this,n.clipPos(this,"number"==typeof e?n.Pos(e,t||0):e),null,i)}),setSelection:t.docMethodOp(function(e,t,i){y.setSimpleSelection(this,n.clipPos(this,e),n.clipPos(this,t||e),i)}),extendSelection:t.docMethodOp(function(e,t,i){y.extendSelection(this,n.clipPos(this,e),t&&n.clipPos(this,t),i)}),extendSelections:t.docMethodOp(function(e,t){y.extendSelections(this,n.clipPosArray(this,e),t)}),extendSelectionsBy:t.docMethodOp(function(e,t){let i=a.map(this.sel.ranges,e);y.extendSelections(this,n.clipPosArray(this,i),t)}),setSelections:t.docMethodOp(function(e,t,i){if(!e.length)return;let r=[];for(let t=0;t<e.length;t++)r[t]=new v.Range(n.clipPos(this,e[t].anchor),n.clipPos(this,e[t].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),y.setSelection(this,v.normalizeSelection(this.cm,r,t),i)}),addSelection:t.docMethodOp(function(e,t,i){let r=this.sel.ranges.slice(0);r.push(new v.Range(n.clipPos(this,e),n.clipPos(this,t||e))),y.setSelection(this,v.normalizeSelection(this.cm,r,r.length-1),i)}),getSelection:function(e){let t,i=this.sel.ranges;for(let e=0;e<i.length;e++){let n=s.getBetween(this,i[e].from(),i[e].to());t=t?t.concat(n):n}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){let t=[],i=this.sel.ranges;for(let n=0;n<i.length;n++){let r=s.getBetween(this,i[n].from(),i[n].to());!1!==e&&(r=r.join(e||this.lineSeparator())),t[n]=r}return t},replaceSelection:function(e,t,i){let n=[];for(let t=0;t<this.sel.ranges.length;t++)n[t]=e;this.replaceSelections(n,t,i||"+input")},replaceSelections:t.docMethodOp(function(e,t,i){let n=[],r=this.sel;for(let t=0;t<r.ranges.length;t++){let s=r.ranges[t];n[t]={from:s.from(),to:s.to(),text:this.splitLines(e[t]),origin:i}}let s=t&&"end"!=t&&u.computeReplacedSel(this,n,t);for(let e=n.length-1;e>=0;e--)h.makeChange(this,n[e]);s?y.setSelectionReplaceHistory(this,s):this.cm&&c.ensureCursorVisible(this.cm)}),undo:t.docMethodOp(function(){h.makeChangeFromHistory(this,"undo")}),redo:t.docMethodOp(function(){h.makeChangeFromHistory(this,"redo")}),undoSelection:t.docMethodOp(function(){h.makeChangeFromHistory(this,"undo",!0)}),redoSelection:t.docMethodOp(function(){h.makeChangeFromHistory(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){let e=this.history,t=0,i=0;for(let i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(let t=0;t<e.undone.length;t++)e.undone[t].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){this.history=new g.History(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:g.copyHistoryArray(this.history.done),undone:g.copyHistoryArray(this.history.undone)}},setHistory:function(e){let t=this.history=new g.History(this.history.maxGeneration);t.done=g.copyHistoryArray(e.done.slice(0),null,!0),t.undone=g.copyHistoryArray(e.undone.slice(0),null,!0)},setGutterMarker:t.docMethodOp(function(e,t,i){return h.changeLine(this,e,"gutter",e=>{let n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=i,!i&&a.isEmpty(n)&&(e.gutterMarkers=null),!0})}),clearGutter:t.docMethodOp(function(e){this.iter(t=>{t.gutterMarkers&&t.gutterMarkers[e]&&h.changeLine(this,t,"gutter",()=>(t.gutterMarkers[e]=null,a.isEmpty(t.gutterMarkers)&&(t.gutterMarkers=null),!0))})}),lineInfo:function(e){let t;if("number"==typeof e){if(!s.isLine(this,e))return null;if(t=e,!(e=s.getLine(this,e)))return null}else if(null==(t=s.lineNo(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:t.docMethodOp(function(e,t,i){return h.changeLine(this,e,"gutter"==t?"gutter":"class",e=>{let n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(o.classTest(i).test(e[n]))return!1;e[n]+=" "+i}else e[n]=i;return!0})}),removeLineClass:t.docMethodOp(function(e,t,i){return h.changeLine(this,e,"gutter"==t?"gutter":"class",e=>{let 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{let t=r.match(o.classTest(i));if(!t)return!1;let s=t.index+t[0].length;e[n]=r.slice(0,t.index)+(t.index&&s!=r.length?" ":"")+r.slice(s)||null}return!0})}),addLineWidget:t.docMethodOp(function(e,t,i){return p.addLineWidget(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return m.markText(this,n.clipPos(this,e),n.clipPos(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){let 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=n.clipPos(this,e),m.markText(this,e,e,i,"bookmark")},findMarksAt:function(e){e=n.clipPos(this,e);let t=[],i=s.getLine(this,e.line).markedSpans;if(i)for(let n=0;n<i.length;++n){let 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=n.clipPos(this,e),t=n.clipPos(this,t);let r=[],s=e.line;return this.iter(e.line,t.line+1,n=>{let o=n.markedSpans;if(o)for(let n=0;n<o.length;n++){let l=o[n];null!=l.to&&s==e.line&&e.ch>=l.to||null==l.from&&s!=e.line||null!=l.from&&s==t.line&&l.from>=t.ch||i&&!i(l.marker)||r.push(l.marker.parent||l.marker)}++s}),r},getAllMarks:function(){let e=[];return this.iter(t=>{let i=t.markedSpans;if(i)for(let t=0;t<i.length;++t)null!=i[t].from&&e.push(i[t].marker)}),e},posFromIndex:function(e){let t,i=this.first,r=this.lineSeparator().length;return this.iter(n=>{let s=n.text.length+r;if(s>e)return t=e,!0;e-=s,++i}),n.clipPos(this,n.Pos(i,t))},indexFromPos:function(e){let t=(e=n.clipPos(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;let i=this.lineSeparator().length;return this.iter(this.first,e.line,e=>{t+=e.text.length+i}),t},copy:function(e){let t=new b(s.getLines(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});let 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);let n=new b(s.getLines(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],m.copySharedMarkers(n,m.findSharedMarkers(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(let e=0;e<this.linked.length;++e){let i=this.linked[e];if(i.doc==t){this.linked.splice(e,1),t.unlinkDoc(this),m.detachSharedMarkers(m.findSharedMarkers(this));break}}if(t.history==this.history){let e=[t.id];f.linkedDocs(t,t=>e.push(t.id),!0),t.history=new g.History(null),t.history.done=g.copyHistoryArray(this.history.done,e),t.history.undone=g.copyHistoryArray(this.history.undone,e)}},iterLinkedDocs:function(e){f.linkedDocs(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):l.splitLinesAuto(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:t.docMethodOp(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(e=>e.order=null),this.cm&&f.directionChanged(this.cm))})}),b.prototype.eachLine=b.prototype.iter,b}),define("skylark-codemirror/primitives/edit/drop_events",["../display/selection","../display/operations","../line/pos","../measurement/position_measurement","../measurement/widgets","../model/changes","../model/change_measurement","../model/selection","../model/selection_updates","../util/browser","../util/dom","../util/event","../util/misc"],function(e,t,i,n,r,s,o,l,a,c,h,u,d){"use strict";let f=0;function g(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}return{onDrop:function(e){let r=this;if(g(r),u.signalDOMEvent(r,e)||e.eventInWidget(r.display,e))return;u.e_preventDefault(e),c.ie&&(f=+new Date);let h=n.posFromMouse(r,e,!0),p=e.dataTransfer.files;if(!h||r.isReadOnly())return;if(p&&p.length&&window.FileReader&&window.File){let e=p.length,n=Array(e),a=0,c=(c,u)=>{if(r.options.allowDropFileTypes&&-1==d.indexOf(r.options.allowDropFileTypes,c.type))return;let f=new FileReader;f.onload=t.operation(r,()=>{let t=f.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(t)&&(t=""),n[u]=t,++a==e){let e={from:h=i.clipPos(r.doc,h),to:h,text:r.doc.splitLines(n.join(r.doc.lineSeparator())),origin:"paste"};s.makeChange(r.doc,e),u.setSelectionReplaceHistory(r.doc,l.simpleSelection(h,o.changeEnd(e)))}}),f.readAsText(c)};for(let t=0;t<e;++t)c(p[t],t)}else{if(r.state.draggingText&&r.doc.sel.contains(h)>-1)return r.state.draggingText(e),void setTimeout(()=>r.display.input.focus(),20);try{let t=e.dataTransfer.getData("Text");if(t){let e;if(r.state.draggingText&&!r.state.draggingText.copy&&(e=r.listSelections()),a.setSelectionNoUndo(r.doc,l.simpleSelection(h,h)),e)for(let t=0;t<e.length;++t)s.replaceRange(r.doc,"",e[t].anchor,e[t].head,"drag");r.replaceSelection(t,"around","paste"),r.display.input.focus()}}catch(e){}}},onDragStart:function(e,t){if(c.ie&&(!e.state.draggingText||+new Date-f<100))return void u.e_stop(t);if(u.signalDOMEvent(e,t)||t.eventInWidget(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!c.safari){let i=h.elt("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c.presto&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),c.presto&&i.parentNode.removeChild(i)}},onDragOver:function(t,i){let r=n.posFromMouse(t,i);if(!r)return;let s=document.createDocumentFragment();e.drawSelectionCursor(t,r,s),t.display.dragCursor||(t.display.dragCursor=h.elt("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv));h.removeChildrenAndAdd(t.display.dragCursor,s)},clearDragCursor:g}}),define("skylark-codemirror/primitives/edit/global_events",["../display/focus","../util/event"],function(e,t){"use strict";function i(e){if(!document.getElementsByClassName)return;let t=document.getElementsByClassName("CodeMirror"),i=[];for(let e=0;e<t.length;e++){let n=t[e].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(()=>{for(let t=0;t<i.length;t++)e(i[t])})}let n=!1;function r(e){let t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}return{ensureGlobalHandlers:function(){if(n)return;(function(){let n;t.on(window,"resize",()=>{null==n&&(n=setTimeout(()=>{n=null,i(r)},100))}),t.on(window,"blur",()=>i(e.onBlur))})(),n=!0}}}),define("skylark-codemirror/primitives/input/keynames",[],function(){"use strict";let e={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};for(let t=0;t<10;t++)e[t+48]=e[t+96]=String(t);for(let t=65;t<=90;t++)e[t]=String.fromCharCode(t);for(let t=1;t<=12;t++)e[t+111]=e[t+63235]="F"+t;return{keyNames:e}}),define("skylark-codemirror/primitives/input/keymap",["../util/browser","../util/misc","./keynames"],function(e,t,i){"use strict";let n={};function r(e){let t,i,n,r,s=e.split(/-(?!$)/);e=s[s.length-1];for(let e=0;e<s.length-1;e++){let o=s[e];if(/^(cmd|meta|m)$/i.test(o))r=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))i=!0;else{if(!/^s(hift)?$/i.test(o))throw new Error("Unrecognized modifier name: "+o);n=!0}}return t&&(e="Alt-"+e),i&&(e="Ctrl-"+e),r&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function s(t,i,n){let r=t;return i.altKey&&"Alt"!=r&&(t="Alt-"+t),(e.flipCtrlCmd?i.metaKey:i.ctrlKey)&&"Ctrl"!=r&&(t="Ctrl-"+t),(e.flipCtrlCmd?i.ctrlKey:i.metaKey)&&"Cmd"!=r&&(t="Cmd-"+t),!n&&i.shiftKey&&"Shift"!=r&&(t="Shift-"+t),t}function o(e){return"string"==typeof e?n[e]:e}return n.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"},n.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"},n.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},n.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"]},n.default=e.mac?n.macDefault:n.pcDefault,{keyMap:n,normalizeKeyMap:function(e){let i={};for(let n in e)if(e.hasOwnProperty(n)){let s=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==s){delete e[n];continue}let o=t.map(n.split(" "),r);for(let e=0;e<o.length;e++){let t,n;e==o.length-1?(n=o.join(" "),t=s):(n=o.slice(0,e+1).join(" "),t="...");let r=i[n];if(r){if(r!=t)throw new Error("Inconsistent bindings for "+n)}else i[n]=t}delete e[n]}for(let t in i)e[t]=i[t];return e},lookupKey:function e(t,i,n,r){i=o(i);let s=i.call?i.call(t,r):i[t];if(!1===s)return"nothing";if("..."===s)return"multi";if(null!=s&&n(s))return"handled";if(i.fallthrough){if("[object Array]"!=Object.prototype.toString.call(i.fallthrough))return e(t,i.fallthrough,n,r);for(let s=0;s<i.fallthrough.length;s++){let o=e(t,i.fallthrough[s],n,r);if(o)return o}}},isModifierKey:function(e){let t="string"==typeof e?e:i.keyNames[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},addModifierNames:s,keyName:function(t,n){if(e.presto&&34==t.keyCode&&t.char)return!1;let r=i.keyNames[t.keyCode];if(null==r||t.altGraphKey)return!1;3==t.keyCode&&t.code&&(r=t.code);return s(r,t,n)},getKeyMap:o}}),define("skylark-codemirror/primitives/edit/deleteNearSelection",["../display/operations","../display/scrolling","../line/pos","../model/changes","../util/misc"],function(e,t,i,n,r){"use strict";return{deleteNearSelection:function(s,o){let l=s.doc.sel.ranges,a=[];for(let e=0;e<l.length;e++){let t=o(l[e]);for(;a.length&&i.cmp(t.from,r.lst(a).to)<=0;){let e=a.pop();if(i.cmp(e.from,t.from)<0){t.from=e.from;break}}a.push(t)}e.runInOp(s,()=>{for(let e=a.length-1;e>=0;e--)n.replaceRange(s.doc,"",a[e].from,a[e].to,"+delete");t.ensureCursorVisible(s)})}}}),define("skylark-codemirror/primitives/input/movement",["../line/pos","../measurement/position_measurement","../util/bidi","../util/misc"],function(e,t,i,n){"use strict";function r(e,t,i){let r=n.skipExtendingChars(e.text,t+i,i);return r<0||r>e.text.length?null:r}function s(t,i,n){let s=r(t,i.ch,n);return null==s?null:new e.Pos(i.line,s,n<0?"after":"before")}return{moveLogically:s,endOfLine:function(s,o,l,a,c){if(s){let s=i.getOrder(l,o.doc.direction);if(s){let i,h=c<0?n.lst(s):s[0],u=c<0==(1==h.level),d=u?"after":"before";if(h.level>0||"rtl"==o.doc.direction){let e=t.prepareMeasureForLine(o,l);i=c<0?l.text.length-1:0;let s=t.measureCharPrepared(o,e,i).top;i=n.findFirst(i=>t.measureCharPrepared(o,e,i).top==s,c<0==(1==h.level)?h.from:h.to-1,i),"before"==d&&(i=r(l,i,1))}else i=c<0?h.to:h.from;return new e.Pos(a,i,d)}}return new e.Pos(a,c<0?l.text.length:0,c<0?"before":"after")},moveVisually:function(i,n,o,l){let a=a.getOrder(n,i.doc.direction);if(!a)return s(n,o,l);o.ch>=n.text.length?(o.ch=n.text.length,o.sticky="before"):o.ch<=0&&(o.ch=0,o.sticky="after");let c=a.getBidiPartAt(a,o.ch,o.sticky),h=a[c];if("ltr"==i.doc.direction&&h.level%2==0&&(l>0?h.to>o.ch:h.from<o.ch))return s(n,o,l);let u,d=(t,i)=>r(n,t instanceof e.Pos?t.ch:t,i),f=e=>i.options.lineWrapping?(u=u||t.prepareMeasureForLine(i,n),t.wrappedLineExtentChar(i,n,u,e)):{begin:0,end:n.text.length},g=f("before"==o.sticky?d(o,-1):o.ch);if("rtl"==i.doc.direction||1==h.level){let t=1==h.level==l<0,i=d(o,t?1:-1);if(null!=i&&(t?i<=h.to&&i<=g.end:i>=h.from&&i>=g.begin)){let n=t?"before":"after";return new e.Pos(o.line,i,n)}}let p=(t,i,n)=>{let r=(t,i)=>i?new e.Pos(o.line,d(t,1),"before"):new e.Pos(o.line,t,"after");for(;t>=0&&t<a.length;t+=i){let e=a[t],s=i>0==(1!=e.level),o=s?n.begin:d(n.end,-1);if(e.from<=o&&o<e.to)return r(o,s);if(o=s?e.from:d(e.to,-1),n.begin<=o&&o<n.end)return r(o,s)}},m=p(c+l,l,g);if(m)return m;let v=l>0?g.end:d(g.begin,-1);if(null!=v&&!(l>0&&v==n.text.length)&&(m=p(l>0?0:a.length-1,l,f(v))))return m;return null}}}),define("skylark-codemirror/primitives/edit/commands",["./deleteNearSelection","../display/operations","../display/scrolling","../input/movement","../line/pos","../line/spans","../line/utils_line","../model/selection","../model/selection_updates","../util/misc","../util/bidi"],function(e,t,i,n,r,s,o,l,a,c,h){"use strict";let u={selectAll:a.selectAll,singleSelection:e=>e.setSelection(e.getCursor("anchor"),e.getCursor("head"),c.sel_dontScroll),killLine:t=>e.deleteNearSelection(t,e=>{if(e.empty()){let i=o.getLine(t.doc,e.head.line).text.length;return e.head.ch==i&&e.head.line<t.lastLine()?{from:e.head,to:r.Pos(e.head.line+1,0)}:{from:e.head,to:r.Pos(e.head.line,i)}}return{from:e.from(),to:e.to()}}),deleteLine:t=>e.deleteNearSelection(t,e=>({from:r.Pos(e.from().line,0),to:r.clipPos(t.doc,r.Pos(e.to().line+1,0))})),delLineLeft:t=>e.deleteNearSelection(t,e=>({from:r.Pos(e.from().line,0),to:e.from()})),delWrappedLineLeft:t=>e.deleteNearSelection(t,e=>{let i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:0,top:i},"div");return{from:n,to:e.from()}}),delWrappedLineRight:t=>e.deleteNearSelection(t,e=>{let i=t.charCoords(e.head,"div").top+5,n=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:i},"div");return{from:e.from(),to:n}}),undo:e=>e.undo(),redo:e=>e.redo(),undoSelection:e=>e.undoSelection(),redoSelection:e=>e.redoSelection(),goDocStart:e=>e.extendSelection(r.Pos(e.firstLine(),0)),goDocEnd:e=>e.extendSelection(r.Pos(e.lastLine())),goLineStart:e=>e.extendSelectionsBy(t=>d(e,t.head.line),{origin:"+move",bias:1}),goLineStartSmart:e=>e.extendSelectionsBy(t=>f(e,t.head),{origin:"+move",bias:1}),goLineEnd:e=>e.extendSelectionsBy(t=>(function(e,t){let i=o.getLine(e.doc,t),r=s.visualLineEnd(i);r!=i&&(t=o.lineNo(r));return n.endOfLine(!0,e,i,t,-1)})(e,t.head.line),{origin:"+move",bias:-1}),goLineRight:e=>e.extendSelectionsBy(t=>{let i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},c.sel_move),goLineLeft:e=>e.extendSelectionsBy(t=>{let i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},c.sel_move),goLineLeftSmart:e=>e.extendSelectionsBy(t=>{let i=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return n.ch<e.getLine(n.line).search(/\S/)?f(e,t.head):n},c.sel_move),goLineUp:e=>e.moveV(-1,"line"),goLineDown:e=>e.moveV(1,"line"),goPageUp:e=>e.moveV(-1,"page"),goPageDown:e=>e.moveV(1,"page"),goCharLeft:e=>e.moveH(-1,"char"),goCharRight:e=>e.moveH(1,"char"),goColumnLeft:e=>e.moveH(-1,"column"),goColumnRight:e=>e.moveH(1,"column"),goWordLeft:e=>e.moveH(-1,"word"),goGroupRight:e=>e.moveH(1,"group"),goGroupLeft:e=>e.moveH(-1,"group"),goWordRight:e=>e.moveH(1,"word"),delCharBefore:e=>e.deleteH(-1,"char"),delCharAfter:e=>e.deleteH(1,"char"),delWordBefore:e=>e.deleteH(-1,"word"),delWordAfter:e=>e.deleteH(1,"word"),delGroupBefore:e=>e.deleteH(-1,"group"),delGroupAfter:e=>e.deleteH(1,"group"),indentAuto:e=>e.indentSelection("smart"),indentMore:e=>e.indentSelection("add"),indentLess:e=>e.indentSelection("subtract"),insertTab:e=>e.replaceSelection("\t"),insertSoftTab:e=>{let t=[],i=e.listSelections(),n=e.options.tabSize;for(let r=0;r<i.length;r++){let s=i[r].from(),o=c.countColumn(e.getLine(s.line),s.ch,n);t.push(c.spaceStr(n-o%n))}e.replaceSelections(t)},defaultTab:e=>{e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:e=>t.runInOp(e,()=>{let t=e.listSelections(),i=[];for(let n=0;n<t.length;n++){if(!t[n].empty())continue;let s=t[n].head,a=o.getLine(e.doc,s.line).text;if(a)if(s.ch==a.length&&(s=new r.Pos(s.line,s.ch-1)),s.ch>0)s=new r.Pos(s.line,s.ch+1),e.replaceRange(a.charAt(s.ch-1)+a.charAt(s.ch-2),r.Pos(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){let t=o.getLine(e.doc,s.line-1).text;t&&(s=new r.Pos(s.line,1),e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+t.charAt(t.length-1),r.Pos(s.line-1,t.length-1),s,"+transpose"))}i.push(new l.Range(s,s))}e.setSelections(i)}),newlineAndIndent:e=>t.runInOp(e,()=>{let t=e.listSelections();for(let i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(let i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);i.ensureCursorVisible(e)}),openLine:e=>e.replaceSelection("\n","start"),toggleOverwrite:e=>e.toggleOverwrite()};function d(e,t){let i=o.getLine(e.doc,t),r=s.visualLine(i);return r!=i&&(t=o.lineNo(r)),n.endOfLine(!0,e,r,t,1)}function f(e,t){let i=d(e,t.line),n=o.getLine(e.doc,i.line),s=h.getOrder(n,e.doc.direction);if(!s||0==s[0].level){let e=Math.max(0,n.text.search(/\S/)),s=t.line==i.line&&t.ch<=e&&t.ch;return r.Pos(i.line,s?0:e,i.sticky)}return i}return{commands:u}}),define("skylark-codemirror/primitives/edit/key_events",["../util/operation_group","../display/selection","../input/keymap","../measurement/widgets","../util/browser","../util/dom","../util/event","../util/feature_detection","../util/misc","./commands"],function(e,t,i,n,r,s,o,l,a,c){"use strict";function h(e,t,i){if("string"==typeof t&&!(t=c.commands[t]))return!1;e.display.input.ensurePolled();let n=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),r=t(e)!=a.Pass}finally{e.display.shift=n,e.state.suppressEdits=!1}return r}let u=new a.Delayed;function d(e,t,n,r){let s=e.state.keySeq;if(s){if(i.isModifierKey(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:u.set(50,()=>{e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),f(e,s+" "+t,n,r))return!0}return f(e,t,n,r)}function f(n,r,s,l){let a=function(e,t,n){for(let r=0;r<e.state.keyMaps.length;r++){let s=i.lookupKey(t,e.state.keyMaps[r],n,e);if(s)return s}return e.options.extraKeys&&i.lookupKey(t,e.options.extraKeys,n,e)||i.lookupKey(t,e.options.keyMap,n,e)}(n,r,l);return"multi"==a&&(n.state.keySeq=r),"handled"==a&&e.signalLater(n,"keyHandled",n,r,s),"handled"!=a&&"multi"!=a||(o.e_preventDefault(s),t.restartBlink(n)),!!a}function g(e,t){let n=i.keyName(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?d(e,"Shift-"+n,t,t=>h(e,t,!0))||d(e,n,t,t=>{if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return h(e,t)}):d(e,n,t,t=>h(e,t)))}let p=null;return{dispatchKey:d,onKeyDown:function(e){let t=this;if(t.curOp.focus=s.activeElt(),o.signalDOMEvent(t,e))return;r.ie&&r.ie_version<11&&27==e.keyCode&&(e.returnValue=!1);let i=e.keyCode;t.display.shift=16==i||e.shiftKey;let n=g(t,e);r.presto&&(p=n?i:null,!n&&88==i&&!l.hasCopyEvent&&(r.mac?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut"));18!=i||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){let t=e.display.lineDiv;function i(e){18!=e.keyCode&&e.altKey||(s.rmClass(t,"CodeMirror-crosshair"),o.off(document,"keyup",i),o.off(document,"mouseover",i))}s.addClass(t,"CodeMirror-crosshair"),o.on(document,"keyup",i),o.on(document,"mouseover",i)}(t)},onKeyUp:function(e){16==e.keyCode&&(this.doc.sel.shift=!1);o.signalDOMEvent(this,e)},onKeyPress:function(e){let t=this;if(n.eventInWidget(t.display,e)||o.signalDOMEvent(t,e)||e.ctrlKey&&!e.altKey||r.mac&&e.metaKey)return;let i=e.keyCode,s=e.charCode;if(r.presto&&i==p)return p=null,void o.e_preventDefault(e);if(r.presto&&(!e.which||e.which<10)&&g(t,e))return;let l=String.fromCharCode(null==s?i:s);if("\b"==l)return;if(function(e,t,i){return d(e,"'"+i+"'",t,t=>h(e,t,!0))}(t,e,l))return;t.display.input.onKeyPress(e)}}}),define("skylark-codemirror/primitives/edit/mouse_events",["../display/focus","../display/operations","../display/update_lines","../line/pos","../line/utils_line","../measurement/position_measurement","../measurement/widgets","../model/selection","../model/selection_updates","../util/browser","../util/bidi","../util/dom","../util/event","../util/feature_detection","../util/misc","../input/keymap","./key_events","./commands"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m,v){"use strict";const y=400;class w{constructor(e,t,i){this.time=e,this.pos=t,this.button=i}compare(e,t,i){return this.time+y>e&&0==n.cmp(t,this.pos)&&i==this.button}}let b,C;function k(i,r,s,o){c.ie?setTimeout(g.bind(e.ensureFocus,i),0):i.curOp.focus=u.activeElt();let l,h=function(e,t,i){let n=e.getOption("configureMouse"),r=n?n(e,t,i):{};if(null==r.unit){let e=c.chromeOS?i.shiftKey&&i.metaKey:i.altKey;r.unit=e?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==r.extend||e.doc.extend)&&(r.extend=e.doc.extend||i.shiftKey);null==r.addNew&&(r.addNew=c.mac?i.metaKey:i.ctrlKey);null==r.moveOnDrag&&(r.moveOnDrag=!(c.mac?i.altKey:i.ctrlKey));return r}(i,s,o),p=i.doc.sel;i.options.dragDrop&&f.dragAndDrop&&!i.isReadOnly()&&"single"==s&&(l=p.contains(r))>-1&&(n.cmp((l=p.ranges[l]).from(),r)<0||r.xRel>0)&&(n.cmp(l.to(),r)>0||r.xRel<0)?function(i,n,r,s){let o=i.display,l=!1,h=t.operation(i,e=>{c.webkit&&(o.scroller.draggable=!1),i.state.draggingText=!1,d.off(o.wrapper.ownerDocument,"mouseup",h),d.off(o.wrapper.ownerDocument,"mousemove",u),d.off(o.scroller,"dragstart",f),d.off(o.scroller,"drop",h),l||(d.e_preventDefault(e),s.addNew||a.extendSelection(i.doc,r,null,null,s.extend),c.webkit||c.ie&&9==c.ie_version?setTimeout(()=>{o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),u=function(e){l=l||Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)>=10},f=()=>l=!0;c.webkit&&(o.scroller.draggable=!0);i.state.draggingText=h,h.copy=!s.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();d.on(o.wrapper.ownerDocument,"mouseup",h),d.on(o.wrapper.ownerDocument,"mousemove",u),d.on(o.scroller,"dragstart",f),d.on(o.scroller,"drop",h),e.delayBlurEvent(i),setTimeout(()=>o.input.focus(),20)}(i,o,r,h):S(i,o,r,h)}function x(e,t,i){if("char"==i)return new l.Range(t,t);if("word"==i)return e.findWordAt(t);if("line"==i)return new l.Range(n.Pos(t.line,0),n.clipPos(e.doc,n.Pos(t.line+1,0)));let r=i(e,t);return new l.Range(r.from,r.to)}function S(e,o,c,f){let p=e.display,m=e.doc;d.e_preventDefault(o);let v,y,w=m.sel,b=w.ranges;if(f.addNew&&!f.extend?(y=m.sel.contains(c),v=y>-1?b[y]:new l.Range(c,c)):(v=m.sel.primary(),y=m.sel.primIndex),"rectangle"==f.unit)f.addNew||(v=new l.Range(c,c)),c=s.posFromMouse(e,o,!0,!0),y=-1;else{let t=x(e,c,f.unit);v=f.extend?a.extendRange(v,t.anchor,t.head,f.extend):t}f.addNew?-1==y?(y=b.length,a.setSelection(m,l.normalizeSelection(e,b.concat([v]),y),{scroll:!1,origin:"*mouse"})):b.length>1&&b[y].empty()&&"char"==f.unit&&!f.extend?(a.setSelection(m,l.normalizeSelection(e,b.slice(0,y).concat(b.slice(y+1)),0),{scroll:!1,origin:"*mouse"}),w=m.sel):a.replaceOneSelection(m,y,v,g.sel_mouse):(y=0,a.setSelection(m,new l.Selection([v],0),g.sel_mouse),w=m.sel);let C=c;function k(t){if(0!=n.cmp(C,t))if(C=t,"rectangle"==f.unit){let i=[],s=e.options.tabSize,o=g.countColumn(r.getLine(m,c.line).text,c.ch,s),h=g.countColumn(r.getLine(m,t.line).text,t.ch,s),u=Math.min(o,h),d=Math.max(o,h);for(let o=Math.min(c.line,t.line),a=Math.min(e.lastLine(),Math.max(c.line,t.line));o<=a;o++){let e=r.getLine(m,o).text,t=g.findColumn(e,u,s);u==d?i.push(new l.Range(n.Pos(o,t),n.Pos(o,t))):e.length>t&&i.push(new l.Range(n.Pos(o,t),n.Pos(o,g.findColumn(e,d,s))))}i.length||i.push(new l.Range(c,c)),a.setSelection(m,l.normalizeSelection(e,w.ranges.slice(0,y).concat(i),y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{let i,s=v,o=x(e,t,f.unit),c=s.anchor;n.cmp(o.anchor,c)>0?(i=o.head,c=n.minPos(s.from(),o.anchor)):(i=o.anchor,c=n.maxPos(s.to(),o.head));let u=w.ranges.slice(0);u[y]=function(e,t){let{anchor:i,head:s}=t,o=r.getLine(e.doc,i.line);if(0==n.cmp(i,s)&&i.sticky==s.sticky)return t;let a=h.getOrder(o);if(!a)return t;let c=h.getBidiPartAt(a,i.ch,i.sticky),u=a[c];if(u.from!=i.ch&&u.to!=i.ch)return t;let d,f=c+(u.from==i.ch==(1!=u.level)?0:1);if(0==f||f==a.length)return t;if(s.line!=i.line)d=(s.line-i.line)*("ltr"==e.doc.direction?1:-1)>0;else{let e=h.getBidiPartAt(a,s.ch,s.sticky),t=e-c||(s.ch-i.ch)*(1==u.level?-1:1);d=e==f-1||e==f?t<0:t>0}let g=a[f+(d?-1:0)],p=d==(1==g.level),m=p?g.from:g.to,v=p?"after":"before";return i.ch==m&&i.sticky==v?t:new l.Range(new n.Pos(i.line,m,v),s)}(e,new l.Range(n.clipPos(m,c),i)),a.setSelection(m,l.normalizeSelection(e,u,y),g.sel_mouse)}}let S=p.wrapper.getBoundingClientRect(),$=0;function L(t){e.state.selectingText=!1,$=1/0,d.e_preventDefault(t),p.input.focus(),d.off(p.wrapper.ownerDocument,"mousemove",A),d.off(p.wrapper.ownerDocument,"mouseup",M),m.history.lastSelOrigin=null}let A=t.operation(e,r=>{0!==r.buttons&&d.e_button(r)?function r(o){let l=++$;let a=s.posFromMouse(e,o,!0,"rectangle"==f.unit);if(!a)return;if(0!=n.cmp(a,C)){e.curOp.focus=u.activeElt(),k(a);let n=i.visibleLines(p,m);(a.line>=n.to||a.line<n.from)&&setTimeout(t.operation(e,()=>{$==l&&r(o)}),150)}else{let i=o.clientY<S.top?-20:o.clientY>S.bottom?20:0;i&&setTimeout(t.operation(e,()=>{$==l&&(p.scroller.scrollTop+=i,r(o))}),50)}}(r):L(r)}),M=t.operation(e,L);e.state.selectingText=M,d.on(p.wrapper.ownerDocument,"mousemove",A),d.on(p.wrapper.ownerDocument,"mouseup",M)}function $(e,t,i,n){let s,o;if(t.touches)s=t.touches[0].clientX,o=t.touches[0].clientY;else try{s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&d.e_preventDefault(t);let l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!d.hasHandler(e,i))return d.e_defaultPrevented(t);o-=a.top-l.viewOffset;for(let n=0;n<e.options.gutters.length;++n){let a=l.gutters.childNodes[n];if(a&&a.getBoundingClientRect().right>=s){let s=r.lineAtHeight(e.doc,o),l=e.options.gutters[n];return d.signal(e,i,e,s,l,t),d.e_defaultPrevented(t)}}}function L(e,t){return $(e,t,"gutterClick",!0)}return{onMouseDown:function(t){let i=this,n=i.display;if(d.signalDOMEvent(i,t)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=t.shiftKey,o.eventInWidget(n,t))return void(c.webkit||(n.scroller.draggable=!1,setTimeout(()=>n.scroller.draggable=!0,100)));if(L(i,t))return;let r=s.posFromMouse(i,t),l=d.e_button(t),h=r?function(e,t){let i=+new Date;return C&&C.compare(i,e,t)?(b=C=null,"triple"):b&&b.compare(i,e,t)?(C=new w(i,e,t),b=null,"double"):(b=new w(i,e,t),C=null,"single")}(r,l):"single";window.focus(),1==l&&i.state.selectingText&&i.state.selectingText(t);if(r&&function(e,t,i,n,r){let s="Click";"double"==n?s="Double"+s:"triple"==n&&(s="Triple"+s);return s=(1==t?"Left":2==t?"Middle":"Right")+s,m.dispatchKey(e,p.addModifierNames(s,r),r,t=>{if("string"==typeof t&&(t=v.commands[t]),!t)return!1;let n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,i)!=g.Pass}finally{e.state.suppressEdits=!1}return n})}(i,l,r,h,t))return;1==l?r?k(i,r,h,t):d.e_target(t)==n.scroller&&d.e_preventDefault(t):2==l?(r&&a.extendSelection(i.doc,r),setTimeout(()=>n.input.focus(),20)):3==l&&(c.captureRightClick?i.display.input.onContextMenu(t):e.delayBlurEvent(i))},clickInGutter:L,onContextMenu:function(e,t){if(o.eventInWidget(e.display,t)||function(e,t){return!!d.hasHandler(e,"gutterContextMenu")&&$(e,t,"gutterContextMenu",!1)}(e,t))return;if(d.signalDOMEvent(e,t,"contextmenu"))return;c.captureRightClick||e.display.input.onContextMenu(t)}}}),define("skylark-codemirror/primitives/edit/utils",["../measurement/position_measurement"],function(e){"use strict";return{themeChanged:function(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),e.clearCaches(t)}}}),define("skylark-codemirror/primitives/edit/options",["../display/focus","../display/gutters","../display/line_numbers","../display/mode_state","../display/scrollbars","../display/selection","../display/view_tracking","../input/keymap","../line/line_data","../line/pos","../line/spans","../measurement/position_measurement","../model/changes","../util/browser","../util/dom","../util/event","./utils"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m){"use strict";let v={toString:function(){return"CodeMirror.Init"}};function y(e){t.updateGutters(e),o.regChange(e),i.alignHorizontally(e)}function w(e,t,i){let n=i&&i!=v;if(!t!=!n){let i=e.display.dragFunctions,n=t?p.on:p.off;n(e.display.scroller,"dragstart",i.start),n(e.display.scroller,"dragenter",i.enter),n(e.display.scroller,"dragover",i.over),n(e.display.scroller,"dragleave",i.leave),n(e.display.scroller,"drop",i.drop)}}function b(e){e.options.lineWrapping?(g.addClass(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g.rmClass(e.display.wrapper,"CodeMirror-wrap"),h.findMaxLine(e)),u.estimateLineHeights(e),o.regChange(e),u.clearCaches(e),setTimeout(()=>r.updateScrollbars(e),100)}return{Init:v,defaults:{},optionHandlers:{},defineOptions:function(i){let h=i.optionHandlers;function g(e,t,n,r){i.defaults[e]=t,n&&(h[e]=r?(e,t,i)=>{i!=v&&n(e,t,i)}:n)}i.defineOption=g,i.Init=v,g("value","",(e,t)=>e.setValue(t),!0),g("mode",null,(e,t)=>{e.doc.modeOption=t,n.loadMode(e)},!0),g("indentUnit",2,n.loadMode,!0),g("indentWithTabs",!1),g("smartIndent",!0),g("tabSize",4,e=>{n.resetModeState(e),u.clearCaches(e),o.regChange(e)},!0),g("lineSeparator",null,(e,t)=>{if(e.doc.lineSep=t,!t)return;let i=[],n=e.doc.first;e.doc.iter(e=>{for(let r=0;;){let s=e.text.indexOf(t,r);if(-1==s)break;r=s+t.length,i.push(c.Pos(n,s))}n++});for(let n=i.length-1;n>=0;n--)d.replaceRange(e.doc,t,i[n],c.Pos(i[n].line,i[n].ch+t.length))}),g("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,(e,t,i)=>{e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),i!=v&&e.refresh()}),g("specialCharPlaceholder",a.defaultSpecialCharPlaceholder,e=>e.refresh(),!0),g("electricChars",!0),g("inputStyle",f.mobile?"contenteditable":"textarea",()=>{throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),g("spellcheck",!1,(e,t)=>e.getInputField().spellcheck=t,!0),g("autocorrect",!1,(e,t)=>e.getInputField().autocorrect=t,!0),g("autocapitalize",!1,(e,t)=>e.getInputField().autocapitalize=t,!0),g("rtlMoveVisually",!f.windows),g("wholeLineUpdateBefore",!0),g("theme","default",e=>{m.themeChanged(e),y(e)},!0),g("keyMap","default",(e,t,i)=>{let n=l.getKeyMap(t),r=i!=v&&l.getKeyMap(i);r&&r.detach&&r.detach(e,n),n.attach&&n.attach(e,r||null)}),g("extraKeys",null),g("configureMouse",null),g("lineWrapping",!1,b,!0),g("gutters",[],e=>{t.setGuttersForLineNumbers(e.options),y(e)},!0),g("fixedGutter",!0,(e,t)=>{e.display.gutters.style.left=t?u.compensateForHScroll(e.display)+"px":"0",e.refresh()},!0),g("coverGutterNextToScrollbar",!1,e=>r.updateScrollbars(e),!0),g("scrollbarStyle","native",e=>{r.initScrollbars(e),r.updateScrollbars(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),g("lineNumbers",!1,e=>{t.setGuttersForLineNumbers(e.options),y(e)},!0),g("firstLineNumber",1,y,!0),g("lineNumberFormatter",e=>e,y,!0),g("showCursorWhenSelecting",!1,s.updateSelection,!0),g("resetSelectionOnContextMenu",!0),g("lineWiseCopyCut",!0),g("pasteLinesPerSelection",!0),g("selectionsMayTouch",!1),g("readOnly",!1,(t,i)=>{"nocursor"==i&&(e.onBlur(t),t.display.input.blur()),t.display.input.readOnlyChanged(i)}),g("disableInput",!1,(e,t)=>{t||e.display.input.reset()},!0),g("dragDrop",!0,w),g("allowDropFileTypes",null),g("cursorBlinkRate",530),g("cursorScrollMargin",0),g("cursorHeight",1,s.updateSelection,!0),g("singleCursorHeightPerLine",!0,s.updateSelection,!0),g("workTime",100),g("workDelay",100),g("flattenSpans",!0,n.resetModeState,!0),g("addModeClass",!1,n.resetModeState,!0),g("pollInterval",100),g("undoDepth",200,(e,t)=>e.doc.history.undoDepth=t),g("historyEventDelay",1250),g("viewportMargin",10,e=>e.refresh(),!0),g("maxHighlightLength",1e4,n.resetModeState,!0),g("moveInputWithCursor",!0,(e,t)=>{t||e.display.input.resetPosition()}),g("tabindex",null,(e,t)=>e.display.input.getField().tabIndex=t||""),g("autofocus",null),g("direction","ltr",(e,t)=>e.doc.setDirection(t),!0),g("phrases",null)}}}),define("skylark-codemirror/primitives/edit/CodeMirror",["../display/Display","../display/focus","../display/gutters","../display/line_numbers","../display/operations","../display/scrollbars","../display/scroll_events","../display/scrolling","../line/pos","../measurement/position_measurement","../measurement/widgets","../model/Doc","../model/document_data","../model/selection","../model/selection_updates","../util/browser","../util/event","../util/misc","./drop_events","./global_events","./key_events","./mouse_events","./utils","./options"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m,v,y,w,b,C,k,x){"use strict";function S(L,A){if(!(this instanceof S))return new S(L,A);this.options=A=A?v.copyObj(A):{},v.copyObj(x.defaults,A,!1),i.setGuttersForLineNumbers(A);let M=A.value;"string"==typeof M?M=new u(M,A.mode,null,A.lineSeparator,A.direction):A.mode&&(M.modeOption=A.mode),this.doc=M;let T=new S.inputStyles[A.inputStyle](this),R=this.display=new e.Display(L,M,T);R.wrapper.CodeMirror=this,i.updateGutters(this),k.themeChanged(this),A.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),s.initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new v.Delayed,keySeq:null,specialChars:null},A.autofocus&&!p.mobile&&R.input.focus(),p.ie&&p.ie_version<11&&setTimeout(()=>this.display.input.reset(!0),20),function(e){let i=e.display;m.on(i.scroller,"mousedown",r.operation(e,C.onMouseDown)),p.ie&&p.ie_version<11?m.on(i.scroller,"dblclick",r.operation(e,t=>{if(m.signalDOMEvent(e,t))return;let i=c.posFromMouse(e,t);if(!i||C.clickInGutter(e,t)||h.eventInWidget(e.display,t))return;m.e_preventDefault(t);let n=e.findWordAt(i);g.extendSelection(e.doc,n.anchor,n.head)})):m.on(i.scroller,"dblclick",t=>m.signalDOMEvent(e,t)||m.e_preventDefault(t));m.on(i.scroller,"contextmenu",t=>C.onContextMenu(e,t));let n,s={end:0};function u(){i.activeTouch&&(n=setTimeout(()=>i.activeTouch=null,1e3),(s=i.activeTouch).end=+new Date)}function d(e,t){if(null==t.left)return!0;let i=t.left-e.left,n=t.top-e.top;return i*i+n*n>400}m.on(i.scroller,"touchstart",t=>{if(!m.signalDOMEvent(e,t)&&!function(e){if(1!=e.touches.length)return!1;let t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(t)&&!C.clickInGutter(e,t)){i.input.ensurePolled(),clearTimeout(n);let e=+new Date;i.activeTouch={start:e,moved:!1,prev:e-s.end<=300?s:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),m.on(i.scroller,"touchmove",()=>{i.activeTouch&&(i.activeTouch.moved=!0)}),m.on(i.scroller,"touchend",t=>{let n=i.activeTouch;if(n&&!h.eventInWidget(i,t)&&null!=n.left&&!n.moved&&new Date-n.start<300){let r,s=e.coordsChar(i.activeTouch,"page");r=!n.prev||d(n,n.prev)?new f.Range(s,s):!n.prev.prev||d(n,n.prev.prev)?e.findWordAt(s):new f.Range(a.Pos(s.line,0),a.clipPos(e.doc,a.Pos(s.line+1,0))),e.setSelection(r.anchor,r.head),e.focus(),m.e_preventDefault(t)}u()}),m.on(i.scroller,"touchcancel",u),m.on(i.scroller,"scroll",()=>{i.scroller.clientHeight&&(l.updateScrollTop(e,i.scroller.scrollTop),l.setScrollLeft(e,i.scroller.scrollLeft,!0),m.signal(e,"scroll",e))}),m.on(i.scroller,"mousewheel",t=>o.onScrollWheel(e,t)),m.on(i.scroller,"DOMMouseScroll",t=>o.onScrollWheel(e,t)),m.on(i.wrapper,"scroll",()=>i.wrapper.scrollTop=i.wrapper.scrollLeft=0),i.dragFunctions={enter:t=>{m.signalDOMEvent(e,t)||m.e_stop(t)},over:t=>{m.signalDOMEvent(e,t)||(y.onDragOver(e,t),m.e_stop(t))},start:t=>y.onDragStart(e,t),drop:r.operation(e,y.onDrop),leave:t=>{m.signalDOMEvent(e,t)||y.clearDragCursor(e)}};let v=i.input.getField();m.on(v,"keyup",t=>b.onKeyUp.call(e,t)),m.on(v,"keydown",r.operation(e,b.onKeyDown)),m.on(v,"keypress",r.operation(e,b.onKeyPress)),m.on(v,"focus",i=>t.onFocus(e,i)),m.on(v,"blur",i=>t.onBlur(e,i))}(this),w.ensureGlobalHandlers(),r.startOperation(this),this.curOp.forceUpdate=!0,d.attachDoc(this,M),A.autofocus&&!p.mobile||this.hasFocus()?setTimeout(v.bind(t.onFocus,this),20):t.onBlur(this);for(let e in x.optionHandlers)x.optionHandlers.hasOwnProperty(e)&&x.optionHandlers[e](this,A[e],x.Init);n.maybeUpdateLineNumberWidth(this),A.finishInit&&A.finishInit(this);for(let e=0;e<$.length;++e)$[e](this);r.endOperation(this),p.webkit&&A.lineWrapping&&"optimizelegibility"==getComputedStyle(R.lineDiv).textRendering&&(R.lineDiv.style.textRendering="auto")}S.defaults=x.defaults,S.optionHandlers=x.optionHandlers;let $=[];return S.defineInitHook=(e=>$.push(e)),S}),define("skylark-codemirror/primitives/input/indent",["../line/highlight","../line/pos","../line/utils_line","../model/changes","../model/selection","../model/selection_updates","../util/misc"],function(e,t,i,n,r,s,o){"use strict";return{indentLine:function(l,a,c,h){let u,d=l.doc;null==c&&(c="add");"smart"==c&&(d.mode.indent?u=e.getContextBefore(l,a).state:c="prev");let f=l.options.tabSize,g=i.getLine(d,a),p=o.countColumn(g.text,null,f);g.stateAfter&&(g.stateAfter=null);let m,v=g.text.match(/^\s*/)[0];if(h||/\S/.test(g.text)){if("smart"==c&&((m=d.mode.indent(u,g.text.slice(v.length),g.text))==o.Pass||m>150)){if(!h)return;c="prev"}}else m=0,c="not";"prev"==c?m=a>d.first?o.countColumn(i.getLine(d,a-1).text,null,f):0:"add"==c?m=p+l.options.indentUnit:"subtract"==c?m=p-l.options.indentUnit:"number"==typeof c&&(m=p+c);m=Math.max(0,m);let y="",w=0;if(l.options.indentWithTabs)for(let e=Math.floor(m/f);e;--e)w+=f,y+="\t";w<m&&(y+=o.spaceStr(m-w));if(y!=v)return n.replaceRange(d,y,t.Pos(a,0),t.Pos(a,v.length),"+input"),g.stateAfter=null,!0;for(let e=0;e<d.sel.ranges.length;e++){let i=d.sel.ranges[e];if(i.head.line==a&&i.head.ch<v.length){let i=t.Pos(a,v.length);s.replaceOneSelection(d,e,new r.Range(i,i));break}}}}}),define("skylark-codemirror/primitives/input/input",["../display/operations","../display/scrolling","../line/pos","../line/utils_line","../model/changes","../util/browser","../util/dom","../util/misc","../util/operation_group","../util/feature_detection","./indent"],function(e,t,i,n,r,s,o,l,a,c,h){"use strict";let u=null;function d(e,s,o,h,d){let g=e.doc;e.display.shift=!1,h||(h=g.sel);let p=+new Date-200,m="paste"==d||e.state.pasteIncoming>p,v=c.splitLinesAuto(s),y=null;if(m&&h.ranges.length>1)if(u&&u.text.join("\n")==s){if(h.ranges.length%u.text.length==0){y=[];for(let e=0;e<u.text.length;e++)y.push(g.splitLines(u.text[e]))}}else v.length==h.ranges.length&&e.options.pasteLinesPerSelection&&(y=l.map(v,e=>[e]));let w=e.curOp.updateInput;for(let t=h.ranges.length-1;t>=0;t--){let c=h.ranges[t],f=c.from(),w=c.to();c.empty()&&(o&&o>0?f=i.Pos(f.line,f.ch-o):e.state.overwrite&&!m?w=i.Pos(w.line,Math.min(n.getLine(g,w.line).text.length,w.ch+l.lst(v).length)):m&&u&&u.lineWise&&u.text.join("\n")==s&&(f=w=i.Pos(f.line,0)));let b={from:f,to:w,text:y?y[t%y.length]:v,origin:d||(m?"paste":e.state.cutIncoming>p?"cut":"+input")};r.makeChange(e.doc,b),a.signalLater(e,"inputRead",e,b)}s&&!m&&f(e,s),t.ensureCursorVisible(e),e.curOp.updateInput<2&&(e.curOp.updateInput=w),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function f(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;let i=e.doc.sel;for(let r=i.ranges.length-1;r>=0;r--){let s=i.ranges[r];if(s.head.ch>100||r&&i.ranges[r-1].head.line==s.head.line)continue;let o=e.getModeAt(s.head),l=!1;if(o.electricChars){for(let i=0;i<o.electricChars.length;i++)if(t.indexOf(o.electricChars.charAt(i))>-1){l=h.indentLine(e,s.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(n.getLine(e.doc,s.head.line).text.slice(0,s.head.ch))&&(l=h.indentLine(e,s.head.line,"smart"));l&&a.signalLater(e,"electricInput",e,s.head.line)}}function g(e,t,i,n){e.setAttribute("autocorrect",!!i),e.setAttribute("autocapitalize",!!n),e.setAttribute("spellcheck",!!t)}return{lastCopied:u,setLastCopied:function(e){u=e},applyTextInput:d,handlePaste:function(t,i){let n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),i.isReadOnly()||i.options.disableInput||e.runInOp(i,()=>d(i,n,0,null,"paste")),!0},triggerElectric:f,copyableRanges:function(e){let t=[],n=[];for(let r=0;r<e.doc.sel.ranges.length;r++){let s=e.doc.sel.ranges[r].head.line,o={anchor:i.Pos(s,0),head:i.Pos(s+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}},disableBrowserMagic:g,hiddenTextarea:function(){let e=o.elt("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o.elt("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");s.webkit?e.style.width="1000px":e.setAttribute("wrap","off");s.ios&&(e.style.border="1px solid black");return g(e),t}}}),define("skylark-codemirror/primitives/edit/methods",["./deleteNearSelection","./commands","../model/document_data","../util/dom","../util/event","../line/highlight","../input/indent","../input/input","./key_events","./mouse_events","../input/keymap","../input/movement","../display/operations","../line/pos","../measurement/position_measurement","../model/selection","../model/selection_updates","../display/scrolling","../line/spans","../display/update_display","../util/misc","../util/operation_group","../line/utils_line","../display/view_tracking","../display/highlight_worker","../display/line_numbers","../display/scrollbars"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m,v,y,w,b,C,k,x,S,$,L){"use strict";function A(e,t,i,n,r){let s=t,o=i,l=k.getLine(e,t.line);function a(n){let s;if(null==(s=r?u.moveVisually(e.cm,l,t,i):u.moveLogically(l,t,i))){if(n||!function(){let n=t.line+i;return!(n<e.first||n>=e.first+e.size)&&(t=new f.Pos(n,t.ch,t.sticky),l=k.getLine(e,n))}())return!1;t=u.endOfLine(r,e.cm,l,t.line,i)}else t=s;return!0}if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n){let r=null,s="group"==n,o=e.cm&&e.cm.getHelper(t,"wordChars");for(let e=!0;!(i<0)||a(!e);e=!1){let n=l.text.charAt(t.ch)||"\n",c=b.isWordChar(n,o)?"w":s&&"\n"==n?"n":!s||/\s/.test(n)?null:"p";if(!s||e||c||(c="s"),r&&r!=c){i<0&&(i=1,a(),t.sticky="after");break}if(c&&(r=c),i>0&&!a(!e))break}}let c=m.skipAtomic(e,t,s,o,!0);return f.equalCursorPos(s,c)&&(c.hitSide=!0),c}function M(e,t,i,n){let r,s,o=e.doc,l=t.left;if("page"==n){let n=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(n-.5*g.textHeight(e.display),3);r=(i>0?t.bottom:t.top)+i*s}else"line"==n&&(r=i>0?t.bottom+3:t.top-3);for(;(s=g.coordsChar(e,l,r)).outside;){if(i<0?r<=0:r>=o.height){s.hitSide=!0;break}r+=5*i}return s}return function(u){let T=u.optionHandlers,R=u.helpers={};u.prototype={constructor:u,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){let i=this.options,n=i[e];i[e]==t&&"mode"!=e||(i[e]=t,T.hasOwnProperty(e)&&d.operation(this,T[e])(this,t,n),r.signal(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](h.getKeyMap(e))},removeKeyMap:function(e){let t=this.state.keyMaps;for(let i=0;i<t.length;++i)if(t[i]==e||t[i].name==e)return t.splice(i,1),!0},addOverlay:d.methodOp(function(e,t){let i=e.token?e:u.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");b.insertSorted(this.state.overlays,{mode:i,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},e=>e.priority),this.state.modeGen++,x.regChange(this)}),removeOverlay:d.methodOp(function(e){let t=this.state.overlays;for(let i=0;i<t.length;++i){let n=t[i].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(i,1),this.state.modeGen++,void x.regChange(this)}}),indentLine:d.methodOp(function(e,t,i){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),k.isLine(this.doc,e)&&o.indentLine(this,e,t,i)}),indentSelection:d.methodOp(function(e){let t=this.doc.sel.ranges,i=-1;for(let n=0;n<t.length;n++){let r=t[n];if(r.empty())r.head.line>i&&(o.indentLine(this,r.head.line,e,!0),i=r.head.line,n==this.doc.sel.primIndex&&v.ensureCursorVisible(this));else{let s=r.from(),l=r.to(),a=Math.max(i,s.line);i=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(let t=a;t<i;++t)o.indentLine(this,t,e);let c=this.doc.sel.ranges;0==s.ch&&t.length==c.length&&c[n].from().ch>0&&m.replaceOneSelection(this.doc,n,new p.Range(s,c[n].to()),b.sel_dontScroll)}}}),getTokenAt:function(e,t){return s.takeToken(this,e,t)},getLineTokens:function(e,t){return s.takeToken(this,f.Pos(e),t,!0)},getTokenTypeAt:function(e){e=f.clipPos(this.doc,e);let t,i=s.getLineStyles(this,k.getLine(this.doc,e.line)),n=0,r=(i.length-1)/2,o=e.ch;if(0==o)t=i[2];else for(;;){let e=n+r>>1;if((e?i[2*e-1]:0)>=o)r=e;else{if(!(i[2*e+1]<o)){t=i[2*e+2];break}n=e+1}}let l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(e){let t=this.doc.mode;return t.innerMode?u.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){let i=[];if(!R.hasOwnProperty(t))return i;let n=R[t],r=this.getModeAt(e);if("string"==typeof r[t])n[r[t]]&&i.push(n[r[t]]);else if(r[t])for(let e=0;e<r[t].length;e++){let s=n[r[t][e]];s&&i.push(s)}else r.helperType&&n[r.helperType]?i.push(n[r.helperType]):n[r.name]&&i.push(n[r.name]);for(let e=0;e<n._global.length;e++){let t=n._global[e];t.pred(r,this)&&-1==b.indexOf(i,t.val)&&i.push(t.val)}return i},getStateAfter:function(e,t){let i=this.doc;return e=f.clipLine(i,null==e?i.first+i.size-1:e),s.getContextBefore(this,e+1,t).state},cursorCoords:function(e,t){let i,n=this.doc.sel.primary();return i=null==e?n.head:"object"==typeof e?f.clipPos(this.doc,e):e?n.from():n.to(),g.cursorCoords(this,i,t||"page")},charCoords:function(e,t){return g.charCoords(this,f.clipPos(this.doc,e),t||"page")},coordsChar:function(e,t){return e=g.fromCoordSystem(this,e,t||"page"),g.coordsChar(this,e.left,e.top)},lineAtHeight:function(e,t){return e=g.fromCoordSystem(this,{top:e,left:0},t||"page").top,k.lineAtHeight(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,i){let n,r=!1;if("number"==typeof e){let t=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>t&&(e=t,r=!0),n=k.getLine(this.doc,e)}else n=e;return g.intoCoordSystem(this,n,{top:0,left:0},t||"page",i||r).top+(r?this.doc.height-y.heightAtLine(n):0)},defaultTextHeight:function(){return g.textHeight(this.display)},defaultCharWidth:function(){return g.charWidth(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,r){let s=this.display,o=(e=g.cursorCoords(this,f.clipPos(this.doc,e))).bottom,l=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){let i=Math.max(s.wrapper.clientHeight,this.doc.height),r=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>i)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=i&&(o=e.bottom),l+t.offsetWidth>r&&(l=r-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="","right"==r?(l=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?l=0:"middle"==r&&(l=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),i&&v.scrollIntoView(this,{left:l,top:o,right:l+t.offsetWidth,bottom:o+t.offsetHeight})},triggerOnKeyDown:d.methodOp(a.onKeyDown),triggerOnKeyPress:d.methodOp(a.onKeyPress),triggerOnKeyUp:a.onKeyUp,triggerOnMouseDown:d.methodOp(c.onMouseDown),execCommand:function(e){if(t.commands.hasOwnProperty(e))return t.commands[e].call(null,this)},triggerElectric:d.methodOp(function(e){l.triggerElectric(this,e)}),findPosH:function(e,t,i,n){let r=1;t<0&&(r=-1,t=-t);let s=f.clipPos(this.doc,e);for(let e=0;e<t&&!(s=A(this.doc,s,r,i,n)).hitSide;++e);return s},moveH:d.methodOp(function(e,t){this.extendSelectionsBy(i=>this.display.shift||this.doc.extend||i.empty()?A(this.doc,i.head,e,t,this.options.rtlMoveVisually):e<0?i.from():i.to(),b.sel_move)}),deleteH:d.methodOp(function(t,i){let n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):e.deleteNearSelection(this,e=>{let n=A(r,e.head,t,i,!1);return t<0?{from:n,to:e.head}:{from:e.head,to:n}})}),findPosV:function(e,t,i,n){let r=1,s=n;t<0&&(r=-1,t=-t);let o=f.clipPos(this.doc,e);for(let e=0;e<t;++e){let e=g.cursorCoords(this,o,"div");if(null==s?s=e.left:e.left=s,(o=M(this,e,r,i)).hitSide)break}return o},moveV:d.methodOp(function(e,t){let i=this.doc,n=[],r=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy(s=>{if(r)return e<0?s.from():s.to();let o=g.cursorCoords(this,s.head,"div");null!=s.goalColumn&&(o.left=s.goalColumn),n.push(o.left);let l=M(this,o,e,t);return"page"==t&&s==i.sel.primary()&&v.addToScrollTop(this,g.charCoords(this,l,"div").top-o.top),l},b.sel_move),n.length)for(let e=0;e<i.sel.ranges.length;e++)i.sel.ranges[e].goalColumn=n[e]}),findWordAt:function(e){let t=this.doc,i=k.getLine(t,e.line).text,n=e.ch,r=e.ch;if(i){let t=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=i.length||!n?++r:--n;let s=i.charAt(n),o=b.isWordChar(s,t)?e=>b.isWordChar(e,t):/\s/.test(s)?e=>/\s/.test(e):e=>!/\s/.test(e)&&!b.isWordChar(e);for(;n>0&&o(i.charAt(n-1));)--n;for(;r<i.length&&o(i.charAt(r));)++r}return new p.Range(f.Pos(e.line,n),f.Pos(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?n.addClass(this.display.cursorDiv,"CodeMirror-overwrite"):n.rmClass(this.display.cursorDiv,"CodeMirror-overwrite"),r.signal(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==n.activeElt()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:d.methodOp(function(e,t){v.scrollToCoords(this,e,t)}),getScrollInfo:function(){let e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-g.scrollGap(this)-this.display.barHeight,width:e.scrollWidth-g.scrollGap(this)-this.display.barWidth,clientHeight:g.displayHeight(this),clientWidth:g.displayWidth(this)}},scrollIntoView:d.methodOp(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:f.Pos(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?v.scrollToRange(this,e):v.scrollToCoordsRange(this,e.from,e.to,e.margin)}),setSize:d.methodOp(function(e,t){let i=e=>"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e;null!=e&&(this.display.wrapper.style.width=i(e)),null!=t&&(this.display.wrapper.style.height=i(t)),this.options.lineWrapping&&g.clearLineMeasurementCache(this);let n=this.display.viewFrom;this.doc.iter(n,this.display.viewTo,e=>{if(e.widgets)for(let t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){x.regLineChange(this,n,"widget");break}++n}),this.curOp.forceUpdate=!0,r.signal(this,"refresh",this)}),operation:function(e){return d.runInOp(this,e)},startOperation:function(){return d.startOperation(this)},endOperation:function(){return d.endOperation(this)},refresh:d.methodOp(function(){let e=this.display.cachedTextHeight;x.regChange(this),this.curOp.forceUpdate=!0,g.clearCaches(this),v.scrollToCoords(this,this.doc.scrollLeft,this.doc.scrollTop),w.updateGutterSpace(this),(null==e||Math.abs(e-g.textHeight(this.display))>.5)&&g.estimateLineHeights(this),r.signal(this,"refresh",this)}),swapDoc:d.methodOp(function(e){let t=this.doc;return t.cm=null,i.attachDoc(this,e),g.clearCaches(this),this.display.input.reset(),v.scrollToCoords(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,C.signalLater(this,"swapDoc",this,t),t}),phrase:function(e){let t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters},startWorker:function(e){return S.startWorker(this,e)},maybeUpdateLineNumberWidth:function(){return $.maybeUpdateLineNumberWidth(this)},measureForScrollbars:function(){return L.measureForScrollbars(this)},updateScrollbars:function(e){return L.updateScrollbars(this,e)}},r.eventMixin(u),u.registerHelper=function(e,t,i){R.hasOwnProperty(e)||(R[e]=u[e]={_global:[]}),R[e][t]=i},u.registerGlobalHelper=function(e,t,i,n){u.registerHelper(e,t,n),R[e]._global.push({pred:i,val:n})}}}),define("skylark-codemirror/primitives/input/ContentEditableInput",["../display/operations","../display/selection","../display/view_tracking","./input","../line/pos","../line/utils_line","../measurement/position_measurement","../model/changes","../model/selection","../model/selection_updates","../util/bidi","../util/browser","../util/dom","../util/event","../util/misc"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g){"use strict";class p{constructor(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new g.Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}init(t){let i=this,r=i.cm,s=i.div=t.lineDiv;function o(e){if(f.signalDOMEvent(r,e))return;if(r.somethingSelected())n.setLastCopied({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;{let t=n.copyableRanges(r);n.setLastCopied({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation(()=>{r.setSelections(t.ranges,0,g.sel_dontScroll),r.replaceSelection("",null,"cut")})}}if(e.clipboardData){e.clipboardData.clearData();let t=n.lastCopied.text.join("\n");if(e.clipboardData.setData("Text",t),e.clipboardData.getData("Text")==t)return void e.preventDefault()}let t=n.hiddenTextarea(),o=t.firstChild;r.display.lineSpace.insertBefore(t,r.display.lineSpace.firstChild),o.value=n.lastCopied.text.join("\n");let l=document.activeElement;d.selectInput(o),setTimeout(()=>{r.display.lineSpace.removeChild(t),l.focus(),l==s&&i.showPrimarySelection()},50)}n.disableBrowserMagic(s,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),f.on(s,"paste",t=>{f.signalDOMEvent(r,t)||n.handlePaste(t,r)||u.ie_version<=11&&setTimeout(e.operation(r,()=>this.updateFromDOM()),20)}),f.on(s,"compositionstart",e=>{this.composing={data:e.data,done:!1}}),f.on(s,"compositionupdate",e=>{this.composing||(this.composing={data:e.data,done:!1})}),f.on(s,"compositionend",e=>{this.composing&&(e.data!=this.composing.data&&this.readFromDOMSoon(),this.composing.done=!0)}),f.on(s,"touchstart",()=>i.forceCompositionEnd()),f.on(s,"input",()=>{this.composing||this.readFromDOMSoon()}),f.on(s,"copy",o),f.on(s,"cut",o)}prepareSelection(){let e=t.prepareSelection(this.cm,!1);return e.focus=this.cm.state.focused,e}showSelection(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))}getSelection(){return this.cm.display.wrapper.ownerDocument.getSelection()}showPrimarySelection(){let e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),s=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||s.line<t.display.viewFrom)return void e.removeAllRanges();let o=y(t,e.anchorNode,e.anchorOffset),l=y(t,e.focusNode,e.focusOffset);if(o&&!o.bad&&l&&!l.bad&&0==r.cmp(r.minPos(o,l),n)&&0==r.cmp(r.maxPos(o,l),s))return;let a=t.display.view,c=n.line>=t.display.viewFrom&&m(t,n)||{node:a[0].measure.map[2],offset:0},h=s.line<t.display.viewTo&&m(t,s);if(!h){let e=a[a.length-1].measure,t=e.maps?e.maps[e.maps.length-1]:e.map;h={node:t[t.length-1],offset:t[t.length-2]-t[t.length-3]}}if(!c||!h)return void e.removeAllRanges();let f,g=e.rangeCount&&e.getRangeAt(0);try{f=d.range(c.node,c.offset,h.offset,h.node)}catch(e){}f&&(!u.gecko&&t.state.focused?(e.collapse(c.node,c.offset),f.collapsed||(e.removeAllRanges(),e.addRange(f))):(e.removeAllRanges(),e.addRange(f)),g&&null==e.anchorNode?e.addRange(g):u.gecko&&this.startGracePeriod()),this.rememberSelection()}startGracePeriod(){clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(()=>{this.gracePeriod=!1,this.selectionChanged()&&this.cm.operation(()=>this.cm.curOp.selectionChanged=!0)},20)}showMultipleSelections(e){d.removeChildrenAndAdd(this.cm.display.cursorDiv,e.cursors),d.removeChildrenAndAdd(this.cm.display.selectionDiv,e.selection)}rememberSelection(){let e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset}selectionInEditor(){let e=this.getSelection();if(!e.rangeCount)return!1;let t=e.getRangeAt(0).commonAncestorContainer;return d.contains(this.div,t)}focus(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())}blur(){this.div.blur()}getField(){return this.div}supportsTouch(){return!0}receivedFocus(){let t=this;this.selectionInEditor()?this.pollSelection():e.runInOp(this.cm,()=>t.cm.curOp.selectionChanged=!0),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})}selectionChanged(){let e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset}pollSelection(){if(null!=this.readDOMTimeout||this.gracePeriod||!this.selectionChanged())return;let t=this.getSelection(),i=this.cm;if(u.android&&u.chrome&&this.cm.options.gutters.length&&function(e){for(let t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(this.composing)return;this.rememberSelection();let n=y(i,t.anchorNode,t.anchorOffset),r=y(i,t.focusNode,t.focusOffset);n&&r&&e.runInOp(i,()=>{c.setSelection(i.doc,a.simpleSelection(n,r),g.sel_dontScroll),(n.bad||r.bad)&&(i.curOp.selectionChanged=!0)})}pollContent(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);let e,t,i,n=this.cm,a=n.display,c=n.doc.sel.primary(),h=c.from(),u=c.to();if(0==h.ch&&h.line>n.firstLine()&&(h=r.Pos(h.line-1,s.getLine(n.doc,h.line-1).length)),u.ch==s.getLine(n.doc,u.line).text.length&&u.line<n.lastLine()&&(u=r.Pos(u.line+1,0)),h.line<a.viewFrom||u.line>a.viewTo-1)return!1;h.line==a.viewFrom||0==(e=o.findViewIndex(n,h.line))?(t=s.lineNo(a.view[0].line),i=a.view[0].node):(t=s.lineNo(a.view[e].line),i=a.view[e-1].node.nextSibling);let d,f,p=o.findViewIndex(n,u.line);if(p==a.view.length-1?(d=a.viewTo-1,f=a.lineDiv.lastChild):(d=s.lineNo(a.view[p+1].line)-1,f=a.view[p+1].node.previousSibling),!i)return!1;let m=n.doc.splitLines(function(e,t,i,n,o){let l="",a=!1,c=e.doc.lineSeparator(),h=!1;function u(){a&&(l+=c,h&&(l+=c),a=h=!1)}function d(e){e&&(u(),l+=e)}function f(t){if(1==t.nodeType){let l=t.getAttribute("cm-text");if(l)return void d(l);let g,p=t.getAttribute("cm-marker");if(p){let t=e.findMarks(r.Pos(n,0),r.Pos(o+1,0),(i=+p,e=>e.id==i));return void(t.length&&(g=t[0].find(0))&&d(s.getBetween(e.doc,g.from,g.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;let m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&u();for(let e=0;e<t.childNodes.length;e++)f(t.childNodes[e]);/^(pre|p)$/i.test(t.nodeName)&&(h=!0),m&&(a=!0)}else 3==t.nodeType&&d(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var i}for(;f(t),t!=i;)t=t.nextSibling,h=!1;return l}(n,i,f,t,d)),v=s.getBetween(n.doc,r.Pos(t,0),r.Pos(d,s.getLine(n.doc,d).text.length));for(;m.length>1&&v.length>1;)if(g.lst(m)==g.lst(v))m.pop(),v.pop(),d--;else{if(m[0]!=v[0])break;m.shift(),v.shift(),t++}let y=0,w=0,b=m[0],C=v[0],k=Math.min(b.length,C.length);for(;y<k&&b.charCodeAt(y)==C.charCodeAt(y);)++y;let x=g.lst(m),S=g.lst(v),$=Math.min(x.length-(1==m.length?y:0),S.length-(1==v.length?y:0));for(;w<$&&x.charCodeAt(x.length-w-1)==S.charCodeAt(S.length-w-1);)++w;if(1==m.length&&1==v.length&&t==h.line)for(;y&&y>h.ch&&x.charCodeAt(x.length-w-1)==S.charCodeAt(S.length-w-1);)y--,w++;m[m.length-1]=x.slice(0,x.length-w).replace(/^\u200b+/,""),m[0]=m[0].slice(y).replace(/\u200b+$/,"");let L=r.Pos(t,y),A=r.Pos(d,v.length?g.lst(v).length-w:0);return m.length>1||m[0]||r.cmp(L,A)?(l.replaceRange(n.doc,m,L,A,"+input"),!0):void 0}ensurePolled(){this.forceCompositionEnd()}reset(){this.forceCompositionEnd()}forceCompositionEnd(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())}readFromDOMSoon(){null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(()=>{if(this.readDOMTimeout=null,this.composing){if(!this.composing.done)return;this.composing=null}this.updateFromDOM()},80))}updateFromDOM(){!this.cm.isReadOnly()&&this.pollContent()||e.runInOp(this.cm,()=>i.regChange(this.cm))}setUneditable(e){e.contentEditable="false"}onKeyPress(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||e.operation(this.cm,n.applyTextInput)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))}readOnlyChanged(e){this.div.contentEditable=String("nocursor"!=e)}onContextMenu(){}resetPosition(){}}function m(e,t){let i=o.findViewForLine(e,t.line);if(!i||i.hidden)return null;let n=s.getLine(e.doc,t.line),r=o.mapFromLineView(i,n,t.line),l=h.getOrder(n,e.doc.direction),a="left";if(l){let e=h.getBidiPartAt(l,t.ch);a=e%2?"right":"left"}let c=o.nodeAndOffsetInLineMap(r.map,t.ch,a);return c.offset="right"==c.collapse?c.end:c.start,c}function v(e,t){return t&&(e.bad=!0),e}function y(e,t,i){let n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[i]))return v(e.clipPos(r.Pos(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(let r=0;r<e.display.view.length;r++){let s=e.display.view[r];if(s.node==n)return w(s,t,i)}}function w(e,t,i){let n=e.text.firstChild,o=!1;if(!t||!d.contains(n,t))return v(r.Pos(s.lineNo(e.line),0),!0);if(t==n&&(o=!0,t=n.childNodes[i],i=0,!t)){let t=e.rest?g.lst(e.rest):e.line;return v(r.Pos(s.lineNo(t),t.text.length),o)}let l=3==t.nodeType?t:null,a=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,i&&(i=l.nodeValue.length));a.parentNode!=n;)a=a.parentNode;let c=e.measure,h=c.maps;function u(t,i,n){for(let o=-1;o<(h?h.length:0);o++){let l=o<0?c.map:h[o];for(let a=0;a<l.length;a+=3){let c=l[a+2];if(c==t||c==i){let i=s.lineNo(o<0?e.line:e.rest[o]),h=l[a]+n;return(n<0||c!=t)&&(h=l[a+(n?1:0)]),r.Pos(i,h)}}}}let f=u(l,a,i);if(f)return v(f,o);for(let e=a.nextSibling,t=l?l.nodeValue.length-i:0;e;e=e.nextSibling){if(f=u(e,e.firstChild,0))return v(r.Pos(f.line,f.ch-t),o);t+=e.textContent.length}for(let e=a.previousSibling,t=i;e;e=e.previousSibling){if(f=u(e,e.firstChild,-1))return v(r.Pos(f.line,f.ch+t),o);t+=e.textContent.length}}return p.prototype.needsContentAttribute=!0,p}),define("skylark-codemirror/primitives/input/TextareaInput",["../display/operations","../display/selection","./input","../measurement/position_measurement","../measurement/widgets","../model/selection","../model/selection_updates","../util/browser","../util/dom","../util/event","../util/feature_detection","../util/misc"],function(e,t,i,n,r,s,o,l,a,c,h,u){"use strict";class d{constructor(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new u.Delayed,this.hasSelection=!1,this.composing=null}init(e){let t=this,n=this.cm;this.createField(e);const s=this.textarea;function o(e){if(!c.signalDOMEvent(n,e)){if(n.somethingSelected())i.setLastCopied({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;{let r=i.copyableRanges(n);i.setLastCopied({lineWise:!0,text:r.text}),"cut"==e.type?n.setSelections(r.ranges,null,u.sel_dontScroll):(t.prevInput="",s.value=r.text.join("\n"),a.selectInput(s))}}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),l.ios&&(s.style.width="0px"),c.on(s,"input",()=>{l.ie&&l.ie_version>=9&&this.hasSelection&&(this.hasSelection=null),t.poll()}),c.on(s,"paste",e=>{c.signalDOMEvent(n,e)||i.handlePaste(e,n)||(n.state.pasteIncoming=+new Date,t.fastPoll())}),c.on(s,"cut",o),c.on(s,"copy",o),c.on(e.scroller,"paste",i=>{if(r.eventInWidget(e,i)||o.signalDOMEvent(n,i))return;if(!s.dispatchEvent)return n.state.pasteIncoming=+new Date,void t.focus();const o=new Event("paste");o.clipboardData=i.clipboardData,s.dispatchEvent(o)}),c.on(e.lineSpace,"selectstart",t=>{r.eventInWidget(e,t)||c.e_preventDefault(t)}),c.on(s,"compositionstart",()=>{let e=n.getCursor("from");t.composing&&t.composing.range.clear(),t.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),c.on(s,"compositionend",()=>{t.composing&&(t.poll(),t.composing.range.clear(),t.composing=null)})}createField(e){this.wrapper=i.hiddenTextarea(),this.textarea=this.wrapper.firstChild}prepareSelection(){let e=this.cm,i=e.display,r=e.doc,s=t.prepareSelection(e);if(e.options.moveInputWithCursor){let t=n.cursorCoords(e,r.sel.primary().head,"div"),o=i.wrapper.getBoundingClientRect(),l=i.lineDiv.getBoundingClientRect();s.teTop=Math.max(0,Math.min(i.wrapper.clientHeight-10,t.top+l.top-o.top)),s.teLeft=Math.max(0,Math.min(i.wrapper.clientWidth-10,t.left+l.left-o.left))}return s}showSelection(e){let t=this.cm,i=t.display;a.removeChildrenAndAdd(i.cursorDiv,e.cursors),a.removeChildrenAndAdd(i.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")}reset(e){if(this.contextMenuPending||this.composing)return;let t=this.cm;if(t.somethingSelected()){this.prevInput="";let e=t.getSelection();this.textarea.value=e,t.state.focused&&a.selectInput(this.textarea),l.ie&&l.ie_version>=9&&(this.hasSelection=e)}else e||(this.prevInput=this.textarea.value="",l.ie&&l.ie_version>=9&&(this.hasSelection=null))}getField(){return this.textarea}supportsTouch(){return!1}focus(){if("nocursor"!=this.cm.options.readOnly&&(!l.mobile||a.activeElt()!=this.textarea))try{this.textarea.focus()}catch(e){}}blur(){this.textarea.blur()}resetPosition(){this.wrapper.style.top=this.wrapper.style.left=0}receivedFocus(){this.slowPoll()}slowPoll(){this.pollingFast||this.polling.set(this.cm.options.pollInterval,()=>{this.poll(),this.cm.state.focused&&this.slowPoll()})}fastPoll(){let e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function i(){let n=t.poll();n||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,i))})}poll(){let t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||h.hasSelection(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;let s=n.value;if(s==r&&!t.somethingSelected())return!1;if(l.ie&&l.ie_version>=9&&this.hasSelection===s||l.mac&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){let e=s.charCodeAt(0);if(8203!=e||r||(r="​"),8666==e)return this.reset(),this.cm.execCommand("undo")}let o=0,a=Math.min(r.length,s.length);for(;o<a&&r.charCodeAt(o)==s.charCodeAt(o);)++o;return e.runInOp(t,()=>{i.applyTextInput(t,s.slice(o),r.length-o,null,this.composing?"*compose":null),s.length>1e3||s.indexOf("\n")>-1?n.value=this.prevInput="":this.prevInput=s,this.composing&&(this.composing.range.clear(),this.composing.range=t.markText(this.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0}ensurePolled(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)}onKeyPress(){l.ie&&l.ie_version>=9&&(this.hasSelection=null),this.fastPoll()}onContextMenu(t){let i=this,r=i.cm,a=r.display,h=i.textarea;i.contextMenuPending&&i.contextMenuPending();let d=n.posFromMouse(r,t),f=a.scroller.scrollTop;if(!d||l.presto)return;let g=r.options.resetSelectionOnContextMenu;g&&-1==r.doc.sel.contains(d)&&e.operation(r,o.setSelection)(r.doc,s.simpleSelection(d),u.sel_dontScroll);let p,m=h.style.cssText,v=i.wrapper.style.cssText,y=i.wrapper.offsetParent.getBoundingClientRect();function w(){if(null!=h.selectionStart){let e=r.somethingSelected(),t="​"+(e?h.value:"");h.value="⇚",h.value=t,i.prevInput=e?"":"​",h.selectionStart=1,h.selectionEnd=t.length,a.selForContextMenu=r.doc.sel}}function b(){if(i.contextMenuPending==b&&(i.contextMenuPending=!1,i.wrapper.style.cssText=v,h.style.cssText=m,l.ie&&l.ie_version<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=f),null!=h.selectionStart)){(!l.ie||l.ie&&l.ie_version<9)&&w();let t=0,n=()=>{a.selForContextMenu==r.doc.sel&&0==h.selectionStart&&h.selectionEnd>0&&"​"==i.prevInput?e.operation(r,o.selectAll)(r):t++<10?a.detectingSelectAll=setTimeout(n,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(n,200)}}if(i.wrapper.style.cssText="position: static",h.style.cssText=`position: absolute; width: 30px; height: 30px;\n      top: ${t.clientY-y.top-5}px; left: ${t.clientX-y.left-5}px;\n      z-index: 1000; background: ${l.ie?"rgba(255, 255, 255, .05)":"transparent"};\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`,l.webkit&&(p=window.scrollY),a.input.focus(),l.webkit&&window.scrollTo(null,p),a.input.reset(),r.somethingSelected()||(h.value=i.prevInput=" "),i.contextMenuPending=b,a.selForContextMenu=r.doc.sel,clearTimeout(a.detectingSelectAll),l.ie&&l.ie_version>=9&&w(),l.captureRightClick){c.e_stop(t);let e=()=>{c.off(window,"mouseup",e),setTimeout(b,20)};c.on(window,"mouseup",e)}else setTimeout(b,50)}readOnlyChanged(e){e||this.reset(),this.textarea.disabled="nocursor"==e}setUneditable(){}}return d.prototype.needsContentAttribute=!1,d}),define("skylark-codemirror/primitives/edit/fromTextArea",["./CodeMirror","../util/dom","../util/event","../util/misc"],function(e,t,i,n){"use strict";return{fromTextArea:function(r,s){(s=s?n.copyObj(s):{}).value=r.value,!s.tabindex&&r.tabIndex&&(s.tabindex=r.tabIndex);!s.placeholder&&r.placeholder&&(s.placeholder=r.placeholder);if(null==s.autofocus){let e=t.activeElt();s.autofocus=e==r||null!=r.getAttribute("autofocus")&&e==document.body}function o(){r.value=a.getValue()}let l;if(r.form&&(i.on(r.form,"submit",o),!s.leaveSubmitMethodAlone)){let e=r.form;l=e.submit;try{let t=e.submit=(()=>{o(),e.submit=l,e.submit(),e.submit=t})}catch(e){}}s.finishInit=(e=>{e.save=o,e.getTextArea=(()=>r),e.toTextArea=(()=>{e.toTextArea=isNaN,o(),r.parentNode.removeChild(e.getWrapperElement()),r.style.display="",r.form&&(i.off(r.form,"submit",o),"function"==typeof r.form.submit&&(r.form.submit=l))})}),r.style.display="none";let a=e(e=>r.parentNode.insertBefore(e,r.nextSibling),s);return a}}}),define("skylark-codemirror/primitives/edit/legacy",["../display/scrollbars","../display/scroll_events","../input/keymap","../input/keynames","../line/line_data","../line/pos","../model/change_measurement","../model/Doc","../model/line_widget","../model/mark_text","../modes","../util/dom","../util/event","../util/feature_detection","../util/misc","../util/StringStream","./commands"],function(e,t,i,n,r,s,o,l,a,c,h,u,d,f,g,p,m){"use strict";return{addLegacyProps:function(v){v.off=d.off,v.on=d.on,v.wheelEventPixels=t.wheelEventPixels,v.Doc=l,v.splitLines=f.splitLinesAuto,v.countColumn=g.countColumn,v.findColumn=g.findColumn,v.isWordChar=g.isWordCharBasic,v.Pass=g.Pass,v.signal=d.signal,v.Line=r.Line,v.changeEnd=o.changeEnd,v.scrollbarModel=e.scrollbarModel,v.Pos=s.Pos,v.cmpPos=s.cmp,v.modes=h.modes,v.mimeModes=h.mimeModes,v.resolveMode=h.resolveMode,v.getMode=h.getMode,v.modeExtensions=h.modeExtensions,v.extendMode=h.extendMode,v.copyState=h.copyState,v.startState=h.startState,v.innerMode=h.innerMode,v.commands=m.commands,v.keyMap=i.keyMap,v.keyName=i.keyName,v.isModifierKey=i.isModifierKey,v.lookupKey=i.lookupKey,v.normalizeKeyMap=i.normalizeKeyMap,v.StringStream=p,v.SharedTextMarker=c.SharedTextMarker,v.TextMarker=c.TextMarker,v.LineWidget=a.LineWidget,v.e_preventDefault=d.e_preventDefault,v.e_stopPropagation=d.e_stopPropagation,v.e_stop=d.e_stop,v.addClass=u.addClass,v.contains=u.contains,v.rmClass=u.rmClass,v.keyNames=n.keyNames}}}),define("skylark-codemirror/primitives/edit/main",["./CodeMirror","../util/event","../util/misc","./options","./methods","../model/Doc","../input/ContentEditableInput","../input/TextareaInput","../modes","./fromTextArea","./legacy"],function(e,t,i,n,r,s,o,l,a,c,h){"use strict";n.defineOptions(e),r(e);let u="iter insert remove copy getEditor constructor".split(" ");for(let t in s.prototype)s.prototype.hasOwnProperty(t)&&i.indexOf(u,t)<0&&(e.prototype[t]=function(e){return function(){return e.apply(this.doc,arguments)}}(s.prototype[t]));return t.eventMixin(s),e.inputStyles={textarea:l,contenteditable:o},e.defineMode=function(t){e.defaults.mode||"null"==t||(e.defaults.mode=t),a.defineMode.apply(this,arguments)},e.defineMIME=a.defineMIME,e.defineMode("null",()=>({token:e=>e.skipToEnd()})),e.defineMIME("text/plain","null"),e.defineExtension=((t,i)=>{e.prototype[t]=i}),e.defineDocExtension=((e,t)=>{s.prototype[e]=t}),e.fromTextArea=c.fromTextArea,h.addLegacyProps(e),e.version="5.45.0",{CodeMirror:e}}),define("skylark-codemirror/CodeMirror",["./cm","./primitives/edit/main"],function(e,t){"use strict";return e.CodeMirror=t.CodeMirror}),define("skylark-jotted/plugins/codemirror",["skylark-codemirror/CodeMirror","../util"],function(e,t){"use strict";return class{constructor(i,n){var r;this.editor={},this.jotted=i;var s={html:"htmlmixed"};n=t.extend(n,{lineNumbers:!0});var o=i.$container.querySelectorAll(".jotted-editor");for(r=0;r<o.length;r++){let i=o[r].querySelector("textarea"),l=t.data(i,"jotted-type"),a=t.data(i,"jotted-file");this.editor[l]=e.fromTextArea(i,n),this.editor[l].setOption("mode",t.getMode(l,a,s))}i.on("change",this.change.bind(this),1)}editorChange(e){return()=>{this.jotted.trigger("change",e)}}change(e,t){var i=this.editor[e.type];e.cmEditor||(i.setValue(e.content),e.cmEditor=i,i.on("change",this.editorChange(e))),e.content=i.getValue(),t(null,e)}}}),define("skylark-jotted/plugins/less",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{}),void 0!==window.less&&(t.$container.querySelector('a[data-jotted-type="css"]').innerHTML="Less",t.on("change",this.change.bind(this),20))}isLess(e){return"css"===e.type&&(-1!==e.file.indexOf(".less")||""===e.file)}change(e,t){this.isLess(e)?window.less.render(e.content,this.options,(i,n)=>{if(i)return t(i,e);e.content=n.css,t(null,e)}):t(null,e)}}}),define("skylark-jotted/plugins/coffeescript",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{}),void 0!==window.CoffeeScript&&(t.$container.querySelector('a[data-jotted-type="js"]').innerHTML="CoffeeScript",t.on("change",this.change.bind(this),20))}isCoffee(e){return"js"===e.type&&(-1!==e.file.indexOf(".coffee")||""===e.file)}change(e,t){if(this.isCoffee(e))try{e.content=window.CoffeeScript.compile(e.content)}catch(i){return t(i,e)}t(null,e)}}}),define("skylark-jotted/plugins/stylus",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{}),void 0!==window.stylus&&(t.$container.querySelector('a[data-jotted-type="css"]').innerHTML="Stylus",t.on("change",this.change.bind(this),20))}isStylus(e){return"css"===e.type&&(-1!==e.file.indexOf(".styl")||""===e.file)}change(e,t){this.isStylus(e)?window.stylus(e.content,this.options).render((i,n)=>{if(i)return t(i,e);e.content=n,t(null,e)}):t(null,e)}}}),define("skylark-jotted/plugins/babel",["../util"],function(e){"use strict";return class{constructor(t,i){if(this.options=e.extend(i,{}),void 0!==window.Babel)this.babel=window.Babel;else{if(void 0===window.babel)return;this.babel={transform:window.babel}}t.$container.querySelector('a[data-jotted-type="js"]').innerHTML="ES2015",t.on("change",this.change.bind(this),20)}change(e,t){if("js"===e.type){try{e.content=this.babel.transform(e.content,this.options).code}catch(i){return t(i,e)}t(null,e)}else t(null,e)}}}),define("skylark-jotted/plugins/markdown",["../util"],function(e){"use strict";return class{constructor(t,i){this.options=e.extend(i,{}),void 0!==window.marked&&(window.marked.setOptions(i),t.$container.querySelector('a[data-jotted-type="html"]').innerHTML="Markdown",t.on("change",this.change.bind(this),20))}change(e,t){if("html"===e.type){try{e.content=window.marked(e.content)}catch(i){return t(i,e)}t(null,e)}else t(null,e)}}}),define("skylark-jotted/plugins/console",["../util"],function(e){"use strict";return class{constructor(t,i){i=e.extend(i,{autoClear:!1});var n=`(function ${this.capture.toString()})();`,r=document.createElement("li");e.addClass(r,"jotted-nav-item jotted-nav-item-console"),r.innerHTML='<a href="#" data-jotted-type="console">JS Console</a>';var s=document.createElement("div");e.addClass(s,"jotted-pane jotted-pane-console"),s.innerHTML='\n      <div class="jotted-console-container">\n        <ul class="jotted-console-output"></ul>\n        <form class="jotted-console-input">\n          <input type="text">\n        </form>\n      </div>\n      <button class="jotted-button jotted-console-clear">Clear</button>\n    ',t.$container.appendChild(s),t.$container.querySelector(".jotted-nav").appendChild(r);var o=t.$container.querySelector(".jotted-console-container"),l=t.$container.querySelector(".jotted-console-output"),a=t.$container.querySelector(".jotted-console-input input"),c=t.$container.querySelector(".jotted-console-input"),h=t.$container.querySelector(".jotted-console-clear");c.addEventListener("submit",this.submit.bind(this)),a.addEventListener("keydown",this.history.bind(this)),h.addEventListener("click",this.clear.bind(this)),!0===i.autoClear&&t.on("change",this.autoClear.bind(this),29),t.on("change",this.change.bind(this),30),window.addEventListener("message",this.getMessage.bind(this)),this.$jottedContainer=t.$container,this.$container=o,this.$input=a,this.$output=l,this.history=[],this.historyIndex=0,this.logCaptureSnippet=n,this.contentCache={html:"",css:"",js:""},this.getIframe=this.getIframe.bind(this)}getIframe(){return this.$jottedContainer.querySelector(".jotted-pane-result iframe")}getMessage(e){if(e.source===this.getIframe().contentWindow){var t={};try{t=JSON.parse(e.data)}catch(e){}"jotted-console-log"===t.type&&this.log(t.message)}}autoClear(e,t){var i=e.content;"js"===e.type&&(i=i.replace(this.logCaptureSnippet,"")),!0!==e.forceRender&&this.contentCache[e.type]===i||this.clear(),this.contentCache[e.type]=i,t(null,e)}change(e,t){if("js"!==e.type)return t(null,e);-1===e.content.indexOf(this.logCaptureSnippet)&&(e.content=`${this.logCaptureSnippet}${e.content}`),t(null,e)}capture(){void 0!==window.console&&void 0!==window.console.log||(window.console={log:function(){}});var e=Function.prototype.bind.call(window.console.log,window.console);window.console.log=function(){[].slice.call(arguments).forEach(function(e){window.parent.postMessage(JSON.stringify({type:"jotted-console-log",message:e}),"*")}),e.apply(e,arguments)}}log(t="",i){var n=document.createElement("li");e.addClass(n,"jotted-console-log"),void 0!==i&&e.addClass(n,`jotted-console-log-${i}`),n.innerHTML=t,this.$output.appendChild(n)}submit(e){var t=this.$input.value.trim();if(""===t)return e.preventDefault();this.history.push(t),this.historyIndex=this.history.length,this.log(t,"history"),0!==t.indexOf("return")&&(t="return "+t);try{var i=this.getIframe().contentWindow.eval(`(function() {${t}})()`);this.log(i)}catch(e){this.log(e,"error")}this.$input.value="",this.$container.scrollTop=this.$container.scrollHeight,e.preventDefault()}clear(){this.$output.innerHTML=""}history(e){var t=!1,i=this.$input.selectionStart;38===e.keyCode&&0!==this.historyIndex&&0===i&&(this.historyIndex--,t=!0),40===e.keyCode&&this.historyIndex!==this.history.length-1&&i===this.$input.value.length&&(this.historyIndex++,t=!0),t&&(this.$input.value=this.history[this.historyIndex])}}}),define("skylark-jotted/plugins/play",["../util"],function(e){"use strict";return class{constructor(t,i){var n={};!1===(i=e.extend(i,{firstRun:!0})).firstRun&&(n={html:{type:"html",content:""},css:{type:"css",content:""},js:{type:"js",content:""}});var r=document.createElement("button");r.className="jotted-button jotted-button-play",r.innerHTML="Run",t.$container.appendChild(r),r.addEventListener("click",this.run.bind(this)),t.on("change",this.change.bind(this),10),this.cache=n,this.code={},this.jotted=t}change(t,i){this.code[t.type]=e.extend(t),void 0!==this.cache[t.type]?(i(null,this.cache[t.type]),this.cache[t.type].forceRender=null):(this.cache[t.type]=e.extend(t),i(null,t))}run(){for(let t in this.code)this.cache[t]=e.extend(this.code[t],{forceRender:!0}),this.jotted.trigger("change",this.cache[t])}}}),define("skylark-jotted/plugins/pen",[],function(){"use strict";return class{constructor(e,t){let i={html:{title:"HTML",classChecker:"jotted-has-html"},css:{title:"CSS",classChecker:"jotted-has-css"},js:{title:"JavaScript",classChecker:"jotted-has-js"},console:{title:"Console",classChecker:"jotted-plugin-console"}},n=[];for(let t in i)e.$container.classList.contains(i[t].classChecker)&&n.push(e.$container.querySelector(`.jotted-pane-${t}`));this.resizablePanes=[];for(let t=0;t<n.length;t++){let r;for(let e=0;e<n[t].classList.length;e++)if(-1!==n[t].classList[e].indexOf("jotted-pane-")){r=n[t].classList[e].replace("jotted-pane-","");break}if(!r)continue;let s={container:n[t],expander:void 0};this.resizablePanes.push(s);let o=document.createElement("div");o.classList.add("jotted-pane-title"),o.innerHTML=i[r].title||r;let l=n[t].firstElementChild;l.insertBefore(o,l.firstChild),t>0&&(s.expander=document.createElement("div"),s.expander.classList.add("jotted-plugin-pen-expander"),s.expander.addEventListener("mousedown",this.startExpand.bind(this,e)),l.insertBefore(s.expander,o))}}startExpand(e,t){let i=this.resizablePanes.filter(e=>e.expander===t.target).shift(),n=this.resizablePanes[this.resizablePanes.indexOf(i)-1],r=100/parseInt(window.getComputedStyle(i.container.parentNode).width,10);i.container.parentNode.style.display="none",i.startX=t.clientX,i.startWidth=parseFloat(window.getComputedStyle(i.container).width,10),n.startWidth=parseFloat(window.getComputedStyle(n.container).width,10),i.container.parentNode.style.display="",i.mousemove=this.doDrag.bind(this,i,n,r),i.mouseup=this.stopDrag.bind(this,i),document.addEventListener("mousemove",i.mousemove,!1),document.addEventListener("mouseup",i.mouseup,!1)}doDrag(e,t,i,n){let r=t.startWidth+(n.clientX-e.startX)*i,s=e.startWidth-(n.clientX-e.startX)*i;r>=10&&s>=10&&(e.container.style.maxWidth="none",t.container.style.maxWidth="none",t.container.style.width=`${r}%`,e.container.style.width=`${s}%`)}stopDrag(e,t){document.removeEventListener("mousemove",e.mousemove,!1),document.removeEventListener("mouseup",e.mouseup,!1)}}}),define("skylark-jotted/bundle-plugins",["./plugins/render","./plugins/scriptless","./plugins/ace","./plugins/codemirror","./plugins/less","./plugins/coffeescript","./plugins/stylus","./plugins/babel","./plugins/markdown","./plugins/console","./plugins/play","./plugins/pen"],function(e,t,i,n,r,s,o,l,a,c,h,u){"use strict";return function(d){d.plugin("render",e),d.plugin("scriptless",t),d.plugin("ace",i),d.plugin("codemirror",n),d.plugin("less",r),d.plugin("coffeescript",s),d.plugin("stylus",o),d.plugin("babel",l),d.plugin("markdown",a),d.plugin("console",c),d.plugin("play",h),d.plugin("pen",u)}}),define("skylark-jotted/Jotted",["skylark-langx/skylark","./util","./template","./plugin","./pubsoup","./bundle-plugins"],function(e,t,i,n,r,s){"use strict";class o{constructor(e,s){if(!e)throw new Error("Can't find Jotted container.");var o={};this._get=function(e){return o[e]},this._set=function(e,t){return o[e]=t,o[e]};var l=this._set("options",t.extend(s,{files:[],showBlank:!1,runScripts:!0,pane:"result",debounce:250,plugins:[]}));l.plugins.push("render"),!1===l.runScripts&&l.plugins.push("scriptless"),this._set("cachedContent",{html:null,css:null,js:null});var a=this._set("pubsoup",new r);this._set("trigger",this.trigger()),this._set("on",function(){a.subscribe.apply(a,arguments)}),this._set("off",function(){a.unsubscribe.apply(a,arguments)});var c=this._set("done",function(){a.done.apply(a,arguments)});c("change",this.errors.bind(this));var h=this._set("$container",e);h.innerHTML=i.container(),t.addClass(h,i.containerClass());var u=this._set("paneActive",l.pane);t.addClass(h,i.paneActiveClass(u)),this._set("$status",{});for(let e of["html","css","js"])this.markup(e);h.addEventListener("keyup",t.debounce(this.change.bind(this),l.debounce)),h.addEventListener("change",t.debounce(this.change.bind(this),l.debounce)),h.addEventListener("click",this.pane.bind(this)),this.$container=this._get("$container"),this.on=this._get("on"),this.off=this._get("off"),this.done=this._get("done"),this.trigger=this._get("trigger"),this.paneActive=this._get("paneActive"),this._set("plugins",{}),n.init.call(this);for(let e of["html","css","js"])this.load(e);if(l.showBlank)for(let e of["html","css","js"])t.addClass(h,i.hasFileClass(e))}findFile(e){var t=this._get("options");for(let i in t.files){let n=t.files[i];if(n.type===e)return n}return{}}markup(e){var n=this._get("$container"),r=n.querySelector(`.jotted-pane-${e}`),s=this.findFile(e),o=document.createElement("div");o.innerHTML=i.editorContent(e,s.url),o.className=i.editorClass(e),r.appendChild(o),this._get("$status")[e]=r.querySelector(".jotted-status"),void 0===s.url&&void 0===s.content||t.addClass(n,i.hasFileClass(e))}load(e){var n=this.findFile(e),r=this._get("$container").querySelector(`.jotted-pane-${e} textarea`);void 0!==n.content?this.setValue(r,n.content):void 0!==n.url?(this.status("loading",[i.statusLoading(n.url)],{type:e,file:n}),t.fetch(n.url,(t,n)=>{t?this.status("error",[i.statusFetchError(t)],{type:e}):(this.clearStatus("loading",{type:e}),this.setValue(r,n))})):this.setValue(r,"")}setValue(e,t){e.value=t,this.change({target:e})}change(e){var i=t.data(e.target,"jotted-type");if(i){var n=this._get("cachedContent");n[i]!==e.target.value&&(n[i]=e.target.value,this.trigger("change",{type:i,file:t.data(e.target,"jotted-file"),content:n[i]}))}}errors(e,t){this.status("error",e,t)}pane(e){if(t.data(e.target,"jotted-type")){var n=this._get("$container"),r=this._get("paneActive");t.removeClass(n,i.paneActiveClass(r)),r=this._set("paneActive",t.data(e.target,"jotted-type")),t.addClass(n,i.paneActiveClass(r)),e.preventDefault()}}status(e="error",n=[],r={}){if(!n.length)return this.clearStatus(e,r);var s=this._get("$status");t.addClass(s[r.type],i.statusClass(e)),t.addClass(this._get("$container"),i.statusActiveClass(r.type));var o="";n.forEach(function(e){o+=i.statusMessage(e)}),s[r.type].innerHTML=o}clearStatus(e,n){var r=this._get("$status");t.removeClass(r[n.type],i.statusClass(e)),t.removeClass(this._get("$container"),i.statusActiveClass(n.type)),r[n.type].innerHTML=""}trigger(){var e=this._get("options"),t=this._get("pubsoup");if(!1===e.debounce)return function(){t.publish.apply(t,arguments)};var i={},n={};return function(r,{type:s="default"}={}){i[s]?n[s]=!0:t.publish.apply(t,arguments),clearTimeout(i[s]),i[s]=setTimeout(()=>{n[s]&&t.publish.apply(t,arguments),n[s]=null,i[s]=null},e.debounce)}}}return o.plugin=function(){return n.register.apply(this,arguments)},s(o),e.attach("itg.Jotted",o)}),define("skylark-jotted/main",["./Jotted"],function(e){return e}),define("skylark-jotted",["skylark-jotted/main"],function(e){return e})}(define,require),!isAmd){var skylarkjs=require("skylark-langx/skylark");isCmd?module.exports=skylarkjs:globals.skylarkjs=skylarkjs}}(0,this);
  //# sourceMappingURL=sourcemaps/skylark-jotted-all.js.map
  