define("orion/util",[],function(){var k=navigator.userAgent,l=-1!==k.indexOf("MSIE")||-1!==k.indexOf("Trident")?document.documentMode:void 0,h=parseFloat(k.split("Firefox/")[1]||k.split("Minefield/")[1])||void 0,g=-1!==k.indexOf("Opera")?parseFloat(k.split("Version/")[1]):void 0,d=parseFloat(k.split("Chrome/")[1])||void 0,f=-1!==k.indexOf("Safari")&&!d,e=parseFloat(k.split("WebKit/")[1])||void 0,c=-1!==k.indexOf("Android"),b=-1!==k.indexOf("iPad"),k=-1!==k.indexOf("iPhone"),n=b||k,a=-1!==navigator.platform.indexOf("Mac"),
m=-1!==navigator.platform.indexOf("Win"),s=-1!==navigator.platform.indexOf("Linux"),t="ontouchstart"in document.createElement("input");return{formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,m){return b[(m<<0)+1]})},createElement:function(a,b){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",b):a.createElement(b)},isIE:l,isFirefox:h,isOpera:g,isChrome:d,isSafari:f,isWebkit:e,isAndroid:c,isIPad:b,isIPhone:k,isIOS:n,isMac:a,isWindows:m,
isLinux:s,isTouch:t,platformDelimiter:m?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(k){function l(b,c){c||(c=document);return c.querySelectorAll(b)}function h(b){var c=b.tabIndex;0===c&&k.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[b.nodeName.toLowerCase()]&&!b.attributes.tabIndex&&(c=-1);return c}function g(b){if(0<=h(b))return b;if(b.hasChildNodes())for(var c=0;c<b.childNodes.length;c++){var a=g(b.childNodes[c]);if(a)return a}return null}function d(b){if(0<=
h(b))return b;if(b.hasChildNodes())for(var c=b.childNodes.length-1;0<=c;c--){var a=d(b.childNodes[c]);if(a)return a}return null}function f(b,c){if(3===b.nodeType){var a=e.exec(b.nodeValue);a&&1<a.length&&c(b,a)}if(b.hasChildNodes())for(a=0;a<b.childNodes.length;a++)f(b.childNodes[a],c)}var e=/\$\{([^\}]+)\}/,c=null;return{$:function(b,c){c||(c=document);return c.querySelector(b)},$$:l,$$array:function(b,c){return Array.prototype.slice.call(l(b,c))},node:function(b){var c=b;"string"===typeof b&&(c=
document.getElementById(b));return c},contains:function(b,c){if(!b||!c)return!1;if(b===c)return!0;var a=b.compareDocumentPosition(c);return Boolean(a&16)},bounds:function(b){b=b.getBoundingClientRect();return{left:b.left+document.documentElement.scrollLeft,top:b.top+document.documentElement.scrollTop,width:b.width,height:b.height}},empty:function(b){for(;b.hasChildNodes();)b.removeChild(b.firstChild)},firstTabbable:g,lastTabbable:d,stop:function(b){window.document.all&&(b.keyCode=0);b.preventDefault&&
(b.preventDefault(),b.stopPropagation())},processTextNodes:function(b,c){f(b,function(a,b){a.parentNode.replaceChild(document.createTextNode(c[b[1]]||b[1]),a)})},processDOMNodes:function(b,c){f(b,function(a,b){var e=c[b[1]];if(e){var d=document.createRange(),p=b.index;d.setStart(a,p);d.setEnd(a,p+b[0].length);d.deleteContents();d.insertNode(e)}})},addAutoDismiss:function(b,e){function a(a){c.forEach(function(b){var c=!1,e=b.excludeNodes.some(function(b){return document.body.contains(b)?(c=!0,b.contains(a.target)):
!1});if(c&&!e)try{b.dismiss(a)}catch(n){"undefined"!==typeof console&&console&&console.error(n&&n.message)}});c=c.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===c&&(c=[],document.addEventListener("click",a,!0),k.isIOS&&document.addEventListener("touchend",function(a){function b(){a.target.removeEventListener("click",b)}0===a.touches.length&&a.target.addEventListener("click",b)},!1));c.push({excludeNodes:b,dismiss:e})},setFramesEnabled:function(b){for(var c=
document.getElementsByTagName("iframe"),a=0;a<c.length;a++)c[a].parentNode.style.pointerEvents=b?"":"none"},removeAutoDismiss:function(b){c=c.filter(function(c){return b!==c.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
(function(k,l){"function"===typeof define&&define.amd?define("orion/Deferred",l):"object"===typeof exports?module.exports=l():(k.orion=k.orion||{},k.orion.Deferred=l())})(this,function(){function k(){for(var c;c=d.shift();)c();f=!1}function l(c){d.push(c);f||(f=!0,e())}function h(c){return function(b){c(b)}}function g(){function c(){for(var a;a=f.shift();){var b=a.deferred,c="fulfilled"===d?"resolve":"reject";a=a[c];if("function"===typeof a)try{var e=a(m),n=e&&("object"===typeof e||"function"===typeof e)&&
e.then;if("function"===typeof n)if(e===b.promise)b.reject(new TypeError);else{var p=e.cancel;"function"===typeof p?b._parentCancel=p.bind(e):delete b._parentCancel;n.call(e,h(b.resolve),h(b.reject),h(b.progress))}else b.resolve(e)}catch(g){b.reject(g)}else b[c](m)}}function b(a){delete p._parentCancel;d="rejected";m=a;f.length&&l(c)}function e(a){function u(a){return function(b){(!d||"assumed"===d)&&a(b)}}delete p._parentCancel;try{var h=a&&("object"===typeof a||"function"===typeof a)&&a.then;if("function"===
typeof h)if(a===p)b(new TypeError);else{d="assumed";var k=a&&a.cancel;if("function"!==typeof k){var x=new g;a=x.promise;try{h(x.resolve,x.reject,x.progress)}catch(y){x.reject(y)}k=a.cancel;h=a.then}m=a;h.call(a,u(e),u(b));p._parentCancel=k.bind(a)}else d="fulfilled",m=a,f.length&&l(c)}catch(A){u(b)(A)}}function a(){var a=p._parentCancel;a?(delete p._parentCancel,a()):d||(a=Error("Cancel"),a.name="Cancel",b(a))}var m,d,f=[],p=this;this.resolve=function(a){d||e(a);return p};this.reject=function(a){d||
b(a);return p};this.progress=function(a){d||f.forEach(function(b){if(b.progress)try{b.progress(a)}catch(c){}});return p.promise};this.cancel=function(){p._parentCancel?setTimeout(a,0):a();return p};this.then=function(a,b,e){var m=new g;m._parentCancel=p.promise.cancel;f.push({resolve:a,reject:b,progress:e,deferred:m});("fulfilled"===d||"rejected"===d)&&l(c);return m.promise};this.promise={then:p.then,cancel:p.cancel}}var d=[],f=!1,e=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var c=
process.nextTick;return function(){c(k)}}if("function"===typeof MutationObserver){var b=document.createElement("div");(new MutationObserver(k)).observe(b,{attributes:!0});return function(){b.setAttribute("class","_tick")}}return function(){setTimeout(k,0)}}();g.all=function(c,b){function e(a,b){f||(d[a]=b,0===--m&&p.resolve(d))}function a(a,c){if(!f){if(b)try{e(a,b(c));return}catch(m){c=m}p.reject(c)}}var m=c.length,d=[],f=!1,p=new g;p.then(void 0,function(){f=!0;c.forEach(function(a){a.cancel&&a.cancel()})});
0===m?p.resolve(d):c.forEach(function(b,c){b.then(e.bind(void 0,c),a.bind(void 0,c))});return p.promise};g.when=function(c,b,e,a){var m;c&&"function"===typeof c.then||(m=new g,m.resolve(c),c=m.promise);return c.then(b,e,a)};return g});
define("orion/EventTarget",[],function(){function k(){this._namedListeners={}}k.prototype={dispatchEvent:function(k){if(!k.type)throw Error("unspecified type");var h=this._namedListeners[k.type];h&&h.forEach(function(g){try{"function"===typeof g?g(k):g.handleEvent(k)}catch(d){"undefined"!==typeof console&&console.log(d)}});return!k.defaultPrevented},addEventListener:function(k,h){if("function"===typeof h||h.handleEvent)this._namedListeners[k]=this._namedListeners[k]||[],this._namedListeners[k].push(h)},
removeEventListener:function(k,h){var g=this._namedListeners[k];if(g)for(var d=0;d<g.length;d++)if(g[d]===h){1===g.length?delete this._namedListeners[k]:g.splice(d,1);break}}};k.prototype.constructor=k;k.attach=function(l){var h=new k;l.dispatchEvent=h.dispatchEvent.bind(h);l.addEventListener=h.addEventListener.bind(h);l.removeEventListener=h.removeEventListener.bind(h)};return k});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(k,l){function h(c,b,e){this._properties=e||{};this._properties["service.id"]=c;this._properties.objectClass=b;this._properties["service.names"]=b}function g(c,b,e){this._serviceId=c;this._serviceReference=b;this._internalRegistry=e}function d(c,b){function e(a){return function(){var e;try{if(!b())throw Error("Service was unregistered");var d=c[a].apply(c,Array.prototype.slice.call(arguments));if(d&&"function"===typeof d.then)return d;
e=new k;e.resolve(d)}catch(n){e=new k,e.reject(n)}return e.promise}}for(var a in c)"function"===typeof c[a]&&(this[a]=e(a))}function f(c,b){this.type=c;this.serviceReference=b}function e(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new l;var c=this;this._internalRegistry={isRegistered:function(b){return c._entries[b]?!0:!1},unregisterService:function(b){var e=c._entries[b];if(!e)throw Error("Service has already been unregistered: "+b);var a=e.reference;c._serviceEventTarget.dispatchEvent(new f("unregistering",
a));c._entries[b]=null;a.getProperty("objectClass").forEach(function(b){for(var e=c._namedReferences[b],d=0;d<e.length;d++)if(e[d]===a){1===e.length?delete c._namedReferences[b]:e.splice(d,1);break}})},modifyService:function(b){var e=c._entries[b];if(!e)throw Error("Service not found while trying to send modified event: "+b);c._serviceEventTarget.dispatchEvent(new f("modified",e.reference))}}}h.prototype={getPropertyKeys:function(){var c=[],b;for(b in this._properties)this._properties.hasOwnProperty(b)&&
c.push(b);return c},getProperty:function(c){return this._properties[c]}};h.prototype.constructor=h;g.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(c){var b=this._serviceReference._properties;this._serviceReference._properties=c||{};c["service.id"]=this._serviceId;
c.objectClass=b.objectClass;c["service.names"]=b["service.names"];this._internalRegistry.modifyService(this._serviceId)}};g.prototype.constructor=g;e.prototype={getService:function(c){var b;if("string"===typeof c)(c=this._namedReferences[c])&&c.some(function(c){b=this._entries[c.getProperty("service.id")].service;return!!b},this);else if(c=this._entries[c.getProperty("service.id")])b=c.service;return b||null},getServiceReferences:function(c){if(c)return this._namedReferences[c]?this._namedReferences[c]:
[];var b=[];this._entries.forEach(function(c){c&&b.push(c.reference)});return b},registerService:function(c,b,e){if("undefined"===typeof b||null===b)throw Error("invalid service");"string"===typeof c?c=[c]:Array.isArray(c)||(c=[]);var a=this._entries.length,m=new h(a,c,e),s=this._namedReferences;c.forEach(function(a){s[a]=s[a]||[];s[a].push(m)});c=new d(b,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:m,service:c});c=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new f("registered",
m));return new g(a,m,c)},addEventListener:function(c,b){this._serviceEventTarget.addEventListener(c,b)},removeEventListener:function(c,b){this._serviceEventTarget.removeEventListener(c,b)}};e.prototype.constructor=e;return{ServiceRegistry:e}});
define("orion/xhr",["orion/Deferred"],function(k){function l(h,g,d,f){var e="undefined"!==typeof d.response?d.response:d.responseText,c;try{c=d.status}catch(b){c=0}h={args:g,response:e,responseText:"string"===typeof e?e:null,status:c,url:h,xhr:d};"undefined"!==typeof f&&(h.error=f);return h}return function(h,g,d){d=d||{};var f=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new k,c=d.headers||{},b=d.log||!1,n;"undefined"===typeof c["X-Requested-With"]&&(c["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof d.data&&("POST"===h||"PUT"===h))n=d.data;var a=!1,m=!1;e.promise.then(void 0,function(b){a=!0;!m&&b instanceof Error&&"Cancel"===b.name&&f.abort()});f.onabort=function(){m=!0;if(!a){var b=Error("Cancel");b.name="Cancel";e.reject(b)}};f.onload=function(){var a=l(g,d,f);200<=f.status&&400>f.status?e.resolve(a):(e.reject(a),b&&"undefined"!==typeof console&&console.log(Error(f.statusText)))};f.onerror=function(){var a=l(g,d,f);e.reject(a);b&&"undefined"!==typeof console&&console.log(Error(f.statusText))};
f.onprogress=function(a){a.xhr=f;e.progress(a)};try{f.open(h,g,!0);"string"===typeof d.responseType&&(f.responseType=d.responseType);if("number"===typeof d.timeout)if("number"===typeof f.timeout)f.timeout=d.timeout,f.addEventListener("timeout",function(a){e.reject(l(g,d,f,"Timeout exceeded"))});else{var s=setTimeout(function(){e.reject(l(g,d,f,"Timeout exceeded"))},d.timeout);e.promise.then(clearTimeout.bind(null,s),clearTimeout.bind(null,s))}Object.keys(c).forEach(function(a){f.setRequestHeader(a,
c[a])});f.send(n||null)}catch(t){e.reject(l(g,d,f,t))}return e.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(k,l,h){function g(b,a){this._name=b;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function d(b,a){return{get:function(c,e){if(0===a)return null;var d=localStorage.getItem(b+c);if(null===d)return null;d=JSON.parse(d);return e||-1===a||d._expires&&d._expires>(new Date).getTime()?(delete d._expires,d):null},set:function(c,e){if(0!==a)if(-1!==a&&(e._expires=(new Date).getTime()+
1E3*a),0===Object.keys(e).length)localStorage.removeItem(b+c);else{var d=JSON.stringify(e);localStorage.setItem(b+c,d);delete e._expires}},remove:function(a){localStorage.removeItem(b+a)}}}function f(b){this._currentPromises={};this._cache=new d("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=b.getServiceReferences("orion.core.preference.provider");0<a.length&&(this._service=b.getService(a[0]))}return!!this._service}}function e(b){this._location=
b;this._currentPromise=null;this._cache=new d("/orion/preferences/default",3600)}function c(){this._cache=new d("/orion/preferences/local",-1)}function b(b,a){this._userProvider=new f(b);this._localProvider=new c;a=a||"defaults.pref";-1===a.indexOf("://")&&(a=k.toUrl(a));this._defaultsProvider=new e(a);this._serviceRegistration=b.registerService("orion.core.preference",this)}g.prototype={_flush:function(){for(var b=[],a=0;a<this._stores.length;++a){var c=this._stores[a];-1!==this._dirty.indexOf(c)&&
b.push(this._providers[a].put(this._name,c));if(this._pendingDeletes[a]&&0<this._pendingDeletes[a].length){for(c=0;c<this._pendingDeletes[a].length;c++)b.push(this._providers[a].remove(this._name,this._pendingDeletes[a][c]));delete this._pendingDeletes[a]}}this._dirty=[];return l.all(b)},_scheduleFlush:function(b){b&&-1===this._dirty.indexOf(b)&&this._dirty.push(b);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){this._flushPending&&(this._flushPending=!1,this._flush())}.bind(this),
0))},_getCached:function(){if(!this._cached){this._cached={};for(var b=0;b<this._stores.length;++b){var a=this._stores[b],c;for(c in a)a.hasOwnProperty(c)&&"undefined"===typeof this._cached[c]&&(this._cached[c]=a[c])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(b){return this._getCached()[b]},put:function(b,a){if(0!==this._stores.length){var c=this._stores[0];c[b]!==a&&(c[b]=a,this._cached=null,this._scheduleFlush(c))}},remove:function(b){for(var a=0;a<
this._stores.length;++a){var c=this._stores[a];if(c.hasOwnProperty(b))return delete c[b],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(b),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var b=0;b<this._stores.length;++b)this._stores[b]={},this._scheduleFlush(this._stores[b]);this._cached=null},sync:function(b){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,c=[],e=0;e<this._providers.length;++e)c.push(this._providers[e].get(this._name,
b).then(function(b){return function(c){a._stores[b]=c}}(e)));return l.all(c).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};f.prototype={get:function(b,a){if(this._currentPromises[b])return this._currentPromises[b];var c=new l,e=null;a?this._cache.remove(b):e=this._cache.get(b);if(null!==e)c.resolve(e);else{this._currentPromises[b]=c;var d=this;this._service.get(b).then(function(a){d._cache.set(b,a);delete d._currentPromises[b];c.resolve(a)},function(a){404===a.status?
(a={},d._cache.set(b,a),delete d._currentPromises[b],c.resolve(a)):(delete d._currentPromises[b],c.resolve(d._cache.get(b,!0)||{}))})}return c},put:function(b,a){this._cache.set(b,a);return this._service.put(b,a)},remove:function(b,a){var c=this._cache.get(b);delete c[a];this._cache.set(b,c);return this._service.remove(b,a)}};e.prototype={get:function(b,a){if(this._currentPromise)return this._currentPromise;var c=new l,e=null;a?this._cache.remove(b):e=this._cache.get(b);if(null!==e)c.resolve(e);else{this._currentPromise=
c;var d=this;h("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);d._cache.set(b,a[b]||{});d._currentPromise=null;c.resolve(a[b]||{})},function(a){401===a.xhr.status||404===a.xhr.status?(d._cache.set(b,{}),d._currentPromise=null,c.resolve({})):(d._currentPromise=null,a=d._cache.get(b,!0),null!==a?c.resolve(a[b]||{}):c.resolve({}))})}return c},put:function(b,a){var c=new l;c.resolve();return c},remove:function(b,a){var c=this._cache.get(b);
delete c[a];this.put(b,c)}};c.prototype={get:function(b){var a=new l;b=this._cache.get(b);null!==b?a.resolve(b):a.resolve({});return a},put:function(b,a){var c=new l;this._cache.set(b,a);c.resolve();return c},remove:function(b,a){var c=this._cache.get(b);delete c[a];this.put(b,c)}};b.DEFAULT_SCOPE=1;b.LOCAL_SCOPE=2;b.USER_SCOPE=4;b.prototype={listenForChangedSettings:function(c,a,e){if(!a||"number"!==typeof a||7<a||1>a)e=a,a=b.DEFAULT_SCOPE|b.LOCAL_SCOPE|b.USER_SCOPE;window.addEventListener("storage",
e,!1);return 0!==(b.USER_SCOPE&a)?"/orion/preferences/user"+c:0!==(b.LOCAL_SCOPE&a)?"/orion/preferences/local"+c:"/orion/preferences/default"+c},getPreferences:function(c,a){if(!a||"number"!==typeof a||7<a||1>a)a=b.DEFAULT_SCOPE|b.LOCAL_SCOPE|b.USER_SCOPE;var e=[];b.USER_SCOPE&a&&this._userProvider.available()&&e.push(this._userProvider);b.LOCAL_SCOPE&a&&e.push(this._localProvider);b.DEFAULT_SCOPE&a&&e.push(this._defaultsProvider);var d=new g(c,e);return d.sync().then(function(){return d})},getSetting:function(b,
a,c){for(var e,d=0;d<b.length;d++)if(b[d].label===a)for(var p=0;p<b[d].data.length;p++)if(b[d].data[p].label===c){e=b[d].data[p].value;break}return e}};return{PreferencesService:b}});
(function(){function k(a){if("string"!==typeof a)throw new TypeError;}function l(a){return a?a.split("\x26"):[]}function h(a){return 0===a.length?"":a.join("\x26")}function g(a){var b=/([^=]*)(?:=?)(.*)/.exec(a);a=b[1]?decodeURIComponent(b[1]):"";b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function d(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="\x3d"+encodeURIComponent(a[1]));return b}function f(a,b){var c="",q=[],e=0;return{next:function(){c!==a.query&&(c=a.query,q=l(c));if(e<q.length){var d=
g(q[e++]);switch(b){case "keys":return d[0];case "values":return d[1];case "keys+values":return[d[0],d[1]];default:throw new TypeError;}}throw z;}}}function e(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function c(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function b(a){var b=[];a.split("/").forEach(function(a){".."===a?b.pop():"."!==a&&b.push(a)});return b.join("/")}function n(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,q){if("string"!==
typeof a)throw new TypeError;a=n(a);var e=p.exec(a);if(!e)return null;var d={};d.scheme=e[1]||"";if(d.scheme&&!u.test(d.scheme))return null;var m=e[2];if(m&&(m=r.exec(m),d.userinfo=m[1],d.host=m[2],d.port=m[3],d.port&&!w.test(d.port)))return null;d.path=e[3];d.query=e[4];d.fragment=e[5];!d.scheme&&q&&(d.scheme=q.scheme,!d.host&&q.host&&(d.userinfo=q.userinfo,d.host=q.host,d.port=q.port,d.pathRelative=!0));d.pathRelative&&(d.path?"/"!==d.path[0]&&(e=/^(.*\/)[^\/]*$/.exec(q.path)[1]||"/",d.path=e+d.path):
d.path=q.path);d.scheme&&(d.scheme=d.scheme.toLowerCase());d.port&&(d.port=c(d.port));d.host&&d.path&&(d.path=b(d.path));return d}function m(b,c){var q;if(c){c=c.href||c;q=a(c);if(!q||!q.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:q})}q=a(b,q);if(!q)throw new SyntaxError;Object.defineProperty(this,"_input",{value:b,writable:!0});Object.defineProperty(this,"_url",{value:q,writable:!0});var d=new e(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var s;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(s=new window.URL("http://www.w3.org?q")).protocol&&s.query)return}catch(t){}var p=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,r=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,u=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,w=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,x=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,y=/^([^?#\s]*)$/,A=/^([^\s]*)$/,q=/^\S*$/,B=/([^:]*):?(.*)/,z="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),C={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(e.prototype,{get:{value:function(a){k(a);var b;l(this._url.query).some(function(c){c=g(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){k(a);k(b);var c=l(this._url.query);c.some(function(q,e){var m=g(q);if(m[0]===a)return m[1]=b,c[e]=d(m),!0})||c.push(d([a,b]));this._url.query=h(c)},enumerable:!0},has:{value:function(a){k(a);
return l(this._url.query).some(function(b){if(g(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){k(a);var b=l(this._url.query),c=b.filter(function(b){return g(b)[0]!==a});return c.length!==b.length?(this._url.query=h(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if("function"!==typeof a)throw new TypeError;var c=f(this._url,"keys+values");try{for(;;){var q=c.next();a.call(b,q[1],q[0],this)}}catch(e){if(e!==z)throw e;
}},enumerable:!0},keys:{value:function(){return f(this._url,"keys")},enumerable:!0},values:{value:function(){return f(this._url,"values")},enumerable:!0},items:{value:function(){return f(this._url,"keys+values")}},size:{get:function(){return l(this._url.query).length},enumerable:!0},getAll:{value:function(a){k(a);var b=[];l(this._url.query).forEach(function(c){c=g(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){k(a);k(b);var c=l(this._url.query);c.push(d([a,b]));this._url.query=
h(c)},enumerable:!0}});Object.defineProperties(m.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(b){k(b);this._input=b;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){k(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||u.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){k(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=B.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){k(a);if(this._url){var b=
B.exec(this._userinfo);a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=B.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){k(a);if(this._url){var b=[B.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){k(a);if(this._url&&(a=x.exec(a)))this._url.host=a[1],this._url.port=c(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){k(a);this._url&&v.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===C[this.protocol]&&(a="");return a},set:function(a){k(a);this._url&&w.exec(a)&&(this._url.port=c(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){k(a);
this._url&&y.exec(a)&&(this._url.host&&a&&"/"!==a[0]&&(a="/"+a),this._url.path=a?b(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){k(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),A.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){k(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),q.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((s=window.URL||window.webkitURL)&&s.createObjectURL)Object.defineProperty(m,"createObjectURL",{value:s.createObjectURL.bind(s),enumerable:!1}),Object.defineProperty(m,"revokeObjectURL",{value:s.revokeObjectURL.bind(s),enumerable:!1});window.URL=m})();define("orion/URL-shim",[],function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(k,l,h){function g(a,b){var c=Object.keys(a),e=Object.keys(b);if(c.length!==e.length)return!1;c.sort();e.sort();for(var d=0,m=c.length;d<m;d++){var n=c[d];if(n!==e[d])return!1;var f=a[n],n=b[n];if(f!==n&&JSON.stringify(f)!==JSON.stringify(n))return!1}return!0}function d(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(b){}return a}function f(a){var b=null,c={key:function(c){return(b=
b||Object.keys(a))[c]},getItem:function(b){return a[b]},setItem:function(c,e){a[c]=e;b=null},removeItem:function(c){delete a[c];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(b){delete a[b]}.bind(this));b=null}};Object.defineProperty(c,"length",{get:function(){return(b=b||Object.keys(a)).length}});return c}function e(a,b){if(b&&b instanceof XMLHttpRequest){var c,e;try{c=b.status,e=b.statusText}catch(d){c=0,e=""}return{status:c||0,statusText:e}}return b}function c(a){var b=a?JSON.parse(JSON.stringify(a,
e)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function b(a,b){this.type=a;this.plugin=b}function n(a,b){this.__objectId=a;this.__methods=b}function a(a,e,d){function m(a){S&&d.postMessage(a,S)}function f(a){if(!S)return(new k).reject(Error("plugin not connected"));a.id=String(M++);var b=new k;T[a.id]=b;b.then(null,function(b){"active"===D&&b instanceof Error&&"Cancel"===b.name&&m({requestId:a.id,method:"cancel",params:b.message?[b.message]:
[]})});var c=Object.prototype.toString;a.params.forEach(function(q,e){if("[object Object]"===c.call(q)&&!(q instanceof n)){var d,m;for(d in q)"[object Function]"===c.call(q[d])&&(m=m||[],m.push(d));if(m){var z=U++;P[z]=q;d=function(){delete P[z]};b.then(d,d);a.params[e]=new n(z,m)}}});d.postMessage(a,S);return b.promise}function h(a,b){a||0===a?m({id:a,result:null,error:b}):console.log(b)}function v(a,b,q,e){e.forEach(function(a,b){if(a&&"undefined"!==typeof a.__objectId){var c={};a.__methods.forEach(function(b){c[b]=
function(){return f({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});e[b]=c}});var d=void 0===typeof a?null:{id:a,result:null,error:null};try{var z=q.apply(b,e);d&&(z&&"function"===typeof z.then?(V[a]=z,z.then(function(b){delete V[a];d.result=b;m(d)},function(b){V[a]&&(delete V[a],d.error=c(b),m(d))},function(){m({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=z,m(d)))}catch(n){d&&(d.error=c(n),m(d))}}function x(a){try{if(a.method){var b=
a.method,c=a.params||[];if("serviceId"in a){var q=Y[a.serviceId];q||h(a.id,"service not found");b in q?v(a.id,q,q[b],c):h(a.id,"method not found")}else if("objectId"in a){var e=P[a.objectId];e||h(a.id,"object not found");b in e?v(a.id,e,e[b],c):h(a.id,"method not found")}else if("requestId"in a){var m=V[a.requestId];m&&"cancel"===b&&m.cancel&&m.cancel.apply(m,c)}else if("responseId"in a){var n=T[a.responseId];n&&"progress"===b&&n.progress&&n.progress.apply(n,c)}else if("plugin"===a.method){var B=
a.params[0];F({headers:B.headers,services:B.services}).then(function(){Q&&Q.resolve(z)})}else if("timeout"===a.method)Q&&Q.reject(a.error);else throw Error("Bad method: "+a.method);}else{var s=T[String(a.id)];delete T[String(a.id)];if(a.error){var f=d.handleServiceError(z,a.error);s.reject(f)}else s.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}function y(a){var b={};if(a.methods&&(a.methods.forEach(function(c){b[c]=function(){var b={serviceId:a.serviceId,method:c,params:Array.prototype.slice.call(arguments)};
return"active"===D?f(b):z.start({"transient":!0}).then(function(){return f(b)})}}),b.addEventListener&&b.removeEventListener)){var c=new l,q=U++;P[q]={handleEvent:c.dispatchEvent.bind(c)};var e=new n(q,["handleEvent"]),d=b.addEventListener;b.addEventListener=function(a,b){c._namedListeners[a]||d(a,e);c.addEventListener(a,b)};var m=b.removeEventListener;b.removeEventListener=function(a,b){c.removeEventListener(a,b);c._namedListeners[a]||m(a,e)}}return b}function A(b){var c=JSON.parse(JSON.stringify(b.properties));
c.__plugin__=a;b=b.names||b.type||[];Array.isArray(b)||(b=[b]);c.objectClass=b;return c}function q(a){var b=y(a),c=A(a),c=d.registerService(a.names||a.type,b,c);J[a.serviceId]={registration:c,proxy:b}}function B(){d.persist(a,{created:C,headers:L,services:G,autostart:E,lastModified:I})}var z=this;e=e||{};var C=e.created||(new Date).getTime(),L=e.headers||{},G=e.services||[],E=e.autostart,I=e.lastModified||0,D="installed",H,Q,S,K,J={},M=0,U=0,V={},T={},P={},Y={},F;this._persist=B;this._resolve=function(){D=
"resolved";d.dispatchEvent(new b("resolved",z))};this._getAutostart=function(){return E};this._getCreated=function(){return C};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(L))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return I};this.getServiceReferences=function(){var a=[];Object.keys(J).forEach(function(b){a.push(J[b].registration.getReference())});
return a};this.setParent=function(a){return K!==a?(K=a,z.stop({"transient":!0}).then(function(){if("started"===E)return z.start({"transient":!0});if("lazy"===E)return z.start({lazy:!0,"transient":!0})})):(new k).resolve()};this.getState=function(){return D};this.start=function(c){if("uninstalled"===D)return(new k).reject(Error("Plugin is uninstalled"));if(H)return H.promise.then(this.start.bind(this,c));if("active"===D)return(new k).resolve();if(!c||!c.transient){var e=c&&c.lazy?"lazy":"started";
e!==E&&(E=e,B())}e=d.getState();if("starting"!==e&&"active"!==e)return c.transient?(new k).reject(Error("start transient error")):(new k).resolve();if("installed"===D)try{this._resolve()}catch(m){return(new k).reject(m)}"resolved"===D&&G.forEach(function(a){q(a)});if(c&&c.lazy)return"starting"!==D&&(D="starting",d.dispatchEvent(new b("lazy activation",z))),(new k).resolve();var n=new k;H=n;D="starting";d.dispatchEvent(new b("starting",z));Q=new k;S=d.connect(a,x,K);Q.then(function(){Q=null;D="active";
d.dispatchEvent(new b("started",z));H=null;n.resolve()},function(){Q=null;D="stopping";d.dispatchEvent(new b("stopping",z));Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});d.disconnect(S);S=null;D="resolved";H=null;d.dispatchEvent(new b("stopped",z));n.reject(Error("plugin activation error"))});return n.promise};this.stop=function(a){if("uninstalled"===D)return(new k).reject(Error("Plugin is uninstalled"));if(H)return H.promise.then(this.stop.bind(this,a));if((!a||
!a.transient)&&"stopped"!==E)E="stopped",B();if("active"!==D&&"starting"!==D)return(new k).resolve();H=a=new k;D="stopping";d.dispatchEvent(new b("stopping",z));Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});S&&(d.disconnect(S),S=null);D="resolved";H=null;d.dispatchEvent(new b("stopped",z));a.resolve();return a.promise};F=function(c){if("uninstalled"===D)return(new k).reject(Error("Plugin is uninstalled"));if(!c)return 0===I&&(I=(new Date).getTime(),B()),d.loadManifest(a).then(F);
var e=L,m=G,n=E;L=c.headers||{};G=c.services||{};E=c.autostart||E;c.lastModified?I=c.lastModified:(I=(new Date).getTime(),B());if(g(L,e)&&g(G,m)&&E===n)return(new k).resolve();if("active"===D||"starting"===D){var f=[];Object.keys(G).forEach(function(a){var b=G[a];f.push(a);var c=J[a];if(c){if(g(b.methods,Object.keys(c.proxy))){a=A(b);var e=c.registration.getReference(),d={};e.getPropertyKeys().forEach(function(a){d[a]=e.getProperty(a)});g(a,d)||c.registration.setProperties(a);return}c.registration.unregister();
delete J[a]}q(b)});Object.keys(J).forEach(function(a){-1===f.indexOf(a)&&(J[a].registration.unregister(),delete J[a])})}"active"===D&&(d.disconnect(S),Q=new k,S=d.connect(a,x,K),Q.then(function(){Q=null},function(){Q=null;D="stopping";d.dispatchEvent(new b("stopping"),z);Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});d.disconnect(S);S=null;D="resolved";d.dispatchEvent(new b("stopped",z))}));return(new k).resolve()};this.update=function(a){return F(a).then(function(){d.dispatchEvent(new b("updated",
z))})};this.uninstall=function(){if("uninstalled"===D)return(new k).reject(Error("Plugin is uninstalled"));if("active"===D||"starting"===D||"stopping"===D)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));d.removePlugin(this);D="uninstalled";d.dispatchEvent(new b("uninstalled",z));return(new k).resolve()}}var m=/^http[s]?/i;return{Plugin:a,PluginRegistry:function(c,e){function n(a){var b=a.source;x.some(function(c){if(b===c.target){try{var q;if("undefined"===typeof c.useStructuredClone){var e=
"string"!==typeof a.data;q=e?a.data:JSON.parse(a.data);c.useStructuredClone=e}else q=c.useStructuredClone?a.data:JSON.parse(a.data);c.handler(q)}catch(d){}return!0}})}e=e||{};var g=e.storage||localStorage;g.getItem||(g=f(g));var u="installed",h,v=[],x=[],y=new l,A={},q={registerService:c.registerService.bind(c),connect:function(a,b,c,q){function e(a){a=Error(a);a.name="timeout";b({method:"timeout",error:a})}var d={handler:b,url:a},m=setTimeout(e.bind(null,"Load timeout for: "+a),q||15E3),n=document.createElement("iframe");
n.name=a+"_"+(new Date).getTime();n.src=a;n.onload=function(){clearTimeout(m);m=setTimeout(e.bind(null,"Plugin handshake timeout for: "+a),5E3)};n.sandbox="allow-scripts allow-same-origin";n.style.width=n.style.height="100%";n.frameBorder=0;(c||h).appendChild(n);d.target=n.contentWindow;d.close=function(){clearTimeout(m);if(n){var a=n.parentNode;a&&a.removeChild(n);n=null}};x.push(d);return d},disconnect:function(a){for(var b=0;b<x.length;b++)if(a===x[b]){x.splice(b,1);try{a.close()}catch(c){}break}},
removePlugin:function(a){for(var b=0;b<v.length;b++)if(a===v[b]){v.splice(b,1);break}g.removeItem("plugin."+a.getLocation())},persist:function(a,b){g.setItem("plugin."+a,JSON.stringify(b))},postMessage:function(a,b){b.target.postMessage(b.useStructuredClone?a:JSON.stringify(a),b.url)},dispatchEvent:function(a){try{y.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new k,c=q.connect(a,function(a){c&&a.method&&("manifest"===a.method||
"plugin"===a.method?(a=a.params[0],q.disconnect(c),c=null,b.resolve(a)):"timeout"===a.method&&(q.disconnect(c),c=null,b.reject(a.error)))});return b.promise},getState:function(){return u},handleServiceError:function(a,b){if(b&&401===b.status){var c=a.getHeaders(),q=a.getName()||a.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+q+"."));c.login&&(e.appendChild(document.createTextNode(" ")),q=document.createElement("a"),q.target="_blank",
q.textContent="Login",q.href=c.login,m.test(q.href)?(e.appendChild(q),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+c.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(b.__isError){var d=b;b=Error(d.message);Object.keys(d).forEach(function(a){b[a]=d[a]});delete b.__isError}return b}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};
this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=q.getState;this.init=function(){if(!("starting"===u||"active"===u||"stopping"===u)){addEventListener("message",n,!1);for(var b=[],c=0,m=g.length;c<m;c++)b.push(g.key(c));b.forEach(function(b){if(0===b.indexOf("plugin.")){var c=b.substring(7);b=JSON.parse(g.getItem(b));b.created&&v.push(new a(c,b,q))}});v.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});e.parent?h=e.parent:(h=document.createElement("div"),
e.visible||(h.style.display="none",h.style.visibility="hidden"),document.body.appendChild(h));e.plugins&&Object.keys(e.plugins).forEach(function(b){b=d(b);if(!this.getPlugin(b)){var c=e.plugins[b];"object"!==typeof c&&(c={});c.autostart=c.autostart||e.defaultAutostart||"lazy";v.push(new a(b,c,q))}}.bind(this));u="starting"}};this.start=function(){"starting"!==u&&this.init();if("starting"!==u)return(new k).reject("Cannot start framework. Framework is already "+u+".");var a=[],b=(new Date).getTime();
v.forEach(function(c){var q=c._getAutostart();0===c.getLastModified()?a.push(c.update().then(function(){if("started"===q)return c.start({"transient":!0});if("lazy"===q)return c.start({lazy:!0,"transient":!0});c._resolve()})):"started"===q?a.push(c.start({"transient":!0})):"lazy"===q?(a.push(c.start({lazy:!0,"transient":!0})),b>c.getLastModified()+864E5&&c.update()):c._resolve()});return k.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){u="active"})};this.stop=function(){if("starting"!==
u&&"active"!==u)return(new k).reject("Cannot stop registry. Registry is already "+u+".");u="stopping";var a=[];v.forEach(function(b){a.push(b.stop({"transient":!0}))});return k.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!e.parent){var a=h.parentNode;a&&a.removeChild(h)}h=null;removeEventListener("message",n);u="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new k).reject("Cannot uninstall registry")};
this.installPlugin=function(c,e){c=d(c);var m=this.getPlugin(c);if(m)return(new k).resolve(m);if(A[c])return A[c];if(e)return m=new a(c,e,q),v.push(m),m._persist(),q.dispatchEvent(new b("installed",m)),(new k).resolve(m);var n=q.loadManifest(c).then(function(e){m=new a(c,e,q);v.push(m);m._persist();delete A[c];q.dispatchEvent(new b("installed",m));return m},function(a){delete A[c];throw a;});return A[c]=n};this.getPlugins=function(){return v.slice()};this.getPlugin=function(a){var b=null;a=d(a);v.some(function(c){if(a===
c.getLocation())return b=c,!0});return b};this.addEventListener=y.addEventListener.bind(y);this.removeEventListener=y.removeEventListener.bind(y);this.resolvePlugins=function(){var a=!0;v.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function k(g,d){function f(a){var e=a.getProperty("service.id"),d=this.addingService(a);d&&(c[e]=a,b[e]=d)}function e(a){var e=a.getProperty("service.id"),d=b[e];delete c[e];delete b[e];this.removedService(a,d)}this.serviceRegistry=g;var c={},b={},n=l,a,m;this.close=function(){if(n!==h)throw"Already closed";n=l;g.removeEventListener("registered",a);g.removeEventListener("unregistering",m);m=a=null;var b=this;this.getServiceReferences().forEach(function(a){e.call(b,
a)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(c);return!a.length?null:a.map(function(a){return c[a]})};this.open=function(){if(n!==l)throw"Already open";n=h;var b=this;a=function(a){if(-1!==a.serviceReference.getProperty("objectClass").indexOf(d)&&(f.call(b,a.serviceReference),"function"===typeof b.onServiceAdded))return b.onServiceAdded(a.serviceReference,b.serviceRegistry.getService(a.serviceReference))};m=function(a){-1!==a.serviceReference.getProperty("objectClass").indexOf(d)&&
e.call(b,a.serviceReference)};g.addEventListener("registered",a);g.addEventListener("unregistering",m);g.getServiceReferences(d).forEach(function(a){f.call(b,a);if("function"===typeof b.onServiceAdded)return b.onServiceAdded(a,g.getService(a))});if("function"===typeof this.onOpen)this.onOpen()}}var l=0,h=1;k.prototype={addingService:function(g){return this.serviceRegistry.getService(g)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(g,d){}};return k});
define("orion/objects",[],function(){function k(k){for(var h=1;h<arguments.length;h++){var g=arguments[h],d;for(d in g)Object.prototype.hasOwnProperty.call(g,d)&&(k[d]=g[d])}return k}return{clone:function(l){if(Array.isArray(l))return Array.prototype.slice.call(l);var h=Object.create(Object.getPrototypeOf(l));k(h,l);return h},mixin:k,toArray:function(k){return Array.isArray(k)?k:[k]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(k,l,h){var g,d,f,e,c,b="pid";g=function(a,c,e){function d(a,b,e){b.forEach(function(d,n){try{var q=a[n].getProperty("__plugin__"),B=q&&c.getPlugin(q);(!q||B&&"active"===B.getState())&&b[n].updated(e)}catch(z){"undefined"!==typeof console&&console.log(z)}})}l.call(this,a,"orion.cm.managedservice");var n={},f={},g=function(c){var d=[];c.plugin.getServiceReferences().forEach(function(c){if(-1!==c.getProperty("objectClass").indexOf("orion.cm.managedservice")){var m=
c.getProperty(b);c=a.getService(c);m&&c&&(m=(m=e._find(m))&&m.getProperties(),d.push(c.updated(m)))}});return k.all(d)};this.addingService=function(c){var e=c.getProperty(b),d=a.getService(c);if(!e||!d)return null;n[e]||(n[e]=[]);f[e]||(f[e]=[]);n[e].push(c);f[e].push(d);return d};this.onServiceAdded=function(a,c){var m=a.getProperty(b),m=e._find(m);d([a],[c],m&&m.getProperties())};this.onOpen=function(){c.addEventListener("started",g)};this.onClose=function(){c.removeEventListener("started",g)};
this.notifyUpdated=function(a){var b=a.getPid();d(n[b]||[],f[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();d(n[a]||[],f[a]||[],null)};this.removedService=function(a,c){var e=a.getProperty(b),d=n[e],m=f[e];1<d.length?d.splice(d.indexOf(a),1):delete n[e];1<m.length?m.splice(m.indexOf(c),1):delete f[e]}};d=function(){function a(a,b,c){this.store=new f(this,c);this.configAdmin=new e(this,this.store);this.tracker=new g(a,b,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(b){a.tracker.open();return b})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();e=function(){function a(a,b){this.factory=a;this.store=b}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var n="/cm/configurations";
f=function(){function a(a,e){this.factory=a;this.prefsService=e;this.configs=Object.create(null);this.pref=null;var d=this;this.initPromise=this.prefsService.getPreferences(n).then(function(a){d.pref=a;a.keys().forEach(function(e){if(!d.configs[e]){var m=a.get(e);"object"===typeof m&&null!==m&&0<Object.keys(m).length&&(m[b]=e,d.configs[e]=new c(d.factory,d,m))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var b=this._find(a);
b||(b=new c(this.factory,this,a),this.configs[a]=b);return b},list:function(){var a=this,b=[];this.pref.keys().forEach(function(c){(c=a._find(c))&&null!==c.getProperties()&&b.push(c)});return b},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,b){this.pref.put(a,b.getProperties(!0)||{})}};return a}();c=function(){function a(a,c){c=h.clone(c);delete c[b];a.properties=c}function c(e,d,m){this.factory=e;this.store=d;if(null!==m&&"object"===typeof m)this.pid=m[b],a(this,
m);else if("string"===typeof m)this.pid=m,this.properties=null;else throw Error("Invalid pid/properties "+m);}c.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var c=null;this.properties&&(c=h.clone(this.properties),a||(c[b]=this.pid));return c},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(b){this._checkRemoved();a(this,b);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return c}();return{ConfigurationAdminFactory:d}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(k,l,h,g,d,f){var e;return{startup:function(){if(e)return e;e=new l;var c=new h.ServiceRegistry,b=new g.PreferencesService(c);return b.getPreferences("/plugins").then(function(n){var a={plugins:{}};n.keys().forEach(function(b){var c=k.toUrl(b);a.plugins[c]=n[b]});var m=new d.PluginRegistry(c,a);return m.start().then(function(){if(0<c.getServiceReferences("orion.core.preference.provider").length)return b.getPreferences("/plugins",
b.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=k.toUrl(a);m.getPlugin(a)||b.push(m.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return l.all(b,function(a){console.log(a)})})}).then(function(){return(new f.ConfigurationAdminFactory(c,m,b)).getConfigurationAdmin().then(c.registerService.bind(c,"orion.cm.configadmin"))}).then(function(){var a=c.getService("orion.core.auth");if(a){var b=a.getUser().then(function(b){if(b)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),e=localStorage.getItem("lastLogin");if(!e||e<(new Date).getTime()-9E5)return b}}).then(function(){var a={serviceRegistry:c,preferences:b,pluginRegistry:m};e.resolve(a);return a})})}}});
(function(){function k(d,f,e,c,b,n){f[d]&&(e.push(d),(!0===f[d]||1===f[d])&&c.push(b+d+"/"+n))}function l(d,f,e,c,b){f=c+f+"/"+b;require._fileExists(d.toUrl(f+".js"))&&e.push(f)}function h(d,f,e){for(var c in f)f.hasOwnProperty(c)&&(!d.hasOwnProperty(c)||e)?d[c]=f[c]:"object"===typeof f[c]&&h(d[c],f[c],e)}var g=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(d){var f=d.config?d.config():{},f=f||{};return{version:"2.0.1+",load:function(e,c,b,d){d=d||{};d.locale&&(f.locale=
d.locale);var a=g.exec(e),m=a[1],s=a[4],t=a[5],p=s.split("-"),r=[],u={},w,v="";a[5]?(m=a[1],e=m+t):(t=a[4],s=f.locale,s||(s=f.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),p=s.split("-"));if(d.isBuild){r.push(e);l(c,"root",r,m,t);for(w=0;w<p.length;w++)d=p[w],v+=(v?"-":"")+d,l(c,v,r,m,t);c(r,function(){b()})}else c([e],function(a){var e=[],d;k("root",a,e,r,m,t);for(w=0;w<p.length;w++)d=p[w],v+=(v?"-":"")+d,k(v,a,e,r,m,t);c(r,function(){var q,
d,n;for(q=e.length-1;-1<q&&e[q];q--){n=e[q];d=a[n];if(!0===d||1===d)d=c(m+n+"/"+t);h(u,d)}b(u)})})}}})})();
define("orion/i18n",[],function(){return{load:function(k,l,h,g){g=g||{};var d=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,f=d.exec(k);if(f){if(!l.defined||l.defined(k))try{h(l(k));return}catch(e){}if(g.isBuild||g.isTest)h({});else if(l.specified&&!l.specified("orion/bootstrap"))h({});else{var c=f[1],b=f[3]?f[2]:"",n=f[3]||f[2];l(["orion/bootstrap"],function(a){a.startup().then(function(a){var e=a.serviceRegistry;a=e.getServiceReferences("orion.i18n.message");if(b)a.some(function(a){return k===a.getProperty("name")?
(e.getService(a).getMessageBundle().then(function(a){h(a)},function(){h({})}),!0):!1})||h({});else{var t={},p;a.forEach(function(a){var e=a.getProperty("name");if((f=d.exec(e))&&c===f[1]&&n===(f[3]||f[2]))if(b=f[3]?f[2]:""){if((a=g.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===a.toLowerCase().indexOf(b.toLowerCase()))t[b]=!0,(!l.specified||!l.specified(e))&&define(e,["orion/i18n!"+e],function(a){return a})}else p=a});!l.specified||!l.specified(k)?p?
e.getService(p).getMessageBundle().then(function(a){Object.keys(t).forEach(function(b){"undefined"===typeof a[b]&&(a[b]=t[b])});define(k,[],a);h(a)},function(){define(k,[],t);h(t)}):(define(k,[],t),h(t)):h(t)}})})}}else h(null)}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-04-02_22-01-33","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Saved searches":"Saved searches","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("text",["module"],function(k){var l,h,g=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],d=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,e="undefined"!==typeof location&&location.href,c=e&&location.protocol&&location.protocol.replace(/\:/,""),b=e&&location.hostname,n=e&&(location.port||void 0),a=[],m=k.config&&k.config()||{};l={version:"2.0.5",strip:function(a){if(a){a=a.replace(d,"");var b=a.match(f);b&&(a=b[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:m.createXhr||function(){var a,b,c;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(b=0;3>b;b+=1){c=g[b];try{a=new ActiveXObject(c)}catch(e){}if(a){g=[c];break}}return a},parseName:function(a){var b,
c,e=!1,d=a.indexOf(".");b=0===a.indexOf("./")||0===a.indexOf("../");-1!==d&&(!b||1<d)?(b=a.substring(0,d),c=a.substring(d+1,a.length)):b=a;a=c||b;d=a.indexOf("!");-1!==d&&(e="strip"===a.substring(d+1),a=a.substring(0,d),c?c=a:b=a);return{moduleName:b,ext:c,strip:e}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,b,c,e){var d,m;d=l.xdRegExp.exec(a);if(!d)return!0;a=d[2];d=d[3];d=d.split(":");m=d[1];d=d[0];return(!a||a===b)&&(!d||d.toLowerCase()===c.toLowerCase())&&(!m&&!d||m===e)},finishLoad:function(b,
c,e,d){e=c?l.strip(e):e;m.isBuild&&(a[b]=e);d(e)},load:function(a,d,f,g){if(g.isBuild&&!g.inlineText)f();else{m.isBuild=g.isBuild;var u=l.parseName(a);g=u.moduleName+(u.ext?"."+u.ext:"");var h=d.toUrl(g),k=m.useXhr||l.useXhr;!e||k(h,c,b,n)?l.get(h,function(b){l.finishLoad(a,u.strip,b,f)},function(a){f.error&&f.error(a)}):d([g],function(a){l.finishLoad(u.moduleName+"."+u.ext,u.strip,a,f)})}},write:function(b,c,e,d){a.hasOwnProperty(c)&&(d=l.jsEscape(a[c]),e.asModule(b+"!"+c,"define(function () { return '"+
d+"';});\n"))},writeFile:function(a,b,c,e,d){b=l.parseName(b);var m=b.ext?"."+b.ext:"",n=b.moduleName+m,f=c.toUrl(b.moduleName+m)+".js";l.load(n,c,function(b){b=function(a){return e(f,a)};b.asModule=function(a,b){return e.asModule(a,f,b)};l.write(a,n,b,d)},d)}};if("node"===m.env||!m.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)h=require.nodeRequire("fs"),l.get=function(a,b){var c=h.readFileSync(a,"utf8");0===c.indexOf("\ufeff")&&(c=c.substring(1));b(c)};else if("xhr"===
m.env||!m.env&&l.createXhr())l.get=function(a,b,c,e){var d=l.createXhr(),n;d.open("GET",a,!0);if(e)for(n in e)e.hasOwnProperty(n)&&d.setRequestHeader(n.toLowerCase(),e[n]);if(m.onXhr)m.onXhr(d,a);d.onreadystatechange=function(e){4===d.readyState&&(e=d.status,399<e&&600>e?(e=Error(a+" HTTP status: "+e),e.xhr=d,c(e)):b(d.responseText))};d.send(null)};else if("rhino"===m.env||!m.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)l.get=function(a,b){var c,e,d=new java.io.File(a),m=java.lang.System.getProperty("line.separator"),
d=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(d),"utf-8")),n="";try{c=new java.lang.StringBuffer;(e=d.readLine())&&e.length()&&65279===e.charAt(0)&&(e=e.substring(1));for(null!==e&&c.append(e);null!==(e=d.readLine());)c.append(m),c.append(e);n=String(c.toString())}finally{d.close()}b(n)};return l});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(k,l,h){return{slideoutHTMLFragment:function(g){var d=document.createElement("div");d.innerHTML=h;var f=l.$("#slideContainer",d);f.id=g+f.id;f=l.$("#pageCommandParameters",d);f.id=g+f.id;f=l.$("#pageCommandDismiss",d);f.id=g+f.id;return d.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(k){function l(g,d,f,e,c,b){this.type=b||"keydown";this.keyCode="string"===typeof g&&"keydown"===this.type?g.toUpperCase().charCodeAt(0):g;this.mod1=void 0!==d&&null!==d?d:!1;this.mod2=void 0!==f&&null!==f?f:!1;this.mod3=void 0!==e&&null!==e?e:!1;this.mod4=void 0!==c&&null!==c?c:!1}function h(g){this.keys=g}l.prototype={getKeys:function(){return[this]},match:function(g,d){if(void 0!==d){if(0!==d)return!1}else if(g instanceof Array){if(1<g.length)return!1;
g=g[0]}return g.type!==this.type?!1:this.keyCode===g.keyCode||this.keyCode===String.fromCharCode(k.isOpera?g.which:void 0!==g.charCode?g.charCode:g.keyCode)?this.mod1!==(k.isMac?g.metaKey:g.ctrlKey)||"keydown"===this.type&&this.mod2!==g.shiftKey||this.mod3!==g.altKey||k.isMac&&this.mod4!==g.ctrlKey?!1:!0:!1},equals:function(g){return!g||this.keyCode!==g.keyCode||this.mod1!==g.mod1||this.mod2!==g.mod2||this.mod3!==g.mod3||this.mod4!==g.mod4||this.type!==g.type?!1:!0}};h.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(g,d){var f=this.keys;if(void 0!==d)return d>f.length?!1:f[d].match(g)?d===f.length-1?!0:d+1:!1;g instanceof Array||(g=[g]);if(g.length>f.length)return!1;var e;for(e=0;e<g.length;e++)if(!f[e].match(g[e]))return!1;return e===f.length?!0:e},equals:function(g){if(!g.keys||g.keys.length!==this.keys.length)return!1;for(var d=0;d<g.keys.length;d++)if(!g.keys[d].equals(this.keys[d]))return!1;return!0}};return{KeyBinding:l,KeyStroke:l,KeySequence:h}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(k,l,h){function g(e){h.attach(this);this._init(e)}function d(e,c){var b=document.createElement(void 0===c?"span":c);b.tabIndex=0;b.className="dropdownMenuItem";b.role="menuitem";var d=document.createElement("span");d.appendChild(document.createTextNode(e));d.classList.add("dropdownCommandName");b.appendChild(d);d=document.createElement("li");d.appendChild(b);return d}function f(){var e=document.createElement("li");
e.classList.add("dropdownSeparator");return e}g.prototype={_init:function(e){this._dropdownNode=l.node(e.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=e.populate;this._selectionClass=e.selectionClass;this._parentDropdown=e.parentDropdown;this._positioningNode=e.positioningNode;if(!this._parentDropdown)for(var c=this._dropdownNode.parentNode;c&&document!==c;){if(c.classList&&c.classList.contains("dropdownMenu")){this._parentDropdown=c.dropdown;break}c=c.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=e.triggerNode?e.triggerNode:l.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!e.skipTriggerEventListeners){var b=this;this._triggerNode.addEventListener("click",function(c){b.toggle(c)&&l.stop(c)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(c){if(c.keyCode===l.KEY.ENTER||c.keyCode===l.KEY.SPACE)b.toggle(),l.stop(c)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(e){var c=this;e.addEventListener("click",function(b){c.toggle(b)&&l.stop(b)},!1)},toggle:function(e){return this.isVisible()?this.close():this.open(e)},isVisible:function(){return this._isVisible},open:function(e){var c=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:e}),l.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?l.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),c=l.$$array(".dropdownSubMenu",this._dropdownNode),l.addAutoDismiss([this._triggerNode].concat(c),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(e),this._dropdownNode.focus(),
c=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return c},_autoDismiss:function(e){if(this.close(!1)&&this._dropdownNode.contains(e.target))for(e=this._parentDropdown;e;)e.close(!1),e=e._parentDropdown},_positionDropdown:function(e){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{e=l.bounds(this._dropdownNode);var c=l.bounds(document.body);if(e.left+e.width>c.left+
c.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-e.width+"px";else{var b=l.bounds(this._boundingNode(this._triggerNode)),d=l.bounds(this._triggerNode);this._dropdownNode.style.left=d.left-b.left-e.width+d.width+"px"}e=e.top+e.height-(c.top+c.height);0<e&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-e)+"px")}},_boundingNode:function(e){var c=window.getComputedStyle(e,null);return null===c||"absolute"===c.getPropertyValue("position")||
!e.parentNode||e===document.body?e:this._boundingNode(e.parentNode)},close:function(e){var c=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),l.setFramesEnabled(!0),e&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),c=!0);return c},
getItems:function(){var e=[],c=this;l.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(b){b.parentNode.parentNode===c._dropdownNode&&e.push(b)});e.forEach(function(b){b._hasDropdownMouseover||(b.addEventListener("mouseover",function(e){b.dropdown?b.dropdown.open(e):(c._closeSelectedSubmenu(),l.stop(e));c._selectItem(b)}),b._hasDropdownMouseover=!0)});return e},empty:function(){var e=this;l.$$array("li",this._dropdownNode).forEach(function(c){c.parentNode===
e._dropdownNode&&c.parentNode.removeChild(c)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(e){if(e.keyCode===l.KEY.UP||e.keyCode===l.KEY.DOWN||e.keyCode===l.KEY.RIGHT||e.keyCode===l.KEY.ENTER||e.keyCode===l.KEY.LEFT){var c=this.getItems();if(c.length&&0<c.length){if(this._selectedItem){var b=c.indexOf(this._selectedItem);0>b&&(b=c.indexOf(this._selectedItem.parentNode));0<=b&&(e.keyCode===l.KEY.UP&&0<b?(b--,this._selectItem(c[b])):e.keyCode===l.KEY.DOWN&&b<c.length-1?(b++,this._selectItem(c[b])):
e.keyCode===l.KEY.ENTER||e.keyCode===l.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):e.keyCode===l.KEY.ENTER&&this._selectedItem.click():e.keyCode===l.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(c[0]);l.stop(e)}}else e.keyCode===
l.KEY.ESCAPE&&(this.close(!0),l.stop(e))},_selectItem:function(e){if(e=e||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=e,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(e){e!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=e)},_closeSelectedSubmenu:function(){for(var e=this._selectedSubmenu;e;)e.close(),
e=e._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&l.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(e,c){var b=d(e,c);this._dropdownNode.appendChild(b);return b},appendSeparator:function(){var e=f();this._dropdownNode.appendChild(e);return e}};g.prototype.constructor=g;return{Dropdown:g,appendKeyBindingString:function(e,c){var b=document.createElement("span");b.classList.add("dropdownKeyBinding");b.appendChild(document.createTextNode(c));e.appendChild(b)},
createMenuItem:d,createSeparator:f}});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(k,l){function h(g){this._init(g)}h.prototype={_init:function(g){this._node=l.node(g.node);if(!this._node)throw"no dom node for tooltip found";this._position=g.position||["right","above","below","left"];this._text=g.text;this._hideDelay=void 0===g.hideDelay?200:g.hideDelay;this._tailSize=g.tailSize||10;this._trigger=g.trigger||"mouseover";this._afterShowing=g.afterShowing;this._afterHiding=g.afterHiding;var d=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(e){e.target===d._node&&(d.show(),l.stop(e))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===g.showDelay?500:g.showDelay;g=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(e){l.contains(d._node,e.target)&&(d.show(),l.stop(e))},!1);this._leaveHandler=function(e){l.contains(d._node,e.target)&&d.hide()};for(var f=0;f<g.length;f++)this._node.addEventListener(g[f],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var g=document.createTextNode(this._text);this._tipTextContent.appendChild(g)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var d=this;l.addAutoDismiss([this._tip,this._node],function(){d.hide()});"mouseover"===this._trigger&&(this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(f){d._timeout&&(window.clearTimeout(d._timeout),d._timeout=null);d._tip.addEventListener("mouseout",function(e){l.contains(d._tip,e.target)&&(d.hide(),l.stop(e))},
!1)},!1))}return this._tip},_positionTip:function(g,d){this._makeTipNode();"left"===g?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var f=this._node,e;for(e=l.bounds(f);f&&!e.width&&!e.height;f=f.parentNode)e=l.bounds(f);var f=l.bounds(this._tipInner),c;switch(g){case "above":c=e.top-f.height-this._tailSize-1;e=e.left-this._tailSize;break;case "below":c=e.top+e.height+this._tailSize+1;e=e.left-this._tailSize;break;case "left":c=e.top-this._tailSize/2;e=e.left-f.width-
this._tailSize-1;break;default:c=e.top-this._tailSize/2,e=e.left+e.width+this._tailSize+1}var b=l.bounds(document.documentElement);if(c+f.height>b.height)if(d)c=b.height-f.height-1;else return!1;if(e+f.width>b.width)if(d)e=b.width-f.width-1;else return!1;if(0>e)if(d)e=4;else return!1;if(0>c)if(d)c=4;else return!1;this._tail&&this._tail.previousPosition!==g&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
g),"above"===g||"left"===g?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),"left"===g&&(this._tail.style.left=f.width+"px"),this._tail.previousPosition=g);this._tip.style.top=c+"px";this._tip.style.left=e+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()},_showImmediately:function(){for(var g=!1,d=0;!g&&d<this._position.length;)g=this._positionTip(this._position[d]),d++;g||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(g){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===g&&(g=
this._hideDelay);var d=this;this._timeout=window.setTimeout(function(){d._tip.classList.remove("tooltipShowing");d._tip.removeAttribute("style");d._afterHiding&&d._afterHiding()},g)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",
this._mouseoverHandler,!1);for(var g=["mouseout","click"],d=0;d<g.length;d++)this._node.removeEventListener(g[d],this._leaveHandler,!1)}}};h.prototype.constructor=h;return{Tooltip:h}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(k,l,h,g,d,f,e,c){function b(a){var b=a.invocation;if(b){var c=a.command;if(c.hrefCallback)return a=c.hrefCallback.call(b.handler||window,b),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(b.commandRegistry)return b.commandRegistry._invoke(b),
!0;if(c.onClick||c.callback)return window.setTimeout(function(){(c.onClick||c.callback).call(b.handler||window,b)},0),!0}return!1}function n(a,c){for(var e in c)if(c[e]&&c[e].keyBinding&&c[e].command&&c[e].keyBinding.match(a)){var d=c[e],m=d.keyBinding;if((!m.domScope||l.contains(l.node(m.domScope),a.target))&&b(d)){l.stop(a);break}}}function a(){var a={};if(w){var b,c,e;c=Object.keys(v);for(b=0;b<c.length;b++)e=c[b],a[e]=v[e];var d=w();c=Object.keys(d);for(b=0;b<c.length;b++)e=c[b],a[e]=d[e]}else a=
v;return a}function m(b){n(b,a())}function s(a,b){a=a||window.event;if(function(a){if(k.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var c=a.target.nodeName.toLowerCase();if("input"===c)switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if("textarea"===c)return}b?b(a):m(a)}function t(){this._init()}
function p(a,b,c){b.classList.add("commandImage");var e;a.imageClass?a.addImageClassToElement?b.classList.add(a.imageClass):(e=document.createElement("span"),b.appendChild(e),e.classList.add(a.spriteClass),e.classList.add(a.imageClass)):(e=new Image,e.alt=a.name,e.name=c,e.id=c,e.src=a.image,b.appendChild(e));return e}function r(a,b,c,e,d){this.commandRegistry=d;this.handler=a;this.items=b;this.userData=c;this.command=e;e.parameters&&(this.parameters=e.parameters.makeCopy());this.id=e.id}function u(a){this._init(a)}
var w=null,v={};t.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(b){return s(b,function(b){var c=a.proxy,e=a.bindings;if(e&&c)for(var d=0;d<e.length;d++)e[d].match(b)&&(c.processKey({type:b.type,keyCode:b.keyCode,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey}),l.stop(b))})})}};window.document.addEventListener("keydown",s,!1);r.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var b=new r(this.handler,this.items,this.userData,this.command,this.commandRegistry);b.domNode=this.domNode;b.domParent=this.domParent;a?b.parameters=a.makeCopy():this.parameters&&(b.parameters=this.parameters.makeCopy());return b}};r.prototype.constructor=r;u.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,b,c,e,
d){c=this.getChoices(b,c,e);var m=c.some(function(a){return a.checked});c.forEach(function(c){if(c.name){var e=document.createElement("li");a.appendChild(e);var q=document.createElement("span");q.tabIndex=0;q.role="menuitem";q.classList.add("dropdownMenuItem");if(m){var n=document.createElement("span");n.classList.add("check");n.appendChild(document.createTextNode(c.checked?"\u25cf":""));q.appendChild(n)}n=document.createTextNode(c.name);q.appendChild(n);e.appendChild(q);q.choice=c;q.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1);q.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1)}else d._generateMenuSeparator(a)})},getChoices:function(a,b,c){return this.choiceCallback?this.choiceCallback.call(b,a,c):null},makeChoiceCallback:function(a,b){return function(c){a.callback&&a.callback.call(a,b,c)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};u.prototype.constructor=u;return{Command:u,CommandInvocation:r,createDropdownMenu:function(a,b,c,e,m,n,f,s,r){a=l.node(a);if(!a)throw"no parent node was specified";var t=document.createRange();t.selectNode(a);t=r?t.createContextualFragment(d):t.createContextualFragment(g);l.processTextNodes(t,{ButtonText:b});a.appendChild(t);a=a.lastChild;
var u;r?(r=a.previousSibling,u=r.lastChild):r=a.previousSibling;e?r.classList.add(e):(r.classList.add("orionButton"),r.classList.add("commandButton"));m&&(n||(r.textContent="",r.setAttribute("aria-label",b)),p({spriteClass:"commandSprite",imageClass:m},r,b),r.classList.add("orionButton"));r.dropdown=new h.Dropdown({dropdown:a,populate:c,selectionClass:f,skipTriggerEventListeners:!!u,positioningNode:s});a.dropdown=r.dropdown;return{menuButton:r,menu:a,dropdown:r.dropdown,dropdownArrow:u}},createCheckedMenuItem:function(a,
b,c,d){a=l.node(a);if(!a)throw"no parent node was specified";var m=document.createRange();m.selectNode(a);m=m.createContextualFragment(e);l.processTextNodes(m,{ItemText:b});a.appendChild(m);a=l.$(".checkedMenuItem",a.lastChild);a.checked=c;a.addEventListener("change",d,!1);return a},createCommandItem:function(a,b,e,d,m,n,f){var g;n=n||!b.name&&b.hasImage();if(b.hrefCallback)g=document.createElement("a"),g.id=d,n&&b.hasImage()?p(b,g,d):(g.className="commandLink",g.appendChild(document.createTextNode(b.name))),
f=b.hrefCallback.call(e.handler,e),f.then?f.then(function(a){g.href=a}):g.href=f?f:"#";else{g=document.createElement("button");g.className="orionButton";n?b.hasImage()?(p(b,g,d),b.name&&g.setAttribute("aria-label",b.name)):(g.classList.add("commandButton"),g.classList.add("commandMissingImageButton"),g.appendChild(document.createTextNode(b.name))):(g.classList.add("commandButton"),d=document.createTextNode(b.name),g.appendChild(d));var s=f||b.callback;s&&(b.onClick=s,g.addEventListener("click",function(a){s.call(e.handler,
e)},!1))}"ul"===a.nodeName.toLowerCase()?(f=document.createElement("li"),a.appendChild(f),a=f):g.classList.add("commandMargins");a.appendChild(g);b.tooltip&&(g.commandTooltip=new c.Tooltip({node:g,text:b.tooltip,position:["above","below","right","left"]}));m&&(v[b.id]={keyBinding:m,command:b,invocation:e});return g},createCommandMenuItem:function(a,b,e,d,m,n){var f,g,p=a.dropdown;if(b.hrefCallback)g=h.createMenuItem(b.name,"a"),f=g.firstElementChild,m=b.hrefCallback.call(e.handler,e),m.then?m.then(function(a){f.href=
a}):f.href=m?m:"#",f.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&f.click()},!1);else{g=h.createMenuItem(b.name);f=g.firstElementChild;var s=m||b.callback;s&&(b.onClick=s,f.addEventListener("click",function(a){p.close(!0);s.call(e.handler,e)},!1),f.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)a.preventDefault(),f.click()},!1))}b.tooltip&&(f.commandTooltip=new c.Tooltip({node:f,text:b.tooltip,position:["above",
"below","right","left"]}));n&&h.appendKeyBindingString(f,n);a.appendChild(g);d&&(v[b.id]={keyBinding:d,command:b,invocation:e});return f},executeBinding:b,setKeyBindingProvider:function(a){w=a},localKeyBindings:v,CommandsProxy:t,getKeyBindings:a,processKey:m,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:n}});
define("orion/explorers/navigationUtils",[],function(){function k(h,g,d,f){!l&&h&&(h.push({domNode:g}),g.tabIndex=-1,g.style.outline="none")}var l=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(h,g,d){h&&(h=h.getGridNavHolder(g,!0))&&k(h,d)},generateNavGrid:k,removeNavGrid:function(h,g){if(h)for(var d=0;d<h.length;d++)if(h[d].domNode===g){h.splice(d,1);break}}}});
define("orion/PageUtil",[],function(){var k=/^http[s]?/i;return{hash:function(){var k=window.location.href.split("#")[1];return k?"#"+k:""},matchResourceParameters:function(k){k=k||window.location.toString();var h={resource:""},g=k.indexOf("#");if(-1!==g&&(k=k.substring(g+1),0!==k.length)){k=k.split(",");h.resource=decodeURIComponent(k[0]);for(g=1;g<k.length;g++){var d=/([^=]*)(=?)(.*)/.exec(k[g]),f=decodeURIComponent(d[1]||""),d=decodeURIComponent(d[3]||"");""!==f&&"resource"!==f&&(h[f]=d)}}return h},
validateURLScheme:function(l,h){var g=l;if(-1===l.indexOf("://")){var d=document.createElement("a");d.href=l;g=d.href}d=!1;if(d=h?h.some(function(d){return RegExp("^"+d+":","i").test(g)}):k.test(g))return l;console.log("Illegal URL Scheme: '"+l+"'");return""}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(k){function l(g){var d="",f=-1!==navigator.platform.indexOf("Mac");f?(g.mod4&&(d+="\u2303"),g.mod3&&(d+="\u2325"),g.mod2&&(d+="\u21e7"),g.mod1&&(d+="\u2318")):(g.mod1&&(d+="Ctrl+"),g.mod2&&(d+="Shift+"),g.mod3&&(d+="Alt+"));if(g.alphaKey)return d+g.alphaKey;if("keypress"===g.type)return d+g.keyCode;for(var e in k.KEY)if(typeof("number"===k.KEY[e])&&k.KEY[e]===g.keyCode){if(f)switch(k.KEY[e]){case k.KEY.BKSPC:e="\u232b";break;case k.KEY.TAB:e=
"\u21e5";break;case k.KEY.ENTER:e="\u23ce";break;case k.KEY.ESCAPE:e="\u238b";break;case k.KEY.SPACE:e="\u2423";break;case k.KEY.PAGEUP:e="\u21de";break;case k.KEY.PAGEDOWN:e="\u21df";break;case k.KEY.END:e="\u21f2";break;case k.KEY.HOME:e="\u21f1";break;case k.KEY.DEL:e="\u2326"}switch(k.KEY[e]){case k.KEY.DOWN:e="\u2193";break;case k.KEY.UP:e="\u2191";break;case k.KEY.RIGHT:e="\u2192";break;case k.KEY.LEFT:e="\u2190"}return d+e}var c;switch(g.keyCode){case 59:c=g.mod2?":":";";break;case 61:c=g.mod2?
"+":"\x3d";break;case 188:c=g.mod2?"\x3c":",";break;case 190:c=g.mod2?"\x3e":".";break;case 191:c=g.mod2?"?":"/";break;case 192:c=g.mod2?"~":"`";break;case 219:c=g.mod2?"{":"[";break;case 220:c=g.mod2?"|":"\\";break;case 221:c=g.mod2?"}":"]";break;case 222:c=g.mod2?'"':"'"}return c?d+c:112<=g.keyCode&&123>=g.keyCode?d+"F"+(g.keyCode-111):d+String.fromCharCode(g.keyCode)}function h(g){var d=-1!==window.navigator.platform.indexOf("Mac");return d&&g.metaKey||!d&&g.ctrlKey}return{getUserKeyString:function(g){var d=
"";g=g.getKeys();for(var f=0;f<g.length;f++)0!==f&&(d+=" "),d+=l(g[f]);return d},getUserText:function(g){var d=g.id,f=g.refNode,e=g.hideRefNode,c=g.initialText,b=g.onComplete,n=g.onEditDestroy,a=g.selectTo,m=g.isInitialValid;g=g.insertAsChild;var s=!1,t=function(a){return function(g){if(!s){var p=k.node(d),t=p.value;p&&(a&&g.keyCode===k.KEY.ESCAPE?(e&&(f.style.display="inline"),s=!0,p.parentNode.removeChild(p),n&&n()):a&&g.keyCode!==k.KEY.ENTER||(0===t.length||!m&&t===c?e&&(f.style.display="inline"):
(b(t),e&&f.parentNode&&(f.style.display="inline")),s=!0,p.parentNode&&p.parentNode.removeChild(p),n&&n()))}}},p=document.createElement("input");p.id=d;p.value=c||"";g?f.appendChild(p):f.parentNode.insertBefore(p,f.nextSibling);p.classList.add("userEditBoxPrompt");e&&(f.style.display="none");p.addEventListener("keydown",t(!0),!1);p.addEventListener("blur",t(!1),!1);window.setTimeout(function(){p.focus();if(c){var b=k.node(d),e=a?c.indexOf(a):-1;0<e?b.createTextRange?(b=b.createTextRange(),b.collapse(!0),
b.moveStart("character",0),b.moveEnd("character",e),b.select()):b.setSelectionRange?b.setSelectionRange(0,e):void 0!==b.selectionStart&&(b.selectionStart=0,b.selectionEnd=e):b.select()}},0)},openInNewWindow:h,followLink:function(g,d){d&&h(d)?window.open(g):window.location=g},createButton:function(g,d){var f=document.createElement("button");f.className="orionButton commandButton commandMargins";f.addEventListener("click",function(e){d();k.stop(e)},!1);g&&f.appendChild(document.createTextNode(g));return f},
createDropdownButton:function(g,d,f){},isFormElement:function(g){switch(g.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(k,l,h,g,d,f,e,c,b,n){function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function m(a,b){this.token=a;this.parameterName=b}function s(a,b,c){this.event=a;this.handler=b;this.capture=c||!1}function t(a,b,c,e,d,m){this.name=a;this.type=b;this.label=c;this.value=e;this.lines=d||1;this.eventListeners=Array.isArray(m)?m:m?[m]:[]}function p(a,b,c){this._storeParameters(a);this._hasOptionalParameters=b&&b.hasOptionalParameters;this._options=b;this.optionsRequested=!1;this.getParameters=c;this.clientCollect=b&&b.clientCollect}a.prototype={_init:function(a){this._selectionService=
a.selection;var b=this;k.setKeyBindingProvider(function(){return b._activeBindings})},processURL:function(a){for(var b in this._urlBindings)if(this._urlBindings[b]&&this._urlBindings[b].urlBinding&&this._urlBindings[b].command){var c=this._urlBindings[b].urlBinding.match(a);if(c){var e=this._urlBindings[b],d=e.command,m=e.invocation;if(m&&m.parameters&&d.callback){m.parameters.setValue(c.parameterName,c.parameterValue);var n=this;window.setTimeout(function(){n._invoke(m)},0);break}}}},findCommand:function(a){return this._commandList[a]},
runCommand:function(a,b,c,e){b?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(b):1)&&a.callback&&this._invoke(new k.CommandInvocation(c,b,null,a,this),e):(b=this._urlBindings[a])&&b.command&&b.command.callback&&this._invoke(b.invocation,e)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,b,c){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,
b,c))},confirm:function(a,b,c,e,d,m){var n=!1;if(this._parameterCollector&&!d){var q=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,d){var m=document.createElement("span");m.classList.add("parameterPrompt");m.textContent=b;a.appendChild(m);m=document.createElement("button");m.addEventListener("click",function(a){n=!0;q._parameterCollector.close()},!1);d.appendChild(m);m.appendChild(document.createTextNode(c));m.className="dismissButton";var f=document.createElement("button");
f.addEventListener("click",function(a){n=!1;q._parameterCollector.close()},!1);d.appendChild(f);f.appendChild(document.createTextNode(e));f.className="dismissButton";return m},function(){m(n)}))return}n=window.confirm(b);m(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,b){return this._collectAndInvoke(a.makeCopy(b),!1)},_collectAndInvoke:function(a,b){if(a)if(this._parameterCollector&&
a.parameters&&a.parameters.hasParameters()&&(b||a.parameters.shouldCollectParameters())){var c=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(c=this._parameterCollector.collectParameters(a),!c)){var d=new e.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),c=d.contentContainer();c.classList.add("parameterPopup");var m=window.document.activeElement,n=this._parameterCollector.getFillFunction(a,
function(){m&&m.focus();d.destroy()})(c);d.show();window.setTimeout(function(){n.focus();n.select()},0);c=!0}c||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function b(a){return function(){k.executeBinding(a)}}var c={},e,d,m=[],n;for(n in this._activeBindings)(d=
this._activeBindings[n])&&d.keyBinding&&d.command&&(d.command.name||d.command.tooltip)&&m.push(d);m.sort(function(a,b){return(a.command.name||a.command.tooltip).localeCompare(b.command.name||b.command.tooltip)});for(n=0;n<m.length;n++)d=m[n],d.keyBinding.scopeName?(c[d.keyBinding.scopeName]||(c[d.keyBinding.scopeName]=[]),c[d.keyBinding.scopeName].push(d)):(e=g.getUserKeyString(d.keyBinding),a.createItem(e,d.command.name||d.command.tooltip,b(d)));for(var q in c)c[q].length&&0<c[q].length&&(a.createHeader(q),
c[q].forEach(function(c){e=g.getUserKeyString(c.keyBinding);a.createItem(e,c.command.name||c.command.tooltip,b(c))}))},addCommand:function(a){this._commandList[a.id]=a;var b=this._pendingBindings[a.id];if(b){var c=this;b.forEach(function(b){c._addBinding(a,b.type,b.binding,b.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,b,c,e,d,m,n,q,f,z){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];d&&(a=this._createEntryForPath(a,
d));a[b]?(e&&(a[b].title=e),c&&(a[b].position=c),n&&(a[b].imageClass=n),q&&(a[b].tooltip=q),f&&(a[b].selectionClass=f),!0===z?a[b].pretendDefaultActionId=!0:a[b].defaultActionId=z,a[b].emptyGroupMessage=m):(a[b]={title:e,position:c,emptyGroupMessage:m,imageClass:n,tooltip:q,selectionClass:f,defaultActionId:!0===z?null:z,pretendDefaultActionId:!0===z,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,b){b&&b.split("/").forEach(function(b){1<b.length&&(a[b]||(a[b]={position:0,
children:{}},a.sortedContributions=null),a=a[b].children)});return a},registerSelectionService:function(a,b){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=b},registerCommandContribution:function(a,b,c,e,d,m,n){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];e&&(a=this._createEntryForPath(a,e));a[b]={position:c};m&&((c=this._commandList[b])?this._addBinding(c,"key",
m,d):this._addPendingBinding(b,"key",m,d));n&&((c=this._commandList[b])?this._addBinding(c,"url",n,d):this._addPendingBinding(b,"url",n,d));a.sortedContributions=null},unregisterCommandContribution:function(a,b,c){if(this._contributionsByScopeId[a]){delete this._commandList[b];delete this._activeBindings[b];delete this._urlBindings[b];delete this._pendingBindings[b];var e=this._contributionsByScopeId[a];c&&c.split("/").forEach(function(a){1<a.length&&e[a]&&(e=e[a].children)});delete e[b];e.sortedContributions=
null}},_addBinding:function(a,b,c,e){if(!a.id)throw Error("No command id: "+a);"key"===b?this._activeBindings[a.id]={command:a,keyBinding:c,bindingOnly:e}:"url"===b&&(this._urlBindings[a.id]={command:a,urlBinding:c,bindingOnly:e})},_addPendingBinding:function(a,b,c,e){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:b,binding:c,bindingOnly:e})},_checkForTrailingSeparator:function(a,b,c){var e;if("tool"===b||"button"===b)if((e=0<a.childNodes.length?a.childNodes[a.childNodes.length-
1]:null)&&e.classList.contains("commandSeparator"))return c?(a.removeChild(e),!1):!0;if("menu"===b&&(a=d.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(e=a[a.length-1],c)e.parentNode.parentNode.removeChild(e.parentNode);else return!0;return!1},renderCommands:function(a,b,c,e,m,n,f){if("string"!==typeof a)throw"a scope id for rendering must be specified";b=d.node(b);if(!b)throw"no parent";var q=this._contributionsByScopeId[a];if(!c&&q){c=q.localSelectionService||
this._selectionService;var B=this;c&&c.getSelections(function(c){B.renderCommands(a,b,c,e,m,n)})}else q&&(this._render(q,b,c,e,m||"button",n,f),this._checkForTrailingSeparator(b,m,!0))},destroy:function(a){a=d.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var b=a.firstChild;b.commandTooltip&&b.commandTooltip.destroy();b.emptyGroupTooltip&&b.emptyGroupTooltip.destroy();this.destroy(b);a.removeChild(b)}},_render:function(a,b,c,d,m,n,f){var q=a.sortedContributions;if(!q){var q=[],B=!1,z;for(z in a)if(Object.prototype.hasOwnProperty.call(a,
z)){var p=a[z];p&&"number"===typeof p.position&&(p.id=z,q.push(p),B=!0)}B&&(q.sort(function(a,b){return a.position-b.position}),a.sortedContributions=q)}var s=0,t=this;q.forEach(function(a){var q;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var z=a.children;if("tool"===m||"button"===m)if(a.title){var B;a.defaultActionId&&((z=t._commandList[a.defaultActionId])&&(z.visibleWhen?z.visibleWhen(c):1)?(B=new k.CommandInvocation(d,c,n,z,t),B.domParent=
b):a.pretendDefaultActionId=!0);z=t._createDropdownMenu(b,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,B,a.pretendDefaultActionId);f&&l.generateNavGrid(f,z.menuButton);z&&(t._render(a.children,z.menu,c,d,"menu",n,f),t._checkForTrailingSeparator(z.menu,"menu",!0),0===z.menu.childNodes.length?a.emptyGroupMessage?z.menuButton.emptyGroupTooltip||(z.menuButton.emptyGroupTooltip=new e.Tooltip({node:z.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above",
"left"]})):(f&&l.removeNavGrid(f,z.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(z.menu),a(z.menuButton),a(z.destroyButton)):z.menuButton.style.visibility="visible")}else{var p;0<b.childNodes.length&&!t._checkForTrailingSeparator(b,m)&&(p=t.generateSeparatorImage(b));t._render(z,b,c,d,m,n,f);0<b.childNodes.length&&b.childNodes[b.childNodes.length-1]!==p&&(p=t.generateSeparatorImage(b))}else if(a.title){if(a=t._createDropdownMenu(b,a.title,!0,null,null,a.imageClass))t._render(z,
a.menu,c,d,"menu",n,f),t._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&b.removeChild(a.destroyButton)}else 0<b.childNodes.length&&t._generateMenuSeparator(b),t._render(z,b,c,d,m,n,f),t._generateMenuSeparator(b)}else{var r=t._commandList[a.id],z=r?!0:!1;B=a=null;if(r){q=new k.CommandInvocation(d,c,n,r,t);q.domParent=b;p=!1;try{p=z&&(r.visibleWhen?r.visibleWhen(c):!0)}catch(C){throw console.log(C),C;}t._activeBindings[r.id]&&t._activeBindings[r.id].keyBinding&&
(a=t._activeBindings[r.id],a.invocation=p?q:null,a.bindingOnly&&(z=!1));t._urlBindings[r.id]&&t._urlBindings[r.id].urlBinding&&(B=t._urlBindings[r.id],B.invocation=p?q:null,B.bindingOnly&&(z=!1));z=z&&p}z&&(r.choiceCallback?("tool"===m||"button"===m?(a=b,z=!1,"ul"===b.nodeName.toLowerCase()&&(a=document.createElement("li"),b.appendChild(a))):(a=b,z=!0),t._createDropdownMenu(a,r.name,z,function(a){r.populateChoicesMenu(a,c,d,n,t)}.bind(r),r.imageClass,r.tooltip||r.title,r.selectionClass,r.positioningNode)):
(q.handler=q.handler||this,q.domParent=b,z=function(a){t._invoke(q)},"menu"===m?(B=null,a&&a.keyBinding&&(B=g.getUserKeyString(a.keyBinding)),a=k.createCommandMenuItem(b,r,q,null,z,B)):(a=m+r.id+s,a=k.createCommandItem(b,r,q,a,null,"tool"===m,z)),l.generateNavGrid(f,a),q.domNode=a,s++))}})},_createDropdownMenu:function(a,b,c,m,g,p,s,q,B,z){a=d.node(a);if(!a||!d.contains(document.body,a))return null;var t,h,G=a;if(c)p=document.createRange(),p.selectNode(a),p=p.createContextualFragment(n),d.processTextNodes(p,
{ButtonText:b}),a.appendChild(p),h=a.lastChild,g=h.lastChild,b=g.previousSibling,b.dropdown=new f.Dropdown({dropdown:g,populate:m,parentDropdown:a.dropdown}),g.dropdown=b.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(G=document.createElement("li"),a.appendChild(G),h=G);a=null;g&&(a="dropdownButtonWithIcon",p=p||b);p=g?p||b:p;var E=k.createDropdownMenu(G,b,m,a,g,!1,s,q,B||z);t=E.dropdownArrow;b=E.menuButton;if(t){B&&(B.domNode=E.menuButton);var l=this;b.onclick=function(a){var b=d.bounds(t);a.clientX>=
b.left&&E.dropdown?E.dropdown.toggle(a):l._invoke(B)};E.dropdown&&(b.onkeydown=function(a){d.KEY.DOWN===a.keyCode&&(E.dropdown.toggle(a),d.stop(a))})}g=E.menu;var D;(m=B&&B.command&&(B.command.tooltip||B.command.name))?D=B.command.tooltip||B.command.name:m&&(D=p);D&&(b.commandTooltip=new e.Tooltip({node:b,text:D,position:["above","below","right","left"]}))}return{menuButton:b,menu:g,dropdown:b.dropdown,destroyButton:h,dropdownArrow:t}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,
"menu")){var b=document.createElement("li");b.classList.add("dropdownSeparator");var c=document.createElement("span");c.classList.add("dropdownSeparator");b.appendChild(c);a.appendChild(b)}},generateSeparatorImage:function(a){var b;b="ul"===a.nodeName.toLowerCase()?document.createElement("li"):document.createElement("span");a.appendChild(b);b.classList.add("core-sprite-sep");b.classList.add("imageSprite");b.classList.add("commandSeparator");return b}};a.prototype.constructor=a;m.prototype={match:function(a){a=
h.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};m.prototype.constructor=m;s.prototype.constructor=s;t.prototype={optionsRequested:function(){return this.optionsRequested}};t.prototype.constructor=t;p.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){var b=this.parameterTable={};a.forEach(function(a){b[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},
hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,b){var c=this.parameterTable[a];c&&(c.value=b)},forEach:function(a){for(var b in this.parameterTable)this.parameterTable[b].type&&this.parameterTable[b].name&&a(this.parameterTable[b])},makeCopy:function(){var a=
[];this.forEach(function(b){b=new t(b.name,b.type,b.label,b.value,b.lines,b.eventListeners);a.push(b)});var b=new p(a,this._options,this.getParameters);b.clientCollect=this.clientCollect;return b},hasOptionalParameters:function(){return this._hasOptionalParameters}};p.prototype.constructor=p;return{CommandRegistry:a,URLBinding:m,ParametersDescription:p,CommandParameter:t,CommandEventListener:s}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(k,l,h){function g(d,f){this._activeContainer=null;this._getElementsFunction=d;this._toolbarLayoutFunction=f}g.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&h.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&h.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(d,f,e){"string"===typeof d&&(d=h.node(d));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===d)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(d))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=e;var c=f(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!c)return!1;this._activeElements.focusNode=c;d=h.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===d.length){f=this._activeElements.dismissArea||
this._activeElements.parameterArea;d=document.createElement("button");d.id="closebox";d.className="imageSprite core-sprite-close dismissButton";d.title=k.Close;f.appendChild(d);var b=this;d.addEventListener("click",function(c){b.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);c&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){c.focus();c.select&&c.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(d,f){h.$$array("input",f).forEach(function(e){"checkbox"===e.type?d.parameters.setValue(e.parameterName,e.checked):"button"!==e.type&&d.parameters.setValue(e.parameterName,e.value.trim())});h.$$array("textArea",f).forEach(function(e){d.parameters.setValue(e.parameterName,e.value.trim())});d.command.callback&&d.command.callback.call(d.handler,d)},collectParameters:function(d){return d.parameters?
(d.domNode&&d.domNode.classList.add("commandMarker"),this.open(d.domNode||d.domParent,this.getFillFunction(d))):!1},getFillFunction:function(d,f){var e=this;return function(c,b){var n=null,a=function(){f&&f();e.close()},m=function(b){b.keyCode===h.KEY.ENTER&&e._collectAndCall(d,c);if(b.keyCode===h.KEY.ESCAPE||b.keyCode===h.KEY.ENTER)a(),h.stop(b)};d.parameters.forEach(function(b){var e=null;b.label&&(e=document.createElement("label"),e.classList.add("parameterInput"),e.setAttribute("for",b.name+"parameterCollector"),
e.textContent=b.label,c.appendChild(e));var f=b.name+"parameterCollector",g,e=e||c;"text"===b.type&&"number"===typeof b.lines&&1<b.lines?(g=document.createElement("textarea"),g.rows=b.lines,g.type="textarea",g.id=f,e.appendChild(g),m=function(b){b.keyCode===h.KEY.ESCAPE&&(a(),h.stop(b))}):"boolean"===b.type?(g=document.createElement("input"),g.type="checkbox",g.id=f,e.appendChild(g),b.value&&(g.checked=!0)):(g=document.createElement("input"),g.type=b.type,g.id=f,e.appendChild(g),b.value&&(g.value=
b.value));g.classList.add("parameterInput");g.setAttribute("speech","speech");g.setAttribute("x-webkit-speech","x-webkit-speech");g.parameterName=b.name;n||(n=g);0<b.eventListeners.length&&b.eventListeners.forEach(function(a){g.addEventListener(a.event,function(b){return a.handler(b,d)},a.capture)});g.addEventListener("keydown",m,!1)});var g=b;g||(g=document.createElement("span"),g.classList.add("layoutRight"),g.classList.add("parametersDismiss"),c.appendChild(g));var t=function(a,b){var c=document.createElement("button");
b.appendChild(c);a&&c.appendChild(document.createTextNode(a));c.classList.add("dismissButton");return c};d.parameters.hasOptionalParameters()&&(d.parameters.optionsRequested=!1,t(k.More,g).addEventListener("click",function(){d.parameters.optionsRequested=!0;e._collectAndCall(d,c);a()},!1));t(k.Submit,g).addEventListener("click",function(){e._collectAndCall(d,c);a()},!1);g=t(null,g);g.id="closebox";g.classList.add("imageSprite");g.classList.add("core-sprite-close");g.title=k.Close;g.addEventListener("click",
function(b){a()},!1);return n}}};g.prototype.constructor=g;return{CommandParameterCollector:g}});define("orion/regex",[],function(){return{escape:function(k){return k.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(k){return(k=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(k))?{pattern:k[1],flags:k[2]}:null}}});
define("orion/contentTypes",[],function(){function k(b,a){if("string"!==typeof b)return null;for(var c=b&&b.split(".").pop(),e=null,d=0;d<a.length;d++){var f=a[d],g;g=e;var h=f,k=c,l=0<=h.filename.indexOf(b),x;x=k.toLowerCase();x=-1!==h.extension.indexOf(x);if(l||x){if(!(x=!g))l&&(k=k.toLowerCase(),l=-1!==g.extension.indexOf(k)),x=l;x&&(g=h)}g===f&&(e=f)}return e}function l(b){return null===b||"undefined"===typeof b?[]:Array.isArray(b)?b:[b]}function h(b){return l(b).map(function(a){return String.prototype.toLowerCase.call(a)})}
function g(b){return{id:b.id,name:b.name,image:b.image,imageClass:b.imageClass,"extends":b["extends"],extension:h(b.extension),filename:l(b.filename)}}function d(b){var a=Object.create(null);b.map(g).forEach(function(b){Object.prototype.hasOwnProperty.call(a,b.id)||(a[b.id]=b)});return a}function f(n){if(n&&n.registerService){this.serviceRegistry=n;for(var a=n.getServiceReferences(c).concat(n.getServiceReferences(b)),m=[],f=0;f<a.length;f++)for(var g=l(a[f].getProperty("contentTypes")),p=0;p<g.length;p++)m.push(g[p]);
this.map=d(m);n.registerService(e,this)}else if(Array.isArray(n))this.serviceRegistry=null,this.map=d(n);else throw Error("Invalid parameter");}var e="orion.core.contentTypeRegistry",c="orion.core.contenttype",b="orion.file.contenttype";f.prototype={getContentTypes:function(){var b=this.getContentTypesMap(),a=[],c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&a.push(b[c]);return a},getContentTypesMap:function(){return this.map},getFileContentType:function(b){return k(b.Name,this.getContentTypes())},
getFilenameContentType:function(b){return k(b,this.getContentTypes())},getContentType:function(b){return this.map[b]||null},isExtensionOf:function(b,a){b="string"===typeof b?this.getContentType(b):b;a="string"===typeof a?this.getContentType(a):a;if(!b||!a)return!1;if(b.id===a.id)return!0;for(var c=b,e={};c&&(c=this.getContentType(c["extends"]));){if(c.id===a.id)return!0;if(e[c.id])throw Error("Cycle: "+c.id);e[c.id]=!0}return!1},isSomeExtensionOf:function(b,a){for(var c=0;c<a.length;c++)if(this.isExtensionOf(b,
a[c]))return!0;return!1}};return{ContentTypeRegistry:f,getFilenameContentType:k}});
define("orion/URITemplate",[],function(){function k(a){this._text=a}function l(a){return a.replace("%25","%")}function h(a,b){if("U"===b)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(n,l);if("U+R-,"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function g(a,b,c){for(var e=
[],d=0;d<a.length;d++)"undefined"!==typeof a[d]&&e.push(h(a[d],b));return e.join(c)}function d(a,b,c,e){for(var d=Object.keys(a),n=[],f=0;f<d.length;f++)"undefined"!==typeof a[d[f]]&&n.push(h(d[f],b)+c+h(a[d[f]],b));return n.join(e)}function f(a){if(0===a.length)throw Error("Invalid Expression: 0 length expression");(this._operator=c[a[0]])?a=a.substring(1):this._operator=c.NUL;for(var e=[],d=a.split(","),n=0;n<d.length;n++){var f=d[n].match(b);if(null===f)throw Error("Bad VarSpec: "+a);e.push({name:f[1],
explode:!!f[2],prefix:f[3]?parseInt(f[3],10):-1})}this._varSpecList=e}function e(a){for(var b=[],c=0,e=a.indexOf("{",c);-1!==e;){b.push(new k(a.substring(c,e)));c=a.indexOf("}",e+1);if(-1===c)throw Error("Invalid template: "+a);b.push(new f(a.substring(e+1,c)));c+=1;e=a.indexOf("{",c)}b.push(new k(a.substring(c)));this._templateComponents=b}var c={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},b=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,n=/%25[0-9A-F][0-9A-F]/g;k.prototype={expand:function(a){return encodeURI(this._text)}};
f.prototype={expand:function(a){for(var b=[],c=0;c<this._varSpecList.length;c++){var e=this._varSpecList[c],n=e.name,f=a[n],k=typeof f;if("undefined"!==k&&null!==f){var w=0===b.length?this._operator.first:this._operator.sep;if("string"===k)this._operator.named&&(w+=h(n,"U+R"),w+=0===f.length?this._operator.ifemp:"\x3d"),-1!==e.prefix&&e.prefix<f.length&&(f=f.substring(0,e.prefix)),w+=h(f,this._operator.allow);else if(Array.isArray(f)){if(0===f.length)continue;e.explode?w+=g(f,this._operator.allow,
this._operator.sep):(e=g(f,this._operator.allow,","),this._operator.named&&(w+=h(n,"U+R"),w+=0===e.length?this._operator.ifemp:"\x3d"),w+=e)}else if("object"===k){if(0===Object.keys(f).length)continue;e.explode?w+=d(f,this._operator.allow,"\x3d",this._operator.sep):(e=d(f,this._operator.allow,",",","),this._operator.named&&(w+=h(n,"U+R"),w+=0===e.length?this._operator.ifemp:"\x3d"),w+=e)}else throw Error("bad param type: "+n+" : "+k);b.push(w)}}return b.join("")}};e.prototype={expand:function(a){for(var b=
[],c=0;c<this._templateComponents.length;c++)b.push(this._templateComponents[c].expand(a));return b.join("")}};return e});
define("orion/i18nUtil",["require","orion/Deferred"],function(k,l){function h(d){if(d=localStorage.getItem("orion/messageBundle/"+d))if(d=JSON.parse(d),d._expires&&d._expires>(new Date).getTime())return delete d._expires,d;return null}var g={};return{getMessageBundle:function(d){function f(a){a?k(["i18n!"+d],function(a){if(a){var b=d;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+b,JSON.stringify(a));delete a._expires}c.resolve(a)}):e(Error(d))}function e(a){c.reject(a)}
if(g[d])return g[d];var c=new l;g[d]=c;var b=h(d);if(b)return c.resolve(b),c;try{k([d],f,e)}catch(n){k(["orion/i18n!"+d],f,e)}return c},formatMessage:function(d){var f=arguments;return d.replace(/\$\{([^\}]+)\}/g,function(e,c){return f[(c<<0)+1]})}}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(k,l,h,g,d,f,e){function c(){return k.toUrl?(new URL(k.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function b(a){var b={};a.getPropertyKeys().forEach(function(c){"objectClass"!==c&&"service.names"!==c&&"service.id"!==c&&"__plugin__"!==c&&(b[c]=a.getProperty(c))});return b}function n(a){return d.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(b){a.textContent=a.nameKey||a.name;return a})}function a(a,e){var d=a.getServiceReferences(e||"orion.page.link"),m=h.matchResourceParameters(window.location.href),f={OrionHome:c(),Location:m.resource},p=[];d.forEach(function(a){a=b(a);if(a.uriTemplate&&(a.nls||a.name)){var c=(new g(a.uriTemplate)).expand(f),c=h.validateURLScheme(c);a.href=c;a.nls?p.push(n(a)):(a.textContent=a.name,p.push((new l).resolve(a)))}});return l.all(p)}function m(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function s(a){this.allPageLinks=a;this.allPageLinks.sort(t)}function t(a,b){var c=a.textContent&&a.textContent.toLowerCase(),e=b.textContent&&b.textContent.toLowerCase();return c<e?-1:c>e?1:0}var p;f.mixin(m.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});f.mixin(s.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href;a=
a.textContent;var c=document.createElement("a");c.href=b;c.target="_self";c.classList.add("targetSelector");c.textContent=a;return c})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var c;return!p?(c=[],a.getServiceReferences("orion.page.link.category").forEach(function(a){a=b(a);if(a.id&&(a.name||a.nameKey))a.nls?c.push(n(a)):(a.textContent=a.name,c.push((new l).resolve(a)))}),l.all(c).then(function(a){return p=new m(a)})):(new l).resolve(p)},getPageLinksInfo:function(b,
c){return a(b,c).then(function(a){return new s(a)})},getOrionHome:c}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(k,l,h,g,d,f,e,c,b,n){function a(a){var b={};a.getPropertyKeys().forEach(function(c){b[c]=a.getProperty(c)});return b}var m={},s=b.getOrionHome();m._cloneItemWithoutChildren=function u(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),c;for(c in a)"children"!==c&&"Children"!==
c&&(b[c]=u(a[c]));return b};m._getOpenWithNavCommandExtensions=function(a,b){function c(a,b){for(var e=a.getServiceReferences("orion.navigate.openWith"),d=[],q=[],m=0;m<e.length;m++){var n=e[m];if(n.getProperty("editor")===b.id){var f=n.getProperty("contentType");f instanceof Array?d=d.concat(f):d.push(f||"*/*");n=n.getProperty("excludedContentTypes");n instanceof Array?q=q.concat(n):null!==n&&"undefined"!==typeof n&&q.push(n)}}0===d.length&&(d=null);0===q.length&&(q=null);return{contentTypes:d,excludedContentTypes:q}}
for(var e=function(){for(var b=a.getServiceReferences("orion.edit.editor"),c=[],e=0;e<b.length;e++){var d=b[e],q=d.getProperty("id");c.push({id:q,"default":d.getProperty("default")||!1,name:d.getProperty("name"),nameKey:d.getProperty("nameKey"),nls:d.getProperty("nls"),uriTemplate:d.getProperty("orionTemplate")||d.getProperty("uriTemplate"),validationProperties:d.getProperty("validationProperties")||[]})}return c}(),d=[],m=0;m<e.length;m++){var q=e[m],n=c(a,q);d.push({properties:{name:q.name||q.id,
nameKey:q.nameKey,id:"eclipse.openWithCommand."+q.id,contentType:n.contentTypes,excludedContentTypes:n.excludedContentTypes,uriTemplate:q.uriTemplate,nls:q.nls,forceSingleItem:!0,isEditor:q["default"]?"default":"editor",validationProperties:q.validationProperties},service:{}})}return d};m._makeValidator=function(a,b,c,e){function m(a,b,c,e,d){var q=!1,n;if("!"===b.charAt(0))return"undefined"===typeof a[b.substring(1)];if("undefined"!==typeof a[b]){if("undefined"===typeof c)n=a[b],q=!0;else if("string"===
typeof c){if(!typeof("string"===a[b]))return!1;if(e.variableName){if(c=RegExp(c).exec(a[b]))q=c[0],n="before"===e.variableMatchPosition?a[b].substring(0,c.index):"after"===e.variableMatchPosition?a[b].substring(c.index+q.length):"only"===e.variableMatchPosition?q:a[b],q=!0}else return RegExp(c).test(a[b])}else a[b]===c&&(n=a[b],q=!0);b=e.variableName;e=e.replacements;if(q&&b&&(d[b]=n,d.itemCached=a,e)){if("string"!==typeof n)return window.console.log("Cannot replace "+b+", value is not a string: "+
n),q;for(a=0;a<e.length;a++){n=!1;if(e[a].pattern){c=e[a].pattern;var f=e[a].replacement||"";d[b]=d[b].replace(RegExp(c),f).replace(RegExp(c),f)}else n=!0;n&&window.console.log("Invalid replacements specified in validation property.  "+e[a])}}return q}return!1}function n(a,b,c,e){var d=c.match,q,f;if(0<=(q=b.indexOf("["))){if(0>(f=b.indexOf("]")))return!1;var g=b.substring(0,q),p;if(!(p=a[g])||!Array.isArray(p))return!1;q=b.substring(q+1,f);q=parseInt(q,10);if(isNaN(q))return!1;0>q&&(q+=p.length);
b=b.substring(f+1);b=g+":"+String(q)+b}return 0<=b.indexOf("|")?(q=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),n(a,q,c,e)?!0:n(a,b,c,e)):0<=b.indexOf(":")?(q=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[q]?n(a[q],b,c,e):!1):m(a,b,d,c,e)}function q(b,c,e){if(e.info.validationProperties)for(var q=0;q<e.info.validationProperties.length;q++){var m=e.info.validationProperties[q];if("undefined"!==typeof m.source){if(!n(b,m.source,m,e))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var q=!0,f=c?d.getFilenameContentType(b.Name,c):null,f=f||{id:"application/octet-stream"};e.info.excludedContentTypes&&c&&(q=e.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==f.id.search(a)?!1:!0}));q&&e.info.contentType&&c&&(q=e.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==f.id.search(a)?!0:!1}));return q}return{info:a,validationFunction:function(a){"function"===typeof e&&(a=e.call(this,a));
if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var b=0;b<a.length;b++)if(!q(a[b],c,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var b={},c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);if(this.info.validationProperties)for(c=0;c<this.info.validationProperties.length;c++){var e=this.info.validationProperties[c];
e.source&&e.variableName&&(this.itemCached===a&&this[e.variableName]||n(a,e.source,e,this),a[e.variableName]?window.console.log("Variable name "+e.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):b[e.variableName]=this[e.variableName])}b.OrionHome=s;return(new f(this.info.uriTemplate)).expand(b)}return null}}};var t=n.UnnamedCommand;m._createCommandOptions=function(a,b,c,d,n,f){function q(e,q){var z=m._makeValidator(a,c,d,f);e.visibleWhen=
z.validationFunction.bind(z);if(n)if(z.generatesURI.bind(z)())e.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return z.getURI.bind(z)(a)};else{var g=a;e.callback=function(a){var d;if(g.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,d=m._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){d=[];for(var q=0;q<a.items.length;q++)d.push(m._cloneItemWithoutChildren(a.items[q]))}else d=m._cloneItemWithoutChildren(a.items);if(c)var n=c.getService("orion.page.progress");
b.run?n?n.progress(b.run(d),"Running command: "+e.name):b.run(d):c&&(n?n.progress(c.getService(b).run(d),"Running command: "+e.name):c.getService(b).run(d))}}q.resolve(e)}var g=new l;if(a.nls){var z=function(b){var c;b?(c=a.tooltipKey&&b[a.tooltipKey],b=a.nameKey&&b[a.nameKey]||a.name||t,c=c||a.tooltip||""):(b=a.name||a.nameKey||t,c=a.tooltip||a.tooltipKey||"");q({name:b,image:a.image,id:a.id||a.name,tooltip:c,isEditor:a.isEditor,showGlobally:a.showGlobally},g)};e.getMessageBundle(a.nls).then(z,z.bind(this,
null))}else q({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},g);return g};m.getOpenWithCommand=function(a,b,c){var e;a=c||m.getOpenWithCommands(a);for(c=0;c<a.length;c++)if(a[c].visibleWhen(b)){var d="default"===a[c].isEditor;if(!e||d)if(e=a[c],d)break}return e};m.getOpenWithCommands=function(a){var b=[],c;for(c in a._commandList){var e=a._commandList[c];e.isEditor&&b.push(e)}return b};var p;m.createAndPlaceFileCommandsExtension=function(a,
b,c,e,d,f){return m.createFileCommands(a,null,f?"all":void 0,!!f,b).then(function(a){d&&0<a.length&&(b.addCommandGroup(c,"eclipse.openWith",1E3,n.OpenWith,d,null,null,null,"dropdownSelection"),b.addCommandGroup(c,"eclipse.fileCommandExtensions",1E3,n.OpenRelated,d));a.forEach(function(a){var q=null;d&&(q=a.isEditor?d+"/eclipse.openWith":d+"/eclipse.fileCommandExtensions");b.registerCommandContribution(c,a.id,e,q)});return{}})};m.createFileCommands=function(a,b,c,e,d){c=void 0===c?"global":c;e=void 0===
e?!0:e;var n=[];m._cachedFileCommands||m._createCachedFileCommands(a);("all"===c||"global"===c)&&m._cachedFileCommands.forEach(function(a){var b=a.properties;("all"===c||b.forceSingleItem&&b.showGlobally)&&n.push(a)});return l.when(function(){var c=a.getService("orion.core.contentTypeRegistry")||b;return p||l.when(c.getContentTypes(),function(a){return p=a})}(),function(){e&&(m._cachedOpenWithExtensions||(m._cachedOpenWithExtensions=m._getOpenWithNavCommandExtensions(a,p)),n=n.concat(m._cachedOpenWithExtensions),
d._addedOpenWithCommands=e);var b=n.map(function(b){var c=b.properties;b=b.service;var e=d.findCommand(c.id||c.name);return e?(new l).resolve(e):m._createCommandOptions(c,b,a,p,!0).then(function(a){a=new h.Command(a);d.addCommand(a);return a})});return l.all(b,function(a){return{_error:a}}).then(function(a){return a})})};m._createCachedFileCommands=function(b){var c=b.getServiceReferences("orion.navigate.command");m._cachedFileCommands=[];for(var e=0;e<c.length;e++)if("orion.navigateFromMetadata"!==
c[e].getProperty("id")){var d=b.getService(c[e]),n=a(c[e]);m._cachedFileCommands.push({properties:n,service:d})}};m.getFileCommandIds=function(){var a=[];if(m._cachedFileCommands)m._cachedFileCommands.length&&(a=m._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};m.createOpenWithCommands=function(a,b,c){return c&&c._addedOpenWithCommands?(new l).resolve(m.getOpenWithCommands(c)):m.createFileCommands(a,b,
"none",!0,c)};return m});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(k,l){function h(g){this._init(g)}h.prototype={_init:function(g){var d=l.node(g.container);if(!d)throw"no parent container";this._container=d;d.classList.remove("currentLocation");this._id=g.id||"eclipse.breadcrumbs";this._resource=g.resource||null;this._rootSegmentName=g.rootSegmentName;this._workspaceRootSegmentName=g.workspaceRootSegmentName;this._workspaceRootURL=g.workspaceRootURL;this._makeHref=g.makeHref;this._makeFinalHref=
g.makeFinalHref;this._maxLength=g.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var g;if(this._resource&&this._resource.Parents&&!this._resource.skip){g=document.createElement("a");var d=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(g,d):g.href=k.toUrl("edit/edit.html")+"#"+d}else g=document.createElement("span");l.empty(g);g.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return g}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(g){var d=document.createElement("a");d.classList.add("breadcrumb");d.appendChild(document.createTextNode(g));return d},addSegmentHref:function(g,d){this._makeHref?this._makeHref(g,d.Location,d):g.href=k.toUrl("edit/edit.html")+"#"+d.ChildrenLocation},buildSegments:function(g,d){if(this._resource.Parents){var f=this._resource.Parents.slice(0),e,c;f&&(f=f.slice(0),"reverse"===d&&(f=f.reverse().slice(0)),
f.forEach(function(b){b.skip||(g?(c=g,g=null):c=b.Name,e=this.buildSegment(c),this.path+=b.Name,this.addSegmentHref(e,b),e.include=!1,this.segments.push(e))}.bind(this)))}},addDivider:function(){var g=document.createElement("span");g.appendChild(document.createTextNode(" / "));this.path+="/";g.classList.add("breadcrumbSeparator");this.append(g)},refresh:function(){(this.crumbs=l.node(this._id))?l.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(g){this.crumbs.appendChild(g)},addTitle:function(g,d){var f=d||document.title;0===this.crumbs.childNodes.length&&(g=document.createElement("span"),g.appendChild(document.createTextNode(f)),
g.classList.add("breadcrumb"),g.classList.add("currentLocation"),this.append(g))},finalSegment:function(g,d){if(!this._resource.skip){var f;f=d?d:this._resource.Name;this._makeFinalHref?(g=this.buildSegment(f),this.addSegmentHref(g,this._resource)):(g=document.createElement("span"),g.appendChild(document.createTextNode(f)));g.classList.add("currentLocation");this.path+=this._resource.Name;this.append(g)}},firstSegment:function(g){g&&(this.append(g),this._resource&&this._resource.Parents&&!this._resource.skip?
(g.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(g.href=""),g.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(g){!0===g.include&&(this.append(g),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var g=this.segments.slice(0).reverse();g.forEach(function(d){this.append(d);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?d.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=g.reverse()}},measure:function(){var g=this._container;g.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:g.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var g=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(g,d):(this.finalSegment(g,d),this._resource&&this._resource.Parents&&(this.buildSegments(d,"reverse"),this.measureSegments(),this.firstSegment(g)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var g=this.getNavigatorWorkspaceRootSegment(),d=this._rootSegmentName;d?this.addTitle(g,d):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(g),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(g,d)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};h.prototype.constructor=h;return{BreadCrumbs:h}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(k,l,h){function g(d){l.attach(this);this._init(d)}g.prototype={_init:function(d){this._tracking=null;this._animationDelay=501;this._closeReversely=d.closeReversely;this.$node=h.node(d.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=h.node(d.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=h.node(d.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=d.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");d.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof d.closeByDefault&&(this._closeByDefault=d.closeByDefault);this._initializeFromStoredSettings();
this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display="block";this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1);window.addEventListener("mouseup",this._mouseUp.bind(this),!1);window.addEventListener("resize",this._resize.bind(this),!1)},isClosed:function(){return this._closed},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(d){this.addEventListener("resize",function(f){d(f.node)})},_initializeFromStoredSettings:function(){var d=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof d?"closed"===d:this._closeByDefault;var d=h.bounds(this.$node.parentNode),f=h.bounds(this.$node),e;this._vertical?(e=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(e,10),this._splitTop>d.top+d.height-f.height&&(this._splitTop=d.top+d.height/
2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(e=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(e,10),this._splitLeft>d.left+d.width-f.width&&(this._splitLeft=d.left+d.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var d=h.bounds(this.$node),f=h.bounds(this.$node.parentNode);return this.vertical?d.top-f.top:d.left-f.left},_adjustToSplitPosition:function(d){var f=
h.bounds(this.$node),e=h.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=f.height;if(d||!this._splitTop)this._splitTop=f.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);d=this._splitTop;"relative"===this.$node.parentNode.style.position&&(d=this._splitTop-e.top);this.$sideNode.style.height=d+"px";this.$sideNode.style.display="block";this.$node.style.top=d+"px"}else{this._splitWidth=f.width;if(d||!this._splitLeft)this._splitLeft=f.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);d=this._splitLeft;"relative"===this.$node.parentNode.style.position&&(d=this._splitLeft-e.left);this.$sideNode.style.width=d+"px";this.$sideNode.style.display="block";this.$node.style.left=d+"px"}this._resize()},_resize:function(d,f,e){d=d||0;var c=h.bounds(this.$node.parentNode),b=h.bounds(this.$node);this._vertical?(void 0===e&&(e=b.top-c.top),e+=b.height,this.$mainNode.style.top=e+"px"):(void 0===f&&(f=b.left-c.left),f+=b.width,this.$mainNode.style.left=f+"px");var n=
this;window.setTimeout(function(){n._notifyResizeListeners(n.$mainNode);n._notifyResizeListeners(n.$sideNode)},d)},_notifyResizeListeners:function(d){this.dispatchEvent({type:"resize",node:d})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(d,f){d||this._addAnimation();var e=this._splitTop,c=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&!this._splitTop&&"number"===typeof this._initialSplit&&(e=c=this._initialSplit);
else if(this._closed=!0,this._closeReversely){var b=h.bounds(this.$node.parentNode),n=h.bounds(this.$node);this._vertical?e=b.height-n.height:c=b.width-n.width}else e=c=0;this._vertical?(this.$sideNode.style.height=e+"px",this.$node.style.top=e+"px"):(this.$sideNode.style.width=c+"px",this.$node.style.left=c+"px");this._resize(this._animationDelay,c,e);d||this._removeAnimation();f||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var a=this;window.setTimeout(function(){a._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var d=this;window.setTimeout(function(){d.$sideNode.classList.remove(d._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");d.$mainNode.classList.remove(d._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");d.$node.classList.remove(d._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":
"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_mouseDown:function(d){if(d.target===this._thumb)return h.stop(d),this._thumbDown();this._tracking||(this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),
window.addEventListener("mousemove",this._tracking),h.setFramesEnabled(!1),h.stop(d))},_mouseMove:function(d){if(this._tracking){var f=h.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=d.clientY;this._splitTop<f.top+5?this._splitTop=f.top+5:this._splitTop>f.top+f.height-5&&(this._splitTop=f.top+f.height-5);var e=this._splitTop,e=this._splitTop-f.top;this.$node.style.top=e+"px"}else this._splitLeft=d.clientX,this._splitLeft<f.left+5?this._splitLeft=f.left+5:this._splitLeft>f.left+f.width-
5&&(this._splitLeft=f.left+f.width-5),e=this._splitLeft-2*f.left,this.$node.style.left=e+"px";this._adjustToSplitPosition(!0);h.stop(d)}},_mouseUp:function(d){this._tracking&&(h.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),h.stop(d))}};g.prototype.constructor=g;return{Splitter:g}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(k,l,h){function g(d){this.commandRegistry=d.commandRegistry;this.create();this._filterString="";this._providers=[]}g.prototype={addProvider:function(d){this._providers.push(d)},create:function(){var d=this._keyAssistDiv=document.createElement("div");d.id="keyAssist";d.style.display="none";d.classList.add("keyAssistFloat");d.setAttribute("role","menu");var f=this._keyAssistInput=document.createElement("input");
f.classList.add("keyAssistInput");f.type="text";f.placeholder=k["Filter bindings"];d.appendChild(f);var e=this._keyAssistContents=document.createElement("div");e.classList.add("keyAssistContents");if(h.isIOS||h.isAndroid)e.style.overflowY="auto";d.appendChild(e);var c=this._keyAssistTable=document.createElement("table");c.tabIndex=0;c.classList.add("keyAssistList");e.appendChild(c);document.body.appendChild(d);f.addEventListener("keydown",function(b){this._keyDown(b)}.bind(this));c.addEventListener("keydown",
function(b){this._keyDown(b)}.bind(this));f.addEventListener("input",function(b){this.filterChanged()}.bind(this));e.addEventListener(h.isFirefox?"DOMMouseScroll":"mousewheel",function(b){this._scrollWheel(b)}.bind(this));document.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE&&this.hide()}.bind(this));l.addAutoDismiss([d],function(){this.hide()}.bind(this))},createContents:function(){l.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var d=this._idCount=
this._keyAssistContents.scrollTop=0;d<this._providers.length;d++)this._providers[d].showKeyBindings(this);this.createHeader(k.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(d,f,e){if(this._filterString){var c=this._filterString.toLowerCase(),b;c!==this._filterString?(c=this._filterString,b=function(a){return a}):b=function(a){return a.toLowerCase()};if(-1===b(f).indexOf(c)&&-1===b(d).indexOf(c)&&-1===b(this._lastHeader).indexOf(c))return}var n=this._keyAssistTable.insertRow(-1);
n.id="keyAssist-keyBinding-"+this._idCount++;n.setAttribute("role","menuitem");n._execute=e;n.classList.add("keyAssistItem");n.addEventListener("click",function(a){this._selectedRow=n;this.execute();a.preventDefault()}.bind(this));e=n.insertCell(-1);e.classList.add("keyAssistName");e.appendChild(document.createTextNode(f));e=n.insertCell(-1);e.classList.add("keyAssistAccel");e.appendChild(document.createTextNode(d))},createHeader:function(d){this._lastHeader=d;var f=this._keyAssistTable.insertRow(-1);
f.classList.add("keyAssistSection");var f=f.insertCell(-1),e=document.createElement("h2");e.appendChild(document.createTextNode(d));f.appendChild(e)},execute:function(){window.setTimeout(function(){this.hide();var d=this._selectedRow;this._selectedRow=null;d&&d._execute&&d._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var d=this._keyAssistInput.value;this._filterString!==d&&(this._filterString=
d,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var d=document.activeElement,f=this._keyAssistDiv,d=f===d||0!==(f.compareDocumentPosition(d)&16);f.style.display="none";d&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(d){d=this._providers.indexOf(d);-1!==d&&this._providers.splice(d,
1)},select:function(d){var f=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===f.length)this._selectedIndex=-1;else{var e=this._selectedIndex,e=(e+(d?1:-1))%f.length;0>e&&(e=f.length-1);-1!==this._selectedIndex&&(d=f[this._selectedIndex],d.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=e;if(-1!==this._selectedIndex){this._selectedRow=d=f[this._selectedIndex];d.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",d.id);this._keyAssistTable.focus();
var f=d.getBoundingClientRect(),c=this._keyAssistContents,b=c.getBoundingClientRect();d.offsetTop<c.scrollTop?0===e?c.scrollTop=0:d.scrollIntoView(!0):f.bottom>b.bottom&&d.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(d){if(40===d.keyCode)this.select(!0);else if(38===d.keyCode)this.select(!1);else if(13===d.keyCode)this.execute();else return;d.preventDefault()},_scrollWheel:function(d){var f=0,f=h.isIE||h.isOpera?-d.wheelDelta:h.isFirefox?40*d.detail:-d.wheelDeltaY,e=this._keyAssistContents,c=e.scrollTop;e.scrollTop+=f;if(c!==e.scrollTop)return d.preventDefault&&d.preventDefault(),!1}};return{KeyAssistPanel:g}});
define("orion/widgets/themes/ThemePreferences",[],function(){function k(k,h){this._preferences=k;this._themeData=h;var g=h.getThemeStorageInfo();this._themeVersion=g.version;var d=k.listenForChangedSettings(g.storage,2,function(f){f.key===d&&this.apply()}.bind(this))}k.prototype={_initialize:function(k,h,g){var d,f;void 0===this._themeVersion||g.get("version")===this._themeVersion?(d=g.get(k.styleset),(f=g.get("selected"))&&(f=JSON.parse(f))):f=d=null;d||(d=h.getStyles(),g.put(k.styleset,JSON.stringify(d)));
if(!f||void 0===f[k.selectedKey])f=f||{},f[k.selectedKey]=k.defaultTheme,g.put("selected",JSON.stringify(f));g.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(k){var h=this._themeData,g=h.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(d){this._initialize(g,h,d);var f=JSON.parse(d.get("selected"));d=JSON.parse(d.get(g.styleset));var e;if(d)for(var c=0;c<d.length;c++)if(d[c].name===f[g.selectedKey]){e=d[c];break}k({style:e,styles:d})}.bind(this))},
setTheme:function(k,h){var g=this._themeData,d=g.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(f){this._initialize(d,g,f);var e=JSON.parse(f.get("selected"));k||(k=e[d.selectedKey]);e[d.selectedKey]=k;f.put("selected",JSON.stringify(e));h?f.put(d.styleset,JSON.stringify(h)):h=JSON.parse(f.get(d.styleset));for(var c=0;c<h.length;c++)if(h[c].name===e[d.selectedKey]){g.processSettings(h[c]);break}f.put("version",this._themeVersion)}.bind(this))},setFontSize:function(k){var h=
this._themeData,g=h.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(d){this._initialize(g,h,d);var f=JSON.parse(d.get("selected")),e=JSON.parse(d.get(g.styleset)),c;if(e)for(var b=0;b<e.length;b++)e[b].fontSize=k,e[b].name===f[g.selectedKey]&&(c=e[b]);d.put(g.styleset,JSON.stringify(e));h.processSettings(c)}.bind(this))}};return{ThemePreferences:k}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/editor/eventTarget",[],function(){function k(){}k.addMixin=function(l){var h=k.prototype,g;for(g in h)h.hasOwnProperty(g)&&(l[g]=h[g])};k.prototype={addEventListener:function(k,h,g){this._eventTypes||(this._eventTypes={});var d=this._eventTypes[k];d||(d=this._eventTypes[k]={level:0,listeners:[]});d.listeners.push({listener:h,useCapture:g})},dispatchEvent:function(k){var h=k.type;this._dispatchEvent("pre"+h,k);this._dispatchEvent(h,k);this._dispatchEvent("post"+h,k)},_dispatchEvent:function(k,
h){var g=this._eventTypes?this._eventTypes[k]:null;if(g){var d=g.listeners;try{if(g.level++,d)for(var f=0,e=d.length;f<e;f++)if(d[f]){var c=d[f].listener;"function"===typeof c?c.call(this,h):c.handleEvent&&"function"===typeof c.handleEvent&&c.handleEvent(h)}}finally{if(g.level--,g.compact&&0===g.level){for(f=d.length-1;0<=f;f--)d[f]||d.splice(f,1);0===d.length&&delete this._eventTypes[k];g.compact=!1}}}},isListening:function(k){return!this._eventTypes?!1:void 0!==this._eventTypes[k]},removeEventListener:function(k,
h,g){if(this._eventTypes){var d=this._eventTypes[k];if(d){for(var f=d.listeners,e=0,c=f.length;e<c;e++){var b=f[e];if(b&&b.listener===h&&b.useCapture===g){0!==d.level?(f[e]=null,d.compact=!0):f.splice(e,1);break}}0===f.length&&delete this._eventTypes[k]}}}};return{EventTarget:k}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(k,l,h){function g(d){d=d||{};this._document=d.document||document}var d={};g.getTheme=function(f){f=f||"default";var e=d[f];e||(e=d[f]=new g);return e};g.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(d,e){var c=this,b=c._themeClass;c._themeClass=d;this._load(d,e,function(){c.onThemeChanged({type:"ThemeChanged",oldValue:b,newValue:c.getThemeClass()})})},onThemeChanged:function(d){return this.dispatchEvent(d)},
buildStyleSheet:function(d,e){function c(c,a,e){a&&(b.push("."+d+" ."+c+" {"),b.push("\t"+(e?"background-color":"color")+": "+a+";"),b.push("}"))}var b=[];b.push("");b.push("."+d+" {");e.fontFamily&&b.push("\tfont-family: "+e.fontFamily+";");e.fontSize&&b.push("\tfont-size: "+e.fontSize+";");e.fontSize&&b.push("\tcolor: "+e.text+";");b.push("}");b.push("."+d+".textview {");e.background&&b.push("\tbackground-color: "+e.background+";");b.push("}");c("ruler.annotations",e.annotationRuler,!0);c("ruler.lines",
e.annotationRuler,!0);c("ruler.folding",e.annotationRuler,!0);c("ruler.overview",e.overviewRuler,!0);c("rulerLines",e.lineNumber,!1);c("rulerLines.even",e.lineNumberEven,!1);c("rulerLines.odd",e.lineNumberOdd,!1);c("annotationLine.currentLine",e.currentLine,!0);c("entity-name-tag",e.keyword,!1);c("entity-other-attribute-name",e.attribute,!1);c("string-quoted",e.string,!1);c("meta.annotation.currentLine",e.currentLine,!0);c("keyword",e.keyword,!1);c("string",e.string,!1);c("comment",e.comment,!1);
c("comment.block.documentation",e.comment,!1);c("keyword.other.documentation.markup",e.comment,!1);return b.join("\n")},_createStyle:function(d,e,c,b){var n=this._document;d="orion-theme-"+d;var a=n.getElementById(d);if(a){if(b||a.firstChild.data===e)return;a.removeChild(a.firstChild);a.appendChild(n.createTextNode(e))}else b?(a=h.createElement(n,"link"),a.rel="stylesheet",a.type="text/css",a.href=e,a.addEventListener("load",function(){c()})):(a=h.createElement(n,"style"),a.appendChild(n.createTextNode(e))),
a.id=d,(n.getElementsByTagName("head")[0]||n.documentElement).appendChild(a);b||c()},_load:function(d,e,c){if(d)if("string"===typeof e)this._createStyle(d,e,c);else if(e=e.href,".css"!==e.substring(e.length-4)&&(e+=".css"),/^\//.test(e)||/[a-zA-Z0-9]+:\/\//i.test(e)||!k.toUrl)this._createStyle(d,e,c,!0);else{var b=this;k(["text!"+e],function(e){b._createStyle(d,e,c,!1)})}else c()}};l.EventTarget.addMixin(g.prototype);return{TextTheme:g}});
define("orion/widgets/themes/ThemeClass",[],function(){function k(k){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=k;this.classString="."+k+"{ "}k.prototype.className=null;k.prototype.classString=void 0;k.prototype.style=void 0;k.prototype.closeString=" }\n";k.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:k}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(k){function l(){}l.prototype.navbar="white";l.prototype.button="#777777";l.prototype.location="#EFEFEF";l.prototype.selection="#cedce7";l.prototype.sidepanel="#F7F7F7";l.prototype.mainpanel="white";l.prototype.navtext="#bfbfbf";l.prototype.content="#3087B3";l.prototype.search="#444";l.prototype.toolpanel="white";l.prototype.writeNavigationStyle=function(){var h="",g=[],d=new k.ThemeClass("orionPage");
d.style.backgroundColor="#fdfdfd";d.style.width="100%";d.style.height="100%";g.push(d);d=new k.ThemeClass("topRowBanner");d.style.margin="0";d.style.border="0";d.style.backgroundColor=this.navbar;d.style.height="16px";d.style.padding="10px";d.style.paddingLeft="6px";d.style.paddingRight="2px";d.style.borderBottom="none";d.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";d.style.zIndex="100";g.push(d);d=new k.ThemeClass("a");d.style.textDecoration="none";d.style.color=
this.content;g.push(d);d=new k.ThemeClass("navlink");d.style.display="inline-block";d.style.padding="2px";d.style.color=this.content;d.style.verticalAlign="bottom";g.push(d);d=new k.ThemeClass("primaryNav");d.style.color=this.navtext;d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.paddingTop="0";d.style.verticalAlign="baseline";g.push(d);d=new k.ThemeClass("primaryNav a");d.style.fontSize="8pt";d.style.color=this.navtext;d.style.marginRight="6px";d.style.marginLeft="6px";d.style.verticalAlign=
"baseline";d.style.textDecoration="none";g.push(d);d=new k.ThemeClass("primaryNav a:hover");d.style.color="#bfbfbf";d.style.cursor="hand";d.style.color="white";d.style.fontWeight="normal";g.push(d);for(var f in g)h+=g[f].toString();return h};l.prototype.writeLocationStyle=function(){var h="",g=[],d=new k.ThemeClass("titleArea");d.style.margin="0";d.style.paddingTop="5px";d.style.border="0";d.style.background=this.location;d.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";d.style.borderBottom="1px solid "+this.location;d.style.minHeight="20px";g.push(d);d=new k.ThemeClass("breadcrumb");d.style.fontSize="8pt";d.style.textDecoration="none";d.style.color="#f1f1f2;";d.style.paddingTop="2px";g.push(d);d=new k.ThemeClass("a.breadcrumb:hover");d.style.textDecoration="none";d.style.borderBottom="1px dotted";d.style.color="#F58B0F";d.style.cursor="pointer";g.push(d);d=new k.ThemeClass("breadcrumbSeparator");d.style.fontSize=
"8pt";d.style.textDecoration="none";d.style.color=this.separator;d.style.fontWeight="bold";g.push(d);d=new k.ThemeClass("currentLocation");d.style.fontWeight="bold";d.style.fontSize="8pt";d.style.color=this.breadcrumb;d.style.textDecoration="none";d.style.textWrap="normal";d.style.lineHeight="10pt";g.push(d);d=new k.ThemeClass("a.currentLocation:hover");d.style.fontWeight="bold";d.style.fontSize="10pt";d.style.color="#666666";d.style.textDecoration="none";d.style.borderBottom="0";g.push(d);d=new k.ThemeClass("navlinkonpage");
d.style.color=this.content;d.style.verticalAlign="middle";g.push(d);this.bannerProgress&&(d=new k.ThemeClass("topRowBanner .progressPane_running"),d.style.borderColor=this.bannerProgress,g.push(d));for(var f in g)h+=g[f].toString();return h};l.prototype.writeButtonStyle=function(){var h="",g=[],d=new k.ThemeClass("commandButton");d.style.color="#666";d.style.border="1px solid #dedede";d.style.backgroundColor="#ddd";d.style.textAlign="center";d.style.verticalAlign="middle";d.style.cursor="pointer";
d.style.display="inline-block";d.style.padding="4px 6px";d.style.borderRadius="3px";d.style.lineHeight="12px";d.style.fontSize="9pt";d.style.userSelect="none";g.push(d);d=new k.ThemeClass("commandButton:over");d.style.backgroundColor="#e6e6e6";d.style.border="1px solid #808080";g.push(d);d=new k.ThemeClass("commandMenu");d.style.color="#222";d.style.display="inline-block";d.style.verticalAlign="baseline";d.style.margin="0";d.style.fontSize="8pt";d.style.fontWeight="normal";d.style.border="1px solid #dedede";
d.style.backgroundColor="#efefef";d.style.cursor="pointer";d.style.borderRadius="1px";g.push(d);d=new k.ThemeClass("commandMenuItem");d.style.border="0";d.style.padding="0";d.style.margin="0";g.push(d);for(var f in g)h+=g[f].toString();return h};l.prototype.writeMainStyle=function(){var h="",g=[],d=new k.ThemeClass("searchbox");d.style.backgroundImage="url(../images/core_sprites.png)";d.style.backgroundRepeat="no-repeat";d.style.backgroundPosition="4px -297px";d.style.width="12px";d.style.height=
"12px";d.style.backgroundColor=this.search;d.style.border="1px solid "+this.search;d.style.fontSize="11px";d.style.width="15em";d.style.height="16px";d.style.borderRadius="10px";d.style.color="#999";d.style.padding="0";d.style.paddingLeft="20px";d.style.marginLeft="5px";d.style.marginTop="6px !important";d.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";g.push(d);d=new k.ThemeClass("searchbox:focus");d.style.color="white";d.style.outline=
"none";g.push(d);d=new k.ThemeClass("checkedRow");d.style.cssText="background-color:"+this.selection+" !important;";g.push(d);d=new k.ThemeClass("navbar-item-selected");d.style.background=this.selection;d.style.color=this.content;g.push(d);d=new k.ThemeClass("auxpane");d.style.border="0";d.style.background=this.sidepanel;g.push(d);d=new k.ThemeClass("mainpane");d.style.background=this.mainpanel;d.style.border=0;g.push(d);d=new k.ThemeClass("mainToolbar");d.style.background=this.toolpanel;g.push(d);
for(var f in g)h+=g[f].toString();return h};l.prototype.render=function(h){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};l.prototype.getSheet=function(h){h.navbar.value?(this.navbar=h.navbar.value,this.button=h.button.value,this.location=h.location.value,this.selection=h.selection.value,this.sidepanel=h.sidepanel.value,this.mainpanel=h.mainpanel.value,this.navtext=h.navtext.value,this.search=
h.search.value,this.content=h.content.value,this.toolpanel=h.toolpanel.value,this.bannerProgress=h.bannerProgress.value):(this.navbar=h.navbar,this.button=h.button,this.location=h.location,this.selection=h.selection,this.sidepanel=h.sidepanel,this.mainpanel=h.mainpanel,this.navtext=h.navtext,this.search=h.search,this.content=h.content,this.toolpanel=h.toolpanel,this.bannerProgress=h.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:l}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(k,l,h){function g(){}function d(){this.styles=[];var e=new g;e.name="Orion";e.navbar="white";e.button="#EFEFEF";e.location="#efefef";e.selection="FEC";e.sidepanel="#FBFBFB";e.mainpanel="white";e.toolpanel="white";e.navtext="#bfbfbf";e.content="#3087B3";e.search="#444";e.breadcrumb="#3087B3";e.separator="#333";e.bannerProgress="whitesmoke";
this.styles.push(e);e=new g;e.name="Orion2014";e.navbar="white";e.button="#EFEFEF";e.location="#EFEFEF";e.selection="FEC";e.sidepanel="#EEEEEE";e.mainpanel="#EEEEEE";e.toolpanel="#EEEEEE";e.navtext="#BFBFBF";e.content="#333333";e.search="#444444";e.breadcrumb="#333333";e.separator="#333333";e.bannerProgress="orange";this.styles.push(e);e=new g;e.name="Green Zone";e.navbar="seagreen";e.button="lavender";e.location="darkseagreen";e.selection="moccasin";e.sidepanel="aliceblue";e.mainpanel="white";e.toolpanel=
"white";e.navtext="#FBFBFB";e.content="darkgreen";e.search="darkgreen";e.breadcrumb="#3087B3";e.separator="seagreen";e.bannerProgress="#F2F2F2";this.styles.push(e);e=new g;e.name="Pretty In Pink";e.navbar="plum";e.button="lavender";e.location="pink";e.selection="lavender";e.sidepanel="seashell";e.mainpanel="white";e.toolpanel="white";e.navtext="#FBFBFB";e.content="mediumorchid";e.search="violet";e.breadcrumb="#3087B3";e.separator="plum";e.bannerProgress="#F2F2F2";this.styles.push(e);e=new g;e.name=
"Blue Monday";e.navbar="cornflowerblue";e.button="lavender";e.location="skyblue";e.selection="lavender";e.sidepanel="aliceblue";e.mainpanel="white";e.toolpanel="white";e.navtext="#FBFBFB";e.content="royalblue";e.search="royalblue";e.breadcrumb="#3087B3";e.separator="cornflowerblue";e.bannerProgress="#F2F2F2";this.styles.push(e);e=new g;e.name="Vanilla Skies";e.navbar="sandybrown";e.button="lemmonchiffon";e.location="cornsilk";e.selection="lemonchiffon";e.sidepanel="white";e.mainpanel="white";e.toolpanel=
"white";e.navtext="lemonchiffon";e.content="chocolate";e.search="moccasin";e.breadcrumb="#3087B3";e.separator="sandybrown";e.bannerProgress="#F2F2F2";this.styles.push(e);e=new g;e.name="Beetlejuice";e.navbar="indigo";e.button="slateblue";e.location="darkslateblue";e.selection="silver";e.sidepanel="lavender";e.mainpanel="white";e.toolpanel="white";e.navtext="#FBFBFB";e.content="mediumslateblue";e.search="#444";e.breadcrumb="#3087B3";e.separator="indigo";e.bannerProgress="#F2F2F2";this.styles.push(e);
e=new g;e.name="Red";e.navbar="#CD2127";e.button="#777777";e.location="#D85F56";e.selection="lightcoral";e.sidepanel="#EFDAB2";e.mainpanel="#FDFADD";e.toolpanel="#FDFADD";e.navtext="#FBFBFB";e.content="darkred";e.search="#D85F56";e.breadcrumb="darkred";e.separator="#CD2127";e.bannerProgress="#F2F2F2";this.styles.push(e)}function f(){return this.styles}g.prototype.name="Orion";g.prototype.navbar="#404648";g.prototype.button="#EFEFEF";g.prototype.location="#333";g.prototype.breadcrumb="#3087B3";g.prototype.separator=
"#333";g.prototype.selection="FEC";g.prototype.sidepanel="#FBFBFB";g.prototype.mainpanel="white";g.prototype.toolpanel="white";g.prototype.navtext="#bfbfbf";g.prototype.content="#3087B3";g.prototype.search="#444";g.prototype.bannerProgress="white";d.prototype.styles=[];d.prototype.getStyles=f;d.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};d.prototype.getViewData=function(){var e={top:10,left:10,
width:350,height:350};e.shapes=[{type:"RECTANGLE",name:k["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:k["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:k["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:k["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:k["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:k.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:k["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:k.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:k.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:k.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:k["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:k.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:k["Button Text"],label:"Button",x:158,y:90,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",
name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:k["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:k["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:k["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:k["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:k["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:k["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},
{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var c=0;3>c;c++)e.shapes.push({type:"TEXT",name:k.Content,label:"org.eclipse.orion.content",x:170,y:127+20*c,fill:"#3087B3",family:"content"});for(c=0;3>c;c++)e.shapes.push({type:"TEXT",name:k.Content,label:"Item",x:25,y:115+20*c,fill:"#3087B3",family:"content"});for(c=0;3>c;c++)e.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+20*c,x2:165,y2:124+20*c,x3:160,y3:127+20*c,family:"navbar",fill:"#333"});e.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return e};d.prototype.processSettings=function(e){var c=new h.ThemeSheetWriter;(new l.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",c.getSheet(e))};return{ThemeData:d,getStyles:f}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",Properties:"Properties",
" (Service Id: ":" (Service Id: ",Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(k){function l(h,g,d){this.elements=d;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===g?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),k.addAutoDismiss([this.container],this.destroy.bind(this))):h.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}l.prototype.elementNode=null;l.prototype.switchesContainer=null;l.prototype.switches=null;l.prototype.radioButtons=null;l.prototype.chosenSwitch=
null;l.prototype.addElement=function(h){var g=document.createElement("span");g.className="UAContainer-icon";g.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+h.image+'" id\x3d"'+h.label+'ImageNode" alt\x3d"'+h.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+h.label+'LabelNode" \x3e'+h.label+"\x3c/span\x3e\x3c/span\x3e";g.onmouseover=function(){document.getElementById(h.label+"ImageNode").src=h.secondaryImage;
document.getElementById(h.label+"LabelNode").className="UALabel-live";g.className="UAContainer-icon-live"};g.onmouseout=function(){document.getElementById(h.label+"ImageNode").src=h.image;document.getElementById(h.label+"LabelNode").className="UALabel";g.className="UAContainer-icon"};var d=this;g.onclick=function(){d.showMedia(h)};this.elementNode.appendChild(g)};l.prototype.clearElements=function(){this.elementNode.innerHTML=""};l.prototype.showMedia=function(h){this.clearElements();this.addElement(h);
var g=document.createElement("span");g.className="UAContainer-media";g.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+h.media+'" alt\x3d"'+h.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(g);setTimeout(function(){g.style.opacity=1},100);h=document.getElementById(h.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=h.parentNode;h.className="chosenCircle"};l.prototype.createSwitch=
function(h){var g;g=h?h.label+"switch":"indexSwitch";var d=document.createElement("span");d.className="workingSpan";d.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+g+'"\x3e\x3c/div\x3e';var f=this;d.onclick=h?function(){f.showMedia(h)}:function(){f.initialize();f.chosenSwitch.firstChild.className="circle";f.chosenSwitch=d;f.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(d);return this.radioButtons[this.radioButtons.length]=d};l.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};l.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return l});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(k,l,h,g){function d(){}var f=null;d.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var e=
document.body;this.$frameParent=e;this.$$modalExclusions=this.$$modalExclusions||[];var c=document.createRange();c.selectNode(e);c=c.createContextualFragment(this.CONTAINERTEMPLATE);e.appendChild(c);this.$frame=e.lastChild;this.title&&h.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=h.$("#closeDialog",this.$frame);var b=this;this.$close.addEventListener("click",function(c){b.hide()},!1);this.$parent=h.$(".dialogContent",this.$frame);c=document.createRange();c.selectNode(this.$parent);
e=c.createContextualFragment(this.TEMPLATE);this.messages&&h.processTextNodes(e,this.messages);this.$parent.appendChild(e);this.$buttonContainer=h.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(c){c.keyCode===h.KEY.ESCAPE?b.hide():c.keyCode===h.KEY.ENTER&&"function"===typeof b._defaultCallback&&b._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent);this.modal&&this._makeModal()},
_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var e=this;this.buttons.forEach(function(c){var b=g.createButton(c.text,c.callback);c.id&&(b.id=c.id,e["$"+b.id]=b);c.isDefault&&(e._defaultCallback=c.callback,e._defaultButton=b);e.$buttonContainer.appendChild(b)})}},_makeModal:function(e){var c=this;this.$frame.addEventListener("blur",function(a){c.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var b=!h.contains(c.$frame,a.target);if(b)for(var e=0;e<
c.$$modalExclusions.length;e++)if(h.contains(c.$$modalExclusions[e],a.target)){b=!1;break}b&&(window.setTimeout(function(){(c.$lastFocusedElement||c.$parent).focus()},0),h.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);e=this.$frameParent.childNodes;var b=!1;this._addedBackdrop=[];for(var d=0;d<e.length;d++){for(var a=0;a<this.$$modalExclusions.length;a++)if(h.contains(this.$$modalExclusions[a],e[d])){b=
!0;break}!b&&e[d]!==c.$frame&&e[d].classList&&!e[d].classList.contains("tooltipContainer")&&(a=e[d],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(e=h.lastTabbable(this.$buttonContainer)||h.lastTabbable(this.$parent))&&e.addEventListener("keydown",function(a){if(a.keyCode===h.KEY.TAB){var b=c._getFirstFocusField();b&&b!==a.target&&b.focus();h.stop(a)}},!1)},_addChildDialog:function(e){this.$$modalExclusions.push(e.$frame||e.$parent)},_inModalExclusion:function(e){return this.$$modalExclusions.some(function(c){return e.$frame===
c||e.$parent===c})},_bindElements:function(e){for(var c=0;c<e.childNodes.length;c++){var b=e.childNodes[c];b.id&&(this["$"+b.id]=b);this._bindElements(b)}},hide:function(e){!e&&f===this&&(f=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");h.setFramesEnabled(!0);"function"===
typeof this._afterHiding&&this._afterHiding();var c=this;this.keepAlive||window.setTimeout(function(){c.destroy()},0)},show:function(e){if(this.modal)if(f){if(!f._inModalExclusion(this)){this.hide(!0);return}}else f=this;"function"===typeof this._beforeShowing&&this._beforeShowing();h.setFramesEnabled(!1);var c=h.bounds(this.$frame),b=h.bounds(document.documentElement),d;e?(d=h.bounds(e),e=d.top+d.height+4,d=d.left+4,e+c.height>b.height&&(e=Math.max(0,b.height-c.height-4)),d+c.width>b.width&&(d=Math.max(0,
b.width-c.width-4))):(d=Math.max(0,(b.width-c.width)/2),e=Math.max(0,(b.height-c.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=e+"px";this.$frame.style.left=d+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return h.firstTabbable(this.$parent)||this._defaultButton||h.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(f===this&&(f=null),h.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(e){e.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0)}};d.prototype.constructor=d;return{Dialog:d}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(k,l,h,g,d,f,e){function c(b){this._displaySignOut=!0;this._init(b)}c.prototype={_init:function(b){this._dropdownNode=h.node(b.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=b.dropdown;this._serviceRegistry=b.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=b.noSeparator;this._dropDownItemClass=b.dropDownItemClass;this._keyAssistClass=b.keyAssistClass;void 0!==b.signOut&&(this._displaySignOut=b.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(b){var c=0,a;for(a in b)b.hasOwnProperty(a)&&c++;
return c},_makeMenuItem:function(b,c){var a=e.createMenuItem(b).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&a.classList.add(this._dropDownItemClass);a.addEventListener("click",c,!1);a.addEventListener("keydown",function(a){(a.keyCode===h.KEY.ENTER||a.keyCode===h.KEY.SPACE)&&c()},!1);return a},_renderAuthenticatedService:function(b,c){var a=this,e=this.authenticatedServices[b].authService;if(e&&e.logout&&this._displaySignOut){var d=this._makeMenuItem(k["Sign Out"],
function(){e.logout().then(function(){a.addUserItem(b,e,a.authenticatedServices[b].label);localStorage.removeItem(b);localStorage.removeItem("lastLogin");for(var c=localStorage.length-1;0<=c;c--){var d=localStorage.key(c);d&&0===d.indexOf("/orion/preferences/user")&&localStorage.removeItem(d)}e.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(d.parentNode)}},renderServices:function(){function b(b){a[b]||(a[b]=c.createDocumentFragment());return a[b]}
var c=document,a=[],d=this._serviceRegistry;g.getPageLinksInfo(d,"orion.page.link.user").then(function(f){this._dropdown?this._dropdown.empty():this._dropdownNode&&h.empty(this._dropdownNode);f.getAllLinks().forEach(function(a){var e,d;if(a.category&&(d=/user\.(\d+)/.exec(a.category)))e=parseInt(d[1],10);if("number"!==typeof e||isNaN(e))e=1;e=b(e);d=c.createElement("li");var m=c.createElement("a");m.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&m.classList.add(this._dropDownItemClass):
m.classList.add("dropdownMenuItem");m.href=a.href;m.textContent=a.textContent;d.appendChild(m);e.appendChild(d);m.addEventListener("keydown",function(a){(a.keyCode===h.KEY.ENTER||a.keyCode===h.KEY.SPACE)&&m.click()},!1)}.bind(this));this.keyAssistFunction&&(f=this._makeMenuItem(k["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&f.classList.add(this._keyAssistClass):f.classList.add("key-assist-menuitem"),f=f.parentNode,b(0).appendChild(f));
if(f=d.getServiceReferences("orion.page.getstarted")[0])f=f.getProperty("data"),f=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,f)).parentNode,b(0).appendChild(f);var g=this;a.sort(function(a,b){return a-b}).forEach(function(b,c){if(c<a.length-1&&!this._noSeparator){var d=e.createSeparator();b.appendChild(d)}g._dropdownNode.appendChild(b)}.bind(this));if(this.isSingleService())for(var p in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(p)&&this._renderAuthenticatedService(p,
0)}.bind(this))},getStartedDialog:function(b){new d(null,!0,b)},setKeyAssist:function(b){this.keyAssistFunction=b;this.renderServices()},addUserItem:function(b,c,a,e){e?(this.unauthenticatedServices[b]&&delete this.unauthenticatedServices[b],this.authenticatedServices[b]={authService:c,label:a,data:e}):(this.authenticatedServices[b]&&delete this.authenticatedServices[b],this.unauthenticatedServices[b]=this.unauthenticatedServices[b]?{authService:c,label:a,pending:this.unauthenticatedServices[b].pending}:
{authService:c,label:a});this.renderServices()}};c.prototype.constructor=c;return{UserMenu:c}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(k,l,h,g,d,f){function e(b,c,a){var e="";a&&(e="^");if(e=h.parse("/"+e+b.searchStr+"/"))a=e.pattern,e=e.flags,-1===e.indexOf("i")&&!c.caseSensitive&&(e+="i"),b.regExp={pattern:a,flags:e},b.wildCard=!0}var c={ALL_FILE_TYPE:"*.*",doSearch:function(b,e,a,d){if(b){var f=!0;"*"===a&&(a="");""===a&&(f=d&&d.type!==c.ALL_FILE_TYPE);f&&(""!==a&&c.addRecentSearch(e,
a,d?d.regEx:!1),b=b.createSearchParams(a,!1,!1,d),b=c.generateSearchHref(b),window.location=b)}else window.alert(k["Can't search: no search service is available"])},generateSearchHelper:function(b,d){var a=b.keyword,m=a,f={};b.fileType&&b.fileType!==c.ALL_FILE_TYPE&&""===a&&(m="*."+b.fileType);if(b.regEx)f.searchStr=a,e(f,b,d);else{var g=-1<a.indexOf("*"),p=-1<a.indexOf("?");g&&(a=a.split("*").join(".*"));p&&(a=a.split("?").join("."));!g&&!p&&!b.nameSearch?(f.searchStr=b.caseSensitive?a.split("\\").join(""):
a.split("\\").join("").toLowerCase(),f.wildCard=!1):(f.searchStr=b.caseSensitive?a:a.toLowerCase(),e(f,b,d),f.wildCard=!0)}f.searchStrLength=f.searchStr.length;return{params:b,inFileQuery:f,displayedSearchTerm:m}},convertSearchParams:function(b){void 0!==b.rows&&(b.rows=parseInt(b.rows,10));void 0!==b.start&&(b.start=parseInt(b.start,10));"string"===typeof b.regEx&&(b.regEx="true"===b.regEx.toLowerCase());"string"===typeof b.caseSensitive&&(b.caseSensitive="true"===b.caseSensitive.toLowerCase());
"string"===typeof b.nameSearch&&(b.nameSearch="true"===b.nameSearch.toLowerCase())},copySearchParams:function(b,c){var a={},e;for(e in b)if(void 0!==b[e]&&null!==b[e]&&(c||"replace"!==e))a[e]=b[e];return a},generateSearchHref:function(b){var e=l.toUrl("search/search.html");b=c.copySearchParams(b,!0);var a=b.resource;b.resource=void 0;return"undefined"!==typeof b.keyword?(new f(e+"#{,resource,params*}")).expand({resource:a,params:b}):(new f(e+"#{,resource}")).expand({resource:a})},generateFindURLBinding:function(b,
c,a,e,d){b={find:c.searchStr,regEx:c.wildCard?!0:void 0,caseSensitive:b.caseSensitive?!0:void 0,replaceWith:"string"===typeof e?e:void 0,atLine:"number"===typeof a?a:void 0};return d?b:","+(new f("{,params*}")).expand({params:b})},convertFindURLBinding:function(b){"string"===typeof b.regEx&&(b.regEx="true"===b.regEx.toLowerCase());"string"===typeof b.caseSensitive&&(b.caseSensitive="true"===b.caseSensitive.toLowerCase());"string"===typeof b.atLine&&(b.atLine=parseInt(b.atLine,10))},replaceRegEx:function(b,
c,a){return b.replace(RegExp(c.pattern,c.flags),a)},replaceStringLiteral:function(b,e,a){e=h.parse("/"+e+"/gim");return c.replaceRegEx(b,e,a)},searchOnelineLiteral:function(b,c,a){var e;e=0;for(var d=!1,f=[];!(e=c.indexOf(b.searchStr,e),0>e);){f.push({startIndex:e,length:b.searchStrLength});d=!0;if(a)break;e+=b.searchStrLength}return d?f:null},findRegExp:function(b,c,a,e){if(!c)return null;a=a||"";a+=(-1===a.indexOf("g")?"g":"")+(-1===a.indexOf("m")?"m":"");var d=null;return(d=RegExp(c,a).exec(b.substring(e)))&&
{startIndex:d.index+e,length:d[0].length}},searchOnelineRegEx:function(b,e,a){for(var d=0,f=!1,g=[];;)if(d=c.findRegExp(e,b.regExp.pattern,b.regExp.flags,d)){g.push(d);f=!0;if(a)break;d=d.startIndex+d.length}else break;return f?g:null},generateNewContents:function(b,e,a,d,f,g){if(d&&e){b||(a.contents=[]);for(var p=0;p<e.length;p++){for(var h=e[p],k=!1,l=!1,v=[],x,y=0,A=0;A<d.children.length;A++)if(d.children[A].lineNumber-1===p){y=A;for(k=0;k<d.children[A].matches.length;k++)!1!==d.children[A+k].checked&&
v.push(k);l=0<v.length;x=d.children[A].matches;k=!0;break}if(k){if(l){v=c.replaceCheckedMatches(h,f,x,v,g);h=v.replacedStr;for(k=0;k<d.children[y].matches.length;k++)d.children[y+k].newMatches=v.newMatches}else for(k=0;k<d.children[y].matches.length;k++)d.children[y+k].newMatches=d.children[y+k].matches;b?a.contents[p]=h:a.contents.push(h)}else b||a.contents.push(h)}}},generateMatchContext:function(b,c,a){var e=[],d=2*b+1,f;c.length<=d?(f=0,b=c.length-1):(f=a-b,0>f?(f=0,b=f+d-1):(b=a+b,b>c.length-
1&&(b=c.length-1,f=b-d+1)));for(d=f;d<=b;d++)e.push({context:c[d],current:d===a});return e},splitFile:function(b){for(var c=0,a=0,e=0,d=0,f=[];;){-1!==c&&c<=e&&(c=b.indexOf("\r",e));-1!==a&&a<=e&&(a=b.indexOf("\n",e));if(-1===a&&-1===c){f.push(b.substring(d));break}var g=1;-1!==c&&-1!==a?c+1===a?(g=2,e=a+1):e=(c<a?c:a)+1:e=-1!==c?c+1:a+1;f.push(b.substring(d,e-g));d=e}return f},searchWithinFile:function(b,e,a,d,f,g){a=c.splitFile(a);f&&(e.contents=a);if(e){e.children=[];for(var p=d=0;p<a.length;p++){var k=
a[p];if(k&&0<k.length){var h=g?k:k.toLowerCase();if(h=b.wildCard?c.searchOnelineRegEx(b,h):c.searchOnelineLiteral(b,h)){var l,v=p+1;if(f)for(var x=0;x<h.length;x++)l=x+1,l={parent:e,checked:e.checked,type:"detail",matches:h,lineNumber:v,matchNumber:l,name:k,location:e.location+"-"+v+"-"+l},e.children.push(l);else l={parent:e,context:c.generateMatchContext(2,a,p),checked:e.checked,type:"detail",matches:h,lineNumber:v,name:k,location:e.location+"-"+v},e.children.push(l);d+=h.length}}}e.totalMatches=
d}},replaceCheckedMatches:function(b,c,a,e,d){for(var f=0,g="",k=[],h=0;h<a.length;h++){f!==a[h].startIndex&&(g+=b.substring(f,a[h].startIndex));a[h].length&&(d=a[h].length);for(var f=!1,l=0;l<e.length;l++)if(e[l]===h){f=!0;break}f?(k.push({startIndex:g.length,length:c.length}),g+=c):(k.push({startIndex:g.length,length:d}),g+=b.substring(a[h].startIndex,a[h].startIndex+d));f=a[h].startIndex+d}f<b.length&&(g+=b.substring(f));return{replacedStr:g,newMatches:k}},fullPathNameByMeta:function(b){var c=
b.length,a="";if(0<c)for(c-=1;-1<c;c--)a=a+(""===a?"":"/")+b[c].Name;return a},path2FolderName:function(b,c,a){return b.substring(0,b.length-c.length-(a?0:1))},_storeRecentSearch:function(b,c,a,e){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b.put("recentSearch",c);a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:e})}.bind(this),20)})},addRecentSearch:function(b,e,a){"string"===typeof e&&e&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f;
d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d){for(f in d)if(d[f].name===e)return;20<=d.length&&d.splice(19,d.length-20+1)}else d=[];d.splice(0,0,{name:e,regEx:a});c._storeRecentSearch(b,d)})},removeRecentSearch:function(b,e,a){"string"===typeof e&&e&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f;d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d)for(f in d)if(d[f].name===e){d.splice(f,1);c._storeRecentSearch(b,
d,a,!0);break}})},getSearches:function(b,c,a){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get(c);"string"===typeof b&&(b=JSON.parse(b));b&&a&&a(b)})},getMixedSearches:function(b,e,a,d){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var f=b.get("recentSearch");"string"===typeof f&&(f=JSON.parse(f));e&&(b=b.get("search"),"string"===typeof b&&(b=JSON.parse(b)),b&&b.forEach(function(b){if(a){var e=c.parseQueryStr(b.query);
f.some(function(a){return e.searchStrTitle===a.name})||f.push({name:e.searchStrTitle,label:b.name})}else f.push({name:null,label:b.name,value:b.query})}));f&&d&&d(f)})},getOpenSearchPref:function(b,c){b.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");c(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(b,c){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",
{openInNewTab:c})})}};return c});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(k,l,h,g,d,f){function e(c,b,e,a){this.registry=c;this.fileClient=b;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=e;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:g.generateSearchHelper(e);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._reportOnCancel=a&&a.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}e.prototype.search=function(c){var b=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=c;this._cancelled=!1;this._deferredArray=[];b.getContentTypes().then(function(b){this.contentTypesCache=b;var a=this;this._visitRecursively(this._childrenLocation).then(function(){(!a._cancelled||a._reportOnCancel)&&a._reportResult();a._cancelled&&a._HandleStatus({name:"Cancel"})}.bind(a),function(b){a._reportResult();a._HandleStatus(b)}.bind(a))}.bind(this))};e.prototype.searchName=function(c,b){c&&(this._searchParams=
c,this.searchHelper=g.generateSearchHelper(c,!0));b&&(this.onSearchNameComplete=b);var e=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var a=0;a<this.fileSkeleton.length;a++){var d=this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,d,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,d,!0))if(e.push(this.fileSkeleton[a]),e.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:e.length,
docs:e}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};e.prototype.buildSkeleton=function(c,b){this._buildingSkeleton=!0;var e=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var a=this;c();e.getContentTypes().then(function(c){a.contentTypesCache=c;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;b();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};e.prototype._sort=function(c){c.sort(function(b,
c){var a,e;if("Path asc"===this._searchParams.sort){a=b.Location&&b.Location.toLowerCase();a=g.path2FolderName(a,b.Name&&b.Name.toLowerCase(),!0);e=c.Location&&c.Location.toLowerCase();e=g.path2FolderName(e,c.Name&&c.Name.toLowerCase(),!0);if(a<e)return-1;if(a>e)return 1}return this._sortOnNameSingle(b,c)}.bind(this))};e.prototype._HandleStatus=function(c){this._statusService&&"Cancel"===c.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:k["Search cancelled by user"],
Severity:"Warning"}))};e.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};e.prototype._sortOnNameSingle=function(c,b){var e=c.Name&&c.Name.toLowerCase(),a=b.Name&&b.Name.toLowerCase();return e<a?-1:e>a?1:0};e.prototype._onFileType=function(c){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===g.ALL_FILE_TYPE?!0:0<=c.extension.indexOf(this.searchHelper.params.fileType):
!0};e.prototype._visitRecursively=function(c){var b=[],e=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(c);return(e._progressService?this._progressService.progress(e.fileClient.fetchChildren(c),"Crawling search for children of "+c):e.fileClient.fetchChildren(c)).then(function(a){for(var c=0;c<a.length;c++)if(void 0!==a[c].Directory&&!1===a[c].Directory)if(e._searchOnName)b.push(e._buildSingleSkeleton(a[c]));else if(e._buildSkeletonOnly)b.push(e._buildSingleSkeleton(a[c]));else{if(!e._cancelled){var g=
d.getFilenameContentType(a[c].Name,e.contentTypesCache);if(g&&("text/plain"===g["extends"]||"text/plain"===g.id)&&e._onFileType(g))g=e._sniffSearch(a[c]),b.push(g),e._deferredArray.push(g)}}else if(a[c].Location)if(e._cancelled)break;else g=e._visitRecursively(a[c].ChildrenLocation),b.push(g),e._deferredArray.push(g);return f.all(b)})};e.prototype._hitOnceWithinFile=function(c){c=this._searchParams.caseSensitive?c:c.toLowerCase();return this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,
c,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,c,!0)};e.prototype._reportSingleHit=function(c){this._cancelled||(c.LastModified=c.LocalTimeStamp,this.fileLocations.push(c),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};e.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(c){c.cancel()})};e.prototype._sniffSearch=function(c){this._totalCounter++;
var b=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(c),this._statusService&&this._statusService.setProgressResult({Message:h.formatMessage(k["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(b._progressService?b._progressService.progress(b.fileClient.read(c.Location),"Reading file "+c.Location):b.fileClient.read(c.Location)).then(function(e){b._hitOnceWithinFile(e)&&b._reportSingleHit(c);b._statusService&&b._statusService.setProgressResult({Message:h.formatMessage(k["${0} files found out of ${1}"],
b._hitCounter,b._totalCounter)},k.Cancel)},function(b){b&&b.message&&"cancel"!==b.message.toLowerCase()&&console.error("Error loading file content: "+b.message)})};e.prototype._buildSingleSkeleton=function(c){this._totalCounter++;this.fileSkeleton.push(c);this.searchHelper&&!this._buildSkeletonOnly&&0===this._totalCounter%100&&this.searchName();c=new f;c.resolve(this._totalCounter);return c};e.prototype.constructor=e;return{SearchCrawler:e}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(k,l,h,g,d,f,e){function c(b){this._init(b)}c.prototype=new e.Dialog;c.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+
g.toUrl("../../../images/progress_running.gif")+'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';c.prototype._init=function(b){this.title=b.title||k["Find File Named"];this.modal=!0;this.messages=k;this._searcher=b.searcher;this._progress=b.progress;this._onHide=b.onHide;this._contentTypeService=
new h.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=b.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=b.initialText;this._message=b.message;this._nameSearch=!0;void 0!==b.nameSearch&&(this._nameSearch=b.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(k["Missing required argument: fileService"]);
this._searchRenderer=b.searchRenderer;if(!this._searchRenderer||"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(k["Missing required argument: searchRenderer"]);this._initialize()};c.prototype._bindToDom=function(b){var c=this;c.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",k["FileName FolderName"]):this.$fileName.setAttribute("placeholder",k.Search);this.$fileName.addEventListener("input",function(a){c._time=+new Date;c._timeoutId&&
clearTimeout(c._timeoutId);c._timeoutId=setTimeout(c.checkSearch.bind(c),0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===d.KEY.ENTER){var b=d.$("a",c.$results);b&&(d.stop(a),(f.isMac?a.metaKey:a.ctrlKey)?window.open(b.href):(window.location.href=b.href,c.hide()))}},!1);b.addEventListener("keydown",function(a){var b,e,f;if(a.keyCode===d.KEY.DOWN||a.keyCode===d.KEY.UP)b=d.$$array("a",c.$results),e=document.activeElement,f=b.indexOf(e),a.keyCode===d.KEY.DOWN?0<=f?(e.classList.remove("treeIterationCursor"),
b=f<b.length-1?b[f+1]:b[0],b.focus(),b.classList.add("treeIterationCursor")):0<b.length&&(b=b[0],b.focus(),b.classList.add("treeIterationCursor")):0<=f?(e.classList.remove("treeIterationCursor"),e=c.$fileName,b=0<f?b[f-1]:e,b.focus(),0<f&&b.classList.add("treeIterationCursor")):0<b.length&&(b[b.length-1].focus(),b[b.length-1].classList.add("treeIterationCursor")),d.stop(a)});b.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(c._forceUseCrawler||!c._fileService.getService(c._searcher.getSearchLocation()).search){var a=
c._searchOnRoot?c._searcher.getSearchRootLocation():c._searcher.getChildrenLocation(),a=new l.SearchCrawler(c._searcher.registry,c._fileService,"",{searchOnName:!0,location:a});c._searcher.setCrawler(a);a.buildSkeleton(function(){c.$crawlingProgress.style.display="inline";c.$progress.appendChild(document.createTextNode(k["Building file skeleton..."]))},function(){c.$crawlingProgress.style.display="none";c.$progress.removeChild(c.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};c.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var b=(new Date).getTime();b-this._time>this._searchDelay?(this._time=b,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};c.prototype._detectFolderKeyword=function(b){var c,a=b,e=null;if(this._nameSearch&&(c=/(\S+)\s*(.*)/,(b=c.exec(b))&&3===b.length))b[1]&&
(a=b[1]),b[2]&&(e=b[2]);return{keyword:a,folderKeyword:e}};c.prototype.doSearch=function(){var b=this.$fileName.value;if(b){var c=this._detectFolderKeyword(b),a=this._searcher.createSearchParams(c.keyword,this._nameSearch,this._searchOnRoot),e=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=e;var g=document.createElement("div");g.appendChild(document.createTextNode(this._nameSearch?k["Searching..."]:f.formatMessage(k["Searching for occurrences of"],
b)));d.empty(this.$results);this.$results.appendChild(g);this._searcher.search(a,c.folderKeyword,function(){e===this.currentSearch&&e.apply(null,arguments)}.bind(this))}};c.prototype.decorateResult=function(b){function c(b){0===b.button&&!b.ctrlKey&&!b.metaKey&&a.hide()}var a=this;b=d.$$array("a",b);for(var e=0;e<b.length;e++)b[e].addEventListener("click",c,!1)};c.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};c.prototype._afterHiding=function(){this._onHide&&this._onHide()};c.prototype.constructor=
c;return{OpenResourceDialog:c}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(k,l){function h(g,d,f){if(g=l.node(g))this._parent=g;else throw Error("Parent node of dropdown menu not found");this.options=f=f||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=f.selectionClass;g=document.createElement("div");g.classList.add("dropdownMenu");g.classList.add("dropdownMenuOpen");g.id=this.navDropDownId;g.style.display="none";this._parent.appendChild(g);this._dropdownMenu=
g;if(d=l.node(d))this._triggerNode=d;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");f.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(e){e.keyCode===l.KEY.ESCAPE&&this.clearPanel()}.bind(this))}k.mixin(h.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){l.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=l.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",l.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(g){this._dropdownMenu.innerHTML=g},getContentNode:function(){return this._dropdownMenu},updateContent:function(g,d){d()},_positionDropdown:function(){this._dropdownMenu.style.right="";var g=l.bounds(this._dropdownMenu),d=l.bounds(document.body);g.left+g.width>d.left+d.width&&(g=l.bounds(this._boundingNode(this._triggerNode)),d=l.bounds(this._triggerNode),this._dropdownMenu.style.right=g.width-(d.left-g.left+d.width)+"px")},_boundingNode:function(g){var d=window.getComputedStyle(g,
null);return null===d||"absolute"===d.getPropertyValue("position")||!g.parentNode||g===document.body?g:this._boundingNode(g.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(l.setFramesEnabled(!0),l.empty(this._parent),this._parent=this.select=null)}});return h});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(k,l,h){function g(e,c,b){if(!e[c])throw c+k[" is not supported in this file system"];return e[c].apply(e,b)}function d(e,c,b,f){if(!e.readBlob)throw k["source file service does not support binary read"];if(!b.writeBlob)throw k["target file service does not support binary write"];if("/"!==c[c.length-1])return g(e,"readBlob",[c]).then(function(a){return g(b,"writeBlob",[f,a])});var a=f.substring(0,
f.length-1),m=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return g(b,"createFolder",[a,m]).then(function(){},function(){}).then(function(){return g(e,"fetchChildren",[c]).then(function(a){for(var c=[],m=0;m<a.length;++m){var g=a[m].Location,h=g;a[m].Directory&&(h=g.substring(0,g.length-1));h=decodeURIComponent(h.substring(h.lastIndexOf("/")+1));h=f+encodeURIComponent(h);a[m].Directory&&(h+="/");c[m]=d(e,g,b,h)}return l.all(c)})})}function f(e,c){function b(a){var b=
new l;b.reject(k["No Matching FileService for location:"]+a);return b}var d=e.getServiceReferences("orion.core.file"),a=d;if(c)for(var a=[],f=0;f<d.length;++f)c(d[f])&&a.push(d[f]);for(var g=[],t=[],p=[],r=[],u={fetchChildren:function(){var a=new l;a.resolve(r);return a},createWorkspace:function(){var a=new l;a.reject(k["no file service"]);return a},loadWorkspaces:function(){var a=new l;a.reject(k["no file service"]);return a},loadWorkspace:function(a){var b=new l;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:k["File Servers"],Location:"/",Children:r,ChildrenLocation:"/"})},100);return b},search:b,createProject:b,createFolder:b,createFile:b,deleteFile:b,moveFile:b,copyFile:b,read:b,write:b},d=0;d<a.length;++d)r[d]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[d].getProperty("top"),ChildrenLocation:a[d].getProperty("top"),Name:a[d].getProperty("Name")},f=a[d].getProperty("pattern")||a[d].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==f[0]&&(f=
"^"+f),g[d]=RegExp(f),t[d]=e.getService(a[d]),p[d]=a[d].getProperty("Name"),a[d].getProperty("NameKey")&&a[d].getProperty("nls")&&h.getMessageBundle(a[d].getProperty("nls")).then(function(b,c){r[b].Name=c[a[b].getProperty("NameKey")];p[b]=c[a[b].getProperty("NameKey")]}.bind(this,d));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return t[0]?0:-1;for(var b=0;b<g.length;++b)if(g[b].test(a))return b;throw k["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?u:t[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?u.Name:p[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?u.Location:r[a].Location}}f.prototype={getService:function(e){return this._getService(e)},fileServiceName:function(e){return this._getServiceName(e)},fileServiceRootURL:function(e){return this._getServiceRootURL(e)},fetchChildren:function(e){return g(this._getService(e),"fetchChildren",
arguments)},createWorkspace:function(e){return g(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return g(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(e){return g(this._getService(e),"loadWorkspace",arguments)},createProject:function(e,c,b,d){return g(this._getService(e),"createProject",arguments)},createFolder:function(e,c){return g(this._getService(e),"createFolder",arguments)},createFile:function(e,c){return g(this._getService(e),"createFile",
arguments)},deleteFile:function(e){return g(this._getService(e),"deleteFile",arguments)},moveFile:function(e,c,b){var f=this._getService(e),a=this._getService(c);if(f===a)return g(f,"moveFile",arguments);var m="/"===e[e.length-1],s=c;"/"!==s[s.length-1]&&(s+="/");if(b)s+=encodeURIComponent(b);else{var h=e;m&&(h=h.substring(0,h.length-1));s+=h.substring(h.lastIndexOf("/")+1)}m&&"/"!==s[s.length-1]&&(s+="/");return d(f,e,a,s).then(function(){return g(f,"deleteFile",[e])})},copyFile:function(e,c,b){var f=
this._getService(e),a=this._getService(c);if(f===a)return g(f,"copyFile",arguments);var m="/"===e[e.length-1],s=c;"/"!==s[s.length-1]&&(s+="/");if(b)s+=encodeURIComponent(b);else{var h=e;m&&(h=h.substring(0,h.length-1));s+=h.substring(h.lastIndexOf("/")+1)}m&&"/"!==s[s.length-1]&&(s+="/");return d(f,e,a,s)},read:function(e,c){return g(this._getService(e),"read",arguments)},readBlob:function(e){return g(this._getService(e),"readBlob",arguments)},write:function(e,c,b){return g(this._getService(e),"write",
arguments)},remoteImport:function(e,c){return g(this._getService(e),"remoteImport",arguments)},remoteExport:function(e,c){return g(this._getService(e),"remoteExport",arguments)},search:function(e){return g(this._getService(e.resource),"search",arguments)}};f.prototype.constructor=f;return{FileClient:f}});
define("orion/webui/SideMenu","orion/commands orion/objects orion/webui/littlelib orion/PageLinks orion/PageUtil orion/URITemplate orion/URL-shim orion/util".split(" "),function(k,l,h,g,d,f,e,c){function b(a,b){this.parentNode=h.node(a);this.contentNode=h.node(b);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);h.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function n(a){return!a.isRelatedLink}function a(a,b){var c=a.order,e=b.order;return c<e?-1:e<c?1:0}function m(a,b){var c=a.source.order,e=b.source.order,c="number"===typeof c?c:100,e="number"===typeof e?e:100;return c===e?a.textContent.localeCompare(b.textContent):
c<e?-1:1}var s=c.isTouch;l.mixin(b.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(a,b,c){var e=this.anchor;a=this.createListItem(a,b);c&&a.classList.add("sideMenuItemActive");e.appendChild(a);this.menuitems[b]=a},setSideMenu:function(){var a=this.getDisplayState(),b=this.parentNode;b&&(a===this.CLOSED_STATE&&(this.setPageContentLeft("0"),this._timeout&&(window.clearTimeout(this._timeout),
this._timeout=null),this._timeout=window.setTimeout(function(){b.style.display="none"},this.TRANSITION_DURATION_MS),b.classList.add("animating")),a===this.OPEN_STATE&&(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),b.classList.remove("animating"),b.style.display="block",b.style.width=this.SIDE_MENU_OPEN_WIDTH,this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)))},setPageContentLeft:function(a){var b=this.contentNode;b&&(b.style.left=a)},toggleSideMenu:function(){var a=this.getDisplayState(),
b=this.contentNode;b&&b.classList.add("content-fixedHeight-animation");a=a===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;a===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,a);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];h.empty(this.anchor)},getMenuItems:function(){var a=this.menuitems;return Object.keys(a).map(function(b){return a[b]})},getMenuItem:function(a){return this.menuitems[a]},getDisplayState:function(){var a=
localStorage.getItem(this.LOCAL_STORAGE_NAME);a||(a=this.DEFAULT_STATE);return a},createListItem:function(a,b){var c=document.createElement("li");c.className=a;c.classList.add("sideMenuItem");c.categoryId=b;return c},setCategories:function(a){this.categories=a;this.links=Object.create(null)},setPageLinks:function(a){this.pageLinks=a;var b=this,c=a.createLinkElements();a.getAllLinks().forEach(function(a,e){var d=c[e];d.source=a;b._getLinksBin(a.category).push(d)});this._renderLinks()},setRelatedLinks:function(a,
b){this.relatedLinks=a;var c=this;Object.keys(this.links).forEach(function(a){var b=c._getLinksBin(a);c.links[a]=b.filter(n)});var e=document.createDocumentFragment();a.forEach(function(a){var b=a.relatedLink,d=c._getLinksBin(b.category);a=k.createCommandMenuItem(e,a.command,a.invocation);a.classList.remove("dropdownMenuItem");a.isRelatedLink=!0;a.source=b;d.push(a)});this._renderLinks(b)},_getLinksBin:function(a){if(a){var b=this.links;b[a]=b[a]||[];return b[a]}return[]},_sort:function(){var a=this.links;
Object.keys(a).forEach(function(b){a[b].sort(m)})},_renderCategories:function(){var b=this.categories,c=this,e=new URL(window.location.href),m=d.matchResourceParameters();m.OrionHome=g.getOrionHome();var n=!1;this.clearMenuItems();b.getCategoryIDs().map(function(a){return b.getCategory(a)}).sort(a).forEach(function(a){var b=c._getLinksBin(a.id);b.length&&(n?c.addMenuItem(a.imageClass,a.id,!1):(b=b.some(function(a){if(!a.source.uriTemplate)return!1;a=new f(a.source.uriTemplate);a=new URL(a.expand(m),
window.location);return a.protocol===e.protocol&&a.host===e.host&&a.hostname===e.hostname&&a.port===e.port&&a.pathname===e.pathname&&a.search===e.search?n=!0:!1}),c.addMenuItem(a.imageClass,a.id,b)))})},_renderLinks:function(a){a=a||[];this._sort();this._renderCategories();var b=this,c=window.location.href;Object.keys(this.menuitems).forEach(function(e){var d=b.getMenuItem(e);if(d){for(var f=b._getLinksBin(e).slice(),f=f.filter(function(b){var e=b.source;return 0<=a.indexOf(e.id)||!e.default&&!e.force&&
b.href===c?!1:!0}),f=f.filter(function(a){a=a.source;return!(1<f.length&&a.default&&!a.force)}),m=f.length-1;0<m;m--)f[m].href===f[m-1].href&&f.splice(m,1);if(f.length){d.appendChild(b._createCategoryElement(e,d,f[0]));var g=document.createElement("ul");g.className="sideMenuSubMenu";f.forEach(function(a){var b=document.createElement("li");b.className="sideMenuSubMenuItem";var c=document.createElement("a");c.href=a;c.className="sideMenuSubMenuItemLink";var e=document.createElement("span");e.innerHTML=
a.innerHTML;e.className="sideMenuSubMenuItemSpan";c.appendChild(e);b.appendChild(c);g.appendChild(b)});d.appendChild(g)}}})},_createCategoryElement:function(a,b,c){a=this.categories.getCategory(a);var e;s?(e=document.createElement("button"),e.type="button"):(e=document.createElement("a"),e.href=c.href);e.className+=a.imageClass;e.classList.add("submenu-trigger");e.tabIndex="0";b.classList.remove(a.imageClass);return e},_handleEvent:function(a){var b=a.target;a="focus"===a.type;if("A"!==b.tagName||
a)b.classList.contains("submenu-trigger")&&(s||a)&&this._expandMenu(h.$(".sideMenuSubMenu",b.parentNode))},_expandMenu:function(a){this.getMenuItems().forEach(function(b){b=h.$(".sideMenuSubMenu",b);a!==b&&b.classList.remove("expanded")});a&&a.classList.toggle("expanded")}});return b});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(k,
l,h,g,d,f,e,c,b,n,a,m,s,t,p,r,u,w,v,x,y,A,q,B,z,C,L,G,E,I,D,H,Q,S,K){function J(a,b){if(a.getLabel)return a.getLabel();var c=new q;c.resolve(b.properties.name);return c}function M(a){s.node("progressPane").setAttribute("aria-label",k["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function U(a,b){var c=a.getServiceReferences("orion.core.auth");ba=[];var e=X.createMenuGenerator.apply(this,arguments);if(e)for(var d=0;d<
c.length;d++){var q=c[d],f=a.getService(q);J(f,q).then(function(a){f.getKey().then(function(b){ba.push(b);f.getUser().then(function(c){e.addUserItem(b,f,a,c)},function(c,d){e.addUserItem(b,f,a,d)});window.addEventListener("storage",function(c){O[b]!==localStorage.getItem(b)&&(O[b]=localStorage.getItem(b),f.getUser().then(function(c){e.addUserItem(b,f,a,c)},function(c){e.addUserItem(b,f,a)}))},!1)})})}}function V(a){return a}function T(a,c,d,f,m){function z(){if(h)return h;var b=a.getService("orion.core.contentTypeRegistry");
b||(b=new u.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return h=a})}function g(a){for(var b={},c=a.getPropertyKeys(),e,d=0;d<c.length;d++)e=c[d],b[e]=a.getProperty(e);return b}function n(a,b){var c=null;a.some(function(a){return b===a.getProperty("id")?!!(c=a):!1});return c}function B(a){var b=a.command;return!b.visibleWhen||b.visibleWhen(c)?(a.invocation=new e.CommandInvocation(c,c,null,b,f),(new q).resolve(a)):"function"===
typeof m?(k||(k=m()),q.when(k,function(d){if(d&&c===ca&&(!b.visibleWhen||b.visibleWhen(d)))return a.invocation=new e.CommandInvocation(d,d,null,b,f),a})):(new q).resolve()}function p(a,b,c){return c?(new q).resolve({relatedLink:a,command:c}):b.then(function(b){return{relatedLink:a,command:new e.Command(b)}})}var s=arguments,h,k,C=a&&a.getServiceReferences("orion.page.link.related");if(C&&0!==C.length){var t=this;q.when(z(),function(){if(X.beforeGenerateRelatedLinks.apply(t,s)){var c=a.getServiceReferences("orion.navigate.command"),
e=[];C.forEach(function(d){var q=g(d);if(q.id){var m;if((q.nls&&q.nameKey||q.name)&&q.uriTemplate)m=b._createCommandOptions(q,d,a,h,!0),e.push(p(q,m,null));else if(m=n(c,q.id)){var z=g(m);d={};K.mixin(d,z,q);(q=f.findCommand(q.id))?e.push(p(d,null,q)):(m=b._createCommandOptions(z,m,a,h,!0),e.push(p(d,m,null)))}}});q.all(e,V).then(function(a){a.sort(function(a,b){return a.command.name.localeCompare(b.command.name)});return q.all(a.map(B),V).then(function(b){var c=[];b=b.filter(function(b,e){if(b)return!0;
c.push(a[e]);return!1});X.addRelatedLinkCommands.call(t,f,b,c,d);X.afterGenerateRelatedLinks.apply(t,s)})})}})}}function P(a){var b=s.node("globalActions");b&&(a.destroy(b),a.renderCommands(b.id,b,{},{},"tool"))}function Y(a){var b=window.getComputedStyle(a,null);return null===b||"absolute"===b.getPropertyValue("position")||!a.parentNode||a===document.body?a:Y(a.parentNode)}function F(a){var b={},c=null;"string"===typeof a&&(a=s.node(a));a||(a=s.node("pageActions"));for(var e=a;e&&e.classList;){if(e.classList.contains("toolComposite")){c=
e;break}e=e.parentNode}a.classList.contains("commandMarker")&&(b.commandNode=a);c&&(b.slideContainer=s.$(".slideParameters",c),b.parameterArea=s.$(".parameters",c),b.dismissArea=s.$(".parametersDismiss",c),b.notifications=s.$("#notificationArea",c),c.parentNode&&(b.toolbarTarget=s.$(".toolbarTarget",c.parentNode),b.toolbarTarget&&(a=s.bounds(b.toolbarTarget),e=s.bounds(Y(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-e.top,b.toolbar=c)));return b}function N(a){if(a=a.slideContainer)if(a.style.left=
"",a.style.top="",a.classList.contains("slideContainerActive")){var b=s.bounds(a),c=s.bounds(a.parentNode);a.style.left=(c.width-b.width)/2+"px";a.style.top="0"}}f=function(a){var b=document.createElement("a");b.href=a;return b.href}(l.toUrl("auth/NotifyAuthentication.html"));var O={},R=null,X={createMenuGenerator:H.createMenuGenerator||function(a,b){if(s.node("userMenu")){var c=s.node("userDropdown"),e=new p.Dropdown({dropdown:c}),c=new B.UserMenu({dropdownNode:c,dropdown:e,serviceRegistry:a}),e=
s.node("userTrigger");new r.Tooltip({node:e,text:k.Options,position:["below","left"]});e=document.getElementById("userTrigger");e.className+=" imageSprite core-sprite-silhouette";c.setKeyAssist(b);return c}},beforeGenerateRelatedLinks:H.beforeGenerateRelatedLinks||function(a,b,c,e,d){return!0},addRelatedLinkCommands:H.addRelatedLinkCommands||function(a,b,c,e){this.sideMenu&&this.sideMenu.setRelatedLinks(b,e)},afterGenerateRelatedLinks:H.afterGenerateRelatedLinks||function(a,b,c,e,d){},afterSetPageTarget:H.afterSetPageTarget||
function(a){},generateNavigationMenu:H.generateNavigationMenu||function(a,b,c,e,d,q,f){if(a=s.node("sideMenu"))b=s.node("centralNavigation"),new r.Tooltip({node:b,text:k.CentralNavTooltip,position:["right"]}),R=this.sideMenu=new S(a,s.node("pageContent")),b.addEventListener("click",R.toggleSideMenu.bind(R)),(a=s.node("sideMenuToggle"))&&a.addEventListener("click",R.toggleSideMenu.bind(R))},afterGenerateNavigationMenu:H.afterGenerateNavigationMenu||function(a,b,c,e,d,q,f){},afterGenerateBanner:H.afterGenerateBanner||
function(a,b,c,e,d,q,f){}},ba=[],ca,aa=[],W,$=null,Z=null,da=new d;return{generateBanner:function(a,b,d,f,m,n,B,p){function r(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var b=s.$$array(".targetSelector"),c=0;c<b.length;c++)b[c].target=a}},{pid:"nav.config"})}(new y.ThemePreferences(f,new A.ThemeData)).apply();var u=s.node(a);if(!u)throw k["could not find banner parent, id was "]+a;var w=document.createRange();
w.selectNode(u);w=w.createContextualFragment(L);s.processTextNodes(w,k);u.firstChild?u.insertBefore(w,u.firstChild):u.appendChild(w);u=s.node("home");u.href=l.toUrl("edit/edit.html");u.setAttribute("aria-label",k["Orion Home"]);s.node("progressPane").src=e.NO_IMAGE;if(u=s.node("pageToolbar"))u.classList.add("toolbarLayout"),u.innerHTML=E+h.slideoutHTMLFragment("mainToolbar");(u=s.node("closeNotifications"))&&u.setAttribute("aria-label",k["Close notification"]);if(17>=D.isFirefox&&(u=s.node("staticBanner")))u.style.width=
"100%",u.style.MozBoxSizing="border-box";if(u=s.node("footer"))u.innerHTML=G,s.processTextNodes(u,k);d.setParameterCollector(new c.CommandParameterCollector(F,N));document.addEventListener("keydown",function(a){a.keyCode===s.KEY.ESCAPE&&(a=b.getService("orion.page.message"))&&a.setProgressMessage("")},!1);X.generateNavigationMenu.apply(this,arguments);X.afterGenerateNavigationMenu.apply(this,arguments);u=z.getCategoriesInfo(b);w=z.getPageLinksInfo(b,"orion.page.link");q.all([u,w]).then(function(a){if(R){var b=
a[1];R.setCategories(a[0]);R.setPageLinks(b);R.setSideMenu()}});if(u=s.$(".split")){var w=s.$(".sidePanelLayout"),I=s.$(".mainPanelLayout");w&&I&&($={side:w,main:I},$.splitter=new t.Splitter({node:u,sidePanel:w,mainPanel:I,toggle:!0,closeByDefault:p}),u=new e.Command({name:k["Toggle side panel"],tooltip:k["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){$.splitter.toggleSidePanel()}}),d.addCommand(u),d.registerCommandContribution("pageActions","orion.toggleSidePane",1,
null,!0,new g.KeyBinding("l",D.isMac?!1:!0,!0,!1,D.isMac?!0:!1)))}var H=!1,x=function(a,b){if(!H){var c=b.getService("orion.page.progress"),e=new C.OpenResourceDialog({searcher:a,progress:c,searchRenderer:a.defaultRenderer,onHide:function(){H=!1}});window.setTimeout(function(){H=!0;e.show()},0)}},u=new e.Command({name:k["Find File Named..."],tooltip:k["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(a){x(m,b)}});d.addCommand(u);d.registerCommandContribution("globalActions",
"orion.openResource",100,null,!0,new g.KeyBinding("f",!0,!0));u=new e.Command({name:k["Toggle banner and footer"],tooltip:k["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=s.node("banner"),b=s.node("footer"),c=s.node("sideMenu"),e=s.$(".content-fixedHeight"),d="hidden"===a.style.visibility;d?(a.style.visibility="visible",b.style.visibility="visible",e.classList.remove("content-fixedHeight-maximized"),c&&c.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",b.style.visibility="hidden",e.classList.add("content-fixedHeight-maximized"),c&&c.classList.add("sideMenu-maximized"));da.dispatchEvent({type:"toggleTrim",maximized:!d});return!0}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new g.KeyBinding("m",!0,!0));u=new e.Command({name:k["System Configuration Details"],tooltip:k["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return l.toUrl("help/about.html")}});d.addCommand(u);
d.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new g.KeyBinding(112,!0,!0));u=new e.Command({name:k["Background Operations"],tooltip:k["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return l.toUrl("operations/list.html")}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new g.KeyBinding("o",!0,!0));Z=new v.KeyAssistPanel({commandRegistry:d});u=new e.Command({name:k["Show Keys"],
tooltip:k["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){Z.isVisible()?Z.hide():Z.show();return!0}});d.addCommand(u);d.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new g.KeyBinding(191,!1,!0));P(d);U(b,u.callback);M(b);window.addEventListener("hashchange",function(){d.processURL(window.location.href)},!1);window.setTimeout(function(){r(b)},0);X.afterGenerateBanner.apply(this,arguments)},getToolbarElements:F,getMainSplitter:function(){return $},
getKeyAssist:function(){return Z},getGlobalEventTarget:function(){return da},layoutToolbarElements:N,setPageTarget:function(a){var b,c,e=a.breadcrumbRootName,d=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&!a.staticBreadcrumb&&(c=(e?e+" ":"")+a.fileService.fileServiceName(a.target.Location),e=null),b=a.name||a.target.Name,ca=a.target,T.call(this,d,a.target,aa,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||
(e=e||a.task||a.name),b=a.name,T.call(this,d,{NoTarget:""},aa,a.commandService,a.makeAlternate));(W=a.title)||(W=b?b+" - "+a.task:a.task);window.document.title=W;X.afterSetPageTarget.apply(this,arguments);if(b=a.breadCrumbContainer?s.node(a.breadCrumbContainer):s.node("location"))if(s.empty(b),a.staticBreadcrumb)new m.BreadCrumbs({container:b,rootSegmentName:e});else{var q=d&&new Q.FileClient(d),d=a.breadcrumbTarget||a.target,q=q&&d&&d.Location?q.fileServiceRootURL(d.Location):null;new m.BreadCrumbs({container:b,
resource:d,rootSegmentName:e,workspaceRootSegmentName:c,workspaceRootURL:q,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){W&&("*"===W.charAt(0)&&!a&&(W=W.substring(1)),a&&"*"!==W.charAt(0)&&(W="*"+W),window.document.title=W);var b=s.node("dirty");b&&(b.textContent=a?"*":"")},setPageCommandExclusions:function(a){aa=a},notifyAuthenticationSite:f}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(k){return{detectValidURL:function(l){for(var h=/\[([^\]]*)\]\(([^\)]+)\)/g,g=h.exec(l),d=[],f=0;g;){if(3===g.length&&0<g[2].length){var e=new URL(g[2]);":"!==e.protocol&&k.validateURLScheme(e.href)&&(g.index>f&&d.push({segmentStr:l.substring(f,g.index)}),d.push({segmentStr:0<g[1].length?g[1]:g[2],urlStr:g[2]}),f=g.index+g[0].length)}g=h.exec(l)}if(0===f)return null;f<l.length-1&&d.push({segmentStr:l.substring(f)});return d},processURLSegments:function(k,
h){h.forEach(function(g){if(g.urlStr){var d=document.createElement("a");d.href=g.urlStr;d.appendChild(document.createTextNode(g.segmentStr))}else d=document.createElement("span"),d.textContent=g.segmentStr;k.appendChild(d)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(k,l,h,g){function d(e,c,b,d,a){this._serviceRegistry=e;this._serviceRegistration=e.registerService("orion.page.message",this);this._operationsClient=c;this.notificationContainerDomId=a;this.domId=b;this.progressDomId=d||b;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var f;d.prototype={_init:function(){var e=l.node("closeNotifications");if(e&&
!this._hookedClose){e.style.cursor="pointer";this._hookedClose=!0;var c=l.node(this.notificationContainerDomId);l.addAutoDismiss([c],function(){this._clickToDisMiss&&this.close()}.bind(this));e.addEventListener("click",function(){this.close()}.bind(this));c.addEventListener("click",function(b){b&&b.target&&"a"===b.target.nodeName.toLowerCase()&&(b=l.$$("a",c))&&b.length&&1===b.length&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var e=l.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&e?(e.innerHTML="",e.classList.remove("cancelButton"),e.classList.add("dismissButton"),e.classList.add("core-sprite-close"),e.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=h.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(e,c,b){this._init();this.currentMessage=e;var d=l.node(this.domId);
if("boolean"===typeof b){var a=d.getAttribute("aria-live");d.setAttribute("aria-live",b?"polite":"off");window.setTimeout(function(){e===this.currentMessage&&(l.empty(d),d.appendChild(document.createTextNode(e)),window.setTimeout(function(){d.setAttribute("aria-live",a)},100))}.bind(this),100)}else l.empty(d),d.appendChild(document.createTextNode(e));"number"===typeof c&&window.setTimeout(function(){e===this.currentMessage&&(l.empty(d),d.appendChild(document.createTextNode("")))}.bind(this),c)},setErrorMessage:function(e){this._clickToDisMiss=
!0;this.currentMessage=e;this._init();var c=e.responseText||e.message||e;if("string"===typeof c)try{c=JSON.parse(c)}catch(b){}e=c.Message||c;var d="red";if(c.Severity)switch(c.Severity){case "Warning":d="#FFCC00";break;case "Error":d="red";break;case "Info":case "Ok":d="green"}c=document.createElement("span");c.style.color=d;c.appendChild(document.createTextNode(e));e=l.node(this.domId);l.empty(e);e.appendChild(c)},setProgressMessage:function(e){this._clickToDisMiss=!1;this._init();this.currentMessage=
e;var c=document.createElement("span");c.classList.add("progressIcon");var b=l.node(this.progressDomId);l.empty(b);b.appendChild(c);b.appendChild(document.createTextNode(e));c=l.node(this.notificationContainerDomId);c.classList.remove("notificationHide");if(e&&0<e.length)c.classList.add("progressNormal"),c.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();c.classList.remove("notificationShow");c.classList.add("notificationHide")}},
setCancelFunction:function(e){this._cancelFunc=e},setProgressResult:function(e,c){this._clickToDisMiss=!1;this._cancelMsg=c;this.currentMessage=e;var b=e.responseText||e;if("string"===typeof b)try{b=JSON.parse(b)}catch(d){}this._init();var a=b.Message||b.toString(),f=k.UnknownError,s="core-sprite-information",h="progressNormal",p=document.createElement("span");p.classList.add("imageSprite");p.classList.add("progressIcon");var r=[];if(b.Severity)switch(b.Severity){case "Warning":f=k.UnknownWarning;
s="core-sprite-warning";h="progressWarning";r.push("progressInfo");r.push("progressError");r.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":s="core-sprite-error";h="progressError";r.push("progressWarning");r.push("progressInfo");r.push("progressNormal");this._clickToDisMiss=!0;break;default:h="progressNormal",r.push("progressWarning"),r.push("progressError"),r.push("progressNormal")}r.push("notificationHide");p.classList.add(s);var u=l.node(this.progressDomId),s=l.node(this.notificationContainerDomId);
l.empty(u);u.appendChild(p);a===Object.prototype.toString()&&(a=f);b.HTML?(b=document.createElement("span"),b.innerHTML=a,u.appendChild(b)):((f=g.detectValidURL(a))?(a=document.createDocumentFragment(),g.processURLSegments(a,f),Array.prototype.forEach.call(l.$$("a",a),function(a){a.target="_blank"})):("Warning"!==b.Severity&&"Error"!==b.Severity&&!c&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
a=document.createTextNode(a)),u.appendChild(a));if(h&&this.progressDomId!==this.domId){s.classList.add(h);for(h=0;h<r.length;h++)s.classList.remove(r[h])}s.classList.add("notificationShow");if(r=l.node("closeNotifications"))this._cancelMsg?(r.classList.add("cancelButton"),r.classList.remove("dismissButton"),r.classList.remove("core-sprite-close"),r.classList.remove("imageSprite"),r.innerHTML=this._cancelMsg):(r.innerHTML="",r.classList.remove("cancelButton"),r.classList.add("dismissButton"),r.classList.add("core-sprite-close"),
r.classList.add("imageSprite"))},showWhile:function(e,c){var b=this;if(c){b.setProgressMessage(c);var d=function(){c===b.currentMessage&&b.setProgressMessage("")};e.then(d,d)}return e},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(e,c){return new f(this,++this._lastProgressId,e,c)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var e="",c=!0,b;for(b in this._progressMonitors)this._progressMonitors[b].status&&(c||(e+=", "),e+=this._progressMonitors[b].status,
c=!1);this.setProgressMessage(e)}else this.setProgressMessage("")},_beginProgressMonitor:function(e){this._progressMonitors[e.progressId]=e;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(e){this._progressMonitors[e.progressId]=e;this._renderOngoingMonitors()},_doneProgressMonitor:function(e){delete this._progressMonitors[e.progressId];this._progressMonitors.length--;e.status?this.setProgressResult(e.status):this._renderOngoingMonitors()}};d.prototype.constructor=
d;f=function(e,c,b,d){this.statusService=e;this.progressId=c;if(b){this.deferred=b;this.begin(d);var a=this;b.then(function(b,c){a.done.bind(a)()},function(b,c){a.done.bind(a)()})}};f.prototype.begin=function(e){this.status=e;this.statusService._beginProgressMonitor(this)};f.prototype.done=function(e){this.status=e;this.statusService._doneProgressMonitor(this)};f.prototype.worked=function(e){this.status=e;this.statusService._workedProgressMonitor(this)};f.prototype.constructor=f;return{StatusReportingService:d,
ProgressMonitor:f}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(k,l,h,g){function d(){}d.prototype={_initialize:function(d,e,c,b,n){this._tooltip=new g.Tooltip({node:d,hideDelay:n||0,afterShowing:this._afterShowingFunction(e).bind(this),afterHiding:c,trigger:b?b:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";d=document.createRange();d.selectNode(this.$parent);d=d.createContextualFragment(this.TEMPLATE);
this.messages&&h.processTextNodes(d,k);this.$parent.appendChild(d);var a=this._tooltip;this.$parent.addEventListener("keydown",function(b){b.keyCode===h.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(d){for(var e=0;e<d.childNodes.length;e++){var c=d.childNodes[e];c.id&&(this["$"+c.id]=c);this._bindElements(c)}},_afterShowingFunction:function(d){return function(){d&&d.bind(this)();if(!this.customFocus){var e=
h.firstTabbable(this.$parent);e&&e.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};d.prototype.constructor=d;return{PopupDialog:d}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(k,l,h,g){var d={};(function(){var f=!1;d.updateNavTools=function(e,c,b,d,a,m){var g=h.node(d);if(g)c.destroy(g);else throw k["could not find toolbar "]+d;c.renderCommands(d,g,m,b,"button");if(a&&(d=h.node(a)))c.destroy(d),c.renderCommands(a,d,null,b,"button");f||(f=!0,e.getService("orion.page.selection").addEventListener("selectionChanged",function(e){var d=h.node(a);
d&&(c.destroy(d),c.renderCommands(a,d,e.selections,b,"button"))}))};d.createOperationsCommands=function(e,c,b){function d(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var a=new g.Command({name:k["Remove Completed"],tooltip:k["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(a){b.removeCompletedOperations().then(function(a){c.loadOperations.bind(c)()})},visibleWhen:function(a){return!0}});e.addCommand(a);
a=new g.Command({name:k.Remove,tooltip:k["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var e=0;e<a.length;e++){var d=a[e];b.removeOperation.bind(b)(d.Location).then(function(){c.loadOperations.bind(c)()},function(){c.loadOperations.bind(c)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!d(a);for(var b in a)if(d(a[b]))return!1;return!0}});e.addCommand(a);
a=new g.Command({name:k.Cancel,tooltip:k["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var c=a[b];c.deferred&&c.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return d(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!d(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});e.addCommand(a)}})();
return d});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(k,l,h,g,d){function f(e){this._options=e}f.prototype=new g.PopupDialog;f.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';f.prototype._init=
function(e){this._myOperations=[];this._operationsDeferreds=[];this._commandService=e.commandRegistry;d.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(e.triggerNode)};f.prototype._bindToDom=function(e){this.$allOperationsLink.href=l.toUrl("operations/list.html");this._setOperationsVisibility()};f.prototype.setOperations=function(e,c){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(e)for(var b in e)this._myOperations.push(e[b]),this._operationsDeferreds.push(c[b]);this._renderOperations()};f.prototype.parseProgressResult=function(e){if(!e)return{};e=e.responseText||e;try{e=JSON.parse(e)}catch(c){}var b={Message:e.Message||e,Severity:e.Severity};e.DetailedMessage&&e.DetailedMessage!==b.Message&&(b.DetailedMessage=e.DetailedMessage);return b};f.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};f.prototype._renderOperationsTable=function(e,c,b){h.empty(e);for(var d=0;d<c.length;d++){var a=c[d],f=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px";g.style.paddingRight="5px";g.textContent=a.Name;f.appendChild(g);var t=document.createElement("div");g.appendChild(t);g=document.createElement("span");g.style.paddingRight="5px";g.classList.add("imageSprite");switch(a.type){case "Warning":g.classList.add("core-sprite-warning");
g.setAttribute("aria-label",k["Operation resulted in a warning."]);break;case "error":g.classList.add("core-sprite-error");g.setAttribute("aria-label",k["Operation resulted in an error."]);break;case "loadstart":case "progress":g.classList.add("core-sprite-start");g.setAttribute("aria-label",k["Operation is running."]);break;case "abort":g.classList.add("core-sprite-stop");g.setAttribute("aria-label",k["Operation is canceled."]);break;case "load":case "loadend":g.classList.add("core-sprite-ok"),g.setAttribute("aria-label",
"Operation ok.")}t.appendChild(g);g=document.createElement("span");g.classList.add("operationStatus");g.textContent=a.Name;t.appendChild(g);if(a.error){var p=a.error.Message||a.error;a.error.DetailedMessage&&""!==a.error.DetailedMessage&&(p+=": "+a.error.DetailedMessage);g.textContent=p;g.classList.remove("operationStatus");g.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",t,{operation:a,deferred:b[d]},this,"tool");e.appendChild(f)}this._setOperationsVisibility()};
f.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};f.prototype.constructor=f;return{OperationsDialog:f}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(k,l,h,g,d){function f(c,b){if(!this._progressPane){this._progressPane=g.node(c);this._operationsDialog=new d.OperationsDialog({triggerNode:this._progressPane,commandRegistry:b});var e=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===g.KEY.ENTER)&&e._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){e._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function e(c,b,e,a){this._serviceRegistry=c;this._serviceRegistration=c.registerService("orion.page.progress",this);this._commandRegistry=e;this._operationsClient=b;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}f.prototype={_switchIconTo:function(c){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=c;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(c,b){var e={},a;for(a in c)c[a].progressMonitor||(e[a]=c[a]);if(this._isEmpty(e))this._switchIconTo("progressPane_empty"),this._progressPane.title=k.Operations,this._progressPane.alt=k.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var d="";for(a in e){var f=e[a];if(f.type&&("loadstart"===f.type||"progress"===f.type)){d=
"running";break}}""===d&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==d;switch(d){case "running":this._progressPane.title=k["Operations running"];this._progressPane.alt=k["Operations running"];this._progressPane.setAttribute("aria-valuetext",k["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=k["Some operations finished with warning"];this._progressPane.alt=k["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",k["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=k["Some operations finished with error"];this._progressPane.alt=k["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",k["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=k.Operations,this._progressPane.alt=k.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(e,b)},_isEmpty:function(c){for(var b in c)return!1;return!0}};f.prototype.constructor=f;e.prototype={init:function(c){this._progressMonitorClass||(this._progressMonitorTool=new f(c,this._commandRegistry))},progress:function(c,b,e){var a=this,d=this._operationsIndex++;!e&&this._progressMonitorClass&&(e=new this._progressMonitorClass,e.begin(b));c.then(function(f){a._operations[d]&&
(f=a._operations[d],b&&(f.Name=b),a._lastOperation=f,f.type="loadend",e&&(f.progressMonitor=e),a.writeOperation.bind(a)(d,f,c),f.Location||a._removeOperationFromTheList.bind(a)(d))},function(f){if(a._operations[d]){var g=a._operations[d];b&&(g.Name=b);e&&(g.progressMonitor=e);a._lastOperation=g;g.type=f.canceled?"abort":"error";g.error=f;a.writeOperation.bind(a)(d,g,c);g.Location||a._removeOperationFromTheList.bind(a)(d)}},function(f){b&&(f.Name=b);e&&(f.progressMonitor=e);a.writeOperation.bind(a)(d,
f,c)});return c},removeOperation:function(c){for(var b in this._operations)if(this._operations[b].Location&&this._operations[b].Location===c){this._removeOperationFromTheList(b);break}this._operationsClient.removeOperation.bind(this._operationsClient)(c)},_removeOperationFromTheList:function(c){var b=this._operations[c].progressMonitor;delete this._operations[c];delete this._operationDeferrds[c];b?b.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var c in this._operations){var b=this._operations[c];b.type&&"loadstart"!==b.type&&"progress"!==b.type&&((b=this._operations[c].progressMonitor)&&b.done(),delete this._operations[c],delete this._operationDeferrds[c])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(c){this._serviceRegistry.getService("orion.page.message").setProgressResult(c)},showWhile:function(c,b,e){b&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(b);
var a=this;c.then(function(b){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(b){e?a._serviceRegistry.getService("orion.page.message").setProgressMessage(""):a.setProgressResult.bind(a)(b);return b});return this.progress(c,b)},writeOperation:function(c,b,e){this._operations[c]=b;this._operationDeferrds[c]=e;b.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(b.Location,{Name:b.Name,expires:b.expires})});
b.progressMonitor?b.progressMonitor.progress(b.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};e.prototype.constructor=e;return{ProgressService:e}});define("orion/dialogs",[],function(){function k(k){this._serviceRegistry=k;this._serviceRegistration=k.registerService("orion.page.dialog",this)}k.prototype={confirm:function(k,h){h(window.confirm(k))},openFiles:function(k){}};k.prototype.constructor=k;return{DialogService:k}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(k,l){function h(g,d){d||(d="orion.page.selection");this._serviceRegistry=g;k.attach(this);this._serviceRegistration=g.registerService(d,this);this._selections=null}h.prototype={getSelection:function(g){var d=this._getSingleSelection();"function"===typeof g&&g(d);return d},getSelections:function(g){var d=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof g&&g(d);return d},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(g){var d=this._selections;Array.isArray(g)?this._selections=0<g.length?g.slice():null:this._selections=g?[g]:null;d!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};h.prototype.constructor=h;return{Selection:h}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(k,l){function h(e,c,b){return e[c].apply(e,b)}function g(e){this._location=e}function d(){var e=new l;e.reject(k["No Matching OperationService for location:"]+this._location);return e}function f(e){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=e.getService("orion.core.preference");for(var c=e.getServiceReferences("orion.core.operation"),
b=0;b<c.length;b++){var d=e.getService(c[b]);this._services[b]=d;d=c[b].getProperty("pattern")||".*";"^"!==d[0]&&(d="^"+d);this._patterns[b]=RegExp(d)}this._getService=function(a){if(!a)return this._services[0];for(var b=0;b<this._patterns.length;++b)if(this._patterns[b].test(a))return this._services[b];this._operations.remove(a);return new g(a)}}g.prototype={getOperation:d,getOperations:d,removeCompletedOperations:d,removeOperation:d,cancelOperation:d};g.prototype.constructor=g;f.prototype={getOperations:function(){var e=
new l;if(this._operations)return e.resolve(this._operations),e;var c=this;this._preferenceService.getPreferences("/operations").then(function(b){c._operations=b;e.resolve(c._operations)});return e},getOperation:function(e){return h(this._getService(e),"getOperation",arguments)},removeCompletedOperations:function(){for(var e=[],c=this,b=0;b<this._services.length;b++){var d=this._patterns[b],a=new l;e[b]=a.promise;h(this._services[b],"removeCompletedOperations").then(function(a){return function(b){Array.isArray(b)&&
c.getOperations.bind(c)().then(function(c){for(var e=c.keys(),f=0;f<e.length;f++){var g=e[f];d.test(g)&&0>b.indexOf(g)&&c.remove(g)}a.resolve()})}}(a),function(a){return function(b){a.reject(b)}}(a))}return l.all(e)},removeOperation:function(e){var c=this;return h(this._getService(e),"removeOperation",arguments).then(function(b){c.getOperations.bind(c)().then(function(b){b.remove(e)})},function(b){return b},function(b){return b})}};f.prototype.constructor=f;return{OperationsClient:f}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace All":"Replace All",
"Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}","Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",
Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches","Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes",
"Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","Show next page of search result":"Show next page of search result","Next result":"Next result","Previous result":"Previous result","Expand all results":"Expand all results",
"Collapse all results":"Collapse all results","Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",
Save:"Save","Type a name for the search":"Type a name for the search","Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",root:"root",Scope:"Scope"});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(k,l){var h={root:l};Object.keys(k).forEach(function(g){"undefined"===typeof h[g]&&(h[g]=k[g])});return h});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(k,l){function h(g){this._init(g)}h.prototype={_init:function(g){var d=g.parent,f=this,d=l.node(d);if(!d)throw k["no parent"];if(!g.model)throw k["no tree model"];if(!g.renderer)throw k["no renderer"];this._parent=d;this._treeModel=g.model;this._onComplete=g.onComplete;this._renderer=g.renderer;this._showRoot=void 0===g.showRoot?!1:g.showRoot;this._indent=void 0===g.indent?16:g.indent;this._onCollapse=g.onCollapse;
this._labelColumnIndex=void 0===g.labelColumnIndex?0:g.labelColumnIndex;this._id=void 0===g.id?"treetable":g.id;this._tableStyle=g.tableStyle;this._tableElement=g.tableElement||"table";this._tableBodyElement=g.tableBodyElement||"tbody";this._tableRowElement=g.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(e){f._showRoot?(e._depth=0,f._generate([e],0)):f._treeModel.getChildren(e,function(c){f.destroyed||f._generate(c,0)})})},destroy:function(){this.destroyed=!0},_generate:function(g,
d){l.empty(this._parent);var f=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(f);var e=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(e);e.id=this._id;this._tableStyle&&e.classList.add(this._tableStyle);this._renderer.initTable(e,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===g.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(g,d);e.appendChild(this._bodyElement);f.appendChild(e);this._parent.appendChild(f);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(g,d,f){for(var e=0;e<g.length;e++){var c=document.createElement(this._tableRowElement);c.id=this._treeModel.getId(g[e]);c._depth=d;c._item=g[e];this._renderer.render(g[e],c);c.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*d+"px";this._renderer.rowCallback&&this._renderer.rowCallback(c,g[e]);f?(this._bodyElement.insertBefore(c,f.nextSibling),f&&(f=c)):this._bodyElement.appendChild(c)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(g,d,f){var e=this._treeModel.getId(g),c;if(e===this._id)this._removeChildRows(e),this._generateChildren(d,0),this._rowsChanged();else{var b=l.node(e);b?(b._item=g,
b&&(f||b._expanded)?(this._removeChildRows(e),d?(b._expanded=!0,this._renderer.updateExpandVisuals(b,!0),this._generateChildren(d,b._depth+1,b),this._rowsChanged()):(c=this,this._renderer.updateExpandVisuals(b,"progress"),d=this._treeModel.getChildren(b._item,function(e){c.destroyed||(c._renderer.updateExpandVisuals(b,!0),b._expanded||(b._expanded=!0,c._generateChildren(e,b._depth+1,b),c._rowsChanged()))}))):this._renderer.updateExpandVisuals(b,!1)):console.log(k["could not find table row "]+e)}},
getItem:function(g){var d=l.node(g);return d&&d._item?d._item:g},toggle:function(g){var d=l.node(g);d&&(d._expanded?this.collapse(g):this.expand(g))},isExpanded:function(g){g="string"===typeof g?g:this._treeModel.getId(g);return(g=l.node(g))?g._expanded:!1},expand:function(g,d,f){g="string"===typeof g?g:this._treeModel.getId(g);var e=l.node(g);if(e){var c=this;e._expanded?d&&d.apply(c,f):(this._renderer.updateExpandVisuals(e,"progress"),this._treeModel.getChildren(e._item,function(b){c.destroyed||
(c._renderer.updateExpandVisuals(e,!0),e._expanded||(e._expanded=!0,c._generateChildren(b,e._depth+1,e),c._rowsChanged()),d&&d.apply(c,f))}))}},_removeChildRows:function(g){for(var d=g===this._id,f=!1,e=-1,c=[],b=l.$$array(".treeTableRow",this._parent),n=0;n<b.length;n++){var a=b[n];if(f)break;d?a._depth>e?c.push(a):f=!0:a.id===g&&(d=!0,e=a._depth)}for(g=0;g<c.length;g++)d=c[g],d.parentNode.removeChild(d)},collapse:function(g){g="string"===typeof g?g:this._treeModel.getId(g);var d=l.node(g);if(d){if(!d._expanded)return;
d._expanded=!1;this._renderer.updateExpandVisuals(d,!1);this._removeChildRows(g);this._rowsChanged()}this._onCollapse&&this._onCollapse(d._item)},getIndent:function(){return this._indent}};h.prototype.constructor=h;return{TableTree:h}});
define("orion/treeModelIterator",[],function(){var k={};k.TreeModelIterator=function(){function k(h,g){this.firstLevelChildren=h;this.reset();this._init(g)}k.prototype={_init:function(h){h&&(this.isExpanded=h.isExpanded,this.isExpandable=h.isExpandable,this.forceExpandFunc=h.forceExpandFunc,this.getChildrenFunc=h.getChildrenFunc)},topLevel:function(h){return h.parent?h.parent===this.root:!0},_getChildren:function(h){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(h):h?h.children:
null},_expanded:function(h){if(!h)return!0;var g=this._getChildren(h),g=g&&0<g.length;this.isExpanded&&g&&(g=this.isExpanded(h));return g},_expandable:function(h){return!h?!0:this.isExpandable?this.isExpandable(h):!1},_diveIn:function(h){return this._expanded(h)?(h=this._getChildren(h),this.setCursor(h[0]),this.cursor()):null},_drillToLast:function(h){return this._expanded(h)?(h=this._getChildren(h),this._drillToLast(h[h.length-1])):h},_forward:function(h){if(!this._cursor)return null;var g=this._diveIn(this._cursor);
if(!g){if(h&&this._expandable(this._cursor)&&this.forceExpandFunc){var d=this;return this.forceExpandFunc(this._cursor,"first",function(f){f&&d.setCursor(f)})}(g=this._findSibling(this._cursor,!0))&&this.setCursor(g)}return g},_backward:function(h){if(!this._cursor)return null;var g=this._findSibling(this._cursor,!1);g&&g!==this._cursor.parent&&(g=this._drillToLast(g));if(h&&g&&this._expandable(g)&&this.forceExpandFunc&&g!==this._cursor.parent){var d=this;return this.forceExpandFunc(g,"last",function(f){f&&
d.setCursor(f)})}g&&this.setCursor(g);return g},_findSibling:function(h,g){for(var d=this.topLevel(h),f=this._getChildren(h.parent),f=d?this.firstLevelChildren:f,e=0;e<f.length;e++)if(f[e]===h)return 0===e&&!g?d?null:h.parent:e===f.length-1&&g?d?null:this._findSibling(h.parent,g):g?f[e+1]:f[e-1];return null},_inParentChain:function(h,g){for(var d=h.parent;d;){if(d===g)return!0;d=d.parent}return!1},_getTopLevelParent:function(h){if(this.topLevel(h))return h;for(h=h.parent;h;){if(this.topLevel(h))return h;
h=h.parent}return null},_onCollapse:function(h){return this._expanded(h.parent)?h:this._onCollapse(h.parent)},_scan:function(h,g,d){this.setCursor(g);var f=[];for(f.push(g);;){if(this.iterate(h))f.push(this.cursor());else break;if(d===this.cursor())return f}return null},setCursor:function(h){this._prevCursor=this._cursor;this._cursor=h},setTree:function(h){this.firstLevelChildren=h;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(h,g){var d=this.cursor(),
f=this._scan(!0,h,g);f||(f=this._scan(!1,h,g));this.setCursor(d);return f},iterate:function(h,g){return h?this._forward(g):this._backward(g)},iterateOnTop:function(h,g){var d=this._findSibling(this._getTopLevelParent(this.cursor()),h);d?this.setCursor(d):g&&0<this.firstLevelChildren.length&&this.setCursor(h?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(h){return!this._cursor?null:this._inParentChain(this._cursor,h)?(this.setCursor(h),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return k}();return k});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(k,l,h){var g={},d=-1!==navigator.userAgent.indexOf("iPad"),f=-1!==window.navigator.platform.indexOf("Mac");g.ExplorerNavHandler=function(){function e(c,b,e){this.explorer=c;this.model=this.explorer.model;this._navDict=b;this._listeners=[];this._selections=[];this._currentColumn=0;c=this._getEventListeningDiv();c.tabIndex=0;c.classList.add("selectionModelContainer");var a=this;this._modelIterator=
new l.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:e.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(b){return a.explorer.renderer.isExpandable(b)}:function(b){return a.isExpandable(b)},forceExpandFunc:this.explorer.forceExpandFunc?function(b,c,e){return a.explorer.forceExpandFunc(b,c,e)}:void 0});this._init(e);(!e||!1!==e.setFocus)&&c.focus();e=function(b){if(h.isFormElement(b.target)||a.explorer.preventDefaultFunc&&a.explorer.preventDefaultFunc(b,
a._modelIterator.cursor()))return!0;if(b.keyCode===k.KEY.DOWN)return a.onDownArrow(b);if(b.keyCode===k.KEY.UP)return a.onUpArrow(b);if(b.keyCode===k.KEY.RIGHT)return a.onRightArrow(b);if(b.keyCode===k.KEY.LEFT)return a.onLeftArrow(b);if(b.keyCode===k.KEY.SPACE)return a.onSpace(b);if(b.keyCode===k.KEY.ENTER)return a.onEnter(b)};c.addEventListener("keydown",e,!1);this._listeners.push({type:"keydown",listener:e});e=function(b){if(a.explorer.onFocus)a.explorer.onFocus(!1);else a.toggleCursor(null,!1)};
c.addEventListener("blur",e,!1);this._listeners.push({type:"blur",listener:e});e=function(b){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};c.addEventListener("focus",e,!1);this._listeners.push({type:"focus",listener:e});this._parentDiv=c}e.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(c){this._linearGridMove=!1;c&&(this._selectionPolicy=c.selectionPolicy,this.gridClickSelectionPolicy=c.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=c.preventDefaultFunc,this.postDefaultFunc=c.postDefaultFunc)},_ctrlKeyOn:function(c){return f?c.metaKey:c.ctrlKey},removeListeners:function(){if(this._listeners)for(var c=0;c<this._listeners.length;c++)this._parentDiv.removeEventListener(this._listeners[c].type,this._listeners[c].listener,!1)},focus:function(){var c=this._getEventListeningDiv();c&&c.focus()},_getEventListeningDiv:function(c){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(c):k.node(this.explorer._parentId)},isExpandable:function(c){return!c?!1:k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(c)))?!0:!1},isExpanded:function(c){return!c?!1:this.explorer.myTree.isExpanded(this.model.getId(c))},refreshSelection:function(c,b){var e=this;this.explorer.selection&&this.explorer.selection.getSelections(function(a){e._clearSelection(b);for(var d=0;d<a.length;d++)e._selections.push(a[d]);0<e._selections.length?e.cursorOn(e._selections[0],
!0,!1,c):e.cursorOn(null,!1,!1,c);e._shiftSelectionAnchor&&0<=e._inSelection(e._shiftSelectionAnchor)||(e._shiftSelectionAnchor=null)})},refreshModel:function(c,b,e,a){this._currentColumn=0;this.topIterationNodes=[];this.model=b;this._navDict=c;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():e&&(this.topIterationNodes=e);this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(c){c=this.model.getId(c);for(var b=0;b<this._selections.length;b++)if(c===this.model.getId(this._selections[b]))return b;return-1},_clearSelection:function(c){if(c)for(c=0;c<this._selections.length;c++)this._checkRow(this._selections[c],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(c){this._selectionPolicy!==
c&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===c)&&this._toggleSelectionClass("disabledRow","readonlySelection"===c),this._selectionPolicy=c,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(c,b,e){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?b&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(c,!0):this._isRowSelectable(c)&&(!b||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(c,!1),this._selections.push(c),this._lastSelection=c):(b=this._inSelection(c),0<=b?(this._checkRow(c,!0),this._selections.splice(b,1)):(this._checkRow(c,!1),this._selections.push(c),this._lastSelection=c)),e&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(c,b){c||(c=this.currentModel());var e=this._getGridChildren(c);if(e&&1<e.length||
0===b&&e){0!==b&&this.toggleCursor(c,!1);var a=this._currentColumn,d=!0,a=a+b;0>a?(this._linearGridMove&&0!==b&&(this._modelIterator.iterate(!1)?c=this.currentModel():d=!1),a=d?e.length-1:this._currentColumn):a>=e.length&&(this._linearGridMove&&0!==b&&(this._modelIterator.iterate(!0)?c=this.currentModel():d=!1),a=d?0:this._currentColumn);this._currentColumn=a;0!==b&&this.toggleCursor(c,!0);return!0}return!1},_getGridChildren:function(c){return this._navDict?this._navDict.getGridNavHolder(c):null},
getCurrentGrid:function(c){c||(c=this.currentModel());return(c=this._getGridChildren(c))&&0<c.length?c[this._currentColumn]:null},getAriaContainerElement:function(c){for(var b=this._parentDiv,e;c&&c!==b&&"grid"!==(e=c.getAttribute("role"))&&"tree"!==e&&"treegrid"!==e;)c=c.parentNode;return c===b?null:c},toggleCursor:function(c,b){var e=this.getRowDiv(c),a=this.getCurrentGrid(c);a?(e&&(b?e.classList.add("treeIterationCursorRow"):e.classList.remove("treeIterationCursorRow")),a.domNode&&(e=this.getAriaContainerElement(a.domNode),
b?(a.domNode.classList.add("treeIterationCursor"),e&&e.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):e&&(b?e.classList.add("treeIterationCursorRow_Dotted"):e.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(c,b,e,a){var d,f;if(c||b){if(f===this._modelIterator.cursor())return;d=this._modelIterator.cursor();f=c;this._modelIterator.setCursor(f)}else d=this._modelIterator.prevCursor(),
f=this._modelIterator.cursor();if(d!==f||b)if(this.toggleCursor(d,!1),!b||f){this.moveColumn(null,0);this.toggleCursor(f,!0);if((c=this.getRowDiv())&&!a){a=c.parentNode;for(b=document.documentElement;a&&a!==b;){var g=window.getComputedStyle(a,null);if(!g)break;g=g.getPropertyValue("overflow-y");if("auto"===g||"scroll"===g)break;a=a.parentNode}a&&(b=!0,c.offsetTop<=a.scrollTop?(b=!1,void 0===e&&(e=!1)):c.offsetTop+c.offsetHeight>=a.scrollTop+a.clientHeight&&(b=!1,void 0===e&&(e=!0)),b||c.scrollIntoView(!e))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(d,
f)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var c=[],b=0;b<this._selections.length;b++)c.push(this.model.getId(this._selections[b]));return c},getRowDiv:function(c){c=c?c:this._modelIterator.cursor();if(!c)return null;c=this.model.getId(c);var b=this._navDict.getValue(c);return b&&b.rowDomNode?b.rowDomNode:k.node(c)},iterate:function(c,b,e,a){var d=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(a){a=this.currentModel();for((d=this._modelIterator.iterate(c,
b))&&this._setCursorOnItem(c,e);d&&d.isNotSelectable;)(d=this._modelIterator.iterate(c,b))&&this._setCursorOnItem(c,e);d||(this.cursorOn(a,!0,!1,!0),this._setCursorOnItem(c,e))}else this._modelIterator.iterate(c,b)&&this._setCursorOnItem(c,e)},_toggleSelectionClass:function(c,b){this._selections.forEach(function(e){(e=this.getRowDiv(e))&&(b?e.classList.add(c):e.classList.remove(c))}.bind(this))},_setCursorOnItem:function(c,b){this.cursorOn(null,!1,c);if(b){var e=this._inSelection(this._modelIterator.prevCursor()),
a=this._inSelection(this._modelIterator.cursor());0<=e&&0<=a?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(c,b){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var e=this.getRowDiv(c);if(e){var a=k.node(this.explorer.renderer.getCheckBoxId(e.id)),d=b?!a.checked:!0;if(d!==a.checked)this.explorer.renderer.onCheck(e,a,d,!0)}}else this._select(c,b)},_select:function(c,b){c||(c=this._modelIterator.cursor());
var e=this.getRowDiv(c);e&&(0>this._inSelection(c)?e.classList.add("checkedRow"):e.classList.remove("checkedRow"))},_onModelGrid:function(c,b){var e=this._getGridChildren(c);if(e)for(var a=0;a<e.length;a++)if(b.target===e[a].domNode)return!0;return!1},onClick:function(c,b){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(c)))k.stop(b);else{var e=k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(c)));if(b.target!==e&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(c,b)))if(this.cursorOn(c,!0,!1,!0),d)this.setSelection(c,!0);else if(this._ctrlKeyOn(b))this.setSelection(c,!0,!0);else if(b.shiftKey&&this._shiftSelectionAnchor){if(e=this._modelIterator.scan(this._shiftSelectionAnchor,c)){this._clearSelection(!0);for(var a=0;a<e.length;a++)this.setSelection(e[a],!0)}}else this.setSelection(c,!1,!0)}},onCollapse:function(c){this._modelIterator.collapse(c)&&this.cursorOn()},onUpArrow:function(c){this.iterate(!1,!1,c.shiftKey,!0);!this._ctrlKeyOn(c)&&
!c.shiftKey&&this.setSelection(this.currentModel(),!1,!0);c.preventDefault();return!1},onDownArrow:function(c){this.iterate(!0,!1,c.shiftKey,!0);!this._ctrlKeyOn(c)&&!c.shiftKey&&this.setSelection(this.currentModel(),!1,!0);c.preventDefault();return!1},_shouldMoveColumn:function(c){var b=this.currentModel(),e=this._getGridChildren(b);return e&&1<e.length?this.isExpandable(b)?this._ctrlKeyOn(c):!0:!1},onLeftArrow:function(c){if(this._shouldMoveColumn(c))return this.moveColumn(null,-1),c.preventDefault(),
!0;var b=this._modelIterator.cursor();if(!b)return!1;if(this.isExpandable(b)&&this.isExpanded(b))return this.explorer.myTree.collapse(b),c.preventDefault(),!0;this._modelIterator.topLevel(b)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(b.parent),this.setSelection(b.parent,!1,!0))},onRightArrow:function(c){if(this._shouldMoveColumn(c))return this.moveColumn(null,1),c.preventDefault(),!0;var b=this._modelIterator.cursor();if(!b)return!1;if(this.isExpandable(b)&&
!this.isExpanded(b))return this.explorer.myTree.expand(b),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(b)),c.preventDefault(),!1},_isRowSelectable:function(c){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(c):!0},onSpace:function(c){this.setSelection(this.currentModel(),!0,!0);c.preventDefault()},onEnter:function(c){var b=this.getCurrentGrid(this._modelIterator.cursor());if(b)if(b.widget)if("function"===typeof b.onClick)b.onClick();else"function"===
typeof b.widget.focus&&b.widget.focus();else{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(c),!1,!1,!1,0,null);b.domNode.dispatchEvent(e)}else if(b=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(e=this.explorer.renderer.getRowActionElement(this.model.getId(b)),e.href&&(this._ctrlKeyOn(c)?window.open(e.href):window.location.href=e.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(c,
b),c.preventDefault(),!1},setIsNotSelectable:function(c,b){c.isNotSelectable=b},disableItem:function(c){var b=this.getRowDiv(c);this.isExpandable(c)&&this.isExpanded(c)&&(this._modelIterator.collapse(c),this.explorer.myTree.toggle(b.id));b.classList.remove("checkedRow");b.classList.add("disabledNavRow");this.setIsNotSelectable(c,!0)},isDisabled:function(c){return c.classList.contains("disabledNavRow")},enableItem:function(c){var b=this.getRowDiv(c);b&&(b.classList.remove("disabledNavRow"),this.setIsNotSelectable(c,
!1))}};return e}();g.ExplorerNavDict=function(){function e(c){this._dict={};this._model=c}e.prototype={addRow:function(c,b){var e=this._model.getId(c);this._dict[e]={model:c,rowDomNode:b}},getValue:function(c){return this._dict[c]},getGridNavHolder:function(c,b){if(!c)return null;var e=this._model.getId(c);return this._dict[e]?(!this._dict[e].gridChildren&&b&&(this._dict[e].gridChildren=[]),this._dict[e].gridChildren):null},initGridNavHolder:function(c){if(!c)return null;c=this._model.getId(c);this._dict[c]&&
(this._dict[c].gridChildren=null)}};return e}();return g});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(k,l,h,g,d,f){var e={};e.Explorer=function(){function c(b,c,a,e){this.registry=b;this.renderer=a;this.selection=c;this.commandService=e;this.renderer&&(this.renderer.explorer=this);this.myTree=null}c.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(b,c){this.myTree&&this.myTree.refresh.bind(this.myTree)(b,c,!0)},updateCommands:function(b){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(b)},makeNewItemPlaceHolder:function(b,c,a,e){b=this.getRow(b);if(a)return b=b.childNodes[a],b.appendChild(document.createElement("br")),e=document.createElement("span"),e.id=c+"placeHolderRow",b.appendChild(e),{tempNode:e,refNode:e};if(b){var d=document.createElement("tr");
d.id=c+"placeHolderRow";a=document.createElement("td");a.id=c+"placeHolderCol";d.appendChild(a);e?(b.parentNode.insertBefore(d,b.nextSibling),b=parseInt(b.firstChild.style.paddingLeft),a.style.paddingLeft=this.myTree.getIndent()+b+"px"):b.appendChild(d);e=h.node(c+"placeHolderRow");b=h.node(c+"placeHolderCol");if(e&&b)return{tempNode:e,refNode:b}}return null},getRow:function(b){if(b=this.model.getId(b))return h.node(b)},collapseAll:function(){for(var b=this._navHandler.getTopLevelNodes(),c=0;c<b.length;c++)this.myTree.collapse(b[c])},
expandAll:function(b){if(b)this._expandRecursively(b);else if(this._navHandler){b=this._navHandler.getTopLevelNodes();for(var c=0;c<b.length;c++)this._expandRecursively(b[c])}},_expandRecursively:function(b){if(this._navHandler&&this._navHandler.isExpandable(b)){var c=this;this.myTree.expand(b,function(){c.model.getChildren(b,function(a){if(!(void 0===a||null===a))for(var b=a.length,e=0;e<b;e++)c._expandRecursively(a[e])})})}},createTree:function(b,c,a){b="string"===typeof b?b:b.id||b;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var e=b+"innerTree",f=h.node(e);f&&h.empty(f);c&&(c.rootId=e);this.model=c;this._parentId=b;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=a?a.selectionPolicy:"",this._navDict=new d.ExplorerNavDict(this.model);this.myTree=new g.TableTree({id:e,model:c,parent:b,onComplete:a?a.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:
!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var b=this.getNavHandler(),c=[];
if(b&&this.getNavDict())for(var a=b.getSelection(),e=0;e<a.length;e++){var d=b.getRowDiv(a[e]);d&&d.parentNode&&(d=this.getNavDict().getValue(this.model.getId(a[e])),d.model&&c.push(d.model))}this.selection.setSelections(c)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var b=this._treeOptions;if(!b||b&&!b.noSelection){this.getNavHandler()||(this._navHandler=b&&b.navHandlerFactory&&"function"===typeof b.navHandlerFactory.createNavHandler?
b.navHandlerFactory.createNavHandler(this,this._navDict,b):new d.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:b?b.getChildrenFunc:null,setFocus:b&&b.setFocus,selectionPolicy:b?b.selectionPolicy:null}));var c=this;this.model.getRoot(function(a){a instanceof Array?c.getNavHandler().refreshModel(c.getNavDict(),c.model,a):a.children&&a.children instanceof Array&&c.getNavHandler().refreshModel(c.getNavDict(),c.model,a.children);b&&b.setFocus&&c.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,
checkbox:!1};return c}();e.createExplorerCommands=function(c,b){function e(a){return"function"===typeof a.getItemCount&&0<a.getItemCount()?b?b(a):!0:!1}var a=new f.Command({tooltip:k["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return e(a)},callback:function(a){a.items.expandAll()}}),d=new f.Command({tooltip:k["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",
visibleWhen:function(a){return e(a)},callback:function(a){a.items.collapseAll()}});c.addCommand(a);c.addCommand(d)};e.ExplorerModel=function(){function c(b,c,a){this.rootPath=b;this.fetchItems=c;this.idPrefix=a||""}c.prototype={destroy:function(){this.destroyed=!0},getRoot:function(b){var c=this;this.fetchItems(this.rootPath).then(function(a){c.root=a;b(a)})},getChildren:function(b,c){b.Children?c(b.Children):b.ChildrenLocation?this.fetchItems(b.ChildrenLocation).then(function(a){b.Children=a;c(a)}):
c([])},getId:function(b){if(b.Location===this.root.Location)return this.rootId;b=b.Location.replace(/[\\\/]/g,"");for(var c=this.idPrefix,a=0;a<b.length;a++)c=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?c+b.charCodeAt(a):c+b[a];return c}};return c}();e.ExplorerFlatModel=function(){function c(b,c,a){this.rootPath=b;this.fetchItems=c;this.root=a}c.prototype=new e.ExplorerModel;c.prototype.getRoot=function(b){if(this.root)b(this.root);else{var c=this;this.fetchItems(this.rootPath).then(function(a){c.root=a;
b(a)})}};c.prototype.getChildren=function(b,c){b===this.root?c(this.root):c([])};return c}();e.ExplorerRenderer=function(){function c(b,c){this.explorer=c;this._init(b);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}c.prototype={_init:function(b){b&&(this._useCheckboxSelection=void 0===b.checkbox?!1:b.checkbox,this.selectionPolicy=b.singleSelection?"singleSelection":
"",this._cachePrefix=b.cachePrefix,this.getCheckedFunc=b.getCheckedFunc,this.onCheckedFunc=b.onCheckedFunc,this._highlightSelection=!0,this._treeTableClass=b.treeTableClass||"treetable",!1===b.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=b.actionScopeId),this.commandService||(this.commandService=b.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(b,c){this.tableTree=c;this.tableNode=b;h.empty(b);this._treeTableClass&&
b.classList.add(this._treeTableClass);this.renderTableHeader(b)},getActionsColumn:function(b,c,a,e,d){a=a||"tool";var f=document.createElement("td");f.id=c.id+"actionswrapper";e&&f.classList.add(e);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,f,b,this.explorer,a,null,d&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(b,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return f},initCheckboxColumn:function(b){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(b,c){if(this._useCheckboxSelection){var a=document.createElement("td"),e=document.createElement("span");e.id=this.getCheckBoxId(c.id);e.classList.add("core-sprite-check");e.classList.add("selectionCheckmarkSprite");e.rowId=c.id;this.getCheckedFunc&&(e.checked=this.getCheckedFunc(b),e.checked?(this._highlightSelection&&c.classList.add("checkedRow"),e.classList.add("core-sprite-check_on")):
(this._highlightSelection&&c.classList.remove("checkedRow"),e.classList.remove("core-sprite-check_on")));a.appendChild(e);var d=this;e.addEventListener("click",function(a){d.onCheck(c,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,c,a,e,d){(c.checked=a)?c.classList.add("core-sprite-check_on"):c.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(c.rowId,a,e);this.explorer.getNavHandler()&&d&&
this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),c=this._getUIStatePreferencePath();c&&window.sessionStorage&&(window.sessionStorage[c+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var c=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&c&&"cursorOnly"!==a.getSelectionPolicy()&&(b=window.sessionStorage[b+
"selection"],"string"===typeof b&&(b=0<b.length?JSON.parse(b):null),b)){for(var e=[],a=0;a<b.length;a++){var d=c.getValue(b[a]);if(d&&d.rowDomNode&&d.model&&(e.push(d.model),this._highlightSelection&&d.rowDomNode.classList.add("checkedRow"),d=h.node(this.getCheckBoxId(d.rowDomNode.id))))d.checked=!0,d.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(e),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var c=!1,a=window.sessionStorage[b+"expanded"];"string"===typeof a&&(a=0<a.length?JSON.parse(a):null);var e;if(a)for(e=0;e<a.length;e++)if(h.node(a[e])){this._expanded.push(a[e]);var d=this;this.tableTree.expand(a[e],function(){d._restoreSelections(b)});c=!0}return!c},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+b+"/uiState"}return null},expandCollapseImageId:function(b){return b+"__expand"},updateExpandVisuals:function(b,c){var a=h.node(this.expandCollapseImageId(b.id));a&&(a.classList.remove(this._expandImageClass),a.classList.remove(this._collapseImageClass),a.classList.remove(this._progressImageClass),a.classList.add("progress"===c?this._progressImageClass:c?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(b,c,a,e){var d=document.createElement("span");
d.id=this.expandCollapseImageId(b.id);c.appendChild(d);d.classList.add(this._twistieSpriteClass);d.classList.add(this._collapseImageClass);if(a){var f=document.createElement("span");c.appendChild(f);f.classList.add(e||"imageSprite");f.classList.add(a)}var g=this;d.onclick=function(a){if(!g.explorer.getNavHandler().isDisabled(b)){g.tableTree.toggle(b.id);if(g.tableTree.isExpanded(b.id))g._expanded.push(b.id),g.explorer.postUserExpand&&g.explorer.postUserExpand(b.id);else for(var c in g._expanded)if(g._expanded[c]===
b.id){g._expanded.splice(c,1);break}(a=g._getUIStatePreferencePath())&&window.sessionStorage&&g._storeExpansions(a)}};return d},render:function(b,c){c.classList.add("navRow");this.renderRow(b,c)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(h.$(".sectionTreeTable",this.tableNode.parentNode)||h.$(".treetable",this.tableNode.parentNode))&&h.$$array(".treeTableRow",this.tableNode).forEach(function(b,c){var a=!(c%
2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",e="darkSectionTreeTableRow"===a?"lightSectionTreeTableRow":"darkSectionTreeTableRow";b.classList.add(a);b.classList.remove(e)})},updateCommands:function(){if(this.commandService)for(var b=h.$$array(".treeTableRow"),c=0;c<b.length;c++){var a=b[c],e=h.node(a.id+"actionswrapper");this.commandService.destroy(e);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,e,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};return c}();e.SelectionRenderer=function(){function c(b,c){this._init(b);this.explorer=c}c.prototype=new e.ExplorerRenderer;c.prototype.renderTableHeader=function(b){var c=document.createElement("thead"),a=document.createElement("tr");c.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var e=0,d=this.getCellHeaderElement(e);d;)0<
d.innerHTML.length&&d.classList.add("navColumn"),a.appendChild(d),d=this.getCellHeaderElement(++e);c.appendChild(a);0<e&&b.appendChild(c)};c.prototype.renderRow=function(b,c){c.verticalAlign="baseline";c.classList.add("treeTableRow");"cursorOnly"!==this.explorer.selectionPolicy&&c.classList.add("selectableNavRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,c);var e=this;c.addEventListener("click",function(a){if(e.explorer.getNavHandler())e.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,
c))a.classList.add("checkColumn"),c.appendChild(a);for(var a=0,d=this.getCellElement(a,b,c);d;)c.appendChild(d),0===a?this.getPrimColumnStyle?d.classList.add(this.getPrimColumnStyle(b)):d.classList.add("navColumn"):this.getSecondaryColumnStyle?d.classList.add(this.getSecondaryColumnStyle()):d.classList.add("secondaryColumn"),d=this.getCellElement(++a,b,c)};c.prototype.getCellHeaderElement=function(b){};c.prototype.getCellElement=function(b,c,a){};return c}();e.SimpleFlatModel=function(){function c(b,
c,a){this.items=b;this.getKey=a;this.idPrefix=c;this.root={children:b}}c.prototype=new e.ExplorerModel;c.prototype.getRoot=function(b){b(this.root)};c.prototype.getId=function(b){b=this.getKey(b).replace(/[\\\/]/g,"");for(var c="",a=0;a<b.length;a++)c=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?c+b.charCodeAt(a):c+b[a];return this.idPrefix+c};c.prototype.getChildren=function(b,c){b===this.root?c(this.items):c([])};return c}();return e});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/webui/littlelib".split(" "),function(k,l,h,g,d,f,e,c){function b(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function n(a,c,g,n,h,k,x,y,A){c=f.clone(c);var q;if(c.Directory)q=document.createElement("a"),
q.className="navlinkonpage",q.href=!a?m:(new e(a+"#{,resource,params*}")).expand({resource:c.ChildrenLocation}),c.Name&&q.appendChild(document.createTextNode(c.Name));else{h||(h=d.getOpenWithCommands(g));q=document.createElement("a");q.className="navlink targetSelector";k&&"object"===typeof k&&Object.keys(k).forEach(function(a){q[a]=k[a]});var B=null,z=null;if(B=y?y.holderDom:q)z=document.createElement("span"),z.className="core-sprite-file modelDecorationSprite thumbnail",B.appendChild(z);c.Name&&
q.appendChild(document.createTextNode(c.Name));var C=c.Location;x&&"object"===typeof x&&(c.params={},f.mixin(c.params,x));(a=d.getOpenWithCommand(g,c,h))&&(C=a.hrefCallback({items:c}));l.when(n.getFileContentType(c),function(a){if(B){var e=B,d=z;if(a){var f,g=a.imageClass,m=a.image;g?(f=document.createElement("span"),f.className+=g,f.classList.add("thumbnail")):m&&(f=document.createElement("img"),f.src=m,f.classList.add("thumbnail"));f&&e.replaceChild(f,d)}}q.href=C;A&&"function"===typeof A.updateFileNode&&
A.updateFileNode(c,q,b(a))})}q.addEventListener("click",function(){s=c}.bind(this),!1);return q}function a(a,b,c,e){this.explorer=b;this.commandService=c;this.contentTypeService=e;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var m=new e("#{,resource,params*}"),s;a.prototype=new h.SelectionRenderer;a.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};a.prototype.tableCallback=function(a){a.setAttribute("aria-label",k.Navigator);a.setAttribute("role",
"presentation")};a.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};a.prototype.emptyCallback=function(a){var b=document.createElement("tr"),e=document.createElement("td");e.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=k.NoFile;var f=document.createElement("span");f.appendChild(document.createTextNode(k.File));c.processDOMNodes(d,[f]);e.appendChild(d);b.appendChild(e);a.appendChild(b)};a.prototype.getCellHeaderElement=
function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};a.prototype.setTarget=function(a){this.target=a};a.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};a.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=n(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&
b.insertBefore(a,b.firstChild)):(b=document.createElement("span"),b.textContent=a.Name);return b};a.prototype.updateFileNode=function(a,b,c){};a.prototype.showFolderLinks=!0;a.prototype.getCellElement=function(a,b,c){switch(a){case 0:a=document.createElement("td");var e=document.createElement("span");e.id=c.id+"MainCol";e.setAttribute("role","presentation");a.appendChild(e);a.setAttribute("role","presentation");e.className="mainNavColumn";var f;b.Directory?(this.getExpandImage(c,e),f=this.createFolderNode(b),
e.appendChild(f),this.explorer._makeDropTarget(b,f),this.explorer._makeDropTarget(b,c)):(this.openWithCommands||(this.openWithCommands=d.getOpenWithCommands(this.commandService)),f=n("",b,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this),e.appendChild(f));f&&(f.id=c.id+"NameLink",1===f.nodeType&&(g.addNavGrid(this.explorer.getNavDict(),b,f),f.setAttribute("role","link"),f.setAttribute("tabindex","-1")));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,
e,b,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;c=document.createElement("td");b.LocalTimeStamp&&(c.textContent=(new Date(b.LocalTimeStamp)).toLocaleString());return c;case 2:if(this.oneColumn)return null;c=document.createElement("td");!b.Directory&&"number"===typeof b.Length&&(b=parseInt(b.Length,10)/1024,c.textContent=Math.ceil(b).toLocaleString()+" KB");c.style.textAlign="right";return c}};a.prototype.constructor=a;return{NavigatorRenderer:a,isImage:b,getClickedItem:function(){return s},
createLink:n}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(k,l,h,g,d,f,e,c,b){function n(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new n(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}n.prototype.makeRenderFunction=function(a,f,n,p,r){var u=this.serviceRegistry,w=this.commandRegistry;this.openWithCommands=this.openWithCommands||c.createOpenWithCommands(u,a,w);var v=this;return function(c,u,A,q){b.when(v.openWithCommands,function(b){if(A)h.empty(f),b=document.createElement("div"),b.appendChild(document.createTextNode(k["Search failed."])),f.appendChild(b),"function"===typeof p&&p(f);else{var z=
function(){function a(b,c){var e=c.folderName?c.folderName:c.path,d=document.createElement("span");d.id=e.replace(/[^a-zA-Z0-9_\.:\-]/g,"");d.appendChild(document.createTextNode(" - "+e+" "));b.appendChild(d)}var b={};return function(c,e){var d=e.name;if(b.hasOwnProperty(d)){a(c,e);var q=b[d];"function"===typeof q&&(b[d]=null,q())}else b[d]=function(){a(c,e)}}}(),C=!1;h.empty(f);if(c&&0<c.length){var L=document.createElement("table");L.setAttribute("role","presentation");for(var G=0;G<c.length;G++){var E=
c[G],I;C||(C=!0,n&&(I=L.insertRow(0).insertCell(0),I.textContent=n));I=L.insertRow(-1).insertCell(0);I.colspan=2;r&&r(I);var v={Name:E.name,Directory:E.directory,Location:E.path||E.location},H=null;"number"===typeof E.LineNumber&&(H={},H.line=E.LineNumber);if(q&&q.keyword&&!q.nameSearch){var Q=d.generateSearchHelper(q),H=H||{};H.find=Q.inFileQuery.searchStr;H.regEx=Q.inFileQuery.wildCard?!0:void 0}v=e.createLink(l.toUrl("edit/edit.html"),v,w,a,b,{"aria-describedby":(E.folderName?E.folderName:E.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},H);E.LineNumber&&v.appendChild(document.createTextNode(" (Line "+E.LineNumber+")"));I.appendChild(v);z(I,E)}f.appendChild(L);"function"===typeof p&&p(f)}!C&&u&&(b=g.formatMessage(k["No matches found for ${0}"],u),h.empty(f),f.appendChild(document.createTextNode(b)),"function"===typeof p&&p(f))}})}};a.prototype={search:function(a,b,c){var e=function(a){for(var c=[],e=0;e<a.response.docs.length;e++){var f=a.response.docs[e],g=f.Location,m=d.path2FolderName(f.Path?
f.Path:f.Location,f.Name),q=m?m:g;(b?0<=q.indexOf(b):1)&&c.push({name:f.Name,path:g,folderName:m,directory:f.Directory,lineNumber:f.LineNumber})}return c};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){c(e(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var d=a.keyword,d=d.substring(d.indexOf("}")+1),d=d.substring(d.indexOf(":")+1);c(e(b),d,null,a)},function(a){c(null,
null,a,null)})}catch(g){"string"===typeof g&&-1<g.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){c(e(b),null,null,a)}):"string"===typeof g&&-1<g.indexOf("search")&&!a.nameSearch?(new f.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){c(e(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(g)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);h.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var c="",e=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?e="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(e=a);e?(this.setLocationbyURL(e.Location),c=e.Name,this._childrenLocation=e.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
c=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);e=h.node("search");c||(c="");if(e&&e.placeholder){e.value="";var d=g.formatMessage(k["Search ${0}"],c);e.placeholder=30<d.length?d.substring(0,27)+"...":g.formatMessage(k["Search ${0}"],c)}e&&e.title&&(e.title=k["Type a keyword or wild card to search in "]+c)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,c,e){c=c?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:c,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:c,sort:e&&e.sort?e.sort:"Path asc",rows:e&&e.rows?e.rows:40,start:0,caseSensitive:e?e.caseSensitive:void 0,regEx:e?e.regEx:void 0,fileType:e?e.fileType:void 0,keyword:a,replace:e?e.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/links",[],function(){function k(k){this._init(k)}k.prototype={_init:function(k){this._registry=k.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.textlink",this)},_replaceLink:function(k,h,g,d,f){var e=k.search(g);0<e&&(h.appendChild(document.createTextNode(k.substring(0,e))),k=k.substring(e));g=k.replace(g,"");var e=k.substring(0,k.length-g.length),c=e.split(" ",d);if(c.length===d){k=document.createElement("a");for(var b=0;b<d;b++)f=f.replace("%"+
(b+1),c[b]);k.setAttribute("href",f);k.textContent=e;h.appendChild(k);k=g}return k},addLinks:function(k,h){var g=h||document.createElement("div"),d=this._registry.getServiceReferences("orion.core.linkScanner");if(0<d.length)for(var f=d[0],d=RegExp(f.getProperty("pattern"),"i"),e=f.getProperty("words"),f=f.getProperty("anchor"),c=k.search(d);0<=c;)k=this._replaceLink(k,g,d,e,f),c=k.search(d);0<k.length&&g.appendChild(document.createTextNode(k));return g}};k.prototype.constructor=k;return{TextLinkService:k}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(k,l){function h(d,f,e,c){k("GET",d,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=b.response?JSON.parse(b.response):null;f.progress(b);!b.type||"loadstart"===b.type||"progress"===b.type?setTimeout(function(){h(d,f,e,c)},2E3):("error"===b.type||"abort"===b.type?f.reject(c?c(b):b.Result):f.resolve(e?e(b):b.Result.JsonData),b.Location||k("DELETE",d,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(b){var c=b;if(void 0!==
b.responseText){c=b.responseText;try{c=JSON.parse(b.responseText)}catch(a){}}void 0!==c.Message?(c.HttpCode=void 0===c.HttpCode?b.status:c.HttpCode,c.Severity=void 0===c.Severity?"Error":c.Severity,f.reject(c)):f.reject({Severity:"Error",Message:c,HttpCode:b.status})})}function g(d,f){f.then(null,function(e){e instanceof Error&&"Cancel"===e.name&&k("PUT",d,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(d,f,e){var c=new l;g(d,c);h(d,c,f,e);return c}}});
define("orion/cfui/cFClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(k,l,h,g){var d=d||{};d.CFService=function(){function d(e){e&&(this._serviceRegistry=e,this._serviceRegistration=e.registerService("orion.cf.service",this))}d.prototype={_getServiceResponse:function(e,c){var b=c.response?JSON.parse(c.response):null;if(c.xhr&&202===c.xhr.status){var d=g.handle(b.Location);d.then(function(a){try{e.resolve(JSON.parse(a))}catch(b){e.resolve(a)}},function(a){a.failedOperation=
b.Location;e.reject(a)},e.progress);e.then(null,function(a){d.reject(a)})}else e.resolve(b)},_handleServiceResponseError:function(e,c){e.reject(this._translateResponseToStatus(c))},_translateResponseToStatus:function(e){var c;try{c=JSON.parse(e.responseText)}catch(b){c={Message:messages["Problem while performing the action"]}}c.HttpCode=e.status;return c},_xhrV1:function(e,c,b){var d=this,a=new h;l(e,c,{headers:{"CF-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify(b)}).then(function(b){d._getServiceResponse(a,b)},function(b){d._handleServiceResponseError(a,b)});return a},setTarget:function(e,c,b){e={Url:e};c&&(e.Org=c);b&&(e.Space=b);return this._xhrV1("POST",k.toUrl("cfapi/target"),e)},login:function(e,c,b,d,a){d={};e&&(d.Url=e);c&&(d.Username=c,d.Password=b);return this._xhrV1("POST",k.toUrl("cfapi/target"),d)},logout:function(){return this._xhrV1("DELETE",k.toUrl("cfapi/target"))},getLogs:function(e,c,b,d){c||(new h).reject("Application name not set");
c=k.toUrl("cfapi/logs/"+c);b&&(c+="/"+b);d&&(c+="/"+d);e&&(c+="?Target\x3d"+JSON.stringify(e));return this._xhrV1("GET",c)},getTarget:function(){return this._xhrV1("GET",k.toUrl("cfapi/target"))},getInfo:function(){return this._xhrV1("GET",k.toUrl("cfapi/info"))},pushApp:function(e,c,b){c={Name:c,ContentLocation:b};e&&(c.Target=e);return this._xhrV1("PUT",k.toUrl("cfapi/apps"),c)},getApp:function(e,c,b){var d=k.toUrl("cfapi/apps");c?d+="?Name\x3d"+c:location&&(d+="?ContentLocation\x3d"+b);e&&(d+=
"\x26Target\x3d"+JSON.stringify(e));return this._xhrV1("GET",d)},getApps:function(){return this._xhrV1("GET",k.toUrl("cfapi/apps"))},startApp:function(e,c,b,d){c={Name:c,ContentLocation:b,Timeout:d,State:"Started"};e&&(c.Target=e);return this._xhrV1("PUT",k.toUrl("cfapi/apps"),c)},stopApp:function(e,c,b){c={Name:c,ContentLocation:b,State:"Stopped"};e&&(c.Target=e);return this._xhrV1("PUT",k.toUrl("cfapi/apps"),c)},getOrgs:function(e){var c=k.toUrl("cfapi/orgs");e&&(c+="?Target\x3d"+JSON.stringify(e));
return this._xhrV1("GET",c)}};return d}();return d});
define("orion/cfui/logsExplorer",["orion/webui/littlelib","orion/explorers/explorer","orion/objects","orion/URITemplate"],function(k,l,h,g){function d(c,b){this.root=c;this.numberOfInstances=Object.keys(this.root.logs).length;this.prefix=b}function f(c,b){this._init(c);this.explorer=b;this.commandService=c.commandRegistry;this.actionScopeId=c.actionScopeId;this.colorLightDarkRows=c.isMiniNav}function e(c,b,e,a,d,g){this.parent=a;this.titleNode=d;l.Explorer.apply(this,[c,b,new f({singleSelection:!0,
checkbox:!1,commandRegistry:e,isMiniNav:g},this),e])}d.prototype=new l.ExplorerModel;h.mixin(d.prototype,{getRoot:function(c){c(this.root)},getChildren:function(c,b){if(c===this.root)if(1===this.numberOfInstances){var e=Object.keys(this.root.logs)[0];this.root.children=this.root.logs[e];this.root.children.forEach(function(a){a.parent=this.root;a.Target=this.root.Target;a.Instance=e}.bind(this));b(this.root.children)}else{var a=[],d;for(d in this.root.logs)a.push({Instance:d,Children:this.root.logs[d],
Type:"Instance",parent:c});this.root.children=a;b(a)}else c.Instance?(a=c.Children,a.forEach(function(a){a.parent=c;a.Instance=c.Instance;a.Target=this.root.Target}.bind(this)),c.children=a,b(a)):b([])},getId:function(c){return c===this.root?this.prefix+this.root.Application:c.Instance&&c.Children?this.prefix+this.root.Application+"_"+c.Instance:c.Instance&&c.Name?this.prefix+this.root.Application+"_"+c.Instance+"_"+c.Name:this.prefix+this.root.Application+"_"+c.Name},constructor:d});f.prototype=
new l.SelectionRenderer;f.prototype.constructor=f;h.mixin(f.prototype,{getCellElement:function(c,b,e){if(0!==c)return null;c=document.createElement("td");var a=document.createElement("span");a.id=e.id+"MainCol";a.setAttribute("role","presentation");c.appendChild(a);c.setAttribute("role","presentation");a.className="mainNavColumn";if("Log"===b.Type){e=document.createElement("span");e.className="coreImageSprite core-sprite-file";e.style.paddingLeft="16px";a.appendChild(e);e=document.createElement("a");
e.appendChild(document.createTextNode(b.Name));var d=b.Target?h.clone(b.Target):{};h.mixin(d,{instance:b.Instance,log:b.Name});e.href=(new g("#{,resource,params*}")).expand({resource:b.Application,params:d});a.appendChild(e)}else"Instance"===b.Type&&(this.getExpandImage(e,a),a.appendChild(document.createTextNode("Instance: "+b.Instance)));c.appendChild(a);return c},rowsChanged:function(){l.SelectionRenderer.prototype.rowsChanged.apply(this,arguments);this.colorLightDarkRows&&(k.$$array(".darkSectionTreeTableRow",
this.tableNode).forEach(function(c,b){c.classList.remove("darkSectionTreeTableRow")}),k.$$array(".lightSectionTreeTableRow",this.tableNode).forEach(function(c,b){c.classList.remove("lightSectionTreeTableRow")}))},prototype:f});e.prototype=Object.create(l.Explorer.prototype);h.mixin(e.prototype,{load:function(c){this.logs=c;if(c.Application&&this.titleNode){k.empty(this.titleNode);var b=document.createElement("span");b.id="LogsNavigationTitle";b.className="filesystemName layoutLeft";b.appendChild(document.createTextNode(c.Application));
this.titleNode.appendChild(b)}c=new d(c,this.parent.id);this.createTree(this.parent,c,{indent:"8px"});this.initNavHandler()},constructor:e});return{LogsExplorer:e}});define("orion/editor/i18n",{load:function(k,l,h,g){l.specified&&l.specified("orion/bootstrap")?l(["orion/i18n!"+k],function(d){h(d)}):h({})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",replaceAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"});
define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(k,l){var h={root:l},g;for(g in k)k.hasOwnProperty(g)&&"undefined"===typeof h[g]&&(h[g]=k[g]);return h});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(k,l,h){function g(d,f){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(d);this.setLineDelimiter(f)}g.prototype={destroy:function(){},find:function(d){1<this._text.length&&(this._text=[this._text.join("")]);var f=d.string,e=d.regex,c=f,b="",g=d.caseInsensitive;if(c)if(e){if(f=l.parse(c))c=f.pattern,b=f.flags}else c=f.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),g&&(c=c.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var a=null,m;if(c){var f=d.reverse,h=d.wrap,e=d.wholeWord,k=d.start||0;d=d.end;var p=null!==d&&void 0!==d;-1===b.indexOf("g")&&(b+="g");-1===b.indexOf("m")&&(b+="m");g&&-1===b.indexOf("i")&&(b+="i");e&&(c="\\b"+c+"\\b");var r=this._text[0],u,w,v=0;p&&(g=k<d?k:d,r=r.substring(g,k<d?d:k),v=g);var x=RegExp(c,b);f?m=function(){var a=null;for(x.lastIndex=0;;){w=x.lastIndex;u=x.exec(r);if(w===x.lastIndex)return null;if(u){if(!(u.index+v<k)){if(!h||a)break;k=r.length+v}a={start:u.index+
v,end:x.lastIndex+v}}else break}a&&(k=a.start);return a}:(p||(x.lastIndex=k),m=function(){for(;;){w=x.lastIndex;u=x.exec(r);if(w===x.lastIndex)break;if(u)return{start:u.index+v,end:x.lastIndex+v};if(!(0!==w&&h))break}return null});a=m()}return{next:function(){var b=a;b&&(a=m());return b},hasNext:function(){return null!==a}}},getCharCount:function(){for(var d=0,f=0;f<this._text.length;f++)d+=this._text[f].length;return d},getLine:function(d,f){var e=this.getLineCount();if(!(0<=d&&d<e))return null;
var c=this._lineOffsets[d];if(d+1<e){e=this.getText(c,this._lineOffsets[d+1]);if(f)return e;for(var c=e.length,b;10===(b=e.charCodeAt(c-1))||13===b;)c--;return e.substring(0,c)}return this.getText(c)},getLineAtOffset:function(d){var f=this.getCharCount();if(!(0<=d&&d<=f))return-1;var e=this.getLineCount();if(d===f)return e-1;var c,b,g=this._lastLineIndex;if(0<=g&&g<e&&(c=this._lineOffsets[g],b=g+1<e?this._lineOffsets[g+1]:f,c<=d&&d<b))return g;for(var a=e,m=-1;1<a-m;)if(g=Math.floor((a+m)/2),c=this._lineOffsets[g],
b=g+1<e?this._lineOffsets[g+1]:f,d<=c)a=g;else if(d<b){a=g;break}else m=g;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(d,f){var e=this.getLineCount();if(!(0<=d&&d<e))return-1;if(d+1<e){e=this._lineOffsets[d+1];if(f)return e;for(var c=this.getText(Math.max(this._lineOffsets[d],e-2),e),b=c.length,g;10===(g=c.charCodeAt(b-1))||13===g;)b--;return e-(c.length-b)}return this.getCharCount()},
getLineStart:function(d){return!(0<=d&&d<this.getLineCount())?-1:this._lineOffsets[d]},getText:function(d,f){void 0===d&&(d=0);void 0===f&&(f=this.getCharCount());if(d===f)return"";for(var e=0,c=0,b;c<this._text.length;){b=this._text[c].length;if(d<=e+b)break;e+=b;c++}for(var g=e,a=c;c<this._text.length;){b=this._text[c].length;if(f<=e+b)break;e+=b;c++}if(a===c)return this._text[a].substring(d-g,f-e);g=this._text[a].substring(d-g);e=this._text[c].substring(0,f-e);return g+this._text.slice(a+1,c).join("")+
e},onChanging:function(d){return this.dispatchEvent(d)},onChanged:function(d){return this.dispatchEvent(d)},setLineDelimiter:function(d,f){"auto"===d&&(d=void 0,1<this.getLineCount()&&(d=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=d?d:h.platformDelimiter;if(f){var e=this.getLineCount();if(1<e){for(var c=Array(e),b=0;b<e;b++)c[b]=this.getLine(b);this.setText(c.join(this._lineDelimiter))}}},setText:function(d,f,e){void 0===d&&(d="");void 0===f&&(f=0);void 0===e&&(e=
this.getCharCount());if(!(f===e&&""===d)){for(var c=this.getLineAtOffset(f),b=this.getLineAtOffset(e),g=f,a=e-f,m=b-c,k=d.length,h=0,p=this.getLineCount(),r=0,u=0,l=0,v=[];;){-1!==r&&r<=l&&(r=d.indexOf("\r",l));-1!==u&&u<=l&&(u=d.indexOf("\n",l));if(-1===u&&-1===r)break;l=-1!==r&&-1!==u?r+1===u?u+1:(r<u?r:u)+1:-1!==r?r+1:u+1;v.push(f+l);h++}this.onChanging({type:"Changing",text:d,start:g,removedCharCount:a,addedCharCount:k,removedLineCount:m,addedLineCount:h});0===v.length&&(l=this.getLineStart(c),
b=b+1<p?this.getLineStart(b+1):this.getCharCount(),f!==l&&(d=this.getText(l,f)+d,f=l),e!==b&&(d+=this.getText(e,b),e=b));l=k-a;for(b=c+m+1;b<p;b++)this._lineOffsets[b]+=l;if(5E4>v.length)c=[c+1,m].concat(v),Array.prototype.splice.apply(this._lineOffsets,c);else{l=c+1;this._lineOffsets.splice(l,m);for(p=0;p<v.length;p+=5E4)c=[l,0].concat(v.slice(p,Math.min(v.length,p+5E4))),Array.prototype.splice.apply(this._lineOffsets,c),l+=5E4}for(l=p=0;l<this._text.length;){b=this._text[l].length;if(f<=p+b)break;
p+=b;l++}c=p;for(v=l;l<this._text.length;){b=this._text[l].length;if(e<=p+b)break;p+=b;l++}b=this._text[l];f=this._text[v].substring(0,f-c);e=b.substring(e-p);v=[v,l-v+1];f&&v.push(f);d&&v.push(d);e&&v.push(e);Array.prototype.splice.apply(this._text,v);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:g,removedCharCount:a,addedCharCount:k,removedLineCount:m,addedLineCount:h})}}};k.EventTarget.addMixin(g.prototype);return{TextModel:g}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(k,l){function h(d){d&&(this._view=d,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function g(d){h.call(this,d)}h.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(d){for(var f=[],e=this._keyBindings,c=0;c<e.length;c++)e[c].actionID===d&&f.push(e[c].keyBinding);return f},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(d){if("keydown"===
d.type)switch(d.keyCode){case 16:case 17:case 18:case 91:return}for(var f=this._keyBindingIndex,e=this._matchingKeyBindings||this._keyBindings,c=[],b=0;b<e.length;b++){var g=e[b],a=g.keyBinding.match(d,f);if(!0===a)return this._keyBindingIndex=0,this._matchingKeyBindings=null,g.actionID;"number"===typeof a&&c.push(g)}if(0===c.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=c,"noop"},setKeyBinding:function(d,f){for(var e=this._keyBindings,
c=0;c<e.length;c++){var b=e[c];if(b.keyBinding.equals(d)){f?b.actionID=f:b.predefined?b.actionID="noop":e.splice(c,1);return}}f&&e.push({keyBinding:d,actionID:f})},setView:function(d){this._view=d}};g.prototype=new h;g.prototype.createKeyBindings=function(){var d=k.KeyBinding,f=[];f.push({actionID:"lineUp",keyBinding:new d(38),predefined:!0});f.push({actionID:"lineDown",keyBinding:new d(40),predefined:!0});f.push({actionID:"charPrevious",keyBinding:new d(37),predefined:!0});f.push({actionID:"charNext",
keyBinding:new d(39),predefined:!0});l.isMac?(f.push({actionID:"scrollPageUp",keyBinding:new d(33),predefined:!0}),f.push({actionID:"scrollPageDown",keyBinding:new d(34),predefined:!0}),f.push({actionID:"pageUp",keyBinding:new d(33,null,null,!0),predefined:!0}),f.push({actionID:"pageDown",keyBinding:new d(34,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new d(37,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new d(39,!0),predefined:!0}),f.push({actionID:"wordPrevious",
keyBinding:new d(37,null,null,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new d(39,null,null,!0),predefined:!0}),f.push({actionID:"scrollTextStart",keyBinding:new d(36),predefined:!0}),f.push({actionID:"scrollTextEnd",keyBinding:new d(35),predefined:!0}),f.push({actionID:"textStart",keyBinding:new d(38,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new d(40,!0),predefined:!0}),f.push({actionID:"scrollPageUp",keyBinding:new d(38,null,null,null,!0),predefined:!0}),f.push({actionID:"scrollPageDown",
keyBinding:new d(40,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new d(37,null,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new d(39,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new d(38,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new d(40,null,null,!0),predefined:!0})):(f.push({actionID:"pageUp",keyBinding:new d(33),predefined:!0}),f.push({actionID:"pageDown",keyBinding:new d(34),predefined:!0}),
f.push({actionID:"lineStart",keyBinding:new d(36),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new d(35),predefined:!0}),f.push({actionID:"wordPrevious",keyBinding:new d(37,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new d(39,!0),predefined:!0}),f.push({actionID:"textStart",keyBinding:new d(36,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new d(35,!0),predefined:!0}));l.isFirefox&&l.isLinux&&(f.push({actionID:"lineUp",keyBinding:new d(38,!0),predefined:!0}),f.push({actionID:"lineDown",
keyBinding:new d(40,!0),predefined:!0}));l.isWindows&&(f.push({actionID:"scrollLineUp",keyBinding:new d(38,!0),predefined:!0}),f.push({actionID:"scrollLineDown",keyBinding:new d(40,!0),predefined:!0}));f.push({actionID:"selectLineUp",keyBinding:new d(38,null,!0),predefined:!0});f.push({actionID:"selectLineDown",keyBinding:new d(40,null,!0),predefined:!0});f.push({actionID:"selectCharPrevious",keyBinding:new d(37,null,!0),predefined:!0});f.push({actionID:"selectCharNext",keyBinding:new d(39,null,!0),
predefined:!0});f.push({actionID:"selectPageUp",keyBinding:new d(33,null,!0),predefined:!0});f.push({actionID:"selectPageDown",keyBinding:new d(34,null,!0),predefined:!0});l.isMac?(f.push({actionID:"selectLineStart",keyBinding:new d(37,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new d(39,!0,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",keyBinding:new d(37,null,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new d(39,null,!0,!0),predefined:!0}),
f.push({actionID:"selectTextStart",keyBinding:new d(36,null,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new d(35,null,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new d(38,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new d(40,!0,!0),predefined:!0}),f.push({actionID:"selectLineStart",keyBinding:new d(37,null,!0,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new d(39,null,!0,null,!0),predefined:!0}),f.push({actionID:"selectLineStart",
keyBinding:new d(38,null,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new d(40,null,!0,!0),predefined:!0})):(l.isLinux&&(f.push({actionID:"selectWholeLineUp",keyBinding:new d(38,!0,!0),predefined:!0}),f.push({actionID:"selectWholeLineDown",keyBinding:new d(40,!0,!0),predefined:!0})),f.push({actionID:"selectLineStart",keyBinding:new d(36,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new d(35,null,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",
keyBinding:new d(37,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new d(39,!0,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new d(36,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new d(35,!0,!0),predefined:!0}));f.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});l.isMac?f.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):f.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0});
f.push({actionID:"deletePrevious",keyBinding:new d(8),predefined:!0});f.push({actionID:"deletePrevious",keyBinding:new d(8,null,!0),predefined:!0});f.push({actionID:"deleteNext",keyBinding:new d(46),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new d(8,!0,!0),predefined:!0});f.push({actionID:"deleteWordNext",keyBinding:new d(46,!0),predefined:!0});f.push({actionID:"tab",keyBinding:new d(9),predefined:!0});
f.push({actionID:"shiftTab",keyBinding:new d(9,null,!0),predefined:!0});f.push({actionID:"enter",keyBinding:new d(13),predefined:!0});f.push({actionID:"enter",keyBinding:new d(13,null,!0),predefined:!0});f.push({actionID:"selectAll",keyBinding:new d("a",!0),predefined:!0});f.push({actionID:"toggleTabMode",keyBinding:new d("m",!0),predefined:!0});l.isMac&&(f.push({actionID:"deleteNext",keyBinding:new d(46,null,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new d(8,null,null,!0),
predefined:!0}),f.push({actionID:"deleteWordNext",keyBinding:new d(46,null,null,!0),predefined:!0}));f.push({actionID:"toggleWrapMode",keyBinding:new k.KeyBinding("w",!0,!1,!0)});f.push({actionID:"toggleOverwriteMode",keyBinding:new k.KeyBinding(45)});if(!l.isFirefox){var e=l.isMac&&l.isChrome;f.push({actionID:"noop",keyBinding:new d("u",!e,!1,!1,e),predefined:!0});f.push({actionID:"noop",keyBinding:new d("i",!e,!1,!1,e),predefined:!0});f.push({actionID:"noop",keyBinding:new d("b",!e,!1,!1,e),predefined:!0})}l.isFirefox&&
(f.push({actionID:"copy",keyBinding:new d(45,!0),predefined:!0}),f.push({actionID:"paste",keyBinding:new d(45,null,!0),predefined:!0}),f.push({actionID:"cut",keyBinding:new d(46,null,!0),predefined:!0}));l.isMac&&(f.push({actionID:"lineStart",keyBinding:new d("a",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new d("e",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineUp",keyBinding:new d("p",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineDown",keyBinding:new d("n",!1,!1,
!1,!0),predefined:!0}),f.push({actionID:"charPrevious",keyBinding:new d("b",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"charNext",keyBinding:new d("f",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deletePrevious",keyBinding:new d("h",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteNext",keyBinding:new d("d",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineEnd",keyBinding:new d("k",!1,!1,!1,!0),predefined:!0}),l.isFirefox?(f.push({actionID:"scrollPageDown",keyBinding:new d("v",!1,
!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineStart",keyBinding:new d("u",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new d("w",!1,!1,!1,!0),predefined:!0})):(f.push({actionID:"pageDown",keyBinding:new d("v",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"centerLine",keyBinding:new d("l",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"enterNoCursor",keyBinding:new d("o",!1,!1,!1,!0),predefined:!0})));return f};return{KeyMode:h,DefaultKeyMode:g}});
define("orion/editor/util",[],function(){return{contains:function(k,l){if(!l)return!1;if(!k.compareDocumentPosition){for(var h=l;h;){if(k===h)return!0;h=h.parentNode}return!1}return k===l||0!==(k.compareDocumentPosition(l)&16)},addEventListener:function(k,l,h,g){"function"===typeof k.addEventListener?k.addEventListener(l,h,!0===g):k.attachEvent("on"+l,h)},removeEventListener:function(k,l,h,g){"function"===typeof k.removeEventListener?k.removeEventListener(l,h,!0===g):k.detachEvent("on"+l,h)}}});
define("orion/editor/textView","i18n!orion/editor/nls/messages orion/editor/textModel orion/editor/keyModes orion/editor/eventTarget orion/editor/textTheme orion/editor/util orion/util".split(" "),function(k,l,h,g,d,f,e){function c(a,b,c){if(c){b.className="";c=b.attributes;for(var d=c.length;0<d--;)(!e.isIE||9<=e.isIE||9>e.isIE&&c[d].specified)&&b.removeAttribute(c[d].name)}if(a){a.styleClass&&(b.className=a.styleClass);if(c=a.style)for(var f in c)c.hasOwnProperty(f)&&(b.style[f]=c[f]);if(a=a.attributes)for(var g in a)a.hasOwnProperty(g)&&
b.setAttribute(g,a[g])}}function b(a){return a instanceof Array?a.slice(0):a}function n(a,b){if(!a)return b;if(!b)return a;for(var c in b)b.hasOwnProperty(c)&&(a.hasOwnProperty(c)||(a[c]=b[c]));return a}function a(b,c){if(b===c)return!0;if(b&&!c||!b&&c||b&&b.constructor===String||c&&c.constructor===String)return!1;if(b instanceof Array||c instanceof Array){if(!(b instanceof Array&&c instanceof Array)||b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!a(b[e],c[e]))return!1;return!0}if(!(b instanceof
Object)||!(c instanceof Object))return!1;for(e in b)if(b.hasOwnProperty(e)&&(!c.hasOwnProperty(e)||!a(b[e],c[e])))return!1;for(e in c)if(!b.hasOwnProperty(e))return!1;return!0}function m(a,b,c){for(var e=0,d=0,f=0,g=a.length;f<g;){-1!==e&&e<=f&&(e=a.indexOf("\r",f));-1!==d&&d<=f&&(d=a.indexOf("\n",f));var m=f,p;if(-1===d&&-1===e){b(a.substring(f));break}-1!==e&&-1!==d?e+1===d?(p=e,f=d+1):(p=e<d?e:d,f=(e<d?e:d)+1):-1!==e?(p=e,f=e+1):(p=d,f=d+1);b(a.substring(m,p));c()}}function s(a){var b,c,e,d,f=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),c=a.getPropertyValue("padding-top"),e=a.getPropertyValue("padding-right"),d=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,c=a.currentStyle.paddingTop,e=a.currentStyle.paddingRight,d=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(c,10)||0,right:parseInt(e,10)||0,bottom:parseInt(d,10)||0}}function t(a){var b,
c,e,d,f=a._trim;if(!f){var f=s(a),g=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;g.getComputedStyle?(d=g.getComputedStyle(a,null),b=d.getPropertyValue("border-left-width"),c=d.getPropertyValue("border-top-width"),e=d.getPropertyValue("border-right-width"),d=d.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,c=a.currentStyle.borderTopWidth,e=a.currentStyle.borderRightWidth,d=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;c=parseInt(c,10)||
0;e=parseInt(e,10)||0;d=parseInt(d,10)||0;f.left+=b;f.top+=c;f.right+=e;f.bottom+=d;a._trim=f}return f}function p(a,b,c,e){function d(b){if(b.animationName===g){var c=b.target;"function"===typeof c.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){c.__DOMReady()},0)}}function f(a,b){for(var c=["","-webkit-","-moz-","-ms-","-o-"],e="",d="body ."+a+" {\n",q=0;q<c.length;q++)e+="@"+c[q]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",d+=c[q]+"animation-duration: 0.001s;\n"+
c[q]+"animation-name: "+b+";\n";return e+(d+"}")}c="_"+c+"DOMReady";b.className=b.className?b.className+" "+c:c;b.__DOMReady=e;e=c+"Style";if(!a.getElementById(e)){var g=c+"Animation";a.addEventListener("animationstart",d,!1);a.addEventListener("MSAnimationStart",d,!1);a.addEventListener("webkitAnimationStart",d,!1);b=a.createElement("style");b.id=e;e=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(f(c,g)));e.insertBefore(b,e.firstChild)}}function r(a,b,c){this.start=
a;this.end=b;this.caret=c}function u(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function w(a,b,c){this.view=a;this.lineIndex=b;this._lineDiv=c}function v(a){this._init(a||{})}var x=f.addEventListener,y=f.removeEventListener,A=function(){function a(b){this.options=b}a.prototype.play=function(){var a="number"===typeof this.options.duration?this.options.duration:350,b=this.options.easing||this.defaultEasing,c=this.options.onAnimate||function(){},e=this.options.curve[0],
d=this.options.curve[1],q=d-e,f=-1,g,m=this;this.interval=this.options.window.setInterval(function(){f=-1===f?(new Date).getTime():f;var p=((new Date).getTime()-f)/a;1>p?(p=b(p),g=e+p*q,c(g)):(c(d),m.stop())},"number"===typeof this.options.rate?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();r.prototype={clone:function(){return new r(this.start,
this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;this.start>this.end&&(a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret)},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===
this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};u.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};w.prototype={create:function(a,b){if(!this._lineDiv){var c=this._lineDiv=this._createLine(a,b,this.lineIndex);c._line=this;return c}},_createLine:function(b,d,f){var g=this.view,m=g._model,p=m.getLine(f),n=m.getLineStart(f),k={type:"LineStyle",textView:g,lineIndex:f,lineText:p,
lineStart:n};g.onLineStyle(k);var h=b.ownerDocument,m=d||e.createElement(h,"div");if(!d||!a(d.viewStyle,k.style))c(k.style,m,d),d&&(d._trim=null),m.viewStyle=k.style,m.setAttribute("role","presentation");m.lineIndex=f;if(d&&m.viewLineText===p&&a(k.ranges,m.viewRanges))return m;m.viewRanges=k.ranges;m.viewLineText=p;f=[];this._createRanges(k.ranges,p,0,p.length,n,{tabOffset:0,ranges:f});k=" ";!g._fullSelection&&9>e.isIE&&(k="\ufeff");g={text:k,style:g._metrics.largestFontStyle,ignoreChars:1};0===f.length||
!f[f.length-1].style||"div"!==f[f.length-1].style.tagName?f.push(g):f.splice(f.length-1,0,g);var s,r,t,l=k=0;if(e.isFirefox&&2E3<p.length){d&&(m.innerHTML="",d.lineWidth=void 0);d=h.createDocumentFragment();for(p=0;p<f.length;p++)g=f[p],n=g.text,s=g.style,s=this._createSpan(m,n,s,g.ignoreChars),d.appendChild(s);m.appendChild(d)}else{var u,y;if(d){if(r=d.modelChangedEvent)0===r.removedLineCount&&0===r.addedLineCount?(y=r.start-n,u=r.addedCharCount-r.removedCharCount):y=-1,d.modelChangedEvent=void 0;
r=d.firstChild}for(p=0;p<f.length;p++){g=f[p];n=g.text;k+=n.length;s=g.style;if(r)if(t=r.firstChild.data,h=r.viewStyle,t===n&&a(s,h)){l+=t.length;r._rectsCache=void 0;s=r=r.nextSibling;continue}else for(;r;){if(-1!==y){h=k;h>=y&&(h-=u);t=(t=r.firstChild.data)?t.length:0;if(l+t>h)break;l+=t}h=r.nextSibling;m.removeChild(r);r=h}s=this._createSpan(m,n,s,g.ignoreChars);r?m.insertBefore(s,r):m.appendChild(s);d&&(d.lineWidth=void 0)}if(d)for(u=s?s.nextSibling:null;u;)h=u.nextSibling,d.removeChild(u),u=
h}m.parentNode||b.appendChild(m);return m},_createRanges:function(b,c,e,d,f,g){if(!(e>d)){if(b)for(var m=0;m<b.length;m++){var p=b[m];if(!(p.end<f+e)){var n=Math.max(f+e,p.start)-f;if(n>d)break;var k=Math.min(f+d,p.end)-f;if(n<=k){n=Math.max(e,n);k=Math.min(d,k);e<n&&this._createRange(c,e,n,null,g);if(!p.style||!p.style.unmergeable)for(;m+1<b.length&&b[m+1].start-f===k&&a(p.style,b[m+1].style);)p=b[m+1],k=Math.min(f+d,p.end)-f,m++;this._createRange(c,n,k,p.style,g);e=k}}}e<d&&this._createRange(c,
e,d,null,g)}},_createRange:function(a,b,c,e,d){if(!(b>c)){var f=this.view._customTabSize;if(f&&8!==f)for(var g=a.indexOf("\t",b);-1!==g&&g<c;){b<g&&(b={text:a.substring(b,g),style:e},d.ranges.push(b),d.tabOffset+=b.text.length);b=f-d.tabOffset%f;if(0<b){for(var m="\u00a0",p=1;p<b;p++)m+=" ";b={text:m,style:e,ignoreChars:b-1};d.ranges.push(b);d.tabOffset+=b.text.length}b=g+1;if(b===c)return;g=a.indexOf("\t",b)}b<=c&&(b={text:a.substring(b,c),style:e},d.ranges.push(b),d.tabOffset+=b.text.length)}},
_createSpan:function(a,b,d,f){var g=this.view,m="span";d&&d.tagName&&(m=d.tagName.toLowerCase());var p="a"===m;p&&(this.hasLink=!0);p&&!g._linksVisible&&(m="span");p=a.ownerDocument;a=e.createElement(a.ownerDocument,m);a.appendChild(p.createTextNode(d&&d.text?d.text:b));d&&d.html?(a.innerHTML=d.html,a.ignore=!0):d&&d.node&&(a.appendChild(d.node),a.ignore=!0);c(d,a);if("a"===m){var n=g._getWindow();x(a,"click",function(a){return g._handleLinkClick(a?a:n.event)},!1)}a.viewStyle=d;f&&(a.ignoreChars=
f);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,b){var c=this._ensureCreated(),d=this.view;if(void 0===a)return this._getLineBoundingClientRect(c,!0);var f=d._model,g=c.ownerDocument,m=this.lineIndex,p=null;if(a<f.getLineEnd(m)){var n=f.getLineStart(m);this.forEach(function(b){var f=b.firstChild,m=this._nodeLength(b);if(n+m>a){var B=a-n;if(1===f.length)p=new u(b.getBoundingClientRect());
else if(d._isRangeRects)m=g.createRange(),m.setStart(f,B),m.setEnd(f,B+1),p=new u(m.getBoundingClientRect());else if(e.isIE)m=g.body.createTextRange(),m.moveToElementText(b),m.collapse(),(f=0===B&&8===e.isIE)&&(B=1),m.moveEnd("character",B+1),m.moveStart("character",B),p=new u(m.getBoundingClientRect()),f&&(p.left=b.getClientRects()[0].left);else{var k=f.data;b.removeChild(f);b.appendChild(g.createTextNode(k.substring(0,B)));var h=e.createElement(g,"span");h.appendChild(g.createTextNode(k.substring(B,
B+1)));b.appendChild(h);b.appendChild(g.createTextNode(k.substring(B+1)));p=new u(h.getBoundingClientRect());b.innerHTML="";b.appendChild(f);this._createdDiv||(b=d._getSelection(),(n<=b.start&&b.start<n+m||n<=b.end&&b.end<n+m)&&d._updateDOMSelection())}e.isIE&&(B=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,b=B.screen.logicalXDPI/B.screen.deviceXDPI,B=B.screen.logicalYDPI/B.screen.deviceYDPI,p.left*=b,p.right*=b,p.top*=B,p.bottom*=B);return!1}n+=m;return!0})}f=this.getBoundingClientRect();
p||(d._wrapMode?(m=this.getClientRects(),p=m[m.length-1],p.left=p.right,p.left+=f.left,p.top+=f.top,p.right+=f.left,p.bottom+=f.top):(p=new u(f),p.left=p.right));if(b||void 0===b)p.left-=f.left,p.top-=f.top,p.right-=f.left,p.bottom-=f.top;return p},forEach:function(a){for(var b=this._ensureCreated().firstChild;b;){var c=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=c}},_getClientRects:function(a,b){var c,e,d,f;if(!a._rectsCache){c=a.getClientRects();e=Array(c.length);for(f=0;f<c.length;f++)d=
e[f]=new u(c[f]),d.left-=b.left,d.top-=b.top,d.right-=b.left,d.bottom-=b.top;a._rectsCache=e}c=a._rectsCache;e=[c.length];for(f=0;f<c.length;f++)e[f]=new u(c[f]);return e},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],c=this._ensureCreated().getBoundingClientRect();this.forEach(function(a){a=this._getClientRects(a,c);for(var e=0;e<a.length;e++){var d=a[e],f,q;if(d.top!==d.bottom){var g=d.top+(d.bottom-d.top)/2;for(f=0;f<b.length&&!(q=b[f],q.top<=
g&&g<q.bottom);f++);f===b.length?b.push(d):(d.left<q.left&&(q.left=d.left),d.top<q.top&&(q.top=d.top),d.right>q.right&&(q.right=d.right),d.bottom>q.bottom&&(q.bottom=d.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var c=new u(a.getBoundingClientRect());if(!this.view._wrapMode){c.right=c.left;for(var e=a.lastChild;e&&e.ignoreChars===e.firstChild.length;)e=e.previousSibling;e&&(e=e.getBoundingClientRect(),c.right=e.right+t(a).right)}b&&(e=t(a),c.left+=e.left,
c.right-=e.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var c=0;c<b.length;c++)if(b[c].top<=a&&a<b[c].bottom)return c;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+
1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var c=0;this.forEach(function(e){var d=e.firstChild;if(d===a)return e.ignoreChars&&(c-=e.ignoreChars),c+=b,!1;e.ignoreChars&&(c-=e.ignoreChars);c+=d.data.length;return!0});return Math.max(0,c)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,c,e,d=this.view._model,f=d.getLineStart(this.lineIndex),
g=a-f,m=d.getLineEnd(this.lineIndex)-f;this.forEach(function(a){var d=a.firstChild,f=this._nodeLength(a);if(f+b>g||b+f>=m)return c=d,e=g-b,a.ignoreChars&&0<f&&e===f&&(e+=a.ignoreChars),!1;b+=f;return!0});return{node:c,offset:e}},getText:function(a){var b="",c=0;this.forEach(function(e){var d;if(e.ignoreChars){d=e.lastChild;for(var f=0,g=[],m=-1;d;){var p=d.data;if(p)for(var n=p.length-1;0<=n;n--){var k=p.substring(n,n+1);f<e.ignoreChars&&(" "===k||"\ufeff"===k)?f++:g.push("\u00a0"===k?"\t":k)}a===
d&&(m=g.length);d=d.previousSibling}g=g.reverse().join("");-1!==m&&(c=b.length+g.length-m);b+=g}else for(d=e.firstChild;d;)a===d&&(c=b.length),b+=d.data,d=d.nextSibling;return!0});return{text:b,offset:c}},getOffset:function(a,b){function c(d,z,n){var r=d.firstChild,C=s._nodeLength(d),t=k.ownerDocument,u=t.defaultView||t.parentWindow,l=e.isIE?u.screen.logicalXDPI/u.screen.deviceXDPI:1,y=e.isIE?u.screen.logicalYDPI/u.screen.deviceYDPI:1,w,v,x,u=n.left+h.left,A,D;if(e.isIE||f._isRangeRects){for(var t=
f._isRangeRects?t.createRange():t.body.createTextRange(),K=C,J=-1;1<K-J;){var M=Math.floor((K+J)/2);n=J+1;w=M===C-1&&d.ignoreChars?r.length:M+1;A=0===n&&8===e.isIE;f._isRangeRects?(t.setStart(r,n),t.setEnd(r,w)):(A&&(n=1),t.moveToElementText(d),t.move("character",n),t.moveEnd("character",w-n));D=t.getClientRects();for(var P=!1,U=0;U<D.length;U++)if(n=D[U],w=(A?u:n.left)*l-h.left,x=n.right*l-h.left,v=n.top*y-h.top,n=n.bottom*y-h.top,w<=a&&a<x&&(!f._wrapMode||v<=b&&b<n)){P=!0;break}P?K=M:J=M}z+=K;n=
K;w=K===C-1&&d.ignoreChars?r.length:Math.min(K+1,r.length);f._isRangeRects?(t.setStart(r,n),t.setEnd(r,w)):(t.moveToElementText(d),t.move("character",n),t.moveEnd("character",w-n));D=t.getClientRects();C=!1;0<D.length&&(n=D[0],w=(A?u:n.left)*l-h.left,x=n.right*l-h.left,C=a>w+(x-w)/2);d=z-p;r=g.getLine(m);l=r.charCodeAt(d);55296<=l&&56319>=l&&C?d<r.length&&(l=r.charCodeAt(d+1),56320<=l&&57343>=l&&(z+=1)):56320<=l&&57343>=l&&!C&&0<d&&(l=r.charCodeAt(d-1),55296<=l&&56319>=l&&(z-=1));C&&z++}else{l=[];
for(A=0;A<C;A++)l.push("\x3cspan\x3e"),A===C-1?l.push(r.data.substring(A)):l.push(r.data.substring(A,A+1)),l.push("\x3c/span\x3e");d.innerHTML=l.join("");for(l=d.firstChild;l;){n=l.getBoundingClientRect();w=n.left-h.left;x=n.right-h.left;if(w<=a&&a<x){a>w+(x-w)/2&&z++;break}z++;l=l.nextSibling}s._createdDiv||(d.innerHTML="",d.appendChild(r),d=f._getSelection(),(z<=d.start&&d.start<z+C||z<=d.end&&d.end<z+C)&&f._updateDOMSelection())}return z}function d(c){if(c.ignore)return null;c=s._getClientRects(c,
h);for(var e=0;e<c.length;e++){var g=c[e];if(g.left<=a&&a<g.right&&(!f._wrapMode||g.top<=b&&b<g.bottom))return g}return null}var f=this.view,g=f._model,m=this.lineIndex,p=g.getLineStart(m),n=g.getLineEnd(m);if(p===n)return p;var k=this._ensureCreated(),h=this.getBoundingClientRect(),s=this,r,t;if(f._wrapMode){r=this.getClientRects();b<r[0].top&&(b=r[0].top);for(var l=0;l<r.length&&!(t=r[l],t.top<=b&&b<t.bottom);l++);a<t.left&&(a=t.left);a>t.right&&(a=t.right-1)}else 0>a&&(a=0),a>h.right-h.left&&(a=
h.right-h.left);var u,y;if(this._lastHitChild&&this._lastHitChild.parentNode){if(u=this._lastHitOffset,y=this._lastHitChild,t=d(y),!t){r=u;for(var l=u+this._nodeLength(y),w=y.previousSibling,v=y.nextSibling;w||v;){if(w){r-=this._nodeLength(w);if(t=d(w)){y=w;u=r;break}w=w.previousSibling}if(v){if(t=d(v)){y=v;u=l;break}l+=this._nodeLength(v);v=v.nextSibling}}}}else u=p,this.forEach(function(a){y=a;if(t=d(y))return!1;u+=this._nodeLength(y);return!0});y&&t&&(this._lastHitChild=y,this._lastHitOffset=u,
u=c(y,u,t));return Math.min(n,Math.max(p,u))},getNextOffset:function(a,b){if("line"===b.unit){var c=this.view._model,d=c.getLineAtOffset(a);if(0<b.count)return b.count--,c.getLineEnd(d);b.count++;return c.getLineStart(d)}return"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit?this._getNextOffset_W3C(a,b):e.isIE?this._getNextOffset_IE(a,b):this._getNextOffset_W3C(a,b)},_getNextOffset_W3C:function(a,b){function c(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function e(a){return 32===
a||9===a}var d=this.view._model,f=d.getLineAtOffset(a),g=d.getLine(f),m=d.getLineStart(f),d=d.getLineEnd(f),f=g.length,p=a-m,n,k=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var h,s,r;0!==b.count;){if(0<b.count){if(p===f)return d;n=g.charCodeAt(p);h=c(n);s=!h&&!e(n);for(p++;p<f;){n=g.charCodeAt(p);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){r=c(n);if("wordend"===b.unit){if(!r&&h)break}else if(r&&!h)break;n=!r&&!e(n)}else n=!e(n);if("wordend"===
b.unit||"wordendWS"===b.unit){if(!n&&s)break}else if(n&&!s)break;s=n;h=r;p++}}else{if(0===p)return m;p--;n=g.charCodeAt(p);h=c(n);for(s=!h&&!e(n);0<p;){n=g.charCodeAt(p-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){r=c(n);if("wordend"===b.unit){if(r&&!h)break}else if(!r&&h)break;n=!r&&!e(n)}else n=!e(n);if("wordend"===b.unit||"wordendWS"===b.unit){if(n&&!s)break}else if(!n&&s)break;s=n;h=r;p--}}b.count-=k}else for(;0!==b.count&&0<=p+k&&p+k<=f;)p+=k,n=g.charCodeAt(p),56320<=n&&57343>=n&&0<p&&(n=g.charCodeAt(p-
1),55296<=n&&56319>=n&&(p+=k)),b.count-=k;return m+p},_getNextOffset_IE:function(a,b){var c=this._ensureCreated(),e=this.view._model,d=this.lineIndex,f=0,g;g=e.getLineStart(d);var m=c.ownerDocument,p=0>b.count?-1:1;if(a===e.getLineEnd(d)){for(c=c.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;if(!c)return g;f=m.body.createTextRange();f.moveToElementText(c);g=f.text.length;f.moveEnd(b.unit,p);f=a+f.text.length-g}else if(a===g&&0>b.count)f=g;else for(c=c.firstChild;c;){e=this._nodeLength(c);
if(g+e>a){f=m.body.createTextRange();if(a===g&&0>b.count){for(g=c.previousSibling;g&&(!g.firstChild||!g.firstChild.length);)g=g.previousSibling;f.moveToElementText(g?g:c.previousSibling)}else f.moveToElementText(c),f.collapse(),f.moveEnd("character",a-g);g=f.text.length;f.moveEnd(b.unit,p);f=a+f.text.length-g;break}g=e+g;c=c.nextSibling}b.count-=p;return f},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(c){var e=c.viewStyle;e&&e.tagName&&"a"===
e.tagName.toLowerCase()&&a.replaceChild(b._createSpan(a,c.firstChild.data,e),c);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};v.prototype={addKeyMode:function(a,b){var c=this._keyModes;void 0!==b?c.splice(b,0,a):c.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var c=this._rulers;if(void 0!==b){var e,d;for(d=e=0;e<c.length&&d<b;e++)a.getLocation()===c[e].getLocation()&&d++;c.splice(d,0,a);b=d}else c.push(a);
this._createRuler(a,b);this._update()},computeSize:function(){var a=0,b=0,c=this._model,d=this._clientDiv;if(!d)return{width:a,height:b};var f=d.style.width;e.isWebkit&&(d.style.width="0x7fffffffpx");for(var c=c.getLineCount(),g=0;g<c;g++){var m=this._getLine(g),p=m.getBoundingClientRect(),a=Math.max(a,p.right-p.left),b=b+(p.bottom-p.top);m.destroy()}e.isWebkit&&(d.style.width=f);d=this._getViewPadding();a+=d.right+d.left+this._metrics.scrollWidth;b+=d.bottom+d.top+this._metrics.scrollWidth;return{width:a,
height:b}},convert:function(a,b,c){if(this._clientDiv){var e=this._getScroll(),d=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-e.x+f.left+d.left),void 0!==a.y&&(a.y+=-e.y+f.top+d.top));"document"===c&&(void 0!==a.x&&(a.x+=e.x-f.left-d.left),void 0!==a.y&&(a.y+=e.y-f.top-d.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});
this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],c=this._actions,e;for(e in c)c.hasOwnProperty(e)&&(a||
!c[e].defaultHandler)&&b.push(e);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?
0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],c=this._keyModes,e=0;e<c.length;e++)b=b.concat(c[e].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;
a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),c=this._getLine(b);a=c.getBoundingClientRect(a);c.destroy();c=a.left;b=this._getLinePixel(b)+a.top;return{x:c,y:b}},getNextOffset:function(a,b){var c=new r(a,a,!1);this._doMove(b,c);return c.getCaret()},getOptions:function(){var a;if(0===arguments.length)a=this._defaultOptions();else if(1===arguments.length){if(a=arguments[0],"string"===typeof a)return b(this["_"+a])}else{a={};for(var c in arguments)arguments.hasOwnProperty(c)&&
(a[arguments[c]]=void 0)}for(var e in a)a.hasOwnProperty(e)&&(a[e]=b(this["_"+e]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var c=this._getLineIndex(b),e=this._getLine(c),c=e.getOffset(a,b-this._getLinePixel(c));e.destroy();return c},getLineAtOffset:function(a){this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=
this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,b,c){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(c))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(c)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},
onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},
onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},
onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var c=this.getRulers(),e=0;e<c.length;e++)this.redrawLines(a,b,c[e])},
redrawLines:function(a,b,c){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var e=this._clientDiv;if(e){if(c)for(e=this._getRulerParent(c).firstChild;e&&e._ruler!==c;)e=e.nextSibling;c?e.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!c||"page"===c.getOverview())for(e=e.firstChild;e;){var d=e.lineIndex;a<=d&&d<b&&(e.lineChanged=!0);e=e.nextSibling}!c&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b&&(this._checkMaxLineIndex=
this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var c=this._model;void 0===a&&(a=0);void 0===b&&(b=c.getCharCount());var e=c.getLineAtOffset(a),c=c.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(e,c)}},removeKeyMode:function(a){for(var b=this._keyModes,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,c=0;c<b.length;c++)if(b[c]===
a){b.splice(c,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,c){if(a){var e=this._actions,d=e[a];d||(d=e[a]={});d.handler=b;void 0!==c&&(d.actionDescription=c)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,c){var e=this._model.getCharCount();a=Math.max(0,Math.min(a,e));a=new r(a,a,!1);this._setSelection(a,void 0===b||b,!0,c)},setHorizontalPixel:function(a){this._clientDiv&&
(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),c=this._model.getCharCount(),e=a.getLineCount(),d=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:c,
addedCharCount:d,removedLineCount:b,addedLineCount:e};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:d,removedLineCount:b,addedLineCount:e};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(c){var e=this._defaultOptions(),d;for(d in c)if(c.hasOwnProperty(d)){var f=c[d];if(!a(this["_"+
d],f)){var g=e[d]?e[d].update:null;g?g.call(this,f):this["_"+d]=b(f)}}},setSelection:function(a,b,c,e){var d=a>b;if(d){var f=a;a=b;b=f}f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));a=new r(a,b,d);this._setSelection(a,void 0===c||c,!0,e)},setText:function(a,b,c){var d=void 0===b&&void 0===c;void 0===b&&(b=0);void 0===c&&(c=this._model.getCharCount());d&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:b,end:c,_code:!0},!d);d&&(this._columnX=-1,
this._setSelection(new r(0,0,!1),!0),13>e.isFirefox&&this._fixCaret())},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)){13>e.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var b=this._overlayDiv||this._clientDiv;9>e.isIE&&(b=this._viewDiv);for(var c=a.target?a.target:a.srcElement;c;){if(b===c)return;c=c.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var d=this;this._getWindow().setTimeout(function(){d._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&
13>e.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._hasFocus=!1;if(9>e.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var b=e.createElement(a.ownerDocument,"div");a.appendChild(b);a.removeChild(b)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",
this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),b=this._selDiv1.ownerDocument,a.getSelection){b=a.getSelection();for(a=b.anchorNode;a;){if(a===this._clientDiv){0<b.rangeCount&&b.removeAllRanges();break}a=a.parentNode}}else if(b.selection){this._ignoreSelect=!1;for(a=b.selection.createRange().parentElement();a;){if(a===this._clientDiv){b.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},
_handleContextMenu:function(a){if(!this._ignoreEvent(a)){e.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var b=!1;this.isListening("ContextMenu")?(b=this._createMouseEvent("ContextMenu",a),b.screenX=a.screenX,b.screenY=a.screenY,this.onContextMenu(b),b=b.defaultPrevented):e.isMac&&e.isFirefox&&0===a.button&&(b=!0);if(b)return a.preventDefault&&a.preventDefault(),!1;this._contextMenuOpen=!0;e.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},
_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>e.isFirefox){var b=this;this._getWindow().setTimeout(function(){b._clientDiv.contentEditable=!0;b._clientDiv.draggable=!1;b._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",
a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>e.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var b=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(b=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(e.isWebkit||b)return a.preventDefault&&
a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var b=!0;this.isListening("DragOver")&&(b=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(e.isWebkit||b)return b&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=
!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;e.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display="block");this._selDiv1&&(a=this._highlightRGB,this._selDiv1.style.background=a,this._selDiv2.style.background=a,this._selDiv3.style.background=
a);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var b=this._createKeyEvent("KeyDown",a);this.onKeyDown(b);if(b.defaultPrevented){e.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}b=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:b=!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;
b=!0;e.isSafari&&e.isMac&&a.ctrlKey&&(b=!1,a.keyCode=129);b&&this._startIME()}else b||this._commitIME();if((e.isMac||e.isLinux)&&4>e.isFirefox||12.16>e.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(e.isMac&&
e.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((e.isMac||e.isLinux)&&4>e.isFirefox||12.16>e.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var b=e.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&b)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(b=this._createKeyEvent("KeyPress",a),this.onKeyPress(b),b.defaultPrevented))a.preventDefault();else{if(this._doAction(a))return a.preventDefault?
(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;b=!1;if(e.isMac){if(a.ctrlKey||a.metaKey)b=!0}else if(e.isFirefox){if(a.ctrlKey||a.altKey)b=!0}else a.ctrlKey^a.altKey&&(b=!0);if(!b&&(b=e.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<b))return this._doContent(String.fromCharCode(b)),a.preventDefault&&a.preventDefault(),!1}}},_handleDocKeyUp:function(a){(e.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=
this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(e.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var b=this._getWindow(),c=!0,d=b;if(e.isIE||e.isFirefox&&!this._overlayDiv)d=this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var f=this;b.setTimeout(function(){f.focus();f._ignoreFocus=
!1},0)}1===this._clickCount?(c=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!e.isOpera||12.16<=e.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(d):(this._isW3CEvents&&this._setGrab(d),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return c},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==(a.target||a.srcElement).tagName)this._setLinksVisible(!1);
else return;this._commitIME();var b=a.which;b||(4===a.button&&(b=2),2===a.button&&(b=3),1===a.button&&(b=1));var c=2!==b&&a.timeStamp?a.timeStamp:(new Date).getTime(),d=c-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),g=Math.abs(this._lastMouseY-a.clientY),m=this._lastMouseButton===b;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=c;this._lastMouseButton=b;1===b&&(this._isMouseDown=!0,m&&d<=this._clickTime&&f<=this._clickDist&&g<=this._clickDist?this._clickCount++:
this._clickCount=1);if(this.isListening("MouseDown")&&(c=this._createMouseEvent("MouseDown",a),this.onMouseDown(c),c.defaultPrevented))a.preventDefault();else{if(1===b&&this._handleMouse(a)&&(9<=e.isIE||e.isOpera||e.isChrome||e.isSafari||e.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();e.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",
a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var b=this._isClientDiv(a);if(this.isListening("MouseMove")&&b)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var c=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;
this._setLinksVisible(c&&!this._isMouseDown&&(e.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&b)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){b=a.clientX;a=a.clientY;var d=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),g=this._getClientWidth(),m=this._getClientHeight(),c=f.left+d.left,p=f.top+d.top,g=f.left+
d.left+g,d=f.top+d.top+m;a<p?this._doAutoScroll("up",b,a-p):a>d?this._doAutoScroll("down",b,a-d):b<c&&!this._wrapMode?this._doAutoScroll("left",b-c,a):b>g&&!this._wrapMode?this._doAutoScroll("right",b-g,a):(this._endAutoScroll(),this._setSelectionTo(b,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=
!0}}},_createMouseEvent:function(a,b){var c=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var b=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||b&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible){if(b&&this._isMouseDown){if(-1!==this._dragOffset){var c=this._getSelection();
c.extend(this._dragOffset);c.collapse();this._setSelection(c,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}b&&e.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var b=this._getLineHeight(),c=0,d=0;e.isIE||e.isOpera?d=-a.wheelDelta/40*b:e.isFirefox?"wheel"===a.type?a.deltaMode?(c=Math.max(-256,Math.min(256,a.deltaX))*b,d=Math.max(-256,Math.min(256,a.deltaY))*b):(c=a.deltaX,d=a.deltaY):(b=e.isMac?
3*a.detail:Math.max(-256,Math.min(256,a.detail))*b,a.axis===a.HORIZONTAL_AXIS?c=b:d=b):e.isMac?(d=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,c=0!==a.wheelDeltaX%120?1:40>d?40/(40-d):40,d=0!==a.wheelDeltaY%120?1:40>d?40/(40-d):40,c=Math.ceil(-a.wheelDeltaX/c),-1<c&&0>c&&(c=-1),0<c&&1>c&&(c=1),d=Math.ceil(-a.wheelDeltaY/d),-1<d&&0>d&&(d=-1),0<d&&1>d&&(d=1)):(c=-a.wheelDeltaX,d=8*(-a.wheelDeltaY/120)*b);if(e.isSafari||e.isChrome&&e.isMac){for(b=a.target;b&&void 0===b.lineIndex;)b=
b.parentNode;this._mouseWheelLine=b}b=this._getScroll();this._scrollView(c,d);c=this._getScroll();if(b.x!==c.x||b.y!==c.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(e.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();b._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(b){b=this._rootDiv.clientWidth;
var c=this._rootDiv.clientHeight;if(this._rootWidth!==b||this._rootHeight!==c)this._rootWidth!==b&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=b,this._rootHeight=c,b=9>e.isIE,c=this._calculateMetrics(),a(c,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=c,b=!0),b?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,c=b.lineIndex;b&&!b._ruler;)void 0===c&&void 0!==b.lineIndex&&
(c=b.lineIndex),b=b.parentNode;var e=b?b._ruler:null;if(void 0===c&&e&&"document"===e.getOverview()){var c=this._getClientHeight(),d=this._model.getLineCount(),f=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect(),c=Math.floor((a.clientY-g.top-this._metrics.scrollWidth)*d/(c+f.top+f.bottom-2*this._metrics.scrollWidth));0<=c&&c<d||(c=void 0)}if(e)switch(a.type){case "click":if(e.onClick)e.onClick(c,a);break;case "dblclick":if(e.onDblClick)e.onDblClick(c,a);break;case "mousemove":if(e.onMouseMove)e.onMouseMove(c,
a);break;case "mouseover":if(e.onMouseOver)e.onMouseOver(c,a);break;case "mouseout":if(e.onMouseOut){for(d=a.relatedTarget;d&&d!==this._rootDiv;){if(d===b)return;d=d.parentNode}e.onMouseOut(c,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,c=this._vScroll;if(b!==a.x||c!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(c===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:c},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=
!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var c;c="DIV"===a.tagName?a:a.parentNode.parentNode;return!c._line?0:c._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!e.isOS&&!e.isAndroid&&!this._checkSelectionChange)return!1;var a=this._getWindow().getSelection(),b=this._getModelOffset(a.anchorNode,a.anchorOffset),c=this._getModelOffset(a.focusNode,a.focusOffset),d=this._getSelection();
if(void 0===b||void 0===c||d.start===b&&d.end===c)return!1;if(this._checkSelectionChange){var d=this._getLineNext(),f=this._getLinePrevious();if(a.anchorNode===d.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===d.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)b=0,c=this.getModel().getCharCount()}this._setSelection(new r(b,c),
!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=this,c=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=c.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&
a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(e.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var c=b.anchorNode;c&&void 0===c.lineIndex;)c=c.parentNode;if(c){var e=this._model,
d=c.lineIndex,f=e.getLine(d),g=f,m=0,e=e.getLineStart(d);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),d=c.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(d),m=this._getDOMText(c,d),g=m.text,m=m.offset,d.parentNode.removeChild(d));c.lineRemoved=!0;for(c=0;f.charCodeAt(c)===g.charCodeAt(c)&&c<m;)c++;b=f.length-1;for(d=g.length-f.length;f.charCodeAt(b)===g.charCodeAt(b+d)&&b+d>=m+a.data.length;)b--;b++;f=g.substring(c,b+d);this._modifyContent({text:f,start:c+e,end:b+e,_ignoreDOMSelection:!0},
!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var b=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",b.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null);var c=a.touches;if(1===c.length){var c=c[0],d=c.clientX,f=c.clientY;this._touchStartX=d;this._touchStartY=f;if(e.isAndroid&&(f<c.pageY-b.pageYOffset||d<c.pageX-b.pageXOffset))d=c.pageX-b.pageXOffset,f=c.pageY-
b.pageYOffset;b=this.convert({x:d,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(b.x,b.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var c=this,e=this._getWindow();this._touchScrollTimer=
e.setInterval(function(){var a=0,b=0;if(c._touching)a=c._touchStartX-c._touchCurrentX,b=c._touchStartY-c._touchCurrentY,c._touchSpeedX=a/10,c._touchSpeedY=b/10,c._touchStartX=c._touchCurrentX,c._touchStartY=c._touchCurrentY;else{if(0.1>Math.abs(c._touchSpeedX)&&0.1>Math.abs(c._touchSpeedY)){c._vScrollDiv.style.display="none";c._hScrollDiv.style.display="none";e.clearInterval(c._touchScrollTimer);c._touchScrollTimer=null;return}a=10*c._touchSpeedX;b=10*c._touchSpeedY;c._touchSpeedX*=0.95;c._touchSpeedY*=
0.95}c._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,c,e=this._keyModes;for(c=e.length-1;0<=c;c--)if(b=e[c],"function"===typeof b.match&&(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var c=this._model,e=b.getCaret(),d=c.getLineAtOffset(e);for(a.count||(a.count=1);0!==a.count;){var f=c.getLineStart(d);if(0>a.count&&e===f)if(0<d)"character"===
a.unit&&a.count++,d--,b.extend(c.getLineEnd(d));else break;else if(0<a.count&&e===c.getLineEnd(d))if(d+1<c.getLineCount())"character"===a.unit&&a.count--,d++,b.extend(c.getLineStart(d));else break;else{var g=!1;a.expandTab&&"character"===a.unit&&0===(e-f)%this._tabSize&&(f=c.getText(f,e),g=!/[^ ]/.test(f));g?(b.extend(e-this._tabSize),a.count+=0>a.count?1:-1):(f=this._getLine(d),b.extend(f.getNextOffset(e,a)),f.destroy())}e=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();
b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var c=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":c=c.toLowerCase();break;case "capitalize":c=c.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<c.length;b++){var e=c[b],d=e.toLowerCase(),e=d!==
e?d:e.toUpperCase();a+=e}c=a;break;default:c=c.toUpperCase()}this._doContent(c);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var c=this._model,e=c.getLineAtOffset(b.end);b.end<c.getLineEnd(e)&&(c=this._getLine(e),b.extend(c.getNextOffset(b.getCaret(),{unit:"character",count:1})),c.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),c=this._model,e;if(a.ctrl)b.extend(c.getCharCount()),e=function(){};else{var d=b.getCaret(),f=c.getLineAtOffset(d);if(this._wrapMode){var g=this._getLine(f),d=g.getLineIndex(d),d=d===g.getLineCount()-1?c.getLineEnd(f):g.getLineStart(d+1)-1;g.destroy()}else a.count&&
0<a.count&&(f=Math.min(f+a.count-1,c.getLineCount()-1)),d=c.getLineEnd(f);b.extend(d)}a.select||b.collapse();this._setSelection(b,!0,!0,e);return!0},_doEnter:function(a){var b=this._model,c=this._getSelection();this._doContent(b.getLineDelimiter());a&&a.noCursor&&(c.end=c.start,this._setSelection(c,!0));return!0},_doHome:function(a){var b=this._getSelection(),c=this._model,e;if(a.ctrl)b.extend(0),e=function(){};else{var d=b.getCaret(),f=c.getLineAtOffset(d);this._wrapMode?(c=this._getLine(f),d=c.getLineIndex(d),
d=c.getLineStart(d),c.destroy()):d=c.getLineStart(f);b.extend(d)}a.select||b.collapse();this._setSelection(b,!0,!0,e);return!0},_doLineDown:function(a){var b=this._model,c=this._getSelection(),d=c.getCaret(),f=b.getLineAtOffset(d),g=this._getLine(f),m=this._columnX,p=1,n=!1;if(-1===m||a.wholeLine||a.select&&e.isIE)m=a.wholeLine?b.getLineEnd(f+1):d,m=g.getBoundingClientRect(m).left;(d=g.getLineIndex(d))<g.getLineCount()-1?p=g.getClientRects(d+1).top+1:(d=b.getLineCount()-1,n=f===d,a.count&&0<a.count?
f=Math.min(f+a.count,d):f++);d=!1;if(n){if(a.select||e.isMac||e.isLinux)c.extend(b.getCharCount()),d=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(m,p)),d=!0;d&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=m;g.destroy();return!0},_doLineUp:function(a){var b=this._model,c=this._getSelection(),d=c.getCaret(),f=b.getLineAtOffset(d),g=this._getLine(f),m=this._columnX,p=!1,n;if(-1===m||a.wholeLine||a.select&&e.isIE)m=a.wholeLine?b.getLineStart(f-1):
d,m=g.getBoundingClientRect(m).left;0<(d=g.getLineIndex(d))?n=g.getClientRects(d-1).top+1:(p=0===f,p||(a.count&&0<a.count?f=Math.max(f-a.count,0):f--,n=this._getLineHeight(f)-1));d=!1;if(p){if(a.select||e.isMac||e.isLinux)c.extend(0),d=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(m,n)),d=!0;d&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=m;g.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var b=this,c=this._model,d=this._getSelection(),
f=d.getCaret(),g=c.getLineAtOffset(f),m=c.getLineCount(),p=this._getScroll(),c=this._getClientHeight(),n,k;if(this._lineHeight){n=this._columnX;p=this._getBoundsAtOffset(f);if(-1===n||a.select&&e.isIE)n=p.left;f=this._getLineIndex(p.top+c);k=this._getLine(f);g=this._getLinePixel(f);f=k.getOffset(n,p.top+c-g);c=k.getBoundingClientRect(f);k.destroy();d.extend(f);a.select||d.collapse();this._setSelection(d,!0,!0,function(){b._columnX=n},c.top+g-p.top);return!0}if(g<m-1){var h=this._getLineHeight(),s=
Math.min(m-g-1,Math.floor(c/h)),s=Math.max(1,s);n=this._columnX;if(-1===n||a.select&&e.isIE)k=this._getLine(g),n=k.getBoundingClientRect(f).left,k.destroy();k=this._getLine(g+s);d.extend(k.getOffset(n,0));k.destroy();a.select||d.collapse();a=m*h;f=p.y+s*h;f+c>a&&(f=a-c);this._setSelection(d,!0,!0,function(){b._columnX=n},f-p.y)}return!0},_doPageUp:function(a){var b=this,c=this._model,d=this._getSelection(),f=d.getCaret(),g=c.getLineAtOffset(f),m=this._getScroll(),p=this._getClientHeight(),n;if(this._lineHeight){n=
this._columnX;m=this._getBoundsAtOffset(f);if(-1===n||a.select&&e.isIE)n=m.left;f=this._getLineIndex(m.bottom-p);c=this._getLine(f);g=this._getLinePixel(f);f=c.getOffset(n,m.bottom-p-g);p=c.getBoundingClientRect(f);c.destroy();d.extend(f);a.select||d.collapse();this._setSelection(d,!0,!0,function(){b._columnX=n},p.top+g-m.top);return!0}if(0<g){var k=this._getLineHeight(),p=Math.max(1,Math.min(g,Math.floor(p/k)));n=this._columnX;if(-1===n||a.select&&e.isIE)c=this._getLine(g),n=c.getBoundingClientRect(f).left,
c.destroy();c=this._getLine(g-p);d.extend(c.getOffset(n,this._getLineHeight(g-p)-1));c.destroy();a.select||d.collapse();a=Math.max(0,m.y-p*k);this._setSelection(d,!0,!0,function(){b._columnX=n},a-m.y)}return!0},_doPaste:function(a){var b=this;return null!==this._getClipboardText(a,function(a){a&&(e.isLinux&&2===b._lastMouseButton&&(new Date).getTime()-b._lastMouseTime<=b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(a))})},_doScroll:function(a){var b=a.type,c=this._model,
e=c.getLineCount();a=this._getClientHeight();var d=this._getLineHeight(),e=e*d,f=this._getScroll().y,g;switch(b){case "textStart":g=0;break;case "textEnd":g=e-a;break;case "pageDown":g=f+a;break;case "pageUp":g=f-a;break;case "lineDown":g=f+d;break;case "lineUp":g=f-d;break;case "centerLine":b=this._getSelection(),g=c.getLineAtOffset(b.start),c=(c.getLineAtOffset(b.end)-g+1)*d,g=g*d-a/2+c/2}void 0!==g&&(g=Math.min(Math.max(0,g),e-a),this._scrollViewAnimated(0,g-f,function(){}));return!0},_doSelectAll:function(a){a=
this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();var c=b.getLineAtOffset(a),b=b.getLineStart(c);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),
!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,b=this._getSelection(),c=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),d=b.getCaret(),f=a.getLineCount(),g=a.getLineAtOffset(d),m;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)d=this._autoScrollY/this._getLineHeight(),d=0>d?Math.floor(d):Math.ceil(d),m=Math.max(0,
Math.min(f-1,g+d));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)m=this._getLineIndex(c.y),g=this._getLine(g),c.x+=g.getBoundingClientRect(d,!1).left,g.destroy();0===m&&(e.isMac||e.isLinux)?b.extend(0):m===f-1&&(e.isMac||e.isLinux)?b.extend(a.getCharCount()):(g=this._getLine(m),b.extend(g.getOffset(c.x,c.y-this._getLinePixel(m))),g.destroy());this._setSelection(b,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},
this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),c=0;if(a){a=0;for(var e=(new Date).getTime(),d=0;c<b&&!(this._lineHeight[c]||(a++,d||(d=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,100<(new Date).getTime()-e););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(c!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},
0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,b=a.ownerDocument,d=e.createElement(b,"div");d.style.lineHeight="normal";var f={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(f);c(f.style,d);d.style.position="fixed";
d.style.left="-1000px";var g=e.createElement(b,"span");g.appendChild(b.createTextNode(" "));d.appendChild(g);var m=e.createElement(b,"span");m.style.fontStyle="italic";m.appendChild(b.createTextNode(" "));d.appendChild(m);var p=e.createElement(b,"span");p.style.fontWeight="bold";p.appendChild(b.createTextNode(" "));d.appendChild(p);f=e.createElement(b,"span");f.style.fontWeight="bold";f.style.fontStyle="italic";f.appendChild(b.createTextNode(" "));d.appendChild(f);a.appendChild(d);var n=d.getBoundingClientRect(),
g=g.getBoundingClientRect(),m=m.getBoundingClientRect(),p=p.getBoundingClientRect(),f=f.getBoundingClientRect(),g=g.bottom-g.top,m=m.bottom-m.top,p=p.bottom-p.top,k=f.bottom-f.top,h=0,f=0>=n.bottom-n.top,n=Math.max(1,n.bottom-n.top);m>g&&(h=1);p>m&&(h=2);k>p&&(h=3);var r;0!==h&&(r={style:{}},0!==(h&1)&&(r.style.fontStyle="italic"),0!==(h&2)&&(r.style.fontWeight="bold"));g=t(d);a.removeChild(d);k=s(this._viewDiv);d=e.createElement(b,"div");d.style.position="fixed";d.style.left="-1000px";d.style.paddingLeft=
k.left+"px";d.style.paddingTop=k.top+"px";d.style.paddingRight=k.right+"px";d.style.paddingBottom=k.bottom+"px";d.style.width="100px";d.style.height="100px";k=e.createElement(b,"div");k.style.width="100%";k.style.height="100%";d.appendChild(k);a.appendChild(d);h=d.getBoundingClientRect();m=k.getBoundingClientRect();p=0;this._singleMode||(d.style.overflow="hidden",k.style.height="200px",p=d.clientWidth,d.style.overflow="scroll",p-=d.clientWidth);a.removeChild(d);k={left:m.left-h.left,top:m.top-h.top,
right:h.right-m.right,bottom:h.bottom-m.bottom};m=h=0;if(!f&&(this._wrapOffset||this._marginOffset))d=e.createElement(b,"div"),d.style.position="fixed",d.style.left="-1000px",d.innerHTML=Array(this._wrapOffset+1+(e.isWebkit?0:1)).join(" "),a.appendChild(d),h=d.getBoundingClientRect(),h=Math.ceil(h.right-h.left),d.innerHTML=Array(this._marginOffset+1).join(" "),m=d.getBoundingClientRect(),m=Math.ceil(m.right-m.left),a.removeChild(d);return{lineHeight:n,largestFontStyle:r,lineTrim:g,viewPadding:k,scrollWidth:p,
wrapWidth:h,marginWidth:m,invalid:f}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(-1!==this._imeOffset){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),c=a.getLineStart(b),e=this._getDOMText(this._getLineNode(b)).text,a=
a.getLine(b),c=this._imeOffset-c,a=c+e.length-a.length;c!==a&&(e=e.substring(c,a),this._doContent(e));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new h.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(n(b,{select:!1}))},actionDescription:{name:k.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(n(b,{select:!1}))},actionDescription:{name:k.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(n(b,
{select:!1,ctrl:!1}))},actionDescription:{name:k.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(n(b,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(n(b,{select:!1,unit:"character"}))},actionDescription:{name:k.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(n(b,{select:!1,unit:"character"}))},actionDescription:{name:k.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(n(b,
{select:!1}))},actionDescription:{name:k.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(n(b,{select:!1}))},actionDescription:{name:k.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(n(b,{type:"pageUp"}))},actionDescription:{name:k.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(n(b,{type:"pageDown"}))},actionDescription:{name:k.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(n(b,{type:"lineUp"}))},
actionDescription:{name:k.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(n(b,{type:"lineDown"}))},actionDescription:{name:k.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(n(b,{select:!1,unit:"word"}))},actionDescription:{name:k.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(n(b,{select:!1,unit:"word"}))},actionDescription:{name:k.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(n(b,{select:!1,
ctrl:!0}))},actionDescription:{name:k.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(n(b,{select:!1,ctrl:!0}))},actionDescription:{name:k.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(n(b,{type:"textStart"}))},actionDescription:{name:k.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(n(b,{type:"textEnd"}))},actionDescription:{name:k.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(n(b,{type:"centerLine"}))},
actionDescription:{name:k.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(n(b,{select:!0}))},actionDescription:{name:k.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(n(b,{select:!0}))},actionDescription:{name:k.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(n(b,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(n(b,
{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(n(b,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(n(b,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(n(b,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(n(b,
{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(n(b,{select:!0}))},actionDescription:{name:k.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(n(b,{select:!0}))},actionDescription:{name:k.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(n(b,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(n(b,
{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(n(b,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(n(b,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(n(b,{unit:"character"}))},actionDescription:{name:k.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(n(b,
{unit:"character"}))},actionDescription:{name:k.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(n(b,{unit:"word"}))},actionDescription:{name:k.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(n(b,{unit:"word"}))},actionDescription:{name:k.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(n(b,{unit:"line"}))},actionDescription:{name:k.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(n(b,
{unit:"line"}))},actionDescription:{name:k.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:k.tab}},shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:k.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:k.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(n(b,{noCursor:!0}))},actionDescription:{name:k.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},
actionDescription:{name:k.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:k.copy}},cut:{defaultHandler:function(b){return a._doCut()},actionDescription:{name:k.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:k.paste}},uppercase:{defaultHandler:function(b){return a._doCase(n(b,{type:"upper"}))},actionDescription:{name:k.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(n(b,{type:"lower"}))},actionDescription:{name:k.lowercase}},
capitalize:{defaultHandler:function(b){return a._doCase(n(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:k.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(n(b,{type:"reverse"}))},actionDescription:{name:k.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:k.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:k.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},
actionDescription:{name:k.toggleWrapMode}}}},_createRulerParent:function(a,b){var c=e.createElement(a,"div");c.className=b;c.tabIndex=-1;c.style.overflow="hidden";c.style.MozUserSelect="none";c.style.WebkitUserSelect="none";c.style.position="absolute";c.style.top="0px";c.style.bottom="0px";c.style.cursor="default";c.style.display="none";c.setAttribute("aria-hidden","true");this._rootDiv.appendChild(c);return c},_createRuler:function(a,b){if(this._clientDiv){var c=this._getRulerParent(a);if(c){if(c!==
this._marginDiv||this._marginOffset)c.style.display="block";var d=e.createElement(c.ownerDocument,"div");d._ruler=a;d.rulerChanged=!0;d.style.position="relative";d.style.cssFloat="left";d.style.styleFloat="left";d.style.outline="none";if(void 0===b||0>b||b>=c.children.length)c.appendChild(d);else{for(var f=c.firstChild;f&&0<b--;)f=f.nextSibling;c.insertBefore(d,f)}}}},_createView:function(){function a(){g._rootDiv&&(g.update(!0),g._metrics.invalid&&g._getWindow().setTimeout(function(){a()},100))}
if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var c=b.ownerDocument,d=e.createElement(c,"div");this._rootDiv=d;d.tabIndex=-1;d.style.position="relative";d.style.overflow="hidden";d.style.width="100%";d.style.height="100%";d.style.overflow="hidden";d.style.WebkitTextSizeAdjust="100%";d.setAttribute("role","application");b.appendChild(d);this._leftDiv=this._createRulerParent(c,"textviewLeftRuler");b=e.createElement(c,"div");b.className="textviewScroll";this._viewDiv=
b;b.tabIndex=-1;b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.borderWidth="0px";b.style.margin="0px";b.style.outline="none";b.style.background="transparent";e.isMac&&e.isWebkit&&(b.style.pointerEvents="none",b.style.zIndex="2");d.appendChild(b);var f=this._createRulerParent(c,"textviewRightRuler");this._rightDiv=f;f.style.right="0px";this._scrollDiv=f=e.createElement(c,"div");f.style.margin="0px";f.style.borderWidth="0px";f.style.padding="0px";b.appendChild(f);(this._marginDiv=
this._createRulerParent(c,"textviewMarginRuler")).style.zIndex="4";!e.isIE&&!e.isIOS&&(this._clipDiv=b=e.createElement(c,"div"),b.style.position="absolute",b.style.overflow="hidden",b.style.margin="0px",b.style.borderWidth="0px",b.style.padding="0px",b.style.background="transparent",d.appendChild(b),this._clipScrollDiv=f=e.createElement(c,"div"),f.style.position="absolute",f.style.height="1px",f.style.top="-1000px",f.style.background="transparent",b.appendChild(f));this._setFullSelection(this._fullSelection,
!0);b=e.createElement(c,"div");b.className="textviewContent";this._clientDiv=b;b.tabIndex=0;b.style.position="absolute";b.style.borderWidth="0px";b.style.margin="0px";b.style.padding="0px";b.style.outline="none";b.style.zIndex="1";b.style.WebkitUserSelect="text";b.setAttribute("spellcheck","false");if(e.isIOS||e.isAndroid)b.style.WebkitTapHighlightColor="transparent";(this._clipDiv||d).appendChild(b);if(e.isIOS||e.isAndroid)this._vScrollDiv=f=e.createElement(c,"div"),f.style.position="absolute",f.style.borderWidth=
"1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.width="8px",f.style.display="none",d.appendChild(f),this._hScrollDiv=f=e.createElement(c,"div"),f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",
f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.height="8px",f.style.display="none",d.appendChild(f);e.isFirefox&&!b.setCapture&&(this._overlayDiv=f=e.createElement(c,"div"),f.style.position=b.style.position,f.style.borderWidth=b.style.borderWidth,f.style.margin=b.style.margin,f.style.padding=b.style.padding,f.style.cursor="text",f.style.zIndex="2",(this._clipDiv||d).appendChild(f));b.contentEditable="true";b.setAttribute("role","textbox");
b.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();b=this._rulers;for(f=0;f<b.length;f++)this._createRuler(b[f]);this._update();var g=this;p(c,d,"textview",a)}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},
readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},
wrappable:{value:!1,update:null},theme:{value:d.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var c=b.firstChild;c;){if(c._ruler===a){c._ruler=void 0;b.removeChild(c);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}c=c.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();
this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);this._updateTimer&&(a.clearTimeout(this._updateTimer),this._updateTimer=null);a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,
b,c){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=c;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var c=this._model;
c.getBaseModel&&(a=c.mapOffset(a),b=c.mapOffset(b),c=c.getBaseModel());return c.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var c=this._clientDiv.getBoundingClientRect();a.bottom>c.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var c=this._getLinePixel(b.lineIndex);a.top+=
c;a.bottom+=c;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,b){var c=this._model.getLineDelimiter(),d,f,g=this._getWindow(),p=g.clipboardData;!p&&a&&(p=a.clipboardData);if(p)return d=[],f=p.getData(e.isIE?"Text":"text/plain"),m(f,function(a){d.push(a)},function(){d.push(c)}),
f=d.join(""),b&&b(f),f;if(e.isFirefox){this._ignoreFocus=!0;var n=this._clipboardDiv,p=this._rootDiv.ownerDocument;n||(this._clipboardDiv=n=e.createElement(p,"div"),n.style.position="fixed",n.style.whiteSpace="pre",n.style.left="-1000px",this._rootDiv.appendChild(n));n.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";n.firstChild.focus();var k=this,h=function(){var a=k._getTextFromElement(n);n.innerHTML="";d=[];m(a,function(a){d.push(a)},function(){d.push(c)});return d.join("")},s=!1;this._ignorePaste=
!0;if(!e.isLinux||2!==this._lastMouseButton)try{s=p.execCommand("paste",!1,null)}catch(r){s=1<n.childNodes.length||n.firstChild&&0<n.firstChild.childNodes.length}this._ignorePaste=!1;if(!s){if(a)return g.setTimeout(function(){k.focus();(f=h())&&b&&b(f);k._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(f=h())&&b&&b(f);return f}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,c=
b.defaultView;if(!c.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=c.getSelection();var c=[],e;for(e=0;e<a.rangeCount;e++)c.push(a.getRangeAt(e));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(e=0;e<c.length;e++)a.addRange(c[e]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:
new w(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var c=this._lineHeight[a];if(c)return c;if(b||void 0===b)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&-1===a.lineIndex;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:
this._clientDiv.lastChild;a&&-1===a.lineIndex;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),c=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)c+=this._getLineHeight(b);else for(b-=1;b>=a;b--)c-=this._getLineHeight(b);return c}return this._getLineHeight()*a},_getLineIndex:function(a){var b,c=0,e=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),d=-this._topIndexY+
this._getScroll().y;if(a!==d)if(a<d)for(;a<d&&0<c;)a+=this._getLineHeight(--c);else for(b=this._getLineHeight(c);a-b>=d&&c<e-1;)a-=b,b=this._getLineHeight(++c)}else b=this._getLineHeight(),c=Math.floor(a/b);return Math.max(0,Math.min(e-1,c))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(void 0===a||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,
y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var c=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect();a.top<e.top+c.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var b=this._handlers=[],c=this._clientDiv,d=this._viewDiv,f=this._rootDiv,g=this._overlayDiv||c,m=c.ownerDocument,p=this._getWindow(),n=e.isIE?m:p;b.push({target:p,type:"resize",handler:function(b){return a._handleResize(b?b:p.event)}});b.push({target:c,
type:"blur",handler:function(b){return a._handleBlur(b?b:p.event)}});b.push({target:c,type:"focus",handler:function(b){return a._handleFocus(b?b:p.event)}});b.push({target:d,type:"focus",handler:function(a){c.focus()}});b.push({target:d,type:"scroll",handler:function(b){return a._handleScroll(b?b:p.event)}});b.push({target:c,type:"textInput",handler:function(b){return a._handleTextInput(b?b:p.event)}});b.push({target:c,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:p.event)}});b.push({target:c,
type:"keypress",handler:function(b){return a._handleKeyPress(b?b:p.event)}});b.push({target:c,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:p.event)}});e.isIE&&b.push({target:m,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:p.event)}});b.push({target:c,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:p.event)}});b.push({target:c,type:"copy",handler:function(b){return a._handleCopy(b?b:p.event)}});b.push({target:c,type:"cut",handler:function(b){return a._handleCut(b?
b:p.event)}});b.push({target:c,type:"paste",handler:function(b){return a._handlePaste(b?b:p.event)}});b.push({target:m,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:p.event)}});if(e.isIOS||e.isAndroid)b.push({target:c,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:p.event)}}),b.push({target:c,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:p.event)}}),b.push({target:c,type:"touchend",handler:function(b){return a._handleTouchEnd(b?
b:p.event)}});else{b.push({target:c,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:p.event)}});b.push({target:c,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:p.event)}});b.push({target:c,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:p.event)}});b.push({target:c,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:p.event)}});b.push({target:n,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:p.event)}});b.push({target:n,
type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:p.event)}});b.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:p.event)}});b.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:p.event)}});b.push({target:g,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:p.event)}});b.push({target:g,type:"drag",handler:function(b){return a._handleDrag(b?b:p.event)}});b.push({target:g,type:"dragend",handler:function(b){return a._handleDragEnd(b?
b:p.event)}});b.push({target:g,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:p.event)}});b.push({target:g,type:"dragover",handler:function(b){return a._handleDragOver(b?b:p.event)}});b.push({target:g,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:p.event)}});b.push({target:g,type:"drop",handler:function(b){return a._handleDrop(b?b:p.event)}});b.push({target:this._clientDiv,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?
b:p.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:p.event)}});if(e.isFirefox&&(!e.isWindows||15<=e.isFirefox))(d=p.MutationObserver||p.MozMutationObserver)?(this._mutationObserver=new d(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(c,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?
b:p.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:p.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:p.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:p.event)}}),b.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:p.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,
type:"dblclick",handler:function(b){return a._handleDblclick(b?b:p.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(d=0;d<b.length;d++)f=b[d],x(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,b){if(a){var c=this,d=this._getWindow();e.isIE&&b.push({target:a,type:"selectstart",handler:function(){return!1}});b.push({target:a,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?
a:d.event)}});b.push({target:a,type:"click",handler:function(a){c._handleRulerEvent(a?a:d.event)}});b.push({target:a,type:"dblclick",handler:function(a){c._handleRulerEvent(a?a:d.event)}});b.push({target:a,type:"mousemove",handler:function(a){c._handleRulerEvent(a?a:d.event)}});b.push({target:a,type:"mouseover",handler:function(a){c._handleRulerEvent(a?a:d.event)}});b.push({target:a,type:"mouseout",handler:function(a){c._handleRulerEvent(a?a:d.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||
this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var b=a.parent;"string"===typeof b&&(b=(a.document||document).getElementById(b));if(!b)throw"no parent";a.parent=b;a.model=a.model||new l.TextModel;var c=this._defaultOptions(),d;for(d in c)c.hasOwnProperty(d)&&(this["_"+d]=void 0!==a[d]?a[d]:c[d].value);this._keyModes=[];this._rulers=[];this._selection=new r(0,0,!1);this._linksVisible=
!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!e.isIE||9<=e.isIE)&&"function"===typeof b.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=b.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=
this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(null===a.text||void 0===a.text)){var c=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),c.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}b&&(c=
this._getSelection(),c.setCaret(a.start+a.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,c=a.addedCharCount,d=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,g=this._getSelection();g.end>b&&(g.end>b&&g.start<b+d?g.setCaret(b+c):(g.start+=c-d,g.end+=c-d),this._setSelection(g,!1,!1));b=this._model.getLineAtOffset(b);for(c=this._getLineNext();c;)d=c.lineIndex,b<=
d&&d<=b+f&&(b===d&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=a,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null)),d>b+f&&(c.lineIndex=d+e-f,c._line.lineIndex=c.lineIndex),c=this._getLineNext(c);this._lineHeight&&(a=[b,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},
_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var c=a;c<b;c++)this._lineHeight[c]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=
null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new r(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>e.isFirefox&&
this._fixCaret()}},_scrollViewAnimated:function(a,b,c){var d=this._getWindow();if(c&&this._scrollAnimation){var e=this;this._animation=new A({window:d,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);c&&d.setTimeout(c,0)}});this._animation.play()}else this._scrollView(a,b),c&&d.setTimeout(c,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var c=this._viewDiv;a&&(c.scrollLeft+=
a);b&&(c.scrollTop+=b)},_setClipboardText:function(a,b){var c,d=this._getWindow(),f=d.clipboardData;!f&&b&&(f=b.clipboardData);if(f&&(c=[],m(a,function(a){c.push(a)},function(){c.push(e.platformDelimiter)}),f.setData(e.isIE?"Text":"text/plain",c.join(""))))return!0;var g=this._parent.ownerDocument,p=e.createElement(g,"pre");p.style.position="fixed";p.style.left="-1000px";m(a,function(a){p.appendChild(g.createTextNode(a))},function(){p.appendChild(e.createElement(g,"br"))});p.appendChild(g.createTextNode(" "));
this._clientDiv.appendChild(p);f=g.createRange();f.setStart(p.firstChild,0);f.setEndBefore(p.lastChild);var n=d.getSelection();0<n.rangeCount&&n.removeAllRanges();n.addRange(f);var k=this,f=function(){p&&p.parentNode===k._clientDiv&&k._clientDiv.removeChild(p);k._updateDOMSelection()},n=!1;this._ignoreCopy=!0;try{n=g.execCommand("copy",!1,null)}catch(h){}this._ignoreCopy=!1;if(!n&&b)return d.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,b,c,d,f){this._setDOMFullSelection(a,b,c,d);a=
a._line.getNodeOffset(b);c=c._line.getNodeOffset(d);d=this._getWindow();b=this._parent.ownerDocument;if(d.getSelection){var g=d.getSelection();d=b.createRange();d.setStart(a.node,a.offset);d.setEnd(c.node,c.offset);if(this._hasFocus&&(g.anchorNode!==a.node||g.anchorOffset!==a.offset||g.focusNode!==c.node||g.focusOffset!==c.offset||g.anchorNode!==c.node||g.anchorOffset!==c.offset||g.focusNode!==a.node||g.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=c.node,
this._focusOffset=c.offset,this._ignoreSelect=!1,0<g.rangeCount&&g.removeAllRanges(),g.addRange(d),this._ignoreSelect=!0;this._cursorDiv&&(d=b.createRange(),f?(d.setStart(a.node,a.offset),d.setEnd(a.node,a.offset)):(d.setStart(c.node,c.offset),d.setEnd(c.node,c.offset)),f=d.getClientRects()[0],a=this._cursorDiv.parentNode,c=a.getBoundingClientRect(),f&&c&&(this._cursorDiv.style.top=f.top-c.top+a.scrollTop+"px",this._cursorDiv.style.left=f.left-c.left+a.scrollLeft+"px"))}else b.selection&&this._hasFocus&&
(f=b.body,d=e.createElement(b,"div"),f.appendChild(d),f.removeChild(d),d=f.createTextRange(),d.moveToElementText(a.node.parentNode),d.moveStart("character",a.offset),f=f.createTextRange(),f.moveToElementText(c.node.parentNode),f.moveStart("character",c.offset),d.setEndPoint("EndToStart",f),this._ignoreSelect=!1,d.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,c,d){if(this._selDiv1){var e=this._selDiv1;e.style.width="0px";e.style.height="0px";e=this._selDiv2;e.style.width="0px";
e.style.height="0px";e=this._selDiv3;e.style.width="0px";e.style.height="0px";if(!(a===c&&b===d)){var f=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),m=this._viewDiv.getBoundingClientRect(),e=m.left+f.left,p=g.right,f=m.top+f.top,n=g.bottom,m=g=0;this._clipDiv?(m=this._clipDiv.getBoundingClientRect(),g=m.left-this._clipDiv.scrollLeft):(m=this._rootDiv.getBoundingClientRect(),g=m.left);m=m.top;this._ignoreDOMSelection=!0;var k=(new w(this,a.lineIndex,a)).getBoundingClientRect(b,
!1),h=k.left;b=(new w(this,c.lineIndex,c)).getBoundingClientRect(d,!1);var s=b.left;this._ignoreDOMSelection=!1;var r=this._selDiv1,h=Math.min(p,Math.max(e,h)),t=Math.min(n,Math.max(f,k.top)),l=p;d=Math.min(n,Math.max(f,k.bottom));r.style.left=h-g+"px";r.style.top=t-m+"px";r.style.width=Math.max(0,l-h)+"px";r.style.height=Math.max(0,d-t)+"px";a.lineIndex===c.lineIndex?(l=Math.min(s,p),r.style.width=Math.max(0,l-h)+"px"):(k=Math.min(n,Math.max(f,b.top)),s=Math.min(p,Math.max(e,s)),f=Math.min(n,Math.max(f,
b.bottom)),n=this._selDiv3,n.style.left=e-g+"px",n.style.top=k-m+"px",n.style.width=Math.max(0,s-e)+"px",n.style.height=Math.max(0,f-k)+"px",1<Math.abs(a.lineIndex-c.lineIndex)&&(a=this._selDiv2,a.style.left=e-g+"px",a.style.top=d-m+"px",a.style.width=Math.max(0,p-e)+"px",a.style.height=Math.max(0,k-d)+"px"))}}},_setGrab:function(a){a!==this._grabControl&&(a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},
_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;e.isIE&&a&&(this._hadFocus=this._hasFocus);var b=this._clientDiv;b.contentEditable=!a;this._hadFocus&&!a&&b.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,c,d,e){if(a){this._columnX=-1;void 0===c&&(c=!0);var f=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,d,
b,e);c&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,c,d){var e=this._model,f=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(d&&!c&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);c||f.collapse()}else 0===
(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,d=e.getNextOffset(a,{unit:"wordend",count:1})):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=e.getNextOffset(c,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(d=e.getLineAtOffset(this._doubleClickSelection.start),a>=
d?(c=e.getLineStart(d),d=e.getLineEnd(a)):(c=e.getLineStart(a),d=e.getLineEnd(d))):(c=e.getLineStart(a),d=e.getLineEnd(a)),f.setCaret(c),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,b){this._fullSelection=a;e.isWebkit&&(this._fullSelection=!0);var c=this._clipDiv||this._rootDiv;if(c)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!e.isIOS){var d=c.ownerDocument;this._highlightRGB=e.isWebkit?"transparent":"Highlight";var f=e.createElement(d,"div");
this._selDiv1=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";c.appendChild(f);var g=e.createElement(d,"div");this._selDiv2=g;g.style.position="absolute";g.style.borderWidth="0px";g.style.margin="0px";g.style.padding="0px";g.style.outline="none";g.style.background=this._highlightRGB;g.style.width="0px";g.style.height="0px";g.style.zIndex=
"0";c.appendChild(g);this._selDiv3=d=e.createElement(d,"div");d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.background=this._highlightRGB;d.style.width="0px";d.style.height="0px";d.style.zIndex="0";c.appendChild(d);if(e.isFirefox&&e.isMac){c=this._getWindow().getComputedStyle(d,null).getPropertyValue("background-color");switch(c){case "rgb(119, 141, 168)":c="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":c="rgb(198, 198, 198)";
break;case "rgb(255, 193, 31)":c="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":c="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":c="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":c="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":c="rgb(232, 184, 255)";break;default:c="rgb(180, 213, 255)"}this._highlightRGB=c;f.style.background=c;g.style.background=c;d.style.background=c}b||this._updateDOMSelection()}}else this._selDiv1&&(c.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&
(c.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(c.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,b=e.createElement(a.ownerDocument,"div");b.className="textviewBlockCursor";this._cursorDiv=
b;b.tabIndex=-1;b.style.zIndex="2";b.style.color="transparent";b.style.position="absolute";b.style.pointerEvents="none";b.innerHTML="\x26nbsp;";a.appendChild(b);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=
a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,b){this._tabSize=a;this._customTabSize=void 0;var c=this._clientDiv;e.isOpera?c&&(c.style.OTabSize=this._tabSize+""):537.1<=e.isWebkit?c&&(c.style.tabSize=this._tabSize+""):4<=e.isFirefox?c&&(c.style.MozTabSize=this._tabSize+
""):8!==this._tabSize&&(this._customTabSize=this._tabSize);b||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var c="textview",d=this._theme.getThemeClass();d&&(c+=" "+d);this._themeClass&&d!==this._themeClass&&(c+=
" "+this._themeClass);this._rootDiv.className=c;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var c=this._clientDiv;this._wrapMode?(c.style.whiteSpace="pre-wrap",c.style.wordWrap="break-word"):(c.style.whiteSpace="pre",c.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,c,d){if(this._clientDiv){var e=this._model,f=this._getSelection(),g=this._getScroll(),m=f.getCaret(),p=f.start,
n=f.end,k=e.getLineAtOffset(p),h=e.getLineAtOffset(n),s=Math.max(Math.max(p,e.getLineStart(h)),n-1),e=this._getClientWidth(),r=this._getClientHeight(),t=e/4,l=this._getBoundsAtOffset(m===p?p:s),u=l.left,y=l.right,w=l.top,v=l.bottom,x=0,A="object"===typeof c;if((a||A)&&!f.isEmpty())l=this._getBoundsAtOffset(m===n?p:s),x=(l.bottom>v?l.bottom:v)-(l.top<w?l.top:w),a&&(l.top===w?m===p?y=u+Math.min(l.right-u,e):u=y-Math.min(y-l.left,e):m===p?v=w+Math.min(l.bottom-w,r):w=v-Math.min(v-l.top,r));a=0;u<g.x&&
(a=Math.min(u-g.x,-t));y>g.x+e&&(a=Math.max(y-g.x-e,t));f=0;w<g.y?f=w-g.y:v>g.y+r&&(f=v-g.y-r);d&&(0<d?0<f&&(f=Math.max(f,d)):0>f&&(f=Math.min(f,d)));d=A&&"always"===c.scrollPolicy;if(0!==a||0!==f||d)return A?(d=0<f,0===f&&(f=w-g.y),g=c.viewAnchor||"caret",w=c.selectionAnchor||"caret",c=Math.min(Math.max(0,c.viewAnchorOffset||0)),f="top"===g?f+Math.floor(d?(1-c)*r:-c*r):"bottom"===g?f+Math.floor(d?c*r:-(1-c)*r):"center"===g?f+Math.floor(d?r/2+c*r:r/2-(1-c)*r):f+Math.floor(d?c*r:-c*r),k!==h&&("top"===
w&&m!==p?f+=Math.floor(-x):"bottom"===w&&m!==n?f+=Math.floor(x):"center"===w&&(f+=Math.floor(x/2)))):0!==f&&"number"===typeof c&&(0>c&&(c=0),1<c&&(c=1),f+=Math.floor(0<f?c*r:-c*r)),this._scrollViewAnimated(a,f,b),r!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},
_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];y(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<
this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,c=b.getLineAtOffset(a.start),d=b.getLineAtOffset(a.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),g;c<e.lineIndex?(c=e,g=b.getLineStart(e.lineIndex)):c>f.lineIndex?(c=f,g=b.getLineStart(f.lineIndex)):(c=this._getLineNode(c),g=a.start);d<e.lineIndex?(d=e,b=b.getLineStart(e.lineIndex)):d>f.lineIndex?(d=f,b=b.getLineStart(f.lineIndex)):(d=this._getLineNode(d),b=a.end);this._setDOMSelection(c,
g,d,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1);var b=this._clientDiv,c=this._viewDiv;if(b){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var d=this._model,f=this._getScroll(!1),g=this._getViewPadding(),m=d.getLineCount(),p=this._getLineHeight(),n=!1,k=!1,h=!1,s=this._metrics.scrollWidth;this._wrapMode&&(b.style.width=(this._metrics.wrapWidth||
this._getClientWidth())+"px");var r,t,l,u,y=0,v=0,x;if(this._lineHeight){for(;v<m;){x=this._getLineHeight(v);if(y+x>f.y)break;y+=x;v++}r=v;t=Math.max(0,r-1);l=d=f.y-y;0<r&&(d+=this._getLineHeight(r-1))}else u=Math.max(0,f.y)/p,r=Math.floor(u),t=Math.max(0,r-1),d=Math.round((u-t)*p),l=Math.round((u-r)*p);this._topIndexY=l;u=this._rootDiv;var A=u.clientWidth,F=u.clientHeight;if(a){p=0;this._leftDiv&&(r=this._leftDiv.getBoundingClientRect(),p=r.right-r.left);r=this._getClientWidth();u=this._getClientHeight();
k=r;for(this._wrapMode?this._metrics.wrapWidth&&(k=this._metrics.wrapWidth):k=Math.max(this._maxLineWidth,k);v<m;)x=this._getLineHeight(v,!1),y+=x,v++;m=y}else{u=this._getClientHeight();l=Math.min(r+Math.floor((u+l)/p),m-1);var f=Math.min(l+1,m-1),N;for(x=b.firstChild;x;){N=x.lineIndex;var O=x.nextSibling;if(!(t<=N&&N<=f)||x.lineRemoved||-1===x.lineIndex)this._mouseWheelLine===x?(x.style.display="none",x.lineIndex=-1):b.removeChild(x);x=O}x=this._getLineNext();var O=c.ownerDocument,R=O.createDocumentFragment();
for(N=t;N<=f;N++)!x||x.lineIndex>N?(new w(this,N)).create(R,null):(R.firstChild&&(b.insertBefore(R,x),R=O.createDocumentFragment()),x&&x.lineChanged&&(x=(new w(this,N)).create(R,x),x.lineChanged=!1),x=this._getLineNext(x));R.firstChild&&b.insertBefore(R,x);e.isWebkit&&!this._wrapMode&&(b.style.width="0x7fffffffpx");x=this._getLineNext();N=u+d;for(R=!1;x;)t=x.lineWidth,void 0===t&&(O=x._line.getBoundingClientRect(),t=x.lineWidth=Math.ceil(O.right-O.left),O=O.bottom-O.top,this._lineHeight?this._lineHeight[x.lineIndex]=
O:0!==p&&0!==O&&Math.ceil(p)!==Math.ceil(O)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[x.lineIndex]=O)),this._lineHeight&&!R&&(N-=this._lineHeight[x.lineIndex],0>N&&(l=x.lineIndex,R=!0)),this._wrapMode||(t>=this._maxLineWidth&&(this._maxLineWidth=t,this._maxLineIndex=x.lineIndex),this._checkMaxLineIndex===x.lineIndex&&(this._checkMaxLineIndex=-1)),x.lineIndex===r&&(this._topChild=x),x.lineIndex===l&&(this._bottomChild=x),x=this._getLineNext(x);for(-1!==this._checkMaxLineIndex&&
(N=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=N&&N<m&&(p=new w(this,N),O=p.getBoundingClientRect(),t=O.right-O.left,t>=this._maxLineWidth&&(this._maxLineWidth=t,this._maxLineIndex=N),p.destroy()));v<m;)x=this._getLineHeight(v,v<=l),y+=x,v++;m=y;this._updateRuler(this._leftDiv,r,f,F);this._updateRuler(this._rightDiv,r,f,F);this._updateRuler(this._marginDiv,r,f,F);p=0;this._leftDiv&&(r=this._leftDiv.getBoundingClientRect(),p=r.right-r.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),
f=f.right-f.left);c.style.left=p+"px";c.style.right=f+"px";f=this._scrollDiv;f.style.height=m+"px";r=this._getClientWidth();!this._singleMode&&!this._wrapMode&&(y=n=u,(v="scroll"===c.style.overflowX)?n+=s:y-=s,x=l=r,(t="scroll"===c.style.overflowY)?l+=s:x-=s,u=n,r=l,m>u&&(h=!0,r=x),this._maxLineWidth>r&&(k=!0,u=y,m>u&&(h=!0,r=x)),v!==k&&(c.style.overflowX=k?"scroll":"hidden"),t!==h&&(c.style.overflowY=h?"scroll":"hidden"),n=v!==k||t!==h);h=r;this._wrapMode?this._metrics.wrapWidth&&(h=this._metrics.wrapWidth):
h=Math.max(this._maxLineWidth,h);k=h;if((!e.isIE||9<=e.isIE)&&this._maxLineWidth>r)h+=g.right+g.left;f.style.width=h+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=h+"px");f=this._getScroll(!1)}this._vScrollDiv&&(h=u-8,y=Math.max(15,Math.ceil(Math.min(1,h/(m+g.top+g.bottom))*h)),this._vScrollDiv.style.left=p+r-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*h/m))+"px",this._vScrollDiv.style.height=y+"px");!this._wrapMode&&this._hScrollDiv&&(h=r-8,y=Math.max(15,Math.ceil(Math.min(1,
h/(this._maxLineWidth+g.left+g.right))*h)),this._hScrollDiv.style.left=p+Math.floor(Math.max(0,Math.floor(f.x*h/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=u-9+"px",this._hScrollDiv.style.width=y+"px");v=f.x;y=this._clipDiv;h=this._overlayDiv;if(l=this._marginDiv)l.style.left=-v+p+this._metrics.marginWidth+g.left+"px",l.style.bottom=("scroll"===c.style.overflowX?s:0)+"px";y?(y.scrollLeft=v,y.scrollTop=0,c=p+g.left,s=g.top,a=r,p=u,v=0,l=-d,0===f.x&&(c-=g.left,a+=g.left,v=g.left),f.x+r===
k&&(a+=g.right),0===f.y&&(s-=g.top,p+=g.top,l+=g.top),f.y+u===m&&(p+=g.bottom),y.style.left=c+"px",y.style.top=s+"px",y.style.right=A-a-c+"px",y.style.bottom=F-p-s+"px",b.style.left=v+"px",b.style.top=l+"px",b.style.width=k+"px",b.style.height=u+d+"px",h&&(h.style.left=b.style.left,h.style.top=b.style.top,h.style.width=b.style.width,h.style.height=b.style.height)):(c=v,s=d,A=v+r,F=d+u,0===c&&(c-=g.left),0===s&&(s-=g.top),A===k&&(A+=g.right),f.y+u===m&&(F+=g.bottom),b.style.clip="rect("+s+"px,"+A+
"px,"+F+"px,"+c+"px)",b.style.left=-v+p+g.left+"px",b.style.width=(this._wrapMode||e.isWebkit?k:r+v)+"px",a||(b.style.top=-d+g.top+"px",b.style.height=u+d+"px"),h&&(h.style.clip=b.style.clip,h.style.left=b.style.left,h.style.width=b.style.width,a||(h.style.top=b.style.top,h.style.height=b.style.height)));this._updateDOMSelection();n&&(b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX=
"hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,b,d,f){if(a){var g=this._parent.ownerDocument,m=this._getLineHeight(),p=this._getViewPadding();for(a=a.firstChild;a;){var n=a._ruler,h=m,k=n.getOverview();"page"===k&&(h+=this._topIndexY);a.style.top=-h+"px";a.style.height=f+h+"px";a.rulerChanged&&c(n.getRulerStyle(),a);var s,r=a.firstChild;r?(s=r,r=r.nextSibling):(s=e.createElement(g,"div"),s.style.visibility="hidden",a.appendChild(s));var t;if(a.rulerChanged&&
s){h=-1;if(t=n.getWidestAnnotation())c(t.style,s),t.html&&(s.innerHTML=t.html);s.lineIndex=h;s.style.height=m+p.top+"px"}var l;if("page"===k){for(n=n.getAnnotations(b,d+1);r;)h=r.lineIndex,t=r.nextSibling,(!(b<=h&&h<=d)||r.lineChanged)&&a.removeChild(r),r=t;r=a.firstChild.nextSibling;l=g.createDocumentFragment();for(h=b;h<=d;h++)if(!r||r.lineIndex>h){s=e.createElement(g,"div");if(t=n[h])c(t.style,s),t.html&&(s.innerHTML=t.html),s.annotation=t;s.lineIndex=h;s.style.height=this._getLineHeight(h)+"px";
l.appendChild(s)}else l.firstChild&&(a.insertBefore(l,r),l=g.createDocumentFragment()),r&&(r=r.nextSibling);l.firstChild&&a.insertBefore(l,r)}else{t=this._getClientHeight();h=this._model.getLineCount();r=t+p.top+p.bottom-2*this._metrics.scrollWidth;k=m*h<r?m:r/h;if(a.rulerChanged){for(t=a.childNodes.length;1<t;)a.removeChild(a.lastChild),t--;n=n.getAnnotations(0,h);l=g.createDocumentFragment();for(var u in n)h=u>>>0,0>h||(s=e.createElement(g,"div"),t=n[u],c(t.style,s),s.style.position="absolute",
s.style.top=this._metrics.scrollWidth+m+Math.floor(h*k)+"px",t.html&&(s.innerHTML=t.html),s.annotation=t,s.lineIndex=h,l.appendChild(s));a.appendChild(l)}else if(a._oldTrackHeight!==r)for(s=a.firstChild?a.firstChild.nextSibling:null;s;)s.style.top=this._metrics.scrollWidth+m+Math.floor(s.lineIndex*k)+"px",s=s.nextSibling;a._oldTrackHeight=r}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";e.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
e.isFirefox&&e.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var b=this._clientDiv.ownerDocument,c=b.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(b.createTextNode(a));else{c=e.createElement(b,"style");c.id="_textviewStyle";var d=b.getElementsByTagName("head")[0]||b.documentElement;c.appendChild(b.createTextNode(a));d.insertBefore(c,d.firstChild)}}},_updateStyle:function(a){!a&&
e.isIE&&(this._rootDiv.style.lineHeight="normal");var b=this._metrics=this._calculateMetrics();this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=e.isIE?b.lineHeight-(b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};g.EventTarget.addMixin(v.prototype);return{TextView:v}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(k,l){function h(g){this._model=g;this._projections=[];var d=this;this._listener={onChanged:function(f){d._onChanged(f)},onChanging:function(f){d._onChanging(f)}};g.addEventListener("postChanged",this._listener.onChanged);g.addEventListener("preChanging",this._listener.onChanging)}h.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(g){if(g){var d=this._model,f=this._projections;g._lineIndex=d.getLineAtOffset(g.start);g._lineCount=d.getLineAtOffset(g.end)-g._lineIndex;var e=g.text;e||(e="");g._model="string"===typeof e?new k.TextModel(e,d.getLineDelimiter()):e;var d=this.mapOffset(g.start,!0),e=g.end-g.start,c=g._lineCount,b=g._model.getCharCount(),n=g._model.getLineCount()-1,a={type:"Changing",text:g._model.getText(),
start:d,removedCharCount:e,addedCharCount:b,removedLineCount:c,addedLineCount:n};this.onChanging(a);a=this._binarySearch(f,g.start);f.splice(a,0,g);this.onChanged({type:"Changed",start:d,removedCharCount:e,addedCharCount:b,removedLineCount:c,addedLineCount:n})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(g,d){var f=this._projections,e=0,c,b;if(d){for(c=0;c<f.length;c++){b=f[c];if(b.start>g)break;if(b.end>g)return-1;e+=
b._model.getCharCount()-(b.end-b.start)}return g+e}for(c=0;c<f.length;c++){b=f[c];if(b.start>g-e)break;var n=b._model.getCharCount();if(b.start+n>g-e)return-1;e+=n-(b.end-b.start)}return g-e},removeProjection:function(g){var d,f=0;for(d=0;d<this._projections.length;d++){var e=this._projections[d];if(e===g){g=e;break}f+=e._model.getCharCount()-(e.end-e.start)}if(d<this._projections.length){var e=this._model,f=g.start+f,c=g.end-g.start,b=g._lineCount,n=g._model.getCharCount(),a=g._model.getLineCount()-
1;g={type:"Changing",text:e.getText(g.start,g.end),start:f,removedCharCount:n,addedCharCount:c,removedLineCount:a,addedLineCount:b};this.onChanging(g);this._projections.splice(d,1);this.onChanged({type:"Changed",start:f,removedCharCount:n,addedCharCount:c,removedLineCount:a,addedLineCount:b})}},_binarySearch:function(g,d){for(var f=g.length,e=-1,c;1<f-e;)c=Math.floor((f+e)/2),d<=g[c].start?f=c:e=c;return f},getCharCount:function(){for(var g=this._model.getCharCount(),d=this._projections,f=0;f<d.length;f++)var e=
d[f],g=g+(e._model.getCharCount()-(e.end-e.start));return g},getLine:function(g,d){if(0>g)return null;var f=this._model,e=this._projections,c=0,b=[],n=0,a,m,h;for(a=0;a<e.length;a++){h=e[a];if(h._lineIndex>=g-c)break;m=h._model.getLineCount()-1;if(h._lineIndex+m>=g-c){n=g-(h._lineIndex+c);if(n<m)return h._model.getLine(n,d);b.push(h._model.getLine(m))}n=h.end;c+=m-h._lineCount}for(n=Math.max(n,f.getLineStart(g-c));a<e.length;a++){h=e[a];if(h._lineIndex>g-c)break;b.push(f.getText(n,h.start));m=h._model.getLineCount()-
1;if(h._lineIndex+m>g-c)return b.push(h._model.getLine(0,d)),b.join("");b.push(h._model.getText());n=h.end;c+=m-h._lineCount}e=f.getLineEnd(g-c,d);n<e&&b.push(f.getText(n,e));return b.join("")},getLineAtOffset:function(g){for(var d=this._model,f=this._projections,e=0,c=0,b=0;b<f.length;b++){var n=f[b];if(n.start>g-e)break;var a=n._model.getCharCount();if(n.start+a>g-e){f=g-(n.start+e);c+=n._model.getLineAtOffset(f);e+=f;break}c+=n._model.getLineCount()-1-n._lineCount;e+=a-(n.end-n.start)}return d.getLineAtOffset(g-
e)+c},getLineCount:function(){for(var g=this._projections,d=this._model.getLineCount(),f=0;f<g.length;f++)var e=g[f],d=d+(e._model.getLineCount()-1-e._lineCount);return d},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(g,d){if(0>g)return-1;for(var f=this._model,e=this._projections,c=0,b=0,n=0;n<e.length;n++){var a=e[n];if(a._lineIndex>g-c)break;var m=a._model.getLineCount()-1;if(a._lineIndex+m>g-c)return a._model.getLineEnd(g-(a._lineIndex+c),d)+a.start+b;b+=
a._model.getCharCount()-(a.end-a.start);c+=m-a._lineCount}return f.getLineEnd(g-c,d)+b},getLineStart:function(g){if(0>g)return-1;for(var d=this._model,f=this._projections,e=0,c=0,b=0;b<f.length;b++){var n=f[b];if(n._lineIndex>=g-e)break;var a=n._model.getLineCount()-1;if(n._lineIndex+a>=g-e)return n._model.getLineStart(g-(n._lineIndex+e))+n.start+c;c+=n._model.getCharCount()-(n.end-n.start);e+=a-n._lineCount}return d.getLineStart(g-e)+c},getText:function(g,d){void 0===g&&(g=0);var f=this._model,e=
this._projections,c=0,b=[],n,a,m;for(n=0;n<e.length;n++){a=e[n];if(a.start>g-c)break;m=a._model.getCharCount();if(a.start+m>g-c){if(void 0!==d&&a.start+m>d-c)return a._model.getText(g-(a.start+c),d-(a.start+c));b.push(a._model.getText(g-(a.start+c)));g=a.end+c+m-(a.end-a.start)}c+=m-(a.end-a.start)}var h=g-c;if(void 0!==d){for(;n<e.length;n++){a=e[n];if(a.start>d-c)break;b.push(f.getText(h,a.start));m=a._model.getCharCount();if(a.start+m>d-c)return b.push(a._model.getText(0,d-(a.start+c))),b.join("");
b.push(a._model.getText());h=a.end;c+=m-(a.end-a.start)}b.push(f.getText(h,d-c))}else{for(;n<e.length;n++)a=e[n],b.push(f.getText(h,a.start)),b.push(a._model.getText()),h=a.end;b.push(f.getText(h))}return b.join("")},_onChanged:function(g){g=this._change;var d=g.baseStart,f=g.baseEnd,e,c,b=this._projections;for(e=0;e<b.length&&!(c=b[e],c.end>d);e++);var n=e;for(e=0;e<b.length&&!(c=b[e],c.start>=f);e++);var a=e,m=this._model,d=g.baseText.length-(f-d);for(e=a;e<b.length;e++)c=b[e],c.start+=d,c.end+=
d,c._lineIndex=m.getLineAtOffset(c.start);c=b.splice(n,a-n);for(e=0;e<c.length;e++)c[e].annotation&&c[e].annotation._expand();this.onChanged({type:"Changed",start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount});this._change=void 0},_onChanging:function(g){var d=!!this._change,f=this._change||{},e=g.start,c=e+g.removedCharCount;f.baseStart=e;f.baseEnd=c;f.baseText=g.text;f.addedLineCount=g.addedLineCount;
if(!d){this._change=f;f.text=g.text;var b=this._projections,n,a,m;g=function(c){for(n=a=0;a<b.length;a++){m=b[a];if(m.start>c)break;if(m.end>c)return-1;n+=m._model.getCharCount()-(m.end-m.start)}return c+n};f.start=g(e);-1===f.start&&(f.text=this._model.getText(m.start,e)+f.text,f.addedLineCount+=this._model.getLineAtOffset(e)-this._model.getLineAtOffset(m.start),f.start=m.start+n);f.end=g(c);-1===f.end&&(f.text+=this._model.getText(c,m.end),f.addedLineCount+=this._model.getLineAtOffset(m.end)-this._model.getLineAtOffset(c),
f.end=m.start+n)}f.addedCharCount=f.text.length;f.removedCharCount=f.end-f.start;f.removedLineCount=this.getLineAtOffset(f.end)-this.getLineAtOffset(f.start);this.onChanging({type:"Changing",text:f.text,start:f.start,removedCharCount:f.removedCharCount,addedCharCount:f.addedCharCount,removedLineCount:f.removedLineCount,addedLineCount:f.addedLineCount})},onChanging:function(g){return this.dispatchEvent(g)},onChanged:function(g){return this.dispatchEvent(g)},setLineDelimiter:function(g){this._model.setLineDelimiter(g)},
setText:function(g,d,f){function e(d){for(b=n=0;n<c.length;n++){a=c[n];if(a.start>d-b)break;var e=a._model.getCharCount();if(a.start+e>d-b)return-1;b+=e-(a.end-a.start)}return d-b}this._change={text:g||"",start:d||0,end:void 0===f?this.getCharCount():f};var c=this._projections,b,n,a,m,h;g=e(this._change.start);-1===g&&(m={projection:a,start:this._change.start-(a.start+b)},g=a.end);d=e(this._change.end);-1===d&&(h={projection:a,end:this._change.end-(a.start+b)},d=a.start);m&&h&&m.projection===h.projection?
a._model.setText(this._change.text,m.start,h.end):(this._model.setText(this._change.text,g,d),m&&(a=m.projection,a._model.setText("",m.start)),h&&(a=h.projection,a._model.setText("",0,h.end),a.start=a.end,a._lineCount=0));this._change=void 0}};l.EventTarget.addMixin(h.prototype);return{ProjectionTextModel:h}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/util orion/util".split(" "),function(k,l,h,g,d,f){function e(c){this._view=c;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(c.getOptions("parent").ownerDocument)}e.getTooltip=function(c){c._tooltip||(c._tooltip=new e(c));return c._tooltip};e.prototype={_create:function(c){if(!this._tooltipDiv){var b=
this._tooltipDiv=f.createElement(c,"div");b.tabIndex=0;b.className="textviewTooltip";b.setAttribute("aria-live","assertive");b.setAttribute("aria-atomic","true");var e=this._tooltipContents=f.createElement(c,"div");b.appendChild(e);c.body.appendChild(b);var a=this;d.addEventListener(b,"mouseover",function(b){a._hideDelay&&(b=a._getWindow(),a._delayedHideTimeout&&(b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null),a._hideTimeout&&(b.clearTimeout(a._hideTimeout),a._hideTimeout=null),
a._nextTarget=null)},!1);d.addEventListener(b,"mouseout",function(c){c=c.relatedTarget||c.toElement;!(c===b||a._hasFocus())&&(!c||!d.contains(b,c))&&a._hide()},!1);d.addEventListener(b,"keydown",function(b){27===b.keyCode&&a._hide()},!1);d.addEventListener(c,"mousedown",this._mouseDownHandler=function(c){a.isVisible()&&(d.contains(b,c.target||c.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var c=this._tooltipDiv.ownerDocument;
return c.defaultView||c.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var c=this._tooltipDiv.parentNode;c&&c.removeChild(this._tooltipDiv);d.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var c=this._tooltipDiv;return!c?!1:d.contains(c,c.ownerDocument.activeElement)},hide:function(c){void 0===c&&(c=this._hideDelay);var b=this._getWindow();this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var d=this;c?d._delayedHideTimeout=b.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},c):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var c=this._tooltipDiv;c&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),c.style.visibility="hidden",c=this._getWindow(),this._showTimeout&&(c.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(c.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(c.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(c.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(c,b,d){if(this.isVisible())this._hasFocus()||(this._nextTarget=c,this.hide(d));else if(this._target=c){var a=
this;c=a._getWindow();a._showTimeout&&(c.clearTimeout(a._showTimeout),a._showTimeout=null);0===b?a.show(!0):a._showTimeout=c.setTimeout(function(){a._showTimeout=null;a.show(!0)},b?b:a._showDelay)}},show:function(c){if(this._target){var b=this._target.getTooltipInfo();if(b){var d=this._tooltipDiv,a=this._tooltipContents;d.style.left=d.style.right=d.style.width=d.style.height=a.style.width=a.style.height="auto";var e=b.contents;e instanceof Array&&(e=this._getAnnotationContents(e));if("string"===typeof e)a.innerHTML=
e;else if(this._isNode(e))a.appendChild(e);else if(e instanceof g.ProjectionTextModel){var f=this._view,h=f.getOptions();h.wrapMode=!1;h.parent=a;var p=h.themeClass;p?((p=p.replace("tooltipTheme",""))&&(p=" "+p),p="tooltipTheme"+p):p="tooltipTheme";h.themeClass=p;h=this._contentsView=new l.TextView(h);h.addEventListener("LineStyle",function(a){f.onLineStyle(a)});h.setModel(e);e=h.computeSize();a.style.width=e.width+"px";a.style.height=e.height+"px";h.resize()}else return;a=d.ownerDocument.documentElement;
"right"===b.anchor?(e=a.clientWidth-b.x,d.style.right=e+"px"):(e=parseInt(this._getNodeStyle(d,"padding-left","0"),10),e+=parseInt(this._getNodeStyle(d,"border-left-width","0"),10),e=b.x-e,d.style.left=e+"px");d.style.maxWidth=a.clientWidth-e-10+"px";e=parseInt(this._getNodeStyle(d,"padding-top","0"),10);e+=parseInt(this._getNodeStyle(d,"border-top-width","0"),10);e=b.y-e;d.style.top=e+"px";d.style.maxHeight=a.clientHeight-e-10+"px";d.style.opacity="1";d.style.visibility="visible";if(c){var k=this,
u=this._getWindow();k._hideTimeout=u.setTimeout(function(){k._hideTimeout=null;var a=parseFloat(k._getNodeStyle(d,"opacity","1"));k._fadeTimeout=u.setInterval(function(){"visible"===d.style.visibility&&0<a?(a-=0.1,d.style.opacity=a):k._hide()},k._fadeDelay/10)},k._autoHideDelay)}}}},_getAnnotationContents:function(c){function b(a,b){var c=w.getLineStart(w.getLineAtOffset(a)),d=w.getLineEnd(w.getLineAtOffset(b),!0);return w.getText(c,d)}function e(a){var c=a.title,g=f.createElement(p,"div");g.className=
"tooltipRow";a.html&&(g.innerHTML=a.html,g.lastChild&&d.addEventListener(g.lastChild,"click",function(b){b=a.start;var c=a.end;l.getBaseModel&&(b=l.mapOffset(b,!0),c=l.mapOffset(c,!0));r.setSelection(b,c,1/3,function(){t._hide()})},!1),g.appendChild(p.createTextNode("\u00a0")));c||(c=b(a.start,a.end));"function"===typeof c&&(c=a.title());if("string"===typeof c){var m=f.createElement(p,"span");m.appendChild(p.createTextNode(c));c=m}g.appendChild(c);return g}for(var a,m=[],h=0;h<c.length;h++)a=c[h],
""!==a.title&&!a.groupAnnotation&&m.push(a);c=m;if(0===c.length)return null;var t=this,p=this._tooltipDiv.ownerDocument,r=this._view,l=r.getModel(),w=l.getBaseModel?l.getBaseModel():l;if(1===c.length){a=c[0];if(void 0!==a.title)return a=e(a),a.firstChild&&((c=a.firstChild.className)&&(c+=" "),a.firstChild.className=c+"single"),a;c=new g.ProjectionTextModel(w);m=w.getLineStart(w.getLineAtOffset(a.start));h=w.getCharCount();a.end!==h&&c.addProjection({start:a.end,end:h});0<m&&c.addProjection({start:0,
end:m});return c}m=f.createElement(p,"div");a=f.createElement(p,"em");a.appendChild(p.createTextNode(k.multipleAnnotations));m.appendChild(a);for(h=0;h<c.length;h++)a=c[h],(a=e(a))&&m.appendChild(a);return m},_getNodeStyle:function(c,b,d){var a;if(c&&(a=c.style[b],!a))if(c.currentStyle){for(a=0;-1!==(a=b.indexOf("-",a));)b=b.substring(0,a)+b.substring(a+1,a+2).toUpperCase()+b.substring(a+2);a=c.currentStyle[b]}else a=(c=c.ownerDocument.defaultView.getComputedStyle(c,null))?c.getPropertyValue(b):null;
return a||d},_isNode:function(c){return"object"===typeof Node?c instanceof Node:c&&"object"===typeof c&&"number"===typeof c.nodeType&&"string"===typeof c.nodeName}};return{Tooltip:e}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(k,l){function h(){}function g(a,b,c){this.start=a;this.end=b;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function d(a,b){var c=a.lastIndexOf("."),c=a.substring(c+1),d={title:k[c],style:{styleClass:"annotation "+c},html:"\x3cdiv class\x3d'annotationHTML "+c+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+c}};b?d.lineStyle=
{styleClass:"annotationLine "+c}:d.rangeStyle={styleClass:"annotationRange "+c};h.registerType(a,d)}function f(){}function e(a,b){for(var c=a.length,d=-1,e;1<c-d;)e=Math.floor((c+d)/2),b<=a[e].start?c=e:d=e;return c}function c(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function b(a,b){this._view=a;this._annotationModel=b;var c=this;this._listener={onDestroy:function(a){c._onDestroy(a)},onLineStyle:function(a){c._onLineStyle(a)},
onChanged:function(a){c._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}g.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){if(!this.expanded)return!1;
this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;
var b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel.removeProjection(this._projection),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var b=this._annotationModel.getAnnotations(this.start,
this.end);b.hasNext();){var c=b.next();c!==this&&c.type===h.ANNOTATION_FOLDING&&a.call(this,c)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};h.ANNOTATION_ERROR="orion.annotation.error";h.ANNOTATION_WARNING="orion.annotation.warning";h.ANNOTATION_TASK="orion.annotation.task";h.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";h.ANNOTATION_BOOKMARK="orion.annotation.bookmark";h.ANNOTATION_FOLDING="orion.annotation.folding";
h.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";h.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";h.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";h.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";h.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";h.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";h.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";h.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";
h.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";h.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";h.ANNOTATION_BLAME="orion.annotation.blame";h.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var n={};h.registerType=function(a,b){var c=b;"function"!==typeof c&&(c=function(a,b,c){this.start=a;this.end=b;void 0!==c&&(this.title=c)},c.prototype=b);c.prototype.type=a;n[a]=c;return a};h.createAnnotation=function(a,b,c,d){return new (this.getType(a))(b,c,d)};h.getType=
function(a){return n[a]};d(h.ANNOTATION_ERROR);d(h.ANNOTATION_WARNING);d(h.ANNOTATION_TASK);d(h.ANNOTATION_BREAKPOINT);d(h.ANNOTATION_BOOKMARK);d(h.ANNOTATION_CURRENT_BRACKET);d(h.ANNOTATION_MATCHING_BRACKET);d(h.ANNOTATION_CURRENT_SEARCH);d(h.ANNOTATION_MATCHING_SEARCH);d(h.ANNOTATION_READ_OCCURRENCE);d(h.ANNOTATION_WRITE_OCCURRENCE);d(h.ANNOTATION_SELECTED_LINKED_GROUP);d(h.ANNOTATION_CURRENT_LINKED_GROUP);d(h.ANNOTATION_LINKED_GROUP);d(h.ANNOTATION_CURRENT_LINE,!0);d(h.ANNOTATION_BLAME,!0);d(h.ANNOTATION_CURRENT_BLAME,
!0);h.registerType(h.ANNOTATION_FOLDING,g);f.addMixin=function(a){var b=f.prototype,c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};f.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var c=b-1;void 0==b||!(0<=c&&c<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(c,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a)return b+
1;return 0},getAnnotationsByType:function(a,b,c){a=a.getAnnotations(b,c);for(c=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&c.push(b);var d=this;c.sort(function(a,b){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(b.type)});return c},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a){this._annotationTypes.splice(b,
1);break}}};c.prototype={addAnnotation:function(a){if(a){var b=this._annotations,c=e(b,a.start);b.splice(c,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var c=this._annotations,d,e=0,f;f=void 0===a&&void 0===b?function(){return e<c.length?c[e++]:null}:function(){for(;e<c.length;){var d=c[e++];if(a===d.start||(a>d.start?a<d.end:d.start<b))return d;if(d.start>=b)break}return null};
d=f();return{next:function(){var a=d;a&&(d=f());return a},hasNext:function(){return null!==d}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,c,d;if(a){c=[];for(d=b.length-1;0<=d;d--){var e=b[d];e.type===a&&(b.splice(d,1),c.splice(0,0,e),e._annotationModel=null)}}else c=b;this.onChanged({type:"Changed",removed:c,
added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,b){var c=this._annotations,d,f,g,n=[];if(a)for(d=a.length-1;0<=d;d--)g=a[d],f=this._getAnnotationIndex(g),0>f||(g._annotationModel=null,c.splice(f,1),n.splice(0,0,g));b||(b=[]);for(d=0;d<b.length;d++)g=b[d],f=e(c,g.start),g._annotationModel=this,c.splice(f,
0,g);this.onChanged({type:"Changed",removed:n,added:b,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var b=this._annotations,c=e(b,a.start);c<b.length&&b[c].start===a.start;){if(b[c]===a)return c;c++}return-1},_onChanged:function(a){var b=a.start,c=a.addedCharCount,d=a.removedCharCount,e=this._annotations,f=
b+d;if(0<e.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};c-=d;for(d=0;d<e.length;d++){var g=e[d];g.start>=f?(g._oldStart=g.start,g._oldEnd=g.end,g.start+=c,g.end+=c,a.changed.push(g)):g.end<=b||(g.start<b&&f<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=c,a.changed.push(g)):(e.splice(d,1),a.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),d--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};l.EventTarget.addMixin(c.prototype);
b.prototype={destroy:function(){var a=this._view;a&&(a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+(" "+b.styleClass):b.styleClass;var c;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(c in a.style||
(a.style={}),b.style)a.style[c]||(a.style[c]=b.style[c]);if(b.attributes)for(c in a.attributes||(a.attributes={}),b.attributes)a.attributes[c]||(a.attributes[c]=b.attributes[c])}return a},_mergeStyleRanges:function(a,b){a||(a=[]);for(var c,d=e(a,b.start);d<a.length&&b;d++){var f=a[d];if(b.end<=f.start)break;if(!(b.start>=f.end)){c=this._mergeStyle({},f.style);c=this._mergeStyle(c,b.style);var g=[];g.push(d,1);b.start<f.start&&g.push({start:b.start,end:f.start,style:b.style});b.start>f.start&&g.push({start:f.start,
end:b.start,style:f.style});g.push({start:Math.max(f.start,b.start),end:Math.min(f.end,b.end),style:c});b.end<f.end&&g.push({start:b.end,end:f.end,style:f.style});b=b.end>f.end?{start:f.end,end:b.end,style:b.style}:null;Array.prototype.splice.apply(a,g)}}b&&(c=this._mergeStyle({},b.style),a.splice(d,0,{start:b.start,end:b.end,style:c}));return a},_onAnnotationModelChanged:function(a){function b(a,c){f.getBaseModel&&(a=f.mapOffset(a,!0),c=f.mapOffset(c,!0));-1!==a&&-1!==c&&d.redrawRange(a,c)}function c(a,
d){for(var f=0;f<a.length;f++)if(e.isAnnotationTypeVisible(a[f].type)){var g=a[f];b(g.start,g.end);d&&void 0!==g._oldStart&&g._oldEnd&&b(g._oldStart,g._oldEnd)}}var d=this._view;if(d){var e=this,f=d.getModel();c(a.added);c(a.removed);c(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,c=a.textView.getModel(),d=b.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;d!==c&&(e=c.mapOffset(e),f=c.mapOffset(f));for(b=b.getAnnotations(e,
f);b.hasNext();)if(e=b.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,g=e.end;d!==c&&(f=c.mapOffset(f,!0),g=c.mapOffset(g,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:g,style:e.rangeStyle})}e.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle))}}};f.addMixin(b.prototype);return{FoldingAnnotation:g,AnnotationType:h,AnnotationTypeList:f,AnnotationModel:c,AnnotationStyler:b}});
define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(k,l,h,g,d,f){function e(b){b=b||{};this._domNode=b.domNode;this._model=b.model;this._undoStack=b.undoStack;this._statusReporter=b.statusReporter;this._title=null;var a=this;this._listener={onChanged:function(b){a.onChanged(b)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function c(b){b=b||{};e.call(this,b);this._textViewFactory=b.textViewFactory;this._undoStackFactory=b.undoStackFactory;this._textDNDFactory=b.textDNDFactory;this._annotationFactory=b.annotationFactory;this._foldingRulerFactory=b.foldingRulerFactory;this._lineNumberRulerFactory=b.lineNumberRulerFactory;this._contentAssistFactory=b.contentAssistFactory;this._keyBindingFactory=b.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var b=g.AnnotationType;e.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(b,a){return this.getModel().getText(b,a)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},onChanged:function(b){this.checkDirty()},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},resize:function(){},setDirty:function(b){this._dirty!==b&&(this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,c,d){this._title=b;d||(a?this.reportStatus(a,"error"):null!==c&&void 0!==c&&"string"===typeof c&&this._setModelText(c),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:d})},setText:function(b,a,c){this.getModel().setText(b,a,c)},uninstall:function(){this.installed=!1}};l.EventTarget.addMixin(e.prototype);c.prototype=new e;
d.mixin(c.prototype,{destroy:function(){e.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=b,this._annotationRuler){var c=this._textView;b?c.addRuler(this._annotationRuler,0):c.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=
b,this._foldingRuler){var c=this._textView;c.getModel().getBaseModel&&(b?c.addRuler(this._foldingRuler):c.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var c=this._textView;b?c.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):c.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=
b,this._overviewRuler){var c=this._textView;b?c.addRuler(this._overviewRuler):c.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getLineAtOffset:function(b){return this.getModel().getLineAtOffset(this.mapOffset(b))},getLineStart:function(b){return this.getModel().getLineStart(b)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(),
b=b.getModel();b.getBaseModel&&(a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end));return a},_expandOffset:function(c){var a=this._textView.getModel(),d=this._annotationModel;if(d&&a.getBaseModel)for(c=d.getAnnotations(c,c+1);c.hasNext();)a=c.next(),a.type===b.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(b),b=e.mapOffset(b,!0));d.setCaretOffset(b,a,c)},setText:function(b,a,c){var d=this._textView,
e=d.getModel();e.getBaseModel&&(void 0!==a&&(this._expandOffset(a),a=e.mapOffset(a,!0)),void 0!==c&&(this._expandOffset(c),c=e.mapOffset(c,!0)));d.setText(b,a,c)},setSelection:function(b,a,c,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=f.mapOffset(b,!0),a=f.mapOffset(a,!0));e.setSelection(b,a,c,d)},moveSelection:function(b,a,c,d){var e=this._textView;this.setSelection(b,a||b,1/3,function(){(void 0===d||d)&&e.focus();c&&c()})},_getTooltipInfo:function(b,
a){var c=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;if(!e)return null;var f=c.getOffsetAtLocation(b,a);if(-1===f)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(d,f,f+1);d=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&d.push(e[f]);if(0===d.length)return null;c=c.convert({x:b,y:a},"document","page");return{contents:d,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(c,a){var d=this._annotationModel;if(d){var e=this._textView;if(!e.getOptions("singleMode")){var f=
e.getModel(),g=a?f.getLineAtOffset(a.start):-1,h=f.getLineAtOffset(c.start),e=c.start===c.end,k=!a||a.start===a.end,l=f.getLineStart(h),v=f.getLineEnd(h);f.getBaseModel&&(l=f.mapOffset(l),v=f.mapOffset(v));f=this._currentLineAnnotation;if(!(g===h&&k&&e&&f&&f.start===l&&f.end===v)){var g=f?[f]:null,x;e&&(f=b.createAnnotation(b.ANNOTATION_CURRENT_LINE,l,v),x=[f]);this._currentLineAnnotation=f;d.replaceAnnotations(g,x)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var c=this,a=this._textView,d=this;this._listener={onModelChanged:function(a){d.checkDirty()},onMouseOver:function(a){d._listener.onMouseMove(a)},onMouseMove:function(b){var c=
h.Tooltip.getTooltip(a);c&&!(d._listener.lastMouseX===b.event.clientX&&d._listener.lastMouseY===b.event.clientY)&&(d._listener.lastMouseX=b.event.clientX,d._listener.lastMouseY=b.event.clientY,c.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return d._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(b){var c=h.Tooltip.getTooltip(a);c&&!(d._listener.lastMouseX===b.event.clientX&&d._listener.lastMouseY===b.event.clientY)&&(d._listener.lastMouseX=b.event.clientX,d._listener.lastMouseY=b.event.clientY,
c.setTarget(null))},onScroll:function(b){(b=h.Tooltip.getTooltip(a))&&b.setTarget(null,0,0)},onSelection:function(a){d._updateCursorStatus();d._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var f;if(f="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(c,this._undoStack,this._contentAssist))this._textActions=f.textActions,this._linkedMode=f.linkedMode,this._sourceCodeActions=f.sourceCodeActions}f=function(a,d){if(void 0!==a&&-1!==a){for(var e=this.getView().getModel(),f=this.getAnnotationModel(),g=c.mapOffset(e.getLineStart(a)),
e=c.mapOffset(e.getLineEnd(a)),p=f.getAnnotations(g,e),m=null;p.hasNext();){var h=p.next();if(h.type===b.ANNOTATION_BOOKMARK){m=h;break}}m?f.removeAnnotation(m):(m=b.createAnnotation(b.ANNOTATION_BOOKMARK,g,e),m.title=void 0,f.addAnnotation(m))}};if(this._annotationFactory){var g=a.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))g.addAnnotationType(b.ANNOTATION_CURRENT_SEARCH),
g.addAnnotationType(b.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(b.ANNOTATION_ERROR),g.addAnnotationType(b.ANNOTATION_WARNING),g.addAnnotationType(b.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(b.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(b.ANNOTATION_CURRENT_LINE),g.addAnnotationType(b.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(b.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(b.ANNOTATION_SELECTED_LINKED_GROUP),g.addAnnotationType(b.ANNOTATION_CURRENT_LINKED_GROUP),g.addAnnotationType(b.ANNOTATION_LINKED_GROUP),
g.addAnnotationType("orion.annotation.highlightError");var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),p=this._annotationRuler=g.annotationRuler;p&&(p.onDblClick=f,p.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),p.addAnnotationType(b.ANNOTATION_ERROR),p.addAnnotationType(b.ANNOTATION_WARNING),p.addAnnotationType(b.ANNOTATION_TASK),p.addAnnotationType(b.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(p=this._overviewRuler=g.overviewRuler)p.addAnnotationType(b.ANNOTATION_CURRENT_SEARCH),p.addAnnotationType(b.ANNOTATION_MATCHING_SEARCH),p.addAnnotationType(b.ANNOTATION_READ_OCCURRENCE),p.addAnnotationType(b.ANNOTATION_WRITE_OCCURRENCE),p.addAnnotationType(b.ANNOTATION_CURRENT_BLAME),p.addAnnotationType(b.ANNOTATION_ERROR),p.addAnnotationType(b.ANNOTATION_WARNING),p.addAnnotationType(b.ANNOTATION_TASK),p.addAnnotationType(b.ANNOTATION_BOOKMARK),p.addAnnotationType(b.ANNOTATION_MATCHING_BRACKET),
p.addAnnotationType(b.ANNOTATION_CURRENT_BRACKET),p.addAnnotationType(b.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(b.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(b.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=f,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(b.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:a});e.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var b=this._textView;b&&(b.destroy(),
this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:b}),e.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var b=
this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c),a=a-b,b=this.getKeyModes(),d=0;d<b.length;d++){var e=b[d];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(f.formatMessage(k.lineColumn,c+1,a+1))},showAnnotations:function(c,a,d,e){var f=this._annotationModel;if(f){for(var g=[],h=[],k=f.getTextModel(),l=f.getAnnotations(),v;l.hasNext();)v=l.next(),-1!==a.indexOf(v.type)&&v.creatorID===this&&g.push(v);if(c)for(a=0;a<c.length;a++)if(v=c[a]){if(d)v=
d(v);else{var x;"number"===typeof v.line?(x=k.getLineStart(v.line-1),l=x+v.start-1,x=x+v.end-1):(l=v.start,x=v.end);var y=e(v);if(!y)continue;v=b.createAnnotation(y,l,x,v.description)}v.creatorID=this;h.push(v)}f.replaceAnnotations(g,h)}},showProblems:function(c){this.showAnnotations(c,[b.ANNOTATION_ERROR,b.ANNOTATION_WARNING,b.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return b.ANNOTATION_ERROR;case "warning":return b.ANNOTATION_WARNING;case "task":return b.ANNOTATION_TASK}return null})},
showOccurrences:function(c){this.showAnnotations(c,[b.ANNOTATION_READ_OCCURRENCE,b.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?b.ANNOTATION_READ_OCCURRENCE:b.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(c){var a=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!a){var h=f.createElement(e,"div");h.className="annotation blame";e.body.appendChild(h);var l=(e.defaultView||e.parentWindow).getComputedStyle(h).getPropertyValue("background-color");h.parentNode.removeChild(h);
var h=l.indexOf("("),p=l.indexOf(")"),l=l.substring(h+1,p);this._blameRGB=a=l.split(",").slice(0,3)}var r=function(){var a=g.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=d.mixin({},a.style);a.style.style=d.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},u=function(){var a=f.createElement(e,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");
-1===b&&(b=this.blame.Message.length);var c=f.createElement(e,"a");c.href=this.blame.CommitLink;c.appendChild(e.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(c);a.appendChild(f.createElement(e,"br"));a.appendChild(e.createTextNode(f.formatMessage(k.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},w=this.getModel();this.showAnnotations(c,[b.ANNOTATION_BLAME,b.ANNOTATION_CURRENT_BLAME],function(c){var e=w.getLineStart(c.Start-1),f=w.getLineEnd(c.End-1,!0),e=g.AnnotationType.createAnnotation(b.ANNOTATION_BLAME,
e,f,u),f=a.slice(0);f.push(c.Shade);e.style=d.mixin({},e.style);e.style.style=d.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+f.join()+")";e.groupId=c.Name;e.groupType=b.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=r;e.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+c.AuthorImage+'"/\x3e';e.blame=c;return e})},showSelection:function(b,a,c,d,e){"number"===typeof b?("number"!==typeof a&&(a=b),this.moveSelection(b,a)):"number"===typeof c&&(b=this.getModel().getLineStart(c-
1),"number"===typeof d&&(b+=d),"number"!==typeof e&&(e=0),this.moveSelection(b,b+e))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(b,a,c,d,f){e.prototype.setInput.call(this,b,a,c,d);this._textView&&!d&&!f&&this._textView.focus()},onGotoLine:function(b,a,c,d){if(this._textView){var e=this.getModel();b=Math.max(0,Math.min(b,e.getLineCount()-1));var f=
e.getLineStart(b),g=0;void 0===c&&(c=0);"string"===typeof a?(b=e.getLine(b).indexOf(a),-1!==b&&(g=b,c=g+a.length)):(g=a,a=e.getLineEnd(b)-f,g=Math.min(g,a),c=Math.min(c,a));this.moveSelection(f+g,f+c,d)}}});return{BaseEditor:e,Editor:c}});
define("orion/editor/find","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/regex orion/objects orion/util".split(" "),function(k,l,h,g,d,f,e){function c(a){var b=a.getTextView();h.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var c=this;this._listener={onVerify:function(a){var b=c.editor,e=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(f,b);if((e=c._prefix.match(RegExp("^"+d.escape(e),"i")))&&0<e.length)c._prefix+=a.text,c._success=!0,c._status(),c.find(c._forward,!0),a.text=null},onSelection:function(){c._ignoreSelection||c.setActive(!1)}}}function b(a,b,c){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var d=this;this._listeners={onEditorFocus:function(a){d._removeCurrentAnnotation(a)}};this.setOptions(c)}}var n={};c.prototype=new h.KeyMode;f.mixin(c.prototype,{createKeyBindings:function(){var a=l.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var c=this._prefix;if(0===c.length)return!1;var d=this.editor,e=d.getModel(),e=a?this._success?b?this._start:d.getCaretOffset()+
1:0:this._success?b?this._start:d.getCaretOffset():e.getCharCount()-1;(c=d.getModel().find({string:c,start:e,reverse:!a,caseInsensitive:c.toLowerCase()===c}).next())?(b||(this._start=e),this._ignoreSelection=this._success=!0,d.moveSelection(a?c.start:c.end,a?c.end:c.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){this._active!==a&&(this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status())},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return 0===a.length?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?k.incrementalFindStr:k.incrementalFindStrNotFound:this._success?k.incrementalFindReverseStr:k.incrementalFindReverseStrNotFound;a=e.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
n.IncrementalFind=c;b.prototype={find:function(a,b,c){this.setOptions({reverse:!a});var d=this.getFindString(),e;b&&(d=b.findString||d,e=b.count);a=this.getOptions();this.setOptions(b);b=c?this._startOffset:this.getStartOffset();if((e=this._doFind(d,b,e))&&!c)this._startOffset=e.start;this.setOptions(a);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=d.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null));this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",c=!1,d=this._editor.getModel().getLineDelimiter(),e=0;e<a.length;e++){var f=a.substring(e,e+1);if(c){switch(f){case "R":b+=d;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}c=!1}else"\\"===f?c=!0:b+=f}c&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,c=this._processReplaceString(this.getReplaceString()),d=b.getSelection().start;if(b=b.getModel().find({string:a,start:d,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,c),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var b=this._editor,c=b.getTextView();b.reportStatus(k.replaceAll);var d=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var g=0,h=0;;){var n=f._doFind(a,g,null,!0);if(!n)break;h++;1===h&&(c.setRedraw(!1),f.startUndo());f._doReplace(n.start,n.end,a,d);g=f.getStartOffset()}0<
h&&(f.endUndo(),c.setRedraw(!0));0<g?b.reportStatus(e.formatMessage(k.replacedMatches,h)):b.reportStatus(k.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(g.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(a));this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,c){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,c,d){c=c||1;var e=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var f,h;if(this._regex)try{h=this._find(a,b,d)}catch(n){e.reportStatus(n.message,
"error");return}else h=this._find(a,b,d);for(a=0;a<c&&h.hasNext();a++)f=h.next();if(!this._replacingAll){f?this._editor.reportStatus(""):this._editor.reportStatus(k.notFound,"error");if(this.isVisible()){c=g.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(h=e.getAnnotationModel())h.removeAnnotations(c),f&&h.addAnnotation(g.AnnotationType.createAnnotation(c,f.start,f.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var l=this;this._timer=window.setTimeout(function(){l._markAllOccurrences();
l._timer=null},500)}}this._findCallback?this._findCallback(f):f&&e.moveSelection(f.start,f.end,null,!1)}return f},_doReplace:function(a,b,c,d){var e=this._editor;if(!this._regex||!(d=e.getText(a,b).replace(RegExp(c,this._caseInsensitive?"i":""),d),!d))e.setText(d,a,b),e.setSelection(a,a+d.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=g.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=a.getAnnotations(),d=[],e;c.hasNext();){var f=c.next();f.type===b&&
d.push(f)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(e=[];c.hasNext();)f=c.next(),e.push(g.AnnotationType.createAnnotation(b,f.start,f.end))}a.replaceAnnotations(d,e)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(g.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(a){(a=this._editor.getAnnotationModel())&&a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};n.Find=b;return n});
define("orion/editor/actions","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/annotations orion/editor/tooltip orion/editor/find orion/util".split(" "),function(k,l,h,g,d,f){function e(a,b,c){this.editor=a;this.undoStack=b;this._incrementalFind=new d.IncrementalFind(a);this._find=c?c:new d.Find(a,b);this._lastEditLocation=null;this.init()}function c(a,b,c,d){this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var b=h.AnnotationType,n={};e.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){this.editor.isDirty()&&(this._lastEditLocation=a.start+a.addedCharCount)}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:k.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:k.redo});a.setKeyBinding(new l.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(k.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:k.find});a.setKeyBinding(new l.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:k.findNext});a.setKeyBinding(new l.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:k.findPrevious});a.setKeyBinding(new l.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:k.incrementalFind});a.setKeyBinding(new l.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:k.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:k.unindentLines});a.setKeyBinding(new l.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:k.moveLinesUp});a.setKeyBinding(new l.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:k.moveLinesDown});a.setKeyBinding(new l.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:k.copyLinesUp});a.setKeyBinding(new l.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:k.copyLinesDown});a.setKeyBinding(new l.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:k.deleteLines});a.setKeyBinding(new l.KeyBinding("l",!f.isMac,!1,!1,f.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:k.gotoLine});a.setKeyBinding(new l.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:k.nextAnnotation});a.setKeyBinding(new l.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:k.prevAnnotation});a.setKeyBinding(new l.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:k.expand});a.setKeyBinding(new l.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:k.collapse});a.setKeyBinding(new l.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:k.expandAll});a.setKeyBinding(new l.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:k.collapseAll});a.setKeyBinding(new l.KeyBinding("q",!f.isMac,!1,!1,f.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:k.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=b.getLineStart(d),d=b.getLineEnd(c,!0),f=b.getLineCount(),g="",e=b.getText(e,d);c===f-1&&(e=(g=b.getLineDelimiter())+e);a.setText(e,d,d);a.setSelection(d+g.length,d+e.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-
1:c.end),d=b.getLineStart(d),e=b.getLineEnd(c,!0),f=b.getLineCount(),g="",e=b.getText(d,e);c===f-1&&(e+=g=b.getLineDelimiter());a.setText(e,d,d);a.setSelection(d,d+e.length-g.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=1;a&&a.count&&(c=a.count);var d=b.getSelection(),e=b.getModel(),f=e.getLineAtOffset(d.start);a=e.getLineStart(f);c=d.start!==d.end||1===c?e.getLineAtOffset(d.end>d.start?d.end-1:d.end):Math.min(f+c-1,e.getLineCount()-
1);c=e.getLineEnd(c,!0);b.setText("",a,c);return!0},expandAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();if(!c)return!0;var d=b.getModel(),e=b.getCaretOffset(),f=d.getLineAtOffset(e),e=d.getLineStart(f),f=d.getLineEnd(f,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d.getBaseModel());for(var g,c=c.getAnnotations(e,f);!g&&c.hasNext();)d=c.next(),d.type===h.AnnotationType.ANNOTATION_FOLDING&&(g=d);g&&a!==g.expanded&&(a?g.expand():(b.setCaretOffset(g.start),g.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,c=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var d=b.getAnnotations();for(c.setRedraw(!1);d.hasNext();)b=d.next(),b.type===h.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());c.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>
d.start?d.end-1:d.end);if(e!==f){var g=[];g.push("");for(var h=e;h<=f;h++)g.push(c.getLine(h,!0));h=c.getLineStart(e);c=c.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(g.join(b),h,c);a.setSelection(h===d.start?d.start:d.start+b.length,d.end+(f-e+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,
b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(k.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount();if(e===f-1)return!0;var d=b.getLineStart(d),c=b.getLineEnd(e,!0),g=b.getLineEnd(e+1,!0)-(c-d),h=0;e!==f-2?b=b.getText(d,c):(e=b.getLineEnd(e),
b=b.getText(e,c)+b.getText(d,e),h+=c-e);this.startUndo();a.setText("",d,c);a.setText(b,g,g);a.setSelection(g+h,g+h+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start);if(0===d)return!0;var e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount(),c=b.getLineStart(d-1),g=b.getLineStart(d),h=b.getLineEnd(e,!0),k=b.getText(g,h),n=0;e===f-1&&(e=b.getLineEnd(d-
1),d=b.getLineEnd(d-1,!0),k+=b.getText(e,d),g=e,n=d-e);this.startUndo();a.setText("",g,h);a.setText(k,c,c);a.setSelection(c,c+k.length-n);this.endUndo();return!0},nextAnnotation:function(a){function c(a){return!!a.lineStyle||a.type===b.ANNOTATION_MATCHING_BRACKET||a.type===b.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var d=this.editor,e=d.getAnnotationModel();if(!e)return!0;var f=d.getOverviewRuler()||d.getAnnotationStyler();if(!f)return!0;for(var h=d.getModel(),k=d.getCaretOffset(),
n=e.getAnnotations(a?k:0,a?h.getCharCount():k),l=null;n.hasNext();){var x=n.next();if(a){if(x.start<=k)continue}else if(x.start>=k)continue;if(!c(x)&&(l=x,a))break}if(l){for(var y=[l],n=e.getAnnotations(l.start,l.start);n.hasNext();)x=n.next(),x!==l&&!c(x)&&y.push(x);var A=d.getTextView(),q=h.getLineAtOffset(l.start),B=g.Tooltip.getTooltip(A);if(!B)return d.moveSelection(l.start),!0;d.moveSelection(l.start,l.start,function(){B.setTarget({getTooltipInfo:function(){var a=A.convert({x:A.getLocationAtOffset(l.start).x,
y:A.getLocationAtOffset(h.getLineStart(q)).y},"document","page");return{contents:y,x:a.x,y:a.y+Math.floor(1.33*A.getLineHeight(q))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=b.getOptions("tabSize"),h=Array(g+1).join(" "),k=[],n=b=0,l=e;l<=f;l++){var A=c.getLine(l,!0);if(c.getLineStart(l)!==
c.getLineEnd(l))if(0===A.indexOf("\t"))A=A.substring(1),b++;else if(0===A.indexOf(h))A=A.substring(g),b+=g;else return!0;l===e&&(n=b);k.push(A)}e=c.getLineStart(e);g=c.getLineEnd(f,!0);c=c.getLineStart(f);a.setText(k.join(""),e,g);f=e===d.start?d.start:d.start-n;d=Math.max(f,d.end-b+(d.end===c+1&&d.start!==d.end?1:0));a.setSelection(f,d);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};n.TextActions=
e;c.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new l.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:k.trimTrailingWhitespaces});a.setKeyBinding(new l.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:k.toggleLineComment});a.setKeyBinding(new l.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:k.addBlockComment});a.setKeyBinding(new l.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:k.removeBlockComment});a.setKeyBinding(new l.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new l.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new l.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new l.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new l.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new l.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new l.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var c=a.getSelection();if(c.start===c.end){for(var d=a.getModel(),e=d.getLineAtOffset(c.start),
f=d.getLine(e,!1),g=d.getLineStart(e),h=0,k=c.start-g,n;h<k&&(32===(n=f.charCodeAt(h))||9===n);)h++;var g=f.substring(0,h),b=b.getOptions("tabSize","expandTab"),l=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=d.getLineDelimiter(),A=/^[\s]*\/\*[\*]*[\s]*$/,q=/^[\s]*\*/,B=/\*\/[\s]*$/,z=f.substring(0,k),C=f.substring(k),L;if(this.smartIndentation&&123===f.charCodeAt(L=z.trimRight().length-1))return d=k-L-1,C=C.length-C.trimLeft().length,f=125===f.charCodeAt(k+C)?b+g+l+b+g:b+g+l,a.setText(f,c.start-
d,c.end+C),a.setCaretOffset(c.start+b.length+g.length+l.length-d),!0;if(this.autoCompleteComments&&!B.test(z)&&(A.test(z)||q.test(z))){if(A.exec(z)){f=b+g+" * ";f=B.test(C)?f+C.substring(0,C.length-2).trim():f+C.trim();if(d.getLineCount()===e+1||!q.test(d.getLine(e+1)))f+=b+g+" */";a.setText(f,c.start,c.end+C.length);a.setCaretOffset(c.start+b.length+g.length+3);return!0}if(q.exec(z))for(e-=1;0<=e;e--){h=d.getLine(e,!1);if(A.test(h))return B.test(C)||47===f.charCodeAt(k)?(f=b+g+"*"+C,g=c.start+b.length+
g.length+1):(f=b+g+"* "+C,g=c.start+b.length+g.length+2),a.setText(f,c.start,c.end+C.length),a.setCaretOffset(g),!0;if(!q.test(h))break}}else{if(B.test(z)&&32===g.charCodeAt(g.length-1))return f=b+g.substring(0,g.length-1),a.setText(f,c.start,c.end),a.setCaretOffset(c.start+f.length),!0;if(0<h){for(h=k;h<f.length&&(32===(n=f.charCodeAt(h++))||9===n);)c.end++;a.setText(d.getLineDelimiter()+g,c.start,c.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),c=a.getSelection(),d=this._findEnclosingComment(b,c.start,c.end);if(void 0!==d.commentStart&&void 0!==d.commentEnd)return!0;b=b.getText(c.start,c.end);if(0===b.length)return!0;var d=b.length,b=b.replace(/\/\*|\*\//g,""),e=b.length;a.setText("/*"+b+"*/",c.start,c.end);a.setSelection(c.start+2,c.end+2+(e-d));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel(),f=c.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),g=/^$|[)}\]>]/;return d.start===d.end&&g.test(f)?(c.setText(a+b,d.start,d.start),c.setCaretOffset(d.start+1),!0):d.start!==d.end?(e=e.getText(d.start,d.end),c.setText(a+e+b,d.start,d.end),c.setSelection(d.start+1,d.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel(),e=b.getCaretOffset(),f=0===e?"":d.getText(c.start-1,c.start).trim(),g=e===d.getCharCount()?"":d.getText(c.start,c.start+1).trim(),e=/^"$|^'$/,h=/\w/,k=/^$|[)}\]>]/;if(c.start!==c.end){d=d.getText(c.start,c.end);if(e.test(d))return!1;b.setText(a+d+a,c.start,c.end);b.setSelection(c.start+1,c.end+1)}else{if(g!==a){if(f===a||e.test(g)||h.test(f)||!k.test(g))return!1;b.setText(a+a,c.start,c.start)}b.setCaretOffset(c.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],c=0;c<a.positions.length;++c)b[c]={positions:[{offset:a.positions[c].offset,length:a.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);
return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var c=a.getModel(),d=a.getCaretOffset(),e=0===d?"":c.getText(b.start-1,b.start),c=d===c.getCharCount()?"":c.getText(b.start,b.start+1);("("===e&&")"===c||"["===e&&"]"===c||"{"===e&&"}"===c||"\x3c"===e&&"\x3e"===c||'"'===e&&'"'===c||"'"===e&&"'"===c)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,c){var d=a.getLineAtOffset(b),
e=a.getLineAtOffset(c),f,g,h,k,n,l;for(f=d;0<=f&&!(g=a.getLine(f),h=f===d?b-a.getLineStart(d):g.length,k=g.lastIndexOf("/*",h),g=g.lastIndexOf("*/",h),g>k);f--)if(-1!==k){n=a.getLineStart(f)+k;break}for(f=e;f<a.getLineCount()&&!(g=a.getLine(f),h=f===e?c-a.getLineStart(e):0,k=g.indexOf("/*",h),g=g.indexOf("*/",h),-1!==k&&k<g);f++)if(-1!==g){l=a.getLineStart(f)+g;break}return{commentStart:n,commentEnd:l}},lineStart:function(){for(var a=this.editor,b=a.getModel(),c=a.getCaretOffset(),d=b.getLineAtOffset(c),
e=b.getLineStart(d),b=b.getLine(d),d=0;d<b.length;d++){var f=b.charCodeAt(d);if(!(32===f||9===f))break}d+=e;return c!==d?(a.setSelection(d,d),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getText(c.start,c.end),e,f,g;for(g=0;g<d.length;g++)if("/*"===d.substring(g,g+2)){e=c.start+g;break}for(;g<d.length;g++)if("*/"===d.substring(g,g+2)){f=c.start+g;break}if(void 0!==e&&void 0!==f)a.setText(b.getText(e+
2,f),e,f+2),a.setSelection(e,f);else{d=this._findEnclosingComment(b,c.start,c.end);if(void 0===d.commentStart||void 0===d.commentEnd)return!0;b=b.getText(d.commentStart+2,d.commentEnd);a.setText(b,d.commentStart,d.commentEnd+2);a.setSelection(c.start-2,c.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=this.lineComment||"//",c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-
1:d.end),g=!0,h=[],k,n,l=e;l<=f;l++)if(k=c.getLine(l,!0),h.push(k),!g||-1===(n=k.indexOf(b)))g=!1;else if(0!==n){var A;for(A=0;A<n;A++){var q=k.charCodeAt(A);if(!(32===q||9===q))break}g=A===n}q=b.length;l=c.getLineStart(e);A=c.getLineEnd(f,!0);if(g){for(g=0;g<h.length;g++)k=h[g],n=k.indexOf(b),h[g]=k.substring(0,n)+k.substring(n+q);b=h.join("");h=c.getLineStart(f);c=l===d.start?d.start:d.start-q;d=d.end-q*(f-e+1)+(d.end===h+1?q:0)}else h.splice(0,0,""),b=h.join(b),c=l===d.start?d.start:d.start+q,
d=d.end+q*(f-e+1);a.setText(b,l,A);a.setSelection(c,d);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),c=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var d=/(\s+$)/,e=b.getLineCount(),f=0;f<e;f++){var g=b.getLine(f),h=d.exec(g);if(h){var k=b.getLineStart(f),g=h[0].length,h=k+h.index;b.setText("",h,h+g);c.start>h&&(c.start=Math.max(h,c.start-g));c.start!==c.end&&c.end>h&&(c.end=Math.max(h,c.end-g))}}a.getUndoStack().endCompoundChange();
a.getTextView().setRedraw(!0);a.setSelection(c.start,c.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel();return(b.getCaretOffset()===d.getCharCount()?"":d.getText(c.start,c.start+1))===a?(b.setCaretOffset(c.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(a){this.autoPairParentheses=
a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};n.SourceCodeActions=c;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,
"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return n});
define("orion/editor/undoStack",[],function(){function k(g,d,f,e,c){this.model=g;this.offset=d;this.text=f;this.previousText=e;this.type=c}function l(g){this.owner=g;this.changes=[]}function h(g,d){this.size=void 0!==d?d:100;this.reset();var f=this;this._listener={onChanging:function(c){f._onChanging(c)},onDestroy:function(c){f._onDestroy(c)}};if(g.getModel){var e=g.getModel();e.getBaseModel&&(e=e.getBaseModel());this.model=e;this.setView(g)}else this.shared=!0,this.model=g;this.model.addEventListener("Changing",
this._listener.onChanging)}k.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(g,d){this._doUndoRedo(this.offset,this.previousText,this.text,g,d);return!0},redo:function(g,d){this._doUndoRedo(this.offset,this.text,this.previousText,g,d);return!0},merge:function(g,d,f,e,c){if(e===this.type){if(1===e&&g===
this.offset+this.text.length)return this.text+=d,!0;if(-1===e&&c===this.offset)return this.offset=g,this.previousText=f+this.previousText,!0;if(-1===e&&g===this.offset)return this.previousText+=f,!0}return!1},_doUndoRedo:function(g,d,f,e,c){this.model.setText(d,g,g+f.length);c&&e&&(f=e.getModel(),f!==this.model&&(g=f.mapOffset(g,!0)),e.setSelection(g,g+d.length))}};l.prototype={getRedoChanges:function(){for(var g=[],d=0;d<this.changes.length;d++)g=g.concat(this.changes[d].getRedoChanges());return g},
getUndoChanges:function(){for(var g=[],d=this.changes.length-1;0<=d;d--)g=g.concat(this.changes[d].getUndoChanges());return g},add:function(g){this.changes.push(g)},end:function(g){g&&(this.endSelection=g.getSelection(),this.endCaret=g.getCaretOffset());(g=this.owner)&&g.end&&g.end()},undo:function(g,d){1<this.changes.length&&g&&g.setRedraw(!1);for(var f=this.changes.length-1;0<=f;f--)this.changes[f].undo(g,!1);1<this.changes.length&&g&&g.setRedraw(!0);if(d&&g){var f=this.startSelection.start,e=this.startSelection.end;
g.setSelection(this.startCaret?f:e,this.startCaret?e:f)}(f=this.owner)&&f.undo&&f.undo();return 0<this.changes.length},redo:function(g,d){1<this.changes.length&&g&&g.setRedraw(!1);for(var f=0;f<this.changes.length;f++)this.changes[f].redo(g,!1);(1<this.changes.length,g)&&g.setRedraw(!0);if(d&&g){var f=this.endSelection.start,e=this.endSelection.end;g.setSelection(this.endCaret?f:e,this.endCaret?e:f)}(f=this.owner)&&f.redo&&f.redo();return 0<this.changes.length},merge:function(g,d,f,e,c){var b=this.changes.length;
return 0<b?this.changes[b-1].merge(g,d,f,e,c):!1},start:function(g){g&&(this.startSelection=g.getSelection(),this.startCaret=g.getCaretOffset());(g=this.owner)&&g.start&&g.start()}};h.prototype={destroy:function(){this._onDestroy()},add:function(g){this.compoundChange?this.compoundChange.add(g):(this.stack.splice(this.index,this.stack.length-this.index,g),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var g=[],d=this.index;d<this.stack.length;d++)g=g.concat(this.stack[d].getRedoChanges());
return g},getUndoChanges:function(){this._commitUndo();for(var g=[],d=this.index;0<=d;d--)g=g.concat(this.stack[d].getUndoChanges());return g},undo:function(){this._commitUndo();var g;g=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;g=this.stack[--this.index]}while(!(g=g.undo(this.view,!0)));this._ignoreUndo=!1;return g},redo:function(){this._commitUndo();var g;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;g=this.stack[this.index++]}while(!g.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(g){this.view!==g&&(this.view&&g.removeEventListener("Destroy",this._listener.onDestroy),(this.view=g)&&g.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(g){this._commitUndo();g=new l(g);this.add(g);this.compoundChange=g;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(g){(!g||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(g){if(!this._ignoreUndo){var d=g.text,f=g.start,e=g.addedCharCount,c=g.removedCharCount;g=f+c;var b=0;0===e&&1===c?b=-1:1===e&&0===c&&(b=1);e=this.stack.length;c=this.model.getText(f,g);(!(0<e&&this.index===e)||!this.stack[e-1].merge(f,d,c,b,g))&&this.add(new k(this.model,
f,d,c,b))}}};return{UndoStack:h}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(k,l,h,g){function d(b,a,c,d){this._location=a||"left";this._overview=c||"page";this._rulerStyle=d;this._view=null;var e=this;this._listener={onTextModelChanged:function(a){e._onTextModelChanged(a)},onAnnotationModelChanged:function(a){e._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function f(b,a,c,e,f){d.call(this,b,a,"page",c);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function e(b,a,c){d.call(this,b,a,"page",c)}function c(b,a,c){d.call(this,b,a,"document",c)}function b(b,a,c){e.call(this,b,a,c)}d.prototype={getAnnotations:function(b,a){var c=this._annotationModel;if(!c)return[];var d=this._view.getModel(),e=d.getLineStart(b),f=d.getLineEnd(a-1),g=d;d.getBaseModel&&(g=d.getBaseModel(),e=d.mapOffset(e),f=d.mapOffset(f));for(var h=[],c=this.getAnnotationsByType(c,e,f),e=0;e<
c.length;e++)for(var f=c[e],k=g.getLineAtOffset(f.start),l=g.getLineAtOffset(Math.max(f.start,f.end-1)),x=k;x<=l;x++){var y=x;if(d!==g){y=g.getLineStart(x);y=d.mapOffset(y,!0);if(-1===y)continue;y=d.getLineAtOffset(y)}if(b<=y&&y<a){var A=this._mergeAnnotation(h[y],f,x-k,l-k+1);A&&(h[y]=A)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var q in h)h[q]._multiple&&(h[q].html+=this._multiAnnotationOverlay.html);return h},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=
b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b,a){if(void 0!==b){var c=this._view,d=c.getModel(),e=d,f=d.getLineStart(b),g=f,k=f,l=this._annotationModel;if(l){c=c.getSelection();k=d.getLineEnd(b,!0);f<=c.start&&c.start<k&&(f=c.start);d.getBaseModel&&(f=d.mapOffset(f),
k=d.mapOffset(k),e=d.getBaseModel());for(var v,k=l.getAnnotations(f,k),l=null;!v&&k.hasNext();)c=k.next(),this.isAnnotationTypeVisible(c.type)&&(l=c,c.start<=f||(v=c));l&&void 0!==l.groupId&&(this._currentClickGroup=this._currentClickGroup===l.groupId?null:l.groupId,this._setCurrentGroup(b));v&&e.getLineAtOffset(v.start)===e.getLineAtOffset(f)?(f=v.start,k=v.end):k=f=g;d.getBaseModel&&(f=d.mapOffset(f,!0),k=d.mapOffset(k,!0))}(d=h.Tooltip.getTooltip(this._view))&&d.setTarget(null);this._view.setSelection(k,
f,1/3,function(){})}},onDblClick:function(b,a){},onMouseMove:function(b,a){var c=h.Tooltip.getTooltip(this._view);if(c&&!(c.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var d=this;c.setTarget({y:a.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(b,a){this._currentClickGroup||this._setCurrentGroup(-1);var c=h.Tooltip.getTooltip(this._view);
c&&c.setTarget(null)},_getTooltipInfo:function(b,a){if(void 0!==b){var c=this._view,d=c.getModel(),e=this._annotationModel,f=[];if(e){var f=d.getLineStart(b),g=d.getLineEnd(b);d.getBaseModel&&(f=d.mapOffset(f),g=d.mapOffset(g));f=this.getAnnotationsByType(e,f,g)}e=this._getTooltipContents(b,f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=c.getClientArea();"document"===this.getOverview()?f.y=c.convert({y:a},"view","document").y:f.y=c.getLocationAtOffset(d.getLineStart(b)).y;c.convert(f,
"document","page");e.x=f.x;e.y=f.y;"right"===e.anchor&&(e.x+=f.width);return e}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(e.isAnnotationTypeVisible(a[b].type)){var f=a[b].start,g=a[b].end;d.getBaseModel&&(f=d.mapOffset(f,!0),g=d.mapOffset(g,!0));-1!==f&&-1!==g&&c.redrawLines(d.getLineAtOffset(f),d.getLineAtOffset(Math.max(f,g-1))+1,e)}}var c=this._view;if(c){var d=c.getModel(),e=this,f=d.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,d.getBaseModel&&(b=d.mapOffset(b,!0)),b=d.getLineAtOffset(b),c.redrawLines(b,f,e)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,c,d){b||(b={});0===c&&(b.html&&a.html?(a.html!==b.html&&!b._multiple&&this._multiAnnotation&&(b.html=this._multiAnnotation.html),b._multiple=!0):b.html=a.html);b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass=b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+(" "+a.styleClass):a.styleClass;var c;if(a.style)for(c in b.style||(b.style={}),a.style)void 0===b.style[c]&&(b.style[c]=a.style[c]);if(a.attributes)for(c in b.attributes||(b.attributes={}),a.attributes)void 0===b.attributes[c]&&(b.attributes[c]=a.attributes[c])}return b},_setCurrentGroup:function(b){var a=this._annotationModel,c=null,d=a.getTextModel(),e,f=this._currentGroupAnnotation;if(-1!==b){var g=d.getLineStart(b),h=d.getLineEnd(b);d.getBaseModel&&(g=d.mapOffset(g),h=d.mapOffset(h));
for(e=a.getAnnotations(g,h);e.hasNext();)if(d=e.next(),this.isAnnotationTypeVisible(d.type)&&d.start<=g&&d.end>=h&&void 0!==d.groupId){c=d;break}if(f&&c&&f.groupId===c.groupId)return}this._currentGroupAnnotation=null;f&&a.removeAnnotations(f.groupType);if(c&&-1!==b){this._currentGroupAnnotation=c;e=a.getAnnotations();for(b=[];e.hasNext();)d=e.next(),delete d.groupAnnotation,d.groupId===c.groupId&&(d=d.createGroupAnnotation(),b.push(d));a.replaceAnnotations(null,b)}}};l.AnnotationTypeList.addMixin(d.prototype);
f.prototype=new d;f.prototype.getAnnotations=function(b,a){for(var c=d.prototype.getAnnotations.call(this,b,a),e=this._view.getModel(),f=b;f<a;f++){var g=f&1?this._oddStyle:this._evenStyle,h=f;e.getBaseModel&&(h=e.getLineStart(h),h=e.getBaseModel().getLineAtOffset(e.mapOffset(h)));c[f]||(c[f]={});c[f].html=this._firstLine+h+"";c[f].style||(c[f].style=g)}return c};f.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};f.prototype.setFirstLine=
function(b){this._firstLine=void 0!==b?b:1};f.prototype._onTextModelChanged=function(b){var a=b.start;b=this._view.getModel();var c=b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount(),c=(this._firstLine+c-1+"").length;this._numOfDigits!==c&&(this._numOfDigits=c,a=b.getLineAtOffset(a),this._view.redrawLines(a,b.getLineCount(),this))};e.prototype=new d;c.prototype=new d;c.prototype.getRulerStyle=function(){return this._mergeStyle({style:{lineHeight:"1px",fontSize:"1px"}},this._rulerStyle)};
c.prototype._getTooltipContents=function(b,a){if(0===a.length){var c=this._view.getModel(),e=b;c.getBaseModel&&(e=c.getLineStart(e),e=c.getBaseModel().getLineAtOffset(c.mapOffset(e)));return g.formatMessage(k.line,e+1)}return d.prototype._getTooltipContents.call(this,b,a)};c.prototype._mergeAnnotation=function(b,a,c,d){if(0===c)return b||(b={html:"\x26nbsp;",style:{style:{height:3*d+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle)),b};b.prototype=new e;b.prototype.onClick=function(b,a){if(void 0!==
b){var c=this._annotationModel;if(c){var d=this._view.getModel(),e=d.getLineStart(b),f=d.getLineEnd(b,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d=d.getBaseModel());for(var g,c=c.getAnnotations(e,f);!g&&c.hasNext();)f=c.next(),this.isAnnotationTypeVisible(f.type)&&d.getLineAtOffset(f.start)===d.getLineAtOffset(e)&&(g=f);g&&((d=h.Tooltip.getTooltip(this._view))&&d.setTarget(null),g.expanded?g.collapse():g.expand())}}};b.prototype._getTooltipContents=function(b,a){if(0<a.length){var c=this._view.getModel(),
d=c.getLineStart(b);c.getBaseModel&&(d=c.mapOffset(d),c=c.getBaseModel());for(var d=c.getLineAtOffset(d),f=0;f<a.length;f++){var g=a[f];if(this.isAnnotationTypeVisible(g.type)&&c.getLineAtOffset(g.start)===d){if(a[f].expanded)break;return e.prototype._getTooltipContents.call(this,b,[g])}}}return null};b.prototype._onAnnotationModelChanged=function(b){function a(a){for(g=0;g<a.length;g++)if(f.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;d.getBaseModel&&(b=d.mapOffset(b,!0));-1!==b&&(k=Math.min(k,
d.getLineAtOffset(b)))}}if(b.textModelChangedEvent)e.prototype._onAnnotationModelChanged.call(this,b);else{var c=this._view;if(c){var d=c.getModel(),f=this,g,h=d.getLineCount(),k=h;a(b.added);a(b.removed);a(b.changed);b=c.getRulers();for(g=0;g<b.length;g++)c.redrawLines(k,h,b[g])}}};return{Ruler:d,AnnotationRuler:e,LineNumberRuler:f,OverviewRuler:c,FoldingRuler:b}});
define("orion/editor/textDND",["orion/util"],function(k){function l(h,g){this._view=h;this._undoStack=g;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var d=this;this._listener={onDragStart:function(f){d._onDragStart(f)},onDragEnd:function(f){d._onDragEnd(f)},onDragEnter:function(f){d._onDragEnter(f)},onDragOver:function(f){d._onDragOver(f)},onDrop:function(f){d._onDrop(f)},onDestroy:function(f){d._onDestroy(f)}};h.addEventListener("DragStart",this._listener.onDragStart);h.addEventListener("DragEnd",
this._listener.onDragEnd);h.addEventListener("DragEnter",this._listener.onDragEnter);h.addEventListener("DragOver",this._listener.onDragOver);h.addEventListener("Drop",this._listener.onDrop);h.addEventListener("Destroy",this._listener.onDestroy)}l.prototype={destroy:function(){var h=this._view;h&&(h.removeEventListener("DragStart",this._listener.onDragStart),h.removeEventListener("DragEnd",this._listener.onDragEnd),h.removeEventListener("DragEnter",this._listener.onDragEnter),h.removeEventListener("DragOver",
this._listener.onDragOver),h.removeEventListener("Drop",this._listener.onDrop),h.removeEventListener("Destroy",this._listener.onDestroy),this._view=null)},_onDestroy:function(h){this.destroy()},_onDragStart:function(h){var g=this._view,d=g.getSelection(),g=g.getModel();g.getBaseModel&&(d.start=g.mapOffset(d.start),d.end=g.mapOffset(d.end),g=g.getBaseModel());if(g=g.getText(d.start,d.end))this._dragSelection=d,h.event.dataTransfer.effectAllowed="copyMove",h.event.dataTransfer.setData("Text",g)},_onDragEnd:function(h){if(this._dragSelection){var g=
this._view,d=h.event.dataTransfer.dropEffect;if(!k.isFirefox&&("none"!==d||this._dropText))d=h.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(h="move"===d)&&g.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var d=this._dropText,f=this._dropOffset;h&&(f>=this._dragSelection.end?f-=this._dragSelection.end-this._dragSelection.start:f>=this._dragSelection.start&&(f=this._dragSelection.start));g.setText(d,f,f);g.setSelection(f,
f+d.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(h){this._onDragOver(h)},_onDragOver:function(h){var g=h.event.dataTransfer.types,d=!this._view.getOptions("readonly");d&&g&&(d=g.contains?g.contains("text/plain")||g.contains("Text"):-1!==g.indexOf("text/plain")||-1!==g.indexOf("Text"));d?k.isFirefox||(this._dropEffect=h.event.dataTransfer.dropEffect=(k.isMac?h.event.altKey:h.event.ctrlKey)?"copy":
"move"):h.event.dataTransfer.dropEffect="none"},_onDrop:function(h){var g=this._view,d=h.event.dataTransfer.getData("Text");d&&(k.isFirefox||(h.event.dataTransfer.dropEffect=this._dropEffect),h=g.getOffsetAtLocation(h.x,h.y),this._dragSelection?(this._dropOffset=h,this._dropText=d):(g.setText(d,h,h),g.setSelection(h,h+d.length)))}};return{TextDND:l}});
define("orion/editor/templates",[],function(){function k(h,g,d,f){this.prefix=h;this.description=g;this.template=d;this.name=f;this._parse()}function l(h,g){this._keywords=h||[];this._templates=[];this.addTemplates(g||[])}k.prototype={getProposal:function(h,g,d){h=g-h.length;g={};var f,e=void 0!==d.delimiter?d.delimiter:"\n";d.indentation&&(e+=d.indentation);var c=void 0!==d.tab?d.tab:"\t",b=0,k=this.variables,a=this.segments;d=[];for(var m=0;m<a.length;m++){var l=a[m],t=k[l];if(void 0!==t)switch(l){case "${tab}":l=
c;break;case "${delimiter}":l=e;break;case "${cursor}":l="";f=b;break;default:var p=g[l];p||(p=g[l]={data:t.data,positions:[]});l=t.substitution;p.data&&p.data.values&&(l=p.data.values[0]);p.positions.push({offset:h+b,length:l.length})}d.push(l);b+=l.length}var e=[],r;for(r in g)g.hasOwnProperty(r)&&e.push(g[r]);d=d.join("");void 0===f&&(f=d.length);return{proposal:d,name:this.name,description:this.description,groups:e,escapePosition:h+f,style:"noemphasis"}},match:function(h){return 0===this.prefix.indexOf(h)},
_parse:function(){var h=this.template,g=[],d={},f,e=0,h=h.replace(/\n/g,"${delimiter}"),h=h.replace(/\t/g,"${tab}");h.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(c,b,k){var a=c.substring(2,c.length-1);b=c;var m=a,l=null,t=m.indexOf(":");-1!==t&&(m=m.substring(0,t),b="${"+m+"}",l=JSON.parse(a.substring(t+1).replace("\\}","}").trim()));(a=d[b])||(a=d[b]={});a.substitution=m;l&&(a.data=l);(f=h.substring(e,k))&&g.push(f);g.push(b);e=k+c.length;return m});(f=h.substring(e,h.length))&&g.push(f);this.segments=
g;this.variables=d}};l.prototype={addTemplates:function(h){for(var g=this.getTemplates(),d=0;d<h.length;d++)g.push(new k(h[d].prefix,h[d].description,h[d].template,h[d].name))},computeProposals:function(h,g,d){var f=this.getPrefix(h,g,d),e=[];this.isValid(f,h,g,d)&&(e=e.concat(this.getTemplateProposals(f,g,d)),e=e.concat(this.getKeywordProposals(f)));return e},getKeywords:function(){return this._keywords},getKeywordProposals:function(h){var g=[],d=this.getKeywords();if(d){for(var f=0;f<d.length;f++)0===
d[f].indexOf(h)&&g.push({proposal:d[f].substring(h.length),description:d[f],style:"noemphasis_keyword"});0<g.length&&g.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return g},getPrefix:function(h,g,d){return d.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(h,g,d){for(var f=[],e=this.getTemplates(),c=0;c<e.length;c++){var b=e[c];b.match(h)&&(b=b.getProposal(h,g,d),this.removePrefix(h,b),f.push(b))}0<f.length&&
(f.sort(function(b,a){return b.name<a.name?-1:b.name>a.name?1:0}),f.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return f},removePrefix:function(h,g){if(!(g.overwrite=g.proposal.substring(0,h.length)!==h))g.proposal=g.proposal.substring(h.length)},isValid:function(h,g,d,f){return!0}};return{Template:k,TemplateContentAssist:l}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(k,l,h,g,d,f){function e(b,c,a){var d=b.getTextView();h.KeyMode.call(this,d);this.editor=b;this.undoStack=c;this.contentAssist=a;this.linkedModeModel=null;d.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));d.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));d.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));d.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),c=this.linkedModeModel,d,e;c;)if(d=this._getPositionChanged(c,b,b+a.removedCharCount),e=d.position,void 0===e||e.model!==c)this.exitLinkedMode(!1),c=this.linkedModeModel;else break;if(c){c=0;a=a.addedCharCount-a.removedCharCount;d=d.positions;for(var f,g=0;g<d.length;++g){f=d[g];e=f.position;var h=e.offset<=b&&b<=e.offset+e.length;h&&!f.ansestor?(e.offset+=c,
e.length+=a,c+=a):(e.offset+=c,f.ansestor&&h&&(e.length+=a));f.escape&&(f.model.escapePosition=e.offset)}this._updateAnnotations(d)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,c=b.mapOffset(a.start),d=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,g;e;)if(f=this._getPositionChanged(e,c,d),g=f.position,void 0===g||g.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var h=this._compoundChange;h?h.owner.model===e&&h.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=g.group;var h=0,k=a.text.length-(d-c);f=f.positions;for(var n,c=c-g.position.offset,m=d-g.position.offset,l=0;l<f.length;++l)n=f[l],d=n.position,n.oldOffset=d.offset,n.model===e&&n.group===g.group?(d.offset+=h,d.length+=k,h+=k):(d.offset+=h,n.ansestor&&(d.length+=g.count*k)),n.escape&&(n.model.escapePosition=d.offset);this.ignoreVerify=!0;for(l=f.length-1;0<=l;l--)n=f[l],n.model===e&&n.group===g.group&&b.setText(a.text,n.oldOffset+
c,n.oldOffset+m);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var c={};e.prototype=new h.KeyMode;f.mixin(e.prototype,{createKeyBindings:function(){var b=l.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new b(13)});c.push({actionID:"linkedModeCancel",keyBinding:new b(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return c},enterLinkedMode:function(b){if(!this.linkedModeModel){var c=
this.editor.getTextView();c.addKeyMode(this);c.addEventListener("Verify",this.linkedModeListener.onVerify);c.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(k.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b);this.linkedModeModel=
b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var c=this.linkedModeModel;this.linkedModeModel=c.previousModel;c.parentGroup=c.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var a=this.editor,d=a.getTextView();d.removeKeyMode(this);d.removeEventListener("Verify",this.linkedModeListener.onVerify);d.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);d=this.contentAssist;d.removeEventListener("Activating",this.linkedModeListener.onActivating);d.offset=void 0;this.editor.reportStatus(k.linkedModeExited,null,!0);b&&a.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var c=this.linkedModeModel;if(c){c.selectedGroupIndex=b;b=c.groups[b];var a=b.positions[0],e=this.editor;e.setSelection(a.offset,a.offset+a.length);if(c=this.contentAssist)c.offset=void 0,b.data&&"link"===b.data.type&&b.data.values?((this._groupContentAssistProvider=new d.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=
e.getSelection();return b.start===b.end&&(b=e.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?e.getText(a.offset,b):""},c.offset=a.offset,c.deactivate(),c.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,c.deactivate())}this._updateAnnotations()},_getModelPositions:function(b,c,a){for(var d=c.groups,e=0;e<d.length;e++)for(var f=d[e].positions,g=0;g<f.length;g++){var h=f[g];a&&(h={offset:h.offset+a,length:h.length});h={index:g,group:e,count:f.length,model:c,
position:h};b.push(h);c.nextModel&&c.nextModel.parentGroup===e&&(h.ansestor=!0,this._getModelPositions(b,c.nextModel,(a||0)+f[g].offset-f[0].offset))}},_getSortedPositions:function(b){var c=this._sortedPositions;if(!c){for(c=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(c,b);b;)void 0!==b.escapePosition&&c.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;c.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=c}return c},
_getPositionChanged:function(b,c,a){var d;b=this._getSortedPositions(b);for(var e=b.length-1;0<=e;e--){var f=b[e].position;if(f.offset<=c&&a<=f.offset+f.length){d=b[e];break}}return{position:d,positions:b}},_updateAnnotations:function(b){var c=this.editor.getAnnotationModel();if(c){var a=[],d=[];c.getTextModel();for(var e=c.getAnnotations(),f;e.hasNext();)switch(f=e.next(),f.type){case g.AnnotationType.ANNOTATION_LINKED_GROUP:case g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(f)}if(e=
this.linkedModeModel){b=b||this._getSortedPositions(e);for(var h=0;h<b.length;h++)if(f=b[h],f.model===e){var k=g.AnnotationType.ANNOTATION_LINKED_GROUP;f.group===e.selectedGroupIndex&&(k=0===f.index?g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);f=f.position;f=g.AnnotationType.createAnnotation(k,f.offset,f.offset+f.length,"");d.push(f)}}c.replaceAnnotations(a,d)}}});c.LinkedMode=e;return c});
define("orion/editor/factories","orion/editor/actions orion/editor/undoStack orion/editor/rulers orion/editor/annotations orion/editor/textDND orion/editor/linkedMode".split(" "),function(k,l,h,g,d,f){function e(){}function c(){}function b(){}function n(){}function a(){}function m(){}var s={};e.prototype={createKeyBindings:function(a,b,c,d){d=new k.TextActions(a,b,d);var e=new f.LinkedMode(a,b,c);a=new k.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};s.KeyBindingsFactory=
e;c.prototype={createUndoStack:function(a){a=a.getTextView();return new l.UndoStack(a,200)}};s.UndoFactory=c;b.prototype={createLineNumberRuler:function(a){return new h.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};s.LineNumberRulerFactory=b;n.prototype={createFoldingRuler:function(a){return new h.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};s.FoldingRulerFactory=n;a.prototype={createAnnotationModel:function(a){return new g.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new g.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new h.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new h.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};s.AnnotationFactory=a;m.prototype={createTextDND:function(a,b){return new d.TextDND(a.getTextView(),b)}};s.TextDNDFactory=m;return s});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(k,l,h,g){return g.mixin({},k,l,h)});
define("orion/editor/contentAssist","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/eventTarget orion/Deferred orion/objects orion/editor/util orion/util orion/webui/littlelib".split(" "),function(k,l,h,g,d,f,e,c,b){function n(a){this.textView=a;this.state=s.INACTIVE;this.resetProviderInfoArray();var b=this;this.contentAssistListener={onModelChanging:function(a){this._latestModelChangingEvent=a}.bind(this),onSelection:function(a){this.isDeactivatingChange(this._latestModelChangingEvent,
a)?this.setState(s.INACTIVE):this.isActive()&&(this.state===s.ACTIVE&&this.setState(s.FILTERING),this.filterProposals(a));this._latestModelChangingEvent=null}.bind(this),onScroll:function(a){this.setState(s.INACTIVE)}.bind(this)};a.setKeyBinding(c.isMac?new l.KeyBinding(" ",!1,!1,!1,!0):new l.KeyBinding(" ",!0),"contentAssist");a.setKeyBinding(c.isMac?new l.KeyBinding(" ",!1,!1,!0,!0):new l.KeyBinding(" ",!0,!1,!0),"contentAssist");a.setAction("contentAssist",function(){a.getOptions("readonly")||
b.activate();return!0},{name:k.contentAssist})}function a(a,b){var c=a.textView;h.KeyMode.call(this,c);this.contentAssist=a;this.widget=b;this.proposals=[];var d=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){d.proposals=a.data.proposals;if(0===d.proposals.length)d.selectedIndex=-1,d.cancel();else{for(d.selectedIndex=0;d.proposals[d.selectedIndex]&&d.proposals[d.selectedIndex].unselectable;)d.selectedIndex++;if(d.proposals[d.selectedIndex]){if(d.widget){var b=!0;if(a.autoApply){for(a=
d.selectedIndex+1;d.proposals[a]&&d.proposals[a].unselectable;)a++;d.proposals[a]||(b=!1,d.contentAssist.apply(d.proposals[d.selectedIndex]))}b&&(d.widget.show(),d.widget.selectNode(d.selectedIndex))}}else d.selectedIndex=-1,d.cancel()}});c.setAction("contentAssistApply",function(){return this.enter()}.bind(this));c.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));c.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));c.setAction("contentAssistPreviousProposal",
function(){return this.lineUp()}.bind(this));c.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));c.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));c.setAction("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));c.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));c.setAction("contentAssistTab",function(){return this.tab()}.bind(this));
this.widget&&(this.widget.setContentAssistMode(this),this.widget.createAccessible())}function m(a,b){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var d=this.textView.getOptions("parent").ownerDocument;this.parentNode="string"===typeof b?d.getElementById(b):b;if(!this.parentNode){this.parentNode=c.createElement(d,"div");this.parentNode.className="contentassist";var f=d.getElementsByTagName("body")[0];if(f)f.appendChild(this.parentNode);
else throw Error("parentNode is required");}this.parentNode.addEventListener("scroll",this.onScroll.bind(this));var g=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==g.parentNode&&g.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(a){g.hide()});this.scrollListener=function(a){g.isShowing&&g.position()};e.addEventListener(d,"scroll",this.scrollListener)}var s={INACTIVE:1,ACTIVE:2,FILTERING:3},t={selected:"selected",
hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",noemphasis_keyword:"proposal-noemphasis-keyword",noemphasis_title:"proposal-noemphasis-title",noemphasis_title_keywords:"proposal-noemphasis-title-keywords",dfault:"proposal-default"};n.prototype={apply:function(a){if(!a)return!1;var b=this.textView,c=b.getSelection(),d=this._initialCaretOffset,e=d,f=c=Math.max(c.start,c.end),g=b.getModel();g.getBaseModel&&(e=g.mapOffset(e),f=g.mapOffset(f),g=g.getBaseModel());a.overwrite&&
(d=this.getPrefixStart(g,e));e={proposal:a,start:e,end:f};this.setState(s.INACTIVE);b.setText("string"===typeof a?a:a.proposal,d,c);this.dispatchEvent({type:"ProposalApplied",data:e});return!0},activate:function(a,b){this.state===s.INACTIVE&&(this._autoTriggered=b?!0:!1,this.setState(s.ACTIVE,a))},deactivate:function(){this.setState(s.INACTIVE)},getTextView:function(){return this.textView},isActive:function(){return this.state===s.ACTIVE||this.state===s.FILTERING},isDeactivatingChange:function(a,
b){var c=!1;b.newValue.start<this._initialCaretOffset?c=!0:a&&(c=0<a.removedLineCount||0<a.addedLineCount);return c},setState:function(a,b){var c;a===s.ACTIVE?(this._filterText="",c="Activating",this._mode&&this._mode.setActive(!0)):a===s.INACTIVE&&(c="Deactivating",this._mode&&this._mode.setActive(!1),this._initialCaretOffset=-1,this._filterText="");c&&this.dispatchEvent({type:c,providerInfoArray:b});this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){a===
s.INACTIVE?this.listenerAdded&&(this._latestModelChangingEvent=null,this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1):a===s.ACTIVE&&(this.listenerAdded||(this.textView.addEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.addEventListener("Scroll",
this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0),this.computeProposals())},computeProposals:function(){var a=this,b=this.textView.getCaretOffset(),c=this.textView.getSelection(),c=Math.min(c.start,c.end);this._initialCaretOffset=Math.min(b,c);this._computeProposals(this._initialCaretOffset).then(function(b){a._computedProposals=b;a.isActive()&&(b=a._flatten(b),a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b},
autoApply:!a._autoTriggered}))})},getPrefixStart:function(a,b){for(var c=b;0<c&&/[A-Za-z0-9_]/.test(a.getText(c-1,c));)c--;return c},handleError:function(a){"undefined"!==typeof console&&(console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},_computeProposals:function(a){var b=this._providerInfoArray,c=this.textView,e=c.getSelection(),g=c.getModel(),h=a;g.getBaseModel&&(h=g.mapOffset(h),e.start=g.mapOffset(e.start),e.end=g.mapOffset(e.end),g=g.getBaseModel());a=g.getLine(g.getLineAtOffset(h));
for(var k=0;k<a.length&&/\s/.test(a.charAt(k));)k++;var k=a.substring(0,k),c=c.getOptions("tabSize","expandTab"),c=c.expandTab?Array(c.tabSize+1).join(" "):"\t",n={line:a,offset:h,prefix:g.getText(this.getPrefixStart(g,h),h),selection:e,delimiter:g.getLineDelimiter(),tab:c,indentation:k},m=this,b=b.map(function(a){a=a.provider;var b;try{var c,e;if(c=a.computeContentAssist){var k=m.editorContextProvider,p=k.getEditorContext();n=f.mixin(n,k.getOptions());e=c.apply(a,[p,n])}else if(c=a.getProposals||
a.computeProposals)e=c.apply(a,[g.getText(),h,n]);b=m.progress?m.progress.progress(e,"Generating content assist proposal"):e}catch(l){m.handleError(l)}return d.when(b)});return d.all(b,this.handleError)},filterProposals:function(a){a="";var b=0;if(this._latestModelChangingEvent){a=this._latestModelChangingEvent.text;if(b=this._latestModelChangingEvent.removedCharCount)this._filterText=this._filterText.substring(0,this._filterText.length-b);a&&(this._filterText=this._filterText.concat(a));a=this.textView.getModel();
a.getBaseModel&&(a=a.getBaseModel());a=this.getPrefixStart(a,this._initialCaretOffset);var c=this.textView.getText(a,this._initialCaretOffset),d=[];this._computedProposals.forEach(function(a){a=a.filter(function(a){if(t[a.style]===t.hr||t[a.style]===t.noemphasis_title)return!0;var b="";if(a.overwrite){if(a.name)b=a.name;else if(a.proposal)b=a.proposal;else return!1;return 0===b.indexOf(c+this._filterText)}return a.name||a.proposal?(b=!1,a.name&&(b=0===a.name.indexOf(c+this._filterText)),!b&&a.proposal&&
(b=0===a.proposal.indexOf(this._filterText)),b):"string"===typeof a?0===a.indexOf(this._filterText):!1},this);0<a.length&&d.push(a)},this);d=this._removeExtraUnselectableElements(d);a=this._flatten(d);this.dispatchEvent({type:"ProposalsComputed",data:{proposals:a},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,c){var d=!0;if(t[b.style]===t.hr)0===c||a.length-1===c?d=!1:t.hr===t[a[c-1].style]&&(d=!1);else if(t[b.style]===t.noemphasis_title){var e=
a[c+1];e?t[e.style]===t.noemphasis_title&&(d=!1):d=!1}return d})})},setEditorContextProvider:function(a){this.editorContextProvider=a},_generateProviderId:function(){this._uniqueProviderIdCounter?this._uniqueProviderIdCounter++:this._uniqueProviderIdCounter=0;return"ContentAssistGeneratedID_"+this._uniqueProviderIdCounter},setAutoTriggerEnabled:function(a){this._autoTriggerEnabled=a;this._updateAutoTriggerListenerState()},setProviders:function(a){a=a.map(function(a){return{provider:a,id:this._generateProviderId()}},
this);this.setProviderInfoArray(a)},setProviderInfoArray:function(a){this.resetProviderInfoArray();this._providerInfoArray=a;this._charTriggersInstalled=a.some(function(a){return a.charTriggers});this._updateAutoTriggerListenerState()},resetProviderInfoArray:function(){this._providerInfoArray=[];this._charTriggersInstalled=!1;this._updateAutoTriggerListenerState()},setProgress:function(a){this.progress=a},setStyleAccessor:function(a){this._styleAccessor=a},_flatten:function(a){return a.reduce(function(a,
b){var c=a;if(Array.isArray(b)&&0<b.length){var c=b,d=a;b[0].style&&0===t[b[0].style].indexOf(t.noemphasis)&&(c=a,d=b);0<c.length&&c[c.length-1].style&&t.hr!==t[c[c.length-1].style]&&(c=c.concat({proposal:"",name:"",description:"---------------------------------",style:"hr",unselectable:!0}));c=c.concat(d)}return c},[])},_triggerListener:function(a){if(this._styleAccessor){var b=this.textView.getCaretOffset(),c=null,d=[];if(this._charTriggersInstalled){var e=this.textView.getText(b-1,b);this._providerInfoArray.forEach(function(a){var f=
a.charTriggers;if(f&&f.test(e)){var f=!1,g=a.excludedStyles;g&&(c||(c=this._styleAccessor.getStyles(b-1)),f=c.some(function(a){return g.test(a.style)}));f||d.push(a)}},this);0<d.length&&this.activate(d,!0)}}},_updateAutoTriggerListenerState:function(){this._boundTriggerListener||(this._boundTriggerListener=this._triggerListener.bind(this));if(this._triggerListenerInstalled){if(!this._autoTriggerEnabled||!this._charTriggersInstalled)this.textView.removeEventListener("Modify",this._boundTriggerListener),
this._triggerListenerInstalled=!1}else this._autoTriggerEnabled&&this._charTriggersInstalled&&(this.textView.addEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!0)}};g.EventTarget.addMixin(n.prototype);a.prototype=new h.KeyMode;f.mixin(a.prototype,{createKeyBindings:function(){var a=l.KeyBinding,c=[];c.push({actionID:"contentAssistApply",keyBinding:new a(13)});c.push({actionID:"contentAssistCancel",keyBinding:new a(27)});c.push({actionID:"contentAssistNextProposal",
keyBinding:new a(40)});c.push({actionID:"contentAssistPreviousProposal",keyBinding:new a(38)});c.push({actionID:"contentAssistNextPage",keyBinding:new a(34)});c.push({actionID:"contentAssistPreviousPage",keyBinding:new a(33)});c.push({actionID:"contentAssistHome",keyBinding:new a(b.KEY.HOME)});c.push({actionID:"contentAssistEnd",keyBinding:new a(b.KEY.END)});c.push({actionID:"contentAssistTab",keyBinding:new a(9)});return c},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},
getProposals:function(){return this.proposals},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):this.contentAssist.textView.removeKeyMode(this)},lineUp:function(a,b){return this.selectNew(a,b,!1)},lineDown:function(a,b){return this.selectNew(a,b,!0)},selectNew:function(a,b,c){if(c){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length){if(b)return!0;a=0}}else if(void 0===a&&(a=this.selectedIndex-1),0>a){if(b)return!0;
a=this.proposals.length-1}for(var d=a;this.proposals[a]&&this.proposals[a].unselectable;){if(c){if(a++,a>=this.proposals.length){if(b)return!0;a=0}}else if(a--,0>a){if(b)return!0;a=this.proposals.length-1}if(a===d){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex());return 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}return this.lineUp()},
pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());return this.lineDown(a,!0)}return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});m.prototype={onClick:function(a){a||(a=window.event);this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},
onScroll:function(a){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(t.selected));this.preserveCloneThroughScroll=!1},createDiv:function(a,b,d){var e=b.ownerDocument,f=c.createElement(e,"div");f.id="contentoption"+d;f.setAttribute("role","option");f.className=t[a.style]?t[a.style]:t.dfault;"hr"===a.style?a=c.createElement(e,"hr"):(a=this._createDisplayNode(f,a,d),f.contentAssistProposalIndex=d);f.appendChild(a);b.appendChild(f)},
createAccessible:function(){var a=this._contentAssistMode,c=this;this.parentNode.addEventListener("keydown",function(d){d||(d=window.event);d.preventDefault&&d.preventDefault();return d.keyCode===b.KEY.ESCAPE?a.cancel():d.keyCode===b.KEY.UP?a.lineUp():d.keyCode===b.KEY.DOWN?a.lineDown():d.keyCode===b.KEY.ENTER?a.enter():d.keyCode===b.KEY.PAGEDOWN?a.pageDown():d.keyCode===b.KEY.PAGEUP?a.pageUp():d.keyCode===b.KEY.HOME?(c.scrollIndex(0,!0),a.lineDown(0)):d.keyCode===b.KEY.END?a.lineUp(a.getProposals().length-
1):!1})},_createDisplayNode:function(a,b,c){var d=null,e=null;if("string"===typeof b)e=b;else if(b.description&&"string"===typeof b.description)if(b.name&&"string"===typeof b.name){var f=this._createNameNode(b.name);f.contentAssistProposalIndex=c;d=document.createElement("span");d.appendChild(f);f=document.createTextNode(b.description);d.appendChild(f);a.setAttribute("title",b.name+b.description)}else e=b.description;else e=b.proposal;e&&(d=this._createNameNode(e),a.setAttribute("title",e));d.contentAssistProposalIndex=
c;return d},_createNameNode:function(a){var b=document.createElement("span");b.classList.add("proposal-name");b.appendChild(document.createTextNode(a));return b},getProposal:function(a){var b=null;a=a.contentAssistProposalIndex;void 0!==a&&(b=this._contentAssistMode.getProposals()[a]||null);return b},getTopIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++)if(a[b].offsetTop>=this.parentNode.scrollTop)return b;return 0},getBottomIndex:function(){for(var a=this.parentNode.childNodes,
b=0;b<a.length;b++){var c=a[b];if(c.offsetTop+c.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)return Math.max(0,b-1)}return a.length-1},scrollIndex:function(a,b){this.parentNode.childNodes[a].scrollIntoView(b);this.preserveCloneThroughScroll=!0},selectNode:function(a){var c=null;this.previousSelectedNode&&(this.previousSelectedNode.classList.remove(t.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode());if(-1!==a){c=this.parentNode.childNodes[a];
c.classList.add(t.selected);this.parentNode.setAttribute("aria-activedescendant",c.id);c.focus();c.offsetTop<this.parentNode.scrollTop?(c.scrollIntoView(!0),this.preserveCloneThroughScroll=!0):c.offsetTop+c.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&(c.scrollIntoView(!1),this.preserveCloneThroughScroll=!0);var d=b.bounds(c.firstChild||c),e=b.bounds(this.parentNode);a=window.getComputedStyle(this.parentNode);var f=window.getComputedStyle(c),f=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+
parseInt(f.paddingLeft)+parseInt(f.paddingRight);if(d.width>=e.width-f){f=parseInt(a.top);e=c.cloneNode(!0);e.classList.add("cloneProposal");e.style.top=f+c.offsetTop-this.parentNode.scrollTop+"px";e.style.left=a.left;e.setAttribute("id",e.id+"_clone");d=d.left+d.width-parseInt(document.documentElement.clientWidth);0<d&&(a=parseInt(a.left)-d,0>a&&(a=0),e.style.left=a+"px");a=document.createElement("div");a.id="clone_contentassist";a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(e);
a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a,this.parentNode);var g=function(a){a.contentAssistProposalIndex=c.contentAssistProposalIndex;if(a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++)g(a.childNodes[b])};g(a);c.classList.remove(t.selected);this.previousCloneNode=a}}this.previousSelectedNode=c},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(0===a.length)this.hide();else{this.parentNode.innerHTML=
"";for(var b=0;b<a.length;b++)this.createDiv(a[b],this.parentNode,b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0;this.textViewListenerAdded||(this.textView.addEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!0)}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1;this.textViewListenerAdded&&
(this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!1);this.previousSelectedNode&&(this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode())},position:function(){var a=this.contentAssist,b=this.textView;if(void 0!==a.offset){var a=a.offset,c=b.getModel();c.getBaseModel&&(a=c.mapOffset(a,!0))}else a=this.textView.getCaretOffset();a=b.getLocationAtOffset(a);a.y+=b.getLineHeight();this.textView.convert(a,"document","page");
this.parentNode.style.position="fixed";this.parentNode.style.left=a.x+"px";this.parentNode.style.top=a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;b=this.parentNode.ownerDocument;c=b.documentElement.clientWidth;a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight&&(this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px");a.x+this.parentNode.offsetWidth>c&&(this.parentNode.style.left=c-this.parentNode.offsetWidth+"px")},
_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode);this.previousCloneNode=null}};return{ContentAssist:n,ContentAssistMode:a,ContentAssistWidget:m}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(k,l,h,g){function d(d){l.KeyMode.call(this,d)}d.prototype=new l.KeyMode;d.prototype.createKeyBindings=function(){var d=[];d.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});d.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});d.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});d.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});d.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});d.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});d.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});d.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});d.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});d.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("x",!g.isMac,!1,!1,g.isMac)])});for(var e=0;9>=e;e++)d.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!g.isMac,!1,!1,g.isMac)}),d.push({actionID:"emacs-digit-argument-"+
e,keyBinding:this._createStroke(48+e,!1,!1,!0)}),d.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!g.isMac,!1,!0,g.isMac)});d.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!1,g.isMac)});d.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});d.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!0,g.isMac)});d.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});d.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});d.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});d.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});d.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});d.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});d.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});d.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("s",!g.isMac,!1,!1,g.isMac)])});this._createActions(this.getView());return d};d.prototype._createStroke=function(d,e,c,b,g){d=new h.KeyStroke(d,e,c,b,g);d.scopeName=k.emacs;return d};d.prototype._createSequence=function(d){d=new h.KeySequence(d);d.scopeName=k.emacs;return d};d.prototype._getData=function(){var d={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return d};d.prototype._moveCursor=
function(d){var e=this._getData();this._marker&&(e.select=!0);return this.getView().invokeAction(d,!1,e)};d.prototype._digitArgument=function(d){this._argument=10*(this._argument||0)+d;return!0};d.prototype._negativeArgument=function(){this._sign=-1*(this._sign||1);return!0};d.prototype._createActions=function(d){var e=this;d.setAction("emacs-beginning-of-line",function(){return e._moveCursor("lineStart")},{name:k.lineStart});d.setAction("emacs-end-of-line",function(){return e._moveCursor("lineEnd")},
{name:k.lineEnd});d.setAction("emacs-forward-char",function(){return e._moveCursor("charNext")},{name:k.charNext});d.setAction("emacs-backward-char",function(){return e._moveCursor("charPrevious")},{name:k.charPrevious});d.setAction("emacs-forward-word",function(){return e._moveCursor("wordNext")},{name:k.wordNext});d.setAction("emacs-backward-word",function(){return e._moveCursor("wordPrevious")},{name:k.wordPrevious});d.setAction("emacs-next-line",function(){return e._moveCursor("lineDown")},{name:k.lineDown});
d.setAction("emacs-previous-line",function(){return e._moveCursor("lineUp")},{name:k.lineUp});d.setAction("emacs-beginning-of-buffer",function(){return e._moveCursor("textStart")},{name:k.textStart});d.setAction("emacs-end-of-buffer",function(){return e._moveCursor("textEnd")},{name:k.textEnd});d.setAction("emacs-delete-backward-char",function(){return d.invokeAction("deletePrevious")},{name:k.deletePrevious});d.setAction("emacs-delete-char",function(){return d.invokeAction("deletePrevious")},{name:k.deletePrevious});
d.setAction("emacs-kill-line",function(){return d.invokeAction("deleteLineEnd")},{name:k.deleteLineEnd});d.setAction("emacs-kill-word",function(){return d.invokeAction("deleteWordNext")},{name:k.deleteWordNext});d.setAction("emacs-backward-kill-word",function(){return d.invokeAction("deleteWordPrevious")},{name:k.deleteWordPrevious});d.setAction("emacs-scroll-up",function(){return e._moveCursor("pageDown")},{name:k.pageDown});d.setAction("emacs-scroll-down",function(){return e._moveCursor("pageUp")},
{name:k.pageUp});d.setAction("emacs-set-mark-command",function(){var c=d.getCaretOffset();d.setCaretOffset(c);e._marker=c;return!0},{name:k.setMarkCommand});d.setAction("emacs-exchange-point-and-mark",function(){if(void 0!==e._marker){var c=d.getCaretOffset(),b=d.getSelection();if(b.end===c){var g=b.start;b.start=b.end;b.end=g}e._marker=c;d.setSelection(b.start,b.end)}return!0},{name:k.exchangeMarkPoint});d.setAction("emacs-reset-mark-command",function(){var c=d.getCaretOffset();d.setCaretOffset(c);
e._marker=void 0;return!0},{name:k.clearMark});d.setAction("emacs-digit-argument-0",function(){return e._digitArgument(0)},{name:g.formatMessage(k.digitArgument,"0")});d.setAction("emacs-digit-argument-1",function(){return e._digitArgument(1)},{name:g.formatMessage(k.digitArgument,"1")});d.setAction("emacs-digit-argument-2",function(){return e._digitArgument(2)},{name:g.formatMessage(k.digitArgument,"2")});d.setAction("emacs-digit-argument-3",function(){return e._digitArgument(3)},{name:g.formatMessage(k.digitArgument,
"3")});d.setAction("emacs-digit-argument-4",function(){return e._digitArgument(4)},{name:g.formatMessage(k.digitArgument,"4")});d.setAction("emacs-digit-argument-5",function(){return e._digitArgument(5)},{name:g.formatMessage(k.digitArgument,"5")});d.setAction("emacs-digit-argument-6",function(){return e._digitArgument(6)},{name:g.formatMessage(k.digitArgument,"6")});d.setAction("emacs-digit-argument-7",function(){return e._digitArgument(7)},{name:g.formatMessage(k.digitArgument,"7")});d.setAction("emacs-digit-argument-8",
function(){return e._digitArgument(8)},{name:g.formatMessage(k.digitArgument,"8")});d.setAction("emacs-digit-argument-9",function(){return e._digitArgument(9)},{name:g.formatMessage(k.digitArgument,"9")});d.setAction("emacs-negative-argument",function(){return e._negativeArgument()},{name:k.negativeArgument});d.setAction("emacs-uppercase",function(){var c=e._getData();c.unit="word";return d.invokeAction("uppercase",!1,c)},{name:k.uppercase});d.setAction("emacs-lowercase",function(){var c=e._getData();
c.unit="word";return d.invokeAction("lowercase",!1,c)},{name:k.lowercase});d.setAction("emacs-capitalize",function(){var c=e._getData();c.unit="word";return d.invokeAction("capitalize",!1,c)},{name:k.capitalize})};return{EmacsMode:d}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(k,l,h,g){function d(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function f(a,b,c,d,e,f,g){a=new h.KeyStroke(a,b,c,d,e,f);a.scopeName=g||k.vi;return a}function e(a,b){var c=new h.KeySequence(a);c.scopeName=b||k.vi;return c}function c(a,b,c){this.key=b;this.msg=c;this.number="";l.KeyMode.call(this,a);a&&this._createActions(a)}function b(a){var b=a.getView();this.viMode=
a;l.KeyMode.call(this,b);this._createActions(b)}function n(a,b,d,e){this.viMode=a;this.nextMode=b;c.call(this,a.getView(),d,e)}function a(a){var b=a.getView();l.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function m(b,d){c.call(this,b,"",k.vimove);this.insertMode=new a(this);this.changeMode=new n(this,this.insertMode,"c",k.vichange);this.deleteMode=new n(this,this,"d",k.videlete);this.yankMode=new n(this,this,"y",k.viyank);this.statusReporter=d}var s,t;c.prototype=new l.KeyMode;d(c.prototype,
{_msg:function(a){return{name:g.formatMessage(k[a],this.msg)}},createKeyBindings:function(){for(var a=[],b=this.key,b=b?"-"+b+"-":"-",c=0;9>=c;c++)a.push({actionID:"vi"+b+c,keyBinding:f(c+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:f(8)});a.push({actionID:"vi"+b+"Left",keyBinding:f(37)});a.push({actionID:"vi"+b+"Down",keyBinding:f("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:f(40)});a.push({actionID:"vi"+b+"Up",keyBinding:f("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:f(38)});a.push({actionID:"vi"+b+"Right",keyBinding:f("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:f(39)});a.push({actionID:"vi"+b+"Right",keyBinding:f(32)});a.push({actionID:"vi"+b+"w",keyBinding:f("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:f("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:f("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:f("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:f("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:f("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:f("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:f("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:f(13)});a.push({actionID:"vi"+b+"-",keyBinding:f("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:f("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:f("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:f("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:f("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:f("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:f("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:f("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:f("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:f("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:f("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:f("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:f("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:f(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:f(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:f("G",!1,!1,!1,!1,"keypress")});return a},_createActions:function(a){function b(c){c=a.getModel().getLine(c);for(var d=0,e=c.charCodeAt(d);32===e||9===e;)d++,e=c.charCodeAt(d);return d}function c(a,b){a&&e.getView().setCaretOffset(a.start);b.editDone&&b.editDone()}var d=this.key,d=d?"-"+d+"-":
"-",e=this;a.setAction("vi"+d+"0",function(){return e._storeNumber(0)});a.setAction("vi"+d+"1",function(){return e._storeNumber(1)});a.setAction("vi"+d+"2",function(){return e._storeNumber(2)});a.setAction("vi"+d+"3",function(){return e._storeNumber(3)});a.setAction("vi"+d+"4",function(){return e._storeNumber(4)});a.setAction("vi"+d+"5",function(){return e._storeNumber(5)});a.setAction("vi"+d+"6",function(){return e._storeNumber(6)});a.setAction("vi"+d+"7",function(){return e._storeNumber(7)});a.setAction("vi"+
d+"8",function(){return e._storeNumber(8)});a.setAction("vi"+d+"9",function(){return e._storeNumber(9)});a.setAction("vi"+d+"Left",function(){return e._invoke("charPrevious",{unit:"character"})},this._msg("viLeft"));a.setAction("vi"+d+"Right",function(){return e._invoke("charNext",{unit:"character"})},this._msg("viRight"));a.setAction("vi"+d+"Up",function(){return e._invoke("lineUp",{editLine:!0})},this._msg("viUp"));a.setAction("vi"+d+"Down",function(){return e._invoke("lineDown",{editLine:!0})},
this._msg("viDown"));a.setAction("vi"+d+"w",function(){return e._invoke("wordNext",{unit:"word"})},this._msg("viw"));a.setAction("vi"+d+"b",function(){return e._invoke("wordPrevious",{unit:"word"})},this._msg("vib"));a.setAction("vi"+d+"W",function(){return e._invoke("wordNext",{unit:"wordWS"})},this._msg("viW"));a.setAction("vi"+d+"B",function(){return e._invoke("wordPrevious",{unit:"wordWS"})},this._msg("viB"));a.setAction("vi"+d+"e",function(){e._invoke("charNext",{unit:"character"});e._invoke("wordNext",
{unit:"wordend"});e._invoke("charPrevious",{unit:"character"});return!0},this._msg("vie"));a.setAction("vi"+d+"E",function(){return e._invoke("wordNext",{unit:"wordendWS"})},this._msg("viE"));a.setAction("vi"+d+"$",function(){return e._invoke("lineEnd")},this._msg("vi$"));a.setAction("vi"+d+"^_",function(){return e._invoke(function(){var c=a.getModel(),d=a.getCaretOffset(),d=c.getLineAtOffset(d);a.setCaretOffset(c.getLineStart(d)+b(d))})},this._msg("vi^_"));a.setAction("vi"+d+"+",function(){return e._invoke(function(c){var d=
a.getModel(),e=a.getCaretOffset(),f=d.getLineCount()-1;c=Math.min(d.getLineAtOffset(e)+c.count,f);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi+"));a.setAction("vi"+d+"-",function(){return e._invoke(function(c){var d=a.getModel(),e=a.getCaretOffset();c=Math.max(d.getLineAtOffset(e)-c.count,0);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi-"));a.setAction("vi"+d+"|",function(){return e._invoke(function(b){var c=a.getModel(),d=a.getCaretOffset(),d=
c.getLineAtOffset(d);a.setCaretOffset(Math.min(c.getLineStart(d)+b.count-1,c.getLineEnd(d)))})},this._msg("vi|"));a.setAction("vi"+d+"H",function(){return e._invoke(function(b){b=a.getModel().getLineStart(a.getTopIndex(!0)+(b.count-1));a.setCaretOffset(b)},{editLine:!0})},this._msg("viH"));a.setAction("vi"+d+"M",function(){return e._invoke(function(b){b=Math.ceil((a.getBottomIndex(!0)-a.getTopIndex(!0))/2)+a.getTopIndex(!0);a.setCaretOffset(a.getModel().getLineStart(b))},{editLine:!0})},this._msg("viM"));
a.setAction("vi"+d+"L",function(){return e._invoke(function(b){a.setCaretOffset(a.getModel().getLineStart(a.getBottomIndex(!0)-(b.count-1)))},{editLine:!0})},this._msg("viL"));a.setAction("vi"+d+"/",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!1,findCallback:function(b){e._searchFwd=!0;c(b,a)}};return e._invoke("find",a)},this._msg("vi/"));a.setAction("vi"+d+"?",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!0,findCallback:function(b){e._searchFwd=!1;c(b,a)}};return e._invoke("find",
a)},this._msg("vi?"));a.setAction("vi"+d+"n",function(){var b,d=a.getCaretOffset();e._searchFwd?(b="findNext",d++):b="findPrevious";var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("vin"));a.setAction("vi"+d+"N",function(){var b,d=a.getCaretOffset();e._searchFwd?b="findPrevious":(b="findNext",d++);var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("viN"));a.setAction("vi"+d+"f",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,
b.getLineEnd(b.getLineAtOffset(c)),!1,0)},this._msg("vif"));a.setAction("vi"+d+"F",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),c,!0,0)},this._msg("viF"));a.setAction("vi"+d+"t",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,b.getLineEnd(b.getLineAtOffset(c)),!1,-1)},this._msg("vit"));a.setAction("vi"+d+"T",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),
c,!0,1)},this._msg("viT"));a.setAction("vi"+d+",",function(){return e._findNextChar(e._charTempOptions.reverse)},this._msg("vi,"));a.setAction("vi"+d+";",function(){return e._findNextChar(!e._charTempOptions.reverse)},this._msg("vi;"));a.setAction("vi"+d+"G",function(){if(""===e.number){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());e.number=b.getLineCount()}return e._invoke(function(b){b=b||{};b.line=b.count;b.editLine=!0;b.callback=function(){b.editDone&&b.editDone()};a.invokeAction("gotoLine",
!1,b)})},this._msg("viG"))},_invoke:function(a,b){var c=this.getView();b=b||{};b.count=this._getCount();"function"===typeof a?a(b):c.invokeAction(a,!1,b);return!0},_getCount:function(){var a=1;""!==this.number&&(a=this.number>>0);this.number="";return a},_findChar:function(a,b,c,d){this._charTempOptions={};this._charTempOptions.start=a;this._charTempOptions.end=b;this._charTempOptions.hideAfterFind=!0;this._charTempOptions.incremental=!1;this._charTempOptions.reverse=c;this._charTempOptions.offset=
d;var e=this._charTempOptions,f=this;this._charTempOptions.findCallback=function(a){a&&f.getView().setCaretOffset(a.start+d);e.editDone&&e.editDone()};return this._invoke("find",this._charTempOptions)},_findNextChar:function(a){if(this._charTempOptions){var b=this.getView(),c={};c.hideAfterFind=this._charTempOptions.hideAfterFind;c.incremental=this._charTempOptions.incremental;c.reverse=this._charTempOptions.reverse;c.wrap=!1;var d=this;c.findCallback=function(a){a&&d.getView().setCaretOffset(a.start+
d._charTempOptions.offset);c.editDone&&c.editDone()};var e=b.getModel();if(a)return c.start=b.getCaretOffset()+1-this._charTempOptions.offset,c.end=e.getLineEnd(e.getLineAtOffset(c.start)),c.reverse=!1,this._invoke("findNext",c);c.start=b.getCaretOffset()-this._charTempOptions.offset;c.end=e.getLineStart(e.getLineAtOffset(c.start));c.reverse=!0;return this._invoke("findPrevious",c)}return!0},_storeNumber:function(a){var b=this;if(0===a&&!this.number)return this._invoke(function(){b.getView().invokeAction("lineStart",
!0)});this.number+=a;return!0}});b.prototype=new l.KeyMode;d(b.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-:-ESC",function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});n.prototype=new c;d(n.prototype,
{createKeyBindings:function(){var a=c.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:f(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:f(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){b=b||{};var d=this.getView(),e=d.getCaretOffset(),f=e,g=d.getModel(),h=this;b.editDone=function(){var a=d.getCaretOffset();if(f>a){var c=f;f=a;a=c}b.editLine&&(f=g.getLineStart(g.getLineAtOffset(f)),a=g.getLineEnd(g.getLineAtOffset(a),
"c"===h.key?!1:!0));"y"===h.key?(s=d.getText(f,a),t=b.editLine,d.setCaretOffset(e)):d.setText("",f,a);d.removeKeyMode(h);d.addKeyMode(h.nextMode)};c.prototype._invoke.call(this,a,b);b.editDone();return!0},_getCount:function(){var a=1;""!==this.firstNumber&&(a=this.firstNumber>>0);var b=1;""!==this.number&&(b=this.number>>0);this.number=this.firstNumber="";return a*b},_createActions:function(a){c.prototype._createActions.call(this,a);var b=this;a.setAction("vi-"+b.key+"ESC",function(){a.removeKeyMode(b);
a.addKeyMode(b.viMode);return!0});a.setAction("vi-"+b.key+"-"+b.key,function(){return b._invoke("lineEnd",{editLine:!0})},this._msg("viycd"))},storeNumber:function(a){this.firstNumber=a},_modeAdded:function(){this.secondNumber=""},_modeRemoved:function(){this.number=this.firstNumber=this.command=""}});a.prototype=new l.KeyMode;d(a.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-insert-ESC",
function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){}});m.prototype=new c;d(m.prototype,{createKeyBindings:function(){var a=c.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:f("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:f("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:f("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:f("y",!0)});a.push({actionID:"statusLineMode",keyBinding:f(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:f("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:f("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:f("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:f("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:f("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:f("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:f("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:f("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:f("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:f("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:f("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-u",
keyBinding:f("u",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",keyBinding:f("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:f("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:f("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:f("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:f("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:f("X",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:f("C",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:f("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:f("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var b=l.KeyMode.prototype.getKeyBindings.call(this,a),b=b||[],c=this.changeMode.getKeyBindings(a),d;if(!this.changeMode.isActive())for(d=0;d<c.length;d++)c[d]=e([f("c",!1,!1,!1,!1,"keypress"),
c[d]]);b=b.concat(c);c=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(d=0;d<c.length;d++)c[d]=e([f("d",!1,!1,!1,!1,"keypress"),c[d]]);b=b.concat(c);c=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(d=0;d<c.length;d++)c[d]=e([f("y",!1,!1,!1,!1,"keypress"),c[d]]);return b.concat(c)},match:function(a){var b=l.KeyMode.prototype.match.call(this,a);!b&&"keypress"===a.type&&(b="noop");return b},_createActions:function(a){c.prototype._createActions.call(this,a);var b=
this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:k.pageDown});a.setAction("vi-ctrl-b",function(){return b._invoke("pageUp")},{name:k.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:k.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:k.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:k.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},
{name:k.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:k.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},{name:k.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:k.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:k.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:k.viR});a.setAction("vi-s",
function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:k.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},{name:k.viS});a.setAction("vi-p",function(){return b._invoke(function(){var a=b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();t?c.start=c.end=d.getLineEnd(d.getLineAtOffset(e),!0):(c.start++,c.end++)}a.setText(s,c.start,c.end)})},{name:k.vip});a.setAction("vi-P",function(){return b._invoke(function(){var a=
b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();t&&(c.start=c.end=d.getLineStart(d.getLineAtOffset(e)))}a.setText(s,c.start,c.end)})},{name:k.viP});a.setAction("vi-u",function(){return b._invoke("undo")},{name:k.Undo});a.setAction("vi-c",function(){a.removeKeyMode(b);a.addKeyMode(b.changeMode);b.changeMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-d",function(){a.removeKeyMode(b);a.addKeyMode(b.deleteMode);b.deleteMode.storeNumber(b.number);
b.number="";return!0});a.setAction("vi-y",function(){a.removeKeyMode(b);a.addKeyMode(b.yankMode);b.yankMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-~",function(){return b._invoke("reversecase")},{name:k.reversecase});a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:k.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:k.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:k.viC});a.setAction("vi-D",
function(){return b._invoke("deleteLineEnd")},{name:k.deleteLineEnd});a.setAction("vi-*",function(){var a=b.getView(),c=a.getCaretOffset(),c=a.getNextOffset(c+1,{count:-1,unit:"word"}),d=a.getNextOffset(c,{count:1,unit:"wordend"}),a=a.getText(c,d);b._searchFwd=!0;return b._invoke("find",{hideAfterFind:!0,incremental:!1,reverse:!1,findString:a})},{name:k.viStar})},_reportStatus:function(a){this.statusReporter&&this.statusReporter(a)},_toInsertMode:function(a,b){b=b||{};var c=1;""!==this.number&&(c=
this.number>>0);b.count=c;c=this.getView();this.insertMode.storeNumber(this.number);c.invokeAction(a,!1,b);c.removeKeyMode(this);c.addKeyMode(this.insertMode);this.number="";return!0},_modeAdded:function(){this.getView().setOptions({blockCursorVisible:!0})},_modeRemoved:function(){var a=this.getView();a.setOptions({blockCursorVisible:!1});a.removeKeyMode(this.insertMode);a.removeKeyMode(this.changeMode);a.removeKeyMode(this.deleteMode)}});return{VIMode:m}});
define("orion/editorPreferences",[],function(){function k(g,d){this._preferences=g;if(this._callback=d)var f=g.listenForChangedSettings(l,function(e){e.key===f&&d()}.bind(this))}var l="/editor/settings",h={autoSave:!1,autoSaveVisible:!0,autoSaveLocalVisible:!0,autoSaveTimeout:1E3,autoSaveTimeoutVisible:!0,themeVisible:!0,themeLocalVisible:!0,fontSizeVisible:!0,fontSizeLocalVisible:!0,autoLoad:!0,autoLoadVisible:!0,saveDiffs:!0,saveDiffsVisible:!0,contentAssistAutoTrigger:!0,contentAssistAutoTriggerVisible:!0,
showOccurrences:!1,showOccurrencesVisible:!0,autoPairParentheses:!0,autoPairParenthesesVisible:!0,autoPairBraces:!0,autoPairBracesVisible:!0,autoPairSquareBrackets:!0,autoPairSquareBracketsVisible:!0,autoPairAngleBrackets:!1,autoPairAngleBracketsVisible:!0,autoPairQuotations:!0,autoPairQuotationsVisible:!0,autoCompleteComments:!0,autoCompleteCommentsVisible:!0,smartIndentation:!0,smartIndentationVisible:!0,trimTrailingWhiteSpace:!1,trimTrailingWhiteSpaceVisible:!0,tabSize:4,tabSizeVisible:!0,expandTab:!1,
expandTabVisible:!0,scrollAnimation:!0,scrollAnimationVisible:!0,scrollAnimationTimeout:300,scrollAnimationTimeoutVisible:!0,annotationRuler:!0,annotationRulerVisible:!0,lineNumberRuler:!0,lineNumberRulerVisible:!0,foldingRuler:!0,foldingRulerVisible:!0,overviewRuler:!0,overviewRulerVisible:!0,showTabs:!1,showTabsVisible:!0,showSpaces:!1,showSpacesVisible:!0,wordWrap:!1,wordWrapVisible:!0,showMargin:!1,showMarginVisible:!0,marginOffset:80,marginOffsetVisible:!0,keyBindings:"Default",keyBindingsVisible:!0,
keyBindingsLocalVisible:!0};k.prototype={_initialize:function(g){g=g.get("editorSettings")||{};for(var d in h)g.hasOwnProperty(d)||(g[d]=h[d]);return g},getPrefs:function(g){this._preferences.getPreferences(l).then(function(d){d=this._initialize(d);"string"===typeof d&&(d=JSON.parse(d));g(d)}.bind(this))},setPrefs:function(g,d){this._preferences.getPreferences(l).then(function(f){f.put("editorSettings",g);g=this._initialize(f);d&&d(g);this._callback&&this._callback(g)}.bind(this))}};return{EditorPreferences:k}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(k,l){function h(){}function g(){this.styles=[];var c=new h;c.name="Eclipse";c.annotationRuler="white";c.background="white";c.comment="green";c.keyword="#7f0055";c.text="darkSlateGray";c.string="blue";c.overviewRuler="white";c.lineNumberOdd="#444";c.lineNumberEven="#444";c.lineNumber="#444";c.currentLine="#EAF2FE";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=
e;this.styles.push(c);c=new h;c.name="Prospecto";c.annotationRuler="white";c.background="white";c.comment="#3C802C";c.keyword="#CC4C07";c.text="#333";c.string="#446FBD";c.overviewRuler="white";c.lineNumberOdd="silver";c.lineNumberEven="silver";c.lineNumber="silver";c.currentLine="#EAF2FE";c.tag="#CC4C07";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c);c=new h;c.name="Blue";c.annotationRuler="lavender";c.background="aliceBlue";c.comment="indigo";c.keyword="cornFlowerBlue";c.text=
"navy";c.string="cornFlowerBlue";c.overviewRuler="lavender";c.lineNumberOdd="darkSlateGray";c.lineNumberEven="darkSlateGray";c.lineNumber="darkSlateGray";c.currentLine="white";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c);c=new h;c.name="Ambience";c.annotationRuler="#3D3D3D";c.background="#202020";c.comment="mediumslateblue";c.keyword="cornFlowerBlue";c.text="darkseagreen";c.string="lightcoral";c.overviewRuler="white";c.lineNumberOdd="black";c.lineNumberEven=
"black";c.lineNumber="black";c.currentLine="lightcyan";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c);c=new h;c.name="Tierra";c.annotationRuler="moccasin";c.background="lemonchiffon";c.comment="darkseagreen";c.keyword="darkred";c.text="#555555";c.string="orangered";c.overviewRuler="moccasin";c.lineNumberOdd="chocolate";c.lineNumberEven="chocolate";c.lineNumber="chocolate";c.currentLine="#baa289";c.tag="darkred";c.attribute="cadetBlue";c.fontFamily=f;
c.fontSize=e;this.styles.push(c);c=new h;c.name="Nimbus";c.annotationRuler="#444";c.background="dimgray";c.comment="darkseagreen";c.keyword="darkorange";c.text="white";c.string="cornflowerblue";c.overviewRuler="#444";c.lineNumberOdd="#aaa";c.lineNumberEven="#aaa";c.lineNumber="#aaa";c.currentLine="#aabfbb";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c);c=new h;c.name="Adelante";c.annotationRuler="#E2D2B2";c.background="#F1E7C8";c.comment="#5D774E";c.keyword=
"#AF473B";c.text="dimgray";c.string="#DE5D3B";c.overviewRuler="#E2D2B2";c.lineNumberOdd="#AF473B";c.lineNumberEven="#AF473B";c.lineNumber="#AF473B";c.currentLine="#9e937b";c.tag="#AF473B";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c);c=new h;c.name="Raspberry Pi";c.annotationRuler="seashell";c.background="seashell";c.comment="#66B32F";c.keyword="#E73E36";c.text="dimgray";c.string="darkorange";c.overviewRuler="seashell";c.lineNumberOdd="#E73E36";c.lineNumberEven="#E73E36";
c.lineNumber="#E73E36";c.currentLine="#F5B1AE";c.tag="#E73E36";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=e;this.styles.push(c)}function d(){return this.styles}var f='"Consolas", "Monaco", "Vera Mono", "monospace"',e="10pt";g.prototype.styles=[];g.prototype.getStyles=d;g.prototype.fontSettable=!0;g.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};g.prototype.parseToXML=function(c){try{var b=
null;if(window.DOMParser){var b=(new DOMParser).parseFromString(c,"text/xml"),d=b.getElementsByTagName("parsererror");return!d||!d.length||!d[0].childNodes.length?b:null}b=new ActiveXObject("Microsoft.XMLDOM");b.async=!1;b.loadXML(c);return b}catch(a){}};g.prototype.selectFontSize=function(c){console.log("fontsize: "+c)};g.prototype.importTheme=function(c){console.log("import theme");console.log(c);var b=c.parameters.valueFor("name"),b=this.parseToXML(b),d=new h;d.name=b.getElementsByTagName("colorTheme")[0].attributes[1].value;
d.annotationRuler=b.getElementsByTagName("background")[0].attributes[0].value;d.background=b.getElementsByTagName("background")[0].attributes[0].value;d.comment=b.getElementsByTagName("singleLineComment")[0].attributes[0].value;d.keyword=b.getElementsByTagName("keyword")[0].attributes[0].value;d.text=b.getElementsByTagName("foreground")[0].attributes[0].value;d.string=b.getElementsByTagName("string")[0].attributes[0].value;d.overviewRuler=b.getElementsByTagName("background")[0].attributes[0].value;
d.lineNumberOdd=b.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumberEven=b.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumber=b.getElementsByTagName("lineNumber")[0].attributes[0].value;d.currentLine=b.getElementsByTagName("selectionBackground")[0].attributes[0].value;c.items.addTheme(d)};g.prototype.processSettings=function(c,b){var d=l.TextTheme.getTheme();d.setThemeClass("editorTheme",d.buildStyleSheet("editorTheme",c))};g.prototype.getViewData=function(){var c=
{top:10,left:10,width:400,height:350},b=c.left,d=c.top;c.shapes=[{type:"TEXT",name:k["Line Numbers"],label:"1",x:b+20,y:d+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:k.Background,x:b+46,y:d,width:290,height:c.height,family:"background",fill:"white"},{type:"TEXT",name:k.Strings,label:"'text/javascript'",x:b+134,y:d+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"\x3d",x:b+124,y:d+20,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Current Line"],x:b+46,y:d+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:k["HTML Attribute"],label:"type",x:b+98,y:d+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Overview Ruler"],x:b+336,y:d,width:14,height:c.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:k.Comments,label:"/* comment */",x:b+75,y:d+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},
{type:"TEXT",name:k["HTML Tag"],label:"\x3cscript",x:b+55,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3e",x:b+213,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Strings,label:"'Result'",x:b+164,y:d+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"multiply(a,b){",x:b+120,y:d+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",
name:k.Keywords,label:"function",x:b+75,y:d+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"var",x:b+95,y:d+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"output \x3d ",x:b+115,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:";",x:b+205,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"var",x:b+
95,y:d+100,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"result \x3d a*b;",x:b+115,y:d+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"return",x:b+95,y:d+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"output + result;",x:b+135,y:d+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"}",x:b+75,y:d+140,
fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3c/script\x3e",x:b+55,y:d+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3cstyle",x:b+55,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Attribute"],label:"type",x:b+95,y:d+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"\x3d",x:b+121,y:d+200,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Strings,label:"'text/css'",x:b+131,y:d+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3e",x:b+180,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:".some-class",x:b+75,y:d+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:"{",x:b+145,y:d+220,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Attribute"],label:"color:",x:b+95,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Value"],label:"#123456",x:b+130,y:d+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Text"],label:";",x:b+180,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:"}",x:b+75,y:d+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:k["HTML Tag"],label:"\x3c/style\x3e",x:b+55,y:d+280,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Annotation Ruler"],x:b,y:d,width:46,height:c.height,family:"annotationRuler",fill:"white"}];for(var a=0;16>a;a++)c.shapes.push({type:"TEXT",name:k["Line Numbers"],label:a+1,x:b+20,y:d+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return c};return{ThemeData:g,getStyles:d}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(k,l){function h(g,d){k.mixin(this,g);this.node=d||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=l.$(".setting-control",this.node)}k.mixin(h.prototype,{templateString:'\x3cinput type\x3d"text" class\x3d"setting-control" name\x3d"myname"/\x3e',category:null,item:null,element:null,ui:null,show:function(){this.textfield.addEventListener("change",this.change.bind(this));this.postCreate()},
destroy:function(){this.node&&(l.empty(this.node),this.textfield=this.node=null)},setStorageItem:function(){},width:function(g){this.textfield.style.width=g},getValue:function(){return"integer"===this.inputType?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(g){this.textfield.value=g},getSelection:function(){return this.getValue()},setSelection:function(g){this.setValue(g)},postCreate:function(){this.inputType&&"password"===this.inputType&&(this.textfield.type="password");
this.editmode&&"readonly"===this.editmode&&this.textfield.setAttribute("readonly","true")},change:function(){var g;this.selection&&this.selection.value&&(g=this.selection.value);this.setStorageItem(this.category,this.item,this.element,g,this.ui)}});return h});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(k,l,h){function g(d,f){h.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}k.mixin(g.prototype,h.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control" type\x3d"text" /\x3e\x3c/label\x3e\x3c/div\x3e',destroy:function(){h.prototype.destroy.call(this);
this.mylabel&&(this.mylabel=null)},postCreate:function(){h.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"}});return g});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(k,l){function h(g,d){k.mixin(this,g);this.node=d||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=l.$(".setting-control",this.node)}k.mixin(h.prototype,{templateString:'\x3clabel\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',show:function(){this.checkbox.addEventListener("change",this.change.bind(this));this.postCreate()},destroy:function(){this.node&&
(l.empty(this.node),this.checkbox=this.node=null)},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(g){this.checkbox.checked=g},getSelection:function(){return this.isChecked()},setSelection:function(g){this.setChecked(g)},change:function(){this.setStorageItem(this.checkbox.value)},postCreate:function(){this.checkbox.style.width="20px";this.editmode&&"readonly"===this.editmode&&this.checkbox.setAttribute("disabled","disabled")}});return h});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(k,l,h){function g(d,f){h.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}k.mixin(g.prototype,h.prototype,{templateString:'\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',postCreate:function(){h.prototype.postCreate.call(this);this.mylabel.textContent=
this.fieldlabel+":"},destroy:function(){h.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return g});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(k,l){function h(g,d){k.mixin(this,g);this.node=d||document.createElement("div");this.node.innerHTML=this.templateString;this.select=l.$(".setting-control",this.node)}k.mixin(h.prototype,{templateString:'\x3cselect class\x3d"setting-control" id\x3d"selection"\x3e\x3c/select\x3e',addOptions:function(g,d,f){d=document.createElement("option");d.value=g.value;d.appendChild(document.createTextNode("string"===typeof g.label?
g.label:g.value));g.selected&&(d.selected="selected");this.select.appendChild(d)},show:function(){this.postCreate()},postCreate:function(){this.options.forEach(this.addOptions.bind(this));this.select.addEventListener("change",this.change.bind(this))},destroy:function(){this.node&&(l.empty(this.node),this.node=this.select=null)},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(g){this.select.selectedIndex=
g},getSelection:function(){return this.getSelected()},setSelection:function(g){for(var d=0;d<this.options.length;d++)if(this.options[d].value===g){this.setSelectedIndex(d);return}this.setSelectedIndex(0)},change:function(){var g=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,g,this.ui):this.setStorageItem(g)}});return h});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(k,l,h){function g(d,f){h.apply(this,arguments);this.mylabel=l.$(".setting-label",this.node)}k.mixin(g.prototype,h.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cselect class\x3d"setting-control"\x3e\x3c/select\x3e\x3c/label\x3e\x3c/div\x3e',postCreate:function(){h.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){h.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return g});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(k,l,h,g,d,f){function e(b,c){var a=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!c.id)throw Error("Missing required argument: id");this.id=c.id;if(!c.title)throw Error("Missing required argument: title");var d=c.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");b.appendChild(this.domNode);for(var e=0;e<d.length;e++)this.domNode.classList.add(d[e]);this.domNode.id=c.id;c.canHide&&(this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(b){(b.target===a.titleNode||b.target===a.twistie||b.target===a.domNode)&&a._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(b){b.keyCode===k.KEY.ENTER&&(b.target===a.domNode||b.target===a.titleNode||b.target===a.twistie)&&a._changeExpandedState()},!1));if(c.iconClass){var f=document.createElement("span");f.classList.add("sectionIcon");this.domNode.appendChild(f);d=Array.isArray(c.iconClass)?c.iconClass:[c.iconClass];d.forEach(function(a){f.classList.add(a)})}c.headerClass&&
(d=Array.isArray(c.headerClass)?c.headerClass:[c.headerClass],d.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=c.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=c.title;"function"===typeof c.getItemCount&&(d=document.createElement("div"),d.classList.add("layoutLeft"),
d.classList.add("sectionItemCount"),this.domNode.appendChild(d),d.textContent=c.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=c.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);d=document.createElement("div");d.id=c.id+
"FilterSearchBox";this.domNode.appendChild(d);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=c.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=c.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=c.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);c.slideout&&(d=g.slideoutHTMLFragment(c.id),e=document.createRange(),e.selectNode(this.domNode),d=e.createContextualFragment(d),this.domNode.appendChild(d));this._contentParent=
document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);b.appendChild(this._contentParent);c.content&&this.setContent(c.content);"function"===typeof c.onExpandCollapse&&(this._onExpandCollapse=c.onExpandCollapse);this._preferenceService=c.preferenceService;this._collapse();if(this._preferenceService){var h=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=
a.get(h.id);void 0===a?c.hidden||h._expand():a&&h._expand();h._updateExpandedState(!1)})}else c.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=c.commandService;this._lastMonitor=0;this._loading={}}function c(b){this._section=b;this._id=++b._lastMonitor}e.prototype={setTitle:function(b){this.titleNode.textContent=b},getHeaderElement:function(b){return this.domNode},getTitleElement:function(b){return this.titleNode},getActionElement:function(b){return this._toolActionsNode},
setContent:function(b){"string"===typeof b?this._contentParent.innerHTML=b:(this._contentParent.innerHTML="",this._contentParent.appendChild(b))},getContentElement:function(){return this._contentParent},embedExplorer:function(b,c,a){this._contentParent.innerHTML="";b.parent||(b.parent=c);this._contentParent.appendChild(b.parent);b.section=this;d.mixin(b,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!k.node(a)){var b=document.createElement("ul");
b.id=a;b.classList.add("commandList");b.classList.add("layoutRight");this.section.actionsNode.appendChild(b)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(a,b){this.section.actionsNode.style.visibility=a?"":"hidden";void 0===b&&(b=a?null:"cursorOnly");this.renderer.selectionPolicy=b;var c=this.getNavHandler();c&&c.setSelectionPolicy(b);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){k.node(a)&&
this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(b){delete a[b]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var b=this;!this.selection&&!a&&(this.serviceRegistry||this.registry?(this.selection=
new f.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(a){b.updateCommands(a.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var c=this.registerCommands();!c||!c.then?b.updateCommands():c.then(function(){b.updateCommands()})}});b.renderer&&(b.renderer.section=this,d.mixin(b.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
a))&&this.section.setTitle(a.innerHTML);return null}}))},createProgressMonitor:function(){return new c(this)},_setMonitorMessage:function(b,c){this._progressNode.style.visibility="visible";this._loading[b]=c;var a="",d;for(d in this._loading)""!==a&&(a+="\n"),a+=this._loading[d];this._progressNode.title=a},_monitorDone:function(b){delete this._loading[b];b="";for(var c in this._loading)""!==b&&(b+="\n"),b+=this._loading[c];this._progressNode.title=b;""===b&&(this._progressNode.style.visibility="hidden")},
_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(b){var c=!this.hidden,a=this.twistie,d=this.id;a&&(a.classList.add(c?this._expandImageClass:this._collapseImageClass),a.classList.remove(c?this._collapseImageClass:this._expandImageClass));this._preferenceService&&b&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(d,c)});this._onExpandCollapse&&this._onExpandCollapse(c,this)},_expand:function(){this._contentParent.classList.remove("sectionClosed");
this.domNode.classList.remove("sectionClosed");this.hidden=!1},_collapse:function(){this.hidden=!0;this._contentParent.classList.add("sectionClosed");this.domNode.classList.add("sectionClosed")}};e.prototype.constructor=e;c.prototype={begin:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},worked:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},done:function(b){this.status=b;this._section._monitorDone(this.id)}};c.prototype.constructor=c;return{Section:e}});
define("orion/widgets/settings/Subsection",[],function(){function k(k){var h=k.sectionName;this.parentNode=k.parentNode;this.children=k.children;k=document.createElement("section");k.classList.add("setting-row");k.setAttribute("role","region");k.setAttribute("aria-labelledby","Navigation-header");var g=document.createElement("h3");g.classList.add("setting-header");g.textContent=h;h=document.createElement("div");h.classList.add("setting-content");k.appendChild(g);k.appendChild(h);this.node=k;this.subsectionContent=
h}k.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var k=this;this.children.forEach(function(h){k.subsectionContent.appendChild(h.node);h.show()})}};return k});
define("orion/widgets/settings/EditorSettings","i18n!orion/settings/nls/messages orion/widgets/input/LabeledTextfield orion/widgets/input/LabeledCheckbox orion/widgets/input/LabeledSelect orion/section orion/widgets/settings/Subsection orion/commands orion/objects orion/webui/littlelib".split(" "),function(k,l,h,g,d,f,e,c,b){function n(a,c,d,e,f){if(!e.local){var g=document.createElement("span");g.classList.add(p);g.classList.add(f[c+"LocalVisible"]?r:u);g.title=k.localSettingsTooltip;g.addEventListener("click",
function(a){g.classList.contains(u)?(g.classList.add(r),g.classList.remove(u)):(g.classList.add(u),g.classList.remove(r))});c=b.$("label",a.node);c.parentNode.insertBefore(g,c)}return a}function a(a,b,c){return n(new h(b),a,this,b,c)}function m(a,b,c){b.inputType="integer";return n(new l(b),a,this,b,c)}function s(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?k[a+"Invalid"]:""}function t(a,b){c.mixin(this,a);this.node=b}var p="setting-local-indicator",r="on",u="off",w={editorSettings:{keys:{keyBindings:{values:[{value:"",
label:k.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:function(a,b,c){var d=this.values;b.options=[];for(var e=0;e<d.length;e++){var f=d[e],h={value:f.value,label:f.label};f.value===c[a]&&(h.selected=!0);b.options.push(h)}return n(new g(b),a,this,b,c)}}},fileManagement:{autoSave:{create:a},autoSaveTimeout:{min:50,max:1E4,create:m,validate:s},autoLoad:{create:a},saveDiffs:{create:a},trimTrailingWhiteSpace:{create:a}},typing:{autoPairQuotations:{create:a},autoPairParentheses:{create:a},
autoPairBraces:{create:a},autoPairSquareBrackets:{create:a},autoPairAngleBrackets:{create:a},autoCompleteComments:{create:a},smartIndentation:{create:a}},tabs:{tabSize:{min:1,max:16,create:m,validate:s},expandTab:{create:a}},whitespaces:{showTabs:{create:a},showSpaces:{create:a}},wrapping:{wordWrap:{create:a},showMargin:{create:a},marginOffset:{min:10,max:200,create:m,validate:s}},smoothScrolling:{scrollAnimation:{create:a},scrollAnimationTimeout:{min:50,max:1E3,create:m,validate:s}},rulers:{annotationRuler:{create:a},
lineNumberRuler:{create:a},foldingRuler:{create:a},overviewRuler:{create:a}},languageTools:{showOccurrences:{create:a},contentAssistAutoTrigger:{create:a}}}};c.mixin(t.prototype,{templateString:'\x3cdiv class\x3d"sections"\x3e\x3c/div\x3e',commandTemplate:'\x3cdiv id\x3d"commandButtons"\x3e\x3cdiv id\x3d"editorCommands" class\x3d"layoutRight sectionActions"\x3e\x3c/div\x3e\x3c/div\x3e',createElements:function(){this.node.innerHTML=this.templateString;this.sections=b.$(".sections",this.node);this.createSections();
this.local?this.sections.classList.add("local"):(document.getElementById("pageActions").innerHTML=this.commandTemplate,this.createToolbar())},createSections:function(){var a=this.oldPrefs,c=[],e,h,m=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new d.Section(this.sections,{id:"editorThemeSettings",title:k.EditorThemes,canHide:!0,slideout:!0}),this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var n=this.oldThemeStyles;
if(a.themeVisible&&(!this.local||a.themeLocalVisible)){var l=n.styles;e=[];for(var s=0;s<l.length;s++)h={value:l[s].name,label:l[s].name},l[s].name===n.style.name&&(h.selected=!0),e.push(h);c.push(e=this.themeSelect=new g({fieldlabel:k.Theme,options:e}));e.setStorageItem=function(a){m.setTheme(a)}}if(a.fontSizeVisible&&(!this.local||a.fontSizeLocalVisible)){n=n.style.fontSize;e=[];for(l=8;19>l;l++)h={value:l+"pt",label:l+"pt"},h.label===n&&(h.selected=!0),e.push(h);c.push(e=this.sizeSelect=new g({fieldlabel:k["Font Size"],
options:e}));e.setStorageItem=function(a){m.setFontSize(a)}}!this.local&&0<c.length&&(c=new f({sectionName:k.Theme,parentNode:this.editorThemeSection.getContentElement(),children:c}),c.show(),c=[])}var t,G;for(G in w)if(w.hasOwnProperty(G)){this.local||(t=new d.Section(this.sections,{id:G,title:k[G],canHide:!0,slideout:!0}),e=document.createElement("div"),e.classList.add("setting-info"),e.textContent=k.editorSettingsInfo,h=document.createElement("span"),h.classList.add(p),h.classList.add(r),n=document.createElement("span"),
n.classList.add(p),n.classList.add(u),l=document.createElement("span"),l.classList.add("core-sprite-wrench"),l.classList.add("icon-inline"),l.classList.add("imageSprite"),b.processDOMNodes(e,[h,n,l]),t.getContentElement().appendChild(e));for(var E in w[G])if(w[G].hasOwnProperty(E)){for(var I in w[G][E])if(a[I+"Visible"]&&(!this.local||a[I+"LocalVisible"]))h=w[G][E][I],e={},e.local=this.local,e.fieldlabel=k[I],c.push(h.widget=h.create(I,e,a));!this.local&&0<c.length&&(c=new f({sectionName:k[E],parentNode:t.getContentElement(),
children:c}),c.show(),c=[])}}this.local&&c.forEach(function(a){this.sections.appendChild(a.node);a.hasOwnProperty("setStorageItem")||(a.setStorageItem=this.update.bind(this));a.show()}.bind(this))},createToolbar:function(){var a=b.node("editorSettingsToolActionsArea"),c=new e.Command({name:k.Restore,tooltip:k["Restore default Editor Settings"],id:"orion.restoreeditorsettings",callback:function(a){this.restore(a.items)}.bind(this)});this.commandService.addCommand(c);this.commandService.registerCommandContribution("restoreEditorSettingCommand",
"orion.restoreeditorsettings",2);this.commandService.renderCommands("restoreEditorSettingCommand",a,this,this,"button");c=new e.Command({name:k.Update,tooltip:k["Update Editor Settings"],id:"orion.updateeditorsettings",callback:function(a){this.update(a.items)}.bind(this)});this.commandService.addCommand(c);this.commandService.registerCommandContribution("editorSettingCommand","orion.updateeditorsettings",1);this.commandService.renderCommands("editorSettingCommand",a,this,this,"button")},valueChanged:function(){var a=
{},b;for(b in this.oldPrefs)this.oldPrefs.hasOwnProperty(b)&&(a[b]=this.oldPrefs[b]);this.getValues(a);for(var c in a)if(a.hasOwnProperty(c)&&a[c]!==this.oldPrefs[c])return a},validate:function(a){var b="";this._forEach(function(c,d){return d.validate&&(b=d.validate(c,a))?!1:!0});return b},_progress:function(a,b){this.registry&&this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:b})},update:function(){var a=this.valueChanged();if(a){var b=this.validate(a);if(b){this._progress(b,
"Error");return}this.preferences.setPrefs(a,function(){this.setValues(this.oldPrefs=a);this._progress(k["Editor preferences updated"],"Normal")}.bind(this))}else this.setValues(this.oldPrefs);this.editor&&this.editor.focus()},restore:function(){this.preferences.setPrefs({},function(a){this._show(a);this._progress(k["Editor defaults restored"],"Normal")}.bind(this))},show:function(a,b){a&&(this.node=a);this.themePreferences.getTheme(function(a){this.preferences.getPrefs(function(c){this._show(c,a);
b&&b()}.bind(this))}.bind(this))},_show:function(a,b){b&&(this.oldThemeStyles=b);this.oldPrefs=a;this.createElements();this.setValues(a)},_forEach:function(a){for(var b in w)if(w.hasOwnProperty(b))for(var c in w[b])if(w[b].hasOwnProperty(c))for(var d in w[b][c])if(w[b][c].hasOwnProperty(d)){var e=w[b][c][d];if(e.widget&&!a(d,e))return}},getValues:function(a){this._forEach(function(c,d){a[c]=d.widget.getSelection();if(!this.local){var e=b.$("."+p,d.widget.node);a[c+"LocalVisible"]=e&&e.classList.contains(r)}return!0}.bind(this))},
setValues:function(a){this._forEach(function(c,d){d.widget.setSelection(a[c]);if(!this.local){var e=b.$("."+p,d.widget.node);e&&(a[c+"LocalVisible"]?(e.classList.add(r),e.classList.remove(u)):(e.classList.add(u),e.classList.remove(r)))}return!0}.bind(this))},destroy:function(){this.node&&(this.node=null);this.editorThemeWidget&&(this.editorThemeWidget.destroy(),this.editorThemeWidget=null)}});return t});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(k){function l(h,g,d){k.attach(this);this._binderFunc=g;this.setInputField(h);(h=d?d.group:null)||(h=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=h+"__completion__";this._proposeFromStart=d?d.proposeFromStart:!1;this._extendedProvider=d?d.extendedProvider:null;this._serviceRegistry=d?d.serviceRegistry:null;this._onDelete=d?d.onDelete:null;this._deleteToolTips=
d?d.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];d=function(d){this._binderFunc&&this._binderFunc(function(e){this._bind(e);d.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",d);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:d});d=function(d){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:d});d=function(d){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",d);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:d})}l.prototype._removeListeners=function(h){h&&h.forEach(function(g){g.evtTarget.removeEventListener(g.type,g.handler,!1)})};l.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};l.prototype.hasValueOf=function(h){return this._dataList.some(function(g){return g.value===h})};l.prototype.setInputField=function(h){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=h;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));h=function(g){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:h});h=function(g){this.onKeyDown(g)}.bind(this);this._inputField.addEventListener("keydown",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:h});h=function(g){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",h);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:h});h=function(g){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(d){this._bind(d)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:h})};l.prototype.onKeyDown=function(h){if(this._dismissed)return!0;var g=h.charCode||h.keyCode;if(13===g){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return h.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,h.ctrlKey),h.stopPropagation(),!1}else{if((40===g||38===g)&&this._proposalList&&0<this._proposalList.length)return h.preventDefault(),this._walk(40===g),h.stopPropagation(),!1;if(27===g)return h.preventDefault(),this._dismiss(),!1;if(46===g&&-1<this._proposalIndex&&this._onDelete)return h.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),h.stopPropagation(),!1}return!0};l.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};l.prototype._bind=function(h){this._dataList=h};l.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};l.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
l.prototype._initUI=function(){(this._completionUIContainer=document.getElementById(this._getUIContainerID()))||(this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer));this._completionUIContainer.textContent="";(this._completionUL=document.getElementById(this._getUIProposalListId()))||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};l.prototype._createProposalLink=function(h,g,d,f){var e=document.createElement("a");
e.href=require.toUrl(g);e.appendChild(this._createBoldText(h,d,f));return e};l.prototype._createBoldText=function(h,g,d,f){if(0>g)return document.createTextNode(h);f=f?f:document.createElement("span");var e;0!==g&&(e=document.createTextNode(h.substring(0,g)),f.appendChild(e));var c=document.createElement("b");f.appendChild(c);e=document.createTextNode(h.substring(g,g+d));c.appendChild(e);g+d<h.length&&(e=document.createTextNode(h.substring(g+d)),f.appendChild(e));return f};l.prototype._proposeOnCategory=
function(h,g){if(0!==g.length){var d;if(h){d=document.createElement("li");d.className="inputCompletionLICategory";var f=document.createTextNode(h);d.appendChild(f);this._completionUL.appendChild(d)}g.forEach(function(e){d=document.createElement("li");d.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);d.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);d.className="inputCompletionLINormal";d.completionItem=e.item;var c;if("string"===typeof e.item.value){var b=
document.createElement("table");b.style.width="100%";b.style.tableLayout="fixed";b.style.borderSpacing="0";var f=document.createElement("tr");f.style.width=this._inputField.offsetWidth+"px";b.appendChild(f);var a=document.createElement("td");a.classList.add("inputCompletionLILeftTD");var g=this._createBoldText(e.item.value,e.boldIndex,e.boldLength);a.appendChild(g);a.style.overflow="hidden";f.appendChild(a);this._onDelete&&(c=document.createElement("button"),c.classList.add("inputCompletionDismissButton"),
c.classList.add("layoutRight"),c.classList.add("core-sprite-close"),c.classList.add("imageSprite"),c.style.display="none",c.style.margin="0 0 0",c.title=this._deleteToolTips,c.onclick=function(a){a.stopPropagation();this._onDelete(e.item.value,this);this._resetIndexAfterDeletion()}.bind(this),a=document.createElement("td"),a.classList.add("inputCompletionLIRightTD"),a.appendChild(c),f.appendChild(a));d.appendChild(b)}else e.item.value.name&&"link"===e.item.value.type&&d.appendChild(this._createProposalLink(e.item.value.name,
e.item.value.value,e.boldIndex,e.boldLength));this._completionUL.appendChild(d);this._proposalList.push({item:e.item,domNode:d,deleteBtn:c})}.bind(this))}};l.prototype._domNode2Index=function(h){if(this._proposalList)for(var g=0;g<this._proposalList.length;g++)if(this._proposalList[g].domNode===h)return g;return-1};l.prototype._highlight=function(h,g){var d=h,f,e=!1;isNaN(d)||(e=!0,this._proposalList&&0<=h&&h<this._proposalList.length?(d=this._proposalList[h].domNode,f=this._proposalList[h].deleteBtn):
d=null);d&&(d.className=g?"inputCompletionLISelected":"inputCompletionLINormal",f&&(f.style.display=g?"":"none"),g&&e&&(d.offsetTop<this._completionUIContainer.scrollTop?d.scrollIntoView(!0):d.offsetTop+d.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&d.scrollIntoView(!1)))};l.prototype._selectProposal=function(h,g){var d=h;isNaN(d)&&(d=this._domNode2Index(h));if(d!==this._proposalIndex||g)this._highlight(this._proposalIndex,!1),this._proposalIndex=d,
this._highlight(this._proposalIndex,!0)};l.prototype._dismiss=function(h,g){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof h?(this._inputField.value=h,this._dismissing=!0,this._inputField.focus()):h&&h.name&&"link"===h.type&&(g?window.open(h.value):window.location.href=h.value),window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200))};l.prototype._show=function(){if(this._proposalList&&0<this._proposalList.length){for(var h=
0,g=0,d=this._inputField;d;)h+=d.offsetLeft,g+=d.offsetTop,d=d.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=g+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=h+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,this._completionUIContainer.style.display="none"};l.prototype._walk=function(h){h=
this._proposalIndex+(h?1:-1);-1>h?h=this._proposalList.length-1:h>=this._proposalList.length&&(h=-1);this._selectProposal(h)};l.prototype._proposeOnList=function(h,g,d){var f="",e=[],c=g?g.length:0;h.forEach(function(b){if("category"===b.type)this._proposeOnCategory(f,e),f=b.label,e=[];else{var h=!0,a=-1;if(g&&d){var k;"string"===typeof b.value?k=b.value.toLowerCase():b.value.name&&(k=b.value.name.toLowerCase());a=k.indexOf(g);0>a?h=!1:this._proposeFromStart&&(h=0===a)}h&&e.push({item:b,boldIndex:a,
boldLength:c})}}.bind(this));this._proposeOnCategory(f,e)};l.prototype._proposeOn=function(h){this._completionUL.textContent="";var g=h?h.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,g,!0);this._extendedProvider&&g?this._extendedProvider(h,function(d){d&&d.forEach(function(d){this._proposeOnList(d.proposals,d.filterForMe?g:h,d.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};l.prototype.constructor=l;return{InputCompletion:l}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages orion/editor/find orion/commands orion/objects orion/searchUtils orion/inputCompletion/inputCompletion orion/webui/littlelib".split(" "),function(k,l,h,g,d,f,e){function c(b,c,a,d,e){l.Find.call(this,b,d,e);this._serviceRegistry=c;this._commandService=a}c.prototype=new l.Find;g.mixin(c.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?l.Find.prototype.getFindString.call(this):
b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");return!b?l.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();l.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){l.Find.prototype.show.call(this,b);var c=b.findString;this._addRecentfind(c);b=b.replaceString;var a=document.getElementById("localSearchFindWith");a||(this._createActionTable(),a=document.getElementById("localSearchFindWith"));
c&&(a.value=c);b&&(document.getElementById("localSearchReplaceWith").value=b);window.setTimeout(function(){a.select();a.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw\x3d\x3d",this._replaceInfo.title=k["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw\x3d\x3d",
this._replaceInfo.title=k["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var a=document.createElement("input");a.type="text";a.name=k["Find:"];a.className="parameterInput";a.id="localSearchFindWith";
a.placeholder=k["Find With"];a.oninput=function(a){return b._handleInput(a)};a.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(a);b._initCompletion(a);b._createButton(k.Next,c,function(){b._addRecentfind(b.getFindString());b.find(!0)});b._createButton(k.Previous,c,function(){b._addRecentfind(b.getFindString());b.find(!1)});var d=b._editor.getTextView().getOptions("readonly");if(!d){var e=document.createElement("input");e.type="text";e.name=k["ReplaceWith:"];e.className="parameterInput";
e.id="localSearchReplaceWith";e.placeholder=k["Replace With"];e.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(e);b._replaceInfo=b._createInfoImage(null,c,null);b._showReplaceInfo();b._createButton(k.Replace,c,function(){b.replace()});b._createButton(k["Replace All"],c,function(){b.replaceAll()})}e=document.createElement("div");c.appendChild(e);e.classList.add("findOptionsDiv");var f=h.createDropdownMenu(e,k.Options,null,"dismissButton",null,!0);f.menuButton.classList.add("parameterInlineButton");
h.createCheckedMenuItem(f.menu,k["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});f.dropdown.close(!0)});h.createCheckedMenuItem(f.menu,k["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});f.dropdown.close(!0);b.find(!0)});h.createCheckedMenuItem(f.menu,k["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});f.dropdown.close(!0)});h.createCheckedMenuItem(f.menu,k["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});
f.dropdown.close(!0)});h.createCheckedMenuItem(f.menu,k["Whole Word"],b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});f.dropdown.close(!0);b.find(!0)});b._regExBox=h.createCheckedMenuItem(f.menu,k["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});f.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});d||h.createCheckedMenuItem(f.menu,k["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});f.dropdown.close(!0)});
return a},function(){b.hide()})},_storeRecentFind:function(b,c,a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){d.put("recentFind",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:a})}.bind(this),20)})},_addRecentfind:function(b){"string"===typeof b&&b&&(!this._completion||!this._completion.hasValueOf(b))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var a;
c=c.get("recentFind");"string"===typeof c&&(c=JSON.parse(c));if(c){for(a in c)if(c[a].name===b)return;30<=c.length&&c.splice(29,c.length-30+1)}else c=[];c.splice(0,0,{name:b});this._storeRecentFind(c,this._completion)}.bind(this))},_removeRecentSearch:function(b,c){"string"===typeof b&&b&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var d;a=a.get("recentFind");"string"===typeof a&&(a=JSON.parse(a));if(a)for(d in a)if(a[d].name===b){a.splice(d,
1);this._storeRecentFind(a,c,!0);break}}.bind(this))},_initCompletion:function(b){if(this._completion)this._completion.setInputField(b);else{var c=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get("recentFind");"string"===typeof b&&(b=JSON.parse(b));if(b){var c=[];b.forEach(function(a){c.push({type:"proposal",label:a.name,value:a.name})});a(c)}})}.bind(this);this._completion=new f.InputCompletion(b,c,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,b){this._removeRecentSearch(a,b)}.bind(this),deleteToolTips:k["Click or use delete key to delete the search term"]})}},_createButton:function(b,c,a){var d=document.createElement("button");d.addEventListener("click",a.bind(this),!1);var f=this;d.addEventListener("keydown",function(a){a.keyCode===e.KEY.ESCAPE&&f.hide()});d.appendChild(document.createTextNode(b));d.className="dismissButton parameterInlineButton";c.appendChild(d)},_createInfoImage:function(b,c,
a){b=document.createElement("img");b.classList.add("replaceInfo");b.addEventListener("click",function(a){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));c.appendChild(b);return b},_handleInput:function(b){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;return c&&70===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=
!0,!1):(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&75===b.keyCode||13===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this._addRecentfind(this.getFindString()),13===b.keyCode?this.find(this._reverse?b.shiftKey:!b.shiftKey):this.find(!b.shiftKey),!1):c&&82===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1):27===b.keyCode?(this.hide(),!1):!0}});return{TextSearcher:c}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(k){var l=Object.create(null);k.getServiceReferences("orion.edit.context").forEach(function(h){var g=k.getService(h);Object.keys(g).forEach(function(d){"function"===typeof g[d]&&(l[d]=g[d].bind(g))})});return l},getOptions:function(k){var l=Object.create(null);k.getServiceReferences("orion.edit.context").forEach(function(h){h.getPropertyKeys().forEach(function(g){"service.id"!==g&&"service.names"!==g&&"objectClass"!==
g&&(l[g]=h.getProperty(g))})});return l}}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate","orion/edit/editorContext"],function(k,l,h,g){function d(d,e){for(var c=e.getFileMetadata(),b=d.getServiceReferences("orion.edit.blamer"),g=0;g<b.length;g++){var a=b[g],h={};h.validationProperties=a.getProperty("validationProperties");h.forceSingleItem=!0;h=k._makeValidator(h,d);if(h.validationFunction.bind(h)(c))return d.getService(a)}return null}return{isVisible:function(f,e){return!!d(f,e)&&!!f.getService("orion.core.blame")},
getBlame:function(f,e){var c=d(f,e);if(c){var b=function(a){for(var b=l.getOrionHome(),c=0;c<a.length;c++){var d=a[c],e=new h(d.CommitLink),g={};g.OrionHome=b;d.CommitLink=e.expand(g)}f.getService("orion.core.blame")._setAnnotations(a)};if(c.computeBlame){var k={metadata:e.getFileMetadata()};c.computeBlame(g.getEditorContext(f),k).then(b)}else c.doBlame(e.getInput()).then(b)}}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages orion/i18nUtil orion/webui/littlelib orion/webui/dialogs/OpenResourceDialog orion/widgets/input/DropDownMenu orion/Deferred orion/URITemplate orion/commands orion/keyBinding orion/commandRegistry orion/extensionCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/PageLinks orion/editor/annotations orion/blamer orion/regex orion/util orion/edit/editorContext".split(" "),function(k,l,h,g,d,f,e,c,b,n,a,m,s,t,p,r,u,w,v,x){function y(a){var b=
new e(a.uriTemplate),c=a.params||{};c.OrionHome=c.OrionHome||p.getOrionHome();var b=b.expand(c),d=document.createElement("div"),f=document.createElement("iframe");f.id=a.id;f.name=a.id;f.type="text/html";f.sandbox="allow-scripts allow-same-origin";f.frameborder=void 0!==a.border?a.border:1;f.src=b;f.className="delegatedUI";a.width&&(d.style.width=a.width,f.style.width=a.width);a.height&&(d.style.height=a.height,f.style.height=a.height);f.style.visibility="hidden";null!==a.parent&&(a.parent||window.document.body).appendChild(d);
d.appendChild(f);f.style.left=a.left||(window.innerWidth-parseInt(f.clientWidth,10))/2+"px";f.style.top=a.top||(window.innerHeight-parseInt(f.clientHeight,10))/2+"px";f.style.visibility="";window.addEventListener("message",function D(b){if(b.source===f.contentWindow&&"string"===typeof b.data&&(b=JSON.parse(b.data),"orion.page.delegatedUI"===b.pageService&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",D,!1);d.parentNode&&d.parentNode.removeChild(d)}},!1);return d}function A(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var q={},B=null;q.createDelegatedUI=y;A.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(a){var e=this,f=new c.Command({imageClass:"core-sprite-wrench",tooltip:k.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return a.installed},callback:function(b){var c=f.settingsDropDown;if(!c||
c.isDestroyed())c=f.settingsDropDown=new d(b.domNode.parentNode,b.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){c.focus()},onHide:function(){a.focus()}}),c.updateContent=e.localSettings.show.bind(e.localSettings),b=c.getContentNode(),b.tabIndex=b.style.marginTop=0;c.click()}});this.commandService.addCommand(f);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new b.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){var d=
new c.Command({name:k.Undo,id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().undo()}});this.commandService.addCommand(d);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new b.KeyBinding("z",!0));d=new c.Command({name:k.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().redo()}});
this.commandService.addCommand(d);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,v.isMac?new b.KeyBinding("z",!0,!0):new b.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var d=this;if(d._searcher){var e=!1,f=new c.Command({name:k.searchFiles,tooltip:k.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(b){if(!e){b=
a.getSelection();b=a.getText(b.start,b.end);var c=d.serviceRegistry.getService("orion.page.progress"),f=new g.OpenResourceDialog({searcher:d._searcher,progress:c,searchRenderer:d._searcher.defaultRenderer,nameSearch:!1,title:k.searchFiles,message:k.searchTerm,initialText:b,onHide:function(){e=!1;a.focus()}});window.setTimeout(function(){e=!0;f.show(h.node(d.toolbarId))},0)}}});this.commandService.addCommand(f);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",
1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new b.KeyBinding("h",!0))}},_generateSaveCommand:function(a,d){var e=this,f=d?d:"orion.save",g=new c.Command({name:k.Save,tooltip:k.saveFile,id:f,visibleWhen:function(){return!a.installed||e.inputManager.getReadOnly()?!1:!0},callback:function(a){e.inputManager.save();return!0}});this.commandService.addCommand(g);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,f,1,this.saveToolbarId?
"orion.menuBarFileGroup/orion.saveGroup":null,!1,new b.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new b.KeyBinding("s",!0),"save"),a.getTextView().setAction("save",g.callback,g))},_generateGotoLineCommnand:function(a){var d=this,e=new n.ParametersDescription([new n.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new n.CommandParameter("line","number","Line:",b.toString())]}),
e=new c.Command({name:k.gotoLine,tooltip:k.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:e,callback:function(b){var c=a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=c.getLineAtOffset(a.getCaretOffset()),(b=prompt(k.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(e);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",
3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new b.KeyBinding("l",!v.isMac,!1,!1,v.isMac),new n.URLBinding("gotoLine","line"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("gotoLine",function(b){if(b)return a.onGotoLine(b.line-1,0,void 0,b.callback),!0;d.commandService.runCommand("orion.gotoLine");return!0},e)},_generateFindCommnand:function(a){var d=this,e=new n.ParametersDescription([new n.CommandParameter("find","text","Find:")],{clientCollect:!0},
function(){var b=a.getSelection(),c="";b.end>b.start&&(c=a.getModel().getText(b.start,b.end),d._localSearcher&&d._localSearcher.getOptions().regex&&(c=w.escape(c)));return[new n.CommandParameter("find","text","Find:",c)]}),e=new c.Command({name:k.Find,tooltip:k.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:e,callback:function(b){if(d._localSearcher){var c="",e=null,f=a.getSelection();f.end>f.start&&b.parameters.valueFor("useEditorSelection")?(c=a.getModel().getText(f.start,
f.end),d._localSearcher.getOptions().regex&&(c=w.escape(c))):b.parameters&&b.parameters.valueFor("find")&&(c=b.parameters.valueFor("find"),e=t.matchResourceParameters(),s.convertFindURLBinding(e));e?(d._localSearcher.setOptions({regex:e.regEx,caseInsensitive:!e.caseSensitive}),b={},e.atLine&&(b.start=a.getModel().getLineStart(e.atLine-1)),d._localSearcher.show({findString:c,replaceString:e.replaceWith}),d._localSearcher.find(!0,b)):d._localSearcher.show({findString:c});return!0}return!1}});this.commandService.addCommand(e);
this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new b.KeyBinding("f",!0),new n.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return d._localSearcher.show(a),!0;d.commandService.runCommand("orion.editor.find",null,null,new n.ParametersDescription([new n.CommandParameter("useEditorSelection","text",
"","true")],{clientCollect:!0}));return!0},e)},_generateBlame:function(a){var d=this,e=new c.Command({name:k.Blame,tooltip:k.BlameTooltip,id:"orion.edit.blame",parameters:new n.ParametersDescription([new n.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:u.isVisible(d.serviceRegistry,d.inputManager)},callback:function(b){for(var c=!1,e=a.getAnnotationModel().getAnnotations();e.hasNext();)if(e.next().type===r.AnnotationType.ANNOTATION_BLAME){c=!0;
break}c=!c;b.parameters&&b.parameters.valueFor("blame")&&(c="true"===b.parameters.valueFor("blame"));c?u.getBlame(d.serviceRegistry,d.inputManager):a.showBlame([])}});this.commandService.addCommand(e);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new b.KeyBinding("b",!0,!0),new n.URLBinding("blame","blame"))},_generateEditCommands:function(d){function e(a){if(!a)return null;var c=new b.KeyBinding;b.KeyBinding.apply(c,a);return c}function g(a,
b){!b&&a&&"undefined"!==typeof a.HTML&&delete a.HTML;var c=n.serviceRegistry.getService("orion.page.message");c?c.setProgressResult(a):window.console.log(a)}var n=this,p=this.toolbarId,q=this.serviceRegistry,s=q.getServiceReferences("orion.edit.command"),r=this.inputManager,t=q.getService("orion.page.progress"),A=function(a,b,e){var f=e.visibleWhen;e.visibleWhen=function(a){return!d.installed||n.inputManager.getReadOnly()?!1:!f||f(a)};e.callback=function(c){d=this;var e=d.getSelection?d.getSelection():
{start:0,end:0};c=d.getModel();var f=function(a){"object"===typeof a&&a?(a.text&&d.setText(a.text),a.selection&&(d.setSelection&&d.setSelection(a.selection.start,a.selection.end,!0),d.focus())):"string"===typeof a&&(d.setText(a,e.start,e.end,!0),d.setSelection&&d.setSelection(e.start,e.start+a.length),d.focus())},h;b.execute?(c={contentType:r.getContentType(),input:r.getInput()},h=x.getEditorContext(q),h.openDelegatedUI=y,h.setStatus=g,c=b.execute(h,c),h=null):(c=b.run(c.getText(e.start,e.end),c.getText(),
e,r.getInput()),h=function(b){if(b&&b.uriTemplate){var c={};c.uriTemplate=b.uriTemplate;c.params=r.getFileMetadata();c.id=a.id;c.width=b.width;c.height=b.height;c.done=f;c.status=g;y(c)}else b&&(b.Status||b.status)?g(b.Status||b.status):f(b)});t.showWhile(c,l.formatMessage(k.running,a.name)).then(h);return!0};e.callback=e.callback.bind(d);return new c.Command(e)};f.when(function(a){if(B)return B;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new m.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));
return b.getContentTypes().then(function(a){return B=a})}(this.serviceRegistry),function(){var b=[],c=100;s.forEach(function(f){var g=f.getProperty("editor");if(!g||!(d.id&&g!==d.id)){for(var h=n.serviceRegistry.getService(f),k={},g=f.getPropertyKeys(),m=0;m<g.length;m++)k[g[m]]=f.getProperty(g[m]);k.forceSingleItem=!0;f=a._createCommandOptions(k,f,n.serviceRegistry,B,!1,function(a){return r.getFileMetadata()});b.push(f);f.then(function(a){a=A(k,h,a);n.commandService.addCommand(a);n.commandService.registerCommandContribution(n.toolbarId,
a.id,c,"orion.menuBarToolsGroup",!1,e(k.key))});c++}});f.all(b,function(a){return{_error:a}}).then(function(a){if(a=r.getFileMetadata()){var b=h.node(p);b&&(n.commandService.destroy(b),n.commandService.renderCommands(b.id,b,a,d,"button"));if(b=h.node("pageNavigationActions"))n.commandService.destroy(b),n.commandService.renderCommands(b.id,b,d,d,"button")}})})}};q.EditorCommandFactory=A;return q});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function k(k,h,g){this.serviceRegistry=k;this.editor=h;this.inputManager=g;this.contentTypeService=k.getService("orion.core.contentTypeRegistry");if(!this.contentTypeService)throw Error("Missing required service");this.serviceReferences={};var d=this;this.listener={onServiceAdded:function(f){d._onServiceAdded(f.serviceReference)},onServiceRemoved:function(f){d._onServiceRemoved(f.serviceReference)}};this.serviceRegistry.addEventListener("registered",
this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",this.listener.onServiceRemoved);this._init()}k.prototype={_init:function(){var k=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){k._wire(k.serviceRegistry)})},_wire:function(k){k=k.getServiceReferences("orion.edit.model");for(var h=0;h<k.length;h++)this._wireServiceReference(k[h])},_wireServiceReference:function(k){var h=k.getProperty("contentType");
if(void 0!==typeof h&&null!==h){var g=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),h).then(function(d){d&&g._wireService(k,g.serviceRegistry.getService(k))})}},_wireService:function(k,h){for(var g=Object.keys(h),d=this.editor.getTextView(),f=0;f<g.length;f++){var e=g[f],c=h[e];"on"!==e.substr(0,2)||"function"!==typeof c||(e=e.substr(2),this._wireServiceMethod(k,h,c,d,e))}this._initService(h,d)},_wireServiceMethod:function(k,h,g,d,f){h=function(d){g(d).then()};
k=k.getProperty("service.id");this.serviceReferences[k]=this.serviceReferences[k]||[];this.serviceReferences[k].push([d,f,h]);d.addEventListener(f,h)},_onServiceRemoved:function(k){k=k.getProperty("service.id");var h=this.serviceReferences[k];if(h){for(var g=0;g<h.length;g++){var d=h[g];d[0].removeEventListener(d[1],d[2])}delete this.serviceReferences[k]}},_onServiceAdded:function(k){-1!==k.getProperty("objectClass").indexOf("orion.edit.model")&&this._wireServiceReference(k)},_initService:function(k,
h){var g=k.onModelChanging;if("function"===typeof g){var d=h.getModel(),f=d.getText(),d={type:"Changing",text:f,start:0,removedCharCount:0,addedCharCount:f.length,removedLineCount:0,addedLineCount:d.getLineCount()};g.call(k,d)}}};return{Dispatcher:k}});
define("orion/edit/typedefs",["orion/objects","orion/serviceTracker"],function(k,l){function h(g){this.props=Object.create(null);this.defs=Object.create(null);this.registration=null;var d=new l(g,"orion.core.typedef"),f=this;d.onServiceAdded=function(d){var c=d.getProperty("id"),b=d.getProperty("defs");if(!c||!b)throw Error("TypeDef registration missing required 'id' or 'defs' [service id: "+d.getProperty("service.id")+"]");var g={};d.getPropertyKeys().forEach(function(a){"defs"!==a&&"service.id"!==
a&&"service.names"!==a&&"objectClass"!==a&&(g[a]=d.getProperty(a))});f.props[c]=g;f.defs[c]=b;f._updateRegistration()};d.removedService=function(d){d=d.getProperty("id");delete f.props[d];delete f.defs[d];f._updateRegistration()};d.open();this.registration=g.registerService("orion.edit.context",{getTypeDef:this.getTypeDef.bind(this)},null);this._updateRegistration()}k.mixin(h.prototype,{_updateRegistration:function(){this.registration&&this.registration.setProperties({typeDefs:this.getAllProperties()})},
getTypeDef:function(g){return this.defs[g]||null},getProperties:function(g){return this.props[g]||null},getAllProperties:function(){return this.props}});return h});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(k){var l="break case class catch continue const debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof undefined var void while with yield".split(" ");k=k.grammars;k.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+l.join("|")+")\\b",name:"keyword.control.js"}]});return{id:k[k.length-1].id,grammars:k,keywords:l}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(k){var l="abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while".split(" ");k=k.grammars;k.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
l.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:k[k.length-1].id,grammars:k,keywords:l}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(k){var l="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");k=
k.grammars;k.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+l.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:k[k.length-1].id,grammars:k,keywords:l}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(k,l,h,g){function d(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function f(){d.call(this,null,!0)}function e(a){d.call(this,null,a)}function c(){d.call(this,null,!1)}function b(b,g,h){this.commentStart="/*";this.commentEnd="*/";var k=[];switch(g){case "java":k=a;break;
case "js":k=n;break;case "css":k=m}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new d(k,this.whitespacesVisible);this._firstScanner=new c;this._commentScanner=new e(this.whitespacesVisible);this._whitespaceScanner=new f;"css"===g&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=b;this.annotationModel=h;this._bracketAnnotations=void 0;var l=this;this._listener=
{onChanged:function(a){l._onModelChanged(a)},onDestroy:function(a){l._onDestroy(a)},onLineStyle:function(a){l._onLineStyle(a)},onMouseDown:function(a){l._onMouseDown(a)},onSelection:function(a){l._onSelection(a)}};g=b.getModel();g.getBaseModel&&(g=g.getBaseModel());g.addEventListener("Changed",this._listener.onChanged);b.addEventListener("MouseDown",this._listener.onMouseDown);b.addEventListener("Selection",this._listener.onSelection);b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();b.redrawLines()}var n=l.keywords,a=h.keywords,m=g.keywords,s={styleClass:"comment"},t={styleClass:"comment"},p={styleClass:"comment block documentation"},r={styleClass:"keyword other documentation markup"},u={styleClass:"keyword other documentation task"},w={styleClass:"keyword other documentation tag"},v={styleClass:"string"},x={styleClass:"constant numeric"},y={styleClass:"keyword"},A={styleClass:"punctuation separator space",
unmergeable:!0},q={styleClass:"punctuation separator tab",unmergeable:!0},B={styleClass:"meta annotation currentLine"};d.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,c=this.offset-1;if(!b&&48<=a&&57>=a){var d=b=!1,e=!1,f=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!d)b=d=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===f&&2===this.offset-c)b=d=e=!0;else if(!(48<=a&&57>=a||e&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){c=this.text.substring(c,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};f.prototype=new d(null);f.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};e.prototype=new d(null);e.prototype.setType=function(a){this._type=a};e.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};c.prototype=new d(null);c.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};b.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(k.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var g=e[f];(g=this._createFoldingAnnotation(a,d,g.start,g.end))&&c.push(g)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c);b=b.getLineAtOffset(d);return e===b?null:new (k.AnnotationType.getType(k.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_computeTasks:function(a,b,c){if(this.detectTasks){var d=
this.annotationModel;if(d){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var g=d.getAnnotations(b,c),e=[],h=k.AnnotationType.ANNOTATION_TASK;g.hasNext();){var m=g.next();m.type===h&&e.push(m)}g=[];m=this._commentScanner;m.setText(f.getText(b,c));for(var l;l=m.nextToken();){var n=m.getStartOffset()+b;14===l&&(l=f.getLineEnd(f.getLineAtOffset(n)),6!==a&&(l=Math.min(l,c-this.commentEnd.length)),g.push(k.AnnotationType.createAnnotation(h,n,l,f.getText(n,l))))}d.replaceAnnotations(e,
g)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return B}return null},_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,g=this.comments,h=this._binarySearch(g,c,!0);h<g.length&&!(g[h].start>=d);h++){var k=g[h].start,m=g[h].end;f<k&&this._parse(b.substring(f-c,k-c),f,e);var l=g[h].type,n;switch(l){case 8:n=p;break;case 7:n=t;break;case 5:n=v}f=Math.max(f,
k);k=Math.min(d,m);(8===l||7===l)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,k-c),f,e,n,l):5===l&&this.whitespacesVisible?this._parseString(b.substring(f-c,k-c),f,e,v):e.push({start:f,end:k,style:n});f=m}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(a,b,c){var d=this._scanner;for(d.setText(a);a=d.nextToken();){var e=
d.getStartOffset()+b,f=null;switch(a){case 2:f=y;break;case 3:f=x;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,v);continue}else f=v;break;case 8:this._parseComment(d.getData(),e,c,p,a);continue;case 6:this._parseComment(d.getData(),e,c,s,a);continue;case 7:this._parseComment(d.getData(),e,c,t,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=A)}c.push({start:e,end:d.getOffset()+b,
style:f})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){e=f.getStartOffset()+b;var g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=A);break;case 12:g=r;break;case 13:g=w;break;case 14:g=u;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(f.getData(),e,c,g))}g&&c.push({start:e,end:f.getOffset()+b,style:g})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=A)}g&&c.push({start:f,end:e.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if(0<(f=a.indexOf("://"))){for(var e=a,g=f;0<g;){f=e.charCodeAt(g-1);if(!(97<=f&&122>=f||65<=f&&90>=f||45===f||48<=f&&57>=f))break;g--}if(0<g&&(f="\"\"''(){}[]\x3c\x3e".indexOf(e.substring(g-
1,g)),-1!==f&&0===(f&1)&&-1!==(f=e.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(f+1,f+2))))){var h=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(g,h)};c.push({start:b,end:b+g,style:d});c.push({start:b+g,end:b+h,style:f});c.push({start:b+h,end:b+a.length,style:d});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return e?(f=this._clone(d),f.tagName="a",f.attributes={href:e},f):d},_clone:function(a){if(!a)return a;
var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_findComments:function(a,b){b=b||0;var c=this._firstScanner,d;c.setText(a);for(var e=[];d=c.nextToken();)(7===d||8===d||5===d)&&e.push({start:c.getStartOffset()+b,end:c.getOffset()+b,type:d}),(6===d||7===d||8===d)&&this._computeTasks(d,c.getStartOffset()+b,c.getOffset()+b);return e},_findMatchingBracket:function(a,b){var c="{}()[]\x3c\x3e",d=a.getText(b,b+1),e=c.indexOf(d,0);if(-1===e)return-1;var f;f=e&1?c.substring(e-1,e):c.substring(e+
1,e+2);for(var g=a.getLineAtOffset(b),c=a.getLine(g),h=a.getLineStart(g),k=a.getLineEnd(g),c=this._findBrackets(d,f,c,h,h,k),k=0;k<c.length;k++)if(h=0<=c[k]?1:-1,c[k]*h-1===b){var m=1;if(e&1){for(k--;0<=k;k--)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*h-1;for(g-=1;0<=g;){c=a.getLine(g);h=a.getLineStart(g);k=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,k);for(e=c.length-1;0<=e;e--)if(h=0<=c[e]?1:-1,m+=h,0===m)return c[e]*h-1;g--}}else{for(k++;k<c.length;k++)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*
h-1;g+=1;for(e=a.getLineCount();g<e;){c=a.getLine(g);h=a.getLineStart(g);k=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,k);for(k=0;k<c.length;k++)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*h-1;g++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){var g=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var h=e,k=this._scanner,m,l=this.comments,n=this._binarySearch(l,e,!0);n<l.length&&!(l[n].start>=f);n++){m=l[n].start;var p=l[n].end;if(h<m)for(k.setText(c.substring(h-e,m-e));m=k.nextToken();)m===a?g.push(k.getStartOffset()+
h-e+d+1):m===b&&g.push(-(k.getStartOffset()+h-e+d+1));h=p}if(h<f)for(k.setText(c.substring(h-e,f-e));m=k.nextToken();)m===a?g.push(k.getStartOffset()+h-e+d+1):m===b&&g.push(-(k.getStartOffset()+h-e+d+1));return g},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var e;
if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,h,m;if(c.start===c.end&&0<(m=d.getCaretOffset()))m-=1,a.getBaseModel&&(m=a.mapOffset(m),a=a.getBaseModel()),a=this._findMatchingBracket(a,m),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,m,m+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());e=this._findMatchingBracket(f,e);-1!==e&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=
a.start,c=a.removedCharCount,d=a.addedCharCount-c,e=this.view;a=e.getModel();var f=a.getBaseModel?a.getBaseModel():a,c=b+c,g=f.getCharCount(),h=this.comments.length,m=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,m,!0),n=this._binarySearch(this.comments,c,!1,l-1,h);l<h&&this.comments[l].start<=m&&m<this.comments[l].end?(m=this.comments[l].start,m>b&&(m+=d)):m=l===h&&0<h&&g-d===this.comments[h-1].end?this.comments[h-1].start:m;var p;n<h?(p=this.comments[n].end,p>b&&(p+=d),
n+=1):(n=h,p=g);for(var g=f.getText(m,p),q,g=this._findComments(g,m),h=l;h<this.comments.length;h++)q=this.comments[h],q.start>b&&(q.start+=d),q.start>b&&(q.end+=d);var y=n-l!==g.length;if(!y)for(h=0;h<g.length;h++){q=this.comments[l+h];var s=g[h];if(q.start!==s.start||q.end!==s.end||q.type!==s.type){y=!0;break}}h=[l,n-l].concat(g);Array.prototype.splice.apply(this.comments,h);y&&(h=m,q=p,a!==f&&(h=a.mapOffset(h,!0),q=a.mapOffset(q,!0)),e.redrawRange(h,q));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=
this.annotationModel;l=e.getAnnotations(m,p);m=[];for(p=[];l.hasNext();)if(q=l.next(),q.type===k.AnnotationType.ANNOTATION_FOLDING){p.push(q);for(h=0;h<g.length&&!(q.start===g[h].start&&q.end===g[h].end);h++);h===g.length?(m.push(q),q.expand()):(h=q.start,n=q.end,h>b&&(h-=d),n>b&&(n-=d),h<=b&&b<n&&h<=c&&c<n&&(h=f.getLineAtOffset(q.start),n=f.getLineAtOffset(q.end),h!==n?q.expanded||q.expand():e.removeAnnotation(q)))}b=[];for(h=0;h<g.length;h++){q=g[h];for(d=0;d<p.length&&!(p[d].start===q.start&&p[d].end===
q.end);d++);d===p.length&&(q=this._createFoldingAnnotation(a,f,q.start,q.end))&&b.push(q)}e.replaceAnnotations(m,b)}}};return{TextStyler:b}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(k){function l(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function h(a,b,c,d,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=c;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns=
{};d&&(this._initPatterns(),this._subBlocks=v(d,d.getText(this.start,this.end),this,this.start))}function g(a){this._styler=a}function d(a,b,c,d){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new l(c,d);this._accessor=new g(this);this._bracketAnnotations=void 0;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},onDestroy:function(a){e._onDestroy(a)},
onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);d=c.getCharCount();this._rootBlock=
new h({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],x(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var f={styleClass:"meta annotation currentLine"},e=/$/,c=/\\(\d)/g,b=/^\(\?i\)\s*/,n=/(.*)(?:[\r\n]|$)/g,a={regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},m={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},s=function(a,b,c,d){var e=c,f=
a.lastIndex;n.lastIndex=c;c=n.exec(b);var g,h;a.lastIndex=0;if(c){for(h=c.index;0<=--h&&!(g=b.charAt(h),"\n"===g||"\r"===g););g=b.substring(h+1,c.index+c[1].length);a.lastIndex=h=c.index-h-1}for(;c&&c.index<b.length;){var k;if(d){var m=a.lastIndex;a.test(g)&&(a.lastIndex=m,k=a.exec(g))}else k=a.exec(g);if(k)return k.index+=e,k.index-=h,a.lastIndex=f,k;h=0;e+=c[0].length;if(c=n.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=f;return null},t=function(a,b){var d=a.toString();c.lastIndex=0;if(!c.test(d))return a;
c.lastIndex=0;for(var e=c.exec(d);e;)d=d.replace(e[0],b[e[1]]||""),c.lastIndex=0,e=c.exec(d);return RegExp(d.substring(1,d.length-1-1),"g")},p=function(a,b,c,d){if(b=s(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,d,!0)){a.result=b;for(d=0;d<c.length;d++)if(b.index<c[d].result.index||b.index===c[d].result.index&&a.pattern.pattern.index<c[d].pattern.pattern.index){c.splice(d,0,a);return}c.push(a)}},r=function(a,b,c,d){if(b[0])d.push({start:c,end:c+a[0].length,style:b[0].name});else for(var e=
0,f=1;f<a.length;f++)if(a[f]){var g=b[f];if(g){var h=c+e;d.push({start:h,end:h+a[f].length,style:g.name})}e+=a[f].length}},u=function(a,b,c){var d=a.start;b.forEach(function(b){d<=b.start&&c.push({start:d,end:b.start,style:a.style});c.push(b);d=b.end});d<a.end&&c.push({start:d,end:a.end,style:a.style})},w=function(a,b,c,d,f){if(a&&(c=c.getLinePatterns())){var g=[];c.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=s(c,a,0))&&g.push({result:c,pattern:b})});g.sort(function(a,
b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0;0<g.length;){var k=g[0];g.splice(0,1);if(!(k.result.index<h)){var m=k.result.index,l,n=[];if(k.pattern.regex){h=k.result;l=m+h[0].length;l={start:b+m,end:b+l,style:k.pattern.pattern.name};if(!f){k.pattern.pattern.captures&&r(h,k.pattern.pattern.captures,b+m,n);n.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(m=0;m<n.length-1;m++)if(n[m+
1].start<n[m].end){var w={start:n[m+1].end,end:n[m].end,style:n[m].style};n[m].end=n[m+1].start;n.splice(m+2,0,w)}}u(l,n,d)}else h=k.pattern.regexEnd,h=t(h,k.result),(h=s(h,a,k.result.index+k.result[0].length))||(e.lastIndex=0,h=e.exec(a)),l=h.index+h[0].length,d.push({start:b+m,end:b+l,style:k.pattern.pattern.name});h=h.index+h[0].length}p(k,a,g,h)}c.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},v=function(a,b,c,d){if(!b)return[];var f=[],g=[];c.getBlockPatterns().forEach(function(a){var c=
s(a.regexBegin||a.regex,b,0);c&&g.push({result:c,pattern:a})}.bind(this));if(!g.length)return f;g.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var k=0;0<g.length;){var m=g[0];g.splice(0,1);if(!(m.result.index<k)){var k=d+m.result.index,l=m.result.index,n=null,r=m.pattern.regexEnd;if(r){var l=l+m.result[0].length,u=m.pattern,w=t(r,m.result);w!==r&&(u={pattern:u.pattern,regexBegin:u.regexBegin,regexEnd:w},
r=w);for(w=l;!n;){(w=s(r,b,w))||(e.lastIndex=0,w=e.exec(b));var v=new h({start:k,end:d+w.index+w[0].length,contentStart:d+l,contentEnd:d+w.index},u,c.getStyler(),a,c),x=v.getBlocks();if(!x.length||x[x.length-1].end<=w.index+d)n=v;w=w.index+w[0].length}}else n=new h({start:k,end:k+m.result[0].length,contentStart:k,contentEnd:k+m.result[0].length},m.pattern,c.getStyler(),a,c);f.push(n);k=n.end-d}p(m,b,g,k)}return f},x=function(a,b,c){if(a.getAnnotationModel()){var d=k.AnnotationType.ANNOTATION_TASK;
if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&0===a.pattern.pattern.name.indexOf("comment")){var e=[];w(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)"meta.annotation.task.todo"===e[f].style&&c.push(k.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){x(a,b,c)}.bind(this))}};l.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+
"#"+this._NO_ID;var b=[0],c={},d=RegExp("^"+a+"[^#]+$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):(a.index=b[0]++,c[a.id]=a))}.bind(this));var e=[];Object.keys(c).forEach(function(a){e.push(c[a])});return e},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a,b){Object.keys(a).forEach(function(c){this._addPattern(a[c],c,b)}.bind(this))},_addPattern:function(a,
b,c){a.parentId=c;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,c){var d,e=a.include.indexOf("#");d=0===e?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===e?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):c[a.id]||(a.index=b[0]++,
c[a.id]=a))}.bind(this))},_NO_ID:"NoID"};h.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var c={start:this.start,end:this.end,style:this.pattern.pattern.name};if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?
{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:c;var d,e,f,g;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);g=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexEnd;f=a.getText(this.contentEnd,this.end);g=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];r(f,e,g,d);for(e=
0;e<d.length;e++)if(d[e].start<=b&&b<d[e].end)return d[e]}return c},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()},getPatterns:function(){return this.getLinePatterns()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){if(this.pattern&&this.pattern.pattern._linePatterns)this._linePatterns=this.pattern.pattern._linePatterns,this._blockPatterns=this.pattern.pattern._blockPatterns,this._enclosurePatterns=this.pattern.pattern._enclosurePatterns;else{var a=function(a){a="string"===typeof a?a:a.match;var c=b.exec(a),d="g";c&&(a=a.substring(c[0].length),d+="i");return RegExp(a,
d)},c=-1,d=0;this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(b){var e;if(b.match&&!b.begin&&!b.end){if(e={regex:a(b.match),pattern:b},this._linePatterns.push(e),b.name&&0===b.name.indexOf("punctuation.section")&&(-1!==b.name.indexOf(".begin")||-1!==b.name.indexOf(".end")))this._enclosurePatterns[b.name]=e}else!b.match&&b.begin&&b.end&&(c=d,e={regexBegin:a(b.begin),regexEnd:a(b.end),pattern:b},this._linePatterns.push(e));d++}.bind(this));this._blockPatterns=
this._linePatterns.slice(0,c+1);this.pattern&&(this.pattern.pattern._enclosurePatterns=this._enclosurePatterns,this.pattern.pattern._linePatterns=this._linePatterns,this.pattern.pattern._blockPatterns=this._blockPatterns)}}};g.prototype={getPatterns:function(a){return this._styler.getPatterns(a)},getStyles:function(a){return this._styler.getStyles(a)}};d.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);
a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getPatterns:function(a){return this._findBlock(this._rootBlock,a).getPatterns()},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],c=this.view.getModel();c.getBaseModel&&(c=c.getBaseModel());var d=this._findBlock(this._rootBlock,
a),e=c.getLineAtOffset(a),f=c.getLine(e),g=[];w(f,c.getLineStart(e),d,g);for(e=0;e<g.length&&!(a<g[e].start);e++)if(g[e].start<=a&&a<g[e].end){b.push(g[e]);break}for(;d;)(g=d.computeStyle(c,a))&&b.splice(0,0,g),d=d.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||
this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=
f;break}else d=f;return e},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(k.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var g=a[f];(g=this._createFoldingAnnotation(b,e,g.start,g.end))&&d.push(g)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c);b=b.getLineAtOffset(d);return e===b?null:new (k.AnnotationType.getType(k.AnnotationType.ANNOTATION_FOLDING))(c,
d,a)},_findBlock:function(a,b){var c=a.getBlocks();if(!c.length)return a;var d=this._binarySearch(c,b,!0);return d<c.length&&c[d].start<=b&&b<c[d].end?this._findBlock(c[d],b):a},_findBrackets:function(a,b,c,d,e,f){for(var g=[],h=[],k=e,m=c.getBlocks(),l=this._binarySearch(m,e,!0);l<m.length&&!(m[l].start>=f);l++){var n=m[l].start,p=m[l].end;k<n&&(w(d.substring(k-e,n-e),k,c,h),h.forEach(function(c){0===c.style.indexOf(a.pattern.name)?g.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&g.push(-(c.start+
1))}),h=[]);k=p}k<f&&(w(d.substring(k-e,f-e),k,c,h),h.forEach(function(c){0===c.style.indexOf(a.pattern.name)?g.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&g.push(-(c.start+1))}));return g},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),g,h=b.getEnclosurePatterns(),k=Object.keys(h),m=0;m<k.length;m++){var l=h[k[m]],n=s(l.regex,f,0);if(n&&0===n.index){g=l;break}}if(!g)return-1;f=!1;-1!==g.pattern.name.indexOf(".begin")?(f=!0,m=g.pattern.name.replace(".begin",
".end")):m=g.pattern.name.replace(".end",".begin");h=h[m];if(!h)return-1;k=a.getLine(d);l=a.getLineStart(d);e=this._findBrackets(g,h,b,k,l,e);for(m=0;m<e.length;m++)if(k=0<=e[m]?1:-1,e[m]*k-1===c){c=1;if(f){for(m++;m<e.length;m++)if(k=0<=e[m]?1:-1,c+=k,0===c)return e[m]*k-1;d+=1;for(m=a.getLineCount();d<m;){k=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,k,l,e);for(f=0;f<e.length;f++)if(k=0<=e[f]?1:-1,c+=k,0===c)return e[f]*k-1;d++}}else{for(m--;0<=m;m--)if(k=0<=e[m]?
1:-1,c+=k,0===c)return e[m]*k-1;for(d-=1;0<=d;){k=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,k,l,e);for(m=e.length-1;0<=m;m--)if(k=0<=e[m]?1:-1,c+=k,0===c)return e[m]*k-1;d--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return f}return null},_getPatternManager:function(){return this.patternManager},
_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var e=d+c.length,f=[],g=d,h=a.getBlocks(),k=this._binarySearch(h,d,!0);k<h.length&&!(h[k].start>=e);k++){var m=h[k].start,l=h[k].end;g<m&&w(c.substring(g-d,m-d),g,a,f);var n=Math.max(g,m);if(n===m&&h[k].pattern.regexBegin){var p=s(h[k].pattern.regexBegin,c.substring(n-d),0);if(p){var t=h[k].pattern.pattern.beginCaptures||h[k].pattern.pattern.captures;t?r(p,t,n,f):f.push({start:n,end:n+p[0].length,style:h[k].pattern.pattern.name});
n+=p[0].length}}var m=Math.min(e,l),u=[];if(m===l&&h[k].pattern.regexEnd&&(g=c.substring(m-g-(h[k].end-h[k].contentEnd)),p=s(h[k].pattern.regexEnd,g,0)))(t=h[k].pattern.pattern.endCaptures||h[k].pattern.pattern.captures)?r(p,t,m-p[0].length,u):h[k].pattern.pattern.name&&u.push({start:m-p[0].length,end:m,style:h[k].pattern.pattern.name}),m-=p[0].length;var g=this._getStyles(h[k],b,c.substring(n-d,m-d),n),v=h[k].pattern.pattern.contentName||h[k].pattern.pattern.name;if(v){var x=n;g.forEach(function(a){a.start-
x&&f.push({start:x,end:a.start,style:v});f.push(a);x=a.end});m-x&&f.push({start:x,end:m,style:v})}else f=f.concat(g);f=f.concat(u);g=l}g<e&&w(c.substring(g-d,e-d),g,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)c=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+c;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(a){this.destroy()},_onLineStyle:function(b){b.textView===this.view&&(b.style=
this._getLineStyle(b.lineIndex));b.ranges=this._getStyles(this._rootBlock,b.textView.getModel(),b.lineText,b.lineStart);b.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(a,b.ranges,b.lineText,b.lineStart),this.tabsVisible&&this._spliceStyles(m,b.ranges,b.lineText,b.lineStart))},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var e;if(this.highlightCaretLine){var f=
a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,h,m;if(c.start===c.end&&0<(m=d.getCaretOffset()))m-=1,a.getBaseModel&&(m=a.mapOffset(m),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,m),a=this._findMatchingBracket(a,c,m),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,
a+1),k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,m,m+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());var g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,e);-1!==e&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&
(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount;a=a.addedCharCount-c;var d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,g=f.getCharCount(),h=this._rootBlock.getBlocks(),m=h.length,l=f.getLineStart(f.getLineAtOffset(b)),n=this._binarySearch(h,l,!0),p=this._binarySearch(h,c,!1,n-1,m),s;n<m&&h[n].start<=l&&l<h[n].end?(s=h[n].start,s>b&&(s+=a)):s=n===m&&0<m&&g-a===h[m-1].end?h[m-1].start:l;var r;do p<m?(r=h[p].end,r>b&&(r+=a),p+=1):
(p=m,r=g),l=f.getText(s,r),l=v(f,l,this._rootBlock,s);while(l.length&&h.length&&p<m&&l[l.length-1].pattern.pattern.id!==h[p-1].pattern.pattern.id);for(g=n;g<h.length;g++)m=h[g],m.start>b&&m.adjustStart(a),m.start>b&&m.adjustEnd(a);var t=p-n!==l.length;if(!t)for(g=0;g<l.length;g++){var m=h[n+g],u=l[g];if(m.start!==u.start||m.end!==u.end||m.type!==u.type){t=!0;break}}g=[n,p-n].concat(l);Array.prototype.splice.apply(h,g);t&&(g=s,m=r,e!==f&&(g=e.mapOffset(g,!0),m=e.mapOffset(m,!0)),d.redrawRange(g,m));
if(this.annotationModel){d=[];h=[];n=[];s=this.annotationModel.getAnnotations(s,r);for(r=this.foldingEnabled&&f!==e;s.hasNext();)if(m=s.next(),r&&m.type===k.AnnotationType.ANNOTATION_FOLDING){n.push(m);for(g=0;g<l.length&&!(m.start===l[g].start&&m.end===l[g].end);g++);g===l.length?(d.push(m),m.expand()):(g=m.start,p=m.end,g>b&&(g-=a),p>b&&(p-=a),g<=b&&b<p&&g<=c&&c<p&&(g=f.getLineAtOffset(m.start),p=f.getLineAtOffset(m.end),g!==p?m.expanded||m.expand():this.annotationModel.removeAnnotation(m)));for(g=
0;g<l.length;g++){m=l[g];for(p=0;p<n.length&&!(n[p].start===m.start&&n[p].end===m.end);p++);p===n.length&&(m=this._createFoldingAnnotation(e,f,m.start,m.end))&&h.push(m)}}else m.type===k.AnnotationType.ANNOTATION_TASK&&d.push(m);if(this.detectTasks)for(g=0;g<l.length;g++)x(l[g],f,h);this.annotationModel.replaceAnnotations(d,h)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,g=e.exec(c);g;){for(g=d+g.index;f<b.length&&!(g<b[f].end);)f++;var h={start:g,end:g+1,style:a.style};if(f<
b.length&&b[f].start<=g){var k={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,k);b.splice(f+1,0,h);f+=2}else b.splice(f,0,h),f++;g=e.exec(c)}}};return{TextStyler:d}});
define("orion/editor/textMateStyler",["orion/regex"],function(k){function l(d){var f;if(d instanceof Array){f=Array(d.length);for(var e=0;e<d.length;e++)f[e]=l(d[e])}else for(e in f={},d)if(Object.prototype.hasOwnProperty.call(d,e)){var c=d[e];f[e]="object"===typeof c&&null!==c?l(c):c}return f}function h(d,f,e){this.initialize(d);this.grammar=l(f);this.externalGrammars=e?l(e):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var g={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(d){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(d){return"\x3d"===d[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(d){return"atomic group"}}],toRegExp:function(d){function f(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var e="",c;d=g.processGlobalFlag("x",d,function(b){for(var a="",c=!1,d=b.length,e=0;e<d;){var f=b.charAt(e);if(!c&&"#"===f)for(;e<d&&"\r"!==f&&"\n"!==f;)f=b.charAt(++e);
else if(!c&&/\s/.test(f))for(;e<d&&/\s/.test(f);)f=b.charAt(++e);else"\\"===f?(a+=f,/\s/.test(b.charAt(e+1))||(a+=b.charAt(e+1),e+=1)):("["===f?c=!0:"]"===f&&(c=!1),a+=f),e+=1}return a});d=g.processGlobalFlag("i",d,function(b){e+="i";return b});for(c=0;c<this.unsupported.length;c++){var b;(b=this.unsupported[c].regex.exec(d))&&f(this.unsupported[c].func(b),b)}return RegExp(d,e)},processGlobalFlag:function(d,f,e){var c="(?"+d+")";d="(?"+d+":";if(f.substring(0,c.length)===c)return e(f.substring(c.length));
if(f.substring(0,d.length)===d){for(var c=0,b=f.length,g=-1,a=0;a<b&&-1===g;a++)switch(f.charAt(a)){case "\\":a++;break;case "(":c++;break;case ")":c--,0===c&&(g=a)}c=g;if(c<f.length-1)throw Error("Only a "+d+") group that encloses the entire regex is supported in: "+f);return e(f.substring(d.length,c))}return f},hasBackReference:function(d){return/\\\d+/.test(d.source)},getSubstitutedRegex:function(d,f,e){e="undefined"===typeof e?!0:!1;d=d.source.split(/(\\\d+)/g);for(var c=[],b=0;b<d.length;b++){var g=
d[b],a=/\\(\d+)/.exec(g);a?(g=f[a[1]]||"",c.push(e?k.escape(g):g)):c.push(g)}return RegExp(c.join(""))},groupify:function(d,f){for(var e=d.source,c=e.length,b=[],g=0,a=[],h=1,k=1,l=[],p={},r={},u=0;u<c;u++){var w=b[b.length-1],v=e.charAt(u);switch(v){case "(":4===w&&(b.pop(),l.push(")"),a[a.length-1].end=u);var x=u+2<c?e.charAt(u+1)+""+e.charAt(u+2):null;if("?:"===x||"?\x3d"===x||"?!"===x){var y;"?:"===x?y=1:(y=3,g++);b.push(y);a.push({start:u,end:-1,type:y});l.push(v);l.push(x);u+=x.length}else b.push(2),
a.push({start:u,end:-1,type:2,oldNum:h,num:k}),l.push(v),0===g&&(r[k]=null),p[h]=k,h++,k++;break;case ")":w=b.pop();3===w&&g--;a[a.length-1].end=u;l.push(v);break;case "*":case "+":case "?":case "}":var A=v,q=e.charAt(u-1),x=u-1;if("}"===v){for(y=u-1;"{"!==e.charAt(y)&&0<=y;y--);q=e.charAt(y-1);x=y-1;A=e.substring(y,u+1)}y=a[a.length-1];if(")"===q&&(2===y.type||4===y.type)){l.splice(y.start,0,"(");l.push(A);l.push(")");v={start:y.start,end:l.length-1,type:4,num:y.num};for(q=0;q<a.length;q++)if(w=
a[q],(2===w.type||4===w.type)&&w.start>=y.start&&w.end<=x)w.start+=1,w.end+=1,w.num+=1,2===w.type&&(p[w.oldNum]=w.num);a.push(v);k++;break}default:"|"!==v&&2!==w&&4!==w&&0===g&&(b.push(4),a.push({start:u,end:-1,type:4,num:k}),l.push("("),r[k]=null,k++),l.push(v),"\\"===v&&(v=e.charAt(u+1),l.push(v),u+=1)}}for(;b.length;)b.pop(),l.push(")");e=RegExp(l.join(""));c={};f=f||p;for(var B in f)f.hasOwnProperty(B)&&(c[B]="\\"+f[B]);e=this.getSubstitutedRegex(e,c,!1);return[e,p,r]},complexCaptures:function(d){if(!d)return!1;
for(var f in d)if(d.hasOwnProperty(f)&&"0"!==f)return!0;return!1}};h.prototype={initialize:function(d){this.textView=d;this.textView.stylerOptions=this;var f=this;this._listener={onModelChanged:function(d){f.onModelChanged(d)},onDestroy:function(d){f.onDestroy(d)},onLineStyle:function(d){f.onLineStyle(d)},onStorage:function(d){f.onStorage(d)}};d.addEventListener("ModelChanged",this._listener.onModelChanged);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",this._listener.onLineStyle);
d.redrawLines()},onDestroy:function(d){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(d){for(d=[d];0!==d.length;){var f=d.pop();if(!f._resolvedRule||!f._typedRule)if(f._resolvedRule=
this._resolve(f),f._typedRule=this._createTypedRule(f),this.addStyles(f.name),this.addStyles(f.contentName),this.addStylesForCaptures(f.captures),this.addStylesForCaptures(f.beginCaptures),this.addStylesForCaptures(f.endCaptures),f._resolvedRule!==f&&d.push(f._resolvedRule),f.patterns)for(var e=0;e<f.patterns.length;e++)d.push(f.patterns[e])}},addStyles:function(d){if(d&&!this._styles[d]){this._styles[d]=[];for(var f=d.split("."),e=0;e<f.length;e++)this._styles[d].push(f.slice(0,e+1).join("-"))}},
addStylesForCaptures:function(d){for(var f in d)d.hasOwnProperty(f)&&this.addStyles(d[f].name)},ContainerRule:function(){function d(d){this.rule=d;this.subrules=d.patterns}d.prototype.valueOf=function(){return"aa"};return d}(),BeginEndRule:function(){function d(d){this.rule=d;this.beginRegex=g.toRegExp(d.begin);this.endRegex=g.toRegExp(d.end);this.subrules=d.patterns||[];this.endRegexHasBackRef=g.hasBackReference(this.endRegex);var e=g.complexCaptures(d.captures);d=g.complexCaptures(d.beginCaptures)||
g.complexCaptures(d.endCaptures);if(this.isComplex=e||d)e=g.groupify(this.beginRegex),this.beginRegex=e[0],this.beginOld2New=e[1],this.beginConsuming=e[2],e=g.groupify(this.endRegex,this.beginOld2New),this.endRegex=e[0],this.endOld2New=e[1],this.endConsuming=e[2]}d.prototype.valueOf=function(){return this.beginRegex};return d}(),MatchRule:function(){function d(d){this.rule=d;this.matchRegex=g.toRegExp(d.match);if(this.isComplex=g.complexCaptures(d.captures))d=g.groupify(this.matchRegex),this.matchRegex=
d[0],this.matchOld2New=d[1],this.matchConsuming=d[2]}d.prototype.valueOf=function(){return this.matchRegex};return d}(),_createTypedRule:function(d){return d.match?new this.MatchRule(d):d.begin?new this.BeginEndRule(d):new this.ContainerRule(d)},_resolve:function(d){var f=d;if(d.include){if(d.begin||d.end||d.match)throw Error('Unexpected regex pattern in "include" rule '+d.include);d=d.include;if("#"===d.charAt(0)){if(f=this.grammar.repository&&this.grammar.repository[d.substring(1)],!f)throw Error("Couldn't find included rule "+
d+" in grammar repository");}else if("$self"===d)f=this.grammar;else{if("$base"===d)throw Error('Include "$base" is not supported');f=this._allGrammars[d];if(!f)for(var e=0;e<this.externalGrammars.length;e++){var c=this.externalGrammars[e];if(c.scopeName===d){this.preprocess(c);f=this._allGrammars[d]=c;break}}}}return f},ContainerNode:function(){function d(d,e){this.parent=d;this.rule=e;this.children=[];this.end=this.start=null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.valueOf=
function(){var d=this.rule;return"ContainerNode { "+(d.include||"")+" "+(d.name||"")+(d.comment||"")+"}"};return d}(),BeginEndNode:function(){function d(d,e,c){this.parent=d;this.rule=e;this.children=[];this.setStart(c);this.endMatch=this.end=null;this.endRegexSubstituted=e.endRegexHasBackRef?g.getSubstitutedRegex(e.endRegex,c):null}d.prototype.addChild=function(d){this.children.push(d)};d.prototype.getIndexInParent=function(d){return this.parent?this.parent.children.indexOf(this):-1};d.prototype.setStart=
function(d){this.start=d.index;this.beginMatch=d};d.prototype.setEnd=function(d){d&&"object"===typeof d?(this.endMatch=d,this.end=d.index+d[0].length):(this.endMatch=null,this.end=d)};d.prototype.shiftStart=function(d){this.start+=d;this.beginMatch.index+=d};d.prototype.shiftEnd=function(d){this.end+=d;this.endMatch&&(this.endMatch.index+=d)};d.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return d}(),push:function(d,f){if(f)for(var e=f.length;0<
e;)d.push(f[--e])},exec:function(d,f,e){if(f=d.exec(f))f.index+=e;d.lastIndex=0;return f},afterMatch:function(d){return d.index+d[0].length},getEndMatch:function(d,f,e){if(d instanceof this.BeginEndNode){var c=d.rule;d=d.endRegexSubstituted||c.endRegex;return!d?null:this.exec(d,f,e)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,!1,0)},onModelChanged:function(d){var f=d.addedCharCount,
e=d.removedCharCount;d=d.start;if(this._tree){var c=this.textView.getModel(),b=c.getCharCount(),c=c.getLineEnd(c.getLineAtOffset(d)-1),g=this.getFirstDamaged(c,c),c=-1===c?0:c,f=g?this.parse(g,!0,c,d,f,e):b;this.textView.redrawRange(c,f)}else this.initialParse()},getFirstDamaged:function(d,f){if(0>d)return this._tree;for(var e=[this._tree],c=null;e.length;){var b=e.pop();if(!b.parent||this.isDamaged(b,d,f)){b instanceof this.BeginEndNode&&(c=b);for(var g=0;g<b.children.length;g++)e.push(b.children[g])}}return c||
this._tree},isDamaged:function(d,f,e){return d.start<=e&&d.end>f},parse:function(d,f,e,c,b,g){var a=this.textView.getModel(),h=a.getLineStart(a.getLineCount()-1),k=a.getCharCount(),l=this.getInitialExpected(d,e),p=-1;f&&(d.repaired=!0,d.endNeedsUpdate=!0,p=(p=d.children[d.children.length-1])?a.getLineEnd(a.getLineAtOffset(p.end+(b-g))):-1,c=a.getLineEnd(a.getLineAtOffset(c+g)),p=Math.max(p,c));p=-1===p?k:p;c=l;for(var r=d,u=!1,w=e,v=-1;r&&(!f||w<p);){var x=this.getNextMatch(a,r,w);x||(w=w>=h?k:a.getLineStart(a.getLineAtOffset(w)+
1));var y=x&&x.match,A=x&&x.rule,q=x&&x.isEnd;if(x&&x.isSub)w=this.afterMatch(y),A instanceof this.BeginEndRule&&(u=!0,f&&A===c.rule&&r===c.parent?(r=c,r.setStart(y),r.repaired=!0,r.endNeedsUpdate=!0,c=this.getNextExpected(c,"begin")):(f&&(this.prune(r,c),f=!1),y=new this.BeginEndNode(r,A,y),r.addChild(y),r=y));else if(q||w===k)r instanceof this.BeginEndNode&&(y?(u=!0,v=Math.max(v,r.end),r.setEnd(y),w=this.afterMatch(y),f&&r===c&&r.parent===c.parent?(r.repaired=!0,delete r.endNeedsUpdate,c=this.getNextExpected(c,
"end")):f&&(this.prune(r,c),f=!1)):(r.setEnd(k),delete r.endNeedsUpdate)),r=r.parent;f&&w>=p&&!u&&(this.prune(d,l),f=!1)}this.removeUnrepairedChildren(d,f,e);this.cleanup(f,d,e,p,k,b,g);return f?Math.max(v,w):w},removeUnrepairedChildren:function(d,f,e){if(f){f=d.children;for(var c=-1,b=0;b<f.length;b++){var g=f[b];if(!g.repaired&&this.isDamaged(g,e,Number.MAX_VALUE)){c=b;break}}-1!==c&&(d.children.length=c)}},cleanup:function(d,f,e,c,b,g,a){if(d){d=g-a;b=this.getIntersecting(c-d+1,b);f=this.getIntersecting(e,
c);for(e=0;e<b.length;e++)c=b[e],!c.repaired&&c instanceof this.BeginEndNode&&(c.shiftEnd(d),c.shiftStart(d));for(e=0;e<f.length;e++)c=f[e],c.repaired&&c.endNeedsUpdate&&c.shiftEnd(d),delete c.endNeedsUpdate,delete c.repaired}else{f=this.getIntersecting(e,c);for(e=0;e<f.length;e++)delete f[e].repaired}},getNextMatch:function(d,f,e,c){var b=d.getLineAtOffset(e),b=d.getLineEnd(b),g=d.getText(e,b),a=[],h=[];d=[];b=[];for(this.push(a,f.rule.subrules);a.length;){var k=a.length?a.pop():null,k=k&&k._resolvedRule._typedRule;
if(k instanceof this.ContainerRule&&-1===h.indexOf(k))h.push(k),this.push(a,k.subrules);else if(!k||!c||k.matchRegex){var l=k&&this.exec(k.matchRegex||k.beginRegex,g,e);l&&(d.push(l),b.push(k))}}a=Number.MAX_VALUE;h=-1;for(k=0;k<d.length;k++)l=d[k],l.index<a&&(a=l.index,h=k);if(!c&&(e=this.getEndMatch(f,g,e)))if(c=f.rule.applyEndPatternLast,-1===h||e.index<a||!c&&e.index===a)return{isEnd:!0,rule:f.rule,match:e};return-1===h?null:{isSub:!0,rule:b[h],match:d[h]}},getInitialExpected:function(d,f){var e,
c;if(d===this._tree)for(e=0;e<d.children.length;e++){if(c=d.children[e],c.start>=f)return c}else if(d instanceof this.BeginEndNode&&d.endMatch){var b=d.endMatch.index;for(e=0;e<d.children.length&&!(c=d.children[e],c.start>=f);e++);if(c&&c.start<b)return c}return d},getNextExpected:function(d,f){if("begin"===f){var e=d.children[0];return e?e:d}if("end"===f&&(e=d.parent)){var c=e.children[e.children.indexOf(d)+1];return c?c:e}return null},prune:function(d,f){f.parent===d?d.children.length=f.getIndexInParent():
d instanceof this.BeginEndNode&&(d.endMatch=null,d.end=null);d.parent&&(d.parent.children.length=d.getIndexInParent()+1)},onLineStyle:function(d){this._tree||this.initialParse();var f=d.lineStart,e=this.textView.getModel(),c=e.getLineEnd(d.lineIndex),b=e.getLineEnd(e.getLineAtOffset(f)-1),b=this.getFirstDamaged(b,b),f=this.getLineScope(e,b,f,c);d.ranges=this.toStyleRanges(f);d.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(d,f,e,c){for(var b=e,g=this.getInitialExpected(f,
e),a=[],h=[];f&&b<c;){var k=this.getNextMatch(d,f,b);if(!k)break;var l=k&&k.match,p=k&&k.rule,r=k&&k.isSub,k=k&&k.isEnd;l.index!==b&&h.push({start:b,end:l.index,node:f});r?(b=this.afterMatch(l),p instanceof this.BeginEndRule?(this.addBeginScope(a,l,p),f=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(a,l,p)):k&&(b=this.afterMatch(l),this.addEndScope(a,l,p),g=this.getNextExpected(g,"end"),f=f.parent)}b<c&&h.push({start:b,end:c,node:f});d=this.getInheritedLineScope(h,e,c);return a.concat(d)},
getInheritedLineScope:function(d,f,e){f=[];for(e=0;e<d.length;e++)for(var c=d[e],b=c.node;b;){var g=b.rule.rule,a=g.name;if(g=g.contentName||a){this.addScopeRange(f,c.start,c.end,g);break}b=b.parent}return f},addBeginScope:function(d,f,e){var c=e.rule;this.addCapturesScope(d,f,c.beginCaptures||c.captures,e.isComplex,e.beginOld2New,e.beginConsuming)},addEndScope:function(d,f,e){var c=e.rule;this.addCapturesScope(d,f,c.endCaptures||c.captures,e.isComplex,e.endOld2New,e.endConsuming)},addMatchScope:function(d,
f,e){var c=e.rule,b=c.name;(c=c.captures)?this.addCapturesScope(d,f,c,e.isComplex,e.matchOld2New,e.matchConsuming):this.addScope(d,f,b)},addScope:function(d,f,e){e&&d.push({start:f.index,end:this.afterMatch(f),scope:e})},addScopeRange:function(d,f,e,c){c&&d.push({start:f,end:e,scope:c})},addCapturesScope:function(d,f,e,c,b,g){if(e)if(c){c={1:0};for(var a=0,h=1;void 0!==f[h];h++)void 0!==g[h]&&(a+=f[h].length),void 0!==f[h+1]&&(c[h+1]=a);g=f.index;for(a=1;e[a];a++){var h=e[a].name,k=b[a],l=g+c[k];
"undefined"!==typeof f[k]&&this.addScopeRange(d,l,l+f[k].length,h)}}else this.addScope(d,f,e[0]&&e[0].name)},getIntersecting:function(d,f){for(var e=[],c=this._tree?[this._tree]:[];c.length;){var b=c.pop(),g=!1;b instanceof this.ContainerNode?g=!0:this.isDamaged(b,d,f)&&(g=!0,e.push(b));if(g)for(var g=b.children.length,a=0;a<g;a++)c.push(b.children[a])}return e.reverse()},toStyleRanges:function(d){for(var f=[],e=0;e<d.length;e++){var c=d[e],b=this._styles[c.scope];if(!b)throw Error("styles not found for "+
c.scope);b=b.join(" ");f.push({start:c.start,end:c.end,style:{styleClass:b}})}return f}};return{RegexUtil:g,TextMateStyler:h}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(k,l){function h(e){return-1!==e.getProperty("objectClass").indexOf(d)&&"highlighter"===e.getProperty("type")}function g(d,c,b){this.initialize(d,c,b);this.lineStyles=[]}var d="orion.edit.highlighter",f=d+" service must be an event emitter";l.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
g.prototype={initialize:function(e,c,b){this.textView=e;this.serviceRegistry=c;this.annotationModel=b;this.services=[];var f=this;this.listener={onModelChanging:function(a){f.onModelChanging(a)},onModelChanged:function(a){f.onModelChanged(a)},onDestroy:function(a){f.onDestroy(a)},onLineStyle:function(a){f.onLineStyle(a)},onStyleReady:function(a){f.onStyleReady(a)},onServiceAdded:function(a){f.onServiceAdded(a.serviceReference,f.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){f.onServiceRemoved(a.serviceReference,
f.serviceRegistry.getService(a.serviceReference))}};e.addEventListener("ModelChanging",this.listener.onModelChanging);e.addEventListener("ModelChanged",this.listener.onModelChanged);e.addEventListener("Destroy",this.listener.onDestroy);e.addEventListener("LineStyle",this.listener.onLineStyle);c.addEventListener("registered",this.listener.onServiceAdded);c.addEventListener("unregistering",this.listener.onServiceRemoved);e=c.getServiceReferences(d);for(b=0;b<e.length;b++){var a=e[b];h(a)&&this.addServiceListener(c.getService(a))}},
onDestroy:function(d){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null);if(this.services){for(var d=0;d<this.services.length;d++)this.removeServiceListener(this.services[d]);this.services=
null}this.serviceRegistry&&(this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null);this.lineStyles=this.listener=null},onModelChanging:function(d){this.startLine=this.textView.getModel().getLineAtOffset(d.start)},onModelChanged:function(d){var c=this.startLine;(d.addedLineCount||d.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[c,d.removedLineCount].concat(this._getEmptyStyle(d.addedLineCount)))},
onStyleReady:function(d){var c=d.lineStyles||d.style;d=Number.MAX_VALUE;var b=-1,f=this.textView.getModel(),a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(this.lineStyles[a]=c[a],d=Math.min(d,a),b=Math.max(b,a));d=Math.max(d,0);b=Math.min(b,f.getLineCount());if(c=this.annotationModel){for(var g=c.getAnnotations(f.getLineStart(d),f.getLineEnd(b)),h=[];g.hasNext();){var k=g.next();"orion.annotation.highlightError"===k.type&&h.push(k)}g=[];for(k=d;k<=b;k++){a=k;var p=this.lineStyles[a],p=p&&
p.errors;a=f.getLineStart(a);if(p)for(var r=0;r<p.length;r++){var u=p[r];g.push(l.AnnotationType.createAnnotation("orion.annotation.highlightError",u.start+a,u.end+a))}}c.replaceAnnotations(h,g)}this.textView.redrawLines(d,b+1)},onLineStyle:function(d){var c=this.lineStyles[d.lineIndex];if(c)if(c.ranges){for(var c=c.ranges,b=d.lineStart,f=c.length,a=[],g=0;g<f;g++){var h=c[g];a.push({start:h.start+b,end:h.end+b,style:h.style})}d.ranges=a}else c.style&&(d.style=c.style)},_getEmptyStyle:function(d){for(var c=
[],b=0;b<d;b++)c.push(null);return c},setContentType:function(d){this.contentType=d;if(this.services)for(d=0;d<this.services.length;d++){var c=this.services[d];if(c.setContentType){var b=this.serviceRegistry.getService("orion.page.progress");b?b.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}},onServiceAdded:function(d,c){h(d)&&this.addServiceListener(c)},onServiceRemoved:function(d,
c){-1!==this.services.indexOf(c)&&this.removeServiceListener(c)},addServiceListener:function(d){if("function"===typeof d.addEventListener){if(d.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(d),d.setContentType&&this.contentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(f))},removeServiceListener:function(d){"function"===typeof d.removeEventListener?(d.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),d=this.services.indexOf(d),-1!==d&&this.services.splice(d,1)):"undefined"!==typeof console&&console.log(Error(f))}};return g});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(k,l,h,g,d){function f(b,e,a,f,s,t,p){function r(b,c){var f=b.getProperty("contentType")||b.getProperty("contentTypes"),g=b.getProperty("fileTypes");return f?d.when(e.isSomeExtensionOf(a,f)).then(function(a){return a?b:null}):c&&g&&-1!==g.indexOf(c)?(f=new d,f.resolve(b),f):null}function u(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new k.TextStyler(f,"js",s);break;case "text/x-java-source":b=new k.TextStyler(f,"java",s);break;case "text/css":b=new k.TextStyler(f,"css",s)}return b}if(!c){var w=u(a);if(w)return t=new d,t.resolve(w),t}c&&!this.orionGrammars&&(this.orionGrammars={});w=t&&t.split(".").pop().toLowerCase();t=b.getServiceReferences("orion.edit.highlighter");for(var v=[],x=[],y=0;y<t.length;y++){var A=t[y],q=A.getProperty("type");"grammar"===q||!c&&"undefined"===typeof q?v.push(A.getProperty("grammar")):"highlighter"!==
q&&(q=A.getProperty("id"))&&!this.orionGrammars[q]&&(this.orionGrammars[q]={id:q,contentTypes:A.getProperty("contentTypes"),patterns:A.getProperty("patterns"),repository:A.getProperty("repository")});(A=r(A,w))&&x.push(A)}return d.all(x,function(a){return{_error:a}}).then(function(d){for(var e,k=d.length-1;0<=k;k--){var n=d[k];if(n&&!n._error&&(p||"highlighter"!==n.getProperty("type"))){e=n;break}}var r;if(e)if(d=e.getProperty("type"),"highlighter"===d)r=new g(f,b,s),r.setContentType(a);else if("grammar"===
d||!c&&"undefined"===typeof d)e=e.getProperty("grammar"),r=new h.TextMateStyler(f,e,v);else if(c){r=[];for(var q in this.orionGrammars)r.push(this.orionGrammars[q]);r=new l.TextStyler(f,s,r,e.getProperty("id"))}return r})}function e(b,c){this.serviceRegistry=b;this.contentTypeService=c;this.styler=null}var c=1;e.prototype={setup:function(b,c,a,d,e){e="undefined"===typeof e?!0:e;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var g=this;return f(this.serviceRegistry,this.contentTypeService?
this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,c,a,d,e).then(function(a){return g.styler=a})},getStyler:function(){return this.styler}};return{createStyler:f,SyntaxHighlighter:e}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(k,l){function h(g,d,f){this.registry=g;this.inputManager=d;this.editor=f}h.prototype={setOccurrencesVisible:function(g){this.occurrencesVisible!==g&&((this.occurrencesVisible=g)||this.editor.showOccurrences([]))},findOccurrences:function(){function g(b,c,a){function d(a,b,c){a=b.getProperty("contentType");return e.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var e=b.getService("orion.core.contentTypeRegistry"),
f=b.getServiceReferences("orion.edit.occurrences"),g=[],h=0;h<f.length;h++){var k=f[h],w=k.getProperty("pattern");k.getProperty("contentType")?g.push(d(b,k,c)):w&&RegExp(w).test(a)&&(w=new l,w.resolve(k),g.push(w))}return l.all(g,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}var d,f=this,e=f.registry.getService("orion.edit.occurrences"),c=function(b){d&&window.clearTimeout(d);f.occurrencesVisible&&(d=window.setTimeout(function(){d=
null;var b={selection:f.editor.getSelection(),contentType:f.inputManager.getContentType().id};e.computeOccurrences(k.getEditorContext(f.registry),b).then(function(a){f.editor.showOccurrences(a)})},500))};f.inputManager.addEventListener("InputChanged",function(b){var e=f.editor.getTextView();e&&(e.removeEventListener("Selection",c),g(f.registry,b.contentType,b.title).then(function(a){!a||0===a.length?d&&window.clearTimeout(d):e.addEventListener("Selection",c)}))})}};return{MarkOccurrences:h}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(k,l){return{SyntaxChecker:function(){function h(d,f){this.registry=d;this.editor=f}function g(d,f,e){d=Math.max(d,f);return Math.min(d,e)}h.prototype={checkSyntax:function(d,f,e,c){function b(a,b){function c(a,b,e){a=b.getProperty("contentType");return d.isSomeExtensionOf(e,a).then(function(a){return a?b:null})}for(var d=a.getService("orion.core.contentTypeRegistry"),e=a.getServiceReferences("orion.edit.validator"),
g=[],h=0;h<e.length;h++){var l=e[h],n=l.getProperty("pattern");l.getProperty("contentType")?g.push(c(a,l,b)):n&&RegExp(n).test(f)&&(n=new k,n.resolve(l),g.push(n))}return k.all(g,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}if(d&&!e){var g=this,a=this.registry;b(a,d).then(function(b){var e=function(a){return a&&(a.problems||a.errors)||[]},h=a.getService("orion.page.progress");b=b.map(function(b){b=a.getService(b);var g;
b.computeProblems?(g={contentType:d.id,title:f},g=b.computeProblems(l.getEditorContext(a),g)):b.checkSyntax&&(g=b.checkSyntax(f,c));return h.progress(g,"Validating "+f).then(e)});k.all(b,function(a){return{_error:a}}).then(function(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];e._error||(g._fixup(e),c=c.concat(e))}a.getService("orion.core.marker")._setProblems(c)})})}},_fixup:function(d){for(var f=this.editor.getModel(),e=0;e<d.length;e++){var c=d[e];c.description=c.description||c.reason;c.severity=
c.severity||"error";c.start="number"===typeof c.start?c.start:c.character;if("number"===typeof c.line){var b=f.getLine(c.line-1,!1).length;c.start=g(c.start,1,b-1);c.end="number"===typeof c.end?c.end:-1;c.end=g(c.end,c.start+1,b)}else if(b=f.getCharCount(),c.start=g(c.start,0,b),c.end="number"===typeof c.end?c.end:-1,c.end=g(c.end,c.start,b),c.end===b&&1<f.getLineCount()&&b===f.getLineStart(f.getLineCount()-1)){var h=f.getLineCount()-2,b=f.getLineStart(h),h=f.getLineEnd(h);b===h?c.start=c.end=h:(c.start=
h-1,c.end=h)}}}};return h}()}});
define("orion/editorView","i18n!orion/edit/nls/messages orion/editor/editor orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/editorFeatures orion/editor/contentAssist orion/editor/emacs orion/editor/vi orion/editorPreferences orion/widgets/themes/ThemePreferences orion/widgets/themes/editor/ThemeData orion/widgets/settings/EditorSettings orion/searchAndReplace/textSearcher orion/editorCommands orion/globalCommands orion/edit/dispatcher orion/edit/editorContext orion/edit/typedefs orion/highlight orion/markOccurrences orion/syntaxchecker orion/keyBinding orion/uiUtils orion/util orion/objects".split(" "),function(k,
l,h,g,d,f,e,c,b,n,a,m,s,t,p,r,u,w,v,x,y,A,q,B,z,C){function L(a){this._parent=a.parent;this.renderToolbars=a.renderToolbars;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progress;this.statusService=a.statusService;this.fileClient=a.fileService;this.inputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly;this.searcher=a.searcher;this.statusReporter=a.statusReporter;this.model=
a.model;this.undoStack=a.undoStack;this.syntaxHighlighter=new x.SyntaxHighlighter(this.serviceRegistry);this.typeDefRegistry=new v(this.serviceRegistry);(a=r.getKeyAssist())&&a.addProvider(this);var b=r.getMainSplitter();b&&b.splitter.addEventListener("resize",function(a){this.editor&&a.node===b.main&&this.editor.resize()}.bind(this));r.getGlobalEventTarget().addEventListener("toggleTrim",function(a){this.editor&&this.editor.resize()}.bind(this));this.settings={};this._init()}L.prototype={updateKeyMode:function(a,
d){this.emacs&&d.removeKeyMode(this.emacs);this.vi&&d.removeKeyMode(this.vi);"Emacs"===a.keyBindings?(this.emacs||(this.emacs=new c.EmacsMode(d)),d.addKeyMode(this.emacs)):"vi"===a.keyBindings&&(this.vi||(this.vi=new b.VIMode(d,this.statusReporter)),d.addKeyMode(this.vi))},getParent:function(){return this._parent},updateSourceCodeActions:function(a,b){b&&(b.setAutoPairParentheses(a.autoPairParentheses),b.setAutoPairBraces(a.autoPairBraces),b.setAutoPairSquareBrackets(a.autoPairSquareBrackets),b.setAutoPairAngleBrackets(a.autoPairAngleBrackets),
b.setAutoPairQuotations(a.autoPairQuotations),b.setAutoCompleteComments(a.autoCompleteComments),b.setSmartIndentation(a.smartIndentation))},updateViewOptions:function(a){var b=0;a.showMargin&&(b=a.marginOffset,"number"!==typeof b&&(b=a.marginOffset=parseInt(b,10)));var c=0;a.wordWrap&&(c=b);return{readonly:this.readonly||this.inputManager.getReadOnly(),tabSize:a.tabSize||4,expandTab:a.expandTab,wrapMode:a.wordWrap,wrapOffset:c,marginOffset:b,scrollAnimation:a.scrollAnimation?a.scrollAnimationTimeout:
0}},updateSettings:function(a){this.settings=a;var b=this.editor,c=this.inputManager;c.setAutoLoadEnabled(a.autoLoad);c.setAutoSaveTimeout(a.autoSave?a.autoSaveTimeout:-1);c.setSaveDiffsEnabled(a.saveDiffs);this.updateStyler(a);var d=b.getTextView();d&&(this.updateKeyMode(a,d),d.setOptions(this.updateViewOptions(a)));this.updateSourceCodeActions(a,b.getSourceCodeActions());b.setAnnotationRulerVisible(a.annotationRuler);b.setLineNumberRulerVisible(a.lineNumberRuler);b.setFoldingRulerVisible(a.foldingRuler);
b.setOverviewRulerVisible(a.overviewRuler);this.renderToolbars&&this.renderToolbars(c.getFileMetadata());this.markOccurrences.setOccurrencesVisible(a.showOccurrences);b.getContentAssist()&&b.getContentAssist().setAutoTriggerEnabled(a.contentAssistAutoTrigger)},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},showKeyBindings:function(a){var b=this.editor;if(b&&b.getTextView&&b.getTextView()){var c=
b.getTextView(),d=c.getActions(!0).filter(function(a){return(a=c.getActionDescription(a))&&a.name});d.sort(function(a,b){return c.getActionDescription(a).name.localeCompare(c.getActionDescription(b).name)});a.createHeader(k.Editor);for(var e=function(a){return function(){c.focus();return c.invokeAction(a)}},b={},f,g=0;g<d.length;g++)for(var h=d[g],m=c.getActionDescription(h),l=c.getKeyBindings(h),n=0;n<l.length;n++){f=l[n];var p=B.getUserKeyString(f);f.scopeName?(b[f.scopeName]||(b[f.scopeName]=[]),
b[f.scopeName].push({bindingString:p,name:m.name,execute:e(h)})):a.createItem(p,m.name,e(h))}for(var q in b)if(b[q].length){a.createHeader(q);for(d=0;d<b[q].length;d++)f=b[q][d],a.createItem(f.bindingString,f.name,f.execute)}}},_init:function(){var b=null;this.preferences&&(b=this.editorPreferences=new n.EditorPreferences(this.preferences,function(a){a?this.updateSettings(a):b.getPrefs(this.updateSettings.bind(this))}.bind(this)));var c=null;this.preferences&&(c=new a.ThemePreferences(this.preferences,
new m.ThemeData),c.apply());var r,v=this,x=this._parent,B=this.readonly,L=this.commandRegistry,K=this.serviceRegistry,J=this.fileClient,M=this.inputManager,U=this.searcher,V=this.progress,T=this.contentTypeRegistry,P=function(a,b,c){var d=M.getContentType(),e=a.getTitle();a=K.getServiceReferences("orion.edit.contentAssist").concat(K.getServiceReferences("orion.edit.contentassist"));(c=c&&c.providerInfoArray)||(c=a.map(function(a){var b=a.getProperty("contentType"),c=a.getProperty("pattern");if(b&&
T.isSomeExtensionOf(d,b)||c&&RegExp(c).test(e)){var b=K.getService(a),c=a.getProperty("service.id").toString(),f=a.getProperty("charTriggers");a=a.getProperty("excludedStyles");f&&(f=RegExp(f));a&&(a=RegExp(a));return{provider:b,id:c,charTriggers:f,excludedStyles:a}}return null}).filter(function(a){return!!a}));var f={};Object.keys(w).forEach(function(a){"function"===typeof w[a]&&(f[a]=w[a].bind(null,K))});b.setEditorContextProvider(f);b.setProviderInfoArray(c);b.setAutoTriggerEnabled(v.settings.contentAssistAutoTrigger);
b.setProgress(V);b.setStyleAccessor(v.getStyleAccessor())},Y=B?null:{createContentAssistMode:function(a){var b=new e.ContentAssist(a.getTextView());b.addEventListener("Activating",P.bind(null,a,b));var c=new e.ContentAssistWidget(b,"contentassist"),c=new e.ContentAssistMode(b,c);b.setMode(c);P(a,b);b.computeProposals();return c}},F=this.editor=new l.Editor({textViewFactory:function(){var a=v.updateViewOptions(v.settings);C.mixin(a,{parent:x,model:new d.ProjectionTextModel(v.model||new g.TextModel),
wrappable:!0});return new h.TextView(a)},undoStackFactory:v.undoStack?{createUndoStack:function(a){v.undoStack.setView(a.getTextView());return v.undoStack}}:new f.UndoFactory,textDNDFactory:new f.TextDNDFactory,annotationFactory:new f.AnnotationFactory,foldingRulerFactory:new f.FoldingRulerFactory,lineNumberRulerFactory:new f.LineNumberRulerFactory,contentAssistFactory:Y,keyBindingFactory:function(a,c,d,e){c=new t.TextSearcher(a,K,L,d);d=(new f.KeyBindingsFactory).createKeyBindings(a,d,e,c);v.updateSourceCodeActions(v.settings,
d.sourceCodeActions);(new p.EditorCommandFactory({serviceRegistry:K,commandRegistry:L,fileClient:J,inputManager:M,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",readonly:B,navToolbarId:"pageNavigationActions",textSearcher:c,searcher:U,editorSettings:function(){return v.settings},localSettings:r})).generateEditorCommands(a);var g=a.getTextView();if(a=L.findCommand("orion.keyAssist"))g.setKeyBinding(new q.KeyStroke(191,!1,!0,!z.isMac,z.isMac),a.id),g.setAction(a.id,
a.callback,a);g.setAction("toggleWrapMode",function(){g.invokeAction("toggleWrapMode",!0);var a=g.getOptions("wrapMode");v.settings.wordWrap=a;b&&b.setPrefs(v.settings);return!0});v.vi=v.emacs=null;v.updateKeyMode(v.settings,g);return d},statusReporter:this.statusReporter,domNode:x});F.id="orion.editor";F.processParameters=function(a){for(var b=["start","end","line","offset","length"],c=0;c<b.length;c++){var d=b[c];a[d]&&(a[d]=parseInt(a[d],10))}this.showSelection(a.start,a.end,a.line,a.offset,a.length)};
this.dispatcher=new u.Dispatcher(this.serviceRegistry,F,M);c&&b&&(r=new s({local:!0,editor:F,themePreferences:c,preferences:b}));M.addEventListener("InputChanged",function(a){var b=F.getTextView();b&&(b.setOptions(this.updateViewOptions(this.settings)),this.syntaxHighlighter.setup(a.contentType,F.getTextView(),F.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings);F.getContentAssist()&&P(F,F.getContentAssist())}.bind(this)))}.bind(this));M.addEventListener("Saving",function(a){v.settings.trimTrailingWhiteSpace&&
F.getTextView().invokeAction("trimTrailingWhitespaces")});(c=K.getService("orion.core.marker"))&&c.addEventListener("problemsChanged",function(a){F.showProblems(a.problems)});(c=K.getService("orion.core.blame"))&&c.addEventListener("blameChanged",function(a){F.showBlame(a.blameInfo)});c=this.markOccurrences=new y.MarkOccurrences(K,M,F);c.setOccurrencesVisible(this.settings.occurrencesVisible);c.findOccurrences();var N=new A.SyntaxChecker(K,F);F.addEventListener("InputChanged",function(a){N.checkSyntax(M.getContentType(),
a.title,a.message,a.contents);M.getReadOnly()&&F.reportStatus(k.readonly,"error")});var O={};"getCaretOffset setCaretOffset getSelection setSelection getText setText getLineAtOffset getLineStart".split(" ").forEach(function(a){O[a]=F[a].bind(F)});K.registerService("orion.edit.context",O,null);this.editorPreferences&&this.editorPreferences.getPrefs(this.updateSettings.bind(this))},create:function(){this.editor.install()},destroy:function(){this.editor.uninstall()},getStyleAccessor:function(){var a=
null,b=this.syntaxHighlighter.getStyler();b&&b.getStyleAccessor&&(a=b.getStyleAccessor());return a}};return{EditorView:L}});
define("orion/inputManager","i18n!orion/edit/nls/messages orion/explorers/navigatorRenderer orion/i18nUtil orion/Deferred orion/EventTarget orion/objects orion/PageUtil".split(" "),function(k,l,h,g,d,f,e){function c(a){this._document=a.document||document;this._timeout=a.timeout;a="keypress keydown keyup mousemove mousedown mousemove".split(" ");for(var b=function(a){this._resetTimer()}.bind(this),c=0;c<a.length;c++)this._document.addEventListener(a[c],b,!0);d.attach(this)}function b(a,b){if(a){if(!b.Severity){var c=
b,d={Severity:"Error",Message:k.noResponse};if(0!==c.status)if(c.responseText){c=c.responseText;try{var e=JSON.parse(c);d.Severity=e.Severity||d.Severity;d.Message=e.Message||d.Message}catch(f){d.Message=c}}else try{d.Message=JSON.stringify(c)}catch(g){}b=d}a.setProgressResult(b)}else window.console.log(b)}function n(a){d.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;this.progressService=a.progressService;this.contentTypeRegistry=
a.contentTypeRegistry;this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}c.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;this._timer&&(a.clearTimeout(this._timer),this._timer=null);-1!==this._timeout&&(this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout))},onIdle:function(a){return this.dispatchEvent(a)},setTimeout:function(a){this._timeout=
a;this._resetTimer()}};f.mixin(n.prototype,{_maybeLoadWorkspace:function(a){var b=this.fileClient;return a===b.fileServiceRootURL(a)?b.loadWorkspace(a).then(function(a){return a.Location}):(new g).resolve(a)},_read:function(a){var b=this.cachedMetadata||l.getClickedItem();if(b&&b.Location===a&&b.Parents&&b.Attributes&&b.ETag)return(new g).resolve(b);var c=this.fileClient,d=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return c.read.apply(c,[a].concat(d))})},
load:function(){var a=this.getInput();if(a){var c=this.fileClient,d=this._parsedLocation.resource,e=this.progressService,f=function(a,b,c){return!e?a:e.progress(a,h.formatMessage(b,c))},l=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&f(c.read(d,!0),k.ReadingMetadata,a).then(function(b){this._fileMetadata&&this._fileMetadata.Location===b.Location&&this._fileMetadata.ETag!==b.ETag&&(this._fileMetadata=b,(!l.isDirty()||window.confirm(k.loadOutOfSync))&&
f(c.read(d),k.Reading,a).then(function(b){l.setInput(a,null,b);this._unsavedChanges=[]}.bind(this)))}.bind(this));else{var n=d;if(0===n.indexOf("/gitapi/commit/")){var w=n.indexOf("/file"),v=n.indexOf("?",w);-1===v&&(v=n.length);n=n.substring(w,v);this._readonly=!0}var x=window.setTimeout(function(){x=null;this.reportStatus(h.formatMessage(k.Fetching,a))}.bind(this),800),y=function(){this.reportStatus("");x&&window.clearTimeout(x)}.bind(this),A=function(a){y();var c=null;this.serviceRegistry?c=this.serviceRegistry.getService("orion.page.message"):
this.statusService&&(c=this.statusService);b(c,a);this._setNoInput()}.bind(this);this._acceptPatch=null;f(this._read(n,!0),k.ReadingMetadata,n).then(function(b){b?b.Directory?g.when(b.Children||f(c.fetchChildren(b.ChildrenLocation),k.Reading,a),function(c){y();b.Children=c;this._setInputContents(this._parsedLocation,a,c,b)}.bind(this),A):this._isText(b)?f(c.read(d,!1,!0),k.Reading,a).then(function(c){y();"string"!==typeof c&&(this._acceptPatch=c.acceptPatch,c=c.result);this._setInputContents(this._parsedLocation,
a,c,b)}.bind(this),A):f(c._getService(d).readBlob(d),k.Reading,a).then(function(c){y();this._setInputContents(this._parsedLocation,a,c,b)}.bind(this),A):A({responseText:h.formatMessage(k.ReadingMetadataError,n)})}.bind(this),A)}}},processParameters:function(a){var b=this.getEditor();b&&b.processParameters&&b.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(a){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,c=a.removedCharCount,d=a.start,e=a.start+c,f=
0;0===a.addedCharCount?f=-1:0===c&&(f=1);if(0<b&&f===this.previousChangeType){b=this._unsavedChanges[b-1];if(0===c&&d===b.end+b.text.length){b.text+=a.text;return}if(0===a.addedCharCount&&e===b.start){b.start=d;return}}this.previousChangeType=f;this._unsavedChanges.push({start:d,end:e,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function a(a){f===B.getInput()&&(B.getFileMetadata().ETag=a.ETag,d.setInput(f,
null,g,!0));B.reportStatus("");e&&q&&q.setProgressResult({Message:k.Saved,Severity:"Normal"});B.afterSave&&B.afterSave();B._saving=!1}function c(a){B.reportStatus("");b(q,a);B._saving=!1;B._errorSaving=!0}if(!this._saving){var d=this.getEditor();if(d&&d.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(k["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});d.markClean();var g=d.getText(),l=g;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var n=this._unsavedChanges,v=0,x=0;x<n.length;x++)v+=n[x].text.length;g.length>v&&(l={diff:n})}this._unsavedChanges=[];this._errorSaving=!1;var n={ETag:this.getFileMetadata().ETag},y=this._parsedLocation.resource,l=this.fileClient.write(y,l,n),A=this.progressService,q=null;this.serviceRegistry&&(q=this.serviceRegistry.getService("orion.page.message"));A&&(l=A.progress(l,h.formatMessage(k.savingFile,f)));var B=this;l.then(a,function(b){412===b.status?window.confirm(k.saveOutOfSync)?
(b=B.fileClient.write(y,g),A&&(b=A.progress(b,h.formatMessage(k.savingFile,f))),b.then(a,c)):B._saving=!1:c(b)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=-1!==a;this._idle?this._idle.setTimeout(a):(this._idle=new c({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=e.hash()),"string"===typeof a)){var b=this.getEditor();a&&"#"!==a[0]&&(a="#"+a);var c=e.matchResourceParameters(a),d=this._parsedLocation||{};if(b&&b.isDirty()){var f=this._location;if(d.resource!==c.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(k.confirmUnsavedChanges)){window.location.hash=f;return}}b=b&&d.editor!==c.editor;this._location=a;this._parsedLocation=c;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=c.resource)?
a===this._input?b?(this.reportStatus(""),this._setInputContents(c,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(c):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var b=a.lastIndexOf("/");-1!==b&&(a=a.substring(b+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&null!==this._acceptPatch&&-1!==this._acceptPatch.indexOf("application/json-patch")},
_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return!0;var b=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,b)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(a,
b,c,d,e){var f,g=!1;d?(this._fileMetadata=d,this.setTitle(d.Location||String(d)),this.setContentType(this.contentTypeRegistry.getFileContentType(d)),f=d.Name,g=d.Directory):(this._fileMetadata=null,this.setTitle(b),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),f=this.getTitle());var h=this.getEditor();this._focusListener&&(h&&h.getTextView&&h.getTextView()&&h.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=null);this._changingListener&&
(h&&h.getModel&&h.getModel()&&h.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null);d={type:"InputChanged",input:a,name:f,title:b,contentType:this.getContentType(),metadata:d,location:window.location,contents:c};this.dispatchEvent(d);this.editor=h=d.editor;g||(h&&h.getModel&&h.getModel()&&h.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this)),e||h.setInput(b,null,c),h&&h.getTextView&&h.getTextView()&&h.getTextView().addEventListener("Focus",
this._focusListener=this.onFocus.bind(this)),this._unsavedChanges=[],this.processParameters(a))}});return{handleError:b,InputManager:n}});
define("orion/cfui/logView","orion/editor/editor orion/editor/textModel orion/editorView orion/inputManager orion/objects orion/webui/littlelib orion/PageUtil orion/Deferred orion/globalCommands orion/URL-shim".split(" "),function(k,l,h,g,d,f,e,c,b){function n(a){g.InputManager.apply(this,[a]);this.cFClient=a.cFClient;this.commandRegistry=a.commandRegistry}function a(a){this.options=a;this._parent=a.parent;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=
a.commandRegistry;this.progress=a.progressService;this.undoStack=a.undoStack;this._createInputManager()}n.prototype=new g.InputManager({});d.mixin(n.prototype,{_read:function(a,d){var e=new c,f=this.applicationInfo.instance||Object.keys(this.applicationInfo.logs)[0];this.cFClient.getLogs(this.applicationInfo.Target,this.applicationInfo.Application,a,this.applicationInfo.instance).then(function(a){a=a[f];a.Instance=f;e.resolve(a);b.setPageTarget({task:"Cloud Foundry Logs",target:a,breadcrumbTarget:a,
serviceRegistry:this.serviceRegistry,commandService:this.commandRegistry})}.bind(this));return e},setApplicationInfo:function(a){this.applicationInfo=a},getApplicationInfo:function(){return this.applicationInfo},load:function(){var a=this.getInput();if(a){var b=null,c=function(){this.reportStatus("");b&&window.clearTimeout(b)}.bind(this),d=function(a){c();var b=this.serviceRegistry.getService("orion.page.message");if(b){if(0===a.status)a={Severity:"Error",Message:"No response"};else{var d=a.responseText;
if(d)try{a=JSON.parse(d)}catch(e){a={Severity:"Error",Message:d}}}b.setProgressResult(a)}else window.console.log(a);this._setNoInput()}.bind(this);this._acceptPatch=null;if(!this.lastLogLoaded||this.lastLogLoaded!==a||null!==this.applicationInfo.instance&&this.lastLogInstance!==this.applicationInfo.instance)this.progressService.showWhile(this._read(a,!0),"Loading "+a).then(function(b){this.lastLogLoaded=a;this.lastLogInstance=b.Instance;this._setInputContents(this._parsedLocation,a,b.Contents,b)}.bind(this),
d);else{var b=window.setTimeout(function(){b=null;this.reportStatus("Fetching "+a)}.bind(this),800),e=!1,f=this.applicationInfo.instance||Object.keys(this.applicationInfo.logs)[0];this.cFClient.getLogs(this.applicationInfo.Target,this.applicationInfo.Application).then(function(b){this.applicationInfo.logs[f].forEach(function(g){g.Name===a&&b[f].forEach(function(b){b.Name===a&&(g.Size!==b.Size&&(e=!0,this._read(a,!0).then(function(b){this._setInputContents(this._parsedLocation,a,b.Contents,b);this.lastLogLoaded=
a}.bind(this),d)),c())}.bind(this))}.bind(this));e||c();this.applicationInfo.logs=b}.bind(this),d)}}else this.lastLogInstance=this.lastLogLoaded=null},constructor:n});a.prototype={_createInputManager:function(){this.inputManager=new n(this.options);var a={parent:this._parent,model:new l.TextModel,undoStack:this.options.undoStack,serviceRegistry:this.options.serviceRegistry,pluginRegistry:this.options.pluginRegistry,commandRegistry:this.options.commandRegistry,contentTypeRegistry:this.options.contentTypeRegistry,
inputManager:this.inputManager,readonly:!0,preferences:this.options.preferences,searcher:this.options.searcher,selection:this.options.selection,fileService:this.options.fileClient,fileClient:this.options.fileClient,statusReporter:this.options.statusReporter,statusService:this.options.statusService,progressService:this.options.progressService};this.editorView=new h.EditorView(a)},create:function(){this.editorCreated||(this.editorView.create(),this.editorCreated=!0,this.inputListener=function(a){a.editor=
this.editorView.editor}.bind(this),this.inputManager.addEventListener("InputChanged",this.inputListener),this.inputManager.lastLogLoaded=null,this.inputManager.lastLogInstance=null)},destroy:function(){this.editorCreated&&(this.editorView.destroy(),this.inputListener&&this.inputManager.removeEventListener("InputChanged",this.inputListener));this.editorCreated=!1}};return{LogEditorView:a}});
define("orion/cfui/widgets/CfLoginDialog",["orion/webui/dialog"],function(k){function l(h){this._init(h)}l.prototype=new k.Dialog;l.prototype.TEMPLATE='\x3cdiv style\x3d"padding: 5px;" id\x3d"userIdRow"\x3e\x3cdiv style\x3d"float: left; width: 150px;"\x3e\x3clabel id\x3d"userIdLabel" for\x3d"userId"\x3e\x3c/label\x3e\x3c/div\x3e\x3cinput id\x3d"userId" style\x3d"width: 200px;" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 5px;" id\x3d"passwordRow"\x3e\x3cdiv style\x3d"float: left; width: 150px;"\x3e\x3clabel id\x3d"passwordLabel" for\x3d"password"\x3e\x3c/label\x3e\x3c/div\x3e\x3cinput type\x3d"password" id\x3d"password" style\x3d"width: 200px;" value\x3d""\x3e\x3c/div\x3e';
l.prototype._init=function(h){this.options=h||{};this.title=this.options.title||"Cloud Foundry Login";this.modal=!0;this.buttons=[{text:"OK",isDefault:!0,callback:this.done.bind(this)}];this._func=h.func;this._initialize()};l.prototype._bindToDom=function(){this.$userIdLabel.appendChild(document.createTextNode("User Id:"));this.$passwordLabel.appendChild(document.createTextNode("Password:"))};l.prototype.done=function(){this.options.func(this.$userId.value,this.$password.value);this.hide()};return l.prototype.constructor=
l});
define("built-logs.js","orion/webui/littlelib orion/bootstrap orion/status orion/progress orion/commandRegistry orion/keyBinding orion/dialogs orion/selection orion/contentTypes orion/fileClient orion/operationsClient orion/searchClient orion/globalCommands orion/links orion/cfui/cFClient orion/PageUtil orion/cfui/logsExplorer orion/cfui/logView orion/section orion/cfui/widgets/CfLoginDialog".split(" "),function(k,l,h,g,d,f,e,c,b,n,a,m,s,t,p,r,u,w,v,x){l.startup().then(function(f){function l(a){s.setPageTarget({task:a.Application?"Cloud Foundry Logs":
a.Application+" - Cloud Foundry Logs",target:a,breadcrumbTarget:a,serviceRegistry:z,commandService:G});M.classList.remove("toolbarTarget");k.empty(M);(new v.Section(M,{id:"logsNavSection",title:"Log Files",canHide:!1})).embedExplorer(T);T.setCommandsVisible(!1);T.load(a)}function q(a){if(I){if(0===a.status)a={Severity:"Error",Message:"No response"};else{var b=a.responseText;if(b)try{a=JSON.parse(b)}catch(c){a={Severity:"Error",Message:b}}}I.setProgressResult(a)}else window.console.log(a)}function B(a){var b;
if(a.Url||a.Org||a.Space)b={Url:a.Url,Org:a.Org,Space:a.Space},a.target=b;a.log&&P.create();a.log||P.destroy();this.lastLogsInfo.Application!==a.resource?D.showWhile(Q.getLogs(b,a.resource),"Getting logs").then(function(c){this.lastLogsInfo=c={Target:b,Application:a.resource,instance:a.instance,logs:c};P.inputManager.setApplicationInfo(c);V.load(c);a.log?(M.classList.add("toolbarTarget"),P.inputManager.setInput(a.log)):l(c)},function(c){c.JsonData&&c.JsonData.error_code&&"CF-InvalidAuthToken"===c.JsonData.error_code?
(new x({title:"Login to "+b.Url,func:function(c,d){D.showWhile(Q.login(b.Url,c,d,b.Org,b.Space),"Logging in to "+b.Url).then(function(){B(a)},q)}})).show():404===c.HttpCode&&"Target not set"===c.Message?C.getPreferences("/settingsCF").then(function(b){a.Url=b.get("targetUrl");B(a)}):q(c)}):(this.lastLogsInfo.instance!==a.instance&&(this.lastLogsInfo.instance=a.instance,P.inputManager.setApplicationInfo(this.lastLogsInfo),a.log&&P.inputManager.getInput()===a.log&&P.inputManager.load()),a.log?(M.classList.add("toolbarTarget"),
P.inputManager.setInput(a.log)):l(P.inputManager.getApplicationInfo()))}var z=f.serviceRegistry,C=f.preferences;f=f.pluginRegistry;new e.DialogService(z);var L=new c.Selection(z),G=new d.CommandRegistry({selection:L}),E=new a.OperationsClient(z),I=new h.StatusReportingService(z,E,"statusPane","notifications","notificationArea"),D=new g.ProgressService(z,E,G);new t.TextLinkService({serviceRegistry:z});var E=new n.FileClient(z),H=new m.Searcher({serviceRegistry:z,commandService:G,fileService:E}),Q=
new p.CFService(z),S=new b.ContentTypeRegistry(z),K=k.node("sidebar"),J=k.node("sidebarToolbar"),M=k.node("log"),U=document.createElement("div"),V=new u.LogsExplorer(z,L,G,K,J,!0),T=new u.LogsExplorer(z,L,G,U),P=new w.LogEditorView({parent:M,undoStack:null,serviceRegistry:z,pluginRegistry:f,commandRegistry:G,contentTypeRegistry:S,preferences:C,searcher:H,selection:L,fileService:E,statusReporter:function(a,b,c){"progress"===b?I.setProgressMessage(a):"error"===b?I.setErrorMessage(a):I.setMessage(a,
null,c)},statusService:I,progressService:D,cFClient:Q});s.generateBanner("cf-logs",z,G,C,H,{});this.lastLogsInfo={};B(r.matchResourceParameters());window.addEventListener("hashchange",function(){B(r.matchResourceParameters())}.bind(this))})});
//@ sourceMappingURL=built-logs.js.map