diff --git a/components/autosave/init.js b/components/autosave/init.js index 69b7af0..baf9d3d 100755 --- a/components/autosave/init.js +++ b/components/autosave/init.js @@ -8,7 +8,7 @@ // Define core var codiad = global.codiad, - scripts= document.getElementsByTagName('script'), + scripts = document.getElementsByTagName('script'), path = scripts[scripts.length-1].src.split('?')[0], curpath = path.split('/').slice(0, -1).join('/')+'/'; @@ -39,6 +39,7 @@ autosave: true, toggle: true, }, + verbose: false, init: function() { @@ -49,7 +50,10 @@ if( this.settings.autosave === false || this.settings.autosave === "false" ) { window.clearInterval( this.auto_save_trigger ); - console.log( 'Auto save disabled' ); + + if( codiad.auto_save.verbose ) { + console.log( 'Auto save disabled' ); + } return; } @@ -57,14 +61,18 @@ //Turn auto save off if the user leaves the tab. codiad.auto_save.settings.toggle = false; - console.log( 'Auto save resumed' ); + if( codiad.auto_save.verbose ) { + console.log( 'Auto save resumed' ); + } }); $(window).blur(function() { //Turn auto save off if the user leaves the tab. codiad.auto_save.settings.toggle = false; - console.log( 'Auto save paused' ); + if( codiad.auto_save.verbose ) { + console.log( 'Auto save paused' ); + } }); console.log( 'Auto save Enabled' ); @@ -126,12 +134,15 @@ reload_interval: function() { - window.clearInterval( codiad.autosave.auto_save_trigger ); - window.clearInterval( this.auto_save_trigger ); - - if( codiad.autosave.settings.autosave === true || codiad.autosave.settings.autosave === "true" ) { + try { - codiad.autosave.auto_save_trigger = setInterval( codiad.autosave.auto_save, 256 ); + window.clearInterval( codiad.autosave.auto_save_trigger ); + window.clearInterval( this.auto_save_trigger ); + } catch( error ) {} + + if( codiad.auto_save.settings.autosave === true || codiad.auto_save.settings.autosave === "true" ) { + + codiad.auto_save.auto_save_trigger = setInterval( codiad.auto_save.auto_save, 256 ); } } }; diff --git a/components/editor/ace-editor/ace.js b/components/editor/ace-editor/ace.js index 3d88726..5d5bc1a 100755 --- a/components/editor/ace-editor/ace.js +++ b/components/editor/ace-editor/ace.js @@ -1,18 +1,13959 @@ -(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE="",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;et.index&&this.lastIndex--}return t},s||(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("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+ta)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=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(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=i.match(/ Gecko\/\d+/),t.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(i.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(i.split(" Chrome/")[1])||undefined,t.isAIR=i.indexOf("AdobeAIR")>=0,t.isIPad=i.indexOf("iPad")>=0,t.isChromeOS=i.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(i)&&!window.MSStream,t.isIOS&&(t.isMac=!0)}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function a(e,t,n){var a=u(t);if(!i.isMac&&s){t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(a|=8);if(s.altGr){if((3&a)==3)return;s.altGr=0}if(n===18||n===17){var f="location"in t?t.location:t.keyLocation;if(n===17&&f===1)s[n]==1&&(o=t.timeStamp);else if(n===18&&a===3&&f===2){var l=t.timeStamp-o;l<50&&(s.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1),a&8&&n>=91&&n<=93&&(n=-1);if(!a&&n===13){var f="location"in t?t.location:t.keyLocation;if(f===3){e(t,a,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&a&8){e(t,a,n);if(t.defaultPrevented)return;a&=-9}return!!a||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,a,n):!1}function f(){s=Object.create(null)}var r=e("./keys"),i=e("./useragent"),s=null,o=0;t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent("on"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent("on"+t,n._wrapper||n)},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 e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,"mousemove",n,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}return t.addListener(document,"mousemove",n,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0),i},t.addTouchMoveListener=function(e,n){var r,i;t.addListener(e,"touchstart",function(e){var t=e.touches,n=t[0];r=n.clientX,i=n.clientY}),t.addListener(e,"touchmove",function(e){var t=e.touches;if(t.length>1)return;var s=t[0];e.wheelX=r-s.clientX,e.wheelY=i-s.clientY,r=s.clientX,i=s.clientY,n(e)})},t.addMouseWheelListener=function(e,n){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){function c(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}e._clicks=o,r[s]("mousedown",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}function h(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s]("mousedown",e),r[s](l[o],e)}var o=0,u,a,f,l={2:"dblclick",3:"tripleclick",4:"quadclick"};Array.isArray(e)||(e=[e]),e.forEach(function(e){t.addListener(e,"mousedown",c),i.isOldIE&&t.addListener(e,"dblclick",h)})};var u=!i.isMac||!i.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)};t.getModifierString=function(e){return r.KEY_MODS[u(e)]},t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var o=null;r(e,"keydown",function(e){o=e.keyCode}),r(e,"keypress",function(e){return a(n,e,o)})}else{var u=null;r(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=a(n,e,e.keyCode);return u=e.defaultPrevented,t}),r(e,"keypress",function(e){u&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),u=null)}),r(e,"keyup",function(e){s[e.keyCode]=null}),s||(f(),r(window,"focus",f))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+l;t.addListener(n,"message",function i(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,"message",i),e())}),n.postMessage(r,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function r(){t.$idleBlocked?setTimeout(r,100):e()},n)},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=typeof window=="object"&&(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("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(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 this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},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){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0: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 n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;nh.length?e=e.substr(9):e.substr(0,4)==h.substr(0,4)?e=e.substr(4,e.length-h.length+1):e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e!=h.charAt(0)&&e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),p&&(p=!1),L&&(L=!1)},O=function(e){if(m)return;var t=c.value;A(t),T()},M=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||f)return;var i=l||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return M(e,t,!0)}},_=function(e,n){var s=t.getCopyText();if(!s)return r.preventDefault(e);M(e,s)?(i.isIOS&&(d=n,c.value="\n aa"+s+"a a\n",c.setSelectionRange(4,4+s.length),p={value:s}),n?t.onCut():t.onCopy(),i.isIOS||r.preventDefault(e)):(p=!0,c.value=s,c.select(),setTimeout(function(){p=!1,T(),x(),n?t.onCut():t.onCopy()}))},D=function(e){_(e,!0)},P=function(e){_(e,!1)},H=function(e){var n=M(e);typeof n=="string"?(n&&t.onPaste(n,e),i.isIE&&setTimeout(x),r.preventDefault(e)):(c.value="",v=!0)};r.addCommandKeyListener(c,t.onCommandKey.bind(t)),r.addListener(c,"select",C),r.addListener(c,"input",O),r.addListener(c,"cut",D),r.addListener(c,"copy",P),r.addListener(c,"paste",H);var B=function(e){if(m||!t.onCompositionStart||t.$readOnly)return;m={},m.canUndo=t.session.$undoManager,t.onCompositionStart(),setTimeout(j,0),t.on("mousedown",F),m.canUndo&&!t.selection.isEmpty()&&(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup()},j=function(){if(!m||!t.onCompositionUpdate||t.$readOnly)return;var e=c.value.replace(/\x01/g,"");if(m.lastValue===e)return;t.onCompositionUpdate(e),m.lastValue&&t.undo(),m.canUndo&&(m.lastValue=e);if(m.lastValue){var n=t.selection.getRange();t.insert(m.lastValue),t.session.markUndoGroup(),m.range=t.selection.getRange(),t.selection.setRange(n),t.selection.clearSelection()}},F=function(e){if(!t.onCompositionEnd||t.$readOnly)return;var n=m;m=!1;var r=setTimeout(function(){r=null;var e=c.value.replace(/\x01/g,"");if(m)return;e==n.lastValue?T():!n.lastValue&&e&&(T(),A(e))});k=function(i){return r&&clearTimeout(r),i=i.replace(/\x01/g,""),i==n.lastValue?"":(n.lastValue&&r&&t.undo(),i)},t.onCompositionEnd(),t.removeListener("mousedown",F),e.type=="compositionend"&&n.range&&t.selection.setRange(n.range);var s=!!i.isChrome&&i.isChrome>=53||!!i.isWebKit&&i.isWebKit>=603;s&&O()},I=o.delayedCall(j,50);r.addListener(c,"compositionstart",B),r.addListener(c,"compositionupdate",function(){I.schedule()}),r.addListener(c,"keyup",function(){I.schedule()}),r.addListener(c,"keydown",function(){I.schedule()}),r.addListener(c,"compositionend",F),this.getElement=function(){return c},this.setReadOnly=function(e){c.readOnly=e},this.onContextMenu=function(e){L=!0,x(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,n){g||(g=c.style.cssText),c.style.cssText=(n?"z-index:100000;":"")+"height:"+c.style.height+";"+(i.isIE?"opacity:0.1;":"");var o=t.container.getBoundingClientRect(),u=s.computedStyle(t.container),a=o.top+(parseInt(u.borderTopWidth)||0),f=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-a-c.clientHeight-2,h=function(e){c.style.left=e.clientX-f-2+"px",c.style.top=Math.min(e.clientY-a-2,l)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(q),i.isWin&&r.capture(t.container,h,R)},this.onContextMenuClose=R;var q,U=function(e){t.textInput.onContextMenu(e),R()};r.addListener(c,"mouseup",U),r.addListener(c,"mousedown",function(e){e.preventDefault(),R()}),r.addListener(t.renderer.scroller,"contextmenu",U),r.addListener(c,"contextmenu",U);if(i.isIOS){var z=null,W=!1;e.addEventListener("keydown",function(e){z&&clearTimeout(z),W=!0}),e.addEventListener("keyup",function(e){z=setTimeout(function(){W=!1},100)});var X=function(e){if(document.activeElement!==c)return;if(W)return;if(d)return setTimeout(function(){d=!1},100);var n=c.selectionStart,r=c.selectionEnd;c.setSelectionRange(4,5);if(n==r)switch(n){case 0:t.onCommandKey(null,0,u.up);break;case 1:t.onCommandKey(null,0,u.home);break;case 2:t.onCommandKey(null,a.option,u.left);break;case 4:t.onCommandKey(null,0,u.left);break;case 5:t.onCommandKey(null,0,u.right);break;case 7:t.onCommandKey(null,a.option,u.right);break;case 8:t.onCommandKey(null,0,u.end);break;case 9:t.onCommandKey(null,0,u.down)}else{switch(r){case 6:t.onCommandKey(null,a.shift,u.right);break;case 7:t.onCommandKey(null,a.shift|a.option,u.right);break;case 8:t.onCommandKey(null,a.shift,u.end);break;case 9:t.onCommandKey(null,a.shift,u.down)}switch(n){case 0:t.onCommandKey(null,a.shift,u.up);break;case 1:t.onCommandKey(null,a.shift,u.home);break;case 2:t.onCommandKey(null,a.shift|a.option,u.left);break;case 3:t.onCommandKey(null,a.shift,u.left)}}};document.addEventListener("selectionchange",X),t.on("destroy",function(){document.removeEventListener("selectionchange",X)})}};t.TextInput=c}),define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/keyboard/textinput_ios"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=i.isChrome<18,a=i.isIE,f=i.isChrome>63,l=e("./textinput_ios").TextInput,c=function(e,t){function T(e){e=y?!1:e;if(v)return;v=!0;if(L)var t=0,r=e?0:n.value.length-1;else var t=e?2:1,r=2;try{n.setSelectionRange(t,r)}catch(i){}v=!1}function N(){if(v)return;n.value=c,i.isWebKit&&x.schedule()}function U(){clearTimeout(R),R=setTimeout(function(){m&&(n.style.cssText=m,m=""),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}if(i.isIOS)return l.call(this,e,t);var n=s.createElement("textarea");n.className="ace_text-input",n.setAttribute("wrap","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck",!1),n.style.opacity="0",e.insertBefore(n,e.firstChild);var c=i.isIE?"\x01\x01":"\u2028\u2028",h=i.isIE?/\x01/g:/\u2028/g,p=!1,d=!1,v=!1,m="",g=!0,y=!1,b=!1;try{var w=document.activeElement===n}catch(E){}r.addListener(n,"blur",function(e){t.onBlur(e),w=!1}),r.addListener(n,"focus",function(e){w=!0,t.onFocus(e),T()}),this.$focusScroll=!1,this.focus=function(){if(m||f||this.$focusScroll=="browser")return n.focus({preventScroll:!0});var e=n.style.top;n.style.position="fixed",n.style.top="0px";var t=n.getBoundingClientRect().top!=0,r=[];if(t){var i=n.parentElement;while(i&&i.nodeType==1)r.push(i),i.setAttribute("ace_nocontext",!0),!i.parentElement&&i.getRootNode?i=i.getRootNode().host:i=i.parentElement}n.focus({preventScroll:!0}),t&&r.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){n.style.position="",n.style.top=="0px"&&(n.style.top=e)},0)},this.blur=function(){n.blur()},this.isFocused=function(){return w};var S=o.delayedCall(function(){w&&T(g)}),x=o.delayedCall(function(){v||(n.value=c,w&&T())});i.isWebKit||t.addEventListener("changeSelection",function(){t.selection.isEmpty()!=g&&(g=!g,S.schedule())}),N(),w&&t.onFocus();var C=function(e){return e.selectionStart===0&&e.selectionEnd===e.value.length},k=function(e){p?p=!1:C(n)?(t.selectAll(),T()):L&&T(t.selection.isEmpty())},L=null;this.setInputHandler=function(e){L=e},this.getInputHandler=function(){return L};var A=!1,O=function(e){L&&(e=L(e),L=null),d?(T(),e&&t.onPaste(e),d=!1):e==c.charAt(0)?A?t.execCommand("del",{source:"ace"}):t.execCommand("backspace",{source:"ace"}):(e.substring(0,2)==c?e=e.substr(2):e.charAt(0)==c.charAt(0)?e=e.substr(1):e.charAt(e.length-1)==c.charAt(0)&&(e=e.slice(0,-1)),e.charAt(e.length-1)==c.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),A&&(A=!1)},M=function(e){if(v)return;var t=n.value;O(t),N()},_=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||u)return;var i=a||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return _(e,t,!0)}},D=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);_(e,s)?(i?t.onCut():t.onCopy(),r.preventDefault(e)):(p=!0,n.value=s,n.select(),setTimeout(function(){p=!1,N(),T(),i?t.onCut():t.onCopy()}))},P=function(e){D(e,!0)},H=function(e){D(e,!1)},B=function(e){var s=_(e);typeof s=="string"?(s&&t.onPaste(s,e),i.isIE&&setTimeout(T),r.preventDefault(e)):(n.value="",d=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t)),r.addListener(n,"select",k),r.addListener(n,"input",M),r.addListener(n,"cut",P),r.addListener(n,"copy",H),r.addListener(n,"paste",B),(!("oncut"in n)||!("oncopy"in n)||!("onpaste"in n))&&r.addListener(e,"keydown",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:H(e);break;case 86:B(e);break;case 88:P(e)}});var j=function(e){if(v||!t.onCompositionStart||t.$readOnly)return;v={},v.canUndo=t.session.$undoManager,t.onCompositionStart(),setTimeout(F,0),t.on("mousedown",I),v.canUndo&&!t.selection.isEmpty()&&(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup()},F=function(){if(!v||!t.onCompositionUpdate||t.$readOnly)return;var e=n.value.replace(h,"");if(v.lastValue===e)return;t.onCompositionUpdate(e),v.lastValue&&t.undo(),v.canUndo&&(v.lastValue=e);if(v.lastValue){var r=t.selection.getRange();t.insert(v.lastValue),t.session.markUndoGroup(),v.range=t.selection.getRange(),t.selection.setRange(r),t.selection.clearSelection()}},I=function(e){if(!t.onCompositionEnd||t.$readOnly)return;var r=v;v=!1;var s=setTimeout(function(){s=null;var e=n.value.replace(h,"");if(v)return;e==r.lastValue?N():!r.lastValue&&e&&(N(),O(e))});L=function(n){return s&&clearTimeout(s),n=n.replace(h,""),n==r.lastValue?"":(r.lastValue&&s&&t.undo(),n)},t.onCompositionEnd(),t.removeListener("mousedown",I),e.type=="compositionend"&&r.range&&t.selection.setRange(r.range);var o=i.isIE||i.isChrome&&i.isChrome>=53||i.isWebKit&&i.isWebKit>=603;o&&M()},q=o.delayedCall(F,50);r.addListener(n,"compositionstart",j),r.addListener(n,"compositionupdate",function(){q.schedule()}),r.addListener(n,"keyup",function(){q.schedule()}),r.addListener(n,"keydown",function(){q.schedule()}),r.addListener(n,"compositionend",I),this.getElement=function(){return n},this.setCommandMode=function(e){b=e,n.readOnly=!1},this.setReadOnly=function(e){b||(n.readOnly=e)},this.setCopyWithEmptySelection=function(e){y=e},this.onContextMenu=function(e){A=!0,T(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){m||(m=n.style.cssText),n.style.cssText=(o?"z-index:100000;":"")+"height:"+n.style.height+";"+(i.isIE?"opacity:0.1;":"");var u=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),f=u.top+(parseInt(a.borderTopWidth)||0),l=u.left+(parseInt(u.borderLeftWidth)||0),c=u.bottom-f-n.clientHeight-2,h=function(e){n.style.left=e.clientX-l-2+"px",n.style.top=Math.min(e.clientY-f-2,c)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(R),i.isWin&&r.capture(t.container,h,U)},this.onContextMenuClose=U;var R,z=function(e){t.textInput.onContextMenu(e),U()};r.addListener(n,"mouseup",z),r.addListener(n,"mousedown",function(e){e.preventDefault(),U()}),r.addListener(t.renderer.scroller,"contextmenu",z),r.addListener(n,"contextmenu",z)};t.TextInput=c}),define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function a(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));var n=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function f(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function l(e,t){if(e.start.row==e.end.row)var n=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 n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=0,u=250;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,i=e.getButton();if(i!==0){var o=r.getSelectionRange(),u=o.isEmpty();(u||i==1)&&r.selection.moveToPosition(n),i==2&&(r.textInput.onContextMenu(e.domEvent),s.isMozilla||e.preventDefault());return}this.mousedownEvent.time=Date.now();if(t&&!r.isFocused()){r.focus();if(this.$focusTimeout&&!this.$clickSelection&&!r.inMultiSelectMode){this.setState("focusWait"),this.captureMouse(e);return}}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=l(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=l(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.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=f(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>o||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.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())return;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 n=this.$lastScroll,r=e.domEvent.timeStamp,i=r-n.t,s=i?e.wheelX/i:n.vx,o=i?e.wheelY/i:n.vy;i=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(f=!0),a<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(f=!0);if(f)n.allowed=r;else if(r-n.allowedt.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("
"),i.setHtml(f),i.show(),t._signal("showGutterTooltip",i),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=u.domEvent.target,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t._signal("hideGutterTooltip",i),t.removeEventListener("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=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(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.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(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.moveCursorToPosition(e),S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.selection.fromOrientedRange(m),t.isFocused()&&!w&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&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;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e)),i.addListener(c,"dragend",this.onDragEnd.bind(e)),i.addListener(c,"dragenter",this.onDragEnter.bind(e)),i.addListener(c,"dragover",this.onDragOver.bind(e)),i.addListener(c,"dragleave",this.onDragLeave.bind(e)),i.addListener(c,"drop",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(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 n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){n.readyState===4&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=r.getDocumentHead(),i=document.createElement("script");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,n){if(n||!i.readyState||i.readyState=="loaded"||i.readyState=="complete")i=i.onload=i.onreadystatechange=null,n||t()}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a)},t.init=f}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("../config"),l=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){var n=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());n&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click")),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove")),r.addMultiMouseDownListener([u,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"),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),r.addTouchMoveListener(e.container,this.onTouchMove.bind(this,"touchmove"));var f=e.renderer.$gutter;r.addListener(f,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),r.addListener(f,"click",this.onMouseEvent.bind(this,"gutterclick")),r.addListener(f,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),r.addListener(f,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),r.addListener(u,"mousedown",n),r.addListener(f,"mousedown",n),i.isIE&&e.renderer.scrollBarV&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n),r.addListener(e.renderer.scrollBarH.element,"mousedown",n)),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.onTouchMove=function(e,t){var n=new u(t,this.editor);n.speed=1,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,s=this.editor.renderer;s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=null);var o=this,a=function(e){if(!e)return;if(i.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new u(e,o.editor),o.$mouseMoved=!0},f=function(e){n.off("beforeEndOperation",c),clearInterval(h),l(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",s.$keepTextAreaAtCursor==null&&(s.$keepTextAreaAtCursor=!0,s.$moveTextAreaToCursor()),o.isMousePressed=!1,o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e)},l=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){f(e)});var c=function(e){n.curOp.command.name&&n.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};n.on("beforeEndOperation",c),o.$onCaptureMouseMove=a,o.releaseMouse=r.capture(this.editor.container,a,f);var h=setInterval(l,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(l.prototype),f.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=l}),define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){e.on("click",function(t){var n=t.getDocumentPosition(),i=e.session,s=i.getFoldAt(n.row,n.column,1);s&&(t.getAccelKey()?i.removeFold(s):i.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&r.hasCssClass(o,"ace_inline_button")&&r.hasCssClass(o,"ace_toggle_wrap")&&(i.setOption("wrap",!0),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}var r=e("../lib/dom");t.FoldHandler=i}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=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)return;while(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)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(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(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return!o&&e==-1&&(s={command:"insertstring"},o=u.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";function F(e,t,n,r){var i=s?d:p,c=null,h=null,v=null,m=0,g=null,y=null,b=-1,w=null,E=null,T=[];if(!r)for(w=0,r=[];w0)if(g==16){for(w=b;w-1){for(w=b;w=0;C--){if(r[C]!=N)break;t[C]=s}}}function I(e,t,n){if(o=e){u=i+1;while(u=e)u++;for(a=i,l=u-1;a=t.length||(o=n[r-1])!=b&&o!=w||(c=t[r+1])!=b&&c!=w)return E;return u&&(c=w),c==o?c:E;case k:o=r>0?n[r-1]:S;if(o==b&&r+10&&n[r-1]==b)return b;if(u)return E;p=r+1,h=t.length;while(p=1425&&d<=2303||d==64286;o=t[p];if(v&&(o==y||o==T))return y}if(r<1||(o=t[r-1])==S)return E;return n[r-1];case S:return u=!1,f=!0,s;case x:return l=!0,E;case O:case M:case D:case P:case _:u=!1;case H:return E}}function R(e){var t=e.charCodeAt(0),n=t>>8;return n==0?t>191?g:B[t]:n==5?/[\u0591-\u05f4]/.test(e)?y:g:n==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?A:/[\u0660-\u0669\u066b-\u066c]/.test(e)?w:t==1642?L:/[\u06f0-\u06f9]/.test(e)?b:T:n==32&&t<=8287?j[t&255]:n==254?t>=65136?T:E:E}function U(e){return e>="\u064b"&&e<="\u0655"}var r=["\u0621","\u0641"],i=["\u063a","\u064a"],s=0,o=0,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=[[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]],d=[[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]],v=0,m=1,g=0,y=1,b=2,w=3,E=4,S=5,x=6,T=7,N=8,C=9,k=10,L=11,A=12,O=13,M=14,_=15,D=16,P=17,H=18,B=[H,H,H,H,H,H,H,H,H,x,S,x,N,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,S,S,S,x,N,E,E,L,L,L,E,E,E,E,E,k,C,k,C,C,b,b,b,b,b,b,b,b,b,b,C,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,H,H,H,H,H,H,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,C,E,L,L,L,L,E,E,E,E,g,E,E,H,E,E,L,L,b,b,E,g,E,E,E,b,g,E,E,E,E,E],j=[N,N,N,N,N,N,N,N,N,N,N,H,H,H,g,y,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N,S,O,M,_,D,P,C,L,L,L,L,L,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,C,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N];t.L=g,t.R=y,t.EN=b,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.DOT="\u00b7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var i=e.split(""),o=new Array(i.length),u=new Array(i.length),a=[];s=r?m:v,F(i,a,i.length,n);for(var f=0;fT&&n[f]0&&i[f-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(i[f])&&(a[f-1]=a[f]=t.R_H,f++);i[i.length-1]===t.DOT&&(a[i.length-1]=t.B);for(var f=0;f=0&&(e=this.session.$docRowCache[n])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n,r=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){n=this.session.$getRowCacheIndex(t,this.currentRow-e-1);if(n!==r)break;r=n,e++}}return e},this.updateRowLine=function(e,t){e===undefined&&(e=this.getDocumentRow()),this.wrapIndent=0,this.isLastRow=e===this.session.getLength()-1,this.line=this.session.getLine(e);if(this.session.$useWrapMode){var n=this.session.$wrapData[e];n&&(t===undefined&&(t=this.getSplitIndex()),t>0&&n.length?(this.wrapIndent=n.indent,this.line=t0?e-1:0,this.bidiMap),n=this.bidiMap.bidiLevels,i=0;e===0&&n[t]%2!==0&&t++;for(var s=0;s=a&&pn+o/2){n+=o;if(i===s.length-1){o=0;break}o=this.charWidths[s[++i]]}return i>0&&s[i-1]%2!==0&&s[i]%2===0?(e0&&s[i-1]%2===0&&s[i]%2!==0?t=1+(e>n?this.bidiMap.logicalFromVisual[i]:this.bidiMap.logicalFromVisual[i-1]):this.isRtlDir&&i===s.length-1&&o===0&&s[i-1]%2===0||!this.isRtlDir&&i===0&&s[i]%2!==0?t=1+this.bidiMap.logicalFromVisual[i]:(i>0&&s[i-1]%2!==0&&o!==0&&i--,t=this.bidiMap.logicalFromVisual[i]),t+this.wrapIndent}}).call(u.prototype),t.BidiHandler=u}),define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=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(){r.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 n=t?e.end:e.start,r=t?e.start:e.end;this.$setSelection(n.row,n.column,r.row,r.column)},this.$setSelection=function(e,t,n,r){var i=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,r),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||i!=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(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.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 n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+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,n){var r=e.column,i=e.column+t;return n<0&&(r=e.column-t,i=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(r,i).split(" ").length-1==t},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(e,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(t.column=r)}}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,n=this.doc.getLine(e),r=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var i=this.session.getFoldAt(e,t,1);if(i){this.moveCursorTo(i.end.row,i.end.column);return}this.session.nonTokenRe.exec(r)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t));if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(s)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t=0,n,r=/\s/,i=this.session.tokenRe;i.lastIndex=0;if(this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{while((n=e[t])&&r.test(n))t++;if(t<1){i.lastIndex=0;while((n=e[t])&&!i.test(n)){i.lastIndex=0,t++;if(r.test(n)){if(t>2){t--;break}while((n=e[t])&&r.test(n))t++;if(t>2)break}}}}return i.lastIndex=0,t},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-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 n=this.session.documentToScreenPosition(this.lead.row,this.lead.column),r;t===0&&(e!==0&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(r=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(r/this.session.$bidiHandler.charWidths[0])):r=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var i=this.session.screenToDocumentPosition(n.row+e,n.column,r);e!==0&&t===0&&i.row===this.lead.row&&i.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[i.row]&&(i.row>0||e>0)&&i.row++,this.moveCursorTo(i.row,i.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0;var i=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(i.charAt(t))&&i.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},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 n=this.getCursor();return o.fromPoints(t,n)}catch(r){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(e.start==undefined){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!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(u.prototype),t.Selection=u}),define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;il){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;yi){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(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,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new r(this.$row,t,this.$row,t+e.value.length)}}).call(i.prototype),t.TokenIterator=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c={'"':'"',"'":"'"},h=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},p=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},d=function(e){this.add("braces","insertion",function(t,n,r,i,s){var u=r.getCursorPosition(),a=i.doc.getLine(u.row);if(s=="{"){h(r);var l=r.getSelectionRange(),c=i.doc.getTextRange(l);if(c!==""&&c!=="{"&&r.getWrapBehavioursEnabled())return p(l,c,"{","}");if(d.isSaneInsertion(r,i))return/[\]\}\)]/.test(a[u.column])||r.inMultiSelectMode||e&&e.braces?(d.recordAutoInsert(r,i,"}"),{text:"{}",selection:[1,1]}):(d.recordMaybeInsert(r,i,"{"),{text:"{",selection:[1,1]})}else if(s=="}"){h(r);var v=a.substring(u.column,u.column+1);if(v=="}"){var m=i.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(m!==null&&d.isAutoInsertedClosing(u,a,s))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(s=="\n"||s=="\r\n"){h(r);var g="";d.isMaybeInsertedClosing(u,a)&&(g=o.stringRepeat("}",f.maybeInsertedBrackets),d.clearMaybeInsertedClosing());var v=a.substring(u.column,u.column+1);if(v==="}"){var y=i.findMatchingBracket({row:u.row,column:u.column+1},"}");if(!y)return null;var b=this.$getIndent(i.getLine(y.row))}else{if(!g){d.clearMaybeInsertedClosing();return}var b=this.$getIndent(a)}var w=b+i.getTabString();return{text:"\n"+w+"\n"+b+g,selection:[1,w.length,1,w.length]}}d.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"(",")");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"[","]");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){var s=r.$mode.$quotes||c;if(i.length==1&&s[i]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(i)!=-1)return;h(n);var o=i,u=n.getSelectionRange(),a=r.doc.getTextRange(u);if(a!==""&&(a.length!=1||!s[a])&&n.getWrapBehavioursEnabled())return p(u,a,o,o);if(!a){var f=n.getCursorPosition(),l=r.doc.getLine(f.row),d=l.substring(f.column-1,f.column),v=l.substring(f.column,f.column+1),m=r.getTokenAt(f.row,f.column),g=r.getTokenAt(f.row,f.column+1);if(d=="\\"&&m&&/escape/.test(m.type))return null;var y=m&&/string|escape/.test(m.type),b=!g||/string|escape/.test(g.type),w;if(v==o)w=y!==b,w&&/string\.end/.test(g.type)&&(w=!1);else{if(y&&!b)return null;if(y&&b)return null;var E=r.$mode.tokenRe;E.lastIndex=0;var S=E.test(d);E.lastIndex=0;var x=E.test(d);if(S||x)return null;if(v&&!/[\s;,.})\]\\]/.test(v))return null;w=!0}return{text:w?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};d.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},d.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},d.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},d.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},d.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},d.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},d.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},d.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(d,i),t.CstyleBehaviour=d}),define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";var r=[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],i=0,s=[];for(var o=0;o2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(ne.length&&(E=e.length)}),a==Infinity&&(a=E,s=!1,o=!1),l&&a%f!=0&&(a=Math.floor(a/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new a(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,l=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new f(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new a(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new f(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);l.start.row==c&&(l.start.column+=h),l.end.row==c&&(l.end.column+=h),t.selection.fromOrientedRange(l)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)e[t]&&(this.$embeds.push(t),this.$modes[t]=new e[t]);var n=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.columnthis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},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 n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.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 u(this,e,t)},"aaa".split(/a/).length===0?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){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},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),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].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 n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.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){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=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){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length-t+1,i=e.start.row,s=e.start.column;for(var o=0,u=0;o20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,r==-1&&(r=t),s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),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 n={first:e,last:t};this._signal("update",{data:n})},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,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}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),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(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.rowthis.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,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s=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 n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row=r)break}if(e.action=="insert"){var f=i-r,l=-t.column+n.column;for(;or)break;a.start.row==r&&a.start.column>=t.column&&(a.start.column!=t.column||!this.$insertRight)&&(a.start.column+=l,a.start.row+=f);if(a.end.row==r&&a.end.column>=t.column){if(a.end.column==t.column&&this.$insertRight)continue;a.end.column==t.column&&l>0&&oa.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=l),a.end.column+=l,a.end.row+=f}}}else{var f=r-i,l=t.column-n.column;for(;oi)break;a.end.rowt.column)a.end.column=t.column,a.end.row=t.row}else a.end.column+=l,a.end.row+=f;if(a.start.row==i)if(a.start.column<=n.column){if(f||a.start.column>t.column)a.start.column=t.column,a.start.row=t.row}else a.start.column+=l,a.start.row+=f}}if(f!=0&&o=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i=t){u=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},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 n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column;if(u0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d0&&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 n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(tl)break}while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return f.end.row=i.getCurrentTokenRow(),f.end.column=i.getCurrentTokenColumn()+s.value.length-2,f}},this.foldAll=function(e,t,n){n==undefined&&(n=1e5);var r=this.foldWidgets;if(!r)return;t=t||this.getLength(),e=e||0;for(var i=e;i=e){i=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=n)}catch(u){}}}},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)return;this.$foldStyle=e,e=="manual"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation");if(!e||this.$foldStyle=="manual"){this.foldWidgets=null;return}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.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);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);if(s&&o.isEqual(s.range))return this.removeFold(s),s}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,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 n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},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)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a=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}r.implement(this,u),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){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=i.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()?i.stringRepeat(" ",this.getTabSize()):" "},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;t0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(oe&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;ao){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},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)return;this.$fromUndo=!0;for(var n=e.length-1;n!=-1;n--){var r=e[n];r.action=="insert"||r.action=="remove"?this.doc.revertDelta(r):r.folds&&this.addFolds(r.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)return;this.$fromUndo=!0;for(var n=0;ne.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,f=s.start,o=f.row-a.row,u=f.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new l(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},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){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-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){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(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){if(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 n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,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,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}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,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),o=this.$wrapData,u=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,o){var u;if(e!=null){u=this.$getDisplayTokens(e,a.length),u[0]=n;for(var f=1;fr-b){var w=f+r-b;if(e[w-1]>=c&&e[w]>=c){y(w);continue}if(e[w]==n||e[w]==s){for(w;w!=f-1;w--)if(e[w]==n)break;if(w>f){y(w);continue}w=f+r;for(w;w>2)),f-1);while(w>E&&e[w]E&&e[w]E&&e[w]==a)w--}else while(w>E&&e[w]E){y(++w);continue}w=f+r,e[w]==t&&w--,y(w-b)}return o},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o39&&u<48||u>57&&u<64?i.push(a):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},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]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]=0)var u=f[l],i=this.$docRowCache[l],h=e>f[c-1];else var h=!c;var p=this.getLength()-1,d=this.getNextFoldLine(i),v=d?d.start.row:Infinity;while(u<=e){a=this.getRowLength(i);if(u+a>e||i>=p)break;u+=a,i++,i>v&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),v=d?d.start.row:Infinity),h&&(this.$docRowCache.push(i),this.$screenRowCache.push(u))}if(d&&d.start.row<=i)r=this.getFoldDisplayLine(d),i=d.start.row;else{if(u+a<=e||i>p)return{row:p,column:this.getLine(p).length};r=this.getLine(i),d=null}var m=0,g=Math.floor(e-u);if(this.$useWrapMode){var y=this.$wrapData[i];y&&(o=y[g],g>0&&y.length&&(m=y.indent,s=y[g-1]||y[y.length-1],r=r.substring(s)))}return n!==undefined&&this.$bidiHandler.isBidiRow(u+g,i,g)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(r,t-m)[1],this.$useWrapMode&&s>=o&&(s=o-1),d?d.idxToPosition(s):{row:i,column:s}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return{row:r,column:v+this.$getStringScreenWidth(d)[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){e=this.getLength();var n=this.$foldData;for(var r=0;ro&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){if(!this.$enableVarChar)return;this.$getStringScreenWidth=function(t,n,r){if(n===0)return[0,0];n||(n=Infinity),r=r||0;var i,s;for(s=0;sn)break}return[r,s]}},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()},this.isFullWidth=m}.call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),o.defineOptions(d.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$modified=!0,this.$resetRowCache(0),this.$updateWrapData(0,this.getLength()-1)))},initialValue:"auto"},indentedSoftWrap:{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){if(isNaN(e)||this.$tabSize===e)return;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=d}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";function u(e,t){function n(e){return/\w/.test(e)||t.regExp?"\\b":""}return n(e[0])+e+n(e[e.length-1])}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i,o){return r=new s(e,n,i,o),n==o&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start)?(r=null,!1):!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;hv)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;gE&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g=u;n--)if(c(n,Number.MAX_VALUE,e))return;if(t.wrap==0)return;for(n=a,u=o.row;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return};else var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n+=1;n<=a;n++)if(c(n,0,e))return;if(t.wrap==0)return;for(n=u,a=o.row;n<=a;n++)if(c(n,0,e))return};if(t.$isMultiLine)var l=n.length,c=function(t,i,s){var o=r?t-l+1:t;if(o<0)return;var u=e.getLine(o),a=u.search(n[0]);if(!r&&ai)return;if(s(o,a,o+l-1,c))return!0};else if(r)var c=function(t,r,i){var s=e.getLine(t),o=[],u,a=0;n.lastIndex=0;while(u=n.exec(s)){var f=u[0].length;a=u.index;if(!f){if(a>=s.length)break;n.lastIndex=a+=1}if(u.index+f>r)break;o.push(u.index,f)}for(var l=o.length-1;l>=0;l-=2){var c=o[l-1],f=o[l];if(i(t,c,t,c+f))return!0}};else var c=function(t,r,i){var s=e.getLine(t),o,u;n.lastIndex=r;while(u=n.exec(s)){var a=u[0].length;o=u.index;if(i(t,o,t,o+a))return!0;if(!a){n.lastIndex=o+=1;if(o>=s.length)return!1}}};return{forEach:f}}}).call(o.prototype),t.Search=o}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&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 n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&e&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r=e(n));var o=i[t];for(s=0;sr)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},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}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){if(r<0)return;var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(e.isAvailable&&!e.isAvailable(t))return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;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)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?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 typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){i.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){i.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){typeof t!="number"&&(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){i.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(),n=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),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){i.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(r.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){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+10?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&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)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"&&e!="ace"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.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)return;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 n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.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?t==1?this.navigateFileEnd():t==-1&&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")||i.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=t.findMatchingBracket(e.getCursorPosition());if(n)var r=new p(n.row,n.column,n.row,n.column+1);else if(t.$mode.getMatching)var r=t.$mode.getMatching(e.session);r&&(t.$bracketHighlight=t.addMarker(r,"ace_bracket","text"))},50)},this.$highlightTags=function(){if(this.$highlightTagPending)return;var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=e.getCursorPosition(),r=new y(e.session,n.row,n.column),i=r.getCurrentToken();if(!i||!/\b(?:tag-open|tag-name)/.test(i.type)){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}if(i.type.indexOf("tag-open")!=-1){i=r.stepForward();if(!i)return}var s=i.value,o=0,u=r.stepBackward();if(u.value=="<"){do u=i,i=r.stepForward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="=0)}else{do i=u,u=r.stepBackward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,"ace_active-line","screenLine"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column,r=t.end.column,i=e.getLine(t.start.row),s=i.substring(n,r);if(s.length>5e3||!/[\w\d]/.test(s))return;var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),u=i.substring(n-1,r+1);if(!o.test(u))return;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(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;var r=this.selection.getAllRanges();for(var i=0;is.length||i.length<2||!i[1])return this.commands.exec("insertstring",this,t);for(var o=s.length;o--;){var u=s[o];u.isEmpty()||r.remove(u),r.insert(u.start,i[o])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var n=this.session,r=n.getMode(),i=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=r.transformAction(n.getState(i.row),"insertion",this,n,e);s&&(e!==s.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),e=s.text)}e==" "&&(e=this.session.getTabString());if(!this.selection.isEmpty()){var o=this.getSelectionRange();i=this.session.remove(o),this.clearSelection()}else if(this.session.getOverwrite()&&e.indexOf("\n")==-1){var o=new p.fromPoints(i,i);o.end.column+=e.length,this.session.remove(o)}if(e=="\n"||e=="\r\n"){var u=n.getLine(i.row);if(i.column>u.search(/\S|$/)){var a=u.substr(i.column).search(/\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e),h=n.insert(i,e);s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(n.getDocument().isNewLine(e)){var d=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},d)}c&&r.autoOutdent(l,n,i.row)},this.onTextInput=function(e){this.keyBinding.onTextInput(e)},this.onCommandKey=function(e,t,n){this.keyBinding.onCommandKey(e,t,n)},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()&&(e=="left"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,"deletion",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]=="\n"){var o=n.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}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.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())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;tt.toLowerCase()?1:0});var i=new p(0,0,0,0);for(var r=e.first;r<=e.last;r++){var s=t.getLine(r);i.start.row=r,i.end.row=r,i.end.column=s.length,t.replace(i,n[r-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),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&np+1)break;p=d.last}l--,u=this.session.$moveLines(h,p,t?0:e),t&&e==-1&&(c=l+1);while(c<=l)o[c].moveBy(u,0),c++;t||(u=0),a+=u}i.fromOrientedRange(i.ranges[0]),i.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(this.getCursorPosition())},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 n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection());var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.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,n,r){this.renderer.scrollToLine(e,t,n,r)},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 n=this.getCursorPosition(),r=new y(this.session,n.row,n.column),i=r.getCurrentToken(),s=i||r.stepForward();if(!s)return;var o,u=!1,a={},f=n.column-s.start,l,c={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g))for(;f=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e=="string"||e instanceof RegExp?t.needle=e:typeof e=="object"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},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 n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},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)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var s=this.on("changeSelection",function(){r=!0}),o=this.renderer.on("beforeRender",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on("afterRender",function(){if(r&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.topwindow.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+"px",i.style.left=s.left+"px",i.style.height=o.lineHeight+"px",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",u),this.renderer.off("beforeRender",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!="wide",i.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e))}}.call(w.prototype),g.defineOptions(w.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},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",showLineNumbers:"renderer",showGutter:"renderer",displayIndentGuides:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"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"}),t.Editor=w}),define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){for(var n=t;n--;){var r=e[n];if(r&&!r[0].ignore){while(n0){a.row+=i,a.column+=a.row==r.row?s:0;continue}!t&&l<=0&&(a.row=n.row,a.column=n.column,l===0&&(a.bias=1))}}function f(e){return{row:e.row,column:e.column}}function l(e){return{start:f(e.start),end:f(e.end),action:e.action,lines:e.lines.slice()}}function c(e){e=e||this;if(Array.isArray(e))return e.map(c).join("\n");var t="";e.action?(t=e.action=="insert"?"+":"-",t+="["+e.lines+"]"):e.value&&(Array.isArray(e.value)?t=e.value.map(h).join("\n"):t=h(e.value)),e.start&&(t+=h(e));if(e.id||e.rev)t+=" ("+(e.id||e.rev)+")";return t}function h(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function p(e,t){var n=e.action=="insert",r=t.action=="insert";if(n&&r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}else if(!n&&r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(!n&&!r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}return[t,e]}function d(e,t){for(var n=e.length;n--;)for(var r=0;r=0?m(e,t,-1):o(e.start,t.start)<=0?m(t,e,1):(m(e,s.fromPoints(t.start,e.start),-1),m(t,e,1));else if(!n&&r)o(t.start,e.end)>=0?m(t,e,-1):o(t.start,e.start)<=0?m(e,t,1):(m(t,s.fromPoints(e.start,t.start),-1),m(e,t,1));else if(!n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0)){var i,u;return o(e.start,t.start)<0&&(i=e,e=y(e,t.start)),o(e.end,t.end)>0&&(u=y(e,t.end)),g(t.end,e.start,e.end,-1),u&&!i&&(e.lines=u.lines,e.start=u.start,e.end=u.end,u=e),[t,i,u].filter(Boolean)}m(e,t,-1)}return[t,e]}function m(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,r){e.row==(r==1?t:n).row&&(e.column+=r*(n.column-t.column)),e.row+=r*(n.row-t.row)}function y(e,t){var n=e.lines,r=e.end;e.end=f(t);var i=e.end.row-e.start.row,s=n.splice(i,n.length),o=i?t.column:t.column-e.start.column;n.push(s[0].substring(0,o)),s[0]=s[0].substr(o);var u={start:f(t),end:r,lines:s,action:e.action};return u}function b(e,t){t=l(t);for(var n=e.length;n--;){var r=e[n];for(var i=0;i0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){e==undefined&&(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?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)}}).call(r.prototype);var s=e("./range").Range,o=s.comparePoints,u=s.comparePoints;t.UndoManager=r}),define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/lang"),o=e("../lib/event_emitter").EventEmitter,u=function(e){this.element=r.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.$cells=[]};(function(){i.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;to&&(v=s.end.row+1,s=t.getNextFoldLine(v,s),o=s?s.start.row:Infinity);if(v>i){while(this.$cells.length>d+1)p=this.$cells.pop(),this.element.removeChild(p.element);break}p=this.$cells[++d],p||(p={element:null,textNode:null,foldWidget:null},p.element=r.createElement("div"),p.textNode=document.createTextNode(""),p.element.appendChild(p.textNode),this.element.appendChild(p.element),this.$cells[d]=p);var m="ace_gutter-cell ";a[v]&&(m+=a[v]),f[v]&&(m+=f[v]),this.$annotations[v]&&(m+=this.$annotations[v].className),p.element.className!=m&&(p.element.className=m);var g=t.getRowLength(v)*e.lineHeight+"px";g!=p.element.style.height&&(p.element.style.height=g);if(u){var y=u[v];y==null&&(y=u[v]=t.getFoldWidget(v))}if(y){p.foldWidget||(p.foldWidget=r.createElement("span"),p.element.appendChild(p.foldWidget));var m="ace_fold-widget ace_"+y;y=="start"&&v==o&&vn.right-t.right)return"foldWidgets"}}).call(u.prototype),t.Gutter=u}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../lib/dom"),s=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,n,r){return(e?1:0)|(t?2:0)|(n?4:0)|(r?8:0)}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.update=function(e){if(!e)return;this.config=e;var t=[];for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var i=r.range.clipRows(e.firstRow,e.lastRow);if(i.isEmpty())continue;i=i.toScreenRange(this.session);if(r.renderer){var s=this.$getTop(i.start.row,e),o=this.$padding+(this.session.$bidiHandler.isBidiRow(i.start.row)?this.session.$bidiHandler.getPosLeft(i.start.column):i.start.column*e.characterWidth);r.renderer(t,i,o,s,e)}else r.type=="fullLine"?this.drawFullLineMarker(t,i,r.clazz,e):r.type=="screenLine"?this.drawScreenLineMarker(t,i,r.clazz,e):i.isMultiLine()?r.type=="text"?this.drawTextMarker(t,i,r.clazz,e):this.drawMultiLineMarker(t,i,r.clazz,e):this.session.$bidiHandler.isBidiRow(i.start.row)?this.drawBidiSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e):this.drawSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e)}this.element.innerHTML=t.join("")},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(t,n,i,s,o){var u=this.session,a=n.start.row,f=n.end.row,l=a,c=0,h=0,p=u.getScreenLastRowColumn(l),d=null,v=new r(l,n.start.column,l,h);for(;l<=f;l++)v.start.row=v.end.row=l,v.start.column=l==a?n.start.column:u.getRowWrapIndent(l),v.end.column=p,c=h,h=p,p=l+1p,l==f),this.session.$bidiHandler.isBidiRow(l)?this.drawBidiSingleLineMarker(t,v,d,s,l==f?0:1,o):this.drawSingleLineMarker(t,v,d,s,l==f?0:1,o)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o,u,a;i=i||"";if(this.session.$bidiHandler.isBidiRow(t.start.row)){var f=t.clone();f.end.row=f.start.row,f.end.column=this.session.getLine(f.start.row).length,this.drawBidiSingleLineMarker(e,f,n+" ace_br1 ace_start",r,null,i)}else o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth,e.push("
");if(this.session.$bidiHandler.isBidiRow(t.end.row)){var f=t.clone();f.start.row=f.end.row,f.start.column=0,this.drawBidiSingleLineMarker(e,f,n+" ace_br12",r,null,i)}else{var l=t.end.column*r.characterWidth;o=r.lineHeight,u=this.$getTop(t.end.row,r),e.push("
")}o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<=0)return;u=this.$getTop(t.start.row+1,r);var c=(t.start.column?1:0)|(t.end.column?0:8);e.push("
")},this.drawSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;e.push("
")},this.drawBidiSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=this.$getTop(t.start.row,r),a=this.$padding,f=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);f.forEach(function(t){e.push("
")})},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),e.push("
")},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;e.push("
")}}).call(s.prototype),t.Marker=s}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/useragent"),u=e("../lib/event_emitter").EventEmitter,a=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this)};(function(){r.implement(this,u),this.EOF_CHAR="\u00b6",this.EOL_CHAR_LF="\u00ac",this.EOL_CHAR_CRLF="\u00a4",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="\u2014",this.SPACE_CHAR="\u00b7",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc.getNewLineCharacter()=="\n"?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=e)return this.EOL_CHAR=e,!0},this.setPadding=function(e){this.$padding=e,this.element.style.padding="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?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;n"+s.stringRepeat(this.TAB_CHAR,n)+""):t.push(s.stringRepeat(" ",n));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",i="",o="";if(this.showInvisibles){r+=" ace_invisible",i=" ace_invisible_space",o=" ace_invisible_tab";var u=s.stringRepeat(this.SPACE_CHAR,this.tabSize),a=s.stringRepeat(this.TAB_CHAR,this.tabSize)}else var u=s.stringRepeat(" ",this.tabSize),a=u;this.$tabStrings[" "]=""+u+"",this.$tabStrings[" "]=""+a+""}},this.updateLines=function(e,t,n){(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)&&this.scrollLines(e),this.config=e;var r=Math.max(t,e.firstRow),i=Math.min(n,e.lastRow),s=this.element.childNodes,o=0;for(var u=e.firstRow;uf&&(u=a.end.row+1,a=this.session.getNextFoldLine(u,a),f=a?a.start.row:Infinity);if(u>i)break;var l=s[o++];if(l){var c=[];this.$renderLine(c,u,!this.$useLineGroups(),u==f?a:!1),l.style.height=e.lineHeight*this.session.getRowLength(u)+"px",l.innerHTML=c.join("")}u++}},this.scrollLines=function(e){var t=this.config;this.config=e;if(!t||t.lastRow0;r--)n.removeChild(n.firstChild);if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)n.removeChild(n.lastChild);if(e.firstRowt.lastRow){var i=this.$renderLinesFragment(e,t.lastRow+1,e.lastRow);n.appendChild(i)}},this.$renderLinesFragment=function(e,t,n){var r=this.element.ownerDocument.createDocumentFragment(),s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=i.createElement("div"),f=[];this.$renderLine(f,s,!1,s==u?o:!1),a.innerHTML=f.join("");if(this.$useLineGroups())a.className="ace_line_group",r.appendChild(a),a.style.height=e.lineHeight*this.session.getRowLength(s)+"px";else while(a.firstChild)r.appendChild(a.firstChild);s++}return r},this.update=function(e){this.config=e;var t=[],n=e.firstRow,r=e.lastRow,i=n,s=this.session.getNextFoldLine(i),o=s?s.start.row:Infinity;for(;;){i>o&&(i=s.end.row+1,s=this.session.getNextFoldLine(i,s),o=s?s.start.row:Infinity);if(i>r)break;this.$useLineGroups()&&t.push("
"),this.$renderLine(t,i,!1,i==o?s:!1),this.$useLineGroups()&&t.push("
"),i++}this.element.innerHTML=t.join("")},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var i=this,o=/\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF\uFFF9-\uFFFC])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\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,u=function(e,n,r,o,u){if(n)return i.showInvisibles?""+s.stringRepeat(i.SPACE_CHAR,e.length)+"":e;if(e=="&")return"&";if(e=="<")return"<";if(e==">")return">";if(e==" "){var a=i.session.getScreenTabSize(t+o);return t+=a-1,i.$tabStrings[a]}if(e=="\u3000"){var f=i.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",l=i.showInvisibles?i.SPACE_CHAR:"";return t+=1,""+l+""}return r?""+i.SPACE_CHAR+"":(t+=1,""+e+"")},a=r.replace(o,u);if(!this.$textToken[n.type]){var f="ace_"+n.type.replace(/\./g," ace_"),l="";n.type=="fold"&&(l=" style='width:"+n.value.length*this.config.characterWidth+"px;' "),e.push("",a,"")}else e.push(a);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);return r<=0||r>=n?t:t[0]==" "?(r-=r%this.tabSize,e.push(s.stringRepeat(this.$tabStrings[" "],r/this.tabSize)),t.substr(r)):t[0]==" "?(e.push(s.stringRepeat(this.$tabStrings[" "],r)),t.substr(r)):t},this.$renderWrappedLine=function(e,t,n,r){var i=0,o=0,u=n[0],a=0;for(var f=0;f=u)a=this.$renderToken(e,a,l,c.substring(0,u-i)),c=c.substring(u-i),i=u,r||e.push("","
"),e.push(s.stringRepeat("\u00a0",n.indent)),o++,a=0,u=n[o]||Number.MAX_VALUE;c.length!=0&&(i+=c.length,a=this.$renderToken(e,a,l,c))}}},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;sthis.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,i);n=this.$renderToken(e,n,r,i)}},this.$renderOverflowMessage=function(e,t,n,r){this.$renderToken(e,t,n,r.slice(0,this.MAX_LINE_LENGTH-t)),e.push("<click to see more...>")},this.$renderLine=function(e,t,n,r){!r&&r!=0&&(r=this.session.getFoldLine(t));if(r)var i=this.$getFoldLineTokens(t,r);else var i=this.session.getTokens(t);n||e.push("
");if(i.length){var s=this.session.getRowSplitData(t);s&&s.length?this.$renderWrappedLine(e,i,s,n):this.$renderSimpleLine(e,i)}this.showInvisibles&&(r&&(t=r.end.row),e.push("",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"")),n||e.push("
")},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.lengthn-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(sn?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:"fold",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(a.prototype),t.Text=a}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i,s=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),i===undefined&&(i=!("opacity"in this.element.style)),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=(i?this.$updateVisibility:this.$updateOpacity).bind(this)};(function(){this.$updateVisibility=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.visibility=e?"":"hidden"},this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.opacity=e?"":"0"},this.$startCssAnimation=function(){var e=this.cursors;for(var t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){r.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){r.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&&!i&&(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.$updateCursors=this.$updateOpacity.bind(this),this.restartTimer())},this.addCursor=function(){var e=r.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,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible)return;this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));if(r.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()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,r=0;if(t===undefined||t.length===0)t=[{cursor:null}];for(var n=0,i=t.length;ne.height+e.offset||s.top<0)&&n>1)continue;var o=(this.cursors[r++]||this.addCursor()).style;this.drawCursor?this.drawCursor(o,s,e,t[n],this.session):(o.left=s.left+"px",o.top=s.top+"px",o.width=e.characterWidth+"px",o.height=e.lineHeight+"px")}while(this.cursors.length>r)this.removeCursor();var u=this.session.getOverwrite();this.$setOverwrite(u),this.$pixelPos=s,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(s.prototype),t.Cursor=s}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,u=32768,a=function(e){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=i.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(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(a.prototype);var f=function(e,t){a.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};r.inherits(f,a),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){this.scrollTop=this.element.scrollTop;if(this.coeff!=1){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>u?(this.coeff=u/e,e=u):this.coeff!=1&&(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(f.prototype);var l=function(e,t){a.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};r.inherits(l,a),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(l.prototype),t.ScrollBar=f,t.ScrollBarV=f,t.ScrollBarH=l,t.VScrollBar=f,t.HScrollBar=l}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var r=e("./lib/event"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){this.changes=this.changes|e;if(this.changes){var t=this;r.nextFrame(function(e){var n=t.changes;n&&(r.blockIdle(100),t.changes=0,t.onRender(n)),t.changes&&t.schedule()})}}}).call(i.prototype),t.RenderLoop=i}),define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),u=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,f=256,l=typeof ResizeObserver=="function",c=200,h=t.FontMetrics=function(e){this.el=i.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.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",f),this.$characterSize={width:0,height:0},l?this.$addObserver():this.checkForSizeChanges()};(function(){r.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",u.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){e===undefined&&(e=this.$measureSizes());if(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 n=t[0].contentRect;e.checkForSizeChanges({height:n.height,width:n.width/f})}),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/f};return t.width===0||t.height===0?null:t},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,f);var t=this.$main.getBoundingClientRect();return t.width/f},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),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=i.buildDom([e(0,0),e(c,0),e(0,c),e(c,c)],this.el)},this.transformCoordinates=function(e,t){function r(e,t,n){var r=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/r,(+e[1]*n[0]-e[0]*n[1])/r]}function i(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 u(e){var t=e.getBoundingClientRect();return[t.left,t.top]}if(e){var n=this.$getZoom(this.el);e=o(1/n,e)}this.els||this.$initTransformMeasureNodes();var a=u(this.els[0]),f=u(this.els[1]),l=u(this.els[2]),h=u(this.els[3]),p=r(i(h,f),i(h,l),i(s(f,l),s(h,a))),d=o(1+p[0],i(f,a)),v=o(1+p[1],i(l,a));if(t){var m=t,g=p[0]*m[0]/c+p[1]*m[1]/c+1,y=s(o(m[0],d),o(m[1],v));return s(o(1/g/c,y),a)}var b=i(e,a),w=r(i(d,o(p[0],b)),i(v,o(p[1],b)),b);return o(c,w)}}).call(h.prototype)}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./config"),o=e("./lib/useragent"),u=e("./layer/gutter").Gutter,a=e("./layer/marker").Marker,f=e("./layer/text").Text,l=e("./layer/cursor").Cursor,c=e("./scrollbar").HScrollBar,h=e("./scrollbar").VScrollBar,p=e("./renderloop").RenderLoop,d=e("./layer/font_metrics").FontMetrics,v=e("./lib/event_emitter").EventEmitter,m='.ace_editor {position: relative;overflow: hidden;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;box-sizing: border-box;min-width: 100%;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {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==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {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==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;text-indent: -1em;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: inherit;color: inherit;z-index: 1000;opacity: 1;text-indent: 0;}[ace_nocontext=true] {transform: none!important;filter: none!important;perspective: none!important;clip-path: none!important;mask : none!important;contain: none!important;perspective: none!important;mix-blend-mode: initial!important;z-index: auto;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;}.ace_text-layer {font: inherit !important;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {transition: opacity 0.18s;}.ace_animate-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: step-end;animation-name: blink-ace-animate;animation-iteration-count: infinite;}.ace_animate-blinking.ace_smooth-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: ease-in-out;animation-name: blink-ace-animate-smooth;}@keyframes blink-ace-animate {from, to { opacity: 1; }60% { opacity: 0; }}@keyframes blink-ace-animate-smooth {from, to { opacity: 1; }45% { opacity: 1; }60% { opacity: 0; }85% { opacity: 0; }}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;box-sizing: border-box;}.ace_line .ace_fold {box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_inline_button {border: 1px solid lightgray;display: inline-block;margin: -1px 8px;padding: 0 5px;pointer-events: auto;cursor: pointer;}.ace_inline_button:hover {border-color: gray;background: rgba(200,200,200,0.2);display: inline-block;pointer-events: auto;}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_text-input-ios {position: absolute !important;top: -100000px !important;left: -100000px !important;}';i.importCssString(m,"ace_editor.css");var g=function(e,t){var n=this;this.container=e||i.createElement("div"),i.addCssClass(this.container,"ace_editor"),this.setTheme(t),this.$gutter=i.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=i.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=i.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new u(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new a(this.content);var r=this.$textLayer=new f(this.content);this.canvas=r.element,this.$markerFront=new a(this.content),this.$cursorLayer=new l(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new h(this.container,this),this.scrollBarH=new c(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new d(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._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.$loop=new p(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,r.implement(this,v),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);if(!e)return;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,n){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRowthis.layerConfig.lastRow)return;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,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)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,n,r){r-=this.$extraHeight||0;var i=0,s=this.$size,o={width:s.width,height:s.height,scrollerHeight:s.scrollerHeight,scrollerWidth:s.scrollerWidth};r&&(e||s.height!=r)&&(s.height=r,i|=this.CHANGE_SIZE,s.scrollerHeight=s.height,this.$horizScroll&&(s.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",i|=this.CHANGE_SCROLL);if(n&&(e||s.width!=n)){i|=this.CHANGE_SIZE,s.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,this.scrollBarH.element.style.left=this.scroller.style.left=t+"px",s.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()),this.scrollBarH.element.style.right=this.scroller.style.right=this.scrollBarV.getWidth()+"px",this.scroller.style.bottom=this.scrollBarH.getHeight()+"px";if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)i|=this.CHANGE_FULL}return s.$dirty=!n||!r,i&&this._signal("resize",o),i},this.onGutterResize=function(){var e=this.$showGutter?this.$gutter.offsetWidth:0;e!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,e,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.$loop.schedule(this.CHANGE_MARKER))},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,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.$updateGutterLineHighlight=function(){var e=this.$cursorLayer.$pixelPos,t=this.layerConfig.lineHeight;if(this.session.getUseWrapMode()){var n=this.session.selection.getCursor();n.column=0,e=this.$cursorLayer.getPixelPosition(n,!0),t*=this.session.getRowLength(n.row)}this.$gutterLineHighlight.style.top=e.top-this.layerConfig.offset+"px",this.$gutterLineHighlight.style.height=t+"px"},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=i.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&&this.session.$wrap==-1&&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){e.left="-100px";return}var t=this.layerConfig,n=this.$cursorLayer.$pixelPos.top,r=this.$cursorLayer.$pixelPos.left;n-=t.offset;var i=this.lineHeight;if(n<0||n>t.height-i){e.top=e.left="0";return}var s=this.characterWidth;if(this.$composition){var o=this.textarea.value.replace(/^\x01+/,"");s*=this.session.$getStringScreenWidth(o)[0]+2,i+=2}r-=this.scrollLeft,r>this.$size.scrollerWidth-s&&(r=this.$size.scrollerWidth-s),r+=this.gutterWidth,e.height=i+"px",e.width=s+"px",e.left=Math.min(r,this.$size.scrollerWidth-s)+"px",e.top=Math.min(n,this.$size.height-i)+"px"},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,n=this.session.documentToScreenRow(t,0)*e.lineHeight;return n-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,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),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){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}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 n=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){e|=this.$computeLayerConfig();if(n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var r=this.scrollTop+(n.firstRow-this.layerConfig.firstRow)*this.lineHeight;r>0&&(this.scrollTop=r,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),this.$gutterLayer.element.style.marginTop=-n.offset+"px",this.content.style.marginTop=-n.offset+"px",this.content.style.width=n.width+2*this.$padding+"px",this.content.style.height=n.minHeight+"px"}e&this.CHANGE_H_SCROLL&&(this.content.style.marginLeft=-this.scrollLeft+"px",this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left");if(e&this.CHANGE_FULL){this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this._signal("afterRender");return}if(e&this.CHANGE_SCROLL){e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this.$moveTextAreaToCursor(),this._signal("afterRender");return}e&this.CHANGE_TEXT?(this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):(e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER)&&this.$showGutter&&this.$gutterLayer.update(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender")},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var r=n<=2*this.lineHeight,i=!r&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var s=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,n),this.desiredHeight=n,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.$getLongestLine(),o=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),u=this.$horizScroll!==o;u&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var f=this.scrollTop%this.lineHeight,l=t.scrollerHeight+this.lineHeight,c=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=c;var h=this.scrollMargin;this.session.setScrollTop(Math.max(-h.top,Math.min(this.scrollTop,i-t.scrollerHeight+h.bottom))),this.session.setScrollLeft(Math.max(-h.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+h.right)));var p=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+c<0||this.scrollTop>h.top),d=a!==p;d&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var v=Math.ceil(l/this.lineHeight)-1,m=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),g=m+v,y,b,w=this.lineHeight;m=e.screenToDocumentRow(m,0);var E=e.getFoldLine(m);E&&(m=E.start.row),y=e.documentToScreenRow(m,0),b=e.getRowLength(m)*w,g=Math.min(e.screenToDocumentRow(g,0),e.getLength()-1),l=t.scrollerHeight+e.getRowLength(g)*w+b,f=this.scrollTop-y*w;var S=0;if(this.layerConfig.width!=s||u)S=this.CHANGE_H_SCROLL;if(u||d)S=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),d&&(s=this.$getLongestLine());return this.layerConfig={width:s,padding:this.$padding,firstRow:m,firstRowScreen:y,lastRow:g,lineHeight:w,characterWidth:this.characterWidth,minHeight:l,maxHeight:i,offset:f,gutterOffset:w?Math.max(0,Math.ceil((f+t.height-t.scrollerHeight)/w)):0,height:this.$size.scrollerHeight},S},this.$updateLines=function(){if(!this.$changedLines)return;var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(tthis.$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,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},this.scrollCursorIntoView=function(e,t,n){if(this.$size.scrollerHeight===0)return;var r=this.$cursorLayer.getPixelPosition(e),i=r.left,s=r.top,o=n&&n.top||0,u=n&&n.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&a+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-ui?(i=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),u=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:u,side:s-u>0?1:-1,offsetX:i}},this.screenToTextCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),u=(t+this.scrollTop-n.top)/this.lineHeight;return this.session.screenToDocumentPosition(u,Math.max(o,0),i)},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+(this.session.$bidiHandler.isBidiRow(r.row,e)?this.session.$bidiHandler.getPosLeft(r.column):Math.round(r.column*this.characterWidth)),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){i.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,i.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor()},this.setCompositionText=function(e){this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;i.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null},this.setTheme=function(e,t){function o(r){if(n.$themeId!=e)return t&&t();if(!r||!r.cssClass)throw new Error("couldn't load module "+e+" or it didn't call define");r.$id&&(n.$themeId=r.$id),i.importCssString(r.cssText,r.cssClass,n.container),n.theme&&i.removeCssClass(n.container,n.theme.cssClass);var s="padding"in r?r.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&s!=n.$padding&&n.setPadding(s),n.$theme=r.cssClass,n.theme=r,i.addCssClass(n.container,r.cssClass),i.setCssClass(n.container,"ace_dark",r.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:r}),t&&t()}var n=this;this.$themeId=e,n._dispatchEvent("themeChange",{theme:e});if(!e||typeof e=="string"){var r=e||this.$options.theme.initialValue;s.loadModule(["theme",r],o)}else o(e)},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){i.setCssClass(this.container,e,t!==!1)},this.unsetStyle=function(e){i.removeCssClass(this.container,e)},this.setCursorStyle=function(e){this.scroller.style.cursor!=e&&(this.scroller.style.cursor=e)},this.setMouseCursor=function(e){this.scroller.style.cursor=e},this.attachToShadowRoot=function(){i.importCssString(m,"ace_editor.css",this.container)},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(g.prototype),s.defineOptions(g.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){typeof e=="number"&&(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){i.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e)},initialValue:!0},showLineNumbers:{set:function(e){this.$gutterLayer.setShowLineNumbers(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){if(!this.$gutterLineHighlight){this.$gutterLineHighlight=i.createElement("div"),this.$gutterLineHighlight.className="ace_gutter-active-line",this.$gutter.appendChild(this.$gutterLineHighlight);return}this.$gutterLineHighlight.style.display=e?"":"none",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight()},initialValue:!1,value:!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){typeof e=="number"&&(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.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0;if(this.$scrollPastEnd==e)return;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:{}}),t.VirtualRenderer=g}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,n){"use strict";function u(e){var t="importScripts('"+i.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(n){var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,s=new r;return s.append(t),s.getBlob("application/javascript")}}function a(e){if(typeof Worker=="undefined")return{postMessage:function(){},terminate:function(){}};var t=u(e),n=window.URL||window.webkitURL,r=n.createObjectURL(t);return new Worker(r)}var r=e("../lib/oop"),i=e("../lib/net"),s=e("../lib/event_emitter").EventEmitter,o=e("../config"),f=function(t,n,r,i,s){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl);if(o.get("packaged")||!e.toUrl)i=i||o.moduleUrl(n,"worker");else{var u=this.$normalizePath;i=i||u(e.toUrl("ace/worker/worker.js",null,"_"));var f={};t.forEach(function(t){f[t]=u(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}this.$worker=a(i),s&&this.send("importScripts",s),this.$worker.postMessage({init:!0,tlns:f,module:n,classname:r}),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){r.implement(this,s),this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var n=this.callbacks[t.id];n&&(n(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 i.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,n){if(n){var r=this.callbackId++;this.callbacks[r]=n,t.push(r)}this.send(e,t)},this.emit=function(e,t){try{this.$worker.postMessage({event:e,data:{data:t.data}})}catch(n){console.error(n.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)),e.action=="insert"?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;if(!e)return;this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e})}}).call(f.prototype);var l=function(e,t,n){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var r=null,i=!1,u=Object.create(s),a=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){a.messageBuffer.push(e),r&&(i?setTimeout(f):f())},this.setEmitSync=function(e){i=e};var f=function(){var e=a.messageBuffer.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};u.postMessage=function(e){a.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){r=new e[n](u);while(a.messageBuffer.length)f()})};l.prototype=f.prototype,t.UIWorkerClient=l,t.WorkerClient=f,t.createWorker=a}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./range").Range,i=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var i=this.pos;i.$insertRight=!0,i.detach(),i.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);r.$insertRight=!0,r.detach(),e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;this.updateAnchors(e),i&&(this.length+=n);if(i&&!this.session.$fromUndo)if(e.action==="insert")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.insertMergedLines(a,e.lines)}else if(e.action==="remove")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.remove(new r(a.row,a.column,a.row,a.column-n))}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)return;var e=this,t=this.session,n=function(n,i){t.removeMarker(n.markerId),n.markerId=t.addMarker(new r(n.row,n.column,n.row,n.column+e.length),i,null,!1)};n(this.pos,this.mainClass);for(var i=this.others.length;i--;)n(this.others[i],this.othersClass)},this.onCursorChange=function(e){if(this.$updating||!this.session)return;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(this.$undoStackDepth===-1)return;var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth;for(var n=0;n1&&!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.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal("removeRange",{ranges:e}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,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],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var n=this.getRange(),r=this.isBackwards(),s=n.start.row,o=n.end.row;if(s==o){if(r)var u=n.end,a=n.start;else var u=n.start,a=n.end;this.addRange(i.fromPoints(a,a)),this.addRange(i.fromPoints(u,u));return}var f=[],l=this.getLineRange(s,!0);l.start.column=n.start.column,f.push(l);for(var c=s+1;c1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column0)g--;if(g>0){var y=0;while(r[y].isEmpty())y++}for(var b=g;b>=y;b--)r[b].isEmpty()&&r.splice(b,1)}return r}}.call(s.prototype);var d=e("./editor").Editor;(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)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,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){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction=="forEach"?r=n.forEachSelection(t,e.args):t.multiSelectAction=="forEachLine"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction=="single"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges();var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r0);u<0&&(u=0),f>=c&&(f=c-1)}var p=this.session.removeFullLines(u,f);p=this.$reAlignText(p,l),this.session.insert({row:u,column:0},p.join("\n")+"\n"),l||(o.start.column=0,o.end.column=p[p.length-1].length),this.selection.setRange(o)}else{s.forEach(function(e){t.substractPoint(e.cursor)});var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),io?e.insert(r,a.stringRepeat(" ",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(" ",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),st[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.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 n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.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=m,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){m(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("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../../range").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?"start":t=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++tf){var h=e.getLine(l).length;return new r(f,u,l,h)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a=="start"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}',t.$id="ace/theme/textmate";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}),define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(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)}var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./range").Range;(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+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();if(this.editor==e)return;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)return;this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnFold=function(e,t){var n=t.lineWidgets;if(!n||!e.action)return;var r=e.data,i=r.start.row,s=r.end.row,o=e.action=="add";for(var u=i+1;u0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+"px";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=n.width+2*n.padding+"px"),u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+"px":u.el.style.right=""}}}).call(o.prototype),t.LineWidgets=o}),define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?"unshift":"push"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e("../line_widgets").LineWidgets,i=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.widgetManager.getWidgetsAtRow(o).filter(function(e){return e.type=="errorMarker"})[0];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!="number"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div"),type:"errorMarker"},p=h.el.appendChild(i.createElement("div")),d=h.el.appendChild(i.createElement("div"));d.className="error_widget_arrow "+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+"px",h.el.className="error_widget_wrapper",p.className="error_widget "+l.className,p.innerHTML=l.text.join("
"),p.appendChild(i.createElement("div"));var m=function(e,t,n){if(t===0&&(n==="esc"||n==="return"))return h.destroy(),{command:"null"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off("changeSelection",h.destroy),e.off("changeSession",h.destroy),e.off("mouseup",h.destroy),e.off("change",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",h.destroy),e.on("changeSession",h.destroy),e.on("mouseup",h.destroy),e.on("change",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.el.offsetHeight})},i.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("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),i=e("./lib/event"),s=e("./range").Range,o=e("./editor").Editor,u=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,f=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,typeof define=="function"&&(t.define=define),t.edit=function(e,n){if(typeof e=="string"){var s=e;e=document.getElementById(s);if(!e)throw new Error("ace.edit can't find div #"+s)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var u="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;u=a.value,e=r.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(u=e.textContent,e.innerHTML="");var l=t.createEditSession(u),c=new o(new f(e),l,n),h={document:l,editor:c,onResize:c.resize.bind(c,null)};return a&&(h.textarea=a),i.addListener(window,"resize",h.onResize),c.on("destroy",function(){i.removeListener(window,"resize",h.onResize),h.editor.container.env=null}),c.container.env=c.env=h,c},t.createEditSession=function(e,t){var n=new u(e,t);return n.setUndoManager(new a),n},t.Range=s,t.EditSession=u,t.UndoManager=a,t.VirtualRenderer=f,t.version="1.3.3"}); - (function() { - window.require(["ace/ace"], function(a) { - if (a) { - a.config.init(true); - a.define = window.define; - } - if (!window.ace) - window.ace = a; - for (var key in a) if (a.hasOwnProperty(key)) - window.ace[key] = a[key]; - window.ace["default"] = window.ace; - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = window.ace; - } - }); - })(); - \ No newline at end of file +(function () +{ + function o(n) + { + var i = e; + n && (e[n] || (e[n] = {}), i = e[n]); + if (!i.define || !i.define.packaged) t.original = i.define, i.define = t, i.define.packaged = !0; + if (!i.require || !i.require.packaged) r.original = i.require, i.require = r, i.require.packaged = !0 + } + var ACE_NAMESPACE = "", + e = function () + { + return this + }(); + !e && typeof window != "undefined" && (e = window); + if (!ACE_NAMESPACE && typeof requirejs != "undefined") return; + var t = function (e, n, r) + { + if (typeof e != "string") + { + t.original ? t.original.apply(this, arguments) : (console.error("dropping module because define wasn't a string."), console.trace()); + return + } + arguments.length == 2 && (r = n), t.modules[e] || (t.payloads[e] = r, t.modules[e] = null) + }; + t.modules = {}, t.payloads = {}; + var n = function (e, t, n) + { + if (typeof t == "string") + { + var i = s(e, t); + if (i != undefined) return n && n(), i + } + else if (Object.prototype.toString.call(t) === "[object Array]") + { + var o = []; + for (var u = 0, a = t.length; u < a; ++u) + { + var f = s(e, t[u]); + if (f == undefined && r.original) return; + o.push(f) + } + return n && n.apply(null, o) || !0 + } + }, + r = function (e, t) + { + var i = n("", e, t); + return i == undefined && r.original ? r.original.apply(this, arguments) : i + }, + i = function (e, t) + { + if (t.indexOf("!") !== -1) + { + var n = t.split("!"); + return i(e, n[0]) + "!" + i(e, n[1]) + } + if (t.charAt(0) == ".") + { + var r = e.split("/").slice(0, -1).join("/"); + t = r + "/" + t; + while (t.indexOf(".") !== -1 && s != t) + { + var s = t; + t = t.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "") + } + } + return t + }, + s = function (e, r) + { + r = i(e, r); + var s = t.modules[r]; + if (!s) + { + s = t.payloads[r]; + if (typeof s == "function") + { + var o = {}, + u = { + id: r, + uri: "", + exports: o, + packaged: !0 + }, + a = function (e, t) + { + return n(r, e, t) + }, + f = s(a, o, u); + o = f || u.exports, t.modules[r] = o, delete t.payloads[r] + } + s = t.modules[r] = o || s + } + return s + }; + o(ACE_NAMESPACE) +})(), define("ace/lib/regexp", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + + function o(e) + { + return (e.global ? "g" : "") + (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.extended ? "x" : "") + (e.sticky ? "y" : "") + } + + function u(e, t, n) + { + if (Array.prototype.indexOf) return e.indexOf(t, n); + for (var r = n || 0; r < e.length; r++) + if (e[r] === t) return r; + return -1 + } + var r = { + exec: RegExp.prototype.exec, + test: RegExp.prototype.test, + match: String.prototype.match, + replace: String.prototype.replace, + split: String.prototype.split + }, + i = r.exec.call(/()??/, "")[1] === undefined, + s = function () + { + var e = /^/g; + return r.test.call(e, ""), !e.lastIndex + }(); + if (s && i) return; + RegExp.prototype.exec = function (e) + { + var t = r.exec.apply(this, arguments), + n, a; + if (typeof e == "string" && t) + { + !i && t.length > 1 && u(t, "") > -1 && (a = RegExp(this.source, r.replace.call(o(this), "g", "")), r.replace.call(e.slice(t.index), a, function () + { + for (var e = 1; e < arguments.length - 2; e++) arguments[e] === undefined && (t[e] = undefined) + })); + if (this._xregexp && this._xregexp.captureNames) + for (var f = 1; f < t.length; f++) n = this._xregexp.captureNames[f - 1], n && (t[n] = t[f]); + !s && this.global && !t[0].length && this.lastIndex > t.index && this.lastIndex-- + } + return t + }, s || (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("ace/lib/es5-shim", ["require", "exports", "module"], function (e, t, n) +{ + function r() + {} + + function w(e) + { + try + { + return Object.defineProperty(e, "sentinel", + {}), "sentinel" in e + } + catch (t) + {} + } + + function H(e) + { + return e = +e, e !== e ? e = 0 : e !== 0 && e !== 1 / 0 && e !== -1 / 0 && (e = (e > 0 || -1) * Math.floor(Math.abs(e))), e + } + + function B(e) + { + var t = typeof e; + return e === null || t === "undefined" || t === "boolean" || t === "number" || t === "string" + } + + function j(e) + { + var t, n, r; + if (B(e)) return e; + n = e.valueOf; + if (typeof n == "function") + { + t = n.call(e); + if (B(t)) return t + } + r = e.toString; + if (typeof r == "function") + { + t = r.call(e); + if (B(t)) return t + } + throw new TypeError + } + Function.prototype.bind || (Function.prototype.bind = function (t) + { + var n = this; + if (typeof n != "function") throw new TypeError("Function.prototype.bind called on incompatible " + n); + var i = u.call(arguments, 1), + s = function () + { + if (this instanceof s) + { + var e = n.apply(this, i.concat(u.call(arguments))); + return Object(e) === e ? e : this + } + return n.apply(t, i.concat(u.call(arguments))) + }; + return n.prototype && (r.prototype = n.prototype, s.prototype = new r, r.prototype = null), s + }); + var i = Function.prototype.call, + s = Array.prototype, + o = Object.prototype, + u = s.slice, + a = i.bind(o.toString), + f = i.bind(o.hasOwnProperty), + l, c, h, p, d; + if (d = f(o, "__defineGetter__")) l = i.bind(o.__defineGetter__), c = i.bind(o.__defineSetter__), h = i.bind(o.__lookupGetter__), p = i.bind(o.__lookupSetter__); + if ([1, 2].splice(0).length != 2) + if (! function () + { + function e(e) + { + var t = new Array(e + 2); + return t[0] = t[1] = 0, t + } + var t = [], + n; + t.splice.apply(t, e(20)), t.splice.apply(t, e(26)), n = t.length, t.splice(5, 0, "XXX"), n + 1 == t.length; + if (n + 1 == t.length) return !0 + }()) Array.prototype.splice = function (e, t) + { + var n = this.length; + e > 0 ? e > n && (e = n) : e == void 0 ? e = 0 : e < 0 && (e = Math.max(n + e, 0)), e + t < n || (t = n - e); + var r = this.slice(e, e + t), + i = u.call(arguments, 2), + s = i.length; + if (e === n) s && this.push.apply(this, i); + else + { + var o = Math.min(t, n - e), + a = e + o, + f = a + s - o, + l = n - a, + c = n - o; + if (f < a) + for (var h = 0; h < l; ++h) this[f + h] = this[a + h]; + else if (f > a) + for (h = l; h--;) this[f + h] = this[a + h]; + if (s && e === c) this.length = c, this.push.apply(this, i); + else + { + this.length = c + s; + for (h = 0; h < s; ++h) this[e + h] = i[h] + } + } + return r + }; + else + { + var v = Array.prototype.splice; + Array.prototype.splice = function (e, t) + { + return arguments.length ? v.apply(this, [e === void 0 ? 0 : e, t === void 0 ? this.length - e : t].concat(u.call(arguments, 2))) : [] + } + } + Array.isArray || (Array.isArray = function (t) + { + return a(t) == "[object Array]" + }); + var m = Object("a"), + g = m[0] != "a" || !(0 in m); + Array.prototype.forEach || (Array.prototype.forEach = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = arguments[1], + s = -1, + o = r.length >>> 0; + if (a(t) != "[object Function]") throw new TypeError; + while (++s < o) s in r && t.call(i, r[s], s, n) + }), Array.prototype.map || (Array.prototype.map = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0, + s = Array(i), + o = arguments[1]; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + for (var u = 0; u < i; u++) u in r && (s[u] = t.call(o, r[u], u, n)); + return s + }), Array.prototype.filter || (Array.prototype.filter = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0, + s = [], + o, u = arguments[1]; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + for (var f = 0; f < i; f++) f in r && (o = r[f], t.call(u, o, f, n) && s.push(o)); + return s + }), Array.prototype.every || (Array.prototype.every = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0, + s = arguments[1]; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + for (var o = 0; o < i; o++) + if (o in r && !t.call(s, r[o], o, n)) return !1; + return !0 + }), Array.prototype.some || (Array.prototype.some = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0, + s = arguments[1]; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + for (var o = 0; o < i; o++) + if (o in r && t.call(s, r[o], o, n)) return !0; + return !1 + }), Array.prototype.reduce || (Array.prototype.reduce = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + if (!i && arguments.length == 1) throw new TypeError("reduce of empty array with no initial value"); + var s = 0, + o; + if (arguments.length >= 2) o = arguments[1]; + else + do { + if (s in r) + { + o = r[s++]; + break + } + if (++s >= i) throw new TypeError("reduce of empty array with no initial value") + } while (!0); + for (; s < i; s++) s in r && (o = t.call(void 0, o, r[s], s, n)); + return o + }), Array.prototype.reduceRight || (Array.prototype.reduceRight = function (t) + { + var n = F(this), + r = g && a(this) == "[object String]" ? this.split("") : n, + i = r.length >>> 0; + if (a(t) != "[object Function]") throw new TypeError(t + " is not a function"); + if (!i && arguments.length == 1) throw new TypeError("reduceRight of empty array with no initial value"); + var s, o = i - 1; + if (arguments.length >= 2) s = arguments[1]; + else + do { + if (o in r) + { + s = r[o--]; + break + } + if (--o < 0) throw new TypeError("reduceRight of empty array with no initial value") + } while (!0); + do o in this && (s = t.call(void 0, s, r[o], o, n)); while (o--); + return s + }); + if (!Array.prototype.indexOf || [0, 1].indexOf(1, 2) != -1) Array.prototype.indexOf = function (t) + { + var n = g && a(this) == "[object String]" ? this.split("") : F(this), + r = n.length >>> 0; + if (!r) return -1; + var i = 0; + arguments.length > 1 && (i = H(arguments[1])), i = i >= 0 ? i : Math.max(0, r + i); + for (; i < r; i++) + if (i in n && n[i] === t) return i; + return -1 + }; + if (!Array.prototype.lastIndexOf || [0, 1].lastIndexOf(0, -3) != -1) Array.prototype.lastIndexOf = function (t) + { + var n = g && a(this) == "[object String]" ? this.split("") : F(this), + r = n.length >>> 0; + if (!r) return -1; + var i = r - 1; + arguments.length > 1 && (i = Math.min(i, H(arguments[1]))), i = i >= 0 ? i : r - Math.abs(i); + for (; i >= 0; i--) + if (i in n && t === n[i]) return i; + return -1 + }; + Object.getPrototypeOf || (Object.getPrototypeOf = function (t) + { + return t.__proto__ || (t.constructor ? t.constructor.prototype : o) + }); + if (!Object.getOwnPropertyDescriptor) + { + var y = "Object.getOwnPropertyDescriptor called on a non-object: "; + Object.getOwnPropertyDescriptor = function (t, n) + { + if (typeof t != "object" && typeof t != "function" || t === null) throw new TypeError(y + t); + if (!f(t, n)) return; + var r, i, s; + r = { + enumerable: !0, + configurable: !0 + }; + if (d) + { + var u = t.__proto__; + t.__proto__ = o; + var i = h(t, n), + s = p(t, n); + t.__proto__ = u; + if (i || s) return i && (r.get = i), s && (r.set = s), r + } + return r.value = t[n], r + } + } + Object.getOwnPropertyNames || (Object.getOwnPropertyNames = function (t) + { + return Object.keys(t) + }); + if (!Object.create) + { + var b; + Object.prototype.__proto__ === null ? b = function () + { + return { + __proto__: null + } + } : b = 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 (t, n) + { + var r; + if (t === null) r = b(); + else + { + if (typeof t != "object") throw new TypeError("typeof prototype[" + typeof t + "] != 'object'"); + var i = function () {}; + i.prototype = t, r = new i, r.__proto__ = t + } + return n !== void 0 && Object.defineProperties(r, n), r + } + } + if (Object.defineProperty) + { + var E = w( + {}), + S = typeof document == "undefined" || w(document.createElement("div")); + if (!E || !S) var x = Object.defineProperty + } + if (!Object.defineProperty || x) + { + var T = "Property description must be an object: ", + N = "Object.defineProperty called on non-object: ", + C = "getters & setters can not be defined on this javascript engine"; + Object.defineProperty = function (t, n, r) + { + if (typeof t != "object" && typeof t != "function" || t === null) throw new TypeError(N + t); + if (typeof r != "object" && typeof r != "function" || r === null) throw new TypeError(T + r); + if (x) try + { + return x.call(Object, t, n, r) + } + catch (i) + {} + if (f(r, "value")) + if (d && (h(t, n) || p(t, n))) + { + var s = t.__proto__; + t.__proto__ = o, delete t[n], t[n] = r.value, t.__proto__ = s + } + else t[n] = r.value; + else + { + if (!d) throw new TypeError(C); + f(r, "get") && l(t, n, r.get), f(r, "set") && c(t, n, r.set) + } + return t + } + } + Object.defineProperties || (Object.defineProperties = function (t, n) + { + for (var r in n) f(n, r) && Object.defineProperty(t, r, n[r]); + return t + }), Object.seal || (Object.seal = function (t) + { + return t + }), Object.freeze || (Object.freeze = function (t) + { + return t + }); + try + { + Object.freeze(function () {}) + } + catch (k) + { + Object.freeze = function (t) + { + return function (n) + { + return typeof n == "function" ? n : t(n) + } + }(Object.freeze) + } + Object.preventExtensions || (Object.preventExtensions = function (t) + { + return t + }), Object.isSealed || (Object.isSealed = function (t) + { + return !1 + }), Object.isFrozen || (Object.isFrozen = function (t) + { + return !1 + }), Object.isExtensible || (Object.isExtensible = function (t) + { + if (Object(t) === t) throw new TypeError; + var n = ""; + while (f(t, n)) n += "?"; + t[n] = !0; + var r = f(t, n); + return delete t[n], r + }); + if (!Object.keys) + { + var L = !0, + A = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], + O = A.length; + for (var M in + { + toString: null + }) L = !1; + Object.keys = function I(e) + { + if (typeof e != "object" && typeof e != "function" || e === null) throw new TypeError("Object.keys called on a non-object"); + var I = []; + for (var t in e) f(e, t) && I.push(t); + if (L) + for (var n = 0, r = O; n < r; n++) + { + var i = A[n]; + f(e, i) && I.push(i) + } + return I + } + } + Date.now || (Date.now = function () + { + return (new Date).getTime() + }); + var _ = " \n\x0b\f\r   ᠎              

"; + if (!String.prototype.trim || _.trim()) + { + _ = "[" + _ + "]"; + var D = new RegExp("^" + _ + _ + "*"), + P = new RegExp(_ + _ + "*$"); + String.prototype.trim = function () + { + return String(this).replace(D, "").replace(P, "") + } + } + var F = function (e) + { + if (e == null) throw new TypeError("can't convert " + e + " to object"); + return Object(e) + } +}), define("ace/lib/fixoldbrowsers", ["require", "exports", "module", "ace/lib/regexp", "ace/lib/es5-shim"], function (e, t, n) +{ + "use strict"; + e("./regexp"), e("./es5-shim") +}), define("ace/lib/dom", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + var r = "http://www.w3.org/1999/xhtml"; + t.buildDom = function s(e, t, n) + { + if (typeof e == "string" && e) + { + var r = document.createTextNode(e); + return t && t.appendChild(r), r + } + if (!Array.isArray(e)) return e; + if (typeof e[0] != "string" || !e[0]) + { + var i = []; + for (var o = 0; o < e.length; o++) + { + var u = s(e[o], t, n); + u && i.push(u) + } + return i + } + var a = document.createElement(e[0]), + f = e[1], + l = 1; + f && typeof f == "object" && !Array.isArray(f) && (l = 2); + for (var o = l; o < e.length; o++) s(e[o], a, n); + return l == 2 && Object.keys(f).forEach(function (e) + { + var t = f[e]; + e === "class" ? a.className = Array.isArray(t) ? t.join(" ") : t : typeof t == "function" || e == "value" ? a[e] = t : e === "ref" ? n && (n[t] = a) : t != null && a.setAttribute(e, t) + }), t && t.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 || r, e) : document.createElement(e) + }, t.hasCssClass = function (e, t) + { + var n = (e.className + "").split(/\s+/g); + return n.indexOf(t) !== -1 + }, t.addCssClass = function (e, n) + { + t.hasCssClass(e, n) || (e.className += " " + n) + }, t.removeCssClass = function (e, t) + { + var n = e.className.split(/\s+/g); + for (;;) + { + var r = n.indexOf(t); + if (r == -1) break; + n.splice(r, 1) + } + e.className = n.join(" ") + }, t.toggleCssClass = function (e, t) + { + var n = e.className.split(/\s+/g), + r = !0; + for (;;) + { + var i = n.indexOf(t); + if (i == -1) break; + r = !1, n.splice(i, 1) + } + return r && n.push(t), e.className = n.join(" "), r + }, t.setCssClass = function (e, n, r) + { + r ? t.addCssClass(e, n) : t.removeCssClass(e, n) + }, t.hasCssString = function (e, t) + { + var n = 0, + r; + t = t || document; + if (r = t.querySelectorAll("style")) + while (n < r.length) + if (r[n++].id === e) return !0 + }, t.importCssString = function (n, r, i) + { + var s = i && i.getRootNode ? i.getRootNode() : i || document, + o = s.ownerDocument || s; + if (r && t.hasCssString(r, s)) return null; + r && (n += "\n/*# sourceURL=ace/css/" + r + " */"); + var u = t.createElement("style"); + u.appendChild(o.createTextNode(n)), r && (u.id = r), s == o && (s = t.getDocumentHead(o)), s.appendChild(u) + }, t.importCssStylsheet = function (e, n) + { + t.buildDom("link", + { + rel: "stylesheet", + href: e + }, t.getDocumentHead(n)) + }, t.scrollbarWidth = function (e) + { + var n = t.createElement("ace_inner"); + n.style.width = "100%", n.style.minWidth = "0px", n.style.height = "200px", n.style.display = "block"; + var r = t.createElement("ace_outer"), + i = r.style; + i.position = "absolute", i.left = "-10000px", i.overflow = "hidden", i.width = "200px", i.minWidth = "0px", i.height = "150px", i.display = "block", r.appendChild(n); + var s = e.documentElement; + s.appendChild(r); + var o = n.offsetWidth; + i.overflow = "scroll"; + var u = n.offsetWidth; + return o == u && (u = r.clientWidth), s.removeChild(r), o - u + }, typeof document == "undefined" && (t.importCssString = function () {}), t.computedStyle = function (e, t) + { + return window.getComputedStyle(e, "") || + {} + }, t.HAS_CSS_ANIMATION = !1; + if (typeof document != "undefined") + { + var i = document.createElement("div"); + typeof i.style.animationName != "undefined" && (t.HAS_CSS_ANIMATION = !0) + } +}), define("ace/lib/oop", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + 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 n in t) e[n] = t[n]; + return e + }, t.implement = function (e, n) + { + t.mixin(e, n) + } +}), define("ace/lib/keys", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/oop"], function (e, t, n) +{ + "use strict"; + e("./fixoldbrowsers"); + var r = e("./oop"), + i = function () + { + var e = { + 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: "*" + } + }, + t, n; + for (n in e.FUNCTION_KEYS) t = e.FUNCTION_KEYS[n].toLowerCase(), e[t] = parseInt(n, 10); + for (n in e.PRINTABLE_KEYS) t = e.PRINTABLE_KEYS[n].toLowerCase(), e[t] = parseInt(n, 10); + return r.mixin(e, e.MODIFIER_KEYS), r.mixin(e, e.PRINTABLE_KEYS), r.mixin(e, e.FUNCTION_KEYS), e.enter = e["return"], e.escape = e.esc, e.del = e["delete"], e[173] = "-", + function () + { + var t = ["cmd", "ctrl", "alt", "shift"]; + for (var n = Math.pow(2, t.length); n--;) e.KEY_MODS[n] = t.filter(function (t) + { + return n & e.KEY_MODS[t] + }).join("-") + "-" + }(), e.KEY_MODS[0] = "", e.KEY_MODS[-1] = "input-", e + }(); + r.mixin(t, i), t.keyCodeToString = function (e) + { + var t = i[e]; + return typeof t != "string" && (t = String.fromCharCode(e)), t.toLowerCase() + } +}), define("ace/lib/useragent", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + 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 + }; + if (typeof navigator != "object") return; + var r = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(), + i = navigator.userAgent; + t.isWin = r == "win", t.isMac = r == "mac", t.isLinux = r == "linux", t.isIE = navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0 ? parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]) : parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]), t.isOldIE = t.isIE && t.isIE < 9, t.isGecko = t.isMozilla = i.match(/ Gecko\/\d+/), t.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]", t.isWebKit = parseFloat(i.split("WebKit/")[1]) || undefined, t.isChrome = parseFloat(i.split(" Chrome/")[1]) || undefined, t.isAIR = i.indexOf("AdobeAIR") >= 0, t.isIPad = i.indexOf("iPad") >= 0, t.isChromeOS = i.indexOf(" CrOS ") >= 0, t.isIOS = /iPad|iPhone|iPod/.test(i) && !window.MSStream, t.isIOS && (t.isMac = !0) +}), define("ace/lib/event", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + + function a(e, t, n) + { + var a = u(t); + if (!i.isMac && s) + { + t.getModifierState && (t.getModifierState("OS") || t.getModifierState("Win")) && (a |= 8); + if (s.altGr) + { + if ((3 & a) == 3) return; + s.altGr = 0 + } + if (n === 18 || n === 17) + { + var f = "location" in t ? t.location : t.keyLocation; + if (n === 17 && f === 1) s[n] == 1 && (o = t.timeStamp); + else if (n === 18 && a === 3 && f === 2) + { + var l = t.timeStamp - o; + l < 50 && (s.altGr = !0) + } + } + } + n in r.MODIFIER_KEYS && (n = -1), a & 8 && n >= 91 && n <= 93 && (n = -1); + if (!a && n === 13) + { + var f = "location" in t ? t.location : t.keyLocation; + if (f === 3) + { + e(t, a, -n); + if (t.defaultPrevented) return + } + } + if (i.isChromeOS && a & 8) + { + e(t, a, n); + if (t.defaultPrevented) return; + a &= -9 + } + return !!a || n in r.FUNCTION_KEYS || n in r.PRINTABLE_KEYS ? e(t, a, n) : !1 + } + + function f() + { + s = Object.create(null) + } + var r = e("./keys"), + i = e("./useragent"), + s = null, + o = 0; + t.addListener = function (e, t, n) + { + if (e.addEventListener) return e.addEventListener(t, n, !1); + if (e.attachEvent) + { + var r = function () + { + n.call(e, window.event) + }; + n._wrapper = r, e.attachEvent("on" + t, r) + } + }, t.removeListener = function (e, t, n) + { + if (e.removeEventListener) return e.removeEventListener(t, n, !1); + e.detachEvent && e.detachEvent("on" + t, n._wrapper || n) + }, 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 e.type == "dblclick" ? 0 : e.type == "contextmenu" || i.isMac && e.ctrlKey && !e.altKey && !e.shiftKey ? 2 : e.preventDefault ? e.button : + { + 1: 0, + 2: 2, + 4: 1 + }[e.button] + }, t.capture = function (e, n, r) + { + function i(e) + { + n && n(e), r && r(e), t.removeListener(document, "mousemove", n, !0), t.removeListener(document, "mouseup", i, !0), t.removeListener(document, "dragstart", i, !0) + } + return t.addListener(document, "mousemove", n, !0), t.addListener(document, "mouseup", i, !0), t.addListener(document, "dragstart", i, !0), i + }, t.addTouchMoveListener = function (e, n) + { + var r, i; + t.addListener(e, "touchstart", function (e) + { + var t = e.touches, + n = t[0]; + r = n.clientX, i = n.clientY + }), t.addListener(e, "touchmove", function (e) + { + var t = e.touches; + if (t.length > 1) return; + var s = t[0]; + e.wheelX = r - s.clientX, e.wheelY = i - s.clientY, r = s.clientX, i = s.clientY, n(e) + }) + }, t.addMouseWheelListener = function (e, n) + { + "onmousewheel" in e ? t.addListener(e, "mousewheel", function (e) + { + var t = 8; + e.wheelDeltaX !== undefined ? (e.wheelX = -e.wheelDeltaX / t, e.wheelY = -e.wheelDeltaY / t) : (e.wheelX = 0, e.wheelY = -e.wheelDelta / t), n(e) + }) : "onwheel" in e ? t.addListener(e, "wheel", function (e) + { + var t = .35; + switch (e.deltaMode) + { + case e.DOM_DELTA_PIXEL: + e.wheelX = e.deltaX * t || 0, e.wheelY = e.deltaY * t || 0; + break; + case e.DOM_DELTA_LINE: + case e.DOM_DELTA_PAGE: + e.wheelX = (e.deltaX || 0) * 5, e.wheelY = (e.deltaY || 0) * 5 + } + n(e) + }) : t.addListener(e, "DOMMouseScroll", function (e) + { + e.axis && e.axis == e.HORIZONTAL_AXIS ? (e.wheelX = (e.detail || 0) * 5, e.wheelY = 0) : (e.wheelX = 0, e.wheelY = (e.detail || 0) * 5), n(e) + }) + }, t.addMultiMouseDownListener = function (e, n, r, s) + { + function c(e) + { + t.getButton(e) !== 0 ? o = 0 : e.detail > 1 ? (o++, o > 4 && (o = 1)) : o = 1; + if (i.isIE) + { + var c = Math.abs(e.clientX - u) > 5 || Math.abs(e.clientY - a) > 5; + if (!f || c) o = 1; + f && clearTimeout(f), f = setTimeout(function () + { + f = null + }, n[o - 1] || 600), o == 1 && (u = e.clientX, a = e.clientY) + } + e._clicks = o, r[s]("mousedown", e); + if (o > 4) o = 0; + else if (o > 1) return r[s](l[o], e) + } + + function h(e) + { + o = 2, f && clearTimeout(f), f = setTimeout(function () + { + f = null + }, n[o - 1] || 600), r[s]("mousedown", e), r[s](l[o], e) + } + var o = 0, + u, a, f, l = { + 2: "dblclick", + 3: "tripleclick", + 4: "quadclick" + }; + Array.isArray(e) || (e = [e]), e.forEach(function (e) + { + t.addListener(e, "mousedown", c), i.isOldIE && t.addListener(e, "dblclick", h) + }) + }; + var u = !i.isMac || !i.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) + }; + t.getModifierString = function (e) + { + return r.KEY_MODS[u(e)] + }, t.addCommandKeyListener = function (e, n) + { + var r = t.addListener; + if (i.isOldGecko || i.isOpera && !("KeyboardEvent" in window)) + { + var o = null; + r(e, "keydown", function (e) + { + o = e.keyCode + }), r(e, "keypress", function (e) + { + return a(n, e, o) + }) + } + else + { + var u = null; + r(e, "keydown", function (e) + { + s[e.keyCode] = (s[e.keyCode] || 0) + 1; + var t = a(n, e, e.keyCode); + return u = e.defaultPrevented, t + }), r(e, "keypress", function (e) + { + u && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && (t.stopEvent(e), u = null) + }), r(e, "keyup", function (e) + { + s[e.keyCode] = null + }), s || (f(), r(window, "focus", f)) + } + }; + if (typeof window == "object" && window.postMessage && !i.isOldIE) + { + var l = 1; + t.nextTick = function (e, n) + { + n = n || window; + var r = "zero-timeout-message-" + l; + t.addListener(n, "message", function i(s) + { + s.data == r && (t.stopPropagation(s), t.removeListener(n, "message", i), e()) + }), n.postMessage(r, "*") + } + } + t.$idleBlocked = !1, t.onIdle = function (e, n) + { + return setTimeout(function r() + { + t.$idleBlocked ? setTimeout(r, 100) : e() + }, n) + }, 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 = typeof window == "object" && (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("ace/range", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + var r = function (e, t) + { + return e.row - t.row || e.column - t.column + }, + i = function (e, t, n, r) + { + this.start = { + row: e, + column: t + }, this.end = { + row: n, + column: r + } + }; + (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 this.compare(e, t) == 0 + }, this.compareRange = function (e) + { + var t, n = e.end, + r = e.start; + return t = this.compare(n.row, n.column), t == 1 ? (t = this.compare(r.row, r.column), t == 1 ? 2 : t == 0 ? 1 : 0) : t == -1 ? -2 : (t = this.compare(r.row, r.column), t == -1 ? -1 : t == 1 ? 42 : 0) + }, this.comparePoint = function (e) + { + return this.compare(e.row, e.column) + }, this.containsRange = function (e) + { + return this.comparePoint(e.start) == 0 && this.comparePoint(e.end) == 0 + }, this.intersects = function (e) + { + var t = this.compareRange(e); + return t == -1 || t == 0 || t == 1 + }, 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) + { + typeof e == "object" ? (this.start.column = e.column, this.start.row = e.row) : (this.start.row = e, this.start.column = t) + }, this.setEnd = function (e, t) + { + typeof e == "object" ? (this.end.column = e.column, this.end.row = e.row) : (this.end.row = e, this.end.column = t) + }, this.inside = function (e, t) + { + return this.compare(e, t) == 0 ? this.isEnd(e, t) || this.isStart(e, t) ? !1 : !0 : !1 + }, this.insideStart = function (e, t) + { + return this.compare(e, t) == 0 ? this.isEnd(e, t) ? !1 : !0 : !1 + }, this.insideEnd = function (e, t) + { + return this.compare(e, t) == 0 ? this.isStart(e, t) ? !1 : !0 : !1 + }, this.compare = function (e, t) + { + return !this.isMultiLine() && e === this.start.row ? t < this.start.column ? -1 : t > this.end.column ? 1 : 0 : 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 + }, 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 n = { + row: t + 1, + column: 0 + }; + else if (this.end.row < e) var n = { + 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 i.fromPoints(r || this.start, n || this.end) + }, this.extend = function (e, t) + { + var n = this.compare(e, t); + if (n == 0) return this; + if (n == -1) var r = { + row: e, + column: t + }; + else var s = { + row: e, + column: t + }; + return i.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 i.fromPoints(this.start, this.end) + }, this.collapseRows = function () + { + return this.end.column == 0 ? new i(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0) : new i(this.start.row, 0, this.end.row, 0) + }, this.toScreenRange = function (e) + { + var t = e.documentToScreenPosition(this.start), + n = e.documentToScreenPosition(this.end); + return new i(t.row, t.column, n.row, n.column) + }, this.moveBy = function (e, t) + { + this.start.row += e, this.start.column += t, this.end.row += e, this.end.column += t + } + }).call(i.prototype), i.fromPoints = function (e, t) + { + return new i(e.row, e.column, t.row, t.column) + }, i.comparePoints = r, i.comparePoints = function (e, t) + { + return e.row - t.row || e.column - t.column + }, t.Range = i +}), define("ace/lib/lang", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + t.last = function (e) + { + return e[e.length - 1] + }, t.stringReverse = function (e) + { + return e.split("").reverse().join("") + }, t.stringRepeat = function (e, t) + { + var n = ""; + while (t > 0) + { + t & 1 && (n += e); + if (t >>= 1) e += e + } + return n + }; + var r = /^\s\s*/, + i = /\s\s*$/; + t.stringTrimLeft = function (e) + { + return e.replace(r, "") + }, t.stringTrimRight = function (e) + { + return e.replace(i, "") + }, t.copyObject = function (e) + { + var t = {}; + for (var n in e) t[n] = e[n]; + return t + }, t.copyArray = function (e) + { + var t = []; + for (var n = 0, r = e.length; n < r; n++) e[n] && typeof e[n] == "object" ? t[n] = this.copyObject(e[n]) : t[n] = e[n]; + return t + }, t.deepCopy = function s(e) + { + if (typeof e != "object" || !e) return e; + var t; + if (Array.isArray(e)) + { + t = []; + for (var n = 0; n < e.length; n++) t[n] = s(e[n]); + return t + } + if (Object.prototype.toString.call(e) !== "[object Object]") return e; + t = {}; + for (var n in e) t[n] = s(e[n]); + return t + }, t.arrayToMap = function (e) + { + var t = {}; + for (var n = 0; n < e.length; n++) t[e[n]] = 1; + return t + }, t.createMap = function (e) + { + var t = Object.create(null); + for (var n in e) t[n] = e[n]; + return t + }, t.arrayRemove = function (e, t) + { + for (var n = 0; n <= e.length; n++) t === e[n] && e.splice(n, 1) + }, t.escapeRegExp = function (e) + { + return e.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }, t.escapeHTML = function (e) + { + return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/ h.length ? e = e.substr(9) : e.substr(0, 4) == h.substr(0, 4) ? e = e.substr(4, e.length - h.length + 1) : e.charAt(e.length - 1) == h.charAt(0) && (e = e.slice(0, -1)), e != h.charAt(0) && e.charAt(e.length - 1) == h.charAt(0) && (e = e.slice(0, -1)), e && t.onTextInput(e)), p && (p = !1), L && (L = !1) + }, + O = function (e) + { + if (m) return; + var t = c.value; + A(t), T() + }, + M = function (e, t, n) + { + var r = e.clipboardData || window.clipboardData; + if (!r || f) return; + var i = l || n ? "Text" : "text/plain"; + try + { + return t ? r.setData(i, t) !== !1 : r.getData(i) + } + catch (e) + { + if (!n) return M(e, t, !0) + } + }, + _ = function (e, n) + { + var s = t.getCopyText(); + if (!s) return r.preventDefault(e); + M(e, s) ? (i.isIOS && (d = n, c.value = "\n aa" + s + "a a\n", c.setSelectionRange(4, 4 + s.length), p = { + value: s + }), n ? t.onCut() : t.onCopy(), i.isIOS || r.preventDefault(e)) : (p = !0, c.value = s, c.select(), setTimeout(function () + { + p = !1, T(), x(), n ? t.onCut() : t.onCopy() + })) + }, + D = function (e) + { + _(e, !0) + }, + P = function (e) + { + _(e, !1) + }, + H = function (e) + { + var n = M(e); + typeof n == "string" ? (n && t.onPaste(n, e), i.isIE && setTimeout(x), r.preventDefault(e)) : (c.value = "", v = !0) + }; + r.addCommandKeyListener(c, t.onCommandKey.bind(t)), r.addListener(c, "select", C), r.addListener(c, "input", O), r.addListener(c, "cut", D), r.addListener(c, "copy", P), r.addListener(c, "paste", H); + var B = function (e) + { + if (m || !t.onCompositionStart || t.$readOnly) return; + m = {}, m.canUndo = t.session.$undoManager, t.onCompositionStart(), setTimeout(j, 0), t.on("mousedown", F), m.canUndo && !t.selection.isEmpty() && (t.insert(""), t.session.markUndoGroup(), t.selection.clearSelection()), t.session.markUndoGroup() + }, + j = function () + { + if (!m || !t.onCompositionUpdate || t.$readOnly) return; + var e = c.value.replace(/\x01/g, ""); + if (m.lastValue === e) return; + t.onCompositionUpdate(e), m.lastValue && t.undo(), m.canUndo && (m.lastValue = e); + if (m.lastValue) + { + var n = t.selection.getRange(); + t.insert(m.lastValue), t.session.markUndoGroup(), m.range = t.selection.getRange(), t.selection.setRange(n), t.selection.clearSelection() + } + }, + F = function (e) + { + if (!t.onCompositionEnd || t.$readOnly) return; + var n = m; + m = !1; + var r = setTimeout(function () + { + r = null; + var e = c.value.replace(/\x01/g, ""); + if (m) return; + e == n.lastValue ? T() : !n.lastValue && e && (T(), A(e)) + }); + k = function (i) + { + return r && clearTimeout(r), i = i.replace(/\x01/g, ""), i == n.lastValue ? "" : (n.lastValue && r && t.undo(), i) + }, t.onCompositionEnd(), t.removeListener("mousedown", F), e.type == "compositionend" && n.range && t.selection.setRange(n.range); + var s = !!i.isChrome && i.isChrome >= 53 || !!i.isWebKit && i.isWebKit >= 603; + s && O() + }, + I = o.delayedCall(j, 50); + r.addListener(c, "compositionstart", B), r.addListener(c, "compositionupdate", function () + { + I.schedule() + }), r.addListener(c, "keyup", function () + { + I.schedule() + }), r.addListener(c, "keydown", function () + { + I.schedule() + }), r.addListener(c, "compositionend", F), this.getElement = function () + { + return c + }, this.setReadOnly = function (e) + { + c.readOnly = e + }, this.onContextMenu = function (e) + { + L = !0, x(t.selection.isEmpty()), t._emit("nativecontextmenu", + { + target: t, + domEvent: e + }), this.moveToMouse(e, !0) + }, this.moveToMouse = function (e, n) + { + g || (g = c.style.cssText), c.style.cssText = (n ? "z-index:100000;" : "") + "height:" + c.style.height + ";" + (i.isIE ? "opacity:0.1;" : ""); + var o = t.container.getBoundingClientRect(), + u = s.computedStyle(t.container), + a = o.top + (parseInt(u.borderTopWidth) || 0), + f = o.left + (parseInt(o.borderLeftWidth) || 0), + l = o.bottom - a - c.clientHeight - 2, + h = function (e) + { + c.style.left = e.clientX - f - 2 + "px", c.style.top = Math.min(e.clientY - a - 2, l) + "px" + }; + h(e); + if (e.type != "mousedown") return; + t.renderer.$keepTextAreaAtCursor && (t.renderer.$keepTextAreaAtCursor = null), clearTimeout(q), i.isWin && r.capture(t.container, h, R) + }, this.onContextMenuClose = R; + var q, U = function (e) + { + t.textInput.onContextMenu(e), R() + }; + r.addListener(c, "mouseup", U), r.addListener(c, "mousedown", function (e) + { + e.preventDefault(), R() + }), r.addListener(t.renderer.scroller, "contextmenu", U), r.addListener(c, "contextmenu", U); + if (i.isIOS) + { + var z = null, + W = !1; + e.addEventListener("keydown", function (e) + { + z && clearTimeout(z), W = !0 + }), e.addEventListener("keyup", function (e) + { + z = setTimeout(function () + { + W = !1 + }, 100) + }); + var X = function (e) + { + if (document.activeElement !== c) return; + if (W) return; + if (d) return setTimeout(function () + { + d = !1 + }, 100); + var n = c.selectionStart, + r = c.selectionEnd; + c.setSelectionRange(4, 5); + if (n == r) switch (n) + { + case 0: + t.onCommandKey(null, 0, u.up); + break; + case 1: + t.onCommandKey(null, 0, u.home); + break; + case 2: + t.onCommandKey(null, a.option, u.left); + break; + case 4: + t.onCommandKey(null, 0, u.left); + break; + case 5: + t.onCommandKey(null, 0, u.right); + break; + case 7: + t.onCommandKey(null, a.option, u.right); + break; + case 8: + t.onCommandKey(null, 0, u.end); + break; + case 9: + t.onCommandKey(null, 0, u.down) + } + else + { + switch (r) + { + case 6: + t.onCommandKey(null, a.shift, u.right); + break; + case 7: + t.onCommandKey(null, a.shift | a.option, u.right); + break; + case 8: + t.onCommandKey(null, a.shift, u.end); + break; + case 9: + t.onCommandKey(null, a.shift, u.down) + } + switch (n) + { + case 0: + t.onCommandKey(null, a.shift, u.up); + break; + case 1: + t.onCommandKey(null, a.shift, u.home); + break; + case 2: + t.onCommandKey(null, a.shift | a.option, u.left); + break; + case 3: + t.onCommandKey(null, a.shift, u.left) + } + } + }; + document.addEventListener("selectionchange", X), t.on("destroy", function () + { + document.removeEventListener("selectionchange", X) + }) + } + }; + t.TextInput = c +}), define("ace/keyboard/textinput", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/lib/dom", "ace/lib/lang", "ace/keyboard/textinput_ios"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/event"), + i = e("../lib/useragent"), + s = e("../lib/dom"), + o = e("../lib/lang"), + u = i.isChrome < 18, + a = i.isIE, + f = i.isChrome > 63, + l = e("./textinput_ios").TextInput, + c = function (e, t) + { + function T(e) + { + e = y ? !1 : e; + if (v) return; + v = !0; + if (L) var t = 0, + r = e ? 0 : n.value.length - 1; + else var t = e ? 2 : 1, + r = 2; + try + { + n.setSelectionRange(t, r) + } + catch (i) + {} + v = !1 + } + + function N() + { + if (v) return; + n.value = c, i.isWebKit && x.schedule() + } + + function U() + { + clearTimeout(R), R = setTimeout(function () + { + m && (n.style.cssText = m, m = ""), t.renderer.$keepTextAreaAtCursor == null && (t.renderer.$keepTextAreaAtCursor = !0, t.renderer.$moveTextAreaToCursor()) + }, 0) + } + if (i.isIOS) return l.call(this, e, t); + var n = s.createElement("textarea"); + n.className = "ace_text-input", n.setAttribute("wrap", "off"), n.setAttribute("autocorrect", "off"), n.setAttribute("autocapitalize", "off"), n.setAttribute("spellcheck", !1), n.style.opacity = "0", e.insertBefore(n, e.firstChild); + var c = i.isIE ? "\x01\x01" : "

", + h = i.isIE ? /\x01/g : /\u2028/g, + p = !1, + d = !1, + v = !1, + m = "", + g = !0, + y = !1, + b = !1; + try + { + var w = document.activeElement === n + } + catch (E) + {} + r.addListener(n, "blur", function (e) + { + t.onBlur(e), w = !1 + }), r.addListener(n, "focus", function (e) + { + w = !0, t.onFocus(e), T() + }), this.$focusScroll = !1, this.focus = function () + { + if (m || f || this.$focusScroll == "browser") return n.focus( + { + preventScroll: !0 + }); + var e = n.style.top; + n.style.position = "fixed", n.style.top = "0px"; + var t = n.getBoundingClientRect().top != 0, + r = []; + if (t) + { + var i = n.parentElement; + while (i && i.nodeType == 1) r.push(i), i.setAttribute("ace_nocontext", !0), !i.parentElement && i.getRootNode ? i = i.getRootNode().host : i = i.parentElement + } + n.focus( + { + preventScroll: !0 + }), t && r.forEach(function (e) + { + e.removeAttribute("ace_nocontext") + }), setTimeout(function () + { + n.style.position = "", n.style.top == "0px" && (n.style.top = e) + }, 0) + }, this.blur = function () + { + n.blur() + }, this.isFocused = function () + { + return w + }; + var S = o.delayedCall(function () + { + w && T(g) + }), + x = o.delayedCall(function () + { + v || (n.value = c, w && T()) + }); + i.isWebKit || t.addEventListener("changeSelection", function () + { + t.selection.isEmpty() != g && (g = !g, S.schedule()) + }), N(), w && t.onFocus(); + var C = function (e) + { + return e.selectionStart === 0 && e.selectionEnd === e.value.length + }, + k = function (e) + { + p ? p = !1 : C(n) ? (t.selectAll(), T()) : L && T(t.selection.isEmpty()) + }, + L = null; + this.setInputHandler = function (e) + { + L = e + }, this.getInputHandler = function () + { + return L + }; + var A = !1, + O = function (e) + { + L && (e = L(e), L = null), d ? (T(), e && t.onPaste(e), d = !1) : e == c.charAt(0) ? A ? t.execCommand("del", + { + source: "ace" + }) : t.execCommand("backspace", + { + source: "ace" + }) : (e.substring(0, 2) == c ? e = e.substr(2) : e.charAt(0) == c.charAt(0) ? e = e.substr(1) : e.charAt(e.length - 1) == c.charAt(0) && (e = e.slice(0, -1)), e.charAt(e.length - 1) == c.charAt(0) && (e = e.slice(0, -1)), e && t.onTextInput(e)), A && (A = !1) + }, + M = function (e) + { + if (v) return; + var t = n.value; + O(t), N() + }, + _ = function (e, t, n) + { + var r = e.clipboardData || window.clipboardData; + if (!r || u) return; + var i = a || n ? "Text" : "text/plain"; + try + { + return t ? r.setData(i, t) !== !1 : r.getData(i) + } + catch (e) + { + if (!n) return _(e, t, !0) + } + }, + D = function (e, i) + { + var s = t.getCopyText(); + if (!s) return r.preventDefault(e); + _(e, s) ? (i ? t.onCut() : t.onCopy(), r.preventDefault(e)) : (p = !0, n.value = s, n.select(), setTimeout(function () + { + p = !1, N(), T(), i ? t.onCut() : t.onCopy() + })) + }, + P = function (e) + { + D(e, !0) + }, + H = function (e) + { + D(e, !1) + }, + B = function (e) + { + var s = _(e); + typeof s == "string" ? (s && t.onPaste(s, e), i.isIE && setTimeout(T), r.preventDefault(e)) : (n.value = "", d = !0) + }; + r.addCommandKeyListener(n, t.onCommandKey.bind(t)), r.addListener(n, "select", k), r.addListener(n, "input", M), r.addListener(n, "cut", P), r.addListener(n, "copy", H), r.addListener(n, "paste", B), (!("oncut" in n) || !("oncopy" in n) || !("onpaste" in n)) && r.addListener(e, "keydown", function (e) + { + if (i.isMac && !e.metaKey || !e.ctrlKey) return; + switch (e.keyCode) + { + case 67: + H(e); + break; + case 86: + B(e); + break; + case 88: + P(e) + } + }); + var j = function (e) + { + if (v || !t.onCompositionStart || t.$readOnly) return; + v = {}, v.canUndo = t.session.$undoManager, t.onCompositionStart(), setTimeout(F, 0), t.on("mousedown", I), v.canUndo && !t.selection.isEmpty() && (t.insert(""), t.session.markUndoGroup(), t.selection.clearSelection()), t.session.markUndoGroup() + }, + F = function () + { + if (!v || !t.onCompositionUpdate || t.$readOnly) return; + var e = n.value.replace(h, ""); + if (v.lastValue === e) return; + t.onCompositionUpdate(e), v.lastValue && t.undo(), v.canUndo && (v.lastValue = e); + if (v.lastValue) + { + var r = t.selection.getRange(); + t.insert(v.lastValue), t.session.markUndoGroup(), v.range = t.selection.getRange(), t.selection.setRange(r), t.selection.clearSelection() + } + }, + I = function (e) + { + if (!t.onCompositionEnd || t.$readOnly) return; + var r = v; + v = !1; + var s = setTimeout(function () + { + s = null; + var e = n.value.replace(h, ""); + if (v) return; + e == r.lastValue ? N() : !r.lastValue && e && (N(), O(e)) + }); + L = function (n) + { + return s && clearTimeout(s), n = n.replace(h, ""), n == r.lastValue ? "" : (r.lastValue && s && t.undo(), n) + }, t.onCompositionEnd(), t.removeListener("mousedown", I), e.type == "compositionend" && r.range && t.selection.setRange(r.range); + var o = i.isIE || i.isChrome && i.isChrome >= 53 || i.isWebKit && i.isWebKit >= 603; + o && M() + }, + q = o.delayedCall(F, 50); + r.addListener(n, "compositionstart", j), r.addListener(n, "compositionupdate", function () + { + q.schedule() + }), r.addListener(n, "keyup", function () + { + q.schedule() + }), r.addListener(n, "keydown", function () + { + q.schedule() + }), r.addListener(n, "compositionend", I), this.getElement = function () + { + return n + }, this.setCommandMode = function (e) + { + b = e, n.readOnly = !1 + }, this.setReadOnly = function (e) + { + b || (n.readOnly = e) + }, this.setCopyWithEmptySelection = function (e) + { + y = e + }, this.onContextMenu = function (e) + { + A = !0, T(t.selection.isEmpty()), t._emit("nativecontextmenu", + { + target: t, + domEvent: e + }), this.moveToMouse(e, !0) + }, this.moveToMouse = function (e, o) + { + m || (m = n.style.cssText), n.style.cssText = (o ? "z-index:100000;" : "") + "height:" + n.style.height + ";" + (i.isIE ? "opacity:0.1;" : ""); + var u = t.container.getBoundingClientRect(), + a = s.computedStyle(t.container), + f = u.top + (parseInt(a.borderTopWidth) || 0), + l = u.left + (parseInt(u.borderLeftWidth) || 0), + c = u.bottom - f - n.clientHeight - 2, + h = function (e) + { + n.style.left = e.clientX - l - 2 + "px", n.style.top = Math.min(e.clientY - f - 2, c) + "px" + }; + h(e); + if (e.type != "mousedown") return; + t.renderer.$keepTextAreaAtCursor && (t.renderer.$keepTextAreaAtCursor = null), clearTimeout(R), i.isWin && r.capture(t.container, h, U) + }, this.onContextMenuClose = U; + var R, z = function (e) + { + t.textInput.onContextMenu(e), U() + }; + r.addListener(n, "mouseup", z), r.addListener(n, "mousedown", function (e) + { + e.preventDefault(), U() + }), r.addListener(t.renderer.scroller, "contextmenu", z), r.addListener(n, "contextmenu", z) + }; + t.TextInput = c +}), define("ace/mouse/default_handlers", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + + function a(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)); + var n = ["select", "startSelect", "selectEnd", "selectAllEnd", "selectByWordsEnd", "selectByLinesEnd", "dragWait", "dragWaitEnd", "focusWait"]; + n.forEach(function (t) + { + e[t] = this[t] + }, this), e.selectByLines = this.extendSelectionBy.bind(e, "getLineRange"), e.selectByWords = this.extendSelectionBy.bind(e, "getWordRange") + } + + function f(e, t, n, r) + { + return Math.sqrt(Math.pow(n - e, 2) + Math.pow(r - t, 2)) + } + + function l(e, t) + { + if (e.start.row == e.end.row) var n = 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 n = t.column - 4; + else var n = 2 * t.row - e.start.row - e.end.row; + return n < 0 ? + { + cursor: e.start, + anchor: e.end + } : + { + cursor: e.end, + anchor: e.start + } + } + var r = e("../lib/dom"), + i = e("../lib/event"), + s = e("../lib/useragent"), + o = 0, + u = 250; + (function () + { + this.onMouseDown = function (e) + { + var t = e.inSelection(), + n = e.getDocumentPosition(); + this.mousedownEvent = e; + var r = this.editor, + i = e.getButton(); + if (i !== 0) + { + var o = r.getSelectionRange(), + u = o.isEmpty(); + (u || i == 1) && r.selection.moveToPosition(n), i == 2 && (r.textInput.onContextMenu(e.domEvent), s.isMozilla || e.preventDefault()); + return + } + this.mousedownEvent.time = Date.now(); + if (t && !r.isFocused()) + { + r.focus(); + if (this.$focusTimeout && !this.$clickSelection && !r.inMultiSelectMode) + { + this.setState("focusWait"), this.captureMouse(e); + return + } + } + return this.captureMouse(e), this.startSelect(n, e.domEvent._clicks > 1), e.preventDefault() + }, this.startSelect = function (e, t) + { + e = e || this.editor.renderer.screenToTextCoordinates(this.x, this.y); + var n = this.editor; + this.mousedownEvent.getShiftKey() ? n.selection.selectToPosition(e) : t || n.selection.moveToPosition(e), t || this.select(), n.renderer.scroller.setCapture && n.renderer.scroller.setCapture(), n.setStyle("ace_selecting"), this.setState("select") + }, this.select = function () + { + var e, t = this.editor, + n = t.renderer.screenToTextCoordinates(this.x, this.y); + if (this.$clickSelection) + { + var r = this.$clickSelection.comparePoint(n); + if (r == -1) e = this.$clickSelection.end; + else if (r == 1) e = this.$clickSelection.start; + else + { + var i = l(this.$clickSelection, n); + n = i.cursor, e = i.anchor + } + t.selection.setSelectionAnchor(e.row, e.column) + } + t.selection.selectToPosition(n), t.renderer.scrollCursorIntoView() + }, this.extendSelectionBy = function (e) + { + var t, n = this.editor, + r = n.renderer.screenToTextCoordinates(this.x, this.y), + i = n.selection[e](r.row, r.column); + if (this.$clickSelection) + { + var s = this.$clickSelection.comparePoint(i.start), + o = this.$clickSelection.comparePoint(i.end); + if (s == -1 && o <= 0) + { + t = this.$clickSelection.end; + if (i.end.row != r.row || i.end.column != r.column) r = i.start + } + else if (o == 1 && s >= 0) + { + t = this.$clickSelection.start; + if (i.start.row != r.row || i.start.column != r.column) r = i.end + } + else if (s == -1 && o == 1) r = i.end, t = i.start; + else + { + var u = l(this.$clickSelection, r); + r = u.cursor, t = u.anchor + } + n.selection.setSelectionAnchor(t.row, t.column) + } + n.selection.selectToPosition(r), n.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 = f(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y), + t = Date.now(); + (e > o || t - this.mousedownEvent.time > this.$focusTimeout) && this.startSelect(this.mousedownEvent.getDocumentPosition()) + }, this.onDoubleClick = function (e) + { + var t = e.getDocumentPosition(), + n = this.editor, + r = n.session, + i = r.getBracketRange(t); + i ? (i.isEmpty() && (i.start.column--, i.end.column++), this.setState("select")) : (i = n.selection.getWordRange(t.row, t.column), this.setState("selectByWords")), this.$clickSelection = i, this.select() + }, this.onTripleClick = function (e) + { + var t = e.getDocumentPosition(), + n = this.editor; + this.setState("selectByLines"); + var r = n.getSelectionRange(); + r.isMultiLine() && r.contains(t.row, t.column) ? (this.$clickSelection = n.selection.getLineRange(r.start.row), this.$clickSelection.end = n.selection.getLineRange(r.end.row).end) : this.$clickSelection = n.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()) return; + 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 n = this.$lastScroll, + r = e.domEvent.timeStamp, + i = r - n.t, + s = i ? e.wheelX / i : n.vx, + o = i ? e.wheelY / i : n.vy; + i < u && (s = (s + n.vx) / 2, o = (o + n.vy) / 2); + var a = Math.abs(s / o), + f = !1; + a >= 1 && t.renderer.isScrollableBy(e.wheelX * e.speed, 0) && (f = !0), a <= 1 && t.renderer.isScrollableBy(0, e.wheelY * e.speed) && (f = !0); + if (f) n.allowed = r; + else if (r - n.allowed < u) + { + var l = Math.abs(s) <= 1.1 * Math.abs(n.vx) && Math.abs(o) <= 1.1 * Math.abs(n.vy); + l ? (f = !0, n.allowed = r) : n.allowed = 0 + } + n.t = r, n.vx = s, n.vy = o; + if (f) return t.renderer.scrollBy(e.wheelX * e.speed, e.wheelY * e.speed), e.stop() + }, this.onTouchMove = function (e) + { + this.editor._emit("mousewheel", e) + } + }).call(a.prototype), t.DefaultHandlers = a +}), define("ace/tooltip", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + + function s(e) + { + this.isOpen = !1, this.$element = null, this.$parentNode = e + } + var r = e("./lib/oop"), + i = e("./lib/dom"); + (function () + { + this.$init = function () + { + return this.$element = i.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) + { + i.addCssClass(this.getElement(), e) + }, this.show = function (e, t, n) + { + e != null && this.setText(e), t != null && n != null && this.setPosition(t, n), 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(s.prototype), t.Tooltip = s +}), define("ace/mouse/default_gutter_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event", "ace/tooltip"], function (e, t, n) +{ + "use strict"; + + function u(e) + { + function l() + { + var r = u.getDocumentPosition().row, + s = n.$annotations[r]; + if (!s) return c(); + var o = t.session.getLength(); + if (r == o) + { + var a = t.renderer.pixelToScreenCoordinates(0, u.y).row, + l = u.$pos; + if (a > t.session.documentToScreenRow(l.row, l.column)) return c() + } + if (f == s) return; + f = s.text.join("
"), i.setHtml(f), i.show(), t._signal("showGutterTooltip", i), t.on("mousewheel", c); + if (e.$tooltipFollowsMouse) h(u); + else + { + var p = u.domEvent.target, + d = p.getBoundingClientRect(), + v = i.getElement().style; + v.left = d.right + "px", v.top = d.bottom + "px" + } + } + + function c() + { + o && (o = clearTimeout(o)), f && (i.hide(), f = null, t._signal("hideGutterTooltip", i), t.removeEventListener("mousewheel", c)) + } + + function h(e) + { + i.setPosition(e.x, e.y) + } + var t = e.editor, + n = t.renderer.$gutterLayer, + i = new a(t.container); + e.editor.setDefaultHandler("guttermousedown", function (r) + { + if (!t.isFocused() || r.getButton() != 0) return; + var i = n.getRegion(r); + if (i == "foldWidgets") return; + var s = r.getDocumentPosition().row, + o = t.session.selection; + if (r.getShiftKey()) o.selectTo(s, 0); + else + { + if (r.domEvent.detail == 2) return t.selectAll(), r.preventDefault(); + e.$clickSelection = t.selection.getLineRange(s) + } + return e.setState("selectByLines"), e.captureMouse(r), r.preventDefault() + }); + var o, u, f; + e.editor.setDefaultHandler("guttermousemove", function (t) + { + var n = t.domEvent.target || t.domEvent.srcElement; + if (r.hasCssClass(n, "ace_fold-widget")) return c(); + f && e.$tooltipFollowsMouse && h(t), u = t; + if (o) return; + o = setTimeout(function () + { + o = null, u && !e.isMousePressed ? l() : c() + }, 50) + }), s.addListener(t.renderer.$gutter, "mouseout", function (e) + { + u = null; + if (!f || o) return; + o = setTimeout(function () + { + o = null, c() + }, 50) + }), t.on("changeSession", c) + } + + function a(e) + { + o.call(this, e) + } + var r = e("../lib/dom"), + i = e("../lib/oop"), + s = e("../lib/event"), + o = e("../tooltip").Tooltip; + i.inherits(a, o), + function () + { + this.setPosition = function (e, t) + { + var n = window.innerWidth || document.documentElement.clientWidth, + r = window.innerHeight || document.documentElement.clientHeight, + i = this.getWidth(), + s = this.getHeight(); + e += 15, t += 15, e + i > n && (e -= e + i - n), t + s > r && (t -= 20 + s), o.prototype.setPosition.call(this, e, t) + } + }.call(a.prototype), t.GutterHandler = u +}), define("ace/mouse/mouse_event", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/event"), + i = 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 () + { + r.stopPropagation(this.domEvent), this.propagationStopped = !0 + }, this.preventDefault = function () + { + r.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 (this.$inSelection !== null) return this.$inSelection; + var e = this.editor, + t = e.getSelectionRange(); + if (t.isEmpty()) this.$inSelection = !1; + else + { + var n = this.getDocumentPosition(); + this.$inSelection = t.contains(n.row, n.column) + } + return this.$inSelection + }, this.getButton = function () + { + return r.getButton(this.domEvent) + }, this.getShiftKey = function () + { + return this.domEvent.shiftKey + }, this.getAccelKey = i.isMac ? function () + { + return this.domEvent.metaKey + } : function () + { + return this.domEvent.ctrlKey + } + }).call(s.prototype) +}), define("ace/mouse/dragdrop_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + + function f(e) + { + function T(e, n) + { + var r = Date.now(), + i = !n || e.row != n.row, + s = !n || e.column != n.column; + if (!S || i || s) t.moveCursorToPosition(e), S = r, x = { + x: p, + y: d + }; + else + { + var o = l(x.x, x.y, p, d); + o > a ? S = null : r - S >= u && (t.renderer.scrollCursorIntoView(), S = null) + } + } + + function N(e, n) + { + var r = Date.now(), + i = t.renderer.layerConfig.lineHeight, + s = t.renderer.layerConfig.characterWidth, + u = t.renderer.scroller.getBoundingClientRect(), + a = { + x: + { + left: p - u.left, + right: u.right - p + }, + y: + { + top: d - u.top, + bottom: u.bottom - d + } + }, + f = Math.min(a.x.left, a.x.right), + l = Math.min(a.y.top, a.y.bottom), + c = { + row: e.row, + column: e.column + }; + f / s <= 2 && (c.column += a.x.left < a.x.right ? -3 : 2), l / i <= 1 && (c.row += a.y.top < a.y.bottom ? -1 : 1); + var h = e.row != c.row, + v = e.column != c.column, + m = !n || e.row != n.row; + h || v && !m ? E ? r - E >= o && t.renderer.scrollCursorIntoView(c) : E = r : E = null + } + + function C() + { + var e = g; + g = t.renderer.screenToTextCoordinates(p, d), T(g, e), N(g, e) + } + + function k() + { + m = t.selection.toOrientedRange(), h = t.session.addMarker(m, "ace_selection", t.getSelectionStyle()), t.clearSelection(), t.isFocused() && t.renderer.$cursorLayer.setBlinking(!1), clearInterval(v), C(), v = setInterval(C, 20), y = 0, i.addListener(document, "mousemove", O) + } + + function L() + { + clearInterval(v), t.session.removeMarker(h), h = null, t.selection.fromOrientedRange(m), t.isFocused() && !w && t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()), m = null, g = null, y = 0, E = null, S = null, i.removeListener(document, "mousemove", O) + } + + function O() + { + A == null && (A = setTimeout(function () + { + A != null && h && L() + }, 20)) + } + + function M(e) + { + var t = e.types; + return !t || Array.prototype.some.call(t, function (e) + { + return e == "text/plain" || e == "Text" + }) + } + + function _(e) + { + var t = ["copy", "copymove", "all", "uninitialized"], + n = ["move", "copymove", "linkmove", "all", "uninitialized"], + r = s.isMac ? e.altKey : e.ctrlKey, + i = "uninitialized"; + try + { + i = e.dataTransfer.effectAllowed.toLowerCase() + } + catch (e) + {} + var o = "none"; + return r && t.indexOf(i) >= 0 ? o = "copy" : n.indexOf(i) >= 0 ? o = "move" : t.indexOf(i) >= 0 && (o = "copy"), o + } + var t = e.editor, + n = r.createElement("img"); + n.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", s.isOpera && (n.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;"); + var f = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"]; + f.forEach(function (t) + { + e[t] = this[t] + }, this), t.addEventListener("mousedown", this.onMouseDown.bind(e)); + var c = t.container, + h, p, d, v, m, g, y = 0, + b, w, E, S, x; + this.onDragStart = function (e) + { + if (this.cancelDrag || !c.draggable) + { + var r = this; + return setTimeout(function () + { + r.startSelect(), r.captureMouse(e) + }, 0), e.preventDefault() + } + m = t.getSelectionRange(); + var i = e.dataTransfer; + i.effectAllowed = t.getReadOnly() ? "copy" : "copyMove", s.isOpera && (t.container.appendChild(n), n.scrollTop = 0), i.setDragImage && i.setDragImage(n, 0, 0), s.isOpera && t.container.removeChild(n), i.clearData(), i.setData("Text", t.session.getTextRange()), w = !0, this.setState("drag") + }, this.onDragEnd = function (e) + { + c.draggable = !1, w = !1, this.setState(null); + if (!t.getReadOnly()) + { + var n = e.dataTransfer.dropEffect; + !b && n == "move" && 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; + return p = e.clientX, d = e.clientY, h || k(), y++, e.dataTransfer.dropEffect = b = _(e), i.preventDefault(e) + }, this.onDragOver = function (e) + { + if (t.getReadOnly() || !M(e.dataTransfer)) return; + return p = e.clientX, d = e.clientY, h || (k(), y++), A !== null && (A = null), e.dataTransfer.dropEffect = b = _(e), i.preventDefault(e) + }, this.onDragLeave = function (e) + { + y--; + if (y <= 0 && h) return L(), b = null, i.preventDefault(e) + }, this.onDrop = function (e) + { + if (!g) return; + var n = e.dataTransfer; + if (w) switch (b) + { + case "move": + m.contains(g.row, g.column) ? m = { + start: g, + end: g + } : m = t.moveText(m, g); + break; + case "copy": + m = t.moveText(m, g, !0) + } + else + { + var r = n.getData("Text"); + m = { + start: g, + end: t.session.insert(g, r) + }, t.focus(), b = null + } + return L(), i.preventDefault(e) + }, i.addListener(c, "dragstart", this.onDragStart.bind(e)), i.addListener(c, "dragend", this.onDragEnd.bind(e)), i.addListener(c, "dragenter", this.onDragEnter.bind(e)), i.addListener(c, "dragover", this.onDragOver.bind(e)), i.addListener(c, "dragleave", this.onDragLeave.bind(e)), i.addListener(c, "drop", this.onDrop.bind(e)); + var A = null + } + + function l(e, t, n, r) + { + return Math.sqrt(Math.pow(n - e, 2) + Math.pow(r - t, 2)) + } + var r = e("../lib/dom"), + i = e("../lib/event"), + s = e("../lib/useragent"), + o = 200, + u = 200, + a = 5; + (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 n = s.isWin ? "default" : "move"; + e.renderer.setCursorStyle(n), this.setState("dragReady") + }, this.onMouseDrag = function (e) + { + var t = this.editor.container; + if (s.isIE && this.state == "dragReady") + { + var n = l(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); + n > 3 && t.dragDrop() + } + if (this.state === "dragWait") + { + var n = l(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); + n > 0 && (t.draggable = !1, this.startSelect(this.mousedownEvent.getDocumentPosition())) + } + }, this.onMouseDown = function (e) + { + if (!this.$dragEnabled) return; + this.mousedownEvent = e; + var t = this.editor, + n = e.inSelection(), + r = e.getButton(), + i = e.domEvent.detail || 1; + if (i === 1 && r === 0 && n) + { + if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey())) return; + this.mousedownEvent.time = Date.now(); + var o = e.domEvent.target || e.domEvent.srcElement; + "unselectable" in o && (o.unselectable = "on"); + if (t.getDragDelay()) + { + if (s.isWebKit) + { + this.cancelDrag = !0; + var u = t.container; + u.draggable = !0 + } + this.setState("dragWait") + } + else this.startDrag(); + this.captureMouse(e, this.onMouseDrag.bind(this)), e.defaultPrevented = !0 + } + } + }).call(f.prototype), t.DragdropHandler = f +}), define("ace/lib/net", ["require", "exports", "module", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + var r = e("./dom"); + t.get = function (e, t) + { + var n = new XMLHttpRequest; + n.open("GET", e, !0), n.onreadystatechange = function () + { + n.readyState === 4 && t(n.responseText) + }, n.send(null) + }, t.loadScript = function (e, t) + { + var n = r.getDocumentHead(), + i = document.createElement("script"); + i.src = e, n.appendChild(i), i.onload = i.onreadystatechange = function (e, n) + { + if (n || !i.readyState || i.readyState == "loaded" || i.readyState == "complete") i = i.onload = i.onreadystatechange = null, n || t() + } + }, t.qualifyURL = function (e) + { + var t = document.createElement("a"); + return t.href = e, t.href + } +}), define("ace/lib/event_emitter", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + var r = {}, + i = function () + { + this.propagationStopped = !0 + }, + s = function () + { + this.defaultPrevented = !0 + }; + r._emit = r._dispatchEvent = function (e, t) + { + this._eventRegistry || (this._eventRegistry = {}), this._defaultHandlers || (this._defaultHandlers = {}); + var n = this._eventRegistry[e] || [], + r = this._defaultHandlers[e]; + if (!n.length && !r) return; + if (typeof t != "object" || !t) t = {}; + t.type || (t.type = e), t.stopPropagation || (t.stopPropagation = i), t.preventDefault || (t.preventDefault = s), n = n.slice(); + for (var o = 0; o < n.length; o++) + { + n[o](t, this); + if (t.propagationStopped) break + } + if (r && !t.defaultPrevented) return r(t, this) + }, r._signal = function (e, t) + { + var n = (this._eventRegistry || + {})[e]; + if (!n) return; + n = n.slice(); + for (var r = 0; r < n.length; r++) n[r](t, this) + }, r.once = function (e, t) + { + var n = this; + t && this.addEventListener(e, function r() + { + n.removeEventListener(e, r), t.apply(null, arguments) + }) + }, r.setDefaultHandler = function (e, t) + { + var n = this._defaultHandlers; + n || (n = this._defaultHandlers = { + _disabled_: + {} + }); + if (n[e]) + { + var r = n[e], + i = n._disabled_[e]; + i || (n._disabled_[e] = i = []), i.push(r); + var s = i.indexOf(t); + s != -1 && i.splice(s, 1) + } + n[e] = t + }, r.removeDefaultHandler = function (e, t) + { + var n = this._defaultHandlers; + if (!n) return; + var r = n._disabled_[e]; + if (n[e] == t) + { + var i = n[e]; + r && this.setDefaultHandler(e, r.pop()) + } + else if (r) + { + var s = r.indexOf(t); + s != -1 && r.splice(s, 1) + } + }, r.on = r.addEventListener = function (e, t, n) + { + this._eventRegistry = this._eventRegistry || + {}; + var r = this._eventRegistry[e]; + return r || (r = this._eventRegistry[e] = []), r.indexOf(t) == -1 && r[n ? "unshift" : "push"](t), t + }, r.off = r.removeListener = r.removeEventListener = function (e, t) + { + this._eventRegistry = this._eventRegistry || + {}; + var n = this._eventRegistry[e]; + if (!n) return; + var r = n.indexOf(t); + r !== -1 && n.splice(r, 1) + }, r.removeAllListeners = function (e) + { + this._eventRegistry && (this._eventRegistry[e] = []) + }, t.EventEmitter = r +}), define("ace/lib/app_config", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function (e, t, n) +{ + "no use strict"; + + function o(e) + { + typeof console != "undefined" && console.warn && console.warn.apply(console, arguments) + } + + function u(e, t) + { + var n = new Error(e); + n.data = t, typeof console == "object" && console.error && console.error(n), setTimeout(function () + { + throw n + }) + } + var r = e("./oop"), + i = 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) + { + var n = this.$options; + e = Object.keys(n).filter(function (e) + { + return !n[e].hidden + }) + } + else Array.isArray(e) || (t = e, e = Object.keys(t)); + return e.forEach(function (e) + { + t[e] = this.getOption(e) + }, this), t + }, + setOption: function (e, t) + { + if (this["$" + e] === t) return; + var n = this.$options[e]; + if (!n) return o('misspelled option "' + e + '"'); + if (n.forwardTo) return this[n.forwardTo] && this[n.forwardTo].setOption(e, t); + n.handlesSet || (this["$" + e] = t), n && n.set && n.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 + '"') + } + }, + a = function () + { + this.$defaultOptions = {} + }; + (function () + { + r.implement(this, i), this.defineOptions = function (e, t, n) + { + return e.$options || (this.$defaultOptions[t] = e.$options = {}), Object.keys(n).forEach(function (t) + { + var r = n[t]; + typeof r == "string" && (r = { + forwardTo: r + }), r.name || (r.name = t), e.$options[r.name] = r, "initialValue" in r && (e["$" + r.name] = r.initialValue) + }), r.implement(e, s), this + }, this.resetOptions = function (e) + { + Object.keys(e.$options).forEach(function (t) + { + var n = e.$options[t]; + "value" in n && e.setOption(t, n.value) + }) + }, this.setDefaultValue = function (e, t, n) + { + var r = this.$defaultOptions[e] || (this.$defaultOptions[e] = {}); + r[t] && (r.forwardTo ? this.setDefaultValue(r.forwardTo, t, n) : r[t].value = n) + }, this.setDefaultValues = function (e, t) + { + Object.keys(t).forEach(function (n) + { + this.setDefaultValue(e, n, t[n]) + }, this) + }, this.warn = o, this.reportError = u + }).call(a.prototype), t.AppConfig = a +}), define("ace/config", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/lib/net", "ace/lib/app_config"], function (e, t, n) +{ + "no use strict"; + + function f(r) + { + if (!u || !u.document) return; + a.packaged = r || e.packaged || n.packaged || u.define && define.packaged; + var i = {}, + s = "", + o = document.currentScript || document._currentScript, + f = o && o.ownerDocument || document, + c = f.getElementsByTagName("script"); + for (var h = 0; h < c.length; h++) + { + var p = c[h], + d = p.src || p.getAttribute("src"); + if (!d) continue; + var v = p.attributes; + for (var m = 0, g = v.length; m < g; m++) + { + var y = v[m]; + y.name.indexOf("data-ace-") === 0 && (i[l(y.name.replace(/^data-ace-/, ""))] = y.value) + } + var b = d.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/); + b && (s = b[1]) + } + s && (i.base = i.base || s, i.packaged = !0), i.basePath = i.base, i.workerPath = i.workerPath || i.base, i.modePath = i.modePath || i.base, i.themePath = i.themePath || i.base, delete i.base; + for (var w in i) typeof i[w] != "undefined" && t.set(w, i[w]) + } + + function l(e) + { + return e.replace(/-(.)/g, function (e, t) + { + return t.toUpperCase() + }) + } + var r = e("./lib/lang"), + i = e("./lib/oop"), + s = e("./lib/net"), + o = e("./lib/app_config").AppConfig; + n.exports = t = new o; + var u = function () + { + return this || typeof window != "undefined" && window + }(), + a = { + packaged: !1, + workerPath: null, + modePath: null, + themePath: null, + basePath: "", + suffix: ".js", + $moduleUrls: + {} + }; + t.get = function (e) + { + if (!a.hasOwnProperty(e)) throw new Error("Unknown config key: " + e); + return a[e] + }, t.set = function (e, t) + { + if (!a.hasOwnProperty(e)) throw new Error("Unknown config key: " + e); + a[e] = t + }, t.all = function () + { + return r.copyObject(a) + }, t.moduleUrl = function (e, t) + { + if (a.$moduleUrls[e]) return a.$moduleUrls[e]; + var n = e.split("/"); + t = t || n[n.length - 2] || ""; + var r = t == "snippets" ? "/" : "-", + i = n[n.length - 1]; + if (t == "worker" && r == "-") + { + var s = new RegExp("^" + t + "[\\-_]|[\\-_]" + t + "$", "g"); + i = i.replace(s, "") + }(!i || i == t) && n.length > 1 && (i = n[n.length - 2]); + var o = a[t + "Path"]; + return o == null ? o = a.basePath : r == "/" && (t = r = ""), o && o.slice(-1) != "/" && (o += "/"), o + t + r + i + this.get("suffix") + }, t.setModuleUrl = function (e, t) + { + return a.$moduleUrls[e] = t + }, t.$loading = {}, t.loadModule = function (n, r) + { + var i, o; + Array.isArray(n) && (o = n[0], n = n[1]); + try + { + i = e(n) + } + catch (u) + {} + if (i && !t.$loading[n]) return r && r(i); + t.$loading[n] || (t.$loading[n] = []), t.$loading[n].push(r); + if (t.$loading[n].length > 1) return; + var a = function () + { + e([n], function (e) + { + t._emit("load.module", + { + name: n, + module: e + }); + var r = t.$loading[n]; + t.$loading[n] = null, r.forEach(function (t) + { + t && t(e) + }) + }) + }; + if (!t.get("packaged")) return a(); + s.loadScript(t.moduleUrl(n, o), a) + }, t.init = f +}), define("ace/mouse/mouse_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/mouse/default_handlers", "ace/mouse/default_gutter_handler", "ace/mouse/mouse_event", "ace/mouse/dragdrop_handler", "ace/config"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/event"), + i = e("../lib/useragent"), + s = e("./default_handlers").DefaultHandlers, + o = e("./default_gutter_handler").GutterHandler, + u = e("./mouse_event").MouseEvent, + a = e("./dragdrop_handler").DragdropHandler, + f = e("../config"), + l = function (e) + { + var t = this; + this.editor = e, new s(this), new o(this), new a(this); + var n = function (t) + { + var n = !document.hasFocus || !document.hasFocus() || !e.isFocused() && document.activeElement == (e.textInput && e.textInput.getElement()); + n && window.focus(), e.focus() + }, + u = e.renderer.getMouseEventTarget(); + r.addListener(u, "click", this.onMouseEvent.bind(this, "click")), r.addListener(u, "mousemove", this.onMouseMove.bind(this, "mousemove")), r.addMultiMouseDownListener([u, 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"), r.addMouseWheelListener(e.container, this.onMouseWheel.bind(this, "mousewheel")), r.addTouchMoveListener(e.container, this.onTouchMove.bind(this, "touchmove")); + var f = e.renderer.$gutter; + r.addListener(f, "mousedown", this.onMouseEvent.bind(this, "guttermousedown")), r.addListener(f, "click", this.onMouseEvent.bind(this, "gutterclick")), r.addListener(f, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick")), r.addListener(f, "mousemove", this.onMouseEvent.bind(this, "guttermousemove")), r.addListener(u, "mousedown", n), r.addListener(f, "mousedown", n), i.isIE && e.renderer.scrollBarV && (r.addListener(e.renderer.scrollBarV.element, "mousedown", n), r.addListener(e.renderer.scrollBarH.element, "mousedown", n)), e.on("mousemove", function (n) + { + if (t.state || t.$dragDelay || !t.$dragEnabled) return; + var r = e.renderer.screenToTextCoordinates(n.x, n.y), + i = e.session.selection.getRange(), + s = e.renderer; + !i.isEmpty() && i.insideStart(r.row, r.column) ? s.setCursorStyle("default") : s.setCursorStyle("") + }) + }; + (function () + { + this.onMouseEvent = function (e, t) + { + this.editor._emit(e, new u(t, this.editor)) + }, this.onMouseMove = function (e, t) + { + var n = this.editor._eventRegistry && this.editor._eventRegistry.mousemove; + if (!n || !n.length) return; + this.editor._emit(e, new u(t, this.editor)) + }, this.onMouseWheel = function (e, t) + { + var n = new u(t, this.editor); + n.speed = this.$scrollSpeed * 2, n.wheelX = t.wheelX, n.wheelY = t.wheelY, this.editor._emit(e, n) + }, this.onTouchMove = function (e, t) + { + var n = new u(t, this.editor); + n.speed = 1, n.wheelX = t.wheelX, n.wheelY = t.wheelY, this.editor._emit(e, n) + }, this.setState = function (e) + { + this.state = e + }, this.captureMouse = function (e, t) + { + this.x = e.x, this.y = e.y, this.isMousePressed = !0; + var n = this.editor, + s = this.editor.renderer; + s.$keepTextAreaAtCursor && (s.$keepTextAreaAtCursor = null); + var o = this, + a = function (e) + { + if (!e) return; + if (i.isWebKit && !e.which && o.releaseMouse) return o.releaseMouse(); + o.x = e.clientX, o.y = e.clientY, t && t(e), o.mouseEvent = new u(e, o.editor), o.$mouseMoved = !0 + }, + f = function (e) + { + n.off("beforeEndOperation", c), clearInterval(h), l(), o[o.state + "End"] && o[o.state + "End"](e), o.state = "", s.$keepTextAreaAtCursor == null && (s.$keepTextAreaAtCursor = !0, s.$moveTextAreaToCursor()), o.isMousePressed = !1, o.$onCaptureMouseMove = o.releaseMouse = null, e && o.onMouseEvent("mouseup", e) + }, + l = function () + { + o[o.state] && o[o.state](), o.$mouseMoved = !1 + }; + if (i.isOldIE && e.domEvent.type == "dblclick") return setTimeout(function () + { + f(e) + }); + var c = function (e) + { + n.curOp.command.name && n.curOp.selectionChanged && (o[o.state + "End"] && o[o.state + "End"](), o.state = "", o.releaseMouse()) + }; + n.on("beforeEndOperation", c), o.$onCaptureMouseMove = a, o.releaseMouse = r.capture(this.editor.container, a, f); + var h = setInterval(l, 20) + }, this.releaseMouse = null, this.cancelContextMenu = function () + { + var e = function (t) + { + if (t && t.domEvent && t.domEvent.type != "contextmenu") return; + this.editor.off("nativecontextmenu", e), t && t.domEvent && r.stopEvent(t.domEvent) + }.bind(this); + setTimeout(e, 10), this.editor.on("nativecontextmenu", e) + } + }).call(l.prototype), f.defineOptions(l.prototype, "mouseHandler", + { + scrollSpeed: + { + initialValue: 2 + }, + dragDelay: + { + initialValue: i.isMac ? 150 : 0 + }, + dragEnabled: + { + initialValue: !0 + }, + focusTimeout: + { + initialValue: 0 + }, + tooltipFollowsMouse: + { + initialValue: !0 + } + }), t.MouseHandler = l +}), define("ace/mouse/fold_handler", ["require", "exports", "module", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + + function i(e) + { + e.on("click", function (t) + { + var n = t.getDocumentPosition(), + i = e.session, + s = i.getFoldAt(n.row, n.column, 1); + s && (t.getAccelKey() ? i.removeFold(s) : i.expandFold(s), t.stop()); + var o = t.domEvent && t.domEvent.target; + o && r.hasCssClass(o, "ace_inline_button") && r.hasCssClass(o, "ace_toggle_wrap") && (i.setOption("wrap", !0), e.renderer.scrollCursorIntoView()) + }), e.on("gutterclick", function (t) + { + var n = e.renderer.$gutterLayer.getRegion(t); + if (n == "foldWidgets") + { + var r = t.getDocumentPosition().row, + i = e.session; + i.foldWidgets && i.foldWidgets[r] && e.session.onFoldWidgetClick(r, t), e.isFocused() || e.focus(), t.stop() + } + }), e.on("gutterdblclick", function (t) + { + var n = e.renderer.$gutterLayer.getRegion(t); + if (n == "foldWidgets") + { + var r = t.getDocumentPosition().row, + i = e.session, + s = i.getParentFoldRangeData(r, !0), + o = s.range || s.firstRange; + if (o) + { + r = o.start.row; + var u = i.getFoldAt(r, i.getLine(r).length, 1); + u ? i.removeFold(u) : (i.addFold("...", o), e.renderer.scrollCursorIntoView( + { + row: o.start.row, + column: 0 + })) + } + t.stop() + } + }) + } + var r = e("../lib/dom"); + t.FoldHandler = i +}), define("ace/keyboard/keybinding", ["require", "exports", "module", "ace/lib/keys", "ace/lib/event"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/keys"), + i = 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) return; + while (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) return; + typeof e == "function" && !e.handleKeyboard && (e.handleKeyboard = e); + var n = this.$handlers.indexOf(e); + n != -1 && this.$handlers.splice(n, 1), t == undefined ? this.$handlers.push(e) : this.$handlers.splice(t, 0, e), n == -1 && e.attach && e.attach(this.$editor) + }, this.removeKeyboardHandler = function (e) + { + var t = this.$handlers.indexOf(e); + return t == -1 ? !1 : (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 (n) + { + return n.getStatusText && n.getStatusText(t, e) || "" + }).filter(Boolean).join(" ") + }, this.$callKeyboardHandlers = function (e, t, n, r) + { + var s, o = !1, + u = this.$editor.commands; + for (var a = this.$handlers.length; a--;) + { + s = this.$handlers[a].handleKeyboard(this.$data, e, t, n, r); + if (!s || !s.command) continue; + s.command == "null" ? o = !0 : o = u.exec(s.command, this.$editor, s.args, r), o && r && e != -1 && s.passEvent != 1 && s.command.passEvent != 1 && i.stopEvent(r); + if (o) break + } + return !o && e == -1 && (s = { + command: "insertstring" + }, o = u.exec("insertstring", this.$editor, t)), o && this.$editor._signal && this.$editor._signal("keyboardActivity", s), o + }, this.onCommandKey = function (e, t, n) + { + var i = r.keyCodeToString(n); + this.$callKeyboardHandlers(t, i, n, e) + }, this.onTextInput = function (e) + { + this.$callKeyboardHandlers(-1, e) + } + }).call(s.prototype), t.KeyBinding = s +}), define("ace/lib/bidiutil", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + + function F(e, t, n, r) + { + var i = s ? d : p, + c = null, + h = null, + v = null, + m = 0, + g = null, + y = null, + b = -1, + w = null, + E = null, + T = []; + if (!r) + for (w = 0, r = []; w < n; w++) r[w] = R(e[w]); + o = s, u = !1, a = !1, f = !1, l = !1; + for (E = 0; E < n; E++) + { + c = m, T[E] = h = q(e, r, T, E), m = i[c][h], g = m & 240, m &= 15, t[E] = v = i[m][5]; + if (g > 0) + if (g == 16) + { + for (w = b; w < E; w++) t[w] = 1; + b = -1 + } + else b = -1; + y = i[m][6]; + if (y) b == -1 && (b = E); + else if (b > -1) + { + for (w = b; w < E; w++) t[w] = v; + b = -1 + } + r[E] == S && (t[E] = 0), o |= v + } + if (l) + for (w = 0; w < n; w++) + if (r[w] == x) + { + t[w] = s; + for (var C = w - 1; C >= 0; C--) + { + if (r[C] != N) break; + t[C] = s + } + } + } + + function I(e, t, n) + { + if (o < e) return; + if (e == 1 && s == m && !f) + { + n.reverse(); + return + } + var r = n.length, + i = 0, + u, a, l, c; + while (i < r) + { + if (t[i] >= e) + { + u = i + 1; + while (u < r && t[u] >= e) u++; + for (a = i, l = u - 1; a < l; a++, l--) c = n[a], n[a] = n[l], n[l] = c; + i = u + } + i++ + } + } + + function q(e, t, n, r) + { + var i = t[r], + o, c, h, p; + switch (i) + { + case g: + case y: + u = !1; + case E: + case w: + return i; + case b: + return u ? w : b; + case T: + return u = !0, a = !0, y; + case N: + return E; + case C: + if (r < 1 || r + 1 >= t.length || (o = n[r - 1]) != b && o != w || (c = t[r + 1]) != b && c != w) return E; + return u && (c = w), c == o ? c : E; + case k: + o = r > 0 ? n[r - 1] : S; + if (o == b && r + 1 < t.length && t[r + 1] == b) return b; + return E; + case L: + if (r > 0 && n[r - 1] == b) return b; + if (u) return E; + p = r + 1, h = t.length; + while (p < h && t[p] == L) p++; + if (p < h && t[p] == b) return b; + return E; + case A: + h = t.length, p = r + 1; + while (p < h && t[p] == A) p++; + if (p < h) + { + var d = e[r], + v = d >= 1425 && d <= 2303 || d == 64286; + o = t[p]; + if (v && (o == y || o == T)) return y + } + if (r < 1 || (o = t[r - 1]) == S) return E; + return n[r - 1]; + case S: + return u = !1, f = !0, s; + case x: + return l = !0, E; + case O: + case M: + case D: + case P: + case _: + u = !1; + case H: + return E + } + } + + function R(e) + { + var t = e.charCodeAt(0), + n = t >> 8; + return n == 0 ? t > 191 ? g : B[t] : n == 5 ? /[\u0591-\u05f4]/.test(e) ? y : g : n == 6 ? /[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e) ? A : /[\u0660-\u0669\u066b-\u066c]/.test(e) ? w : t == 1642 ? L : /[\u06f0-\u06f9]/.test(e) ? b : T : n == 32 && t <= 8287 ? j[t & 255] : n == 254 ? t >= 65136 ? T : E : E + } + + function U(e) + { + return e >= "ً" && e <= "ٕ" + } + var r = ["ء", "ف"], + i = ["غ", "ي"], + s = 0, + o = 0, + u = !1, + a = !1, + f = !1, + l = !1, + c = !1, + h = !1, + p = [ + [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] + ], + d = [ + [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] + ], + v = 0, + m = 1, + g = 0, + y = 1, + b = 2, + w = 3, + E = 4, + S = 5, + x = 6, + T = 7, + N = 8, + C = 9, + k = 10, + L = 11, + A = 12, + O = 13, + M = 14, + _ = 15, + D = 16, + P = 17, + H = 18, + B = [H, H, H, H, H, H, H, H, H, x, S, x, N, S, H, H, H, H, H, H, H, H, H, H, H, H, H, H, S, S, S, x, N, E, E, L, L, L, E, E, E, E, E, k, C, k, C, C, b, b, b, b, b, b, b, b, b, b, C, E, E, E, E, E, E, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, E, E, E, E, E, E, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, E, E, E, E, H, H, H, H, H, H, S, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, H, C, E, L, L, L, L, E, E, E, E, g, E, E, H, E, E, L, L, b, b, E, g, E, E, E, b, g, E, E, E, E, E], + j = [N, N, N, N, N, N, N, N, N, N, N, H, H, H, g, y, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, N, S, O, M, _, D, P, C, L, L, L, L, L, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, C, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, N]; + t.L = g, t.R = y, t.EN = b, t.ON_R = 3, t.AN = 4, t.R_H = 5, t.B = 6, t.DOT = "·", t.doBidiReorder = function (e, n, r) + { + if (e.length < 2) return {}; + var i = e.split(""), + o = new Array(i.length), + u = new Array(i.length), + a = []; + s = r ? m : v, F(i, a, i.length, n); + for (var f = 0; f < o.length; o[f] = f, f++); + I(2, a, o), I(1, a, o); + for (var f = 0; f < o.length - 1; f++) n[f] === w ? a[f] = t.AN : a[f] === y && (n[f] > T && n[f] < O || n[f] === E || n[f] === H) ? a[f] = t.ON_R : f > 0 && i[f - 1] === "ل" && /\u0622|\u0623|\u0625|\u0627/.test(i[f]) && (a[f - 1] = a[f] = t.R_H, f++); + i[i.length - 1] === t.DOT && (a[i.length - 1] = t.B); + for (var f = 0; f < o.length; f++) u[f] = a[o[f]]; + return { + logicalFromVisual: o, + bidiLevels: u + } + }, t.hasBidiCharacters = function (e, t) + { + var n = !1; + for (var r = 0; r < e.length; r++) t[r] = R(e.charAt(r)), !n && (t[r] == y || t[r] == T) && (n = !0); + return n + }, t.getVisualFromLogicalIdx = function (e, t) + { + for (var n = 0; n < t.logicalFromVisual.length; n++) + if (t.logicalFromVisual[n] == e) return n; + return 0 + } +}), define("ace/bidihandler", ["require", "exports", "module", "ace/lib/bidiutil", "ace/lib/lang", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/bidiutil"), + i = e("./lib/lang"), + s = e("./lib/useragent"), + o = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, + u = function (e) + { + this.session = e, this.bidiMap = {}, this.currentRow = null, this.bidiUtil = r, this.charWidths = [], this.EOL = "¬", this.showInvisibles = !0, this.isRtlDir = !1, this.line = "", this.wrapIndent = 0, this.isLastRow = !1, this.EOF = "¶", this.seenBidi = !1 + }; + (function () + { + this.isBidiRow = function (e, t, n) + { + return this.seenBidi ? (e !== this.currentRow && (this.currentRow = e, this.updateRowLine(t, n), this.updateBidiMap()), this.bidiMap.bidiLevels) : !1 + }, this.onChange = function (e) + { + this.seenBidi ? this.currentRow = null : e.action == "insert" && o.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 n = this.session.$getRowCacheIndex(t, this.currentRow); + n >= 0 && (e = this.session.$docRowCache[n]) + } + return e + }, this.getSplitIndex = function () + { + var e = 0, + t = this.session.$screenRowCache; + if (t.length) + { + var n, r = this.session.$getRowCacheIndex(t, this.currentRow); + while (this.currentRow - e > 0) + { + n = this.session.$getRowCacheIndex(t, this.currentRow - e - 1); + if (n !== r) break; + r = n, e++ + } + } + return e + }, this.updateRowLine = function (e, t) + { + e === undefined && (e = this.getDocumentRow()), this.wrapIndent = 0, this.isLastRow = e === this.session.getLength() - 1, this.line = this.session.getLine(e); + if (this.session.$useWrapMode) + { + var n = this.session.$wrapData[e]; + n && (t === undefined && (t = this.getSplitIndex()), t > 0 && n.length ? (this.wrapIndent = n.indent, this.line = t < n.length ? this.line.substring(n[t - 1], n[n.length - 1]) : this.line.substring(n[n.length - 1])) : this.line = this.line.substring(0, n[t])) + } + var s = this.session, + o = 0, + u; + this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function (e, t) + { + return e === " " || s.isFullWidth(e.charCodeAt(0)) ? (u = e === " " ? s.getScreenTabSize(t + o) : 2, o += u - 1, i.stringRepeat(r.DOT, u)) : e + }) + }, this.updateBidiMap = function () + { + var e = [], + t = this.isLastRow ? this.EOF : this.EOL, + n = this.line + (this.showInvisibles ? t : r.DOT); + r.hasBidiCharacters(n, e) ? this.bidiMap = r.doBidiReorder(n, e, this.isRtlDir) : this.bidiMap = {} + }, this.markAsDirty = function () + { + this.currentRow = null + }, this.updateCharacterWidths = function (e) + { + if (!this.seenBidi) return; + if (this.characterWidth === e.$characterSize.width) return; + var t = this.characterWidth = e.$characterSize.width, + n = e.$measureCharWidth("ה"); + this.charWidths[r.L] = this.charWidths[r.EN] = this.charWidths[r.ON_R] = t, this.charWidths[r.R] = this.charWidths[r.AN] = n, this.charWidths[r.R_H] = s.isChrome ? n : n * .45, this.charWidths[r.B] = 0, this.currentRow = null + }, this.getShowInvisibles = function () + { + return this.showInvisibles + }, this.setShowInvisibles = function (e) + { + this.showInvisibles = e, this.currentRow = null + }, this.setEolChar = function (e) + { + this.EOL = e + }, this.setTextDir = function (e) + { + this.isRtlDir = e + }, this.getPosLeft = function (e) + { + e -= this.wrapIndent; + var t = r.getVisualFromLogicalIdx(e > 0 ? e - 1 : 0, this.bidiMap), + n = this.bidiMap.bidiLevels, + i = 0; + e === 0 && n[t] % 2 !== 0 && t++; + for (var s = 0; s < t; s++) i += this.charWidths[n[s]]; + return e !== 0 && n[t] % 2 === 0 && (i += this.charWidths[n[t]]), this.wrapIndent && (i += this.wrapIndent * this.charWidths[r.L]), i + }, this.getSelections = function (e, t) + { + var n = this.bidiMap, + i = n.bidiLevels, + s, o = this.wrapIndent * this.charWidths[r.L], + u = [], + a = Math.min(e, t) - this.wrapIndent, + f = Math.max(e, t) - this.wrapIndent, + l = !1, + c = !1, + h = 0; + for (var p, d = 0; d < i.length; d++) p = n.logicalFromVisual[d], s = i[d], l = p >= a && p < f, l && !c ? h = o : !l && c && u.push( + { + left: h, + width: o - h + }), o += this.charWidths[s], c = l; + return l && d === i.length && u.push( + { + left: h, + width: o - h + }), u + }, this.offsetToCol = function (e) + { + var t = 0, + e = Math.max(e, 0), + n = 0, + i = 0, + s = this.bidiMap.bidiLevels, + o = this.charWidths[s[i]]; + this.wrapIndent && (e -= this.wrapIndent * this.charWidths[r.L]); + while (e > n + o / 2) + { + n += o; + if (i === s.length - 1) + { + o = 0; + break + } + o = this.charWidths[s[++i]] + } + return i > 0 && s[i - 1] % 2 !== 0 && s[i] % 2 === 0 ? (e < n && i--, t = this.bidiMap.logicalFromVisual[i]) : i > 0 && s[i - 1] % 2 === 0 && s[i] % 2 !== 0 ? t = 1 + (e > n ? this.bidiMap.logicalFromVisual[i] : this.bidiMap.logicalFromVisual[i - 1]) : this.isRtlDir && i === s.length - 1 && o === 0 && s[i - 1] % 2 === 0 || !this.isRtlDir && i === 0 && s[i] % 2 !== 0 ? t = 1 + this.bidiMap.logicalFromVisual[i] : (i > 0 && s[i - 1] % 2 !== 0 && o !== 0 && i--, t = this.bidiMap.logicalFromVisual[i]), t + this.wrapIndent + } + }).call(u.prototype), t.BidiHandler = u +}), define("ace/selection", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/lang"), + s = e("./lib/event_emitter").EventEmitter, + o = e("./range").Range, + u = 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 () + { + r.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 n = t ? e.end : e.start, + r = t ? e.start : e.end; + this.$setSelection(n.row, n.column, r.row, r.column) + }, this.$setSelection = function (e, t, n, r) + { + var i = this.$isEmpty, + s = this.inMultiSelectMode; + this.$silent = !0, this.$cursorChanged = this.$anchorChanged = !1, this.anchor.setPosition(e, t), this.cursor.setPosition(n, r), this.$isEmpty = !o.comparePoints(this.anchor, this.cursor), this.$silent = !1, this.$cursorChanged && this._emit("changeCursor"), (this.$cursorChanged || this.$anchorChanged || i != 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 (typeof t == "undefined") + { + var n = e || this.lead; + e = n.row, t = n.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 n = typeof e == "number" ? e : this.lead.row, + r, i = this.session.getFoldLine(n); + return i ? (n = i.start.row, r = i.end.row) : r = n, t === !0 ? new o(n, 0, r, this.session.getLine(r).length) : new o(n, 0, r + 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, n) + { + var r = e.column, + i = e.column + t; + return n < 0 && (r = e.column - t, i = e.column), this.session.isTabStop(e) && this.doc.getLine(e.row).slice(r, i).split(" ").length - 1 == t + }, this.moveCursorLeft = function () + { + var e = this.lead.getPosition(), + t; + if (t = this.session.getFoldAt(e.row, e.column, -1)) this.moveCursorTo(t.start.row, t.start.column); + else if (e.column === 0) e.row > 0 && this.moveCursorTo(e.row - 1, this.doc.getLine(e.row - 1).length); + else + { + var n = this.session.getTabSize(); + this.wouldMoveIntoSoftTab(e, n, -1) && !this.session.getNavigateWithinSoftTabs() ? this.moveCursorBy(0, -n) : this.moveCursorBy(0, -1) + } + }, this.moveCursorRight = function () + { + var e = this.lead.getPosition(), + t; + if (t = this.session.getFoldAt(e.row, e.column, 1)) this.moveCursorTo(t.end.row, t.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 n = this.session.getTabSize(), + e = this.lead; + this.wouldMoveIntoSoftTab(e, n, 1) && !this.session.getNavigateWithinSoftTabs() ? this.moveCursorBy(0, n) : this.moveCursorBy(0, 1) + } + }, this.moveCursorLineStart = function () + { + var e = this.lead.row, + t = this.lead.column, + n = this.session.documentToScreenRow(e, t), + r = this.session.screenToDocumentPosition(n, 0), + i = this.session.getDisplayLine(e, null, r.row, r.column), + s = i.match(/^\s*/); + s[0].length != t && !this.session.$useEmacsStyleLineStart && (r.column += s[0].length), this.moveCursorToPosition(r) + }, this.moveCursorLineEnd = function () + { + var e = this.lead, + t = this.session.getDocumentLastRowColumnPosition(e.row, e.column); + if (this.lead.column == t.column) + { + var n = this.session.getLine(t.row); + if (t.column == n.length) + { + var r = n.search(/\s+$/); + r > 0 && (t.column = r) + } + } + 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, + n = this.doc.getLine(e), + r = n.substring(t); + this.session.nonTokenRe.lastIndex = 0, this.session.tokenRe.lastIndex = 0; + var i = this.session.getFoldAt(e, t, 1); + if (i) + { + this.moveCursorTo(i.end.row, i.end.column); + return + } + this.session.nonTokenRe.exec(r) && (t += this.session.nonTokenRe.lastIndex, this.session.nonTokenRe.lastIndex = 0, r = n.substring(t)); + if (t >= n.length) + { + this.moveCursorTo(e, n.length), this.moveCursorRight(), e < this.doc.getLength() - 1 && this.moveCursorWordRight(); + return + } + this.session.tokenRe.exec(r) && (t += this.session.tokenRe.lastIndex, this.session.tokenRe.lastIndex = 0), this.moveCursorTo(e, t) + }, this.moveCursorLongWordLeft = function () + { + var e = this.lead.row, + t = this.lead.column, + n; + if (n = this.session.getFoldAt(e, t, -1)) + { + this.moveCursorTo(n.start.row, n.start.column); + return + } + var r = this.session.getFoldStringAt(e, t, -1); + r == null && (r = this.doc.getLine(e).substring(0, t)); + var s = i.stringReverse(r); + this.session.nonTokenRe.lastIndex = 0, this.session.tokenRe.lastIndex = 0, this.session.nonTokenRe.exec(s) && (t -= this.session.nonTokenRe.lastIndex, s = s.slice(this.session.nonTokenRe.lastIndex), this.session.nonTokenRe.lastIndex = 0); + if (t <= 0) + { + this.moveCursorTo(e, 0), this.moveCursorLeft(), e > 0 && this.moveCursorWordLeft(); + return + } + this.session.tokenRe.exec(s) && (t -= this.session.tokenRe.lastIndex, this.session.tokenRe.lastIndex = 0), this.moveCursorTo(e, t) + }, this.$shortWordEndIndex = function (e) + { + var t = 0, + n, r = /\s/, + i = this.session.tokenRe; + i.lastIndex = 0; + if (this.session.tokenRe.exec(e)) t = this.session.tokenRe.lastIndex; + else + { + while ((n = e[t]) && r.test(n)) t++; + if (t < 1) + { + i.lastIndex = 0; + while ((n = e[t]) && !i.test(n)) + { + i.lastIndex = 0, t++; + if (r.test(n)) + { + if (t > 2) + { + t--; + break + } + while ((n = e[t]) && r.test(n)) t++; + if (t > 2) break + } + } + } + } + return i.lastIndex = 0, t + }, this.moveCursorShortWordRight = function () + { + var e = this.lead.row, + t = this.lead.column, + n = this.doc.getLine(e), + r = n.substring(t), + i = this.session.getFoldAt(e, t, 1); + if (i) return this.moveCursorTo(i.end.row, i.end.column); + if (t == n.length) + { + var s = this.doc.getLength(); + do e++, r = this.doc.getLine(e); while (e < s && /^\s*$/.test(r)); + /^\s+/.test(r) || (r = ""), t = 0 + } + var o = this.$shortWordEndIndex(r); + this.moveCursorTo(e, t + o) + }, this.moveCursorShortWordLeft = function () + { + var e = this.lead.row, + t = this.lead.column, + n; + if (n = this.session.getFoldAt(e, t, -1)) return this.moveCursorTo(n.start.row, n.start.column); + var r = this.session.getLine(e).substring(0, t); + if (t === 0) + { + do e--, r = this.doc.getLine(e); while (e > 0 && /^\s*$/.test(r)); + t = r.length, /\s+$/.test(r) || (r = "") + } + var s = i.stringReverse(r), + o = this.$shortWordEndIndex(s); + return this.moveCursorTo(e, t - 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 n = this.session.documentToScreenPosition(this.lead.row, this.lead.column), + r; + t === 0 && (e !== 0 && (this.session.$bidiHandler.isBidiRow(n.row, this.lead.row) ? (r = this.session.$bidiHandler.getPosLeft(n.column), n.column = Math.round(r / this.session.$bidiHandler.charWidths[0])) : r = n.column * this.session.$bidiHandler.charWidths[0]), this.$desiredColumn ? n.column = this.$desiredColumn : this.$desiredColumn = n.column); + var i = this.session.screenToDocumentPosition(n.row + e, n.column, r); + e !== 0 && t === 0 && i.row === this.lead.row && i.column === this.lead.column && this.session.lineWidgets && this.session.lineWidgets[i.row] && (i.row > 0 || e > 0) && i.row++, this.moveCursorTo(i.row, i.column + t, t === 0) + }, this.moveCursorToPosition = function (e) + { + this.moveCursorTo(e.row, e.column) + }, this.moveCursorTo = function (e, t, n) + { + var r = this.session.getFoldAt(e, t, 1); + r && (e = r.start.row, t = r.start.column), this.$keepDesiredColumnOnChange = !0; + var i = this.session.getLine(e); + /[\uDC00-\uDFFF]/.test(i.charAt(t)) && i.charAt(t - 1) && (this.lead.row == e && this.lead.column == t + 1 ? t -= 1 : t += 1), this.lead.setPosition(e, t), this.$keepDesiredColumnOnChange = !1, n || (this.$desiredColumn = null) + }, this.moveCursorToScreen = function (e, t, n) + { + var r = this.session.screenToDocumentPosition(e, t); + this.moveCursorTo(r.row, r.column, n) + }, 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 n = this.getCursor(); + return o.fromPoints(t, n) + } + catch (r) + { + 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 (e.start == undefined) + { + if (this.rangeList) + { + this.toSingleRange(e[0]); + for (var t = e.length; t--;) + { + var n = o.fromPoints(e[t].start, e[t].end); + e[t].isBackwards && (n.cursor = n.start), this.addRange(n, !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(u.prototype), t.Selection = u +}), define("ace/tokenizer", ["require", "exports", "module", "ace/config"], function (e, t, n) +{ + "use strict"; + var r = e("./config"), + i = 2e3, + s = function (e) + { + this.states = e, this.regExps = {}, this.matchMappings = {}; + for (var t in this.states) + { + var n = this.states[t], + r = [], + i = 0, + s = this.matchMappings[t] = { + defaultToken: "text" + }, + o = "g", + u = []; + for (var a = 0; a < n.length; a++) + { + var f = n[a]; + f.defaultToken && (s.defaultToken = f.defaultToken), f.caseInsensitive && (o = "gi"); + if (f.regex == null) continue; + f.regex instanceof RegExp && (f.regex = f.regex.toString().slice(1, -1)); + var l = f.regex, + c = (new RegExp("(?:(" + l + ")|(.))")).exec("a").length - 2; + Array.isArray(f.token) ? f.token.length == 1 || c == 1 ? f.token = f.token[0] : c - 1 != f.token.length ? (this.reportError("number of classes and regexp groups doesn't match", + { + rule: f, + groupCount: c - 1 + }), f.token = f.token[0]) : (f.tokenArray = f.token, f.token = null, f.onMatch = this.$arrayTokens) : typeof f.token == "function" && !f.onMatch && (c > 1 ? f.onMatch = this.$applyToken : f.onMatch = f.token), c > 1 && (/\\\d/.test(f.regex) ? l = f.regex.replace(/\\([0-9]+)/g, function (e, t) + { + return "\\" + (parseInt(t, 10) + i + 1) + }) : (c = 1, l = this.removeCapturingGroups(f.regex)), !f.splitRegex && typeof f.token != "string" && u.push(f)), s[i] = a, i += c, r.push(l), f.onMatch || (f.onMatch = null) + } + r.length || (s[0] = 0, r.push("$")), u.forEach(function (e) + { + e.splitRegex = this.createSplitterRegexp(e.regex, o) + }, this), this.regExps[t] = new RegExp("(" + r.join(")|(") + ")|($)", o) + } + }; + (function () + { + this.$setMaxTokenCount = function (e) + { + i = e | 0 + }, this.$applyToken = function (e) + { + var t = this.splitRegex.exec(e).slice(1), + n = this.token.apply(this, t); + if (typeof n == "string") return [ + { + type: n, + value: e + }]; + var r = []; + for (var i = 0, s = n.length; i < s; i++) t[i] && (r[r.length] = { + type: n[i], + value: t[i] + }); + return r + }, this.$arrayTokens = function (e) + { + if (!e) return []; + var t = this.splitRegex.exec(e); + if (!t) return "text"; + var n = [], + r = this.tokenArray; + for (var i = 0, s = r.length; i < s; i++) t[i + 1] && (n[n.length] = { + type: r[i], + value: t[i + 1] + }); + return n + }, this.removeCapturingGroups = function (e) + { + var t = e.replace(/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g, function (e, t) + { + return t ? "(?:" : e + }); + return t + }, this.createSplitterRegexp = function (e, t) + { + if (e.indexOf("(?=") != -1) + { + var n = 0, + r = !1, + i = {}; + e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function (e, t, s, o, u, a) + { + return r ? r = u != "]" : u ? r = !0 : o ? (n == i.stack && (i.end = a + 1, i.stack = -1), n--) : s && (n++, s.length != 1 && (i.stack = n, i.start = a)), e + }), i.end != null && /^\)*$/.test(e.substr(i.end)) && (e = e.substring(0, i.start) + e.substr(i.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 && typeof t != "string") + { + var n = t.slice(0); + t = n[0], t === "#tmp" && (n.shift(), t = n.shift()) + } + else var n = []; + var r = t || "start", + s = this.states[r]; + s || (r = "start", s = this.states[r]); + var o = this.matchMappings[r], + u = this.regExps[r]; + u.lastIndex = 0; + var a, f = [], + l = 0, + c = 0, + h = { + type: null, + value: "" + }; + while (a = u.exec(e)) + { + var p = o.defaultToken, + d = null, + v = a[0], + m = u.lastIndex; + if (m - v.length > l) + { + var g = e.substring(l, m - v.length); + h.type == p ? h.value += g : (h.type && f.push(h), h = { + type: p, + value: g + }) + } + for (var y = 0; y < a.length - 2; y++) + { + if (a[y + 1] === undefined) continue; + d = s[o[y]], d.onMatch ? p = d.onMatch(v, r, n, e) : p = d.token, d.next && (typeof d.next == "string" ? r = d.next : r = d.next(r, n), s = this.states[r], s || (this.reportError("state doesn't exist", r), r = "start", s = this.states[r]), o = this.matchMappings[r], l = m, u = this.regExps[r], u.lastIndex = m), d.consumeLineEnd && (l = m); + break + } + if (v) + if (typeof p == "string") !!d && d.merge === !1 || h.type !== p ? (h.type && f.push(h), h = { + type: p, + value: v + }) : h.value += v; + else if (p) + { + h.type && f.push(h), h = { + type: null, + value: "" + }; + for (var y = 0; y < p.length; y++) f.push(p[y]) + } + if (l == e.length) break; + l = m; + if (c++ > i) + { + c > 2 * e.length && this.reportError("infinite loop with in ace tokenizer", + { + startState: t, + line: e + }); + while (l < e.length) h.type && f.push(h), h = { + value: e.substring(l, l += 2e3), + type: "overflow" + }; + r = "start", n = []; + break + } + } + return h.type && f.push(h), n.length > 1 && n[0] !== r && n.unshift("#tmp", r), + { + tokens: f, + state: n.length ? n : r + } + }, this.reportError = r.reportError + }).call(s.prototype), t.Tokenizer = s +}), define("ace/mode/text_highlight_rules", ["require", "exports", "module", "ace/lib/lang"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/lang"), + i = function () + { + this.$rules = { + start: [ + { + token: "empty_line", + regex: "^$" + }, + { + defaultToken: "text" + }] + } + }; + (function () + { + this.addRules = function (e, t) + { + if (!t) + { + for (var n in e) this.$rules[n] = e[n]; + return + } + for (var n in e) + { + var r = e[n]; + for (var i = 0; i < r.length; i++) + { + var s = r[i]; + if (s.next || s.onMatch) typeof s.next == "string" && s.next.indexOf(t) !== 0 && (s.next = t + s.next), s.nextState && s.nextState.indexOf(t) !== 0 && (s.nextState = t + s.nextState) + } + this.$rules[t + n] = r + } + }, this.getRules = function () + { + return this.$rules + }, this.embedRules = function (e, t, n, i, s) + { + var o = typeof e == "function" ? (new e).getRules() : e; + if (i) + for (var u = 0; u < i.length; u++) i[u] = t + i[u]; + else + { + i = []; + for (var a in o) i.push(t + a) + } + this.addRules(o, t); + if (n) + { + var f = Array.prototype[s ? "push" : "unshift"]; + for (var u = 0; u < i.length; u++) f.apply(this.$rules[i[u]], r.deepCopy(n)) + } + this.$embeds || (this.$embeds = []), this.$embeds.push(t) + }, this.getEmbeds = function () + { + return this.$embeds + }; + var e = function (e, t) + { + return (e != "start" || t.length) && t.unshift(this.nextState, e), this.nextState + }, + t = function (e, t) + { + return t.shift(), t.shift() || "start" + }; + this.normalizeRules = function () + { + function i(s) + { + var o = r[s]; + o.processed = !0; + for (var u = 0; u < o.length; u++) + { + var a = o[u], + f = null; + Array.isArray(a) && (f = 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 l = a.next || a.push; + if (l && Array.isArray(l)) + { + var c = a.stateName; + c || (c = a.token, typeof c != "string" && (c = c[0] || ""), r[c] && (c += n++)), r[c] = l, a.next = c, i(c) + } + else l == "pop" && (a.next = t); + a.push && (a.nextState = a.next || a.push, a.next = e, delete a.push); + if (a.rules) + for (var h in a.rules) r[h] ? r[h].push && r[h].push.apply(r[h], a.rules[h]) : r[h] = a.rules[h]; + var p = typeof a == "string" ? a : a.include; + p && (Array.isArray(p) ? f = p.map(function (e) + { + return r[e] + }) : f = r[p]); + if (f) + { + var d = [u, 1].concat(f); + a.noEscape && (d = d.filter(function (e) + { + return !e.next + })), o.splice.apply(o, d), u-- + } + a.keywordMap && (a.token = this.createKeywordMapper(a.keywordMap, a.defaultToken || "text", a.caseInsensitive), delete a.defaultToken) + } + } + var n = 0, + r = this.$rules; + Object.keys(r).forEach(i, this) + }, this.createKeywordMapper = function (e, t, n, r) + { + var i = Object.create(null); + return Object.keys(e).forEach(function (t) + { + var s = e[t]; + n && (s = s.toLowerCase()); + var o = s.split(r || "|"); + for (var u = o.length; u--;) i[o[u]] = t + }), Object.getPrototypeOf(i) && (i.__proto__ = null), this.$keywordList = Object.keys(i), e = null, n ? function (e) + { + return i[e.toLowerCase()] || t + } : function (e) + { + return i[e] || t + } + }, this.getKeywords = function () + { + return this.$keywords + } + }).call(i.prototype), t.TextHighlightRules = i +}), define("ace/mode/behaviour", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + var r = function () + { + this.$behaviours = {} + }; + (function () + { + this.add = function (e, t, n) + { + switch (undefined) + { + case this.$behaviours: + this.$behaviours = {}; + case this.$behaviours[e]: + this.$behaviours[e] = {} + } + this.$behaviours[e][t] = n + }, this.addBehaviours = function (e) + { + for (var t in e) + for (var n in e[t]) this.add(t, n, e[t][n]) + }, this.remove = function (e) + { + this.$behaviours && this.$behaviours[e] && delete this.$behaviours[e] + }, this.inherit = function (e, t) + { + if (typeof e == "function") var n = (new e).getBehaviours(t); + else var n = e.getBehaviours(t); + this.addBehaviours(n) + }, this.getBehaviours = function (e) + { + if (!e) return this.$behaviours; + var t = {}; + for (var n = 0; n < e.length; n++) this.$behaviours[e[n]] && (t[e[n]] = this.$behaviours[e[n]]); + return t + } + }).call(r.prototype), t.Behaviour = r +}), define("ace/token_iterator", ["require", "exports", "module", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("./range").Range, + i = function (e, t, n) + { + this.$session = e, this.$row = t, this.$rowTokens = e.getTokens(t); + var r = e.getTokenAt(t, n); + this.$tokenIndex = r ? r.index : -1 + }; + (function () + { + this.stepBackward = function () + { + this.$tokenIndex -= 1; + while (this.$tokenIndex < 0) + { + this.$row -= 1; + if (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 () + { + this.$tokenIndex += 1; + var e; + while (this.$tokenIndex >= this.$rowTokens.length) + { + this.$row += 1, e || (e = this.$session.getLength()); + if (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, + n = e[t].start; + if (n !== undefined) return n; + n = 0; + while (t > 0) t -= 1, n += e[t].value.length; + return n + }, this.getCurrentTokenPosition = function () + { + return { + row: this.$row, + column: this.getCurrentTokenColumn() + } + }, this.getCurrentTokenRange = function () + { + var e = this.$rowTokens[this.$tokenIndex], + t = this.getCurrentTokenColumn(); + return new r(this.$row, t, this.$row, t + e.value.length) + } + }).call(i.prototype), t.TokenIterator = i +}), define("ace/mode/behaviour/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator", "ace/lib/lang"], function (e, t, n) +{ + "use strict"; + var r = e("../../lib/oop"), + i = e("../behaviour").Behaviour, + s = e("../../token_iterator").TokenIterator, + o = e("../../lib/lang"), + u = ["text", "paren.rparen", "punctuation.operator"], + a = ["text", "paren.rparen", "punctuation.operator", "comment"], + f, l = {}, + c = { + '"': '"', + "'": "'" + }, + h = function (e) + { + var t = -1; + e.multiSelect && (t = e.selection.index, l.rangeCount != e.multiSelect.rangeCount && (l = { + rangeCount: e.multiSelect.rangeCount + })); + if (l[t]) return f = l[t]; + f = l[t] = { + autoInsertedBrackets: 0, + autoInsertedRow: -1, + autoInsertedLineEnd: "", + maybeInsertedBrackets: 0, + maybeInsertedRow: -1, + maybeInsertedLineStart: "", + maybeInsertedLineEnd: "" + } + }, + p = function (e, t, n, r) + { + var i = e.end.row - e.start.row; + return { + text: n + t + r, + selection: [0, e.start.column + 1, i, e.end.column + (i ? 0 : 1)] + } + }, + d = function (e) + { + this.add("braces", "insertion", function (t, n, r, i, s) + { + var u = r.getCursorPosition(), + a = i.doc.getLine(u.row); + if (s == "{") + { + h(r); + var l = r.getSelectionRange(), + c = i.doc.getTextRange(l); + if (c !== "" && c !== "{" && r.getWrapBehavioursEnabled()) return p(l, c, "{", "}"); + if (d.isSaneInsertion(r, i)) return /[\]\}\)]/.test(a[u.column]) || r.inMultiSelectMode || e && e.braces ? (d.recordAutoInsert(r, i, "}"), + { + text: "{}", + selection: [1, 1] + }) : (d.recordMaybeInsert(r, i, "{"), + { + text: "{", + selection: [1, 1] + }) + } + else if (s == "}") + { + h(r); + var v = a.substring(u.column, u.column + 1); + if (v == "}") + { + var m = i.$findOpeningBracket("}", + { + column: u.column + 1, + row: u.row + }); + if (m !== null && d.isAutoInsertedClosing(u, a, s)) return d.popAutoInsertedClosing(), + { + text: "", + selection: [1, 1] + } + } + } + else + { + if (s == "\n" || s == "\r\n") + { + h(r); + var g = ""; + d.isMaybeInsertedClosing(u, a) && (g = o.stringRepeat("}", f.maybeInsertedBrackets), d.clearMaybeInsertedClosing()); + var v = a.substring(u.column, u.column + 1); + if (v === "}") + { + var y = i.findMatchingBracket( + { + row: u.row, + column: u.column + 1 + }, "}"); + if (!y) return null; + var b = this.$getIndent(i.getLine(y.row)) + } + else + { + if (!g) + { + d.clearMaybeInsertedClosing(); + return + } + var b = this.$getIndent(a) + } + var w = b + i.getTabString(); + return { + text: "\n" + w + "\n" + b + g, + selection: [1, w.length, 1, w.length] + } + } + d.clearMaybeInsertedClosing() + } + }), this.add("braces", "deletion", function (e, t, n, r, i) + { + var s = r.doc.getTextRange(i); + if (!i.isMultiLine() && s == "{") + { + h(n); + var o = r.doc.getLine(i.start.row), + u = o.substring(i.end.column, i.end.column + 1); + if (u == "}") return i.end.column++, i; + f.maybeInsertedBrackets-- + } + }), this.add("parens", "insertion", function (e, t, n, r, i) + { + if (i == "(") + { + h(n); + var s = n.getSelectionRange(), + o = r.doc.getTextRange(s); + if (o !== "" && n.getWrapBehavioursEnabled()) return p(s, o, "(", ")"); + if (d.isSaneInsertion(n, r)) return d.recordAutoInsert(n, r, ")"), + { + text: "()", + selection: [1, 1] + } + } + else if (i == ")") + { + h(n); + var u = n.getCursorPosition(), + a = r.doc.getLine(u.row), + f = a.substring(u.column, u.column + 1); + if (f == ")") + { + var l = r.$findOpeningBracket(")", + { + column: u.column + 1, + row: u.row + }); + if (l !== null && d.isAutoInsertedClosing(u, a, i)) return d.popAutoInsertedClosing(), + { + text: "", + selection: [1, 1] + } + } + } + }), this.add("parens", "deletion", function (e, t, n, r, i) + { + var s = r.doc.getTextRange(i); + if (!i.isMultiLine() && s == "(") + { + h(n); + var o = r.doc.getLine(i.start.row), + u = o.substring(i.start.column + 1, i.start.column + 2); + if (u == ")") return i.end.column++, i + } + }), this.add("brackets", "insertion", function (e, t, n, r, i) + { + if (i == "[") + { + h(n); + var s = n.getSelectionRange(), + o = r.doc.getTextRange(s); + if (o !== "" && n.getWrapBehavioursEnabled()) return p(s, o, "[", "]"); + if (d.isSaneInsertion(n, r)) return d.recordAutoInsert(n, r, "]"), + { + text: "[]", + selection: [1, 1] + } + } + else if (i == "]") + { + h(n); + var u = n.getCursorPosition(), + a = r.doc.getLine(u.row), + f = a.substring(u.column, u.column + 1); + if (f == "]") + { + var l = r.$findOpeningBracket("]", + { + column: u.column + 1, + row: u.row + }); + if (l !== null && d.isAutoInsertedClosing(u, a, i)) return d.popAutoInsertedClosing(), + { + text: "", + selection: [1, 1] + } + } + } + }), this.add("brackets", "deletion", function (e, t, n, r, i) + { + var s = r.doc.getTextRange(i); + if (!i.isMultiLine() && s == "[") + { + h(n); + var o = r.doc.getLine(i.start.row), + u = o.substring(i.start.column + 1, i.start.column + 2); + if (u == "]") return i.end.column++, i + } + }), this.add("string_dquotes", "insertion", function (e, t, n, r, i) + { + var s = r.$mode.$quotes || c; + if (i.length == 1 && s[i]) + { + if (this.lineCommentStart && this.lineCommentStart.indexOf(i) != -1) return; + h(n); + var o = i, + u = n.getSelectionRange(), + a = r.doc.getTextRange(u); + if (a !== "" && (a.length != 1 || !s[a]) && n.getWrapBehavioursEnabled()) return p(u, a, o, o); + if (!a) + { + var f = n.getCursorPosition(), + l = r.doc.getLine(f.row), + d = l.substring(f.column - 1, f.column), + v = l.substring(f.column, f.column + 1), + m = r.getTokenAt(f.row, f.column), + g = r.getTokenAt(f.row, f.column + 1); + if (d == "\\" && m && /escape/.test(m.type)) return null; + var y = m && /string|escape/.test(m.type), + b = !g || /string|escape/.test(g.type), + w; + if (v == o) w = y !== b, w && /string\.end/.test(g.type) && (w = !1); + else + { + if (y && !b) return null; + if (y && b) return null; + var E = r.$mode.tokenRe; + E.lastIndex = 0; + var S = E.test(d); + E.lastIndex = 0; + var x = E.test(d); + if (S || x) return null; + if (v && !/[\s;,.})\]\\]/.test(v)) return null; + w = !0 + } + return { + text: w ? o + o : "", + selection: [1, 1] + } + } + } + }), this.add("string_dquotes", "deletion", function (e, t, n, r, i) + { + var s = r.doc.getTextRange(i); + if (!i.isMultiLine() && (s == '"' || s == "'")) + { + h(n); + var o = r.doc.getLine(i.start.row), + u = o.substring(i.start.column + 1, i.start.column + 2); + if (u == s) return i.end.column++, i + } + }) + }; + d.isSaneInsertion = function (e, t) + { + var n = e.getCursorPosition(), + r = new s(t, n.row, n.column); + if (!this.$matchTokenType(r.getCurrentToken() || "text", u)) + { + var i = new s(t, n.row, n.column + 1); + if (!this.$matchTokenType(i.getCurrentToken() || "text", u)) return !1 + } + return r.stepForward(), r.getCurrentTokenRow() !== n.row || this.$matchTokenType(r.getCurrentToken() || "text", a) + }, d.$matchTokenType = function (e, t) + { + return t.indexOf(e.type || e) > -1 + }, d.recordAutoInsert = function (e, t, n) + { + var r = e.getCursorPosition(), + i = t.doc.getLine(r.row); + this.isAutoInsertedClosing(r, i, f.autoInsertedLineEnd[0]) || (f.autoInsertedBrackets = 0), f.autoInsertedRow = r.row, f.autoInsertedLineEnd = n + i.substr(r.column), f.autoInsertedBrackets++ + }, d.recordMaybeInsert = function (e, t, n) + { + var r = e.getCursorPosition(), + i = t.doc.getLine(r.row); + this.isMaybeInsertedClosing(r, i) || (f.maybeInsertedBrackets = 0), f.maybeInsertedRow = r.row, f.maybeInsertedLineStart = i.substr(0, r.column) + n, f.maybeInsertedLineEnd = i.substr(r.column), f.maybeInsertedBrackets++ + }, d.isAutoInsertedClosing = function (e, t, n) + { + return f.autoInsertedBrackets > 0 && e.row === f.autoInsertedRow && n === f.autoInsertedLineEnd[0] && t.substr(e.column) === f.autoInsertedLineEnd + }, d.isMaybeInsertedClosing = function (e, t) + { + return f.maybeInsertedBrackets > 0 && e.row === f.maybeInsertedRow && t.substr(e.column) === f.maybeInsertedLineEnd && t.substr(0, e.column) == f.maybeInsertedLineStart + }, d.popAutoInsertedClosing = function () + { + f.autoInsertedLineEnd = f.autoInsertedLineEnd.substr(1), f.autoInsertedBrackets-- + }, d.clearMaybeInsertedClosing = function () + { + f && (f.maybeInsertedBrackets = 0, f.maybeInsertedRow = -1) + }, r.inherits(d, i), t.CstyleBehaviour = d +}), define("ace/unicode", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + var r = [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], + i = 0, + s = []; + for (var o = 0; o < r.length; o += 2) s.push(i += r[o]), r[o + 1] && s.push(45, i += r[o + 1]); + t.wordChars = String.fromCharCode.apply(null, s) +}), define("ace/mode/text", ["require", "exports", "module", "ace/tokenizer", "ace/mode/text_highlight_rules", "ace/mode/behaviour/cstyle", "ace/unicode", "ace/lib/lang", "ace/token_iterator", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("../tokenizer").Tokenizer, + i = e("./text_highlight_rules").TextHighlightRules, + s = e("./behaviour/cstyle").CstyleBehaviour, + o = e("../unicode"), + u = e("../lib/lang"), + a = e("../token_iterator").TokenIterator, + f = e("../range").Range, + l = function () + { + this.HighlightRules = i + }; + (function () + { + this.$defaultBehaviour = new s, this.tokenRe = new RegExp("^[" + o.wordChars + "\\$_]+", "g"), this.nonTokenRe = new RegExp("^(?:[^" + o.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, n, r) + { + function w(e) + { + for (var t = n; t <= r; t++) e(i.getLine(t), t) + } + var i = t.doc, + s = !0, + o = !0, + a = Infinity, + f = t.getTabSize(), + l = !1; + if (!this.lineCommentStart) + { + if (!this.blockComment) return !1; + var c = this.blockComment.start, + h = this.blockComment.end, + p = new RegExp("^(\\s*)(?:" + u.escapeRegExp(c) + ")"), + d = new RegExp("(?:" + u.escapeRegExp(h) + ")\\s*$"), + v = function (e, t) + { + if (g(e, t)) return; + if (!s || /\S/.test(e)) i.insertInLine( + { + row: t, + column: e.length + }, h), i.insertInLine( + { + row: t, + column: a + }, c) + }, + m = function (e, t) + { + var n; + (n = e.match(d)) && i.removeInLine(t, e.length - n[0].length, e.length), (n = e.match(p)) && i.removeInLine(t, n[1].length, n[0].length) + }, + g = function (e, n) + { + if (p.test(e)) return !0; + var r = t.getTokens(n); + for (var i = 0; i < r.length; i++) + if (r[i].type === "comment") return !0 + } + } + else + { + if (Array.isArray(this.lineCommentStart)) var p = this.lineCommentStart.map(u.escapeRegExp).join("|"), + c = this.lineCommentStart[0]; + else var p = u.escapeRegExp(this.lineCommentStart), + c = this.lineCommentStart; + p = new RegExp("^(\\s*)(?:" + p + ") ?"), l = t.getUseSoftTabs(); + var m = function (e, t) + { + var n = e.match(p); + if (!n) return; + var r = n[1].length, + s = n[0].length; + !b(e, r, s) && n[0][s - 1] == " " && s--, i.removeInLine(t, r, s) + }, + y = c + " ", + v = function (e, t) + { + if (!s || /\S/.test(e)) b(e, a, a) ? i.insertInLine( + { + row: t, + column: a + }, y) : i.insertInLine( + { + row: t, + column: a + }, c) + }, + g = function (e, t) + { + return p.test(e) + }, + b = function (e, t, n) + { + var r = 0; + while (t-- && e.charAt(t) == " ") r++; + if (r % f != 0) return !1; + var r = 0; + while (e.charAt(n++) == " ") r++; + return f > 2 ? r % f != f - 1 : r % f == 0 + } + } + var E = Infinity; + w(function (e, t) + { + var n = e.search(/\S/); + n !== -1 ? (n < a && (a = n), o && !g(e, t) && (o = !1)) : E > e.length && (E = e.length) + }), a == Infinity && (a = E, s = !1, o = !1), l && a % f != 0 && (a = Math.floor(a / f) * f), w(o ? m : v) + }, this.toggleBlockComment = function (e, t, n, r) + { + var i = this.blockComment; + if (!i) return; + !i.start && i[0] && (i = i[0]); + var s = new a(t, r.row, r.column), + o = s.getCurrentToken(), + u = t.selection, + l = t.selection.toOrientedRange(), + c, h; + if (o && /comment/.test(o.type)) + { + var p, d; + while (o && /comment/.test(o.type)) + { + var v = o.value.indexOf(i.start); + if (v != -1) + { + var m = s.getCurrentTokenRow(), + g = s.getCurrentTokenColumn() + v; + p = new f(m, g, m, g + i.start.length); + break + } + o = s.stepBackward() + } + var s = new a(t, r.row, r.column), + o = s.getCurrentToken(); + while (o && /comment/.test(o.type)) + { + var v = o.value.indexOf(i.end); + if (v != -1) + { + var m = s.getCurrentTokenRow(), + g = s.getCurrentTokenColumn() + v; + d = new f(m, g, m, g + i.end.length); + break + } + o = s.stepForward() + } + d && t.remove(d), p && (t.remove(p), c = p.start.row, h = -i.start.length) + } + else h = i.start.length, c = n.start.row, t.insert(n.end, i.end), t.insert(n.start, i.start); + l.start.row == c && (l.start.column += h), l.end.row == c && (l.end.column += h), t.selection.fromOrientedRange(l) + }, this.getNextLineIndent = function (e, t, n) + { + return this.$getIndent(t) + }, this.checkOutdent = function (e, t, n) + { + return !1 + }, this.autoOutdent = function (e, t, n) {}, this.$getIndent = function (e) + { + return e.match(/^\s*/)[0] + }, this.createWorker = function (e) + { + return null + }, this.createModeDelegates = function (e) + { + this.$embeds = [], this.$modes = {}; + for (var t in e) e[t] && (this.$embeds.push(t), this.$modes[t] = new e[t]); + var n = ["toggleBlockComment", "toggleCommentLines", "getNextLineIndent", "checkOutdent", "autoOutdent", "transformAction", "getCompletions"]; + for (var t = 0; t < n.length; t++)(function (e) + { + var r = n[t], + i = e[r]; + e[n[t]] = function () + { + return this.$delegator(r, arguments, i) + } + })(this) + }, this.$delegator = function (e, t, n) + { + var r = t[0]; + typeof r != "string" && (r = r[0]); + for (var i = 0; i < this.$embeds.length; i++) + { + if (!this.$modes[this.$embeds[i]]) continue; + var s = r.split(this.$embeds[i]); + if (!s[0] && s[1]) + { + t[0] = s[1]; + var o = this.$modes[this.$embeds[i]]; + return o[e].apply(o, t) + } + } + var u = n.apply(this, t); + return n ? u : undefined + }, this.transformAction = function (e, t, n, r, i) + { + if (this.$behaviour) + { + var s = this.$behaviour.getBehaviours(); + for (var o in s) + if (s[o][t]) + { + var u = s[o][t].apply(this, arguments); + if (u) return u + } + } + }, this.getKeywords = function (e) + { + if (!this.completionKeywords) + { + var t = this.$tokenizer.rules, + n = []; + for (var r in t) + { + var i = t[r]; + for (var s = 0, o = i.length; s < o; s++) + if (typeof i[s].token == "string") /keyword|support|storage/.test(i[s].token) && n.push(i[s].regex); + else if (typeof i[s].token == "object") + for (var u = 0, a = i[s].token.length; u < a; u++) + if (/keyword|support|storage/.test(i[s].token[u])) + { + var r = i[s].regex.match(/\(.+?\)/g)[u]; + n.push(r.substr(1, r.length - 2)) + } + } + this.completionKeywords = n + } + return e ? n.concat(this.$keywordList || []) : this.$keywordList + }, this.$createKeywordList = function () + { + return this.$highlightRules || this.getTokenizer(), this.$keywordList = this.$highlightRules.$keywordList || [] + }, this.getCompletions = function (e, t, n, r) + { + var i = this.$keywordList || this.$createKeywordList(); + return i.map(function (e) + { + return { + name: e, + value: e, + score: 0, + meta: "keyword" + } + }) + }, this.$id = "ace/mode/text" + }).call(l.prototype), t.Mode = l +}), define("ace/apply_delta", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + + function r(e, t) + { + throw console.log("Invalid Delta:", e), "Invalid Delta: " + t + } + + function i(e, t) + { + return t.row >= 0 && t.row < e.length && t.column >= 0 && t.column <= e[t.row].length + } + + function s(e, t) + { + t.action != "insert" && t.action != "remove" && r(t, "delta.action must be 'insert' or 'remove'"), t.lines instanceof Array || r(t, "delta.lines must be an Array"), (!t.start || !t.end) && r(t, "delta.start/end must be an present"); + var n = t.start; + i(e, t.start) || r(t, "delta.start must be contained in document"); + var s = t.end; + t.action == "remove" && !i(e, s) && r(t, "delta.end must contained in document for 'remove' actions"); + var o = s.row - n.row, + u = s.column - (o == 0 ? n.column : 0); + (o != t.lines.length - 1 || t.lines[o].length != u) && r(t, "delta.range must match delta lines") + } + t.applyDelta = function (e, t, n) + { + var r = t.start.row, + i = t.start.column, + s = e[r] || ""; + switch (t.action) + { + case "insert": + var o = t.lines; + if (o.length === 1) e[r] = s.substring(0, i) + t.lines[0] + s.substring(i); + else + { + var u = [r, 1].concat(t.lines); + e.splice.apply(e, u), e[r] = s.substring(0, i) + e[r], e[r + t.lines.length - 1] += s.substring(i) + } + break; + case "remove": + var a = t.end.column, + f = t.end.row; + r === f ? e[r] = s.substring(0, i) + s.substring(a) : e.splice(r, f - r + 1, s.substring(0, i) + e[f].substring(a)) + } + } +}), define("ace/anchor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/event_emitter").EventEmitter, + s = t.Anchor = function (e, t, n) + { + this.$onChange = this.onChange.bind(this), this.attach(e), typeof n == "undefined" ? this.setPosition(t.row, t.column) : this.setPosition(t, n) + }; + (function () + { + function e(e, t, n) + { + var r = n ? e.column <= t.column : e.column < t.column; + return e.row < t.row || e.row == t.row && r + } + + function t(t, n, r) + { + var i = t.action == "insert", + s = (i ? 1 : -1) * (t.end.row - t.start.row), + o = (i ? 1 : -1) * (t.end.column - t.start.column), + u = t.start, + a = i ? u : t.end; + return e(n, u, r) ? + { + row: n.row, + column: n.column + } : e(a, n, !r) ? + { + row: n.row + s, + column: n.column + (n.row == a.row ? o : 0) + } : + { + row: u.row, + column: u.column + } + } + r.implement(this, i), this.getPosition = function () + { + return this.$clipPositionToDocument(this.row, this.column) + }, this.getDocument = function () + { + return this.document + }, this.$insertRight = !1, this.onChange = function (e) + { + if (e.start.row == e.end.row && e.start.row != this.row) return; + if (e.start.row > this.row) return; + var n = t(e, + { + row: this.row, + column: this.column + }, this.$insertRight); + this.setPosition(n.row, n.column, !0) + }, this.setPosition = function (e, t, n) + { + var r; + n ? r = { + row: e, + column: t + } : r = this.$clipPositionToDocument(e, t); + if (this.row == r.row && this.column == r.column) return; + var i = { + row: this.row, + column: this.column + }; + this.row = r.row, this.column = r.column, this._signal("change", + { + old: i, + value: r + }) + }, 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 n = {}; + return e >= this.document.getLength() ? (n.row = Math.max(0, this.document.getLength() - 1), n.column = this.document.getLine(n.row).length) : e < 0 ? (n.row = 0, n.column = 0) : (n.row = e, n.column = Math.min(this.document.getLine(n.row).length, Math.max(0, t))), t < 0 && (n.column = 0), n + } + }).call(s.prototype) +}), define("ace/document", ["require", "exports", "module", "ace/lib/oop", "ace/apply_delta", "ace/lib/event_emitter", "ace/range", "ace/anchor"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./apply_delta").applyDelta, + s = e("./lib/event_emitter").EventEmitter, + o = e("./range").Range, + u = e("./anchor").Anchor, + a = function (e) + { + this.$lines = [""], e.length === 0 ? this.$lines = [""] : Array.isArray(e) ? this.insertMergedLines( + { + row: 0, + column: 0 + }, e) : this.insert( + { + row: 0, + column: 0 + }, e) + }; + (function () + { + r.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 u(this, e, t) + }, "aaa".split(/a/).length === 0 ? 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) + { + if (this.$newLineMode === e) return; + this.$newLineMode = e, this._signal("changeNewLineMode") + }, this.getNewLineMode = function () + { + return this.$newLineMode + }, this.isNewLine = function (e) + { + return e == "\r\n" || e == "\r" || e == "\n" + }, 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), t[0] = (t[0] || "").substring(e.start.column); + var n = t.length - 1; + e.end.row - e.start.row == n && (t[n] = t[n].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 n = this.clippedPos(e.row, e.column), + r = this.pos(e.row, e.column + t.length); + return this.applyDelta( + { + start: n, + end: r, + action: "insert", + lines: [t] + }, !0), this.clonePos(r) + }, this.clippedPos = function (e, t) + { + var n = this.getLength(); + e === undefined ? e = n : e < 0 ? e = 0 : e >= n && (e = n - 1, t = undefined); + var r = this.getLine(e); + return t == undefined && (t = r.length), t = Math.min(Math.max(t, 0), r.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) + { + e = Math.min(Math.max(e, 0), this.getLength()); + var n = 0; + e < this.getLength() ? (t = t.concat([""]), n = 0) : (t = [""].concat(t), e--, n = this.$lines[e].length), this.insertMergedLines( + { + row: e, + column: n + }, t) + }, this.insertMergedLines = function (e, t) + { + var n = this.clippedPos(e.row, e.column), + r = { + row: n.row + t.length - 1, + column: (t.length == 1 ? n.column : 0) + t[t.length - 1].length + }; + return this.applyDelta( + { + start: n, + end: r, + action: "insert", + lines: t + }), this.clonePos(r) + }, this.remove = function (e) + { + var t = this.clippedPos(e.start.row, e.start.column), + n = this.clippedPos(e.end.row, e.end.column); + return this.applyDelta( + { + start: t, + end: n, + action: "remove", + lines: this.getLinesForRange( + { + start: t, + end: n + }) + }), this.clonePos(t) + }, this.removeInLine = function (e, t, n) + { + var r = this.clippedPos(e, t), + i = this.clippedPos(e, n); + return this.applyDelta( + { + start: r, + end: i, + action: "remove", + lines: this.getLinesForRange( + { + start: r, + end: i + }) + }, !0), this.clonePos(r) + }, this.removeFullLines = function (e, t) + { + e = Math.min(Math.max(0, e), this.getLength() - 1), t = Math.min(Math.max(0, t), this.getLength() - 1); + var n = t == this.getLength() - 1 && e > 0, + r = t < this.getLength() - 1, + i = n ? e - 1 : e, + s = n ? this.getLine(i).length : 0, + u = r ? t + 1 : t, + a = r ? 0 : this.getLine(u).length, + f = new o(i, s, u, a), + l = this.$lines.slice(e, t + 1); + return this.applyDelta( + { + start: f.start, + end: f.end, + action: "remove", + lines: this.getLinesForRange(f) + }), l + }, 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) + { + e instanceof o || (e = o.fromPoints(e.start, e.end)); + if (t.length === 0 && e.isEmpty()) return e.start; + if (t == this.getTextRange(e)) return e.end; + this.remove(e); + var n; + return t ? n = this.insert(e.start, t) : n = e.start, n + }, 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 n = e.action == "insert"; + if (n ? e.lines.length <= 1 && !e.lines[0] : !o.comparePoints(e.start, e.end)) return; + n && e.lines.length > 2e4 ? this.$splitAndapplyLargeDelta(e, 2e4) : (i(this.$lines, e, t), this._signal("change", e)) + }, this.$splitAndapplyLargeDelta = function (e, t) + { + var n = e.lines, + r = n.length - t + 1, + i = e.start.row, + s = e.start.column; + for (var o = 0, u = 0; o < r; o = u) + { + u += t - 1; + var a = n.slice(o, u); + a.push(""), this.applyDelta( + { + start: this.pos(i + o, s), + end: this.pos(i + u, s = 0), + action: e.action, + lines: a + }, !0) + } + e.lines = n.slice(o), e.start.row = i + 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: e.action == "insert" ? "remove" : "insert", + lines: e.lines.slice() + }) + }, this.indexToPosition = function (e, t) + { + var n = this.$lines || this.getAllLines(), + r = this.getNewLineCharacter().length; + for (var i = t || 0, s = n.length; i < s; i++) + { + e -= n[i].length + r; + if (e < 0) return { + row: i, + column: e + n[i].length + r + } + } + return { + row: s - 1, + column: e + n[s - 1].length + r + } + }, this.positionToIndex = function (e, t) + { + var n = this.$lines || this.getAllLines(), + r = this.getNewLineCharacter().length, + i = 0, + s = Math.min(e.row, n.length); + for (var o = t || 0; o < s; ++o) i += n[o].length + r; + return i + e.column + } + }).call(a.prototype), t.Document = a +}), define("ace/background_tokenizer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/event_emitter").EventEmitter, + s = function (e, t) + { + this.running = !1, this.lines = [], this.states = [], this.currentLine = 0, this.tokenizer = e; + var n = this; + this.$worker = function () + { + if (!n.running) return; + var e = new Date, + t = n.currentLine, + r = -1, + i = n.doc, + s = t; + while (n.lines[t]) t++; + var o = i.getLength(), + u = 0; + n.running = !1; + while (t < o) + { + n.$tokenizeRow(t), r = t; + do t++; while (n.lines[t]); + u++; + if (u % 5 === 0 && new Date - e > 20) + { + n.running = setTimeout(n.$worker, 20); + break + } + } + n.currentLine = t, r == -1 && (r = t), s <= r && n.fireUpdateEvent(s, r) + } + }; + (function () + { + r.implement(this, i), 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 n = { + first: e, + last: t + }; + this._signal("update", + { + data: n + }) + }, 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, + n = e.end.row - t; + if (n === 0) this.lines[t] = null; + else if (e.action == "remove") this.lines.splice(t, n + 1, null), this.states.splice(t, n + 1, null); + else + { + var r = Array(n + 1); + r.unshift(t, 1), this.lines.splice.apply(this.lines, r), this.states.splice.apply(this.states, r) + } + 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), + n = this.states[e - 1], + r = this.tokenizer.getLineTokens(t, n, e); + return this.states[e] + "" != r.state + "" ? (this.states[e] = r.state, this.lines[e + 1] = null, this.currentLine > e + 1 && (this.currentLine = e + 1)) : this.currentLine == e && (this.currentLine = e + 1), this.lines[e] = r.tokens + } + }).call(s.prototype), t.BackgroundTokenizer = s +}), define("ace/search_highlight", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/lang"), + i = e("./lib/oop"), + s = e("./range").Range, + o = function (e, t, n) + { + this.setRegexp(e), this.clazz = t, this.type = n || "text" + }; + (function () + { + this.MAX_RANGES = 500, this.setRegexp = function (e) + { + if (this.regExp + "" == e + "") return; + this.regExp = e, this.cache = [] + }, this.update = function (e, t, n, i) + { + if (!this.regExp) return; + var o = i.firstRow, + u = i.lastRow; + for (var a = o; a <= u; a++) + { + var f = this.cache[a]; + f == null && (f = r.getMatchOffsets(n.getLine(a), this.regExp), f.length > this.MAX_RANGES && (f = f.slice(0, this.MAX_RANGES)), f = f.map(function (e) + { + return new s(a, e.offset, a, e.offset + e.length) + }), this.cache[a] = f.length ? f : ""); + for (var l = f.length; l--;) t.drawSingleLineMarker(e, f[l].toScreenRange(n), this.clazz, i) + } + } + }).call(o.prototype), t.SearchHighlight = o +}), define("ace/edit_session/fold_line", ["require", "exports", "module", "ace/range"], function (e, t, n) +{ + "use strict"; + + function i(e, t) + { + this.foldData = e, Array.isArray(t) ? this.folds = t : t = this.folds = [t]; + var n = t[t.length - 1]; + this.range = new r(t[0].start.row, t[0].start.column, n.end.row, n.end.column), this.start = this.range.start, this.end = this.range.end, this.folds.forEach(function (e) + { + e.setFoldLine(this) + }, this) + } + var r = e("../range").Range; + (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, n) + { + var r = 0, + i = this.folds, + s, o, u, a = !0; + t == null && (t = this.end.row, n = this.end.column); + for (var f = 0; f < i.length; f++) + { + s = i[f], o = s.range.compareStart(t, n); + if (o == -1) + { + e(null, t, n, r, a); + return + } + u = e(null, s.start.row, s.start.column, r, a), u = !u && e(s.placeholder, s.start.row, s.start.column, r); + if (u || o === 0) return; + a = !s.sameRow, r = s.end.column + } + e(null, t, n, r, a) + }, this.getNextFoldTo = function (e, t) + { + var n, r; + for (var i = 0; i < this.folds.length; i++) + { + n = this.folds[i], r = n.range.compareEnd(e, t); + if (r == -1) return { + fold: n, + kind: "after" + }; + if (r === 0) return { + fold: n, + kind: "inside" + } + } + return null + }, this.addRemoveChars = function (e, t, n) + { + var r = this.getNextFoldTo(e, t), + i, s; + if (r) + { + i = r.fold; + if (r.kind == "inside" && i.start.column != t && i.start.row != e) window.console && window.console.log(e, t, i); + else if (i.start.row == e) + { + s = this.folds; + var o = s.indexOf(i); + o === 0 && (this.start.column += n); + for (o; o < s.length; o++) + { + i = s[o], i.start.column += n; + if (!i.sameRow) return; + i.end.column += n + } + this.end.column += n + } + } + }, this.split = function (e, t) + { + var n = this.getNextFoldTo(e, t); + if (!n || n.kind == "inside") return null; + var r = n.fold, + s = this.folds, + o = this.foldData, + u = s.indexOf(r), + a = s[u - 1]; + this.end.row = a.end.row, this.end.column = a.end.column, s = s.splice(u, s.length - u); + var f = new i(o, s); + return o.splice(o.indexOf(this) + 1, 0, f), f + }, this.merge = function (e) + { + var t = e.folds; + for (var n = 0; n < t.length; n++) this.addFold(t[n]); + var r = this.foldData; + r.splice(r.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) + { + var t = 0; + for (var n = 0; n < this.folds.length; n++) + { + var r = this.folds[n]; + e -= r.start.column - t; + if (e < 0) return { + row: r.start.row, + column: r.start.column + e + }; + e -= r.placeholder.length; + if (e < 0) return r.start; + t = r.end.column + } + return { + row: this.end.row, + column: this.end.column + e + } + } + }).call(i.prototype), t.FoldLine = i +}), define("ace/range_list", ["require", "exports", "module", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("./range").Range, + i = r.comparePoints, + s = function () + { + this.ranges = [] + }; + (function () + { + this.comparePoints = i, this.pointIndex = function (e, t, n) + { + var r = this.ranges; + for (var s = n || 0; s < r.length; s++) + { + var o = r[s], + u = i(e, o.end); + if (u > 0) continue; + var a = i(e, o.start); + return u === 0 ? t && a !== 0 ? -s - 2 : s : a > 0 || a === 0 && !t ? s : -s - 1 + } + return -s - 1 + }, this.add = function (e) + { + var t = !e.isEmpty(), + n = this.pointIndex(e.start, t); + n < 0 && (n = -n - 1); + var r = this.pointIndex(e.end, t, n); + return r < 0 ? r = -r - 1 : r++, this.ranges.splice(n, r - n, e) + }, this.addList = function (e) + { + var t = []; + for (var n = e.length; n--;) t.push.apply(t, this.add(e[n])); + return t + }, this.substractPoint = function (e) + { + var t = this.pointIndex(e); + if (t >= 0) return this.ranges.splice(t, 1) + }, this.merge = function () + { + var e = [], + t = this.ranges; + t = t.sort(function (e, t) + { + return i(e.start, t.start) + }); + var n = t[0], + r; + for (var s = 1; s < t.length; s++) + { + r = n, n = t[s]; + var o = i(r.end, n.start); + if (o < 0) continue; + if (o == 0 && !r.isEmpty() && !n.isEmpty()) continue; + i(r.end, n.end) < 0 && (r.end.row = n.end.row, r.end.column = n.end.column), t.splice(s, 1), e.push(n), n = r, s-- + } + return this.ranges = t, e + }, 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 n = this.ranges; + if (n[0].start.row > t || n[n.length - 1].start.row < e) return []; + var r = this.pointIndex( + { + row: e, + column: 0 + }); + r < 0 && (r = -r - 1); + var i = this.pointIndex( + { + row: t, + column: 0 + }, r); + i < 0 && (i = -i - 1); + var s = []; + for (var o = r; o < i; o++) s.push(n[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 () + { + if (!this.session) return; + this.session.removeListener("change", this.onChange), this.session = null + }, this.$onChange = function (e) + { + var t = e.start, + n = e.end, + r = t.row, + i = n.row, + s = this.ranges; + for (var o = 0, u = s.length; o < u; o++) + { + var a = s[o]; + if (a.end.row >= r) break + } + if (e.action == "insert") + { + var f = i - r, + l = -t.column + n.column; + for (; o < u; o++) + { + var a = s[o]; + if (a.start.row > r) break; + a.start.row == r && a.start.column >= t.column && (a.start.column != t.column || !this.$insertRight) && (a.start.column += l, a.start.row += f); + if (a.end.row == r && a.end.column >= t.column) + { + if (a.end.column == t.column && this.$insertRight) continue; + a.end.column == t.column && l > 0 && o < u - 1 && a.end.column > a.start.column && a.end.column == s[o + 1].start.column && (a.end.column -= l), a.end.column += l, a.end.row += f + } + } + } + else + { + var f = r - i, + l = t.column - n.column; + for (; o < u; o++) + { + var a = s[o]; + if (a.start.row > i) break; + a.end.row < i && (a.end.row = r, a.end.column = t.column); + if (a.start.row < i || a.start.row == i && a.start.column <= n.colum) a.start.row = r, a.start.column = t.column; + if (a.end.row == i) + if (a.end.column <= n.column) + { + if (f || a.end.column > t.column) a.end.column = t.column, a.end.row = t.row + } + else a.end.column += l, a.end.row += f; + if (a.start.row == i) + if (a.start.column <= n.column) + { + if (f || a.start.column > t.column) a.start.column = t.column, a.start.row = t.row + } + else a.start.column += l, a.start.row += f + } + } + if (f != 0 && o < u) + for (; o < u; o++) + { + var a = s[o]; + a.start.row += f, a.end.row += f + } + } + }).call(s.prototype), t.RangeList = s +}), define("ace/edit_session/fold", ["require", "exports", "module", "ace/range", "ace/range_list", "ace/lib/oop"], function (e, t, n) +{ + "use strict"; + + function u(e, t) + { + e.row -= t.row, e.row == 0 && (e.column -= t.column) + } + + function a(e, t) + { + u(e.start, t), u(e.end, t) + } + + function f(e, t) + { + e.row == 0 && (e.column += t.column), e.row += t.row + } + + function l(e, t) + { + f(e.start, t), f(e.end, t) + } + var r = e("../range").Range, + i = e("../range_list").RangeList, + s = e("../lib/oop"), + o = 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 = [] + }; + s.inherits(o, i), + 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 o(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)) return; + if (!this.range.containsRange(e)) throw new Error("A fold can't intersect already existing fold" + e.range + this.range); + a(e, this.start); + var t = e.start.row, + n = e.start.column; + for (var r = 0, i = -1; r < this.subFolds.length; r++) + { + i = this.subFolds[r].range.compare(t, n); + if (i != 1) break + } + var s = this.subFolds[r]; + if (i == 0) return s.addSubFold(e); + var t = e.range.end.row, + n = e.range.end.column; + for (var o = r, i = -1; o < this.subFolds.length; o++) + { + i = this.subFolds[o].range.compare(t, n); + if (i != 1) break + } + var u = this.subFolds[o]; + if (i == 0) throw new Error("A fold can't intersect already existing fold" + e.range + this.range); + var f = this.subFolds.splice(r, o - r, e); + return e.setFoldLine(this.foldLine), e + }, this.restoreRange = function (e) + { + return l(e, this.start) + } + }.call(o.prototype) +}), define("ace/edit_session/folding", ["require", "exports", "module", "ace/range", "ace/edit_session/fold_line", "ace/edit_session/fold", "ace/token_iterator"], function (e, t, n) +{ + "use strict"; + + function u() + { + this.getFoldAt = function (e, t, n) + { + var r = this.getFoldLine(e); + if (!r) return null; + var i = r.folds; + for (var s = 0; s < i.length; s++) + { + var o = i[s]; + if (o.range.contains(e, t)) + { + if (n == 1 && o.range.isEnd(e, t)) continue; + if (n == -1 && o.range.isStart(e, t)) continue; + return o + } + } + }, this.getFoldsInRange = function (e) + { + var t = e.start, + n = e.end, + r = this.$foldData, + i = []; + t.column += 1, n.column -= 1; + for (var s = 0; s < r.length; s++) + { + var o = r[s].range.compareRange(e); + if (o == 2) continue; + if (o == -2) break; + var u = r[s].folds; + for (var a = 0; a < u.length; a++) + { + var f = u[a]; + o = f.range.compareRange(e); + if (o == -2) break; + if (o == 2) continue; + if (o == 42) break; + i.push(f) + } + } + return t.column -= 1, n.column += 1, i + }, 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 () + { + var e = [], + t = this.$foldData; + for (var n = 0; n < t.length; n++) + for (var r = 0; r < t[n].folds.length; r++) e.push(t[n].folds[r]); + return e + }, this.getFoldStringAt = function (e, t, n, r) + { + r = r || this.getFoldLine(e); + if (!r) return null; + var i = { + end: + { + column: 0 + } + }, + s, o; + for (var u = 0; u < r.folds.length; u++) + { + o = r.folds[u]; + var a = o.range.compareEnd(e, t); + if (a == -1) + { + s = this.getLine(o.start.row).substring(i.end.column, o.start.column); + break + } + if (a === 0) return null; + i = o + } + return s || (s = this.getLine(o.start.row).substring(i.end.column)), n == -1 ? s.substring(0, t - i.end.column) : n == 1 ? s.substring(t - i.end.column) : s + }, this.getFoldLine = function (e, t) + { + var n = this.$foldData, + r = 0; + t && (r = n.indexOf(t)), r == -1 && (r = 0); + for (r; r < n.length; r++) + { + var i = n[r]; + if (i.start.row <= e && i.end.row >= e) return i; + if (i.end.row > e) return null + } + return null + }, this.getNextFoldLine = function (e, t) + { + var n = this.$foldData, + r = 0; + t && (r = n.indexOf(t)), r == -1 && (r = 0); + for (r; r < n.length; r++) + { + var i = n[r]; + if (i.end.row >= e) return i + } + return null + }, this.getFoldedRowCount = function (e, t) + { + var n = this.$foldData, + r = t - e + 1; + for (var i = 0; i < n.length; i++) + { + var s = n[i], + o = s.end.row, + u = s.start.row; + if (o >= t) + { + u < t && (u >= e ? r -= t - u : r = 0); + break + } + o >= e && (u >= e ? r -= o - u : r -= o - e + 1) + } + return r + }, 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 n = this.$foldData, + r = !1, + o; + e instanceof s ? o = e : (o = new s(t, e), o.collapseChildren = t.collapseChildren), this.$clipRangeToDocument(o.range); + var u = o.start.row, + a = o.start.column, + f = o.end.row, + l = o.end.column; + if (u < f || u == f && a <= l - 2) + { + var c = this.getFoldAt(u, a, 1), + h = this.getFoldAt(f, l, -1); + if (c && h == c) return c.addSubFold(o); + c && !c.range.isStart(u, a) && this.removeFold(c), h && !h.range.isEnd(f, l) && this.removeFold(h); + var p = this.getFoldsInRange(o.range); + p.length > 0 && (this.removeFolds(p), p.forEach(function (e) + { + o.addSubFold(e) + })); + for (var d = 0; d < n.length; d++) + { + var v = n[d]; + if (f == v.start.row) + { + v.addFold(o), r = !0; + break + } + if (u == v.end.row) + { + v.addFold(o), r = !0; + if (!o.sameRow) + { + var m = n[d + 1]; + if (m && m.start.row == f) + { + v.merge(m); + break + } + } + break + } + if (f <= v.start.row) break + } + return r || (v = this.$addFoldLine(new i(this.$foldData, o))), this.$useWrapMode ? this.$updateWrapData(v.start.row, v.start.row) : this.$updateRowLengthCache(v.start.row, v.start.row), this.$modified = !0, this._signal("changeFold", + { + data: o, + action: "add" + }), o + } + throw new Error("The range has to be at least 2 characters width") + }, this.addFolds = function (e) + { + e.forEach(function (e) + { + this.addFold(e) + }, this) + }, this.removeFold = function (e) + { + var t = e.foldLine, + n = t.start.row, + r = t.end.row, + i = this.$foldData, + s = t.folds; + if (s.length == 1) i.splice(i.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, s.shift(), o.start.row = s[0].start.row, o.start.column = s[0].start.column + } + this.$updating || (this.$useWrapMode ? this.$updateWrapData(n, r) : this.$updateRowLengthCache(n, r)), this.$modified = !0, this._signal("changeFold", + { + data: e, + action: "remove" + }) + }, this.removeFolds = function (e) + { + var t = []; + for (var n = 0; n < e.length; n++) t.push(e[n]); + 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 n, i; + e == null ? (n = new r(0, 0, this.getLength(), 0), t = !0) : typeof e == "number" ? n = new r(e, 0, e, this.getLine(e).length) : "row" in e ? n = r.fromPoints(e, e) : n = e, i = this.getFoldsInRangeList(n); + if (t) this.removeFolds(i); + else + { + var s = i; + while (s.length) this.expandFolds(s), s = this.getFoldsInRangeList(n) + } + if (i.length) return i + }, this.isRowFolded = function (e, t) + { + return !!this.getFoldLine(e, t) + }, this.getRowFoldEnd = function (e, t) + { + var n = this.getFoldLine(e, t); + return n ? n.end.row : e + }, this.getRowFoldStart = function (e, t) + { + var n = this.getFoldLine(e, t); + return n ? n.start.row : e + }, this.getFoldDisplayLine = function (e, t, n, r, i) + { + r == null && (r = e.start.row), i == null && (i = 0), t == null && (t = e.end.row), n == null && (n = this.getLine(t).length); + var s = this.doc, + o = ""; + return e.walk(function (e, t, n, u) + { + if (t < r) return; + if (t == r) + { + if (n < i) return; + u = Math.max(i, u) + } + e != null ? o += e : o += s.getLine(t).substring(u, n) + }, t, n), o + }, this.getDisplayLine = function (e, t, n, r) + { + var i = this.getFoldLine(e); + if (!i) + { + var s; + return s = this.doc.getLine(e), s.substring(r || 0, t || s.length) + } + return this.getFoldDisplayLine(i, e, t, n, r) + }, this.$cloneFoldData = function () + { + var e = []; + return e = this.$foldData.map(function (t) + { + var n = t.folds.map(function (e) + { + return e.clone() + }); + return new i(e, n) + }), e + }, this.toggleFold = function (e) + { + var t = this.selection, + n = t.getRange(), + r, i; + if (n.isEmpty()) + { + var s = n.start; + r = this.getFoldAt(s.row, s.column); + if (r) + { + this.expandFold(r); + return + }(i = this.findMatchingBracket(s)) ? n.comparePoint(i) == 1 ? n.end = i : (n.start = i, n.start.column++, n.end.column--): (i = this.findMatchingBracket( + { + row: s.row, + column: s.column + 1 + })) ? (n.comparePoint(i) == 1 ? n.end = i : n.start = i, n.start.column++) : n = this.getCommentFoldRange(s.row, s.column) || n + } + else + { + var o = this.getFoldsInRange(n); + if (e && o.length) + { + this.expandFolds(o); + return + } + o.length == 1 && (r = o[0]) + } + r || (r = this.getFoldAt(n.start.row, n.start.column)); + if (r && r.range.toString() == n.toString()) + { + this.expandFold(r); + return + } + var u = "..."; + if (!n.isMultiLine()) + { + u = this.getTextRange(n); + if (u.length < 4) return; + u = u.trim().substring(0, 2) + ".." + } + this.addFold(u, n) + }, this.getCommentFoldRange = function (e, t, n) + { + var i = new o(this, e, t), + s = i.getCurrentToken(), + u = s.type; + if (s && /^comment|string/.test(u)) + { + u = u.match(/comment|string/)[0], u == "comment" && (u += "|doc-start"); + var a = new RegExp(u), + f = new r; + if (n != 1) + { + do s = i.stepBackward(); while (s && a.test(s.type)); + i.stepForward() + } + f.start.row = i.getCurrentTokenRow(), f.start.column = i.getCurrentTokenColumn() + 2, i = new o(this, e, t); + if (n != -1) + { + var l = -1; + do { + s = i.stepForward(); + if (l == -1) + { + var c = this.getState(i.$row); + a.test(c) || (l = i.$row) + } + else if (i.$row > l) break + } while (s && a.test(s.type)); + s = i.stepBackward() + } + else s = i.getCurrentToken(); + return f.end.row = i.getCurrentTokenRow(), f.end.column = i.getCurrentTokenColumn() + s.value.length - 2, f + } + }, this.foldAll = function (e, t, n) + { + n == undefined && (n = 1e5); + var r = this.foldWidgets; + if (!r) return; + t = t || this.getLength(), e = e || 0; + for (var i = e; i < t; i++) + { + r[i] == null && (r[i] = this.getFoldWidget(i)); + if (r[i] != "start") continue; + var s = this.getFoldWidgetRange(i); + if (s && s.isMultiLine() && s.end.row <= t && s.start.row >= e) + { + i = s.end.row; + try + { + var o = this.addFold("...", s); + o && (o.collapseChildren = n) + } + catch (u) + {} + } + } + }, 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) return; + this.$foldStyle = e, e == "manual" && this.unfold(); + var t = this.$foldMode; + this.$setFolding(null), this.$setFolding(t) + }, this.$setFolding = function (e) + { + if (this.$foldMode == e) return; + this.$foldMode = e, this.off("change", this.$updateFoldWidgets), this.off("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets), this._signal("changeAnnotation"); + if (!e || this.$foldStyle == "manual") + { + this.foldWidgets = null; + return + } + 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.getParentFoldRangeData = function (e, t) + { + var n = this.foldWidgets; + if (!n || t && n[e]) return {}; + var r = e - 1, + i; + while (r >= 0) + { + var s = n[r]; + s == null && (s = n[r] = this.getFoldWidget(r)); + if (s == "start") + { + var o = this.getFoldWidgetRange(r); + i || (i = o); + if (o && o.end.row >= e) break + } + r-- + } + return { + range: r !== -1 && o, + firstRange: i + } + }, this.onFoldWidgetClick = function (e, t) + { + t = t.domEvent; + var n = { + children: t.shiftKey, + all: t.ctrlKey || t.metaKey, + siblings: t.altKey + }, + r = this.$toggleFoldWidget(e, n); + if (!r) + { + var i = t.target || t.srcElement; + i && /ace_fold-widget/.test(i.className) && (i.className += " ace_invalid") + } + }, this.$toggleFoldWidget = function (e, t) + { + if (!this.getFoldWidget) return; + var n = this.getFoldWidget(e), + r = this.getLine(e), + i = n === "end" ? -1 : 1, + s = this.getFoldAt(e, i === -1 ? 0 : r.length, i); + 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); + if (s && o.isEqual(s.range)) return this.removeFold(s), s + } + if (t.siblings) + { + var u = this.getParentFoldRangeData(e); + if (u.range) var a = u.range.start.row + 1, + f = u.range.end.row; + this.foldAll(a, f, t.all ? 1e4 : 0) + } + else t.children ? (f = o ? o.end.row : this.getLength(), this.foldAll(e + 1, f, 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 n = this.$toggleFoldWidget(t, + {}); + if (n) return; + var r = this.getParentFoldRangeData(t, !0); + n = r.range || r.firstRange; + if (n) + { + t = n.start.row; + var i = this.getFoldAt(t, this.getLine(t).length, 1); + i ? this.removeFold(i) : this.addFold("...", n) + } + }, this.updateFoldWidgets = function (e) + { + var t = e.start.row, + n = e.end.row - t; + if (n === 0) this.foldWidgets[t] = null; + else if (e.action == "remove") this.foldWidgets.splice(t, n + 1, null); + else + { + var r = Array(n + 1); + r.unshift(t, 1), this.foldWidgets.splice.apply(this.foldWidgets, r) + } + }, 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) + } + } + var r = e("../range").Range, + i = e("./fold_line").FoldLine, + s = e("./fold").Fold, + o = e("../token_iterator").TokenIterator; + t.Folding = u +}), define("ace/edit_session/bracket_match", ["require", "exports", "module", "ace/token_iterator", "ace/range"], function (e, t, n) +{ + "use strict"; + + function s() + { + this.findMatchingBracket = function (e, t) + { + if (e.column == 0) return null; + var n = t || this.getLine(e.row).charAt(e.column - 1); + if (n == "") return null; + var r = n.match(/([\(\[\{])|([\)\]\}])/); + return r ? r[1] ? this.$findClosingBracket(r[1], e) : this.$findOpeningBracket(r[2], e) : null + }, this.getBracketRange = function (e) + { + var t = this.getLine(e.row), + n = !0, + r, s = t.charAt(e.column - 1), + o = s && s.match(/([\(\[\{])|([\)\]\}])/); + o || (s = t.charAt(e.column), e = { + row: e.row, + column: e.column + 1 + }, o = s && s.match(/([\(\[\{])|([\)\]\}])/), n = !1); + if (!o) return null; + if (o[1]) + { + var u = this.$findClosingBracket(o[1], e); + if (!u) return null; + r = i.fromPoints(e, u), n || (r.end.column++, r.start.column--), r.cursor = r.end + } + else + { + var u = this.$findOpeningBracket(o[2], e); + if (!u) return null; + r = i.fromPoints(u, e), n || (r.start.column++, r.end.column--), r.cursor = r.start + } + return r + }, this.$brackets = { + ")": "(", + "(": ")", + "]": "[", + "[": "]", + "{": "}", + "}": "{" + }, this.$findOpeningBracket = function (e, t, n) + { + var i = this.$brackets[e], + s = 1, + o = new r(this, t.row, t.column), + u = o.getCurrentToken(); + u || (u = o.stepForward()); + if (!u) return; + n || (n = new RegExp("(\\.?" + u.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+")); + var a = t.column - o.getCurrentTokenColumn() - 2, + f = u.value; + for (;;) + { + while (a >= 0) + { + var l = f.charAt(a); + if (l == i) + { + s -= 1; + if (s == 0) return { + row: o.getCurrentTokenRow(), + column: a + o.getCurrentTokenColumn() + } + } + else l == e && (s += 1); + a -= 1 + } + do u = o.stepBackward(); while (u && !n.test(u.type)); + if (u == null) break; + f = u.value, a = f.length - 1 + } + return null + }, this.$findClosingBracket = function (e, t, n) + { + var i = this.$brackets[e], + s = 1, + o = new r(this, t.row, t.column), + u = o.getCurrentToken(); + u || (u = o.stepForward()); + if (!u) return; + n || (n = new RegExp("(\\.?" + u.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+")); + var a = t.column - o.getCurrentTokenColumn(); + for (;;) + { + var f = u.value, + l = f.length; + while (a < l) + { + var c = f.charAt(a); + if (c == i) + { + s -= 1; + if (s == 0) return { + row: o.getCurrentTokenRow(), + column: a + o.getCurrentTokenColumn() + } + } + else c == e && (s += 1); + a += 1 + } + do u = o.stepForward(); while (u && !n.test(u.type)); + if (u == null) break; + a = 0 + } + return null + } + } + var r = e("../token_iterator").TokenIterator, + i = e("../range").Range; + t.BracketMatch = s +}), define("ace/edit_session", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/bidihandler", "ace/config", "ace/lib/event_emitter", "ace/selection", "ace/mode/text", "ace/range", "ace/document", "ace/background_tokenizer", "ace/search_highlight", "ace/edit_session/folding", "ace/edit_session/bracket_match"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/lang"), + s = e("./bidihandler").BidiHandler, + o = e("./config"), + u = e("./lib/event_emitter").EventEmitter, + a = e("./selection").Selection, + f = e("./mode/text").Mode, + l = e("./range").Range, + c = e("./document").Document, + h = e("./background_tokenizer").BackgroundTokenizer, + p = e("./search_highlight").SearchHighlight, + d = function (e, t) + { + this.$breakpoints = [], this.$decorations = [], this.$frontMarkers = {}, this.$backMarkers = {}, this.$markerId = 1, this.$undoSelect = !0, this.$foldData = [], this.id = "session" + ++d.$uid, this.$foldData.toString = function () + { + return this.join("\n") + }, this.on("changeFold", this.onChangeFold.bind(this)), this.$onChange = this.onChange.bind(this); + if (typeof e != "object" || !e.getLine) e = new c(e); + this.$bidiHandler = new s(this), this.setDocument(e), this.selection = new a(this), o.resetOptions(this), this.setMode(t), o._signal("session", this) + }; + d.$uid = 0, + function () + { + function m(e) + { + return e < 4352 ? !1 : 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 + } + r.implement(this, u), 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) + { + this.$docRowCache = [], this.$screenRowCache = []; + return + } + var t = this.$docRowCache.length, + n = this.$getRowCacheIndex(this.$docRowCache, e) + 1; + t > n && (this.$docRowCache.splice(n, t), this.$screenRowCache.splice(n, t)) + }, this.$getRowCacheIndex = function (e, t) + { + var n = 0, + r = e.length - 1; + while (n <= r) + { + var i = n + r >> 1, + s = e[i]; + if (t > s) n = i + 1; + else + { + if (!(t < s)) return i; + r = i - 1 + } + } + return n - 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 n = this.bgTokenizer.getTokens(e), + r, i = 0; + if (t == null) + { + var s = n.length - 1; + i = this.getLine(e).length + } + else + for (var s = 0; s < n.length; s++) + { + i += n[s].value.length; + if (i >= t) break + } + return r = n[s], r ? (r.index = s, r.start = i - r.value.length, r) : null + }, this.setUndoManager = function (e) + { + this.$undoManager = e, this.$informUndoManager && this.$informUndoManager.cancel(); + if (e) + { + var t = this; + e.addSession(this), this.$syncInformUndoManager = function () + { + t.$informUndoManager.cancel(), t.mergeUndoDeltas = !1 + }, this.$informUndoManager = i.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() ? i.stringRepeat(" ", this.getTabSize()) : " " + }, 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) + { + t === undefined && (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, n, r) + { + var i = this.$markerId++, + s = { + range: e, + type: n || "line", + renderer: typeof n == "function" ? n : null, + clazz: t, + inFront: !!r, + id: i + }; + return r ? (this.$frontMarkers[i] = s, this._signal("changeFrontMarker")) : (this.$backMarkers[i] = s, this._signal("changeBackMarker")), i + }, this.addDynamicMarker = function (e, t) + { + if (!e.update) return; + var n = this.$markerId++; + return e.id = n, e.inFront = !!t, t ? (this.$frontMarkers[n] = e, this._signal("changeFrontMarker")) : (this.$backMarkers[n] = e, this._signal("changeBackMarker")), e + }, this.removeMarker = function (e) + { + var t = this.$frontMarkers[e] || this.$backMarkers[e]; + if (!t) return; + var n = t.inFront ? this.$frontMarkers : this.$backMarkers; + delete n[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 p(null, "ace_selected-word", "text"); + this.$searchHighlight = this.addDynamicMarker(t) + } + this.$searchHighlight.setRegexp(e) + }, this.highlightLines = function (e, t, n, r) + { + typeof t != "number" && (n = t, t = e), n || (n = "ace_step"); + var i = new l(e, 0, t, Infinity); + return i.id = this.addMarker(i, n, "fullLine", r), i + }, 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); + t ? this.$autoNewLine = t[1] : this.$autoNewLine = "\n" + }, this.getWordRange = function (e, t) + { + var n = this.getLine(e), + r = !1; + t > 0 && (r = !!n.charAt(t - 1).match(this.tokenRe)), r || (r = !!n.charAt(t).match(this.tokenRe)); + if (r) var i = this.tokenRe; + else if (/^\s+$/.test(n.slice(t - 1, t + 1))) var i = /\s/; + else var i = this.nonTokenRe; + var s = t; + if (s > 0) + { + do s--; while (s >= 0 && n.charAt(s).match(i)); + s++ + } + var o = t; + while (o < n.length && n.charAt(o).match(i)) o++; + return new l(e, s, e, o) + }, this.getAWordRange = function (e, t) + { + var n = this.getWordRange(e, t), + r = this.getLine(n.end.row); + while (r.charAt(n.end.column).match(/[ \t]/)) n.end.column += 1; + return n + }, 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 = {}, this.$mode = null, this.$modeId = null, this.setMode = function (e, t) + { + if (e && typeof e == "object") + { + if (e.getTokenizer) return this.$onChangeMode(e); + var n = e, + r = n.path + } + else r = e || "ace/mode/text"; + this.$modes["ace/mode/text"] || (this.$modes["ace/mode/text"] = new f); + if (this.$modes[r] && !n) + { + this.$onChangeMode(this.$modes[r]), t && t(); + return + } + this.$modeId = r, o.loadModule(["mode", r], function (e) + { + if (this.$modeId !== r) return t && t(); + this.$modes[r] && !n ? this.$onChangeMode(this.$modes[r]) : e && e.Mode && (e = new e.Mode(n), n || (this.$modes[r] = e, e.$id = r), this.$onChangeMode(e)), t && t() + }.bind(this)), this.$mode || this.$onChangeMode(this.$modes["ace/mode/text"], !0) + }, this.$onChangeMode = function (e, t) + { + t || (this.$modeId = e.$id); + if (this.$mode === e) return; + this.$mode = e, this.$stopWorker(), this.$useWorker && this.$startWorker(); + var n = e.getTokenizer(); + if (n.addEventListener !== undefined) + { + var r = this.onReloadTokenizer.bind(this); + n.addEventListener("update", r) + } + if (!this.bgTokenizer) + { + this.bgTokenizer = new h(n); + var i = this; + this.bgTokenizer.addEventListener("update", function (e) + { + i._signal("tokenizerUpdate", e) + }) + } + else this.bgTokenizer.setTokenizer(n); + 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) + { + if (this.$scrollTop === e || isNaN(e)) return; + this.$scrollTop = e, this._signal("changeScrollTop", e) + }, this.getScrollTop = function () + { + return this.$scrollTop + }, this.$scrollLeft = 0, this.setScrollLeft = function (e) + { + if (this.$scrollLeft === e || isNaN(e)) return; + 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 (this.lineWidgetsWidth != null) 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) + { + this.$modified = !1; + if (this.$useWrapMode) return this.screenWidth = this.$wrapLimit; + var t = this.doc.getAllLines(), + n = this.$rowLengthCache, + r = 0, + i = 0, + s = this.$foldData[i], + o = s ? s.start.row : Infinity, + u = t.length; + for (var a = 0; a < u; a++) + { + if (a > o) + { + a = s.end.row + 1; + if (a >= u) break; + s = this.$foldData[i++], o = s ? s.start.row : Infinity + } + n[a] == null && (n[a] = this.$getStringScreenWidth(t[a])[0]), n[a] > r && (r = n[a]) + } + this.screenWidth = r + } + }, 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) return; + this.$fromUndo = !0; + for (var n = e.length - 1; n != -1; n--) + { + var r = e[n]; + r.action == "insert" || r.action == "remove" ? this.doc.revertDelta(r) : r.folds && this.addFolds(r.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) return; + this.$fromUndo = !0; + for (var n = 0; n < e.length; n++) + { + var r = e[n]; + (r.action == "insert" || r.action == "remove") && this.doc.applyDelta(r) + }!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 n(e) + { + return t ? e.action !== "insert" : e.action === "insert" + } + var r, i, s; + for (var o = 0; o < e.length; o++) + { + var u = e[o]; + if (!u.start) continue; + if (!r) + { + n(u) ? (r = l.fromPoints(u.start, u.end), s = !0) : (r = l.fromPoints(u.start, u.start), s = !1); + continue + } + n(u) ? (i = u.start, r.compare(i.row, i.column) == -1 && r.setStart(i), i = u.end, r.compare(i.row, i.column) == 1 && r.setEnd(i), s = !0) : (i = u.start, r.compare(i.row, i.column) == -1 && (r = l.fromPoints(u.start, u.start)), s = !1) + } + return r + }, this.replace = function (e, t) + { + return this.doc.replace(e, t) + }, this.moveText = function (e, t, n) + { + var r = this.getTextRange(e), + i = this.getFoldsInRange(e), + s = l.fromPoints(t, t); + if (!n) + { + this.remove(e); + var o = e.start.row - e.end.row, + u = o ? -e.end.column : e.start.column - e.end.column; + u && (s.start.row == e.end.row && s.start.column > e.end.column && (s.start.column += u), s.end.row == e.end.row && s.end.column > e.end.column && (s.end.column += u)), o && s.start.row >= e.end.row && (s.start.row += o, s.end.row += o) + } + s.end = this.insert(s.start, r); + if (i.length) + { + var a = e.start, + f = s.start, + o = f.row - a.row, + u = f.column - a.column; + this.addFolds(i.map(function (e) + { + return e = e.clone(), e.start.row == a.row && (e.start.column += u), e.end.row == a.row && (e.end.column += u), e.start.row += o, e.end.row += o, e + })) + } + return s + }, this.indentRows = function (e, t, n) + { + n = n.replace(/\t/g, this.getTabString()); + for (var r = e; r <= t; r++) this.doc.insertInLine( + { + row: r, + column: 0 + }, n) + }, this.outdentRows = function (e) + { + var t = e.collapseRows(), + n = new l(0, 0, 0, 0), + r = this.getTabSize(); + for (var i = t.start.row; i <= t.end.row; ++i) + { + var s = this.getLine(i); + n.start.row = i, n.end.row = i; + for (var o = 0; o < r; ++o) + if (s.charAt(o) != " ") break; + o < r && s.charAt(o) == " " ? (n.start.column = o, n.end.column = o + 1) : (n.start.column = 0, n.end.column = o), this.remove(n) + } + }, this.$moveLines = function (e, t, n) + { + e = this.getRowFoldStart(e), t = this.getRowFoldEnd(t); + if (n < 0) + { + var r = this.getRowFoldStart(e + n); + if (r < 0) return 0; + var i = r - e + } + else if (n > 0) + { + var r = this.getRowFoldEnd(t + n); + if (r > this.doc.getLength() - 1) return 0; + var i = r - t + } + else + { + e = this.$clipRowToDocument(e), t = this.$clipRowToDocument(t); + var i = t - e + 1 + } + var s = new l(e, 0, t, Number.MAX_VALUE), + o = this.getFoldsInRange(s).map(function (e) + { + return e = e.clone(), e.start.row += i, e.end.row += i, e + }), + u = n == 0 ? this.doc.getLines(e, t) : this.doc.removeFullLines(e, t); + return this.doc.insertFullLines(e + i, u), o.length && this.addFolds(o), i + }, 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) + { + t = Math.max(0, t); + if (e < 0) e = 0, t = 0; + else + { + var n = this.doc.getLength(); + e >= n ? (e = n - 1, t = this.doc.getLine(n - 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) + { + this.$useWrapMode = e, this.$modified = !0, this.$resetRowCache(0); + if (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) + { + if (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 n = this.$wrapLimitRange; + n.max < 0 && (n = { + min: t, + max: t + }); + var r = this.$constrainWrapLimit(e, n.min, n.max); + return r != this.$wrapLimit && r > 1 ? (this.$wrapLimit = r, this.$modified = !0, this.$useWrapMode && (this.$updateWrapData(0, this.getLength() - 1), this.$resetRowCache(0), this._signal("changeWrapLimit")), !0) : !1 + }, this.$constrainWrapLimit = function (e, t, n) + { + return t && (e = Math.max(t, e)), n && (e = Math.min(n, 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, + n = e.action, + r = e.start, + i = e.end, + s = r.row, + o = i.row, + u = o - s, + a = null; + this.$updating = !0; + if (u != 0) + if (n === "remove") + { + this[t ? "$wrapData" : "$rowLengthCache"].splice(s, u); + var f = this.$foldData; + a = this.getFoldsInRange(e), this.removeFolds(a); + var l = this.getFoldLine(i.row), + c = 0; + if (l) + { + l.addRemoveChars(i.row, i.column, r.column - i.column), l.shiftRow(-u); + var h = this.getFoldLine(s); + h && h !== l && (h.merge(l), l = h), c = f.indexOf(l) + 1 + } + for (c; c < f.length; c++) + { + var l = f[c]; + l.start.row >= i.row && l.shiftRow(-u) + } + o = s + } + else + { + var p = Array(u); + p.unshift(s, 0); + var d = t ? this.$wrapData : this.$rowLengthCache; + d.splice.apply(d, p); + var f = this.$foldData, + l = this.getFoldLine(s), + c = 0; + if (l) + { + var v = l.range.compareInside(r.row, r.column); + v == 0 ? (l = l.split(r.row, r.column), l && (l.shiftRow(u), l.addRemoveChars(o, 0, i.column - r.column))) : v == -1 && (l.addRemoveChars(s, 0, i.column - r.column), l.shiftRow(u)), c = f.indexOf(l) + 1 + } + for (c; c < f.length; c++) + { + var l = f[c]; + l.start.row >= s && l.shiftRow(u) + } + } + else + { + u = Math.abs(e.start.column - e.end.column), n === "remove" && (a = this.getFoldsInRange(e), this.removeFolds(a), u = -u); + var l = this.getFoldLine(s); + l && l.addRemoveChars(s, r.column, u) + } + 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, n) + { + this.$rowLengthCache[e] = null, this.$rowLengthCache[t] = null + }, this.$updateWrapData = function (e, t) + { + var r = this.doc.getAllLines(), + i = this.getTabSize(), + o = this.$wrapData, + u = this.$wrapLimit, + a, f, l = e; + t = Math.min(t, r.length - 1); + while (l <= t) f = this.getFoldLine(l, f), f ? (a = [], f.walk(function (e, t, i, o) + { + var u; + if (e != null) + { + u = this.$getDisplayTokens(e, a.length), u[0] = n; + for (var f = 1; f < u.length; f++) u[f] = s + } + else u = this.$getDisplayTokens(r[t].substring(o, i), a.length); + a = a.concat(u) + }.bind(this), f.end.row, r[f.end.row].length + 1), o[f.start.row] = this.$computeWrapSplits(a, u, i), l = f.end.row + 1) : (a = this.$getDisplayTokens(r[l]), o[l] = this.$computeWrapSplits(a, u, i), l++) + }; + var e = 1, + t = 2, + n = 3, + s = 4, + a = 9, + c = 10, + d = 11, + v = 12; + this.$computeWrapSplits = function (e, r, i) + { + function g() + { + var t = 0; + if (m === 0) return t; + if (p) + for (var n = 0; n < e.length; n++) + { + var r = e[n]; + if (r == c) t += 1; + else + { + if (r != d) + { + if (r == v) continue; + break + } + t += i + } + } + return h && p !== !1 && (t += i), Math.min(t, m) + } + + function y(t) + { + var n = e.slice(f, t), + r = n.length; + n.join("").replace(/12/g, function () + { + r -= 1 + }).replace(/2/g, function () + { + r -= 1 + }), o.length || (b = g(), o.indent = b), l += r, o.push(l), f = t + } + if (e.length == 0) return []; + var o = [], + u = e.length, + f = 0, + l = 0, + h = this.$wrapAsCode, + p = this.$indentedSoftWrap, + m = r <= Math.max(2 * i, 8) || p === !1 ? 0 : Math.floor(r / 2), + b = 0; + while (u - f > r - b) + { + var w = f + r - b; + if (e[w - 1] >= c && e[w] >= c) + { + y(w); + continue + } + if (e[w] == n || e[w] == s) + { + for (w; w != f - 1; w--) + if (e[w] == n) break; + if (w > f) + { + y(w); + continue + } + w = f + r; + for (w; w < e.length; w++) + if (e[w] != s) break; + if (w == e.length) break; + y(w); + continue + } + var E = Math.max(w - (r - (r >> 2)), f - 1); + while (w > E && e[w] < n) w--; + if (h) + { + while (w > E && e[w] < n) w--; + while (w > E && e[w] == a) w-- + } + else + while (w > E && e[w] < c) w--; + if (w > E) + { + y(++w); + continue + } + w = f + r, e[w] == t && w--, y(w - b) + } + return o + }, this.$getDisplayTokens = function (n, r) + { + var i = [], + s; + r = r || 0; + for (var o = 0; o < n.length; o++) + { + var u = n.charCodeAt(o); + if (u == 9) + { + s = this.getScreenTabSize(i.length + r), i.push(d); + for (var f = 1; f < s; f++) i.push(v) + } + else u == 32 ? i.push(c) : u > 39 && u < 48 || u > 57 && u < 64 ? i.push(a) : u >= 4352 && m(u) ? i.push(e, t) : i.push(e) + } + return i + }, this.$getStringScreenWidth = function (e, t, n) + { + if (t == 0) return [0, 0]; + t == null && (t = Infinity), n = n || 0; + var r, i; + for (i = 0; i < e.length; i++) + { + r = e.charCodeAt(i), r == 9 ? n += this.getScreenTabSize(n) : r >= 4352 && m(r) ? n += 2 : n += 1; + if (n > t) break + } + return [n, i] + }, 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] ? 1 + t : this.$wrapData[e].length + 1 + t + }, this.getRowLineCount = function (e) + { + return !this.$useWrapMode || !this.$wrapData[e] ? 1 : this.$wrapData[e].length + 1 + }, this.getRowWrapIndent = function (e) + { + if (this.$useWrapMode) + { + var t = this.screenToDocumentPosition(e, Number.MAX_VALUE), + n = this.$wrapData[t.row]; + return n.length && n[0] < t.column ? n.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 n = this.documentToScreenRow(e, t); + return this.getScreenLastRowColumn(n) + }, this.getDocumentLastRowColumnPosition = function (e, t) + { + var n = this.documentToScreenRow(e, t); + return this.screenToDocumentPosition(n, Number.MAX_VALUE / 10) + }, this.getRowSplitData = function (e) + { + return this.$useWrapMode ? this.$wrapData[e] : undefined + }, 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, n) + { + if (e < 0) return { + row: 0, + column: 0 + }; + var r, i = 0, + s = 0, + o, u = 0, + a = 0, + f = this.$screenRowCache, + l = this.$getRowCacheIndex(f, e), + c = f.length; + if (c && l >= 0) var u = f[l], + i = this.$docRowCache[l], + h = e > f[c - 1]; + else var h = !c; + var p = this.getLength() - 1, + d = this.getNextFoldLine(i), + v = d ? d.start.row : Infinity; + while (u <= e) + { + a = this.getRowLength(i); + if (u + a > e || i >= p) break; + u += a, i++, i > v && (i = d.end.row + 1, d = this.getNextFoldLine(i, d), v = d ? d.start.row : Infinity), h && (this.$docRowCache.push(i), this.$screenRowCache.push(u)) + } + if (d && d.start.row <= i) r = this.getFoldDisplayLine(d), i = d.start.row; + else + { + if (u + a <= e || i > p) return { + row: p, + column: this.getLine(p).length + }; + r = this.getLine(i), d = null + } + var m = 0, + g = Math.floor(e - u); + if (this.$useWrapMode) + { + var y = this.$wrapData[i]; + y && (o = y[g], g > 0 && y.length && (m = y.indent, s = y[g - 1] || y[y.length - 1], r = r.substring(s))) + } + return n !== undefined && this.$bidiHandler.isBidiRow(u + g, i, g) && (t = this.$bidiHandler.offsetToCol(n)), s += this.$getStringScreenWidth(r, t - m)[1], this.$useWrapMode && s >= o && (s = o - 1), d ? d.idxToPosition(s) : + { + row: i, + column: s + } + }, this.documentToScreenPosition = function (e, t) + { + if (typeof t == "undefined") var n = this.$clipPositionToDocument(e.row, e.column); + else n = this.$clipPositionToDocument(e, t); + e = n.row, t = n.column; + var r = 0, + i = null, + s = null; + s = this.getFoldAt(e, t, 1), s && (e = s.start.row, t = s.start.column); + var o, u = 0, + a = this.$docRowCache, + f = this.$getRowCacheIndex(a, e), + l = a.length; + if (l && f >= 0) var u = a[f], + r = this.$screenRowCache[f], + c = e > a[l - 1]; + else var c = !l; + var h = this.getNextFoldLine(u), + p = h ? h.start.row : Infinity; + while (u < e) + { + if (u >= p) + { + o = h.end.row + 1; + if (o > e) break; + h = this.getNextFoldLine(o, h), p = h ? h.start.row : Infinity + } + else o = u + 1; + r += this.getRowLength(u), u = o, c && (this.$docRowCache.push(u), this.$screenRowCache.push(r)) + } + var d = ""; + h && u >= p ? (d = this.getFoldDisplayLine(h, e, t), i = h.start.row) : (d = this.getLine(e).substring(0, t), i = e); + var v = 0; + if (this.$useWrapMode) + { + var m = this.$wrapData[i]; + if (m) + { + var g = 0; + while (d.length >= m[g]) r++, g++; + d = d.substring(m[g - 1] || 0, d.length), v = g > 0 ? m.indent : 0 + } + } + return { + row: r, + column: v + this.$getStringScreenWidth(d)[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) + { + e = this.getLength(); + var n = this.$foldData; + for (var r = 0; r < n.length; r++) t = n[r], e -= t.end.row - t.start.row + } + else + { + var i = this.$wrapData.length, + s = 0, + r = 0, + t = this.$foldData[r++], + o = t ? t.start.row : Infinity; + while (s < i) + { + var u = this.$wrapData[s]; + e += u ? u.length + 1 : 1, s++, s > o && (s = t.end.row + 1, t = this.$foldData[r++], o = t ? t.start.row : Infinity) + } + } + return this.lineWidgets && (e += this.$getWidgetScreenLength()), e + }, this.$setFontMetrics = function (e) + { + if (!this.$enableVarChar) return; + this.$getStringScreenWidth = function (t, n, r) + { + if (n === 0) return [0, 0]; + n || (n = Infinity), r = r || 0; + var i, s; + for (s = 0; s < t.length; s++) + { + i = t.charAt(s), i === " " ? r += this.getScreenTabSize(r) : r += e.getCharacterWidth(i); + if (r > n) break + } + return [r, s] + } + }, this.destroy = function () + { + this.bgTokenizer && (this.bgTokenizer.setDocument(null), this.bgTokenizer = null), this.$stopWorker() + }, this.isFullWidth = m + }.call(d.prototype), e("./edit_session/folding").Folding.call(d.prototype), e("./edit_session/bracket_match").BracketMatch.call(d.prototype), o.defineOptions(d.prototype, "session", + { + wrap: + { + set: function (e) + { + !e || e == "off" ? e = !1 : e == "free" ? e = !0 : e == "printMargin" ? e = -1 : typeof e == "string" && (e = parseInt(e, 10) || !1); + if (this.$wrap == e) return; + this.$wrap = e; + if (!e) this.setUseWrapMode(!1); + else + { + var t = typeof e == "number" ? e : null; + this.setWrapLimitRange(t, t), this.setUseWrapMode(!0) + } + }, + get: function () + { + return this.getUseWrapMode() ? this.$wrap == -1 ? "printMargin" : this.getWrapLimitRange().min ? this.$wrap : "free" : "off" + }, + handlesSet: !0 + }, + wrapMethod: + { + set: function (e) + { + e = e == "auto" ? this.$mode.type != "text" : e != "text", e != this.$wrapAsCode && (this.$wrapAsCode = e, this.$useWrapMode && (this.$modified = !0, this.$resetRowCache(0), this.$updateWrapData(0, this.getLength() - 1))) + }, + initialValue: "auto" + }, + indentedSoftWrap: + { + 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) + { + if (isNaN(e) || this.$tabSize === e) return; + 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 = d +}), define("ace/search", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function (e, t, n) +{ + "use strict"; + + function u(e, t) + { + function n(e) + { + return /\w/.test(e) || t.regExp ? "\\b" : "" + } + return n(e[0]) + e + n(e[e.length - 1]) + } + var r = e("./lib/lang"), + i = e("./lib/oop"), + s = e("./range").Range, + o = function () + { + this.$options = {} + }; + (function () + { + this.set = function (e) + { + return i.mixin(this.$options, e), this + }, this.getOptions = function () + { + return r.copyObject(this.$options) + }, this.setOptions = function (e) + { + this.$options = e + }, this.find = function (e) + { + var t = this.$options, + n = this.$matchIterator(e, t); + if (!n) return !1; + var r = null; + return n.forEach(function (e, n, i, o) + { + return r = new s(e, n, i, o), n == o && t.start && t.start.start && t.skipCurrent != 0 && r.isEqual(t.start) ? (r = null, !1) : !0 + }), r + }, this.findAll = function (e) + { + var t = this.$options; + if (!t.needle) return []; + this.$assembleRegExp(t); + var n = t.range, + i = n ? e.getLines(n.start.row, n.end.row) : e.doc.getAllLines(), + o = [], + u = t.re; + if (t.$isMultiLine) + { + var a = u.length, + f = i.length - a, + l; + e: for (var c = u.offset || 0; c <= f; c++) + { + for (var h = 0; h < a; h++) + if (i[c + h].search(u[h]) == -1) continue e; + var p = i[c], + d = i[c + a - 1], + v = p.length - p.match(u[0])[0].length, + m = d.match(u[a - 1])[0].length; + if (l && l.end.row === c && l.end.column > v) continue; + o.push(l = new s(c, v, c + a - 1, m)), a > 2 && (c = c + a - 2) + } + } + else + for (var g = 0; g < i.length; g++) + { + var y = r.getMatchOffsets(i[g], u); + for (var h = 0; h < y.length; h++) + { + var b = y[h]; + o.push(new s(g, b.offset, g, b.offset + b.length)) + } + } + if (n) + { + var w = n.start.column, + E = n.start.column, + g = 0, + h = o.length - 1; + while (g < h && o[g].start.column < w && o[g].start.row == n.start.row) g++; + while (g < h && o[h].end.column > E && o[h].end.row == n.end.row) h--; + o = o.slice(g, h + 1); + for (g = 0, h = o.length; g < h; g++) o[g].start.row += n.start.row, o[g].end.row += n.start.row + } + return o + }, this.replace = function (e, t) + { + var n = this.$options, + r = this.$assembleRegExp(n); + if (n.$isMultiLine) return t; + if (!r) return; + var i = r.exec(e); + if (!i || i[0].length != e.length) return null; + t = e.replace(r, t); + if (n.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 n = e.needle; + if (!e.needle) return e.re = !1; + e.regExp || (n = r.escapeRegExp(n)), e.wholeWord && (n = u(n, e)); + var i = e.caseSensitive ? "gm" : "gmi"; + e.$isMultiLine = !t && /[\n\r]/.test(n); + if (e.$isMultiLine) return e.re = this.$assembleMultilineRegExp(n, i); + try + { + var s = new RegExp(n, i) + } + catch (o) + { + s = !1 + } + return e.re = s + }, this.$assembleMultilineRegExp = function (e, t) + { + var n = e.replace(/\r\n|\r|\n/g, "$\n^").split("\n"), + r = []; + for (var i = 0; i < n.length; i++) try + { + r.push(new RegExp(n[i], t)) + } + catch (s) + { + return !1 + } + return r + }, this.$matchIterator = function (e, t) + { + var n = this.$assembleRegExp(t); + if (!n) return !1; + var r = t.backwards == 1, + i = t.skipCurrent != 0, + s = t.range, + o = t.start; + o || (o = s ? s[r ? "end" : "start"] : e.selection.getRange()), o.start && (o = o[i != r ? "end" : "start"]); + var u = s ? s.start.row : 0, + a = s ? s.end.row : e.getLength() - 1; + if (r) var f = function (e) + { + var n = o.row; + if (c(n, o.column, e)) return; + for (n--; n >= u; n--) + if (c(n, Number.MAX_VALUE, e)) return; + if (t.wrap == 0) return; + for (n = a, u = o.row; n >= u; n--) + if (c(n, Number.MAX_VALUE, e)) return + }; + else var f = function (e) + { + var n = o.row; + if (c(n, o.column, e)) return; + for (n += 1; n <= a; n++) + if (c(n, 0, e)) return; + if (t.wrap == 0) return; + for (n = u, a = o.row; n <= a; n++) + if (c(n, 0, e)) return + }; + if (t.$isMultiLine) var l = n.length, + c = function (t, i, s) + { + var o = r ? t - l + 1 : t; + if (o < 0) return; + var u = e.getLine(o), + a = u.search(n[0]); + if (!r && a < i || a === -1) return; + for (var f = 1; f < l; f++) + { + u = e.getLine(o + f); + if (u.search(n[f]) == -1) return + } + var c = u.match(n[l - 1])[0].length; + if (r && c > i) return; + if (s(o, a, o + l - 1, c)) return !0 + }; + else if (r) var c = function (t, r, i) + { + var s = e.getLine(t), + o = [], + u, a = 0; + n.lastIndex = 0; + while (u = n.exec(s)) + { + var f = u[0].length; + a = u.index; + if (!f) + { + if (a >= s.length) break; + n.lastIndex = a += 1 + } + if (u.index + f > r) break; + o.push(u.index, f) + } + for (var l = o.length - 1; l >= 0; l -= 2) + { + var c = o[l - 1], + f = o[l]; + if (i(t, c, t, c + f)) return !0 + } + }; + else var c = function (t, r, i) + { + var s = e.getLine(t), + o, u; + n.lastIndex = r; + while (u = n.exec(s)) + { + var a = u[0].length; + o = u.index; + if (i(t, o, t, o + a)) return !0; + if (!a) + { + n.lastIndex = o += 1; + if (o >= s.length) return !1 + } + } + }; + return { + forEach: f + } + } + }).call(o.prototype), t.Search = o +}), define("ace/keyboard/hash_handler", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function (e, t, n) +{ + "use strict"; + + function o(e, t) + { + this.platform = t || (i.isMac ? "mac" : "win"), this.commands = {}, this.commandKeyBinding = {}, this.addCommands(e), this.$singleCommand = !0 + } + + function u(e, t) + { + o.call(this, e, t), this.$singleCommand = !1 + } + var r = e("../lib/keys"), + i = e("../lib/useragent"), + s = r.KEY_MODS; + u.prototype = o.prototype, + function () + { + function e(e) + { + return typeof e == "object" && 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 n = e && (typeof e == "string" ? e : e.name); + e = this.commands[n], t || delete this.commands[n]; + var r = this.commandKeyBinding; + for (var i in r) + { + var s = r[i]; + if (s == e) delete r[i]; + else if (Array.isArray(s)) + { + var o = s.indexOf(e); + o != -1 && (s.splice(o, 1), s.length == 1 && (r[i] = s[0])) + } + } + }, this.bindKey = function (e, t, n) + { + typeof e == "object" && e && (n == undefined && (n = e.position), e = e[this.platform]); + if (!e) return; + if (typeof t == "function") return this.addCommand( + { + exec: t, + bindKey: e, + name: t.name || e + }); + e.split("|").forEach(function (e) + { + var r = ""; + if (e.indexOf(" ") != -1) + { + var i = e.split(/\s+/); + e = i.pop(), i.forEach(function (e) + { + var t = this.parseKeys(e), + n = s[t.hashId] + t.key; + r += (r ? " " : "") + n, this._addCommandToBinding(r, "chainKeys") + }, this), r += " " + } + var o = this.parseKeys(e), + u = s[o.hashId] + o.key; + this._addCommandToBinding(r + u, t, n) + }, this) + }, this._addCommandToBinding = function (t, n, r) + { + var i = this.commandKeyBinding, + s; + if (!n) delete i[t]; + else if (!i[t] || this.$singleCommand) i[t] = n; + else + { + Array.isArray(i[t]) ? (s = i[t].indexOf(n)) != -1 && i[t].splice(s, 1) : i[t] = [i[t]], typeof r != "number" && (r = e(n)); + var o = i[t]; + for (s = 0; s < o.length; s++) + { + var u = o[s], + a = e(u); + if (a > r) break + } + o.splice(s, 0, n) + } + }, this.addCommands = function (e) + { + e && Object.keys(e).forEach(function (t) + { + var n = e[t]; + if (!n) return; + if (typeof n == "string") return this.bindKey(n, t); + typeof n == "function" && (n = { + exec: n + }); + if (typeof n != "object") return; + n.name || (n.name = t), this.addCommand(n) + }, 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 + }), + n = t.pop(), + i = r[n]; + if (r.FUNCTION_KEYS[i]) n = r.FUNCTION_KEYS[i].toLowerCase(); + else + { + if (!t.length) return { + key: n, + hashId: -1 + }; + if (t.length == 1 && t[0] == "shift") return { + key: n.toUpperCase(), + hashId: -1 + } + } + var s = 0; + for (var o = t.length; o--;) + { + var u = r.KEY_MODS[t[o]]; + if (u == null) return typeof console != "undefined" && console.error("invalid modifier " + t[o] + " in " + e), !1; + s |= u + } + return { + key: n, + hashId: s + } + }, this.findKeyCommand = function (t, n) + { + var r = s[t] + n; + return this.commandKeyBinding[r] + }, this.handleKeyboard = function (e, t, n, r) + { + if (r < 0) return; + var i = s[t] + n, + o = this.commandKeyBinding[i]; + e.$keyChain && (e.$keyChain += " " + i, o = this.commandKeyBinding[e.$keyChain] || o); + if (o) + if (o == "chainKeys" || o[o.length - 1] == "chainKeys") return e.$keyChain = e.$keyChain || i, + { + command: "null" + }; + if (e.$keyChain) + if (!!t && t != 4 || n.length != 1) + { + if (t == -1 || r > 0) e.$keyChain = "" + } + else e.$keyChain = e.$keyChain.slice(0, -i.length - 1); + return { + command: o + } + }, this.getStatusText = function (e, t) + { + return t.$keyChain || "" + } + }.call(o.prototype), t.HashHandler = o, t.MultiHashHandler = u +}), define("ace/commands/command_manager", ["require", "exports", "module", "ace/lib/oop", "ace/keyboard/hash_handler", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/oop"), + i = e("../keyboard/hash_handler").MultiHashHandler, + s = e("../lib/event_emitter").EventEmitter, + o = function (e, t) + { + i.call(this, t, e), this.byName = this.commands, this.setDefaultHandler("exec", function (e) + { + return e.command.exec(e.editor, e.args || + {}) + }) + }; + r.inherits(o, i), + function () + { + r.implement(this, s), this.exec = function (e, t, n) + { + if (Array.isArray(e)) + { + for (var r = e.length; r--;) + if (this.exec(e[r], t, n)) return !0; + return !1 + } + typeof e == "string" && (e = this.commands[e]); + if (!e) return !1; + if (t && t.$readOnly && !e.readOnly) return !1; + if (e.isAvailable && !e.isAvailable(t)) return !1; + var i = { + editor: t, + command: e, + args: n + }; + return i.returnValue = this._emit("exec", i), this._signal("afterExec", i), i.returnValue === !1 ? !1 : !0 + }, this.toggleRecording = function (e) + { + if (this.$inReplay) return; + 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) return; + if (this.recording) return this.toggleRecording(e); + try + { + this.$inReplay = !0, this.macro.forEach(function (t) + { + typeof t == "string" ? 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 typeof e[0] != "string" && (e[0] = e[0].name), e[1] || (e = e[0]), e + }) + } + }.call(o.prototype), t.CommandManager = o +}), define("ace/commands/default_commands", ["require", "exports", "module", "ace/lib/lang", "ace/config", "ace/range"], function (e, t, n) +{ + "use strict"; + + function o(e, t) + { + return { + win: e, + mac: t + } + } + var r = e("../lib/lang"), + i = e("../config"), + s = e("../range").Range; + t.commands = [ + { + name: "showSettingsMenu", + bindKey: o("Ctrl-,", "Command-,"), + exec: function (e) + { + i.loadModule("ace/ext/settings_menu", function (t) + { + t.init(e), e.showSettingsMenu() + }) + }, + readOnly: !0 + }, + { + name: "goToNextError", + bindKey: o("Alt-E", "F4"), + exec: function (e) + { + i.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) + { + i.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) + { + typeof t != "number" && (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) + { + i.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(), + n = t ? e.selection.getLineRange() : e.selection.getRange(); + e._emit("cut", n), n.isEmpty() || e.session.remove(n), 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) + { + i.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(r.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) + { + var t = e.selection.isBackwards(), + n = t ? e.selection.getSelectionLead() : e.selection.getSelectionAnchor(), + i = t ? e.selection.getSelectionAnchor() : e.selection.getSelectionLead(), + o = e.session.doc.getLine(n.row).length, + u = e.session.doc.getTextRange(e.selection.getRange()), + a = u.replace(/\n\s*/, " ").length, + f = e.session.doc.getLine(n.row); + for (var l = n.row + 1; l <= i.row + 1; l++) + { + var c = r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l))); + c.length !== 0 && (c = " " + c), f += c + } + i.row + 1 < e.session.doc.getLength() - 1 && (f += e.session.doc.getNewLineCharacter()), e.clearSelection(), e.session.doc.replace(new s(n.row, 0, i.row + 2, 0), f), a > 0 ? (e.selection.moveCursorTo(n.row, n.column), e.selection.selectTo(n.row, n.column + a)) : (o = e.session.doc.getLine(n.row).length > o ? o + 1 : o, e.selection.moveCursorTo(n.row, o)) + }, + multiSelectAction: "forEach", + readOnly: !0 + }, + { + name: "invertSelection", + bindKey: o(null, null), + exec: function (e) + { + var t = e.session.doc.getLength() - 1, + n = e.session.doc.getLine(t).length, + r = e.selection.rangeList.ranges, + i = []; + r.length < 1 && (r = [e.selection.getRange()]); + for (var o = 0; o < r.length; o++) o == r.length - 1 && (r[o].end.row !== t || r[o].end.column !== n) && i.push(new s(r[o].end.row, r[o].end.column, t, n)), o === 0 ? (r[o].start.row !== 0 || r[o].start.column !== 0) && i.push(new s(0, 0, r[o].start.row, r[o].start.column)) : i.push(new s(r[o - 1].end.row, r[o - 1].end.column, r[o].start.row, r[o].start.column)); + e.exitMultiSelectMode(), e.clearSelection(); + for (var o = 0; o < i.length; o++) e.selection.addRange(i[o], !1) + }, + readOnly: !0, + scrollIntoView: "none" + }] +}), define("ace/clipboard", ["require", "exports", "module"], function (e, t, n) +{ + "use strict"; + n.exports = { + lineMode: !1 + } +}), define("ace/editor", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/keyboard/textinput", "ace/mouse/mouse_handler", "ace/mouse/fold_handler", "ace/keyboard/keybinding", "ace/edit_session", "ace/search", "ace/range", "ace/lib/event_emitter", "ace/commands/command_manager", "ace/commands/default_commands", "ace/config", "ace/token_iterator", "ace/clipboard"], function (e, t, n) +{ + "use strict"; + e("./lib/fixoldbrowsers"); + var r = e("./lib/oop"), + i = e("./lib/dom"), + s = e("./lib/lang"), + o = e("./lib/useragent"), + u = e("./keyboard/textinput").TextInput, + a = e("./mouse/mouse_handler").MouseHandler, + f = e("./mouse/fold_handler").FoldHandler, + l = e("./keyboard/keybinding").KeyBinding, + c = e("./edit_session").EditSession, + h = e("./search").Search, + p = e("./range").Range, + d = e("./lib/event_emitter").EventEmitter, + v = e("./commands/command_manager").CommandManager, + m = e("./commands/default_commands").commands, + g = e("./config"), + y = e("./token_iterator").TokenIterator, + b = e("./clipboard"), + w = function (e, t, n) + { + var r = e.getContainerElement(); + this.container = r, this.renderer = e, this.id = "editor" + ++w.$uid, this.commands = new v(o.isMac ? "mac" : "win", m), typeof document == "object" && (this.textInput = new u(e.getTextAreaContainer(), this), this.renderer.textarea = this.textInput.getElement(), this.$mouseHandler = new a(this), new f(this)), this.keyBinding = new l(this), this.$search = (new h).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 || n && n.session || new c("")), g.resetOptions(this), n && this.setOptions(n), g._signal("editor", this) + }; + w.$uid = 0, + function () + { + r.implement(this, d), 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)), 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 && e.returnValue === !1) return this.curOp = null; + this._signal("beforeEndOperation"); + var t = this.curOp.command, + n = t && t.scrollIntoView; + if (n) + { + switch (n) + { + case "center-animate": + n = "animate"; + case "center": + this.renderer.scrollCursorIntoView(null, .5); + break; + case "animate": + case "cursor": + this.renderer.scrollCursorIntoView(); + break; + case "selectionPart": + var r = this.selection.getRange(), + i = this.renderer.layerConfig; + (r.start.row >= i.lastRow || r.end.row <= i.firstRow) && this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead); + break; + default: + } + n == "animate" && 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) return; + var t = this.prevOp, + n = this.$mergeableCommands, + r = t.command && e.command.name == t.command.name; + if (e.command.name == "insertstring") + { + var i = e.args; + this.mergeNextCommand === undefined && (this.mergeNextCommand = !0), r = r && this.mergeNextCommand && (!/\s/.test(i) || /\s/.test(t.args)), this.mergeNextCommand = !0 + } + else r = r && n.indexOf(e.command.name) !== -1; + this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2e3 && (r = !1), r ? this.session.mergeUndoDeltas = !0 : n.indexOf(e.command.name) !== -1 && (this.sequenceStartTime = Date.now()) + }, this.setKeyboardHandler = function (e, t) + { + if (e && typeof e == "string" && e != "ace") + { + this.$keybindingId = e; + var n = this; + g.loadModule(["keybinding", e], function (r) + { + n.$keybindingId == e && n.keyBinding.setKeyboardHandler(r && r.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) return; + 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 n = this.session.getSelection(); + n.off("changeCursor", this.$onCursorChange), n.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 ? t == 1 ? this.navigateFileEnd() : t == -1 && 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") || i.computedStyle(this.container).fontSize + }, this.setFontSize = function (e) + { + this.setOption("fontSize", e) + }, this.$highlightBrackets = function () + { + this.session.$bracketHighlight && (this.session.removeMarker(this.session.$bracketHighlight), this.session.$bracketHighlight = null); + if (this.$highlightPending) return; + var e = this; + this.$highlightPending = !0, setTimeout(function () + { + e.$highlightPending = !1; + var t = e.session; + if (!t || !t.bgTokenizer) return; + var n = t.findMatchingBracket(e.getCursorPosition()); + if (n) var r = new p(n.row, n.column, n.row, n.column + 1); + else if (t.$mode.getMatching) var r = t.$mode.getMatching(e.session); + r && (t.$bracketHighlight = t.addMarker(r, "ace_bracket", "text")) + }, 50) + }, this.$highlightTags = function () + { + if (this.$highlightTagPending) return; + var e = this; + this.$highlightTagPending = !0, setTimeout(function () + { + e.$highlightTagPending = !1; + var t = e.session; + if (!t || !t.bgTokenizer) return; + var n = e.getCursorPosition(), + r = new y(e.session, n.row, n.column), + i = r.getCurrentToken(); + if (!i || !/\b(?:tag-open|tag-name)/.test(i.type)) + { + t.removeMarker(t.$tagHighlight), t.$tagHighlight = null; + return + } + if (i.type.indexOf("tag-open") != -1) + { + i = r.stepForward(); + if (!i) return + } + var s = i.value, + o = 0, + u = r.stepBackward(); + if (u.value == "<") + { + do u = i, i = r.stepForward(), i && i.value === s && i.type.indexOf("tag-name") !== -1 && (u.value === "<" ? o++ : u.value === "= 0) + } + else + { + do i = u, u = r.stepBackward(), i && i.value === s && i.type.indexOf("tag-name") !== -1 && (u.value === "<" ? o++ : u.value === " 1) && (t = !1) + } + if (e.$highlightLineMarker && !t) e.removeMarker(e.$highlightLineMarker.id), e.$highlightLineMarker = null; + else if (!e.$highlightLineMarker && t) + { + var n = new p(t.row, t.column, t.row, Infinity); + n.id = e.addMarker(n, "ace_active-line", "screenLine"), e.$highlightLineMarker = n + } + else t && (e.$highlightLineMarker.start.row = t.row, e.$highlightLineMarker.end.row = t.row, e.$highlightLineMarker.start.column = t.column, e._signal("changeBackMarker")) + }, this.onSelectionChange = function (e) + { + var t = this.session; + t.$selectionMarker && t.removeMarker(t.$selectionMarker), t.$selectionMarker = null; + if (!this.selection.isEmpty()) + { + var n = this.selection.getRange(), + r = this.getSelectionStyle(); + t.$selectionMarker = t.addMarker(n, "ace_selection", r) + } + else this.$updateHighlightActiveLine(); + var i = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp(); + this.session.highlight(i), this._signal("changeSelection") + }, this.$getSelectionHighLightRegexp = function () + { + var e = this.session, + t = this.getSelectionRange(); + if (t.isEmpty() || t.isMultiLine()) return; + var n = t.start.column, + r = t.end.column, + i = e.getLine(t.start.row), + s = i.substring(n, r); + if (s.length > 5e3 || !/[\w\d]/.test(s)) return; + var o = this.$search.$assembleRegExp( + { + wholeWord: !0, + caseSensitive: !0, + needle: s + }), + u = i.substring(n - 1, r + 1); + if (!o.test(u)) return; + 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(), + n = !1; + if (!e && this.$copyWithEmptySelection) + { + n = !0; + var r = this.selection.getAllRanges(); + for (var i = 0; i < r.length; i++) + { + var s = r[i]; + if (i && r[i - 1].start.row == s.start.row) continue; + e += this.session.getLine(s.start.row) + t + } + } + var o = { + text: e + }; + return this._signal("copy", o), b.lineMode = n ? 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 n = { + text: e, + event: t + }; + this.commands.exec("paste", this, n) + }, this.$handlePaste = function (e) + { + typeof e == "string" && (e = { + text: e + }), this._signal("paste", e); + var t = e.text, + n = t == b.lineMode, + r = this.session; + if (!this.inMultiSelectMode || this.inVirtualSelectionMode) n ? r.insert( + { + row: this.selection.lead.row, + column: 0 + }, t) : this.insert(t); + else if (n) this.selection.rangeList.ranges.forEach(function (e) + { + r.insert( + { + row: e.start.row, + column: 0 + }, t) + }); + else + { + var i = t.split(/\r\n|\r|\n/), + s = this.selection.rangeList.ranges; + if (i.length > s.length || i.length < 2 || !i[1]) return this.commands.exec("insertstring", this, t); + for (var o = s.length; o--;) + { + var u = s[o]; + u.isEmpty() || r.remove(u), r.insert(u.start, i[o]) + } + } + }, this.execCommand = function (e, t) + { + return this.commands.exec(e, this, t) + }, this.insert = function (e, t) + { + var n = this.session, + r = n.getMode(), + i = this.getCursorPosition(); + if (this.getBehavioursEnabled() && !t) + { + var s = r.transformAction(n.getState(i.row), "insertion", this, n, e); + s && (e !== s.text && (this.inVirtualSelectionMode || (this.session.mergeUndoDeltas = !1, this.mergeNextCommand = !1)), e = s.text) + } + e == " " && (e = this.session.getTabString()); + if (!this.selection.isEmpty()) + { + var o = this.getSelectionRange(); + i = this.session.remove(o), this.clearSelection() + } + else if (this.session.getOverwrite() && e.indexOf("\n") == -1) + { + var o = new p.fromPoints(i, i); + o.end.column += e.length, this.session.remove(o) + } + if (e == "\n" || e == "\r\n") + { + var u = n.getLine(i.row); + if (i.column > u.search(/\S|$/)) + { + var a = u.substr(i.column).search(/\S|$/); + n.doc.removeInLine(i.row, i.column, i.column + a) + } + } + this.clearSelection(); + var f = i.column, + l = n.getState(i.row), + u = n.getLine(i.row), + c = r.checkOutdent(l, u, e), + h = n.insert(i, e); + s && s.selection && (s.selection.length == 2 ? this.selection.setSelectionRange(new p(i.row, f + s.selection[0], i.row, f + s.selection[1])) : this.selection.setSelectionRange(new p(i.row + s.selection[0], s.selection[1], i.row + s.selection[2], s.selection[3]))); + if (n.getDocument().isNewLine(e)) + { + var d = r.getNextLineIndent(l, u.slice(0, i.column), n.getTabString()); + n.insert( + { + row: i.row + 1, + column: 0 + }, d) + } + c && r.autoOutdent(l, n, i.row) + }, this.onTextInput = function (e) + { + this.keyBinding.onTextInput(e) + }, this.onCommandKey = function (e, t, n) + { + this.keyBinding.onCommandKey(e, t, n) + }, 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() && (e == "left" ? this.selection.selectLeft() : this.selection.selectRight()); + var t = this.getSelectionRange(); + if (this.getBehavioursEnabled()) + { + var n = this.session, + r = n.getState(t.start.row), + i = n.getMode().transformAction(r, "deletion", this, n, t); + if (t.end.column === 0) + { + var s = n.getTextRange(t); + if (s[s.length - 1] == "\n") + { + var o = n.getLine(t.end.row); + /^\s+$/.test(o) && (t.end.column = o.length) + } + } + i && (t = i) + } + 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.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()) return; + var e = this.getCursorPosition(), + t = e.column; + if (t === 0) return; + var n = this.session.getLine(e.row), + r, i; + t < n.length ? (r = n.charAt(t) + n.charAt(t - 1), i = new p(e.row, t - 1, e.row, t + 1)) : (r = n.charAt(t - 1) + n.charAt(t - 2), i = new p(e.row, t - 2, e.row, t)), this.session.replace(i, r), this.session.selection.moveToPosition(i.end) + }, this.toLowerCase = function () + { + var e = this.getSelectionRange(); + this.selection.isEmpty() && this.selection.selectWord(); + var t = this.getSelectionRange(), + n = this.session.getTextRange(t); + this.session.replace(t, n.toLowerCase()), this.selection.setSelectionRange(e) + }, this.toUpperCase = function () + { + var e = this.getSelectionRange(); + this.selection.isEmpty() && this.selection.selectWord(); + var t = this.getSelectionRange(), + n = this.session.getTextRange(t); + this.session.replace(t, n.toUpperCase()), this.selection.setSelectionRange(e) + }, this.indent = function () + { + var e = this.session, + t = this.getSelectionRange(); + if (t.start.row < t.end.row) + { + var n = this.$getSelectedRows(); + e.indentRows(n.first, n.last, " "); + return + } + if (t.start.column < t.end.column) + { + var r = e.getTextRange(t); + if (!/^\s+$/.test(r)) + { + var n = this.$getSelectedRows(); + e.indentRows(n.first, n.last, " "); + return + } + } + var i = e.getLine(t.start.row), + o = t.start, + u = e.getTabSize(), + a = e.documentToScreenColumn(o.row, o.column); + if (this.session.getUseSoftTabs()) var f = u - a % u, + l = s.stringRepeat(" ", f); + else + { + var f = a % u; + while (i[t.start.column - 1] == " " && f) t.start.column--, f--; + this.selection.setSelectionRange(t), l = " " + } + return this.insert(l) + }, this.blockIndent = function () + { + var e = this.$getSelectedRows(); + this.session.indentRows(e.first, e.last, " ") + }, this.blockOutdent = function () + { + var e = this.session.getSelection(); + this.session.outdentRows(e.getRange()) + }, this.sortLines = function () + { + var e = this.$getSelectedRows(), + t = this.session, + n = []; + for (var r = e.first; r <= e.last; r++) n.push(t.getLine(r)); + n.sort(function (e, t) + { + return e.toLowerCase() < t.toLowerCase() ? -1 : e.toLowerCase() > t.toLowerCase() ? 1 : 0 + }); + var i = new p(0, 0, 0, 0); + for (var r = e.first; r <= e.last; r++) + { + var s = t.getLine(r); + i.start.row = r, i.end.row = r, i.end.column = s.length, t.replace(i, n[r - 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), + n = this.getSelectionRange(); + this.session.getMode().toggleBlockComment(t, this.session, n, e) + }, this.getNumberAt = function (e, t) + { + var n = /[\-]?[0-9]+(?:\.[0-9]+)?/g; + n.lastIndex = 0; + var r = this.session.getLine(e); + while (n.lastIndex < t) + { + var i = n.exec(r); + if (i.index <= t && i.index + i[0].length >= t) + { + var s = { + value: i[0], + start: i.index, + end: i.index + i[0].length + }; + return s + } + } + return null + }, this.modifyNumber = function (e) + { + var t = this.selection.getCursor().row, + n = this.selection.getCursor().column, + r = new p(t, n - 1, t, n), + i = this.session.getTextRange(r); + if (!isNaN(parseFloat(i)) && isFinite(i)) + { + var s = this.getNumberAt(t, n); + if (s) + { + var o = s.value.indexOf(".") >= 0 ? s.start + s.value.indexOf(".") + 1 : s.end, + u = s.start + s.value.length - o, + a = parseFloat(s.value); + a *= Math.pow(10, u), o !== s.end && n < o ? e *= Math.pow(10, s.end - n - 1) : e *= Math.pow(10, s.end - n), a += e, a /= Math.pow(10, u); + var f = a.toFixed(u), + l = new p(t, s.start, t, s.end); + this.session.replace(l, f), this.moveCursorTo(t, Math.max(s.start + 1, n + f.length - s.value.length)) + } + } + }, 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, + n = e.getRange(), + r = e.isBackwards(); + if (n.isEmpty()) + { + var i = n.start.row; + t.duplicateLines(i, i) + } + else + { + var s = r ? n.start : n.end, + o = t.insert(s, t.getTextRange(n), !1); + n.start = s, n.end = o, e.setSelectionRange(n, r) + } + }, this.moveLinesDown = function () + { + this.$moveLines(1, !1) + }, this.moveLinesUp = function () + { + this.$moveLines(-1, !1) + }, this.moveText = function (e, t, n) + { + return this.session.moveText(e, t, n) + }, this.copyLinesUp = function () + { + this.$moveLines(-1, !0) + }, this.copyLinesDown = function () + { + this.$moveLines(1, !0) + }, this.$moveLines = function (e, t) + { + var n, r, i = this.selection; + if (!i.inMultiSelectMode || this.inVirtualSelectionMode) + { + var s = i.toOrientedRange(); + n = this.$getSelectedRows(s), r = this.session.$moveLines(n.first, n.last, t ? 0 : e), t && e == -1 && (r = 0), s.moveBy(r, 0), i.fromOrientedRange(s) + } + else + { + var o = i.rangeList.ranges; + i.rangeList.detach(this.session), this.inVirtualSelectionMode = !0; + var u = 0, + a = 0, + f = o.length; + for (var l = 0; l < f; l++) + { + var c = l; + o[l].moveBy(u, 0), n = this.$getSelectedRows(o[l]); + var h = n.first, + p = n.last; + while (++l < f) + { + a && o[l].moveBy(a, 0); + var d = this.$getSelectedRows(o[l]); + if (t && d.first != p) break; + if (!t && d.first > p + 1) break; + p = d.last + } + l--, u = this.session.$moveLines(h, p, t ? 0 : e), t && e == -1 && (c = l + 1); + while (c <= l) o[c].moveBy(u, 0), c++; + t || (u = 0), a += u + } + i.fromOrientedRange(i.ranges[0]), i.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(this.getCursorPosition()) + }, 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 n = this.renderer, + r = this.renderer.layerConfig, + i = e * Math.floor(r.height / r.lineHeight); + t === !0 ? this.selection.$moveSelection(function () + { + this.moveCursorBy(i, 0) + }) : t === !1 && (this.selection.moveCursorBy(i, 0), this.selection.clearSelection()); + var s = n.scrollTop; + n.scrollBy(0, i * r.lineHeight), t != null && n.scrollCursorIntoView(null, .5), n.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, n, r) + { + this.renderer.scrollToLine(e, t, n, r) + }, 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 n = this.getCursorPosition(), + r = new y(this.session, n.row, n.column), + i = r.getCurrentToken(), + s = i || r.stepForward(); + if (!s) return; + var o, u = !1, + a = {}, + f = n.column - s.start, + l, c = { + ")": "(", + "(": "(", + "]": "[", + "[": "[", + "{": "{", + "}": "{" + }; + do { + if (s.value.match(/[{}()\[\]]/g)) + for (; f < s.value.length && !u; f++) + { + if (!c[s.value[f]]) continue; + l = c[s.value[f]] + "." + s.type.replace("rparen", "lparen"), isNaN(a[l]) && (a[l] = 0); + switch (s.value[f]) + { + case "(": + case "[": + case "{": + a[l]++; + break; + case ")": + case "]": + case "}": + a[l]--, a[l] === -1 && (o = "bracket", u = !0) + } + } + else s.type.indexOf("tag-name") !== -1 && (isNaN(a[s.value]) && (a[s.value] = 0), i.value === "<" ? a[s.value]++ : i.value === "= 0; --s) this.$tryReplace(n[s], e) && r++; + return this.selection.setSelectionRange(i), r + }, this.$tryReplace = function (e, t) + { + var n = this.session.getTextRange(e); + return t = this.$search.replace(n, t), t !== null ? (e.end = this.session.replace(e, t), e) : null + }, this.getLastSearchOptions = function () + { + return this.$search.getOptions() + }, this.find = function (e, t, n) + { + t || (t = {}), typeof e == "string" || e instanceof RegExp ? t.needle = e : typeof e == "object" && r.mixin(t, e); + var i = this.selection.getRange(); + t.needle == null && (e = this.session.getTextRange(i) || this.$search.$options.needle, e || (i = this.session.getWordRange(i.start.row, i.start.column), e = this.session.getTextRange(i)), this.$search.set( + { + needle: e + })), this.$search.set(t), t.start || this.$search.set( + { + start: i + }); + var s = this.$search.find(this.session); + if (t.preventScroll) return s; + if (s) return this.revealRange(s, n), s; + t.backwards ? i.start = i.end : i.end = i.start, this.selection.setRange(i) + }, 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 n = this.renderer.scrollTop; + this.renderer.scrollSelectionIntoView(e.start, e.end, .5), t !== !1 && this.renderer.animateScrolling(n) + }, 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) return; + var t, n = this, + r = !1; + this.$scrollAnchor || (this.$scrollAnchor = document.createElement("div")); + var i = this.$scrollAnchor; + i.style.cssText = "position:absolute", this.container.insertBefore(i, this.container.firstChild); + var s = this.on("changeSelection", function () + { + r = !0 + }), + o = this.renderer.on("beforeRender", function () + { + r && (t = n.renderer.container.getBoundingClientRect()) + }), + u = this.renderer.on("afterRender", function () + { + if (r && t && (n.isFocused() || n.searchBox && n.searchBox.isFocused())) + { + var e = n.renderer, + s = e.$cursorLayer.$pixelPos, + o = e.layerConfig, + u = s.top - o.offset; + s.top >= 0 && u + t.top < 0 ? r = !0 : s.top < o.height && s.top + t.top + o.lineHeight > window.innerHeight ? r = !1 : r = null, r != null && (i.style.top = u + "px", i.style.left = s.left + "px", i.style.height = o.lineHeight + "px", i.scrollIntoView(r)), r = t = null + } + }); + this.setAutoScrollEditorIntoView = function (e) + { + if (e) return; + delete this.setAutoScrollEditorIntoView, this.off("changeSelection", s), this.renderer.off("afterRender", u), this.renderer.off("beforeRender", o) + } + }, this.$resetCursorStyle = function () + { + var e = this.$cursorStyle || "ace", + t = this.renderer.$cursorLayer; + if (!t) return; + t.setSmoothBlinking(/smooth/.test(e)), t.isBlinking = !this.$readOnly && e != "wide", i.setCssClass(t.element, "ace_slim-cursors", /slim/.test(e)) + } + }.call(w.prototype), g.defineOptions(w.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 + }, + hScrollBarAlwaysVisible: "renderer", + vScrollBarAlwaysVisible: "renderer", + highlightGutterLine: "renderer", + animatedScroll: "renderer", + showInvisibles: "renderer", + showPrintMargin: "renderer", + printMarginColumn: "renderer", + printMargin: "renderer", + fadeFoldWidgets: "renderer", + showFoldWidgets: "renderer", + showLineNumbers: "renderer", + showGutter: "renderer", + displayIndentGuides: "renderer", + fontSize: "renderer", + fontFamily: "renderer", + maxLines: "renderer", + minLines: "renderer", + scrollPastEnd: "renderer", + fixedWidthGutter: "renderer", + theme: "renderer", + hasCssTransforms: "renderer", + maxPixelHeight: "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" + }), t.Editor = w +}), define("ace/undomanager", ["require", "exports", "module", "ace/range"], function (e, t, n) +{ + "use strict"; + + function i(e, t) + { + for (var n = t; n--;) + { + var r = e[n]; + if (r && !r[0].ignore) + { + while (n < t - 1) + { + var i = d(e[n], e[n + 1]); + e[n] = i[0], e[n + 1] = i[1], n++ + } + return !0 + } + } + } + + function a(e) + { + var t = e.action == "insert", + n = e.start, + r = e.end, + i = (r.row - n.row) * (t ? 1 : -1), + s = (r.column - n.column) * (t ? 1 : -1); + t && (r = n); + for (var o in this.marks) + { + var a = this.marks[o], + f = u(a, n); + if (f < 0) continue; + if (f === 0 && t) + { + if (a.bias != 1) + { + a.bias == -1; + continue + } + f = 1 + } + var l = t ? f : u(a, r); + if (l > 0) + { + a.row += i, a.column += a.row == r.row ? s : 0; + continue + }!t && l <= 0 && (a.row = n.row, a.column = n.column, l === 0 && (a.bias = 1)) + } + } + + function f(e) + { + return { + row: e.row, + column: e.column + } + } + + function l(e) + { + return { + start: f(e.start), + end: f(e.end), + action: e.action, + lines: e.lines.slice() + } + } + + function c(e) + { + e = e || this; + if (Array.isArray(e)) return e.map(c).join("\n"); + var t = ""; + e.action ? (t = e.action == "insert" ? "+" : "-", t += "[" + e.lines + "]") : e.value && (Array.isArray(e.value) ? t = e.value.map(h).join("\n") : t = h(e.value)), e.start && (t += h(e)); + if (e.id || e.rev) t += " (" + (e.id || e.rev) + ")"; + return t + } + + function h(e) + { + return e.start.row + ":" + e.start.column + "=>" + e.end.row + ":" + e.end.column + } + + function p(e, t) + { + var n = e.action == "insert", + r = t.action == "insert"; + if (n && r) + if (o(t.start, e.end) >= 0) m(t, e, -1); + else + { + if (!(o(t.start, e.start) <= 0)) return null; + m(e, t, 1) + } + else if (n && !r) + if (o(t.start, e.end) >= 0) m(t, e, -1); + else + { + if (!(o(t.end, e.start) <= 0)) return null; + m(e, t, -1) + } + else if (!n && r) + if (o(t.start, e.start) >= 0) m(t, e, 1); + else + { + if (!(o(t.start, e.start) <= 0)) return null; + m(e, t, 1) + } + else if (!n && !r) + if (o(t.start, e.start) >= 0) m(t, e, 1); + else + { + if (!(o(t.end, e.start) <= 0)) return null; + m(e, t, -1) + } + return [t, e] + } + + function d(e, t) + { + for (var n = e.length; n--;) + for (var r = 0; r < t.length; r++) + if (!p(e[n], t[r])) + { + while (n < e.length) + { + while (r--) p(t[r], e[n]); + r = t.length, n++ + } + return [e, t] + } + return e.selectionBefore = t.selectionBefore = e.selectionAfter = t.selectionAfter = null, [t, e] + } + + function v(e, t) + { + var n = e.action == "insert", + r = t.action == "insert"; + if (n && r) o(e.start, t.start) < 0 ? m(t, e, 1) : m(e, t, 1); + else if (n && !r) o(e.start, t.end) >= 0 ? m(e, t, -1) : o(e.start, t.start) <= 0 ? m(t, e, 1) : (m(e, s.fromPoints(t.start, e.start), -1), m(t, e, 1)); + else if (!n && r) o(t.start, e.end) >= 0 ? m(t, e, -1) : o(t.start, e.start) <= 0 ? m(e, t, 1) : (m(t, s.fromPoints(e.start, t.start), -1), m(e, t, 1)); + else if (!n && !r) + if (o(t.start, e.end) >= 0) m(t, e, -1); + else + { + if (!(o(t.end, e.start) <= 0)) + { + var i, u; + return o(e.start, t.start) < 0 && (i = e, e = y(e, t.start)), o(e.end, t.end) > 0 && (u = y(e, t.end)), g(t.end, e.start, e.end, -1), u && !i && (e.lines = u.lines, e.start = u.start, e.end = u.end, u = e), [t, i, u].filter(Boolean) + } + m(e, t, -1) + } + return [t, e] + } + + function m(e, t, n) + { + g(e.start, t.start, t.end, n), g(e.end, t.start, t.end, n) + } + + function g(e, t, n, r) + { + e.row == (r == 1 ? t : n).row && (e.column += r * (n.column - t.column)), e.row += r * (n.row - t.row) + } + + function y(e, t) + { + var n = e.lines, + r = e.end; + e.end = f(t); + var i = e.end.row - e.start.row, + s = n.splice(i, n.length), + o = i ? t.column : t.column - e.start.column; + n.push(s[0].substring(0, o)), s[0] = s[0].substr(o); + var u = { + start: f(t), + end: r, + lines: s, + action: e.action + }; + return u + } + + function b(e, t) + { + t = l(t); + for (var n = e.length; n--;) + { + var r = e[n]; + for (var i = 0; i < r.length; i++) + { + var s = r[i], + o = v(s, t); + t = o[0], o.length != 2 && (o[2] ? (r.splice(i + 1, 1, o[1], o[2]), i++) : o[1] || (r.splice(i, 1), i--)) + } + r.length || e.splice(n, 1) + } + return e + } + + function w(e, t) + { + for (var n = 0; n < t.length; n++) + { + var r = t[n]; + for (var i = 0; i < r.length; i++) b(e, r[i]) + } + } + var r = function () + { + this.$maxRev = 0, this.$fromUndo = !1, this.reset() + }; + (function () + { + this.addSession = function (e) + { + this.$session = e + }, this.add = function (e, t, n) + { + if (this.$fromUndo) return; + if (e == this.$lastDelta) return; + if (t === !1 || !this.lastDeltas) this.lastDeltas = [], this.$undoStack.push(this.lastDeltas), e.id = this.$rev = ++this.$maxRev; + if (e.action == "remove" || e.action == "insert") 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) + { + t == null && (t = this.$rev + 1); + var n = this.$undoStack; + for (var r = n.length; r--;) + { + var i = n[r][0]; + if (i.id <= e) break; + i.id < t && (i.ignore = !0) + } + this.lastDeltas = null + }, this.getSelection = function (e, t) + { + var n = this.selections; + for (var r = n.length; r--;) + { + var i = n[r]; + if (i.rev < e) return t && (i = n[r + 1]), i + } + }, this.getRevision = function () + { + return this.$rev + }, this.getDeltas = function (e, t) + { + t == null && (t = this.$rev + 1); + var n = this.$undoStack, + r = null, + i = 0; + for (var s = n.length; s--;) + { + var o = n[s][0]; + o.id < t && !r && (r = s + 1); + if (o.id <= e) + { + i = s + 1; + break + } + } + return n.slice(i, r) + }, this.getChangedRanges = function (e, t) + { + t == null && (t = this.$rev + 1) + }, this.getChangedLines = function (e, t) + { + t == null && (t = this.$rev + 1) + }, this.undo = function (e, t) + { + this.lastDeltas = null; + var n = this.$undoStack; + if (!i(n, n.length)) return; + e || (e = this.$session), this.$redoStackBaseRev !== this.$rev && this.$redoStack.length && (this.$redoStack = []), this.$fromUndo = !0; + var r = n.pop(), + s = null; + return r && r.length && (s = e.undoChanges(r, t), this.$redoStack.push(r), this.$syncRev()), this.$fromUndo = !1, s + }, this.redo = function (e, t) + { + this.lastDeltas = null, e || (e = this.$session), this.$fromUndo = !0; + if (this.$redoStackBaseRev != this.$rev) + { + var n = this.getDeltas(this.$redoStackBaseRev, this.$rev + 1); + w(this.$redoStack, n), this.$redoStackBaseRev = this.$rev, this.$redoStack.forEach(function (e) + { + e[0].id = ++this.$maxRev + }, this) + } + var r = this.$redoStack.pop(), + i = null; + return r && (i = e.redoChanges(r, t), this.$undoStack.push(r), this.$syncRev()), this.$fromUndo = !1, i + }, this.$syncRev = function () + { + var e = this.$undoStack, + t = e[e.length - 1], + n = t && t[0].id || 0; + this.$redoStackBaseRev = n, this.$rev = n + }, 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) + { + e == undefined && (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 ? c(e) : c(this.$undoStack) + "\n---\n" + c(this.$redoStack) + } + }).call(r.prototype); + var s = e("./range").Range, + o = s.comparePoints, + u = s.comparePoints; + t.UndoManager = r +}), define("ace/layer/gutter", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/dom"), + i = e("../lib/oop"), + s = e("../lib/lang"), + o = e("../lib/event_emitter").EventEmitter, + u = function (e) + { + this.element = r.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.$cells = [] + }; + (function () + { + i.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 n = e[t], + r = n.row, + i = this.$annotations[r]; + i || (i = this.$annotations[r] = { + text: [] + }); + var o = n.text; + o = o ? s.escapeHTML(o) : n.html || "", i.text.indexOf(o) === -1 && i.text.push(o); + var u = n.type; + u == "error" ? i.className = " ace_error" : u == "warning" && i.className != " ace_error" ? i.className = " ace_warning" : u == "info" && !i.className && (i.className = " ace_info") + } + }, this.$updateAnnotations = function (e) + { + if (!this.$annotations.length) return; + var t = e.start.row, + n = e.end.row - t; + if (n !== 0) + if (e.action == "remove") this.$annotations.splice(t, n + 1, null); + else + { + var r = new Array(n + 1); + r.unshift(t, 1), this.$annotations.splice.apply(this.$annotations, r) + } + }, this.update = function (e) + { + var t = this.session, + n = e.firstRow, + i = Math.min(e.lastRow + e.gutterOffset, t.getLength() - 1), + s = t.getNextFoldLine(n), + o = s ? s.start.row : Infinity, + u = this.$showFoldWidgets && t.foldWidgets, + a = t.$breakpoints, + f = t.$decorations, + l = t.$firstLineNumber, + c = 0, + h = t.gutterRenderer || this.$renderer, + p = null, + d = -1, + v = n; + for (;;) + { + v > o && (v = s.end.row + 1, s = t.getNextFoldLine(v, s), o = s ? s.start.row : Infinity); + if (v > i) + { + while (this.$cells.length > d + 1) p = this.$cells.pop(), this.element.removeChild(p.element); + break + } + p = this.$cells[++d], p || (p = { + element: null, + textNode: null, + foldWidget: null + }, p.element = r.createElement("div"), p.textNode = document.createTextNode(""), p.element.appendChild(p.textNode), this.element.appendChild(p.element), this.$cells[d] = p); + var m = "ace_gutter-cell "; + a[v] && (m += a[v]), f[v] && (m += f[v]), this.$annotations[v] && (m += this.$annotations[v].className), p.element.className != m && (p.element.className = m); + var g = t.getRowLength(v) * e.lineHeight + "px"; + g != p.element.style.height && (p.element.style.height = g); + if (u) + { + var y = u[v]; + y == null && (y = u[v] = t.getFoldWidget(v)) + } + if (y) + { + p.foldWidget || (p.foldWidget = r.createElement("span"), p.element.appendChild(p.foldWidget)); + var m = "ace_fold-widget ace_" + y; + y == "start" && v == o && v < s.end.row ? m += " ace_closed" : m += " ace_open", p.foldWidget.className != m && (p.foldWidget.className = m); + var g = e.lineHeight + "px"; + p.foldWidget.style.height != g && (p.foldWidget.style.height = g) + } + else p.foldWidget && (p.element.removeChild(p.foldWidget), p.foldWidget = null); + var b = c = h ? h.getText(t, v) : v + l; + b !== p.textNode.data && (p.textNode.data = b), v++ + } + this.element.style.height = e.minHeight + "px"; + if (this.$fixedWidth || t.$useWrapMode) c = t.getLength() + l; + var w = h ? h.getWidth(t, c, e) : c.toString().length * e.characterWidth, + E = this.$padding || this.$computePadding(); + w += E.left + E.right, w !== this.gutterWidth && !isNaN(w) && (this.gutterWidth = w, this.element.style.width = Math.ceil(this.gutterWidth) + "px", this._emit("changeGutterWidth", w)) + }, this.$fixedWidth = !1, this.$showLineNumbers = !0, this.$renderer = "", this.setShowLineNumbers = function (e) + { + this.$renderer = !e && + { + getWidth: function () + { + return "" + }, + getText: function () + { + return "" + } + } + }, this.getShowLineNumbers = function () + { + return this.$showLineNumbers + }, this.$showFoldWidgets = !0, this.setShowFoldWidgets = function (e) + { + e ? r.addCssClass(this.element, "ace_folding-enabled") : r.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 = r.computedStyle(this.element.firstChild); + return this.$padding = {}, this.$padding.left = parseInt(e.paddingLeft) + 1 || 0, this.$padding.right = parseInt(e.paddingRight) || 0, this.$padding + }, this.getRegion = function (e) + { + var t = this.$padding || this.$computePadding(), + n = this.element.getBoundingClientRect(); + if (e.x < t.left + n.left) return "markers"; + if (this.$showFoldWidgets && e.x > n.right - t.right) return "foldWidgets" + } + }).call(u.prototype), t.Gutter = u +}), define("ace/layer/marker", ["require", "exports", "module", "ace/range", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + var r = e("../range").Range, + i = e("../lib/dom"), + s = function (e) + { + this.element = i.createElement("div"), this.element.className = "ace_layer ace_marker-layer", e.appendChild(this.element) + }; + (function () + { + function e(e, t, n, r) + { + return (e ? 1 : 0) | (t ? 2 : 0) | (n ? 4 : 0) | (r ? 8 : 0) + } + 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.update = function (e) + { + if (!e) return; + this.config = e; + var t = []; + for (var n in this.markers) + { + var r = this.markers[n]; + if (!r.range) + { + r.update(t, this, this.session, e); + continue + } + var i = r.range.clipRows(e.firstRow, e.lastRow); + if (i.isEmpty()) continue; + i = i.toScreenRange(this.session); + if (r.renderer) + { + var s = this.$getTop(i.start.row, e), + o = this.$padding + (this.session.$bidiHandler.isBidiRow(i.start.row) ? this.session.$bidiHandler.getPosLeft(i.start.column) : i.start.column * e.characterWidth); + r.renderer(t, i, o, s, e) + } + else r.type == "fullLine" ? this.drawFullLineMarker(t, i, r.clazz, e) : r.type == "screenLine" ? this.drawScreenLineMarker(t, i, r.clazz, e) : i.isMultiLine() ? r.type == "text" ? this.drawTextMarker(t, i, r.clazz, e) : this.drawMultiLineMarker(t, i, r.clazz, e) : this.session.$bidiHandler.isBidiRow(i.start.row) ? this.drawBidiSingleLineMarker(t, i, r.clazz + " ace_start" + " ace_br15", e) : this.drawSingleLineMarker(t, i, r.clazz + " ace_start" + " ace_br15", e) + } + this.element.innerHTML = t.join("") + }, this.$getTop = function (e, t) + { + return (e - t.firstRowScreen) * t.lineHeight + }, this.drawTextMarker = function (t, n, i, s, o) + { + var u = this.session, + a = n.start.row, + f = n.end.row, + l = a, + c = 0, + h = 0, + p = u.getScreenLastRowColumn(l), + d = null, + v = new r(l, n.start.column, l, h); + for (; l <= f; l++) v.start.row = v.end.row = l, v.start.column = l == a ? n.start.column : u.getRowWrapIndent(l), v.end.column = p, c = h, h = p, p = l + 1 < f ? u.getScreenLastRowColumn(l + 1) : l == f ? 0 : n.end.column, d = i + (l == a ? " ace_start" : "") + " ace_br" + e(l == a || l == a + 1 && n.start.column, c < h, h > p, l == f), this.session.$bidiHandler.isBidiRow(l) ? this.drawBidiSingleLineMarker(t, v, d, s, l == f ? 0 : 1, o) : this.drawSingleLineMarker(t, v, d, s, l == f ? 0 : 1, o) + }, this.drawMultiLineMarker = function (e, t, n, r, i) + { + var s = this.$padding, + o, u, a; + i = i || ""; + if (this.session.$bidiHandler.isBidiRow(t.start.row)) + { + var f = t.clone(); + f.end.row = f.start.row, f.end.column = this.session.getLine(f.start.row).length, this.drawBidiSingleLineMarker(e, f, n + " ace_br1 ace_start", r, null, i) + } + else o = r.lineHeight, u = this.$getTop(t.start.row, r), a = s + t.start.column * r.characterWidth, e.push("
"); + if (this.session.$bidiHandler.isBidiRow(t.end.row)) + { + var f = t.clone(); + f.start.row = f.end.row, f.start.column = 0, this.drawBidiSingleLineMarker(e, f, n + " ace_br12", r, null, i) + } + else + { + var l = t.end.column * r.characterWidth; + o = r.lineHeight, u = this.$getTop(t.end.row, r), e.push("
") + } + o = (t.end.row - t.start.row - 1) * r.lineHeight; + if (o <= 0) return; + u = this.$getTop(t.start.row + 1, r); + var c = (t.start.column ? 1 : 0) | (t.end.column ? 0 : 8); + e.push("
") + }, this.drawSingleLineMarker = function (e, t, n, r, i, s) + { + var o = r.lineHeight, + u = (t.end.column + (i || 0) - t.start.column) * r.characterWidth, + a = this.$getTop(t.start.row, r), + f = this.$padding + t.start.column * r.characterWidth; + e.push("
") + }, this.drawBidiSingleLineMarker = function (e, t, n, r, i, s) + { + var o = r.lineHeight, + u = this.$getTop(t.start.row, r), + a = this.$padding, + f = this.session.$bidiHandler.getSelections(t.start.column, t.end.column); + f.forEach(function (t) + { + e.push("
") + }) + }, this.drawFullLineMarker = function (e, t, n, r, i) + { + var s = this.$getTop(t.start.row, r), + o = r.lineHeight; + t.start.row != t.end.row && (o += this.$getTop(t.end.row, r) - s), e.push("
") + }, this.drawScreenLineMarker = function (e, t, n, r, i) + { + var s = this.$getTop(t.start.row, r), + o = r.lineHeight; + e.push("
") + } + }).call(s.prototype), t.Marker = s +}), define("ace/layer/text", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/oop"), + i = e("../lib/dom"), + s = e("../lib/lang"), + o = e("../lib/useragent"), + u = e("../lib/event_emitter").EventEmitter, + a = function (e) + { + this.element = i.createElement("div"), this.element.className = "ace_layer ace_text-layer", e.appendChild(this.element), this.$updateEolChar = this.$updateEolChar.bind(this) + }; + (function () + { + r.implement(this, u), 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.getNewLineCharacter() == "\n" ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF; + if (this.EOL_CHAR != e) return this.EOL_CHAR = e, !0 + }, this.setPadding = function (e) + { + this.$padding = e, this.element.style.padding = "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 ? !1 : (this.showInvisibles = e, this.$computeTabString(), !0) + }, this.displayIndentGuides = !0, this.setDisplayIndentGuides = function (e) + { + return this.displayIndentGuides == e ? !1 : (this.displayIndentGuides = e, this.$computeTabString(), !0) + }, this.$tabStrings = [], this.onChangeTabSize = this.$computeTabString = function () + { + var e = this.session.getTabSize(); + this.tabSize = e; + var t = this.$tabStrings = [0]; + for (var n = 1; n < e + 1; n++) this.showInvisibles ? t.push("" + s.stringRepeat(this.TAB_CHAR, n) + "") : t.push(s.stringRepeat(" ", n)); + if (this.displayIndentGuides) + { + this.$indentGuideRe = /\s\S| \t|\t |\s$/; + var r = "ace_indent-guide", + i = "", + o = ""; + if (this.showInvisibles) + { + r += " ace_invisible", i = " ace_invisible_space", o = " ace_invisible_tab"; + var u = s.stringRepeat(this.SPACE_CHAR, this.tabSize), + a = s.stringRepeat(this.TAB_CHAR, this.tabSize) + } + else var u = s.stringRepeat(" ", this.tabSize), + a = u; + this.$tabStrings[" "] = "" + u + "", this.$tabStrings[" "] = "" + a + "" + } + }, this.updateLines = function (e, t, n) + { + (this.config.lastRow != e.lastRow || this.config.firstRow != e.firstRow) && this.scrollLines(e), this.config = e; + var r = Math.max(t, e.firstRow), + i = Math.min(n, e.lastRow), + s = this.element.childNodes, + o = 0; + for (var u = e.firstRow; u < r; u++) + { + var a = this.session.getFoldLine(u); + if (a) + { + if (a.containsRow(r)) + { + r = a.start.row; + break + } + u = a.end.row + } + o++ + } + var u = r, + a = this.session.getNextFoldLine(u), + f = a ? a.start.row : Infinity; + for (;;) + { + u > f && (u = a.end.row + 1, a = this.session.getNextFoldLine(u, a), f = a ? a.start.row : Infinity); + if (u > i) break; + var l = s[o++]; + if (l) + { + var c = []; + this.$renderLine(c, u, !this.$useLineGroups(), u == f ? a : !1), l.style.height = e.lineHeight * this.session.getRowLength(u) + "px", l.innerHTML = c.join("") + } + u++ + } + }, this.scrollLines = function (e) + { + var t = this.config; + this.config = e; + if (!t || t.lastRow < e.firstRow) return this.update(e); + if (e.lastRow < t.firstRow) return this.update(e); + var n = this.element; + if (t.firstRow < e.firstRow) + for (var r = this.session.getFoldedRowCount(t.firstRow, e.firstRow - 1); r > 0; r--) n.removeChild(n.firstChild); + if (t.lastRow > e.lastRow) + for (var r = this.session.getFoldedRowCount(e.lastRow + 1, t.lastRow); r > 0; r--) n.removeChild(n.lastChild); + if (e.firstRow < t.firstRow) + { + var i = this.$renderLinesFragment(e, e.firstRow, t.firstRow - 1); + n.firstChild ? n.insertBefore(i, n.firstChild) : n.appendChild(i) + } + if (e.lastRow > t.lastRow) + { + var i = this.$renderLinesFragment(e, t.lastRow + 1, e.lastRow); + n.appendChild(i) + } + }, this.$renderLinesFragment = function (e, t, n) + { + var r = this.element.ownerDocument.createDocumentFragment(), + s = t, + o = this.session.getNextFoldLine(s), + u = o ? o.start.row : Infinity; + for (;;) + { + s > u && (s = o.end.row + 1, o = this.session.getNextFoldLine(s, o), u = o ? o.start.row : Infinity); + if (s > n) break; + var a = i.createElement("div"), + f = []; + this.$renderLine(f, s, !1, s == u ? o : !1), a.innerHTML = f.join(""); + if (this.$useLineGroups()) a.className = "ace_line_group", r.appendChild(a), a.style.height = e.lineHeight * this.session.getRowLength(s) + "px"; + else + while (a.firstChild) r.appendChild(a.firstChild); + s++ + } + return r + }, this.update = function (e) + { + this.config = e; + var t = [], + n = e.firstRow, + r = e.lastRow, + i = n, + s = this.session.getNextFoldLine(i), + o = s ? s.start.row : Infinity; + for (;;) + { + i > o && (i = s.end.row + 1, s = this.session.getNextFoldLine(i, s), o = s ? s.start.row : Infinity); + if (i > r) break; + this.$useLineGroups() && t.push("
"), this.$renderLine(t, i, !1, i == o ? s : !1), this.$useLineGroups() && t.push("
"), i++ + } + this.element.innerHTML = t.join("") + }, this.$textToken = { + text: !0, + rparen: !0, + lparen: !0 + }, this.$renderToken = function (e, t, n, r) + { + var i = this, + o = /\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF\uFFF9-\uFFFC])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\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, + u = function (e, n, r, o, u) + { + if (n) return i.showInvisibles ? "" + s.stringRepeat(i.SPACE_CHAR, e.length) + "" : e; + if (e == "&") return "&"; + if (e == "<") return "<"; + if (e == ">") return ">"; + if (e == " ") + { + var a = i.session.getScreenTabSize(t + o); + return t += a - 1, i.$tabStrings[a] + } + if (e == " ") + { + var f = i.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk", + l = i.showInvisibles ? i.SPACE_CHAR : ""; + return t += 1, "" + l + "" + } + return r ? "" + i.SPACE_CHAR + "" : (t += 1, "" + e + "") + }, + a = r.replace(o, u); + if (!this.$textToken[n.type]) + { + var f = "ace_" + n.type.replace(/\./g, " ace_"), + l = ""; + n.type == "fold" && (l = " style='width:" + n.value.length * this.config.characterWidth + "px;' "), e.push("", a, "") + } + else e.push(a); + return t + r.length + }, this.renderIndentGuide = function (e, t, n) + { + var r = t.search(this.$indentGuideRe); + return r <= 0 || r >= n ? t : t[0] == " " ? (r -= r % this.tabSize, e.push(s.stringRepeat(this.$tabStrings[" "], r / this.tabSize)), t.substr(r)) : t[0] == " " ? (e.push(s.stringRepeat(this.$tabStrings[" "], r)), t.substr(r)) : t + }, this.$renderWrappedLine = function (e, t, n, r) + { + var i = 0, + o = 0, + u = n[0], + a = 0; + for (var f = 0; f < t.length; f++) + { + var l = t[f], + c = l.value; + if (f == 0 && this.displayIndentGuides) + { + i = c.length, c = this.renderIndentGuide(e, c, u); + if (!c) continue; + i -= c.length + } + if (i + c.length < u) a = this.$renderToken(e, a, l, c), i += c.length; + else + { + while (i + c.length >= u) a = this.$renderToken(e, a, l, c.substring(0, u - i)), c = c.substring(u - i), i = u, r || e.push("
", "
"), e.push(s.stringRepeat(" ", n.indent)), o++, a = 0, u = n[o] || Number.MAX_VALUE; + c.length != 0 && (i += c.length, a = this.$renderToken(e, a, l, c)) + } + } + }, this.$renderSimpleLine = function (e, t) + { + var n = 0, + r = t[0], + i = r.value; + this.displayIndentGuides && (i = this.renderIndentGuide(e, i)), i && (n = this.$renderToken(e, n, r, i)); + for (var s = 1; s < t.length; s++) + { + r = t[s], i = r.value; + if (n + i.length > this.MAX_LINE_LENGTH) return this.$renderOverflowMessage(e, n, r, i); + n = this.$renderToken(e, n, r, i) + } + }, this.$renderOverflowMessage = function (e, t, n, r) + { + this.$renderToken(e, t, n, r.slice(0, this.MAX_LINE_LENGTH - t)), e.push("<click to see more...>") + }, this.$renderLine = function (e, t, n, r) + { + !r && r != 0 && (r = this.session.getFoldLine(t)); + if (r) var i = this.$getFoldLineTokens(t, r); + else var i = this.session.getTokens(t); + n || e.push("
"); + if (i.length) + { + var s = this.session.getRowSplitData(t); + s && s.length ? this.$renderWrappedLine(e, i, s, n) : this.$renderSimpleLine(e, i) + } + this.showInvisibles && (r && (t = r.end.row), e.push("", t == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR, "")), n || e.push("
") + }, this.$getFoldLineTokens = function (e, t) + { + function i(e, t, n) + { + var i = 0, + s = 0; + while (s + e[i].value.length < t) + { + s += e[i].value.length, i++; + if (i == e.length) return + } + if (s != t) + { + var o = e[i].value.substring(t - s); + o.length > n - t && (o = o.substring(0, n - t)), r.push( + { + type: e[i].type, + value: o + }), s = t + o.length, i += 1 + } + while (s < n && i < e.length) + { + var o = e[i].value; + o.length + s > n ? r.push( + { + type: e[i].type, + value: o.substring(0, n - s) + }) : r.push(e[i]), s += o.length, i += 1 + } + } + var n = this.session, + r = [], + s = n.getTokens(e); + return t.walk(function (e, t, o, u, a) + { + e != null ? r.push( + { + type: "fold", + value: e + }) : (a && (s = n.getTokens(t)), s.length && i(s, u, o)) + }, t.end.row, this.session.getLine(t.end.row).length), r + }, this.$useLineGroups = function () + { + return this.session.getUseWrapMode() + }, this.destroy = function () + { + clearInterval(this.$pollSizeChangesTimer), this.$measureNode && this.$measureNode.parentNode.removeChild(this.$measureNode), delete this.$measureNode + } + }).call(a.prototype), t.Text = a +}), define("ace/layer/cursor", ["require", "exports", "module", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + var r = e("../lib/dom"), + i, s = function (e) + { + this.element = r.createElement("div"), this.element.className = "ace_layer ace_cursor-layer", e.appendChild(this.element), i === undefined && (i = !("opacity" in this.element.style)), this.isVisible = !1, this.isBlinking = !0, this.blinkInterval = 1e3, this.smoothBlinking = !1, this.cursors = [], this.cursor = this.addCursor(), r.addCssClass(this.element, "ace_hidden-cursors"), this.$updateCursors = (i ? this.$updateVisibility : this.$updateOpacity).bind(this) + }; + (function () + { + this.$updateVisibility = function (e) + { + var t = this.cursors; + for (var n = t.length; n--;) t[n].style.visibility = e ? "" : "hidden" + }, this.$updateOpacity = function (e) + { + var t = this.cursors; + for (var n = t.length; n--;) t[n].style.opacity = e ? "" : "0" + }, this.$startCssAnimation = function () + { + var e = this.cursors; + for (var t = e.length; t--;) e[t].style.animationDuration = this.blinkInterval + "ms"; + setTimeout(function () + { + r.addCssClass(this.element, "ace_animate-blinking") + }.bind(this)) + }, this.$stopCssAnimation = function () + { + r.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 && !i && (this.smoothBlinking = e, r.setCssClass(this.element, "ace_smooth-blinking", e), this.$updateCursors(!0), this.$updateCursors = this.$updateOpacity.bind(this), this.restartTimer()) + }, this.addCursor = function () + { + var e = r.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, r.addCssClass(this.element, "ace_hidden-cursors"), this.restartTimer() + }, this.showCursor = function () + { + this.isVisible = !0, r.removeCssClass(this.element, "ace_hidden-cursors"), this.restartTimer() + }, this.restartTimer = function () + { + var e = this.$updateCursors; + clearInterval(this.intervalId), clearTimeout(this.timeoutId), this.$stopCssAnimation(), this.smoothBlinking && r.removeCssClass(this.element, "ace_smooth-blinking"), e(!0); + if (!this.isBlinking || !this.blinkInterval || !this.isVisible) return; + this.smoothBlinking && setTimeout(function () + { + r.addCssClass(this.element, "ace_smooth-blinking") + }.bind(this)); + if (r.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() + } + }, this.getPixelPosition = function (e, t) + { + if (!this.config || !this.session) return { + left: 0, + top: 0 + }; + e || (e = this.session.selection.getCursor()); + var n = this.session.documentToScreenPosition(e), + r = this.$padding + (this.session.$bidiHandler.isBidiRow(n.row, e.row) ? this.session.$bidiHandler.getPosLeft(n.column) : n.column * this.config.characterWidth), + i = (n.row - (t ? this.config.firstRowScreen : 0)) * this.config.lineHeight; + return { + left: r, + top: i + } + }, this.update = function (e) + { + this.config = e; + var t = this.session.$selectionMarkers, + n = 0, + r = 0; + if (t === undefined || t.length === 0) t = [ + { + cursor: null + }]; + for (var n = 0, i = t.length; n < i; n++) + { + var s = this.getPixelPosition(t[n].cursor, !0); + if ((s.top > e.height + e.offset || s.top < 0) && n > 1) continue; + var o = (this.cursors[r++] || this.addCursor()).style; + this.drawCursor ? this.drawCursor(o, s, e, t[n], this.session) : (o.left = s.left + "px", o.top = s.top + "px", o.width = e.characterWidth + "px", o.height = e.lineHeight + "px") + } + while (this.cursors.length > r) this.removeCursor(); + var u = this.session.getOverwrite(); + this.$setOverwrite(u), this.$pixelPos = s, this.restartTimer() + }, this.drawCursor = null, this.$setOverwrite = function (e) + { + e != this.overwrite && (this.overwrite = e, e ? r.addCssClass(this.element, "ace_overwrite-cursors") : r.removeCssClass(this.element, "ace_overwrite-cursors")) + }, this.destroy = function () + { + clearInterval(this.intervalId), clearTimeout(this.timeoutId) + } + }).call(s.prototype), t.Cursor = s +}), define("ace/scrollbar", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/dom"), + s = e("./lib/event"), + o = e("./lib/event_emitter").EventEmitter, + u = 32768, + a = function (e) + { + this.element = i.createElement("div"), this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix, this.inner = i.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 () + { + r.implement(this, o), this.setVisible = function (e) + { + this.element.style.display = e ? "" : "none", this.isVisible = e, this.coeff = 1 + } + }).call(a.prototype); + var f = function (e, t) + { + a.call(this, e), this.scrollTop = 0, this.scrollHeight = 0, t.$scrollbarWidth = this.width = i.scrollbarWidth(e.ownerDocument), this.inner.style.width = this.element.style.width = (this.width || 15) + 5 + "px", this.$minWidth = 0 + }; + r.inherits(f, a), + function () + { + this.classSuffix = "-v", this.onScroll = function () + { + if (!this.skipEvent) + { + this.scrollTop = this.element.scrollTop; + if (this.coeff != 1) + { + 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 > u ? (this.coeff = u / e, e = u) : this.coeff != 1 && (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(f.prototype); + var l = function (e, t) + { + a.call(this, e), this.scrollLeft = 0, this.height = t.$scrollbarWidth, this.inner.style.height = this.element.style.height = (this.height || 15) + 5 + "px" + }; + r.inherits(l, a), + 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(l.prototype), t.ScrollBar = f, t.ScrollBarV = f, t.ScrollBarH = l, t.VScrollBar = f, t.HScrollBar = l +}), define("ace/renderloop", ["require", "exports", "module", "ace/lib/event"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/event"), + i = function (e, t) + { + this.onRender = e, this.pending = !1, this.changes = 0, this.window = t || window + }; + (function () + { + this.schedule = function (e) + { + this.changes = this.changes | e; + if (this.changes) + { + var t = this; + r.nextFrame(function (e) + { + var n = t.changes; + n && (r.blockIdle(100), t.changes = 0, t.onRender(n)), t.changes && t.schedule() + }) + } + } + }).call(i.prototype), t.RenderLoop = i +}), define("ace/layer/font_metrics", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/event", "ace/lib/useragent", "ace/lib/event_emitter"], function (e, t, n) +{ + var r = e("../lib/oop"), + i = e("../lib/dom"), + s = e("../lib/lang"), + o = e("../lib/event"), + u = e("../lib/useragent"), + a = e("../lib/event_emitter").EventEmitter, + f = 256, + l = typeof ResizeObserver == "function", + c = 200, + h = t.FontMetrics = function (e) + { + this.el = i.createElement("div"), this.$setMeasureNodeStyles(this.el.style, !0), this.$main = i.createElement("div"), this.$setMeasureNodeStyles(this.$main.style), this.$measureNode = i.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", f), this.$characterSize = { + width: 0, + height: 0 + }, l ? this.$addObserver() : this.checkForSizeChanges() + }; + (function () + { + r.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", u.isIE < 8 ? e["font-family"] = "inherit" : e.font = "inherit", e.overflow = t ? "hidden" : "visible" + }, this.checkForSizeChanges = function (e) + { + e === undefined && (e = this.$measureSizes()); + if (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 n = t[0].contentRect; + e.checkForSizeChanges( + { + height: n.height, + width: n.width / f + }) + }), 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 / f + }; + return t.width === 0 || t.height === 0 ? null : t + }, this.$measureCharWidth = function (e) + { + this.$main.innerHTML = s.stringRepeat(e, f); + var t = this.$main.getBoundingClientRect(); + return t.width / f + }, this.getCharacterWidth = function (e) + { + var t = this.charSizes[e]; + return t === undefined && (t = this.charSizes[e] = this.$measureCharWidth(e) / this.$characterSize.width), t + }, this.destroy = function () + { + clearInterval(this.$pollSizeChangesTimer), 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 = i.buildDom([e(0, 0), e(c, 0), e(0, c), e(c, c)], this.el) + }, this.transformCoordinates = function (e, t) + { + function r(e, t, n) + { + var r = e[1] * t[0] - e[0] * t[1]; + return [(-t[1] * n[0] + t[0] * n[1]) / r, (+e[1] * n[0] - e[0] * n[1]) / r] + } + + function i(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 u(e) + { + var t = e.getBoundingClientRect(); + return [t.left, t.top] + } + if (e) + { + var n = this.$getZoom(this.el); + e = o(1 / n, e) + } + this.els || this.$initTransformMeasureNodes(); + var a = u(this.els[0]), + f = u(this.els[1]), + l = u(this.els[2]), + h = u(this.els[3]), + p = r(i(h, f), i(h, l), i(s(f, l), s(h, a))), + d = o(1 + p[0], i(f, a)), + v = o(1 + p[1], i(l, a)); + if (t) + { + var m = t, + g = p[0] * m[0] / c + p[1] * m[1] / c + 1, + y = s(o(m[0], d), o(m[1], v)); + return s(o(1 / g / c, y), a) + } + var b = i(e, a), + w = r(i(d, o(p[0], b)), i(v, o(p[1], b)), b); + return o(c, w) + } + }).call(h.prototype) +}), define("ace/virtual_renderer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/config", "ace/lib/useragent", "ace/layer/gutter", "ace/layer/marker", "ace/layer/text", "ace/layer/cursor", "ace/scrollbar", "ace/scrollbar", "ace/renderloop", "ace/layer/font_metrics", "ace/lib/event_emitter"], function (e, t, n) +{ + "use strict"; + var r = e("./lib/oop"), + i = e("./lib/dom"), + s = e("./config"), + o = e("./lib/useragent"), + u = e("./layer/gutter").Gutter, + a = e("./layer/marker").Marker, + f = e("./layer/text").Text, + l = e("./layer/cursor").Cursor, + c = e("./scrollbar").HScrollBar, + h = e("./scrollbar").VScrollBar, + p = e("./renderloop").RenderLoop, + d = e("./layer/font_metrics").FontMetrics, + v = e("./lib/event_emitter").EventEmitter, + m = '.ace_editor {position: relative;overflow: hidden;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;box-sizing: border-box;min-width: 100%;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {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==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {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==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;text-indent: -1em;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: inherit;color: inherit;z-index: 1000;opacity: 1;text-indent: 0;}[ace_nocontext=true] {transform: none!important;filter: none!important;perspective: none!important;clip-path: none!important;mask : none!important;contain: none!important;perspective: none!important;mix-blend-mode: initial!important;z-index: auto;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;}.ace_text-layer {font: inherit !important;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {transition: opacity 0.18s;}.ace_animate-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: step-end;animation-name: blink-ace-animate;animation-iteration-count: infinite;}.ace_animate-blinking.ace_smooth-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: ease-in-out;animation-name: blink-ace-animate-smooth;}@keyframes blink-ace-animate {from, to { opacity: 1; }60% { opacity: 0; }}@keyframes blink-ace-animate-smooth {from, to { opacity: 1; }45% { opacity: 1; }60% { opacity: 0; }85% { opacity: 0; }}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;box-sizing: border-box;}.ace_line .ace_fold {box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_inline_button {border: 1px solid lightgray;display: inline-block;margin: -1px 8px;padding: 0 5px;pointer-events: auto;cursor: pointer;}.ace_inline_button:hover {border-color: gray;background: rgba(200,200,200,0.2);display: inline-block;pointer-events: auto;}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_text-input-ios {position: absolute !important;top: -100000px !important;left: -100000px !important;}'; + i.importCssString(m, "ace_editor.css"); + var g = function (e, t) + { + var n = this; + this.container = e || i.createElement("div"), i.addCssClass(this.container, "ace_editor"), this.setTheme(t), this.$gutter = i.createElement("div"), this.$gutter.className = "ace_gutter", this.container.appendChild(this.$gutter), this.$gutter.setAttribute("aria-hidden", !0), this.scroller = i.createElement("div"), this.scroller.className = "ace_scroller", this.container.appendChild(this.scroller), this.content = i.createElement("div"), this.content.className = "ace_content", this.scroller.appendChild(this.content), this.$gutterLayer = new u(this.$gutter), this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this)), this.$markerBack = new a(this.content); + var r = this.$textLayer = new f(this.content); + this.canvas = r.element, this.$markerFront = new a(this.content), this.$cursorLayer = new l(this.content), this.$horizScroll = !1, this.$vScroll = !1, this.scrollBar = this.scrollBarV = new h(this.container, this), this.scrollBarH = new c(this.container, this), this.scrollBarV.addEventListener("scroll", function (e) + { + n.$scrollAnimation || n.session.setScrollTop(e.data - n.scrollMargin.top) + }), this.scrollBarH.addEventListener("scroll", function (e) + { + n.$scrollAnimation || n.session.setScrollLeft(e.data - n.scrollMargin.left) + }), this.scrollTop = 0, this.scrollLeft = 0, this.cursorPos = { + row: 0, + column: 0 + }, this.$fontMetrics = new d(this.container), this.$textLayer.$setFontMetrics(this.$fontMetrics), this.$textLayer.addEventListener("changeCharacterSize", function (e) + { + n.updateCharacterSize(), n.onResize(!0, n.gutterWidth, n.$size.width, n.$size.height), n._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.$loop = new p(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, r.implement(this, v), 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); + if (!e) return; + 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, n) + { + t === undefined && (t = Infinity), this.$changedLines ? (this.$changedLines.firstRow > e && (this.$changedLines.firstRow = e), this.$changedLines.lastRow < t && (this.$changedLines.lastRow = t)) : this.$changedLines = { + firstRow: e, + lastRow: t + }; + if (this.$changedLines.lastRow < this.layerConfig.firstRow) + { + if (!n) return; + this.$changedLines.lastRow = this.layerConfig.lastRow + } + if (this.$changedLines.firstRow > this.layerConfig.lastRow) return; + 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, n, r) + { + if (this.resizing > 2) return; + this.resizing > 0 ? this.resizing++ : this.resizing = e ? 1 : 0; + var i = this.container; + r || (r = i.clientHeight || i.scrollHeight), n || (n = i.clientWidth || i.scrollWidth); + var s = this.$updateCachedSize(e, t, n, r); + if (!this.$size.scrollerHeight || !n && !r) 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, n, r) + { + r -= this.$extraHeight || 0; + var i = 0, + s = this.$size, + o = { + width: s.width, + height: s.height, + scrollerHeight: s.scrollerHeight, + scrollerWidth: s.scrollerWidth + }; + r && (e || s.height != r) && (s.height = r, i |= this.CHANGE_SIZE, s.scrollerHeight = s.height, this.$horizScroll && (s.scrollerHeight -= this.scrollBarH.getHeight()), this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px", i |= this.CHANGE_SCROLL); + if (n && (e || s.width != n)) + { + i |= this.CHANGE_SIZE, s.width = n, t == null && (t = this.$showGutter ? this.$gutter.offsetWidth : 0), this.gutterWidth = t, this.scrollBarH.element.style.left = this.scroller.style.left = t + "px", s.scrollerWidth = Math.max(0, n - t - this.scrollBarV.getWidth()), this.scrollBarH.element.style.right = this.scroller.style.right = this.scrollBarV.getWidth() + "px", this.scroller.style.bottom = this.scrollBarH.getHeight() + "px"; + if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || e) i |= this.CHANGE_FULL + } + return s.$dirty = !n || !r, i && this._signal("resize", o), i + }, this.onGutterResize = function () + { + var e = this.$showGutter ? this.$gutter.offsetWidth : 0; + e != this.gutterWidth && (this.$changes |= this.$updateCachedSize(!0, e, 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.$loop.schedule(this.CHANGE_MARKER)) + }, this.adjustWrapLimit = function () + { + var e = this.$size.scrollerWidth - this.$padding * 2, + 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.$updateGutterLineHighlight = function () + { + var e = this.$cursorLayer.$pixelPos, + t = this.layerConfig.lineHeight; + if (this.session.getUseWrapMode()) + { + var n = this.session.selection.getCursor(); + n.column = 0, e = this.$cursorLayer.getPixelPosition(n, !0), t *= this.session.getRowLength(n.row) + } + this.$gutterLineHighlight.style.top = e.top - this.layerConfig.offset + "px", this.$gutterLineHighlight.style.height = t + "px" + }, this.$updatePrintMargin = function () + { + if (!this.$showPrintMargin && !this.$printMarginEl) return; + if (!this.$printMarginEl) + { + var e = i.createElement("div"); + e.className = "ace_layer ace_print-margin-layer", this.$printMarginEl = i.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 && this.session.$wrap == -1 && 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) + { + e.left = "-100px"; + return + } + var t = this.layerConfig, + n = this.$cursorLayer.$pixelPos.top, + r = this.$cursorLayer.$pixelPos.left; + n -= t.offset; + var i = this.lineHeight; + if (n < 0 || n > t.height - i) + { + e.top = e.left = "0"; + return + } + var s = this.characterWidth; + if (this.$composition) + { + var o = this.textarea.value.replace(/^\x01+/, ""); + s *= this.session.$getStringScreenWidth(o)[0] + 2, i += 2 + } + r -= this.scrollLeft, r > this.$size.scrollerWidth - s && (r = this.$size.scrollerWidth - s), r += this.gutterWidth, e.height = i + "px", e.width = s + "px", e.left = Math.min(r, this.$size.scrollerWidth - s) + "px", e.top = Math.min(n, this.$size.height - i) + "px" + }, this.getFirstVisibleRow = function () + { + return this.layerConfig.firstRow + }, this.getFirstFullyVisibleRow = function () + { + return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1) + }, this.getLastFullyVisibleRow = function () + { + var e = this.layerConfig, + t = e.lastRow, + n = this.session.documentToScreenRow(t, 0) * e.lineHeight; + return n - 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, n, r) + { + var i = this.scrollMargin; + i.top = e | 0, i.bottom = t | 0, i.right = r | 0, i.left = n | 0, i.v = i.top + i.bottom, i.h = i.left + i.right, i.top && this.scrollTop <= 0 && this.session && this.session.setScrollTop(-i.top), 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) + { + this.$changes && (e |= this.$changes, this.$changes = 0); + if (!this.session || !this.container.offsetWidth || this.$frozen || !e && !t) + { + this.$changes |= e; + return + } + 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 n = 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) + { + e |= this.$computeLayerConfig(); + if (n.firstRow != this.layerConfig.firstRow && n.firstRowScreen == this.layerConfig.firstRowScreen) + { + var r = this.scrollTop + (n.firstRow - this.layerConfig.firstRow) * this.lineHeight; + r > 0 && (this.scrollTop = r, e |= this.CHANGE_SCROLL, e |= this.$computeLayerConfig()) + } + n = this.layerConfig, this.$updateScrollBarV(), e & this.CHANGE_H_SCROLL && this.$updateScrollBarH(), this.$gutterLayer.element.style.marginTop = -n.offset + "px", this.content.style.marginTop = -n.offset + "px", this.content.style.width = n.width + 2 * this.$padding + "px", this.content.style.height = n.minHeight + "px" + } + e & this.CHANGE_H_SCROLL && (this.content.style.marginLeft = -this.scrollLeft + "px", this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left"); + if (e & this.CHANGE_FULL) + { + this.$textLayer.update(n), this.$showGutter && this.$gutterLayer.update(n), this.$markerBack.update(n), this.$markerFront.update(n), this.$cursorLayer.update(n), this.$moveTextAreaToCursor(), this.$highlightGutterLine && this.$updateGutterLineHighlight(), this._signal("afterRender"); + return + } + if (e & this.CHANGE_SCROLL) + { + e & this.CHANGE_TEXT || e & this.CHANGE_LINES ? this.$textLayer.update(n) : this.$textLayer.scrollLines(n), this.$showGutter && this.$gutterLayer.update(n), this.$markerBack.update(n), this.$markerFront.update(n), this.$cursorLayer.update(n), this.$highlightGutterLine && this.$updateGutterLineHighlight(), this.$moveTextAreaToCursor(), this._signal("afterRender"); + return + } + e & this.CHANGE_TEXT ? (this.$textLayer.update(n), this.$showGutter && this.$gutterLayer.update(n)) : e & this.CHANGE_LINES ? (this.$updateLines() || e & this.CHANGE_GUTTER && this.$showGutter) && this.$gutterLayer.update(n) : (e & this.CHANGE_TEXT || e & this.CHANGE_GUTTER) && this.$showGutter && this.$gutterLayer.update(n), e & this.CHANGE_CURSOR && (this.$cursorLayer.update(n), this.$moveTextAreaToCursor(), this.$highlightGutterLine && this.$updateGutterLineHighlight()), e & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT) && this.$markerFront.update(n), e & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK) && this.$markerBack.update(n), this._signal("afterRender") + }, this.$autosize = function () + { + var e = this.session.getScreenLength() * this.lineHeight, + t = this.$maxLines * this.lineHeight, + n = Math.min(t, Math.max((this.$minLines || 1) * this.lineHeight, e)) + this.scrollMargin.v + (this.$extraHeight || 0); + this.$horizScroll && (n += this.scrollBarH.getHeight()), this.$maxPixelHeight && n > this.$maxPixelHeight && (n = this.$maxPixelHeight); + var r = n <= 2 * this.lineHeight, + i = !r && e > t; + if (n != this.desiredHeight || this.$size.height != this.desiredHeight || i != this.$vScroll) + { + i != this.$vScroll && (this.$vScroll = i, this.scrollBarV.setVisible(i)); + var s = this.container.clientWidth; + this.container.style.height = n + "px", this.$updateCachedSize(!0, this.$gutterWidth, s, n), this.desiredHeight = n, this._signal("autosize") + } + }, this.$computeLayerConfig = function () + { + var e = this.session, + t = this.$size, + n = t.height <= 2 * this.lineHeight, + r = this.session.getScreenLength(), + i = r * this.lineHeight, + s = this.$getLongestLine(), + o = !n && (this.$hScrollBarAlwaysVisible || t.scrollerWidth - s - 2 * this.$padding < 0), + u = this.$horizScroll !== o; + u && (this.$horizScroll = o, this.scrollBarH.setVisible(o)); + var a = this.$vScroll; + this.$maxLines && this.lineHeight > 1 && this.$autosize(); + var f = this.scrollTop % this.lineHeight, + l = t.scrollerHeight + this.lineHeight, + c = !this.$maxLines && this.$scrollPastEnd ? (t.scrollerHeight - this.lineHeight) * this.$scrollPastEnd : 0; + i += c; + var h = this.scrollMargin; + this.session.setScrollTop(Math.max(-h.top, Math.min(this.scrollTop, i - t.scrollerHeight + h.bottom))), this.session.setScrollLeft(Math.max(-h.left, Math.min(this.scrollLeft, s + 2 * this.$padding - t.scrollerWidth + h.right))); + var p = !n && (this.$vScrollBarAlwaysVisible || t.scrollerHeight - i + c < 0 || this.scrollTop > h.top), + d = a !== p; + d && (this.$vScroll = p, this.scrollBarV.setVisible(p)); + var v = Math.ceil(l / this.lineHeight) - 1, + m = Math.max(0, Math.round((this.scrollTop - f) / this.lineHeight)), + g = m + v, + y, b, w = this.lineHeight; + m = e.screenToDocumentRow(m, 0); + var E = e.getFoldLine(m); + E && (m = E.start.row), y = e.documentToScreenRow(m, 0), b = e.getRowLength(m) * w, g = Math.min(e.screenToDocumentRow(g, 0), e.getLength() - 1), l = t.scrollerHeight + e.getRowLength(g) * w + b, f = this.scrollTop - y * w; + var S = 0; + if (this.layerConfig.width != s || u) S = this.CHANGE_H_SCROLL; + if (u || d) S = this.$updateCachedSize(!0, this.gutterWidth, t.width, t.height), this._signal("scrollbarVisibilityChanged"), d && (s = this.$getLongestLine()); + return this.layerConfig = { + width: s, + padding: this.$padding, + firstRow: m, + firstRowScreen: y, + lastRow: g, + lineHeight: w, + characterWidth: this.characterWidth, + minHeight: l, + maxHeight: i, + offset: f, + gutterOffset: w ? Math.max(0, Math.ceil((f + t.height - t.scrollerHeight) / w)) : 0, + height: this.$size.scrollerHeight + }, S + }, this.$updateLines = function () + { + if (!this.$changedLines) return; + var e = this.$changedLines.firstRow, + t = this.$changedLines.lastRow; + this.$changedLines = null; + var n = this.layerConfig; + if (e > n.lastRow + 1) return; + if (t < n.firstRow) return; + if (t === Infinity) + { + this.$showGutter && this.$gutterLayer.update(n), this.$textLayer.update(n); + return + } + return this.$textLayer.updateLines(n, 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, n) + { + this.scrollCursorIntoView(e, n), this.scrollCursorIntoView(t, n) + }, this.scrollCursorIntoView = function (e, t, n) + { + if (this.$size.scrollerHeight === 0) return; + var r = this.$cursorLayer.getPixelPosition(e), + i = r.left, + s = r.top, + o = n && n.top || 0, + u = n && n.bottom || 0, + a = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop; + a + o > s ? (t && a + o > s + this.lineHeight && (s -= t * this.$size.scrollerHeight), s === 0 && (s = -this.scrollMargin.top), this.session.setScrollTop(s)) : a + this.$size.scrollerHeight - u < s + this.lineHeight && (t && a + this.$size.scrollerHeight - u < s - this.lineHeight && (s += t * this.$size.scrollerHeight), this.session.setScrollTop(s + this.lineHeight - this.$size.scrollerHeight)); + var f = this.scrollLeft; + f > i ? (i < this.$padding + 2 * this.layerConfig.characterWidth && (i = -this.scrollMargin.left), this.session.setScrollLeft(i)) : f + this.$size.scrollerWidth < i + this.characterWidth ? this.session.setScrollLeft(Math.round(i + this.characterWidth - this.$size.scrollerWidth)) : f <= this.$padding && i - f < 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) + { + typeof e == "number" && (e = { + row: e, + column: 0 + }); + var n = this.$cursorLayer.getPixelPosition(e), + r = this.$size.scrollerHeight - this.lineHeight, + i = n.top - r * (t || 0); + return this.session.setScrollTop(i), i + }, this.STEPS = 8, this.$calcSteps = function (e, t) + { + var n = 0, + r = this.STEPS, + i = [], + s = function (e, t, n) + { + return n * (Math.pow(e - 1, 3) + 1) + t + }; + for (n = 0; n < r; ++n) i.push(s(n / this.STEPS, e, t - e)); + return i + }, this.scrollToLine = function (e, t, n, r) + { + var i = this.$cursorLayer.getPixelPosition( + { + row: e, + column: 0 + }), + s = i.top; + t && (s -= this.$size.scrollerHeight / 2); + var o = this.scrollTop; + this.session.setScrollTop(s), n !== !1 && this.animateScrolling(o, r) + }, this.animateScrolling = function (e, t) + { + var n = this.scrollTop; + if (!this.$animatedScroll) return; + var r = this; + if (e == n) return; + if (this.$scrollAnimation) + { + var i = this.$scrollAnimation.steps; + if (i.length) + { + e = i[0]; + if (e == n) return + } + } + var s = r.$calcSteps(e, n); + this.$scrollAnimation = { + from: e, + to: n, + steps: s + }, clearInterval(this.$timer), r.session.setScrollTop(s.shift()), r.session.$scrollTop = n, this.$timer = setInterval(function () + { + s.length ? (r.session.setScrollTop(s.shift()), r.session.$scrollTop = n) : n != null ? (r.session.$scrollTop = -1, r.session.setScrollTop(n), n = null) : (r.$timer = clearInterval(r.$timer), r.$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) + { + if (t < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top) return !0; + if (t > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom) return !0; + if (e < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left) return !0; + if (e > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right) return !0 + }, this.pixelToScreenCoordinates = function (e, t) + { + var n; + if (this.$hasCssTransforms) + { + n = { + top: 0, + left: 0 + }; + var r = this.$fontMetrics.transformCoordinates([e, t]); + e = r[1] - this.gutterWidth, t = r[0] + } + else n = this.scroller.getBoundingClientRect(); + var i = e + this.scrollLeft - n.left - this.$padding, + s = i / this.characterWidth, + o = Math.floor((t + this.scrollTop - n.top) / this.lineHeight), + u = this.$blockCursor ? Math.floor(s) : Math.round(s); + return { + row: o, + column: u, + side: s - u > 0 ? 1 : -1, + offsetX: i + } + }, this.screenToTextCoordinates = function (e, t) + { + var n; + if (this.$hasCssTransforms) + { + n = { + top: 0, + left: 0 + }; + var r = this.$fontMetrics.transformCoordinates([e, t]); + e = r[1] - this.gutterWidth, t = r[0] + } + else n = this.scroller.getBoundingClientRect(); + var i = e + this.scrollLeft - n.left - this.$padding, + s = i / this.characterWidth, + o = this.$blockCursor ? Math.floor(s) : Math.round(s), + u = (t + this.scrollTop - n.top) / this.lineHeight; + return this.session.screenToDocumentPosition(u, Math.max(o, 0), i) + }, this.textToScreenCoordinates = function (e, t) + { + var n = this.scroller.getBoundingClientRect(), + r = this.session.documentToScreenPosition(e, t), + i = this.$padding + (this.session.$bidiHandler.isBidiRow(r.row, e) ? this.session.$bidiHandler.getPosLeft(r.column) : Math.round(r.column * this.characterWidth)), + s = r.row * this.lineHeight; + return { + pageX: n.left + i - this.scrollLeft, + pageY: n.top + s - this.scrollTop + } + }, this.visualizeFocus = function () + { + i.addCssClass(this.container, "ace_focus") + }, this.visualizeBlur = function () + { + i.removeCssClass(this.container, "ace_focus") + }, this.showComposition = function (e) + { + this.$composition || (this.$composition = { + keepTextAreaAtCursor: this.$keepTextAreaAtCursor, + cssText: this.textarea.style.cssText + }), this.$keepTextAreaAtCursor = !0, i.addCssClass(this.textarea, "ace_composition"), this.textarea.style.cssText = "", this.$moveTextAreaToCursor() + }, this.setCompositionText = function (e) + { + this.$moveTextAreaToCursor() + }, this.hideComposition = function () + { + if (!this.$composition) return; + i.removeCssClass(this.textarea, "ace_composition"), this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor, this.textarea.style.cssText = this.$composition.cssText, this.$composition = null + }, this.setTheme = function (e, t) + { + function o(r) + { + if (n.$themeId != e) return t && t(); + if (!r || !r.cssClass) throw new Error("couldn't load module " + e + " or it didn't call define"); + r.$id && (n.$themeId = r.$id), i.importCssString(r.cssText, r.cssClass, n.container), n.theme && i.removeCssClass(n.container, n.theme.cssClass); + var s = "padding" in r ? r.padding : "padding" in (n.theme || + {}) ? 4 : n.$padding; + n.$padding && s != n.$padding && n.setPadding(s), n.$theme = r.cssClass, n.theme = r, i.addCssClass(n.container, r.cssClass), i.setCssClass(n.container, "ace_dark", r.isDark), n.$size && (n.$size.width = 0, n.$updateSizeAsync()), n._dispatchEvent("themeLoaded", + { + theme: r + }), t && t() + } + var n = this; + this.$themeId = e, n._dispatchEvent("themeChange", + { + theme: e + }); + if (!e || typeof e == "string") + { + var r = e || this.$options.theme.initialValue; + s.loadModule(["theme", r], o) + } + else o(e) + }, this.getTheme = function () + { + return this.$themeId + }, this.setStyle = function (e, t) + { + i.setCssClass(this.container, e, t !== !1) + }, this.unsetStyle = function (e) + { + i.removeCssClass(this.container, e) + }, this.setCursorStyle = function (e) + { + this.scroller.style.cursor != e && (this.scroller.style.cursor = e) + }, this.setMouseCursor = function (e) + { + this.scroller.style.cursor = e + }, this.attachToShadowRoot = function () + { + i.importCssString(m, "ace_editor.css", this.container) + }, this.destroy = function () + { + this.$textLayer.destroy(), this.$cursorLayer.destroy() + } + }).call(g.prototype), s.defineOptions(g.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) + { + typeof e == "number" && (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) + { + i.setCssClass(this.$gutter, "ace_fade-fold-widgets", e) + }, + initialValue: !1 + }, + showFoldWidgets: + { + set: function (e) + { + this.$gutterLayer.setShowFoldWidgets(e) + }, + initialValue: !0 + }, + showLineNumbers: + { + set: function (e) + { + this.$gutterLayer.setShowLineNumbers(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) + { + if (!this.$gutterLineHighlight) + { + this.$gutterLineHighlight = i.createElement("div"), this.$gutterLineHighlight.className = "ace_gutter-active-line", this.$gutter.appendChild(this.$gutterLineHighlight); + return + } + this.$gutterLineHighlight.style.display = e ? "" : "none", this.$cursorLayer.$pixelPos && this.$updateGutterLineHighlight() + }, + initialValue: !1, + value: !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) + { + typeof e == "number" && (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.updateFull() + } + }, + maxPixelHeight: + { + set: function (e) + { + this.updateFull() + }, + initialValue: 0 + }, + scrollPastEnd: + { + set: function (e) + { + e = +e || 0; + if (this.$scrollPastEnd == e) return; + 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: + {} + }), t.VirtualRenderer = g +}), define("ace/worker/worker_client", ["require", "exports", "module", "ace/lib/oop", "ace/lib/net", "ace/lib/event_emitter", "ace/config"], function (e, t, n) +{ + "use strict"; + + function u(e) + { + var t = "importScripts('" + i.qualifyURL(e) + "');"; + try + { + return new Blob([t], + { + type: "application/javascript" + }) + } + catch (n) + { + var r = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder, + s = new r; + return s.append(t), s.getBlob("application/javascript") + } + } + + function a(e) + { + if (typeof Worker == "undefined") return { + postMessage: function () {}, + terminate: function () {} + }; + var t = u(e), + n = window.URL || window.webkitURL, + r = n.createObjectURL(t); + return new Worker(r) + } + var r = e("../lib/oop"), + i = e("../lib/net"), + s = e("../lib/event_emitter").EventEmitter, + o = e("../config"), + f = function (t, n, r, i, s) + { + this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this), this.changeListener = this.changeListener.bind(this), this.onMessage = this.onMessage.bind(this), e.nameToUrl && !e.toUrl && (e.toUrl = e.nameToUrl); + if (o.get("packaged") || !e.toUrl) i = i || o.moduleUrl(n, "worker"); + else + { + var u = this.$normalizePath; + i = i || u(e.toUrl("ace/worker/worker.js", null, "_")); + var f = {}; + t.forEach(function (t) + { + f[t] = u(e.toUrl(t, null, "_").replace(/(\.js)?(\?.*)?$/, "")) + }) + } + this.$worker = a(i), s && this.send("importScripts", s), this.$worker.postMessage( + { + init: !0, + tlns: f, + module: n, + classname: r + }), this.callbackId = 1, this.callbacks = {}, this.$worker.onmessage = this.onMessage + }; + (function () + { + r.implement(this, s), this.onMessage = function (e) + { + var t = e.data; + switch (t.type) + { + case "event": + this._signal(t.name, + { + data: t.data + }); + break; + case "call": + var n = this.callbacks[t.id]; + n && (n(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 i.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, n) + { + if (n) + { + var r = this.callbackId++; + this.callbacks[r] = n, t.push(r) + } + this.send(e, t) + }, this.emit = function (e, t) + { + try + { + this.$worker.postMessage( + { + event: e, + data: + { + data: t.data + } + }) + } + catch (n) + { + console.error(n.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)), e.action == "insert" ? this.deltaQueue.push(e.start, e.lines) : this.deltaQueue.push(e.start, e.end) + }, this.$sendDeltaQueue = function () + { + var e = this.deltaQueue; + if (!e) return; + this.deltaQueue = null, e.length > 50 && e.length > this.$doc.getLength() >> 1 ? this.call("setValue", [this.$doc.getValue()]) : this.emit("change", + { + data: e + }) + } + }).call(f.prototype); + var l = function (e, t, n) + { + this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this), this.changeListener = this.changeListener.bind(this), this.callbackId = 1, this.callbacks = {}, this.messageBuffer = []; + var r = null, + i = !1, + u = Object.create(s), + a = this; + this.$worker = {}, this.$worker.terminate = function () {}, this.$worker.postMessage = function (e) + { + a.messageBuffer.push(e), r && (i ? setTimeout(f) : f()) + }, this.setEmitSync = function (e) + { + i = e + }; + var f = function () + { + var e = a.messageBuffer.shift(); + e.command ? r[e.command].apply(r, e.args) : e.event && u._signal(e.event, e.data) + }; + u.postMessage = function (e) + { + a.onMessage( + { + data: e + }) + }, u.callback = function (e, t) + { + this.postMessage( + { + type: "call", + id: t, + data: e + }) + }, u.emit = function (e, t) + { + this.postMessage( + { + type: "event", + name: e, + data: t + }) + }, o.loadModule(["worker", t], function (e) + { + r = new e[n](u); + while (a.messageBuffer.length) f() + }) + }; + l.prototype = f.prototype, t.UIWorkerClient = l, t.WorkerClient = f, t.createWorker = a +}), define("ace/placeholder", ["require", "exports", "module", "ace/range", "ace/lib/event_emitter", "ace/lib/oop"], function (e, t, n) +{ + "use strict"; + var r = e("./range").Range, + i = e("./lib/event_emitter").EventEmitter, + s = e("./lib/oop"), + o = function (e, t, n, r, i, s) + { + var o = this; + this.length = t, this.session = e, this.doc = e.getDocument(), this.mainClass = i, this.othersClass = s, this.$onUpdate = this.onUpdate.bind(this), this.doc.on("change", this.$onUpdate), this.$others = r, this.$onCursorChange = function () + { + setTimeout(function () + { + o.onCursorChange() + }) + }, this.$pos = n; + var u = e.getUndoManager().$undoStack || e.getUndoManager().$undostack || + { + length: -1 + }; + this.$undoStackDepth = u.length, this.setup(), e.selection.on("changeCursor", this.$onCursorChange) + }; + (function () + { + s.implement(this, i), this.setup = function () + { + var e = this, + t = this.doc, + n = this.session; + this.selectionBefore = n.selection.toJSON(), n.selection.inMultiSelectMode && n.selection.toSingleRange(), this.pos = t.createAnchor(this.$pos.row, this.$pos.column); + var i = this.pos; + i.$insertRight = !0, i.detach(), i.markerId = n.addMarker(new r(i.row, i.column, i.row, i.column + this.length), this.mainClass, null, !1), this.others = [], this.$others.forEach(function (n) + { + var r = t.createAnchor(n.row, n.column); + r.$insertRight = !0, r.detach(), e.others.push(r) + }), n.setUndoSelect(!1) + }, this.showOtherMarkers = function () + { + if (this.othersActive) return; + var e = this.session, + t = this; + this.othersActive = !0, this.others.forEach(function (n) + { + n.markerId = e.addMarker(new r(n.row, n.column, n.row, n.column + t.length), t.othersClass, null, !1) + }) + }, this.hideOtherMarkers = function () + { + if (!this.othersActive) return; + 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) return; + if (t.start.row !== this.pos.row) return; + this.$updating = !0; + var n = e.action === "insert" ? t.end.column - t.start.column : t.start.column - t.end.column, + i = t.start.column >= this.pos.column && t.start.column <= this.pos.column + this.length + 1, + s = t.start.column - this.pos.column; + this.updateAnchors(e), i && (this.length += n); + if (i && !this.session.$fromUndo) + if (e.action === "insert") + for (var o = this.others.length - 1; o >= 0; o--) + { + var u = this.others[o], + a = { + row: u.row, + column: u.column + s + }; + this.doc.insertMergedLines(a, e.lines) + } + else if (e.action === "remove") + for (var o = this.others.length - 1; o >= 0; o--) + { + var u = this.others[o], + a = { + row: u.row, + column: u.column + s + }; + this.doc.remove(new r(a.row, a.column, a.row, a.column - n)) + } + 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) return; + var e = this, + t = this.session, + n = function (n, i) + { + t.removeMarker(n.markerId), n.markerId = t.addMarker(new r(n.row, n.column, n.row, n.column + e.length), i, null, !1) + }; + n(this.pos, this.mainClass); + for (var i = this.others.length; i--;) n(this.others[i], this.othersClass) + }, this.onCursorChange = function (e) + { + if (this.$updating || !this.session) return; + 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 (this.$undoStackDepth === -1) return; + var e = this.session.getUndoManager(), + t = (e.$undoStack || e.$undostack).length - this.$undoStackDepth; + for (var n = 0; n < t; n++) e.undo(this.session, !0); + this.selectionBefore && this.session.selection.fromJSON(this.selectionBefore) + } + }).call(o.prototype), t.PlaceHolder = o +}), define("ace/mouse/multi_select_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function (e, t, n) +{ + function s(e, t) + { + return e.row == t.row && e.column == t.column + } + + function o(e) + { + var t = e.domEvent, + n = t.altKey, + o = t.shiftKey, + u = t.ctrlKey, + a = e.getAccelKey(), + f = e.getButton(); + u && i.isMac && (f = t.button); + if (e.editor.inMultiSelectMode && f == 2) + { + e.editor.textInput.onContextMenu(e.domEvent); + return + } + if (!u && !n && !a) + { + f === 0 && e.editor.inMultiSelectMode && e.editor.exitMultiSelectMode(); + return + } + if (f !== 0) return; + var l = e.editor, + c = l.selection, + h = l.inMultiSelectMode, + p = e.getDocumentPosition(), + d = c.getCursor(), + v = e.inSelection() || c.isEmpty() && s(p, d), + m = e.x, + g = e.y, + y = function (e) + { + m = e.clientX, g = e.clientY + }, + b = l.session, + w = l.renderer.pixelToScreenCoordinates(m, g), + E = w, + S; + if (l.$mouseHandler.$enableJumpToDef) u && n || a && n ? S = o ? "block" : "add" : n && l.$blockSelectEnabled && (S = "block"); + else if (a && !n) + { + S = "add"; + if (!h && o) return + } + else n && l.$blockSelectEnabled && (S = "block"); + S && i.isMac && t.ctrlKey && l.$mouseHandler.cancelContextMenu(); + if (S == "add") + { + if (!h && v) return; + if (!h) + { + var x = c.toOrientedRange(); + l.addSelectionMarker(x) + } + var T = c.rangeList.rangeAtPoint(p); + l.inVirtualSelectionMode = !0, o && (T = null, x = c.ranges[0] || x, l.removeSelectionMarker(x)), l.once("mouseup", function () + { + var e = c.toOrientedRange(); + T && e.isEmpty() && s(T.cursor, e.cursor) ? c.substractPoint(e.cursor) : (o ? c.substractPoint(x.cursor) : x && (l.removeSelectionMarker(x), c.addRange(x)), c.addRange(e)), l.inVirtualSelectionMode = !1 + }) + } + else if (S == "block") + { + e.stop(), l.inVirtualSelectionMode = !0; + var N, C = [], + k = function () + { + var e = l.renderer.pixelToScreenCoordinates(m, g), + t = b.screenToDocumentPosition(e.row, e.column, e.offsetX); + if (s(E, e) && s(t, c.lead)) return; + E = e, l.selection.moveToPosition(t), l.renderer.scrollCursorIntoView(), l.removeSelectionMarkers(C), C = c.rectangularRangeBlock(E, w), l.$mouseHandler.$clickSelection && C.length == 1 && C[0].isEmpty() && (C[0] = l.$mouseHandler.$clickSelection.clone()), C.forEach(l.addSelectionMarker, l), l.updateSelectionMarkers() + }; + h && !a ? c.toSingleRange() : !h && a && (N = c.toOrientedRange(), l.addSelectionMarker(N)), o ? w = b.documentToScreenPosition(c.lead) : c.moveToPosition(p), E = { + row: -1, + column: -1 + }; + var L = function (e) + { + clearInterval(O), l.removeSelectionMarkers(C), C.length || (C = [c.toOrientedRange()]), N && (l.removeSelectionMarker(N), c.toSingleRange(N)); + for (var t = 0; t < C.length; t++) c.addRange(C[t]); + l.inVirtualSelectionMode = !1, l.$mouseHandler.$clickSelection = null + }, + A = k; + r.capture(l.container, y, L); + var O = setInterval(function () + { + A() + }, 20); + return e.preventDefault() + } + } + var r = e("../lib/event"), + i = e("../lib/useragent"); + t.onMouseDown = o +}), define("ace/commands/multi_select_commands", ["require", "exports", "module", "ace/keyboard/hash_handler"], function (e, t, n) +{ + 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 r = e("../keyboard/hash_handler").HashHandler; + t.keyboardHandler = new r(t.multiSelectCommands) +}), define("ace/multi_select", ["require", "exports", "module", "ace/range_list", "ace/range", "ace/selection", "ace/mouse/multi_select_handler", "ace/lib/event", "ace/lib/lang", "ace/commands/multi_select_commands", "ace/search", "ace/edit_session", "ace/editor", "ace/config"], function (e, t, n) +{ + function h(e, t, n) + { + return c.$options.wrap = !0, c.$options.needle = t, c.$options.backwards = n == -1, c.find(e) + } + + function v(e, t) + { + return e.row == t.row && e.column == t.column + } + + function m(e) + { + if (e.$multiselectOnSessionChange) return; + 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(f.defaultCommands), g(e) + } + + function g(e) + { + function r(t) + { + n && (e.renderer.setMouseCursor(""), n = !1) + } + var t = e.textInput.getElement(), + n = !1; + u.addListener(t, "keydown", function (t) + { + var i = t.keyCode == 18 && !(t.ctrlKey || t.shiftKey || t.metaKey); + e.$blockSelectEnabled && i ? n || (e.renderer.setMouseCursor("crosshair"), n = !0) : n && r() + }), u.addListener(t, "keyup", r), u.addListener(t, "blur", r) + } + var r = e("./range_list").RangeList, + i = e("./range").Range, + s = e("./selection").Selection, + o = e("./mouse/multi_select_handler").onMouseDown, + u = e("./lib/event"), + a = e("./lib/lang"), + f = e("./commands/multi_select_commands"); + t.commands = f.defaultCommands.concat(f.multiSelectCommands); + var l = e("./search").Search, + c = new l, + p = e("./edit_session").EditSession; + (function () + { + this.getSelectionMarkers = function () + { + return this.$selectionMarkers + } + }).call(p.prototype), + function () + { + this.ranges = null, this.rangeList = null, this.addRange = function (e, t) + { + if (!e) return; + if (!this.inMultiSelectMode && this.rangeCount === 0) + { + var n = this.toOrientedRange(); + this.rangeList.add(n), this.rangeList.add(e); + if (this.rangeList.ranges.length != 2) return this.rangeList.removeAll(), t || this.fromOrientedRange(e); + this.rangeList.removeAll(), this.rangeList.add(n), this.$onAddRange(n) + } + e.cursor || (e.cursor = e.end); + var r = this.rangeList.add(e); + return this.$onAddRange(e), r.length && this.$onRemoveRange(r), 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.ranges[0] && this.fromOrientedRange(this.ranges[0]) + }, this.$onAddRange = function (e) + { + this.rangeCount = this.rangeList.ranges.length, this.ranges.unshift(e), this._signal("addRange", + { + range: e + }) + }, this.$onRemoveRange = function (e) + { + this.rangeCount = this.rangeList.ranges.length; + if (this.rangeCount == 1 && this.inMultiSelectMode) + { + var t = this.rangeList.ranges.pop(); + e.push(t), this.rangeCount = 0 + } + for (var n = e.length; n--;) + { + var r = this.ranges.indexOf(e[n]); + this.ranges.splice(r, 1) + } + this._signal("removeRange", + { + ranges: e + }), this.rangeCount === 0 && this.inMultiSelectMode && (this.inMultiSelectMode = !1, this._signal("singleSelect"), this.session.$undoSelect = !0, this.rangeList.detach(this.session)), t = t || this.ranges[0], t && !t.isEqual(this.getRange()) && this.fromOrientedRange(t) + }, this.$initRangeList = function () + { + if (this.rangeList) return; + this.rangeList = new r, 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], + n = i.fromPoints(e[0].start, t.end); + this.toSingleRange(), this.setSelectionRange(n, t.cursor == t.start) + } + else + { + var n = this.getRange(), + r = this.isBackwards(), + s = n.start.row, + o = n.end.row; + if (s == o) + { + if (r) var u = n.end, + a = n.start; + else var u = n.start, + a = n.end; + this.addRange(i.fromPoints(a, a)), this.addRange(i.fromPoints(u, u)); + return + } + var f = [], + l = this.getLineRange(s, !0); + l.start.column = n.start.column, f.push(l); + for (var c = s + 1; c < o; c++) f.push(this.getLineRange(c, !0)); + l = this.getLineRange(o, !0), l.end.column = n.end.column, f.push(l), f.forEach(this.addRange, this) + } + }, this.toggleBlockSelection = function () + { + if (this.rangeCount > 1) + { + var e = this.rangeList.ranges, + t = e[e.length - 1], + n = i.fromPoints(e[0].start, t.end); + this.toSingleRange(), this.setSelectionRange(n, t.cursor == t.start) + } + else + { + var r = this.session.documentToScreenPosition(this.cursor), + s = this.session.documentToScreenPosition(this.anchor), + o = this.rectangularRangeBlock(r, s); + o.forEach(this.addRange, this) + } + }, this.rectangularRangeBlock = function (e, t, n) + { + var r = [], + s = e.column < t.column; + if (s) var o = e.column, + u = t.column, + a = e.offsetX, + f = t.offsetX; + else var o = t.column, + u = e.column, + a = t.offsetX, + f = e.offsetX; + var l = e.row < t.row; + if (l) var c = e.row, + h = t.row; + else var c = t.row, + h = e.row; + o < 0 && (o = 0), c < 0 && (c = 0), c == h && (n = !0); + var p; + for (var d = c; d <= h; d++) + { + var m = i.fromPoints(this.session.screenToDocumentPosition(d, o, a), this.session.screenToDocumentPosition(d, u, f)); + if (m.isEmpty()) + { + if (p && v(m.end, p)) break; + p = m.end + } + m.cursor = s ? m.start : m.end, r.push(m) + } + l && r.reverse(); + if (!n) + { + var g = r.length - 1; + while (r[g].isEmpty() && g > 0) g--; + if (g > 0) + { + var y = 0; + while (r[y].isEmpty()) y++ + } + for (var b = g; b >= y; b--) r[b].isEmpty() && r.splice(b, 1) + } + return r + } + }.call(s.prototype); + var d = e("./editor").Editor; + (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) return; + this.session.removeMarker(e.marker); + var t = this.session.$selectionMarkers.indexOf(e); + t != -1 && this.session.$selectionMarkers.splice(t, 1), this.session.selectionMarkerCount = this.session.$selectionMarkers.length + }, this.removeSelectionMarkers = function (e) + { + var t = this.session.$selectionMarkers; + for (var n = e.length; n--;) + { + var r = e[n]; + if (!r.marker) continue; + this.session.removeMarker(r.marker); + var i = t.indexOf(r); + i != -1 && t.splice(i, 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) + { + if (this.inMultiSelectMode) return; + this.inMultiSelectMode = !0, this.setStyle("ace_multiselect"), this.keyBinding.addKeyboardHandler(f.keyboardHandler), this.commands.setDefaultHandler("exec", this.$onMultiSelectExec), this.renderer.updateCursor(), this.renderer.updateBackMarkers() + }, this.$onSingleSelect = function (e) + { + if (this.session.multiSelect.inVirtualMode) return; + this.inMultiSelectMode = !1, this.unsetStyle("ace_multiselect"), this.keyBinding.removeKeyboardHandler(f.keyboardHandler), this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec), this.renderer.updateCursor(), this.renderer.updateBackMarkers(), this._emit("changeSelection") + }, this.$onMultiSelectExec = function (e) + { + var t = e.command, + n = e.editor; + if (!n.multiSelect) return; + if (!t.multiSelectAction) + { + var r = t.exec(n, e.args || + {}); + n.multiSelect.addRange(n.multiSelect.toOrientedRange()), n.multiSelect.mergeOverlappingRanges() + } + else t.multiSelectAction == "forEach" ? r = n.forEachSelection(t, e.args) : t.multiSelectAction == "forEachLine" ? r = n.forEachSelection(t, e.args, !0) : t.multiSelectAction == "single" ? (n.exitMultiSelectMode(), r = t.exec(n, e.args || + {})) : r = t.multiSelectAction(n, e.args || + {}); + return r + }, this.forEachSelection = function (e, t, n) + { + if (this.inVirtualSelectionMode) return; + var r = n && n.keepOrder, + i = n == 1 || n && n.$byLines, + o = this.session, + u = this.selection, + a = u.rangeList, + f = (r ? u : a).ranges, + l; + if (!f.length) return e.exec ? e.exec(this, t || + {}) : e(this, t || + {}); + var c = u._eventRegistry; + u._eventRegistry = {}; + var h = new s(o); + this.inVirtualSelectionMode = !0; + for (var p = f.length; p--;) + { + if (i) + while (p > 0 && f[p].start.row == f[p - 1].end.row) p--; + h.fromOrientedRange(f[p]), h.index = p, this.selection = o.selection = h; + var d = e.exec ? e.exec(this, t || + {}) : e(this, t || + {}); + !l && d !== undefined && (l = d), h.toOrientedRange(f[p]) + } + h.detach(), this.selection = o.selection = u, this.inVirtualSelectionMode = !1, u._eventRegistry = c, u.mergeOverlappingRanges(); + var v = this.renderer.$scrollAnimation; + return this.onCursorChange(), this.onSelectionChange(), v && v.from == v.to && this.renderer.animateScrolling(v.from), l + }, this.exitMultiSelectMode = function () + { + if (!this.inMultiSelectMode || this.inVirtualSelectionMode) return; + this.multiSelect.toSingleRange() + }, this.getSelectedText = function () + { + var e = ""; + if (this.inMultiSelectMode && !this.inVirtualSelectionMode) + { + var t = this.multiSelect.rangeList.ranges, + n = []; + for (var r = 0; r < t.length; r++) n.push(this.session.getTextRange(t[r])); + var i = this.session.getDocument().getNewLineCharacter(); + e = n.join(i), e.length == (n.length - 1) * i.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 n = this.multiSelect.ranges[0]; + if (this.multiSelect.isEmpty() && t == this.multiSelect.anchor) return; + var r = t == this.multiSelect.anchor ? n.cursor == n.start ? n.end : n.start : n.cursor; + r.row != t.row || this.session.$clipPositionToDocument(r.row, r.column).column != t.column ? this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()) : this.multiSelect.mergeOverlappingRanges() + } + }, this.findAll = function (e, t, n) + { + t = t || + {}, t.needle = e || t.needle; + if (t.needle == undefined) + { + var r = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange(); + t.needle = this.session.getTextRange(r) + } + this.$search.set(t); + var i = this.$search.findAll(this.session); + if (!i.length) return 0; + var s = this.multiSelect; + n || s.toSingleRange(i[0]); + for (var o = i.length; o--;) s.addRange(i[o], !0); + return r && s.rangeList.rangeAtPoint(r.start) && s.addRange(r, !0), i.length + }, this.selectMoreLines = function (e, t) + { + var n = this.selection.toOrientedRange(), + r = n.cursor == n.end, + s = this.session.documentToScreenPosition(n.cursor); + this.selection.$desiredColumn && (s.column = this.selection.$desiredColumn); + var o = this.session.screenToDocumentPosition(s.row + e, s.column); + if (!n.isEmpty()) var u = this.session.documentToScreenPosition(r ? n.end : n.start), + a = this.session.screenToDocumentPosition(u.row + e, u.column); + else var a = o; + if (r) + { + var f = i.fromPoints(o, a); + f.cursor = f.start + } + else + { + var f = i.fromPoints(a, o); + f.cursor = f.end + } + f.desiredColumn = s.column; + if (!this.selection.inMultiSelectMode) this.selection.addRange(n); + else if (t) var l = n.cursor; + this.selection.addRange(f), l && this.selection.substractPoint(l) + }, this.transposeSelections = function (e) + { + var t = this.session, + n = t.multiSelect, + r = n.ranges; + for (var i = r.length; i--;) + { + var s = r[i]; + 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 + } + } + n.mergeOverlappingRanges(); + var u = []; + for (var i = r.length; i--;) + { + var s = r[i]; + u.unshift(t.getTextRange(s)) + } + e < 0 ? u.unshift(u.pop()) : u.push(u.shift()); + for (var i = r.length; i--;) + { + var s = r[i], + o = s.clone(); + t.replace(s, u[i]), s.start.row = o.start.row, s.start.column = o.start.column + } + }, this.selectMore = function (e, t, n) + { + var r = this.session, + i = r.multiSelect, + s = i.toOrientedRange(); + if (s.isEmpty()) + { + s = r.getWordRange(s.start.row, s.start.column), s.cursor = e == -1 ? s.start : s.end, this.multiSelect.addRange(s); + if (n) return + } + var o = r.getTextRange(s), + u = h(r, o, e); + u && (u.cursor = e == -1 ? u.start : u.end, this.session.unfold(u), this.multiSelect.addRange(u), this.renderer.scrollCursorIntoView(null, .5)), t && this.multiSelect.substractPoint(s.cursor) + }, this.alignCursors = function () + { + var e = this.session, + t = e.multiSelect, + n = t.ranges, + r = -1, + s = n.filter(function (e) + { + if (e.cursor.row == r) return !0; + r = e.cursor.row + }); + if (!n.length || s.length == n.length - 1) + { + var o = this.selection.getRange(), + u = o.start.row, + f = o.end.row, + l = u == f; + if (l) + { + var c = this.session.getLength(), + h; + do h = this.session.getLine(f); while (/[=:]/.test(h) && ++f < c); + do h = this.session.getLine(u); while (/[=:]/.test(h) && --u > 0); + u < 0 && (u = 0), f >= c && (f = c - 1) + } + var p = this.session.removeFullLines(u, f); + p = this.$reAlignText(p, l), this.session.insert( + { + row: u, + column: 0 + }, p.join("\n") + "\n"), l || (o.start.column = 0, o.end.column = p[p.length - 1].length), this.selection.setRange(o) + } + else + { + s.forEach(function (e) + { + t.substractPoint(e.cursor) + }); + var d = 0, + v = Infinity, + m = n.map(function (t) + { + var n = t.cursor, + r = e.getLine(n.row), + i = r.substr(n.column).search(/\S/g); + return i == -1 && (i = 0), n.column > d && (d = n.column), i < v && (v = i), i + }); + n.forEach(function (t, n) + { + var r = t.cursor, + s = d - r.column, + o = m[n] - v; + s > o ? e.insert(r, a.stringRepeat(" ", s - o)) : e.remove(new i(r.row, r.column, r.row, r.column - s + o)), t.start.column = t.end.column = d, t.start.row = t.end.row = r.row, t.cursor = t.end + }), t.fromOrientedRange(n[0]), this.renderer.updateCursor(), this.renderer.updateBackMarkers() + } + }, this.$reAlignText = function (e, t) + { + function u(e) + { + return a.stringRepeat(" ", e) + } + + function f(e) + { + return e[2] ? u(i) + e[2] + u(s - e[2].length + o) + e[4].replace(/^([=:])\s+/, "$1 ") : e[0] + } + + function l(e) + { + return e[2] ? u(i + s - e[2].length) + e[2] + u(o) + e[4].replace(/^([=:])\s+/, "$1 ") : e[0] + } + + function c(e) + { + return e[2] ? u(i) + e[2] + u(o) + e[4].replace(/^([=:])\s+/, "$1 ") : e[0] + } + var n = !0, + r = !0, + i, s, o; + return e.map(function (e) + { + var t = e.match(/(\s*)(.*?)(\s*)([=:].*)/); + return t ? i == null ? (i = t[1].length, s = t[2].length, o = t[3].length, t) : (i + s + o != t[1].length + t[2].length + t[3].length && (r = !1), i != t[1].length && (n = !1), i > t[1].length && (i = t[1].length), s < t[2].length && (s = t[2].length), o > t[3].length && (o = t[3].length), t) : [e] + }).map(t ? f : n ? r ? l : f : c) + } + }).call(d.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 n = e.oldSession; + n && (n.multiSelect.off("addRange", this.$onAddRange), n.multiSelect.off("removeRange", this.$onRemoveRange), n.multiSelect.off("multiSelect", this.$onMultiSelect), n.multiSelect.off("singleSelect", this.$onSingleSelect), n.multiSelect.lead.off("change", this.$checkMultiselectChange), n.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 = m, e("./config").defineOptions(d.prototype, "editor", + { + enableMultiselect: + { + set: function (e) + { + m(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("ace/mode/folding/fold_mode", ["require", "exports", "module", "ace/range"], function (e, t, n) +{ + "use strict"; + var r = e("../../range").Range, + i = t.FoldMode = function () {}; + (function () + { + this.foldingStartMarker = null, this.foldingStopMarker = null, this.getFoldWidget = function (e, t, n) + { + var r = e.getLine(n); + return this.foldingStartMarker.test(r) ? "start" : t == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(r) ? "end" : "" + }, this.getFoldWidgetRange = function (e, t, n) + { + return null + }, this.indentationBlock = function (e, t, n) + { + var i = /\S/, + s = e.getLine(t), + o = s.search(i); + if (o == -1) return; + var u = n || s.length, + a = e.getLength(), + f = t, + l = t; + while (++t < a) + { + var c = e.getLine(t).search(i); + if (c == -1) continue; + if (c <= o) break; + l = t + } + if (l > f) + { + var h = e.getLine(l).length; + return new r(f, u, l, h) + } + }, this.openingBracketBlock = function (e, t, n, i, s) + { + var o = { + row: n, + column: i + 1 + }, + u = e.$findClosingBracket(t, o, s); + if (!u) return; + var a = e.foldWidgets[u.row]; + return a == null && (a = e.getFoldWidget(u.row)), a == "start" && u.row > o.row && (u.row--, u.column = e.getLine(u.row).length), r.fromPoints(o, u) + }, this.closingBracketBlock = function (e, t, n, i, s) + { + var o = { + row: n, + column: i + }, + u = e.$findOpeningBracket(t, o); + if (!u) return; + return u.column++, o.column--, r.fromPoints(u, o) + } + }).call(i.prototype) +}), define("ace/theme/textmate", ["require", "exports", "module", "ace/lib/dom"], function (e, t, n) +{ + "use strict"; + t.isDark = !1, t.cssClass = "ace-tm", t.cssText = '.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}', t.$id = "ace/theme/textmate"; + var r = e("../lib/dom"); + r.importCssString(t.cssText, t.cssClass) +}), define("ace/line_widgets", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/range"], function (e, t, n) +{ + "use strict"; + + function o(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) + } + var r = e("./lib/oop"), + i = e("./lib/dom"), + s = e("./range").Range; + (function () + { + this.getRowLength = function (e) + { + var t; + return this.lineWidgets ? t = this.lineWidgets[e] && this.lineWidgets[e].rowCount || 0 : t = 0, !this.$useWrapMode || !this.$wrapData[e] ? 1 + t : this.$wrapData[e].length + 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(); + if (this.editor == e) return; + 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) return; + this.editor = null, t.widgetManager = null, t.renderer.off("beforeRender", this.measureWidgets), t.renderer.off("afterRender", this.renderWidgets); + var n = this.session.lineWidgets; + n && n.forEach(function (e) + { + e && e.el && e.el.parentNode && (e._inDocument = !1, e.el.parentNode.removeChild(e.el)) + }) + }, this.updateOnFold = function (e, t) + { + var n = t.lineWidgets; + if (!n || !e.action) return; + var r = e.data, + i = r.start.row, + s = r.end.row, + o = e.action == "add"; + for (var u = i + 1; u < s; u++) n[u] && (n[u].hidden = o); + n[s] && (o ? n[i] ? n[s].hidden = o : n[i] = n[s] : (n[i] == n[s] && (n[i] = undefined), n[s].hidden = o)) + }, this.updateOnChange = function (e) + { + var t = this.session.lineWidgets; + if (!t) return; + var n = e.start.row, + r = e.end.row - n; + if (r !== 0) + if (e.action == "remove") + { + var i = t.splice(n + 1, r); + i.forEach(function (e) + { + e && this.removeLineWidget(e) + }, this), this.$updateRows() + } + else + { + var s = new Array(r); + s.unshift(n, 0), t.splice.apply(t, s), this.$updateRows() + } + }, this.$updateRows = function () + { + var e = this.session.lineWidgets; + if (!e) return; + var t = !0; + e.forEach(function (e, n) + { + if (e) + { + t = !1, e.row = n; + while (e.$oldWidget) e.$oldWidget.row = n, 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 n = this.editor.renderer; + e.html && !e.el && (e.el = i.createElement("div"), e.el.innerHTML = e.html), e.el && (i.addCssClass(e.el, "ace_lineWidgetContainer"), e.el.style.position = "absolute", e.el.style.zIndex = 5, n.container.appendChild(e.el), e._inDocument = !0), e.coverGutter || (e.el.style.zIndex = 3), e.pixelHeight == null && (e.pixelHeight = e.el.offsetHeight), e.rowCount == null && (e.rowCount = e.pixelHeight / n.layerConfig.lineHeight); + var r = this.session.getFoldAt(e.row, 0); + e.$fold = r; + if (r) + { + var s = this.session.lineWidgets; + e.row == r.end.row && !s[r.start.row] ? s[r.start.row] = e : e.hidden = !0 + } + return this.session._emit("changeFold", + { + data: + { + start: + { + row: e.row + } + } + }), this.$updateRows(), this.renderWidgets(null, n), this.onWidgetChanged(e), e + }, this.removeLineWidget = function (e) + { + e._inDocument = !1, e.session = null, e.el && e.el.parentNode && e.el.parentNode.removeChild(e.el); + if (e.editor && e.editor.destroy) try + { + e.editor.destroy() + } + catch (t) + {} + if (this.session.lineWidgets) + { + var n = this.session.lineWidgets[e.row]; + if (n == e) this.session.lineWidgets[e.row] = e.$oldWidget, e.$oldWidget && this.onWidgetChanged(e.$oldWidget); + else + while (n) + { + if (n.$oldWidget == e) + { + n.$oldWidget = e.$oldWidget; + break + } + n = n.$oldWidget + } + } + this.session._emit("changeFold", + { + data: + { + start: + { + row: e.row + } + } + }), this.$updateRows() + }, this.getWidgetsAtRow = function (e) + { + var t = this.session.lineWidgets, + n = t && t[e], + r = []; + while (n) r.push(n), n = n.$oldWidget; + return r + }, this.onWidgetChanged = function (e) + { + this.session._changedWidgets.push(e), this.editor && this.editor.renderer.updateFull() + }, this.measureWidgets = function (e, t) + { + var n = this.session._changedWidgets, + r = t.layerConfig; + if (!n || !n.length) return; + var i = Infinity; + for (var s = 0; s < n.length; s++) + { + var o = n[s]; + if (!o || !o.el) continue; + if (o.session != this.session) continue; + 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 / r.characterWidth)); + var u = o.h / r.lineHeight; + o.coverLine && (u -= this.session.getRowLineCount(o.row), u < 0 && (u = 0)), o.rowCount != u && (o.rowCount = u, o.row < i && (i = o.row)) + } + i != Infinity && (this.session._emit("changeFold", + { + data: + { + start: + { + row: i + } + } + }), this.session.lineWidgetWidth = null), this.session._changedWidgets = [] + }, this.renderWidgets = function (e, t) + { + var n = t.layerConfig, + r = this.session.lineWidgets; + if (!r) return; + var i = Math.min(this.firstRow, n.firstRow), + s = Math.max(this.lastRow, n.lastRow, r.length); + while (i > 0 && !r[i]) i--; + this.firstRow = n.firstRow, this.lastRow = n.lastRow, t.$cursorLayer.config = n; + for (var o = i; o <= s; o++) + { + var u = r[o]; + if (!u || !u.el) continue; + if (u.hidden) + { + u.el.style.top = -100 - (u.pixelHeight || 0) + "px"; + continue + } + u._inDocument || (u._inDocument = !0, t.container.appendChild(u.el)); + var a = t.$cursorLayer.getPixelPosition( + { + row: o, + column: 0 + }, !0).top; + u.coverLine || (a += n.lineHeight * this.session.getRowLineCount(u.row)), u.el.style.top = a - n.offset + "px"; + var f = u.coverGutter ? 0 : t.gutterWidth; + u.fixedWidth || (f -= t.scrollLeft), u.el.style.left = f + "px", u.fullWidth && u.screenWidth && (u.el.style.minWidth = n.width + 2 * n.padding + "px"), u.fixedWidth ? u.el.style.right = t.scrollBar.getWidth() + "px" : u.el.style.right = "" + } + } + }).call(o.prototype), t.LineWidgets = o +}), define("ace/ext/error_marker", ["require", "exports", "module", "ace/line_widgets", "ace/lib/dom", "ace/range"], function (e, t, n) +{ + "use strict"; + + function o(e, t, n) + { + var r = 0, + i = e.length - 1; + while (r <= i) + { + var s = r + i >> 1, + o = n(t, e[s]); + if (o > 0) r = s + 1; + else + { + if (!(o < 0)) return s; + i = s - 1 + } + } + return -(r + 1) + } + + function u(e, t, n) + { + var r = e.getAnnotations().sort(s.comparePoints); + if (!r.length) return; + var i = o(r, + { + row: t, + column: -1 + }, s.comparePoints); + i < 0 && (i = -i - 1), i >= r.length ? i = n > 0 ? 0 : r.length - 1 : i === 0 && n < 0 && (i = r.length - 1); + var u = r[i]; + if (!u || !n) return; + if (u.row === t) + { + do u = r[i += n]; while (u && u.row === t); + if (!u) return r.slice() + } + var a = []; + t = u.row; + do a[n < 0 ? "unshift" : "push"](u), u = r[i += n]; while (u && u.row == t); + return a.length && a + } + var r = e("../line_widgets").LineWidgets, + i = e("../lib/dom"), + s = e("../range").Range; + t.showErrorMarker = function (e, t) + { + var n = e.session; + n.widgetManager || (n.widgetManager = new r(n), n.widgetManager.attach(e)); + var s = e.getCursorPosition(), + o = s.row, + a = n.widgetManager.getWidgetsAtRow(o).filter(function (e) + { + return e.type == "errorMarker" + })[0]; + a ? a.destroy() : o -= t; + var f = u(n, o, t), + l; + if (f) + { + var c = f[0]; + s.column = (c.pos && typeof c.column != "number" ? c.pos.sc : c.column) || 0, s.row = c.row, l = e.renderer.$gutterLayer.$annotations[s.row] + } + else + { + if (a) return; + l = { + text: ["Looks good!"], + className: "ace_ok" + } + } + e.session.unfold(s.row), e.selection.moveToPosition(s); + var h = { + row: s.row, + fixedWidth: !0, + coverGutter: !0, + el: i.createElement("div"), + type: "errorMarker" + }, + p = h.el.appendChild(i.createElement("div")), + d = h.el.appendChild(i.createElement("div")); + d.className = "error_widget_arrow " + l.className; + var v = e.renderer.$cursorLayer.getPixelPosition(s).left; + d.style.left = v + e.renderer.gutterWidth - 5 + "px", h.el.className = "error_widget_wrapper", p.className = "error_widget " + l.className, p.innerHTML = l.text.join("
"), p.appendChild(i.createElement("div")); + var m = function (e, t, n) + { + if (t === 0 && (n === "esc" || n === "return")) return h.destroy(), + { + command: "null" + } + }; + h.destroy = function () + { + if (e.$mouseHandler.isMousePressed) return; + e.keyBinding.removeKeyboardHandler(m), n.widgetManager.removeLineWidget(h), e.off("changeSelection", h.destroy), e.off("changeSession", h.destroy), e.off("mouseup", h.destroy), e.off("change", h.destroy) + }, e.keyBinding.addKeyboardHandler(m), e.on("changeSelection", h.destroy), e.on("changeSession", h.destroy), e.on("mouseup", h.destroy), e.on("change", h.destroy), e.session.widgetManager.addLineWidget(h), h.el.onmousedown = e.focus.bind(e), e.renderer.scrollCursorIntoView(null, .5, + { + bottom: h.el.offsetHeight + }) + }, i.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("ace/ace", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/lib/dom", "ace/lib/event", "ace/range", "ace/editor", "ace/edit_session", "ace/undomanager", "ace/virtual_renderer", "ace/worker/worker_client", "ace/keyboard/hash_handler", "ace/placeholder", "ace/multi_select", "ace/mode/folding/fold_mode", "ace/theme/textmate", "ace/ext/error_marker", "ace/config"], function (e, t, n) +{ + "use strict"; + e("./lib/fixoldbrowsers"); + var r = e("./lib/dom"), + i = e("./lib/event"), + s = e("./range").Range, + o = e("./editor").Editor, + u = e("./edit_session").EditSession, + a = e("./undomanager").UndoManager, + f = 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, typeof define == "function" && (t.define = define), t.edit = function (e, n) + { + if (typeof e == "string") + { + var s = e; + e = document.getElementById(s); + if (!e) throw new Error("ace.edit can't find div #" + s) + } + if (e && e.env && e.env.editor instanceof o) return e.env.editor; + var u = ""; + if (e && /input|textarea/i.test(e.tagName)) + { + var a = e; + u = a.value, e = r.createElement("pre"), a.parentNode.replaceChild(e, a) + } + else e && (u = e.textContent, e.innerHTML = ""); + var l = t.createEditSession(u), + c = new o(new f(e), l, n), + h = { + document: l, + editor: c, + onResize: c.resize.bind(c, null) + }; + return a && (h.textarea = a), i.addListener(window, "resize", h.onResize), c.on("destroy", function () + { + i.removeListener(window, "resize", h.onResize), h.editor.container.env = null + }), c.container.env = c.env = h, c + }, t.createEditSession = function (e, t) + { + var n = new u(e, t); + return n.setUndoManager(new a), n + }, t.Range = s, t.EditSession = u, t.UndoManager = a, t.VirtualRenderer = f, t.version = "1.3.3" +}); +(function () +{ + window.require(["ace/ace"], function (a) + { + if (a) + { + a.config.init(true); + a.define = window.define; + } + if (!window.ace) + window.ace = a; + for (var key in a) + if (a.hasOwnProperty(key)) + window.ace[key] = a[key]; + window.ace["default"] = window.ace; + if (typeof module == "object" && typeof exports == "object" && module) + { + module.exports = window.ace; + } + }); +})(); \ No newline at end of file diff --git a/components/editor/init.js b/components/editor/init.js index a67f670..a974c12 100755 --- a/components/editor/init.js +++ b/components/editor/init.js @@ -1,1543 +1,1567 @@ -/* - * Copyright (c) Codiad & Kent Safranski (codiad.com), distributed - * as-is and without warranty under the MIT License. See - * [root]/license.txt for more. This information must remain intact. - */ - -(function(global, $) { - - // Classes from Ace - var VirtualRenderer = ace.require('ace/virtual_renderer').VirtualRenderer; - var Editor = ace.require('ace/editor').Editor; - var EditSession = ace.require('ace/edit_session').EditSession; - var UndoManager = ace.require("ace/undomanager").UndoManager; - - // Editor modes that have been loaded - var editorModes = {}; - - var codiad = global.codiad; - codiad._cursorPoll = null; - - var separatorWidth = 3; - - $(function(){ - codiad.editor.init(); - }); - - // modes available for selecting - var availableTextModes = new Array( - 'abap', - 'abc', - 'actionscript', - 'ada', - 'apache_conf', - 'applescript', - 'asciidoc', - 'assembly_x86', - 'autohotkey', - 'batchfile', - 'c9search', - 'c_cpp', - 'cirru', - 'clojure', - 'cobol', - 'coffee', - 'coldfusion', - 'csharp', - 'css', - 'curly', - 'd', - 'dart', - 'diff', - 'django', - 'dockerfile', - 'dot', - 'eiffel', - 'ejs', - 'elixir', - 'elm', - 'erlang', - 'forth', - 'ftl', - 'gcode', - 'gherkin', - 'gitignore', - 'glsl', - 'gobstones', - 'golang', - 'groovy', - 'haml', - 'handlebars', - 'haskell', - 'haxe', - 'html', - 'html_elixir', - 'html_ruby', - 'ini', - 'io', - 'jack', - 'jade', - 'java', - 'javascript', - 'json', - 'jsoniq', - 'jsp', - 'jsx', - 'julia', - 'latex', - 'lean', - 'less', - 'liquid', - 'lisp', - 'livescript', - 'logiql', - 'lsl', - 'lua', - 'luapage', - 'lucene', - 'makefile', - 'markdown', - 'mask', - 'matlab', - 'maze', - 'mel', - 'mips_assembler', - 'mushcode', - 'mysql', - 'nix', - 'nsis', - 'objectivec', - 'ocaml', - 'pascal', - 'perl', - 'pgsql', - 'php', - 'plain_text', - 'powershell', - 'praat', - 'prolog', - 'protobuf', - 'python', - 'r', - 'razor', - 'rdoc', - 'rhtml', - 'rst', - 'ruby', - 'rust', - 'sass', - 'scad', - 'scala', - 'scheme', - 'scss', - 'sh', - 'sjs', - 'smarty', - 'snippets', - 'soy_template', - 'space', - 'sql', - 'sqlserver', - 'stylus', - 'svg', - 'swift', - 'swig', - 'tcl', - 'tex', - 'text', - 'textile', - 'toml', - 'twig', - 'typescript', - 'vala', - 'vbscript', - 'velocity', - 'verilog', - 'vhdl', - 'wollok', - 'xml', - 'xquery', - 'yaml' - ); - - function SplitContainer(root, children, splitType) { - var _this = this; - - this.root = root; - this.splitType = splitType; - this.childContainers = {}; - this.childElements = {}; - this.splitProp = 0.5; - - this.setChild(0, children[0]); - this.setChild(1, children[1]); - - this.splitter = $('
') - .addClass('splitter') - .appendTo(root) - .draggable({ - axis: (splitType === 'horizontal' ? 'x' : 'y'), - drag: function(e, ui){ - if (_this.splitType === 'horizontal') { - var w1, w2; - w1 = ui.position.left - separatorWidth/2; - w2 = _this.root.width() - ui.position.left - - separatorWidth/2; - _this.splitProp = w1 / _this.root.width(); - _this.childElements[0] - .width(w1) - .trigger('h-resize', [true, true]); - _this.childElements[1] - .width(w2) - .css('left', w1 + separatorWidth + 'px') - .trigger('h-resize', [true, true]); - _this.splitProp = ui.position.left / _this.root.width(); - } else { - var h1, h2; - h1 = ui.position.top - separatorWidth/2; - h2 = _this.root.width() - ui.position.top - - separatorWidth/2; - _this.splitProp = h1 / _this.root.height(); - _this.childElements[0] - .height(h1) - .trigger('v-resize', [true, true]); - _this.childElements[1] - .height(h2) - .css('top', h1 + separatorWidth + 'px') - .trigger('v-resize', [true, true]); - } - } - }); - - if (splitType === 'horizontal') { - this.splitter - .addClass('h-splitter') - .width(separatorWidth) - .height(root.height()); - } else if (splitType === 'vertical') { - this.splitter - .addClass('v-splitter') - .height(separatorWidth) - .width(root.width()); - } - - this.root.on('h-resize', function(e, percolateUp, percolateDown){ - e.stopPropagation(); - if (_this.splitType === 'horizontal') { - var w1, w2; - w1 = _this.root.width() * _this.splitProp - - separatorWidth / 2; - w2 = _this.root.width() * (1 - _this.splitProp) - - separatorWidth / 2; - _this.childElements[0] - .width(w1); - _this.childElements[1] - .width(w2) - .css('left', w1 + separatorWidth); - _this.splitter.css('left', w1); - } else if (_this.splitType === 'vertical') { - var w = _this.root.width(); - _this.childElements[0] - .width(w); - _this.childElements[1] - .width(w); - _this.splitter.width(w); - } - if (percolateUp) { - _this.root.parent('.editor-wrapper') - .trigger('h-resize', [true ,false]); - } - if (! percolateDown) return; - if (_this.childContainers[0]) { - _this.childContainers[0].root - .trigger('h-resize', [false, true]); - } else if (_this.childContainers[1]) { - _this.childContainers[1].root - .trigger('h-resize', [false, true]); - } - }); - - this.root.on('v-resize', function(e, percolateUp, percolateDown){ - e.stopPropagation(); - if (_this.splitType === 'horizontal') { - var h = _this.root.height(); - _this.childElements[0] - .height(h); - _this.childElements[1] - .height(h); - _this.splitter.height(h); - } else if (_this.splitType === 'vertical') { - var h1 = _this.root.height() * _this.splitProp - - separatorWidth / 2; - var h2 = _this.root.height() * (1 - _this.splitProp) - - separatorWidth / 2; - _this.childElements[0] - .height(h1); - _this.childElements[1] - .height(h2) - .css('top', h1+separatorWidth); - _this.splitter.css('top', h1); - } - if (percolateUp) { - _this.root.parent('.editor-wrapper') - .trigger('v-resize', [true ,false]); - } - if (! percolateDown) return; - if (_this.childContainers[0]) { - _this.childContainers[0].root - .trigger('v-resize', [false, true]); - } else if (_this.childContainers[1]) { - _this.childContainers[1].root - .trigger('v-resize', [false, true]); - } - }); - - this.root - .trigger('h-resize', [false, false]) - .trigger('v-resize', [false, false]); - } - - SplitContainer.prototype = { - setChild: function(idx, el){ - - if (el instanceof SplitContainer) { - this.childElements[idx] = el.root; - this.childContainers[idx] = el; - el.idx = idx; - } else { - this.childElements[idx] = el; - } - - this.childElements[idx].appendTo(this.root); - this.cssInit(this.childElements[idx], idx); - }, - cssInit: function(el, idx){ - var props = {}; - var h1, h2, w1, w2, rh, rw; - - rh = this.root.height(); - rw = this.root.width(); - - if (this.splitType === 'horizontal') { - - w1 = rw * this.splitProp - separatorWidth / 2; - w2 = rw * (1 - this.splitProp) - separatorWidth / 2; - - if (idx === 0) { - props = { - left: 0, - width: w1, - height: rh, - top: 0 - }; - } else { - props = { - left: w1 + separatorWidth, - width: w2, - height: rh, - top: 0 - }; - } - - } else if (this.splitType === 'vertical') { - - h1 = rh * this.splitProp - separatorWidth / 2; - h2 = rh * (1 - this.splitProp) - separatorWidth / 2; - - if (idx === 0) { - props = { - top: 0, - height: h1, - width: rw, - left: 0 - }; - } else { - props = { - top: h1 + separatorWidth, - height: h2, - width: rw, - left: 0 - }; - } - - } - - el.css(props); - } - }; - - ////////////////////////////////////////////////////////////////// - // - // Editor Component for Codiad - // --------------------------- - // Manage the lifecycle of Editor instances - // - ////////////////////////////////////////////////////////////////// - - codiad.editor = { - - /// Editor instances - One instance corresponds to an editor - /// pane in the user interface. Different EditSessions - /// (ace/edit_session) - instances: [], - - /// Currently focussed editor - activeInstance: null, - - // Settings for Editor instances - settings: { - theme: 'twilight', - fontSize: '13px', - printMargin: false, - printMarginColumn: 80, - highlightLine: true, - indentGuides: true, - wrapMode: false, - softTabs: false, - persistentModal: true, - rightSidebarTrigger: false, - fileManagerTrigger: false, - tabSize: 4 - }, - - rootContainer: null, - - fileExtensionTextMode: {}, - - init: function(){ - this.createSplitMenu(); - this.createModeMenu(); - - var er = $('#editor-region'); - - er.on('h-resize-init', function(){ - $('#editor-region > .editor-wrapper') - .width($(this).width()) - .trigger('h-resize'); - - }).on('v-resize-init', function(){ - $('#editor-region > .editor-wrapper') - .height($(this).height()) - .trigger('v-resize'); - }); - - - $(window).resize(function(){ - $('#editor-region') - .trigger('h-resize-init') - .trigger('v-resize-init'); - }); - }, - - ////////////////////////////////////////////////////////////////// - // - // Retrieve editor settings from localStorage - // - ////////////////////////////////////////////////////////////////// - - getSettings: function() { - var boolVal = null; - var theme = localStorage.getItem('codiad.editor.theme'); - - var _this = this; - - $.each(['theme', 'fontSize', 'tabSize'], function(idx, key) { - var localValue = localStorage.getItem('codiad.editor.' + key); - if (localValue !== null) { - _this.settings[key] = localValue; - } - }); - - $.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode', 'rightSidebarTrigger', 'fileManagerTrigger', 'softTabs', 'persistentModal'], - function(idx, key) { - var localValue = - localStorage.getItem('codiad.editor.' + key); - if (localValue === null) { - return; - } - _this.settings[key] = (localValue == 'true'); - }); - $.each(['printMarginColumn'], - function(idx, key) { - var localValue = - localStorage.getItem('codiad.editor.' + key); - if (localValue === null) { - return; - } - _this.settings[key] = localValue; - }); - }, - - ///////////////////////////////////////////////////////////////// - // - // Apply configuration settings - // - // Parameters: - // i - {Editor} - // - ///////////////////////////////////////////////////////////////// - - applySettings: function(i) { - // Check user-specified settings - this.getSettings(); - - // Apply the current configuration settings: - i.setTheme('ace/theme/' + this.settings.theme); - i.setFontSize(this.settings.fontSize); - i.setPrintMarginColumn(this.settings.printMarginColumn); - i.setShowPrintMargin(this.settings.printMargin); - i.setHighlightActiveLine(this.settings.highlightLine); - i.setDisplayIndentGuides(this.settings.indentGuides); - i.getSession().setUseWrapMode(this.settings.wrapMode); - this.setTabSize(this.settings.tabSize, i); - this.setSoftTabs(this.settings.softTabs, i); - }, - - ////////////////////////////////////////////////////////////////// - // - // Create a new editor instance attached to given session - // - // Parameters: - // session - {EditSession} Session to be used for new Editor instance - // - ////////////////////////////////////////////////////////////////// - - addInstance: function(session, where) { - var el = $('
'); - var chType, chArr = [], sc = null, chIdx = null; - var _this = this; - - if (this.instances.length == 0) { - // el.appendTo($('#editor-region')); - el.appendTo($('#root-editor-wrapper')); - } else { - - var ch = this.activeInstance.el; - var root; - - chIdx = (where === 'top' || where === 'left') ? 0 : 1; - chType = (where === 'top' || where === 'bottom') ? - 'vertical' : 'horizontal'; - - chArr[chIdx] = el; - chArr[1 - chIdx] = ch; - - root = $('
') - .height(ch.height()) - .width(ch.width()) - .addClass('editor-wrapper-' + chType) - .appendTo(ch.parent()); - - sc = new SplitContainer(root, chArr, chType); - - if (this.instances.length > 1) { - var pContainer = this.activeInstance.splitContainer; - var idx = this.activeInstance.splitIdx; - pContainer.setChild(idx, sc); - } - } - - var i = ace.edit(el[0]); - var resizeEditor = function(){ - i.resize(); - }; - - if (sc) { - i.splitContainer = sc; - i.splitIdx = chIdx; - - this.activeInstance.splitContainer = sc; - this.activeInstance.splitIdx = 1 - chIdx; - - sc.root - .on('h-resize', resizeEditor) - .on('v-resize', resizeEditor); - - if (this.instances.length === 1) { - var re = function(){ - _this.instances[0].resize(); - }; - sc.root - .on('h-resize', re) - .on('v-resize', re); - } - } - - i.el = el; - this.setSession(session, i); - - this.changeListener(i); - this.cursorTracking(i); - this.bindKeys(i); - - this.instances.push(i); - - i.on('focus', function(){ - _this.focus(i); - }); - - return i; - }, - - createSplitMenu: function(){ - var _this = this; - var _splitOptionsMenu = $('#split-options-menu'); - - this.initMenuHandler($('#split'),_splitOptionsMenu); - - $('#split-horizontally a').click(function(e){ - e.stopPropagation(); - _this.addInstance(_this.activeInstance.getSession(), 'bottom'); - _splitOptionsMenu.hide(); - }); - - $('#split-vertically a').click(function(e){ - e.stopPropagation(); - _this.addInstance(_this.activeInstance.getSession(), 'right'); - _splitOptionsMenu.hide(); - }); - - $('#merge-all a').click(function(e){ - e.stopPropagation(); - var s = _this.activeInstance.getSession(); - _this.exterminate(); - _this.addInstance(s); - _splitOptionsMenu.hide(); - }); - }, - - createModeMenu: function(){ - var _this = this; - var _thisMenu = $('#changemode-menu'); - var modeColumns = new Array(); - var modeOptions = new Array(); - var maxOptionsColumn = 15; - var firstOption = 0; - - this.initMenuHandler($('#current-mode'),_thisMenu); - - availableTextModes.sort(); - $.each(availableTextModes, function(i){ - modeOptions.push('
  • '+availableTextModes[i]+'
  • '); - }); - - var html = ''; - while(true) { - html += ''; - firstOption = firstOption + maxOptionsColumn; - if(firstOption >= modeOptions.length) { - break; - } - } - - html += '
      '; - if ((modeOptions.length-firstOption) < maxOptionsColumn) { - max = modeOptions.length; - } else { - max = firstOption + maxOptionsColumn; - } - var currentcolumn = modeOptions.slice(firstOption, max); - for (var option in currentcolumn) { - html += currentcolumn[option]; - } - html += '
    '; - _thisMenu.html(html); - - $('#changemode-menu a').click(function(e){ - e.stopPropagation(); - var newMode = "ace/mode/" + $(e.currentTarget).text(); - var actSession = _this.activeInstance.getSession(); - - // handle async mode change - var fn = function(){ - _this.setModeDisplay(actSession); - actSession.removeListener('changeMode', fn); - }; - actSession.on("changeMode", fn); - - actSession.setMode(newMode); - _thisMenu.hide(); - - }); - }, - - initMenuHandler: function(button,menu){ - var _this = this; - var thisButton = button; - var thisMenu = menu; - - thisMenu.appendTo($('body')); - - thisButton.click(function(e){ - var wh = $(window).height(); - - e.stopPropagation(); - - // close other menus - _this.closeMenus(thisMenu); - - thisMenu.css({ - // display: 'block', - bottom: ( (wh - $(this).offset().top) + 8) + 'px', - left: ($(this).offset().left - 13) + 'px' - }); - - thisMenu.slideToggle('fast'); - - // handle click-out autoclosing - var fn = function(){ - thisMenu.hide(); - $(window).off('click', fn); - }; - $(window).on('click', fn); - }); - }, - - closeMenus: function(exclude){ - var menuId = exclude.attr("id"); - if(menuId != 'split-options-menu') $('#split-options-menu').hide(); - if(menuId != 'changemode-menu') $('#changemode-menu').hide(); - }, - - setModeDisplay: function(session){ - var currMode = session.getMode().$id; - if(currMode){ - currMode = currMode.substring(currMode.lastIndexOf('/') + 1); - $('#current-mode').html(currMode); - } else { - $('#current-mode').html('text'); - } - }, - - ////////////////////////////////////////////////////////////////// - // - // Remove all Editor instances and clean up the DOM - // - ////////////////////////////////////////////////////////////////// - - exterminate: function() { - $('.editor').remove(); - $('.editor-wrapper').remove(); - $('#editor-region').append($('
    ').attr('id', 'editor')); - $('#current-file').html(''); - $('#current-mode').html(''); - this.instances = []; - this.activeInstance = null; - }, - - ////////////////////////////////////////////////////////////////// - // - // Detach EditSession session from all Editor instances replacing - // them with replacementSession - // - ////////////////////////////////////////////////////////////////// - - removeSession: function(session, replacementSession) { - for (var k = 0; k < this.instances.length; k++) { - if (this.instances[k].getSession().path === session.path) { - this.instances[k].setSession(replacementSession); - } - } - if ($('#current-file').text() === session.path) { - $('#current-file').text(replacementSession.path); - } - - this.setModeDisplay(replacementSession); - }, - - isOpen: function(session){ - for (var k = 0; k < this.instances.length; k++) { - if (this.instances[k].getSession().path === session.path) { - return true; - } - } - return false; - }, - - ///////////////////////////////////////////////////////////////// - // - // Convenience function to iterate over Editor instances - // - // Parameters: - // fn - {Function} callback called with each member as an argument - // - ///////////////////////////////////////////////////////////////// - - forEach: function(fn) { - for (var k = 0; k < this.instances.length; k++) { - fn.call(this, this.instances[k]); - } - }, - - ///////////////////////////////////////////////////////////////// - // - // Get the currently active Editor instance - // - // In a multi-pane setup this would correspond to the - // editor pane user is currently working on. - // - ///////////////////////////////////////////////////////////////// - - getActive: function() { - return this.activeInstance; - }, - - ///////////////////////////////////////////////////////////////// - // - // Set an editor instance as active - // - // Parameters: - // i - {Editor} - // - ///////////////////////////////////////////////////////////////// - - setActive: function(i) { - if (! i) return; - this.activeInstance = i; - $('#current-file').text(i.getSession().path); - this.setModeDisplay(i.getSession()); - }, - - ///////////////////////////////////////////////////////////////// - // - // Change the EditSession of Editor instance - // - // Parameters: - // session - {EditSession} - // i - {Editor} - // - ///////////////////////////////////////////////////////////////// - - setSession: function(session, i) { - i = i || this.getActive(); - if (! this.isOpen(session)) { - if (! i) { - i = this.addInstance(session); - } else { - i.setSession(session); - } - } else { - // Proxy session is required because scroll-position and - // cursor position etc. are shared among sessions. - - var proxySession = new EditSession(session.getDocument(), - session.getMode()); - proxySession.setUndoManager(new UndoManager()); - proxySession.path = session.path; - proxySession.listThumb = session.listThumb; - proxySession.tabThumb = session.tabThumb; - if (! i) { - i = this.addInstance(proxySession); - } else { - i.setSession(proxySession); - } - } - this.applySettings(i); - - this.setActive(i); - }, - - ///////////////////////////////////////////////////////////////// - // - // Select file mode by extension case insensitive - // - // Parameters: - // e - {String} File extension - // - ///////////////////////////////////////////////////////////////// - - selectMode: function(e) { - if(typeof(e) != 'string'){ - return 'text'; - } - e = e.toLowerCase(); - - if(e in this.fileExtensionTextMode){ - return this.fileExtensionTextMode[e]; - }else{ - return 'text'; - } - }, - - ///////////////////////////////////////////////////////////////// - // - // Add an text mode for an extension - // - // Parameters: - // extension - {String} File Extension - // mode - {String} TextMode for this extension - // - ///////////////////////////////////////////////////////////////// - - addFileExtensionTextMode: function(extension, mode){ - if(typeof(extension) != 'string' || typeof(mode) != 'string'){ - if (console){ - console.warn('wrong usage of addFileExtensionTextMode, both parameters need to be string'); - } - return; - } - mode = mode.toLowerCase(); - this.fileExtensionTextMode[extension] = mode; - }, - - ///////////////////////////////////////////////////////////////// - // - // clear all extension-text mode joins - // - ///////////////////////////////////////////////////////////////// - - clearFileExtensionTextMode: function(){ - this.fileExtensionTextMode = {}; - }, - - ///////////////////////////////////////////////////////////////// - // - // Set the editor mode - // - // Parameters: - // m - {TextMode} mode - // i - {Editor} Editor (Defaults to active editor) - // - ///////////////////////////////////////////////////////////////// - - setMode: function(m, i) { - i = i || this.getActive(); - - // Check if mode is already loaded - if (! editorModes[m]) { - - // Load the Mode - var modeFile = 'components/editor/ace-editor/mode-' + m + '.js'; - $.loadScript(modeFile, function() { - - // Mark the mode as loaded - editorModes[m] = true; - var EditorMode = ace.require('ace/mode/' + m).Mode; - i.getSession().setMode(new EditorMode()); - }, true); - } else { - - var EditorMode = ace.require('ace/mode/' + m).Mode; - i.getSession().setMode(new EditorMode()); - - } - }, - - ///////////////////////////////////////////////////////////////// - // - // Set the editor theme - // - // Parameters: - // t - {String} theme eg. twilight, cobalt etc. - // i - {Editor} Editor instance (If omitted, Defaults to all editors) - // - // For a list of themes supported by Ace - refer : - // https://github.com/ajaxorg/ace/tree/master/lib/ace/theme - // - // TODO: Provide support for custom themes - // - ///////////////////////////////////////////////////////////////// - - setTheme: function(t, i) { - if (i) { - // If a specific instance is specified, change the theme for - // this instance - i.setTheme('ace/theme/'+ t); - } else { - // Change the theme for the existing editor instances - // and make it the default for new instances - this.settings.theme = t; - for (var k = 0; k < this.instances.length; k++) { - this.instances[k].setTheme('ace/theme/'+ t); - } - } - // LocalStorage - localStorage.setItem('codiad.editor.theme', t); - }, - - ///////////////////////////////////////////////////////////////// - // - // Set contents of the editor - // - // Parameters: - // c - {String} content - // i - {Editor} (Defaults to active editor) - // - ///////////////////////////////////////////////////////////////// - - setContent: function(c, i) { - i = i || this.getActive(); - i.getSession().setValue(c); - }, - - ///////////////////////////////////////////////////////////////// - // - // Set Font Size - // - // Set the font for all Editor instances and remember - // the value for Editor instances to be created in - // future - // - // Parameters: - // s - {Number} font size - // i - {Editor} Editor instance (If omitted, Defaults to all editors) - // - ///////////////////////////////////////////////////////////////// - - setFontSize: function(s, i) { - if (i) { - i.setFontSize(s); - } else { - this.settings.fontSize = s; - this.forEach(function(i) { - i.setFontSize(s); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.fontSize', s); - }, - - - ///////////////////////////////////////////////////////////////// - // - // Enable/disable Highlighting of active line - // - // Parameters: - // h - {Boolean} - // i - {Editor} Editor instance ( If left out, setting is - // applied to all editors ) - // - ///////////////////////////////////////////////////////////////// - - setHighlightLine: function(h, i) { - if (i) { - i.setHighlightActiveLine(h); - } else { - this.settings.highlightLine = h; - this.forEach(function(i) { - i.setHighlightActiveLine(h); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.highlightLine', h); - }, - - ////////////////////////////////////////////////////////////////// - // - // Show/Hide print margin indicator - // - // Parameters: - // p - {Number} print margin column - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setPrintMargin: function(p, i) { - if (i) { - i.setShowPrintMargin(p); - } else { - this.settings.printMargin = p; - this.forEach(function(i) { - i.setShowPrintMargin(p); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.printMargin', p); - }, - - ////////////////////////////////////////////////////////////////// - // - // Set print margin column - // - // Parameters: - // p - {Number} print margin column - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setPrintMarginColumn: function(p, i) { - if (i) { - i.setPrintMarginColumn(p); - } else { - this.settings.printMarginColumn = p; - this.forEach(function(i) { - i.setPrintMarginColumn(p); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.printMarginColumn', p); - }, - - ////////////////////////////////////////////////////////////////// - // - // Show/Hide indent guides - // - // Parameters: - // g - {Boolean} - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setIndentGuides: function(g, i) { - if (i) { - i.setDisplayIndentGuides(g); - } else { - this.settings.indentGuides = g; - this.forEach(function(i) { - i.setDisplayIndentGuides(g); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.indentGuides', g); - }, - - ////////////////////////////////////////////////////////////////// - // - // Enable/Disable Code Folding - // - // Parameters: - // f - {Boolean} - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setCodeFolding: function(f, i) { - if (i) { - i.setFoldStyle(f); - } else { - this.forEach(function(i) { - i.setFoldStyle(f); - }); - } - }, - - ////////////////////////////////////////////////////////////////// - // - // Enable/Disable Line Wrapping - // - // Parameters: - // w - {Boolean} - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setWrapMode: function(w, i) { - if (i) { - i.getSession().setUseWrapMode(w); - } else { - this.forEach(function(i) { - i.getSession().setUseWrapMode(w); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.wrapMode', w); - }, - - ////////////////////////////////////////////////////////////////// - // - // Set last position of modal to be saved - // - // Parameters: - // t - {Boolean} (false for Automatic Position, true for Last Position) - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setPersistentModal: function(t, i) { - this.settings.persistentModal = t; - // LocalStorage - localStorage.setItem('codiad.editor.persistentModal', t); - }, - - ////////////////////////////////////////////////////////////////// - // - // Set trigger for opening the right sidebar - // - // Parameters: - // t - {Boolean} (false for Hover, true for Click) - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setRightSidebarTrigger: function(t, i) { - this.settings.rightSidebarTrigger = t; - // LocalStorage - localStorage.setItem('codiad.editor.rightSidebarTrigger', t); - }, - - ////////////////////////////////////////////////////////////////// - // - // Set trigger for clicking on the filemanager - // - // Parameters: - // t - {Boolean} (false for Hover, true for Click) - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setFileManagerTrigger: function(t, i) { - this.settings.fileManagerTrigger = t; - // LocalStorage - localStorage.setItem('codiad.editor.fileManagerTrigger', t); - codiad.project.loadSide(); - }, - - - ////////////////////////////////////////////////////////////////// - // - // set Tab Size - // - // Parameters: - // s - size - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setTabSize: function(s, i) { - if (i) { - i.getSession().setTabSize(parseInt(s)); - } else { - this.forEach(function(i) { - i.getSession().setTabSize(parseInt(s)); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.tabSize', s); - - }, - - ////////////////////////////////////////////////////////////////// - // - // Enable or disable Soft Tabs - // - // Parameters: - // t - true / false - // i - {Editor} (If omitted, Defaults to all editors) - // - ////////////////////////////////////////////////////////////////// - - setSoftTabs: function(t, i) { - if (i) { - i.getSession().setUseSoftTabs(t); - } else { - this.forEach(function(i) { - i.getSession().setUseSoftTabs(t); - }); - } - // LocalStorage - localStorage.setItem('codiad.editor.softTabs', t); - - }, - - ////////////////////////////////////////////////////////////////// - // - // Get content from editor - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - getContent: function(i) { - i = i || this.getActive(); - if (! i) return; - var content = i.getSession().getValue(); - if (!content) { - content = ' '; - } // Pass something through - return content; - }, - - ////////////////////////////////////////////////////////////////// - // - // Resize the editor - Trigger the editor to readjust its layout - // esp if the container has been resized manually. - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - resize: function(i) { - i = i || this.getActive(); - if (! i) return; - i.resize(); - }, - - ////////////////////////////////////////////////////////////////// - // - // Mark the instance as changed (in the user interface) - // upon change in the document content. - // - // Parameters: - // i - {Editor} - // - ////////////////////////////////////////////////////////////////// - - changeListener: function(i) { - var _this = this; - i.on('change', function() { - codiad.active.markChanged(_this.getActive().getSession().path); - }); - }, - - ////////////////////////////////////////////////////////////////// - // - // Get Selected Text - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - getSelectedText: function(i) { - i = i || this.getActive(); - if (! i) return; - return i.getCopyText(); - }, - - ////////////////////////////////////////////////////////////////// - // - // Insert text - // - // Parameters: - // val - {String} Text to be inserted - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - insertText: function(val, i) { - i = i || this.getActive(); - if (! i) return; - i.insert(val); - }, - - ////////////////////////////////////////////////////////////////// - // - // Move the cursor to a particular line - // - // Parameters: - // line - {Number} Line number - // i - {Editor} Editor instance - // - ////////////////////////////////////////////////////////////////// - - gotoLine: function(line, i) { - i = i || this.getActive(); - if (! i) return; - i.gotoLine(line, 0, true); - }, - - ////////////////////////////////////////////////////////////////// - // - // Focus an editor - // - // Parameters: - // i - {Editor} Editor instance (Defaults to current editor) - // - ////////////////////////////////////////////////////////////////// - - focus: function(i) { - i = i || this.getActive(); - this.setActive(i); - if (! i) return; - i.focus(); - codiad.active.focus(i.getSession().path); - this.cursorTracking(i); - }, - - ////////////////////////////////////////////////////////////////// - // - // Setup Cursor Tracking - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - cursorTracking: function(i) { - i = i || this.getActive(); - if (! i) return; - clearInterval(codiad._cursorPoll); - codiad._cursorPoll = setInterval(function() { - $('#cursor-position') - .html(i18n('Ln') + ': ' - + (i.getCursorPosition().row + 1) - + ' · ' + i18n('Col') + ': ' - + i.getCursorPosition().column - ); - }, 100); - }, - - ////////////////////////////////////////////////////////////////// - // - // Setup Key bindings - // - // Parameters: - // i - {Editor} - // - ////////////////////////////////////////////////////////////////// - - bindKeys: function(i) { - - var _this = this; - - // Find - i.commands.addCommand({ - name: 'Find', - bindKey: { - win: 'Ctrl-F', - mac: 'Command-F' - }, - exec: function(e) { - _this.openSearch('find'); - } - }); - - // Find + Replace - i.commands.addCommand({ - name: 'Replace', - bindKey: { - win: 'Ctrl-R', - mac: 'Command-R' - }, - exec: function(e) { - _this.openSearch('replace'); - } - }); - - i.commands.addCommand({ - name: 'Move Up', - bindKey: { - win: 'Ctrl-up', - mac: 'Command-up' - }, - exec: function(e) { - codiad.active.move('up'); - } - }); - - i.commands.addCommand({ - name: 'Move Down', - bindKey: { - win: 'Ctrl-down', - mac: 'Command-up' - }, - exec: function(e) { - codiad.active.move('down'); - } - }); - - }, - - ////////////////////////////////////////////////////////////////// - // - // Present the Search (Find + Replace) dialog box - // - // Parameters: - // type - {String} Optional, defaults to find. Provide 'replace' for replace dialog. - // - ////////////////////////////////////////////////////////////////// - - openSearch: function(type) { - if (this.getActive()) { - codiad.modal.load(400, - 'components/editor/dialog.php?action=search&type=' + - type); - codiad.modal.hideOverlay(); - } else { - codiad.message.error('No Open Files'); - } - }, - - ////////////////////////////////////////////////////////////////// - // - // Perform Search (Find + Replace) operation - // - // Parameters: - // action - {String} find | replace | replaceAll - // i - {Editor} Defaults to active Editor instance - // - ////////////////////////////////////////////////////////////////// - - search: function(action, i) { - i = i || this.getActive(); - if (! i) return; - var find = $('#modal input[name="find"]') - .val(); - var replace = $('#modal input[name="replace"]') - .val(); - switch (action) { - case 'find': - - i.find(find, { - backwards: false, - wrap: true, - caseSensitive: false, - wholeWord: false, - regExp: false - }); - - break; - - case 'replace': - - i.find(find, { - backwards: false, - wrap: true, - caseSensitive: false, - wholeWord: false, - regExp: false - }); - i.replace(replace); - - break; - - case 'replaceAll': - - i.find(find, { - backwards: false, - wrap: true, - caseSensitive: false, - wholeWord: false, - regExp: false - }); - i.replaceAll(replace); - - break; - } - }, - - ////////////////////////////////////////////////////////////////// - // - // Enable editor - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - enableEditing: function(i) { - i = i || this.getActive(); - if (! i) return; - i.textInput.setReadOnly( false ); - }, - - ////////////////////////////////////////////////////////////////// - // - // Disable editor - // - // Parameters: - // i - {Editor} (Defaults to active editor) - // - ////////////////////////////////////////////////////////////////// - - disableEditing: function(i) { - i = i || this.getActive(); - if (! i) return; - i.textInput.setReadOnly( true ); - }, - - }; - -})(this, jQuery); +/* + * Copyright (c) Codiad & Kent Safranski (codiad.com), distributed + * as-is and without warranty under the MIT License. See + * [root]/license.txt for more. This information must remain intact. + */ + +(function(global, $) { + + // Classes from Ace + var VirtualRenderer = ace.require('ace/virtual_renderer').VirtualRenderer; + var Editor = ace.require('ace/editor').Editor; + var EditSession = ace.require('ace/edit_session').EditSession; + var UndoManager = ace.require("ace/undomanager").UndoManager; + + // Editor modes that have been loaded + var editorModes = {}; + + var codiad = global.codiad; + codiad._cursorPoll = null; + + var separatorWidth = 3; + + $(function(){ + codiad.editor.init(); + }); + + // modes available for selecting + var availableTextModes = new Array( + 'abap', + 'abc', + 'actionscript', + 'ada', + 'apache_conf', + 'applescript', + 'asciidoc', + 'assembly_x86', + 'autohotkey', + 'batchfile', + 'c9search', + 'c_cpp', + 'cirru', + 'clojure', + 'cobol', + 'coffee', + 'coldfusion', + 'csharp', + 'css', + 'curly', + 'd', + 'dart', + 'diff', + 'django', + 'dockerfile', + 'dot', + 'eiffel', + 'ejs', + 'elixir', + 'elm', + 'erlang', + 'forth', + 'ftl', + 'gcode', + 'gherkin', + 'gitignore', + 'glsl', + 'gobstones', + 'golang', + 'groovy', + 'haml', + 'handlebars', + 'haskell', + 'haxe', + 'html', + 'html_elixir', + 'html_ruby', + 'ini', + 'io', + 'jack', + 'jade', + 'java', + 'javascript', + 'json', + 'jsoniq', + 'jsp', + 'jsx', + 'julia', + 'latex', + 'lean', + 'less', + 'liquid', + 'lisp', + 'livescript', + 'logiql', + 'lsl', + 'lua', + 'luapage', + 'lucene', + 'makefile', + 'markdown', + 'mask', + 'matlab', + 'maze', + 'mel', + 'mips_assembler', + 'mushcode', + 'mysql', + 'nix', + 'nsis', + 'objectivec', + 'ocaml', + 'pascal', + 'perl', + 'pgsql', + 'php', + 'plain_text', + 'powershell', + 'praat', + 'prolog', + 'protobuf', + 'python', + 'r', + 'razor', + 'rdoc', + 'rhtml', + 'rst', + 'ruby', + 'rust', + 'sass', + 'scad', + 'scala', + 'scheme', + 'scss', + 'sh', + 'sjs', + 'smarty', + 'snippets', + 'soy_template', + 'space', + 'sql', + 'sqlserver', + 'stylus', + 'svg', + 'swift', + 'swig', + 'tcl', + 'tex', + 'text', + 'textile', + 'toml', + 'twig', + 'typescript', + 'vala', + 'vbscript', + 'velocity', + 'verilog', + 'vhdl', + 'wollok', + 'xml', + 'xquery', + 'yaml' + ); + + function SplitContainer(root, children, splitType) { + var _this = this; + + this.root = root; + this.splitType = splitType; + this.childContainers = {}; + this.childElements = {}; + this.splitProp = 0.5; + + this.setChild(0, children[0]); + this.setChild(1, children[1]); + + this.splitter = $('
    ') + .addClass('splitter') + .appendTo(root) + .draggable({ + axis: (splitType === 'horizontal' ? 'x' : 'y'), + drag: function(e, ui){ + if (_this.splitType === 'horizontal') { + var w1, w2; + w1 = ui.position.left - separatorWidth/2; + w2 = _this.root.width() - ui.position.left + - separatorWidth/2; + _this.splitProp = w1 / _this.root.width(); + _this.childElements[0] + .width(w1) + .trigger('h-resize', [true, true]); + _this.childElements[1] + .width(w2) + .css('left', w1 + separatorWidth + 'px') + .trigger('h-resize', [true, true]); + _this.splitProp = ui.position.left / _this.root.width(); + } else { + var h1, h2; + h1 = ui.position.top - separatorWidth/2; + h2 = _this.root.width() - ui.position.top + - separatorWidth/2; + _this.splitProp = h1 / _this.root.height(); + _this.childElements[0] + .height(h1) + .trigger('v-resize', [true, true]); + _this.childElements[1] + .height(h2) + .css('top', h1 + separatorWidth + 'px') + .trigger('v-resize', [true, true]); + } + } + }); + + if (splitType === 'horizontal') { + this.splitter + .addClass('h-splitter') + .width(separatorWidth) + .height(root.height()); + } else if (splitType === 'vertical') { + this.splitter + .addClass('v-splitter') + .height(separatorWidth) + .width(root.width()); + } + + this.root.on('h-resize', function(e, percolateUp, percolateDown){ + e.stopPropagation(); + if (_this.splitType === 'horizontal') { + var w1, w2; + w1 = _this.root.width() * _this.splitProp + - separatorWidth / 2; + w2 = _this.root.width() * (1 - _this.splitProp) + - separatorWidth / 2; + _this.childElements[0] + .width(w1); + _this.childElements[1] + .width(w2) + .css('left', w1 + separatorWidth); + _this.splitter.css('left', w1); + } else if (_this.splitType === 'vertical') { + var w = _this.root.width(); + _this.childElements[0] + .width(w); + _this.childElements[1] + .width(w); + _this.splitter.width(w); + } + if (percolateUp) { + _this.root.parent('.editor-wrapper') + .trigger('h-resize', [true ,false]); + } + if (! percolateDown) return; + if (_this.childContainers[0]) { + _this.childContainers[0].root + .trigger('h-resize', [false, true]); + } else if (_this.childContainers[1]) { + _this.childContainers[1].root + .trigger('h-resize', [false, true]); + } + }); + + this.root.on('v-resize', function(e, percolateUp, percolateDown){ + e.stopPropagation(); + if (_this.splitType === 'horizontal') { + var h = _this.root.height(); + _this.childElements[0] + .height(h); + _this.childElements[1] + .height(h); + _this.splitter.height(h); + } else if (_this.splitType === 'vertical') { + var h1 = _this.root.height() * _this.splitProp + - separatorWidth / 2; + var h2 = _this.root.height() * (1 - _this.splitProp) + - separatorWidth / 2; + _this.childElements[0] + .height(h1); + _this.childElements[1] + .height(h2) + .css('top', h1+separatorWidth); + _this.splitter.css('top', h1); + } + if (percolateUp) { + _this.root.parent('.editor-wrapper') + .trigger('v-resize', [true ,false]); + } + if (! percolateDown) return; + if (_this.childContainers[0]) { + _this.childContainers[0].root + .trigger('v-resize', [false, true]); + } else if (_this.childContainers[1]) { + _this.childContainers[1].root + .trigger('v-resize', [false, true]); + } + }); + + this.root + .trigger('h-resize', [false, false]) + .trigger('v-resize', [false, false]); + } + + SplitContainer.prototype = { + setChild: function(idx, el){ + + if (el instanceof SplitContainer) { + this.childElements[idx] = el.root; + this.childContainers[idx] = el; + el.idx = idx; + } else { + this.childElements[idx] = el; + } + + this.childElements[idx].appendTo(this.root); + this.cssInit(this.childElements[idx], idx); + }, + cssInit: function(el, idx){ + var props = {}; + var h1, h2, w1, w2, rh, rw; + + rh = this.root.height(); + rw = this.root.width(); + + if (this.splitType === 'horizontal') { + + w1 = rw * this.splitProp - separatorWidth / 2; + w2 = rw * (1 - this.splitProp) - separatorWidth / 2; + + if (idx === 0) { + props = { + left: 0, + width: w1, + height: rh, + top: 0 + }; + } else { + props = { + left: w1 + separatorWidth, + width: w2, + height: rh, + top: 0 + }; + } + + } else if (this.splitType === 'vertical') { + + h1 = rh * this.splitProp - separatorWidth / 2; + h2 = rh * (1 - this.splitProp) - separatorWidth / 2; + + if (idx === 0) { + props = { + top: 0, + height: h1, + width: rw, + left: 0 + }; + } else { + props = { + top: h1 + separatorWidth, + height: h2, + width: rw, + left: 0 + }; + } + + } + + el.css(props); + } + }; + + ////////////////////////////////////////////////////////////////// + // + // Editor Component for Codiad + // --------------------------- + // Manage the lifecycle of Editor instances + // + ////////////////////////////////////////////////////////////////// + + codiad.editor = { + + /// Editor instances - One instance corresponds to an editor + /// pane in the user interface. Different EditSessions + /// (ace/edit_session) + instances: [], + + /// Currently focussed editor + activeInstance: null, + + // Settings for Editor instances + settings: { + theme: 'twilight', + fontSize: '13px', + printMargin: false, + printMarginColumn: 80, + highlightLine: true, + indentGuides: true, + wrapMode: false, + softTabs: false, + persistentModal: true, + rightSidebarTrigger: false, + fileManagerTrigger: false, + tabSize: 4 + }, + + rootContainer: null, + + fileExtensionTextMode: {}, + + init: function(){ + this.createSplitMenu(); + this.createModeMenu(); + + var er = $('#editor-region'); + + er.on('h-resize-init', function(){ + $('#editor-region > .editor-wrapper') + .width($(this).width()) + .trigger('h-resize'); + + }).on('v-resize-init', function(){ + $('#editor-region > .editor-wrapper') + .height($(this).height()) + .trigger('v-resize'); + }); + + + $(window).resize(function(){ + $('#editor-region') + .trigger('h-resize-init') + .trigger('v-resize-init'); + }); + }, + + ////////////////////////////////////////////////////////////////// + // + // Retrieve editor settings from localStorage + // + ////////////////////////////////////////////////////////////////// + + getSettings: function() { + var boolVal = null; + var theme = localStorage.getItem('codiad.editor.theme'); + + var _this = this; + + $.each(['theme', 'fontSize', 'tabSize'], function(idx, key) { + var localValue = localStorage.getItem('codiad.editor.' + key); + if (localValue !== null) { + _this.settings[key] = localValue; + } + }); + + $.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode', 'rightSidebarTrigger', 'fileManagerTrigger', 'softTabs', 'persistentModal'], + function(idx, key) { + var localValue = + localStorage.getItem('codiad.editor.' + key); + if (localValue === null) { + return; + } + _this.settings[key] = (localValue == 'true'); + }); + $.each(['printMarginColumn'], + function(idx, key) { + var localValue = + localStorage.getItem('codiad.editor.' + key); + if (localValue === null) { + return; + } + _this.settings[key] = localValue; + }); + }, + + ///////////////////////////////////////////////////////////////// + // + // Apply configuration settings + // + // Parameters: + // i - {Editor} + // + ///////////////////////////////////////////////////////////////// + + applySettings: function(i) { + // Check user-specified settings + this.getSettings(); + + // Apply the current configuration settings: + i.setTheme('ace/theme/' + this.settings.theme); + i.setFontSize(this.settings.fontSize); + i.setPrintMarginColumn(this.settings.printMarginColumn); + i.setShowPrintMargin(this.settings.printMargin); + i.setHighlightActiveLine(this.settings.highlightLine); + i.setDisplayIndentGuides(this.settings.indentGuides); + i.getSession().setUseWrapMode(this.settings.wrapMode); + this.setTabSize(this.settings.tabSize, i); + this.setSoftTabs(this.settings.softTabs, i); + this.setOverScroll(this.settings.overScroll, i); + }, + + ////////////////////////////////////////////////////////////////// + // + // Create a new editor instance attached to given session + // + // Parameters: + // session - {EditSession} Session to be used for new Editor instance + // + ////////////////////////////////////////////////////////////////// + + addInstance: function(session, where) { + var el = $('
    '); + var chType, chArr = [], sc = null, chIdx = null; + var _this = this; + + if (this.instances.length == 0) { + // el.appendTo($('#editor-region')); + el.appendTo($('#root-editor-wrapper')); + } else { + + var ch = this.activeInstance.el; + var root; + + chIdx = (where === 'top' || where === 'left') ? 0 : 1; + chType = (where === 'top' || where === 'bottom') ? + 'vertical' : 'horizontal'; + + chArr[chIdx] = el; + chArr[1 - chIdx] = ch; + + root = $('
    ') + .height(ch.height()) + .width(ch.width()) + .addClass('editor-wrapper-' + chType) + .appendTo(ch.parent()); + + sc = new SplitContainer(root, chArr, chType); + + if (this.instances.length > 1) { + var pContainer = this.activeInstance.splitContainer; + var idx = this.activeInstance.splitIdx; + pContainer.setChild(idx, sc); + } + } + + var i = ace.edit(el[0]); + var resizeEditor = function(){ + i.resize(); + }; + + if (sc) { + i.splitContainer = sc; + i.splitIdx = chIdx; + + this.activeInstance.splitContainer = sc; + this.activeInstance.splitIdx = 1 - chIdx; + + sc.root + .on('h-resize', resizeEditor) + .on('v-resize', resizeEditor); + + if (this.instances.length === 1) { + var re = function(){ + _this.instances[0].resize(); + }; + sc.root + .on('h-resize', re) + .on('v-resize', re); + } + } + + i.el = el; + this.setSession(session, i); + + this.changeListener(i); + this.cursorTracking(i); + this.bindKeys(i); + + this.instances.push(i); + + i.on('focus', function(){ + _this.focus(i); + }); + + return i; + }, + + createSplitMenu: function(){ + var _this = this; + var _splitOptionsMenu = $('#split-options-menu'); + + this.initMenuHandler($('#split'),_splitOptionsMenu); + + $('#split-horizontally a').click(function(e){ + e.stopPropagation(); + _this.addInstance(_this.activeInstance.getSession(), 'bottom'); + _splitOptionsMenu.hide(); + }); + + $('#split-vertically a').click(function(e){ + e.stopPropagation(); + _this.addInstance(_this.activeInstance.getSession(), 'right'); + _splitOptionsMenu.hide(); + }); + + $('#merge-all a').click(function(e){ + e.stopPropagation(); + var s = _this.activeInstance.getSession(); + _this.exterminate(); + _this.addInstance(s); + _splitOptionsMenu.hide(); + }); + }, + + createModeMenu: function(){ + var _this = this; + var _thisMenu = $('#changemode-menu'); + var modeColumns = new Array(); + var modeOptions = new Array(); + var maxOptionsColumn = 15; + var firstOption = 0; + + this.initMenuHandler($('#current-mode'),_thisMenu); + + availableTextModes.sort(); + $.each(availableTextModes, function(i){ + modeOptions.push('
  • '+availableTextModes[i]+'
  • '); + }); + + var html = ''; + while(true) { + html += ''; + firstOption = firstOption + maxOptionsColumn; + if(firstOption >= modeOptions.length) { + break; + } + } + + html += '
      '; + if ((modeOptions.length-firstOption) < maxOptionsColumn) { + max = modeOptions.length; + } else { + max = firstOption + maxOptionsColumn; + } + var currentcolumn = modeOptions.slice(firstOption, max); + for (var option in currentcolumn) { + html += currentcolumn[option]; + } + html += '
    '; + _thisMenu.html(html); + + $('#changemode-menu a').click(function(e){ + e.stopPropagation(); + var newMode = "ace/mode/" + $(e.currentTarget).text(); + var actSession = _this.activeInstance.getSession(); + + // handle async mode change + var fn = function(){ + _this.setModeDisplay(actSession); + actSession.removeListener('changeMode', fn); + }; + actSession.on("changeMode", fn); + + actSession.setMode(newMode); + _thisMenu.hide(); + + }); + }, + + initMenuHandler: function(button,menu){ + var _this = this; + var thisButton = button; + var thisMenu = menu; + + thisMenu.appendTo($('body')); + + thisButton.click(function(e){ + var wh = $(window).height(); + + e.stopPropagation(); + + // close other menus + _this.closeMenus(thisMenu); + + thisMenu.css({ + // display: 'block', + bottom: ( (wh - $(this).offset().top) + 8) + 'px', + left: ($(this).offset().left - 13) + 'px' + }); + + thisMenu.slideToggle('fast'); + + // handle click-out autoclosing + var fn = function(){ + thisMenu.hide(); + $(window).off('click', fn); + }; + $(window).on('click', fn); + }); + }, + + closeMenus: function(exclude){ + var menuId = exclude.attr("id"); + if(menuId != 'split-options-menu') $('#split-options-menu').hide(); + if(menuId != 'changemode-menu') $('#changemode-menu').hide(); + }, + + setModeDisplay: function(session){ + var currMode = session.getMode().$id; + if(currMode){ + currMode = currMode.substring(currMode.lastIndexOf('/') + 1); + $('#current-mode').html(currMode); + } else { + $('#current-mode').html('text'); + } + }, + + ////////////////////////////////////////////////////////////////// + // + // Remove all Editor instances and clean up the DOM + // + ////////////////////////////////////////////////////////////////// + + exterminate: function() { + $('.editor').remove(); + $('.editor-wrapper').remove(); + $('#editor-region').append($('
    ').attr('id', 'editor')); + $('#current-file').html(''); + $('#current-mode').html(''); + this.instances = []; + this.activeInstance = null; + }, + + ////////////////////////////////////////////////////////////////// + // + // Detach EditSession session from all Editor instances replacing + // them with replacementSession + // + ////////////////////////////////////////////////////////////////// + + removeSession: function(session, replacementSession) { + for (var k = 0; k < this.instances.length; k++) { + if (this.instances[k].getSession().path === session.path) { + this.instances[k].setSession(replacementSession); + } + } + if ($('#current-file').text() === session.path) { + $('#current-file').text(replacementSession.path); + } + + this.setModeDisplay(replacementSession); + }, + + isOpen: function(session){ + for (var k = 0; k < this.instances.length; k++) { + if (this.instances[k].getSession().path === session.path) { + return true; + } + } + return false; + }, + + ///////////////////////////////////////////////////////////////// + // + // Convenience function to iterate over Editor instances + // + // Parameters: + // fn - {Function} callback called with each member as an argument + // + ///////////////////////////////////////////////////////////////// + + forEach: function(fn) { + for (var k = 0; k < this.instances.length; k++) { + fn.call(this, this.instances[k]); + } + }, + + ///////////////////////////////////////////////////////////////// + // + // Get the currently active Editor instance + // + // In a multi-pane setup this would correspond to the + // editor pane user is currently working on. + // + ///////////////////////////////////////////////////////////////// + + getActive: function() { + return this.activeInstance; + }, + + ///////////////////////////////////////////////////////////////// + // + // Set an editor instance as active + // + // Parameters: + // i - {Editor} + // + ///////////////////////////////////////////////////////////////// + + setActive: function(i) { + if (! i) return; + this.activeInstance = i; + $('#current-file').text(i.getSession().path); + this.setModeDisplay(i.getSession()); + }, + + ///////////////////////////////////////////////////////////////// + // + // Change the EditSession of Editor instance + // + // Parameters: + // session - {EditSession} + // i - {Editor} + // + ///////////////////////////////////////////////////////////////// + + setSession: function(session, i) { + i = i || this.getActive(); + if (! this.isOpen(session)) { + if (! i) { + i = this.addInstance(session); + } else { + i.setSession(session); + } + } else { + // Proxy session is required because scroll-position and + // cursor position etc. are shared among sessions. + + var proxySession = new EditSession(session.getDocument(), + session.getMode()); + proxySession.setUndoManager(new UndoManager()); + proxySession.path = session.path; + proxySession.listThumb = session.listThumb; + proxySession.tabThumb = session.tabThumb; + if (! i) { + i = this.addInstance(proxySession); + } else { + i.setSession(proxySession); + } + } + this.applySettings(i); + + this.setActive(i); + }, + + ///////////////////////////////////////////////////////////////// + // + // Select file mode by extension case insensitive + // + // Parameters: + // e - {String} File extension + // + ///////////////////////////////////////////////////////////////// + + selectMode: function(e) { + if(typeof(e) != 'string'){ + return 'text'; + } + e = e.toLowerCase(); + + if(e in this.fileExtensionTextMode){ + return this.fileExtensionTextMode[e]; + }else{ + return 'text'; + } + }, + + ///////////////////////////////////////////////////////////////// + // + // Add an text mode for an extension + // + // Parameters: + // extension - {String} File Extension + // mode - {String} TextMode for this extension + // + ///////////////////////////////////////////////////////////////// + + addFileExtensionTextMode: function(extension, mode){ + if(typeof(extension) != 'string' || typeof(mode) != 'string'){ + if (console){ + console.warn('wrong usage of addFileExtensionTextMode, both parameters need to be string'); + } + return; + } + mode = mode.toLowerCase(); + this.fileExtensionTextMode[extension] = mode; + }, + + ///////////////////////////////////////////////////////////////// + // + // clear all extension-text mode joins + // + ///////////////////////////////////////////////////////////////// + + clearFileExtensionTextMode: function(){ + this.fileExtensionTextMode = {}; + }, + + ///////////////////////////////////////////////////////////////// + // + // Set the editor mode + // + // Parameters: + // m - {TextMode} mode + // i - {Editor} Editor (Defaults to active editor) + // + ///////////////////////////////////////////////////////////////// + + setMode: function(m, i) { + i = i || this.getActive(); + + // Check if mode is already loaded + if (! editorModes[m]) { + + // Load the Mode + var modeFile = 'components/editor/ace-editor/mode-' + m + '.js'; + $.loadScript(modeFile, function() { + + // Mark the mode as loaded + editorModes[m] = true; + var EditorMode = ace.require('ace/mode/' + m).Mode; + i.getSession().setMode(new EditorMode()); + }, true); + } else { + + var EditorMode = ace.require('ace/mode/' + m).Mode; + i.getSession().setMode(new EditorMode()); + + } + }, + + ///////////////////////////////////////////////////////////////// + // + // Set the editor theme + // + // Parameters: + // t - {String} theme eg. twilight, cobalt etc. + // i - {Editor} Editor instance (If omitted, Defaults to all editors) + // + // For a list of themes supported by Ace - refer : + // https://github.com/ajaxorg/ace/tree/master/lib/ace/theme + // + // TODO: Provide support for custom themes + // + ///////////////////////////////////////////////////////////////// + + setTheme: function(t, i) { + if (i) { + // If a specific instance is specified, change the theme for + // this instance + i.setTheme('ace/theme/'+ t); + } else { + // Change the theme for the existing editor instances + // and make it the default for new instances + this.settings.theme = t; + for (var k = 0; k < this.instances.length; k++) { + this.instances[k].setTheme('ace/theme/'+ t); + } + } + // LocalStorage + localStorage.setItem('codiad.editor.theme', t); + }, + + ///////////////////////////////////////////////////////////////// + // + // Set contents of the editor + // + // Parameters: + // c - {String} content + // i - {Editor} (Defaults to active editor) + // + ///////////////////////////////////////////////////////////////// + + setContent: function(c, i) { + i = i || this.getActive(); + i.getSession().setValue(c); + }, + + ///////////////////////////////////////////////////////////////// + // + // Set Font Size + // + // Set the font for all Editor instances and remember + // the value for Editor instances to be created in + // future + // + // Parameters: + // s - {Number} font size + // i - {Editor} Editor instance (If omitted, Defaults to all editors) + // + ///////////////////////////////////////////////////////////////// + + setFontSize: function(s, i) { + if (i) { + i.setFontSize(s); + } else { + this.settings.fontSize = s; + this.forEach(function(i) { + i.setFontSize(s); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.fontSize', s); + }, + + + ///////////////////////////////////////////////////////////////// + // + // Enable/disable Highlighting of active line + // + // Parameters: + // h - {Boolean} + // i - {Editor} Editor instance ( If left out, setting is + // applied to all editors ) + // + ///////////////////////////////////////////////////////////////// + + setHighlightLine: function(h, i) { + if (i) { + i.setHighlightActiveLine(h); + } else { + this.settings.highlightLine = h; + this.forEach(function(i) { + i.setHighlightActiveLine(h); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.highlightLine', h); + }, + + ////////////////////////////////////////////////////////////////// + // + // Show/Hide print margin indicator + // + // Parameters: + // p - {Number} print margin column + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setPrintMargin: function(p, i) { + if (i) { + i.setShowPrintMargin(p); + } else { + this.settings.printMargin = p; + this.forEach(function(i) { + i.setShowPrintMargin(p); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.printMargin', p); + }, + + ////////////////////////////////////////////////////////////////// + // + // Set print margin column + // + // Parameters: + // p - {Number} print margin column + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setPrintMarginColumn: function(p, i) { + if (i) { + i.setPrintMarginColumn(p); + } else { + this.settings.printMarginColumn = p; + this.forEach(function(i) { + i.setPrintMarginColumn(p); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.printMarginColumn', p); + }, + + ////////////////////////////////////////////////////////////////// + // + // Show/Hide indent guides + // + // Parameters: + // g - {Boolean} + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setIndentGuides: function(g, i) { + if (i) { + i.setDisplayIndentGuides(g); + } else { + this.settings.indentGuides = g; + this.forEach(function(i) { + i.setDisplayIndentGuides(g); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.indentGuides', g); + }, + + ////////////////////////////////////////////////////////////////// + // + // Enable/Disable Code Folding + // + // Parameters: + // f - {Boolean} + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setCodeFolding: function(f, i) { + if (i) { + i.setFoldStyle(f); + } else { + this.forEach(function(i) { + i.setFoldStyle(f); + }); + } + }, + + ////////////////////////////////////////////////////////////////// + // + // Enable/Disable Line Wrapping + // + // Parameters: + // w - {Boolean} + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setWrapMode: function(w, i) { + if (i) { + i.getSession().setUseWrapMode(w); + } else { + this.forEach(function(i) { + i.getSession().setUseWrapMode(w); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.wrapMode', w); + }, + + ////////////////////////////////////////////////////////////////// + // + // Set last position of modal to be saved + // + // Parameters: + // t - {Boolean} (false for Automatic Position, true for Last Position) + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setPersistentModal: function(t, i) { + this.settings.persistentModal = t; + // LocalStorage + localStorage.setItem('codiad.editor.persistentModal', t); + }, + + ////////////////////////////////////////////////////////////////// + // + // Set trigger for opening the right sidebar + // + // Parameters: + // t - {Boolean} (false for Hover, true for Click) + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setRightSidebarTrigger: function(t, i) { + this.settings.rightSidebarTrigger = t; + // LocalStorage + localStorage.setItem('codiad.editor.rightSidebarTrigger', t); + }, + + ////////////////////////////////////////////////////////////////// + // + // Set trigger for clicking on the filemanager + // + // Parameters: + // t - {Boolean} (false for Hover, true for Click) + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setFileManagerTrigger: function(t, i) { + this.settings.fileManagerTrigger = t; + // LocalStorage + localStorage.setItem('codiad.editor.fileManagerTrigger', t); + codiad.project.loadSide(); + }, + + + ////////////////////////////////////////////////////////////////// + // + // set Tab Size + // + // Parameters: + // s - size + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setTabSize: function(s, i) { + if (i) { + i.getSession().setTabSize(parseInt(s)); + } else { + this.forEach(function(i) { + i.getSession().setTabSize(parseInt(s)); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.tabSize', s); + + }, + + ////////////////////////////////////////////////////////////////// + // + // Enable or disable Soft Tabs + // + // Parameters: + // t - true / false + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setSoftTabs: function(t, i) { + if (i) { + i.getSession().setUseSoftTabs(t); + } else { + this.forEach(function(i) { + i.getSession().setUseSoftTabs(t); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.softTabs', t); + + }, + + ////////////////////////////////////////////////////////////////// + // + // Get content from editor + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + getContent: function(i) { + i = i || this.getActive(); + if (! i) return; + var content = i.getSession().getValue(); + if (!content) { + content = ' '; + } // Pass something through + return content; + }, + + ////////////////////////////////////////////////////////////////// + // + // Resize the editor - Trigger the editor to readjust its layout + // esp if the container has been resized manually. + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + resize: function(i) { + i = i || this.getActive(); + if (! i) return; + i.resize(); + }, + + ////////////////////////////////////////////////////////////////// + // + // Mark the instance as changed (in the user interface) + // upon change in the document content. + // + // Parameters: + // i - {Editor} + // + ////////////////////////////////////////////////////////////////// + + changeListener: function(i) { + var _this = this; + i.on('change', function() { + codiad.active.markChanged(_this.getActive().getSession().path); + }); + }, + + ////////////////////////////////////////////////////////////////// + // + // Get Selected Text + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + getSelectedText: function(i) { + i = i || this.getActive(); + if (! i) return; + return i.getCopyText(); + }, + + ////////////////////////////////////////////////////////////////// + // + // Insert text + // + // Parameters: + // val - {String} Text to be inserted + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + insertText: function(val, i) { + i = i || this.getActive(); + if (! i) return; + i.insert(val); + }, + + ////////////////////////////////////////////////////////////////// + // + // Move the cursor to a particular line + // + // Parameters: + // line - {Number} Line number + // i - {Editor} Editor instance + // + ////////////////////////////////////////////////////////////////// + + gotoLine: function(line, i) { + i = i || this.getActive(); + if (! i) return; + i.gotoLine(line, 0, true); + }, + + ////////////////////////////////////////////////////////////////// + // + // Focus an editor + // + // Parameters: + // i - {Editor} Editor instance (Defaults to current editor) + // + ////////////////////////////////////////////////////////////////// + + focus: function(i) { + i = i || this.getActive(); + this.setActive(i); + if (! i) return; + i.focus(); + codiad.active.focus(i.getSession().path); + this.cursorTracking(i); + }, + + ////////////////////////////////////////////////////////////////// + // + // Setup Cursor Tracking + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + cursorTracking: function(i) { + i = i || this.getActive(); + if (! i) return; + clearInterval(codiad._cursorPoll); + codiad._cursorPoll = setInterval(function() { + $('#cursor-position') + .html(i18n('Ln') + ': ' + + (i.getCursorPosition().row + 1) + + ' · ' + i18n('Col') + ': ' + + i.getCursorPosition().column + ); + }, 100); + }, + + ////////////////////////////////////////////////////////////////// + // + // Setup Key bindings + // + // Parameters: + // i - {Editor} + // + ////////////////////////////////////////////////////////////////// + + bindKeys: function(i) { + + var _this = this; + + // Find + i.commands.addCommand({ + name: 'Find', + bindKey: { + win: 'Ctrl-F', + mac: 'Command-F' + }, + exec: function(e) { + _this.openSearch('find'); + } + }); + + // Find + Replace + i.commands.addCommand({ + name: 'Replace', + bindKey: { + win: 'Ctrl-R', + mac: 'Command-R' + }, + exec: function(e) { + _this.openSearch('replace'); + } + }); + + i.commands.addCommand({ + name: 'Move Up', + bindKey: { + win: 'Ctrl-up', + mac: 'Command-up' + }, + exec: function(e) { + codiad.active.move('up'); + } + }); + + i.commands.addCommand({ + name: 'Move Down', + bindKey: { + win: 'Ctrl-down', + mac: 'Command-up' + }, + exec: function(e) { + codiad.active.move('down'); + } + }); + + }, + + ////////////////////////////////////////////////////////////////// + // + // Present the Search (Find + Replace) dialog box + // + // Parameters: + // type - {String} Optional, defaults to find. Provide 'replace' for replace dialog. + // + ////////////////////////////////////////////////////////////////// + + openSearch: function(type) { + if (this.getActive()) { + codiad.modal.load(400, + 'components/editor/dialog.php?action=search&type=' + + type); + codiad.modal.hideOverlay(); + } else { + codiad.message.error('No Open Files'); + } + }, + + ////////////////////////////////////////////////////////////////// + // + // Perform Search (Find + Replace) operation + // + // Parameters: + // action - {String} find | replace | replaceAll + // i - {Editor} Defaults to active Editor instance + // + ////////////////////////////////////////////////////////////////// + + search: function(action, i) { + i = i || this.getActive(); + if (! i) return; + var find = $('#modal input[name="find"]') + .val(); + var replace = $('#modal input[name="replace"]') + .val(); + switch (action) { + case 'find': + + i.find(find, { + backwards: false, + wrap: true, + caseSensitive: false, + wholeWord: false, + regExp: false + }); + + break; + + case 'replace': + + i.find(find, { + backwards: false, + wrap: true, + caseSensitive: false, + wholeWord: false, + regExp: false + }); + i.replace(replace); + + break; + + case 'replaceAll': + + i.find(find, { + backwards: false, + wrap: true, + caseSensitive: false, + wholeWord: false, + regExp: false + }); + i.replaceAll(replace); + + break; + } + }, + + ////////////////////////////////////////////////////////////////// + // + // Enable editor + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + enableEditing: function(i) { + i = i || this.getActive(); + if (! i) return; + i.textInput.setReadOnly( false ); + }, + + ////////////////////////////////////////////////////////////////// + // + // Disable editor + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + disableEditing: function(i) { + i = i || this.getActive(); + if (! i) return; + i.textInput.setReadOnly( true ); + }, + + ////////////////////////////////////////////////////////////////// + // + // Set Overscroll + // + // Parameters: + // i - {Editor} (Defaults to active editor) + // + ////////////////////////////////////////////////////////////////// + + setOverScroll: function( s, i ) { + + if (i) { + i.setOption( "scrollPastEnd", s ); + } else { + this.settings.overScroll = s; + this.forEach(function(i) { + i.setOption( "scrollPastEnd", s ); + }); + } + // LocalStorage + localStorage.setItem('codiad.editor.overScroll', s); + }, + + }; + +})(this, jQuery); \ No newline at end of file diff --git a/components/filemanager/class.filemanager.php b/components/filemanager/class.filemanager.php index 3fe696f..3fbbcba 100755 --- a/components/filemanager/class.filemanager.php +++ b/components/filemanager/class.filemanager.php @@ -9,622 +9,713 @@ require_once('../../lib/diff_match_patch.php'); require_once('../../common.php'); -class Filemanager extends Common -{ - - ////////////////////////////////////////////////////////////////// - // PROPERTIES - ////////////////////////////////////////////////////////////////// - - public $root = ""; - public $project = ""; - public $rel_path = ""; - public $path = ""; - public $patch = ""; - public $type = ""; - public $new_name = ""; - public $content = ""; - public $destination = ""; - public $upload = ""; - public $controller = ""; - public $upload_json = ""; - public $search_string = ""; - - public $search_file_type = ""; - public $query = ""; - public $foptions = ""; - - // JSEND Return Contents - public $status = ""; - public $data = ""; - public $message = ""; - - ////////////////////////////////////////////////////////////////// - // METHODS - ////////////////////////////////////////////////////////////////// - - // -----------------------------||----------------------------- // - - ////////////////////////////////////////////////////////////////// - // Construct - ////////////////////////////////////////////////////////////////// - - public function __construct($get, $post, $files) - { - $this->rel_path = Filemanager::cleanPath($get['path']); - - if ($this->rel_path!="/") { - $this->rel_path .= "/"; - } - if (!empty($get['query'])) { - $this->query = $get['query']; - } - if (!empty($get['options'])) { - $this->foptions = $get['options']; - } - $this->root = $get['root']; - if ($this->isAbsPath($get['path'])) { - $this->path = Filemanager::cleanPath($get['path']); - } else { - $this->root .= '/'; - $this->path = $this->root . Filemanager::cleanPath($get['path']); - } - // Search - if (!empty($post['search_string'])) { - $this->search_string = ($post['search_string']); - } - if (!empty($post['search_file_type'])) { - $this->search_file_type = ($post['search_file_type']); - } - // Create - if (!empty($get['type'])) { - $this->type = $get['type']; - } - // Modify\Create - if (!empty($get['new_name'])) { - $this->new_name = $get['new_name']; - } - - foreach (array('content', 'mtime', 'patch') as $key) { - if (!empty($post[$key])) { - if (get_magic_quotes_gpc()) { - $this->$key = stripslashes($post[$key]); - } else { - $this->$key = $post[$key]; - } - } - } - // Duplicate - if (!empty($get['destination'])) { - $get['destination'] = Filemanager::cleanPath($get['destination']); - if ($this->isAbsPath($get['path'])) { - $this->destination = $get['destination']; - } else { - $this->destination = $this->root . $get['destination']; - } - } - } - - ////////////////////////////////////////////////////////////////// - // INDEX (Returns list of files and directories) - ////////////////////////////////////////////////////////////////// - - public function index() - { - - if (file_exists($this->path)) { - $index = array(); - if (is_dir($this->path) && $handle = opendir($this->path)) { - while (false !== ($object = readdir($handle))) { - if ($object != "." && $object != ".." && $object != $this->controller) { - if (is_dir($this->path.'/'.$object)) { - $type = "directory"; - $size=count(glob($this->path.'/'.$object.'/*')); - } else { - $type = "file"; - $size=@filesize($this->path.'/'.$object); - } - $index[] = array( - "name"=>$this->rel_path . $object, - "type"=>$type, - "size"=>$size - ); - } - } - - $folders = array(); - $files = array(); - foreach ($index as $item => $data) { - if ($data['type']=='directory') { - $folders[] = array("name"=>$data['name'],"type"=>$data['type'],"size"=>$data['size']); - } - if ($data['type']=='file') { - $files[] = array("name"=>$data['name'],"type"=>$data['type'],"size"=>$data['size']); - } - } - - function sorter($a, $b, $key = 'name') - { - return strnatcmp($a[$key], $b[$key]); - } - - usort($folders, "sorter"); - usort($files, "sorter"); - - $output = array_merge($folders, $files); - - $this->status = "success"; - $this->data = '"index":' . json_encode($output); - } else { - $this->status = "error"; - $this->message = "Not A Directory"; - } - } else { - $this->status = "error"; - $this->message = "Path Does Not Exist"; - } - - $this->respond(); - } - - public function find() - { - if (!function_exists('shell_exec')) { - $this->status = "error"; - $this->message = "Shell_exec() Command Not Enabled."; - } else { - chdir($this->path); - $input = str_replace('"', '', $this->query); - $cmd = 'find -L '; - $strategy = ''; - if ($this->foptions && $this->foptions['strategy']) { - $strategy = $this->foptions['strategy']; - } - switch ($strategy) { - case 'substring': - $cmd = "$cmd -iname ".escapeshellarg('*'.$input.'*'); - break; - case 'regexp': - $cmd = "$cmd -regex ".escapeshellarg($input); - break; - case 'left_prefix': - default: - $cmd = "$cmd -iname ".escapeshellarg($input.'*'); - break; - } - $cmd = "$cmd -printf \"%h/%f %y\n\""; - $output = shell_exec($cmd); - $file_arr = explode("\n", $output); - $output_arr = array(); - - error_reporting(0); - - foreach ($file_arr as $i => $fentry) { - $farr = explode(" ", $fentry); - $fname = trim($farr[0]); - if ($farr[1] == 'f') { - $ftype = 'file'; - } else { - $ftype = 'directory'; - } - if (strlen($fname) != 0) { - $fname = $this->rel_path . substr($fname, 2); - $f = array('path' => $fname, 'type' => $ftype ); - array_push($output_arr, $f); - } - } - - if (count($output_arr)==0) { - $this->status = "error"; - $this->message = "No Results Returned"; - } else { - $this->status = "success"; - $this->data = '"index":' . json_encode($output_arr); - } - } - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // SEARCH - ////////////////////////////////////////////////////////////////// - - public function search() - { - if (!function_exists('shell_exec')) { - $this->status = "error"; - $this->message = "Shell_exec() Command Not Enabled."; - } else { - if ($_GET['type'] == 1) { - $this->path = WORKSPACE; - } - $return = array(); - - $input = str_replace('"', '', $this->search_string); - $cmd = 'find -L ' . escapeshellarg($this->path) . ' -iregex '.escapeshellarg('.*' . $this->search_file_type ).' -type f | xargs grep -i -I -n -R -H ' . escapeshellarg($input) . ''; - $output = shell_exec($cmd); - $output_arr = explode("\n", $output); - foreach ($output_arr as $line) { - $data = explode(":", $line); - $da = array(); - if (count($data) > 2) { - $da['line'] = $data[1]; - $da['file'] = str_replace($this->path, '', $data[0]); - $da['result'] = str_replace($this->root, '', $data[0]); - $da['string'] = str_replace($data[0] . ":" . $data[1] . ':', '', $line); - $return[] = $da; - } - } - if (count($return)==0) { - $this->status = "error"; - $this->message = "No Results Returned"; - } else { - $this->status = "success"; - $this->data = '"index":' . json_encode($return); - } - } - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // OPEN (Returns the contents of a file) - ////////////////////////////////////////////////////////////////// - - public function open() - { - if (is_file($this->path)) { - $output = file_get_contents($this->path); - - if (extension_loaded('mbstring')) { - if (!mb_check_encoding($output, 'UTF-8')) { - if (mb_check_encoding($output, 'ISO-8859-1')) { - $output = utf8_encode($output); - } else { - $output = mb_convert_encoding($content, 'UTF-8'); - } - } - } - - $this->status = "success"; - $this->data = '"content":' . json_encode($output); - $mtime = filemtime($this->path); - $this->data .= ', "mtime":'.$mtime; - } else { - $this->status = "error"; - $this->message = "Not A File :".$this->path; - } - - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // OPEN IN BROWSER (Return URL) - ////////////////////////////////////////////////////////////////// - - public function openinbrowser() - { - $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; - $domainName = $_SERVER['HTTP_HOST']; - $url = $protocol.WSURL.'/'.$this->rel_path; - $this->status = "success"; - $this->data = '"url":' . json_encode(rtrim($url, "/")); - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // CREATE (Creates a new file or directory) - ////////////////////////////////////////////////////////////////// - - public function create() - { - - // Create file - if ($this->type=="file") { - if (!file_exists($this->path)) { - if ($file = fopen($this->path, 'w')) { - // Write content - if ($this->content) { - fwrite($file, $this->content); - } - $this->data = '"mtime":'.filemtime($this->path); - fclose($file); - $this->status = "success"; - } else { - $this->status = "error"; - $this->message = "Cannot Create File"; - } - } else { - $this->status = "error"; - $this->message = "File Already Exists"; - } - } - - // Create directory - if ($this->type=="directory") { - if (!is_dir($this->path)) { - mkdir($this->path); - $this->status = "success"; - } else { - $this->status = "error"; - $this->message = "Directory Already Exists"; - } - } - - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // DELETE (Deletes a file or directory (+contents or only contents)) - ////////////////////////////////////////////////////////////////// - - public function delete( $keep_parent=false ) - { - - function rrmdir($path, $follow) - { - if (is_file($path)) { - unlink($path); - } else { - $files = array_diff(scandir($path), array('.','..')); - foreach ($files as $file) { - if (is_link("$path/$file")) { - if ($follow) { - rrmdir("$path/$file", $follow); - } - unlink("$path/$file"); - } elseif (is_dir("$path/$file")) { - rrmdir("$path/$file", $follow); - } else { - unlink("$path/$file"); - } - } - if( $keep_parent === false ) { - return rmdir($path); - } else { - return; - } - } - } - - if (file_exists($this->path)) { - if (isset($_GET['follow'])) { - rrmdir($this->path, true); - } else { - rrmdir($this->path, false); - } - $this->status = "success"; - } else { - $this->status = "error"; - $this->message = "Path Does Not Exist "; - } - - $this->respond(); - } - - - ////////////////////////////////////////////////////////////////// - // MODIFY (Modifies a file name/contents or directory name) - ////////////////////////////////////////////////////////////////// - - public function modify() - { - - // Change name - if ($this->new_name) { - $explode = explode('/', $this->path); - array_pop($explode); - $new_path = implode("/", $explode) . "/" . $this->new_name; - if (!file_exists($new_path)) { - if (rename($this->path, $new_path)) { - //unlink($this->path); - $this->status = "success"; - } else { - $this->status = "error"; - $this->message = "Could Not Rename"; - } - } else { - $this->status = "error"; - $this->message = "Path Already Exists"; - } - } else { - // Change content - if ($this->content || $this->patch) { - if ($this->content==' ') { - $this->content=''; // Blank out file - } - if ($this->patch && ! $this->mtime) { - $this->status = "error"; - $this->message = "mtime parameter not found"; - $this->respond(); - return; - } - if (is_file($this->path)) { - $serverMTime = filemtime($this->path); - $fileContents = file_get_contents($this->path); - - if ($this->patch && $this->mtime != $serverMTime) { - $this->status = "error"; - $this->message = "Client is out of sync"; - //DEBUG : file_put_contents($this->path.".conflict", "SERVER MTIME :".$serverMTime.", CLIENT MTIME :".$this->mtime); - $this->respond(); - return; - } elseif (strlen(trim($this->patch)) == 0 && ! $this->content) { - // Do nothing if the patch is empty and there is no content - $this->status = "success"; - $this->data = '"mtime":'.$serverMTime; - $this->respond(); - return; - } - - if ($file = fopen($this->path, 'w')) { - if ($this->patch) { - $dmp = new diff_match_patch(); - $p = $dmp->patch_apply($dmp->patch_fromText($this->patch), $fileContents); - $this->content = $p[0]; - //DEBUG : file_put_contents($this->path.".orig",$fileContents ); - //DEBUG : file_put_contents($this->path.".patch", $this->patch); - } - - if (fwrite($file, $this->content) === false) { - $this->status = "error"; - $this->message = "could not write to file"; - } else { - // Unless stat cache is cleared the pre-cached mtime will be - // returned instead of new modification time after editing - // the file. - clearstatcache(); - $this->data = '"mtime":'.filemtime($this->path); - $this->status = "success"; - } - - fclose($file); - } else { - $this->status = "error"; - $this->message = "Cannot Write to File"; - } - } else { - $this->status = "error"; - $this->message = "Not A File"; - } - } else { - $file = fopen($this->path, 'w'); - fclose($file); - $this->data = '"mtime":'.filemtime($this->path); - $this->status = "success"; - } - } - - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // DUPLICATE (Creates a duplicate of the object - (cut/copy/paste) - ////////////////////////////////////////////////////////////////// - - public function duplicate() - { - - if (!file_exists($this->path)) { - $this->status = "error"; - $this->message = "Invalid Source"; - } - - function recurse_copy($src, $dst) - { - $dir = opendir($src); - @mkdir($dst); - while (false !== ( $file = readdir($dir))) { - if (( $file != '.' ) && ( $file != '..' )) { - if (is_dir($src . '/' . $file)) { - recurse_copy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } - } - } - closedir($dir); - } - - if ($this->status!="error") { - if (is_file($this->path)) { - copy($this->path, $this->destination); - $this->status = "success"; - } else { - recurse_copy($this->path, $this->destination); - if (!$this->response) { - $this->status = "success"; - } - } - } - - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // UPLOAD (Handles uploads to the specified directory) - ////////////////////////////////////////////////////////////////// - - public function upload() - { - - // Check that the path is a directory - if (is_file($this->path)) { - $this->status = "error"; - $this->message = "Path Not A Directory"; - } else { - // Handle upload - $info = array(); - foreach( $_FILES['upload']['name'] as $key=>$value) { - if (!empty($value)) { - $filename = $value; - $add = $this->path."/$filename"; - if (@move_uploaded_file($_FILES['upload']['tmp_name'][$key], $add)) { - $info[] = array( - "name"=>$value, - "size"=>filesize($add), - "url"=>$add, - "thumbnail_url"=>$add, - "delete_url"=>$add, - "delete_type"=>"DELETE" - ); - } - } - } - $this->upload_json = json_encode($info); - } - - $this->respond(); - } - - ////////////////////////////////////////////////////////////////// - // RESPOND (Outputs data in JSON [JSEND] format) - ////////////////////////////////////////////////////////////////// - - public function respond() - { - - // Success /////////////////////////////////////////////// - if ($this->status=="success") { - if ($this->data) { - $json = '{"status":"success","data":{'.$this->data.'}}'; - } else { - $json = '{"status":"success","data":null}'; - } - - // Upload JSON /////////////////////////////////////////// - } elseif ($this->upload_json!='') { - $json = $this->upload_json; - - // Error ///////////////////////////////////////////////// - } else { - $json = '{"status":"error","message":"'.$this->message.'"}'; - } - - // Output //////////////////////////////////////////////// - echo($json); - } - - ////////////////////////////////////////////////////////////////// - // Clean a path - ////////////////////////////////////////////////////////////////// - - public static function cleanPath($path) - { - - // replace backslash with slash - $path = str_replace('\\', '/', $path); - - // allow only valid chars in paths$ - $path = preg_replace('/[^A-Za-z0-9\-\._\/\ ]/', '', $path); - // maybe this is not needed anymore - // prevent Poison Null Byte injections - $path = str_replace(chr(0), '', $path); - - // prevent go out of the workspace - while (strpos($path, '../') !== false) { - $path = str_replace('../', '', $path); - } - - return $path; - } +class Filemanager extends Common { + + ////////////////////////////////////////////////////////////////// + // PROPERTIES + ////////////////////////////////////////////////////////////////// + + public $root = ""; + public $project = ""; + public $rel_path = ""; + public $path = ""; + public $patch = ""; + public $type = ""; + public $new_name = ""; + public $content = ""; + public $destination = ""; + public $upload = ""; + public $controller = ""; + public $upload_json = ""; + public $search_string = ""; + + public $search_file_type = ""; + public $query = ""; + public $foptions = ""; + + // JSEND Return Contents + public $status = ""; + public $data = ""; + public $message = ""; + + ////////////////////////////////////////////////////////////////// + // METHODS + ////////////////////////////////////////////////////////////////// + + // -----------------------------||----------------------------- // + + ////////////////////////////////////////////////////////////////// + // Construct + ////////////////////////////////////////////////////////////////// + + public function __construct( $get, $post, $files ) { + $this->rel_path = Filemanager::cleanPath($get['path']); + + if ( $this->rel_path != "/ ") { + + $this->rel_path .= "/"; + } + if ( ! empty( $get['query'] ) ) { + $this->query = $get['query']; + } + if ( ! empty($get['options'] ) ) { + $this->foptions = $get['options']; + } + $this->root = $get['root']; + if ( $this->isAbsPath( $get['path'] ) ) { + + $this->path = Filemanager::cleanPath($get['path']); + } else { + + $this->root .= '/'; + $this->path = $this->root . Filemanager::cleanPath( $get['path'] ); + } + // Search + if ( ! empty( $post['search_string'] ) ) { + $this->search_string = ($post['search_string']); + } + if ( ! empty( $post['search_file_type'] ) ) { + $this->search_file_type = ($post['search_file_type']); + } + // Create + if ( ! empty($get['type'] ) ) { + + $this->type = $get['type']; + } + // Modify\Create + if ( ! empty( $get['new_name'] ) ) { + + $this->new_name = $get['new_name']; + } + + foreach ( array( 'content', 'mtime', 'patch' ) as $key ) { + + if ( ! empty( $post[$key] ) ) { + + if ( get_magic_quotes_gpc() ) { + + $this->$key = stripslashes( $post[$key] ); + } else { + + $this->$key = $post[$key]; + } + } + } + // Duplicate + if ( ! empty( $get['destination'] ) ) { + + $get['destination'] = Filemanager::cleanPath( $get['destination'] ); + if ( $this->isAbsPath( $get['path'] ) ) { + + $this->destination = $get['destination']; + } else { + + $this->destination = $this->root . $get['destination']; + } + } + } + + ////////////////////////////////////////////////////////////////// + // INDEX (Returns list of files and directories) + ////////////////////////////////////////////////////////////////// + + public function index() { + + if ( file_exists( $this->path ) ) { + + $index = array(); + if ( is_dir( $this->path ) && $handle = opendir( $this->path ) ) { + + while (false !== ( $object = readdir( $handle ) ) ) { + + if ($object != "." && $object != ".." && $object != $this->controller) { + if ( is_dir( $this->path.'/'.$object ) ) { + + $type = "directory"; + $size = count( glob( $this->path . '/' . $object . '/*' ) ); + } else { + + $type = "file"; + $size = @filesize( $this->path.'/' . $object ); + } + $index[] = array( + "name"=>$this->rel_path . $object, + "type"=>$type, + "size"=>$size + ); + } + } + + $folders = array(); + $files = array(); + foreach ($index as $item => $data) { + + if ( $data['type'] == 'directory' ) { + + $folders[] = array( "name"=>$data['name'], "type"=>$data['type'], "size"=>$data['size'] ); + } + if ( $data['type'] == 'file' ) { + + $files[] = array( "name"=>$data['name'], "type"=>$data['type'], "size"=>$data['size'] ); + } + } + + function sorter($a, $b, $key = 'name') { + + return strnatcmp( $a[$key], $b[$key] ); + } + + usort( $folders, "sorter" ); + usort( $files, "sorter" ); + + $output = array_merge( $folders, $files ); + + $this->status = "success"; + $this->data = '"index":' . json_encode( $output ); + } else { + + $this->status = "error"; + $this->message = "Not A Directory"; + } + } else { + $this->status = "error"; + $this->message = "Path Does Not Exist"; + } + + $this->respond(); + } + + public function find() { + + if ( ! function_exists( 'shell_exec' ) ) { + + $this->status = "error"; + $this->message = "Shell_exec() Command Not Enabled."; + } else { + + chdir( $this->path ); + $input = str_replace( '"', '', $this->query ); + $cmd = 'find -L '; + $strategy = ''; + if ( $this->foptions && $this->foptions['strategy'] ) { + + $strategy = $this->foptions['strategy']; + } + switch ( $strategy ) { + + case 'substring': + $cmd = "$cmd -iname ".escapeshellarg( '*' . $input . '*' ); + break; + case 'regexp': + $cmd = "$cmd -regex ".escapeshellarg( $input ); + break; + case 'left_prefix': + default: + $cmd = "$cmd -iname ".escapeshellarg( $input . '*'); + break; + } + $cmd = "$cmd -printf \"%h/%f %y\n\""; + $output = shell_exec( $cmd ); + $file_arr = explode( "\n", $output ); + $output_arr = array(); + + error_reporting( 0 ); + + foreach ( $file_arr as $i => $fentry ) { + + $farr = explode( " ", $fentry ); + $fname = trim( $farr[0] ); + if ( $farr[1] == 'f' ) { + + $ftype = 'file'; + } else { + + $ftype = 'directory'; + } + if ( strlen( $fname ) != 0 ) { + + $fname = $this->rel_path . substr( $fname, 2 ); + $f = array( 'path' => $fname, 'type' => $ftype ); + array_push( $output_arr, $f ); + } + } + + if ( count( $output_arr ) == 0 ) { + + $this->status = "error"; + $this->message = "No Results Returned"; + } else { + $this->status = "success"; + $this->data = '"index":' . json_encode( $output_arr ); + } + } + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // SEARCH + ////////////////////////////////////////////////////////////////// + + public function search() { + + if ( ! function_exists( 'shell_exec' ) ) { + + $this->status = "error"; + $this->message = "Shell_exec() Command Not Enabled."; + } else { + + if ( $_GET['type'] == 1 ) { + + $this->path = WORKSPACE; + } + $return = array(); + $input = str_replace( '"', '', $this->search_string ); + $cmd = 'find -L ' . escapeshellarg( $this->path ) . ' -iregex '.escapeshellarg( '.*' . $this->search_file_type ) . ' -type f | xargs grep -i -I -n -R -H ' . escapeshellarg( $input ) . ''; + $output = shell_exec( $cmd ); + $output_arr = explode( "\n", $output ); + foreach ( $output_arr as $line ) { + + $data = explode( ":", $line ); + $da = array(); + if ( count( $data ) > 2 ) { + + $da['line'] = $data[1]; + $da['file'] = str_replace( $this->path, '', $data[0] ); + $da['result'] = str_replace( $this->root, '', $data[0] ); + $da['string'] = str_replace( $data[0] . ":" . $data[1] . ':', '', $line ); + $return[] = $da; + } + } + if ( count( $return ) == 0 ) { + + $this->status = "error"; + $this->message = "No Results Returned"; + } else { + + $this->status = "success"; + $this->data = '"index":' . json_encode( $return ); + } + } + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // OPEN (Returns the contents of a file) + ////////////////////////////////////////////////////////////////// + + public function open() { + + if ( is_file( $this->path ) ) { + + $output = file_get_contents($this->path); + + if ( extension_loaded( 'mbstring' ) ) { + + if ( ! mb_check_encoding( $output, 'UTF-8' ) ) { + + if ( mb_check_encoding( $output, 'ISO-8859-1' ) ) { + + $output = utf8_encode( $output ); + } else { + + $output = mb_convert_encoding( $content, 'UTF-8' ); + } + } + } + + $this->status = "success"; + $this->data = '"content":' . json_encode( $output ); + $mtime = filemtime( $this->path ); + $this->data .= ', "mtime":'.$mtime; + } else { + + $this->status = "error"; + $this->message = "Not A File :" . $this->path; + } + + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // OPEN IN BROWSER (Return URL) + ////////////////////////////////////////////////////////////////// + + public function openinbrowser() { + + $protocol = ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != 'off' ) || $_SERVER['SERVER_PORT'] == 443 ) ? "https://" : "http://"; + $domainName = $_SERVER['HTTP_HOST']; + $url = $protocol . WSURL . '/' . $this->rel_path; + $this->status = "success"; + $this->data = '"url":' . json_encode( rtrim( $url, "/" ) ); + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // CREATE (Creates a new file or directory) + ////////////////////////////////////////////////////////////////// + + public function create() { + + // Create file + if ( $this->type == "file" ) { + + if ( ! file_exists( $this->path ) ) { + + if ( $file = fopen( $this->path, 'w' ) ) { + + // Write content + if ( $this->content ) { + + fwrite( $file, $this->content ); + } + $this->data = '"mtime":' . filemtime( $this->path ); + fclose( $file ); + $this->status = "success"; + } else { + + $this->status = "error"; + $this->message = "Cannot Create File"; + } + } else { + + $this->status = "error"; + $this->message = "File Already Exists"; + } + } + + // Create directory + if ( $this->type == "directory" ) { + + if ( ! is_dir( $this->path ) ) { + + mkdir( $this->path ); + $this->status = "success"; + } else { + + $this->status = "error"; + $this->message = "Directory Already Exists"; + } + } + + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // DELETE (Deletes a file or directory (+contents or only contents)) + ////////////////////////////////////////////////////////////////// + + public function delete( $keep_parent = false ) { + + function rrmdir( $path, $follow, $keep_parent = false ) { + + if ( is_file( $path ) ) { + + unlink( $path ); + } else { + + $files = array_diff( scandir( $path ), array( '.', '..' ) ); + foreach ( $files as $file ) { + + if ( is_link( "$path/$file" ) ) { + + if ( $follow ) { + + rrmdir("$path/$file", $follow, false); + } + unlink( "$path/$file" ); + } elseif ( is_dir( "$path/$file" ) ) { + + rrmdir( "$path/$file", $follow, false ); + } else { + + unlink( "$path/$file" ); + } + } + if( $keep_parent === false ) { + + rmdir( $path ); + return; + } else { + + return; + } + } + } + + if ( file_exists( $this->path ) ) { + + if ( isset( $_GET['follow'] ) ) { + + rrmdir( $this->path, true, $keep_parent ); + } else { + + rrmdir( $this->path, false, $keep_parent ); + } + + $this->status = "success"; + } else { + + $this->status = "error"; + $this->message = "Path Does Not Exist "; + } + $this->respond(); + } + + + ////////////////////////////////////////////////////////////////// + // MODIFY (Modifies a file name/contents or directory name) + ////////////////////////////////////////////////////////////////// + + public function modify() { + + // Change name + if ( $this->new_name ) { + + $explode = explode( '/', $this->path ); + array_pop( $explode ); + $new_path = implode( "/", $explode ) . "/" . $this->new_name; + if ( ! file_exists( $new_path ) ) { + + if ( rename( $this->path, $new_path ) ) { + + //unlink($this->path); + $this->status = "success"; + } else { + + $this->status = "error"; + $this->message = "Could Not Rename"; + } + } else { + + $this->status = "error"; + $this->message = "Path Already Exists"; + } + } else { + + // Change content + if ($this->content || $this->patch) { + + if ( $this->content == ' ' ) { + + $this->content = ''; // Blank out file + } + if ( $this->patch && ! $this->mtime ) { + + $this->status = "error"; + $this->message = "mtime parameter not found"; + $this->respond(); + return; + } + if ( is_file( $this->path ) ) { + + $serverMTime = filemtime( $this->path ); + $fileContents = file_get_contents( $this->path ); + + if ( $this->patch && $this->mtime != $serverMTime ) { + + $this->status = "error"; + $this->message = "Client is out of sync"; + //DEBUG : file_put_contents($this->path.".conflict", "SERVER MTIME :".$serverMTime.", CLIENT MTIME :".$this->mtime); + $this->respond(); + return; + } elseif ( strlen( trim( $this->patch ) ) == 0 && ! $this->content ) { + + // Do nothing if the patch is empty and there is no content + $this->status = "success"; + $this->data = '"mtime":' . $serverMTime; + $this->respond(); + return; + } + + if ( $file = fopen( $this->path, 'w' ) ) { + + if ( $this->patch ) { + + $dmp = new diff_match_patch(); + $p = $dmp->patch_apply( $dmp->patch_fromText( $this->patch ), $fileContents ); + $this->content = $p[0]; + //DEBUG : file_put_contents($this->path.".orig",$fileContents ); + //DEBUG : file_put_contents($this->path.".patch", $this->patch); + } + + if ( fwrite( $file, $this->content ) === false ) { + + $this->status = "error"; + $this->message = "could not write to file"; + } else { + + // Unless stat cache is cleared the pre-cached mtime will be + // returned instead of new modification time after editing + // the file. + clearstatcache(); + $this->data = '"mtime":'.filemtime( $this->path ); + $this->status = "success"; + } + + fclose( $file ); + } else { + + $this->status = "error"; + $this->message = "Cannot Write to File"; + } + + } else { + + $this->status = "error"; + $this->message = "Not A File"; + } + } else { + + $file = fopen( $this->path, 'w' ); + fclose( $file ); + $this->data = '"mtime":' . filemtime ($this->path); + $this->status = "success"; + } + } + + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // DUPLICATE (Creates a duplicate of the object - (cut/copy/paste) + ////////////////////////////////////////////////////////////////// + + public function duplicate() { + + if ( ! file_exists( $this->path ) ) { + + $this->status = "error"; + $this->message = "Invalid Source"; + } + + function recurse_copy( $src, $dst ) { + + $dir = opendir( $src ); + @mkdir( $dst ); + while ( false !== ( $file = readdir( $dir ) ) ) { + + if (( $file != '.' ) && ( $file != '..' )) { + + if ( is_dir( $src . '/' . $file ) ) { + + recurse_copy( $src . '/' . $file, $dst . '/' . $file ); + } else { + + copy( $src . '/' . $file, $dst . '/' . $file ); + } + } + } + closedir($dir); + } + + if ( $this->status != "error" ) { + + if ( is_file( $this->path ) ) { + + copy( $this->path, $this->destination ); + $this->status = "success"; + } else { + + recurse_copy( $this->path, $this->destination ); + if ( ! $this->response ) { + + $this->status = "success"; + } + } + } + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // UPLOAD (Handles uploads to the specified directory) + ////////////////////////////////////////////////////////////////// + + public function upload() { + + // Check that the path is a directory + if ( is_file( $this->path ) ) { + + $this->status = "error"; + $this->message = "Path Not A Directory"; + } else { + + // Handle upload + $info = array(); + foreach( $_FILES['upload']['name'] as $key => $value ) { + + if ( ! empty( $value ) ) { + + $filename = $value; + $add = $this->path."/$filename"; + if ( @move_uploaded_file( $_FILES['upload']['tmp_name'][$key], $add ) ) { + + $info[] = array( + "name"=>$value, + "size"=>filesize($add), + "url"=>$add, + "thumbnail_url"=>$add, + "delete_url"=>$add, + "delete_type"=>"DELETE" + ); + } + } + } + $this->upload_json = json_encode( $info ); + } + $this->respond(); + } + + ////////////////////////////////////////////////////////////////// + // RESPOND (Outputs data in JSON [JSEND] format) + ////////////////////////////////////////////////////////////////// + + public function respond() { + + // Success /////////////////////////////////////////////// + if ( $this->status=="success" ) { + + if ( $this->data ) { + + $json = '{"status":"success","data":{' . $this->data . '}}'; + } else { + $json = '{"status":"success","data":null}'; + } + + // Upload JSON /////////////////////////////////////////// + } elseif ( $this->upload_json != '' ) { + + $json = $this->upload_json; + // Error ///////////////////////////////////////////////// + } else { + + $json = '{"status":"error","message":"'.$this->message.'"}'; + } + + // Output //////////////////////////////////////////////// + echo( $json ); + } + + ////////////////////////////////////////////////////////////////// + // Clean a path + ////////////////////////////////////////////////////////////////// + + public static function cleanPath( $path ) { + + // replace backslash with slash + $path = str_replace( '\\', '/', $path ); + + // allow only valid chars in paths$ + $path = preg_replace( '/[^A-Za-z0-9\-\._\/\ ]/', '', $path ); + // maybe this is not needed anymore + // prevent Poison Null Byte injections + $path = str_replace( chr( 0 ), '', $path ); + + // prevent go out of the workspace + while ( strpos( $path, '../' ) !== false ) { + + $path = str_replace( '../', '', $path ); + } + + return $path; + } } \ No newline at end of file diff --git a/components/settings/dialog.php b/components/settings/dialog.php index 4f3c9a0..16440d9 100755 --- a/components/settings/dialog.php +++ b/components/settings/dialog.php @@ -135,6 +135,9 @@ case "codiad.editor.tabSize": codiad.editor.setTabSize(val); break; + case "codiad.editor.overScroll": + codiad.editor.setOverScroll(val); + break; } } localStorage.setItem(setting, val); diff --git a/components/settings/settings.editor.php b/components/settings/settings.editor.php index f4aa254..6ce3955 100755 --- a/components/settings/settings.editor.php +++ b/components/settings/settings.editor.php @@ -173,4 +173,16 @@ + + + + + + + + diff --git a/plugins/Codiad-Collaborative-master/README.md b/plugins/Codiad-Collaborative-master/README.md deleted file mode 100755 index 49426f1..0000000 --- a/plugins/Codiad-Collaborative-master/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Collaborative - -This plugin adds collaborative functionallity to Codiad - -# Installation - -- Install Node.JS -- Install Socket.io -- Forward a port you are comfortable with and change the default port in the config.json -- Download the zip file and extract it to your plugins folder diff --git a/plugins/Codiad-Collaborative-master/controller.php b/plugins/Codiad-Collaborative-master/controller.php deleted file mode 100755 index fe4ee36..0000000 --- a/plugins/Codiad-Collaborative-master/controller.php +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/dialog.php b/plugins/Codiad-Collaborative-master/dialog.php deleted file mode 100755 index 4bdaf46..0000000 --- a/plugins/Codiad-Collaborative-master/dialog.php +++ /dev/null @@ -1,37 +0,0 @@ - -
    - -
    Not compatible with this version of Codiad
    - Note: This plugin requires at least Codiad 2.x.

    - -
    - \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/file_db.php b/plugins/Codiad-Collaborative-master/file_db.php deleted file mode 100755 index a6e9a30..0000000 --- a/plugins/Codiad-Collaborative-master/file_db.php +++ /dev/null @@ -1,307 +0,0 @@ -base_path = $base_path; - if(!is_dir($base_path)) { - mkdir($base_path); - } - } - - /* Create a new entry into the data base. */ - public function create($query, $group=null) { - $query = $this->_normalize_query($query); - - if(!$this->_is_direct_query($query)) { - return null; - } - - $base_path = $this->base_path; - if($group != null) { - $base_path .= '/' . $group; - } - $index_file = $base_path . '/' . $this->index_name; - - if(!is_dir($base_path)) { - mkdir($base_path); - } - - $entry_name = $this->_make_entry_name($query); - $entry_hash = md5($entry_name); - $entry_file = $base_path . '/' . $entry_hash; - - if(!file_exists($entry_file)) { - if(!file_exists($index_file)) { - touch($index_file); - } - - $entry = $entry_name . '>' . $entry_hash . '>' . PHP_EOL; - file_put_contents($index_file, $entry, FILE_APPEND | LOCK_EX); - touch($entry_file); - } - - $entry = new file_db_entry($entry_name, $entry_file, $index_file, $group); - $entry->clear(); - - if(file_exists($entry_file)) { - return $entry; - } - return null; - } - - /* Get the content for the given query. */ - public function select($query, $group=null) { - $query = $this->_normalize_query($query); - - $base_path = $this->base_path; - if($group != null) { - $base_path .= '/' . $group; - } - $index_file = $base_path . '/' . $this->index_name; - - if($this->_is_direct_query($query)) { - $entry_name = $this->_make_entry_name($query); - $entry_hash = md5($entry_name); - $entry_file = $base_path . '/' . $entry_hash; - - if(file_exists($entry_file)) { - return new file_db_entry($entry_name, $entry_file, $index_file, $group); - } - return null; - } - - $entries = array(); - if(file_exists($index_file)) { - $regex = $this->_make_regex($query); - $file = fopen($index_file, 'r'); - while(!feof($file)) { - $line = fgets($file); - if (preg_match($regex, $line, $matches)) { - $entry_file = $base_path . '/' . $matches[2]; - if(file_exists($entry_file)) { - $entries[] = new file_db_entry($matches[1], $entry_file, $index_file, $group); - } - } - } - fclose($file); - } - - return $entries; - } - - /* Select all entries into the given group. */ - public function select_group($group) { - $entries = array(); - - $base_path = $this->base_path . '/' . $group; - $index_file = $base_path . '/' . $this->index_name; - - if(file_exists($index_file)) { - $sep = $this->separator_regex; - $regex = '/(' . $sep . '.*?' . $sep . ')\>(.*?)\>/'; - $file = fopen($index_file, 'r'); - while(!feof($file)) { - $line = fgets($file); - if (preg_match($regex, $line, $matches)) { - $entry_file = $base_path . '/' . $matches[2]; - $entries[] = new file_db_entry($matches[1], $entry_file, $index_file, $group); - } - } - fclose($file); - } - - return $entries; - } - - /* Make the regex for the given query. */ - private function _make_regex($query) { - $regex = '/(' . $this->separator_regex; - foreach($query as $key => $value) { - $regex .= $key . $this->key_value_separator_regex; - if($value == '%2A') { // %2A=* - $regex .= '.*?'; - } - else { - $regex .= $value; - } - $regex .= $this->separator_regex; - } - $regex .= ')' . '\>(.*?)\>' . '/'; - return $regex; - } - - /* Make an entry name from the given normalized query. */ - private function _make_entry_name($query) { - $filename = $this->separator; - foreach($query as $key => $value) { - $filename .= $key . $this->key_value_separator . $value; - $filename .= $this->separator; - } - return $filename; - } - - /* Check if the given query is a direct query. */ - private function _is_direct_query($query) { - foreach($query as $key => $value) { - if($value == '%2A'){ // %2A=* - return false; - } - } - return true; - } - - /* Normalize the given query. */ - private function &_normalize_query(&$query) { - ksort($query); - foreach($query as $key => $value) { - $query[$key] = rawurlencode($value); - } - return $query; - } - -} - -/* */ -class file_db_entry { - - /* They should be the same as those - * in the file_db class. */ - private $separator = '|'; - private $separator_regex = '\|'; - private $key_value_separator = ':'; - private $key_value_separator_regex = '\:'; - - private $entry_name; - private $entry_hash; - private $entry_file; - private $index_file; - private $group; - - private $handler; - - /* Construct the entry with the given filename. */ - public function __construct($entry_name, $entry_file, $index_file, $group) { - $this->entry_name = $entry_name; - $this->entry_file = $entry_file; - $this->index_file = $index_file; - $this->group = $group; - } - - /* Get the value of the field with the given name. */ - public function get_field($name) { - $regex = '/' - . $this->separator_regex - . rawurlencode($name) - . $this->key_value_separator_regex - . '(.*?)' . $this->separator_regex - . '/'; - if(preg_match($regex, $this->entry_name, $matches)) { - return rawurldecode($matches[1]); - } - return null; - } - - /* Get the group name of the entry. */ - public function get_group() { - return $this->group; - } - - /* Set the value of the entry. */ - public function put_value($value) { - file_put_contents($this->entry_file, serialize($value), LOCK_EX); - } - - /* Get the value of the entry. */ - public function get_value() { - if(file_exists($this->entry_file)) { - return unserialize(file_get_contents($this->entry_file)); - } - return null; - } - - /* Remove the entry. */ - public function remove() { - $success = false; - if(file_exists($this->index_file)) { - $lines = file($this->index_file, FILE_SKIP_EMPTY_LINES); - - $file = fopen($this->index_file, 'w'); - flock($file, LOCK_EX); - - foreach($lines as $line) { - if (strpos($line, $this->entry_name) !== 0) { - fwrite($file, $line); - } - else { - $success = true; - } - } - - flock($file, LOCK_UN); - fclose($file); - } - - if($success && file_exists($this->entry_file)) { - unlink($this->entry_file); - return true; - } - return false; - } - - /* Clear the value of the entry. */ - public function clear() { - $this->put_value(''); - } - - /* Lock the entry. */ - public function lock() { - $lock = $this->entry_file . '.lock'; - while(file_exists($lock)) { - usleep(100); - } - touch($this->entry_file . '.lock'); - } - - /* Unlock the entry. */ - public function unlock() { - $lock = $this->entry_file . '.lock'; - if(file_exists($lock)) { - unlink($lock); - } - } -} - -?> diff --git a/plugins/Codiad-Collaborative-master/init.js b/plugins/Codiad-Collaborative-master/init_old.js similarity index 100% rename from plugins/Codiad-Collaborative-master/init.js rename to plugins/Codiad-Collaborative-master/init_old.js diff --git a/plugins/Codiad-Collaborative-master/node_modules/accepts/HISTORY.md b/plugins/Codiad-Collaborative-master/node_modules/accepts/HISTORY.md deleted file mode 100755 index f16c17a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/accepts/HISTORY.md +++ /dev/null @@ -1,224 +0,0 @@ -1.3.5 / 2018-02-28 -================== - - * deps: mime-types@~2.1.18 - - deps: mime-db@~1.33.0 - -1.3.4 / 2017-08-22 -================== - - * deps: mime-types@~2.1.16 - - deps: mime-db@~1.29.0 - -1.3.3 / 2016-05-02 -================== - - * deps: mime-types@~2.1.11 - - deps: mime-db@~1.23.0 - * deps: negotiator@0.6.1 - - perf: improve `Accept` parsing speed - - perf: improve `Accept-Charset` parsing speed - - perf: improve `Accept-Encoding` parsing speed - - perf: improve `Accept-Language` parsing speed - -1.3.2 / 2016-03-08 -================== - - * deps: mime-types@~2.1.10 - - Fix extension of `application/dash+xml` - - Update primary extension for `audio/mp4` - - deps: mime-db@~1.22.0 - -1.3.1 / 2016-01-19 -================== - - * deps: mime-types@~2.1.9 - - deps: mime-db@~1.21.0 - -1.3.0 / 2015-09-29 -================== - - * deps: mime-types@~2.1.7 - - deps: mime-db@~1.19.0 - * deps: negotiator@0.6.0 - - Fix including type extensions in parameters in `Accept` parsing - - Fix parsing `Accept` parameters with quoted equals - - Fix parsing `Accept` parameters with quoted semicolons - - Lazy-load modules from main entry point - - perf: delay type concatenation until needed - - perf: enable strict mode - - perf: hoist regular expressions - - perf: remove closures getting spec properties - - perf: remove a closure from media type parsing - - perf: remove property delete from media type parsing - -1.2.13 / 2015-09-06 -=================== - - * deps: mime-types@~2.1.6 - - deps: mime-db@~1.18.0 - -1.2.12 / 2015-07-30 -=================== - - * deps: mime-types@~2.1.4 - - deps: mime-db@~1.16.0 - -1.2.11 / 2015-07-16 -=================== - - * deps: mime-types@~2.1.3 - - deps: mime-db@~1.15.0 - -1.2.10 / 2015-07-01 -=================== - - * deps: mime-types@~2.1.2 - - deps: mime-db@~1.14.0 - -1.2.9 / 2015-06-08 -================== - - * deps: mime-types@~2.1.1 - - perf: fix deopt during mapping - -1.2.8 / 2015-06-07 -================== - - * deps: mime-types@~2.1.0 - - deps: mime-db@~1.13.0 - * perf: avoid argument reassignment & argument slice - * perf: avoid negotiator recursive construction - * perf: enable strict mode - * perf: remove unnecessary bitwise operator - -1.2.7 / 2015-05-10 -================== - - * deps: negotiator@0.5.3 - - Fix media type parameter matching to be case-insensitive - -1.2.6 / 2015-05-07 -================== - - * deps: mime-types@~2.0.11 - - deps: mime-db@~1.9.1 - * deps: negotiator@0.5.2 - - Fix comparing media types with quoted values - - Fix splitting media types with quoted commas - -1.2.5 / 2015-03-13 -================== - - * deps: mime-types@~2.0.10 - - deps: mime-db@~1.8.0 - -1.2.4 / 2015-02-14 -================== - - * Support Node.js 0.6 - * deps: mime-types@~2.0.9 - - deps: mime-db@~1.7.0 - * deps: negotiator@0.5.1 - - Fix preference sorting to be stable for long acceptable lists - -1.2.3 / 2015-01-31 -================== - - * deps: mime-types@~2.0.8 - - deps: mime-db@~1.6.0 - -1.2.2 / 2014-12-30 -================== - - * deps: mime-types@~2.0.7 - - deps: mime-db@~1.5.0 - -1.2.1 / 2014-12-30 -================== - - * deps: mime-types@~2.0.5 - - deps: mime-db@~1.3.1 - -1.2.0 / 2014-12-19 -================== - - * deps: negotiator@0.5.0 - - Fix list return order when large accepted list - - Fix missing identity encoding when q=0 exists - - Remove dynamic building of Negotiator class - -1.1.4 / 2014-12-10 -================== - - * deps: mime-types@~2.0.4 - - deps: mime-db@~1.3.0 - -1.1.3 / 2014-11-09 -================== - - * deps: mime-types@~2.0.3 - - deps: mime-db@~1.2.0 - -1.1.2 / 2014-10-14 -================== - - * deps: negotiator@0.4.9 - - Fix error when media type has invalid parameter - -1.1.1 / 2014-09-28 -================== - - * deps: mime-types@~2.0.2 - - deps: mime-db@~1.1.0 - * deps: negotiator@0.4.8 - - Fix all negotiations to be case-insensitive - - Stable sort preferences of same quality according to client order - -1.1.0 / 2014-09-02 -================== - - * update `mime-types` - -1.0.7 / 2014-07-04 -================== - - * Fix wrong type returned from `type` when match after unknown extension - -1.0.6 / 2014-06-24 -================== - - * deps: negotiator@0.4.7 - -1.0.5 / 2014-06-20 -================== - - * fix crash when unknown extension given - -1.0.4 / 2014-06-19 -================== - - * use `mime-types` - -1.0.3 / 2014-06-11 -================== - - * deps: negotiator@0.4.6 - - Order by specificity when quality is the same - -1.0.2 / 2014-05-29 -================== - - * Fix interpretation when header not in request - * deps: pin negotiator@0.4.5 - -1.0.1 / 2014-01-18 -================== - - * Identity encoding isn't always acceptable - * deps: negotiator@~0.4.0 - -1.0.0 / 2013-12-27 -================== - - * Genesis diff --git a/plugins/Codiad-Collaborative-master/node_modules/accepts/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/accepts/LICENSE deleted file mode 100755 index 0616607..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/accepts/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2015 Douglas Christopher Wilson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/accepts/README.md b/plugins/Codiad-Collaborative-master/node_modules/accepts/README.md deleted file mode 100755 index 6a2749a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/accepts/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# accepts - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). -Extracted from [koa](https://www.npmjs.com/package/koa) for general use. - -In addition to negotiator, it allows: - -- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` - as well as `('text/html', 'application/json')`. -- Allows type shorthands such as `json`. -- Returns `false` when no types match -- Treats non-existent headers as `*` - -## Installation - -This is a [Node.js](https://nodejs.org/en/) module available through the -[npm registry](https://www.npmjs.com/). Installation is done using the -[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): - -```sh -$ npm install accepts -``` - -## API - - - -```js -var accepts = require('accepts') -``` - -### accepts(req) - -Create a new `Accepts` object for the given `req`. - -#### .charset(charsets) - -Return the first accepted charset. If nothing in `charsets` is accepted, -then `false` is returned. - -#### .charsets() - -Return the charsets that the request accepts, in the order of the client's -preference (most preferred first). - -#### .encoding(encodings) - -Return the first accepted encoding. If nothing in `encodings` is accepted, -then `false` is returned. - -#### .encodings() - -Return the encodings that the request accepts, in the order of the client's -preference (most preferred first). - -#### .language(languages) - -Return the first accepted language. If nothing in `languages` is accepted, -then `false` is returned. - -#### .languages() - -Return the languages that the request accepts, in the order of the client's -preference (most preferred first). - -#### .type(types) - -Return the first accepted type (and it is returned as the same text as what -appears in the `types` array). If nothing in `types` is accepted, then `false` -is returned. - -The `types` array can contain full MIME types or file extensions. Any value -that is not a full MIME types is passed to `require('mime-types').lookup`. - -#### .types() - -Return the types that the request accepts, in the order of the client's -preference (most preferred first). - -## Examples - -### Simple type negotiation - -This simple example shows how to use `accepts` to return a different typed -respond body based on what the client wants to accept. The server lists it's -preferences in order and will get back the best match between the client and -server. - -```js -var accepts = require('accepts') -var http = require('http') - -function app (req, res) { - var accept = accepts(req) - - // the order of this list is significant; should be server preferred order - switch (accept.type(['json', 'html'])) { - case 'json': - res.setHeader('Content-Type', 'application/json') - res.write('{"hello":"world!"}') - break - case 'html': - res.setHeader('Content-Type', 'text/html') - res.write('hello, world!') - break - default: - // the fallback is text/plain, so no need to specify it above - res.setHeader('Content-Type', 'text/plain') - res.write('hello, world!') - break - } - - res.end() -} - -http.createServer(app).listen(3000) -``` - -You can test this out with the cURL program: -```sh -curl -I -H'Accept: text/html' http://localhost:3000/ -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/accepts.svg -[npm-url]: https://npmjs.org/package/accepts -[node-version-image]: https://img.shields.io/node/v/accepts.svg -[node-version-url]: https://nodejs.org/en/download/ -[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg -[travis-url]: https://travis-ci.org/jshttp/accepts -[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/accepts -[downloads-image]: https://img.shields.io/npm/dm/accepts.svg -[downloads-url]: https://npmjs.org/package/accepts diff --git a/plugins/Codiad-Collaborative-master/node_modules/accepts/index.js b/plugins/Codiad-Collaborative-master/node_modules/accepts/index.js deleted file mode 100755 index e9b2f63..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/accepts/index.js +++ /dev/null @@ -1,238 +0,0 @@ -/*! - * accepts - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var Negotiator = require('negotiator') -var mime = require('mime-types') - -/** - * Module exports. - * @public - */ - -module.exports = Accepts - -/** - * Create a new Accepts object for the given req. - * - * @param {object} req - * @public - */ - -function Accepts (req) { - if (!(this instanceof Accepts)) { - return new Accepts(req) - } - - this.headers = req.headers - this.negotiator = new Negotiator(req) -} - -/** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json" or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * this.types('html'); - * // => "html" - * - * // Accept: text/*, application/json - * this.types('html'); - * // => "html" - * this.types('text/html'); - * // => "text/html" - * this.types('json', 'text'); - * // => "json" - * this.types('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * this.types('image/png'); - * this.types('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * this.types(['html', 'json']); - * this.types('html', 'json'); - * // => "json" - * - * @param {String|Array} types... - * @return {String|Array|Boolean} - * @public - */ - -Accepts.prototype.type = -Accepts.prototype.types = function (types_) { - var types = types_ - - // support flattened arguments - if (types && !Array.isArray(types)) { - types = new Array(arguments.length) - for (var i = 0; i < types.length; i++) { - types[i] = arguments[i] - } - } - - // no types, return all requested types - if (!types || types.length === 0) { - return this.negotiator.mediaTypes() - } - - // no accept header, return first given type - if (!this.headers.accept) { - return types[0] - } - - var mimes = types.map(extToMime) - var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) - var first = accepts[0] - - return first - ? types[mimes.indexOf(first)] - : false -} - -/** - * Return accepted encodings or best fit based on `encodings`. - * - * Given `Accept-Encoding: gzip, deflate` - * an array sorted by quality is returned: - * - * ['gzip', 'deflate'] - * - * @param {String|Array} encodings... - * @return {String|Array} - * @public - */ - -Accepts.prototype.encoding = -Accepts.prototype.encodings = function (encodings_) { - var encodings = encodings_ - - // support flattened arguments - if (encodings && !Array.isArray(encodings)) { - encodings = new Array(arguments.length) - for (var i = 0; i < encodings.length; i++) { - encodings[i] = arguments[i] - } - } - - // no encodings, return all requested encodings - if (!encodings || encodings.length === 0) { - return this.negotiator.encodings() - } - - return this.negotiator.encodings(encodings)[0] || false -} - -/** - * Return accepted charsets or best fit based on `charsets`. - * - * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` - * an array sorted by quality is returned: - * - * ['utf-8', 'utf-7', 'iso-8859-1'] - * - * @param {String|Array} charsets... - * @return {String|Array} - * @public - */ - -Accepts.prototype.charset = -Accepts.prototype.charsets = function (charsets_) { - var charsets = charsets_ - - // support flattened arguments - if (charsets && !Array.isArray(charsets)) { - charsets = new Array(arguments.length) - for (var i = 0; i < charsets.length; i++) { - charsets[i] = arguments[i] - } - } - - // no charsets, return all requested charsets - if (!charsets || charsets.length === 0) { - return this.negotiator.charsets() - } - - return this.negotiator.charsets(charsets)[0] || false -} - -/** - * Return accepted languages or best fit based on `langs`. - * - * Given `Accept-Language: en;q=0.8, es, pt` - * an array sorted by quality is returned: - * - * ['es', 'pt', 'en'] - * - * @param {String|Array} langs... - * @return {Array|String} - * @public - */ - -Accepts.prototype.lang = -Accepts.prototype.langs = -Accepts.prototype.language = -Accepts.prototype.languages = function (languages_) { - var languages = languages_ - - // support flattened arguments - if (languages && !Array.isArray(languages)) { - languages = new Array(arguments.length) - for (var i = 0; i < languages.length; i++) { - languages[i] = arguments[i] - } - } - - // no languages, return all requested languages - if (!languages || languages.length === 0) { - return this.negotiator.languages() - } - - return this.negotiator.languages(languages)[0] || false -} - -/** - * Convert extnames to mime. - * - * @param {String} type - * @return {String} - * @private - */ - -function extToMime (type) { - return type.indexOf('/') === -1 - ? mime.lookup(type) - : type -} - -/** - * Check if mime is valid. - * - * @param {String} type - * @return {String} - * @private - */ - -function validMime (type) { - return typeof type === 'string' -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/accepts/package.json b/plugins/Codiad-Collaborative-master/node_modules/accepts/package.json deleted file mode 100755 index 398a82d..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/accepts/package.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "_args": [ - [ - "accepts@~1.3.4", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io" - ] - ], - "_from": "accepts@>=1.3.4 <1.4.0", - "_id": "accepts@1.3.5", - "_inCache": true, - "_installable": true, - "_location": "/accepts", - "_nodeVersion": "6.11.1", - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/accepts_1.3.5_1519869527663_0.6663620712347182" - }, - "_npmUser": { - "email": "doug@somethingdoug.com", - "name": "dougwilson" - }, - "_npmVersion": "3.10.10", - "_phantomChildren": {}, - "_requested": { - "name": "accepts", - "raw": "accepts@~1.3.4", - "rawSpec": "~1.3.4", - "scope": null, - "spec": ">=1.3.4 <1.4.0", - "type": "range" - }, - "_requiredBy": [ - "/engine.io" - ], - "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "_shasum": "eb777df6011723a3b14e8a72c0805c8e86746bd2", - "_shrinkwrap": null, - "_spec": "accepts@~1.3.4", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io", - "bugs": { - "url": "https://github.com/jshttp/accepts/issues" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - } - ], - "dependencies": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - }, - "description": "Higher-level content negotiation", - "devDependencies": { - "eslint": "4.18.1", - "eslint-config-standard": "11.0.0", - "eslint-plugin-import": "2.9.0", - "eslint-plugin-markdown": "1.0.0-beta.6", - "eslint-plugin-node": "6.0.1", - "eslint-plugin-promise": "3.6.0", - "eslint-plugin-standard": "3.0.1", - "istanbul": "0.4.5", - "mocha": "~1.21.5" - }, - "directories": {}, - "dist": { - "fileCount": 5, - "shasum": "eb777df6011723a3b14e8a72c0805c8e86746bd2", - "tarball": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "unpackedSize": 16555 - }, - "engines": { - "node": ">= 0.6" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "gitHead": "c38d0e968cdc1526f7cc7a718977ee76655c84f5", - "homepage": "https://github.com/jshttp/accepts#readme", - "keywords": [ - "accept", - "accepts", - "content", - "negotiation" - ], - "license": "MIT", - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "name": "accepts", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/accepts.git" - }, - "scripts": { - "lint": "eslint --plugin markdown --ext js,md .", - "test": "mocha --reporter spec --check-leaks --bail test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "version": "1.3.5" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/after/.npmignore deleted file mode 100755 index 6c78602..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.monitor diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/.travis.yml b/plugins/Codiad-Collaborative-master/node_modules/after/.travis.yml deleted file mode 100755 index afd72d0..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - 0.9 - - 0.10 - - 0.12 - - 4.2.4 - - 5.4.1 - - iojs-1 - - iojs-2 - - iojs-3 diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/LICENCE b/plugins/Codiad-Collaborative-master/node_modules/after/LICENCE deleted file mode 100755 index 7c35130..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/README.md b/plugins/Codiad-Collaborative-master/node_modules/after/README.md deleted file mode 100755 index fc69096..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# After [![Build Status][1]][2] - -Invoke callback after n calls - -## Status: production ready - -## Example - -```js -var after = require("after") -var db = require("./db") // some db. - -var updateUser = function (req, res) { - // use after to run two tasks in parallel, - // namely get request body and get session - // then run updateUser with the results - var next = after(2, updateUser) - var results = {} - - getJSONBody(req, res, function (err, body) { - if (err) return next(err) - - results.body = body - next(null, results) - }) - - getSessionUser(req, res, function (err, user) { - if (err) return next(err) - - results.user = user - next(null, results) - }) - - // now do the thing! - function updateUser(err, result) { - if (err) { - res.statusCode = 500 - return res.end("Unexpected Error") - } - - if (!result.user || result.user.role !== "admin") { - res.statusCode = 403 - return res.end("Permission Denied") - } - - db.put("users:" + req.params.userId, result.body, function (err) { - if (err) { - res.statusCode = 500 - return res.end("Unexpected Error") - } - - res.statusCode = 200 - res.end("Ok") - }) - } -} -``` - -## Naive Example - -```js -var after = require("after") - , next = after(3, logItWorks) - -next() -next() -next() // it works - -function logItWorks() { - console.log("it works!") -} -``` - -## Example with error handling - -```js -var after = require("after") - , next = after(3, logError) - -next() -next(new Error("oops")) // logs oops -next() // does nothing - -// This callback is only called once. -// If there is an error the callback gets called immediately -// this avoids the situation where errors get lost. -function logError(err) { - console.log(err) -} -``` - -## Installation - -`npm install after` - -## Tests - -`npm test` - -## Contributors - - - Raynos - - defunctzombie - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Raynos/after.png - [2]: http://travis-ci.org/Raynos/after - [3]: http://raynos.org/blog/2/Flow-control-in-node.js - [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307 - [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031 - [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419 - [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091 - [8]: http://github.com/Raynos/iterators - [9]: http://github.com/Raynos/composite diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/index.js b/plugins/Codiad-Collaborative-master/node_modules/after/index.js deleted file mode 100755 index ec24879..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/index.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = after - -function after(count, callback, err_cb) { - var bail = false - err_cb = err_cb || noop - proxy.count = count - - return (count === 0) ? callback() : proxy - - function proxy(err, result) { - if (proxy.count <= 0) { - throw new Error('after called too many times') - } - --proxy.count - - // after first error, rest are passed to err_cb - if (err) { - bail = true - callback(err) - // future error callbacks will go to error handler - callback = err_cb - } else if (proxy.count === 0 && !bail) { - callback(null, result) - } - } -} - -function noop() {} diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/package.json b/plugins/Codiad-Collaborative-master/node_modules/after/package.json deleted file mode 100755 index 3dfa58f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/package.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "_args": [ - [ - "after@0.8.2", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser" - ] - ], - "_from": "after@0.8.2", - "_id": "after@0.8.2", - "_inCache": true, - "_installable": true, - "_location": "/after", - "_nodeVersion": "0.10.32", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/after-0.8.2.tgz_1471308639186_0.9132961586583406" - }, - "_npmUser": { - "email": "raynos2@gmail.com", - "name": "raynos" - }, - "_npmVersion": "2.15.9", - "_phantomChildren": {}, - "_requested": { - "name": "after", - "raw": "after@0.8.2", - "rawSpec": "0.8.2", - "scope": null, - "spec": "0.8.2", - "type": "version" - }, - "_requiredBy": [ - "/engine.io-parser" - ], - "_resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "_shasum": "fedb394f9f0e02aa9768e702bda23b505fae7e1f", - "_shrinkwrap": null, - "_spec": "after@0.8.2", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser", - "author": { - "email": "raynos2@gmail.com", - "name": "Raynos" - }, - "bugs": { - "url": "https://github.com/Raynos/after/issues" - }, - "contributors": [ - { - "name": "Raynos", - "email": "raynos2@gmail.com", - "url": "http://raynos.org" - } - ], - "dependencies": {}, - "description": "after - tiny flow control", - "devDependencies": { - "mocha": "~1.8.1" - }, - "directories": {}, - "dist": { - "shasum": "fedb394f9f0e02aa9768e702bda23b505fae7e1f", - "tarball": "https://registry.npmjs.org/after/-/after-0.8.2.tgz" - }, - "gitHead": "e8c26046f36962b90e68dc5df33a9672a54b25f5", - "homepage": "https://github.com/Raynos/after#readme", - "keywords": [ - "after", - "arch", - "control", - "flow", - "flowcontrol" - ], - "license": "MIT", - "maintainers": [ - { - "name": "raynos", - "email": "raynos2@gmail.com" - }, - { - "name": "defunctzombie", - "email": "shtylman@gmail.com" - } - ], - "name": "after", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/after.git" - }, - "scripts": { - "test": "mocha --ui tdd --reporter spec test/*.js" - }, - "version": "0.8.2" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/after/test/after-test.js b/plugins/Codiad-Collaborative-master/node_modules/after/test/after-test.js deleted file mode 100755 index 0d63f4c..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/after/test/after-test.js +++ /dev/null @@ -1,120 +0,0 @@ -/*global suite, test*/ - -var assert = require("assert") - , after = require("../") - -test("exists", function () { - assert(typeof after === "function", "after is not a function") -}) - -test("after when called with 0 invokes", function (done) { - after(0, done) -}); - -test("after 1", function (done) { - var next = after(1, done) - next() -}) - -test("after 5", function (done) { - var next = after(5, done) - , i = 5 - - while (i--) { - next() - } -}) - -test("manipulate count", function (done) { - var next = after(1, done) - , i = 5 - - next.count = i - while (i--) { - next() - } -}) - -test("after terminates on error", function (done) { - var next = after(2, function(err) { - assert.equal(err.message, 'test'); - done(); - }) - next(new Error('test')) - next(new Error('test2')) -}) - -test('gee', function(done) { - done = after(2, done) - - function cb(err) { - assert.equal(err.message, 1); - done() - } - - var next = after(3, cb, function(err) { - assert.equal(err.message, 2) - done() - }); - - next() - next(new Error(1)) - next(new Error(2)) -}) - -test('eee', function(done) { - done = after(3, done) - - function cb(err) { - assert.equal(err.message, 1); - done() - } - - var next = after(3, cb, function(err) { - assert.equal(err.message, 2) - done() - }); - - next(new Error(1)) - next(new Error(2)) - next(new Error(2)) -}) - -test('gge', function(done) { - function cb(err) { - assert.equal(err.message, 1); - done() - } - - var next = after(3, cb, function(err) { - // should not happen - assert.ok(false); - }); - - next() - next() - next(new Error(1)) -}) - -test('egg', function(done) { - function cb(err) { - assert.equal(err.message, 1); - done() - } - - var next = after(3, cb, function(err) { - // should not happen - assert.ok(false); - }); - - next(new Error(1)) - next() - next() -}) - -test('throws on too many calls', function(done) { - var next = after(1, done); - next() - assert.throws(next, /after called too many times/); -}); - diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/.npmignore deleted file mode 100755 index cfbee8d..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/.npmignore +++ /dev/null @@ -1,17 +0,0 @@ -lib-cov -lcov.info -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results -build -.grunt - -node_modules diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/LICENCE b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/LICENCE deleted file mode 100755 index 35fa375..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/LICENCE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (C) 2013 Rase- - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/Makefile b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/Makefile deleted file mode 100755 index 849887f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -REPORTER = dot - -test: - @./node_modules/.bin/mocha \ - --reporter $(REPORTER) - -.PHONY: test diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/README.md b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/README.md deleted file mode 100755 index 15e465e..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# How to -```javascript -var sliceBuffer = require('arraybuffer.slice'); -var ab = (new Int8Array(5)).buffer; -var sliced = sliceBuffer(ab, 1, 3); -sliced = sliceBuffer(ab, 1); -``` - -# Licence (MIT) -Copyright (C) 2013 Rase- - - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/index.js b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/index.js deleted file mode 100755 index 11ac556..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/index.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * An abstraction for slicing an arraybuffer even when - * ArrayBuffer.prototype.slice is not supported - * - * @api public - */ - -module.exports = function(arraybuffer, start, end) { - var bytes = arraybuffer.byteLength; - start = start || 0; - end = end || bytes; - - if (arraybuffer.slice) { return arraybuffer.slice(start, end); } - - if (start < 0) { start += bytes; } - if (end < 0) { end += bytes; } - if (end > bytes) { end = bytes; } - - if (start >= bytes || start >= end || bytes === 0) { - return new ArrayBuffer(0); - } - - var abv = new Uint8Array(arraybuffer); - var result = new Uint8Array(end - start); - for (var i = start, ii = 0; i < end; i++, ii++) { - result[ii] = abv[i]; - } - return result.buffer; -}; diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/package.json b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/package.json deleted file mode 100755 index d4e9c05..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_args": [ - [ - "arraybuffer.slice@~0.0.7", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser" - ] - ], - "_from": "arraybuffer.slice@>=0.0.7 <0.1.0", - "_id": "arraybuffer.slice@0.0.7", - "_inCache": true, - "_installable": true, - "_location": "/arraybuffer.slice", - "_nodeVersion": "8.4.0", - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/arraybuffer.slice-0.0.7.tgz_1503998406760_0.431125596864149" - }, - "_npmUser": { - "email": "tonykovanen@hotmail.com", - "name": "rase-" - }, - "_npmVersion": "5.3.0", - "_phantomChildren": {}, - "_requested": { - "name": "arraybuffer.slice", - "raw": "arraybuffer.slice@~0.0.7", - "rawSpec": "~0.0.7", - "scope": null, - "spec": ">=0.0.7 <0.1.0", - "type": "range" - }, - "_requiredBy": [ - "/engine.io-parser" - ], - "_resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", - "_shasum": "3bbc4275dd584cc1b10809b89d4e8b63a69e7675", - "_shrinkwrap": null, - "_spec": "arraybuffer.slice@~0.0.7", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser", - "bugs": { - "url": "https://github.com/rase-/arraybuffer.slice/issues" - }, - "dependencies": {}, - "description": "Exports a function for slicing ArrayBuffers (no polyfilling)", - "devDependencies": { - "expect.js": "0.2.0", - "mocha": "1.17.1" - }, - "directories": {}, - "dist": { - "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", - "shasum": "3bbc4275dd584cc1b10809b89d4e8b63a69e7675", - "tarball": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz" - }, - "gitHead": "6779b3ca590f15c0910181bf7ccc51061f7eb7ac", - "homepage": "https://github.com/rase-/arraybuffer.slice", - "license": "MIT", - "maintainers": [ - { - "name": "rase-", - "email": "tonykovanen@hotmail.com" - } - ], - "name": "arraybuffer.slice", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/rase-/arraybuffer.slice.git" - }, - "version": "0.0.7" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/test/slice-buffer.js b/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/test/slice-buffer.js deleted file mode 100755 index 4778da6..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/arraybuffer.slice/test/slice-buffer.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Test dependencies - */ - -var sliceBuffer = require('../index.js'); -var expect = require('expect.js'); - -/** - * Tests - */ - -describe('sliceBuffer', function() { - describe('using standard slice', function() { - it('should slice correctly with only start provided', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 3); - var sabv = new Uint8Array(sliced); - for (var i = 3, ii = 0; i < abv.length; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with start and end provided', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 3, 8); - var sabv = new Uint8Array(sliced); - for (var i = 3, ii = 0; i < 8; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative start', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, -3); - var sabv = new Uint8Array(sliced); - for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 0, -3); - var sabv = new Uint8Array(sliced); - for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative start and end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, -6, -3); - var sabv = new Uint8Array(sliced); - for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with equal start and end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 1, 1); - expect(sliced.byteLength).to.equal(0); - }); - - it('should slice correctly when end larger than buffer', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 0, 100); - expect(new Uint8Array(sliced)).to.eql(abv); - }); - - it('shoud slice correctly when start larger than end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - - var sliced = sliceBuffer(abv.buffer, 6, 5); - expect(sliced.byteLength).to.equal(0); - }); - }); - - describe('using fallback', function() { - it('should slice correctly with only start provided', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, 3); - var sabv = new Uint8Array(sliced); - for (var i = 3, ii = 0; i < abv.length; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with start and end provided', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - - var sliced = sliceBuffer(ab, 3, 8); - var sabv = new Uint8Array(sliced); - for (var i = 3, ii = 0; i < 8; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative start', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - - var sliced = sliceBuffer(ab, -3); - var sabv = new Uint8Array(sliced); - for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, 0, -3); - var sabv = new Uint8Array(sliced); - for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with negative start and end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, -6, -3); - var sabv = new Uint8Array(sliced); - for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { - expect(abv[i]).to.equal(sabv[ii]); - } - }); - - it('should slice correctly with equal start and end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, 1, 1); - expect(sliced.byteLength).to.equal(0); - }); - - it('should slice correctly when end larger than buffer', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, 0, 100); - var sabv = new Uint8Array(sliced); - for (var i = 0; i < abv.length; i++) { - expect(abv[i]).to.equal(sabv[i]); - } - }); - - it('shoud slice correctly when start larger than end', function() { - var abv = new Uint8Array(10); - for (var i = 0; i < abv.length; i++) { - abv[i] = i; - } - var ab = abv.buffer; - ab.slice = undefined; - - var sliced = sliceBuffer(ab, 6, 5); - expect(sliced.byteLength).to.equal(0); - }); - }); -}); diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/.travis.yml b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/.travis.yml deleted file mode 100755 index 6cf4a7a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "6" - - "node" -script: npm run travis -cache: - yarn: true diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/LICENSE deleted file mode 100755 index 9c91fb2..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2017 Samuel Reed - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/coverage.json b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/coverage.json deleted file mode 100755 index 5b4a358..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/coverage.json +++ /dev/null @@ -1 +0,0 @@ -{"/Users/samuelreed/git/forks/async-throttle/index.js":{"path":"/Users/samuelreed/git/forks/async-throttle/index.js","s":{"1":1,"2":7,"3":1,"4":6,"5":6,"6":6,"7":6,"8":6,"9":6,"10":1,"11":1,"12":3,"13":13,"14":13,"15":13,"16":1,"17":19,"18":1,"19":45,"20":6,"21":39,"22":13,"23":13,"24":13,"25":13,"26":39,"27":18,"28":6,"29":6,"30":1,"31":6,"32":6,"33":6,"34":1,"35":13,"36":13,"37":1},"b":{"1":[1,6],"2":[6,5],"3":[6,5],"4":[6,39],"5":[13,26],"6":[18,21],"7":[6,0]},"f":{"1":7,"2":3,"3":13,"4":19,"5":45,"6":6,"7":13},"fnMap":{"1":{"name":"Queue","line":3,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"2":{"name":"(anonymous_2)","line":22,"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":41}}},"3":{"name":"(anonymous_3)","line":23,"loc":{"start":{"line":23,"column":28},"end":{"line":23,"column":39}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":7},"end":{"line":31,"column":18}}},"5":{"name":"(anonymous_5)","line":36,"loc":{"start":{"line":36,"column":23},"end":{"line":36,"column":34}}},"6":{"name":"(anonymous_6)","line":55,"loc":{"start":{"line":55,"column":25},"end":{"line":55,"column":38}}},"7":{"name":"done","line":62,"loc":{"start":{"line":62,"column":0},"end":{"line":62,"column":16}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":14,"column":1}},"2":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}},"3":{"start":{"line":5,"column":4},"end":{"line":5,"column":30}},"4":{"start":{"line":8,"column":2},"end":{"line":8,"column":26}},"5":{"start":{"line":9,"column":2},"end":{"line":9,"column":53}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":19}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":17}},"8":{"start":{"line":12,"column":2},"end":{"line":12,"column":16}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":31}},"10":{"start":{"line":16,"column":0},"end":{"line":20,"column":2}},"11":{"start":{"line":22,"column":0},"end":{"line":28,"column":3}},"12":{"start":{"line":23,"column":2},"end":{"line":27,"column":4}},"13":{"start":{"line":24,"column":4},"end":{"line":24,"column":75}},"14":{"start":{"line":25,"column":4},"end":{"line":25,"column":16}},"15":{"start":{"line":26,"column":4},"end":{"line":26,"column":24}},"16":{"start":{"line":30,"column":0},"end":{"line":34,"column":3}},"17":{"start":{"line":32,"column":4},"end":{"line":32,"column":43}},"18":{"start":{"line":36,"column":0},"end":{"line":53,"column":2}},"19":{"start":{"line":37,"column":2},"end":{"line":39,"column":3}},"20":{"start":{"line":38,"column":4},"end":{"line":38,"column":11}},"21":{"start":{"line":40,"column":2},"end":{"line":45,"column":3}},"22":{"start":{"line":41,"column":4},"end":{"line":41,"column":32}},"23":{"start":{"line":42,"column":4},"end":{"line":42,"column":19}},"24":{"start":{"line":43,"column":4},"end":{"line":43,"column":20}},"25":{"start":{"line":44,"column":4},"end":{"line":44,"column":16}},"26":{"start":{"line":47,"column":2},"end":{"line":52,"column":3}},"27":{"start":{"line":48,"column":4},"end":{"line":51,"column":5}},"28":{"start":{"line":49,"column":6},"end":{"line":49,"column":30}},"29":{"start":{"line":50,"column":6},"end":{"line":50,"column":27}},"30":{"start":{"line":55,"column":0},"end":{"line":60,"column":2}},"31":{"start":{"line":56,"column":2},"end":{"line":59,"column":3}},"32":{"start":{"line":57,"column":4},"end":{"line":57,"column":22}},"33":{"start":{"line":58,"column":4},"end":{"line":58,"column":16}},"34":{"start":{"line":62,"column":0},"end":{"line":65,"column":1}},"35":{"start":{"line":63,"column":2},"end":{"line":63,"column":17}},"36":{"start":{"line":64,"column":2},"end":{"line":64,"column":14}},"37":{"start":{"line":67,"column":0},"end":{"line":67,"column":23}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":2}},{"start":{"line":4,"column":2},"end":{"line":4,"column":2}}]},"2":{"line":8,"type":"binary-expr","locations":[{"start":{"line":8,"column":12},"end":{"line":8,"column":19}},{"start":{"line":8,"column":23},"end":{"line":8,"column":25}}]},"3":{"line":9,"type":"binary-expr","locations":[{"start":{"line":9,"column":21},"end":{"line":9,"column":40}},{"start":{"line":9,"column":44},"end":{"line":9,"column":52}}]},"4":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":37,"column":2}},{"start":{"line":37,"column":2},"end":{"line":37,"column":2}}]},"5":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":40,"column":2}},{"start":{"line":40,"column":2},"end":{"line":40,"column":2}}]},"6":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":2},"end":{"line":47,"column":2}},{"start":{"line":47,"column":2},"end":{"line":47,"column":2}}]},"7":{"line":56,"type":"if","locations":[{"start":{"line":56,"column":2},"end":{"line":56,"column":2}},{"start":{"line":56,"column":2},"end":{"line":56,"column":2}}]}}}} \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html deleted file mode 100755 index 198882b..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Code coverage report for async-throttle/ - - - - - - -
    -

    Code coverage report for async-throttle/

    -

    - Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

    -
    All files » async-throttle/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    index.js100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
    -
    -
    - - - - - - diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html deleted file mode 100755 index adc030f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - Code coverage report for async-throttle/index.js - - - - - - -
    -

    Code coverage report for async-throttle/index.js

    -

    - Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

    -
    All files » async-throttle/ » index.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68  -  -1 -7 -1 -  -  -6 -6 -6 -6 -6 -6 -  -  -1 -  -  -  -  -  -1 -3 -13 -13 -13 -  -  -  -1 -  -19 -  -  -  -1 -45 -6 -  -39 -13 -13 -13 -13 -  -  -39 -18 -6 -6 -  -  -  -  -1 -6 -6 -6 -  -  -  -1 -13 -13 -  -  -1 - 
    'use strict';
    - 
    -function Queue(options) {
    -  if (!(this instanceof Queue)) {
    -    return new Queue(options);
    -  }
    - 
    -  options = options || {};
    -  this.concurrency = options.concurrency || Infinity;
    -  this.pending = 0;
    -  this.jobs = [];
    -  this.cbs = [];
    -  this._done = done.bind(this);
    -}
    - 
    -var arrayAddMethods = [
    -  'push',
    -  'unshift',
    -  'splice'
    -];
    - 
    -arrayAddMethods.forEach(function(method) {
    -  Queue.prototype[method] = function() {
    -    var methodResult = Array.prototype[method].apply(this.jobs, arguments);
    -    this._run();
    -    return methodResult;
    -  };
    -});
    - 
    -Object.defineProperty(Queue.prototype, 'length', {
    -  get: function() {
    -    return this.pending + this.jobs.length;
    -  }
    -});
    - 
    -Queue.prototype._run = function() {
    -  if (this.pending === this.concurrency) {
    -    return;
    -  }
    -  if (this.jobs.length) {
    -    var job = this.jobs.shift();
    -    this.pending++;
    -    job(this._done);
    -    this._run();
    -  }
    - 
    -  if (this.pending === 0) {
    -    while (this.cbs.length !== 0) {
    -      var cb = this.cbs.pop();
    -      process.nextTick(cb);
    -    }
    -  }
    -};
    - 
    -Queue.prototype.onDone = function(cb) {
    -  Eif (typeof cb === 'function') {
    -    this.cbs.push(cb);
    -    this._run();
    -  }
    -};
    - 
    -function done() {
    -  this.pending--;
    -  this._run();
    -}
    - 
    -module.exports = Queue;
    - 
    - -
    - - - - - - diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/base.css b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/base.css deleted file mode 100755 index a6a2f32..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/base.css +++ /dev/null @@ -1,182 +0,0 @@ -body, html { - margin:0; padding: 0; -} -body { - font-family: Helvetica Neue, Helvetica,Arial; - font-size: 10pt; -} -div.header, div.footer { - background: #eee; - padding: 1em; -} -div.header { - z-index: 100; - position: fixed; - top: 0; - border-bottom: 1px solid #666; - width: 100%; -} -div.footer { - border-top: 1px solid #666; -} -div.body { - margin-top: 10em; -} -div.meta { - font-size: 90%; - text-align: center; -} -h1, h2, h3 { - font-weight: normal; -} -h1 { - font-size: 12pt; -} -h2 { - font-size: 10pt; -} -pre { - font-family: Consolas, Menlo, Monaco, monospace; - margin: 0; - padding: 0; - line-height: 1.3; - font-size: 14px; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} - -div.path { font-size: 110%; } -div.path a:link, div.path a:visited { color: #000; } -table.coverage { border-collapse: collapse; margin:0; padding: 0 } - -table.coverage td { - margin: 0; - padding: 0; - color: #111; - vertical-align: top; -} -table.coverage td.line-count { - width: 50px; - text-align: right; - padding-right: 5px; -} -table.coverage td.line-coverage { - color: #777 !important; - text-align: right; - border-left: 1px solid #666; - border-right: 1px solid #666; -} - -table.coverage td.text { -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 40px; -} -table.coverage td span.cline-neutral { - background: #eee; -} -table.coverage td span.cline-yes { - background: #b5d592; - color: #999; -} -table.coverage td span.cline-no { - background: #fc8c84; -} - -.cstat-yes { color: #111; } -.cstat-no { background: #fc8c84; color: #111; } -.fstat-no { background: #ffc520; color: #111 !important; } -.cbranch-no { background: yellow !important; color: #111; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -.missing-if-branch { - display: inline-block; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: black; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} - -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} - -.entity, .metric { font-weight: bold; } -.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } -.metric small { font-size: 80%; font-weight: normal; color: #666; } - -div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } -div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } -div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } -div.coverage-summary th.file { border-right: none !important; } -div.coverage-summary th.pic { border-left: none !important; text-align: right; } -div.coverage-summary th.pct { border-right: none !important; } -div.coverage-summary th.abs { border-left: none !important; text-align: right; } -div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } -div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } -div.coverage-summary td.file { border-left: 1px solid #666; white-space: nowrap; } -div.coverage-summary td.pic { min-width: 120px !important; } -div.coverage-summary a:link { text-decoration: none; color: #000; } -div.coverage-summary a:visited { text-decoration: none; color: #777; } -div.coverage-summary a:hover { text-decoration: underline; } -div.coverage-summary tfoot td { border-top: 1px solid #666; } - -div.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -div.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -div.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} - -.high { background: #b5d592 !important; } -.medium { background: #ffe87c !important; } -.low { background: #fc8c84 !important; } - -span.cover-fill, span.cover-empty { - display:inline-block; - border:1px solid #444; - background: white; - height: 12px; -} -span.cover-fill { - background: #ccc; - border-right: 1px solid #444; -} -span.cover-empty { - background: white; - border-left: none; -} -span.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/index.html b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/index.html deleted file mode 100755 index 782a1cf..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Code coverage report for All files - - - - - - -
    -

    Code coverage report for All files

    -

    - Statements: 100% (37 / 37)      - Branches: 92.86% (13 / 14)      - Functions: 100% (7 / 7)      - Lines: 100% (37 / 37)      - Ignored: none      -

    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    async-throttle/100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
    -
    -
    - - - - - - diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.css b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.css deleted file mode 100755 index b317a7c..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.js b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.js deleted file mode 100755 index ef51e03..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100755 index 03f704a..0000000 Binary files a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png and /dev/null differ diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sorter.js b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sorter.js deleted file mode 100755 index 6afb736..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov-report/sorter.js +++ /dev/null @@ -1,156 +0,0 @@ -var addSorting = (function () { - "use strict"; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { return document.querySelector('.coverage-summary table'); } - // returns the thead element of the summary table - function getTableHeader() { return getTable().querySelector('thead tr'); } - // returns the tbody element of the summary table - function getTableBody() { return getTable().querySelector('tbody'); } - // returns the th element for nth column - function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function (a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function (a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function () { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i =0 ; i < cols.length; i += 1) { - if (cols[i].sortable) { - el = getNthColumn(i).querySelector('.sorter'); - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function () { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(cols); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov.info b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov.info deleted file mode 100755 index fbf36aa..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/coverage/lcov.info +++ /dev/null @@ -1,74 +0,0 @@ -TN: -SF:/Users/samuelreed/git/forks/async-throttle/index.js -FN:3,Queue -FN:22,(anonymous_2) -FN:23,(anonymous_3) -FN:31,(anonymous_4) -FN:36,(anonymous_5) -FN:55,(anonymous_6) -FN:62,done -FNF:7 -FNH:7 -FNDA:7,Queue -FNDA:3,(anonymous_2) -FNDA:13,(anonymous_3) -FNDA:19,(anonymous_4) -FNDA:45,(anonymous_5) -FNDA:6,(anonymous_6) -FNDA:13,done -DA:3,1 -DA:4,7 -DA:5,1 -DA:8,6 -DA:9,6 -DA:10,6 -DA:11,6 -DA:12,6 -DA:13,6 -DA:16,1 -DA:22,1 -DA:23,3 -DA:24,13 -DA:25,13 -DA:26,13 -DA:30,1 -DA:32,19 -DA:36,1 -DA:37,45 -DA:38,6 -DA:40,39 -DA:41,13 -DA:42,13 -DA:43,13 -DA:44,13 -DA:47,39 -DA:48,18 -DA:49,6 -DA:50,6 -DA:55,1 -DA:56,6 -DA:57,6 -DA:58,6 -DA:62,1 -DA:63,13 -DA:64,13 -DA:67,1 -LF:37 -LH:37 -BRDA:4,1,0,1 -BRDA:4,1,1,6 -BRDA:8,2,0,6 -BRDA:8,2,1,5 -BRDA:9,3,0,6 -BRDA:9,3,1,5 -BRDA:37,4,0,6 -BRDA:37,4,1,39 -BRDA:40,5,0,13 -BRDA:40,5,1,26 -BRDA:47,6,0,18 -BRDA:47,6,1,21 -BRDA:56,7,0,6 -BRDA:56,7,1,0 -BRF:14 -BRH:13 -end_of_record diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/index.js b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/index.js deleted file mode 100755 index c9bd2f9..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/index.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -function Queue(options) { - if (!(this instanceof Queue)) { - return new Queue(options); - } - - options = options || {}; - this.concurrency = options.concurrency || Infinity; - this.pending = 0; - this.jobs = []; - this.cbs = []; - this._done = done.bind(this); -} - -var arrayAddMethods = [ - 'push', - 'unshift', - 'splice' -]; - -arrayAddMethods.forEach(function(method) { - Queue.prototype[method] = function() { - var methodResult = Array.prototype[method].apply(this.jobs, arguments); - this._run(); - return methodResult; - }; -}); - -Object.defineProperty(Queue.prototype, 'length', { - get: function() { - return this.pending + this.jobs.length; - } -}); - -Queue.prototype._run = function() { - if (this.pending === this.concurrency) { - return; - } - if (this.jobs.length) { - var job = this.jobs.shift(); - this.pending++; - job(this._done); - this._run(); - } - - if (this.pending === 0) { - while (this.cbs.length !== 0) { - var cb = this.cbs.pop(); - process.nextTick(cb); - } - } -}; - -Queue.prototype.onDone = function(cb) { - if (typeof cb === 'function') { - this.cbs.push(cb); - this._run(); - } -}; - -function done() { - this.pending--; - this._run(); -} - -module.exports = Queue; diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/package.json b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/package.json deleted file mode 100755 index c61cfc4..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "_args": [ - [ - "async-limiter@~1.0.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/ws" - ] - ], - "_from": "async-limiter@>=1.0.0 <1.1.0", - "_id": "async-limiter@1.0.0", - "_inCache": true, - "_installable": true, - "_location": "/async-limiter", - "_nodeVersion": "8.4.0", - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/async-limiter-1.0.0.tgz_1505149068503_0.15003100014291704" - }, - "_npmUser": { - "email": "samuel.trace.reed@gmail.com", - "name": "strml" - }, - "_npmVersion": "5.4.1", - "_phantomChildren": {}, - "_requested": { - "name": "async-limiter", - "raw": "async-limiter@~1.0.0", - "rawSpec": "~1.0.0", - "scope": null, - "spec": ">=1.0.0 <1.1.0", - "type": "range" - }, - "_requiredBy": [ - "/ws" - ], - "_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "_shasum": "78faed8c3d074ab81f22b4e985d79e8738f720f8", - "_shrinkwrap": null, - "_spec": "async-limiter@~1.0.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/ws", - "author": { - "name": "Samuel Reed" - }, - "bugs": { - "url": "https://github.com/strml/async-limiter/issues" - }, - "dependencies": {}, - "description": "asynchronous function queue with adjustable concurrency", - "devDependencies": { - "coveralls": "^2.11.2", - "eslint": "^4.6.1", - "eslint-plugin-mocha": "^4.11.0", - "intelli-espower-loader": "^1.0.1", - "istanbul": "^0.3.2", - "mocha": "^3.5.2", - "power-assert": "^1.4.4" - }, - "directories": {}, - "dist": { - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", - "shasum": "78faed8c3d074ab81f22b4e985d79e8738f720f8", - "tarball": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz" - }, - "gitHead": "02c8b498279dc7cc1ecc1c4f6fc9ca320c0ce39b", - "homepage": "https://github.com/strml/async-limiter#readme", - "keywords": [ - "async", - "asynchronous", - "concurrency", - "concurrent", - "job", - "limiter", - "task", - "throttle" - ], - "license": "MIT", - "maintainers": [ - { - "name": "strml", - "email": "samuel.trace.reed@gmail.com" - } - ], - "name": "async-limiter", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/strml/async-limiter.git" - }, - "scripts": { - "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls", - "example": "node example", - "lint": "eslint .", - "test": "mocha --R intelli-espower-loader test/", - "travis": "npm run lint && npm run coverage" - }, - "version": "1.0.0" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/readme.md b/plugins/Codiad-Collaborative-master/node_modules/async-limiter/readme.md deleted file mode 100755 index dcf4932..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/async-limiter/readme.md +++ /dev/null @@ -1,132 +0,0 @@ -# Async-Limiter - -A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue). - -[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter) -[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter) -[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter) - -This module exports a class `Limiter` that implements some of the `Array` API. -Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods. - -## Motivation - -Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when -run at infinite concurrency. - -In this case, it is actually faster, and takes far less memory, to limit concurrency. - -This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would -make this module faster or lighter, but new functionality is not desired. - -Style should confirm to nodejs/node style. - -## Example - -``` javascript -var Limiter = require('async-limiter') - -var t = new Limiter({concurrency: 2}); -var results = [] - -// add jobs using the familiar Array API -t.push(function (cb) { - results.push('two') - cb() -}) - -t.push( - function (cb) { - results.push('four') - cb() - }, - function (cb) { - results.push('five') - cb() - } -) - -t.unshift(function (cb) { - results.push('one') - cb() -}) - -t.splice(2, 0, function (cb) { - results.push('three') - cb() -}) - -// Jobs run automatically. If you want a callback when all are done, -// call 'onDone()'. -t.onDone(function () { - console.log('all done:', results) -}) -``` - -## Zlib Example - -```js -const zlib = require('zlib'); -const Limiter = require('async-limiter'); - -const message = {some: "data"}; -const payload = new Buffer(JSON.stringify(message)); - -// Try with different concurrency values to see how this actually -// slows significantly with higher concurrency! -// -// 5: 1398.607ms -// 10: 1375.668ms -// Infinity: 4423.300ms -// -const t = new Limiter({concurrency: 5}); -function deflate(payload, cb) { - t.push(function(done) { - zlib.deflate(payload, function(err, buffer) { - done(); - cb(err, buffer); - }); - }); -} - -console.time('deflate'); -for(let i = 0; i < 30000; ++i) { - deflate(payload, function (err, buffer) {}); -} -q.onDone(function() { - console.timeEnd('deflate'); -}); -``` - -## Install - -`npm install async-limiter` - -## Test - -`npm test` - -## API - -### `var t = new Limiter([opts])` -Constructor. `opts` may contain inital values for: -* `q.concurrency` - -## Instance methods - -### `q.onDone(fn)` -`fn` will be called once and only once, when the queue is empty. - -## Instance methods mixed in from `Array` -Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). -### `q.push(element1, ..., elementN)` -### `q.unshift(element1, ..., elementN)` -### `q.splice(index , howMany[, element1[, ...[, elementN]]])` - -## Properties -### `q.concurrency` -Max number of jobs the queue should process concurrently, defaults to `Infinity`. - -### `q.length` -Jobs pending + jobs to process (readonly). - diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/backo2/.npmignore deleted file mode 100755 index c2658d7..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/History.md b/plugins/Codiad-Collaborative-master/node_modules/backo2/History.md deleted file mode 100755 index 8eb28b8..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/History.md +++ /dev/null @@ -1,12 +0,0 @@ - -1.0.1 / 2014-02-17 -================== - - * go away decimal point - * history - -1.0.0 / 2014-02-17 -================== - - * add jitter option - * Initial commit diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/Makefile b/plugins/Codiad-Collaborative-master/node_modules/backo2/Makefile deleted file mode 100755 index 9987df8..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter dot \ - --bail - -.PHONY: test \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/backo2/Readme.md deleted file mode 100755 index 0df2a39..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/Readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# backo - - Simple exponential backoff because the others seem to have weird abstractions. - -## Installation - -``` -$ npm install backo -``` - -## Options - - - `min` initial timeout in milliseconds [100] - - `max` max timeout [10000] - - `jitter` [0] - - `factor` [2] - -## Example - -```js -var Backoff = require('backo'); -var backoff = new Backoff({ min: 100, max: 20000 }); - -setTimeout(function(){ - something.reconnect(); -}, backoff.duration()); - -// later when something works -backoff.reset() -``` - -# License - - MIT diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/component.json b/plugins/Codiad-Collaborative-master/node_modules/backo2/component.json deleted file mode 100755 index 994845a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "backo", - "repo": "segmentio/backo", - "dependencies": {}, - "version": "1.0.1", - "description": "simple backoff without the weird abstractions", - "keywords": ["backoff"], - "license": "MIT", - "scripts": ["index.js"], - "main": "index.js" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/index.js b/plugins/Codiad-Collaborative-master/node_modules/backo2/index.js deleted file mode 100755 index fac4429..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/index.js +++ /dev/null @@ -1,85 +0,0 @@ - -/** - * Expose `Backoff`. - */ - -module.exports = Backoff; - -/** - * Initialize backoff timer with `opts`. - * - * - `min` initial timeout in milliseconds [100] - * - `max` max timeout [10000] - * - `jitter` [0] - * - `factor` [2] - * - * @param {Object} opts - * @api public - */ - -function Backoff(opts) { - opts = opts || {}; - this.ms = opts.min || 100; - this.max = opts.max || 10000; - this.factor = opts.factor || 2; - this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; - this.attempts = 0; -} - -/** - * Return the backoff duration. - * - * @return {Number} - * @api public - */ - -Backoff.prototype.duration = function(){ - var ms = this.ms * Math.pow(this.factor, this.attempts++); - if (this.jitter) { - var rand = Math.random(); - var deviation = Math.floor(rand * this.jitter * ms); - ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; - } - return Math.min(ms, this.max) | 0; -}; - -/** - * Reset the number of attempts. - * - * @api public - */ - -Backoff.prototype.reset = function(){ - this.attempts = 0; -}; - -/** - * Set the minimum duration - * - * @api public - */ - -Backoff.prototype.setMin = function(min){ - this.ms = min; -}; - -/** - * Set the maximum duration - * - * @api public - */ - -Backoff.prototype.setMax = function(max){ - this.max = max; -}; - -/** - * Set the jitter - * - * @api public - */ - -Backoff.prototype.setJitter = function(jitter){ - this.jitter = jitter; -}; - diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/package.json b/plugins/Codiad-Collaborative-master/node_modules/backo2/package.json deleted file mode 100755 index 90292db..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_args": [ - [ - "backo2@1.0.2", - "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client" - ] - ], - "_from": "backo2@1.0.2", - "_id": "backo2@1.0.2", - "_inCache": true, - "_installable": true, - "_location": "/backo2", - "_npmUser": { - "email": "mokesmokes@gmail.com", - "name": "mokesmokes" - }, - "_npmVersion": "1.4.28", - "_phantomChildren": {}, - "_requested": { - "name": "backo2", - "raw": "backo2@1.0.2", - "rawSpec": "1.0.2", - "scope": null, - "spec": "1.0.2", - "type": "version" - }, - "_requiredBy": [ - "/socket.io-client" - ], - "_resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "_shasum": "31ab1ac8b129363463e35b3ebb69f4dfcfba7947", - "_shrinkwrap": null, - "_spec": "backo2@1.0.2", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client", - "bugs": { - "url": "https://github.com/mokesmokes/backo/issues" - }, - "dependencies": {}, - "description": "simple backoff based on segmentio/backo", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "directories": {}, - "dist": { - "shasum": "31ab1ac8b129363463e35b3ebb69f4dfcfba7947", - "tarball": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz" - }, - "gitHead": "3e695bade7756fef2295e8883bf3570a06e5d9ec", - "homepage": "https://github.com/mokesmokes/backo", - "keywords": [ - "backoff" - ], - "license": "MIT", - "maintainers": [ - { - "name": "mokesmokes", - "email": "mokesmokes@gmail.com" - } - ], - "name": "backo2", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/mokesmokes/backo.git" - }, - "scripts": {}, - "version": "1.0.2" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/backo2/test/index.js b/plugins/Codiad-Collaborative-master/node_modules/backo2/test/index.js deleted file mode 100755 index ea1f6de..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/backo2/test/index.js +++ /dev/null @@ -1,18 +0,0 @@ - -var Backoff = require('..'); -var assert = require('assert'); - -describe('.duration()', function(){ - it('should increase the backoff', function(){ - var b = new Backoff; - - assert(100 == b.duration()); - assert(200 == b.duration()); - assert(400 == b.duration()); - assert(800 == b.duration()); - - b.reset(); - assert(100 == b.duration()); - assert(200 == b.duration()); - }) -}) \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.npmignore deleted file mode 100755 index 332ee5a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -/node_modules/ -Gruntfile.js -/test/ diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.travis.yml b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.travis.yml deleted file mode 100755 index 19259a5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: node_js -node_js: -- '0.12' -- iojs-1 -- iojs-2 -- iojs-3 -- '4.1' -before_script: -- npm install -before_install: npm install -g npm@'>=2.13.5' -deploy: - provider: npm - email: niklasvh@gmail.com - api_key: - secure: oHV9ArprTj5WOk7MP1UF7QMJ70huXw+y7xXb5wF4+V2H8Hyfa5TfE0DiOmqrube1WXTeH1FLgq54shp/sJWi47Hkg/GyeoB5NnsPhYEaJkaON9UG5blML+ODiNVsEnq/1kNBQ8e0+0JItMPLGySKyFmuZ3yflulXKS8O88mfINo= - on: - tags: true - branch: master - repo: niklasvh/base64-arraybuffer diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/LICENSE-MIT b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/LICENSE-MIT deleted file mode 100755 index ed27b41..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Niklas von Hertzen - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/README.md b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/README.md deleted file mode 100755 index 50009e4..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# base64-arraybuffer - -[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) -[![NPM Downloads](https://img.shields.io/npm/dm/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) -[![NPM Version](https://img.shields.io/npm/v/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) - -Encode/decode base64 data into ArrayBuffers - -## Getting Started -Install the module with: `npm install base64-arraybuffer` - -## API -The library encodes and decodes base64 to and from ArrayBuffers - - - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string - - __decode(str)__ - Decodes base64 string to `ArrayBuffer` - -## License -Copyright (c) 2012 Niklas von Hertzen -Licensed under the MIT license. diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js deleted file mode 100755 index e6b6306..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * base64-arraybuffer - * https://github.com/niklasvh/base64-arraybuffer - * - * Copyright (c) 2012 Niklas von Hertzen - * Licensed under the MIT license. - */ -(function(){ - "use strict"; - - var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - // Use a lookup table to find the index. - var lookup = new Uint8Array(256); - for (var i = 0; i < chars.length; i++) { - lookup[chars.charCodeAt(i)] = i; - } - - exports.encode = function(arraybuffer) { - var bytes = new Uint8Array(arraybuffer), - i, len = bytes.length, base64 = ""; - - for (i = 0; i < len; i+=3) { - base64 += chars[bytes[i] >> 2]; - base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; - base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; - base64 += chars[bytes[i + 2] & 63]; - } - - if ((len % 3) === 2) { - base64 = base64.substring(0, base64.length - 1) + "="; - } else if (len % 3 === 1) { - base64 = base64.substring(0, base64.length - 2) + "=="; - } - - return base64; - }; - - exports.decode = function(base64) { - var bufferLength = base64.length * 0.75, - len = base64.length, i, p = 0, - encoded1, encoded2, encoded3, encoded4; - - if (base64[base64.length - 1] === "=") { - bufferLength--; - if (base64[base64.length - 2] === "=") { - bufferLength--; - } - } - - var arraybuffer = new ArrayBuffer(bufferLength), - bytes = new Uint8Array(arraybuffer); - - for (i = 0; i < len; i+=4) { - encoded1 = lookup[base64.charCodeAt(i)]; - encoded2 = lookup[base64.charCodeAt(i+1)]; - encoded3 = lookup[base64.charCodeAt(i+2)]; - encoded4 = lookup[base64.charCodeAt(i+3)]; - - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - - return arraybuffer; - }; -})(); diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/package.json b/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/package.json deleted file mode 100755 index 4535db4..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64-arraybuffer/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "_args": [ - [ - "base64-arraybuffer@0.1.5", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser" - ] - ], - "_from": "base64-arraybuffer@0.1.5", - "_id": "base64-arraybuffer@0.1.5", - "_inCache": true, - "_installable": true, - "_location": "/base64-arraybuffer", - "_nodeVersion": "2.5.0", - "_npmUser": { - "email": "niklasvh@gmail.com", - "name": "niklasvh" - }, - "_npmVersion": "3.4.0", - "_phantomChildren": {}, - "_requested": { - "name": "base64-arraybuffer", - "raw": "base64-arraybuffer@0.1.5", - "rawSpec": "0.1.5", - "scope": null, - "spec": "0.1.5", - "type": "version" - }, - "_requiredBy": [ - "/engine.io-parser", - "/socket.io-client" - ], - "_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "_shasum": "73926771923b5a19747ad666aa5cd4bf9c6e9ce8", - "_shrinkwrap": null, - "_spec": "base64-arraybuffer@0.1.5", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser", - "author": { - "email": "niklasvh@gmail.com", - "name": "Niklas von Hertzen", - "url": "http://hertzen.com" - }, - "bugs": { - "url": "https://github.com/niklasvh/base64-arraybuffer/issues" - }, - "dependencies": {}, - "description": "Encode/decode base64 data into ArrayBuffers", - "devDependencies": { - "grunt": "^0.4.5", - "grunt-cli": "^0.1.13", - "grunt-contrib-jshint": "^0.11.2", - "grunt-contrib-nodeunit": "^0.4.1", - "grunt-contrib-watch": "^0.6.1" - }, - "directories": {}, - "dist": { - "shasum": "73926771923b5a19747ad666aa5cd4bf9c6e9ce8", - "tarball": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz" - }, - "engines": { - "node": ">= 0.6.0" - }, - "gitHead": "e9457ccb7b140f5ae54a2880c8e9b967ffb03a7d", - "homepage": "https://github.com/niklasvh/base64-arraybuffer", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" - } - ], - "main": "lib/base64-arraybuffer", - "maintainers": [ - { - "name": "niklasvh", - "email": "niklasvh@gmail.com" - } - ], - "name": "base64-arraybuffer", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/niklasvh/base64-arraybuffer.git" - }, - "scripts": { - "test": "grunt nodeunit" - }, - "version": "0.1.5" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64id/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/base64id/.npmignore deleted file mode 100755 index 39e9864..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64id/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -support -test -examples diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64id/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/base64id/LICENSE deleted file mode 100755 index 0d03c83..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64id/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012-2016 Kristian Faeldt - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64id/README.md b/plugins/Codiad-Collaborative-master/node_modules/base64id/README.md deleted file mode 100755 index 17689e6..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64id/README.md +++ /dev/null @@ -1,18 +0,0 @@ -base64id -======== - -Node.js module that generates a base64 id. - -Uses crypto.randomBytes when available, falls back to unsafe methods for node.js <= 0.4. - -To increase performance, random bytes are buffered to minimize the number of synchronous calls to crypto.randomBytes. - -## Installation - - $ npm install base64id - -## Usage - - var base64id = require('base64id'); - - var id = base64id.generateId(); diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64id/lib/base64id.js b/plugins/Codiad-Collaborative-master/node_modules/base64id/lib/base64id.js deleted file mode 100755 index f688159..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64id/lib/base64id.js +++ /dev/null @@ -1,103 +0,0 @@ -/*! - * base64id v0.1.0 - */ - -/** - * Module dependencies - */ - -var crypto = require('crypto'); - -/** - * Constructor - */ - -var Base64Id = function() { }; - -/** - * Get random bytes - * - * Uses a buffer if available, falls back to crypto.randomBytes - */ - -Base64Id.prototype.getRandomBytes = function(bytes) { - - var BUFFER_SIZE = 4096 - var self = this; - - bytes = bytes || 12; - - if (bytes > BUFFER_SIZE) { - return crypto.randomBytes(bytes); - } - - var bytesInBuffer = parseInt(BUFFER_SIZE/bytes); - var threshold = parseInt(bytesInBuffer*0.85); - - if (!threshold) { - return crypto.randomBytes(bytes); - } - - if (this.bytesBufferIndex == null) { - this.bytesBufferIndex = -1; - } - - if (this.bytesBufferIndex == bytesInBuffer) { - this.bytesBuffer = null; - this.bytesBufferIndex = -1; - } - - // No buffered bytes available or index above threshold - if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) { - - if (!this.isGeneratingBytes) { - this.isGeneratingBytes = true; - crypto.randomBytes(BUFFER_SIZE, function(err, bytes) { - self.bytesBuffer = bytes; - self.bytesBufferIndex = 0; - self.isGeneratingBytes = false; - }); - } - - // Fall back to sync call when no buffered bytes are available - if (this.bytesBufferIndex == -1) { - return crypto.randomBytes(bytes); - } - } - - var result = this.bytesBuffer.slice(bytes*this.bytesBufferIndex, bytes*(this.bytesBufferIndex+1)); - this.bytesBufferIndex++; - - return result; -} - -/** - * Generates a base64 id - * - * (Original version from socket.io ) - */ - -Base64Id.prototype.generateId = function () { - var rand = new Buffer(15); // multiple of 3 for base64 - if (!rand.writeInt32BE) { - return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString() - + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString(); - } - this.sequenceNumber = (this.sequenceNumber + 1) | 0; - rand.writeInt32BE(this.sequenceNumber, 11); - if (crypto.randomBytes) { - this.getRandomBytes(12).copy(rand); - } else { - // not secure for node 0.4 - [0, 4, 8].forEach(function(i) { - rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i); - }); - } - return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-'); -}; - -/** - * Export - */ - -exports = module.exports = new Base64Id(); diff --git a/plugins/Codiad-Collaborative-master/node_modules/base64id/package.json b/plugins/Codiad-Collaborative-master/node_modules/base64id/package.json deleted file mode 100755 index 78c5eb5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/base64id/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_args": [ - [ - "base64id@1.0.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io" - ] - ], - "_from": "base64id@1.0.0", - "_id": "base64id@1.0.0", - "_inCache": true, - "_installable": true, - "_location": "/base64id", - "_nodeVersion": "4.4.7", - "_npmOperationalInternal": { - "host": "packages-18-east.internal.npmjs.com", - "tmp": "tmp/base64id-1.0.0.tgz_1480551701495_0.042360062478110194" - }, - "_npmUser": { - "email": "damien.arrachequesne@gmail.com", - "name": "darrachequesne" - }, - "_npmVersion": "2.15.8", - "_phantomChildren": {}, - "_requested": { - "name": "base64id", - "raw": "base64id@1.0.0", - "rawSpec": "1.0.0", - "scope": null, - "spec": "1.0.0", - "type": "version" - }, - "_requiredBy": [ - "/engine.io" - ], - "_resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", - "_shasum": "47688cb99bb6804f0e06d3e763b1c32e57d8e6b6", - "_shrinkwrap": null, - "_spec": "base64id@1.0.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io", - "author": { - "email": "faeldt_kristian@cyberagent.co.jp", - "name": "Kristian Faeldt" - }, - "bugs": { - "url": "https://github.com/faeldt/base64id/issues" - }, - "dependencies": {}, - "description": "Generates a base64 id", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "47688cb99bb6804f0e06d3e763b1c32e57d8e6b6", - "tarball": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz" - }, - "engines": { - "node": ">= 0.4.0" - }, - "gitHead": "3c846f0818ff88b683ad39fde2f8e015ce0f9807", - "homepage": "https://github.com/faeldt/base64id#readme", - "license": "MIT", - "main": "./lib/base64id.js", - "maintainers": [ - { - "name": "darrachequesne", - "email": "damien.arrachequesne@gmail.com" - }, - { - "name": "faeldt_kristian", - "email": "kristian.faeldt@gmail.com" - } - ], - "name": "base64id", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/faeldt/base64id.git" - }, - "scripts": {}, - "version": "1.0.0" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/better-assert/.npmignore deleted file mode 100755 index f1250e5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/History.md b/plugins/Codiad-Collaborative-master/node_modules/better-assert/History.md deleted file mode 100755 index cbb579b..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/History.md +++ /dev/null @@ -1,15 +0,0 @@ - -1.0.0 / 2013-02-03 -================== - - * Stop using the removed magic __stack global getter - -0.1.0 / 2012-10-04 -================== - - * add throwing of AssertionError for test frameworks etc - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/Makefile b/plugins/Codiad-Collaborative-master/node_modules/better-assert/Makefile deleted file mode 100755 index 36a3ed7..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @echo "populate me" - -.PHONY: test \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/better-assert/Readme.md deleted file mode 100755 index d8d3a63..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/Readme.md +++ /dev/null @@ -1,61 +0,0 @@ - -# better-assert - - Better c-style assertions using [callsite](https://github.com/visionmedia/callsite) for - self-documenting failure messages. - -## Installation - - $ npm install better-assert - -## Example - - By default assertions are enabled, however the __NO_ASSERT__ environment variable - will deactivate them when truthy. - -```js -var assert = require('better-assert'); - -test(); - -function test() { - var user = { name: 'tobi' }; - assert('tobi' == user.name); - assert('number' == typeof user.age); -} - -AssertionError: 'number' == typeof user.age - at test (/Users/tj/projects/better-assert/example.js:9:3) - at Object. (/Users/tj/projects/better-assert/example.js:4:1) - at Module._compile (module.js:449:26) - at Object.Module._extensions..js (module.js:467:10) - at Module.load (module.js:356:32) - at Function.Module._load (module.js:312:12) - at Module.runMain (module.js:492:10) - at process.startup.processNextTick.process._tickCallback (node.js:244:9) -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/example.js b/plugins/Codiad-Collaborative-master/node_modules/better-assert/example.js deleted file mode 100755 index 688c29e..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/example.js +++ /dev/null @@ -1,10 +0,0 @@ - -var assert = require('./'); - -test(); - -function test() { - var user = { name: 'tobi' }; - assert('tobi' == user.name); - assert('number' == typeof user.age); -} \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/index.js b/plugins/Codiad-Collaborative-master/node_modules/better-assert/index.js deleted file mode 100755 index fd1c9b7..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Module dependencies. - */ - -var AssertionError = require('assert').AssertionError - , callsite = require('callsite') - , fs = require('fs') - -/** - * Expose `assert`. - */ - -module.exports = process.env.NO_ASSERT - ? function(){} - : assert; - -/** - * Assert the given `expr`. - */ - -function assert(expr) { - if (expr) return; - - var stack = callsite(); - var call = stack[1]; - var file = call.getFileName(); - var lineno = call.getLineNumber(); - var src = fs.readFileSync(file, 'utf8'); - var line = src.split('\n')[lineno-1]; - var src = line.match(/assert\((.*)\)/)[1]; - - var err = new AssertionError({ - message: src, - stackStartFunction: stack[0].getFunction() - }); - - throw err; -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/better-assert/package.json b/plugins/Codiad-Collaborative-master/node_modules/better-assert/package.json deleted file mode 100755 index ecd9a8f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/better-assert/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_args": [ - [ - "better-assert@~1.0.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/parseqs" - ] - ], - "_from": "better-assert@>=1.0.0 <1.1.0", - "_id": "better-assert@1.0.2", - "_inCache": true, - "_installable": true, - "_location": "/better-assert", - "_npmUser": { - "email": "coolhzb@163.com", - "name": "tony_ado" - }, - "_npmVersion": "1.4.9", - "_phantomChildren": {}, - "_requested": { - "name": "better-assert", - "raw": "better-assert@~1.0.0", - "rawSpec": "~1.0.0", - "scope": null, - "spec": ">=1.0.0 <1.1.0", - "type": "range" - }, - "_requiredBy": [ - "/parseqs", - "/parseuri" - ], - "_resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "_shasum": "40866b9e1b9e0b55b481894311e68faffaebc522", - "_shrinkwrap": null, - "_spec": "better-assert@~1.0.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/parseqs", - "author": { - "email": "tj@vision-media.ca", - "name": "TJ Holowaychuk" - }, - "bugs": { - "url": "https://github.com/visionmedia/better-assert/issues" - }, - "contributors": [ - { - "name": "TonyHe", - "email": "coolhzb@163.com" - }, - { - "name": "ForbesLindesay" - } - ], - "dependencies": { - "callsite": "1.0.0" - }, - "description": "Better assertions for node, reporting the expr, filename, lineno etc", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "40866b9e1b9e0b55b481894311e68faffaebc522", - "tarball": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz" - }, - "engines": { - "node": "*" - }, - "homepage": "https://github.com/visionmedia/better-assert", - "keywords": [ - "assert", - "debug", - "stack", - "trace" - ], - "main": "index", - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tony_ado", - "email": "coolhzb@163.com" - } - ], - "name": "better-assert", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/visionmedia/better-assert.git" - }, - "version": "1.0.2" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/blob/.npmignore deleted file mode 100755 index 548a368..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -blob.js diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/.zuul.yml b/plugins/Codiad-Collaborative-master/node_modules/blob/.zuul.yml deleted file mode 100755 index 380c395..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/.zuul.yml +++ /dev/null @@ -1,14 +0,0 @@ -ui: mocha-bdd -browsers: - - name: chrome - version: 8..latest - - name: firefox - version: 7..latest - - name: safari - version: 6..latest - - name: opera - version: 12.1..latest - - name: ie - version: 10..latest - - name: android - version: latest diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/Makefile b/plugins/Codiad-Collaborative-master/node_modules/blob/Makefile deleted file mode 100755 index 7d9601a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -REPORTER = dot - -build: blob.js - -blob.js: - @./node_modules/.bin/browserify --standalone blob index.js > blob.js - -test: - @./node_modules/.bin/zuul -- test/index.js - -clean: - rm blob.js - -.PHONY: test blob.js diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/README.md b/plugins/Codiad-Collaborative-master/node_modules/blob/README.md deleted file mode 100755 index 6915955..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Blob -==== - -A module that exports a constructor that uses window.Blob when available, and a BlobBuilder with any vendor prefix in other cases. If neither is available, it exports undefined. - -Usage: - -```javascript -var Blob = require('blob'); -var b = new Blob(['hi', 'constructing', 'a', 'blob']); -``` - -## Licence -MIT diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/index.js b/plugins/Codiad-Collaborative-master/node_modules/blob/index.js deleted file mode 100755 index cad3f84..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/index.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Create a blob builder even when vendor prefixes exist - */ - -var BlobBuilder = global.BlobBuilder - || global.WebKitBlobBuilder - || global.MSBlobBuilder - || global.MozBlobBuilder; - -/** - * Check if Blob constructor is supported - */ - -var blobSupported = (function() { - try { - var a = new Blob(['hi']); - return a.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if Blob constructor supports ArrayBufferViews - * Fails in Safari 6, so we need to map to ArrayBuffers there. - */ - -var blobSupportsArrayBufferView = blobSupported && (function() { - try { - var b = new Blob([new Uint8Array([1,2])]); - return b.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if BlobBuilder is supported - */ - -var blobBuilderSupported = BlobBuilder - && BlobBuilder.prototype.append - && BlobBuilder.prototype.getBlob; - -/** - * Helper function that maps ArrayBufferViews to ArrayBuffers - * Used by BlobBuilder constructor and old browsers that didn't - * support it in the Blob constructor. - */ - -function mapArrayBufferViews(ary) { - for (var i = 0; i < ary.length; i++) { - var chunk = ary[i]; - if (chunk.buffer instanceof ArrayBuffer) { - var buf = chunk.buffer; - - // if this is a subarray, make a copy so we only - // include the subarray region from the underlying buffer - if (chunk.byteLength !== buf.byteLength) { - var copy = new Uint8Array(chunk.byteLength); - copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); - buf = copy.buffer; - } - - ary[i] = buf; - } - } -} - -function BlobBuilderConstructor(ary, options) { - options = options || {}; - - var bb = new BlobBuilder(); - mapArrayBufferViews(ary); - - for (var i = 0; i < ary.length; i++) { - bb.append(ary[i]); - } - - return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); -}; - -function BlobConstructor(ary, options) { - mapArrayBufferViews(ary); - return new Blob(ary, options || {}); -}; - -module.exports = (function() { - if (blobSupported) { - return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; - } else if (blobBuilderSupported) { - return BlobBuilderConstructor; - } else { - return undefined; - } -})(); diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/package.json b/plugins/Codiad-Collaborative-master/node_modules/blob/package.json deleted file mode 100755 index 62c99cf..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_args": [ - [ - "blob@0.0.4", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser" - ] - ], - "_from": "blob@0.0.4", - "_id": "blob@0.0.4", - "_inCache": true, - "_installable": true, - "_location": "/blob", - "_npmUser": { - "email": "tonykovanen@hotmail.com", - "name": "rase-" - }, - "_npmVersion": "1.4.6", - "_phantomChildren": {}, - "_requested": { - "name": "blob", - "raw": "blob@0.0.4", - "rawSpec": "0.0.4", - "scope": null, - "spec": "0.0.4", - "type": "version" - }, - "_requiredBy": [ - "/engine.io-parser" - ], - "_resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", - "_shasum": "bcf13052ca54463f30f9fc7e95b9a47630a94921", - "_shrinkwrap": null, - "_spec": "blob@0.0.4", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-parser", - "bugs": { - "url": "https://github.com/rase-/blob/issues" - }, - "dependencies": {}, - "description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.", - "devDependencies": { - "browserify": "3.30.1", - "expect.js": "0.2.0", - "mocha": "1.17.1", - "zuul": "1.5.4" - }, - "directories": {}, - "dist": { - "shasum": "bcf13052ca54463f30f9fc7e95b9a47630a94921", - "tarball": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz" - }, - "homepage": "https://github.com/rase-/blob", - "maintainers": [ - { - "name": "rase-", - "email": "tonykovanen@hotmail.com" - } - ], - "name": "blob", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/rase-/blob.git" - }, - "scripts": { - "test": "make test" - }, - "version": "0.0.4" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/blob/test/index.js b/plugins/Codiad-Collaborative-master/node_modules/blob/test/index.js deleted file mode 100755 index df9303f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/blob/test/index.js +++ /dev/null @@ -1,94 +0,0 @@ -var Blob = require('../'); -var expect = require('expect.js'); - -describe('blob', function() { - if (!Blob) { - it('should not have a blob or a blob builder in the global namespace, or blob should not be a constructor function if the module exports false', function() { - try { - var ab = (new Uint8Array(5)).buffer; - global.Blob([ab]); - expect().fail('Blob shouldn\'t be constructable'); - } catch (e) {} - - var BlobBuilder = global.BlobBuilder - || global.WebKitBlobBuilder - || global.MSBlobBuilder - || global.MozBlobBuilder; - expect(BlobBuilder).to.be(undefined); - }); - } else { - it('should encode a proper sized blob when given a string argument', function() { - var b = new Blob(['hi']); - expect(b.size).to.be(2); - }); - - it('should encode a blob with proper size when given two strings as arguments', function() { - var b = new Blob(['hi', 'hello']); - expect(b.size).to.be(7); - }); - - it('should encode arraybuffers with right content', function(done) { - var ary = new Uint8Array(5); - for (var i = 0; i < 5; i++) ary[i] = i; - var b = new Blob([ary.buffer]); - var fr = new FileReader(); - fr.onload = function() { - var newAry = new Uint8Array(this.result); - for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); - done(); - }; - fr.readAsArrayBuffer(b); - }); - - it('should encode typed arrays with right content', function(done) { - var ary = new Uint8Array(5); - for (var i = 0; i < 5; i++) ary[i] = i; - var b = new Blob([ary]); - var fr = new FileReader(); - fr.onload = function() { - var newAry = new Uint8Array(this.result); - for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); - done(); - }; - fr.readAsArrayBuffer(b); - }); - - it('should encode sliced typed arrays with right content', function(done) { - var ary = new Uint8Array(5); - for (var i = 0; i < 5; i++) ary[i] = i; - var b = new Blob([ary.subarray(2)]); - var fr = new FileReader(); - fr.onload = function() { - var newAry = new Uint8Array(this.result); - for (var i = 0; i < 3; i++) expect(newAry[i]).to.be(i + 2); - done(); - }; - fr.readAsArrayBuffer(b); - }); - - it('should encode with blobs', function(done) { - var ary = new Uint8Array(5); - for (var i = 0; i < 5; i++) ary[i] = i; - var b = new Blob([new Blob([ary.buffer])]); - var fr = new FileReader(); - fr.onload = function() { - var newAry = new Uint8Array(this.result); - for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); - done(); - }; - fr.readAsArrayBuffer(b); - }); - - it('should enode mixed contents to right size', function() { - var ary = new Uint8Array(5); - for (var i = 0; i < 5; i++) ary[i] = i; - var b = new Blob([ary.buffer, 'hello']); - expect(b.size).to.be(10); - }); - - it('should accept mime type', function() { - var b = new Blob(['hi', 'hello'], { type: 'text/html' }); - expect(b.type).to.be('text/html'); - }); - } -}); diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/callsite/.npmignore deleted file mode 100755 index f1250e5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/History.md b/plugins/Codiad-Collaborative-master/node_modules/callsite/History.md deleted file mode 100755 index 4994198..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/History.md +++ /dev/null @@ -1,10 +0,0 @@ - -1.0.0 / 2013-01-24 -================== - - * remove lame magical getters - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/Makefile b/plugins/Codiad-Collaborative-master/node_modules/callsite/Makefile deleted file mode 100755 index 634e372..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/callsite/Readme.md deleted file mode 100755 index 0dbd16a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/Readme.md +++ /dev/null @@ -1,44 +0,0 @@ -# callstack - - Access to v8's "raw" `CallSite`s. - -## Installation - - $ npm install callsite - -## Example - -```js -var stack = require('callsite'); - -foo(); - -function foo() { - bar(); -} - -function bar() { - baz(); -} - -function baz() { - console.log(); - stack().forEach(function(site){ - console.log(' \033[36m%s\033[90m in %s:%d\033[0m' - , site.getFunctionName() || 'anonymous' - , site.getFileName() - , site.getLineNumber()); - }); - console.log(); -} -``` - -## Why? - - Because you can do weird, stupid, clever, wacky things such as: - - - [better-assert](https://github.com/visionmedia/better-assert) - -## License - - MIT diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/index.js b/plugins/Codiad-Collaborative-master/node_modules/callsite/index.js deleted file mode 100755 index d3ee6f8..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/index.js +++ /dev/null @@ -1,10 +0,0 @@ - -module.exports = function(){ - var orig = Error.prepareStackTrace; - Error.prepareStackTrace = function(_, stack){ return stack; }; - var err = new Error; - Error.captureStackTrace(err, arguments.callee); - var stack = err.stack; - Error.prepareStackTrace = orig; - return stack; -}; diff --git a/plugins/Codiad-Collaborative-master/node_modules/callsite/package.json b/plugins/Codiad-Collaborative-master/node_modules/callsite/package.json deleted file mode 100755 index 8490be5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/callsite/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_args": [ - [ - "callsite@1.0.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/better-assert" - ] - ], - "_from": "callsite@1.0.0", - "_id": "callsite@1.0.0", - "_inCache": true, - "_installable": true, - "_location": "/callsite", - "_npmUser": { - "email": "tj@vision-media.ca", - "name": "tjholowaychuk" - }, - "_npmVersion": "1.2.2", - "_phantomChildren": {}, - "_requested": { - "name": "callsite", - "raw": "callsite@1.0.0", - "rawSpec": "1.0.0", - "scope": null, - "spec": "1.0.0", - "type": "version" - }, - "_requiredBy": [ - "/better-assert" - ], - "_resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "_shasum": "280398e5d664bd74038b6f0905153e6e8af1bc20", - "_shrinkwrap": null, - "_spec": "callsite@1.0.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/better-assert", - "author": { - "email": "tj@vision-media.ca", - "name": "TJ Holowaychuk" - }, - "dependencies": {}, - "description": "access to v8's CallSites", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "directories": {}, - "dist": { - "shasum": "280398e5d664bd74038b6f0905153e6e8af1bc20", - "tarball": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz" - }, - "engines": { - "node": "*" - }, - "keywords": [ - "line", - "stack", - "trace" - ], - "main": "index", - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "name": "callsite", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "version": "1.0.0" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/component-bind/.npmignore deleted file mode 100755 index f1250e5..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/History.md b/plugins/Codiad-Collaborative-master/node_modules/component-bind/History.md deleted file mode 100755 index 2795fdb..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/History.md +++ /dev/null @@ -1,13 +0,0 @@ - -1.0.0 / 2014-05-27 -================== - - * index: use slice ref (#7, @viatropos) - * package: rename package to "component-bind" - * package: add "repository" field (#6, @repoify) - * package: add "component" section - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/Makefile b/plugins/Codiad-Collaborative-master/node_modules/component-bind/Makefile deleted file mode 100755 index 4e9c8d3..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/component-bind/Readme.md deleted file mode 100755 index 6a8febc..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/Readme.md +++ /dev/null @@ -1,64 +0,0 @@ -# bind - - Function binding utility. - -## Installation - -``` -$ component install component/bind -``` - -## API - - - [bind(obj, fn)](#bindobj-fn) - - [bind(obj, fn, ...)](#bindobj-fn-) - - [bind(obj, name)](#bindobj-name) - - - -### bind(obj, fn) -should bind the function to the given object. - -```js -var tobi = { name: 'tobi' }; - -function name() { - return this.name; -} - -var fn = bind(tobi, name); -fn().should.equal('tobi'); -``` - - -### bind(obj, fn, ...) -should curry the remaining arguments. - -```js -function add(a, b) { - return a + b; -} - -bind(null, add)(1, 2).should.equal(3); -bind(null, add, 1)(2).should.equal(3); -bind(null, add, 1, 2)().should.equal(3); -``` - - -### bind(obj, name) -should bind the method of the given name. - -```js -var tobi = { name: 'tobi' }; - -tobi.getName = function() { - return this.name; -}; - -var fn = bind(tobi, 'getName'); -fn().should.equal('tobi'); -``` - -## License - - MIT \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/component.json b/plugins/Codiad-Collaborative-master/node_modules/component-bind/component.json deleted file mode 100755 index 4e1e93f..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/component.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "bind", - "version": "1.0.0", - "description": "function binding utility", - "keywords": [ - "bind", - "utility" - ], - "dependencies": {}, - "scripts": [ - "index.js" - ] -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/index.js b/plugins/Codiad-Collaborative-master/node_modules/component-bind/index.js deleted file mode 100755 index 4eeb2c0..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Slice reference. - */ - -var slice = [].slice; - -/** - * Bind `obj` to `fn`. - * - * @param {Object} obj - * @param {Function|String} fn or string - * @return {Function} - * @api public - */ - -module.exports = function(obj, fn){ - if ('string' == typeof fn) fn = obj[fn]; - if ('function' != typeof fn) throw new Error('bind() requires a function'); - var args = slice.call(arguments, 2); - return function(){ - return fn.apply(obj, args.concat(slice.call(arguments))); - } -}; diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-bind/package.json b/plugins/Codiad-Collaborative-master/node_modules/component-bind/package.json deleted file mode 100755 index 4180955..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-bind/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "component-bind@1.0.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client" - ] - ], - "_from": "component-bind@1.0.0", - "_id": "component-bind@1.0.0", - "_inCache": true, - "_installable": true, - "_location": "/component-bind", - "_npmUser": { - "email": "nathan@tootallnate.net", - "name": "tootallnate" - }, - "_npmVersion": "1.4.9", - "_phantomChildren": {}, - "_requested": { - "name": "component-bind", - "raw": "component-bind@1.0.0", - "rawSpec": "1.0.0", - "scope": null, - "spec": "1.0.0", - "type": "version" - }, - "_requiredBy": [ - "/socket.io-client" - ], - "_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", - "_shrinkwrap": null, - "_spec": "component-bind@1.0.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client", - "bugs": { - "url": "https://github.com/component/bind/issues" - }, - "component": { - "scripts": { - "bind/index.js": "index.js" - } - }, - "dependencies": {}, - "description": "function binding utility", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "directories": {}, - "dist": { - "shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", - "tarball": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz" - }, - "homepage": "https://github.com/component/bind", - "keywords": [ - "bind", - "utility" - ], - "maintainers": [ - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "name": "component-bind", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/component/bind.git" - }, - "version": "1.0.0" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/History.md b/plugins/Codiad-Collaborative-master/node_modules/component-emitter/History.md deleted file mode 100755 index 9189c60..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/History.md +++ /dev/null @@ -1,68 +0,0 @@ - -1.2.1 / 2016-04-18 -================== - - * enable client side use - -1.2.0 / 2014-02-12 -================== - - * prefix events with `$` to support object prototype method names - -1.1.3 / 2014-06-20 -================== - - * republish for npm - * add LICENSE file - -1.1.2 / 2014-02-10 -================== - - * package: rename to "component-emitter" - * package: update "main" and "component" fields - * Add license to Readme (same format as the other components) - * created .npmignore - * travis stuff - -1.1.1 / 2013-12-01 -================== - - * fix .once adding .on to the listener - * docs: Emitter#off() - * component: add `.repo` prop - -1.1.0 / 2013-10-20 -================== - - * add `.addEventListener()` and `.removeEventListener()` aliases - -1.0.1 / 2013-06-27 -================== - - * add support for legacy ie - -1.0.0 / 2013-02-26 -================== - - * add `.off()` support for removing all listeners - -0.0.6 / 2012-10-08 -================== - - * add `this._callbacks` initialization to prevent funky gotcha - -0.0.5 / 2012-09-07 -================== - - * fix `Emitter.call(this)` usage - -0.0.3 / 2012-07-11 -================== - - * add `.listeners()` - * rename `.has()` to `.hasListeners()` - -0.0.2 / 2012-06-28 -================== - - * fix `.off()` with `.once()`-registered callbacks diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/component-emitter/LICENSE deleted file mode 100755 index d6e43f2..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Component contributors - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/component-emitter/Readme.md deleted file mode 100755 index 0466411..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/Readme.md +++ /dev/null @@ -1,74 +0,0 @@ -# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter) - - Event emitter component. - -## Installation - -``` -$ component install component/emitter -``` - -## API - -### Emitter(obj) - - The `Emitter` may also be used as a mixin. For example - a "plain" object may become an emitter, or you may - extend an existing prototype. - - As an `Emitter` instance: - -```js -var Emitter = require('emitter'); -var emitter = new Emitter; -emitter.emit('something'); -``` - - As a mixin: - -```js -var Emitter = require('emitter'); -var user = { name: 'tobi' }; -Emitter(user); - -user.emit('im a user'); -``` - - As a prototype mixin: - -```js -var Emitter = require('emitter'); -Emitter(User.prototype); -``` - -### Emitter#on(event, fn) - - Register an `event` handler `fn`. - -### Emitter#once(event, fn) - - Register a single-shot `event` handler `fn`, - removed immediately after it is invoked the - first time. - -### Emitter#off(event, fn) - - * Pass `event` and `fn` to remove a listener. - * Pass `event` to remove all listeners on that event. - * Pass nothing to remove all listeners on all events. - -### Emitter#emit(event, ...) - - Emit an `event` with variable option args. - -### Emitter#listeners(event) - - Return an array of callbacks, or an empty array. - -### Emitter#hasListeners(event) - - Check if this emitter has `event` handlers. - -## License - -MIT diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/index.js b/plugins/Codiad-Collaborative-master/node_modules/component-emitter/index.js deleted file mode 100755 index df94c78..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/index.js +++ /dev/null @@ -1,163 +0,0 @@ - -/** - * Expose `Emitter`. - */ - -if (typeof module !== 'undefined') { - module.exports = Emitter; -} - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks['$' + event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/package.json b/plugins/Codiad-Collaborative-master/node_modules/component-emitter/package.json deleted file mode 100755 index 134a246..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-emitter/package.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "_args": [ - [ - "component-emitter@1.2.1", - "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client" - ] - ], - "_from": "component-emitter@1.2.1", - "_id": "component-emitter@1.2.1", - "_inCache": true, - "_installable": true, - "_location": "/component-emitter", - "_nodeVersion": "0.12.4", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/component-emitter-1.2.1.tgz_1461005707641_0.14232611074112356" - }, - "_npmUser": { - "email": "karp@hotmail.fr", - "name": "nami-doc" - }, - "_npmVersion": "2.10.1", - "_phantomChildren": {}, - "_requested": { - "name": "component-emitter", - "raw": "component-emitter@1.2.1", - "rawSpec": "1.2.1", - "scope": null, - "spec": "1.2.1", - "type": "version" - }, - "_requiredBy": [ - "/engine.io-client", - "/socket.io-client", - "/socket.io-parser" - ], - "_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "_shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6", - "_shrinkwrap": null, - "_spec": "component-emitter@1.2.1", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io-client", - "bugs": { - "url": "https://github.com/component/emitter/issues" - }, - "component": { - "scripts": { - "emitter/index.js": "index.js" - } - }, - "dependencies": {}, - "description": "Event emitter", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "directories": {}, - "dist": { - "shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6", - "tarball": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz" - }, - "files": [ - "LICENSE", - "index.js" - ], - "gitHead": "187492ab8028c7221b589bdfd482b715149cd868", - "homepage": "https://github.com/component/emitter#readme", - "license": "MIT", - "main": "index.js", - "maintainers": [ - { - "name": "swatinem", - "email": "arpad.borsos@googlemail.com" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "trevorgerhardt", - "email": "trevorgerhardt@gmail.com" - }, - { - "name": "timaschew", - "email": "timaschew@gmail.com" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - { - "name": "retrofox", - "email": "rdsuarez@gmail.com" - }, - { - "name": "coreh", - "email": "thecoreh@gmail.com" - }, - { - "name": "forbeslindesay", - "email": "forbes@lindesay.co.uk" - }, - { - "name": "kelonye", - "email": "kelonyemitchel@gmail.com" - }, - { - "name": "mattmueller", - "email": "mattmuelle@gmail.com" - }, - { - "name": "yields", - "email": "yields@icloud.com" - }, - { - "name": "anthonyshort", - "email": "antshort@gmail.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "ianstormtaylor", - "email": "ian@ianstormtaylor.com" - }, - { - "name": "cristiandouce", - "email": "cristian@gravityonmars.com" - }, - { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - }, - { - "name": "stagas", - "email": "gstagas@gmail.com" - }, - { - "name": "amasad", - "email": "amjad.masad@gmail.com" - }, - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - { - "name": "calvinfo", - "email": "calvin@calv.info" - }, - { - "name": "dominicbarnes", - "email": "dominic@dbarnes.info" - }, - { - "name": "blakeembrey", - "email": "hello@blakeembrey.com" - }, - { - "name": "timoxley", - "email": "secoif@gmail.com" - }, - { - "name": "jonathanong", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "queckezz", - "email": "fabian.eichenberger@gmail.com" - }, - { - "name": "nami-doc", - "email": "vendethiel@hotmail.fr" - }, - { - "name": "clintwood", - "email": "clint@anotherway.co.za" - }, - { - "name": "thehydroimpulse", - "email": "dnfagnan@gmail.com" - }, - { - "name": "stephenmathieson", - "email": "me@stephenmathieson.com" - }, - { - "name": "dfcreative", - "email": "df.creative@gmail.com" - }, - { - "name": "defunctzombie", - "email": "shtylman@gmail.com" - } - ], - "name": "component-emitter", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/component/emitter.git" - }, - "scripts": { - "test": "make test" - }, - "version": "1.2.1" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/.npmignore deleted file mode 100755 index 665aa21..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -components -build -node_modules diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/History.md b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/History.md deleted file mode 100755 index 22d87e1..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/History.md +++ /dev/null @@ -1,5 +0,0 @@ - -0.0.2 / 2012-09-03 -================== - - * fix typo in package.json diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Makefile b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Makefile deleted file mode 100755 index ebbc52a..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Makefile +++ /dev/null @@ -1,16 +0,0 @@ - -build: components index.js - @component build - -components: - @Component install - -clean: - rm -fr build components template.js - -test: - @node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: clean test diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Readme.md b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Readme.md deleted file mode 100755 index f03ab27..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/Readme.md +++ /dev/null @@ -1,24 +0,0 @@ -# inherit - - Prototype inheritance utility. - -## Installation - -``` -$ component install component/inherit -``` - -## Example - -```js -var inherit = require('inherit'); - -function Human() {} -function Woman() {} - -inherit(Woman, Human); -``` - -## License - - MIT diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/component.json b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/component.json deleted file mode 100755 index ae57747..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "inherit", - "description": "Prototype inheritance utility", - "version": "0.0.3", - "keywords": ["inherit", "utility"], - "dependencies": {}, - "scripts": [ - "index.js" - ] -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/index.js b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/index.js deleted file mode 100755 index aaebc03..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/index.js +++ /dev/null @@ -1,7 +0,0 @@ - -module.exports = function(a, b){ - var fn = function(){}; - fn.prototype = b.prototype; - a.prototype = new fn; - a.prototype.constructor = a; -}; \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/package.json b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/package.json deleted file mode 100755 index 47fe857..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_args": [ - [ - "component-inherit@0.0.3", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-client" - ] - ], - "_from": "component-inherit@0.0.3", - "_id": "component-inherit@0.0.3", - "_inCache": true, - "_installable": true, - "_location": "/component-inherit", - "_npmUser": { - "email": "thecoreh@gmail.com", - "name": "coreh" - }, - "_npmVersion": "1.3.24", - "_phantomChildren": {}, - "_requested": { - "name": "component-inherit", - "raw": "component-inherit@0.0.3", - "rawSpec": "0.0.3", - "scope": null, - "spec": "0.0.3", - "type": "version" - }, - "_requiredBy": [ - "/engine.io-client" - ], - "_resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "_shasum": "645fc4adf58b72b649d5cae65135619db26ff143", - "_shrinkwrap": null, - "_spec": "component-inherit@0.0.3", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io-client", - "bugs": { - "url": "https://github.com/component/inherit/issues" - }, - "component": { - "scripts": { - "inherit/index.js": "index.js" - } - }, - "dependencies": {}, - "description": "Prototype inheritance utility", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "645fc4adf58b72b649d5cae65135619db26ff143", - "tarball": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz" - }, - "homepage": "https://github.com/component/inherit", - "keywords": [ - "inherit", - "utility" - ], - "maintainers": [ - { - "name": "coreh", - "email": "thecoreh@gmail.com" - } - ], - "name": "component-inherit", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/component/inherit.git" - }, - "version": "0.0.3" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/test/inherit.js b/plugins/Codiad-Collaborative-master/node_modules/component-inherit/test/inherit.js deleted file mode 100755 index 14852f2..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/component-inherit/test/inherit.js +++ /dev/null @@ -1,21 +0,0 @@ - -/** - * Module dependencies. - */ - -var inherit = require('..'); - -describe('inherit(a, b)', function(){ - it('should inherit b\'s prototype', function(){ - function Loki(){} - function Animal(){} - - Animal.prototype.species = 'unknown'; - - inherit(Loki, Animal); - - var loki = new Loki; - loki.species.should.equal('unknown'); - loki.constructor.should.equal(Loki); - }) -}) \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/node_modules/cookie/HISTORY.md b/plugins/Codiad-Collaborative-master/node_modules/cookie/HISTORY.md deleted file mode 100755 index 5bd6485..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/cookie/HISTORY.md +++ /dev/null @@ -1,118 +0,0 @@ -0.3.1 / 2016-05-26 -================== - - * Fix `sameSite: true` to work with draft-7 clients - - `true` now sends `SameSite=Strict` instead of `SameSite` - -0.3.0 / 2016-05-26 -================== - - * Add `sameSite` option - - Replaces `firstPartyOnly` option, never implemented by browsers - * Improve error message when `encode` is not a function - * Improve error message when `expires` is not a `Date` - -0.2.4 / 2016-05-20 -================== - - * perf: enable strict mode - * perf: use for loop in parse - * perf: use string concatination for serialization - -0.2.3 / 2015-10-25 -================== - - * Fix cookie `Max-Age` to never be a floating point number - -0.2.2 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.2.1 / 2015-09-17 -================== - - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.2.0 / 2015-08-13 -================== - - * Add `firstPartyOnly` option - * Throw better error for invalid argument to parse - * perf: hoist regular expression - -0.1.5 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.1.4 / 2015-09-17 -================== - - * Throw better error for invalid argument to parse - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.1.3 / 2015-05-19 -================== - - * Reduce the scope of try-catch deopt - * Remove argument reassignments - -0.1.2 / 2014-04-16 -================== - - * Remove unnecessary files from npm package - -0.1.1 / 2014-02-23 -================== - - * Fix bad parse when cookie value contained a comma - * Fix support for `maxAge` of `0` - -0.1.0 / 2013-05-01 -================== - - * Add `decode` option - * Add `encode` option - -0.0.6 / 2013-04-08 -================== - - * Ignore cookie parts missing `=` - -0.0.5 / 2012-10-29 -================== - - * Return raw cookie value if value unescape errors - -0.0.4 / 2012-06-21 -================== - - * Use encode/decodeURIComponent for cookie encoding/decoding - - Improve server/client interoperability - -0.0.3 / 2012-06-06 -================== - - * Only escape special characters per the cookie RFC - -0.0.2 / 2012-06-01 -================== - - * Fix `maxAge` option to not throw error - -0.0.1 / 2012-05-28 -================== - - * Add more tests - -0.0.0 / 2012-05-28 -================== - - * Initial release diff --git a/plugins/Codiad-Collaborative-master/node_modules/cookie/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/cookie/LICENSE deleted file mode 100755 index 058b6b4..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/cookie/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2012-2014 Roman Shtylman -Copyright (c) 2015 Douglas Christopher Wilson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/plugins/Codiad-Collaborative-master/node_modules/cookie/README.md b/plugins/Codiad-Collaborative-master/node_modules/cookie/README.md deleted file mode 100755 index db0d078..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/cookie/README.md +++ /dev/null @@ -1,220 +0,0 @@ -# cookie - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Basic HTTP cookie parser and serializer for HTTP servers. - -## Installation - -```sh -$ npm install cookie -``` - -## API - -```js -var cookie = require('cookie'); -``` - -### cookie.parse(str, options) - -Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. -The `str` argument is the string representing a `Cookie` header value and `options` is an -optional object containing additional parsing options. - -```js -var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); -// { foo: 'bar', equation: 'E=mc^2' } -``` - -#### Options - -`cookie.parse` accepts these properties in the options object. - -##### decode - -Specifies a function that will be used to decode a cookie's value. Since the value of a cookie -has a limited character set (and must be a simple string), this function can be used to decode -a previously-encoded cookie value into a JavaScript string or other object. - -The default function is the global `decodeURIComponent`, which will decode any URL-encoded -sequences into their byte representations. - -**note** if an error is thrown from this function, the original, non-decoded cookie value will -be returned as the cookie's value. - -### cookie.serialize(name, value, options) - -Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the -name for the cookie, the `value` argument is the value to set the cookie to, and the `options` -argument is an optional object containing additional serialization options. - -```js -var setCookie = cookie.serialize('foo', 'bar'); -// foo=bar -``` - -#### Options - -`cookie.serialize` accepts these properties in the options object. - -##### domain - -Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no -domain is set, and most clients will consider the cookie to apply to only the current domain. - -##### encode - -Specifies a function that will be used to encode a cookie's value. Since value of a cookie -has a limited character set (and must be a simple string), this function can be used to encode -a value into a string suited for a cookie's value. - -The default function is the global `ecodeURIComponent`, which will encode a JavaScript string -into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. - -##### expires - -Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1]. -By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and -will delete it on a condition like exiting a web browser application. - -**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and -`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### httpOnly - -Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy, -the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not allow client-side -JavaScript to see the cookie in `document.cookie`. - -##### maxAge - -Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2]. -The given number will be converted to an integer by rounding down. By default, no maximum age is set. - -**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and -`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### path - -Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path -is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most -clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting -a web browser application. - -##### sameSite - -Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07]. - - - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - - `false` will not set the `SameSite` attribute. - - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. - - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - -More information about the different enforcement levels can be found in the specification -https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1 - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### secure - -Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy, -the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to -the server in the future if the browser does not have an HTTPS connection. - -## Example - -The following example uses this module in conjunction with the Node.js core HTTP server -to prompt a user for their name and display it back on future visits. - -```js -var cookie = require('cookie'); -var escapeHtml = require('escape-html'); -var http = require('http'); -var url = require('url'); - -function onRequest(req, res) { - // Parse the query string - var query = url.parse(req.url, true, true).query; - - if (query && query.name) { - // Set a new cookie with the name - res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { - httpOnly: true, - maxAge: 60 * 60 * 24 * 7 // 1 week - })); - - // Redirect back after setting cookie - res.statusCode = 302; - res.setHeader('Location', req.headers.referer || '/'); - res.end(); - return; - } - - // Parse the cookies on the request - var cookies = cookie.parse(req.headers.cookie || ''); - - // Get the visitor name set in the cookie - var name = cookies.name; - - res.setHeader('Content-Type', 'text/html; charset=UTF-8'); - - if (name) { - res.write('

    Welcome back, ' + escapeHtml(name) + '!

    '); - } else { - res.write('

    Hello, new visitor!

    '); - } - - res.write('
    '); - res.write(' '); - res.end(' values - * - * @param {string} str - * @param {object} [options] - * @return {object} - * @public - */ - -function parse(str, options) { - if (typeof str !== 'string') { - throw new TypeError('argument str must be a string'); - } - - var obj = {} - var opt = options || {}; - var pairs = str.split(pairSplitRegExp); - var dec = opt.decode || decode; - - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - var eq_idx = pair.indexOf('='); - - // skip things that don't look like key=value - if (eq_idx < 0) { - continue; - } - - var key = pair.substr(0, eq_idx).trim() - var val = pair.substr(++eq_idx, pair.length).trim(); - - // quoted values - if ('"' == val[0]) { - val = val.slice(1, -1); - } - - // only assign once - if (undefined == obj[key]) { - obj[key] = tryDecode(val, dec); - } - } - - return obj; -} - -/** - * Serialize data into a cookie header. - * - * Serialize the a name value pair into a cookie string suitable for - * http headers. An optional options object specified cookie parameters. - * - * serialize('foo', 'bar', { httpOnly: true }) - * => "foo=bar; httpOnly" - * - * @param {string} name - * @param {string} val - * @param {object} [options] - * @return {string} - * @public - */ - -function serialize(name, val, options) { - var opt = options || {}; - var enc = opt.encode || encode; - - if (typeof enc !== 'function') { - throw new TypeError('option encode is invalid'); - } - - if (!fieldContentRegExp.test(name)) { - throw new TypeError('argument name is invalid'); - } - - var value = enc(val); - - if (value && !fieldContentRegExp.test(value)) { - throw new TypeError('argument val is invalid'); - } - - var str = name + '=' + value; - - if (null != opt.maxAge) { - var maxAge = opt.maxAge - 0; - if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); - str += '; Max-Age=' + Math.floor(maxAge); - } - - if (opt.domain) { - if (!fieldContentRegExp.test(opt.domain)) { - throw new TypeError('option domain is invalid'); - } - - str += '; Domain=' + opt.domain; - } - - if (opt.path) { - if (!fieldContentRegExp.test(opt.path)) { - throw new TypeError('option path is invalid'); - } - - str += '; Path=' + opt.path; - } - - if (opt.expires) { - if (typeof opt.expires.toUTCString !== 'function') { - throw new TypeError('option expires is invalid'); - } - - str += '; Expires=' + opt.expires.toUTCString(); - } - - if (opt.httpOnly) { - str += '; HttpOnly'; - } - - if (opt.secure) { - str += '; Secure'; - } - - if (opt.sameSite) { - var sameSite = typeof opt.sameSite === 'string' - ? opt.sameSite.toLowerCase() : opt.sameSite; - - switch (sameSite) { - case true: - str += '; SameSite=Strict'; - break; - case 'lax': - str += '; SameSite=Lax'; - break; - case 'strict': - str += '; SameSite=Strict'; - break; - default: - throw new TypeError('option sameSite is invalid'); - } - } - - return str; -} - -/** - * Try decoding a string using a decoding function. - * - * @param {string} str - * @param {function} decode - * @private - */ - -function tryDecode(str, decode) { - try { - return decode(str); - } catch (e) { - return str; - } -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/cookie/package.json b/plugins/Codiad-Collaborative-master/node_modules/cookie/package.json deleted file mode 100755 index 480648b..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/cookie/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "_args": [ - [ - "cookie@0.3.1", - "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io" - ] - ], - "_from": "cookie@0.3.1", - "_id": "cookie@0.3.1", - "_inCache": true, - "_installable": true, - "_location": "/cookie", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/cookie-0.3.1.tgz_1464323556714_0.6435900838114321" - }, - "_npmUser": { - "email": "doug@somethingdoug.com", - "name": "dougwilson" - }, - "_npmVersion": "1.4.28", - "_phantomChildren": {}, - "_requested": { - "name": "cookie", - "raw": "cookie@0.3.1", - "rawSpec": "0.3.1", - "scope": null, - "spec": "0.3.1", - "type": "version" - }, - "_requiredBy": [ - "/engine.io" - ], - "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "_shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb", - "_shrinkwrap": null, - "_spec": "cookie@0.3.1", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/engine.io", - "author": { - "email": "shtylman@gmail.com", - "name": "Roman Shtylman" - }, - "bugs": { - "url": "https://github.com/jshttp/cookie/issues" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "dependencies": {}, - "description": "HTTP server cookie parsing and serialization", - "devDependencies": { - "istanbul": "0.4.3", - "mocha": "1.21.5" - }, - "directories": {}, - "dist": { - "shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb", - "tarball": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz" - }, - "engines": { - "node": ">= 0.6" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "index.js" - ], - "gitHead": "e3c77d497d66c8b8d4b677b8954c1b192a09f0b3", - "homepage": "https://github.com/jshttp/cookie", - "keywords": [ - "cookie", - "cookies" - ], - "license": "MIT", - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "name": "cookie", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/cookie.git" - }, - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" - }, - "version": "0.3.1" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/.coveralls.yml b/plugins/Codiad-Collaborative-master/node_modules/debug/.coveralls.yml deleted file mode 100755 index 20a7068..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/.coveralls.yml +++ /dev/null @@ -1 +0,0 @@ -repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/.eslintrc b/plugins/Codiad-Collaborative-master/node_modules/debug/.eslintrc deleted file mode 100755 index 146371e..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/.eslintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "env": { - "browser": true, - "node": true - }, - "globals": { - "chrome": true - }, - "rules": { - "no-console": 0, - "no-empty": [1, { "allowEmptyCatch": true }] - }, - "extends": "eslint:recommended" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/.npmignore b/plugins/Codiad-Collaborative-master/node_modules/debug/.npmignore deleted file mode 100755 index 5f60eec..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -support -test -examples -example -*.sock -dist -yarn.lock -coverage -bower.json diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/.travis.yml b/plugins/Codiad-Collaborative-master/node_modules/debug/.travis.yml deleted file mode 100755 index a764300..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: false - -language: node_js - -node_js: - - "4" - - "6" - - "8" - -install: - - make install - -script: - - make lint - - make test - -matrix: - include: - - node_js: '8' - env: BROWSER=1 diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/CHANGELOG.md b/plugins/Codiad-Collaborative-master/node_modules/debug/CHANGELOG.md deleted file mode 100755 index 820d21e..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/CHANGELOG.md +++ /dev/null @@ -1,395 +0,0 @@ - -3.1.0 / 2017-09-26 -================== - - * Add `DEBUG_HIDE_DATE` env var (#486) - * Remove ReDoS regexp in %o formatter (#504) - * Remove "component" from package.json - * Remove `component.json` - * Ignore package-lock.json - * Examples: fix colors printout - * Fix: browser detection - * Fix: spelling mistake (#496, @EdwardBetts) - -3.0.1 / 2017-08-24 -================== - - * Fix: Disable colors in Edge and Internet Explorer (#489) - -3.0.0 / 2017-08-08 -================== - - * Breaking: Remove DEBUG_FD (#406) - * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) - * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) - * Addition: document `enabled` flag (#465) - * Addition: add 256 colors mode (#481) - * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) - * Update: component: update "ms" to v2.0.0 - * Update: separate the Node and Browser tests in Travis-CI - * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots - * Update: separate Node.js and web browser examples for organization - * Update: update "browserify" to v14.4.0 - * Fix: fix Readme typo (#473) - -2.6.9 / 2017-09-22 -================== - - * remove ReDoS regexp in %o formatter (#504) - -2.6.8 / 2017-05-18 -================== - - * Fix: Check for undefined on browser globals (#462, @marbemac) - -2.6.7 / 2017-05-16 -================== - - * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) - * Fix: Inline extend function in node implementation (#452, @dougwilson) - * Docs: Fix typo (#455, @msasad) - -2.6.5 / 2017-04-27 -================== - - * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) - * Misc: clean up browser reference checks (#447, @thebigredgeek) - * Misc: add npm-debug.log to .gitignore (@thebigredgeek) - - -2.6.4 / 2017-04-20 -================== - - * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) - * Chore: ignore bower.json in npm installations. (#437, @joaovieira) - * Misc: update "ms" to v0.7.3 (@tootallnate) - -2.6.3 / 2017-03-13 -================== - - * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) - * Docs: Changelog fix (@thebigredgeek) - -2.6.2 / 2017-03-10 -================== - - * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) - * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) - * Docs: Add Slackin invite badge (@tootallnate) - -2.6.1 / 2017-02-10 -================== - - * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error - * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) - * Fix: IE8 "Expected identifier" error (#414, @vgoma) - * Fix: Namespaces would not disable once enabled (#409, @musikov) - -2.6.0 / 2016-12-28 -================== - - * Fix: added better null pointer checks for browser useColors (@thebigredgeek) - * Improvement: removed explicit `window.debug` export (#404, @tootallnate) - * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) - -2.5.2 / 2016-12-25 -================== - - * Fix: reference error on window within webworkers (#393, @KlausTrainer) - * Docs: fixed README typo (#391, @lurch) - * Docs: added notice about v3 api discussion (@thebigredgeek) - -2.5.1 / 2016-12-20 -================== - - * Fix: babel-core compatibility - -2.5.0 / 2016-12-20 -================== - - * Fix: wrong reference in bower file (@thebigredgeek) - * Fix: webworker compatibility (@thebigredgeek) - * Fix: output formatting issue (#388, @kribblo) - * Fix: babel-loader compatibility (#383, @escwald) - * Misc: removed built asset from repo and publications (@thebigredgeek) - * Misc: moved source files to /src (#378, @yamikuronue) - * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) - * Test: coveralls integration (#378, @yamikuronue) - * Docs: simplified language in the opening paragraph (#373, @yamikuronue) - -2.4.5 / 2016-12-17 -================== - - * Fix: `navigator` undefined in Rhino (#376, @jochenberger) - * Fix: custom log function (#379, @hsiliev) - * Improvement: bit of cleanup + linting fixes (@thebigredgeek) - * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) - * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) - -2.4.4 / 2016-12-14 -================== - - * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) - -2.4.3 / 2016-12-14 -================== - - * Fix: navigation.userAgent error for react native (#364, @escwald) - -2.4.2 / 2016-12-14 -================== - - * Fix: browser colors (#367, @tootallnate) - * Misc: travis ci integration (@thebigredgeek) - * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) - -2.4.1 / 2016-12-13 -================== - - * Fix: typo that broke the package (#356) - -2.4.0 / 2016-12-13 -================== - - * Fix: bower.json references unbuilt src entry point (#342, @justmatt) - * Fix: revert "handle regex special characters" (@tootallnate) - * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) - * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) - * Improvement: allow colors in workers (#335, @botverse) - * Improvement: use same color for same namespace. (#338, @lchenay) - -2.3.3 / 2016-11-09 -================== - - * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) - * Fix: Returning `localStorage` saved values (#331, Levi Thomason) - * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) - -2.3.2 / 2016-11-09 -================== - - * Fix: be super-safe in index.js as well (@TooTallNate) - * Fix: should check whether process exists (Tom Newby) - -2.3.1 / 2016-11-09 -================== - - * Fix: Added electron compatibility (#324, @paulcbetts) - * Improvement: Added performance optimizations (@tootallnate) - * Readme: Corrected PowerShell environment variable example (#252, @gimre) - * Misc: Removed yarn lock file from source control (#321, @fengmk2) - -2.3.0 / 2016-11-07 -================== - - * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) - * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) - * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) - * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) - * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) - * Package: Update "ms" to 0.7.2 (#315, @DevSide) - * Package: removed superfluous version property from bower.json (#207 @kkirsche) - * Readme: fix USE_COLORS to DEBUG_COLORS - * Readme: Doc fixes for format string sugar (#269, @mlucool) - * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) - * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) - * Readme: better docs for browser support (#224, @matthewmueller) - * Tooling: Added yarn integration for development (#317, @thebigredgeek) - * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) - * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) - * Misc: Updated contributors (@thebigredgeek) - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/debug/LICENSE deleted file mode 100755 index 658c933..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the 'Software'), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/Makefile b/plugins/Codiad-Collaborative-master/node_modules/debug/Makefile deleted file mode 100755 index 3ddd136..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 -THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) - -# BIN directory -BIN := $(THIS_DIR)/node_modules/.bin - -# Path -PATH := node_modules/.bin:$(PATH) -SHELL := /bin/bash - -# applications -NODE ?= $(shell which node) -YARN ?= $(shell which yarn) -PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) -BROWSERIFY ?= $(NODE) $(BIN)/browserify - -install: node_modules - -browser: dist/debug.js - -node_modules: package.json - @NODE_ENV= $(PKG) install - @touch node_modules - -dist/debug.js: src/*.js node_modules - @mkdir -p dist - @$(BROWSERIFY) \ - --standalone debug \ - . > dist/debug.js - -lint: - @eslint *.js src/*.js - -test-node: - @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js - @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js - -test-browser: - @$(MAKE) browser - @karma start --single-run - -test-all: - @concurrently \ - "make test-node" \ - "make test-browser" - -test: - @if [ "x$(BROWSER)" = "x" ]; then \ - $(MAKE) test-node; \ - else \ - $(MAKE) test-browser; \ - fi - -clean: - rimraf dist coverage - -.PHONY: browser install clean lint test test-all test-node test-browser diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/README.md b/plugins/Codiad-Collaborative-master/node_modules/debug/README.md deleted file mode 100755 index 8e754d1..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/README.md +++ /dev/null @@ -1,368 +0,0 @@ -# debug -[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) - - - -A tiny JavaScript debugging utility modelled after Node.js core's debugging -technique. Works in Node.js and web browsers. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - -`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. - -Example [_app.js_](./examples/node/app.js): - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %o', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example [_worker.js_](./examples/node/worker.js): - -```js -var a = require('debug')('worker:a') - , b = require('debug')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); -``` - -The `DEBUG` environment variable is then used to enable these based on space or -comma-delimited names. - -Here are some examples: - -screen shot 2017-08-08 at 12 53 04 pm -screen shot 2017-08-08 at 12 53 38 pm -screen shot 2017-08-08 at 12 53 25 pm - -#### Windows note - -On Windows the environment variable is set using the `set` command. - -```cmd -set DEBUG=*,-not_this -``` - -Note that PowerShell uses different syntax to set environment variables. - -```cmd -$env:DEBUG = "*,-not_this" -``` - -Then, run the program to be debugged as usual. - - -## Namespace Colors - -Every debug instance has a color generated for it based on its namespace name. -This helps when visually parsing the debug output to identify which debug instance -a debug line belongs to. - -#### Node.js - -In Node.js, colors are enabled when stderr is a TTY. You also _should_ install -the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, -otherwise debug will only use a small handful of basic colors. - - - -#### Web Browser - -Colors are also enabled on "Web Inspectors" that understand the `%c` formatting -option. These are WebKit web inspectors, Firefox ([since version -31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) -and the Firebug plugin for Firefox (any version). - - - - -## Millisecond diff - -When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - - -When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: - - - - -## Conventions - -If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. - -## Wildcards - -The `*` character may be used as a wildcard. Suppose for example your library has -debuggers named "connect:bodyParser", "connect:compress", "connect:session", -instead of listing all three with -`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do -`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - -You can also exclude specific debuggers by prefixing them with a "-" character. -For example, `DEBUG=*,-connect:*` would include all debuggers except those -starting with "connect:". - -## Environment Variables - -When running through Node.js, you can set a few environment variables that will -change the behavior of the debug logging: - -| Name | Purpose | -|-----------|-------------------------------------------------| -| `DEBUG` | Enables/disables specific debugging namespaces. | -| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | -| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | -| `DEBUG_DEPTH` | Object inspection depth. | -| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | - - -__Note:__ The environment variables beginning with `DEBUG_` end up being -converted into an Options object that gets used with `%o`/`%O` formatters. -See the Node.js documentation for -[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) -for the complete list. - -## Formatters - -Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. -Below are the officially supported formatters: - -| Formatter | Representation | -|-----------|----------------| -| `%O` | Pretty-print an Object on multiple lines. | -| `%o` | Pretty-print an Object all on a single line. | -| `%s` | String. | -| `%d` | Number (both integer and float). | -| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | -| `%%` | Single percent sign ('%'). This does not consume an argument. | - - -### Custom formatters - -You can add custom formatters by extending the `debug.formatters` object. -For example, if you wanted to add support for rendering a Buffer as hex with -`%h`, you could do something like: - -```js -const createDebug = require('debug') -createDebug.formatters.h = (v) => { - return v.toString('hex') -} - -// …elsewhere -const debug = createDebug('foo') -debug('this is hex: %h', new Buffer('hello world')) -// foo this is hex: 68656c6c6f20776f726c6421 +0ms -``` - - -## Browser Support - -You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), -or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), -if you don't want to build it yourself. - -Debug's enable state is currently persisted by `localStorage`. -Consider the situation shown below where you have `worker:a` and `worker:b`, -and wish to debug both. You can enable this using `localStorage.debug`: - -```js -localStorage.debug = 'worker:*' -``` - -And then refresh the page. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - - -## Output streams - - By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: - -Example [_stdout.js_](./examples/node/stdout.js): - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -## Checking whether a debug target is enabled - -After you've created a debug instance, you can determine whether or not it is -enabled by checking the `enabled` property: - -```javascript -const debug = require('debug')('http'); - -if (debug.enabled) { - // do stuff... -} -``` - -You can also manually toggle this property to force the debug instance to be -enabled or disabled. - - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - - Andrew Rhyne - -## Backers - -Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## Sponsors - -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## License - -(The MIT License) - -Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/karma.conf.js b/plugins/Codiad-Collaborative-master/node_modules/debug/karma.conf.js deleted file mode 100755 index 103a82d..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/karma.conf.js +++ /dev/null @@ -1,70 +0,0 @@ -// Karma configuration -// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) - -module.exports = function(config) { - config.set({ - - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '', - - - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['mocha', 'chai', 'sinon'], - - - // list of files / patterns to load in the browser - files: [ - 'dist/debug.js', - 'test/*spec.js' - ], - - - // list of files to exclude - exclude: [ - 'src/node.js' - ], - - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - }, - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], - - - // web server port - port: 9876, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, - - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], - - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false, - - // Concurrency level - // how many browser should be started simultaneous - concurrency: Infinity - }) -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/node.js b/plugins/Codiad-Collaborative-master/node_modules/debug/node.js deleted file mode 100755 index 7fc36fe..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/node.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./src/node'); diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/package.json b/plugins/Codiad-Collaborative-master/node_modules/debug/package.json deleted file mode 100755 index 9906279..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/package.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "_args": [ - [ - "debug@~3.1.0", - "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io" - ] - ], - "_from": "debug@>=3.1.0 <3.2.0", - "_id": "debug@3.1.0", - "_inCache": true, - "_installable": true, - "_location": "/debug", - "_nodeVersion": "8.4.0", - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/debug-3.1.0.tgz_1506453230282_0.13498495938256383" - }, - "_npmUser": { - "email": "nathan@tootallnate.net", - "name": "tootallnate" - }, - "_npmVersion": "5.3.0", - "_phantomChildren": {}, - "_requested": { - "name": "debug", - "raw": "debug@~3.1.0", - "rawSpec": "~3.1.0", - "scope": null, - "spec": ">=3.1.0 <3.2.0", - "type": "range" - }, - "_requiredBy": [ - "/engine.io", - "/engine.io-client", - "/socket.io", - "/socket.io-client", - "/socket.io-parser" - ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "_shasum": "5bb5a0672628b64149566ba16819e61518c67261", - "_shrinkwrap": null, - "_spec": "debug@~3.1.0", - "_where": "/var/www/html/code/workspace/codiad/Testing/node_modules/socket.io", - "author": { - "email": "tj@vision-media.ca", - "name": "TJ Holowaychuk" - }, - "browser": "./src/browser.js", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - }, - { - "name": "Andrew Rhyne", - "email": "rhyneandrew@gmail.com" - } - ], - "dependencies": { - "ms": "2.0.0" - }, - "description": "small debugging utility", - "devDependencies": { - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", - "coveralls": "^2.11.15", - "eslint": "^3.12.1", - "istanbul": "^0.4.5", - "karma": "^1.3.0", - "karma-chai": "^0.1.0", - "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", - "karma-sinon": "^1.0.5", - "mocha": "^3.2.0", - "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", - "sinon": "^1.17.6", - "sinon-chai": "^2.8.0" - }, - "directories": {}, - "dist": { - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "shasum": "5bb5a0672628b64149566ba16819e61518c67261", - "tarball": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz" - }, - "gitHead": "f073e056f33efdd5b311381eb6bca2bc850745bf", - "homepage": "https://github.com/visionmedia/debug#readme", - "keywords": [ - "debug", - "debugger", - "log" - ], - "license": "MIT", - "main": "./src/index.js", - "maintainers": [ - { - "name": "thebigredgeek", - "email": "rhyneandrew@gmail.com" - }, - { - "name": "kolban", - "email": "kolban1@kolban.com" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "name": "debug", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "version": "3.1.0" -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/src/browser.js b/plugins/Codiad-Collaborative-master/node_modules/debug/src/browser.js deleted file mode 100755 index f5149ff..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/src/browser.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', - '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', - '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', - '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', - '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', - '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', - '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', - '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', - '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', - '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', - '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { - return true; - } - - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - // is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (err) { - return '[UnexpectedJSONParseError]: ' + err.message; - } -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs(args) { - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return; - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit') - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage() { - try { - return window.localStorage; - } catch (e) {} -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/src/debug.js b/plugins/Codiad-Collaborative-master/node_modules/debug/src/debug.js deleted file mode 100755 index 77e6384..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/src/debug.js +++ /dev/null @@ -1,225 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * Active `debug` instances. - */ -exports.instances = []; - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - -exports.formatters = {}; - -/** - * Select a color. - * @param {String} namespace - * @return {Number} - * @api private - */ - -function selectColor(namespace) { - var hash = 0, i; - - for (i in namespace) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return exports.colors[Math.abs(hash) % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function createDebug(namespace) { - - var prevTime; - - function debug() { - // disabled? - if (!debug.enabled) return; - - var self = debug; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // turn the `arguments` into a proper Array - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %O - args.unshift('%O'); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // apply env-specific formatting (colors, etc.) - exports.formatArgs.call(self, args); - - var logFn = debug.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = exports.enabled(namespace); - debug.useColors = exports.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - - // env-specific initialization logic for debug instances - if ('function' === typeof exports.init) { - exports.init(debug); - } - - exports.instances.push(debug); - - return debug; -} - -function destroy () { - var index = exports.instances.indexOf(this); - if (index !== -1) { - exports.instances.splice(index, 1); - return true; - } else { - return false; - } -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - exports.names = []; - exports.skips = []; - - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < exports.instances.length; i++) { - var instance = exports.instances[i]; - instance.enabled = exports.enabled(instance.namespace); - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/src/index.js b/plugins/Codiad-Collaborative-master/node_modules/debug/src/index.js deleted file mode 100755 index cabcbcd..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/src/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Detect Electron renderer process, which is node, but we should - * treat as a browser. - */ - -if (typeof process === 'undefined' || process.type === 'renderer') { - module.exports = require('./browser.js'); -} else { - module.exports = require('./node.js'); -} diff --git a/plugins/Codiad-Collaborative-master/node_modules/debug/src/node.js b/plugins/Codiad-Collaborative-master/node_modules/debug/src/node.js deleted file mode 100755 index d666fb9..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/debug/src/node.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Module dependencies. - */ - -var tty = require('tty'); -var util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [ 6, 2, 3, 4, 5, 1 ]; - -try { - var supportsColor = require('supports-color'); - if (supportsColor && supportsColor.level >= 2) { - exports.colors = [ - 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, - 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, - 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 214, 215, 220, 221 - ]; - } -} catch (err) { - // swallow - we only care if `supports-color` is available; it doesn't have to be. -} - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - -exports.inspectOpts = Object.keys(process.env).filter(function (key) { - return /^debug_/i.test(key); -}).reduce(function (obj, key) { - // camel-case - var prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); - - // coerce string value into JS value - var val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) val = true; - else if (/^(no|off|false|disabled)$/i.test(val)) val = false; - else if (val === 'null') val = null; - else val = Number(val); - - obj[prop] = val; - return obj; -}, {}); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts - ? Boolean(exports.inspectOpts.colors) - : tty.isatty(process.stderr.fd); -} - -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -exports.formatters.o = function(v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .split('\n').map(function(str) { - return str.trim() - }).join(' '); -}; - -/** - * Map %o to `util.inspect()`, allowing multiple lines if needed. - */ - -exports.formatters.O = function(v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs(args) { - var name = this.namespace; - var useColors = this.useColors; - - if (useColors) { - var c = this.color; - var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); - var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; - - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } else { - return new Date().toISOString() + ' '; - } -} - -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ - -function log() { - return process.stderr.write(util.format.apply(util, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - -function init (debug) { - debug.inspectOpts = {}; - - var keys = Object.keys(exports.inspectOpts); - for (var i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/LICENSE b/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/LICENSE deleted file mode 100755 index b248ba1..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014-2015 Automattic - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/README.md b/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/README.md deleted file mode 100755 index 7e335a3..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/README.md +++ /dev/null @@ -1,299 +0,0 @@ - -# Engine.IO client - -[![Build Status](https://travis-ci.org/socketio/engine.io-client.svg?branch=master)](http://travis-ci.org/socketio/engine.io-client) -[![NPM version](https://badge.fury.io/js/engine.io-client.svg)](http://badge.fury.io/js/engine.io-client) - -This is the client for [Engine.IO](http://github.com/socketio/engine.io), -the implementation of transport-based cross-browser/cross-device -bi-directional communication layer for [Socket.IO](http://github.com/socketio/socket.io). - -## How to use - -### Standalone - -You can find an `engine.io.js` file in this repository, which is a -standalone build you can use as follows: - -```html - - -``` - -### With browserify - -Engine.IO is a commonjs module, which means you can include it by using -`require` on the browser and package using [browserify](http://browserify.org/): - -1. install the client package - - ```bash - $ npm install engine.io-client - ``` - -1. write your app code - - ```js - var socket = require('engine.io-client')('ws://localhost'); - socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); - }); - ``` - -1. build your app bundle - - ```bash - $ browserify app.js > bundle.js - ``` - -1. include on your page - - ```html - - ``` - -### Sending and receiving binary - -```html - - -``` - -### Node.JS - -Add `engine.io-client` to your `package.json` and then: - -```js -var socket = require('engine.io-client')('ws://localhost'); -socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); -}); -``` - -### Node.js with certificates -```js -var opts = { - key: fs.readFileSync('test/fixtures/client.key'), - cert: fs.readFileSync('test/fixtures/client.crt'), - ca: fs.readFileSync('test/fixtures/ca.crt') -}; - -var socket = require('engine.io-client')('ws://localhost', opts); -socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); -}); -``` - -### Node.js with extraHeaders -```js -var opts = { - extraHeaders: { - 'X-Custom-Header-For-My-Project': 'my-secret-access-token', - 'Cookie': 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly' - } -}; - -var socket = require('engine.io-client')('ws://localhost', opts); -socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); -}); -``` - -## Features - -- Lightweight -- Runs on browser and node.js seamlessly -- Transports are independent of `Engine` - - Easy to debug - - Easy to unit test -- Runs inside HTML5 WebWorker -- Can send and receive binary data - - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer - in Node - - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise - binary is encoded into base64 strings, and decoded when binary types are - supported. - - With browsers that don't support ArrayBuffer, an object { base64: true, - data: dataAsBase64String } is emitted on the `message` event. - -## API - -### Socket - -The client class. Mixes in [Emitter](http://github.com/component/emitter). -Exposed as `eio` in the browser standalone build. - -#### Properties - -- `protocol` _(Number)_: protocol revision number -- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers, - and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's - supported. - -#### Events - -- `open` - - Fired upon successful connection. -- `message` - - Fired when data is received from the server. - - **Arguments** - - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing - binary data -- `close` - - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be - fired even if the `open` event does not occur (i.e. due to connection error or `close()`). -- `error` - - Fired when an error occurs. -- `flush` - - Fired upon completing a buffer flush -- `drain` - - Fired after `drain` event of transport if writeBuffer is empty -- `upgradeError` - - Fired if an error occurs with a transport we're trying to upgrade to. -- `upgrade` - - Fired upon upgrade success, after the new transport is set -- `ping` - - Fired upon _flushing_ a ping packet (ie: actual packet write out) -- `pong` - - Fired upon receiving a pong packet. - -#### Methods - -- **constructor** - - Initializes the client - - **Parameters** - - `String` uri - - `Object`: optional, options object - - **Options** - - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only) - - `upgrade` (`Boolean`): defaults to true, whether the client should try - to upgrade the transport from long-polling to something better. - - `forceJSONP` (`Boolean`): forces JSONP for polling transport. - - `jsonp` (`Boolean`): determines whether to use JSONP when - necessary for polling. If disabled (by settings to false) an error will - be emitted (saying "No transports available") if no other transports - are available. If another transport is available for opening a - connection (e.g. WebSocket) that transport - will be used instead. - - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. - - `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie. - - `timestampRequests` (`Boolean`): whether to add the timestamp with each - transport request. Note: polling requests are always stamped unless this - option is explicitly set to `false` (`false`) - - `timestampParam` (`String`): timestamp parameter (`t`) - - `policyPort` (`Number`): port the policy server listens on (`843`) - - `path` (`String`): path to connect to, default is `/engine.io` - - `transports` (`Array`): a list of transports to try (in order). - Defaults to `['polling', 'websocket']`. `Engine` - always attempts to connect directly with the first one, provided the - feature detection test for it passes. - - `transportOptions` (`Object`): hash of options, indexed by transport name, overriding the common options for the given transport - - `rememberUpgrade` (`Boolean`): defaults to false. - If true and if the previous websocket connection to the server succeeded, - the connection attempt will bypass the normal upgrade process and will initially - try websocket. A connection attempt following a transport error will use the - normal upgrade process. It is recommended you turn this on only when using - SSL/TLS connections, or if you know that your network does not block websockets. - - `pfx` (`String`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information. - - `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information. - - `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information. - - `cert` (`String`): Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information. - - `ca` (`String`|`Array`): An authority certificate or array of authority certificates to check the remote host against.. Can be used in Node.js client environment to manually specify certificate information. - - `ciphers` (`String`): A string describing the ciphers to use or exclude. Consult the [cipher format list](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the format. Can be used in Node.js client environment to manually specify certificate information. - - `rejectUnauthorized` (`Boolean`): If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information. - - `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension - (see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`) - - `threshold` (`Number`): data is compressed only if the byte size is above this value. This option is ignored on the browser. (`1024`) - - `extraHeaders` (`Object`): Headers that will be passed for each request to the server (via xhr-polling and via websockets). These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment. - - `onlyBinaryUpgrades` (`Boolean`): whether transport upgrades should be restricted to transports supporting binary data (`false`) - - `forceNode` (`Boolean`): Uses NodeJS implementation for websockets - even if there is a native Browser-Websocket available, which is preferred by default over the NodeJS implementation. (This is useful when using hybrid platforms like nw.js or electron) (`false`, NodeJS only) - - `localAddress` (`String`): the local IP address to connect to - - **Polling-only options** - - `requestTimeout` (`Number`): Timeout for xhr-polling requests in milliseconds (`0`) - - **Websocket-only options** - - `protocols` (`Array`): a list of subprotocols (see [MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Subprotocols)) -- `send` - - Sends a message to the server - - **Parameters** - - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send - - `Object`: optional, options object - - `Function`: optional, callback upon `drain` - - **Options** - - `compress` (`Boolean`): whether to compress sending data. This option is ignored and forced to be `true` on the browser. (`true`) -- `close` - - Disconnects the client. - -### Transport - -The transport class. Private. _Inherits from EventEmitter_. - -#### Events - -- `poll`: emitted by polling transports upon starting a new request -- `pollComplete`: emitted by polling transports upon completing a request -- `drain`: emitted by polling transports upon a buffer drain - -## Tests - -`engine.io-client` is used to test -[engine](http://github.com/socketio/engine.io). Running the `engine.io` -test suite ensures the client works and vice-versa. - -Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can -run the tests locally using the following command. - -``` -./node_modules/.bin/zuul --local 8080 -- test/index.js -``` - -Additionally, `engine.io-client` has a standalone test suite you can run -with `make test` which will run node.js and browser tests. You must have zuul setup with -a saucelabs account. - -## Support - -The support channels for `engine.io-client` are the same as `socket.io`: - - irc.freenode.net **#socket.io** - - [Google Groups](http://groups.google.com/group/socket_io) - - [Website](http://socket.io) - -## Development - -To contribute patches, run tests or benchmarks, make sure to clone the -repository: - -```bash -git clone git://github.com/socketio/engine.io-client.git -``` - -Then: - -```bash -cd engine.io-client -npm install -``` - -See the `Tests` section above for how to run tests before submitting any patches. - -## License - -MIT - Copyright (c) 2014 Automattic, Inc. diff --git a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/engine.io.js b/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/engine.io.js deleted file mode 100755 index a37bbd6..0000000 --- a/plugins/Codiad-Collaborative-master/node_modules/engine.io-client/engine.io.js +++ /dev/null @@ -1,4692 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["eio"] = factory(); - else - root["eio"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - module.exports = __webpack_require__(1); - - /** - * Exports parser - * - * @api public - * - */ - module.exports.parser = __webpack_require__(8); - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - /** - * Module dependencies. - */ - - var transports = __webpack_require__(2); - var Emitter = __webpack_require__(18); - var debug = __webpack_require__(22)('engine.io-client:socket'); - var index = __webpack_require__(29); - var parser = __webpack_require__(8); - var parseuri = __webpack_require__(30); - var parseqs = __webpack_require__(19); - - /** - * Module exports. - */ - - module.exports = Socket; - - /** - * Socket constructor. - * - * @param {String|Object} uri or options - * @param {Object} options - * @api public - */ - - function Socket(uri, opts) { - if (!(this instanceof Socket)) return new Socket(uri, opts); - - opts = opts || {}; - - if (uri && 'object' === (typeof uri === 'undefined' ? 'undefined' : _typeof(uri))) { - opts = uri; - uri = null; - } - - if (uri) { - uri = parseuri(uri); - opts.hostname = uri.host; - opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; - opts.port = uri.port; - if (uri.query) opts.query = uri.query; - } else if (opts.host) { - opts.hostname = parseuri(opts.host).host; - } - - this.secure = null != opts.secure ? opts.secure : global.location && 'https:' === location.protocol; - - if (opts.hostname && !opts.port) { - // if no port is specified manually, use the protocol default - opts.port = this.secure ? '443' : '80'; - } - - this.agent = opts.agent || false; - this.hostname = opts.hostname || (global.location ? location.hostname : 'localhost'); - this.port = opts.port || (global.location && location.port ? location.port : this.secure ? 443 : 80); - this.query = opts.query || {}; - if ('string' === typeof this.query) this.query = parseqs.decode(this.query); - this.upgrade = false !== opts.upgrade; - this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; - this.forceJSONP = !!opts.forceJSONP; - this.jsonp = false !== opts.jsonp; - this.forceBase64 = !!opts.forceBase64; - this.enablesXDR = !!opts.enablesXDR; - this.timestampParam = opts.timestampParam || 't'; - this.timestampRequests = opts.timestampRequests; - this.transports = opts.transports || ['polling', 'websocket']; - this.transportOptions = opts.transportOptions || {}; - this.readyState = ''; - this.writeBuffer = []; - this.prevBufferLen = 0; - this.policyPort = opts.policyPort || 843; - this.rememberUpgrade = opts.rememberUpgrade || false; - this.binaryType = null; - this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; - this.perMessageDeflate = false !== opts.perMessageDeflate ? opts.perMessageDeflate || {} : false; - - if (true === this.perMessageDeflate) this.perMessageDeflate = {}; - if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { - this.perMessageDeflate.threshold = 1024; - } - - // SSL options for Node.js client - this.pfx = opts.pfx || null; - this.key = opts.key || null; - this.passphrase = opts.passphrase || null; - this.cert = opts.cert || null; - this.ca = opts.ca || null; - this.ciphers = opts.ciphers || null; - this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; - this.forceNode = !!opts.forceNode; - - // other options for Node.js client - var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global; - if (freeGlobal.global === freeGlobal) { - if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { - this.extraHeaders = opts.extraHeaders; - } - - if (opts.localAddress) { - this.localAddress = opts.localAddress; - } - } - - // set on handshake - this.id = null; - this.upgrades = null; - this.pingInterval = null; - this.pingTimeout = null; - - // set on heartbeat - this.pingIntervalTimer = null; - this.pingTimeoutTimer = null; - - this.open(); - } - - Socket.priorWebsocketSuccess = false; - - /** - * Mix in `Emitter`. - */ - - Emitter(Socket.prototype); - - /** - * Protocol version. - * - * @api public - */ - - Socket.protocol = parser.protocol; // this is an int - - /** - * Expose deps for legacy compatibility - * and standalone browser access. - */ - - Socket.Socket = Socket; - Socket.Transport = __webpack_require__(7); - Socket.transports = __webpack_require__(2); - Socket.parser = __webpack_require__(8); - - /** - * Creates transport of the given type. - * - * @param {String} transport name - * @return {Transport} - * @api private - */ - - Socket.prototype.createTransport = function (name) { - debug('creating transport "%s"', name); - var query = clone(this.query); - - // append engine.io protocol identifier - query.EIO = parser.protocol; - - // transport name - query.transport = name; - - // per-transport options - var options = this.transportOptions[name] || {}; - - // session id if we already have one - if (this.id) query.sid = this.id; - - var transport = new transports[name]({ - query: query, - socket: this, - agent: options.agent || this.agent, - hostname: options.hostname || this.hostname, - port: options.port || this.port, - secure: options.secure || this.secure, - path: options.path || this.path, - forceJSONP: options.forceJSONP || this.forceJSONP, - jsonp: options.jsonp || this.jsonp, - forceBase64: options.forceBase64 || this.forceBase64, - enablesXDR: options.enablesXDR || this.enablesXDR, - timestampRequests: options.timestampRequests || this.timestampRequests, - timestampParam: options.timestampParam || this.timestampParam, - policyPort: options.policyPort || this.policyPort, - pfx: options.pfx || this.pfx, - key: options.key || this.key, - passphrase: options.passphrase || this.passphrase, - cert: options.cert || this.cert, - ca: options.ca || this.ca, - ciphers: options.ciphers || this.ciphers, - rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, - perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, - extraHeaders: options.extraHeaders || this.extraHeaders, - forceNode: options.forceNode || this.forceNode, - localAddress: options.localAddress || this.localAddress, - requestTimeout: options.requestTimeout || this.requestTimeout, - protocols: options.protocols || void 0 - }); - - return transport; - }; - - function clone(obj) { - var o = {}; - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - o[i] = obj[i]; - } - } - return o; - } - - /** - * Initializes transport to use and starts probe. - * - * @api private - */ - Socket.prototype.open = function () { - var transport; - if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { - transport = 'websocket'; - } else if (0 === this.transports.length) { - // Emit error on next tick so it can be listened to - var self = this; - setTimeout(function () { - self.emit('error', 'No transports available'); - }, 0); - return; - } else { - transport = this.transports[0]; - } - this.readyState = 'opening'; - - // Retry with the next transport if the transport is disabled (jsonp: false) - try { - transport = this.createTransport(transport); - } catch (e) { - this.transports.shift(); - this.open(); - return; - } - - transport.open(); - this.setTransport(transport); - }; - - /** - * Sets the current transport. Disables the existing one (if any). - * - * @api private - */ - - Socket.prototype.setTransport = function (transport) { - debug('setting transport %s', transport.name); - var self = this; - - if (this.transport) { - debug('clearing existing transport %s', this.transport.name); - this.transport.removeAllListeners(); - } - - // set up transport - this.transport = transport; - - // set up transport listeners - transport.on('drain', function () { - self.onDrain(); - }).on('packet', function (packet) { - self.onPacket(packet); - }).on('error', function (e) { - self.onError(e); - }).on('close', function () { - self.onClose('transport close'); - }); - }; - - /** - * Probes a transport. - * - * @param {String} transport name - * @api private - */ - - Socket.prototype.probe = function (name) { - debug('probing transport "%s"', name); - var transport = this.createTransport(name, { probe: 1 }); - var failed = false; - var self = this; - - Socket.priorWebsocketSuccess = false; - - function onTransportOpen() { - if (self.onlyBinaryUpgrades) { - var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; - failed = failed || upgradeLosesBinary; - } - if (failed) return; - - debug('probe transport "%s" opened', name); - transport.send([{ type: 'ping', data: 'probe' }]); - transport.once('packet', function (msg) { - if (failed) return; - if ('pong' === msg.type && 'probe' === msg.data) { - debug('probe transport "%s" pong', name); - self.upgrading = true; - self.emit('upgrading', transport); - if (!transport) return; - Socket.priorWebsocketSuccess = 'websocket' === transport.name; - - debug('pausing current transport "%s"', self.transport.name); - self.transport.pause(function () { - if (failed) return; - if ('closed' === self.readyState) return; - debug('changing transport and sending upgrade packet'); - - cleanup(); - - self.setTransport(transport); - transport.send([{ type: 'upgrade' }]); - self.emit('upgrade', transport); - transport = null; - self.upgrading = false; - self.flush(); - }); - } else { - debug('probe transport "%s" failed', name); - var err = new Error('probe error'); - err.transport = transport.name; - self.emit('upgradeError', err); - } - }); - } - - function freezeTransport() { - if (failed) return; - - // Any callback called by transport should be ignored since now - failed = true; - - cleanup(); - - transport.close(); - transport = null; - } - - // Handle any error that happens while probing - function onerror(err) { - var error = new Error('probe error: ' + err); - error.transport = transport.name; - - freezeTransport(); - - debug('probe transport "%s" failed because of error: %s', name, err); - - self.emit('upgradeError', error); - } - - function onTransportClose() { - onerror('transport closed'); - } - - // When the socket is closed while we're probing - function onclose() { - onerror('socket closed'); - } - - // When the socket is upgraded while we're probing - function onupgrade(to) { - if (transport && to.name !== transport.name) { - debug('"%s" works - aborting "%s"', to.name, transport.name); - freezeTransport(); - } - } - - // Remove all listeners on the transport and on self - function cleanup() { - transport.removeListener('open', onTransportOpen); - transport.removeListener('error', onerror); - transport.removeListener('close', onTransportClose); - self.removeListener('close', onclose); - self.removeListener('upgrading', onupgrade); - } - - transport.once('open', onTransportOpen); - transport.once('error', onerror); - transport.once('close', onTransportClose); - - this.once('close', onclose); - this.once('upgrading', onupgrade); - - transport.open(); - }; - - /** - * Called when connection is deemed open. - * - * @api public - */ - - Socket.prototype.onOpen = function () { - debug('socket open'); - this.readyState = 'open'; - Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; - this.emit('open'); - this.flush(); - - // we check for `readyState` in case an `open` - // listener already closed the socket - if ('open' === this.readyState && this.upgrade && this.transport.pause) { - debug('starting upgrade probes'); - for (var i = 0, l = this.upgrades.length; i < l; i++) { - this.probe(this.upgrades[i]); - } - } - }; - - /** - * Handles a packet. - * - * @api private - */ - - Socket.prototype.onPacket = function (packet) { - if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { - debug('socket receive: type "%s", data "%s"', packet.type, packet.data); - - this.emit('packet', packet); - - // Socket is live - any packet counts - this.emit('heartbeat'); - - switch (packet.type) { - case 'open': - this.onHandshake(JSON.parse(packet.data)); - break; - - case 'pong': - this.setPing(); - this.emit('pong'); - break; - - case 'error': - var err = new Error('server error'); - err.code = packet.data; - this.onError(err); - break; - - case 'message': - this.emit('data', packet.data); - this.emit('message', packet.data); - break; - } - } else { - debug('packet received with socket readyState "%s"', this.readyState); - } - }; - - /** - * Called upon handshake completion. - * - * @param {Object} handshake obj - * @api private - */ - - Socket.prototype.onHandshake = function (data) { - this.emit('handshake', data); - this.id = data.sid; - this.transport.query.sid = data.sid; - this.upgrades = this.filterUpgrades(data.upgrades); - this.pingInterval = data.pingInterval; - this.pingTimeout = data.pingTimeout; - this.onOpen(); - // In case open handler closes socket - if ('closed' === this.readyState) return; - this.setPing(); - - // Prolong liveness of socket on heartbeat - this.removeListener('heartbeat', this.onHeartbeat); - this.on('heartbeat', this.onHeartbeat); - }; - - /** - * Resets ping timeout. - * - * @api private - */ - - Socket.prototype.onHeartbeat = function (timeout) { - clearTimeout(this.pingTimeoutTimer); - var self = this; - self.pingTimeoutTimer = setTimeout(function () { - if ('closed' === self.readyState) return; - self.onClose('ping timeout'); - }, timeout || self.pingInterval + self.pingTimeout); - }; - - /** - * Pings server every `this.pingInterval` and expects response - * within `this.pingTimeout` or closes connection. - * - * @api private - */ - - Socket.prototype.setPing = function () { - var self = this; - clearTimeout(self.pingIntervalTimer); - self.pingIntervalTimer = setTimeout(function () { - debug('writing ping packet - expecting pong within %sms', self.pingTimeout); - self.ping(); - self.onHeartbeat(self.pingTimeout); - }, self.pingInterval); - }; - - /** - * Sends a ping packet. - * - * @api private - */ - - Socket.prototype.ping = function () { - var self = this; - this.sendPacket('ping', function () { - self.emit('ping'); - }); - }; - - /** - * Called on `drain` event - * - * @api private - */ - - Socket.prototype.onDrain = function () { - this.writeBuffer.splice(0, this.prevBufferLen); - - // setting prevBufferLen = 0 is very important - // for example, when upgrading, upgrade packet is sent over, - // and a nonzero prevBufferLen could cause problems on `drain` - this.prevBufferLen = 0; - - if (0 === this.writeBuffer.length) { - this.emit('drain'); - } else { - this.flush(); - } - }; - - /** - * Flush write buffers. - * - * @api private - */ - - Socket.prototype.flush = function () { - if ('closed' !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { - debug('flushing %d packets in socket', this.writeBuffer.length); - this.transport.send(this.writeBuffer); - // keep track of current length of writeBuffer - // splice writeBuffer and callbackBuffer on `drain` - this.prevBufferLen = this.writeBuffer.length; - this.emit('flush'); - } - }; - - /** - * Sends a message. - * - * @param {String} message. - * @param {Function} callback function. - * @param {Object} options. - * @return {Socket} for chaining. - * @api public - */ - - Socket.prototype.write = Socket.prototype.send = function (msg, options, fn) { - this.sendPacket('message', msg, options, fn); - return this; - }; - - /** - * Sends a packet. - * - * @param {String} packet type. - * @param {String} data. - * @param {Object} options. - * @param {Function} callback function. - * @api private - */ - - Socket.prototype.sendPacket = function (type, data, options, fn) { - if ('function' === typeof data) { - fn = data; - data = undefined; - } - - if ('function' === typeof options) { - fn = options; - options = null; - } - - if ('closing' === this.readyState || 'closed' === this.readyState) { - return; - } - - options = options || {}; - options.compress = false !== options.compress; - - var packet = { - type: type, - data: data, - options: options - }; - this.emit('packetCreate', packet); - this.writeBuffer.push(packet); - if (fn) this.once('flush', fn); - this.flush(); - }; - - /** - * Closes the connection. - * - * @api private - */ - - Socket.prototype.close = function () { - if ('opening' === this.readyState || 'open' === this.readyState) { - this.readyState = 'closing'; - - var self = this; - - if (this.writeBuffer.length) { - this.once('drain', function () { - if (this.upgrading) { - waitForUpgrade(); - } else { - close(); - } - }); - } else if (this.upgrading) { - waitForUpgrade(); - } else { - close(); - } - } - - function close() { - self.onClose('forced close'); - debug('socket closing - telling transport to close'); - self.transport.close(); - } - - function cleanupAndClose() { - self.removeListener('upgrade', cleanupAndClose); - self.removeListener('upgradeError', cleanupAndClose); - close(); - } - - function waitForUpgrade() { - // wait for upgrade to finish since we can't send packets while pausing a transport - self.once('upgrade', cleanupAndClose); - self.once('upgradeError', cleanupAndClose); - } - - return this; - }; - - /** - * Called upon transport error - * - * @api private - */ - - Socket.prototype.onError = function (err) { - debug('socket error %j', err); - Socket.priorWebsocketSuccess = false; - this.emit('error', err); - this.onClose('transport error', err); - }; - - /** - * Called upon transport close. - * - * @api private - */ - - Socket.prototype.onClose = function (reason, desc) { - if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { - debug('socket close with reason: "%s"', reason); - var self = this; - - // clear timers - clearTimeout(this.pingIntervalTimer); - clearTimeout(this.pingTimeoutTimer); - - // stop event from firing again for transport - this.transport.removeAllListeners('close'); - - // ensure transport won't stay open - this.transport.close(); - - // ignore further transport communication - this.transport.removeAllListeners(); - - // set ready state - this.readyState = 'closed'; - - // clear session id - this.id = null; - - // emit close event - this.emit('close', reason, desc); - - // clean buffers after, so users can still - // grab the buffers on `close` event - self.writeBuffer = []; - self.prevBufferLen = 0; - } - }; - - /** - * Filters upgrades, returning only those matching client transports. - * - * @param {Array} server upgrades - * @api private - * - */ - - Socket.prototype.filterUpgrades = function (upgrades) { - var filteredUpgrades = []; - for (var i = 0, j = upgrades.length; i < j; i++) { - if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); - } - return filteredUpgrades; - }; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - /** - * Module dependencies - */ - - var XMLHttpRequest = __webpack_require__(3); - var XHR = __webpack_require__(5); - var JSONP = __webpack_require__(26); - var websocket = __webpack_require__(27); - - /** - * Export transports. - */ - - exports.polling = polling; - exports.websocket = websocket; - - /** - * Polling transport polymorphic constructor. - * Decides on xhr vs jsonp based on feature detection. - * - * @api private - */ - - function polling(opts) { - var xhr; - var xd = false; - var xs = false; - var jsonp = false !== opts.jsonp; - - if (global.location) { - var isSSL = 'https:' === location.protocol; - var port = location.port; - - // some user agents have empty `location.port` - if (!port) { - port = isSSL ? 443 : 80; - } - - xd = opts.hostname !== location.hostname || port !== opts.port; - xs = opts.secure !== isSSL; - } - - opts.xdomain = xd; - opts.xscheme = xs; - xhr = new XMLHttpRequest(opts); - - if ('open' in xhr && !opts.forceJSONP) { - return new XHR(opts); - } else { - if (!jsonp) throw new Error('JSONP disabled'); - return new JSONP(opts); - } - } - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - // browser shim for xmlhttprequest module - - var hasCORS = __webpack_require__(4); - - module.exports = function (opts) { - var xdomain = opts.xdomain; - - // scheme must be same when usign XDomainRequest - // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx - var xscheme = opts.xscheme; - - // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. - // https://github.com/Automattic/engine.io-client/pull/217 - var enablesXDR = opts.enablesXDR; - - // XMLHttpRequest can be disabled on IE - try { - if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { - return new XMLHttpRequest(); - } - } catch (e) {} - - // Use XDomainRequest for IE8 if enablesXDR is true - // because loading bar keeps flashing when using jsonp-polling - // https://github.com/yujiosaka/socke.io-ie8-loading-example - try { - if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { - return new XDomainRequest(); - } - } catch (e) {} - - if (!xdomain) { - try { - return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); - } catch (e) {} - } - }; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - - /** - * Module exports. - * - * Logic borrowed from Modernizr: - * - * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js - */ - - try { - module.exports = typeof XMLHttpRequest !== 'undefined' && - 'withCredentials' in new XMLHttpRequest(); - } catch (err) { - // if XMLHttp support is disabled in IE then it will throw - // when trying to create - module.exports = false; - } - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - /** - * Module requirements. - */ - - var XMLHttpRequest = __webpack_require__(3); - var Polling = __webpack_require__(6); - var Emitter = __webpack_require__(18); - var inherit = __webpack_require__(20); - var debug = __webpack_require__(22)('engine.io-client:polling-xhr'); - - /** - * Module exports. - */ - - module.exports = XHR; - module.exports.Request = Request; - - /** - * Empty function - */ - - function empty() {} - - /** - * XHR Polling constructor. - * - * @param {Object} opts - * @api public - */ - - function XHR(opts) { - Polling.call(this, opts); - this.requestTimeout = opts.requestTimeout; - this.extraHeaders = opts.extraHeaders; - - if (global.location) { - var isSSL = 'https:' === location.protocol; - var port = location.port; - - // some user agents have empty `location.port` - if (!port) { - port = isSSL ? 443 : 80; - } - - this.xd = opts.hostname !== global.location.hostname || port !== opts.port; - this.xs = opts.secure !== isSSL; - } - } - - /** - * Inherits from Polling. - */ - - inherit(XHR, Polling); - - /** - * XHR supports binary - */ - - XHR.prototype.supportsBinary = true; - - /** - * Creates a request. - * - * @param {String} method - * @api private - */ - - XHR.prototype.request = function (opts) { - opts = opts || {}; - opts.uri = this.uri(); - opts.xd = this.xd; - opts.xs = this.xs; - opts.agent = this.agent || false; - opts.supportsBinary = this.supportsBinary; - opts.enablesXDR = this.enablesXDR; - - // SSL options for Node.js client - opts.pfx = this.pfx; - opts.key = this.key; - opts.passphrase = this.passphrase; - opts.cert = this.cert; - opts.ca = this.ca; - opts.ciphers = this.ciphers; - opts.rejectUnauthorized = this.rejectUnauthorized; - opts.requestTimeout = this.requestTimeout; - - // other options for Node.js client - opts.extraHeaders = this.extraHeaders; - - return new Request(opts); - }; - - /** - * Sends data. - * - * @param {String} data to send. - * @param {Function} called upon flush. - * @api private - */ - - XHR.prototype.doWrite = function (data, fn) { - var isBinary = typeof data !== 'string' && data !== undefined; - var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); - var self = this; - req.on('success', fn); - req.on('error', function (err) { - self.onError('xhr post error', err); - }); - this.sendXhr = req; - }; - - /** - * Starts a poll cycle. - * - * @api private - */ - - XHR.prototype.doPoll = function () { - debug('xhr poll'); - var req = this.request(); - var self = this; - req.on('data', function (data) { - self.onData(data); - }); - req.on('error', function (err) { - self.onError('xhr poll error', err); - }); - this.pollXhr = req; - }; - - /** - * Request constructor - * - * @param {Object} options - * @api public - */ - - function Request(opts) { - this.method = opts.method || 'GET'; - this.uri = opts.uri; - this.xd = !!opts.xd; - this.xs = !!opts.xs; - this.async = false !== opts.async; - this.data = undefined !== opts.data ? opts.data : null; - this.agent = opts.agent; - this.isBinary = opts.isBinary; - this.supportsBinary = opts.supportsBinary; - this.enablesXDR = opts.enablesXDR; - this.requestTimeout = opts.requestTimeout; - - // SSL options for Node.js client - this.pfx = opts.pfx; - this.key = opts.key; - this.passphrase = opts.passphrase; - this.cert = opts.cert; - this.ca = opts.ca; - this.ciphers = opts.ciphers; - this.rejectUnauthorized = opts.rejectUnauthorized; - - // other options for Node.js client - this.extraHeaders = opts.extraHeaders; - - this.create(); - } - - /** - * Mix in `Emitter`. - */ - - Emitter(Request.prototype); - - /** - * Creates the XHR object and sends the request. - * - * @api private - */ - - Request.prototype.create = function () { - var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; - - // SSL options for Node.js client - opts.pfx = this.pfx; - opts.key = this.key; - opts.passphrase = this.passphrase; - opts.cert = this.cert; - opts.ca = this.ca; - opts.ciphers = this.ciphers; - opts.rejectUnauthorized = this.rejectUnauthorized; - - var xhr = this.xhr = new XMLHttpRequest(opts); - var self = this; - - try { - debug('xhr open %s: %s', this.method, this.uri); - xhr.open(this.method, this.uri, this.async); - try { - if (this.extraHeaders) { - xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); - for (var i in this.extraHeaders) { - if (this.extraHeaders.hasOwnProperty(i)) { - xhr.setRequestHeader(i, this.extraHeaders[i]); - } - } - } - } catch (e) {} - - if ('POST' === this.method) { - try { - if (this.isBinary) { - xhr.setRequestHeader('Content-type', 'application/octet-stream'); - } else { - xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); - } - } catch (e) {} - } - - try { - xhr.setRequestHeader('Accept', '*/*'); - } catch (e) {} - - // ie6 check - if ('withCredentials' in xhr) { - xhr.withCredentials = true; - } - - if (this.requestTimeout) { - xhr.timeout = this.requestTimeout; - } - - if (this.hasXDR()) { - xhr.onload = function () { - self.onLoad(); - }; - xhr.onerror = function () { - self.onError(xhr.responseText); - }; - } else { - xhr.onreadystatechange = function () { - if (xhr.readyState === 2) { - try { - var contentType = xhr.getResponseHeader('Content-Type'); - if (self.supportsBinary && contentType === 'application/octet-stream') { - xhr.responseType = 'arraybuffer'; - } - } catch (e) {} - } - if (4 !== xhr.readyState) return; - if (200 === xhr.status || 1223 === xhr.status) { - self.onLoad(); - } else { - // make sure the `error` event handler that's user-set - // does not throw in the same tick and gets caught here - setTimeout(function () { - self.onError(xhr.status); - }, 0); - } - }; - } - - debug('xhr data %s', this.data); - xhr.send(this.data); - } catch (e) { - // Need to defer since .create() is called directly fhrom the constructor - // and thus the 'error' event can only be only bound *after* this exception - // occurs. Therefore, also, we cannot throw here at all. - setTimeout(function () { - self.onError(e); - }, 0); - return; - } - - if (global.document) { - this.index = Request.requestsCount++; - Request.requests[this.index] = this; - } - }; - - /** - * Called upon successful response. - * - * @api private - */ - - Request.prototype.onSuccess = function () { - this.emit('success'); - this.cleanup(); - }; - - /** - * Called if we have data. - * - * @api private - */ - - Request.prototype.onData = function (data) { - this.emit('data', data); - this.onSuccess(); - }; - - /** - * Called upon error. - * - * @api private - */ - - Request.prototype.onError = function (err) { - this.emit('error', err); - this.cleanup(true); - }; - - /** - * Cleans up house. - * - * @api private - */ - - Request.prototype.cleanup = function (fromError) { - if ('undefined' === typeof this.xhr || null === this.xhr) { - return; - } - // xmlhttprequest - if (this.hasXDR()) { - this.xhr.onload = this.xhr.onerror = empty; - } else { - this.xhr.onreadystatechange = empty; - } - - if (fromError) { - try { - this.xhr.abort(); - } catch (e) {} - } - - if (global.document) { - delete Request.requests[this.index]; - } - - this.xhr = null; - }; - - /** - * Called upon load. - * - * @api private - */ - - Request.prototype.onLoad = function () { - var data; - try { - var contentType; - try { - contentType = this.xhr.getResponseHeader('Content-Type'); - } catch (e) {} - if (contentType === 'application/octet-stream') { - data = this.xhr.response || this.xhr.responseText; - } else { - data = this.xhr.responseText; - } - } catch (e) { - this.onError(e); - } - if (null != data) { - this.onData(data); - } - }; - - /** - * Check if it has XDomainRequest. - * - * @api private - */ - - Request.prototype.hasXDR = function () { - return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR; - }; - - /** - * Aborts the request. - * - * @api public - */ - - Request.prototype.abort = function () { - this.cleanup(); - }; - - /** - * Aborts pending requests when unloading the window. This is needed to prevent - * memory leaks (e.g. when using IE) and to ensure that no spurious error is - * emitted. - */ - - Request.requestsCount = 0; - Request.requests = {}; - - if (global.document) { - if (global.attachEvent) { - global.attachEvent('onunload', unloadHandler); - } else if (global.addEventListener) { - global.addEventListener('beforeunload', unloadHandler, false); - } - } - - function unloadHandler() { - for (var i in Request.requests) { - if (Request.requests.hasOwnProperty(i)) { - Request.requests[i].abort(); - } - } - } - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - /** - * Module dependencies. - */ - - var Transport = __webpack_require__(7); - var parseqs = __webpack_require__(19); - var parser = __webpack_require__(8); - var inherit = __webpack_require__(20); - var yeast = __webpack_require__(21); - var debug = __webpack_require__(22)('engine.io-client:polling'); - - /** - * Module exports. - */ - - module.exports = Polling; - - /** - * Is XHR2 supported? - */ - - var hasXHR2 = function () { - var XMLHttpRequest = __webpack_require__(3); - var xhr = new XMLHttpRequest({ xdomain: false }); - return null != xhr.responseType; - }(); - - /** - * Polling interface. - * - * @param {Object} opts - * @api private - */ - - function Polling(opts) { - var forceBase64 = opts && opts.forceBase64; - if (!hasXHR2 || forceBase64) { - this.supportsBinary = false; - } - Transport.call(this, opts); - } - - /** - * Inherits from Transport. - */ - - inherit(Polling, Transport); - - /** - * Transport name. - */ - - Polling.prototype.name = 'polling'; - - /** - * Opens the socket (triggers polling). We write a PING message to determine - * when the transport is open. - * - * @api private - */ - - Polling.prototype.doOpen = function () { - this.poll(); - }; - - /** - * Pauses polling. - * - * @param {Function} callback upon buffers are flushed and transport is paused - * @api private - */ - - Polling.prototype.pause = function (onPause) { - var self = this; - - this.readyState = 'pausing'; - - function pause() { - debug('paused'); - self.readyState = 'paused'; - onPause(); - } - - if (this.polling || !this.writable) { - var total = 0; - - if (this.polling) { - debug('we are currently polling - waiting to pause'); - total++; - this.once('pollComplete', function () { - debug('pre-pause polling complete'); - --total || pause(); - }); - } - - if (!this.writable) { - debug('we are currently writing - waiting to pause'); - total++; - this.once('drain', function () { - debug('pre-pause writing complete'); - --total || pause(); - }); - } - } else { - pause(); - } - }; - - /** - * Starts polling cycle. - * - * @api public - */ - - Polling.prototype.poll = function () { - debug('polling'); - this.polling = true; - this.doPoll(); - this.emit('poll'); - }; - - /** - * Overloads onData to detect payloads. - * - * @api private - */ - - Polling.prototype.onData = function (data) { - var self = this; - debug('polling got data %s', data); - var callback = function callback(packet, index, total) { - // if its the first message we consider the transport open - if ('opening' === self.readyState) { - self.onOpen(); - } - - // if its a close packet, we close the ongoing requests - if ('close' === packet.type) { - self.onClose(); - return false; - } - - // otherwise bypass onData and handle the message - self.onPacket(packet); - }; - - // decode payload - parser.decodePayload(data, this.socket.binaryType, callback); - - // if an event did not trigger closing - if ('closed' !== this.readyState) { - // if we got data we're not polling - this.polling = false; - this.emit('pollComplete'); - - if ('open' === this.readyState) { - this.poll(); - } else { - debug('ignoring poll - transport state "%s"', this.readyState); - } - } - }; - - /** - * For polling, send a close packet. - * - * @api private - */ - - Polling.prototype.doClose = function () { - var self = this; - - function close() { - debug('writing close packet'); - self.write([{ type: 'close' }]); - } - - if ('open' === this.readyState) { - debug('transport open - closing'); - close(); - } else { - // in case we're trying to close while - // handshaking is in progress (GH-164) - debug('transport not open - deferring close'); - this.once('open', close); - } - }; - - /** - * Writes a packets payload. - * - * @param {Array} data packets - * @param {Function} drain callback - * @api private - */ - - Polling.prototype.write = function (packets) { - var self = this; - this.writable = false; - var callbackfn = function callbackfn() { - self.writable = true; - self.emit('drain'); - }; - - parser.encodePayload(packets, this.supportsBinary, function (data) { - self.doWrite(data, callbackfn); - }); - }; - - /** - * Generates uri for connection. - * - * @api private - */ - - Polling.prototype.uri = function () { - var query = this.query || {}; - var schema = this.secure ? 'https' : 'http'; - var port = ''; - - // cache busting is forced - if (false !== this.timestampRequests) { - query[this.timestampParam] = yeast(); - } - - if (!this.supportsBinary && !query.sid) { - query.b64 = 1; - } - - query = parseqs.encode(query); - - // avoid port if default for schema - if (this.port && ('https' === schema && Number(this.port) !== 443 || 'http' === schema && Number(this.port) !== 80)) { - port = ':' + this.port; - } - - // prepend ? to query - if (query.length) { - query = '?' + query; - } - - var ipv6 = this.hostname.indexOf(':') !== -1; - return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; - }; - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - /** - * Module dependencies. - */ - - var parser = __webpack_require__(8); - var Emitter = __webpack_require__(18); - - /** - * Module exports. - */ - - module.exports = Transport; - - /** - * Transport abstract constructor. - * - * @param {Object} options. - * @api private - */ - - function Transport(opts) { - this.path = opts.path; - this.hostname = opts.hostname; - this.port = opts.port; - this.secure = opts.secure; - this.query = opts.query; - this.timestampParam = opts.timestampParam; - this.timestampRequests = opts.timestampRequests; - this.readyState = ''; - this.agent = opts.agent || false; - this.socket = opts.socket; - this.enablesXDR = opts.enablesXDR; - - // SSL options for Node.js client - this.pfx = opts.pfx; - this.key = opts.key; - this.passphrase = opts.passphrase; - this.cert = opts.cert; - this.ca = opts.ca; - this.ciphers = opts.ciphers; - this.rejectUnauthorized = opts.rejectUnauthorized; - this.forceNode = opts.forceNode; - - // other options for Node.js client - this.extraHeaders = opts.extraHeaders; - this.localAddress = opts.localAddress; - } - - /** - * Mix in `Emitter`. - */ - - Emitter(Transport.prototype); - - /** - * Emits an error. - * - * @param {String} str - * @return {Transport} for chaining - * @api public - */ - - Transport.prototype.onError = function (msg, desc) { - var err = new Error(msg); - err.type = 'TransportError'; - err.description = desc; - this.emit('error', err); - return this; - }; - - /** - * Opens the transport. - * - * @api public - */ - - Transport.prototype.open = function () { - if ('closed' === this.readyState || '' === this.readyState) { - this.readyState = 'opening'; - this.doOpen(); - } - - return this; - }; - - /** - * Closes the transport. - * - * @api private - */ - - Transport.prototype.close = function () { - if ('opening' === this.readyState || 'open' === this.readyState) { - this.doClose(); - this.onClose(); - } - - return this; - }; - - /** - * Sends multiple packets. - * - * @param {Array} packets - * @api private - */ - - Transport.prototype.send = function (packets) { - if ('open' === this.readyState) { - this.write(packets); - } else { - throw new Error('Transport not open'); - } - }; - - /** - * Called upon open - * - * @api private - */ - - Transport.prototype.onOpen = function () { - this.readyState = 'open'; - this.writable = true; - this.emit('open'); - }; - - /** - * Called with data. - * - * @param {String} data - * @api private - */ - - Transport.prototype.onData = function (data) { - var packet = parser.decodePacket(data, this.socket.binaryType); - this.onPacket(packet); - }; - - /** - * Called with a decoded packet. - */ - - Transport.prototype.onPacket = function (packet) { - this.emit('packet', packet); - }; - - /** - * Called upon close. - * - * @api private - */ - - Transport.prototype.onClose = function () { - this.readyState = 'closed'; - this.emit('close'); - }; - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {/** - * Module dependencies. - */ - - var keys = __webpack_require__(9); - var hasBinary = __webpack_require__(10); - var sliceBuffer = __webpack_require__(12); - var after = __webpack_require__(13); - var utf8 = __webpack_require__(14); - - var base64encoder; - if (global && global.ArrayBuffer) { - base64encoder = __webpack_require__(16); - } - - /** - * Check if we are running an android browser. That requires us to use - * ArrayBuffer with polling transports... - * - * http://ghinda.net/jpeg-blob-ajax-android/ - */ - - var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); - - /** - * Check if we are running in PhantomJS. - * Uploading a Blob with PhantomJS does not work correctly, as reported here: - * https://github.com/ariya/phantomjs/issues/11395 - * @type boolean - */ - var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); - - /** - * When true, avoids using Blobs to encode payloads. - * @type boolean - */ - var dontSendBlobs = isAndroid || isPhantomJS; - - /** - * Current protocol version. - */ - - exports.protocol = 3; - - /** - * Packet types. - */ - - var packets = exports.packets = { - open: 0 // non-ws - , close: 1 // non-ws - , ping: 2 - , pong: 3 - , message: 4 - , upgrade: 5 - , noop: 6 - }; - - var packetslist = keys(packets); - - /** - * Premade error packet. - */ - - var err = { type: 'error', data: 'parser error' }; - - /** - * Create a blob api even for blob builder when vendor prefixes exist - */ - - var Blob = __webpack_require__(17); - - /** - * Encodes a packet. - * - * [ ] - * - * Example: - * - * 5hello world - * 3 - * 4 - * - * Binary is encoded in an identical principle - * - * @api private - */ - - exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { - if (typeof supportsBinary === 'function') { - callback = supportsBinary; - supportsBinary = false; - } - - if (typeof utf8encode === 'function') { - callback = utf8encode; - utf8encode = null; - } - - var data = (packet.data === undefined) - ? undefined - : packet.data.buffer || packet.data; - - if (global.ArrayBuffer && data instanceof ArrayBuffer) { - return encodeArrayBuffer(packet, supportsBinary, callback); - } else if (Blob && data instanceof global.Blob) { - return encodeBlob(packet, supportsBinary, callback); - } - - // might be an object with { base64: true, data: dataAsBase64String } - if (data && data.base64) { - return encodeBase64Object(packet, callback); - } - - // Sending data as a utf-8 string - var encoded = packets[packet.type]; - - // data fragment is optional - if (undefined !== packet.data) { - encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); - } - - return callback('' + encoded); - - }; - - function encodeBase64Object(packet, callback) { - // packet data is an object { base64: true, data: dataAsBase64String } - var message = 'b' + exports.packets[packet.type] + packet.data.data; - return callback(message); - } - - /** - * Encode packet helpers for binary types - */ - - function encodeArrayBuffer(packet, supportsBinary, callback) { - if (!supportsBinary) { - return exports.encodeBase64Packet(packet, callback); - } - - var data = packet.data; - var contentArray = new Uint8Array(data); - var resultBuffer = new Uint8Array(1 + data.byteLength); - - resultBuffer[0] = packets[packet.type]; - for (var i = 0; i < contentArray.length; i++) { - resultBuffer[i+1] = contentArray[i]; - } - - return callback(resultBuffer.buffer); - } - - function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { - if (!supportsBinary) { - return exports.encodeBase64Packet(packet, callback); - } - - var fr = new FileReader(); - fr.onload = function() { - packet.data = fr.result; - exports.encodePacket(packet, supportsBinary, true, callback); - }; - return fr.readAsArrayBuffer(packet.data); - } - - function encodeBlob(packet, supportsBinary, callback) { - if (!supportsBinary) { - return exports.encodeBase64Packet(packet, callback); - } - - if (dontSendBlobs) { - return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); - } - - var length = new Uint8Array(1); - length[0] = packets[packet.type]; - var blob = new Blob([length.buffer, packet.data]); - - return callback(blob); - } - - /** - * Encodes a packet with binary data in a base64 string - * - * @param {Object} packet, has `type` and `data` - * @return {String} base64 encoded message - */ - - exports.encodeBase64Packet = function(packet, callback) { - var message = 'b' + exports.packets[packet.type]; - if (Blob && packet.data instanceof global.Blob) { - var fr = new FileReader(); - fr.onload = function() { - var b64 = fr.result.split(',')[1]; - callback(message + b64); - }; - return fr.readAsDataURL(packet.data); - } - - var b64data; - try { - b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); - } catch (e) { - // iPhone Safari doesn't let you apply with typed arrays - var typed = new Uint8Array(packet.data); - var basic = new Array(typed.length); - for (var i = 0; i < typed.length; i++) { - basic[i] = typed[i]; - } - b64data = String.fromCharCode.apply(null, basic); - } - message += global.btoa(b64data); - return callback(message); - }; - - /** - * Decodes a packet. Changes format to Blob if requested. - * - * @return {Object} with `type` and `data` (if any) - * @api private - */ - - exports.decodePacket = function (data, binaryType, utf8decode) { - if (data === undefined) { - return err; - } - // String data - if (typeof data === 'string') { - if (data.charAt(0) === 'b') { - return exports.decodeBase64Packet(data.substr(1), binaryType); - } - - if (utf8decode) { - data = tryDecode(data); - if (data === false) { - return err; - } - } - var type = data.charAt(0); - - if (Number(type) != type || !packetslist[type]) { - return err; - } - - if (data.length > 1) { - return { type: packetslist[type], data: data.substring(1) }; - } else { - return { type: packetslist[type] }; - } - } - - var asArray = new Uint8Array(data); - var type = asArray[0]; - var rest = sliceBuffer(data, 1); - if (Blob && binaryType === 'blob') { - rest = new Blob([rest]); - } - return { type: packetslist[type], data: rest }; - }; - - function tryDecode(data) { - try { - data = utf8.decode(data, { strict: false }); - } catch (e) { - return false; - } - return data; - } - - /** - * Decodes a packet encoded in a base64 string - * - * @param {String} base64 encoded message - * @return {Object} with `type` and `data` (if any) - */ - - exports.decodeBase64Packet = function(msg, binaryType) { - var type = packetslist[msg.charAt(0)]; - if (!base64encoder) { - return { type: type, data: { base64: true, data: msg.substr(1) } }; - } - - var data = base64encoder.decode(msg.substr(1)); - - if (binaryType === 'blob' && Blob) { - data = new Blob([data]); - } - - return { type: type, data: data }; - }; - - /** - * Encodes multiple messages (payload). - * - * :data - * - * Example: - * - * 11:hello world2:hi - * - * If any contents are binary, they will be encoded as base64 strings. Base64 - * encoded strings are marked with a b before the length specifier - * - * @param {Array} packets - * @api private - */ - - exports.encodePayload = function (packets, supportsBinary, callback) { - if (typeof supportsBinary === 'function') { - callback = supportsBinary; - supportsBinary = null; - } - - var isBinary = hasBinary(packets); - - if (supportsBinary && isBinary) { - if (Blob && !dontSendBlobs) { - return exports.encodePayloadAsBlob(packets, callback); - } - - return exports.encodePayloadAsArrayBuffer(packets, callback); - } - - if (!packets.length) { - return callback('0:'); - } - - function setLengthHeader(message) { - return message.length + ':' + message; - } - - function encodeOne(packet, doneCallback) { - exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { - doneCallback(null, setLengthHeader(message)); - }); - } - - map(packets, encodeOne, function(err, results) { - return callback(results.join('')); - }); - }; - - /** - * Async array map using after - */ - - function map(ary, each, done) { - var result = new Array(ary.length); - var next = after(ary.length, done); - - var eachWithIndex = function(i, el, cb) { - each(el, function(error, msg) { - result[i] = msg; - cb(error, result); - }); - }; - - for (var i = 0; i < ary.length; i++) { - eachWithIndex(i, ary[i], next); - } - } - - /* - * Decodes data when a payload is maybe expected. Possible binary contents are - * decoded from their base64 representation - * - * @param {String} data, callback method - * @api public - */ - - exports.decodePayload = function (data, binaryType, callback) { - if (typeof data !== 'string') { - return exports.decodePayloadAsBinary(data, binaryType, callback); - } - - if (typeof binaryType === 'function') { - callback = binaryType; - binaryType = null; - } - - var packet; - if (data === '') { - // parser error - ignoring payload - return callback(err, 0, 1); - } - - var length = '', n, msg; - - for (var i = 0, l = data.length; i < l; i++) { - var chr = data.charAt(i); - - if (chr !== ':') { - length += chr; - continue; - } - - if (length === '' || (length != (n = Number(length)))) { - // parser error - ignoring payload - return callback(err, 0, 1); - } - - msg = data.substr(i + 1, n); - - if (length != msg.length) { - // parser error - ignoring payload - return callback(err, 0, 1); - } - - if (msg.length) { - packet = exports.decodePacket(msg, binaryType, false); - - if (err.type === packet.type && err.data === packet.data) { - // parser error in individual packet - ignoring payload - return callback(err, 0, 1); - } - - var ret = callback(packet, i + n, l); - if (false === ret) return; - } - - // advance cursor - i += n; - length = ''; - } - - if (length !== '') { - // parser error - ignoring payload - return callback(err, 0, 1); - } - - }; - - /** - * Encodes multiple messages (payload) as binary. - * - * <1 = binary, 0 = string>[...] - * - * Example: - * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers - * - * @param {Array} packets - * @return {ArrayBuffer} encoded payload - * @api private - */ - - exports.encodePayloadAsArrayBuffer = function(packets, callback) { - if (!packets.length) { - return callback(new ArrayBuffer(0)); - } - - function encodeOne(packet, doneCallback) { - exports.encodePacket(packet, true, true, function(data) { - return doneCallback(null, data); - }); - } - - map(packets, encodeOne, function(err, encodedPackets) { - var totalLength = encodedPackets.reduce(function(acc, p) { - var len; - if (typeof p === 'string'){ - len = p.length; - } else { - len = p.byteLength; - } - return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 - }, 0); - - var resultArray = new Uint8Array(totalLength); - - var bufferIndex = 0; - encodedPackets.forEach(function(p) { - var isString = typeof p === 'string'; - var ab = p; - if (isString) { - var view = new Uint8Array(p.length); - for (var i = 0; i < p.length; i++) { - view[i] = p.charCodeAt(i); - } - ab = view.buffer; - } - - if (isString) { // not true binary - resultArray[bufferIndex++] = 0; - } else { // true binary - resultArray[bufferIndex++] = 1; - } - - var lenStr = ab.byteLength.toString(); - for (var i = 0; i < lenStr.length; i++) { - resultArray[bufferIndex++] = parseInt(lenStr[i]); - } - resultArray[bufferIndex++] = 255; - - var view = new Uint8Array(ab); - for (var i = 0; i < view.length; i++) { - resultArray[bufferIndex++] = view[i]; - } - }); - - return callback(resultArray.buffer); - }); - }; - - /** - * Encode as Blob - */ - - exports.encodePayloadAsBlob = function(packets, callback) { - function encodeOne(packet, doneCallback) { - exports.encodePacket(packet, true, true, function(encoded) { - var binaryIdentifier = new Uint8Array(1); - binaryIdentifier[0] = 1; - if (typeof encoded === 'string') { - var view = new Uint8Array(encoded.length); - for (var i = 0; i < encoded.length; i++) { - view[i] = encoded.charCodeAt(i); - } - encoded = view.buffer; - binaryIdentifier[0] = 0; - } - - var len = (encoded instanceof ArrayBuffer) - ? encoded.byteLength - : encoded.size; - - var lenStr = len.toString(); - var lengthAry = new Uint8Array(lenStr.length + 1); - for (var i = 0; i < lenStr.length; i++) { - lengthAry[i] = parseInt(lenStr[i]); - } - lengthAry[lenStr.length] = 255; - - if (Blob) { - var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); - doneCallback(null, blob); - } - }); - } - - map(packets, encodeOne, function(err, results) { - return callback(new Blob(results)); - }); - }; - - /* - * Decodes data when a payload is maybe expected. Strings are decoded by - * interpreting each byte as a key code for entries marked to start with 0. See - * description of encodePayloadAsBinary - * - * @param {ArrayBuffer} data, callback method - * @api public - */ - - exports.decodePayloadAsBinary = function (data, binaryType, callback) { - if (typeof binaryType === 'function') { - callback = binaryType; - binaryType = null; - } - - var bufferTail = data; - var buffers = []; - - while (bufferTail.byteLength > 0) { - var tailArray = new Uint8Array(bufferTail); - var isString = tailArray[0] === 0; - var msgLength = ''; - - for (var i = 1; ; i++) { - if (tailArray[i] === 255) break; - - // 310 = char length of Number.MAX_VALUE - if (msgLength.length > 310) { - return callback(err, 0, 1); - } - - msgLength += tailArray[i]; - } - - bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); - msgLength = parseInt(msgLength); - - var msg = sliceBuffer(bufferTail, 0, msgLength); - if (isString) { - try { - msg = String.fromCharCode.apply(null, new Uint8Array(msg)); - } catch (e) { - // iPhone Safari doesn't let you apply to typed arrays - var typed = new Uint8Array(msg); - msg = ''; - for (var i = 0; i < typed.length; i++) { - msg += String.fromCharCode(typed[i]); - } - } - } - - buffers.push(msg); - bufferTail = sliceBuffer(bufferTail, msgLength); - } - - var total = buffers.length; - buffers.forEach(function(buffer, i) { - callback(exports.decodePacket(buffer, binaryType, true), i, total); - }); - }; - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - - /** - * Gets the keys for an object. - * - * @return {Array} keys - * @api private - */ - - module.exports = Object.keys || function keys (obj){ - var arr = []; - var has = Object.prototype.hasOwnProperty; - - for (var i in obj) { - if (has.call(obj, i)) { - arr.push(i); - } - } - return arr; - }; - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {/* global Blob File */ - - /* - * Module requirements. - */ - - var isArray = __webpack_require__(11); - - var toString = Object.prototype.toString; - var withNativeBlob = typeof global.Blob === 'function' || toString.call(global.Blob) === '[object BlobConstructor]'; - var withNativeFile = typeof global.File === 'function' || toString.call(global.File) === '[object FileConstructor]'; - - /** - * Module exports. - */ - - module.exports = hasBinary; - - /** - * Checks for binary data. - * - * Supports Buffer, ArrayBuffer, Blob and File. - * - * @param {Object} anything - * @api public - */ - - function hasBinary (obj) { - if (!obj || typeof obj !== 'object') { - return false; - } - - if (isArray(obj)) { - for (var i = 0, l = obj.length; i < l; i++) { - if (hasBinary(obj[i])) { - return true; - } - } - return false; - } - - if ((typeof global.Buffer === 'function' && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) || - (typeof global.ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || - (withNativeBlob && obj instanceof Blob) || - (withNativeFile && obj instanceof File) - ) { - return true; - } - - // see: https://github.com/Automattic/has-binary/pull/4 - if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { - return hasBinary(obj.toJSON(), true); - } - - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { - return true; - } - } - - return false; - } - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - var toString = {}.toString; - - module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; - }; - - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - /** - * An abstraction for slicing an arraybuffer even when - * ArrayBuffer.prototype.slice is not supported - * - * @api public - */ - - module.exports = function(arraybuffer, start, end) { - var bytes = arraybuffer.byteLength; - start = start || 0; - end = end || bytes; - - if (arraybuffer.slice) { return arraybuffer.slice(start, end); } - - if (start < 0) { start += bytes; } - if (end < 0) { end += bytes; } - if (end > bytes) { end = bytes; } - - if (start >= bytes || start >= end || bytes === 0) { - return new ArrayBuffer(0); - } - - var abv = new Uint8Array(arraybuffer); - var result = new Uint8Array(end - start); - for (var i = start, ii = 0; i < end; i++, ii++) { - result[ii] = abv[i]; - } - return result.buffer; - }; - - -/***/ }, -/* 13 */ -/***/ function(module, exports) { - - module.exports = after - - function after(count, callback, err_cb) { - var bail = false - err_cb = err_cb || noop - proxy.count = count - - return (count === 0) ? callback() : proxy - - function proxy(err, result) { - if (proxy.count <= 0) { - throw new Error('after called too many times') - } - --proxy.count - - // after first error, rest are passed to err_cb - if (err) { - bail = true - callback(err) - // future error callbacks will go to error handler - callback = err_cb - } else if (proxy.count === 0 && !bail) { - callback(null, result) - } - } - } - - function noop() {} - - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/utf8js v2.1.2 by @mathias */ - ;(function(root) { - - // Detect free variables `exports` - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module` - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root` - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - var stringFromCharCode = String.fromCharCode; - - // Taken from https://mths.be/punycode - function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - var value; - var extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - // Taken from https://mths.be/punycode - function ucs2encode(array) { - var length = array.length; - var index = -1; - var value; - var output = ''; - while (++index < length) { - value = array[index]; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - } - return output; - } - - function checkScalarValue(codePoint, strict) { - if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { - if (strict) { - throw Error( - 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + - ' is not a scalar value' - ); - } - return false; - } - return true; - } - /*--------------------------------------------------------------------------*/ - - function createByte(codePoint, shift) { - return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); - } - - function encodeCodePoint(codePoint, strict) { - if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence - return stringFromCharCode(codePoint); - } - var symbol = ''; - if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence - symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); - } - else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence - if (!checkScalarValue(codePoint, strict)) { - codePoint = 0xFFFD; - } - symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); - symbol += createByte(codePoint, 6); - } - else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence - symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); - symbol += createByte(codePoint, 12); - symbol += createByte(codePoint, 6); - } - symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); - return symbol; - } - - function utf8encode(string, opts) { - opts = opts || {}; - var strict = false !== opts.strict; - - var codePoints = ucs2decode(string); - var length = codePoints.length; - var index = -1; - var codePoint; - var byteString = ''; - while (++index < length) { - codePoint = codePoints[index]; - byteString += encodeCodePoint(codePoint, strict); - } - return byteString; - } - - /*--------------------------------------------------------------------------*/ - - function readContinuationByte() { - if (byteIndex >= byteCount) { - throw Error('Invalid byte index'); - } - - var continuationByte = byteArray[byteIndex] & 0xFF; - byteIndex++; - - if ((continuationByte & 0xC0) == 0x80) { - return continuationByte & 0x3F; - } - - // If we end up here, it’s not a continuation byte - throw Error('Invalid continuation byte'); - } - - function decodeSymbol(strict) { - var byte1; - var byte2; - var byte3; - var byte4; - var codePoint; - - if (byteIndex > byteCount) { - throw Error('Invalid byte index'); - } - - if (byteIndex == byteCount) { - return false; - } - - // Read first byte - byte1 = byteArray[byteIndex] & 0xFF; - byteIndex++; - - // 1-byte sequence (no continuation bytes) - if ((byte1 & 0x80) == 0) { - return byte1; - } - - // 2-byte sequence - if ((byte1 & 0xE0) == 0xC0) { - byte2 = readContinuationByte(); - codePoint = ((byte1 & 0x1F) << 6) | byte2; - if (codePoint >= 0x80) { - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 3-byte sequence (may include unpaired surrogates) - if ((byte1 & 0xF0) == 0xE0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; - if (codePoint >= 0x0800) { - return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 4-byte sequence - if ((byte1 & 0xF8) == 0xF0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - byte4 = readContinuationByte(); - codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | - (byte3 << 0x06) | byte4; - if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { - return codePoint; - } - } - - throw Error('Invalid UTF-8 detected'); - } - - var byteArray; - var byteCount; - var byteIndex; - function utf8decode(byteString, opts) { - opts = opts || {}; - var strict = false !== opts.strict; - - byteArray = ucs2decode(byteString); - byteCount = byteArray.length; - byteIndex = 0; - var codePoints = []; - var tmp; - while ((tmp = decodeSymbol(strict)) !== false) { - codePoints.push(tmp); - } - return ucs2encode(codePoints); - } - - /*--------------------------------------------------------------------------*/ - - var utf8 = { - 'version': '2.1.2', - 'encode': utf8encode, - 'decode': utf8decode - }; - - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - true - ) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return utf8; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = utf8; - } else { // in Narwhal or RingoJS v0.7.0- - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - for (var key in utf8) { - hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); - } - } - } else { // in Rhino or a web browser - root.utf8 = utf8; - } - - }(this)); - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)(module), (function() { return this; }()))) - -/***/ }, -/* 15 */ -/***/ function(module, exports) { - - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } - - -/***/ }, -/* 16 */ -/***/ function(module, exports) { - - /* - * base64-arraybuffer - * https://github.com/niklasvh/base64-arraybuffer - * - * Copyright (c) 2012 Niklas von Hertzen - * Licensed under the MIT license. - */ - (function(){ - "use strict"; - - var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - // Use a lookup table to find the index. - var lookup = new Uint8Array(256); - for (var i = 0; i < chars.length; i++) { - lookup[chars.charCodeAt(i)] = i; - } - - exports.encode = function(arraybuffer) { - var bytes = new Uint8Array(arraybuffer), - i, len = bytes.length, base64 = ""; - - for (i = 0; i < len; i+=3) { - base64 += chars[bytes[i] >> 2]; - base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; - base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; - base64 += chars[bytes[i + 2] & 63]; - } - - if ((len % 3) === 2) { - base64 = base64.substring(0, base64.length - 1) + "="; - } else if (len % 3 === 1) { - base64 = base64.substring(0, base64.length - 2) + "=="; - } - - return base64; - }; - - exports.decode = function(base64) { - var bufferLength = base64.length * 0.75, - len = base64.length, i, p = 0, - encoded1, encoded2, encoded3, encoded4; - - if (base64[base64.length - 1] === "=") { - bufferLength--; - if (base64[base64.length - 2] === "=") { - bufferLength--; - } - } - - var arraybuffer = new ArrayBuffer(bufferLength), - bytes = new Uint8Array(arraybuffer); - - for (i = 0; i < len; i+=4) { - encoded1 = lookup[base64.charCodeAt(i)]; - encoded2 = lookup[base64.charCodeAt(i+1)]; - encoded3 = lookup[base64.charCodeAt(i+2)]; - encoded4 = lookup[base64.charCodeAt(i+3)]; - - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - - return arraybuffer; - }; - })(); - - -/***/ }, -/* 17 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {/** - * Create a blob builder even when vendor prefixes exist - */ - - var BlobBuilder = global.BlobBuilder - || global.WebKitBlobBuilder - || global.MSBlobBuilder - || global.MozBlobBuilder; - - /** - * Check if Blob constructor is supported - */ - - var blobSupported = (function() { - try { - var a = new Blob(['hi']); - return a.size === 2; - } catch(e) { - return false; - } - })(); - - /** - * Check if Blob constructor supports ArrayBufferViews - * Fails in Safari 6, so we need to map to ArrayBuffers there. - */ - - var blobSupportsArrayBufferView = blobSupported && (function() { - try { - var b = new Blob([new Uint8Array([1,2])]); - return b.size === 2; - } catch(e) { - return false; - } - })(); - - /** - * Check if BlobBuilder is supported - */ - - var blobBuilderSupported = BlobBuilder - && BlobBuilder.prototype.append - && BlobBuilder.prototype.getBlob; - - /** - * Helper function that maps ArrayBufferViews to ArrayBuffers - * Used by BlobBuilder constructor and old browsers that didn't - * support it in the Blob constructor. - */ - - function mapArrayBufferViews(ary) { - for (var i = 0; i < ary.length; i++) { - var chunk = ary[i]; - if (chunk.buffer instanceof ArrayBuffer) { - var buf = chunk.buffer; - - // if this is a subarray, make a copy so we only - // include the subarray region from the underlying buffer - if (chunk.byteLength !== buf.byteLength) { - var copy = new Uint8Array(chunk.byteLength); - copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); - buf = copy.buffer; - } - - ary[i] = buf; - } - } - } - - function BlobBuilderConstructor(ary, options) { - options = options || {}; - - var bb = new BlobBuilder(); - mapArrayBufferViews(ary); - - for (var i = 0; i < ary.length; i++) { - bb.append(ary[i]); - } - - return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); - }; - - function BlobConstructor(ary, options) { - mapArrayBufferViews(ary); - return new Blob(ary, options || {}); - }; - - module.exports = (function() { - if (blobSupported) { - return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; - } else if (blobBuilderSupported) { - return BlobBuilderConstructor; - } else { - return undefined; - } - })(); - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - - /** - * Expose `Emitter`. - */ - - if (true) { - module.exports = Emitter; - } - - /** - * Initialize a new `Emitter`. - * - * @api public - */ - - function Emitter(obj) { - if (obj) return mixin(obj); - }; - - /** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - - function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; - } - - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.on = - Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; - }; - - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; - }; - - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.off = - Emitter.prototype.removeListener = - Emitter.prototype.removeAllListeners = - Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; - }; - - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - - Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks['$' + event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; - }; - - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - - Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; - }; - - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - - Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; - }; - - -/***/ }, -/* 19 */ -/***/ function(module, exports) { - - /** - * Compiles a querystring - * Returns string representation of the object - * - * @param {Object} - * @api private - */ - - exports.encode = function (obj) { - var str = ''; - - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - if (str.length) str += '&'; - str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); - } - } - - return str; - }; - - /** - * Parses a simple querystring into an object - * - * @param {String} qs - * @api private - */ - - exports.decode = function(qs){ - var qry = {}; - var pairs = qs.split('&'); - for (var i = 0, l = pairs.length; i < l; i++) { - var pair = pairs[i].split('='); - qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); - } - return qry; - }; - - -/***/ }, -/* 20 */ -/***/ function(module, exports) { - - - module.exports = function(a, b){ - var fn = function(){}; - fn.prototype = b.prototype; - a.prototype = new fn; - a.prototype.constructor = a; - }; - -/***/ }, -/* 21 */ -/***/ function(module, exports) { - - 'use strict'; - - var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') - , length = 64 - , map = {} - , seed = 0 - , i = 0 - , prev; - - /** - * Return a string representing the specified number. - * - * @param {Number} num The number to convert. - * @returns {String} The string representation of the number. - * @api public - */ - function encode(num) { - var encoded = ''; - - do { - encoded = alphabet[num % length] + encoded; - num = Math.floor(num / length); - } while (num > 0); - - return encoded; - } - - /** - * Return the integer value specified by the given string. - * - * @param {String} str The string to convert. - * @returns {Number} The integer value represented by the string. - * @api public - */ - function decode(str) { - var decoded = 0; - - for (i = 0; i < str.length; i++) { - decoded = decoded * length + map[str.charAt(i)]; - } - - return decoded; - } - - /** - * Yeast: A tiny growing id generator. - * - * @returns {String} A unique id. - * @api public - */ - function yeast() { - var now = encode(+new Date()); - - if (now !== prev) return seed = 0, prev = now; - return now +'.'+ encode(seed++); - } - - // - // Map each character to its index. - // - for (; i < length; i++) map[alphabet[i]] = i; - - // - // Expose the `yeast`, `encode` and `decode` functions. - // - yeast.encode = encode; - yeast.decode = decode; - module.exports = yeast; - - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - - exports = module.exports = __webpack_require__(24); - exports.log = log; - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - - /** - * Colors. - */ - - exports.colors = [ - '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', - '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', - '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', - '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', - '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', - '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', - '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', - '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', - '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', - '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', - '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' - ]; - - /** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - - function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { - return true; - } - - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - // is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); - } - - /** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - - exports.formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (err) { - return '[UnexpectedJSONParseError]: ' + err.message; - } - }; - - - /** - * Colorize log arguments if enabled. - * - * @api public - */ - - function formatArgs(args) { - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return; - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit') - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - } - - /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); - } - - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} - } - - /** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; - } - - /** - * Enable namespaces listed in `localStorage.debug` initially. - */ - - exports.enable(load()); - - /** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - function localstorage() { - try { - return window.localStorage; - } catch (e) {} - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(23))) - -/***/ }, -/* 23 */ -/***/ function(module, exports) { - - // shim for using process in browser - var process = module.exports = {}; - - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { return [] } - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { return 0; }; - - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - - exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = __webpack_require__(25); - - /** - * Active `debug` instances. - */ - exports.instances = []; - - /** - * The currently active debug mode names, and names to skip. - */ - - exports.names = []; - exports.skips = []; - - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - exports.formatters = {}; - - /** - * Select a color. - * @param {String} namespace - * @return {Number} - * @api private - */ - - function selectColor(namespace) { - var hash = 0, i; - - for (i in namespace) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return exports.colors[Math.abs(hash) % exports.colors.length]; - } - - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - - var prevTime; - - function debug() { - // disabled? - if (!debug.enabled) return; - - var self = debug; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // turn the `arguments` into a proper Array - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %O - args.unshift('%O'); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // apply env-specific formatting (colors, etc.) - exports.formatArgs.call(self, args); - - var logFn = debug.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = exports.enabled(namespace); - debug.useColors = exports.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - - // env-specific initialization logic for debug instances - if ('function' === typeof exports.init) { - exports.init(debug); - } - - exports.instances.push(debug); - - return debug; - } - - function destroy () { - var index = exports.instances.indexOf(this); - if (index !== -1) { - exports.instances.splice(index, 1); - return true; - } else { - return false; - } - } - - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - function enable(namespaces) { - exports.save(namespaces); - - exports.names = []; - exports.skips = []; - - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < exports.instances.length; i++) { - var instance = exports.instances[i]; - instance.enabled = exports.enabled(instance.namespace); - } - } - - /** - * Disable debug output. - * - * @api public - */ - - function disable() { - exports.enable(''); - } - - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; - } - - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; - } - - -/***/ }, -/* 25 */ -/***/ function(module, exports) { - - /** - * Helpers. - */ - - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - - module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); - }; - - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } - } - - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - function fmtShort(ms) { - if (ms >= d) { - return Math.round(ms / d) + 'd'; - } - if (ms >= h) { - return Math.round(ms / h) + 'h'; - } - if (ms >= m) { - return Math.round(ms / m) + 'm'; - } - if (ms >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; - } - - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - function fmtLong(ms) { - return plural(ms, d, 'day') || - plural(ms, h, 'hour') || - plural(ms, m, 'minute') || - plural(ms, s, 'second') || - ms + ' ms'; - } - - /** - * Pluralization helper. - */ - - function plural(ms, n, name) { - if (ms < n) { - return; - } - if (ms < n * 1.5) { - return Math.floor(ms / n) + ' ' + name; - } - return Math.ceil(ms / n) + ' ' + name + 's'; - } - - -/***/ }, -/* 26 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - /** - * Module requirements. - */ - - var Polling = __webpack_require__(6); - var inherit = __webpack_require__(20); - - /** - * Module exports. - */ - - module.exports = JSONPPolling; - - /** - * Cached regular expressions. - */ - - var rNewline = /\n/g; - var rEscapedNewline = /\\n/g; - - /** - * Global JSONP callbacks. - */ - - var callbacks; - - /** - * Noop. - */ - - function empty() {} - - /** - * JSONP Polling constructor. - * - * @param {Object} opts. - * @api public - */ - - function JSONPPolling(opts) { - Polling.call(this, opts); - - this.query = this.query || {}; - - // define global callbacks array if not present - // we do this here (lazily) to avoid unneeded global pollution - if (!callbacks) { - // we need to consider multiple engines in the same page - if (!global.___eio) global.___eio = []; - callbacks = global.___eio; - } - - // callback identifier - this.index = callbacks.length; - - // add callback to jsonp global - var self = this; - callbacks.push(function (msg) { - self.onData(msg); - }); - - // append to query string - this.query.j = this.index; - - // prevent spurious errors from being emitted when the window is unloaded - if (global.document && global.addEventListener) { - global.addEventListener('beforeunload', function () { - if (self.script) self.script.onerror = empty; - }, false); - } - } - - /** - * Inherits from Polling. - */ - - inherit(JSONPPolling, Polling); - - /* - * JSONP only supports binary as base64 encoded strings - */ - - JSONPPolling.prototype.supportsBinary = false; - - /** - * Closes the socket. - * - * @api private - */ - - JSONPPolling.prototype.doClose = function () { - if (this.script) { - this.script.parentNode.removeChild(this.script); - this.script = null; - } - - if (this.form) { - this.form.parentNode.removeChild(this.form); - this.form = null; - this.iframe = null; - } - - Polling.prototype.doClose.call(this); - }; - - /** - * Starts a poll cycle. - * - * @api private - */ - - JSONPPolling.prototype.doPoll = function () { - var self = this; - var script = document.createElement('script'); - - if (this.script) { - this.script.parentNode.removeChild(this.script); - this.script = null; - } - - script.async = true; - script.src = this.uri(); - script.onerror = function (e) { - self.onError('jsonp poll error', e); - }; - - var insertAt = document.getElementsByTagName('script')[0]; - if (insertAt) { - insertAt.parentNode.insertBefore(script, insertAt); - } else { - (document.head || document.body).appendChild(script); - } - this.script = script; - - var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); - - if (isUAgecko) { - setTimeout(function () { - var iframe = document.createElement('iframe'); - document.body.appendChild(iframe); - document.body.removeChild(iframe); - }, 100); - } - }; - - /** - * Writes with a hidden iframe. - * - * @param {String} data to send - * @param {Function} called upon flush. - * @api private - */ - - JSONPPolling.prototype.doWrite = function (data, fn) { - var self = this; - - if (!this.form) { - var form = document.createElement('form'); - var area = document.createElement('textarea'); - var id = this.iframeId = 'eio_iframe_' + this.index; - var iframe; - - form.className = 'socketio'; - form.style.position = 'absolute'; - form.style.top = '-1000px'; - form.style.left = '-1000px'; - form.target = id; - form.method = 'POST'; - form.setAttribute('accept-charset', 'utf-8'); - area.name = 'd'; - form.appendChild(area); - document.body.appendChild(form); - - this.form = form; - this.area = area; - } - - this.form.action = this.uri(); - - function complete() { - initIframe(); - fn(); - } - - function initIframe() { - if (self.iframe) { - try { - self.form.removeChild(self.iframe); - } catch (e) { - self.onError('jsonp polling iframe removal error', e); - } - } - - try { - // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) - var html = '\n \n
    \n\n
    \n \n
    \n
    Following to new URL...
    \n
    \n
    \n Following\n \n to \n
    \n
    \n\n \n
    \n
    \n
    \n \n has invited anyone\n you\n to \n
    \n
    \n\n
    \n\n \n
    \n
    \n\n \n
    \n\n \n
    \n\n \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n
    \n\n \n
    \n
    \n
    \n\n \n
    \n
    \n
    \n
    \n"), - help: clean("<% /*\n This is used to show the help when you type /help. Used in\n TogetherJS.localChatMessage().\n\n*/ %>\n/help : this message\n/test : run an automated/randomized test (or stop one that is in progress)\n /test start N : run N times (instead of default 100)\n /test show : show what kind of actions the random test would take (or stop showing)\n /test describe : describe the possible actions (instead of showing them)\n/clear : clear the chat area\n/record : open up a recorder for the session\n/playback URL : play back a session that was recorded (it's up to you to figure out how to host it)\n /playback local:NAME : play a locally saved log\n/savelogs NAME : save the currently recorded logs under NAME (recorder must be open)\n/baseurl : set a local baseUrl to load TogetherJS from, for debugging a development version of TogetherJS.\n/config : override some TogetherJS configuration parameters\n /config VAR VALUE : set TogetherJS.config(\"VAR\", VALUE). VALUE must be a legal Javascript/JSON literal.\n /config clear : remove all overridden configuration\n"), - walkthrough: clean("\n
    \n
    You're using TogetherJS!
    \n\n
    \n
    \n\n
    \n

    \n\t

    TogetherJS is a service for your website that makes it easy to collaborate in real-time on: [site name]

    \n
    \n\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n

    Set up your avatar, name and user color above. If you'd like to update it later, you can click your Profile button.

    \n
    \n
    \n

    \n

    Change your avatar, name and user color using the Profile button.

    \n
    \n
    \n\n
    \n

    \n

    \n

    You can invite more friends to the session by sending the invite link in the TogetherJS dock.

    \n

    \n \n Copy and paste this link into IM or email to invite friends.\n \n \n

    \n

    Send the above link to a friend so they can join your session! You can find this invite link on the TogetherJS dock as well.

    \n
    \n\n
    \n

    \n

    Friends who join your TogetherJS session will appear here. You can click their avatars to see more.

    \n
    \n\n
    \n

    \n

    When your friends join you in your TogetherJS session, you can chat with them here!

    \n
    \n\n
    \n

    \n

    If your browser supports it, click the microphone icon to begin a audio chat. Learn more about this experimental feature here.

    \n
    \n\n
    \n

    \n

    Alright, you're ready to use TogetherJS. Now start collaborating on [site name]!

    \n
    \n\n
    \n \n \n
    \n
    \n
    \n\n
    \n \n
    \n\n
    \n") - }; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('peers',["util", "session", "storage", "require"], function (util, session, storage, require) { - var peers = util.Module("peers"); - var assert = util.assert; - var CHECK_ACTIVITY_INTERVAL = 10*1000; // Every 10 seconds see if someone has gone idle - var IDLE_TIME = 3*60*1000; // Idle time is 3 minutes - var TAB_IDLE_TIME = 2*60*1000; // When you tab away, after two minutes you'll say you are idle - var BYE_TIME = 10*60*1000; // After 10 minutes of inactivity the person is considered to be "gone" - - var ui; - require(["ui"], function (uiModule) { - ui = uiModule; - }); - - var DEFAULT_NICKNAMES = [ - "Friendly Fox", - "Brilliant Beaver", - "Observant Owl", - "Gregarious Giraffe", - "Wild Wolf", - "Silent Seal", - "Wacky Whale", - "Curious Cat", - "Intelligent Iguana" - ]; - - var Peer = util.Class({ - - isSelf: false, - - constructor: function (id, attrs) { - attrs = attrs || {}; - assert(id); - assert(! Peer.peers[id]); - this.id = id; - this.identityId = attrs.identityId || null; - this.status = attrs.status || "live"; - this.idle = attrs.status || "active"; - this.name = attrs.name || null; - this.avatar = attrs.avatar || null; - this.color = attrs.color || "#00FF00"; - this.view = ui.PeerView(this); - this.lastMessageDate = 0; - this.following = attrs.following || false; - Peer.peers[id] = this; - var joined = attrs.joined || false; - if (attrs.fromHelloMessage) { - this.updateFromHello(attrs.fromHelloMessage); - if (attrs.fromHelloMessage.type == "hello") { - joined = true; - } - } - peers.emit("new-peer", this); - if (joined) { - this.view.notifyJoined(); - } - this.view.update(); - }, - - repr: function () { - return "Peer(" + JSON.stringify(this.id) + ")"; - }, - - serialize: function () { - return { - id: this.id, - status: this.status, - idle: this.idle, - url: this.url, - hash: this.hash, - title: this.title, - identityId: this.identityId, - rtcSupported: this.rtcSupported, - name: this.name, - avatar: this.avatar, - color: this.color, - following: this.following - }; - }, - - destroy: function () { - this.view.destroy(); - delete Peer.peers[this.id]; - }, - - updateMessageDate: function (msg) { - if (this.idle == "inactive") { - this.update({idle: "active"}); - } - if (this.status == "bye") { - this.unbye(); - } - this.lastMessageDate = Date.now(); - }, - - updateFromHello: function (msg) { - var urlUpdated = false; - var activeRTC = false; - var identityUpdated = false; - if (msg.url && msg.url != this.url) { - this.url = msg.url; - this.hash = null; - this.title = null; - urlUpdated = true; - } - if (msg.hash != this.hash) { - this.hash = msg.urlHash; - urlUpdated = true; - } - if (msg.title != this.title) { - this.title = msg.title; - urlUpdated = true; - } - if (msg.rtcSupported !== undefined) { - this.rtcSupported = msg.rtcSupported; - } - if (msg.identityId !== undefined) { - this.identityId = msg.identityId; - } - if (msg.name && msg.name != this.name) { - this.name = msg.name; - identityUpdated = true; - } - if (msg.avatar && msg.avatar != this.avatar) { - util.assertValidUrl(msg.avatar); - this.avatar = msg.avatar; - identityUpdated = true; - } - if (msg.color && msg.color != this.color) { - this.color = msg.color; - identityUpdated = true; - } - if (msg.isClient !== undefined) { - this.isCreator = ! msg.isClient; - } - if (this.status != "live") { - this.status = "live"; - peers.emit("status-updated", this); - } - if (this.idle != "active") { - this.idle = "active"; - peers.emit("idle-updated", this); - } - if (msg.rtcSupported) { - peers.emit("rtc-supported", this); - } - if (urlUpdated) { - peers.emit("url-updated", this); - } - if (identityUpdated) { - peers.emit("identity-updated", this); - } - // FIXME: I can't decide if this is the only time we need to emit - // this message (and not .update() or other methods) - if (this.following) { - session.emit("follow-peer", this); - } - }, - - update: function (attrs) { - // FIXME: should probably test that only a couple attributes are settable - // particularly status and idle - if (attrs.idle) { - this.idle = attrs.idle; - } - if (attrs.status) { - this.status = attrs.status; - } - this.view.update(); - }, - - className: function (prefix) { - prefix = prefix || ""; - return prefix + util.safeClassName(this.id); - }, - - bye: function () { - if (this.status != "bye") { - this.status = "bye"; - peers.emit("status-updated", this); - } - this.view.update(); - }, - - unbye: function () { - if (this.status == "bye") { - this.status = "live"; - peers.emit("status-updated", this); - } - this.view.update(); - }, - - nudge: function () { - session.send({ - type: "url-change-nudge", - url: location.href, - to: this.id - }); - }, - - follow: function () { - if (this.following) { - return; - } - peers.getAllPeers().forEach(function (p) { - if (p.following) { - p.unfollow(); - } - }); - this.following = true; - // We have to make sure we remember this, even if we change URLs: - storeSerialization(); - this.view.update(); - session.emit("follow-peer", this); - }, - - unfollow: function () { - this.following = false; - storeSerialization(); - this.view.update(); - } - - }); - - // FIXME: I can't decide where this should actually go, seems weird - // that it is emitted and handled in the same module - session.on("follow-peer", function (peer) { - if (peer.url != session.currentUrl()) { - var url = peer.url; - if (peer.urlHash) { - url += peer.urlHash; - } - location.href = url; - } - }); - - Peer.peers = {}; - - Peer.deserialize = function (obj) { - obj.fromStorage = true; - var peer = Peer(obj.id, obj); - }; - - peers.Self = undefined; - - session.on("start", function () { - if (peers.Self) { - return; - } - /* Same interface as Peer, represents oneself (local user): */ - peers.Self = util.mixinEvents({ - isSelf: true, - id: session.clientId, - identityId: session.identityId, - status: "live", - idle: "active", - name: null, - avatar: null, - color: null, - defaultName: null, - loaded: false, - isCreator: ! session.isClient, - - update: function (attrs) { - var updatePeers = false; - var updateIdle = false; - var updateMsg = {type: "peer-update"}; - if (typeof attrs.name == "string" && attrs.name != this.name) { - this.name = attrs.name; - updateMsg.name = this.name; - if (! attrs.fromLoad) { - storage.settings.set("name", this.name); - updatePeers = true; - } - } - if (attrs.avatar && attrs.avatar != this.avatar) { - util.assertValidUrl(attrs.avatar); - this.avatar = attrs.avatar; - updateMsg.avatar = this.avatar; - if (! attrs.fromLoad) { - storage.settings.set("avatar", this.avatar); - updatePeers = true; - } - } - if (attrs.color && attrs.color != this.color) { - this.color = attrs.color; - updateMsg.color = this.color; - if (! attrs.fromLoad) { - storage.settings.set("color", this.color); - updatePeers = true; - } - } - if (attrs.defaultName && attrs.defaultName != this.defaultName) { - this.defaultName = attrs.defaultName; - if (! attrs.fromLoad) { - storage.settings.set("defaultName", this.defaultName); - updatePeers = true; - } - } - if (attrs.status && attrs.status != this.status) { - this.status = attrs.status; - peers.emit("status-updated", this); - } - if (attrs.idle && attrs.idle != this.idle) { - this.idle = attrs.idle; - updateIdle = true; - peers.emit("idle-updated", this); - } - this.view.update(); - if (updatePeers && ! attrs.fromLoad) { - session.emit("self-updated"); - session.send(updateMsg); - } - if (updateIdle && ! attrs.fromLoad) { - session.send({ - type: "idle-status", - idle: this.idle - }); - } - }, - - className: function (prefix) { - prefix = prefix || ""; - return prefix + "self"; - }, - - _loadFromSettings: function () { - return util.resolveMany( - storage.settings.get("name"), - storage.settings.get("avatar"), - storage.settings.get("defaultName"), - storage.settings.get("color")).then((function (name, avatar, defaultName, color) { - if (! defaultName) { - defaultName = util.pickRandom(DEFAULT_NICKNAMES); - storage.settings.set("defaultName", defaultName); - } - if (! color) { - color = Math.floor(Math.random() * 0xffffff).toString(16); - while (color.length < 6) { - color = "0" + color; - } - color = "#" + color; - storage.settings.set("color", color); - } - if (! avatar) { - avatar = TogetherJS.baseUrl + "/togetherjs/images/default-avatar.png"; - } - this.update({ - name: name, - avatar: avatar, - defaultName: defaultName, - color: color, - fromLoad: true - }); - peers._SelfLoaded.resolve(); - }).bind(this)); // FIXME: ignoring error - }, - - _loadFromApp: function () { - // FIXME: I wonder if these should be optionally functions? - // We could test typeof==function to distinguish between a getter and a concrete value - var getUserName = TogetherJS.config.get("getUserName"); - var getUserColor = TogetherJS.config.get("getUserColor"); - var getUserAvatar = TogetherJS.config.get("getUserAvatar"); - var name, color, avatar; - if (getUserName) { - if (typeof getUserName == "string") { - name = getUserName; - } else { - name = getUserName(); - } - if (name && typeof name != "string") { - // FIXME: test for HTML safe? Not that we require it, but - // <>'s are probably a sign something is wrong. - console.warn("Error in getUserName(): should return a string (got", name, ")"); - name = null; - } - } - if (getUserColor) { - if (typeof getUserColor == "string") { - color = getUserColor; - } else { - color = getUserColor(); - } - if (color && typeof color != "string") { - // FIXME: would be nice to test for color-ness here. - console.warn("Error in getUserColor(): should return a string (got", color, ")"); - color = null; - } - } - if (getUserAvatar) { - if (typeof getUserAvatar == "string") { - avatar = getUserAvatar; - } else { - avatar = getUserAvatar(); - } - if (avatar && typeof avatar != "string") { - console.warn("Error in getUserAvatar(): should return a string (got", avatar, ")"); - avatar = null; - } - } - if (name || color || avatar) { - this.update({ - name: name, - color: color, - avatar: avatar - }); - } - } - }); - - peers.Self.view = ui.PeerView(peers.Self); - storage.tab.get("peerCache").then(deserialize); - peers.Self._loadFromSettings().then(function() { - peers.Self._loadFromApp(); - peers.Self.view.update(); - session.emit("self-updated"); - }); - }); - - session.on("refresh-user-data", function () { - if (peers.Self) { - peers.Self._loadFromApp(); - } - }); - - TogetherJS.config.track( - "getUserName", - TogetherJS.config.track( - "getUserColor", - TogetherJS.config.track( - "getUserAvatar", - function () { - if (peers.Self) { - peers.Self._loadFromApp(); - } - } - ) - ) - ); - - peers._SelfLoaded = util.Deferred(); - - function serialize() { - var peers = []; - util.forEachAttr(Peer.peers, function (peer) { - peers.push(peer.serialize()); - }); - return { - peers: peers - }; - } - - function deserialize(obj) { - if (! obj) { - return; - } - obj.peers.forEach(function (peer) { - Peer.deserialize(peer); - }); - } - - peers.getPeer = function getPeer(id, message) { - assert(id); - var peer = Peer.peers[id]; - if (id === session.clientId) { - return peers.Self; - } - if (message && ! peer) { - peer = Peer(id, {fromHelloMessage: message}); - return peer; - } - assert(peer, "No peer with id:", id); - if (message && - (message.type == "hello" || message.type == "hello-back" || - message.type == "peer-update")) { - peer.updateFromHello(message); - peer.view.update(); - } - return Peer.peers[id]; - }; - - peers.getAllPeers = function (liveOnly) { - var result = []; - util.forEachAttr(Peer.peers, function (peer) { - if (liveOnly && peer.status != "live") { - return; - } - result.push(peer); - }); - return result; - }; - - function checkActivity() { - var ps = peers.getAllPeers(); - var now = Date.now(); - ps.forEach(function (p) { - if (p.idle == "active" && now - p.lastMessageDate > IDLE_TIME) { - p.update({idle: "inactive"}); - } - if (p.status != "bye" && now - p.lastMessageDate > BYE_TIME) { - p.bye(); - } - }); - } - - session.hub.on("bye", function (msg) { - var peer = peers.getPeer(msg.clientId); - peer.bye(); - }); - - var checkActivityTask = null; - - session.on("start", function () { - if (checkActivityTask) { - console.warn("Old peers checkActivityTask left over?"); - clearTimeout(checkActivityTask); - } - checkActivityTask = setInterval(checkActivity, CHECK_ACTIVITY_INTERVAL); - }); - - session.on("close", function () { - util.forEachAttr(Peer.peers, function (peer) { - peer.destroy(); - }); - storage.tab.set("peerCache", undefined); - clearTimeout(checkActivityTask); - checkActivityTask = null; - }); - - var tabIdleTimeout = null; - - session.on("visibility-change", function (hidden) { - if (hidden) { - if (tabIdleTimeout) { - clearTimeout(tabIdleTimeout); - } - tabIdleTimeout = setTimeout(function () { - peers.Self.update({idle: "inactive"}); - }, TAB_IDLE_TIME); - } else { - if (tabIdleTimeout) { - clearTimeout(tabIdleTimeout); - } - if (peers.Self.idle == "inactive") { - peers.Self.update({idle: "active"}); - } - } - }); - - session.hub.on("idle-status", function (msg) { - msg.peer.update({idle: msg.idle}); - }); - - // Pings are a straight alive check, and contain no more information: - session.hub.on("ping", function () { - session.send({type: "ping-back"}); - }); - - window.addEventListener("pagehide", function () { - // FIXME: not certain if this should be tab local or not: - storeSerialization(); - }, false); - - function storeSerialization() { - storage.tab.set("peerCache", serialize()); - } - - util.mixinEvents(peers); - - util.testExpose({ - setIdleTime: function (time) { - IDLE_TIME = time; - CHECK_ACTIVITY_INTERVAL = time / 2; - if (TogetherJS.running) { - clearTimeout(checkActivityTask); - checkActivityTask = setInterval(checkActivity, CHECK_ACTIVITY_INTERVAL); - } - } - }); - - util.testExpose({ - setByeTime: function (time) { - BYE_TIME = time; - CHECK_ACTIVITY_INTERVAL = Math.min(CHECK_ACTIVITY_INTERVAL, time / 2); - if (TogetherJS.running) { - clearTimeout(checkActivityTask); - checkActivityTask = setInterval(checkActivity, CHECK_ACTIVITY_INTERVAL); - } - } - }); - - return peers; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ -define('windowing',["jquery", "util", "peers", "session"], function ($, util, peers, session) { - var assert = util.assert; - var windowing = util.Module("windowing"); - var $window = $(window); - // This is also in togetherjs.less, under .togetherjs-animated - var ANIMATION_DURATION = 1000; - - /* Displays one window. A window must already exist. This hides other windows, and - positions the window according to its data-bound-to attributes */ - windowing.show = function (element, options) { - element = $(element); - options = options || {}; - options.bind = options.bind || element.attr("data-bind-to"); - var notification = element.hasClass("togetherjs-notification"); - var modal = element.hasClass("togetherjs-modal"); - if (options.bind) { - options.bind = $(options.bind); - } - windowing.hide(); - element.stop(); - element.show(); - // In addition to being hidden, the window can be faded out, which we want to undo: - element.css({opacity: "1"}); - if (options.bind) { - assert(! modal, "Binding does not currently work with modals"); - bind(element, options.bind); - } - if (notification) { - element.slideIn(); - } else if (! modal) { - element.popinWindow(); - } - if (modal) { - getModalBackground().show(); - modalEscape.bind(); - } - onClose = options.onClose || null; - session.emit("display-window", element.attr("id"), element); - }; - - var onClose = null; - - /* Moves a window to be attached to data-bind-to, e.g., the button - that opened the window. Or you can provide an element that it should bind to. */ - function bind(win, bound) { - if ($.browser.mobile) { - return; - } - win = $(win); - assert(bound.length, "Cannot find binding:", bound.selector, "from:", win.selector); - // FIXME: hardcoding - var ifacePos = "right"; - //var ifacePos = panelPosition(); - var boundPos = bound.offset(); - boundPos.height = bound.height(); - boundPos.width = bound.width(); - var windowHeight = $window.height(); - boundPos.top -= $window.scrollTop(); - boundPos.left -= $window.scrollLeft(); - // FIXME: I appear to have to add the padding to the width to get a "true" - // width. But it's still not entirely consistent. - var height = win.height() + 5; - var width = win.width() + 20; - var left, top; - if (ifacePos == "right") { - left = boundPos.left - 11 - width; - top = boundPos.top + (boundPos.height / 2) - (height / 2); - } else if (ifacePos == "left") { - left = boundPos.left + boundPos.width + 15; - top = boundPos.top + (boundPos.height / 2) - (height / 2); - } else if (ifacePos == "bottom") { - left = (boundPos.left + boundPos.width / 2) - (width / 2); - top = boundPos.top - 10 - height; - } - top = Math.min(windowHeight - 10 - height, Math.max(10, top)); - win.css({ - top: top + "px", - left: left + "px" - }); - if (win.hasClass("togetherjs-window")) { - $("#togetherjs-window-pointer-right, #togetherjs-window-pointer-left").hide(); - var pointer = $("#togetherjs-window-pointer-" + ifacePos); - pointer.show(); - if (ifacePos == "right") { - pointer.css({ - top: boundPos.top + Math.floor(boundPos.height / 2) + "px", - left: left + win.width() + 9 + "px" - }); - } else if (ifacePos == "left") { - pointer.css({ - top: boundPos.top + Math.floor(boundPos.height / 2) + "px", - left: (left - 5) + "px" - }); - } else { - console.warn("don't know how to deal with position:", ifacePos); - } - } - win.data("boundTo", bound.selector || "#" + bound.attr("id")); - bound.addClass("togetherjs-active"); - } - - session.on("resize", function () { - var win = $(".togetherjs-modal:visible, .togetherjs-window:visible"); - if (! win.length) { - return; - } - var boundTo = win.data("boundTo"); - if (! boundTo) { - return; - } - boundTo = $(boundTo); - bind(win, boundTo); - }); - - windowing.hide = function (els) { - // FIXME: also hide modals? - els = els || ".togetherjs-window, .togetherjs-modal, .togetherjs-notification"; - els = $(els); - els = els.filter(":visible"); - els.filter(":not(.togetherjs-notification)").hide(); - getModalBackground().hide(); - var windows = []; - els.each(function (index, element) { - element = $(element); - windows.push(element); - var bound = element.data("boundTo"); - if (! bound) { - return; - } - bound = $(bound); - bound.addClass("togetherjs-animated").addClass("togetherjs-color-pulse"); - setTimeout(function () { - bound.removeClass("togetherjs-color-pulse").removeClass("togetherjs-animated"); - }, ANIMATION_DURATION+10); - element.data("boundTo", null); - bound.removeClass("togetherjs-active"); - if (element.hasClass("togetherjs-notification")) { - element.fadeOut().promise().then(function () { - this.hide(); - }); - } - }); - $("#togetherjs-window-pointer-right, #togetherjs-window-pointer-left").hide(); - if (onClose) { - onClose(); - onClose = null; - } - if (windows.length) { - session.emit("hide-window", windows); - } - }; - - windowing.showNotification = function (element, options) { - element = $(element); - options = options || {}; - assert(false); - }; - - windowing.toggle = function (el) { - el = $(el); - if (el.is(":visible")) { - windowing.hide(el); - } else { - windowing.show(el); - } - }; - - function bindEvents(el) { - el.find(".togetherjs-close, .togetherjs-dismiss").click(function (event) { - var w = $(event.target).closest(".togetherjs-window, .togetherjs-modal, .togetherjs-notification"); - windowing.hide(w); - event.stopPropagation(); - return false; - }); - } - - function getModalBackground() { - if (getModalBackground.element) { - return getModalBackground.element; - } - var background = $("#togetherjs-modal-background"); - assert(background.length); - getModalBackground.element = background; - background.click(function () { - windowing.hide(); - }); - return background; - } - - var modalEscape = { - bind: function () { - $(document).keydown(modalEscape.onKeydown); - }, - unbind: function () { - $(document).unbind("keydown", modalEscape.onKeydown); - }, - onKeydown: function (event) { - if (event.which == 27) { - windowing.hide(); - } - } - }; - - session.on("close", function () { - modalEscape.unbind(); - }); - - session.on("new-element", function (el) { - bindEvents(el); - }); - - return windowing; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ -define('templating',["jquery", "util", "peers", "windowing", "session"], function ($, util, peers, windowing, session) { - var assert = util.assert; - var templating = util.Module("templating"); - - templating.clone = function (templateId) { - templateId = "#togetherjs-template-" + templateId; - var template = $(templateId); - assert(template.length, "No template found with id:", templateId); - template = template.clone(); - template.attr("id", null); - // FIXME: if called directly, doesn't emit new-element event: - return template; - }; - - templating.sub = function (templateId, variables) { - var template = templating.clone(templateId); - variables = variables || {}; - util.forEachAttr(variables, function (value, attr) { - // FIXME: do the substitution... somehow? - var subs = template.find(".togetherjs-sub-" + attr).removeClass("togetherjs-sub-" + attr); - if (subs.length) { - if (typeof value == "string") { - subs.text(value); - } else if (value instanceof $) { - subs.append(value); - } else { - assert(false, "Unknown variable value type:", attr, "=", value); - } - } - var ifs = template.find(".togetherjs-if-" + attr).removeClass("togetherjs-sub-" + attr); - if (! value) { - ifs.hide(); - } - ifs = template.find(".togetherjs-ifnot-" + attr).removeClass("togetherjs-ifnot-" + attr); - if (value) { - ifs.hide(); - } - var attrName = "data-togetherjs-subattr-" + attr; - var attrs = template.find("[" + attrName + "]"); - attrs.each(function (index, element) { - assert(typeof value == "string"); - element = $(element); - var subAttribute = element.attr(attrName); - element.attr(attrName, null); - element.attr(subAttribute, value); - }); - }); - if (variables.peer) { - variables.peer.view.setElement(template); - } - if (variables.date) { - var date = variables.date; - if (typeof date == "number") { - date = new Date(date); - } - var ampm = "AM"; - var hour = date.getHours(); - if (hour > 12) { - hour -= 12; - ampm = "PM"; - } - var minute = date.getMinutes(); - var t = hour + ":"; - if (minute < 10) { - t += "0"; - } - t += minute; - template.find(".togetherjs-time").text(t); - template.find(".togetherjs-ampm").text(ampm); - } - - // FIXME: silly this is on session: - session.emit("new-element", template); - return template; - }; - - return templating; -}); - -define('linkify',[], function () { - // FIXME: this could be moved to a different module, it's pretty stand-alone - /* Finds any links in the text of an element (or its children) and turns them - into anchors (with target=_blank) */ - function linkify(el) { - if (el.jquery) { - el = el[0]; - } - el.normalize(); - function linkifyNode(node) { - var _len = node.childNodes.length; - for (var i=0; i<_len; i++) { - if (node.childNodes[i].nodeType == document.ELEMENT_NODE) { - linkifyNode(node.childNodes[i]); - } - } - var texts = []; - for (i=0; i<_len; i++) { - if (node.childNodes[i].nodeType == document.TEXT_NODE) { - texts.push(node.childNodes[i]); - } - } - texts.forEach(function (item) { - if (item.nodeType == document.ELEMENT_NODE) { - linkifyNode(item); - } else if (item.nodeType == document.TEXT_NODE) { - while (true) { - var text = item.nodeValue; - var regex = /\bhttps?:\/\/[a-z0-9\.\-_](:\d+)?[^ \n\t<>()\[\]]*/i; - var match = regex.exec(text); - if (! match) { - break; - } - var leadingNode = document.createTextNode(text.substr(0, match.index)); - node.replaceChild(leadingNode, item); - var anchor = document.createElement("a"); - anchor.setAttribute("target", "_blank"); - anchor.href = match[0]; - anchor.appendChild(document.createTextNode(match[0])); - node.insertBefore(anchor, leadingNode.nextSibling); - var trailing = document.createTextNode(text.substr(match.index + match[0].length)); - node.insertBefore(trailing, anchor.nextSibling); - item = trailing; - } - } - }); - } - linkifyNode(el); - return el; - } - - return linkify; -}); - -// TinyColor v0.9.13 -// https://github.com/bgrins/TinyColor -// 2012-11-28, Brian Grinstead, MIT License - -(function(root) { - -var trimLeft = /^[\s,#]+/, - trimRight = /\s+$/, - tinyCounter = 0, - math = Math, - mathRound = math.round, - mathMin = math.min, - mathMax = math.max, - mathRandom = math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - - // If input is already a tinycolor, return itself - if (typeof color == "object" && color.hasOwnProperty("_tc_id")) { - return color; - } - - var rgb = inputToRGB(color); - var r = rgb.r, - g = rgb.g, - b = rgb.b, - a = rgb.a, - roundA = mathRound(100*a) / 100, - format = rgb.format; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (r < 1) { r = mathRound(r); } - if (g < 1) { g = mathRound(g); } - if (b < 1) { b = mathRound(b); } - - return { - ok: rgb.ok, - format: format, - _tc_id: tinyCounter++, - alpha: a, - toHsv: function() { - var hsv = rgbToHsv(r, g, b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(r, g, b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(r, g, b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: a }; - }, - toHslString: function() { - var hsl = rgbToHsl(r, g, b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ roundA + ")"; - }, - toHex: function() { - return rgbToHex(r, g, b); - }, - toHexString: function() { - return '#' + rgbToHex(r, g, b); - }, - toRgb: function() { - return { r: mathRound(r), g: mathRound(g), b: mathRound(b), a: a }; - }, - toRgbString: function() { - return (a == 1) ? - "rgb(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ")" : - "rgba(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ", " + roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(r, 255) * 100) + "%", g: mathRound(bound01(g, 255) * 100) + "%", b: mathRound(bound01(b, 255) * 100) + "%", a: a }; - }, - toPercentageRgbString: function() { - return (a == 1) ? - "rgb(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%, " + roundA + ")"; - }, - toName: function() { - return hexNames[rgbToHex(r, g, b)] || false; - }, - toFilter: function() { - var hex = rgbToHex(r, g, b); - var secondHex = hex; - var alphaHex = Math.round(parseFloat(a) * 255).toString(16); - var secondAlphaHex = alphaHex; - var gradientType = opts && opts.gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex = s.toHex(); - secondAlphaHex = Math.round(parseFloat(s.alpha) * 255).toString(16); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr=#" + pad2(alphaHex) + hex + ",endColorstr=#" + pad2(secondAlphaHex) + secondHex + ")"; - }, - toString: function(format) { - format = format || this.format; - var formattedString = false; - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex") { - formattedString = this.toHexString(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - } - }; -} - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - newColor[i] = convertToPercentage(color[i]); - } - color = newColor; - } - - return tinycolor(color); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 255, g: 255, b: 255 }; - var a = 1; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } - - if (typeof color == "object") { - if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) { - color.s = convertToPercentage(color.s); - color.v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, color.s, color.v); - ok = true; - format = "hsv"; - } - else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) { - color.s = convertToPercentage(color.s); - color.l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, color.s, color.l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = parseFloat(a); - - // Handle invalid alpha characters by setting to 1 - if (isNaN(a) || a < 0 || a > 1) { - a = 1; - } - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - - -// Conversion Functions -// -------------------- - -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic - } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - - h /= 6; - } - - return { h: h, s: s, l: l }; -} - -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } - - if(s === 0) { - r = g = b = l; // achromatic - } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic - } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { - - h = bound01(h, 360) * 6; - s = bound01(s, 100); - v = bound01(v, 100); - - var i = math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b) { - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - if (hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); - } - - return hex.join(""); -} - -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); -}; - - -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// - - -tinycolor.desaturate = function (color, amount) { - var hsl = tinycolor(color).toHsl(); - hsl.s -= ((amount || 10) / 100); - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -}; -tinycolor.saturate = function (color, amount) { - var hsl = tinycolor(color).toHsl(); - hsl.s += ((amount || 10) / 100); - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -}; -tinycolor.greyscale = function(color) { - return tinycolor.desaturate(color, 100); -}; -tinycolor.lighten = function(color, amount) { - var hsl = tinycolor(color).toHsl(); - hsl.l += ((amount || 10) / 100); - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -}; -tinycolor.darken = function (color, amount) { - var hsl = tinycolor(color).toHsl(); - hsl.l -= ((amount || 10) / 100); - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -}; -tinycolor.complement = function(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -}; - - -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// - -tinycolor.triad = function(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -}; -tinycolor.tetrad = function(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -}; -tinycolor.splitcomplement = function(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; -}; -tinycolor.analogous = function(color, results, slices) { - results = results || 6; - slices = slices || 30; - - var hsl = tinycolor(color).toHsl(); - var part = 360 / slices; - var ret = [tinycolor(color)]; - - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); - } - return ret; -}; -tinycolor.monochromatic = function(color, results) { - results = results || 6; - var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; - var ret = []; - var modification = 1 / results; - - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; - } - - return ret; -}; -// Readability based on W3C recommendations: http://www.w3.org/TR/AERT#color-contrast -// Returns object with two properties: -// .brightness: the difference in brightness between the two colors -// .color: the difference in color/hue between the two colors -// An "acceptable" color is considered to have a brightness difference of 125 and a -// color difference of 500 -tinycolor.readability = function(color1, color2) { - var a = tinycolor(color1).toRgb(), b = tinycolor(color2).toRgb(); - var brightnessA = (a.r * 299 + a.g * 587 + a.b * 114) / 1000; - var brightnessB = (b.r * 299 + b.g * 587 + b.b * 114) / 1000; - var colorDiff = ( - Math.max(a.r, b.r) - Math.min(a.r, b.r) + - Math.max(a.g, b.g) - Math.min(a.g, b.g) + - Math.max(a.b, b.b) - Math.min(a.b, b.b)); - return { - brightness: Math.abs(brightnessA - brightnessB), - color: colorDiff - }; -}; -// True if using color1 over color2 (or vice versa) is "readable" -// Based on: http://www.w3.org/TR/AERT#color-contrast -// Example: -// tinycolor.readable("#000", "#111") => false -tinycolor.readable = function(color1, color2) { - var readability = tinycolor.readability(color1, color2); - return readability.brightness > 125 && readability.color > 500; -}; -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Example: -// tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000" -tinycolor.mostReadable = function(baseColor, colorList) { - var bestColor; - var bestScore = 0; - var bestIsReadable = false; - for (var i=0; i < colorList.length; i++) { - var readability = tinycolor.readability(baseColor, colorList[i]); - var readable = readability.brightness > 125 && readability.color > 500; - // We normalize both around the "acceptable" breaking point, - // but rank brightness constrast higher than hue. Why? I'm - // not sure, seems reasonable. - var score = 3 * (readability.brightness / 125) + (readability.color / 500); - if ((readable && ! bestIsReadable) || - (readable && bestIsReadable && score > bestScore) || - ((! readable) && (! bestIsReadable) && score > bestScore)) { - bestIsReadable = readable; - bestScore = score; - bestColor = colorList[i]; - } - } - return bestColor; -}; - - -// Big List of Colors -// --------- -// -var names = tinycolor.names = { - aliceblue: "f0f8ff", - antiquewhite: "faebd7", - aqua: "0ff", - aquamarine: "7fffd4", - azure: "f0ffff", - beige: "f5f5dc", - bisque: "ffe4c4", - black: "000", - blanchedalmond: "ffebcd", - blue: "00f", - blueviolet: "8a2be2", - brown: "a52a2a", - burlywood: "deb887", - burntsienna: "ea7e5d", - cadetblue: "5f9ea0", - chartreuse: "7fff00", - chocolate: "d2691e", - coral: "ff7f50", - cornflowerblue: "6495ed", - cornsilk: "fff8dc", - crimson: "dc143c", - cyan: "0ff", - darkblue: "00008b", - darkcyan: "008b8b", - darkgoldenrod: "b8860b", - darkgray: "a9a9a9", - darkgreen: "006400", - darkgrey: "a9a9a9", - darkkhaki: "bdb76b", - darkmagenta: "8b008b", - darkolivegreen: "556b2f", - darkorange: "ff8c00", - darkorchid: "9932cc", - darkred: "8b0000", - darksalmon: "e9967a", - darkseagreen: "8fbc8f", - darkslateblue: "483d8b", - darkslategray: "2f4f4f", - darkslategrey: "2f4f4f", - darkturquoise: "00ced1", - darkviolet: "9400d3", - deeppink: "ff1493", - deepskyblue: "00bfff", - dimgray: "696969", - dimgrey: "696969", - dodgerblue: "1e90ff", - firebrick: "b22222", - floralwhite: "fffaf0", - forestgreen: "228b22", - fuchsia: "f0f", - gainsboro: "dcdcdc", - ghostwhite: "f8f8ff", - gold: "ffd700", - goldenrod: "daa520", - gray: "808080", - green: "008000", - greenyellow: "adff2f", - grey: "808080", - honeydew: "f0fff0", - hotpink: "ff69b4", - indianred: "cd5c5c", - indigo: "4b0082", - ivory: "fffff0", - khaki: "f0e68c", - lavender: "e6e6fa", - lavenderblush: "fff0f5", - lawngreen: "7cfc00", - lemonchiffon: "fffacd", - lightblue: "add8e6", - lightcoral: "f08080", - lightcyan: "e0ffff", - lightgoldenrodyellow: "fafad2", - lightgray: "d3d3d3", - lightgreen: "90ee90", - lightgrey: "d3d3d3", - lightpink: "ffb6c1", - lightsalmon: "ffa07a", - lightseagreen: "20b2aa", - lightskyblue: "87cefa", - lightslategray: "789", - lightslategrey: "789", - lightsteelblue: "b0c4de", - lightyellow: "ffffe0", - lime: "0f0", - limegreen: "32cd32", - linen: "faf0e6", - magenta: "f0f", - maroon: "800000", - mediumaquamarine: "66cdaa", - mediumblue: "0000cd", - mediumorchid: "ba55d3", - mediumpurple: "9370db", - mediumseagreen: "3cb371", - mediumslateblue: "7b68ee", - mediumspringgreen: "00fa9a", - mediumturquoise: "48d1cc", - mediumvioletred: "c71585", - midnightblue: "191970", - mintcream: "f5fffa", - mistyrose: "ffe4e1", - moccasin: "ffe4b5", - navajowhite: "ffdead", - navy: "000080", - oldlace: "fdf5e6", - olive: "808000", - olivedrab: "6b8e23", - orange: "ffa500", - orangered: "ff4500", - orchid: "da70d6", - palegoldenrod: "eee8aa", - palegreen: "98fb98", - paleturquoise: "afeeee", - palevioletred: "db7093", - papayawhip: "ffefd5", - peachpuff: "ffdab9", - peru: "cd853f", - pink: "ffc0cb", - plum: "dda0dd", - powderblue: "b0e0e6", - purple: "800080", - red: "f00", - rosybrown: "bc8f8f", - royalblue: "4169e1", - saddlebrown: "8b4513", - salmon: "fa8072", - sandybrown: "f4a460", - seagreen: "2e8b57", - seashell: "fff5ee", - sienna: "a0522d", - silver: "c0c0c0", - skyblue: "87ceeb", - slateblue: "6a5acd", - slategray: "708090", - slategrey: "708090", - snow: "fffafa", - springgreen: "00ff7f", - steelblue: "4682b4", - tan: "d2b48c", - teal: "008080", - thistle: "d8bfd8", - tomato: "ff6347", - turquoise: "40e0d0", - violet: "ee82ee", - wheat: "f5deb3", - white: "fff", - whitesmoke: "f5f5f5", - yellow: "ff0", - yellowgreen: "9acd32" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); - - -// Utilities -// --------- - -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } - - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); - - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } - - // Handle floating point rounding errors - if ((math.abs(n - max) < 0.000001)) { - return 1; - } - - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} - -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} - -// Parse an integer into hex -function parseHex(val) { - return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; - } - - return n; -} - -var matchers = (function() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; - - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - - return { - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ - }; -})(); - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { - - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); - var named = false; - if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0 }; - } - - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; - } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; - } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; - } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; - } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; - } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseHex(match[1]), - g: parseHex(match[2]), - b: parseHex(match[3]), - format: named ? "name" : "hex" - }; - } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseHex(match[1] + '' + match[1]), - g: parseHex(match[2] + '' + match[2]), - b: parseHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; - } - - return false; -} - -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define !== "undefined") { - define('tinycolor',[],function () {return tinycolor;}); -} -// Browser: Expose to window -else { - root.tinycolor = tinycolor; -} - -})(this); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('elementFinder',["util", "jquery"], function (util, $) { - var elementFinder = util.Module("elementFinder"); - var assert = util.assert; - - elementFinder.ignoreElement = function ignoreElement(el) { - if (el instanceof $) { - el = el[0]; - } - while (el) { - if ($(el).hasClass("togetherjs")) { - return true; - } - el = el.parentNode; - } - return false; - }; - - elementFinder.elementLocation = function elementLocation(el) { - assert(el !== null, "Got null element"); - if (el instanceof $) { - // a jQuery element - el = el[0]; - } - if (el[0] && el.attr && el[0].nodeType == 1) { - // Or a jQuery element not made by us - el = el[0]; - } - if (el.id) { - return "#" + el.id; - } - if (el.tagName == "BODY") { - return "body"; - } - if (el.tagName == "HEAD") { - return "head"; - } - if (el === document) { - return "document"; - } - var parent = el.parentNode; - if ((! parent) || parent == el) { - console.warn("elementLocation(", el, ") has null parent"); - throw new Error("No locatable parent found"); - } - var parentLocation = elementLocation(parent); - var children = parent.childNodes; - var _len = children.length; - var index = 0; - for (var i=0; i<_len; i++) { - if (children[i] == el) { - break; - } - if (children[i].nodeType == document.ELEMENT_NODE) { - if (children[i].className.indexOf("togetherjs") != -1) { - // Don't count our UI - continue; - } - // Don't count text or comments - index++; - } - } - return parentLocation + ":nth-child(" + (index+1) + ")"; - }; - - elementFinder.CannotFind = util.Class({ - constructor: function CannotFind(location, reason, context) { - this.prefix = ""; - this.location = location; - this.reason = reason; - this.context = context; - }, - toString: function () { - var loc; - try { - loc = elementFinder.elementLocation(this.context); - } catch (e) { - loc = this.context; - } - return ( - "[CannotFind " + this.prefix + - "(" + this.location + "): " + - this.reason + " in " + - loc + "]"); - } - }); - - elementFinder.findElement = function findElement(loc, container) { - // FIXME: should this all just be done with document.querySelector()? - // But no! We can't ignore togetherjs elements with querySelector. - // But maybe! We *could* make togetherjs elements less obtrusive? - container = container || document; - var el, rest; - if (loc === "body") { - return document.body; - } else if (loc === "head") { - return document.head; - } else if (loc === "document") { - return document; - } else if (loc.indexOf("body") === 0) { - el = document.body; - try { - return findElement(loc.substr(("body").length), el); - } catch (e) { - if (e instanceof elementFinder.CannotFind) { - e.prefix = "body" + e.prefix; - } - throw e; - } - } else if (loc.indexOf("head") === 0) { - el = document.head; - try { - return findElement(loc.substr(("head").length), el); - } catch (e) { - if (e instanceof elementFinder.CannotFind) { - e.prefix = "head" + e.prefix; - } - throw e; - } - } else if (loc.indexOf("#") === 0) { - var id; - loc = loc.substr(1); - if (loc.indexOf(":") === -1) { - id = loc; - rest = ""; - } else { - id = loc.substr(0, loc.indexOf(":")); - rest = loc.substr(loc.indexOf(":")); - } - el = document.getElementById(id); - if (! el) { - throw elementFinder.CannotFind("#" + id, "No element by that id", container); - } - if (rest) { - try { - return findElement(rest, el); - } catch (e) { - if (e instanceof elementFinder.CannotFind) { - e.prefix = "#" + id + e.prefix; - } - throw e; - } - } else { - return el; - } - } else if (loc.indexOf(":nth-child(") === 0) { - loc = loc.substr((":nth-child(").length); - if (loc.indexOf(")") == -1) { - throw "Invalid location, missing ): " + loc; - } - var num = loc.substr(0, loc.indexOf(")")); - num = parseInt(num, 10); - var count = num; - loc = loc.substr(loc.indexOf(")") + 1); - var children = container.childNodes; - el = null; - for (var i=0; i height) { - return false; - } - last = el; - }); - if ((! children.length) || (! last)) { - // There are no children, or only inapplicable children - return { - location: elementFinder.elementLocation(start[0]), - offset: height - start.offset().top, - absoluteTop: height, - documentHeight: $(document).height() - }; - } - return search(last, height); - } - return search($(document.body), height); - }; - - elementFinder.pixelForPosition = function (position) { - /* Inverse of elementFinder.elementByPixel */ - if (position.location == "body") { - return position.offset; - } - var el; - try { - el = elementFinder.findElement(position.location); - } catch (e) { - if (e instanceof elementFinder.CannotFind && position.absoluteTop) { - // We don't trust absoluteTop to be quite right locally, so we adjust - // for the total document height differences: - var percent = position.absoluteTop / position.documentHeight; - return $(document).height() * percent; - } - throw e; - } - var top = $(el).offset().top; - // FIXME: maybe here we should test for sanity, like if an element is - // hidden. We can use position.absoluteTop to get a sense of where the - // element roughly should be. If the sanity check failed we'd use - // absoluteTop - return top + position.offset; - }; - - return elementFinder; - -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Loading this module will cause, when TogetherJS is active, the - session object to emit visibility-change with a `hidden` argument - whenever the visibility changes, on browsers where we can detect - it. - */ - -define('visibilityApi',["util", "session"], function (util, session) { - var visibilityApi = util.Module("visibilityApi"); - var hidden; - var visibilityChange; - if (document.hidden !== undefined) { // Opera 12.10 and Firefox 18 and later support - hidden = "hidden"; - visibilityChange = "visibilitychange"; - } else if (document.mozHidden !== undefined) { - hidden = "mozHidden"; - visibilityChange = "mozvisibilitychange"; - } else if (document.msHidden !== undefined) { - hidden = "msHidden"; - visibilityChange = "msvisibilitychange"; - } else if (document.webkitHidden !== undefined) { - hidden = "webkitHidden"; - visibilityChange = "webkitvisibilitychange"; - } - - session.on("start", function () { - document.addEventListener(visibilityChange, change, false); - }); - - session.on("close", function () { - document.removeEventListener(visibilityChange, change, false); - }); - - function change() { - session.emit("visibility-change", document[hidden]); - } - - visibilityApi.hidden = function () { - return document[hidden]; - }; - - return visibilityApi; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('ui',["require", "jquery", "util", "session", "templates", "templating", "linkify", "peers", "windowing", "tinycolor", "elementFinder", "visibilityApi"], function (require, $, util, session, templates, templating, linkify, peers, windowing, tinycolor, elementFinder, visibilityApi) { - var ui = util.Module('ui'); - var assert = util.assert; - var AssertionError = util.AssertionError; - var chat; - var $window = $(window); - // This is also in togetherjs.less, as @button-height: - var BUTTON_HEIGHT = 60 + 1; // 60 is button height, 1 is border - // chat TextArea - var TEXTAREA_LINE_HEIGHT = 20; // in pixels - var TEXTAREA_MAX_LINES = 5; - // This is also in togetherjs.less, under .togetherjs-animated - var ANIMATION_DURATION = 1000; - // Time the new user window sticks around until it fades away: - var NEW_USER_FADE_TIMEOUT = 5000; - // This is set when an animation will keep the UI from being ready - // (until this time): - var finishedAt = null; - // Time in milliseconds for the dock to animate out: - var DOCK_ANIMATION_TIME = 300; - // If two chat messages come from the same person in this time - // (milliseconds) then they are collapsed into one message: - var COLLAPSE_MESSAGE_LIMIT = 5000; - - var COLORS = [ - "#8A2BE2", "#7FFF00", "#DC143C", "#00FFFF", "#8FBC8F", "#FF8C00", "#FF00FF", - "#FFD700", "#F08080", "#90EE90", "#FF6347"]; - - // This would be a circular import, but we just need the chat module sometime - // after everything is loaded, and this is sure to complete by that time: - require(["chat"], function (c) { - chat = c; - }); - - /* Displays some toggleable element; toggleable elements have a - data-toggles attribute that indicates what other elements should - be hidden when this element is shown. */ - ui.displayToggle = function (el) { - el = $(el); - assert(el.length, "No element", arguments[0]); - var other = $(el.attr("data-toggles")); - assert(other.length, "Cannot toggle", el[0], "selector", other.selector); - other.hide(); - el.show(); - }; - - function panelPosition() { - var iface = $("#togetherjs-dock"); - if (iface.hasClass("togetherjs-dock-right")) { - return "right"; - } else if (iface.hasClass("togetherjs-dock-left")) { - return "left"; - } else if (iface.hasClass("togetherjs-dock-bottom")) { - return "bottom"; - } else { - throw new AssertionError("#togetherjs-dock doesn't have positioning class"); - } - } - - ui.container = null; - - // This is used for some signalling when ui.prepareUI and/or - // ui.activateUI is called before the DOM is fully loaded: - var deferringPrepareUI = null; - - function deferForContainer(func) { - /* Defers any calls to func() until after ui.container is set - Function cannot have a return value (as sometimes the call will - become async). Use like: - - method: deferForContainer(function (args) {...}) - */ - return function () { - if (ui.container) { - func.apply(this, arguments); - } - var self = this; - var args = Array.prototype.slice.call(arguments); - session.once("ui-ready", function () { - func.apply(self, args); - }); - }; - } - - // This is called before activateUI; it doesn't bind anything, but does display - // the dock - // FIXME: because this module has lots of requirements we can't do - // this before those requirements are loaded. Maybe worth splitting - // this out? OTOH, in production we should have all the files - // combined so there's not much problem loading those modules. - ui.prepareUI = function () { - if (! (document.readyState == "complete" || document.readyState == "interactive")) { - // Too soon! Wait a sec... - deferringPrepareUI = "deferring"; - document.addEventListener("DOMContentLoaded", function () { - var d = deferringPrepareUI; - deferringPrepareUI = null; - ui.prepareUI(); - // This happens when ui.activateUI is called before the document has been - // loaded: - if (d == "activate") { - ui.activateUI(); - } - }); - return; - } - var container = ui.container = $(templates["interface"]); - assert(container.length); - $("body").append(container); - fixupAvatars(container); - if (session.firstRun && TogetherJS.startTarget) { - // Time at which the UI will be fully ready: - // (We have to do this because the offset won't be quite right - // until the animation finishes - attempts to calculate the - // offset without taking into account CSS transforms have so far - // failed.) - var timeoutSeconds = DOCK_ANIMATION_TIME / 1000; - finishedAt = Date.now() + DOCK_ANIMATION_TIME + 50; - setTimeout(function () { - finishedAt = Date.now() + DOCK_ANIMATION_TIME + 40; - var iface = container.find("#togetherjs-dock"); - var start = iface.offset(); - var pos = $(TogetherJS.startTarget).offset(); - pos.top = Math.floor(pos.top - start.top); - pos.left = Math.floor(pos.left - start.left); - var translate = "translate(" + pos.left + "px, " + pos.top + "px)"; - iface.css({ - MozTransform: translate, - WebkitTransform: translate, - transform: translate, - opacity: "0.0" - }); - setTimeout(function () { - // We keep recalculating because the setTimeout times aren't always so accurate: - finishedAt = Date.now() + DOCK_ANIMATION_TIME + 20; - var transition = "transform " + timeoutSeconds + "s ease-out, "; - transition += "opacity " + timeoutSeconds + "s ease-out"; - iface.css({ - opacity: "1.0", - MozTransition: "-moz-" + transition, - MozTransform: "translate(0, 0)", - WebkitTransition: "-webkit-" + transition, - WebkitTransform: "translate(0, 0)", - transition: transition, - transform: "translate(0, 0)" - }); - setTimeout(function () { - finishedAt = null; - iface.attr("style", ""); - }, 510); - }, 5); - }, 5); - } - if (TogetherJS.startTarget) { - var el = $(TogetherJS.startTarget); - var text = el.text().toLowerCase().replace(/\s+/g, " "); - text = text.replace(/^\s*/, "").replace(/\s*$/, ""); - if (text == "start togetherjs") { - el.attr("data-end-togetherjs-html", "End TogetherJS"); - } - if (el.attr("data-end-togetherjs-html")) { - el.attr("data-start-togetherjs-html", el.html()); - el.html(el.attr("data-end-togetherjs-html")); - } - el.addClass("togetherjs-started"); - } - ui.container.find(".togetherjs-window > header, .togetherjs-modal > header").each(function () { - $(this).append($('')); - }); - - TogetherJS.config.track("disableWebRTC", function (hide, previous) { - if (hide && ! previous) { - ui.container.find("#togetherjs-audio-button").hide(); - adjustDockSize(-1); - } else if ((! hide) && previous) { - ui.container.find("#togetherjs-audio-button").show(); - adjustDockSize(1); - } - }); - - }; - - // After prepareUI, this actually makes the interface live. We have - // to do this later because we call prepareUI when many components - // aren't initialized, so we don't even want the user to be able to - // interact with the interface. But activateUI is called once - // everything is loaded and ready for interaction. - ui.activateUI = function () { - if (deferringPrepareUI) { - console.warn("ui.activateUI called before document is ready; waiting..."); - deferringPrepareUI = "activate"; - return; - } - if (! ui.container) { - ui.prepareUI(); - } - var container = ui.container; - - //create the overlay - if($.browser.mobile) { - // $("body").append( "\x3cdiv class='overlay' style='position: absolute; top: 0; left: 0; background-color: rgba(0,0,0,0); width: 120%; height: 100%; z-index: 1000; margin: -10px'>\x3c/div>" ); - } - - // The share link: - ui.prepareShareLink(container); - container.find("input.togetherjs-share-link").on("keydown", function (event) { - if (event.which == 27) { - windowing.hide("#togetherjs-share"); - return false; - } - return undefined; - }); - session.on("shareId", updateShareLink); - - // The chat input element: - var input = container.find("#togetherjs-chat-input"); - input.bind("keydown", function (event) { - if (event.which == 13 && !event.shiftKey) { // Enter without Shift pressed - submitChat(); - return false; - } - if (event.which == 27) { // Escape - windowing.hide("#togetherjs-chat"); - return false; - } - }); - - function submitChat() { - var val = input.val(); - if ($.trim(val)) { - input.val(""); - // triggering the event manually to avoid the addition of newline character to the textarea: - input.trigger("input").trigger("propertychange"); - chat.submit(val); - } - } - // auto-resize textarea: - input.on("input propertychange", function () { - var $this = $(this); - var actualHeight = $this.height(); - // reset the height of textarea to remove trailing empty space (used for shrinking): - $this.height(TEXTAREA_LINE_HEIGHT); - this.scrollTop = 0; - // scroll to bottom: - this.scrollTop = 9999; - var newHeight = this.scrollTop + $this.height(); - var maxHeight = TEXTAREA_MAX_LINES * TEXTAREA_LINE_HEIGHT; - if (newHeight > maxHeight) { - newHeight = maxHeight; - this.style.overflowY = "scroll"; - } else { - this.style.overflowY = "hidden"; - } - this.style.height = newHeight + "px"; - var diff = newHeight - actualHeight; - $("#togetherjs-chat-input-box").height($("#togetherjs-chat-input-box").height() + diff); - $("#togetherjs-chat-messages").height($("#togetherjs-chat-messages").height() - diff); - return false; - }); - - util.testExpose({submitChat: submitChat}); - - // Moving the window: - // FIXME: this should probably be stickier, and not just move the window around - // so abruptly - var anchor = container.find("#togetherjs-dock-anchor"); - assert(anchor.length); - // FIXME: This is in place to temporarily disable dock dragging: - anchor = container.find("#togetherjs-dock-anchor-disabled"); - anchor.mousedown(function (event) { - var iface = $("#togetherjs-dock"); - // FIXME: switch to .offset() and pageX/Y - var startPos = panelPosition(); - function selectoff() { - return false; - } - function mousemove(event2) { - var fromRight = $window.width() + window.pageXOffset - event2.pageX; - var fromLeft = event2.pageX - window.pageXOffset; - var fromBottom = $window.height() + window.pageYOffset - event2.pageY; - // FIXME: this is to temporarily disable the bottom view: - fromBottom = 10000; - - var pos; - if (fromLeft < fromRight && fromLeft < fromBottom) { - pos = "left"; - } else if (fromRight < fromLeft && fromRight < fromBottom) { - pos = "right"; - } else { - pos = "bottom"; - } - iface.removeClass("togetherjs-dock-left"); - iface.removeClass("togetherjs-dock-right"); - iface.removeClass("togetherjs-dock-bottom"); - iface.addClass("togetherjs-dock-" + pos); - if (startPos && pos != startPos) { - windowing.hide(); - startPos = null; - } - } - $(document).bind("mousemove", mousemove); - // If you don't turn selection off it will still select text, and show a - // text selection cursor: - $(document).bind("selectstart", selectoff); - // FIXME: it seems like sometimes we lose the mouseup event, and it's as though - // the mouse is stuck down: - $(document).one("mouseup", function () { - $(document).unbind("mousemove", mousemove); - $(document).unbind("selectstart", selectoff); - }); - return false; - }); - - function openDock() { - $('.togetherjs-window').animate({ - opacity: 1 - }); - $('#togetherjs-dock-participants').animate({ - opacity: 1 - }); - $('#togetherjs-dock #togetherjs-buttons').animate({ - opacity: 1 - }); - - //for iphone - if($(window).width() < 480) { - $('.togetherjs-dock-right').animate({ - width: "204px" - }, { - duration:60, easing:"linear" - }); - } - - //for ipad - else { - $('.togetherjs-dock-right').animate({ - width: "27%" - }, { - duration:60, easing:"linear" - }); - } - - - // add bg overlay - // $("body").append( "\x3cdiv class='overlay' style='position: absolute; top: 0; left: -2px; background-color: rgba(0,0,0,0.5); width: 200%; height: 400%; z-index: 1000; margin: 0px;'>\x3c/div>" ); - - //disable vertical scrolling - // $("body").css({ - // "position": "fixed", - // top: 0, - // left: 0 - // }); - - //replace the anchor icon - var src = "/togetherjs/images/togetherjs-logo-close.png"; - $("#togetherjs-dock-anchor #togetherjs-dock-anchor-horizontal img").attr("src", src); - } - - function closeDock() { - //enable vertical scrolling - $("body").css({ - "position": "", - top: "", - left: "" - }); - - //replace the anchor icon - var src = "/togetherjs/images/togetherjs-logo-open.png"; - $("#togetherjs-dock-anchor #togetherjs-dock-anchor-horizontal img").attr("src", src); - - $('.togetherjs-window').animate({ - opacity: 0 - }); - $('#togetherjs-dock-participants').animate({ - opacity: 0 - }); - $('#togetherjs-dock #togetherjs-buttons').animate({ - opacity: 0 - }); - $('.togetherjs-dock-right').animate({ - width: "40px" - }, { - duration:60, easing:"linear" - }); - - // remove bg overlay - //$(".overlay").remove(); - } - - // Setting the anchor button + dock mobile actions - if($.browser.mobile) { - - // toggle the audio button - $("#togetherjs-audio-button").click(function () { - windowing.toggle("#togetherjs-rtc-not-supported"); - }); - - // toggle the profile button - $("#togetherjs-profile-button").click(function () { - windowing.toggle("#togetherjs-menu-window"); - }); - - // $("body").append( "\x3cdiv class='overlay' style='position: absolute; top: 0; left: -2px; background-color: rgba(0,0,0,0.5); width: 200%; height: 400%; z-index: 1000; margin: 0px'>\x3c/div>" ); - - //disable vertical scrolling - // $("body").css({ - // "position": "fixed", - // top: 0, - // left: 0 - // }); - - //replace the anchor icon - var src = "/togetherjs/images/togetherjs-logo-close.png"; - $("#togetherjs-dock-anchor #togetherjs-dock-anchor-horizontal img").attr("src", src); - - $("#togetherjs-dock-anchor").toggle(function() { - closeDock(); - },function(){ - openDock(); - }); - } - - $("#togetherjs-share-button").click(function () { - windowing.toggle("#togetherjs-share"); - }); - - $("#togetherjs-profile-button").click(function (event) { - if ($.browser.mobile) { - windowing.show("#togetherjs-menu-window"); - return false; - } - toggleMenu(); - event.stopPropagation(); - return false; - }); - - $("#togetherjs-menu-feedback, #togetherjs-menu-feedback-button").click(function(){ - windowing.hide(); - hideMenu(); - windowing.show("#togetherjs-feedback-form"); - }); - - $("#togetherjs-menu-help, #togetherjs-menu-help-button").click(function () { - windowing.hide(); - hideMenu(); - require(["walkthrough"], function (walkthrough) { - windowing.hide(); - walkthrough.start(false); - }); - }); - - $("#togetherjs-menu-update-name").click(function () { - var input = $("#togetherjs-menu .togetherjs-self-name"); - input.css({ - width: $("#togetherjs-menu").width() - 32 + "px" - }); - ui.displayToggle("#togetherjs-menu .togetherjs-self-name"); - $("#togetherjs-menu .togetherjs-self-name").focus(); - }); - - $("#togetherjs-menu-update-name-button").click(function () { - windowing.show("#togetherjs-edit-name-window"); - $("#togetherjs-edit-name-window input").focus(); - }); - - $("#togetherjs-menu .togetherjs-self-name").bind("keyup change", function (event) { - console.log("alrighty", event); - if (event.which == 13) { - ui.displayToggle("#togetherjs-self-name-display"); - return; - } - var val = $("#togetherjs-menu .togetherjs-self-name").val(); - console.log("values!!", val); - if (val) { - peers.Self.update({name: val}); - } - }); - - $("#togetherjs-menu-update-avatar, #togetherjs-menu-update-avatar-button").click(function () { - hideMenu(); - windowing.show("#togetherjs-avatar-edit"); - }); - - $("#togetherjs-menu-end, #togetherjs-menu-end-button").click(function () { - hideMenu(); - windowing.show("#togetherjs-confirm-end"); - }); - - $("#togetherjs-end-session").click(function () { - session.close(); - //$(".overlay").remove(); - - }); - - $("#togetherjs-menu-update-color").click(function () { - var picker = $("#togetherjs-pick-color"); - if (picker.is(":visible")) { - picker.hide(); - return; - } - picker.show(); - bindPicker(); - picker.find(".togetherjs-swatch-active").removeClass("togetherjs-swatch-active"); - picker.find(".togetherjs-swatch[data-color=\"" + peers.Self.color + "\"]").addClass("togetherjs-swatch-active"); - }); - - $("#togetherjs-pick-color").click(".togetherjs-swatch", function (event) { - var swatch = $(event.target); - var color = swatch.attr("data-color"); - peers.Self.update({ - color: color - }); - event.stopPropagation(); - return false; - }); - - $("#togetherjs-pick-color").click(function (event) { - $("#togetherjs-pick-color").hide(); - event.stopPropagation(); - return false; - }); - - COLORS.forEach(function (color) { - var el = templating.sub("swatch"); - el.attr("data-color", color); - var darkened = tinycolor.darken(color); - el.css({ - backgroundColor: color, - borderColor: darkened - }); - $("#togetherjs-pick-color").append(el); - }); - - $("#togetherjs-chat-button").click(function () { - windowing.toggle("#togetherjs-chat"); - }); - - session.on("display-window", function (id, element) { - if (id == "togetherjs-chat") { - if (! $.browser.mobile) { - $("#togetherjs-chat-input").focus(); - } - } else if (id == "togetherjs-share") { - var link = element.find("input.togetherjs-share-link"); - if (link.is(":visible")) { - link.focus().select(); - } - } - }); - - container.find("#togetherjs-chat-notifier").click(function (event) { - if ($(event.target).is("a") || container.is(".togetherjs-close")) { - return; - } - windowing.show("#togetherjs-chat"); - }); - - // FIXME: Don't think this makes sense - $(".togetherjs header.togetherjs-title").each(function (index, item) { - var button = $(''); - button.click(function (event) { - var window = button.closest(".togetherjs-window"); - windowing.hide(window); - }); - $(item).append(button); - }); - - $("#togetherjs-avatar-done").click(function () { - ui.displayToggle("#togetherjs-no-avatar-edit"); - }); - - $("#togetherjs-self-color").css({backgroundColor: peers.Self.color}); - - var avatar = peers.Self.avatar; - if (avatar) { - $("#togetherjs-self-avatar").attr("src", avatar); - } - - var starterButton = $("#togetherjs-starter button"); - starterButton.click(function () { - windowing.show("#togetherjs-about"); - }).addClass("togetherjs-running"); - if (starterButton.text() == "Start TogetherJS") { - starterButton.attr("data-start-text", starterButton.text()); - starterButton.text("End TogetherJS Session"); - } - - ui.activateAvatarEdit(container, { - onSave: function () { - windowing.hide("#togetherjs-avatar-edit"); - } - }); - - TogetherJS.config.track("inviteFromRoom", function (inviter, previous) { - if (inviter) { - container.find("#togetherjs-invite").show(); - } else { - container.find("#togetherjs-invite").hide(); - } - }); - - container.find("#togetherjs-menu-refresh-invite").click(refreshInvite); - container.find("#togetherjs-menu-invite-anyone").click(function () { - invite(null); - }); - - // The following lines should be at the end of this function - // (new code goes above) - session.emit("new-element", ui.container); - - if (finishedAt && finishedAt > Date.now()) { - setTimeout(function () { - finishedAt = null; - session.emit("ui-ready", ui); - }, finishedAt - Date.now()); - } else { - session.emit("ui-ready", ui); - } - - }; // End ui.activateUI() - - ui.activateAvatarEdit = function (container, options) { - options = options || {}; - var pendingImage = null; - - container.find(".togetherjs-avatar-save").prop("disabled", true); - - container.find(".togetherjs-avatar-save").click(function () { - if (pendingImage) { - peers.Self.update({avatar: pendingImage}); - container.find(".togetherjs-avatar-save").prop("disabled", true); - if (options.onSave) { - options.onSave(); - } - } - }); - - container.find(".togetherjs-upload-avatar").on("change", function () { - util.readFileImage(this).then(function (url) { - sizeDownImage(url).then(function (smallUrl) { - pendingImage = smallUrl; - container.find(".togetherjs-avatar-preview").css({ - backgroundImage: 'url(' + pendingImage + ')' - }); - container.find(".togetherjs-avatar-save").prop("disabled", false); - if (options.onPending) { - options.onPending(); - } - }); - }); - }); - - }; - - function sizeDownImage(imageUrl) { - return util.Deferred(function (def) { - var $canvas = $(""); - $canvas[0].height = session.AVATAR_SIZE; - $canvas[0].width = session.AVATAR_SIZE; - var context = $canvas[0].getContext("2d"); - var img = new Image(); - img.src = imageUrl; - // Sometimes the DOM updates immediately to call - // naturalWidth/etc, and sometimes it doesn't; using setTimeout - // gives it a chance to catch up - setTimeout(function () { - var width = img.naturalWidth || img.width; - var height = img.naturalHeight || img.height; - width = width * (session.AVATAR_SIZE / height); - height = session.AVATAR_SIZE; - context.drawImage(img, 0, 0, width, height); - def.resolve($canvas[0].toDataURL("image/png")); - }); - }); - } - - function fixupAvatars(container) { - /* All
    elements need an element inside, - so we add that element here */ - container.find(".togetherjs-person").each(function () { - var $this = $(this); - var inner = $this.find(".togetherjs-person-avatar-swatch"); - if (! inner.length) { - $this.append('
    '); - } - }); - } - - ui.prepareShareLink = function (container) { - container.find("input.togetherjs-share-link").click(function () { - $(this).select(); - }).change(function () { - updateShareLink(); - }); - container.find("a.togetherjs-share-link").click(function () { - // FIXME: this is currently opening up Bluetooth, not sharing a link - if (false && window.MozActivity) { - var activity = new MozActivity({ - name: "share", - data: { - type: "url", - url: $(this).attr("href") - } - }); - } - // FIXME: should show some help if you actually try to follow the link - // like this, instead of simply suppressing it - return false; - }); - updateShareLink(); - }; - - // Menu - - function showMenu(event) { - var el = $("#togetherjs-menu"); - assert(el.length); - el.show(); - bindMenu(); - $(document).bind("click", maybeHideMenu); - } - - function bindMenu() { - var el = $("#togetherjs-menu:visible"); - if (el.length) { - var bound = $("#togetherjs-profile-button"); - var boundOffset = bound.offset(); - el.css({ - top: boundOffset.top + bound.height() - $window.scrollTop() + "px", - left: (boundOffset.left + bound.width() - 10 - el.width() - $window.scrollLeft()) + "px" - }); - } - } - - function bindPicker() { - var picker = $("#togetherjs-pick-color:visible"); - if (picker.length) { - var menu = $("#togetherjs-menu-update-color"); - var menuOffset = menu.offset(); - picker.css({ - top: menuOffset.top + menu.height(), - left: menuOffset.left - }); - } - } - - session.on("resize", function () { - bindMenu(); - bindPicker(); - }); - - function toggleMenu() { - if ($("#togetherjs-menu").is(":visible")) { - hideMenu(); - } else { - showMenu(); - } - } - - function hideMenu() { - var el = $("#togetherjs-menu"); - el.hide(); - $(document).unbind("click", maybeHideMenu); - ui.displayToggle("#togetherjs-self-name-display"); - $("#togetherjs-pick-color").hide(); - } - - function maybeHideMenu(event) { - var t = event.target; - while (t) { - if (t.id == "togetherjs-menu") { - // Click inside the menu, ignore this - return; - } - t = t.parentNode; - } - hideMenu(); - } - - function adjustDockSize(buttons) { - /* Add or remove spots from the dock; positive number to - add button(s), negative number to remove button(s) - */ - assert(typeof buttons == "number"); - assert(buttons && Math.floor(buttons) == buttons); - var iface = $("#togetherjs-dock"); - var newHeight = iface.height() + (BUTTON_HEIGHT * buttons); - assert(newHeight >= BUTTON_HEIGHT * 3, "Height went too low (", newHeight, - "), should never be less than 3 buttons high (", BUTTON_HEIGHT * 3, ")"); - iface.css({ - height: newHeight + "px" - }); - } - - // Misc - - function updateShareLink() { - var input = $("input.togetherjs-share-link"); - var link = $("a.togetherjs-share-link"); - var display = $("#togetherjs-session-id"); - if (! session.shareId) { - input.val(""); - link.attr("href", "#"); - display.text("(none)"); - } else { - input.val(session.shareUrl()); - link.attr("href", session.shareUrl()); - display.text(session.shareId); - } - } - - session.on("close", function () { - - if($.browser.mobile) { - // remove bg overlay - //$(".overlay").remove(); - - //after hitting End, reset window draggin - $("body").css({ - "position": "", - top: "", - left: "" - }); - - } - - if (ui.container) { - ui.container.remove(); - ui.container = null; - } - // Clear out any other spurious elements: - $(".togetherjs").remove(); - var starterButton = $("#togetherjs-starter button"); - starterButton.removeClass("togetherjs-running"); - if (starterButton.attr("data-start-text")) { - starterButton.text(starterButton.attr("data-start-text")); - starterButton.attr("data-start-text", ""); - } - if (TogetherJS.startTarget) { - var el = $(TogetherJS.startTarget); - if (el.attr("data-start-togetherjs-html")) { - el.html(el.attr("data-start-togetherjs-html")); - } - el.removeClass("togetherjs-started"); - } - }); - - ui.chat = { - text: function (attrs) { - assert(typeof attrs.text == "string"); - assert(attrs.peer); - assert(attrs.messageId); - var date = attrs.date || Date.now(); - var lastEl = ui.container.find("#togetherjs-chat .togetherjs-chat-message"); - if (lastEl.length) { - lastEl = $(lastEl[lastEl.length-1]); - } - var lastDate = null; - if (lastEl) { - lastDate = parseInt(lastEl.attr("data-date"), 10); - } - if (lastEl && lastEl.attr("data-person") == attrs.peer.id && - lastDate && date < lastDate + COLLAPSE_MESSAGE_LIMIT) { - lastEl.attr("data-date", date); - var content = lastEl.find(".togetherjs-chat-content"); - assert(content.length); - attrs.text = content.text() + "\n" + attrs.text; - attrs.messageId = lastEl.attr("data-message-id"); - lastEl.remove(); - } - var el = templating.sub("chat-message", { - peer: attrs.peer, - content: attrs.text, - date: date - }); - linkify(el.find(".togetherjs-chat-content")); - el.attr("data-person", attrs.peer.id) - .attr("data-date", date) - .attr("data-message-id", attrs.messageId); - ui.chat.add(el, attrs.messageId, attrs.notify); - }, - - joinedSession: function (attrs) { - assert(attrs.peer); - var date = attrs.date || Date.now(); - var el = templating.sub("chat-joined", { - peer: attrs.peer, - date: date - }); - // FIXME: should bind the notification to the dock location - ui.chat.add(el, attrs.peer.className("join-message-"), 4000); - }, - - leftSession: function (attrs) { - assert(attrs.peer); - var date = attrs.date || Date.now(); - var el = templating.sub("chat-left", { - peer: attrs.peer, - date: date, - declinedJoin: attrs.declinedJoin - }); - // FIXME: should bind the notification to the dock location - ui.chat.add(el, attrs.peer.className("join-message-"), 4000); - }, - - system: function (attrs) { - assert(! attrs.peer); - assert(typeof attrs.text == "string"); - var date = attrs.date || Date.now(); - var el = templating.sub("chat-system", { - content: attrs.text, - date: date - }); - ui.chat.add(el, undefined, true); - }, - - clear: deferForContainer(function () { - var container = ui.container.find("#togetherjs-chat-messages"); - container.empty(); - }), - - urlChange: function (attrs) { - assert(attrs.peer); - assert(typeof attrs.url == "string"); - assert(typeof attrs.sameUrl == "boolean"); - var messageId = attrs.peer.className("url-change-"); - // FIXME: duplicating functionality in .add(): - var realId = "togetherjs-chat-" + messageId; - var date = attrs.date || Date.now(); - var title; - // FIXME: strip off common domain from msg.url? E.g., if I'm on - // http://example.com/foobar, and someone goes to http://example.com/baz then - // show only /baz - // FIXME: truncate long titles - if (attrs.title) { - title = attrs.title + " (" + attrs.url + ")"; - } else { - title = attrs.url; - } - var el = templating.sub("url-change", { - peer: attrs.peer, - date: date, - href: attrs.url, - title: title, - sameUrl: attrs.sameUrl - }); - el.find(".togetherjs-nudge").click(function () { - attrs.peer.nudge(); - return false; - }); - el.find(".togetherjs-follow").click(function () { - var url = attrs.peer.url; - if (attrs.peer.urlHash) { - url += attrs.peer.urlHash; - } - location.href = url; - }); - var notify = ! attrs.sameUrl; - if (attrs.sameUrl && ! $("#" + realId).length) { - // Don't bother showing a same-url notification, if no previous notification - // had been shown - return; - } - ui.chat.add(el, messageId, notify); - }, - - invite: function (attrs) { - assert(attrs.peer); - assert(typeof attrs.url == "string"); - var messageId = attrs.peer.className("invite-"); - var date = attrs.date || Date.now(); - var hrefTitle = attrs.url.replace(/\#?&togetherjs=.*/, "").replace(/^\w+:\/\//, ""); - var el = templating.sub("invite", { - peer: attrs.peer, - date: date, - href: attrs.url, - hrefTitle: hrefTitle, - forEveryone: attrs.forEveryone - }); - if (attrs.forEveryone) { - el.find("a").click(function () { - // FIXME: hacky way to do this: - chat.submit("Followed link to " + attrs.url); - }); - } - ui.chat.add(el, messageId, true); - }, - - hideTimeout: null, - - add: deferForContainer(function (el, id, notify) { - if (id) { - el.attr("id", "togetherjs-chat-" + util.safeClassName(id)); - } - var container = ui.container.find("#togetherjs-chat-messages"); - assert(container.length); - var popup = ui.container.find("#togetherjs-chat-notifier"); - container.append(el); - ui.chat.scroll(); - var doNotify = !! notify; - var section = popup.find("#togetherjs-chat-notifier-message"); - if (notify && visibilityApi.hidden()) { - ui.container.find("#togetherjs-notification")[0].play(); - } - if (id && section.data("message-id") == id) { - doNotify = true; - } - if (container.is(":visible")) { - doNotify = false; - } - if (doNotify) { - section.empty(); - section.append(el.clone(true, true)); - if (section.data("message-id") != id) { - section.data("message-id", id || ""); - windowing.show(popup); - } else if (! popup.is(":visible")) { - windowing.show(popup); - } - if (typeof notify == "number") { - // This is the amount of time we're supposed to notify - if (this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - this.hideTimeout = setTimeout((function () { - windowing.hide(popup); - this.hideTimeout = null; - }).bind(this), notify); - } - } - }), - - scroll: deferForContainer(function () { - var container = ui.container.find("#togetherjs-chat-messages")[0]; - container.scrollTop = container.scrollHeight; - }) - - }; - - session.on("display-window", function (id, win) { - if (id == "togetherjs-chat") { - ui.chat.scroll(); - windowing.hide("#togetherjs-chat-notifier"); - } - }); - - /* This class is bound to peers.Peer instances as peer.view. - The .update() method is regularly called by peer objects when info changes. */ - ui.PeerView = util.Class({ - - constructor: function (peer) { - assert(peer.isSelf !== undefined, "PeerView instantiated with non-Peer object"); - this.peer = peer; - this.dockClick = this.dockClick.bind(this); - }, - - /* Takes an element and sets any person-related attributes on the element - Different from updates, which use the class names we set here: */ - setElement: function (el) { - var count = 0; - var classes = ["togetherjs-person", "togetherjs-person-status", - "togetherjs-person-name", "togetherjs-person-name-abbrev", - "togetherjs-person-bgcolor", "togetherjs-person-swatch", - "togetherjs-person-status", "togetherjs-person-role", - "togetherjs-person-url", "togetherjs-person-url-title", - "togetherjs-person-bordercolor"]; - classes.forEach(function (cls) { - var els = el.find("." + cls); - els.addClass(this.peer.className(cls + "-")); - count += els.length; - }, this); - if (! count) { - console.warn("setElement(", el, ") doesn't contain any person items"); - } - this.updateDisplay(el); - }, - - updateDisplay: deferForContainer(function (container) { - container = container || ui.container; - var abbrev = this.peer.name; - if (this.peer.isSelf) { - abbrev = "me"; - } - container.find("." + this.peer.className("togetherjs-person-name-")).text(this.peer.name || ""); - container.find("." + this.peer.className("togetherjs-person-name-abbrev-")).text(abbrev); - var avatarEl = container.find("." + this.peer.className("togetherjs-person-")); - if (this.peer.avatar) { - util.assertValidUrl(this.peer.avatar); - avatarEl.css({ - backgroundImage: "url(" + this.peer.avatar + ")" - }); - } - if (this.peer.idle == "inactive") { - avatarEl.addClass("togetherjs-person-inactive"); - } else { - avatarEl.removeClass("togetherjs-person-inactive"); - } - avatarEl.attr("title", this.peer.name); - if (this.peer.color) { - avatarEl.css({ - borderColor: this.peer.color - }); - avatarEl.find(".togetherjs-person-avatar-swatch").css({ - borderTopColor: this.peer.color, - borderRightColor: this.peer.color - }); - } - if (this.peer.color) { - var colors = container.find("." + this.peer.className("togetherjs-person-bgcolor-")); - colors.css({ - backgroundColor: this.peer.color - }); - colors = container.find("." + this.peer.className("togetherjs-person-bordercolor-")); - colors.css({ - borderColor: this.peer.color - }); - } - container.find("." + this.peer.className("togetherjs-person-role-")) - .text(this.peer.isCreator ? "Creator" : "Participant"); - var urlName = this.peer.title || ""; - if (this.peer.title) { - urlName += " ("; - } - urlName += util.truncateCommonDomain(this.peer.url, location.href); - if (this.peer.title) { - urlName += ")"; - } - container.find("." + this.peer.className("togetherjs-person-url-title-")) - .text(urlName); - var url = this.peer.url; - if (this.peer.urlHash) { - url += this.peer.urlHash; - } - container.find("." + this.peer.className("togetherjs-person-url-")) - .attr("href", url); - // FIXME: should have richer status: - container.find("." + this.peer.className("togetherjs-person-status-")) - .text(this.peer.idle == "active" ? "Active" : "Inactive"); - if (this.peer.isSelf) { - // FIXME: these could also have consistent/reliable class names: - var selfName = $(".togetherjs-self-name"); - selfName.each((function (index, el) { - el = $(el); - if (el.val() != this.peer.name) { - el.val(this.peer.name); - } - }).bind(this)); - $("#togetherjs-menu-avatar").attr("src", this.peer.avatar); - if (! this.peer.name) { - $("#togetherjs-menu .togetherjs-person-name-self").text(this.peer.defaultName); - } - } - if (this.peer.url != session.currentUrl()) { - container.find("." + this.peer.className("togetherjs-person-")) - .addClass("togetherjs-person-other-url"); - } else { - container.find("." + this.peer.className("togetherjs-person-")) - .removeClass("togetherjs-person-other-url"); - } - if (this.peer.following) { - if (this.followCheckbox) { - this.followCheckbox.prop("checked", true); - } - } else { - if (this.followCheckbox) { - this.followCheckbox.prop("checked", false); - } - } - // FIXME: add some style based on following? - updateChatParticipantList(); - this.updateFollow(); - }),UPDATEURL - - update: function () { - if (! this.peer.isSelf) { - if (this.peer.status == "live") { - this.dock(); - } else { - this.undock(); - } - } - this.updateDisplay(); - this.updateUrlDisplay(); - }, - - updateUrlDisplay: function (force) { - var url = this.peer.url; - if ((! url) || (url == this._lastUpdateUrlDisplay && ! force)) { - return; - } - this._lastUpdateUrlDisplay = url; - var sameUrl = url == session.currentUrl(); - ui.chat.urlChange({ - peer: this.peer, - url: this.peer.url, - title: this.peer.title, - sameUrl: sameUrl - }); - }, - - urlNudge: function () { - // FIXME: do something more distinct here - this.updateUrlDisplay(true); - }, - - notifyJoined: function () { - ui.chat.joinedSession({ - peer: this.peer - }); - }, - - // when there are too many participants in the dock, consolidate the participants to one avatar, and on mouseOver, the dock expands down to reveal the rest of the participants - // if there are X users in the session - // then hide the users in the dock - // and shrink the size of the dock - // and if you rollover the dock, it expands and reveals the rest of the participants in the dock - - //if users hit X then show the participant button with the consol - - dock: deferForContainer(function () { - - var numberOfUsers = peers.getAllPeers().length; - - // collapse the Dock if too many users - function CollapsedDock() { - // decrease/reset dock height - $("#togetherjs-dock").css("height", 260); - //replace participant button - $("#togetherjs-dock-participants").replaceWith(""); - // new full participant window created on toggle - $("#togetherjs-participantlist-button").click(function () { - windowing.toggle("#togetherjs-participantlist"); - }); - } - - // FIXME: turned off for now - if( numberOfUsers >= 5 && false) { - CollapsedDock(); - } else { - // reset - - } - - - if (this.dockElement) { - return; - } - this.dockElement = templating.sub("dock-person", { - peer: this.peer - }); - this.dockElement.attr("id", this.peer.className("togetherjs-dock-element-")); - ui.container.find("#togetherjs-dock-participants").append(this.dockElement); - this.dockElement.find(".togetherjs-person").animateDockEntry(); - adjustDockSize(1); - this.detailElement = templating.sub("participant-window", { - peer: this.peer - }); - var followId = this.peer.className("togetherjs-person-status-follow-"); - this.detailElement.find('[for="togetherjs-person-status-follow"]').attr("for", followId); - this.detailElement.find('#togetherjs-person-status-follow').attr("id", followId); - this.detailElement.find(".togetherjs-follow").click(function () { - location.href = $(this).attr("href"); - }); - this.detailElement.find(".togetherjs-nudge").click((function () { - this.peer.nudge(); - }).bind(this)); - this.followCheckbox = this.detailElement.find("#" + followId); - this.followCheckbox.change(function () { - if (! this.checked) { - this.peer.unfollow(); - } - // Following doesn't happen until the window is closed - // FIXME: should we tell the user this? - }); - this.maybeHideDetailWindow = this.maybeHideDetailWindow.bind(this); - session.on("hide-window", this.maybeHideDetailWindow); - ui.container.append(this.detailElement); - this.dockElement.click((function () { - if (this.detailElement.is(":visible")) { - windowing.hide(this.detailElement); - } else { - windowing.show(this.detailElement, {bind: this.dockElement}); - this.scrollTo(); - this.cursor().element.animate({ - opacity:0.3 - }).animate({ - opacity:1 - }).animate({ - opacity:0.3 - }).animate({ - opacity:1 - }); - } - }).bind(this)); - this.updateFollow(); - }), - - undock: function () { - if (! this.dockElement) { - return; - } - this.dockElement.animateDockExit().promise().then((function () { - this.dockElement.remove(); - this.dockElement = null; - this.detailElement.remove(); - this.detailElement = null; - adjustDockSize(-1); - }).bind(this)); - }, - - scrollTo: function () { - if (this.peer.url != session.currentUrl()) { - return; - } - var pos = this.peer.scrollPosition; - if (! pos) { - console.warn("Peer has no scroll position:", this.peer); - return; - } - pos = elementFinder.pixelForPosition(pos); - $("html, body").easeTo(pos); - }, - - updateFollow: function () { - if (! this.peer.url) { - return; - } - if (! this.detailElement) { - return; - } - var same = this.detailElement.find(".togetherjs-same-url"); - var different = this.detailElement.find(".togetherjs-different-url"); - if (this.peer.url == session.currentUrl()) { - same.show(); - different.hide(); - } else { - same.hide(); - different.show(); - } - }, - - maybeHideDetailWindow: function (windows) { - if (this.detailElement && windows[0] && windows[0][0] === this.detailElement[0]) { - if (this.followCheckbox[0].checked) { - this.peer.follow(); - } else { - this.peer.unfollow(); - } - } - }, - - dockClick: function () { - // FIXME: scroll to person - }, - - cursor: function () { - return require("cursor").getClient(this.peer.id); - }, - - destroy: function () { - // FIXME: should I get rid of the dockElement? - session.off("hide-window", this.maybeHideDetailWindow); - } - }); - - function updateChatParticipantList() { - var live = peers.getAllPeers(true); - if (live.length) { - ui.displayToggle("#togetherjs-chat-participants"); - $("#togetherjs-chat-participant-list").text( - live.map(function (p) {return p.name;}).join(", ")); - } else { - ui.displayToggle("#togetherjs-chat-no-participants"); - } - } - - function inviteHubUrl() { - var base = TogetherJS.config.get("inviteFromRoom"); - assert(base); - return util.makeUrlAbsolute(base, session.hubUrl()); - } - - var inRefresh = false; - - function refreshInvite() { - if (inRefresh) { - return; - } - inRefresh = true; - require(["who"], function (who) { - var def = who.getList(inviteHubUrl()); - function addUser(user, before) { - var item = templating.sub("invite-user-item", {peer: user}); - item.attr("data-clientid", user.id); - if (before) { - item.insertBefore(before); - } else { - $("#togetherjs-invite-users").append(item); - } - item.click(function() { - invite(user.clientId); - }); - } - function refresh(users, finished) { - var sorted = []; - for (var id in users) { - if (users.hasOwnProperty(id)) { - sorted.push(users[id]); - } - } - sorted.sort(function (a, b) { - return a.name < b.name ? -1 : 1; - }); - var pos = 0; - ui.container.find("#togetherjs-invite-users .togetherjs-menu-item").each(function () { - var $this = $(this); - if (finished && ! users[$this.attr("data-clientid")]) { - $this.remove(); - return; - } - if (pos >= sorted.length) { - return; - } - while (pos < sorted.length && $this.attr("data-clientid") !== sorted[pos].id) { - addUser(sorted[pos], $this); - pos++; - } - while (pos < sorted.length && $this.attr("data-clientid") == sorted[pos].id) { - pos++; - } - }); - for (var i=pos; i= this.logs.length) { - this.unload(); - return; - } - if (this.pos !== 0) { - // First we need to play the hello - var toReplay = []; - var foundHello = false; - for (var i=this.pos-1; i>=0; i--) { - var item = this.logs[i]; - if (ALWAYS_REPLAY[item.type]) { - toReplay.push(item); - } - if (item.type == "hello" || item.type == "hello-back") { - this.playItem(item); - foundHello = true; - break; - } - } - if (! foundHello) { - console.warn("No hello message found before position", this.pos); - } - toReplay.reverse(); - for (i=0; i= this.logs.length) { - this.unload(); - return; - } - var item = this.logs[this.pos]; - this.playItem(item); - this.pos++; - if (this.pos >= this.logs.length) { - this.unload(); - return; - } - var next = this.logs[this.pos]; - var pause = next.date - item.date; - this.playTimer = setTimeout(this.playOne.bind(this), pause); - if (this.fromStorage) { - this.savePos(); - } - }, - - playItem: function (item) { - if (item.type == "hello") { - // We may need to pause here - if (item.url != (location.href+"").replace(/\#.*/, "")) { - this.pause(); - } - } - try { - session._getChannel().onmessage(item); - } catch (e) { - console.warn("Could not play back message:", item, "error:", e); - } - }, - - save: function () { - this.fromStorage = true; - storage.set("playback.logs", this.logs); - this.savePos(); - }, - - savePos: function () { - storage.set("playback.pos", this.pos); - }, - - unload: function () { - if (this.fromStorage) { - storage.set("playback.logs", undefined); - storage.set("playback.pos", undefined); - } - // FIXME: should do a bye message here - } - - }); - - playback.getRunningLogs = function () { - return storage.get("playback.logs").then(function (value) { - if (! value) { - return null; - } - var logs = Logs(value, true); - return storage.get("playback.pos").then(function (pos) { - pos = pos || 0; - logs.pos = pos; - return logs; - }); - }); - }; - - return playback; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*jshint evil:true */ -define('chat',["require", "jquery", "util", "session", "ui", "templates", "playback", "storage", "peers", "windowing"], function (require, $, util, session, ui, templates, playback, storage, peers, windowing) { - var chat = util.Module("chat"); - var assert = util.assert; - var Walkabout; - - session.hub.on("chat", function (msg) { - ui.chat.text({ - text: msg.text, - peer: msg.peer, - // FIXME: a little unsure of trusting this (maybe I should prefix it?) - messageId: msg.messageId, - notify: true - }); - saveChatMessage({ - text: msg.text, - date: Date.now(), - peerId: msg.peer.id, - messageId: msg.messageId - }); - }); - - // FIXME: this doesn't really belong in this module: - session.hub.on("bye", function (msg) { - ui.chat.leftSession({ - peer: msg.peer, - declinedJoin: msg.reason == "declined-join" - }); - }); - - chat.submit = function (message) { - var parts = message.split(/ /); - if (parts[0].charAt(0) == "/") { - var name = parts[0].substr(1).toLowerCase(); - var method = commands["command_" + name]; - if (method) { - method.apply(null, parts.slice(1)); - return; - } - } - var messageId = session.clientId + "-" + Date.now(); - session.send({ - type: "chat", - text: message, - messageId: messageId - }); - ui.chat.text({ - text: message, - peer: peers.Self, - messageId: messageId, - notify: false - }); - saveChatMessage({ - text: message, - date: Date.now(), - peerId: peers.Self.id, - messageId: messageId - }); - }; - - var commands = { - command_help: function () { - var msg = util.trim(templates.help); - ui.chat.system({ - text: msg - }); - }, - - command_test: function (args) { - if (! Walkabout) { - require(["walkabout"], (function (WalkaboutModule) { - Walkabout = WalkaboutModule; - this.command_test(args); - }).bind(this)); - return; - } - args = util.trim(args || "").split(/\s+/g); - if (args[0] === "" || ! args.length) { - if (this._testCancel) { - args = ["cancel"]; - } else { - args = ["start"]; - } - } - if (args[0] == "cancel") { - ui.chat.system({ - text: "Aborting test" - }); - this._testCancel(); - this._testCancel = null; - return; - } - if (args[0] == "start") { - var times = parseInt(args[1], 10); - if (isNaN(times) || ! times) { - times = 100; - } - ui.chat.system({ - text: "Testing with walkabout.js" - }); - var tmpl = $(templates.walkabout); - var container = ui.container.find(".togetherjs-test-container"); - container.empty(); - container.append(tmpl); - container.show(); - var statusContainer = container.find(".togetherjs-status"); - statusContainer.text("starting..."); - this._testCancel = Walkabout.runManyActions({ - ondone: function () { - statusContainer.text("done"); - statusContainer.one("click", function () { - container.hide(); - }); - this._testCancel = null; - }, - onstatus: function (status) { - var note = "actions: " + status.actions.length + " running: " + - (status.times - status.remaining) + " / " + status.times; - statusContainer.text(note); - } - }); - return; - } - if (args[0] == "show") { - if (this._testShow.length) { - this._testShow.forEach(function (item) { - if (item) { - item.remove(); - } - }, this); - this._testShow = []; - } else { - var actions = Walkabout.findActions(); - actions.forEach(function (action) { - this._testShow.push(action.show()); - }, this); - } - return; - } - if (args[0] == "describe") { - Walkabout.findActions().forEach(function (action) { - ui.chat.system({ - text: action.description() - }); - }, this); - return; - } - ui.chat.system({ - text: "Did not understand: " + args.join(" ") - }); - }, - - _testCancel: null, - _testShow: [], - - command_clear: function () { - ui.chat.clear(); - }, - - command_exec: function () { - var expr = Array.prototype.slice.call(arguments).join(" "); - var result; - // We use this to force global eval (not in this scope): - var e = eval; - try { - result = e(expr); - } catch (error) { - ui.chat.system({ - text: "Error: " + error - }); - } - if (result !== undefined) { - ui.chat.system({ - text: "" + result - }); - } - }, - - command_record: function () { - ui.chat.system({ - text: "When you see the robot appear, the recording will have started" - }); - window.open( - session.recordUrl(), "_blank", - "left,width=" + ($(window).width() / 2)); - }, - - playing: null, - - command_playback: function (url) { - if (this.playing) { - this.playing.cancel(); - this.playing.unload(); - this.playing = null; - ui.chat.system({ - text: "playback cancelled" - }); - return; - } - if (! url) { - ui.chat.system({ - text: "Nothing is playing" - }); - return; - } - var logLoader = playback.getLogs(url); - logLoader.then( - (function (logs) { - if (! logs) { - ui.chat.system({ - text: "No logs found." - }); - return; - } - logs.save(); - this.playing = logs; - logs.play(); - }).bind(this), - function (error) { - ui.chat.system({ - text: "Error fetching " + url + ":\n" + JSON.stringify(error, null, " ") - }); - }); - windowing.hide("#togetherjs-chat"); - }, - - command_savelogs: function (name) { - session.send({ - type: "get-logs", - forClient: session.clientId, - saveAs: name - }); - function save(msg) { - if (msg.request.forClient == session.clientId && msg.request.saveAs == name) { - storage.set("recording." + name, msg.logs).then(function () { - session.hub.off("logs", save); - ui.chat.system({ - text: "Saved as local:" + name - }); - }); - } - } - session.hub.on("logs", save); - }, - - command_baseurl: function (url) { - if (! url) { - storage.get("baseUrlOverride").then(function (b) { - if (b) { - ui.chat.system({ - text: "Set to: " + b.baseUrl - }); - } else { - ui.chat.system({ - text: "No baseUrl override set" - }); - } - }); - return; - } - url = url.replace(/\/*$/, ""); - ui.chat.system({ - text: "If this goes wrong, do this in the console to reset:\n localStorage.setItem('togetherjs.baseUrlOverride', null)" - }); - storage.set("baseUrlOverride", { - baseUrl: url, - expiresAt: Date.now() + (1000 * 60 * 60 * 24) - }).then(function () { - ui.chat.system({ - text: "baseUrl overridden (to " + url + "), will last for one day." - }); - }); - }, - - command_config: function (variable, value) { - if (! (variable || value)) { - storage.get("configOverride").then(function (c) { - if (c) { - util.forEachAttr(c, function (value, attr) { - if (attr == "expiresAt") { - return; - } - ui.chat.system({ - text: " " + attr + " = " + JSON.stringify(value) - }); - }); - ui.chat.system({ - text: "Config expires at " + (new Date(c.expiresAt)) - }); - } else { - ui.chat.system({ - text: "No config override" - }); - } - }); - return; - } - if (variable == "clear") { - storage.set("configOverride", undefined); - ui.chat.system({ - text: "Clearing all overridden configuration" - }); - return; - } - console.log("config", [variable, value]); - if (! (variable && value)) { - ui.chat.system({ - text: "Error: must provide /config VAR VALUE" - }); - return; - } - try { - value = JSON.parse(value); - } catch (e) { - ui.chat.system({ - text: "Error: value (" + value + ") could not be parsed: " + e - }); - return; - } - if (! TogetherJS._defaultConfiguration.hasOwnProperty(variable)) { - ui.chat.system({ - text: "Warning: variable " + variable + " is unknown" - }); - } - storage.get("configOverride").then(function (c) { - c = c || {}; - c[variable] = value; - c.expiresAt = Date.now() + (1000 * 60 * 60 * 24); - storage.set("configOverride", c).then(function () { - ui.chat.system({ - text: "Variable " + variable + " = " + JSON.stringify(value) + "\nValue will be set for one day." - }); - }); - }); - } - - }; - - // this section deal with saving/restoring chat history as long as session is alive - var chatStorageKey = "chatlog"; - var maxLogMessages = 100; - - function saveChatMessage(obj) { - assert(obj.peerId); - assert(obj.messageId); - assert(obj.date); - assert(typeof obj.text == "string"); - - loadChatLog().then(function (log) { - for (var i = log.length - 1; i >= 0; i--) { - if (log[i].messageId === obj.messageId) { - return; - } - } - log.push(obj); - if (log.length > maxLogMessages) { - log.splice(0, log.length - maxLogMessages); - } - storage.tab.set(chatStorageKey, log); - }); - } - - function loadChatLog() { - return storage.tab.get(chatStorageKey, []); - } - - session.once("ui-ready", function () { - loadChatLog().then(function (log) { - if (! log) { - return; - } - for (var i = 0; i < log.length; i++) { - // peers should already be loaded from sessionStorage by the peers module - // maybe i should use a try catch block here - var currentPeer = peers.getPeer(log[i].peerId); - ui.chat.text({ - text: log[i].text, - date: log[i].date, - peer: currentPeer, - messageId: log[i].messageId - }); - } - }); - }); - //delete chat log - session.on("close", function(){ - storage.tab.set(chatStorageKey, undefined); - }); - - return chat; - -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ -define('console',["util"], function (util) { - - var console = window.console || {log: function () {}}; - - var Console = util.Class({ - constructor: function () { - this.messages = []; - this.level = this.levels.log; - }, - - messageLimit: 100, - - levels: { - debug: 1, - // FIXME: I'm considering *not* wrapping console.log, and strictly keeping - // it as a debugging tool; also line numbers would be preserved - log: 2, - info: 3, - notify: 4, - warn: 5, - error: 6, - fatal: 7 - }, - - // Gets set below: - maxLevel: 0, - - consoleLevels: [ - [], - console.debug || [], - console.log || [], - console.info || [], - console.notify || [], - console.warn || [], - console.error || [], - console.fatal || [] - ], - - levelNames: {}, - - setLevel: function (l) { - var number; - if (typeof l == "string") { - number = this.levels[l]; - if (number === undefined) { - throw new Error("Tried to set Console level to unknown level string: " + l); - } - l = number; - } - if (typeof l == "function") { - number = this.consoleLevels.indexOf(l); - if (number == -1) { - throw new Error("Tried to set Console level based on unknown console function: " + l); - } - l = number; - } - if (typeof l == "number") { - if (l < 0) { - throw new Error("Console level must be 0 or larger: " + l); - } else if (l > this.maxLevel) { - throw new Error("Console level must be " + this.maxLevel + " or smaller: " + l); - } - } - this.level = l; - }, - - write: function (level) { - try { - this.messages.push([ - Date.now(), - level, - this._stringify(Array.prototype.slice.call(arguments, 1)) - ]); - } catch (e) { - console.warn("Error stringifying argument:", e); - } - if (level != "suppress" && this.level <= level) { - var method = console[this.levelNames[level]]; - if (! method) { - method = console.log; - } - method.apply(console, Array.prototype.slice.call(arguments, 1)); - } - }, - - suppressedWrite: function () { - this.write.apply(this, ["suppress"].concat(Array.prototype.slice.call(arguments))); - }, - - trace: function (level) { - level = level || 'log'; - if (console.trace) { - level = "suppressedWrite"; - } - try { - throw new Error(); - } catch (e) { - // FIXME: trim this frame - var stack = e.stack; - stack = stack.replace(/^[^\n]*\n/, ""); - this[level](stack); - } - if (console.trace) { - console.trace(); - } - }, - - _browserInfo: function () { - // FIXME: add TogetherJS version and - return [ - "TogetherJS base URL: " + TogetherJS.baseUrl, - "User Agent: " + navigator.userAgent, - "Page loaded: " + this._formatDate(TogetherJS.pageLoaded), - "Age: " + this._formatMinutes(Date.now() - TogetherJS.pageLoaded) + " minutes", - // FIXME: make this right: - //"Window: height: " + window.screen.height + " width: " + window.screen.width - "URL: " + location.href, - "------+------+----------------------------------------------" - ]; - }, - - _stringify: function (args) { - var s = ""; - for (var i=0; i 10) { - // Over 10 minutes, just ignore the seconds - return m; - } - var seconds = Math.floor(remaining / 1000) + ""; - m += ":"; - seconds = lpad(seconds, 2, "0"); - m += seconds; - if (m == "0:00") { - m += ((remaining / 1000).toFixed(3) + "").substr(1); - } - return m; - }, - - _formatLevel: function (l) { - if (l === "suppress") { - return ""; - } - return this.levelNames[l]; - }, - - toString: function () { - try { - var lines = this._browserInfo(); - this.messages.forEach(function (m) { - lines.push(lpad(this._formatTime(m[0]), 6) + " " + rpad(this._formatLevel(m[1]), 6) + " " + lpadLines(m[2], 14)); - }, this); - return lines.join("\n"); - } catch (e) { - // toString errors can otherwise be swallowed: - console.warn("Error running console.toString():", e); - throw e; - } - }, - - submit: function (options) { - // FIXME: friendpaste is broken for this - // (and other pastebin sites aren't really Browser-accessible) - return util.Deferred(function (def) { - options = options || {}; - var site = options.site || TogetherJS.config.get("pasteSite") || "https://www.friendpaste.com/"; - var req = new XMLHttpRequest(); - req.open("POST", site); - req.setRequestHeader("Content-Type", "application/json"); - req.send(JSON.stringify({ - "title": options.title || "TogetherJS log file", - "snippet": this.toString(), - "language": "text" - })); - req.onreadystatechange = function () { - if (req.readyState === 4) { - var data = JSON.parse(req.responseText); - } - }; - }); - } - - }); - - function rpad(s, len, pad) { - s = s + ""; - pad = pad || " "; - while (s.length < len) { - s += pad; - } - return s; - } - - function lpad(s, len, pad) { - s = s + ""; - pad = pad || " "; - while (s.length < len) { - s = pad + s; - } - return s; - } - - function lpadLines(s, len, pad) { - var i; - s = s + ""; - if (s.indexOf("\n") == -1) { - return s; - } - pad = pad || " "; - var fullPad = ""; - for (i=0; i wTop + height - CURSOR_HEIGHT) { - top = height - CURSOR_HEIGHT - 5; - this.setClass("togetherjs-scrolled-below"); - } else { - this.setClass("togetherjs-scrolled-normal"); - } - this.element.css({ - top: top, - left: left - }); - }, - - refresh: function () { - if (this.lastTop !== null) { - this.setPosition(this.lastTop, this.lastLeft); - } - }, - - setKeydown: function () { - if (this.keydownTimeout) { - clearTimeout(this.keydownTimeout); - } else { - this.element.find(".togetherjs-cursor-typing").show().animateKeyboard(); - } - this.keydownTimeout = setTimeout(this.clearKeydown, this.KEYDOWN_WAIT_TIME); - }, - - clearKeydown: function () { - this.keydownTimeout = null; - this.element.find(".togetherjs-cursor-typing").hide().stopKeyboardAnimation(); - }, - - _destroy: function () { - this.element.remove(); - this.element = null; - } - }); - - Cursor._cursors = {}; - - cursor.getClient = Cursor.getClient = function (clientId) { - var c = Cursor._cursors[clientId]; - if (! c) { - c = Cursor._cursors[clientId] = Cursor(clientId); - } - return c; - }; - - Cursor.forEach = function (callback, context) { - context = context || null; - for (var a in Cursor._cursors) { - if (Cursor._cursors.hasOwnProperty(a)) { - callback.call(context, Cursor._cursors[a], a); - } - } - }; - - Cursor.destroy = function (clientId) { - Cursor._cursors[clientId]._destroy(); - delete Cursor._cursors[clientId]; - }; - - peers.on("new-peer identity-updated status-updated", function (peer) { - var c = Cursor.getClient(peer.id); - c.updatePeer(peer); - }); - - var lastTime = 0; - var MIN_TIME = 100; - var lastPosX = -1; - var lastPosY = -1; - var lastMessage = null; - function mousemove(event) { - var now = Date.now(); - if (now - lastTime < MIN_TIME) { - return; - } - lastTime = now; - var pageX = event.pageX; - var pageY = event.pageY; - if (Math.abs(lastPosX - pageX) < 3 && Math.abs(lastPosY - pageY) < 3) { - // Not a substantial enough change - return; - } - lastPosX = pageX; - lastPosY = pageY; - var target = event.target; - var parent = $(target).closest(".togetherjs-window, .togetherjs-popup, #togetherjs-dock"); - if (parent.length) { - target = parent[0]; - } else if (elementFinder.ignoreElement(target)) { - target = null; - } - if ((! target) || target == document.documentElement || target == document.body) { - lastMessage = { - type: "cursor-update", - top: pageY, - left: pageX - }; - //session.send(lastMessage); - return; - } - target = $(target); - var offset = target.offset(); - if (! offset) { - // FIXME: this really is walkabout.js's problem to fire events on the - // document instead of a specific element - console.warn("Could not get offset of element:", target[0]); - return; - } - var offsetX = pageX - offset.left; - var offsetY = pageY - offset.top; - lastMessage = { - type: "cursor-update", - element: elementFinder.elementLocation(target), - offsetX: Math.floor(offsetX), - offsetY: Math.floor(offsetY) - }; - //session.send(lastMessage); - } - - function makeCursor(color) { - var canvas = $(""); - canvas.attr("height", CURSOR_HEIGHT); - canvas.attr("width", CURSOR_WIDTH); - var context = canvas[0].getContext('2d'); - context.fillStyle = color; - context.moveTo(0, 0); - context.beginPath(); - context.lineTo(0, CURSOR_HEIGHT/1.2); - context.lineTo(Math.sin(CURSOR_ANGLE/2) * CURSOR_HEIGHT / 1.5, - Math.cos(CURSOR_ANGLE/2) * CURSOR_HEIGHT / 1.5); - context.lineTo(Math.sin(CURSOR_ANGLE) * CURSOR_HEIGHT / 1.2, - Math.cos(CURSOR_ANGLE) * CURSOR_HEIGHT / 1.2); - context.lineTo(0, 0); - context.shadowColor = 'rgba(0,0,0,0.3)'; - context.shadowBlur = 2; - context.shadowOffsetX = 1; - context.shadowOffsetY = 2; - context.strokeStyle = "#ffffff"; - context.stroke(); - context.fill(); - return canvas[0].toDataURL("image/png"); - } - - var scrollTimeout = null; - var scrollTimeoutSet = 0; - var SCROLL_DELAY_TIMEOUT = 75; - var SCROLL_DELAY_LIMIT = 300; - - function scroll() { - var now = Date.now(); - if (scrollTimeout) { - if (now - scrollTimeoutSet < SCROLL_DELAY_LIMIT) { - clearTimeout(scrollTimeout); - } else { - // Just let it progress anyway - return; - } - } - scrollTimeout = setTimeout(_scrollRefresh, SCROLL_DELAY_TIMEOUT); - if (! scrollTimeoutSet) { - scrollTimeoutSet = now; - } - } - - var lastScrollMessage = null; - function _scrollRefresh() { - scrollTimeout = null; - scrollTimeoutSet = 0; - Cursor.forEach(function (c) { - c.refresh(); - }); - lastScrollMessage = { - type: "scroll-update", - position: elementFinder.elementByPixel($(window).scrollTop()) - }; - session.send(lastScrollMessage); - } - - // FIXME: do the same thing for cursor position? And give up on the - // ad hoc update-on-hello? - session.on("prepare-hello", function (helloMessage) { - if (lastScrollMessage) { - helloMessage.scrollPosition = lastScrollMessage.position; - } - }); - - session.hub.on("scroll-update", function (msg) { - msg.peer.scrollPosition = msg.position; - if (msg.peer.following) { - msg.peer.view.scrollTo(); - } - }); - - // In case there are multiple peers, we track that we've accepted one of their - // hello-based scroll updates, just so we don't bounce around (we don't intelligently - // choose which one to use, just the first that comes in) - var acceptedScrollUpdate = false; - session.hub.on("hello-back hello", function (msg) { - if (msg.type == "hello") { - // Once a hello comes in, a bunch of hello-backs not intended for us will also - // come in, and we should ignore them - acceptedScrollUpdate = true; - } - if (! msg.scrollPosition) { - return; - } - msg.peer.scrollPosition = msg.scrollPosition; - if ((! acceptedScrollUpdate) && - msg.sameUrl && - Date.now() - session.timeHelloSent < SCROLL_UPDATE_CUTOFF) { - acceptedScrollUpdate = true; - msg.peer.view.scrollTo(); - } - }); - - session.on("ui-ready", function () { - $(document).mousemove(mousemove); - document.addEventListener("click", documentClick, true); - document.addEventListener("keydown", documentKeydown, true); - $(window).scroll(scroll); - scroll(); - }); - - session.on("close", function () { - Cursor.forEach(function (c, clientId) { - Cursor.destroy(clientId); - }); - $(document).unbind("mousemove", mousemove); - document.removeEventListener("click", documentClick, true); - document.removeEventListener("keydown", documentKeydown, true); - $(window).unbind("scroll", scroll); - }); - - session.hub.on("hello", function (msg) { - // Immediately get our cursor onto this new person's screen: - if (lastMessage) { - session.send(lastMessage); - } - if (lastScrollMessage) { - session.send(lastScrollMessage); - } - }); - - function documentClick(event) { - if (event.togetherjsInternal) { - // This is an artificial internal event - return; - } - // FIXME: this might just be my imagination, but somehow I just - // really don't want to do anything at this stage of the event - // handling (since I'm catching every click), and I'll just do - // something real soon: - setTimeout(function () { - if (! TogetherJS.running) { - // This can end up running right after TogetherJS has been closed, often - // because TogetherJS was closed with a click... - return; - } - var element = event.target; - if (element == document.documentElement) { - // For some reason clicking on gives the element here - element = document.body; - } - if (elementFinder.ignoreElement(element)) { - return; - } - //Prevent click events on video objects to avoid conflicts with - //togetherjs's own video events - if (element.nodeName.toLowerCase() === 'video'){ - return; - } - - var dontShowClicks = TogetherJS.config.get("dontShowClicks"); - var cloneClicks = TogetherJS.config.get("cloneClicks"); - // If you dont want to clone the click for this element - // and you dont want to show the click for this element or you dont want to show any clicks - // then return to avoid sending a useless click - if ((! util.matchElement(element, cloneClicks)) && util.matchElement(element, dontShowClicks)) { - return; - } - var location = elementFinder.elementLocation(element); - var offset = $(element).offset(); - var offsetX = event.pageX - offset.left; - var offsetY = event.pageY - offset.top; - /*session.send({ - type: "cursor-click", - element: location, - offsetX: offsetX, - offsetY: offsetY - });*/ - if (util.matchElement(element, dontShowClicks)) { - return; - } - //displayClick({top: event.pageY, left: event.pageX}, peers.Self.color); - }); - } - - session.hub.on("app.codiad", function (data) { - codiad.together.handle(data); - }); - - var CLICK_TRANSITION_TIME = 3000; - - session.hub.on("cursor-click", function (pos) { - // When the click is calculated isn't always the same as how the - // last cursor update was calculated, so we force the cursor to - // the last location during a click: - if (! pos.sameUrl) { - // FIXME: if we *could have* done a local click, but we follow along - // later, we'll be in different states if that click was important. - // Mostly click cloning just won't work. - return; - } - Cursor.getClient(pos.clientId).updatePosition(pos); - var target = $(elementFinder.findElement(pos.element)); - var offset = target.offset(); - var top = offset.top + pos.offsetY; - var left = offset.left + pos.offsetX; - var cloneClicks = TogetherJS.config.get("cloneClicks"); - if (util.matchElement(target, cloneClicks)) { - eventMaker.performClick(target); - } - var dontShowClicks = TogetherJS.config.get("dontShowClicks"); - if (util.matchElement(target, dontShowClicks)) { - return; - } - displayClick({top: top, left: left}, pos.peer.color); - }); - - function displayClick(pos, color) { - // FIXME: should we hide the local click if no one else is going to see it? - // That means tracking who might be able to see our screen. - var element = templating.clone("click"); - $(document.body).append(element); - element.css({ - top: pos.top, - left: pos.left, - borderColor: color - }); - setTimeout(function () { - element.addClass("togetherjs-clicking"); - }, 100); - setTimeout(function () { - element.remove(); - }, CLICK_TRANSITION_TIME); - } - - var lastKeydown = 0; - var MIN_KEYDOWN_TIME = 500; - - function documentKeydown(event) { - setTimeout(function () { - var now = Date.now(); - if (now - lastKeydown < MIN_KEYDOWN_TIME) { - return; - } - lastKeydown = now; - // FIXME: is event.target interesting here? That is, *what* the - // user is typing into, not just that the user is typing? Also - // I'm assuming we don't care if the user it typing into a - // togetherjs-related field, since chat activity is as interesting - // as any other activity. - session.send({type: "keydown"}); - }); - } - - session.hub.on("keydown", function (msg) { - // FIXME: when the cursor is hidden there's nothing to show with setKeydown(). - var cursor = Cursor.getClient(msg.clientId); - cursor.setKeydown(); - }); - - util.testExpose({Cursor: Cursor}); - - return cursor; - -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('ot',["util"], function (util) { - - var ot = util.Module("ot"); - var assert = util.assert; - - var StringSet = util.Class({ - /* Set that only supports string items */ - constructor: function () { - this._items = {}; - this._count = 0; - }, - contains: function (k) { - assert(typeof k == "string"); - return this._items.hasOwnProperty(k); - }, - add: function (k) { - assert(typeof k == "string"); - if (this.contains(k)) { - return; - } - this._items[k] = null; - this._count++; - }, - remove: function (k) { - assert(typeof k == "string"); - if (! this.contains(k)) { - return; - } - delete this._items[k]; - this._count++; - }, - isEmpty: function () { - return ! this._count; - } - }); - - var Queue = util.Class({ - - constructor: function (size) { - this._q = []; - this._size = size; - this._deleted = 0; - }, - - _trim: function () { - if (this._size) { - if (this._q.length > this._size) { - this._q.splice(0, this._q.length - this._size); - this._deleted += this._q.length - this._size; - } - } - }, - - push: function (item) { - this._q.push(item); - this._trim(); - }, - - last: function () { - return this._q[this._q.length-1]; - }, - - walkBack: function (callback, context) { - var result = true; - for (var i=this._q.length-1; i >= 0; i--) { - var item = this._q[i]; - result = callback.call(context, item, i + this._deleted); - if (result === false) { - return result; - } else if (! result) { - result = true; - } - } - return result; - }, - - walkForward: function (index, callback, context) { - var result = true; - for (var i=index; i this.version || - (otherChange.version == this.version && otherChange.clientId > this.clientId); - }, - - knowsAboutAll: function (versions) { - for (var clientId in versions) { - if (! versions.hasOwnProperty(clientId)) { - continue; - } - if (! versions[clientId]) { - continue; - } - if ((! this.known[clientId]) || this.known[clientId] < versions[clientId]) { - return false; - } - } - return true; - }, - - knowsAboutChange: function (change) { - return change.clientId == this.clientId || - (this.known[change.clientId] && this.known[change.clientId] >= change.version); - }, - - knowsAboutVersion: function (version, clientId) { - if ((! version) || clientId == this.clientId) { - return true; - } - return this.known[clientId] && this.known[clientId] >= version; - }, - - maybeMissingChanges: function (mostRecentVersion, clientId) { - if (! mostRecentVersion) { - // No actual changes for clientId exist - return false; - } - if (! this.known[clientId]) { - // We don't even know about clientId, so we are definitely missing something - return true; - } - if (this.known[clientId] >= mostRecentVersion) { - // We know about all versions through mostRecentVersion - return false; - } - if ((clientId > this.clientId && this.known[clientId] >= this.version-1) || - (clientId < this.clientId && this.known[clientId] == this.version)) { - // We know about all versions from clientId that could exist before this - // version - return false; - } - // We may or may not be missing something - return true; - } - }); - - /* SimpleHistory synchronizes peers by relying on the server to serialize - * the order of all updates. Each client maintains a queue of patches - * which have not yet been 'committed' (by being echoed back from the - * server). The client is responsible for transposing its own queue - * if 'earlier' patches are heard from the server. - * - * Let's say that A's edit "1" and B's edit "2" occur and get put in - * their respective SimpleHistory queues. The server happens to - * handle 1 first, then 2, so those are the order that all peers - * (both A and B) see the messages. - * - * A sees 1, and has 1 on its queue, so everything's fine. It - * updates the 'committed' text to match its current text and drops - * the patch from its queue. It then sees 2, but the basis number - * for 2 no longer matches the committed basis, so it throws it - * away. - * - * B sees 1, and has 2 on its queue. It does the OT transpose thing, - * updating the committed text to include 1 and the 'current' text - * to include 1+2. It updates its queue with the newly transposed - * version of 2 (call it 2prime) and updates 2prime's basis - * number. It them resends 2prime to the server. It then receives 2 - * (the original) but the basis number no longer matches the - * committed basis, so it throws it away. - * - * Now the server sees 2prime and rebroadcasts it to both A and B. - * - * A is seeing it for the first time, and the basis number matches, - * so it applies it to the current and committed text. - * - * B sees that 2prime matches what's on the start of its queue, - * shifts it off, and updates the committed text to match the - * current text. - * - * Note that no one tries to keep an entire history of changes, - * which is the main difference with ot.History. Everyone applies - * the same patches in the same order. - */ - ot.SimpleHistory = util.Class({ - - constructor: function(clientId, initState, initBasis) { - this.clientId = clientId; - this.committed = initState; - this.current = initState; - this.basis = initBasis; - this.queue = []; - this.deltaId = 1; - this.selection = null; - }, - - // Use a fake change to represent the selection. - // (This is the only bit that hard codes ot.TextReplace as the delta - // representation; override this in a subclass (or don't set the - // selection) if you are using a different delta representation. - setSelection: function(selection) { - if (selection) { - this.selection = ot.TextReplace(selection[0], - selection[1] - selection[0], '@'); - } else { - this.selection = null; - } - }, - - // Decode the fake change to reconstruct the updated selection. - getSelection: function() { - if (! this.selection) { - return null; - } - return [this.selection.start, this.selection.start + this.selection.del]; - }, - - // Add this delta to this client's queue. - add: function(delta) { - var change = { - id: this.clientId + '.' + (this.deltaId++), - delta: delta - }; - if (! this.queue.length) { - change.basis = this.basis; - } - this.queue.push(change); - this.current = delta.apply(this.current); - return !!change.basis; - }, - - // Apply a delta received from the server. - // Return true iff the current text changed as a result. - commit: function(change) { - - // ignore it if the basis doesn't match (this patch doesn't apply) - // if so, this delta is out of order; we expect the original client - // to retransmit an updated delta. - if (change.basis !== this.basis) { - return false; // 'current' text did not change - } - - // is this the first thing on the queue? - if (this.queue.length && this.queue[0].id === change.id) { - assert(change.basis === this.queue[0].basis); - // good, apply this to commit state & remove it from queue - this.committed = this.queue.shift().delta.apply(this.committed); - this.basis++; - if (this.queue.length) { - this.queue[0].basis = this.basis; - } - return false; // 'current' text did not change - } - - // Transpose all bits on the queue to put this patch first. - var inserted = change.delta; - this.queue = this.queue.map(function(qchange) { - var tt = qchange.delta.transpose(inserted); - inserted = tt[1]; - return { - id: qchange.id, - delta: tt[0] - }; - }); - if (this.selection) { - // update the selection! - this.selection = this.selection.transpose(inserted)[0]; - } - this.committed = change.delta.apply(this.committed); - this.basis++; - if (this.queue.length) { - this.queue[0].basis = this.basis; - } - // Update current by replaying queued changes starting from 'committed' - this.current = this.committed; - this.queue.forEach(function(qchange) { - this.current = qchange.delta.apply(this.current); - }.bind(this)); - return true; // The 'current' text changed. - }, - - // Return the next change to transmit to the server, or null if there - // isn't one. - getNextToSend: function() { - var qchange = this.queue[0]; - if (! qchange) { - /* nothing to send */ - return null; - } - if (qchange.sent) { - /* already sent */ - return null; - } - assert(qchange.basis); - qchange.sent = true; - return qchange; - } - }); - - ot.History = util.Class({ - - constructor: function (clientId, initState) { - this._history = Queue(); - this._history.push({ - clientId: "init", state: initState - }); - this.clientId = clientId; - this.known = {}; - this.mostRecentLocalChange = null; - }, - - add: function (change) { - // Simplest cast, it is our change: - if (change.clientId == this.clientId) { - this._history.push(change); - this.mostRecentLocalChange = change.version; - return change.delta; - } - assert((! this.known[change.clientId]) || this.known[change.clientId] < change.version, - "Got a change", change, "that appears older (or same as) a known change", this.known[change.clientId]); - // Second simplest case, we get a change that we can add to our - // history without modification: - var last = this._history.last(); - if ((last.clientId == "init" || last.isBefore(change)) && - change.knowsAboutAll(this.known) && - change.knowsAboutVersion(this.mostRecentLocalChange, this.clientId)) { - this._history.push(change); - this.known[change.clientId] = change.version; - return change.delta; - } - // We must do work! - - this.logHistory("//"); - - // First we check if we need to modify this change because we - // know about changes that it should know about (changes that - // preceed it that are in our local history). - var clientsToCheck = StringSet(); - for (var clientId in this.known) { - if (! this.known.hasOwnProperty(clientId)) { - continue; - } - if (change.maybeMissingChanges(this.known[clientId], clientId)) { - clientsToCheck.add(clientId); - } - } - if (change.maybeMissingChanges(this.mostRecentLocalChange, this.clientId)) { - clientsToCheck.add(this.clientId); - } - if (! clientsToCheck.isEmpty()) { - var indexToCheckFrom = null; - this._history.walkBack(function (c, index) { - indexToCheckFrom = index; - if (c.clientId == "init") { - return false; - } - if (clientsToCheck.contains(c.clientId) && - ! change.maybeMissingChanges(c.version, c.clientId)) { - clientsToCheck.remove(c.clientId); - if (clientsToCheck.isEmpty()) { - return false; - } - } - return true; - }, this); - this._history.walkForward(indexToCheckFrom, function (c, index) { - if (c.clientId == "init") { - return true; - } - if (change.isBefore(c)) { - return false; - } - if (! change.knowsAboutChange(c)) { - var presentDelta = this.promoteDelta(c.delta, index, change); - if (! presentDelta.equals(c.delta)) { - //console.log("->rebase delta rewrite", presentDelta+""); - } - this.logChange("->rebase", change, function () { - var result = change.delta.transpose(presentDelta); - change.delta = result[0]; - change.known[c.clientId] = c.version; - }, "with:", c); - } - return true; - }, this); - } - - // Next we insert the change into its proper location - var indexToInsert = null; - this._history.walkBack(function (c, index) { - if (c.clientId == "init" || c.isBefore(change)) { - indexToInsert = index+1; - return false; - } - return true; - }, this); - assert(indexToInsert); - this._history.insert(indexToInsert, change); - - // Now we fix up any forward changes - var fixupDelta = change.delta; - this._history.walkForward(indexToInsert+1, function (c, index) { - if (! c.knowsAboutChange(change)) { - var origChange = c.clone(); - this.logChange("^^fix", c, function () { - var fixupResult = c.delta.transpose(fixupDelta); - console.log(" ^^real"); - var result = c.delta.transpose(fixupDelta); - c.delta = result[0]; - c.known[change.clientId] = change.version; - fixupDelta = fixupResult[1]; - }, "clone:", change.delta+""); - console.log("(trans)", fixupDelta+""); - assert(c.knowsAboutChange(change)); - } - }, this); - - // Finally we return the transformed delta that represents - // changes that should be made to the state: - - this.logHistory("!!"); - return fixupDelta; - }, - - promoteDelta: function (delta, deltaIndex, untilChange) { - this._history.walkForward(deltaIndex+1, function (c, index) { - if (untilChange.isBefore(c)) { - return false; - } - // FIXME: not sure if this clientId check here is right. Maybe - // if untilChange.knowsAbout(c)? - if (untilChange.knowsAboutChange(c)) { - var result = c.delta.transpose(delta); - delta = result[1]; - } - return true; - }); - return delta; - }, - - logHistory: function (prefix) { - prefix = prefix || ""; - var postfix = Array.prototype.slice.call(arguments, 1); - console.log.apply(console, [prefix + "history", this.clientId, ":"].concat(postfix)); - console.log(prefix + " state:", JSON.stringify(this.getStateSafe())); - var hstate; - this._history.walkForward(0, function (c, index) { - if (! index) { - assert(c.clientId == "init"); - console.log(prefix + " init:", JSON.stringify(c.state)); - hstate = c.state; - } else { - try { - hstate = c.delta.apply(hstate); - } catch (e) { - hstate = "Error: " + e; - } - console.log(prefix + " ", index, c+"", JSON.stringify(hstate)); - } - }); - }, - - logChange: function (prefix, change, callback) { - prefix = prefix || "before"; - var postfix = Array.prototype.slice.call(arguments, 3); - console.log.apply( - console, - [prefix, this.clientId, ":", change+""].concat(postfix).concat([JSON.stringify(this.getStateSafe(true))])); - try { - callback(); - } finally { - console.log(prefix + " after:", change+"", JSON.stringify(this.getStateSafe())); - } - }, - - addDelta: function (delta) { - var version = this._createVersion(); - var change = Change(version, this.clientId, delta, util.extend(this.knownVersions)); - this.add(change); - return change; - }, - - _createVersion: function () { - var max = 1; - for (var id in this.knownVersions) { - max = Math.max(max, this.knownVersions[id]); - } - max = Math.max(max, this.mostRecentLocalChange); - return max+1; - }, - - fault: function (change) { - throw new Error('Fault'); - }, - - getState: function () { - var state; - this._history.walkForward(0, function (c) { - if (c.clientId == "init") { - // Initialization, has the state - state = c.state; - } else { - state = c.delta.apply(state); - } - }, this); - return state; - }, - - getStateSafe: function () { - try { - return this.getState(); - } catch (e) { - return 'Error: ' + e; - } - } - - }); - - ot.TextReplace = util.Class({ - - constructor: function (start, del, text) { - assert(typeof start == "number" && typeof del == "number" && typeof text == "string", start, del, text); - assert(start >=0 && del >= 0, start, del); - this.start = start; - this.del = del; - this.text = text; - }, - - toString: function () { - if (this.empty()) { - return '[no-op]'; - } - if (! this.del) { - return '[insert ' + JSON.stringify(this.text) + ' @' + this.start + ']'; - } else if (! this.text) { - return '[delete ' + this.del + ' chars @' + this.start + ']'; - } else { - return '[replace ' + this.del + ' chars with ' + JSON.stringify(this.text) + ' @' + this.start + ']'; - } - }, - - equals: function (other) { - return other.constructor === this.constructor && - other.del === this.del && - other.start === this.start && - other.text === this.text; - }, - - clone: function (start, del, text) { - if (start === undefined) { - start = this.start; - } - if (del === undefined) { - del = this.del; - } - if (text === undefined) { - text = this.text; - } - return ot.TextReplace(start, del, text); - }, - - empty: function () { - return (! this.del) && (! this.text); - }, - - apply: function (text) { - if (this.empty()) { - return text; - } - if (this.start > text.length) { - console.trace(); - throw new util.AssertionError("Start after end of text (" + JSON.stringify(text) + "/" + text.length + "): " + this); - } - if (this.start + this.del > text.length) { - throw new util.AssertionError("Start+del after end of text (" + JSON.stringify(text) + "/" + text.length + "): " + this); - } - return text.substr(0, this.start) + this.text + text.substr(this.start+this.del); - }, - - transpose: function (delta) { - /* Transform this delta as though the other delta had come before it. - Returns a [new_version_of_this, transformed_delta], where transformed_delta - satisfies: - - result1 = new_version_of_this.apply(delta.apply(text)); - result2 = transformed_delta.apply(this.apply(text)); - assert(result1 == result2); - - Does not modify this object. - */ - var overlap; - assert(delta instanceof ot.TextReplace, "Transposing with non-TextReplace:", delta); - if (this.empty()) { - //console.log(" =this is empty"); - return [this.clone(), delta.clone()]; - } - if (delta.empty()) { - //console.log(" =other is empty"); - return [this.clone(), delta.clone()]; - } - if (delta.before(this)) { - //console.log(" =this after other"); - return [this.clone(this.start + delta.text.length - delta.del), - delta.clone()]; - } else if (this.before(delta)) { - //console.log(" =this before other"); - return [this.clone(), delta.clone(delta.start + this.text.length - this.del)]; - } else if (delta.sameRange(this)) { - //console.log(" =same range"); - return [this.clone(this.start+delta.text.length, 0), - delta.clone(undefined, 0)]; - } else if (delta.contains(this)) { - //console.log(" =other contains this"); - return [this.clone(delta.start+delta.text.length, 0, this.text), - delta.clone(undefined, delta.del - this.del + this.text.length, delta.text + this.text)]; - } else if (this.contains(delta)) { - //console.log(" =this contains other"); - return [this.clone(undefined, this.del - delta.del + delta.text.length, delta.text + this.text), - delta.clone(this.start, 0, delta.text)]; - } else if (this.overlapsStart(delta)) { - //console.log(" =this overlaps start of other"); - overlap = this.start + this.del - delta.start; - return [this.clone(undefined, this.del - overlap), - delta.clone(this.start + this.text.length, delta.del - overlap)]; - } else { - //console.log(" =this overlaps end of other"); - assert(delta.overlapsStart(this), delta+"", "does not overlap start of", this+"", delta.before(this)); - overlap = delta.start + delta.del - this.start; - return [this.clone(delta.start + delta.text.length, this.del - overlap), - delta.clone(undefined, delta.del - overlap)]; - } - throw 'Should not happen'; - }, - - before: function (other) { - return this.start + this.del <= other.start; - }, - - contains: function (other) { - return other.start >= this.start && other.start + other.del < this.start + this.del; - }, - - sameRange: function (other) { - return other.start == this.start && other.del == this.del; - }, - - overlapsStart: function (other) { - return this.start < other.start && this.start + this.del > other.start; - }, - - classMethods: { - - /* Make a new ot.TextReplace that converts oldValue to newValue. */ - fromChange: function(oldValue, newValue) { - assert(typeof oldValue == "string"); - assert(typeof newValue == "string"); - var commonStart = 0; - while (commonStart < newValue.length && - newValue.charAt(commonStart) == oldValue.charAt(commonStart)) { - commonStart++; - } - var commonEnd = 0; - while (commonEnd < (newValue.length - commonStart) && - commonEnd < (oldValue.length - commonStart) && - newValue.charAt(newValue.length - commonEnd - 1) == - oldValue.charAt(oldValue.length - commonEnd - 1)) { - commonEnd++; - } - var removed = oldValue.substr(commonStart, oldValue.length - commonStart - commonEnd); - var inserted = newValue.substr(commonStart, newValue.length - commonStart - commonEnd); - if (! (removed.length || inserted)) { - return null; - } - return this(commonStart, removed.length, inserted); - }, - - random: function (source, generator) { - var text, start, len; - var ops = ["ins", "del", "repl"]; - if (! source.length) { - ops = ["ins"]; - } - switch (generator.pick(ops)) { - case "ins": - if (! generator.number(2)) { - text = generator.string(1); - } else { - text = generator.string(generator.number(3)+1); - } - if (! generator.number(4)) { - start = 0; - } else if (! generator.number(3)) { - start = source.length-1; - } else { - start = generator.number(source.length); - } - return this(start, 0, text); - - case "del": - if (! generator.number(20)) { - return this(0, source.length, ""); - } - start = generator.number(source.length-1); - if (! generator.number(2)) { - len = 1; - } else { - len = generator.number(5)+1; - } - len = Math.min(len, source.length - start); - return this(start, len, ""); - - case "repl": - start = generator.number(source.length-1); - len = generator.number(5); - len = Math.min(len, source.length - start); - text = generator.string(generator.number(2)+1); - return this(start, len, text); - } - throw 'Unreachable'; - } - } - }); - - return ot; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('forms',["jquery", "util", "session", "elementFinder", "eventMaker", "templating", "ot"], function ($, util, session, elementFinder, eventMaker, templating, ot) { - var forms = util.Module("forms"); - var assert = util.assert; - - // This is how much larger the focus element is than the element it surrounds - // (this is padding on each side) - var FOCUS_BUFFER = 5; - - var inRemoteUpdate = false; - - function suppressSync(element) { - var ignoreForms = TogetherJS.config.get("ignoreForms"); - if (ignoreForms === true) { - return true; - } - else { - return $(element).is(ignoreForms.join(",")); - } - } - - function maybeChange(event) { - // Called when we get an event that may or may not indicate a real change - // (like keyup in a textarea) - var tag = event.target.tagName; - if (tag == "TEXTAREA" || tag == "INPUT") { - change(event); - } - } - - function change(event) { - sendData({ - element: event.target, - value: getValue(event.target) - }); - } - - function sendData(attrs) { - var el = $(attrs.element); - assert(el); - var tracker = attrs.tracker; - var value = attrs.value; - if (inRemoteUpdate) { - return; - } - if (elementFinder.ignoreElement(el) || - (elementTracked(el) && !tracker) || - suppressSync(el)) { - return; - } - var location = elementFinder.elementLocation(el); - var msg = { - type: "form-update", - element: location - }; - if (isText(el) || tracker) { - var history = el.data("togetherjsHistory"); - if (history) { - if (history.current == value) { - return; - } - var delta = ot.TextReplace.fromChange(history.current, value); - assert(delta); - history.add(delta); - maybeSendUpdate(msg.element, history, tracker); - return; - } else { - msg.value = value; - msg.basis = 1; - el.data("togetherjsHistory", ot.SimpleHistory(session.clientId, value, 1)); - } - } else { - msg.value = value; - } - session.send(msg); - } - - function isCheckable(el) { - el = $(el); - var type = (el.prop("type") || "text").toLowerCase(); - if (el.prop("tagName") == "INPUT" && ["radio", "checkbox"].indexOf(type) != -1) { - return true; - } - return false; - } - - var editTrackers = {}; - var liveTrackers = []; - - TogetherJS.addTracker = function (TrackerClass, skipSetInit) { - assert(typeof TrackerClass === "function", "You must pass in a class"); - assert(typeof TrackerClass.prototype.trackerName === "string", - "Needs a .prototype.trackerName string"); - // Test for required instance methods. - "destroy update init makeInit tracked".split(/ /).forEach(function(m) { - assert(typeof TrackerClass.prototype[m] === "function", - "Missing required tracker method: "+m); - }); - // Test for required class methods. - "scan tracked".split(/ /).forEach(function(m) { - assert(typeof TrackerClass[m] === "function", - "Missing required tracker class method: "+m); - }); - editTrackers[TrackerClass.prototype.trackerName] = TrackerClass; - if (!skipSetInit) { - setInit(); - } - }; - - var AceEditor = util.Class({ - - trackerName: "AceEditor", - - constructor: function (el) { - this.element = $(el)[0]; - assert($(this.element).hasClass("ace_editor")); - this._change = this._change.bind(this); - this._editor().document.on("change", this._change); - }, - - tracked: function (el) { - return this.element === $(el)[0]; - }, - - destroy: function (el) { - this._editor().document.removeListener("change", this._change); - }, - - update: function (msg) { - this._editor().document.setValue(msg.value); - }, - - init: function (update, msg) { - this.update(update); - }, - - makeInit: function () { - return { - element: this.element, - tracker: this.trackerName, - value: this._editor().document.getValue() - }; - }, - - _editor: function () { - return this.element.env; - }, - - _change: function (e) { - // FIXME: I should have an internal .send() function that automatically - // asserts !inRemoteUpdate, among other things - if (inRemoteUpdate) { - return; - } - sendData({ - tracker: this.trackerName, - element: this.element, - value: this.getContent() - }); - }, - - getContent: function() { - return this._editor().document.getValue(); - } - }); - - AceEditor.scan = function () { - return $(".ace_editor"); - }; - - AceEditor.tracked = function (el) { - return !! $(el).closest(".ace_editor").length; - }; - - TogetherJS.addTracker(AceEditor, true /* skip setInit */); - - var CodeMirrorEditor = util.Class({ - trackerName: "CodeMirrorEditor", - - constructor: function (el) { - this.element = $(el)[0]; - assert(this.element.CodeMirror); - this._change = this._change.bind(this); - this._editor().on("change", this._change); - }, - - tracked: function (el) { - return this.element === $(el)[0]; - }, - - destroy: function (el) { - this._editor().off("change", this._change); - }, - - update: function (msg) { - this._editor().setValue(msg.value); - }, - - init: function (msg) { - if (msg.value) { - this.update(msg); - } - }, - - makeInit: function () { - return { - element: this.element, - tracker: this.trackerName, - value: this._editor().getValue() - }; - }, - - _change: function (editor, change) { - if (inRemoteUpdate) { - return; - } - sendData({ - tracker: this.trackerName, - element: this.element, - value: this.getContent() - }); - }, - - _editor: function () { - return this.element.CodeMirror; - }, - - getContent: function() { - return this._editor().getValue(); - } - }); - - CodeMirrorEditor.scan = function () { - var result = []; - var els = document.body.getElementsByTagName("*"); - var _len = els.length; - for (var i=0; i<_len; i++) { - var el = els[i]; - if (el.CodeMirror) { - result.push(el); - } - } - return $(result); - }; - - CodeMirrorEditor.tracked = function (el) { - el = $(el)[0]; - while (el) { - if (el.CodeMirror) { - return true; - } - el = el.parentNode; - } - return false; - }; - - TogetherJS.addTracker(CodeMirrorEditor, true /* skip setInit */); - - - var CKEditor = util.Class({ - trackerName: "CKEditor", - - constructor: function (el) { - this.element = $(el)[0]; - assert(CKEDITOR); - assert(CKEDITOR.dom.element.get(this.element)); - this._change = this._change.bind(this); - // FIXME: change event is available since CKEditor 4.2 - this._editor().on("change", this._change); - }, - tracked: function (el) { - return this.element === $(el)[0]; - }, - destroy: function (el) { - this._editor().removeListener("change", this._change); - }, - - update: function (msg) { - //FIXME: use setHtml instead of setData to avoid frame reloading overhead - this._editor().editable().setHtml(msg.value); - }, - - init: function (update, msg) { - this.update(update); - }, - - makeInit: function () { - return { - element: this.element, - tracker: this.trackerName, - value: this.getContent() - }; - }, - - _change: function (e) { - if (inRemoteUpdate) { - return; - } - sendData({ - tracker: this.trackerName, - element: this.element, - value: this.getContent() - }); - }, - - _editor: function () { - return CKEDITOR.dom.element.get(this.element).getEditor(); - }, - - getContent: function () { - return this._editor().getData(); - } - }); - - CKEditor.scan = function () { - var result = []; - if (typeof CKEDITOR == "undefined") { - return; - } - var editorInstance; - for (var instanceIdentifier in CKEDITOR.instances) { - editorInstance = document.getElementById(instanceIdentifier) || document.getElementsByName(instanceIdentifier)[0]; - if (editorInstance) { - result.push(editorInstance); - } - } - return $(result); - }; - - CKEditor.tracked = function (el) { - if (typeof CKEDITOR == "undefined") { - return false; - } - el = $(el)[0]; - return !! (CKEDITOR.dom.element.get(el) && CKEDITOR.dom.element.get(el).getEditor()); - }; - - TogetherJS.addTracker(CKEditor, true /* skip setInit */); - - - function buildTrackers() { - assert(! liveTrackers.length); - util.forEachAttr(editTrackers, function (TrackerClass) { - var els = TrackerClass.scan(); - if (els) { - $.each(els, function () { - var tracker = new TrackerClass(this); - $(this).data("togetherjsHistory", ot.SimpleHistory(session.clientId, tracker.getContent(), 1)); - liveTrackers.push(tracker); - }); - } - }); - } - - function destroyTrackers() { - liveTrackers.forEach(function (tracker) { - tracker.destroy(); - }); - liveTrackers = []; - } - - function elementTracked(el) { - var result = false; - util.forEachAttr(editTrackers, function (TrackerClass) { - if (TrackerClass.tracked(el)) { - result = true; - } - }); - return result; - } - - function getTracker(el, name) { - el = $(el)[0]; - for (var i=0; i= STEPS.length) { - session.emit("startup-ready"); - return; - } - currentStep = STEPS[index]; - handlers[currentStep](startup.start); - }; - - var handlers = { - - browserBroken: function (next) { - if (window.WebSocket) { - next(); - return; - } - windowing.show("#togetherjs-browser-broken", { - onClose: function () { - session.close(); - } - }); - if ($.browser.msie) { - $("#togetherjs-browser-broken-is-ie").show(); - } - }, - - browserUnsupported: function (next) { - if (! $.browser.msie) { - next(); - return; - } - var cancel = true; - windowing.show("#togetherjs-browser-unsupported", { - onClose: function () { - if (cancel) { - session.close(); - } else { - next(); - } - } - }); - $("#togetherjs-browser-unsupported-anyway").click(function () { - cancel = false; - }); - }, - - sessionIntro: function (next) { - if ((! session.isClient) || ! session.firstRun) { - next(); - return; - } - TogetherJS.config.close("suppressJoinConfirmation"); - if (TogetherJS.config.get("suppressJoinConfirmation")) { - next(); - return; - } - var cancelled = false; - windowing.show("#togetherjs-intro", { - onClose: function () { - if (! cancelled) { - next(); - } - } - }); - $("#togetherjs-intro .togetherjs-modal-dont-join").click(function () { - cancelled = true; - windowing.hide(); - session.close("declined-join"); - }); - }, - - walkthrough: function (next) { - storage.settings.get("seenIntroDialog").then(function (seenIntroDialog) { - if (seenIntroDialog) { - next(); - return; - } - require(["walkthrough"], function (walkthrough) { - walkthrough.start(true, function () { - storage.settings.set("seenIntroDialog", true); - next(); - }); - }); - }); - }, - - share: function (next) { - TogetherJS.config.close("suppressInvite"); - if (session.isClient || (! session.firstRun) || - TogetherJS.config.get("suppressInvite")) { - next(); - return; - } - require(["windowing"], function (windowing) { - windowing.show("#togetherjs-share"); - // FIXME: no way to detect when the window is closed - // If there was a next() step then it would not work - }); - } - - }; - - return startup; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('videos',["jquery", "util", "session", "elementFinder"], -function ($, util, session, elementFinder) { - - var listeners = []; - - var TIME_UPDATE = 'timeupdate'; - var MIRRORED_EVENTS = ['play', 'pause']; - - var TOO_FAR_APART = 3000; - - session.on("reinitialize", function () { - unsetListeners(); - setupListeners(); - }); - - session.on("ui-ready", setupListeners); - - function setupListeners() { - var videos = $('video'); - setupMirroredEvents(videos); - setupTimeSync(videos); - } - - function setupMirroredEvents(videos) { - var currentListener; - MIRRORED_EVENTS.forEach(function (eventName) { - currentListener = makeEventSender(eventName); - videos.on(eventName, currentListener); - listeners.push({ - name: eventName, - listener: currentListener - }); - }); - } - - function makeEventSender(eventName) { - return function (event, options) { - var element = event.target; - options || (options = {}); - if (!options.silent) { - session.send({ - type: ('video-'+eventName), - location: elementFinder.elementLocation(element), - position: element.currentTime - }); - } - }; - } - - function setupTimeSync(videos) { - videos.each(function(i, video) { - var onTimeUpdate = makeTimeUpdater(); - $(video).on(TIME_UPDATE, onTimeUpdate); - listeners.push({ - name: TIME_UPDATE, - listener: onTimeUpdate - }); - }); - } - - function makeTimeUpdater() { - var last = 0; - return function (event) { - var currentTime = event.target.currentTime; - if(areTooFarApart(currentTime, last)){ - makeEventSender(TIME_UPDATE)(event); - } - last = currentTime; - }; - } - - function areTooFarApart(currentTime, lastTime) { - var secDiff = Math.abs(currentTime - lastTime); - var milliDiff = secDiff * 1000; - return milliDiff > TOO_FAR_APART; - } - - session.on("close", unsetListeners); - - function unsetListeners() { - var videos = $('video'); - listeners.forEach(function (event) { - videos.off(event.name, event.listener); - }); - listeners = []; - } - - - session.hub.on('video-timeupdate', function (msg) { - var element = $findElement(msg.location); - var oldTime = element.prop('currentTime'); - var newTime = msg.position; - - //to help throttle uneccesary position changes - if(areTooFarApart(oldTime, newTime)){ - setTime(element, msg.position); - } - }); - - MIRRORED_EVENTS.forEach( function (eventName) { - session.hub.on("video-"+eventName, function (msg) { - var element = $findElement(msg.location); - - setTime(element, msg.position); - - element.trigger(eventName, {silent: true}); - }); - }); - - //Currently does not discriminate between visible and invisible videos - function $findElement(location) { - return $(elementFinder.findElement(location)); - } - - function setTime(video, time) { - video.prop('currentTime', time); - } - -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -define('walkthrough',["util", "ui", "jquery", "windowing", "templates", "templating", "session", "peers"], function (util, ui, $, windowing, templates, templating, session, peers) { - var assert = util.assert; - var walkthrough = util.Module("walkthrough"); - var onHideAll = null; - var container = null; - - var slides = null; - - walkthrough.start = function (firstTime, doneCallback) { - if (! container) { - container = $(templates.walkthrough); - container.hide(); - ui.container.append(container); - slides = container.find(".togetherjs-walkthrough-slide"); - slides.hide(); - var progress = $("#togetherjs-walkthrough-progress"); - slides.each(function (index) { - var bullet = templating.sub("walkthrough-slide-progress"); - progress.append(bullet); - bullet.click(function () { - show(index); - }); - }); - container.find("#togetherjs-walkthrough-previous").click(previous); - container.find("#togetherjs-walkthrough-next").click(next); - ui.prepareShareLink(container); - container.find(".togetherjs-self-name").bind("keyup", function (event) { - var val = $(event.target).val(); - peers.Self.update({name: val}); - }); - container.find(".togetherjs-swatch").click(function () { - var picker = $("#togetherjs-pick-color"); - if (picker.is(":visible")) { - picker.hide(); - return; - } - picker.show(); - picker.find(".togetherjs-swatch-active").removeClass("togetherjs-swatch-active"); - picker.find(".togetherjs-swatch[data-color=\"" + peers.Self.color + "\"]").addClass("togetherjs-swatch-active"); - var location = container.find(".togetherjs-swatch").offset(); - picker.css({ - top: location.top, - // The -7 comes out of thin air, but puts it in the right place: - left: location.left-7 - }); - }); - if (session.isClient) { - container.find(".togetherjs-if-creator").remove(); - container.find(".togetherjs-ifnot-creator").show(); - } else { - container.find(".togetherjs-if-creator").show(); - container.find(".togetherjs-ifnot-creator").remove(); - } - TogetherJS.config.track("siteName", function (value) { - value = value || document.title; - container.find(".togetherjs-site-name").text(value); - }); - ui.activateAvatarEdit(container, { - onSave: function () { - container.find("#togetherjs-avatar-when-saved").show(); - container.find("#togetherjs-avatar-when-unsaved").hide(); - }, - onPending: function () { - container.find("#togetherjs-avatar-when-saved").hide(); - container.find("#togetherjs-avatar-when-unsaved").show(); - } - }); - // This triggers substititions in the walkthrough: - peers.Self.update({}); - session.emit("new-element", container); - } - assert(typeof firstTime == "boolean", "You must provide a firstTime boolean parameter"); - if (firstTime) { - container.find(".togetherjs-walkthrough-firsttime").show(); - container.find(".togetherjs-walkthrough-not-firsttime").hide(); - } else { - container.find(".togetherjs-walkthrough-firsttime").hide(); - container.find(".togetherjs-walkthrough-not-firsttime").show(); - } - onHideAll = doneCallback; - show(0); - windowing.show(container); - }; - - function show(index) { - slides.hide(); - $(slides[index]).show(); - var bullets = container.find("#togetherjs-walkthrough-progress .togetherjs-walkthrough-slide-progress"); - bullets.removeClass("togetherjs-active"); - $(bullets[index]).addClass("togetherjs-active"); - var $next = $("#togetherjs-walkthrough-next").removeClass("togetherjs-disabled"); - var $previous = $("#togetherjs-walkthrough-previous").removeClass("togetherjs-disabled"); - if (index == slides.length - 1) { - $next.addClass("togetherjs-disabled"); - } else if (index === 0) { - $previous.addClass("togetherjs-disabled"); - } - } - - function previous() { - var index = getIndex(); - index--; - if (index < 0) { - index = 0; - } - show(index); - } - - function next() { - var index = getIndex(); - index++; - if (index >= slides.length) { - index = slides.length-1; - } - show(index); - } - - function getIndex() { - var active = slides.filter(":visible"); - if (! active.length) { - return 0; - } - for (var i=0; i"); - $canvas[0].height = session.AVATAR_SIZE; - $canvas[0].width = session.AVATAR_SIZE; - var context = $canvas[0].getContext("2d"); - context.arc(session.AVATAR_SIZE/2, session.AVATAR_SIZE/2, session.AVATAR_SIZE/2, 0, Math.PI*2); - context.closePath(); - context.clip(); - context.drawImage($video[0], (session.AVATAR_SIZE - width) / 2, 0, width, height); - savePicture($canvas[0].toDataURL("image/png")); - } - - $upload.on("change", function () { - var reader = new FileReader(); - reader.onload = function () { - // FIXME: I don't actually know it's JPEG, but it's probably a - // good enough guess: - var url = "data:image/jpeg;base64," + util.blobToBase64(this.result); - convertImage(url, function (result) { - savePicture(result); - }); - }; - reader.onerror = function () { - console.error("Error reading file:", this.error); - }; - reader.readAsArrayBuffer(this.files[0]); - }); - - function convertImage(imageUrl, callback) { - var $canvas = $(""); - $canvas[0].height = session.AVATAR_SIZE; - $canvas[0].width = session.AVATAR_SIZE; - var context = $canvas[0].getContext("2d"); - var img = new Image(); - img.src = imageUrl; - // Sometimes the DOM updates immediately to call - // naturalWidth/etc, and sometimes it doesn't; using setTimeout - // gives it a chance to catch up - setTimeout(function () { - var width = img.naturalWidth || img.width; - var height = img.naturalHeight || img.height; - width = width * (session.AVATAR_SIZE / height); - height = session.AVATAR_SIZE; - context.drawImage(img, 0, 0, width, height); - callback($canvas[0].toDataURL("image/png")); - }); - } - - }); - - /**************************************** - * RTC support - */ - - function audioButton(selector) { - ui.displayToggle(selector); - if (selector == "#togetherjs-audio-incoming") { - $("#togetherjs-audio-button").addClass("togetherjs-animated").addClass("togetherjs-color-alert"); - } else { - $("#togetherjs-audio-button").removeClass("togetherjs-animated").removeClass("togetherjs-color-alert"); - } - } - - session.on("ui-ready", function () { - $("#togetherjs-audio-button").click(function () { - if ($("#togetherjs-rtc-info").is(":visible")) { - windowing.hide(); - return; - } - if (session.RTCSupported) { - enableAudio(); - } else { - windowing.show("#togetherjs-rtc-not-supported"); - } - }); - - if (! session.RTCSupported) { - audioButton("#togetherjs-audio-unavailable"); - return; - } - audioButton("#togetherjs-audio-ready"); - - var audioStream = null; - var accepted = false; - var connected = false; - var $audio = $("#togetherjs-audio-element"); - var offerSent = null; - var offerReceived = null; - var offerDescription = false; - var answerSent = null; - var answerReceived = null; - var answerDescription = false; - var _connection = null; - var iceCandidate = null; - - function enableAudio() { - accepted = true; - storage.settings.get("dontShowRtcInfo").then(function (dontShow) { - if (! dontShow) { - windowing.show("#togetherjs-rtc-info"); - } - }); - if (! audioStream) { - startStreaming(connect); - return; - } - if (! connected) { - connect(); - } - toggleMute(); - } - - ui.container.find("#togetherjs-rtc-info .togetherjs-dont-show-again").change(function () { - storage.settings.set("dontShowRtcInfo", this.checked); - }); - - function error() { - console.warn.apply(console, arguments); - var s = ""; - for (var i=0; i= expected) { - close(); - } else { - def.notify(users); - } - } - } - console.log("users", users); - }; - channel.send({ - type: "who", - "server-echo": true, - clientId: null - }); - var timeout = setTimeout(function () { - close(); - }, MAX_RESPONSE_TIME); - function close() { - if (timeout) { - clearTimeout(timeout); - } - if (lateResponseTimeout) { - clearTimeout(lateResponseTimeout); - } - channel.close(); - def.resolve(users); - } - }); - }; - - who.invite = function (hubUrl, clientId) { - return util.Deferred(function (def) { - var channel = channels.WebSocketChannel(hubUrl); - var id = util.generateId(); - channel.onmessage = function (msg) { - if (msg.type == "invite" && msg.inviteId == id) { - channel.close(); - def.resolve(); - } - }; - var userInfo = session.makeHelloMessage(false); - delete userInfo.type; - userInfo.clientId = session.clientId; - channel.send({ - type: "invite", - inviteId: id, - url: session.shareUrl(), - userInfo: userInfo, - forClientId: clientId, - clientId: null, - "server-echo": true - }); - }); - }; - - who.ExternalPeer = util.Class({ - isSelf: false, - isExternal: true, - constructor: function (id, attrs) { - attrs = attrs || {}; - assert(id); - this.id = id; - this.identityId = attrs.identityId || null; - this.status = attrs.status || "live"; - this.idle = attrs.status || "active"; - this.name = attrs.name || null; - this.avatar = attrs.avatar || null; - this.color = attrs.color || "#00FF00"; - this.lastMessageDate = 0; - this.view = ui.PeerView(this); - }, - - className: function (prefix) { - prefix = prefix || ""; - return prefix + util.safeClassName(this.id); - } - - }); - - return who; -}); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http:// mozilla.org/MPL/2.0/. */ - -define('youtubeVideos',["jquery", "util", "session", "elementFinder"], -function ($, util, session, elementFinder) { - - // constant var to indicate whether two players are too far apart in sync - var TOO_FAR_APART = 3000; - // embedded youtube iframes - var youTubeIframes = []; - // youtube API load delay - var API_LOADING_DELAY = 2000; - - session.on("reinitialize", function () { - if (TogetherJS.config.get("youtube")) { - prepareYouTube(); - } - }); - - session.on("close", function () { - $(youTubeIframes).each(function (i, iframe) { - // detach players from iframes - $(iframe).removeData("togetherjs-player"); - $(iframe).removeData("dontPublish"); - $(iframe).removeData("currentVideoId"); - // disable iframeAPI - $(iframe).removeAttr("enablejsapi"); - // remove unique youtube iframe indicators - var id = $(iframe).attr("id") || ""; - if (id.indexOf("youtube-player") === 0) { - // An id we added - $(iframe).removeAttr("id"); - } - youTubeIframes = []; - }); - }); - - TogetherJS.config.track("youtube", function (track, previous) { - if (track && ! previous) { - prepareYouTube(); - // You can enable youtube dynamically, but can't turn it off: - TogetherJS.config.close("youtube"); - } - }); - - function prepareYouTube() { - // setup iframes first - setupYouTubeIframes(); - - // this function should be global so it can be called when API is loaded - window.onYouTubeIframeAPIReady = function() { - // YouTube API is ready - $(youTubeIframes).each(function (i, iframe) { - var player = new YT.Player(iframe.id, { // get the reference to the already existing iframe - events: { - 'onReady': insertPlayer, - 'onStateChange': publishPlayerStateChange - } - }); - }); - }; - - if (window.YT === undefined) { - // load necessary API - // it calls onYouTubeIframeAPIReady automatically when the API finishes loading - var tag = document.createElement('script'); - tag.src = "https://www.youtube.com/iframe_api"; - var firstScriptTag = document.getElementsByTagName('script')[0]; - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); - } else { - // manually invoke APIReady function when the API was already loaded by user - onYouTubeIframeAPIReady(); - } - - // give each youtube iframe a unique id and set its enablejsapi param to true - function setupYouTubeIframes() { - var iframes = $('iframe'); - iframes.each(function (i, iframe) { - // if the iframe's unique id is already set, skip it - // FIXME: what if the user manually sets an iframe's id (i.e. "#my-youtube")? - // maybe we should set iframes everytime togetherjs is reinitialized? - if (($(iframe).attr("src") || "").indexOf("youtube") != -1 && !$(iframe).attr("id")) { - $(iframe).attr("id", "youtube-player"+i); - $(iframe).attr("enablejsapi", 1); - youTubeIframes[i] = iframe; - } - }); - } // iframes are ready - - function insertPlayer(event) { - // only when it is READY, attach a player to its iframe - var currentPlayer = event.target; - var currentIframe = currentPlayer.a; - // check if a player is already attached in case of being reinitialized - if (!$(currentIframe).data("togetherjs-player")) { - $(currentIframe).data("togetherjs-player", currentPlayer); - // initialize its dontPublish flag as well - $(currentIframe).data("dontPublish", false); - // store its current video's id - var currentVideoId = getVideoIdFromUrl(currentPlayer.getVideoUrl()); - $(currentIframe).data("currentVideoId", currentVideoId); - } - } - } // end of prepareYouTube - - function publishPlayerStateChange(event) { - var target = event.target; - var currentIframe = target.a; - // FIXME: player object retrieved from event.target has an incomplete set of essential functions - // this is most likely due to a recently-introduced problem with current YouTube API as others have been reporting the same issue (12/18/`13) - //var currentPlayer = target; - //var currentTime = currentPlayer.getCurrentTime(); - var currentPlayer = $(currentIframe).data("togetherjs-player"); - var currentTime = target.k.currentTime; - var iframeLocation = elementFinder.elementLocation(currentIframe); - - if ($(currentPlayer).data("seek")) { - $(currentPlayer).removeData("seek"); - return; - } - - // do not publish if playerState was changed by other users - if ($(currentIframe).data("dontPublish")) { - // make it false again so it can start publishing events of its own state changes - $(currentIframe).data("dontPublish", false); - return; - } - - // notify other people that I changed the player state - if (event.data == YT.PlayerState.PLAYING) { - - var currentVideoId = isDifferentVideoLoaded(currentIframe); - if (currentVideoId) { - // notify that I just loaded another video - publishDifferentVideoLoaded(iframeLocation, currentVideoId); - // update current video id - $(currentIframe).data("currentVideoId", currentVideoId); - } else { - session.send({ - type: "playerStateChange", - element: iframeLocation, - playerState: 1, - playerTime: currentTime - }); - } - } else if (event.data == YT.PlayerState.PAUSED) { - session.send({ - type: "playerStateChange", - element: iframeLocation, - playerState: 2, - playerTime: currentTime - }); - } else { - // do nothing when the state is buffering, cued, or ended - return; - } - } - - function publishDifferentVideoLoaded(iframeLocation, videoId) { - session.send({ - type: "differentVideoLoaded", - videoId: videoId, - element: iframeLocation - }); - } - - session.hub.on('playerStateChange', function (msg) { - var iframe = elementFinder.findElement(msg.element); - var player = $(iframe).data("togetherjs-player"); - var currentTime = player.getCurrentTime(); - var currentState = player.getPlayerState(); - - if (currentState != msg.playerState) { - $(iframe).data("dontPublish", true); - } - - if (msg.playerState == 1) { - player.playVideo(); - // seekTo() updates the video's time and plays it if it was already playing - // and pauses it if it was already paused - if (areTooFarApart(currentTime, msg.playerTime)) { - player.seekTo(msg.playerTime, true); - } - } else if (msg.playerState == 2) { - // When YouTube videos are advanced while playing, - // Chrome: pause -> pause -> play (onStateChange is called even when it is from pause to pause) - // FireFox: buffering -> play -> buffering -> play - // We must prevent advanced videos from going out of sync - player.pauseVideo(); - if (areTooFarApart(currentTime, msg.playerTime)) { - // "seek" flag will help supress publishing unwanted state changes - $(player).data("seek", true); - player.seekTo(msg.playerTime, true); - } - } - }); - - // if a late user joins a channel, synchronize his videos - session.hub.on('hello', function () { - // wait a couple seconds to make sure the late user has finished loading API - setTimeout(synchronizeVideosOfLateGuest, API_LOADING_DELAY); - }); - - session.hub.on('synchronizeVideosOfLateGuest', function (msg) { - var iframe = elementFinder.findElement(msg.element); - var player = $(iframe).data("togetherjs-player"); - // check if another video had been loaded to an existing iframe before I joined - var currentVideoId = $(iframe).data("currentVideoId"); - if (msg.videoId != currentVideoId) { - $(iframe).data("currentVideoId", msg.videoId); - player.loadVideoById(msg.videoId, msg.playerTime, 'default'); - } else { - // if the video is only cued, I do not have to do anything to sync - if (msg.playerState != 5) { - player.seekTo(msg.playerTime, true); - } - } - }); - - session.hub.on('differentVideoLoaded', function (msg) { - // load a new video if the host has loaded one - var iframe = elementFinder.findElement(msg.element); - var player = $(iframe).data("togetherjs-player"); - player.loadVideoById(msg.videoId, 0, 'default'); - $(iframe).data("currentVideoId", msg.videoId); - - }); - - function synchronizeVideosOfLateGuest() { - youTubeIframes.forEach(function (iframe) { - var currentPlayer = $(iframe).data("togetherjs-player"); - var currentVideoId = getVideoIdFromUrl(currentPlayer.getVideoUrl()); - var currentState = currentPlayer.getPlayerState(); - var currentTime = currentPlayer.getCurrentTime(); - var iframeLocation = elementFinder.elementLocation(iframe); - session.send({ - type: "synchronizeVideosOfLateGuest", - element: iframeLocation, - videoId: currentVideoId, - playerState: currentState, //this might be necessary later - playerTime: currentTime - }); - }); - } - - function isDifferentVideoLoaded(iframe) { - var lastVideoId = $(iframe).data("currentVideoId"); - var currentPlayer = $(iframe).data("togetherjs-player"); - var currentVideoId = getVideoIdFromUrl(currentPlayer.getVideoUrl()); - - // since url forms of iframe src and player's video url are different, - // I have to compare the video ids - if (currentVideoId != lastVideoId) { - return currentVideoId; - } else { - return false; - } - } - - // parses videoId from the url returned by getVideoUrl function - function getVideoIdFromUrl(videoUrl) { - var videoId = videoUrl.split('v=')[1]; - //Chrome and Firefox have different positions for parameters - var ampersandIndex = videoId.indexOf('&'); - if (ampersandIndex != -1) { - videoId = videoId.substring(0, ampersandIndex); - } - return videoId; - } - - function areTooFarApart(myTime, theirTime) { - var secDiff = Math.abs(myTime - theirTime); - var milliDiff = secDiff * 1000; - return milliDiff > TOO_FAR_APART; - } -}); -TogetherJS.require = TogetherJS._requireObject = require; -TogetherJS._loaded = true; -require(["session"]); -}()); \ No newline at end of file