three-codeeditor
Version:
codeeditor for three.js
33 lines (32 loc) • 506 kB
JavaScript
/*! three-codeeditor-v0.1.4-seth.6 2017-11-18 */
var THREEx=THREEx||{};THREEx.DomEvents=function(a,b){this._camera=a||null,this._domElement=b||document,this._raycaster=new THREE.Raycaster,this._selected=null,this._boundObjs={};var c=this;this._$onClick=function(){c._onClick.apply(c,arguments)},this._$onDblClick=function(){c._onDblClick.apply(c,arguments)},this._$onMouseMove=function(){c._onMouseMove.apply(c,arguments)},this._$onMouseDown=function(){c._onMouseDown.apply(c,arguments)},this._$onMouseUp=function(){c._onMouseUp.apply(c,arguments)},this._$onTouchMove=function(){c._onTouchMove.apply(c,arguments)},this._$onTouchStart=function(){c._onTouchStart.apply(c,arguments)},this._$onTouchEnd=function(){c._onTouchEnd.apply(c,arguments)},this._$onContextmenu=function(){c._onContextmenu.apply(c,arguments)},this._domElement.addEventListener("click",this._$onClick,!1),this._domElement.addEventListener("dblclick",this._$onDblClick,!1),this._domElement.addEventListener("mousemove",this._$onMouseMove,!1),this._domElement.addEventListener("mousedown",this._$onMouseDown,!1),this._domElement.addEventListener("mouseup",this._$onMouseUp,!1),this._domElement.addEventListener("touchmove",this._$onTouchMove,!1),this._domElement.addEventListener("touchstart",this._$onTouchStart,!1),this._domElement.addEventListener("touchend",this._$onTouchEnd,!1),this._domElement.addEventListener("contextmenu",this._$onContextmenu,!1)},THREEx.DomEvents.prototype.destroy=function(){this._domElement.removeEventListener("click",this._$onClick,!1),this._domElement.removeEventListener("dblclick",this._$onDblClick,!1),this._domElement.removeEventListener("mousemove",this._$onMouseMove,!1),this._domElement.removeEventListener("mousedown",this._$onMouseDown,!1),this._domElement.removeEventListener("mouseup",this._$onMouseUp,!1),this._domElement.removeEventListener("touchmove",this._$onTouchMove,!1),this._domElement.removeEventListener("touchstart",this._$onTouchStart,!1),this._domElement.removeEventListener("touchend",this._$onTouchEnd,!1),this._domElement.removeEventListener("contextmenu",this._$onContextmenu,!1)},THREEx.DomEvents.eventNames=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu","touchstart","touchend"],THREEx.DomEvents.prototype._getRelativeMouseXY=function(a){var b=a.target||a.srcElement;3===b.nodeType&&(b=b.parentNode);var c={x:0,y:0},d=b,e=getComputedStyle(d,null);c.y+=parseInt(e.getPropertyValue("padding-top"),10),c.x+=parseInt(e.getPropertyValue("padding-left"),10);do{c.x+=d.offsetLeft,c.y+=d.offsetTop,e=getComputedStyle(d,null),c.x+=parseInt(e.getPropertyValue("border-left-width"),10),c.y+=parseInt(e.getPropertyValue("border-top-width"),10)}while(d=d.offsetParent);var f={width:b===window?window.innerWidth:b.offsetWidth,height:b===window?window.innerHeight:b.offsetHeight};return{x:+(a.pageX-c.x)/f.width*2-1,y:-(a.pageY-c.y)/f.height*2+1}},THREEx.DomEvents.prototype._objectCtxInit=function(a){a._3xDomEvent={}},THREEx.DomEvents.prototype._objectCtxDeinit=function(a){delete a._3xDomEvent},THREEx.DomEvents.prototype._objectCtxIsInit=function(a){return!!a._3xDomEvent},THREEx.DomEvents.prototype._objectCtxGet=function(a){return a._3xDomEvent},THREEx.DomEvents.prototype.camera=function(a){return a&&(this._camera=a),this._camera},THREEx.DomEvents.prototype.bind=function(a,b,c,d){console.assert(-1!==THREEx.DomEvents.eventNames.indexOf(b),"not available events:"+b),this._objectCtxIsInit(a)||this._objectCtxInit(a);var e=this._objectCtxGet(a);e[b+"Handlers"]||(e[b+"Handlers"]=[]),e[b+"Handlers"].push({callback:c,useCapture:d}),void 0===this._boundObjs[b]&&(this._boundObjs[b]=[]),this._boundObjs[b].push(a)},THREEx.DomEvents.prototype.addEventListener=THREEx.DomEvents.prototype.bind,THREEx.DomEvents.prototype.unbind=function(a,b,c,d){console.assert(-1!==THREEx.DomEvents.eventNames.indexOf(b),"not available events:"+b),this._objectCtxIsInit(a)||this._objectCtxInit(a);var e=this._objectCtxGet(a);e[b+"Handlers"]||(e[b+"Handlers"]=[]);for(var f=e[b+"Handlers"],g=0;g<f.length;g++){var h=f[g];if(c==h.callback&&d==h.useCapture){f.splice(g,1);break}}var i=this._boundObjs[b].indexOf(a);console.assert(-1!==i),this._boundObjs[b].splice(i,1)},THREEx.DomEvents.prototype.removeEventListener=THREEx.DomEvents.prototype.unbind,THREEx.DomEvents.prototype._bound=function(a,b){var c=this._objectCtxGet(b);return!!c&&!!c[a+"Handlers"]},THREEx.DomEvents.prototype._onMove=function(a,b,c,d){var e=this._boundObjs[a];if(void 0!==e&&0!==e.length){var f=new THREE.Vector2;f.set(b,c),this._raycaster.setFromCamera(f,this._camera);var g=this._raycaster.intersectObjects(e),h=this._selected;if(g.length>0){var i,j,k,l=g[0],m=l.object;this._selected=m,k=this._bound("mousemove",m),h!=m&&(i=this._bound("mouseover",m),j=h&&this._bound("mouseout",h))}else j=h&&this._bound("mouseout",h),this._selected=null;k&&this._notify("mousemove",m,d,l),i&&this._notify("mouseover",m,d,l),j&&this._notify("mouseout",h,d,l)}},THREEx.DomEvents.prototype._onEvent=function(a,b,c,d){var e=this._boundObjs[a];if(void 0!==e&&0!==e.length){var f=new THREE.Vector2;f.set(b,c),this._raycaster.setFromCamera(f,this._camera);var g=this._raycaster.intersectObjects(e,!0);if(0!==g.length){for(var h=g[0],i=h.object,j=this._objectCtxGet(i),k=i.parent;void 0===j&&k;)j=this._objectCtxGet(k),k=k.parent;j&&this._notify(a,i,d,h)}}},THREEx.DomEvents.prototype._notify=function(a,b,c,d){var e=this._objectCtxGet(b),f=e?e[a+"Handlers"]:null;if(console.assert(4===arguments.length),!e||!f||0===f.length)return void(b.parent&&this._notify(a,b.parent,c,d));for(var f=e[a+"Handlers"],g=0;g<f.length;g++){var h=f[g],i=!0;h.callback({type:a,target:b,origDomEvent:c,intersect:d,stopPropagation:function(){i=!1}}),i&&(!1===h.useCapture&&b.parent&&this._notify(a,b.parent,c,d))}},THREEx.DomEvents.prototype._onMouseDown=function(a){return this._onMouseEvent("mousedown",a)},THREEx.DomEvents.prototype._onMouseUp=function(a){return this._onMouseEvent("mouseup",a)},THREEx.DomEvents.prototype._onMouseEvent=function(a,b){var c=this._getRelativeMouseXY(b);this._onEvent(a,c.x,c.y,b)},THREEx.DomEvents.prototype._onMouseMove=function(a){var b=this._getRelativeMouseXY(a);this._onMove("mousemove",b.x,b.y,a),this._onMove("mouseover",b.x,b.y,a),this._onMove("mouseout",b.x,b.y,a)},THREEx.DomEvents.prototype._onClick=function(a){this._onMouseEvent("click",a)},THREEx.DomEvents.prototype._onDblClick=function(a){this._onMouseEvent("dblclick",a)},THREEx.DomEvents.prototype._onContextmenu=function(a){this._onMouseEvent("contextmenu",a)},THREEx.DomEvents.prototype._onTouchStart=function(a){return this._onTouchEvent("touchstart",a)},THREEx.DomEvents.prototype._onTouchEnd=function(a){return this._onTouchEvent("touchend",a)},THREEx.DomEvents.prototype._onTouchMove=function(a){if(1==a.touches.length){a.preventDefault();var b=+a.touches[0].pageX/window.innerWidth*2-1,c=-a.touches[0].pageY/window.innerHeight*2+1;this._onMove("mousemove",b,c,a),this._onMove("mouseover",b,c,a),this._onMove("mouseout",b,c,a)}},THREEx.DomEvents.prototype._onTouchEvent=function(a,b){if(1==b.touches.length){b.preventDefault();var c=+b.touches[0].pageX/window.innerWidth*2-1,d=-b.touches[0].pageY/window.innerHeight*2+1;this._onEvent(a,c,d,b)}},/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
function(){function a(a){var b=function(a,b){return e("",a,b)},f=c;a&&(c[a]||(c[a]={}),f=c[a]),f.define&&f.define.packaged||(d.original=f.define,f.define=d,f.define.packaged=!0),f.require&&f.require.packaged||(e.original=f.require,f.require=b,f.require.packaged=!0)}var b="ace",c=function(){return this}();if(b||"undefined"==typeof requirejs){var d=function(a,b,c){if("string"!=typeof a)return void(d.original?d.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace()));2==arguments.length&&(c=b),d.modules||(d.modules={},d.payloads={}),d.payloads[a]=c,d.modules[a]=null},e=function(a,b,c){if("[object Array]"===Object.prototype.toString.call(b)){for(var d=[],f=0,h=b.length;f<h;++f){var i=g(a,b[f]);if(!i&&e.original)return e.original.apply(window,arguments);d.push(i)}c&&c.apply(null,d)}else{if("string"==typeof b){var j=g(a,b);return!j&&e.original?e.original.apply(window,arguments):(c&&c(),j)}if(e.original)return e.original.apply(window,arguments)}},f=function(a,b){if(-1!==b.indexOf("!")){var c=b.split("!");return f(a,c[0])+"!"+f(a,c[1])}if("."==b.charAt(0)){var d=a.split("/").slice(0,-1).join("/");for(b=d+"/"+b;-1!==b.indexOf(".")&&e!=b;){var e=b;b=b.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return b},g=function(a,b){b=f(a,b);var c=d.modules[b];if(!c){if("function"==typeof(c=d.payloads[b])){var g={},h={id:b,uri:"",exports:g,packaged:!0};g=c(function(a,c){return e(b,a,c)},g,h)||h.exports,d.modules[b]=g,delete d.payloads[b]}c=d.modules[b]=g||c}return c};a(b)}}(),ace.define("ace/lib/regexp",["require","exports","module"],function(a,b,c){"use strict";function d(a){return(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":"")}function e(a,b,c){if(Array.prototype.indexOf)return a.indexOf(b,c);for(var d=c||0;d<a.length;d++)if(a[d]===b)return d;return-1}var f={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},g=void 0===f.exec.call(/()??/,"")[1],h=function(){var a=/^/g;return f.test.call(a,""),!a.lastIndex}();h&&g||(RegExp.prototype.exec=function(a){var b,c,i=f.exec.apply(this,arguments);if("string"==typeof a&&i){if(!g&&i.length>1&&e(i,"")>-1&&(c=RegExp(this.source,f.replace.call(d(this),"g","")),f.replace.call(a.slice(i.index),c,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),this._xregexp&&this._xregexp.captureNames)for(var j=1;j<i.length;j++)(b=this._xregexp.captureNames[j-1])&&(i[b]=i[j]);!h&&this.global&&!i[0].length&&this.lastIndex>i.index&&this.lastIndex--}return i},h||(RegExp.prototype.test=function(a){var b=f.exec.call(this,a);return b&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--,!!b}))}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(a,b,c){function d(){}function e(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(a){}}function f(a){return a=+a,a!==a?a=0:0!==a&&a!==1/0&&a!==-1/0&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);var c=o.call(arguments,1),e=function(){if(this instanceof e){var d=b.apply(this,c.concat(o.call(arguments)));return Object(d)===d?d:this}return b.apply(a,c.concat(o.call(arguments)))};return b.prototype&&(d.prototype=b.prototype,e.prototype=new d,d.prototype=null),e});var g,h,i,j,k,l=Function.prototype.call,m=Array.prototype,n=Object.prototype,o=m.slice,p=l.bind(n.toString),q=l.bind(n.hasOwnProperty);if((k=q(n,"__defineGetter__"))&&(g=l.bind(n.__defineGetter__),h=l.bind(n.__defineSetter__),i=l.bind(n.__lookupGetter__),j=l.bind(n.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function a(a){var b=new Array(a+2);return b[0]=b[1]=0,b}var b,c=[];if(c.splice.apply(c,a(20)),c.splice.apply(c,a(26)),b=c.length,c.splice(5,0,"XXX"),c.length,b+1==c.length)return!0}()){var r=Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?r.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(o.call(arguments,2))):[]}}else Array.prototype.splice=function(a,b){var c=this.length;a>0?a>c&&(a=c):void 0==a?a=0:a<0&&(a=Math.max(c+a,0)),a+b<c||(b=c-a);var d=this.slice(a,a+b),e=o.call(arguments,2),f=e.length;if(a===c)f&&this.push.apply(this,e);else{var g=Math.min(b,c-a),h=a+g,i=h+f-g,j=c-h,k=c-g;if(i<h)for(var l=0;l<j;++l)this[i+l]=this[h+l];else if(i>h)for(l=j;l--;)this[i+l]=this[h+l];if(f&&a===k)this.length=k,this.push.apply(this,e);else for(this.length=k+f,l=0;l<f;++l)this[a+l]=e[l]}return d};Array.isArray||(Array.isArray=function(a){return"[object Array]"==p(a)});var s=Object("a"),t="a"!=s[0]||!(0 in s);if(Array.prototype.forEach||(Array.prototype.forEach=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=arguments[1],e=-1,f=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError;for(;++e<f;)e in c&&a.call(d,c[e],e,b)}),Array.prototype.map||(Array.prototype.map=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var g=0;g<d;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){var b,c=F(this),d=t&&"[object String]"==p(this)?this.split(""):c,e=d.length>>>0,f=[],g=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var h=0;h<e;h++)h in d&&(b=d[h],a.call(g,b,h,c)&&f.push(b));return f}),Array.prototype.every||(Array.prototype.every=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var f=0;f<d;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var f=0;f<d;f++)if(f in c&&a.call(e,c[f],f,b))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e,f=0;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f++];break}if(++f>=d)throw new TypeError("reduce of empty array with no initial value")}for(;f<d;f++)f in c&&(e=a.call(void 0,e,c[f],f,b));return e}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=F(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var e,f=d-1;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f--];break}if(--f<0)throw new TypeError("reduceRight of empty array with no initial value")}do{f in this&&(e=a.call(void 0,e,c[f],f,b))}while(f--);return e}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(a){var b=t&&"[object String]"==p(this)?this.split(""):F(this),c=b.length>>>0;if(!c)return-1;var d=0;for(arguments.length>1&&(d=f(arguments[1])),d=d>=0?d:Math.max(0,c+d);d<c;d++)if(d in b&&b[d]===a)return d;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(a){var b=t&&"[object String]"==p(this)?this.split(""):F(this),c=b.length>>>0;if(!c)return-1;var d=c-1;for(arguments.length>1&&(d=Math.min(d,f(arguments[1]))),d=d>=0?d:c-Math.abs(d);d>=0;d--)if(d in b&&a===b[d])return d;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__||(a.constructor?a.constructor.prototype:n)}),!Object.getOwnPropertyDescriptor){Object.getOwnPropertyDescriptor=function(a,b){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+a);if(q(a,b)){var c,d,e;if(c={enumerable:!0,configurable:!0},k){var f=a.__proto__;a.__proto__=n;var d=i(a,b),e=j(a,b);if(a.__proto__=f,d||e)return d&&(c.get=d),e&&(c.set=e),c}return c.value=a[b],c}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(a){return Object.keys(a)}),!Object.create){var u;u=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var a={};for(var b in a)a[b]=null;return a.constructor=a.hasOwnProperty=a.propertyIsEnumerable=a.isPrototypeOf=a.toLocaleString=a.toString=a.valueOf=a.__proto__=null,a},Object.create=function(a,b){var c;if(null===a)c=u();else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return void 0!==b&&Object.defineProperties(c,b),c}}if(Object.defineProperty){var v=e({}),w="undefined"==typeof document||e(document.createElement("div"));if(!v||!w)var x=Object.defineProperty}if(!Object.defineProperty||x){Object.defineProperty=function(a,b,c){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.defineProperty called on non-object: "+a);if("object"!=typeof c&&"function"!=typeof c||null===c)throw new TypeError("Property description must be an object: "+c);if(x)try{return x.call(Object,a,b,c)}catch(a){}if(q(c,"value"))if(k&&(i(a,b)||j(a,b))){var d=a.__proto__;a.__proto__=n,delete a[b],a[b]=c.value,a.__proto__=d}else a[b]=c.value;else{if(!k)throw new TypeError("getters & setters can not be defined on this javascript engine");q(c,"get")&&g(a,b,c.get),q(c,"set")&&h(a,b,c.set)}return a}}Object.defineProperties||(Object.defineProperties=function(a,b){for(var c in b)q(b,c)&&Object.defineProperty(a,c,b[c]);return a}),Object.seal||(Object.seal=function(a){return a}),Object.freeze||(Object.freeze=function(a){return a});try{Object.freeze(function(){})}catch(a){Object.freeze=function(a){return function(b){return"function"==typeof b?b:a(b)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(a){return a}),Object.isSealed||(Object.isSealed=function(a){return!1}),Object.isFrozen||(Object.isFrozen=function(a){return!1}),Object.isExtensible||(Object.isExtensible=function(a){if(Object(a)===a)throw new TypeError;for(var b="";q(a,b);)b+="?";a[b]=!0;var c=q(a,b);return delete a[b],c}),!Object.keys){var y=!0,z=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],A=z.length;for(var B in{toString:null})y=!1;Object.keys=function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on a non-object");var b=[];for(var c in a)q(a,c)&&b.push(c);if(y)for(var d=0,e=A;d<e;d++){var f=z[d];q(a,f)&&b.push(f)}return b}}Date.now||(Date.now=function(){return(new Date).getTime()});var C="\t\n\v\f\r \u2028\u2029\ufeff";if(!String.prototype.trim||C.trim()){C="["+C+"]";var D=new RegExp("^"+C+C+"*"),E=new RegExp(C+C+"*$");String.prototype.trim=function(){return String(this).replace(D,"").replace(E,"")}}var F=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(a,b,c){"use strict";a("./regexp"),a("./es5-shim")}),ace.define("ace/lib/dom",["require","exports","module"],function(a,b,c){"use strict";var d="http://www.w3.org/1999/xhtml";b.getDocumentHead=function(a){return a||(a=document),a.head||a.getElementsByTagName("head")[0]||a.documentElement},b.createElement=function(a,b){return document.createElementNS?document.createElementNS(b||d,a):document.createElement(a)},b.hasCssClass=function(a,b){return-1!==(a.className||"").split(/\s+/g).indexOf(b)},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.removeCssClass=function(a,b){for(var c=a.className.split(/\s+/g);;){var d=c.indexOf(b);if(-1==d)break;c.splice(d,1)}a.className=c.join(" ")},b.toggleCssClass=function(a,b){for(var c=a.className.split(/\s+/g),d=!0;;){var e=c.indexOf(b);if(-1==e)break;d=!1,c.splice(e,1)}return d&&c.push(b),a.className=c.join(" "),d},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.hasCssString=function(a,b){var c,d=0;if(b=b||document,b.createStyleSheet&&(c=b.styleSheets)){for(;d<c.length;)if(c[d++].owningElement.id===a)return!0}else if(c=b.getElementsByTagName("style"))for(;d<c.length;)if(c[d++].id===a)return!0;return!1},b.importCssString=function(a,c,e){if(e=e||document,c&&b.hasCssString(c,e))return null;var f;e.createStyleSheet?(f=e.createStyleSheet(),f.cssText=a,c&&(f.owningElement.id=c)):(f=e.createElementNS?e.createElementNS(d,"style"):e.createElement("style"),f.appendChild(e.createTextNode(a)),c&&(f.id=c),b.getDocumentHead(e).appendChild(f))},b.importCssStylsheet=function(a,c){if(c.createStyleSheet)c.createStyleSheet(a);else{var d=b.createElement("link");d.rel="stylesheet",d.href=a,b.getDocumentHead(c).appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"),10)+parseInt(b.computedStyle(a,"paddingRight"),10)+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"),10)+parseInt(b.computedStyle(a,"paddingBottom"),10)+a.clientHeight},"undefined"!=typeof document&&(void 0!==window.pageYOffset?(b.getPageScrollTop=function(){return window.pageYOffset},b.getPageScrollLeft=function(){return window.pageXOffset}):(b.getPageScrollTop=function(){return document.body.scrollTop},b.getPageScrollLeft=function(){return document.body.scrollLeft}),window.getComputedStyle?b.computedStyle=function(a,b){return b?(window.getComputedStyle(a,"")||{})[b]||"":window.getComputedStyle(a,"")||{}}:b.computedStyle=function(a,b){return b?a.currentStyle[b]:a.currentStyle},b.scrollbarWidth=function(a){var c=b.createElement("ace_inner");c.style.width="100%",c.style.minWidth="0px",c.style.height="200px",c.style.display="block";var d=b.createElement("ace_outer"),e=d.style;e.position="absolute",e.left="-10000px",e.overflow="hidden",e.width="200px",e.minWidth="0px",e.height="150px",e.display="block",d.appendChild(c);var f=a.documentElement;f.appendChild(d);var g=c.offsetWidth;e.overflow="scroll";var h=c.offsetWidth;return g==h&&(h=d.clientWidth),f.removeChild(d),g-h},b.setInnerHtml=function(a,b){var c=a.cloneNode(!1);return c.innerHTML=b,a.parentNode.replaceChild(c,a),c},"textContent"in document.documentElement?(b.setInnerText=function(a,b){a.textContent=b},b.getInnerText=function(a){return a.textContent}):(b.setInnerText=function(a,b){a.innerText=b},b.getInnerText=function(a){return a.innerText}),b.getParentWindow=function(a){return a.defaultView||a.parentWindow})}),ace.define("ace/lib/oop",["require","exports","module"],function(a,b,c){"use strict";b.inherits=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},b.mixin=function(a,b){for(var c in b)a[c]=b[c];return a},b.implement=function(a,c){b.mixin(a,c)}}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"],function(a,b,c){"use strict";a("./fixoldbrowsers");var d=a("./oop"),e=function(){var a,b,c={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:".",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}};for(b in c.FUNCTION_KEYS)a=c.FUNCTION_KEYS[b].toLowerCase(),c[a]=parseInt(b,10);for(b in c.PRINTABLE_KEYS)a=c.PRINTABLE_KEYS[b].toLowerCase(),c[a]=parseInt(b,10);return d.mixin(c,c.MODIFIER_KEYS),d.mixin(c,c.PRINTABLE_KEYS),d.mixin(c,c.FUNCTION_KEYS),c.enter=c.return,c.escape=c.esc,c.del=c.delete,c[173]="-",function(){for(var a=["cmd","ctrl","alt","shift"],b=Math.pow(2,a.length);b--;)c.KEY_MODS[b]=a.filter(function(a){return b&c.KEY_MODS[a]}).join("-")+"-"}(),c.KEY_MODS[0]="",c.KEY_MODS[-1]="input",c}();d.mixin(b,e),b.keyCodeToString=function(a){var b=e[a];return"string"!=typeof b&&(b=String.fromCharCode(a)),b.toLowerCase()}}),ace.define("ace/lib/useragent",["require","exports","module"],function(a,b,c){"use strict";if(b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS},"object"==typeof navigator){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),e=navigator.userAgent;b.isWin="win"==d,b.isMac="mac"==d,b.isLinux="linux"==d,b.isIE="Microsoft Internet Explorer"==navigator.appName||navigator.appName.indexOf("MSAppHost")>=0?parseFloat((e.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((e.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),b.isOldIE=b.isIE&&b.isIE<9,b.isGecko=b.isMozilla=(window.Controllers||window.controllers)&&"Gecko"===window.navigator.product,b.isOldGecko=b.isGecko&&parseInt((e.match(/rv\:(\d+)/)||[])[1],10)<4,b.isOpera=window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),b.isWebKit=parseFloat(e.split("WebKit/")[1])||void 0,b.isChrome=parseFloat(e.split(" Chrome/")[1])||void 0,b.isAIR=e.indexOf("AdobeAIR")>=0,b.isIPad=e.indexOf("iPad")>=0,b.isTouchPad=e.indexOf("TouchPad")>=0,b.isChromeOS=e.indexOf(" CrOS ")>=0}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(a,b,c){"use strict";function d(a,b,c){var d=g(b);if(!f.isMac&&h){if((h[91]||h[92])&&(d|=8),h.altGr){if(3==(3&d))return;h.altGr=0}if(18===c||17===c){var j="location"in b?b.location:b.keyLocation;if(17===c&&1===j)i=b.timeStamp;else if(18===c&&3===d&&2===j){var k=-i;i=b.timeStamp,k+=i,k<3&&(h.altGr=!0)}}}if(c in e.MODIFIER_KEYS){switch(e.MODIFIER_KEYS[c]){case"Alt":d=2;break;case"Shift":d=4;break;case"Ctrl":d=1;break;default:d=8}c=-1}if(8&d&&(91===c||93===c)&&(c=-1),!d&&13===c){var j="location"in b?b.location:b.keyLocation;if(3===j&&(a(b,d,-c),b.defaultPrevented))return}if(f.isChromeOS&&8&d){if(a(b,d,c),b.defaultPrevented)return;d&=-9}return!!(d||c in e.FUNCTION_KEYS||c in e.PRINTABLE_KEYS)&&a(b,d,c)}var e=a("./keys"),f=a("./useragent");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1);if(a.attachEvent){var d=function(){c.call(a,window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,!1);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){return b.stopPropagation(a),b.preventDefault(a),!1},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},b.getButton=function(a){return"dblclick"==a.type?0:"contextmenu"==a.type||f.isMac&&a.ctrlKey&&!a.altKey&&!a.shiftKey?2:a.preventDefault?a.button:{1:0,2:2,4:1}[a.button]},b.capture=function(a,c,d){function e(a){c&&c(a),d&&d(a),b.removeListener(document,"mousemove",c,!0),b.removeListener(document,"mouseup",e,!0),b.removeListener(document,"dragstart",e,!0)}return b.addListener(document,"mousemove",c,!0),b.addListener(document,"mouseup",e,!0),b.addListener(document,"dragstart",e,!0),e},b.addMouseWheelListener=function(a,c){"onmousewheel"in a?b.addListener(a,"mousewheel",function(a){var b=8;void 0!==a.wheelDeltaX?(a.wheelX=-a.wheelDeltaX/b,a.wheelY=-a.wheelDeltaY/b):(a.wheelX=0,a.wheelY=-a.wheelDelta/b),c(a)}):"onwheel"in a?b.addListener(a,"wheel",function(a){var b=.35;switch(a.deltaMode){case a.DOM_DELTA_PIXEL:a.wheelX=a.deltaX*b||0,a.wheelY=a.deltaY*b||0;break;case a.DOM_DELTA_LINE:case a.DOM_DELTA_PAGE:a.wheelX=5*(a.deltaX||0),a.wheelY=5*(a.deltaY||0)}c(a)}):b.addListener(a,"DOMMouseScroll",function(a){a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=5*(a.detail||0),a.wheelY=0):(a.wheelX=0,a.wheelY=5*(a.detail||0)),c(a)})},b.addMultiMouseDownListener=function(a,c,d,e){var g,h,i,j=0,k={2:"dblclick",3:"tripleclick",4:"quadclick"};b.addListener(a,"mousedown",function(a){if(0!==b.getButton(a)?j=0:a.detail>1?++j>4&&(j=1):j=1,f.isIE){var l=Math.abs(a.clientX-g)>5||Math.abs(a.clientY-h)>5;i&&!l||(j=1),i&&clearTimeout(i),i=setTimeout(function(){i=null},c[j-1]||600),1==j&&(g=a.clientX,h=a.clientY)}if(a._clicks=j,d[e]("mousedown",a),j>4)j=0;else if(j>1)return d[e](k[j],a)}),f.isOldIE&&b.addListener(a,"dblclick",function(a){j=2,i&&clearTimeout(i),i=setTimeout(function(){i=null},c[j-1]||600),d[e]("mousedown",a),d[e](k[j],a)})};var g=!f.isMac||!f.isOpera||"KeyboardEvent"in window?function(a){return 0|(a.ctrlKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.metaKey?8:0)}:function(a){return 0|(a.metaKey?1:0)|(a.altKey?2:0)|(a.shiftKey?4:0)|(a.ctrlKey?8:0)};b.getModifierString=function(a){return e.KEY_MODS[g(a)]};var h=null,i=0;if(b.addCommandKeyListener=function(a,c){var e=b.addListener;if(f.isOldGecko||f.isOpera&&!("KeyboardEvent"in window)){var g=null;e(a,"keydown",function(a){g=a.keyCode}),e(a,"keypress",function(a){return d(c,a,g)})}else{var i=null;e(a,"keydown",function(a){h[a.keyCode]=!0;var b=d(c,a,a.keyCode);return i=a.defaultPrevented,b}),e(a,"keypress",function(a){i&&(a.ctrlKey||a.altKey||a.shiftKey||a.metaKey)&&(b.stopEvent(a),i=null)}),e(a,"keyup",function(a){h[a.keyCode]=null}),h||(h=Object.create(null),e(window,"focus",function(a){h=Object.create(null)}))}},window.postMessage&&!f.isOldIE){b.nextTick=function(a,c){c=c||window;var d="zero-timeout-message-"+1;b.addListener(c,"message",function e(f){f.data==d&&(b.stopPropagation(f),b.removeListener(c,"message",e),a())}),c.postMessage(d,"*")}}b.nextFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,b.nextFrame?b.nextFrame=b.nextFrame.bind(window):b.nextFrame=function(a){setTimeout(a,17)}}),ace.define("ace/lib/lang",["require","exports","module"],function(a,b,c){"use strict";b.last=function(a){return a[a.length-1]},b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){for(var c="";b>0;)1&b&&(c+=a),(b>>=1)&&(a+=a);return c};var d=/^\s\s*/,e=/\s\s*$/;b.stringTrimLeft=function(a){return a.replace(d,"")},b.stringTrimRight=function(a){return a.replace(e,"")},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.copyArray=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&"object"==typeof a[c]?b[c]=this.copyObject(a[c]):b[c]=a[c];return b},b.deepCopy=function(a){if("object"!=typeof a||!a)return a;var c=a.constructor;if(c===RegExp)return a;var d=c();for(var e in a)"object"==typeof a[e]?d[e]=b.deepCopy(a[e]):d[e]=a[e];return d},b.arrayToMap=function(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=1;return b},b.createMap=function(a){var b=Object.create(null);for(var c in a)b[c]=a[c];return b},b.arrayRemove=function(a,b){for(var c=0;c<=a.length;c++)b===a[c]&&a.splice(c,1)},b.escapeRegExp=function(a){return a.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},b.escapeHTML=function(a){return a.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},b.getMatchOffsets=function(a,b){var c=[];return a.replace(b,function(a){c.push({offset:arguments[arguments.length-2],length:a.length})}),c},b.deferredCall=function(a){var b=null,c=function(){b=null,a()},d=function(a){return d.cancel(),b=setTimeout(c,a||0),d};return d.schedule=d,d.call=function(){return this.cancel(),a(),d},d.cancel=function(){return clearTimeout(b),b=null,d},d.isPending=function(){return b},d},b.delayedCall=function(a,b){var c=null,d=function(){c=null,a()},e=function(a){null==c&&(c=setTimeout(d,a||b))};return e.delay=function(a){c&&clearTimeout(c),c=setTimeout(d,a||b)},e.schedule=e,e.call=function(){this.cancel(),a()},e.cancel=function(){c&&clearTimeout(c),c=null},e.isPending=function(){return c},e}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang"],function(a,b,c){"use strict";var d=a("../lib/event"),e=a("../lib/useragent"),f=a("../lib/dom"),g=a("../lib/lang"),h=e.isChrome<18,i=e.isIE,j=function(a,b){function c(a){if(!p){if(B)b=0,c=a?0:l.value.length-1;else var b=a?2:1,c=2;try{l.setSelectionRange(b,c)}catch(a){}}}function j(){p||(l.value=m,e.isWebKit&&u.schedule())}function k(){clearTimeout(O),O=setTimeout(function(){q&&(l.style.cssText=q,q=""),null==b.renderer.$keepTextAreaAtCursor&&(b.renderer.$keepTextAreaAtCursor=!0,b.renderer.$moveTextAreaToCursor())},e.isOldIE?200:0)}var l=f.createElement("textarea");l.className="ace_text-input",e.isTouchPad&&l.setAttribute("x-palm-disable-auto-cap",!0),l.setAttribute("wrap","off"),l.setAttribute("autocorrect","off"),l.setAttribute("autocapitalize","off"),l.setAttribute("spellcheck",!1),l.style.opacity="0",e.isOldIE&&(l.style.top="-100px"),a.insertBefore(l,a.firstChild);var m="",n=!1,o=!1,p=!1,q="",r=!0;try{var s=document.activeElement===l}catch(a){}d.addListener(l,"blur",function(a){b.onBlur(a),s=!1}),d.addListener(l,"focus",function(a){s=!0,b.onFocus(a),c()}),this.focus=function(){l.style.position="fixed",l.style.top="-10000000px",l.focus(),setTimeout(function(){l.style.position=""},0)},this.blur=function(){l.blur()},this.isFocused=function(){return s};var t=g.delayedCall(function(){s&&c(r)}),u=g.delayedCall(function(){p||(l.value=m,s&&c())});e.isWebKit||b.addEventListener("changeSelection",function(){b.selection.isEmpty()!=r&&(r=!r,t.schedule())}),j(),s&&b.onFocus();var v=function(a){return 0===a.selectionStart&&a.selectionEnd===a.value.length};if(!l.setSelectionRange&&l.createTextRange&&(l.setSelectionRange=function(a,b){var c=this.createTextRange();c.collapse(!0),c.moveStart("character",a),c.moveEnd("character",b),c.select()},v=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(a){}return!(!b||b.parentElement()!=a)&&b.text==a.value}),e.isOldIE){var w=!1,x=function(a){if(!w){var b=l.value;if(!p&&b&&b!=m){if(a&&b==m[0])return y.schedule();D(b),w=!0,j(),w=!1}}},y=g.delayedCall(x);d.addListener(l,"propertychange",x);var z={13:1,27:1};d.addListener(l,"keyup",function(a){if(!p||l.value&&!z[a.keyCode]||setTimeout(M,0),(l.value.charCodeAt(0)||0)<129)return y.call();p?L():K()}),d.addListener(l,"keydown",function(a){y.schedule(50)})}var A=function(a){n?n=!1:v(l)?(b.selectAll(),c()):B&&c(b.selection.isEmpty())},B=null;this.setInputHandler=function(a){B=a},this.getInputHandler=function(){return B};var C=!1,D=function(a){B&&(a=B(a),B=null),o?(c(),a&&b.onPaste(a),o=!1):a==m.charAt(0)?C?b.execCommand("del",{source:"ace"}):b.execCommand("backspace",{source:"ace"}):(a.substring(0,2)==m?a=a.substr(2):a.charAt(0)==m.charAt(0)?a=a.substr(1):a.charAt(a.length-1)==m.charAt(0)&&(a=a.slice(0,-1)),a.charAt(a.length-1)==m.charAt(0)&&(a=a.slice(0,-1)),a&&b.onTextInput(a)),C&&(C=!1)},E=function(a){if(!p){var b=l.value;D(b),j()}},F=function(a,b){var c=a.clipboardData||window.clipboardData;if(c&&!h){var d=i?"Text":"text/plain";return b?!1!==c.setData(d,b):c.getData(d)}},G=function(a,e){var f=b.getCopyText();if(!f)return d.preventDefault(a);F(a,f)?(e?b.onCut():b.onCopy(),d.preventDefault(a)):(n=!0,l.value=f,l.select(),setTimeout(function(){n=!1,j(),c(),e?b.onCut():b.onCopy()}))},H=function(a){G(a,!0)},I=function(a){G(a,!1)},J=function(a){var f=F(a);"string"==typeof f?(f&&b.onPaste(f),e.isIE&&setTimeout(c),d.preventDefault(a)):(l.value="",o=!0)};d.addCommandKeyListener(l,b.onCommandKey.bind(b)),d.addListener(l,"select",A),d.addListener(l,"input",E),d.addListener(l,"cut",H),d.addListener(l,"copy",I),d.addListener(l,"paste",J),"oncut"in l&&"oncopy"in l&&"onpaste"in l||d.addListener(a,"keydown",function(a){if((!e.isMac||a.metaKey)&&a.ctrlKey)switch(a.keyCode){case 67:I(a);break;case 86:J(a);break;case 88:H(a)}});var K=function(a){p||!b.onCompositionStart||b.$readOnly||(p={},b.onCompositionStart(),setTimeout(L,0),b.on("mousedown",M),b.selection.isEmpty()||(b.insert(""),b.session.markUndoGroup(),b.selection.clearSelection()),b.session.markUndoGroup())},L=function(){if(p&&b.onCompositionUpdate&&!b.$readOnly){var a=l.value.replace(/\x01/g,"");if(p.lastValue!==a&&(b.onCompositionUpdate(a),p.lastValue&&b.undo(),p.lastValue=a,p.lastValue)){var c=b.selection.getRange();b.insert(p.lastValue),b.session.markUndoGroup(),p.range=b.selection.getRange(),b.selection.setRange(c),b.selection.clearSelection()}}},M=function(a){if(b.onCompositionEnd&&!b.$readOnly){var c=p;p=!1;var d=setTimeout(function(){d=null;var a=l.value.replace(/\x01/g,"");p||(a==c.lastValue?j():!c.lastValue&&a&&(j(),D(a)))});B=function(a){return d&&clearTimeout(d),(a=a.replace(/\x01/g,""))==c.lastValue?"":(c.lastValue&&d&&b.undo(),a)},b.onCompositionEnd(),b.removeListener("mousedown",M),"compositionend"==a.type&&c.range&&b.selection.setRange(c.range)}},N=g.delayedCall(L,50);d.addListener(l,"compositionstart",K),e.isGecko?d.addListener(l,"text",function(){N.schedule()}):(d.addListener(l,"keyup",function(){N.schedule()}),d.addListener(l,"keydown",function(){N.schedule()})),d.addListener(l,"compositionend",M),this.getElement=function(){return l},this.setReadOnly=function(a){l.readOnly=a},this.onContextMenu=function(a){C=!0,c(b.selection.isEmpty()),b._emit("nativecontextmenu",{target:b,domEvent:a}),this.moveToMouse(a,!0)},this.moveToMouse=function(a,c){if(c||!e.isOldIE){q||(q=l.style.cssText),l.style.cssText=(c?"z-index:100000;":"")+"height:"+l.style.height+";"+(e.isIE?"opacity:0.1;":"");var g=b.container.getBoundingClientRect(),h=f.computedStyle(b.container),i=g.top+(parseInt(h.borderTopWidth)||0),j=g.left+(parseInt(g.borderLeftWidth)||0),m=g.bottom-i-l.clientHeight-2,n=function(a){l.style.left=a.clientX-j-2+"px",l.style.top=Math.min(a.clientY-i-2,m)+"px"};n(a),"mousedown"==a.type&&(b.renderer.$keepTextAreaAtCursor&&(b.renderer.$keepTextAreaAtCursor=null),e.isWin&&!e.isOldIE&&d.capture(b.container,n,k))}},this.onContextMenuClose=k;var O,P=function(a){b.textInput.onContextMenu(a),k()};d.addListener(b.renderer.scroller,"contextmenu",P),d.addListener(l,"contextmenu",P)};b.TextInput=j}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(a,b,c){"use strict";function d(a){a.$clickSelection=null;var b=a.editor;b.setDefaultHandler("mousedown",this.onMouseDown.bind(a)),b.setDefaultHandler("dblclick",this.onDoubleClick.bind(a)),b.setDefaultHandler("tripleclick",this.onTripleClick.bind(a)),b.setDefaultHandler("quadclick",this.onQuadClick.bind(a)),b.setDefaultHandler("mousewheel",this.onMouseWheel.bind(a)),["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(b){a[b]=this[b]},this),a.selectByLines=this.extendSelectionBy.bind(a,"getLineRange"),a.selectByWords=this.extendSelectionBy.bind(a,"getWordRange")}function e(a,b,c,d){return Math.sqrt(Math.pow(c-a,2)+Math.pow(d-b,2))}function f(a,b){
if(a.start.row==a.end.row)var c=2*b.column-a.start.column-a.end.column;else if(a.start.row!=a.end.row-1||a.start.column||a.end.column)var c=2*b.row-a.start.row-a.end.row;else var c=b.column-4;return c<0?{cursor:a.start,anchor:a.end}:{cursor:a.end,anchor:a.start}}a("../lib/dom"),a("../lib/event"),a("../lib/useragent");(function(){this.onMouseDown=function(a){var b=a.inSelection(),c=a.getDocumentPosition();this.mousedownEvent=a;var d=this.editor;if(0!==a.getButton()){var e=d.getSelectionRange(),f=e.isEmpty();return d.$blockScrolling++,f&&d.selection.moveToPosition(c),d.$blockScrolling--,void d.textInput.onContextMenu(a.domEvent)}return this.mousedownEvent.time=Date.now(),!b||d.isFocused()||(d.focus(),!this.$focusTimout||this.$clickSelection||d.inMultiSelectMode)?(this.captureMouse(a),this.startSelect(c,a.domEvent._clicks>1),a.preventDefault()):(this.setState("focusWait"),void this.captureMouse(a))},this.startSelect=function(a,b){a=a||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var c=this.editor;c.$blockScrolling++,this.mousedownEvent.getShiftKey()?c.selection.selectToPosition(a):b||c.selection.moveToPosition(a),b||this.select(),c.renderer.scroller.setCapture&&c.renderer.scroller.setCapture(),c.setStyle("ace_selecting"),this.setState("select"),c.$blockScrolling--},this.select=function(){var a,b=this.editor,c=b.renderer.screenToTextCoordinates(this.x,this.y);if(b.$blockScrolling++,this.$clickSelection){var d=this.$clickSelection.comparePoint(c);if(-1==d)a=this.$clickSelection.end;else if(1==d)a=this.$clickSelection.start;else{var e=f(this.$clickSelection,c);c=e.cursor,a=e.anchor}b.selection.setSelectionAnchor(a.row,a.column)}b.selection.selectToPosition(c),b.$blockScrolling--,b.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(a){var b,c=this.editor,d=c.renderer.screenToTextCoordinates(this.x,this.y),e=c.selection[a](d.row,d.column);if(c.$blockScrolling++,this.$clickSelection){var g=this.$clickSelection.comparePoint(e.start),h=this.$clickSelection.comparePoint(e.end);if(-1==g&&h<=0)b=this.$clickSelection.end,e.end.row==d.row&&e.end.column==d.column||(d=e.start);else if(1==h&&g>=0)b=this.$clickSelection.start,e.start.row==d.row&&e.start.column==d.column||(d=e.end);else if(-1==g&&1==h)d=e.end,b=e.start;else{var i=f(this.$clickSelection,d);d=i.cursor,b=i.anchor}c.selection.setSelectionAnchor(b.row,b.column)}c.selection.selectToPosition(d),c.$blockScrolling--,c.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 a=e(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),b=Date.now();(a>0||b-this.mousedownEvent.time>this.$focusTimout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(a){var b=a.getDocumentPosition(),c=this.editor,d=c.session,e=d.getBracketRange(b);e?(e.isEmpty()&&(e.start.column--,e.end.column++),this.setState("select")):(e=c.selection.getWordRange(b.row,b.column),this.setState("selectByWords")),this.$clickSelection=e,this.select()},this.onTripleClick=function(a){var b=a.getDocumentPosition(),c=this.editor;this.setState("selectByLines");var d=c.getSelectionRange();d.isMultiLine()&&d.contains(b.row,b.column)?(this.$clickSelection=c.selection.getLineRange(d.start.row),this.$clickSelection.end=c.selection.getLineRange(d.end.row).end):this.$clickSelection=c.selection.getLineRange(b.row),this.select()},this.onQuadClick=function(a){var b=this.editor;b.selectAll(),this.$clickSelection=b.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(a){if(!a.getAccelKey()){a.getShiftKey()&&a.wheelY&&!a.wheelX&&(a.wheelX=a.wheelY,a.wheelY=0);var b=a.domEvent.timeStamp,c=b-(this.$lastScrollTime||0),d=this.editor;return d.renderer.isScrollableBy(a.wheelX*a.speed,a.wheelY*a.speed)||c<200?(this.$lastScrollTime=b,d.renderer.scrollBy(a.wheelX*a.speed,a.wheelY*a.speed),a.stop()):void 0}}}).call(d.prototype),b.DefaultHandlers=d}),ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],function(a,b,c){"use strict";function d(a){this.isOpen=!1,this.$element=null,this.$parentNode=a}var e=(a("./lib/oop"),a("./lib/dom"));(function(){this.$init=function(){return this.$element=e.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(a){e.setInnerText(this.getElement(),a)},this.setHtml=function(a){this.getElement().innerHTML=a},this.setPosition=function(a,b){this.getElement().style.left=a+"px",this.getElement().style.top=b+"px"},this.setClassName=function(a){e.addCssClass(this.getElement(),a)},this.show=function(a,b,c){null!=a&&this.setText(a),null!=b&&null!=c&&this.setPosition(b,c),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}}).call(d.prototype),b.Tooltip=d}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],function(a,b,c){"use strict";function d(a){function b(){var b=l.getDocumentPosition().row,e=i.$annotations[b];if(!e)return c();if(b==g.session.getLength()){var f=g.renderer.pixelToScreenCoordinates(0,l.y).row,h=l.$pos;if(f>g.session.documentToScreenRow(h.row,h.column))return c()}if(m!=e)if(m=e.text.join("<br/>"),j.setHtml(m),j.show(),g.on("mousewheel",c),a.$tooltipFollowsMouse)d(l);else{var k=i.$cells[g.session.documentToScreenRow(b,0)].element,n=k.getBoundingClientRect(),o=j.getElement().style;o.left=n.right+"px",o.top=n.bottom+"px"}}function c(){k&&(k=clearTimeout(k)),m&&(j.hide(),m=null,g.removeEventListener("mousewheel",c))}function d(a){j.setPosition(a.x,a.y)}var g=a.editor,i=g.renderer.$gutterLayer,j=new e(g.container);a.editor.setDefaultHandler("guttermousedown",function(b){if(g.isFocused()&&0==b.getButton()){if("foldWidgets"!=i.getRegion(b)){var c=b.getDocumentPosition().row,d=g.session.selection;if(b.getShiftKey())d.selectTo(c,0);else{if(2==b.domEvent.detail)return g.selectAll(),b.preventDefault();a.$clickSelection=g.selection.getLineRange(c)}return a.setState("selectByLines"),a.captureMouse(b),b.preventDefault()}}});var k,l,m;a.editor.setDefaultHandler("guttermousemove",function(e){var g=e.domEvent.target||e.domEvent.srcElement;if(f.hasCssClass(g,"ace_fold-widget"))return c();m&&a.$tooltipFollowsMouse&&d(e),l=e,k||(k=setTimeout(function(){k=null,l&&!a.isMousePressed?b():c()},50))}),h.addListener(g.renderer.$gutter,"mouseout",function(a){l=null,m&&!k&&(k=setTimeout(function(){k=null,c()},50))}),g.on("changeSession",c)}function e(a){i.call(this,a)}var f=a("../lib/dom"),g=a("../lib/oop"),h=a("../lib/event"),i=a("../tooltip").Tooltip;g.inherits(e,i),function(){this.setPosition=function(a,b){var c=window.innerWidth||document.documentElement.clientWidth,d=window.innerHeight||document.documentElement.clientHeight,e=this.getWidth(),f=this.getHeight();a+=15,b+=15,a+e>c&&(a-=a+e-c),b+f>d&&(b-=20+f),i.prototype.setPosition.call(this,a,b)}}.call(e.prototype),b.GutterHandler=d}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(a,b,c){"use strict";var d=a("../lib/event"),e=a("../lib/useragent"),f=b.MouseEvent=function(a,b){this.domEvent=a,this.editor=b,this.x=this.clientX=a.clientX,this.y=this.clientY=a.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){d.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){d.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 a=this.editor,b=a.getSelectionRange();if(b.isEmpty())this.$inSelection=!1;else{var c=this.getDocumentPosition();this.$inSelection=b.contains(c.row,c.column)}return this.$inSelection},this.getButton=function(){return d.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=e.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(f.prototype)}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(a,b,c){"use strict";function d(a){function b(a,b){var c=Date.now(),d=!b||a.row!=b.row,f=!b||a.column!=b.column;if(!B||d||f)q.$blockScrolling+=1,q.moveCursorToPosition(a),q.$blockScrolling-=1,B=c,C={x:t,y:u};else{e(C.x,C.y,t,u)>k?B=null:c-B>=j&&(q.renderer.scrollC