(function(){function k(b,d,a,e,f,l){d[b]&&(a.push(b),(!0===d[b]||1===d[b])&&e.push(f+b+"/"+l))}function m(b,d,a,e,f){d=e+d+"/"+f;require._fileExists(b.toUrl(d+".js"))&&a.push(d)}function h(b,d,a){for(var e in d)d.hasOwnProperty(e)&&(!b.hasOwnProperty(e)||a)?b[e]=d[e]:"object"===typeof d[e]&&h(b[e],d[e],a)}var d=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(b){var g=b.config?b.config():{},g=g||{};return{version:"2.0.1+",load:function(a,e,f,b){b=b||{};b.locale&&(g.locale=
b.locale);var c=d.exec(a),n=c[1],q=c[4],s=c[5],u=q.split("-"),r=[],t={},v,w="";c[5]?(n=c[1],a=n+s):(s=c[4],q=g.locale,q||(q=g.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),u=q.split("-"));if(b.isBuild){r.push(a);m(e,"root",r,n,s);for(v=0;v<u.length;v++)b=u[v],w+=(w?"-":"")+b,m(e,w,r,n,s);e(r,function(){f()})}else e([a],function(c){var a=[],b;k("root",c,a,r,n,s);for(v=0;v<u.length;v++)b=u[v],w+=(w?"-":"")+b,k(w,c,a,r,n,s);e(r,function(){var p,
b,l;for(p=a.length-1;-1<p&&a[p];p--){l=a[p];b=c[l];if(!0===b||1===b)b=e(n+l+"/"+s);h(t,b)}f(t)})})}}})})();
define("orion/i18n",[],function(){return{load:function(k,m,h,d){d=d||{};var b=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,g=b.exec(k);if(g){if(!m.defined||m.defined(k))try{h(m(k));return}catch(a){}if(d.isBuild||d.isTest)h({});else if(m.specified&&!m.specified("orion/bootstrap"))h({});else{var e=g[1],f=g[3]?g[2]:"",l=g[3]||g[2];m(["orion/bootstrap"],function(c){c.startup().then(function(c){var a=c.serviceRegistry;c=a.getServiceReferences("orion.i18n.message");if(f)c.some(function(c){return k===c.getProperty("name")?
(a.getService(c).getMessageBundle().then(function(c){h(c)},function(){h({})}),!0):!1})||h({});else{var s={},u;c.forEach(function(c){var a=c.getProperty("name");if((g=b.exec(a))&&e===g[1]&&l===(g[3]||g[2]))if(f=g[3]?g[2]:""){if((c=d.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===c.toLowerCase().indexOf(f.toLowerCase()))s[f]=!0,(!m.specified||!m.specified(a))&&define(a,["orion/i18n!"+a],function(c){return c})}else u=c});!m.specified||!m.specified(k)?u?
a.getService(u).getMessageBundle().then(function(c){Object.keys(s).forEach(function(a){"undefined"===typeof c[a]&&(c[a]=s[a])});define(k,[],c);h(c)},function(){define(k,[],s);h(s)}):(define(k,[],s),h(s)):h(s)}})})}}else h(null)}}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
(function(){function k(){for(var b=navigator.userAgent,d={browser:!1,version:!1},a=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Microsoft Internet Explorer",regExp:/Trident\/(\d+)/i,minVersion:6},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:6}],e=0;e<a.length;e++){var f=a[e],l=b.match(f.regExp);if(l){d.browser=
!0;d.version=l[1]>=f.minVersion;d.name=f.name;break}}return d}function m(){try{return"localStorage"in window&&null!==window.localStorage}catch(b){return!1}}function h(b){alert(b);throw Error("unsupported browser");}var d=k();if(d.browser)d.version||h("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+d.name+".\n");else if(m()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=
1;else throw"unsupported browser";else m()||h("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:k,supportsLocalStorage:m,throwBrowserAlert:h}})();define("orion/browserCompatibility",function(){});
(function(k,m){"function"===typeof define&&define.amd?define("orion/Deferred",m):"object"===typeof exports?module.exports=m():(k.orion=k.orion||{},k.orion.Deferred=m())})(this,function(){function k(){for(var a;a=b.shift();)a();g=!1}function m(e){b.push(e);g||(g=!0,a())}function h(a){return function(f){a(f)}}function d(){function a(){for(var c;c=s.shift();){var f=c.deferred,e="fulfilled"===q?"resolve":"reject";c=c[e];if("function"===typeof c)try{var b=c(n),l=b&&("object"===typeof b||"function"===typeof b)&&
b.then;if("function"===typeof l)if(b===f.promise)f.reject(new TypeError);else{var d=b.cancel;"function"===typeof d?f._parentCancel=d.bind(b):delete f._parentCancel;l.call(b,h(f.resolve),h(f.reject),h(f.progress))}else f.resolve(b)}catch(g){f.reject(g)}else f[e](n)}}function f(c){delete g._parentCancel;q="rejected";n=c;s.length&&m(a)}function b(c){function t(c){return function(a){(!q||"assumed"===q)&&c(a)}}delete g._parentCancel;try{var h=c&&("object"===typeof c||"function"===typeof c)&&c.then;if("function"===
typeof h)if(c===g)f(new TypeError);else{q="assumed";var k=c&&c.cancel;if("function"!==typeof k){var A=new d;c=A.promise;try{h(A.resolve,A.reject,A.progress)}catch(x){A.reject(x)}k=c.cancel;h=c.then}n=c;h.call(c,t(b),t(f));g._parentCancel=k.bind(c)}else q="fulfilled",n=c,s.length&&m(a)}catch(z){t(f)(z)}}function c(){var c=g._parentCancel;c?(delete g._parentCancel,c()):q||(c=Error("Cancel"),c.name="Cancel",f(c))}var n,q,s=[],g=this;this.resolve=function(c){q||b(c);return g};this.reject=function(c){q||
f(c);return g};this.progress=function(c){q||s.forEach(function(a){if(a.progress)try{a.progress(c)}catch(f){}});return g.promise};this.cancel=function(){g._parentCancel?setTimeout(c,0):c();return g};this.then=function(c,f,b){var l=new d;l._parentCancel=g.promise.cancel;s.push({resolve:c,reject:f,progress:b,deferred:l});("fulfilled"===q||"rejected"===q)&&m(a);return l.promise};this.promise={then:g.then,cancel:g.cancel}}var b=[],g=!1,a=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var a=
process.nextTick;return function(){a(k)}}if("function"===typeof MutationObserver){var f=document.createElement("div");(new MutationObserver(k)).observe(f,{attributes:!0});return function(){f.setAttribute("class","_tick")}}return function(){setTimeout(k,0)}}();d.all=function(a,f){function b(c,a){g||(q[c]=a,0===--n&&u.resolve(q))}function c(c,a){if(!g){if(f)try{b(c,f(a));return}catch(e){a=e}u.reject(a)}}var n=a.length,q=[],g=!1,u=new d;u.then(void 0,function(){g=!0;a.forEach(function(c){c.cancel&&c.cancel()})});
0===n?u.resolve(q):a.forEach(function(a,f){a.then(b.bind(void 0,f),c.bind(void 0,f))});return u.promise};d.when=function(a,f,b,c){var n;a&&"function"===typeof a.then||(n=new d,n.resolve(a),a=n.promise);return a.then(f,b,c)};return d});
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(d){try{"function"===typeof d?d(k):d.handleEvent(k)}catch(b){"undefined"!==typeof console&&console.log(b)}});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 d=this._namedListeners[k];if(d)for(var b=0;b<d.length;b++)if(d[b]===h){1===d.length?delete this._namedListeners[k]:d.splice(b,1);break}}};k.prototype.constructor=k;k.attach=function(m){var h=new k;m.dispatchEvent=h.dispatchEvent.bind(h);m.addEventListener=h.addEventListener.bind(h);m.removeEventListener=h.removeEventListener.bind(h)};return k});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(k,m){function h(a,f,b){this._properties=b||{};this._properties["service.id"]=a;this._properties.objectClass=f;this._properties["service.names"]=f}function d(a,f,b){this._serviceId=a;this._serviceReference=f;this._internalRegistry=b}function b(a,b){function l(c){return function(){var l;try{if(!b())throw Error("Service was unregistered");var d=a[c].apply(a,Array.prototype.slice.call(arguments));if(d&&"function"===typeof d.then)return d;
l=new k;l.resolve(d)}catch(g){l=new k,l.reject(g)}return l.promise}}for(var c in a)"function"===typeof a[c]&&(this[c]=l(c))}function g(a,b){this.type=a;this.serviceReference=b}function a(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new m;var a=this;this._internalRegistry={isRegistered:function(b){return a._entries[b]?!0:!1},unregisterService:function(b){var l=a._entries[b];if(!l)throw Error("Service has already been unregistered: "+b);var c=l.reference;a._serviceEventTarget.dispatchEvent(new g("unregistering",
c));a._entries[b]=null;c.getProperty("objectClass").forEach(function(b){for(var f=a._namedReferences[b],l=0;l<f.length;l++)if(f[l]===c){1===f.length?delete a._namedReferences[b]:f.splice(l,1);break}})},modifyService:function(b){var l=a._entries[b];if(!l)throw Error("Service not found while trying to send modified event: "+b);a._serviceEventTarget.dispatchEvent(new g("modified",l.reference))}}}h.prototype={getPropertyKeys:function(){var a=[],b;for(b in this._properties)this._properties.hasOwnProperty(b)&&
a.push(b);return a},getProperty:function(a){return this._properties[a]}};h.prototype.constructor=h;d.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(a){var b=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;
a.objectClass=b.objectClass;a["service.names"]=b["service.names"];this._internalRegistry.modifyService(this._serviceId)}};d.prototype.constructor=d;a.prototype={getService:function(a){var b;if("string"===typeof a)(a=this._namedReferences[a])&&a.some(function(a){b=this._entries[a.getProperty("service.id")].service;return!!b},this);else if(a=this._entries[a.getProperty("service.id")])b=a.service;return b||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:
[];var b=[];this._entries.forEach(function(a){a&&b.push(a.reference)});return b},registerService:function(a,f,l){if("undefined"===typeof f||null===f)throw Error("invalid service");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var c=this._entries.length,n=new h(c,a,l),q=this._namedReferences;a.forEach(function(c){q[c]=q[c]||[];q[c].push(n)});a=new b(f,this._internalRegistry.isRegistered.bind(null,c));this._entries.push({reference:n,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",
n));return new d(c,n,a)},addEventListener:function(a,b){this._serviceEventTarget.addEventListener(a,b)},removeEventListener:function(a,b){this._serviceEventTarget.removeEventListener(a,b)}};a.prototype.constructor=a;return{ServiceRegistry:a}});
define("orion/xhr",["orion/Deferred"],function(k){function m(h,d,b,g){var a="undefined"!==typeof b.response?b.response:b.responseText,e;try{e=b.status}catch(f){e=0}h={args:d,response:a,responseText:"string"===typeof a?a:null,status:e,url:h,xhr:b};"undefined"!==typeof g&&(h.error=g);return h}return function(h,d,b){b=b||{};var g=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,a=new k,e=b.headers||{},f=b.log||!1,l;"undefined"===typeof e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof b.data&&("POST"===h||"PUT"===h))l=b.data;var c=!1,n=!1;a.promise.then(void 0,function(a){c=!0;!n&&a instanceof Error&&"Cancel"===a.name&&g.abort()});g.onabort=function(){n=!0;if(!c){var b=Error("Cancel");b.name="Cancel";a.reject(b)}};g.onload=function(){var c=m(d,b,g);200<=g.status&&400>g.status?a.resolve(c):(a.reject(c),f&&"undefined"!==typeof console&&console.log(Error(g.statusText)))};g.onerror=function(){var c=m(d,b,g);a.reject(c);f&&"undefined"!==typeof console&&console.log(Error(g.statusText))};
g.onprogress=function(c){c.xhr=g;a.progress(c)};try{g.open(h,d,!0);"string"===typeof b.responseType&&(g.responseType=b.responseType);if("number"===typeof b.timeout)if("number"===typeof g.timeout)g.timeout=b.timeout,g.addEventListener("timeout",function(c){a.reject(m(d,b,g,"Timeout exceeded"))});else{var q=setTimeout(function(){a.reject(m(d,b,g,"Timeout exceeded"))},b.timeout);a.promise.then(clearTimeout.bind(null,q),clearTimeout.bind(null,q))}Object.keys(e).forEach(function(c){g.setRequestHeader(c,
e[c])});g.send(l||null)}catch(s){a.reject(m(d,b,g,s))}return a.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(k,m,h){function d(a,c){this._name=a;this._providers=c;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function b(a,c){return{get:function(b,f){if(0===c)return null;var e=localStorage.getItem(a+b);if(null===e)return null;e=JSON.parse(e);return f||-1===c||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(b,f){if(0!==c)if(-1!==c&&(f._expires=(new Date).getTime()+
1E3*c),0===Object.keys(f).length)localStorage.removeItem(a+b);else{var e=JSON.stringify(f);localStorage.setItem(a+b,e);delete f._expires}},remove:function(c){localStorage.removeItem(a+c)}}}function g(a){this._currentPromises={};this._cache=new b("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var c=a.getServiceReferences("orion.core.preference.provider");0<c.length&&(this._service=a.getService(c[0]))}return!!this._service}}function a(a){this._location=
a;this._currentPromise=null;this._cache=new b("/orion/preferences/default",3600)}function e(){this._cache=new b("/orion/preferences/local",-1)}function f(b,c){this._userProvider=new g(b);this._localProvider=new e;c=c||"defaults.pref";-1===c.indexOf("://")&&(c=k.toUrl(c));this._defaultsProvider=new a(c);this._serviceRegistration=b.registerService("orion.core.preference",this)}d.prototype={_flush:function(){for(var a=[],c=0;c<this._stores.length;++c){var b=this._stores[c];-1!==this._dirty.indexOf(b)&&
a.push(this._providers[c].put(this._name,b));if(this._pendingDeletes[c]&&0<this._pendingDeletes[c].length){for(b=0;b<this._pendingDeletes[c].length;b++)a.push(this._providers[c].remove(this._name,this._pendingDeletes[c][b]));delete this._pendingDeletes[c]}}this._dirty=[];return m.all(a)},_scheduleFlush:function(a){a&&-1===this._dirty.indexOf(a)&&this._dirty.push(a);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 a=0;a<this._stores.length;++a){var c=this._stores[a],b;for(b in c)c.hasOwnProperty(b)&&"undefined"===typeof this._cached[b]&&(this._cached[b]=c[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,c){if(0!==this._stores.length){var b=this._stores[0];b[a]!==c&&(b[a]=c,this._cached=null,this._scheduleFlush(b))}},remove:function(a){for(var c=0;c<
this._stores.length;++c){var b=this._stores[c];if(b.hasOwnProperty(a))return delete b[a],this._pendingDeletes[c]||(this._pendingDeletes[c]=[]),this._pendingDeletes[c].push(a),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]={},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var c=this,b=[],f=0;f<this._providers.length;++f)b.push(this._providers[f].get(this._name,
a).then(function(a){return function(b){c._stores[a]=b}}(f)));return m.all(b).then(function(){c._cached=null;c._getCached()})},flush:function(){this._flush()}};g.prototype={get:function(a,c){if(this._currentPromises[a])return this._currentPromises[a];var b=new m,f=null;c?this._cache.remove(a):f=this._cache.get(a);if(null!==f)b.resolve(f);else{this._currentPromises[a]=b;var e=this;this._service.get(a).then(function(c){e._cache.set(a,c);delete e._currentPromises[a];b.resolve(c)},function(c){404===c.status?
(c={},e._cache.set(a,c),delete e._currentPromises[a],b.resolve(c)):(delete e._currentPromises[a],b.resolve(e._cache.get(a,!0)||{}))})}return b},put:function(a,c){this._cache.set(a,c);return this._service.put(a,c)},remove:function(a,c){var b=this._cache.get(a);delete b[c];this._cache.set(a,b);return this._service.remove(a,c)}};a.prototype={get:function(a,c){if(this._currentPromise)return this._currentPromise;var b=new m,f=null;c?this._cache.remove(a):f=this._cache.get(a);if(null!==f)b.resolve(f);else{this._currentPromise=
b;var e=this;h("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=JSON.parse(c.response);e._cache.set(a,c[a]||{});e._currentPromise=null;b.resolve(c[a]||{})},function(c){401===c.xhr.status||404===c.xhr.status?(e._cache.set(a,{}),e._currentPromise=null,b.resolve({})):(e._currentPromise=null,c=e._cache.get(a,!0),null!==c?b.resolve(c[a]||{}):b.resolve({}))})}return b},put:function(a,c){var b=new m;b.resolve();return b},remove:function(a,c){var b=this._cache.get(a);
delete b[c];this.put(a,b)}};e.prototype={get:function(a){var c=new m;a=this._cache.get(a);null!==a?c.resolve(a):c.resolve({});return c},put:function(a,c){var b=new m;this._cache.set(a,c);b.resolve();return b},remove:function(a,c){var b=this._cache.get(a);delete b[c];this.put(a,b)}};f.DEFAULT_SCOPE=1;f.LOCAL_SCOPE=2;f.USER_SCOPE=4;f.prototype={listenForChangedSettings:function(a,c,b){if(!c||"number"!==typeof c||7<c||1>c)b=c,c=f.DEFAULT_SCOPE|f.LOCAL_SCOPE|f.USER_SCOPE;window.addEventListener("storage",
b,!1);return 0!==(f.USER_SCOPE&c)?"/orion/preferences/user"+a:0!==(f.LOCAL_SCOPE&c)?"/orion/preferences/local"+a:"/orion/preferences/default"+a},getPreferences:function(a,c){if(!c||"number"!==typeof c||7<c||1>c)c=f.DEFAULT_SCOPE|f.LOCAL_SCOPE|f.USER_SCOPE;var b=[];f.USER_SCOPE&c&&this._userProvider.available()&&b.push(this._userProvider);f.LOCAL_SCOPE&c&&b.push(this._localProvider);f.DEFAULT_SCOPE&c&&b.push(this._defaultsProvider);var e=new d(a,b);return e.sync().then(function(){return e})},getSetting:function(a,
c,b){for(var f,e=0;e<a.length;e++)if(a[e].label===c)for(var d=0;d<a[e].data.length;d++)if(a[e].data[d].label===b){f=a[e].data[d].value;break}return f}};return{PreferencesService:f}});
(function(){function k(c){if("string"!==typeof c)throw new TypeError;}function m(c){return c?c.split("\x26"):[]}function h(c){return 0===c.length?"":c.join("\x26")}function d(c){var p=/([^=]*)(?:=?)(.*)/.exec(c);c=p[1]?decodeURIComponent(p[1]):"";p=p[2]?decodeURIComponent(p[2]):"";return[c,p]}function b(c){var p=encodeURIComponent(c[0]);c[1]&&(p+="\x3d"+encodeURIComponent(c[1]));return p}function g(c,p){var a="",b=[],f=0;return{next:function(){a!==c.query&&(a=c.query,b=m(a));if(f<b.length){var e=
d(b[f++]);switch(p){case "keys":return e[0];case "values":return e[1];case "keys+values":return[e[0],e[1]];default:throw new TypeError;}}throw B;}}}function a(c){Object.defineProperty(this,"_url",{get:function(){return c._url}})}function e(c){return c?/[1-9]\d*$/.exec(c)[0]:""}function f(c){var p=[];c.split("/").forEach(function(c){".."===c?p.pop():"."!==c&&p.push(c)});return p.join("/")}function l(c){return c.replace(/\s/g,function(c){return"%"+c.charCodeAt(0).toString(16)})}function c(c,p){if("string"!==
typeof c)throw new TypeError;c=l(c);var a=u.exec(c);if(!a)return null;var b={};b.scheme=a[1]||"";if(b.scheme&&!t.test(b.scheme))return null;var y=a[2];if(y&&(y=r.exec(y),b.userinfo=y[1],b.host=y[2],b.port=y[3],b.port&&!v.test(b.port)))return null;b.path=a[3];b.query=a[4];b.fragment=a[5];!b.scheme&&p&&(b.scheme=p.scheme,!b.host&&p.host&&(b.userinfo=p.userinfo,b.host=p.host,b.port=p.port,b.pathRelative=!0));b.pathRelative&&(b.path?"/"!==b.path[0]&&(a=/^(.*\/)[^\/]*$/.exec(p.path)[1]||"/",b.path=a+b.path):
b.path=p.path);b.scheme&&(b.scheme=b.scheme.toLowerCase());b.port&&(b.port=e(b.port));b.host&&b.path&&(b.path=f(b.path));return b}function n(p,b){var f;if(b){b=b.href||b;f=c(b);if(!f||!f.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:f})}f=c(p,f);if(!f)throw new SyntaxError;Object.defineProperty(this,"_input",{value:p,writable:!0});Object.defineProperty(this,"_url",{value:f,writable:!0});var e=new a(this);Object.defineProperty(this,"query",{get:function(){return this._url?
e:null},enumerable:!0})}try{var q;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(q=new window.URL("http://www.w3.org?q")).protocol&&q.query)return}catch(s){}var u=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,r=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,t=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,v=/^\d*$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,A=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,z=/^([^\s]*)$/,p=/^\S*$/,y=/([^:]*):?(.*)/,B="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),C={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(a.prototype,{get:{value:function(c){k(c);var p;m(this._url.query).some(function(a){a=d(a);if(a[0]===c)return p=a[1],!0});return p},enumerable:!0},set:{value:function(c,p){k(c);k(p);var a=m(this._url.query);a.some(function(f,e){var y=d(f);if(y[0]===c)return y[1]=p,a[e]=b(y),!0})||a.push(b([c,p]));this._url.query=h(a)},enumerable:!0},has:{value:function(c){k(c);
return m(this._url.query).some(function(p){if(d(p)[0]===c)return!0})},enumerable:!0},"delete":{value:function(c){k(c);var p=m(this._url.query),a=p.filter(function(p){return d(p)[0]!==c});return a.length!==p.length?(this._url.query=h(a),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(c,p){if("function"!==typeof c)throw new TypeError;var a=g(this._url,"keys+values");try{for(;;){var b=a.next();c.call(p,b[1],b[0],this)}}catch(f){if(f!==B)throw f;
}},enumerable:!0},keys:{value:function(){return g(this._url,"keys")},enumerable:!0},values:{value:function(){return g(this._url,"values")},enumerable:!0},items:{value:function(){return g(this._url,"keys+values")}},size:{get:function(){return m(this._url.query).length},enumerable:!0},getAll:{value:function(c){k(c);var p=[];m(this._url.query).forEach(function(a){a=d(a);a[0]===c&&p.push(a[1])});return p},enumerable:!0},append:{value:function(c,p){k(c);k(p);var a=m(this._url.query);a.push(b([c,p]));this._url.query=
h(a)},enumerable:!0}});Object.defineProperties(n.prototype,{href:{get:function(){var c;if(this._url){c=this._url;var p=c.scheme?c.scheme+":":"";c.host&&(p+="//",c.userinfo&&(p+=c.userinfo+"@"),p+=c.host,c.port&&(p+=":"+c.port));p+=c.path;c.query&&(p+="?"+c.query);c.fragment&&(p+="#"+c.fragment);c=p}else c=this._input;return c},set:function(p){k(p);this._input=p;this._url=c(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(c){k(c);if(this._url&&(c=":"===c.slice(-1)?c.substring(0,c.length-1):c,""===c||t.test(c)))this._url.scheme=c.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(c){k(c);this._url&&(this._url.userinfo=c)}},username:{get:function(){if(!this._url)return"";var c=y.exec(this._userinfo);return decodeURIComponent(c[1]||"")},set:function(c){k(c);if(this._url){var p=
y.exec(this._userinfo);c=[encodeURIComponent(c||"")];p[2]&&c.push(p[2]);this._userinfo=c.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var c=y.exec(this._userinfo);return decodeURIComponent(c[2]||"")},set:function(c){k(c);if(this._url){var p=[y.exec(this._userinfo)[1]||""];c&&p.push(encodeURIComponent(c));this._userinfo=p.join(":")}},enumerable:!0},host:{get:function(){var c="";this._url&&this._url.host&&(c+=this._url.host,this._url.port&&(c+=":"+this._url.port));return c},
set:function(c){k(c);if(this._url&&(c=A.exec(c)))this._url.host=c[1],this._url.port=e(c[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(c){k(c);this._url&&w.exec(c)&&(this._url.host=c)},enumerable:!0},port:{get:function(){var c=this._url?this._url.port||"":"";c&&c===C[this.protocol]&&(c="");return c},set:function(c){k(c);this._url&&v.exec(c)&&(this._url.port=e(c))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(c){k(c);
this._url&&x.exec(c)&&(this._url.host&&c&&"/"!==c[0]&&(c="/"+c),this._url.path=c?f(c):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(c){k(c);this._url&&(c&&"?"===c[0]&&(c=c.substring(1)),z.exec(c)&&(this._url.query=c))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(c){k(c);this._url&&(c&&"#"===c[0]&&(c=c.substring(1)),p.exec(c)&&(this._url.fragment=c))},enumerable:!0}});
if((q=window.URL||window.webkitURL)&&q.createObjectURL)Object.defineProperty(n,"createObjectURL",{value:q.createObjectURL.bind(q),enumerable:!1}),Object.defineProperty(n,"revokeObjectURL",{value:q.revokeObjectURL.bind(q),enumerable:!1});window.URL=n})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(k,m,h){function d(c,a){var b=Object.keys(c),f=Object.keys(a);if(b.length!==f.length)return!1;b.sort();f.sort();for(var e=0,n=b.length;e<n;e++){var l=b[e];if(l!==f[e])return!1;var d=c[l],l=a[l];if(d!==l&&JSON.stringify(d)!==JSON.stringify(l))return!1}return!0}function b(c){if(-1===c.indexOf("://"))try{return(new URL(c,location.href)).href}catch(a){}return c}function g(c){var a=null,b={key:function(b){return(a=
a||Object.keys(c))[b]},getItem:function(a){return c[a]},setItem:function(b,f){c[b]=f;a=null},removeItem:function(b){delete c[b];a=null},clear:function(){(a=a||Object.keys(c)).forEach(function(a){delete c[a]}.bind(this));a=null}};Object.defineProperty(b,"length",{get:function(){return(a=a||Object.keys(c)).length}});return b}function a(c,a){if(a&&a instanceof XMLHttpRequest){var b,f;try{b=a.status,f=a.statusText}catch(e){b=0,f=""}return{status:b||0,statusText:f}}return a}function e(c){var b=c?JSON.parse(JSON.stringify(c,
a)):c;c instanceof Error&&(b.__isError=!0,b.message=b.message||c.message,b.name=b.name||c.name);return b}function f(c,a){this.type=c;this.plugin=a}function l(c,a){this.__objectId=c;this.__methods=a}function c(c,a,b){function n(c){J&&b.postMessage(c,J)}function g(c){if(!J)return(new k).reject(Error("plugin not connected"));c.id=String(T++);var p=new k;V[c.id]=p;p.then(null,function(p){"active"===F&&p instanceof Error&&"Cancel"===p.name&&n({requestId:c.id,method:"cancel",params:p.message?[p.message]:
[]})});var a=Object.prototype.toString;c.params.forEach(function(b,f){if("[object Object]"===a.call(b)&&!(b instanceof l)){var e,y;for(e in b)"[object Function]"===a.call(b[e])&&(y=y||[],y.push(e));if(y){var B=W++;X[B]=b;e=function(){delete X[B]};p.then(e,e);c.params[f]=new l(B,y)}}});b.postMessage(c,J);return p.promise}function h(c,p){c||0===c?n({id:c,result:null,error:p}):console.log(p)}function w(c,p,a,b){b.forEach(function(c,p){if(c&&"undefined"!==typeof c.__objectId){var a={};c.__methods.forEach(function(p){a[p]=
function(){return g({objectId:c.__objectId,method:p,params:Array.prototype.slice.call(arguments)})}});b[p]=a}});var f=void 0===typeof c?null:{id:c,result:null,error:null};try{var y=a.apply(p,b);f&&(y&&"function"===typeof y.then?(R[c]=y,y.then(function(p){delete R[c];f.result=p;n(f)},function(p){R[c]&&(delete R[c],f.error=e(p),n(f))},function(){n({responseId:c,method:"progress",params:Array.prototype.slice.call(arguments)})})):(f.result=y,n(f)))}catch(B){f&&(f.error=e(B),n(f))}}function A(c){try{if(c.method){var p=
c.method,a=c.params||[];if("serviceId"in c){var f=$[c.serviceId];f||h(c.id,"service not found");p in f?w(c.id,f,f[p],a):h(c.id,"method not found")}else if("objectId"in c){var e=X[c.objectId];e||h(c.id,"object not found");p in e?w(c.id,e,e[p],a):h(c.id,"method not found")}else if("requestId"in c){var y=R[c.requestId];y&&"cancel"===p&&y.cancel&&y.cancel.apply(y,a)}else if("responseId"in c){var n=V[c.responseId];n&&"progress"===p&&n.progress&&n.progress.apply(n,a)}else if("plugin"===c.method){var l=
c.params[0];P({headers:l.headers,services:l.services}).then(function(){E&&E.resolve(B)})}else if("timeout"===c.method)E&&E.reject(c.error);else throw Error("Bad method: "+c.method);}else{var d=V[String(c.id)];delete V[String(c.id)];if(c.error){var q=b.handleServiceError(B,c.error);d.reject(q)}else d.resolve(c.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}function x(c){var p={};if(c.methods&&(c.methods.forEach(function(a){p[a]=function(){var p={serviceId:c.serviceId,method:a,params:Array.prototype.slice.call(arguments)};
return"active"===F?g(p):B.start({"transient":!0}).then(function(){return g(p)})}}),p.addEventListener&&p.removeEventListener)){var a=new m,b=W++;X[b]={handleEvent:a.dispatchEvent.bind(a)};var f=new l(b,["handleEvent"]),e=p.addEventListener;p.addEventListener=function(c,p){a._namedListeners[c]||e(c,f);a.addEventListener(c,p)};var y=p.removeEventListener;p.removeEventListener=function(c,p){a.removeEventListener(c,p);a._namedListeners[c]||y(c,f)}}return p}function z(p){var a=JSON.parse(JSON.stringify(p.properties));
a.__plugin__=c;p=p.names||p.type||[];Array.isArray(p)||(p=[p]);a.objectClass=p;return a}function p(c){var p=x(c),a=z(c),a=b.registerService(c.names||c.type,p,a);L[c.serviceId]={registration:a,proxy:p}}function y(){b.persist(c,{created:C,headers:I,services:H,autostart:G,lastModified:K})}var B=this;a=a||{};var C=a.created||(new Date).getTime(),I=a.headers||{},H=a.services||[],G=a.autostart,K=a.lastModified||0,F="installed",D,E,J,Q,L={},T=0,W=0,R={},V={},X={},$={},P;this._persist=y;this._resolve=function(){F=
"resolved";b.dispatchEvent(new f("resolved",B))};this._getAutostart=function(){return G};this._getCreated=function(){return C};this.getLocation=function(){return c};this.getHeaders=function(){return JSON.parse(JSON.stringify(I))};this.getName=function(){var c=this.getHeaders();return c?c.name||"":null};this.getVersion=function(){var c=this.getHeaders();return c?c.version||"0.0.0":null};this.getLastModified=function(){return K};this.getServiceReferences=function(){var c=[];Object.keys(L).forEach(function(p){c.push(L[p].registration.getReference())});
return c};this.setParent=function(c){return Q!==c?(Q=c,B.stop({"transient":!0}).then(function(){if("started"===G)return B.start({"transient":!0});if("lazy"===G)return B.start({lazy:!0,"transient":!0})})):(new k).resolve()};this.getState=function(){return F};this.start=function(a){if("uninstalled"===F)return(new k).reject(Error("Plugin is uninstalled"));if(D)return D.promise.then(this.start.bind(this,a));if("active"===F)return(new k).resolve();if(!a||!a.transient){var e=a&&a.lazy?"lazy":"started";
e!==G&&(G=e,y())}e=b.getState();if("starting"!==e&&"active"!==e)return a.transient?(new k).reject(Error("start transient error")):(new k).resolve();if("installed"===F)try{this._resolve()}catch(n){return(new k).reject(n)}"resolved"===F&&H.forEach(function(c){p(c)});if(a&&a.lazy)return"starting"!==F&&(F="starting",b.dispatchEvent(new f("lazy activation",B))),(new k).resolve();var l=new k;D=l;F="starting";b.dispatchEvent(new f("starting",B));E=new k;J=b.connect(c,A,Q);E.then(function(){E=null;F="active";
b.dispatchEvent(new f("started",B));D=null;l.resolve()},function(){E=null;F="stopping";b.dispatchEvent(new f("stopping",B));Object.keys(L).forEach(function(c){L[c].registration.unregister();delete L[c]});b.disconnect(J);J=null;F="resolved";D=null;b.dispatchEvent(new f("stopped",B));l.reject(Error("plugin activation error"))});return l.promise};this.stop=function(c){if("uninstalled"===F)return(new k).reject(Error("Plugin is uninstalled"));if(D)return D.promise.then(this.stop.bind(this,c));if((!c||
!c.transient)&&"stopped"!==G)G="stopped",y();if("active"!==F&&"starting"!==F)return(new k).resolve();D=c=new k;F="stopping";b.dispatchEvent(new f("stopping",B));Object.keys(L).forEach(function(c){L[c].registration.unregister();delete L[c]});J&&(b.disconnect(J),J=null);F="resolved";D=null;b.dispatchEvent(new f("stopped",B));c.resolve();return c.promise};P=function(a){if("uninstalled"===F)return(new k).reject(Error("Plugin is uninstalled"));if(!a)return 0===K&&(K=(new Date).getTime(),y()),b.loadManifest(c).then(P);
var e=I,n=H,l=G;I=a.headers||{};H=a.services||{};G=a.autostart||G;a.lastModified?K=a.lastModified:(K=(new Date).getTime(),y());if(d(I,e)&&d(H,n)&&G===l)return(new k).resolve();if("active"===F||"starting"===F){var g=[];Object.keys(H).forEach(function(c){var a=H[c];g.push(c);var b=L[c];if(b){if(d(a.methods,Object.keys(b.proxy))){c=z(a);var f=b.registration.getReference(),e={};f.getPropertyKeys().forEach(function(c){e[c]=f.getProperty(c)});d(c,e)||b.registration.setProperties(c);return}b.registration.unregister();
delete L[c]}p(a)});Object.keys(L).forEach(function(c){-1===g.indexOf(c)&&(L[c].registration.unregister(),delete L[c])})}"active"===F&&(b.disconnect(J),E=new k,J=b.connect(c,A,Q),E.then(function(){E=null},function(){E=null;F="stopping";b.dispatchEvent(new f("stopping"),B);Object.keys(L).forEach(function(c){L[c].registration.unregister();delete L[c]});b.disconnect(J);J=null;F="resolved";b.dispatchEvent(new f("stopped",B))}));return(new k).resolve()};this.update=function(c){return P(c).then(function(){b.dispatchEvent(new f("updated",
B))})};this.uninstall=function(){if("uninstalled"===F)return(new k).reject(Error("Plugin is uninstalled"));if("active"===F||"starting"===F||"stopping"===F)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));b.removePlugin(this);F="uninstalled";b.dispatchEvent(new f("uninstalled",B));return(new k).resolve()}}var n=/^http[s]?/i;return{Plugin:c,PluginRegistry:function(a,e){function l(c){var p=c.source;A.some(function(a){if(p===a.target){try{var b;if("undefined"===typeof a.useStructuredClone){var f=
"string"!==typeof c.data;b=f?c.data:JSON.parse(c.data);a.useStructuredClone=f}else b=a.useStructuredClone?c.data:JSON.parse(c.data);a.handler(b)}catch(e){}return!0}})}e=e||{};var d=e.storage||localStorage;d.getItem||(d=g(d));var h="installed",v,w=[],A=[],x=new m,z={},p={registerService:a.registerService.bind(a),connect:function(c,p,a,b){function f(c){c=Error(c);c.name="timeout";p({method:"timeout",error:c})}var e={handler:p,url:c},n=setTimeout(f.bind(null,"Load timeout for: "+c),b||15E3),l=document.createElement("iframe");
l.name=c+"_"+(new Date).getTime();l.src=c;l.onload=function(){clearTimeout(n);n=setTimeout(f.bind(null,"Plugin handshake timeout for: "+c),5E3)};l.sandbox="allow-scripts allow-same-origin";l.style.width=l.style.height="100%";l.frameBorder=0;(a||v).appendChild(l);e.target=l.contentWindow;e.close=function(){clearTimeout(n);if(l){var c=l.parentNode;c&&c.removeChild(l);l=null}};A.push(e);return e},disconnect:function(c){for(var p=0;p<A.length;p++)if(c===A[p]){A.splice(p,1);try{c.close()}catch(a){}break}},
removePlugin:function(c){for(var p=0;p<w.length;p++)if(c===w[p]){w.splice(p,1);break}d.removeItem("plugin."+c.getLocation())},persist:function(c,p){d.setItem("plugin."+c,JSON.stringify(p))},postMessage:function(c,p){p.target.postMessage(p.useStructuredClone?c:JSON.stringify(c),p.url)},dispatchEvent:function(c){try{x.dispatchEvent(c)}catch(p){console&&console.log("PluginRegistry.dispatchEvent "+p)}},loadManifest:function(c){var a=new k,b=p.connect(c,function(c){b&&c.method&&("manifest"===c.method||
"plugin"===c.method?(c=c.params[0],p.disconnect(b),b=null,a.resolve(c)):"timeout"===c.method&&(p.disconnect(b),b=null,a.reject(c.error)))});return a.promise},getState:function(){return h},handleServiceError:function(c,p){if(p&&401===p.status){var a=c.getHeaders(),b=c.getName()||c.getLocation(),f=document.createElement("span");f.appendChild(document.createTextNode("Authentication required for: "+b+"."));a.login&&(f.appendChild(document.createTextNode(" ")),b=document.createElement("a"),b.target="_blank",
b.textContent="Login",b.href=a.login,n.test(b.href)?(f.appendChild(b),f.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+a.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(f)}}if(p.__isError){var e=p;p=Error(e.message);Object.keys(e).forEach(function(c){p[c]=e[c]});delete p.__isError}return p}};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=p.getState;this.init=function(){if(!("starting"===h||"active"===h||"stopping"===h)){addEventListener("message",l,!1);for(var a=[],f=0,n=d.length;f<n;f++)a.push(d.key(f));a.forEach(function(a){if(0===a.indexOf("plugin.")){var b=a.substring(7);a=JSON.parse(d.getItem(a));a.created&&w.push(new c(b,a,p))}});w.sort(function(c,p){return c._getCreated()<p._getCreated()?-1:1});e.parent?v=e.parent:(v=document.createElement("div"),
e.visible||(v.style.display="none",v.style.visibility="hidden"),document.body.appendChild(v));e.plugins&&Object.keys(e.plugins).forEach(function(a){a=b(a);if(!this.getPlugin(a)){var f=e.plugins[a];"object"!==typeof f&&(f={});f.autostart=f.autostart||e.defaultAutostart||"lazy";w.push(new c(a,f,p))}}.bind(this));h="starting"}};this.start=function(){"starting"!==h&&this.init();if("starting"!==h)return(new k).reject("Cannot start framework. Framework is already "+h+".");var c=[],p=(new Date).getTime();
w.forEach(function(a){var b=a._getAutostart();0===a.getLastModified()?c.push(a.update().then(function(){if("started"===b)return a.start({"transient":!0});if("lazy"===b)return a.start({lazy:!0,"transient":!0});a._resolve()})):"started"===b?c.push(a.start({"transient":!0})):"lazy"===b?(c.push(a.start({lazy:!0,"transient":!0})),p>a.getLastModified()+864E5&&a.update()):a._resolve()});return k.all(c,function(c){console.log("PluginRegistry.stop "+c)}).then(function(){h="active"})};this.stop=function(){if("starting"!==
h&&"active"!==h)return(new k).reject("Cannot stop registry. Registry is already "+h+".");h="stopping";var c=[];w.forEach(function(p){c.push(p.stop({"transient":!0}))});return k.all(c,function(c){console.log("PluginRegistry.stop "+c)}).then(function(){if(!e.parent){var c=v.parentNode;c&&c.removeChild(v)}v=null;removeEventListener("message",l);h="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new k).reject("Cannot uninstall registry")};
this.installPlugin=function(a,e){a=b(a);var n=this.getPlugin(a);if(n)return(new k).resolve(n);if(z[a])return z[a];if(e)return n=new c(a,e,p),w.push(n),n._persist(),p.dispatchEvent(new f("installed",n)),(new k).resolve(n);var l=p.loadManifest(a).then(function(b){n=new c(a,b,p);w.push(n);n._persist();delete z[a];p.dispatchEvent(new f("installed",n));return n},function(c){delete z[a];throw c;});return z[a]=l};this.getPlugins=function(){return w.slice()};this.getPlugin=function(c){var p=null;c=b(c);w.some(function(a){if(c===
a.getLocation())return p=a,!0});return p};this.addEventListener=x.addEventListener.bind(x);this.removeEventListener=x.removeEventListener.bind(x);this.resolvePlugins=function(){var c=!0;w.forEach(function(p){c=c&&p._resolve()});return c}}}});
define("orion/serviceTracker",[],function(){function k(d,b){function g(c){var a=c.getProperty("service.id"),b=this.addingService(c);b&&(e[a]=c,f[a]=b)}function a(c){var a=c.getProperty("service.id"),b=f[a];delete e[a];delete f[a];this.removedService(c,b)}this.serviceRegistry=d;var e={},f={},l=m,c,n;this.close=function(){if(l!==h)throw"Already closed";l=m;d.removeEventListener("registered",c);d.removeEventListener("unregistering",n);n=c=null;var b=this;this.getServiceReferences().forEach(function(c){a.call(b,
c)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var c=Object.keys(e);return!c.length?null:c.map(function(c){return e[c]})};this.open=function(){if(l!==m)throw"Already open";l=h;var f=this;c=function(c){if(-1!==c.serviceReference.getProperty("objectClass").indexOf(b)&&(g.call(f,c.serviceReference),"function"===typeof f.onServiceAdded))return f.onServiceAdded(c.serviceReference,f.serviceRegistry.getService(c.serviceReference))};n=function(c){-1!==c.serviceReference.getProperty("objectClass").indexOf(b)&&
a.call(f,c.serviceReference)};d.addEventListener("registered",c);d.addEventListener("unregistering",n);d.getServiceReferences(b).forEach(function(c){g.call(f,c);if("function"===typeof f.onServiceAdded)return f.onServiceAdded(c,d.getService(c))});if("function"===typeof this.onOpen)this.onOpen()}}var m=0,h=1;k.prototype={addingService:function(d){return this.serviceRegistry.getService(d)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(d,b){}};return k});
define("orion/objects",[],function(){function k(k){for(var h=1;h<arguments.length;h++){var d=arguments[h],b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&(k[b]=d[b])}return k}return{clone:function(m){if(Array.isArray(m))return Array.prototype.slice.call(m);var h=Object.create(Object.getPrototypeOf(m));k(h,m);return h},mixin:k,toArray:function(k){return Array.isArray(k)?k:[k]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(k,m,h){var d,b,g,a,e,f="pid";d=function(c,a,b){function e(c,b,f){b.forEach(function(e,l){try{var p=c[l].getProperty("__plugin__"),y=p&&a.getPlugin(p);(!p||y&&"active"===y.getState())&&b[l].updated(f)}catch(B){"undefined"!==typeof console&&console.log(B)}})}m.call(this,c,"orion.cm.managedservice");var l={},d={},g=function(a){var e=[];a.plugin.getServiceReferences().forEach(function(a){if(-1!==a.getProperty("objectClass").indexOf("orion.cm.managedservice")){var l=
a.getProperty(f);a=c.getService(a);l&&a&&(l=(l=b._find(l))&&l.getProperties(),e.push(a.updated(l)))}});return k.all(e)};this.addingService=function(a){var b=a.getProperty(f),e=c.getService(a);if(!b||!e)return null;l[b]||(l[b]=[]);d[b]||(d[b]=[]);l[b].push(a);d[b].push(e);return e};this.onServiceAdded=function(c,a){var l=c.getProperty(f),l=b._find(l);e([c],[a],l&&l.getProperties())};this.onOpen=function(){a.addEventListener("started",g)};this.onClose=function(){a.removeEventListener("started",g)};
this.notifyUpdated=function(c){var a=c.getPid();e(l[a]||[],d[a]||[],c.getProperties())};this.notifyDeleted=function(c){c=c.getPid();e(l[c]||[],d[c]||[],null)};this.removedService=function(c,a){var b=c.getProperty(f),e=l[b],n=d[b];1<e.length?e.splice(e.indexOf(c),1):delete l[b];1<n.length?n.splice(n.indexOf(a),1):delete d[b]}};b=function(){function c(c,b,f){this.store=new g(this,f);this.configAdmin=new a(this,this.store);this.tracker=new d(c,b,this.store)}c.prototype={getConfigurationAdmin:function(){var c=
this;return this.configAdmin._init().then(function(a){c.tracker.open();return a})},notifyDeleted:function(c){this.tracker.notifyDeleted(c)},notifyUpdated:function(c){this.tracker.notifyUpdated(c)}};return c}();a=function(){function c(c,a){this.factory=c;this.store=a}c.prototype={_init:function(){var c=this;return this.store._init().then(function(){return c})},getConfiguration:function(c){return this.store.get(c)},listConfigurations:function(){return this.store.list()}};return c}();var l="/cm/configurations";
g=function(){function c(c,a){this.factory=c;this.prefsService=a;this.configs=Object.create(null);this.pref=null;var b=this;this.initPromise=this.prefsService.getPreferences(l).then(function(c){b.pref=c;c.keys().forEach(function(a){if(!b.configs[a]){var l=c.get(a);"object"===typeof l&&null!==l&&0<Object.keys(l).length&&(l[f]=a,b.configs[a]=new e(b.factory,b,l))}})})}c.prototype={_init:function(){return this.initPromise},_find:function(c){return this.configs[c]||null},get:function(c){var a=this._find(c);
a||(a=new e(this.factory,this,c),this.configs[c]=a);return a},list:function(){var c=this,a=[];this.pref.keys().forEach(function(b){(b=c._find(b))&&null!==b.getProperties()&&a.push(b)});return a},remove:function(c){this.pref.remove(c);delete this.configs[c]},save:function(c,a){this.pref.put(c,a.getProperties(!0)||{})}};return c}();e=function(){function c(c,a){a=h.clone(a);delete a[f];c.properties=a}function a(b,e,l){this.factory=b;this.store=e;if(null!==l&&"object"===typeof l)this.pid=l[f],c(this,
l);else if("string"===typeof l)this.pid=l,this.properties=null;else throw Error("Invalid pid/properties "+l);}a.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(c){this._checkRemoved();var a=null;this.properties&&(a=h.clone(this.properties),c||(a[f]=this.pid));return a},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(a){this._checkRemoved();c(this,a);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return a}();return{ConfigurationAdminFactory:b}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(k,m,h,d,b,g){var a;return{startup:function(){if(a)return a;a=new m;var e=new h.ServiceRegistry,f=new d.PreferencesService(e);return f.getPreferences("/plugins").then(function(l){var c={plugins:{}};l.keys().forEach(function(a){var b=k.toUrl(a);c.plugins[b]=l[a]});var n=new b.PluginRegistry(e,c);return n.start().then(function(){if(0<e.getServiceReferences("orion.core.preference.provider").length)return f.getPreferences("/plugins",
f.USER_SCOPE).then(function(c){var a=[];c.keys().forEach(function(c){c=k.toUrl(c);n.getPlugin(c)||a.push(n.installPlugin(c,{autostart:"lazy"}).then(function(c){return c.update().then(function(){return c.start({lazy:!0})})}))});return m.all(a,function(c){console.log(c)})})}).then(function(){return(new g.ConfigurationAdminFactory(e,n,f)).getConfigurationAdmin().then(e.registerService.bind(e,"orion.cm.configadmin"))}).then(function(){var c=e.getService("orion.core.auth");if(c){var a=c.getUser().then(function(a){if(a)localStorage.setItem("lastLogin",
(new Date).getTime());else return c.getAuthForm(window.location.href).then(function(c){setTimeout(function(){window.location=c},0)})}),b=localStorage.getItem("lastLogin");if(!b||b<(new Date).getTime()-9E5)return a}}).then(function(){var c={serviceRegistry:e,preferences:f,pluginRegistry:n};a.resolve(c);return c})})}}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/util",[],function(){var k=navigator.userAgent,m=-1!==k.indexOf("MSIE")||-1!==k.indexOf("Trident")?document.documentMode:void 0,h=parseFloat(k.split("Firefox/")[1]||k.split("Minefield/")[1])||void 0,d=-1!==k.indexOf("Opera")?parseFloat(k.split("Version/")[1]):void 0,b=parseFloat(k.split("Chrome/")[1])||void 0,g=-1!==k.indexOf("Safari")&&!b,a=parseFloat(k.split("WebKit/")[1])||void 0,e=-1!==k.indexOf("Android"),f=-1!==k.indexOf("iPad"),k=-1!==k.indexOf("iPhone"),l=f||k,c=-1!==navigator.platform.indexOf("Mac"),
n=-1!==navigator.platform.indexOf("Win"),q=-1!==navigator.platform.indexOf("Linux"),s="ontouchstart"in document.createElement("input");return{formatMessage:function(c){var a=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(c,b){return a[(b<<0)+1]})},createElement:function(c,a){return c.createElementNS?c.createElementNS("http://www.w3.org/1999/xhtml",a):c.createElement(a)},isIE:m,isFirefox:h,isOpera:d,isChrome:b,isSafari:g,isWebkit:a,isAndroid:e,isIPad:f,isIPhone:k,isIOS:l,isMac:c,isWindows:n,
isLinux:q,isTouch:s,platformDelimiter:n?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(k){function m(a,b){b||(b=document);return b.querySelectorAll(a)}function h(a){var b=a.tabIndex;0===b&&k.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[a.nodeName.toLowerCase()]&&!a.attributes.tabIndex&&(b=-1);return b}function d(a){if(0<=h(a))return a;if(a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++){var c=d(a.childNodes[b]);if(c)return c}return null}function b(a){if(0<=
h(a))return a;if(a.hasChildNodes())for(var e=a.childNodes.length-1;0<=e;e--){var c=b(a.childNodes[e]);if(c)return c}return null}function g(b,e){if(3===b.nodeType){var c=a.exec(b.nodeValue);c&&1<c.length&&e(b,c)}if(b.hasChildNodes())for(c=0;c<b.childNodes.length;c++)g(b.childNodes[c],e)}var a=/\$\{([^\}]+)\}/,e=null;return{$:function(a,b){b||(b=document);return b.querySelector(a)},$$:m,$$array:function(a,b){return Array.prototype.slice.call(m(a,b))},node:function(a){var b=a;"string"===typeof a&&(b=
document.getElementById(a));return b},contains:function(a,b){if(!a||!b)return!1;if(a===b)return!0;var c=a.compareDocumentPosition(b);return Boolean(c&16)},bounds:function(a){a=a.getBoundingClientRect();return{left:a.left+document.documentElement.scrollLeft,top:a.top+document.documentElement.scrollTop,width:a.width,height:a.height}},empty:function(a){for(;a.hasChildNodes();)a.removeChild(a.firstChild)},firstTabbable:d,lastTabbable:b,stop:function(a){window.document.all&&(a.keyCode=0);a.preventDefault&&
(a.preventDefault(),a.stopPropagation())},processTextNodes:function(a,b){g(a,function(c,a){c.parentNode.replaceChild(document.createTextNode(b[a[1]]||a[1]),c)})},processDOMNodes:function(a,b){g(a,function(c,a){var e=b[a[1]];if(e){var f=document.createRange(),d=a.index;f.setStart(c,d);f.setEnd(c,d+a[0].length);f.deleteContents();f.insertNode(e)}})},addAutoDismiss:function(a,b){function c(c){e.forEach(function(a){var b=!1,e=a.excludeNodes.some(function(a){return document.body.contains(a)?(b=!0,a.contains(c.target)):
!1});if(b&&!e)try{a.dismiss(c)}catch(f){"undefined"!==typeof console&&console&&console.error(f&&f.message)}});e=e.filter(function(c){return c.excludeNodes.some(function(c){return document.body.contains(c)})})}null===e&&(e=[],document.addEventListener("click",c,!0),k.isIOS&&document.addEventListener("touchend",function(c){function a(){c.target.removeEventListener("click",a)}0===c.touches.length&&c.target.addEventListener("click",a)},!1));e.push({excludeNodes:a,dismiss:b})},setFramesEnabled:function(a){for(var b=
document.getElementsByTagName("iframe"),c=0;c<b.length;c++)b[c].parentNode.style.pointerEvents=a?"":"none"},removeAutoDismiss:function(a){e=e.filter(function(b){return a!==b.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}}});
define("text",["module"],function(k){var m,h,d=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],b=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,g=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,a="undefined"!==typeof location&&location.href,e=a&&location.protocol&&location.protocol.replace(/\:/,""),f=a&&location.hostname,l=a&&(location.port||void 0),c=[],n=k.config&&k.config()||{};m={version:"2.0.5",strip:function(c){if(c){c=c.replace(b,"");var a=c.match(g);a&&(c=a[1])}else c="";return c},
jsEscape:function(c){return c.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:n.createXhr||function(){var c,a,b;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(a=0;3>a;a+=1){b=d[a];try{c=new ActiveXObject(b)}catch(e){}if(c){d=[b];break}}return c},parseName:function(c){var a,
b,e=!1,f=c.indexOf(".");a=0===c.indexOf("./")||0===c.indexOf("../");-1!==f&&(!a||1<f)?(a=c.substring(0,f),b=c.substring(f+1,c.length)):a=c;c=b||a;f=c.indexOf("!");-1!==f&&(e="strip"===c.substring(f+1),c=c.substring(0,f),b?b=c:a=c);return{moduleName:a,ext:b,strip:e}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(c,a,b,e){var f,l;f=m.xdRegExp.exec(c);if(!f)return!0;c=f[2];f=f[3];f=f.split(":");l=f[1];f=f[0];return(!c||c===a)&&(!f||f.toLowerCase()===b.toLowerCase())&&(!l&&!f||l===e)},finishLoad:function(a,
b,e,f){e=b?m.strip(e):e;n.isBuild&&(c[a]=e);f(e)},load:function(c,b,d,g){if(g.isBuild&&!g.inlineText)d();else{n.isBuild=g.isBuild;var h=m.parseName(c);g=h.moduleName+(h.ext?"."+h.ext:"");var v=b.toUrl(g),k=n.useXhr||m.useXhr;!a||k(v,e,f,l)?m.get(v,function(a){m.finishLoad(c,h.strip,a,d)},function(c){d.error&&d.error(c)}):b([g],function(c){m.finishLoad(h.moduleName+"."+h.ext,h.strip,c,d)})}},write:function(a,b,e,f){c.hasOwnProperty(b)&&(f=m.jsEscape(c[b]),e.asModule(a+"!"+b,"define(function () { return '"+
f+"';});\n"))},writeFile:function(c,a,b,e,f){a=m.parseName(a);var l=a.ext?"."+a.ext:"",n=a.moduleName+l,d=b.toUrl(a.moduleName+l)+".js";m.load(n,b,function(a){a=function(c){return e(d,c)};a.asModule=function(c,a){return e.asModule(c,d,a)};m.write(c,n,a,f)},f)}};if("node"===n.env||!n.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)h=require.nodeRequire("fs"),m.get=function(c,a){var b=h.readFileSync(c,"utf8");0===b.indexOf("\ufeff")&&(b=b.substring(1));a(b)};else if("xhr"===
n.env||!n.env&&m.createXhr())m.get=function(c,a,b,e){var f=m.createXhr(),l;f.open("GET",c,!0);if(e)for(l in e)e.hasOwnProperty(l)&&f.setRequestHeader(l.toLowerCase(),e[l]);if(n.onXhr)n.onXhr(f,c);f.onreadystatechange=function(e){4===f.readyState&&(e=f.status,399<e&&600>e?(e=Error(c+" HTTP status: "+e),e.xhr=f,b(e)):a(f.responseText))};f.send(null)};else if("rhino"===n.env||!n.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)m.get=function(c,a){var b,e,f=new java.io.File(c),l=java.lang.System.getProperty("line.separator"),
f=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(f),"utf-8")),n="";try{b=new java.lang.StringBuffer;(e=f.readLine())&&e.length()&&65279===e.charAt(0)&&(e=e.substring(1));for(null!==e&&b.append(e);null!==(e=f.readLine());)b.append(l),b.append(e);n=String(b.toString())}finally{f.close()}a(n)};return m});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,m,h){return{slideoutHTMLFragment:function(d){var b=document.createElement("div");b.innerHTML=h;var g=m.$("#slideContainer",b);g.id=d+g.id;g=m.$("#pageCommandParameters",b);g.id=d+g.id;g=m.$("#pageCommandDismiss",b);g.id=d+g.id;return b.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(k){function m(d,b,g,a,e,f){this.type=f||"keydown";this.keyCode="string"===typeof d&&"keydown"===this.type?d.toUpperCase().charCodeAt(0):d;this.mod1=void 0!==b&&null!==b?b:!1;this.mod2=void 0!==g&&null!==g?g:!1;this.mod3=void 0!==a&&null!==a?a:!1;this.mod4=void 0!==e&&null!==e?e:!1}function h(d){this.keys=d}m.prototype={getKeys:function(){return[this]},match:function(d,b){if(void 0!==b){if(0!==b)return!1}else if(d instanceof Array){if(1<d.length)return!1;
d=d[0]}return d.type!==this.type?!1:this.keyCode===d.keyCode||this.keyCode===String.fromCharCode(k.isOpera?d.which:void 0!==d.charCode?d.charCode:d.keyCode)?this.mod1!==(k.isMac?d.metaKey:d.ctrlKey)||"keydown"===this.type&&this.mod2!==d.shiftKey||this.mod3!==d.altKey||k.isMac&&this.mod4!==d.ctrlKey?!1:!0:!1},equals:function(d){return!d||this.keyCode!==d.keyCode||this.mod1!==d.mod1||this.mod2!==d.mod2||this.mod3!==d.mod3||this.mod4!==d.mod4||this.type!==d.type?!1:!0}};h.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(d,b){var g=this.keys;if(void 0!==b)return b>g.length?!1:g[b].match(d)?b===g.length-1?!0:b+1:!1;d instanceof Array||(d=[d]);if(d.length>g.length)return!1;var a;for(a=0;a<d.length;a++)if(!g[a].match(d[a]))return!1;return a===g.length?!0:a},equals:function(d){if(!d.keys||d.keys.length!==this.keys.length)return!1;for(var b=0;b<d.keys.length;b++)if(!d.keys[b].equals(this.keys[b]))return!1;return!0}};return{KeyBinding:m,KeyStroke:m,KeySequence:h}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(k,m,h){function d(a){h.attach(this);this._init(a)}function b(a,b){var f=document.createElement(void 0===b?"span":b);f.tabIndex=0;f.className="dropdownMenuItem";f.role="menuitem";var l=document.createElement("span");l.appendChild(document.createTextNode(a));l.classList.add("dropdownCommandName");f.appendChild(l);l=document.createElement("li");l.appendChild(f);return l}function g(){var a=document.createElement("li");
a.classList.add("dropdownSeparator");return a}d.prototype={_init:function(a){this._dropdownNode=m.node(a.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=a.populate;this._selectionClass=a.selectionClass;this._parentDropdown=a.parentDropdown;this._positioningNode=a.positioningNode;if(!this._parentDropdown)for(var b=this._dropdownNode.parentNode;b&&document!==b;){if(b.classList&&b.classList.contains("dropdownMenu")){this._parentDropdown=b.dropdown;break}b=b.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=a.triggerNode?a.triggerNode:m.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!a.skipTriggerEventListeners){var f=this;this._triggerNode.addEventListener("click",function(a){f.toggle(a)&&m.stop(a)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(a){if(a.keyCode===m.KEY.ENTER||a.keyCode===m.KEY.SPACE)f.toggle(),m.stop(a)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(a){var b=this;a.addEventListener("click",function(a){b.toggle(a)&&m.stop(a)},!1)},toggle:function(a){return this.isVisible()?this.close():this.open(a)},isVisible:function(){return this._isVisible},open:function(a){var b=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:a}),m.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?m.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),b=m.$$array(".dropdownSubMenu",this._dropdownNode),m.addAutoDismiss([this._triggerNode].concat(b),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(a),this._dropdownNode.focus(),
b=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return b},_autoDismiss:function(a){if(this.close(!1)&&this._dropdownNode.contains(a.target))for(a=this._parentDropdown;a;)a.close(!1),a=a._parentDropdown},_positionDropdown:function(a){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{a=m.bounds(this._dropdownNode);var b=m.bounds(document.body);if(a.left+a.width>b.left+
b.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-a.width+"px";else{var f=m.bounds(this._boundingNode(this._triggerNode)),l=m.bounds(this._triggerNode);this._dropdownNode.style.left=l.left-f.left-a.width+l.width+"px"}a=a.top+a.height-(b.top+b.height);0<a&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-a)+"px")}},_boundingNode:function(a){var b=window.getComputedStyle(a,null);return null===b||"absolute"===b.getPropertyValue("position")||
!a.parentNode||a===document.body?a:this._boundingNode(a.parentNode)},close:function(a){var b=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),m.setFramesEnabled(!0),a&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),b=!0);return b},
getItems:function(){var a=[],b=this;m.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(f){f.parentNode.parentNode===b._dropdownNode&&a.push(f)});a.forEach(function(a){a._hasDropdownMouseover||(a.addEventListener("mouseover",function(l){a.dropdown?a.dropdown.open(l):(b._closeSelectedSubmenu(),m.stop(l));b._selectItem(a)}),a._hasDropdownMouseover=!0)});return a},empty:function(){var a=this;m.$$array("li",this._dropdownNode).forEach(function(b){b.parentNode===
a._dropdownNode&&b.parentNode.removeChild(b)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(a){if(a.keyCode===m.KEY.UP||a.keyCode===m.KEY.DOWN||a.keyCode===m.KEY.RIGHT||a.keyCode===m.KEY.ENTER||a.keyCode===m.KEY.LEFT){var b=this.getItems();if(b.length&&0<b.length){if(this._selectedItem){var f=b.indexOf(this._selectedItem);0>f&&(f=b.indexOf(this._selectedItem.parentNode));0<=f&&(a.keyCode===m.KEY.UP&&0<f?(f--,this._selectItem(b[f])):a.keyCode===m.KEY.DOWN&&f<b.length-1?(f++,this._selectItem(b[f])):
a.keyCode===m.KEY.ENTER||a.keyCode===m.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):a.keyCode===m.KEY.ENTER&&this._selectedItem.click():a.keyCode===m.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(b[0]);m.stop(a)}}else a.keyCode===
m.KEY.ESCAPE&&(this.close(!0),m.stop(a))},_selectItem:function(a){if(a=a||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=a,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(a){a!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=a)},_closeSelectedSubmenu:function(){for(var a=this._selectedSubmenu;a;)a.close(),
a=a._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&m.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(a,e){var f=b(a,e);this._dropdownNode.appendChild(f);return f},appendSeparator:function(){var a=g();this._dropdownNode.appendChild(a);return a}};d.prototype.constructor=d;return{Dropdown:d,appendKeyBindingString:function(a,b){var f=document.createElement("span");f.classList.add("dropdownKeyBinding");f.appendChild(document.createTextNode(b));a.appendChild(f)},
createMenuItem:b,createSeparator:g}});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,m){function h(d){this._init(d)}h.prototype={_init:function(d){this._node=m.node(d.node);if(!this._node)throw"no dom node for tooltip found";this._position=d.position||["right","above","below","left"];this._text=d.text;this._hideDelay=void 0===d.hideDelay?200:d.hideDelay;this._tailSize=d.tailSize||10;this._trigger=d.trigger||"mouseover";this._afterShowing=d.afterShowing;this._afterHiding=d.afterHiding;var b=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(a){a.target===b._node&&(b.show(),m.stop(a))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===d.showDelay?500:d.showDelay;d=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(a){m.contains(b._node,a.target)&&(b.show(),m.stop(a))},!1);this._leaveHandler=function(a){m.contains(b._node,a.target)&&b.hide()};for(var g=0;g<d.length;g++)this._node.addEventListener(d[g],
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 d=document.createTextNode(this._text);this._tipTextContent.appendChild(d)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var b=this;m.addAutoDismiss([this._tip,this._node],function(){b.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(d){b._timeout&&(window.clearTimeout(b._timeout),b._timeout=null);b._tip.addEventListener("mouseout",function(a){m.contains(b._tip,a.target)&&(b.hide(),m.stop(a))},
!1)},!1))}return this._tip},_positionTip:function(d,b){this._makeTipNode();"left"===d?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var g=this._node,a;for(a=m.bounds(g);g&&!a.width&&!a.height;g=g.parentNode)a=m.bounds(g);var g=m.bounds(this._tipInner),e;switch(d){case "above":e=a.top-g.height-this._tailSize-1;a=a.left-this._tailSize;break;case "below":e=a.top+a.height+this._tailSize+1;a=a.left-this._tailSize;break;case "left":e=a.top-this._tailSize/2;a=a.left-g.width-
this._tailSize-1;break;default:e=a.top-this._tailSize/2,a=a.left+a.width+this._tailSize+1}var f=m.bounds(document.documentElement);if(e+g.height>f.height)if(b)e=f.height-g.height-1;else return!1;if(a+g.width>f.width)if(b)a=f.width-g.width-1;else return!1;if(0>a)if(b)a=4;else return!1;if(0>e)if(b)e=4;else return!1;this._tail&&this._tail.previousPosition!==d&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
d),"above"===d||"left"===d?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),"left"===d&&(this._tail.style.left=g.width+"px"),this._tail.previousPosition=d);this._tip.style.top=e+"px";this._tip.style.left=a+"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 d=!1,b=0;!d&&b<this._position.length;)d=this._positionTip(this._position[b]),b++;d||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(d){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===d&&(d=
this._hideDelay);var b=this;this._timeout=window.setTimeout(function(){b._tip.classList.remove("tooltipShowing");b._tip.removeAttribute("style");b._afterHiding&&b._afterHiding()},d)}},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 d=["mouseout","click"],b=0;b<d.length;b++)this._node.removeEventListener(d[b],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,m,h,d,b,g,a,e){function f(c){var a=c.invocation;if(a){var b=c.command;if(b.hrefCallback)return c=b.hrefCallback.call(a.handler||window,a),c.then?c.then(function(c){window.open(c)}):window.open(c),!0;if(a.commandRegistry)return a.commandRegistry._invoke(a),
!0;if(b.onClick||b.callback)return window.setTimeout(function(){(b.onClick||b.callback).call(a.handler||window,a)},0),!0}return!1}function l(c,a){for(var b in a)if(a[b]&&a[b].keyBinding&&a[b].command&&a[b].keyBinding.match(c)){var p=a[b],e=p.keyBinding;if((!e.domScope||m.contains(m.node(e.domScope),c.target))&&f(p)){m.stop(c);break}}}function c(){var c={};if(v){var a,b,p;b=Object.keys(w);for(a=0;a<b.length;a++)p=b[a],c[p]=w[p];var f=v();b=Object.keys(f);for(a=0;a<b.length;a++)p=b[a],c[p]=f[p]}else c=
w;return c}function n(a){l(a,c())}function q(c,a){c=c||window.event;if(function(c){if(k.isMac){if(c.metaKey&&!c.altKey)return!c.shiftKey&&!c.ctrlKey&&(65===c.keyCode||67===c.keyCode||86===c.keyCode||88===c.keyCode||90===c.keyCode)?!0:!1;if(c.ctrlKey)return!1}else{if(c.ctrlKey&&!c.altKey)return!c.shiftKey&&(65===c.keyCode||67===c.keyCode||86===c.keyCode||88===c.keyCode||90===c.keyCode)?!0:!1;if(c.altKey&&!c.ctrlKey)return!1}if(c["char"])return 0<c["char"].length;if(c.charCode||c.keyCode)switch(c=c.charCode||
c.keyCode,c){case 8:case 9:case 13:case 46:return!0;default:return 32<=c&&112>c||123<c}return!1}(c)){if("true"===c.target.contentEditable)return;var b=c.target.nodeName.toLowerCase();if("input"===b)switch(c.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"===b)return}a?a(c):n(c)}function s(){this._init()}
function u(c,a,b){a.classList.add("commandImage");var p;c.imageClass?c.addImageClassToElement?a.classList.add(c.imageClass):(p=document.createElement("span"),a.appendChild(p),p.classList.add(c.spriteClass),p.classList.add(c.imageClass)):(p=new Image,p.alt=c.name,p.name=b,p.id=b,p.src=c.image,a.appendChild(p));return p}function r(c,a,b,p,f){this.commandRegistry=f;this.handler=c;this.items=a;this.userData=b;this.command=p;p.parameters&&(this.parameters=p.parameters.makeCopy());this.id=p.id}function t(c){this._init(c)}
var v=null,w={};s.prototype={setProxy:function(c){this.proxy=c},setKeyBindings:function(c){this.bindings=c},_init:function(){var c=this;document.addEventListener("keydown",function(a){return q(a,function(a){var b=c.proxy,f=c.bindings;if(f&&b)for(var e=0;e<f.length;e++)f[e].match(a)&&(b.processKey({type:a.type,keyCode:a.keyCode,altKey:a.altKey,ctrlKey:a.ctrlKey,metaKey:a.metaKey,shiftKey:a.shiftKey}),m.stop(a))})})}};window.document.addEventListener("keydown",q,!1);r.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(c){var a=new r(this.handler,this.items,this.userData,this.command,this.commandRegistry);a.domNode=this.domNode;a.domParent=this.domParent;c?a.parameters=c.makeCopy():this.parameters&&(a.parameters=this.parameters.makeCopy());return a}};r.prototype.constructor=r;t.prototype={_init:function(c){this.id=c.id;this.name=c.name;this.tooltip=c.tooltip;this.callback=c.callback;this.hrefCallback=c.hrefCallback;this.choiceCallback=c.choiceCallback;
this.positioningNode=c.positioningNode;this.image=c.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=c.imageClass;this.addImageClassToElement=c.addImageClassToElement;this.selectionClass=c.selectionClass;this.spriteClass=c.spriteClass||"commandSprite";this.visibleWhen=c.visibleWhen;this.parameters=c.parameters;this.isEditor=c.isEditor},populateChoicesMenu:function(c,a,b,p,
f){b=this.getChoices(a,b,p);var e=b.some(function(c){return c.checked});b.forEach(function(b){if(b.name){var p=document.createElement("li");c.appendChild(p);var l=document.createElement("span");l.tabIndex=0;l.role="menuitem";l.classList.add("dropdownMenuItem");if(e){var n=document.createElement("span");n.classList.add("check");n.appendChild(document.createTextNode(b.checked?"\u25cf":""));l.appendChild(n)}n=document.createTextNode(b.name);l.appendChild(n);p.appendChild(l);l.choice=b;l.addEventListener("click",
function(c){c.target.choice&&c.target.choice.callback.call(c.target.choice,a)},!1);l.addEventListener("keydown",function(c){(c.keyCode===m.KEY.ENTER||c.keyCode===m.KEY.SPACE)&&c.target.choice&&c.target.choice.callback.call(c.target.choice,a)},!1)}else f._generateMenuSeparator(c)})},getChoices:function(c,a,b){return this.choiceCallback?this.choiceCallback.call(a,c,b):null},makeChoiceCallback:function(c,a){return function(b){c.callback&&c.callback.call(c,a,b)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};t.prototype.constructor=t;return{Command:t,CommandInvocation:r,createDropdownMenu:function(c,a,f,p,e,l,n,g,q){c=m.node(c);if(!c)throw"no parent node was specified";var s=document.createRange();s.selectNode(c);s=q?s.createContextualFragment(b):s.createContextualFragment(d);m.processTextNodes(s,{ButtonText:a});c.appendChild(s);c=c.lastChild;
var r;q?(q=c.previousSibling,r=q.lastChild):q=c.previousSibling;p?q.classList.add(p):(q.classList.add("orionButton"),q.classList.add("commandButton"));e&&(l||(q.textContent="",q.setAttribute("aria-label",a)),u({spriteClass:"commandSprite",imageClass:e},q,a),q.classList.add("orionButton"));q.dropdown=new h.Dropdown({dropdown:c,populate:f,selectionClass:n,skipTriggerEventListeners:!!r,positioningNode:g});c.dropdown=q.dropdown;return{menuButton:q,menu:c,dropdown:q.dropdown,dropdownArrow:r}},createCheckedMenuItem:function(c,
b,f,p){c=m.node(c);if(!c)throw"no parent node was specified";var e=document.createRange();e.selectNode(c);e=e.createContextualFragment(a);m.processTextNodes(e,{ItemText:b});c.appendChild(e);c=m.$(".checkedMenuItem",c.lastChild);c.checked=f;c.addEventListener("change",p,!1);return c},createCommandItem:function(c,a,b,p,f,l,n){var d;l=l||!a.name&&a.hasImage();if(a.hrefCallback)d=document.createElement("a"),d.id=p,l&&a.hasImage()?u(a,d,p):(d.className="commandLink",d.appendChild(document.createTextNode(a.name))),
n=a.hrefCallback.call(b.handler,b),n.then?n.then(function(c){d.href=c}):d.href=n?n:"#";else{d=document.createElement("button");d.className="orionButton";l?a.hasImage()?(u(a,d,p),a.name&&d.setAttribute("aria-label",a.name)):(d.classList.add("commandButton"),d.classList.add("commandMissingImageButton"),d.appendChild(document.createTextNode(a.name))):(d.classList.add("commandButton"),p=document.createTextNode(a.name),d.appendChild(p));var g=n||a.callback;g&&(a.onClick=g,d.addEventListener("click",function(c){g.call(b.handler,
b)},!1))}"ul"===c.nodeName.toLowerCase()?(n=document.createElement("li"),c.appendChild(n),c=n):d.classList.add("commandMargins");c.appendChild(d);a.tooltip&&(d.commandTooltip=new e.Tooltip({node:d,text:a.tooltip,position:["above","below","right","left"]}));f&&(w[a.id]={keyBinding:f,command:a,invocation:b});return d},createCommandMenuItem:function(c,a,b,p,f,l){var n,d,g=c.dropdown;if(a.hrefCallback)d=h.createMenuItem(a.name,"a"),n=d.firstElementChild,f=a.hrefCallback.call(b.handler,b),f.then?f.then(function(c){n.href=
c}):n.href=f?f:"#",n.addEventListener("keydown",function(c){(c.keyCode===m.KEY.ENTER||c.keyCode===m.KEY.SPACE)&&n.click()},!1);else{d=h.createMenuItem(a.name);n=d.firstElementChild;var q=f||a.callback;q&&(a.onClick=q,n.addEventListener("click",function(c){g.close(!0);q.call(b.handler,b)},!1),n.addEventListener("keydown",function(c){if(c.keyCode===m.KEY.ENTER||c.keyCode===m.KEY.SPACE)c.preventDefault(),n.click()},!1))}a.tooltip&&(n.commandTooltip=new e.Tooltip({node:n,text:a.tooltip,position:["above",
"below","right","left"]}));l&&h.appendKeyBindingString(n,l);c.appendChild(d);p&&(w[a.id]={keyBinding:p,command:a,invocation:b});return n},executeBinding:f,setKeyBindingProvider:function(c){v=c},localKeyBindings:w,CommandsProxy:s,getKeyBindings:c,processKey:n,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:l}});
define("orion/explorers/navigationUtils",[],function(){function k(h,d,b,g){!m&&h&&(h.push({domNode:d}),d.tabIndex=-1,d.style.outline="none")}var m=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(h,d,b){h&&(h=h.getGridNavHolder(d,!0))&&k(h,b)},generateNavGrid:k,removeNavGrid:function(h,d){if(h)for(var b=0;b<h.length;b++)if(h[b].domNode===d){h.splice(b,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:""},d=k.indexOf("#");if(-1!==d&&(k=k.substring(d+1),0!==k.length)){k=k.split(",");h.resource=decodeURIComponent(k[0]);for(d=1;d<k.length;d++){var b=/([^=]*)(=?)(.*)/.exec(k[d]),g=decodeURIComponent(b[1]||""),b=decodeURIComponent(b[3]||"");""!==g&&"resource"!==g&&(h[g]=b)}}return h},
validateURLScheme:function(m,h){var d=m;if(-1===m.indexOf("://")){var b=document.createElement("a");b.href=m;d=b.href}b=!1;if(b=h?h.some(function(b){return RegExp("^"+b+":","i").test(d)}):k.test(d))return m;console.log("Illegal URL Scheme: '"+m+"'");return""}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(k){function m(d){var b="",g=-1!==navigator.platform.indexOf("Mac");g?(d.mod4&&(b+="\u2303"),d.mod3&&(b+="\u2325"),d.mod2&&(b+="\u21e7"),d.mod1&&(b+="\u2318")):(d.mod1&&(b+="Ctrl+"),d.mod2&&(b+="Shift+"),d.mod3&&(b+="Alt+"));if(d.alphaKey)return b+d.alphaKey;if("keypress"===d.type)return b+d.keyCode;for(var a in k.KEY)if(typeof("number"===k.KEY[a])&&k.KEY[a]===d.keyCode){if(g)switch(k.KEY[a]){case k.KEY.BKSPC:a="\u232b";break;case k.KEY.TAB:a=
"\u21e5";break;case k.KEY.ENTER:a="\u23ce";break;case k.KEY.ESCAPE:a="\u238b";break;case k.KEY.SPACE:a="\u2423";break;case k.KEY.PAGEUP:a="\u21de";break;case k.KEY.PAGEDOWN:a="\u21df";break;case k.KEY.END:a="\u21f2";break;case k.KEY.HOME:a="\u21f1";break;case k.KEY.DEL:a="\u2326"}switch(k.KEY[a]){case k.KEY.DOWN:a="\u2193";break;case k.KEY.UP:a="\u2191";break;case k.KEY.RIGHT:a="\u2192";break;case k.KEY.LEFT:a="\u2190"}return b+a}var e;switch(d.keyCode){case 59:e=d.mod2?":":";";break;case 61:e=d.mod2?
"+":"\x3d";break;case 188:e=d.mod2?"\x3c":",";break;case 190:e=d.mod2?"\x3e":".";break;case 191:e=d.mod2?"?":"/";break;case 192:e=d.mod2?"~":"`";break;case 219:e=d.mod2?"{":"[";break;case 220:e=d.mod2?"|":"\\";break;case 221:e=d.mod2?"}":"]";break;case 222:e=d.mod2?'"':"'"}return e?b+e:112<=d.keyCode&&123>=d.keyCode?b+"F"+(d.keyCode-111):b+String.fromCharCode(d.keyCode)}function h(d){var b=-1!==window.navigator.platform.indexOf("Mac");return b&&d.metaKey||!b&&d.ctrlKey}return{getUserKeyString:function(d){var b=
"";d=d.getKeys();for(var g=0;g<d.length;g++)0!==g&&(b+=" "),b+=m(d[g]);return b},getUserText:function(d){var b=d.id,g=d.refNode,a=d.hideRefNode,e=d.initialText,f=d.onComplete,l=d.onEditDestroy,c=d.selectTo,n=d.isInitialValid;d=d.insertAsChild;var q=!1,s=function(c){return function(d){if(!q){var s=k.node(b),h=s.value;s&&(c&&d.keyCode===k.KEY.ESCAPE?(a&&(g.style.display="inline"),q=!0,s.parentNode.removeChild(s),l&&l()):c&&d.keyCode!==k.KEY.ENTER||(0===h.length||!n&&h===e?a&&(g.style.display="inline"):
(f(h),a&&g.parentNode&&(g.style.display="inline")),q=!0,s.parentNode&&s.parentNode.removeChild(s),l&&l()))}}},h=document.createElement("input");h.id=b;h.value=e||"";d?g.appendChild(h):g.parentNode.insertBefore(h,g.nextSibling);h.classList.add("userEditBoxPrompt");a&&(g.style.display="none");h.addEventListener("keydown",s(!0),!1);h.addEventListener("blur",s(!1),!1);window.setTimeout(function(){h.focus();if(e){var a=k.node(b),f=c?e.indexOf(c):-1;0<f?a.createTextRange?(a=a.createTextRange(),a.collapse(!0),
a.moveStart("character",0),a.moveEnd("character",f),a.select()):a.setSelectionRange?a.setSelectionRange(0,f):void 0!==a.selectionStart&&(a.selectionStart=0,a.selectionEnd=f):a.select()}},0)},openInNewWindow:h,followLink:function(d,b){b&&h(b)?window.open(d):window.location=d},createButton:function(d,b){var g=document.createElement("button");g.className="orionButton commandButton commandMargins";g.addEventListener("click",function(a){b();k.stop(a)},!1);d&&g.appendChild(document.createTextNode(d));return g},
createDropdownButton:function(d,b,g){},isFormElement:function(d){switch(d.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,m,h,d,b,g,a,e,f,l){function c(c){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(c);this._parameterCollector=
null}function n(c,a){this.token=c;this.parameterName=a}function q(c,a,b){this.event=c;this.handler=a;this.capture=b||!1}function s(c,a,b,f,e,l){this.name=c;this.type=a;this.label=b;this.value=f;this.lines=e||1;this.eventListeners=Array.isArray(l)?l:l?[l]:[]}function u(c,a,b){this._storeParameters(c);this._hasOptionalParameters=a&&a.hasOptionalParameters;this._options=a;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=a&&a.clientCollect}c.prototype={_init:function(c){this._selectionService=
c.selection;var a=this;k.setKeyBindingProvider(function(){return a._activeBindings})},processURL:function(c){for(var a in this._urlBindings)if(this._urlBindings[a]&&this._urlBindings[a].urlBinding&&this._urlBindings[a].command){var b=this._urlBindings[a].urlBinding.match(c);if(b){var f=this._urlBindings[a],e=f.command,l=f.invocation;if(l&&l.parameters&&e.callback){l.parameters.setValue(b.parameterName,b.parameterValue);var n=this;window.setTimeout(function(){n._invoke(l)},0);break}}}},findCommand:function(c){return this._commandList[c]},
runCommand:function(c,a,b,f){a?(c=this._commandList[c])&&(c.visibleWhen?c.visibleWhen(a):1)&&c.callback&&this._invoke(new k.CommandInvocation(b,a,null,c,this),f):(a=this._urlBindings[c])&&a.command&&a.command.callback&&this._invoke(a.invocation,f)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(c){this._parameterCollector=c},openParameterCollector:function(c,a,b){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(c,
a,b))},confirm:function(c,a,b,f,e,l){var n=!1;if(this._parameterCollector&&!e){var p=this;this._parameterCollector.close();if(this._parameterCollector.open(c,function(c,e){var l=document.createElement("span");l.classList.add("parameterPrompt");l.textContent=a;c.appendChild(l);l=document.createElement("button");l.addEventListener("click",function(c){n=!0;p._parameterCollector.close()},!1);e.appendChild(l);l.appendChild(document.createTextNode(b));l.className="dismissButton";var d=document.createElement("button");
d.addEventListener("click",function(c){n=!1;p._parameterCollector.close()},!1);e.appendChild(d);d.appendChild(document.createTextNode(f));d.className="dismissButton";return l},function(){l(n)}))return}n=window.confirm(a);l(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(c,a){return this._collectAndInvoke(c.makeCopy(a),!1)},_collectAndInvoke:function(c,b){if(c)if(this._parameterCollector&&
c.parameters&&c.parameters.hasParameters()&&(b||c.parameters.shouldCollectParameters())){var f=!1;c.parameters.updateParameters(c);if(c.parameters.shouldCollectParameters()&&(f=this._parameterCollector.collectParameters(c),!f)){var e=new a.Tooltip({node:c.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),f=e.contentContainer();f.classList.add("parameterPopup");var l=window.document.activeElement,n=this._parameterCollector.getFillFunction(c,
function(){l&&l.focus();e.destroy()})(f);e.show();window.setTimeout(function(){n.focus();n.select()},0);f=!0}f||c.command.callback.call(c.handler||window,c)}else c.command.callback.call(c.handler||window,c);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(c){this._collectAndInvoke(c,!0)},showKeyBindings:function(c){function a(c){return function(){k.executeBinding(c)}}var b={},f,e,l=[],n;for(n in this._activeBindings)(e=
this._activeBindings[n])&&e.keyBinding&&e.command&&(e.command.name||e.command.tooltip)&&l.push(e);l.sort(function(c,a){return(c.command.name||c.command.tooltip).localeCompare(a.command.name||a.command.tooltip)});for(n=0;n<l.length;n++)e=l[n],e.keyBinding.scopeName?(b[e.keyBinding.scopeName]||(b[e.keyBinding.scopeName]=[]),b[e.keyBinding.scopeName].push(e)):(f=d.getUserKeyString(e.keyBinding),c.createItem(f,e.command.name||e.command.tooltip,a(e)));for(var p in b)b[p].length&&0<b[p].length&&(c.createHeader(p),
b[p].forEach(function(b){f=d.getUserKeyString(b.keyBinding);c.createItem(f,b.command.name||b.command.tooltip,a(b))}))},addCommand:function(c){this._commandList[c.id]=c;var a=this._pendingBindings[c.id];if(a){var b=this;a.forEach(function(a){b._addBinding(c,a.type,a.binding,a.bindingOnly)});delete this._pendingBindings[c.id]}},addCommandGroup:function(c,a,b,f,e,l,n,p,y,d){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});c=this._contributionsByScopeId[c];e&&(c=this._createEntryForPath(c,
e));c[a]?(f&&(c[a].title=f),b&&(c[a].position=b),n&&(c[a].imageClass=n),p&&(c[a].tooltip=p),y&&(c[a].selectionClass=y),!0===d?c[a].pretendDefaultActionId=!0:c[a].defaultActionId=d,c[a].emptyGroupMessage=l):(c[a]={title:f,position:b,emptyGroupMessage:l,imageClass:n,tooltip:p,selectionClass:y,defaultActionId:!0===d?null:d,pretendDefaultActionId:!0===d,children:{}},c.sortedContributions=null)},_createEntryForPath:function(c,a){a&&a.split("/").forEach(function(a){1<a.length&&(c[a]||(c[a]={position:0,
children:{}},c.sortedContributions=null),c=c[a].children)});return c},registerSelectionService:function(c,a){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});this._contributionsByScopeId[c].localSelectionService=a},registerCommandContribution:function(c,a,b,f,e,l,n){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});c=this._contributionsByScopeId[c];f&&(c=this._createEntryForPath(c,f));c[a]={position:b};l&&((b=this._commandList[a])?this._addBinding(b,"key",
l,e):this._addPendingBinding(a,"key",l,e));n&&((b=this._commandList[a])?this._addBinding(b,"url",n,e):this._addPendingBinding(a,"url",n,e));c.sortedContributions=null},unregisterCommandContribution:function(c,a,b){if(this._contributionsByScopeId[c]){delete this._commandList[a];delete this._activeBindings[a];delete this._urlBindings[a];delete this._pendingBindings[a];var f=this._contributionsByScopeId[c];b&&b.split("/").forEach(function(c){1<c.length&&f[c]&&(f=f[c].children)});delete f[a];f.sortedContributions=
null}},_addBinding:function(c,a,b,f){if(!c.id)throw Error("No command id: "+c);"key"===a?this._activeBindings[c.id]={command:c,keyBinding:b,bindingOnly:f}:"url"===a&&(this._urlBindings[c.id]={command:c,urlBinding:b,bindingOnly:f})},_addPendingBinding:function(c,a,b,f){this._pendingBindings[c]=this._pendingBindings[c]||[];this._pendingBindings[c].push({type:a,binding:b,bindingOnly:f})},_checkForTrailingSeparator:function(c,a,f){var e;if("tool"===a||"button"===a)if((e=0<c.childNodes.length?c.childNodes[c.childNodes.length-
1]:null)&&e.classList.contains("commandSeparator"))return f?(c.removeChild(e),!1):!0;if("menu"===a&&(c=b.$$array("li \x3e *",c),0<c.length&&c[c.length-1].classList.contains("dropdownSeparator")))if(e=c[c.length-1],f)e.parentNode.parentNode.removeChild(e.parentNode);else return!0;return!1},renderCommands:function(c,a,f,e,l,n,d){if("string"!==typeof c)throw"a scope id for rendering must be specified";a=b.node(a);if(!a)throw"no parent";var p=this._contributionsByScopeId[c];if(!f&&p){f=p.localSelectionService||
this._selectionService;var y=this;f&&f.getSelections(function(b){y.renderCommands(c,a,b,e,l,n)})}else p&&(this._render(p,a,f,e,l||"button",n,d),this._checkForTrailingSeparator(a,l,!0))},destroy:function(c){c=b.node(c);if(!c)throw"no parent";for(;c.hasChildNodes();){var a=c.firstChild;a.commandTooltip&&a.commandTooltip.destroy();a.emptyGroupTooltip&&a.emptyGroupTooltip.destroy();this.destroy(a);c.removeChild(a)}},_render:function(c,b,f,e,l,n,g){var p=c.sortedContributions;if(!p){var p=[],y=!1,B;for(B in c)if(Object.prototype.hasOwnProperty.call(c,
B)){var q=c[B];q&&"number"===typeof q.position&&(q.id=B,p.push(q),y=!0)}y&&(p.sort(function(c,a){return c.position-a.position}),c.sortedContributions=p)}var s=0,h=this;p.forEach(function(c){var p;c.imageClass||(c.imageClass=null);if(c.children&&0<Object.getOwnPropertyNames(c.children).length){var y=c.children;if("tool"===l||"button"===l)if(c.title){var B;c.defaultActionId&&((y=h._commandList[c.defaultActionId])&&(y.visibleWhen?y.visibleWhen(f):1)?(B=new k.CommandInvocation(e,f,n,y,h),B.domParent=
b):c.pretendDefaultActionId=!0);y=h._createDropdownMenu(b,c.title,null,null,c.imageClass,c.tooltip,c.selectionClass,null,B,c.pretendDefaultActionId);g&&m.generateNavGrid(g,y.menuButton);y&&(h._render(c.children,y.menu,f,e,"menu",n,g),h._checkForTrailingSeparator(y.menu,"menu",!0),0===y.menu.childNodes.length?c.emptyGroupMessage?y.menuButton.emptyGroupTooltip||(y.menuButton.emptyGroupTooltip=new a.Tooltip({node:y.menuButton,text:c.emptyGroupMessage,trigger:"click",position:["below","right","above",
"left"]})):(g&&m.removeNavGrid(g,y.menuButton),c=function(c){c&&c.parentNode&&c.parentNode.removeChild(c)},c(y.menu),c(y.menuButton),c(y.destroyButton)):y.menuButton.style.visibility="visible")}else{var q;0<b.childNodes.length&&!h._checkForTrailingSeparator(b,l)&&(q=h.generateSeparatorImage(b));h._render(y,b,f,e,l,n,g);0<b.childNodes.length&&b.childNodes[b.childNodes.length-1]!==q&&(q=h.generateSeparatorImage(b))}else if(c.title){if(c=h._createDropdownMenu(b,c.title,!0,null,null,c.imageClass))h._render(y,
c.menu,f,e,"menu",n,g),h._checkForTrailingSeparator(c.menu,"menu",!0),0===c.menu.childNodes.length&&c.destroyButton&&b.removeChild(c.destroyButton)}else 0<b.childNodes.length&&h._generateMenuSeparator(b),h._render(y,b,f,e,l,n,g),h._generateMenuSeparator(b)}else{var C=h._commandList[c.id],y=C?!0:!1;B=c=null;if(C){p=new k.CommandInvocation(e,f,n,C,h);p.domParent=b;q=!1;try{q=y&&(C.visibleWhen?C.visibleWhen(f):!0)}catch(u){throw console.log(u),u;}h._activeBindings[C.id]&&h._activeBindings[C.id].keyBinding&&
(c=h._activeBindings[C.id],c.invocation=q?p:null,c.bindingOnly&&(y=!1));h._urlBindings[C.id]&&h._urlBindings[C.id].urlBinding&&(B=h._urlBindings[C.id],B.invocation=q?p:null,B.bindingOnly&&(y=!1));y=y&&q}y&&(C.choiceCallback?("tool"===l||"button"===l?(c=b,y=!1,"ul"===b.nodeName.toLowerCase()&&(c=document.createElement("li"),b.appendChild(c))):(c=b,y=!0),h._createDropdownMenu(c,C.name,y,function(c){C.populateChoicesMenu(c,f,e,n,h)}.bind(C),C.imageClass,C.tooltip||C.title,C.selectionClass,C.positioningNode)):
(p.handler=p.handler||this,p.domParent=b,y=function(c){h._invoke(p)},"menu"===l?(B=null,c&&c.keyBinding&&(B=d.getUserKeyString(c.keyBinding)),c=k.createCommandMenuItem(b,C,p,null,y,B)):(c=l+C.id+s,c=k.createCommandItem(b,C,p,c,null,"tool"===l,y)),m.generateNavGrid(g,c),p.domNode=c,s++))}})},_createDropdownMenu:function(c,f,e,n,d,q,s,p,y,B){c=b.node(c);if(!c||!b.contains(document.body,c))return null;var C,h,u=c;if(e)q=document.createRange(),q.selectNode(c),q=q.createContextualFragment(l),b.processTextNodes(q,
{ButtonText:f}),c.appendChild(q),h=c.lastChild,d=h.lastChild,f=d.previousSibling,f.dropdown=new g.Dropdown({dropdown:d,populate:n,parentDropdown:c.dropdown}),d.dropdown=f.dropdown;else{"ul"===c.nodeName.toLowerCase()&&(u=document.createElement("li"),c.appendChild(u),h=u);c=null;d&&(c="dropdownButtonWithIcon",q=q||f);q=d?q||f:q;var G=k.createDropdownMenu(u,f,n,c,d,!1,s,p,y||B);C=G.dropdownArrow;f=G.menuButton;if(C){y&&(y.domNode=G.menuButton);var m=this;f.onclick=function(c){var a=b.bounds(C);c.clientX>=
a.left&&G.dropdown?G.dropdown.toggle(c):m._invoke(y)};G.dropdown&&(f.onkeydown=function(c){b.KEY.DOWN===c.keyCode&&(G.dropdown.toggle(c),b.stop(c))})}d=G.menu;var F;(n=y&&y.command&&(y.command.tooltip||y.command.name))?F=y.command.tooltip||y.command.name:n&&(F=q);F&&(f.commandTooltip=new a.Tooltip({node:f,text:F,position:["above","below","right","left"]}))}return{menuButton:f,menu:d,dropdown:f.dropdown,destroyButton:h,dropdownArrow:C}},_generateMenuSeparator:function(c){if(!this._checkForTrailingSeparator(c,
"menu")){var a=document.createElement("li");a.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");a.appendChild(b);c.appendChild(a)}},generateSeparatorImage:function(c){var a;a="ul"===c.nodeName.toLowerCase()?document.createElement("li"):document.createElement("span");c.appendChild(a);a.classList.add("core-sprite-sep");a.classList.add("imageSprite");a.classList.add("commandSeparator");return a}};c.prototype.constructor=c;n.prototype={match:function(c){c=
h.matchResourceParameters(c);return"undefined"!==typeof c[this.token]?(this.parameterValue=c[this.token],this):null}};n.prototype.constructor=n;q.prototype.constructor=q;s.prototype={optionsRequested:function(){return this.optionsRequested}};s.prototype.constructor=s;u.prototype={_storeParameters:function(c){this.parameterTable=null;if(c){var a=this.parameterTable={};c.forEach(function(c){a[c.name]=c})}},updateParameters:function(c){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(c))},
hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(c){return this.parameterTable[c]},valueFor:function(c){return(c=this.parameterTable[c])?c.value:null},setValue:function(c,a){var b=this.parameterTable[c];b&&(b.value=a)},forEach:function(c){for(var a in this.parameterTable)this.parameterTable[a].type&&this.parameterTable[a].name&&c(this.parameterTable[a])},makeCopy:function(){var c=
[];this.forEach(function(a){a=new s(a.name,a.type,a.label,a.value,a.lines,a.eventListeners);c.push(a)});var a=new u(c,this._options,this.getParameters);a.clientCollect=this.clientCollect;return a},hasOptionalParameters:function(){return this._hasOptionalParameters}};u.prototype.constructor=u;return{CommandRegistry:c,URLBinding:n,ParametersDescription:u,CommandParameter:s,CommandEventListener:q}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(k,m,h){function d(b,d){this._activeContainer=null;this._getElementsFunction=b;this._toolbarLayoutFunction=d}d.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(b,d,a){"string"===typeof b&&(b=h.node(b));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===b)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(b))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=a;var e=d(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!e)return!1;this._activeElements.focusNode=e;b=h.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===b.length){d=this._activeElements.dismissArea||
this._activeElements.parameterArea;b=document.createElement("button");b.id="closebox";b.className="imageSprite core-sprite-close dismissButton";b.title=k.Close;d.appendChild(b);var f=this;b.addEventListener("click",function(a){f.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);e&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){e.focus();e.select&&e.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(b,d){h.$$array("input",d).forEach(function(a){"checkbox"===a.type?b.parameters.setValue(a.parameterName,a.checked):"button"!==a.type&&b.parameters.setValue(a.parameterName,a.value.trim())});h.$$array("textArea",d).forEach(function(a){b.parameters.setValue(a.parameterName,a.value.trim())});b.command.callback&&b.command.callback.call(b.handler,b)},collectParameters:function(b){return b.parameters?
(b.domNode&&b.domNode.classList.add("commandMarker"),this.open(b.domNode||b.domParent,this.getFillFunction(b))):!1},getFillFunction:function(b,d){var a=this;return function(e,f){var l=null,c=function(){d&&d();a.close()},n=function(f){f.keyCode===h.KEY.ENTER&&a._collectAndCall(b,e);if(f.keyCode===h.KEY.ESCAPE||f.keyCode===h.KEY.ENTER)c(),h.stop(f)};b.parameters.forEach(function(a){var f=null;a.label&&(f=document.createElement("label"),f.classList.add("parameterInput"),f.setAttribute("for",a.name+"parameterCollector"),
f.textContent=a.label,e.appendChild(f));var d=a.name+"parameterCollector",q,f=f||e;"text"===a.type&&"number"===typeof a.lines&&1<a.lines?(q=document.createElement("textarea"),q.rows=a.lines,q.type="textarea",q.id=d,f.appendChild(q),n=function(a){a.keyCode===h.KEY.ESCAPE&&(c(),h.stop(a))}):"boolean"===a.type?(q=document.createElement("input"),q.type="checkbox",q.id=d,f.appendChild(q),a.value&&(q.checked=!0)):(q=document.createElement("input"),q.type=a.type,q.id=d,f.appendChild(q),a.value&&(q.value=
a.value));q.classList.add("parameterInput");q.setAttribute("speech","speech");q.setAttribute("x-webkit-speech","x-webkit-speech");q.parameterName=a.name;l||(l=q);0<a.eventListeners.length&&a.eventListeners.forEach(function(c){q.addEventListener(c.event,function(a){return c.handler(a,b)},c.capture)});q.addEventListener("keydown",n,!1)});var q=f;q||(q=document.createElement("span"),q.classList.add("layoutRight"),q.classList.add("parametersDismiss"),e.appendChild(q));var s=function(c,a){var b=document.createElement("button");
a.appendChild(b);c&&b.appendChild(document.createTextNode(c));b.classList.add("dismissButton");return b};b.parameters.hasOptionalParameters()&&(b.parameters.optionsRequested=!1,s(k.More,q).addEventListener("click",function(){b.parameters.optionsRequested=!0;a._collectAndCall(b,e);c()},!1));s(k.Submit,q).addEventListener("click",function(){a._collectAndCall(b,e);c()},!1);q=s(null,q);q.id="closebox";q.classList.add("imageSprite");q.classList.add("core-sprite-close");q.title=k.Close;q.addEventListener("click",
function(a){c()},!1);return l}}};d.prototype.constructor=d;return{CommandParameterCollector:d}});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(a,c){if("string"!==typeof a)return null;for(var b=a&&a.split(".").pop(),f=null,e=0;e<c.length;e++){var d=c[e],g;g=f;var h=d,k=b,m=0<=h.filename.indexOf(a),A;A=k.toLowerCase();A=-1!==h.extension.indexOf(A);if(m||A){if(!(A=!g))m&&(k=k.toLowerCase(),m=-1!==g.extension.indexOf(k)),A=m;A&&(g=h)}g===d&&(f=d)}return f}function m(a){return null===a||"undefined"===typeof a?[]:Array.isArray(a)?a:[a]}function h(a){return m(a).map(function(c){return String.prototype.toLowerCase.call(c)})}
function d(a){return{id:a.id,name:a.name,image:a.image,imageClass:a.imageClass,"extends":a["extends"],extension:h(a.extension),filename:m(a.filename)}}function b(a){var c=Object.create(null);a.map(d).forEach(function(a){Object.prototype.hasOwnProperty.call(c,a.id)||(c[a.id]=a)});return c}function g(l){if(l&&l.registerService){this.serviceRegistry=l;for(var c=l.getServiceReferences(e).concat(l.getServiceReferences(f)),n=[],d=0;d<c.length;d++)for(var g=m(c[d].getProperty("contentTypes")),h=0;h<g.length;h++)n.push(g[h]);
this.map=b(n);l.registerService(a,this)}else if(Array.isArray(l))this.serviceRegistry=null,this.map=b(l);else throw Error("Invalid parameter");}var a="orion.core.contentTypeRegistry",e="orion.core.contenttype",f="orion.file.contenttype";g.prototype={getContentTypes:function(){var a=this.getContentTypesMap(),c=[],b;for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&c.push(a[b]);return c},getContentTypesMap:function(){return this.map},getFileContentType:function(a){return k(a.Name,this.getContentTypes())},
getFilenameContentType:function(a){return k(a,this.getContentTypes())},getContentType:function(a){return this.map[a]||null},isExtensionOf:function(a,c){a="string"===typeof a?this.getContentType(a):a;c="string"===typeof c?this.getContentType(c):c;if(!a||!c)return!1;if(a.id===c.id)return!0;for(var b=a,f={};b&&(b=this.getContentType(b["extends"]));){if(b.id===c.id)return!0;if(f[b.id])throw Error("Cycle: "+b.id);f[b.id]=!0}return!1},isSomeExtensionOf:function(a,c){for(var b=0;b<c.length;b++)if(this.isExtensionOf(a,
c[b]))return!0;return!1}};return{ContentTypeRegistry:g,getFilenameContentType:k}});
define("orion/URITemplate",[],function(){function k(c){this._text=c}function m(c){return c.replace("%25","%")}function h(c,a){if("U"===a)return encodeURIComponent(c).replace(/[!'()*]/g,function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===a)return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(l,m);if("U+R-,"===a)return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+a);}function d(c,a,b){for(var f=
[],e=0;e<c.length;e++)"undefined"!==typeof c[e]&&f.push(h(c[e],a));return f.join(b)}function b(c,a,b,f){for(var e=Object.keys(c),l=[],d=0;d<e.length;d++)"undefined"!==typeof c[e[d]]&&l.push(h(e[d],a)+b+h(c[e[d]],a));return l.join(f)}function g(c){if(0===c.length)throw Error("Invalid Expression: 0 length expression");(this._operator=e[c[0]])?c=c.substring(1):this._operator=e.NUL;for(var a=[],b=c.split(","),l=0;l<b.length;l++){var d=b[l].match(f);if(null===d)throw Error("Bad VarSpec: "+c);a.push({name:d[1],
explode:!!d[2],prefix:d[3]?parseInt(d[3],10):-1})}this._varSpecList=a}function a(c){for(var a=[],b=0,f=c.indexOf("{",b);-1!==f;){a.push(new k(c.substring(b,f)));b=c.indexOf("}",f+1);if(-1===b)throw Error("Invalid template: "+c);a.push(new g(c.substring(f+1,b)));b+=1;f=c.indexOf("{",b)}a.push(new k(c.substring(b)));this._templateComponents=a}var e={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-,"}},f=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,l=/%25[0-9A-F][0-9A-F]/g;k.prototype={expand:function(c){return encodeURI(this._text)}};
g.prototype={expand:function(c){for(var a=[],f=0;f<this._varSpecList.length;f++){var e=this._varSpecList[f],l=e.name,g=c[l],k=typeof g;if("undefined"!==k&&null!==g){var v=0===a.length?this._operator.first:this._operator.sep;if("string"===k)this._operator.named&&(v+=h(l,"U+R"),v+=0===g.length?this._operator.ifemp:"\x3d"),-1!==e.prefix&&e.prefix<g.length&&(g=g.substring(0,e.prefix)),v+=h(g,this._operator.allow);else if(Array.isArray(g)){if(0===g.length)continue;e.explode?v+=d(g,this._operator.allow,
this._operator.sep):(e=d(g,this._operator.allow,","),this._operator.named&&(v+=h(l,"U+R"),v+=0===e.length?this._operator.ifemp:"\x3d"),v+=e)}else if("object"===k){if(0===Object.keys(g).length)continue;e.explode?v+=b(g,this._operator.allow,"\x3d",this._operator.sep):(e=b(g,this._operator.allow,",",","),this._operator.named&&(v+=h(l,"U+R"),v+=0===e.length?this._operator.ifemp:"\x3d"),v+=e)}else throw Error("bad param type: "+l+" : "+k);a.push(v)}}return a.join("")}};a.prototype={expand:function(c){for(var a=
[],b=0;b<this._templateComponents.length;b++)a.push(this._templateComponents[b].expand(c));return a.join("")}};return a});
define("orion/i18nUtil",["require","orion/Deferred"],function(k,m){function h(b){if(b=localStorage.getItem("orion/messageBundle/"+b))if(b=JSON.parse(b),b._expires&&b._expires>(new Date).getTime())return delete b._expires,b;return null}var d={};return{getMessageBundle:function(b){function g(c){c?k(["i18n!"+b],function(c){if(c){var a=b;c._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+a,JSON.stringify(c));delete c._expires}e.resolve(c)}):a(Error(b))}function a(c){e.reject(c)}
if(d[b])return d[b];var e=new m;d[b]=e;var f=h(b);if(f)return e.resolve(f),e;try{k([b],g,a)}catch(l){k(["orion/i18n!"+b],g,a)}return e},formatMessage:function(b){var d=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(a,b){return d[(b<<0)+1]})}}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(k,m,h,d,b,g,a){function e(){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 f(c){var a={};c.getPropertyKeys().forEach(function(b){"objectClass"!==b&&"service.names"!==b&&"service.id"!==b&&"__plugin__"!==b&&(a[b]=c.getProperty(b))});return a}function l(c){return b.getMessageBundle(c.nls).then(function(a){c.textContent=
c.nameKey?a[c.nameKey]:c.name;return c},function(a){c.textContent=c.nameKey||c.name;return c})}function c(c,a){var b=c.getServiceReferences(a||"orion.page.link"),n=h.matchResourceParameters(window.location.href),g={OrionHome:e(),Location:n.resource},q=[];b.forEach(function(c){c=f(c);if(c.uriTemplate&&(c.nls||c.name)){var a=(new d(c.uriTemplate)).expand(g),a=h.validateURLScheme(a);c.href=a;c.nls?q.push(l(c)):(c.textContent=c.name,q.push((new m).resolve(c)))}});return m.all(q)}function n(c){var a=this.categories=
Object.create(null);c.forEach(function(c){a[c.id]=c})}function q(c){this.allPageLinks=c;this.allPageLinks.sort(s)}function s(c,a){var b=c.textContent&&c.textContent.toLowerCase(),f=a.textContent&&a.textContent.toLowerCase();return b<f?-1:b>f?1:0}var u;g.mixin(n.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(c){return this.categories[c]||null}});g.mixin(q.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(c){var a=c.href;c=
c.textContent;var b=document.createElement("a");b.href=a;b.target="_self";b.classList.add("targetSelector");b.textContent=c;return b})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(c){var a;return!u?(a=[],c.getServiceReferences("orion.page.link.category").forEach(function(c){c=f(c);if(c.id&&(c.name||c.nameKey))c.nls?a.push(l(c)):(c.textContent=c.name,a.push((new m).resolve(c)))}),m.all(a).then(function(c){return u=new n(c)})):(new m).resolve(u)},getPageLinksInfo:function(a,
b){return c(a,b).then(function(c){return new q(c)})},getOrionHome:e}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});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,m,h,d,b,g,a,e,f,l){function c(c){var a={};c.getPropertyKeys().forEach(function(b){a[b]=c.getProperty(b)});return a}var n={},q=f.getOrionHome();n._cloneItemWithoutChildren=function t(c){if(null===c||"object"!==typeof c)return c;var a=c.constructor(),b;for(b in c)"children"!==b&&"Children"!==
b&&(a[b]=t(c[b]));return a};n._getOpenWithNavCommandExtensions=function(c,a){function b(c,a){for(var p=c.getServiceReferences("orion.navigate.openWith"),f=[],e=[],l=0;l<p.length;l++){var y=p[l];if(y.getProperty("editor")===a.id){var n=y.getProperty("contentType");n instanceof Array?f=f.concat(n):f.push(n||"*/*");y=y.getProperty("excludedContentTypes");y instanceof Array?e=e.concat(y):null!==y&&"undefined"!==typeof y&&e.push(y)}}0===f.length&&(f=null);0===e.length&&(e=null);return{contentTypes:f,excludedContentTypes:e}}
for(var f=function(){for(var a=c.getServiceReferences("orion.edit.editor"),b=[],p=0;p<a.length;p++){var f=a[p],e=f.getProperty("id");b.push({id:e,"default":f.getProperty("default")||!1,name:f.getProperty("name"),nameKey:f.getProperty("nameKey"),nls:f.getProperty("nls"),uriTemplate:f.getProperty("orionTemplate")||f.getProperty("uriTemplate"),validationProperties:f.getProperty("validationProperties")||[]})}return b}(),e=[],l=0;l<f.length;l++){var p=f[l],y=b(c,p);e.push({properties:{name:p.name||p.id,
nameKey:p.nameKey,id:"eclipse.openWithCommand."+p.id,contentType:y.contentTypes,excludedContentTypes:y.excludedContentTypes,uriTemplate:p.uriTemplate,nls:p.nls,forceSingleItem:!0,isEditor:p["default"]?"default":"editor",validationProperties:p.validationProperties},service:{}})}return e};n._makeValidator=function(c,a,f,e){function l(c,a,b,p,f){var e=!1,n;if("!"===a.charAt(0))return"undefined"===typeof c[a.substring(1)];if("undefined"!==typeof c[a]){if("undefined"===typeof b)n=c[a],e=!0;else if("string"===
typeof b){if(!typeof("string"===c[a]))return!1;if(p.variableName){if(b=RegExp(b).exec(c[a]))e=b[0],n="before"===p.variableMatchPosition?c[a].substring(0,b.index):"after"===p.variableMatchPosition?c[a].substring(b.index+e.length):"only"===p.variableMatchPosition?e:c[a],e=!0}else return RegExp(b).test(c[a])}else c[a]===b&&(n=c[a],e=!0);a=p.variableName;p=p.replacements;if(e&&a&&(f[a]=n,f.itemCached=c,p)){if("string"!==typeof n)return window.console.log("Cannot replace "+a+", value is not a string: "+
n),e;for(c=0;c<p.length;c++){n=!1;if(p[c].pattern){b=p[c].pattern;var d=p[c].replacement||"";f[a]=f[a].replace(RegExp(b),d).replace(RegExp(b),d)}else n=!0;n&&window.console.log("Invalid replacements specified in validation property.  "+p[c])}}return e}return!1}function n(c,a,b,p){var f=b.match,e,d;if(0<=(e=a.indexOf("["))){if(0>(d=a.indexOf("]")))return!1;var g=a.substring(0,e),q;if(!(q=c[g])||!Array.isArray(q))return!1;e=a.substring(e+1,d);e=parseInt(e,10);if(isNaN(e))return!1;0>e&&(e+=q.length);
a=a.substring(d+1);a=g+":"+String(e)+a}return 0<=a.indexOf("|")?(e=a.substring(0,a.indexOf("|")),a=a.substring(a.indexOf("|")+1),n(c,e,b,p)?!0:n(c,a,b,p)):0<=a.indexOf(":")?(e=a.substring(0,a.indexOf(":")),a=a.substring(a.indexOf(":")+1),c[e]?n(c[e],a,b,p):!1):l(c,a,f,b,p)}function p(a,p,f){if(f.info.validationProperties)for(var e=0;e<f.info.validationProperties.length;e++){var l=f.info.validationProperties[e];if("undefined"!==typeof l.source){if(!n(a,l.source,l,f))return!1}else return window.console.log("Invalid validationProperties in "+
c.id+".  No source property specified."),!1}var e=!0,d=p?b.getFilenameContentType(a.Name,p):null,d=d||{id:"application/octet-stream"};f.info.excludedContentTypes&&p&&(e=f.info.excludedContentTypes.every(function(c){c=c.replace(/([*?])/g,".$1");return-1!==d.id.search(c)?!1:!0}));e&&f.info.contentType&&p&&(e=f.info.contentType.some(function(c){c=c.replace(/([*?])/g,".$1");return-1!==d.id.search(c)?!0:!1}));return e}return{info:c,validationFunction:function(c){"function"===typeof e&&(c=e.call(this,c));
if(c){if(Array.isArray(c)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==c.length||1>c.length)return!1}else c=[c];for(var a=0;a<c.length;a++)if(!p(c[a],f,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(c){if(this.info.uriTemplate){var a={},b;for(b in c)Object.prototype.hasOwnProperty.call(c,b)&&(a[b]=c[b]);if(this.info.validationProperties)for(b=0;b<this.info.validationProperties.length;b++){var p=this.info.validationProperties[b];
p.source&&p.variableName&&(this.itemCached===c&&this[p.variableName]||n(c,p.source,p,this),c[p.variableName]?window.console.log("Variable name "+p.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):a[p.variableName]=this[p.variableName])}a.OrionHome=q;return(new g(this.info.uriTemplate)).expand(a)}return null}}};var s=l.UnnamedCommand;n._createCommandOptions=function(c,b,f,e,l,d){function p(a,p){var y=n._makeValidator(c,f,e,d);a.visibleWhen=
y.validationFunction.bind(y);if(l)if(y.generatesURI.bind(y)())a.hrefCallback=function(c){c=Array.isArray(c.items)?c.items[0]:c.items;return y.getURI.bind(y)(c)};else{var B=c;a.callback=function(c){var p;if(B.forceSingleItem)c=Array.isArray(c.items)?c.items[0]:c.items,p=n._cloneItemWithoutChildren(c);else if(Array.isArray(c.items)){p=[];for(var e=0;e<c.items.length;e++)p.push(n._cloneItemWithoutChildren(c.items[e]))}else p=n._cloneItemWithoutChildren(c.items);if(f)var l=f.getService("orion.page.progress");
b.run?l?l.progress(b.run(p),"Running command: "+a.name):b.run(p):f&&(l?l.progress(f.getService(b).run(p),"Running command: "+a.name):f.getService(b).run(p))}}p.resolve(a)}var y=new m;if(c.nls){var B=function(a){var b;a?(b=c.tooltipKey&&a[c.tooltipKey],a=c.nameKey&&a[c.nameKey]||c.name||s,b=b||c.tooltip||""):(a=c.name||c.nameKey||s,b=c.tooltip||c.tooltipKey||"");p({name:a,image:c.image,id:c.id||c.name,tooltip:b,isEditor:c.isEditor,showGlobally:c.showGlobally},y)};a.getMessageBundle(c.nls).then(B,B.bind(this,
null))}else p({name:c.name,image:c.image,id:c.id||c.name,tooltip:c.tooltip,isEditor:c.isEditor,showGlobally:c.showGlobally},y);return y};n.getOpenWithCommand=function(c,a,b){var f;c=b||n.getOpenWithCommands(c);for(b=0;b<c.length;b++)if(c[b].visibleWhen(a)){var e="default"===c[b].isEditor;if(!f||e)if(f=c[b],e)break}return f};n.getOpenWithCommands=function(c){var a=[],b;for(b in c._commandList){var f=c._commandList[b];f.isEditor&&a.push(f)}return a};var u;n.createAndPlaceFileCommandsExtension=function(c,
a,b,f,e,d){return n.createFileCommands(c,null,d?"all":void 0,!!d,a).then(function(c){e&&0<c.length&&(a.addCommandGroup(b,"eclipse.openWith",1E3,l.OpenWith,e,null,null,null,"dropdownSelection"),a.addCommandGroup(b,"eclipse.fileCommandExtensions",1E3,l.OpenRelated,e));c.forEach(function(c){var p=null;e&&(p=c.isEditor?e+"/eclipse.openWith":e+"/eclipse.fileCommandExtensions");a.registerCommandContribution(b,c.id,f,p)});return{}})};n.createFileCommands=function(c,a,b,f,e){b=void 0===b?"global":b;f=void 0===
f?!0:f;var l=[];n._cachedFileCommands||n._createCachedFileCommands(c);("all"===b||"global"===b)&&n._cachedFileCommands.forEach(function(c){var a=c.properties;("all"===b||a.forceSingleItem&&a.showGlobally)&&l.push(c)});return m.when(function(){var b=c.getService("orion.core.contentTypeRegistry")||a;return u||m.when(b.getContentTypes(),function(c){return u=c})}(),function(){f&&(n._cachedOpenWithExtensions||(n._cachedOpenWithExtensions=n._getOpenWithNavCommandExtensions(c,u)),l=l.concat(n._cachedOpenWithExtensions),
e._addedOpenWithCommands=f);var a=l.map(function(a){var b=a.properties;a=a.service;var p=e.findCommand(b.id||b.name);return p?(new m).resolve(p):n._createCommandOptions(b,a,c,u,!0).then(function(c){c=new h.Command(c);e.addCommand(c);return c})});return m.all(a,function(c){return{_error:c}}).then(function(c){return c})})};n._createCachedFileCommands=function(a){var b=a.getServiceReferences("orion.navigate.command");n._cachedFileCommands=[];for(var f=0;f<b.length;f++)if("orion.navigateFromMetadata"!==
b[f].getProperty("id")){var e=a.getService(b[f]),l=c(b[f]);n._cachedFileCommands.push({properties:l,service:e})}};n.getFileCommandIds=function(){var c=[];if(n._cachedFileCommands)n._cachedFileCommands.length&&(c=n._cachedFileCommands.map(function(c){return c.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return c};n.createOpenWithCommands=function(c,a,b){return b&&b._addedOpenWithCommands?(new m).resolve(n.getOpenWithCommands(b)):n.createFileCommands(c,a,
"none",!0,b)};return n});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(k,m){function h(d){this._init(d)}h.prototype={_init:function(d){var b=m.node(d.container);if(!b)throw"no parent container";this._container=b;b.classList.remove("currentLocation");this._id=d.id||"eclipse.breadcrumbs";this._resource=d.resource||null;this._rootSegmentName=d.rootSegmentName;this._workspaceRootSegmentName=d.workspaceRootSegmentName;this._workspaceRootURL=d.workspaceRootURL;this._makeHref=d.makeHref;this._makeFinalHref=
d.makeFinalHref;this._maxLength=d.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var d;if(this._resource&&this._resource.Parents&&!this._resource.skip){d=document.createElement("a");var b=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(d,b):d.href=k.toUrl("edit/edit.html")+"#"+b}else d=document.createElement("span");m.empty(d);d.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return d}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(d){var b=document.createElement("a");b.classList.add("breadcrumb");b.appendChild(document.createTextNode(d));return b},addSegmentHref:function(d,b){this._makeHref?this._makeHref(d,b.Location,b):d.href=k.toUrl("edit/edit.html")+"#"+b.ChildrenLocation},buildSegments:function(d,b){if(this._resource.Parents){var g=this._resource.Parents.slice(0),a,e;g&&(g=g.slice(0),"reverse"===b&&(g=g.reverse().slice(0)),
g.forEach(function(b){b.skip||(d?(e=d,d=null):e=b.Name,a=this.buildSegment(e),this.path+=b.Name,this.addSegmentHref(a,b),a.include=!1,this.segments.push(a))}.bind(this)))}},addDivider:function(){var d=document.createElement("span");d.appendChild(document.createTextNode(" / "));this.path+="/";d.classList.add("breadcrumbSeparator");this.append(d)},refresh:function(){(this.crumbs=m.node(this._id))?m.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(d){this.crumbs.appendChild(d)},addTitle:function(d,b){var g=b||document.title;0===this.crumbs.childNodes.length&&(d=document.createElement("span"),d.appendChild(document.createTextNode(g)),
d.classList.add("breadcrumb"),d.classList.add("currentLocation"),this.append(d))},finalSegment:function(d,b){if(!this._resource.skip){var g;g=b?b:this._resource.Name;this._makeFinalHref?(d=this.buildSegment(g),this.addSegmentHref(d,this._resource)):(d=document.createElement("span"),d.appendChild(document.createTextNode(g)));d.classList.add("currentLocation");this.path+=this._resource.Name;this.append(d)}},firstSegment:function(d){d&&(this.append(d),this._resource&&this._resource.Parents&&!this._resource.skip?
(d.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(d.href=""),d.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(d){!0===d.include&&(this.append(d),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var d=this.segments.slice(0).reverse();d.forEach(function(b){this.append(b);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?b.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=d.reverse()}},measure:function(){var d=this._container;d.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:d.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var d=this.getNavigatorWorkspaceRootSegment(),b=this._rootSegmentName;b?this.addTitle(d,b):(this.finalSegment(d,b),this._resource&&this._resource.Parents&&(this.buildSegments(b,"reverse"),this.measureSegments(),this.firstSegment(d)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var d=this.getNavigatorWorkspaceRootSegment(),b=this._rootSegmentName;b?this.addTitle(d,b):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(d),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(d,b)));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,m,h){function d(b){m.attach(this);this._init(b)}d.prototype={_init:function(b){this._tracking=null;this._animationDelay=501;this._closeReversely=b.closeReversely;this.$node=h.node(b.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=h.node(b.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=h.node(b.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=b.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");b.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 b.closeByDefault&&(this._closeByDefault=b.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(b){this.addEventListener("resize",function(d){b(d.node)})},_initializeFromStoredSettings:function(){var b=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof b?"closed"===b:this._closeByDefault;var b=h.bounds(this.$node.parentNode),d=h.bounds(this.$node),a;this._vertical?(a=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(a,10),this._splitTop>b.top+b.height-d.height&&(this._splitTop=b.top+b.height/
2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(a=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(a,10),this._splitLeft>b.left+b.width-d.width&&(this._splitLeft=b.left+b.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var b=h.bounds(this.$node),d=h.bounds(this.$node.parentNode);return this.vertical?b.top-d.top:b.left-d.left},_adjustToSplitPosition:function(b){var d=
h.bounds(this.$node),a=h.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=d.height;if(b||!this._splitTop)this._splitTop=d.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);b=this._splitTop;"relative"===this.$node.parentNode.style.position&&(b=this._splitTop-a.top);this.$sideNode.style.height=b+"px";this.$sideNode.style.display="block";this.$node.style.top=b+"px"}else{this._splitWidth=d.width;if(b||!this._splitLeft)this._splitLeft=d.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);b=this._splitLeft;"relative"===this.$node.parentNode.style.position&&(b=this._splitLeft-a.left);this.$sideNode.style.width=b+"px";this.$sideNode.style.display="block";this.$node.style.left=b+"px"}this._resize()},_resize:function(b,d,a){b=b||0;var e=h.bounds(this.$node.parentNode),f=h.bounds(this.$node);this._vertical?(void 0===a&&(a=f.top-e.top),a+=f.height,this.$mainNode.style.top=a+"px"):(void 0===d&&(d=f.left-e.left),d+=f.width,this.$mainNode.style.left=d+"px");var l=
this;window.setTimeout(function(){l._notifyResizeListeners(l.$mainNode);l._notifyResizeListeners(l.$sideNode)},b)},_notifyResizeListeners:function(b){this.dispatchEvent({type:"resize",node:b})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(b,d){b||this._addAnimation();var a=this._splitTop,e=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&!this._splitTop&&"number"===typeof this._initialSplit&&(a=e=this._initialSplit);
else if(this._closed=!0,this._closeReversely){var f=h.bounds(this.$node.parentNode),l=h.bounds(this.$node);this._vertical?a=f.height-l.height:e=f.width-l.width}else a=e=0;this._vertical?(this.$sideNode.style.height=a+"px",this.$node.style.top=a+"px"):(this.$sideNode.style.width=e+"px",this.$node.style.left=e+"px");this._resize(this._animationDelay,e,a);b||this._removeAnimation();d||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var c=this;window.setTimeout(function(){c._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var b=this;window.setTimeout(function(){b.$sideNode.classList.remove(b._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");b.$mainNode.classList.remove(b._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");b.$node.classList.remove(b._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(b){if(b.target===this._thumb)return h.stop(b),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(b))},_mouseMove:function(b){if(this._tracking){var d=h.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=b.clientY;this._splitTop<d.top+5?this._splitTop=d.top+5:this._splitTop>d.top+d.height-5&&(this._splitTop=d.top+d.height-5);var a=this._splitTop,a=this._splitTop-d.top;this.$node.style.top=a+"px"}else this._splitLeft=b.clientX,this._splitLeft<d.left+5?this._splitLeft=d.left+5:this._splitLeft>d.left+d.width-
5&&(this._splitLeft=d.left+d.width-5),a=this._splitLeft-2*d.left,this.$node.style.left=a+"px";this._adjustToSplitPosition(!0);h.stop(b)}},_mouseUp:function(b){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(b))}};d.prototype.constructor=d;return{Splitter:d}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(k,m,h){function d(b){this.commandRegistry=b.commandRegistry;this.create();this._filterString="";this._providers=[]}d.prototype={addProvider:function(b){this._providers.push(b)},create:function(){var b=this._keyAssistDiv=document.createElement("div");b.id="keyAssist";b.style.display="none";b.classList.add("keyAssistFloat");b.setAttribute("role","menu");var d=this._keyAssistInput=document.createElement("input");
d.classList.add("keyAssistInput");d.type="text";d.placeholder=k["Filter bindings"];b.appendChild(d);var a=this._keyAssistContents=document.createElement("div");a.classList.add("keyAssistContents");if(h.isIOS||h.isAndroid)a.style.overflowY="auto";b.appendChild(a);var e=this._keyAssistTable=document.createElement("table");e.tabIndex=0;e.classList.add("keyAssistList");a.appendChild(e);document.body.appendChild(b);d.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));e.addEventListener("keydown",
function(a){this._keyDown(a)}.bind(this));d.addEventListener("input",function(a){this.filterChanged()}.bind(this));a.addEventListener(h.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===m.KEY.ESCAPE&&this.hide()}.bind(this));m.addAutoDismiss([b],function(){this.hide()}.bind(this))},createContents:function(){m.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var b=this._idCount=
this._keyAssistContents.scrollTop=0;b<this._providers.length;b++)this._providers[b].showKeyBindings(this);this.createHeader(k.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(b,d,a){if(this._filterString){var e=this._filterString.toLowerCase(),f;e!==this._filterString?(e=this._filterString,f=function(c){return c}):f=function(c){return c.toLowerCase()};if(-1===f(d).indexOf(e)&&-1===f(b).indexOf(e)&&-1===f(this._lastHeader).indexOf(e))return}var l=this._keyAssistTable.insertRow(-1);
l.id="keyAssist-keyBinding-"+this._idCount++;l.setAttribute("role","menuitem");l._execute=a;l.classList.add("keyAssistItem");l.addEventListener("click",function(c){this._selectedRow=l;this.execute();c.preventDefault()}.bind(this));a=l.insertCell(-1);a.classList.add("keyAssistName");a.appendChild(document.createTextNode(d));a=l.insertCell(-1);a.classList.add("keyAssistAccel");a.appendChild(document.createTextNode(b))},createHeader:function(b){this._lastHeader=b;var d=this._keyAssistTable.insertRow(-1);
d.classList.add("keyAssistSection");var d=d.insertCell(-1),a=document.createElement("h2");a.appendChild(document.createTextNode(b));d.appendChild(a)},execute:function(){window.setTimeout(function(){this.hide();var b=this._selectedRow;this._selectedRow=null;b&&b._execute&&b._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var b=this._keyAssistInput.value;this._filterString!==b&&(this._filterString=
b,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var b=document.activeElement,d=this._keyAssistDiv,b=d===b||0!==(d.compareDocumentPosition(b)&16);d.style.display="none";b&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(b){b=this._providers.indexOf(b);-1!==b&&this._providers.splice(b,
1)},select:function(b){var d=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===d.length)this._selectedIndex=-1;else{var a=this._selectedIndex,a=(a+(b?1:-1))%d.length;0>a&&(a=d.length-1);-1!==this._selectedIndex&&(b=d[this._selectedIndex],b.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=a;if(-1!==this._selectedIndex){this._selectedRow=b=d[this._selectedIndex];b.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",b.id);this._keyAssistTable.focus();
var d=b.getBoundingClientRect(),e=this._keyAssistContents,f=e.getBoundingClientRect();b.offsetTop<e.scrollTop?0===a?e.scrollTop=0:b.scrollIntoView(!0):d.bottom>f.bottom&&b.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(b){if(40===b.keyCode)this.select(!0);else if(38===b.keyCode)this.select(!1);else if(13===b.keyCode)this.execute();else return;b.preventDefault()},_scrollWheel:function(b){var d=0,d=h.isIE||h.isOpera?-b.wheelDelta:h.isFirefox?40*b.detail:-b.wheelDeltaY,a=this._keyAssistContents,e=a.scrollTop;a.scrollTop+=d;if(e!==a.scrollTop)return b.preventDefault&&b.preventDefault(),!1}};return{KeyAssistPanel:d}});
define("orion/widgets/themes/ThemePreferences",[],function(){function k(k,h){this._preferences=k;this._themeData=h;var d=h.getThemeStorageInfo();this._themeVersion=d.version;var b=k.listenForChangedSettings(d.storage,2,function(d){d.key===b&&this.apply()}.bind(this))}k.prototype={_initialize:function(k,h,d){var b,g;void 0===this._themeVersion||d.get("version")===this._themeVersion?(b=d.get(k.styleset),(g=d.get("selected"))&&(g=JSON.parse(g))):g=b=null;b||(b=h.getStyles(),d.put(k.styleset,JSON.stringify(b)));
if(!g||void 0===g[k.selectedKey])g=g||{},g[k.selectedKey]=k.defaultTheme,d.put("selected",JSON.stringify(g));d.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(k){var h=this._themeData,d=h.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(b){this._initialize(d,h,b);var g=JSON.parse(b.get("selected"));b=JSON.parse(b.get(d.styleset));var a;if(b)for(var e=0;e<b.length;e++)if(b[e].name===g[d.selectedKey]){a=b[e];break}k({style:a,styles:b})}.bind(this))},
setTheme:function(k,h){var d=this._themeData,b=d.getThemeStorageInfo();this._preferences.getPreferences(b.storage,2).then(function(g){this._initialize(b,d,g);var a=JSON.parse(g.get("selected"));k||(k=a[b.selectedKey]);a[b.selectedKey]=k;g.put("selected",JSON.stringify(a));h?g.put(b.styleset,JSON.stringify(h)):h=JSON.parse(g.get(b.styleset));for(var e=0;e<h.length;e++)if(h[e].name===a[b.selectedKey]){d.processSettings(h[e]);break}g.put("version",this._themeVersion)}.bind(this))},setFontSize:function(k){var h=
this._themeData,d=h.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(b){this._initialize(d,h,b);var g=JSON.parse(b.get("selected")),a=JSON.parse(b.get(d.styleset)),e;if(a)for(var f=0;f<a.length;f++)a[f].fontSize=k,a[f].name===g[d.selectedKey]&&(e=a[f]);b.put(d.styleset,JSON.stringify(a));h.processSettings(e)}.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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/editor/eventTarget",[],function(){function k(){}k.addMixin=function(m){var h=k.prototype,d;for(d in h)h.hasOwnProperty(d)&&(m[d]=h[d])};k.prototype={addEventListener:function(k,h,d){this._eventTypes||(this._eventTypes={});var b=this._eventTypes[k];b||(b=this._eventTypes[k]={level:0,listeners:[]});b.listeners.push({listener:h,useCapture:d})},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 d=this._eventTypes?this._eventTypes[k]:null;if(d){var b=d.listeners;try{if(d.level++,b)for(var g=0,a=b.length;g<a;g++)if(b[g]){var e=b[g].listener;"function"===typeof e?e.call(this,h):e.handleEvent&&"function"===typeof e.handleEvent&&e.handleEvent(h)}}finally{if(d.level--,d.compact&&0===d.level){for(g=b.length-1;0<=g;g--)b[g]||b.splice(g,1);0===b.length&&delete this._eventTypes[k];d.compact=!1}}}},isListening:function(k){return!this._eventTypes?!1:void 0!==this._eventTypes[k]},removeEventListener:function(k,
h,d){if(this._eventTypes){var b=this._eventTypes[k];if(b){for(var g=b.listeners,a=0,e=g.length;a<e;a++){var f=g[a];if(f&&f.listener===h&&f.useCapture===d){0!==b.level?(g[a]=null,b.compact=!0):g.splice(a,1);break}}0===g.length&&delete this._eventTypes[k]}}}};return{EventTarget:k}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(k,m,h){function d(b){b=b||{};this._document=b.document||document}var b={};d.getTheme=function(g){g=g||"default";var a=b[g];a||(a=b[g]=new d);return a};d.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(b,a){var e=this,f=e._themeClass;e._themeClass=b;this._load(b,a,function(){e.onThemeChanged({type:"ThemeChanged",oldValue:f,newValue:e.getThemeClass()})})},onThemeChanged:function(b){return this.dispatchEvent(b)},
buildStyleSheet:function(b,a){function e(a,c,e){c&&(f.push("."+b+" ."+a+" {"),f.push("\t"+(e?"background-color":"color")+": "+c+";"),f.push("}"))}var f=[];f.push("");f.push("."+b+" {");a.fontFamily&&f.push("\tfont-family: "+a.fontFamily+";");a.fontSize&&f.push("\tfont-size: "+a.fontSize+";");a.fontSize&&f.push("\tcolor: "+a.text+";");f.push("}");f.push("."+b+".textview {");a.background&&f.push("\tbackground-color: "+a.background+";");f.push("}");e("ruler.annotations",a.annotationRuler,!0);e("ruler.lines",
a.annotationRuler,!0);e("ruler.folding",a.annotationRuler,!0);e("ruler.overview",a.overviewRuler,!0);e("rulerLines",a.lineNumber,!1);e("rulerLines.even",a.lineNumberEven,!1);e("rulerLines.odd",a.lineNumberOdd,!1);e("annotationLine.currentLine",a.currentLine,!0);e("entity-name-tag",a.keyword,!1);e("entity-other-attribute-name",a.attribute,!1);e("string-quoted",a.string,!1);e("meta.annotation.currentLine",a.currentLine,!0);e("keyword",a.keyword,!1);e("string",a.string,!1);e("comment",a.comment,!1);
e("comment.block.documentation",a.comment,!1);e("keyword.other.documentation.markup",a.comment,!1);return f.join("\n")},_createStyle:function(b,a,e,f){var l=this._document;b="orion-theme-"+b;var c=l.getElementById(b);if(c){if(f||c.firstChild.data===a)return;c.removeChild(c.firstChild);c.appendChild(l.createTextNode(a))}else f?(c=h.createElement(l,"link"),c.rel="stylesheet",c.type="text/css",c.href=a,c.addEventListener("load",function(){e()})):(c=h.createElement(l,"style"),c.appendChild(l.createTextNode(a))),
c.id=b,(l.getElementsByTagName("head")[0]||l.documentElement).appendChild(c);f||e()},_load:function(b,a,e){if(b)if("string"===typeof a)this._createStyle(b,a,e);else if(a=a.href,".css"!==a.substring(a.length-4)&&(a+=".css"),/^\//.test(a)||/[a-zA-Z0-9]+:\/\//i.test(a)||!k.toUrl)this._createStyle(b,a,e,!0);else{var f=this;k(["text!"+a],function(a){f._createStyle(b,a,e,!1)})}else e()}};m.EventTarget.addMixin(d.prototype);return{TextTheme:d}});
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 m(){}m.prototype.navbar="white";m.prototype.button="#777777";m.prototype.location="#EFEFEF";m.prototype.selection="#cedce7";m.prototype.sidepanel="#F7F7F7";m.prototype.mainpanel="white";m.prototype.navtext="#bfbfbf";m.prototype.content="#3087B3";m.prototype.search="#444";m.prototype.toolpanel="white";m.prototype.writeNavigationStyle=function(){var h="",d=[],b=new k.ThemeClass("orionPage");
b.style.backgroundColor="#fdfdfd";b.style.width="100%";b.style.height="100%";d.push(b);b=new k.ThemeClass("topRowBanner");b.style.margin="0";b.style.border="0";b.style.backgroundColor=this.navbar;b.style.height="16px";b.style.padding="10px";b.style.paddingLeft="6px";b.style.paddingRight="2px";b.style.borderBottom="none";b.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";b.style.zIndex="100";d.push(b);b=new k.ThemeClass("a");b.style.textDecoration="none";b.style.color=
this.content;d.push(b);b=new k.ThemeClass("navlink");b.style.display="inline-block";b.style.padding="2px";b.style.color=this.content;b.style.verticalAlign="bottom";d.push(b);b=new k.ThemeClass("primaryNav");b.style.color=this.navtext;b.style.fontSize="8pt";b.style.fontWeight="normal";b.style.paddingTop="0";b.style.verticalAlign="baseline";d.push(b);b=new k.ThemeClass("primaryNav a");b.style.fontSize="8pt";b.style.color=this.navtext;b.style.marginRight="6px";b.style.marginLeft="6px";b.style.verticalAlign=
"baseline";b.style.textDecoration="none";d.push(b);b=new k.ThemeClass("primaryNav a:hover");b.style.color="#bfbfbf";b.style.cursor="hand";b.style.color="white";b.style.fontWeight="normal";d.push(b);for(var g in d)h+=d[g].toString();return h};m.prototype.writeLocationStyle=function(){var h="",d=[],b=new k.ThemeClass("titleArea");b.style.margin="0";b.style.paddingTop="5px";b.style.border="0";b.style.background=this.location;b.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";b.style.borderBottom="1px solid "+this.location;b.style.minHeight="20px";d.push(b);b=new k.ThemeClass("breadcrumb");b.style.fontSize="8pt";b.style.textDecoration="none";b.style.color="#f1f1f2;";b.style.paddingTop="2px";d.push(b);b=new k.ThemeClass("a.breadcrumb:hover");b.style.textDecoration="none";b.style.borderBottom="1px dotted";b.style.color="#F58B0F";b.style.cursor="pointer";d.push(b);b=new k.ThemeClass("breadcrumbSeparator");b.style.fontSize=
"8pt";b.style.textDecoration="none";b.style.color=this.separator;b.style.fontWeight="bold";d.push(b);b=new k.ThemeClass("currentLocation");b.style.fontWeight="bold";b.style.fontSize="8pt";b.style.color=this.breadcrumb;b.style.textDecoration="none";b.style.textWrap="normal";b.style.lineHeight="10pt";d.push(b);b=new k.ThemeClass("a.currentLocation:hover");b.style.fontWeight="bold";b.style.fontSize="10pt";b.style.color="#666666";b.style.textDecoration="none";b.style.borderBottom="0";d.push(b);b=new k.ThemeClass("navlinkonpage");
b.style.color=this.content;b.style.verticalAlign="middle";d.push(b);this.bannerProgress&&(b=new k.ThemeClass("topRowBanner .progressPane_running"),b.style.borderColor=this.bannerProgress,d.push(b));for(var g in d)h+=d[g].toString();return h};m.prototype.writeButtonStyle=function(){var h="",d=[],b=new k.ThemeClass("commandButton");b.style.color="#666";b.style.border="1px solid #dedede";b.style.backgroundColor="#ddd";b.style.textAlign="center";b.style.verticalAlign="middle";b.style.cursor="pointer";
b.style.display="inline-block";b.style.padding="4px 6px";b.style.borderRadius="3px";b.style.lineHeight="12px";b.style.fontSize="9pt";b.style.userSelect="none";d.push(b);b=new k.ThemeClass("commandButton:over");b.style.backgroundColor="#e6e6e6";b.style.border="1px solid #808080";d.push(b);b=new k.ThemeClass("commandMenu");b.style.color="#222";b.style.display="inline-block";b.style.verticalAlign="baseline";b.style.margin="0";b.style.fontSize="8pt";b.style.fontWeight="normal";b.style.border="1px solid #dedede";
b.style.backgroundColor="#efefef";b.style.cursor="pointer";b.style.borderRadius="1px";d.push(b);b=new k.ThemeClass("commandMenuItem");b.style.border="0";b.style.padding="0";b.style.margin="0";d.push(b);for(var g in d)h+=d[g].toString();return h};m.prototype.writeMainStyle=function(){var h="",d=[],b=new k.ThemeClass("searchbox");b.style.backgroundImage="url(../images/core_sprites.png)";b.style.backgroundRepeat="no-repeat";b.style.backgroundPosition="4px -297px";b.style.width="12px";b.style.height=
"12px";b.style.backgroundColor=this.search;b.style.border="1px solid "+this.search;b.style.fontSize="11px";b.style.width="15em";b.style.height="16px";b.style.borderRadius="10px";b.style.color="#999";b.style.padding="0";b.style.paddingLeft="20px";b.style.marginLeft="5px";b.style.marginTop="6px !important";b.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";d.push(b);b=new k.ThemeClass("searchbox:focus");b.style.color="white";b.style.outline=
"none";d.push(b);b=new k.ThemeClass("checkedRow");b.style.cssText="background-color:"+this.selection+" !important;";d.push(b);b=new k.ThemeClass("navbar-item-selected");b.style.background=this.selection;b.style.color=this.content;d.push(b);b=new k.ThemeClass("auxpane");b.style.border="0";b.style.background=this.sidepanel;d.push(b);b=new k.ThemeClass("mainpane");b.style.background=this.mainpanel;b.style.border=0;d.push(b);b=new k.ThemeClass("mainToolbar");b.style.background=this.toolpanel;d.push(b);
for(var g in d)h+=d[g].toString();return h};m.prototype.render=function(h){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};m.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:m}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(k,m,h){function d(){}function b(){this.styles=[];var a=new d;a.name="Orion";a.navbar="white";a.button="#EFEFEF";a.location="#efefef";a.selection="FEC";a.sidepanel="#FBFBFB";a.mainpanel="white";a.toolpanel="white";a.navtext="#bfbfbf";a.content="#3087B3";a.search="#444";a.breadcrumb="#3087B3";a.separator="#333";a.bannerProgress="whitesmoke";
this.styles.push(a);a=new d;a.name="Orion2014";a.navbar="white";a.button="#EFEFEF";a.location="#EFEFEF";a.selection="FEC";a.sidepanel="#EEEEEE";a.mainpanel="#EEEEEE";a.toolpanel="#EEEEEE";a.navtext="#BFBFBF";a.content="#333333";a.search="#444444";a.breadcrumb="#333333";a.separator="#333333";a.bannerProgress="orange";this.styles.push(a);a=new d;a.name="Green Zone";a.navbar="seagreen";a.button="lavender";a.location="darkseagreen";a.selection="moccasin";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel=
"white";a.navtext="#FBFBFB";a.content="darkgreen";a.search="darkgreen";a.breadcrumb="#3087B3";a.separator="seagreen";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Pretty In Pink";a.navbar="plum";a.button="lavender";a.location="pink";a.selection="lavender";a.sidepanel="seashell";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumorchid";a.search="violet";a.breadcrumb="#3087B3";a.separator="plum";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name=
"Blue Monday";a.navbar="cornflowerblue";a.button="lavender";a.location="skyblue";a.selection="lavender";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="royalblue";a.search="royalblue";a.breadcrumb="#3087B3";a.separator="cornflowerblue";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Vanilla Skies";a.navbar="sandybrown";a.button="lemmonchiffon";a.location="cornsilk";a.selection="lemonchiffon";a.sidepanel="white";a.mainpanel="white";a.toolpanel=
"white";a.navtext="lemonchiffon";a.content="chocolate";a.search="moccasin";a.breadcrumb="#3087B3";a.separator="sandybrown";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Beetlejuice";a.navbar="indigo";a.button="slateblue";a.location="darkslateblue";a.selection="silver";a.sidepanel="lavender";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumslateblue";a.search="#444";a.breadcrumb="#3087B3";a.separator="indigo";a.bannerProgress="#F2F2F2";this.styles.push(a);
a=new d;a.name="Red";a.navbar="#CD2127";a.button="#777777";a.location="#D85F56";a.selection="lightcoral";a.sidepanel="#EFDAB2";a.mainpanel="#FDFADD";a.toolpanel="#FDFADD";a.navtext="#FBFBFB";a.content="darkred";a.search="#D85F56";a.breadcrumb="darkred";a.separator="#CD2127";a.bannerProgress="#F2F2F2";this.styles.push(a)}function g(){return this.styles}d.prototype.name="Orion";d.prototype.navbar="#404648";d.prototype.button="#EFEFEF";d.prototype.location="#333";d.prototype.breadcrumb="#3087B3";d.prototype.separator=
"#333";d.prototype.selection="FEC";d.prototype.sidepanel="#FBFBFB";d.prototype.mainpanel="white";d.prototype.toolpanel="white";d.prototype.navtext="#bfbfbf";d.prototype.content="#3087B3";d.prototype.search="#444";d.prototype.bannerProgress="white";b.prototype.styles=[];b.prototype.getStyles=g;b.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};b.prototype.getViewData=function(){var a={top:10,left:10,
width:350,height:350};a.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 b=0;3>b;b++)a.shapes.push({type:"TEXT",name:k.Content,label:"org.eclipse.orion.content",x:170,y:127+20*b,fill:"#3087B3",family:"content"});for(b=0;3>b;b++)a.shapes.push({type:"TEXT",name:k.Content,label:"Item",x:25,y:115+20*b,fill:"#3087B3",family:"content"});for(b=0;3>b;b++)a.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+20*b,x2:165,y2:124+20*b,x3:160,y3:127+20*b,family:"navbar",fill:"#333"});a.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return a};b.prototype.processSettings=function(a){var b=new h.ThemeSheetWriter;(new m.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",b.getSheet(a))};return{ThemeData:b,getStyles:g}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(k){function m(h,d,b){this.elements=b;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===d?(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))}m.prototype.elementNode=null;m.prototype.switchesContainer=null;m.prototype.switches=null;m.prototype.radioButtons=null;m.prototype.chosenSwitch=
null;m.prototype.addElement=function(h){var d=document.createElement("span");d.className="UAContainer-icon";d.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";d.onmouseover=function(){document.getElementById(h.label+"ImageNode").src=h.secondaryImage;
document.getElementById(h.label+"LabelNode").className="UALabel-live";d.className="UAContainer-icon-live"};d.onmouseout=function(){document.getElementById(h.label+"ImageNode").src=h.image;document.getElementById(h.label+"LabelNode").className="UALabel";d.className="UAContainer-icon"};var b=this;d.onclick=function(){b.showMedia(h)};this.elementNode.appendChild(d)};m.prototype.clearElements=function(){this.elementNode.innerHTML=""};m.prototype.showMedia=function(h){this.clearElements();this.addElement(h);
var d=document.createElement("span");d.className="UAContainer-media";d.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(d);setTimeout(function(){d.style.opacity=1},100);h=document.getElementById(h.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=h.parentNode;h.className="chosenCircle"};m.prototype.createSwitch=
function(h){var d;d=h?h.label+"switch":"indexSwitch";var b=document.createElement("span");b.className="workingSpan";b.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+d+'"\x3e\x3c/div\x3e';var g=this;b.onclick=h?function(){g.showMedia(h)}:function(){g.initialize();g.chosenSwitch.firstChild.className="circle";g.chosenSwitch=b;g.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(b);return this.radioButtons[this.radioButtons.length]=b};m.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};m.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return m});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(k,m,h,d){function b(){}var g=null;b.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 a=
document.body;this.$frameParent=a;this.$$modalExclusions=this.$$modalExclusions||[];var b=document.createRange();b.selectNode(a);b=b.createContextualFragment(this.CONTAINERTEMPLATE);a.appendChild(b);this.$frame=a.lastChild;this.title&&h.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=h.$("#closeDialog",this.$frame);var f=this;this.$close.addEventListener("click",function(a){f.hide()},!1);this.$parent=h.$(".dialogContent",this.$frame);b=document.createRange();b.selectNode(this.$parent);
a=b.createContextualFragment(this.TEMPLATE);this.messages&&h.processTextNodes(a,this.messages);this.$parent.appendChild(a);this.$buttonContainer=h.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(a){a.keyCode===h.KEY.ESCAPE?f.hide():a.keyCode===h.KEY.ENTER&&"function"===typeof f._defaultCallback&&f._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 a=this;this.buttons.forEach(function(b){var f=d.createButton(b.text,b.callback);b.id&&(f.id=b.id,a["$"+f.id]=f);b.isDefault&&(a._defaultCallback=b.callback,a._defaultButton=f);a.$buttonContainer.appendChild(f)})}},_makeModal:function(a){var b=this;this.$frame.addEventListener("blur",function(c){b.$lastFocusedElement=c.target},!0);this._modalListener=function(c){var a=!h.contains(b.$frame,c.target);if(a)for(var f=0;f<
b.$$modalExclusions.length;f++)if(h.contains(b.$$modalExclusions[f],c.target)){a=!1;break}a&&(window.setTimeout(function(){(b.$lastFocusedElement||b.$parent).focus()},0),h.stop(c))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);a=this.$frameParent.childNodes;var f=!1;this._addedBackdrop=[];for(var l=0;l<a.length;l++){for(var c=0;c<this.$$modalExclusions.length;c++)if(h.contains(this.$$modalExclusions[c],a[l])){f=
!0;break}!f&&a[l]!==b.$frame&&a[l].classList&&!a[l].classList.contains("tooltipContainer")&&(c=a[l],c.classList.contains("modalBackdrop")||(c.classList.add("modalBackdrop"),this._addedBackdrop.push(c)))}(a=h.lastTabbable(this.$buttonContainer)||h.lastTabbable(this.$parent))&&a.addEventListener("keydown",function(c){if(c.keyCode===h.KEY.TAB){var a=b._getFirstFocusField();a&&a!==c.target&&a.focus();h.stop(c)}},!1)},_addChildDialog:function(a){this.$$modalExclusions.push(a.$frame||a.$parent)},_inModalExclusion:function(a){return this.$$modalExclusions.some(function(b){return a.$frame===
b||a.$parent===b})},_bindElements:function(a){for(var b=0;b<a.childNodes.length;b++){var f=a.childNodes[b];f.id&&(this["$"+f.id]=f);this._bindElements(f)}},hide:function(a){!a&&g===this&&(g=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 b=this;this.keepAlive||window.setTimeout(function(){b.destroy()},0)},show:function(a){if(this.modal)if(g){if(!g._inModalExclusion(this)){this.hide(!0);return}}else g=this;"function"===typeof this._beforeShowing&&this._beforeShowing();h.setFramesEnabled(!1);var b=h.bounds(this.$frame),f=h.bounds(document.documentElement),l;a?(l=h.bounds(a),a=l.top+l.height+4,l=l.left+4,a+b.height>f.height&&(a=Math.max(0,f.height-b.height-4)),l+b.width>f.width&&(l=Math.max(0,
f.width-b.width-4))):(l=Math.max(0,(f.width-b.width)/2),a=Math.max(0,(f.height-b.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=a+"px";this.$frame.style.left=l+"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&&(g===this&&(g=null),h.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(a){a.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)}};b.prototype.constructor=b;return{Dialog:b}});
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,m,h,d,b,g,a){function e(a){this._displaySignOut=!0;this._init(a)}e.prototype={_init:function(a){this._dropdownNode=h.node(a.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=a.dropdown;this._serviceRegistry=a.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=a.noSeparator;this._dropDownItemClass=a.dropDownItemClass;this._keyAssistClass=a.keyAssistClass;void 0!==a.signOut&&(this._displaySignOut=a.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(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;
return b},_makeMenuItem:function(b,e){var c=a.createMenuItem(b).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&c.classList.add(this._dropDownItemClass);c.addEventListener("click",e,!1);c.addEventListener("keydown",function(c){(c.keyCode===h.KEY.ENTER||c.keyCode===h.KEY.SPACE)&&e()},!1);return c},_renderAuthenticatedService:function(a,b){var c=this,e=this.authenticatedServices[a].authService;if(e&&e.logout&&this._displaySignOut){var d=this._makeMenuItem(k["Sign Out"],
function(){e.logout().then(function(){c.addUserItem(a,e,c.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;0<=b;b--){var d=localStorage.key(b);d&&0===d.indexOf("/orion/preferences/user")&&localStorage.removeItem(d)}e.getAuthForm(window.location.href).then(function(c){window.location=c})})});this._dropdownNode.appendChild(d.parentNode)}},renderServices:function(){function b(a){c[a]||(c[a]=e.createDocumentFragment());return c[a]}
var e=document,c=[],n=this._serviceRegistry;d.getPageLinksInfo(n,"orion.page.link.user").then(function(d){this._dropdown?this._dropdown.empty():this._dropdownNode&&h.empty(this._dropdownNode);d.getAllLinks().forEach(function(c){var a,d;if(c.category&&(d=/user\.(\d+)/.exec(c.category)))a=parseInt(d[1],10);if("number"!==typeof a||isNaN(a))a=1;a=b(a);d=e.createElement("li");var n=e.createElement("a");n.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&n.classList.add(this._dropDownItemClass):
n.classList.add("dropdownMenuItem");n.href=c.href;n.textContent=c.textContent;d.appendChild(n);a.appendChild(d);n.addEventListener("keydown",function(c){(c.keyCode===h.KEY.ENTER||c.keyCode===h.KEY.SPACE)&&n.click()},!1)}.bind(this));this.keyAssistFunction&&(d=this._makeMenuItem(k["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&d.classList.add(this._keyAssistClass):d.classList.add("key-assist-menuitem"),d=d.parentNode,b(0).appendChild(d));
if(d=n.getServiceReferences("orion.page.getstarted")[0])d=d.getProperty("data"),d=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,d)).parentNode,b(0).appendChild(d);var g=this;c.sort(function(c,a){return c-a}).forEach(function(b,f){if(f<c.length-1&&!this._noSeparator){var e=a.createSeparator();b.appendChild(e)}g._dropdownNode.appendChild(b)}.bind(this));if(this.isSingleService())for(var u in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(u)&&this._renderAuthenticatedService(u,
0)}.bind(this))},getStartedDialog:function(a){new b(null,!0,a)},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,b,c,e){e?(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:b,label:c,data:e}):(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:b,label:c,pending:this.unauthenticatedServices[a].pending}:
{authService:b,label:c});this.renderServices()}};e.prototype.constructor=e;return{UserMenu:e}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(k,m,h,d,b,g){function a(a,b,c){var e="";c&&(e="^");if(e=h.parse("/"+e+a.searchStr+"/"))c=e.pattern,e=e.flags,-1===e.indexOf("i")&&!b.caseSensitive&&(e+="i"),a.regExp={pattern:c,flags:e},a.wildCard=!0}var e={ALL_FILE_TYPE:"*.*",doSearch:function(a,b,c,d){if(a){var q=!0;"*"===c&&(c="");""===c&&(q=d&&d.type!==e.ALL_FILE_TYPE);q&&(""!==c&&e.addRecentSearch(b,
c,d?d.regEx:!1),a=a.createSearchParams(c,!1,!1,d),a=e.generateSearchHref(a),window.location=a)}else window.alert(k["Can't search: no search service is available"])},generateSearchHelper:function(b,d){var c=b.keyword,n=c,q={};b.fileType&&b.fileType!==e.ALL_FILE_TYPE&&""===c&&(n="*."+b.fileType);if(b.regEx)q.searchStr=c,a(q,b,d);else{var g=-1<c.indexOf("*"),h=-1<c.indexOf("?");g&&(c=c.split("*").join(".*"));h&&(c=c.split("?").join("."));!g&&!h&&!b.nameSearch?(q.searchStr=b.caseSensitive?c.split("\\").join(""):
c.split("\\").join("").toLowerCase(),q.wildCard=!1):(q.searchStr=b.caseSensitive?c:c.toLowerCase(),a(q,b,d),q.wildCard=!0)}q.searchStrLength=q.searchStr.length;return{params:b,inFileQuery:q,displayedSearchTerm:n}},convertSearchParams:function(a){void 0!==a.rows&&(a.rows=parseInt(a.rows,10));void 0!==a.start&&(a.start=parseInt(a.start,10));"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());
"string"===typeof a.nameSearch&&(a.nameSearch="true"===a.nameSearch.toLowerCase())},copySearchParams:function(a,b){var c={},e;for(e in a)if(void 0!==a[e]&&null!==a[e]&&(b||"replace"!==e))c[e]=a[e];return c},generateSearchHref:function(a){var b=m.toUrl("search/search.html");a=e.copySearchParams(a,!0);var c=a.resource;a.resource=void 0;return"undefined"!==typeof a.keyword?(new g(b+"#{,resource,params*}")).expand({resource:c,params:a}):(new g(b+"#{,resource}")).expand({resource:c})},generateFindURLBinding:function(a,
b,c,e,d){a={find:b.searchStr,regEx:b.wildCard?!0:void 0,caseSensitive:a.caseSensitive?!0:void 0,replaceWith:"string"===typeof e?e:void 0,atLine:"number"===typeof c?c:void 0};return d?a:","+(new g("{,params*}")).expand({params:a})},convertFindURLBinding:function(a){"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());"string"===typeof a.atLine&&(a.atLine=parseInt(a.atLine,10))},replaceRegEx:function(a,
b,c){return a.replace(RegExp(b.pattern,b.flags),c)},replaceStringLiteral:function(a,b,c){b=h.parse("/"+b+"/gim");return e.replaceRegEx(a,b,c)},searchOnelineLiteral:function(a,b,c){var e;e=0;for(var d=!1,g=[];!(e=b.indexOf(a.searchStr,e),0>e);){g.push({startIndex:e,length:a.searchStrLength});d=!0;if(c)break;e+=a.searchStrLength}return d?g:null},findRegExp:function(a,b,c,e){if(!b)return null;c=c||"";c+=(-1===c.indexOf("g")?"g":"")+(-1===c.indexOf("m")?"m":"");var d=null;return(d=RegExp(b,c).exec(a.substring(e)))&&
{startIndex:d.index+e,length:d[0].length}},searchOnelineRegEx:function(a,b,c){for(var d=0,q=!1,g=[];;)if(d=e.findRegExp(b,a.regExp.pattern,a.regExp.flags,d)){g.push(d);q=!0;if(c)break;d=d.startIndex+d.length}else break;return q?g:null},generateNewContents:function(a,b,c,d,q,g){if(d&&b){a||(c.contents=[]);for(var h=0;h<b.length;h++){for(var k=b[h],t=!1,m=!1,w=[],A,x=0,z=0;z<d.children.length;z++)if(d.children[z].lineNumber-1===h){x=z;for(t=0;t<d.children[z].matches.length;t++)!1!==d.children[z+t].checked&&
w.push(t);m=0<w.length;A=d.children[z].matches;t=!0;break}if(t){if(m){w=e.replaceCheckedMatches(k,q,A,w,g);k=w.replacedStr;for(t=0;t<d.children[x].matches.length;t++)d.children[x+t].newMatches=w.newMatches}else for(t=0;t<d.children[x].matches.length;t++)d.children[x+t].newMatches=d.children[x+t].matches;a?c.contents[h]=k:c.contents.push(k)}else a||c.contents.push(k)}}},generateMatchContext:function(a,b,c){var e=[],d=2*a+1,g;b.length<=d?(g=0,a=b.length-1):(g=c-a,0>g?(g=0,a=g+d-1):(a=c+a,a>b.length-
1&&(a=b.length-1,g=a-d+1)));for(d=g;d<=a;d++)e.push({context:b[d],current:d===c});return e},splitFile:function(a){for(var b=0,c=0,e=0,d=0,g=[];;){-1!==b&&b<=e&&(b=a.indexOf("\r",e));-1!==c&&c<=e&&(c=a.indexOf("\n",e));if(-1===c&&-1===b){g.push(a.substring(d));break}var h=1;-1!==b&&-1!==c?b+1===c?(h=2,e=c+1):e=(b<c?b:c)+1:e=-1!==b?b+1:c+1;g.push(a.substring(d,e-h));d=e}return g},searchWithinFile:function(a,b,c,d,g,s){c=e.splitFile(c);g&&(b.contents=c);if(b){b.children=[];for(var h=d=0;h<c.length;h++){var k=
c[h];if(k&&0<k.length){var t=s?k:k.toLowerCase();if(t=a.wildCard?e.searchOnelineRegEx(a,t):e.searchOnelineLiteral(a,t)){var m,w=h+1;if(g)for(var A=0;A<t.length;A++)m=A+1,m={parent:b,checked:b.checked,type:"detail",matches:t,lineNumber:w,matchNumber:m,name:k,location:b.location+"-"+w+"-"+m},b.children.push(m);else m={parent:b,context:e.generateMatchContext(2,c,h),checked:b.checked,type:"detail",matches:t,lineNumber:w,name:k,location:b.location+"-"+w},b.children.push(m);d+=t.length}}}b.totalMatches=
d}},replaceCheckedMatches:function(a,b,c,e,d){for(var g=0,h="",k=[],t=0;t<c.length;t++){g!==c[t].startIndex&&(h+=a.substring(g,c[t].startIndex));c[t].length&&(d=c[t].length);for(var g=!1,m=0;m<e.length;m++)if(e[m]===t){g=!0;break}g?(k.push({startIndex:h.length,length:b.length}),h+=b):(k.push({startIndex:h.length,length:d}),h+=a.substring(c[t].startIndex,c[t].startIndex+d));g=c[t].startIndex+d}g<a.length&&(h+=a.substring(g));return{replacedStr:h,newMatches:k}},fullPathNameByMeta:function(a){var b=
a.length,c="";if(0<b)for(b-=1;-1<b;b--)c=c+(""===c?"":"/")+a[b].Name;return c},path2FolderName:function(a,b,c){return a.substring(0,a.length-b.length-(c?0:1))},_storeRecentSearch:function(a,b,c,e){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("recentSearch",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:e})}.bind(this),20)})},addRecentSearch:function(a,b,c){"string"===typeof b&&b&&a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var g;
d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d){for(g in d)if(d[g].name===b)return;20<=d.length&&d.splice(19,d.length-20+1)}else d=[];d.splice(0,0,{name:b,regEx:c});e._storeRecentSearch(a,d)})},removeRecentSearch:function(a,b,c){"string"===typeof b&&b&&a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var g;d=d.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));if(d)for(g in d)if(d[g].name===b){d.splice(g,1);e._storeRecentSearch(a,
d,c,!0);break}})},getSearches:function(a,b,c){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a=a.get(b);"string"===typeof a&&(a=JSON.parse(a));a&&c&&c(a)})},getMixedSearches:function(a,b,c,d){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var f=a.get("recentSearch");"string"===typeof f&&(f=JSON.parse(f));b&&(a=a.get("search"),"string"===typeof a&&(a=JSON.parse(a)),a&&a.forEach(function(a){if(c){var b=e.parseQueryStr(a.query);
f.some(function(c){return b.searchStrTitle===c.name})||f.push({name:b.searchStrTitle,label:a.name})}else f.push({name:null,label:a.name,value:a.query})}));f&&d&&d(f)})},getOpenSearchPref:function(a,b){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(c){c=c.get("nav.config");b(c&&"undefined"!==c["links.newtab"]?c["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(a,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("openSearchPref",
{openInNewTab:b})})}};return e});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(k,m,h,d,b,g){function a(a,b,l,c){this.registry=a;this.fileClient=b;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=c&&c.searchOnName;this._buildSkeletonOnly=c&&c.buildSkeletonOnly;this._fetchChildrenCallBack=c&&c.fetchChildrenCallBack;this._searchParams=l;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:d.generateSearchHelper(l);this._location=c&&c.location;this._childrenLocation=c&&c.childrenLocation?c.childrenLocation:this._location;this._reportOnCancel=c&&c.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))}a.prototype.search=function(a){var b=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=a;this._cancelled=!1;this._deferredArray=[];b.getContentTypes().then(function(a){this.contentTypesCache=a;var c=this;this._visitRecursively(this._childrenLocation).then(function(){(!c._cancelled||c._reportOnCancel)&&c._reportResult();c._cancelled&&c._HandleStatus({name:"Cancel"})}.bind(c),function(a){c._reportResult();c._HandleStatus(a)}.bind(c))}.bind(this))};a.prototype.searchName=function(a,b){a&&(this._searchParams=
a,this.searchHelper=d.generateSearchHelper(a,!0));b&&(this.onSearchNameComplete=b);var l=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var c=0;c<this.fileSkeleton.length;c++){var n=this.fileSkeleton[c].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?d.searchOnelineRegEx(this.searchHelper.inFileQuery,n,!0):d.searchOnelineLiteral(this.searchHelper.inFileQuery,n,!0))if(l.push(this.fileSkeleton[c]),l.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:l.length,
docs:l}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};a.prototype.buildSkeleton=function(a,b){this._buildingSkeleton=!0;var d=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var c=this;a();d.getContentTypes().then(function(a){c.contentTypesCache=a;c._visitRecursively(c._childrenLocation).then(function(){c._buildingSkeleton=!1;b();c.searchHelper&&!c._buildSkeletonOnly&&c.searchName()})})};a.prototype._sort=function(a){a.sort(function(a,
b){var c,e;if("Path asc"===this._searchParams.sort){c=a.Location&&a.Location.toLowerCase();c=d.path2FolderName(c,a.Name&&a.Name.toLowerCase(),!0);e=b.Location&&b.Location.toLowerCase();e=d.path2FolderName(e,b.Name&&b.Name.toLowerCase(),!0);if(c<e)return-1;if(c>e)return 1}return this._sortOnNameSingle(a,b)}.bind(this))};a.prototype._HandleStatus=function(a){this._statusService&&"Cancel"===a.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:k["Search cancelled by user"],
Severity:"Warning"}))};a.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};a.prototype._sortOnNameSingle=function(a,b){var d=a.Name&&a.Name.toLowerCase(),c=b.Name&&b.Name.toLowerCase();return d<c?-1:d>c?1:0};a.prototype._onFileType=function(a){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===d.ALL_FILE_TYPE?!0:0<=a.extension.indexOf(this.searchHelper.params.fileType):
!0};a.prototype._visitRecursively=function(a){var f=[],d=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(a);return(d._progressService?this._progressService.progress(d.fileClient.fetchChildren(a),"Crawling search for children of "+a):d.fileClient.fetchChildren(a)).then(function(c){for(var a=0;a<c.length;a++)if(void 0!==c[a].Directory&&!1===c[a].Directory)if(d._searchOnName)f.push(d._buildSingleSkeleton(c[a]));else if(d._buildSkeletonOnly)f.push(d._buildSingleSkeleton(c[a]));else{if(!d._cancelled){var e=
b.getFilenameContentType(c[a].Name,d.contentTypesCache);if(e&&("text/plain"===e["extends"]||"text/plain"===e.id)&&d._onFileType(e))e=d._sniffSearch(c[a]),f.push(e),d._deferredArray.push(e)}}else if(c[a].Location)if(d._cancelled)break;else e=d._visitRecursively(c[a].ChildrenLocation),f.push(e),d._deferredArray.push(e);return g.all(f)})};a.prototype._hitOnceWithinFile=function(a){a=this._searchParams.caseSensitive?a:a.toLowerCase();return this.searchHelper.inFileQuery.wildCard?d.searchOnelineRegEx(this.searchHelper.inFileQuery,
a,!0):d.searchOnelineLiteral(this.searchHelper.inFileQuery,a,!0)};a.prototype._reportSingleHit=function(a){this._cancelled||(a.LastModified=a.LocalTimeStamp,this.fileLocations.push(a),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};a.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(a){a.cancel()})};a.prototype._sniffSearch=function(a){this._totalCounter++;
var b=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(a),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(a.Location),"Reading file "+a.Location):b.fileClient.read(a.Location)).then(function(d){b._hitOnceWithinFile(d)&&b._reportSingleHit(a);b._statusService&&b._statusService.setProgressResult({Message:h.formatMessage(k["${0} files found out of ${1}"],
b._hitCounter,b._totalCounter)},k.Cancel)},function(a){a&&a.message&&"cancel"!==a.message.toLowerCase()&&console.error("Error loading file content: "+a.message)})};a.prototype._buildSingleSkeleton=function(a){this._totalCounter++;this.fileSkeleton.push(a);this.searchHelper&&!this._buildSkeletonOnly&&0===this._totalCounter%100&&this.searchName();a=new g;a.resolve(this._totalCounter);return a};a.prototype.constructor=a;return{SearchCrawler:a}});
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,m,h,d,b,g,a){function e(a){this._init(a)}e.prototype=new a.Dialog;e.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"'+
d.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';e.prototype._init=function(a){this.title=a.title||k["Find File Named"];this.modal=!0;this.messages=k;this._searcher=a.searcher;this._progress=a.progress;this._onHide=a.onHide;this._contentTypeService=
new h.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=a.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=a.initialText;this._message=a.message;this._nameSearch=!0;void 0!==a.nameSearch&&(this._nameSearch=a.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(k["Missing required argument: fileService"]);
this._searchRenderer=a.searchRenderer;if(!this._searchRenderer||"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(k["Missing required argument: searchRenderer"]);this._initialize()};e.prototype._bindToDom=function(a){var e=this;e.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",k["FileName FolderName"]):this.$fileName.setAttribute("placeholder",k.Search);this.$fileName.addEventListener("input",function(c){e._time=+new Date;e._timeoutId&&
clearTimeout(e._timeoutId);e._timeoutId=setTimeout(e.checkSearch.bind(e),0)},!1);this.$fileName.addEventListener("keydown",function(c){if(c.keyCode===b.KEY.ENTER){var a=b.$("a",e.$results);a&&(b.stop(c),(g.isMac?c.metaKey:c.ctrlKey)?window.open(a.href):(window.location.href=a.href,e.hide()))}},!1);a.addEventListener("keydown",function(c){var a,f,d;if(c.keyCode===b.KEY.DOWN||c.keyCode===b.KEY.UP)a=b.$$array("a",e.$results),f=document.activeElement,d=a.indexOf(f),c.keyCode===b.KEY.DOWN?0<=d?(f.classList.remove("treeIterationCursor"),
a=d<a.length-1?a[d+1]:a[0],a.focus(),a.classList.add("treeIterationCursor")):0<a.length&&(a=a[0],a.focus(),a.classList.add("treeIterationCursor")):0<=d?(f.classList.remove("treeIterationCursor"),f=e.$fileName,a=0<d?a[d-1]:f,a.focus(),0<d&&a.classList.add("treeIterationCursor")):0<a.length&&(a[a.length-1].focus(),a[a.length-1].classList.add("treeIterationCursor")),b.stop(c)});a.addEventListener("mouseup",function(c){c.target.focus()},!1);setTimeout(function(){if(e._forceUseCrawler||!e._fileService.getService(e._searcher.getSearchLocation()).search){var c=
e._searchOnRoot?e._searcher.getSearchRootLocation():e._searcher.getChildrenLocation(),c=new m.SearchCrawler(e._searcher.registry,e._fileService,"",{searchOnName:!0,location:c});e._searcher.setCrawler(c);c.buildSkeleton(function(){e.$crawlingProgress.style.display="inline";e.$progress.appendChild(document.createTextNode(k["Building file skeleton..."]))},function(){e.$crawlingProgress.style.display="none";e.$progress.removeChild(e.$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())};e.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var a=(new Date).getTime();a-this._time>this._searchDelay?(this._time=a,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};e.prototype._detectFolderKeyword=function(a){var b,c=a,e=null;if(this._nameSearch&&(b=/(\S+)\s*(.*)/,(a=b.exec(a))&&3===a.length))a[1]&&
(c=a[1]),a[2]&&(e=a[2]);return{keyword:c,folderKeyword:e}};e.prototype.doSearch=function(){var a=this.$fileName.value;if(a){var e=this._detectFolderKeyword(a),c=this._searcher.createSearchParams(e.keyword,this._nameSearch,this._searchOnRoot),d=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=d;var q=document.createElement("div");q.appendChild(document.createTextNode(this._nameSearch?k["Searching..."]:g.formatMessage(k["Searching for occurrences of"],
a)));b.empty(this.$results);this.$results.appendChild(q);this._searcher.search(c,e.folderKeyword,function(){d===this.currentSearch&&d.apply(null,arguments)}.bind(this))}};e.prototype.decorateResult=function(a){function e(a){0===a.button&&!a.ctrlKey&&!a.metaKey&&c.hide()}var c=this;a=b.$$array("a",a);for(var d=0;d<a.length;d++)a[d].addEventListener("click",e,!1)};e.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};e.prototype._afterHiding=function(){this._onHide&&this._onHide()};e.prototype.constructor=
e;return{OpenResourceDialog:e}});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,m){function h(d,b,g){if(d=m.node(d))this._parent=d;else throw Error("Parent node of dropdown menu not found");this.options=g=g||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=g.selectionClass;d=document.createElement("div");d.classList.add("dropdownMenu");d.classList.add("dropdownMenuOpen");d.id=this.navDropDownId;d.style.display="none";this._parent.appendChild(d);this._dropdownMenu=
d;if(b=m.node(b))this._triggerNode=b;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");g.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(a){a.keyCode===m.KEY.ESCAPE&&this.clearPanel()}.bind(this))}k.mixin(h.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){m.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=m.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",m.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(d){this._dropdownMenu.innerHTML=d},getContentNode:function(){return this._dropdownMenu},updateContent:function(d,b){b()},_positionDropdown:function(){this._dropdownMenu.style.right="";var d=m.bounds(this._dropdownMenu),b=m.bounds(document.body);d.left+d.width>b.left+b.width&&(d=m.bounds(this._boundingNode(this._triggerNode)),b=m.bounds(this._triggerNode),this._dropdownMenu.style.right=d.width-(b.left-d.left+b.width)+"px")},_boundingNode:function(d){var b=window.getComputedStyle(d,
null);return null===b||"absolute"===b.getPropertyValue("position")||!d.parentNode||d===document.body?d:this._boundingNode(d.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&&(m.setFramesEnabled(!0),m.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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(k,m,h){function d(a,b,d){if(!a[b])throw b+k[" is not supported in this file system"];return a[b].apply(a,d)}function b(a,e,f,l){if(!a.readBlob)throw k["source file service does not support binary read"];if(!f.writeBlob)throw k["target file service does not support binary write"];if("/"!==e[e.length-1])return d(a,"readBlob",[e]).then(function(c){return d(f,"writeBlob",[l,c])});var c=l.substring(0,
l.length-1),n=decodeURIComponent(c.substring(c.lastIndexOf("/")+1)),c=c.substring(0,c.lastIndexOf("/")+1);return d(f,"createFolder",[c,n]).then(function(){},function(){}).then(function(){return d(a,"fetchChildren",[e]).then(function(c){for(var e=[],d=0;d<c.length;++d){var n=c[d].Location,g=n;c[d].Directory&&(g=n.substring(0,n.length-1));g=decodeURIComponent(g.substring(g.lastIndexOf("/")+1));g=l+encodeURIComponent(g);c[d].Directory&&(g+="/");e[d]=b(a,n,f,g)}return m.all(e)})})}function g(a,b){function d(c){var a=
new m;a.reject(k["No Matching FileService for location:"]+c);return a}var l=a.getServiceReferences("orion.core.file"),c=l;if(b)for(var c=[],n=0;n<l.length;++n)b(l[n])&&c.push(l[n]);for(var g=[],s=[],u=[],r=[],t={fetchChildren:function(){var c=new m;c.resolve(r);return c},createWorkspace:function(){var c=new m;c.reject(k["no file service"]);return c},loadWorkspaces:function(){var c=new m;c.reject(k["no file service"]);return c},loadWorkspace:function(c){var a=new m;window.setTimeout(function(){a.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:k["File Servers"],Location:"/",Children:r,ChildrenLocation:"/"})},100);return a},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},l=0;l<c.length;++l)r[l]={Directory:!0,Length:0,LocalTimeStamp:0,Location:c[l].getProperty("top"),ChildrenLocation:c[l].getProperty("top"),Name:c[l].getProperty("Name")},n=c[l].getProperty("pattern")||c[l].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==n[0]&&(n=
"^"+n),g[l]=RegExp(n),s[l]=a.getService(c[l]),u[l]=c[l].getProperty("Name"),c[l].getProperty("NameKey")&&c[l].getProperty("nls")&&h.getMessageBundle(c[l].getProperty("nls")).then(function(a,b){r[a].Name=b[c[a].getProperty("NameKey")];u[a]=b[c[a].getProperty("NameKey")]}.bind(this,l));this._getServiceIndex=function(c){if("/"===c)return-1;if(!c||c.length&&0===c.length)return s[0]?0:-1;for(var a=0;a<g.length;++a)if(g[a].test(c))return a;throw k["No Matching FileService for location:"]+c;};this._getService=
function(c){c=this._getServiceIndex(c);return-1===c?t:s[c]};this._getServiceName=function(c){c=this._getServiceIndex(c);return-1===c?t.Name:u[c]};this._getServiceRootURL=function(c){c=this._getServiceIndex(c);return-1===c?t.Location:r[c].Location}}g.prototype={getService:function(a){return this._getService(a)},fileServiceName:function(a){return this._getServiceName(a)},fileServiceRootURL:function(a){return this._getServiceRootURL(a)},fetchChildren:function(a){return d(this._getService(a),"fetchChildren",
arguments)},createWorkspace:function(a){return d(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return d(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(a){return d(this._getService(a),"loadWorkspace",arguments)},createProject:function(a,b,f,l){return d(this._getService(a),"createProject",arguments)},createFolder:function(a,b){return d(this._getService(a),"createFolder",arguments)},createFile:function(a,b){return d(this._getService(a),"createFile",
arguments)},deleteFile:function(a){return d(this._getService(a),"deleteFile",arguments)},moveFile:function(a,e,f){var l=this._getService(a),c=this._getService(e);if(l===c)return d(l,"moveFile",arguments);var n="/"===a[a.length-1],g=e;"/"!==g[g.length-1]&&(g+="/");if(f)g+=encodeURIComponent(f);else{var h=a;n&&(h=h.substring(0,h.length-1));g+=h.substring(h.lastIndexOf("/")+1)}n&&"/"!==g[g.length-1]&&(g+="/");return b(l,a,c,g).then(function(){return d(l,"deleteFile",[a])})},copyFile:function(a,e,f){var l=
this._getService(a),c=this._getService(e);if(l===c)return d(l,"copyFile",arguments);var n="/"===a[a.length-1],g=e;"/"!==g[g.length-1]&&(g+="/");if(f)g+=encodeURIComponent(f);else{var h=a;n&&(h=h.substring(0,h.length-1));g+=h.substring(h.lastIndexOf("/")+1)}n&&"/"!==g[g.length-1]&&(g+="/");return b(l,a,c,g)},read:function(a,b){return d(this._getService(a),"read",arguments)},readBlob:function(a){return d(this._getService(a),"readBlob",arguments)},write:function(a,b,f){return d(this._getService(a),"write",
arguments)},remoteImport:function(a,b){return d(this._getService(a),"remoteImport",arguments)},remoteExport:function(a,b){return d(this._getService(a),"remoteExport",arguments)},search:function(a){return d(this._getService(a.resource),"search",arguments)}};g.prototype.constructor=g;return{FileClient:g}});
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,m,h,d,b,g,a,e){function f(c,a){this.parentNode=h.node(c);this.contentNode=h.node(a);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 l(c){return!c.isRelatedLink}function c(c,a){var b=c.order,e=a.order;return b<e?-1:e<b?1:0}function n(c,a){var b=c.source.order,e=a.source.order,b="number"===typeof b?b:100,e="number"===typeof e?e:100;return b===e?c.textContent.localeCompare(a.textContent):
b<e?-1:1}var q=e.isTouch;m.mixin(f.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(c,a,b){var e=this.anchor;c=this.createListItem(c,a);b&&c.classList.add("sideMenuItemActive");e.appendChild(c);this.menuitems[a]=c},setSideMenu:function(){var c=this.getDisplayState(),a=this.parentNode;a&&(c===this.CLOSED_STATE&&(this.setPageContentLeft("0"),this._timeout&&(window.clearTimeout(this._timeout),
this._timeout=null),this._timeout=window.setTimeout(function(){a.style.display="none"},this.TRANSITION_DURATION_MS),a.classList.add("animating")),c===this.OPEN_STATE&&(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),a.classList.remove("animating"),a.style.display="block",a.style.width=this.SIDE_MENU_OPEN_WIDTH,this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)))},setPageContentLeft:function(c){var a=this.contentNode;a&&(a.style.left=c)},toggleSideMenu:function(){var c=this.getDisplayState(),
a=this.contentNode;a&&a.classList.add("content-fixedHeight-animation");c=c===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;c===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,c);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];h.empty(this.anchor)},getMenuItems:function(){var c=this.menuitems;return Object.keys(c).map(function(a){return c[a]})},getMenuItem:function(c){return this.menuitems[c]},getDisplayState:function(){var c=
localStorage.getItem(this.LOCAL_STORAGE_NAME);c||(c=this.DEFAULT_STATE);return c},createListItem:function(c,a){var b=document.createElement("li");b.className=c;b.classList.add("sideMenuItem");b.categoryId=a;return b},setCategories:function(c){this.categories=c;this.links=Object.create(null)},setPageLinks:function(c){this.pageLinks=c;var a=this,b=c.createLinkElements();c.getAllLinks().forEach(function(c,e){var d=b[e];d.source=c;a._getLinksBin(c.category).push(d)});this._renderLinks()},setRelatedLinks:function(c,
a){this.relatedLinks=c;var b=this;Object.keys(this.links).forEach(function(c){var a=b._getLinksBin(c);b.links[c]=a.filter(l)});var e=document.createDocumentFragment();c.forEach(function(c){var a=c.relatedLink,d=b._getLinksBin(a.category);c=k.createCommandMenuItem(e,c.command,c.invocation);c.classList.remove("dropdownMenuItem");c.isRelatedLink=!0;c.source=a;d.push(c)});this._renderLinks(a)},_getLinksBin:function(c){if(c){var a=this.links;a[c]=a[c]||[];return a[c]}return[]},_sort:function(){var c=this.links;
Object.keys(c).forEach(function(a){c[a].sort(n)})},_renderCategories:function(){var a=this.categories,e=this,f=new URL(window.location.href),l=b.matchResourceParameters();l.OrionHome=d.getOrionHome();var n=!1;this.clearMenuItems();a.getCategoryIDs().map(function(c){return a.getCategory(c)}).sort(c).forEach(function(c){var a=e._getLinksBin(c.id);a.length&&(n?e.addMenuItem(c.imageClass,c.id,!1):(a=a.some(function(c){if(!c.source.uriTemplate)return!1;c=new g(c.source.uriTemplate);c=new URL(c.expand(l),
window.location);return c.protocol===f.protocol&&c.host===f.host&&c.hostname===f.hostname&&c.port===f.port&&c.pathname===f.pathname&&c.search===f.search?n=!0:!1}),e.addMenuItem(c.imageClass,c.id,a)))})},_renderLinks:function(c){c=c||[];this._sort();this._renderCategories();var a=this,b=window.location.href;Object.keys(this.menuitems).forEach(function(e){var d=a.getMenuItem(e);if(d){for(var f=a._getLinksBin(e).slice(),f=f.filter(function(a){var p=a.source;return 0<=c.indexOf(p.id)||!p.default&&!p.force&&
a.href===b?!1:!0}),f=f.filter(function(c){c=c.source;return!(1<f.length&&c.default&&!c.force)}),l=f.length-1;0<l;l--)f[l].href===f[l-1].href&&f.splice(l,1);if(f.length){d.appendChild(a._createCategoryElement(e,d,f[0]));var n=document.createElement("ul");n.className="sideMenuSubMenu";f.forEach(function(c){var a=document.createElement("li");a.className="sideMenuSubMenuItem";var b=document.createElement("a");b.href=c;b.className="sideMenuSubMenuItemLink";var e=document.createElement("span");e.innerHTML=
c.innerHTML;e.className="sideMenuSubMenuItemSpan";b.appendChild(e);a.appendChild(b);n.appendChild(a)});d.appendChild(n)}}})},_createCategoryElement:function(c,a,b){c=this.categories.getCategory(c);var e;q?(e=document.createElement("button"),e.type="button"):(e=document.createElement("a"),e.href=b.href);e.className+=c.imageClass;e.classList.add("submenu-trigger");e.tabIndex="0";a.classList.remove(c.imageClass);return e},_handleEvent:function(c){var a=c.target;c="focus"===c.type;if("A"!==a.tagName||
c)a.classList.contains("submenu-trigger")&&(q||c)&&this._expandMenu(h.$(".sideMenuSubMenu",a.parentNode))},_expandMenu:function(c){this.getMenuItems().forEach(function(a){a=h.$(".sideMenuSubMenu",a);c!==a&&a.classList.remove("expanded")});c&&c.classList.toggle("expanded")}});return f});
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,
m,h,d,b,g,a,e,f,l,c,n,q,s,u,r,t,v,w,A,x,z,p,y,B,C,I,H,G,K,F,D,E,J,Q){function L(c,a){if(c.getLabel)return c.getLabel();var b=new p;b.resolve(a.properties.name);return b}function T(c){q.node("progressPane").setAttribute("aria-label",k["Operations - Press spacebar to show current operations"]);(c=c.getService("orion.page.progress"))&&c.init.bind(c)("progressPane")}function W(c,a){var b=c.getServiceReferences("orion.core.auth");ba=[];var p=U.createMenuGenerator.apply(this,arguments);if(p)for(var e=0;e<
b.length;e++){var d=b[e],f=c.getService(d);L(f,d).then(function(c){f.getKey().then(function(a){ba.push(a);f.getUser().then(function(b){p.addUserItem(a,f,c,b)},function(b,e){p.addUserItem(a,f,c,e)});window.addEventListener("storage",function(b){N[a]!==localStorage.getItem(a)&&(N[a]=localStorage.getItem(a),f.getUser().then(function(b){p.addUserItem(a,f,c,b)},function(b){p.addUserItem(a,f,c)}))},!1)})})}}function R(c){return c}function V(c,b,e,d,y){function l(){if(C)return C;var a=c.getService("orion.core.contentTypeRegistry");
a||(a=new t.ContentTypeRegistry(c),a=c.getService("orion.core.contentTypeRegistry"));return a.getContentTypes().then(function(c){return C=c})}function B(c){for(var a={},b=c.getPropertyKeys(),p,e=0;e<b.length;e++)p=b[e],a[p]=c.getProperty(p);return a}function n(c,a){var b=null;c.some(function(c){return a===c.getProperty("id")?!!(b=c):!1});return b}function g(c){var e=c.command;return!e.visibleWhen||e.visibleWhen(b)?(c.invocation=new a.CommandInvocation(b,b,null,e,d),(new p).resolve(c)):"function"===
typeof y?(s||(s=y()),p.when(s,function(p){if(p&&b===ca&&(!e.visibleWhen||e.visibleWhen(p)))return c.invocation=new a.CommandInvocation(p,p,null,e,d),c})):(new p).resolve()}function q(c,b,e){return e?(new p).resolve({relatedLink:c,command:e}):b.then(function(b){return{relatedLink:c,command:new a.Command(b)}})}var h=arguments,C,s,I=c&&c.getServiceReferences("orion.page.link.related");if(I&&0!==I.length){var k=this;p.when(l(),function(){if(U.beforeGenerateRelatedLinks.apply(k,h)){var a=c.getServiceReferences("orion.navigate.command"),
b=[];I.forEach(function(p){var e=B(p);if(e.id){var y;if((e.nls&&e.nameKey||e.name)&&e.uriTemplate)y=f._createCommandOptions(e,p,c,C,!0),b.push(q(e,y,null));else if(y=n(a,e.id)){var l=B(y);p={};Q.mixin(p,l,e);(e=d.findCommand(e.id))?b.push(q(p,null,e)):(y=f._createCommandOptions(l,y,c,C,!0),b.push(q(p,y,null)))}}});p.all(b,R).then(function(c){c.sort(function(c,a){return c.command.name.localeCompare(a.command.name)});return p.all(c.map(g),R).then(function(a){var b=[];a=a.filter(function(a,p){if(a)return!0;
b.push(c[p]);return!1});U.addRelatedLinkCommands.call(k,d,a,b,e);U.afterGenerateRelatedLinks.apply(k,h)})})}})}}function X(c){var a=q.node("globalActions");a&&(c.destroy(a),c.renderCommands(a.id,a,{},{},"tool"))}function $(c){var a=window.getComputedStyle(c,null);return null===a||"absolute"===a.getPropertyValue("position")||!c.parentNode||c===document.body?c:$(c.parentNode)}function P(c){var a={},b=null;"string"===typeof c&&(c=q.node(c));c||(c=q.node("pageActions"));for(var p=c;p&&p.classList;){if(p.classList.contains("toolComposite")){b=
p;break}p=p.parentNode}c.classList.contains("commandMarker")&&(a.commandNode=c);b&&(a.slideContainer=q.$(".slideParameters",b),a.parameterArea=q.$(".parameters",b),a.dismissArea=q.$(".parametersDismiss",b),a.notifications=q.$("#notificationArea",b),b.parentNode&&(a.toolbarTarget=q.$(".toolbarTarget",b.parentNode),a.toolbarTarget&&(c=q.bounds(a.toolbarTarget),p=q.bounds($(a.toolbarTarget.parentNode)),a.toolbarTargetY=c.top-p.top,a.toolbar=b)));return a}function M(c){if(c=c.slideContainer)if(c.style.left=
"",c.style.top="",c.classList.contains("slideContainerActive")){var a=q.bounds(c),b=q.bounds(c.parentNode);c.style.left=(b.width-a.width)/2+"px";c.style.top="0"}}g=function(c){var a=document.createElement("a");a.href=c;return a.href}(m.toUrl("auth/NotifyAuthentication.html"));var N={},O=null,U={createMenuGenerator:D.createMenuGenerator||function(c,a){if(q.node("userMenu")){var b=q.node("userDropdown"),p=new u.Dropdown({dropdown:b}),b=new y.UserMenu({dropdownNode:b,dropdown:p,serviceRegistry:c}),p=
q.node("userTrigger");new r.Tooltip({node:p,text:k.Options,position:["below","left"]});p=document.getElementById("userTrigger");p.className+=" imageSprite core-sprite-silhouette";b.setKeyAssist(a);return b}},beforeGenerateRelatedLinks:D.beforeGenerateRelatedLinks||function(c,a,b,p,e){return!0},addRelatedLinkCommands:D.addRelatedLinkCommands||function(c,a,b,p){this.sideMenu&&this.sideMenu.setRelatedLinks(a,p)},afterGenerateRelatedLinks:D.afterGenerateRelatedLinks||function(c,a,b,p,e){},afterSetPageTarget:D.afterSetPageTarget||
function(c){},generateNavigationMenu:D.generateNavigationMenu||function(c,a,b,p,e,d,f){if(c=q.node("sideMenu"))a=q.node("centralNavigation"),new r.Tooltip({node:a,text:k.CentralNavTooltip,position:["right"]}),O=this.sideMenu=new J(c,q.node("pageContent")),a.addEventListener("click",O.toggleSideMenu.bind(O)),(c=q.node("sideMenuToggle"))&&c.addEventListener("click",O.toggleSideMenu.bind(O))},afterGenerateNavigationMenu:D.afterGenerateNavigationMenu||function(c,a,b,p,e,d,f){},afterGenerateBanner:D.afterGenerateBanner||
function(c,a,b,p,e,d,f){}},ba=[],ca,aa=[],S,Z=null,Y=null,da=new b;return{generateBanner:function(c,b,f,y,l,n,g,u){function E(c){c.registerService("orion.cm.managedservice",{updated:function(c){c=c&&"undefined"!==c["links.newtab"]?c["links.newtab"]?"_blank":"_self":"_self";for(var a=q.$$array(".targetSelector"),b=0;b<a.length;b++)a[b].target=c}},{pid:"nav.config"})}(new x.ThemePreferences(y,new z.ThemeData)).apply();var r=q.node(c);if(!r)throw k["could not find banner parent, id was "]+c;var K=document.createRange();
K.selectNode(r);K=K.createContextualFragment(I);q.processTextNodes(K,k);r.firstChild?r.insertBefore(K,r.firstChild):r.appendChild(K);r=q.node("home");r.href=m.toUrl("edit/edit.html");r.setAttribute("aria-label",k["Orion Home"]);q.node("progressPane").src=a.NO_IMAGE;if(r=q.node("pageToolbar"))r.classList.add("toolbarLayout"),r.innerHTML=G+h.slideoutHTMLFragment("mainToolbar");(r=q.node("closeNotifications"))&&r.setAttribute("aria-label",k["Close notification"]);if(17>=F.isFirefox&&(r=q.node("staticBanner")))r.style.width=
"100%",r.style.MozBoxSizing="border-box";if(r=q.node("footer"))r.innerHTML=H,q.processTextNodes(r,k);f.setParameterCollector(new e.CommandParameterCollector(P,M));document.addEventListener("keydown",function(c){c.keyCode===q.KEY.ESCAPE&&(c=b.getService("orion.page.message"))&&c.setProgressMessage("")},!1);U.generateNavigationMenu.apply(this,arguments);U.afterGenerateNavigationMenu.apply(this,arguments);r=B.getCategoriesInfo(b);K=B.getPageLinksInfo(b,"orion.page.link");p.all([r,K]).then(function(c){if(O){var a=
c[1];O.setCategories(c[0]);O.setPageLinks(a);O.setSideMenu()}});if(r=q.$(".split")){var K=q.$(".sidePanelLayout"),t=q.$(".mainPanelLayout");K&&t&&(Z={side:K,main:t},Z.splitter=new s.Splitter({node:r,sidePanel:K,mainPanel:t,toggle:!0,closeByDefault:u}),r=new a.Command({name:k["Toggle side panel"],tooltip:k["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){Z.splitter.toggleSidePanel()}}),f.addCommand(r),f.registerCommandContribution("pageActions","orion.toggleSidePane",1,
null,!0,new d.KeyBinding("l",F.isMac?!1:!0,!0,!1,F.isMac?!0:!1)))}var D=!1,v=function(c,a){if(!D){var b=a.getService("orion.page.progress"),p=new C.OpenResourceDialog({searcher:c,progress:b,searchRenderer:c.defaultRenderer,onHide:function(){D=!1}});window.setTimeout(function(){D=!0;p.show()},0)}},r=new a.Command({name:k["Find File Named..."],tooltip:k["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(c){v(l,b)}});f.addCommand(r);f.registerCommandContribution("globalActions",
"orion.openResource",100,null,!0,new d.KeyBinding("f",!0,!0));r=new a.Command({name:k["Toggle banner and footer"],tooltip:k["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var c=q.node("banner"),a=q.node("footer"),b=q.node("sideMenu"),p=q.$(".content-fixedHeight"),e="hidden"===c.style.visibility;e?(c.style.visibility="visible",a.style.visibility="visible",p.classList.remove("content-fixedHeight-maximized"),b&&b.classList.remove("sideMenu-maximized")):(c.style.visibility=
"hidden",a.style.visibility="hidden",p.classList.add("content-fixedHeight-maximized"),b&&b.classList.add("sideMenu-maximized"));da.dispatchEvent({type:"toggleTrim",maximized:!e});return!0}});f.addCommand(r);f.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new d.KeyBinding("m",!0,!0));r=new a.Command({name:k["System Configuration Details"],tooltip:k["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return m.toUrl("help/about.html")}});f.addCommand(r);
f.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new d.KeyBinding(112,!0,!0));r=new a.Command({name:k["Background Operations"],tooltip:k["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return m.toUrl("operations/list.html")}});f.addCommand(r);f.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new d.KeyBinding("o",!0,!0));Y=new w.KeyAssistPanel({commandRegistry:f});r=new a.Command({name:k["Show Keys"],
tooltip:k["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){Y.isVisible()?Y.hide():Y.show();return!0}});f.addCommand(r);f.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new d.KeyBinding(191,!1,!0));X(f);W(b,r.callback);T(b);window.addEventListener("hashchange",function(){f.processURL(window.location.href)},!1);window.setTimeout(function(){E(b)},0);U.afterGenerateBanner.apply(this,arguments)},getToolbarElements:P,getMainSplitter:function(){return Z},
getKeyAssist:function(){return Y},getGlobalEventTarget:function(){return da},layoutToolbarElements:M,setPageTarget:function(c){var a,b,p=c.breadcrumbRootName,e=c.serviceRegistry;c.target?(c.searchService&&c.searchService.setLocationByMetaData(c.target),c.fileService&&!c.breadcrumbTarget&&!c.staticBreadcrumb&&(b=(p?p+" ":"")+c.fileService.fileServiceName(c.target.Location),p=null),a=c.name||c.target.Name,ca=c.target,V.call(this,e,c.target,aa,c.commandService,c.makeAlternate)):(c.breadcrumbTarget||
(p=p||c.task||c.name),a=c.name,V.call(this,e,{NoTarget:""},aa,c.commandService,c.makeAlternate));(S=c.title)||(S=a?a+" - "+c.task:c.task);window.document.title=S;U.afterSetPageTarget.apply(this,arguments);if(a=c.breadCrumbContainer?q.node(c.breadCrumbContainer):q.node("location"))if(q.empty(a),c.staticBreadcrumb)new n.BreadCrumbs({container:a,rootSegmentName:p});else{var d=e&&new E.FileClient(e),e=c.breadcrumbTarget||c.target,d=d&&e&&e.Location?d.fileServiceRootURL(e.Location):null;new n.BreadCrumbs({container:a,
resource:e,rootSegmentName:p,workspaceRootSegmentName:b,workspaceRootURL:d,makeFinalHref:c.makeBreadcrumFinalLink,makeHref:c.makeBreadcrumbLink})}},setDirtyIndicator:function(c){S&&("*"===S.charAt(0)&&!c&&(S=S.substring(1)),c&&"*"!==S.charAt(0)&&(S="*"+S),window.document.title=S);var a=q.node("dirty");a&&(a.textContent=c?"*":"")},setPageCommandExclusions:function(c){aa=c},notifyAuthenticationSite:g}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(k){return{detectValidURL:function(m){for(var h=/\[([^\]]*)\]\(([^\)]+)\)/g,d=h.exec(m),b=[],g=0;d;){if(3===d.length&&0<d[2].length){var a=new URL(d[2]);":"!==a.protocol&&k.validateURLScheme(a.href)&&(d.index>g&&b.push({segmentStr:m.substring(g,d.index)}),b.push({segmentStr:0<d[1].length?d[1]:d[2],urlStr:d[2]}),g=d.index+d[0].length)}d=h.exec(m)}if(0===g)return null;g<m.length-1&&b.push({segmentStr:m.substring(g)});return b},processURLSegments:function(k,
h){h.forEach(function(d){if(d.urlStr){var b=document.createElement("a");b.href=d.urlStr;b.appendChild(document.createTextNode(d.segmentStr))}else b=document.createElement("span"),b.textContent=d.segmentStr;k.appendChild(b)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(k,m,h,d){function b(a,b,d,l,c){this._serviceRegistry=a;this._serviceRegistration=a.registerService("orion.page.message",this);this._operationsClient=b;this.notificationContainerDomId=c;this.domId=d;this.progressDomId=l||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var g;b.prototype={_init:function(){var a=m.node("closeNotifications");if(a&&
!this._hookedClose){a.style.cursor="pointer";this._hookedClose=!0;var b=m.node(this.notificationContainerDomId);m.addAutoDismiss([b],function(){this._clickToDisMiss&&this.close()}.bind(this));a.addEventListener("click",function(){this.close()}.bind(this));b.addEventListener("click",function(a){a&&a.target&&"a"===a.target.nodeName.toLowerCase()&&(a=m.$$("a",b))&&a.length&&1===a.length&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var a=m.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&a?(a.innerHTML="",a.classList.remove("cancelButton"),a.classList.add("dismissButton"),a.classList.add("core-sprite-close"),a.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(a,b,d){this._init();this.currentMessage=a;var l=m.node(this.domId);
if("boolean"===typeof d){var c=l.getAttribute("aria-live");l.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){a===this.currentMessage&&(m.empty(l),l.appendChild(document.createTextNode(a)),window.setTimeout(function(){l.setAttribute("aria-live",c)},100))}.bind(this),100)}else m.empty(l),l.appendChild(document.createTextNode(a));"number"===typeof b&&window.setTimeout(function(){a===this.currentMessage&&(m.empty(l),l.appendChild(document.createTextNode("")))}.bind(this),b)},setErrorMessage:function(a){this._clickToDisMiss=
!0;this.currentMessage=a;this._init();var b=a.responseText||a.message||a;if("string"===typeof b)try{b=JSON.parse(b)}catch(d){}a=b.Message||b;var l="red";if(b.Severity)switch(b.Severity){case "Warning":l="#FFCC00";break;case "Error":l="red";break;case "Info":case "Ok":l="green"}b=document.createElement("span");b.style.color=l;b.appendChild(document.createTextNode(a));a=m.node(this.domId);m.empty(a);a.appendChild(b)},setProgressMessage:function(a){this._clickToDisMiss=!1;this._init();this.currentMessage=
a;var b=document.createElement("span");b.classList.add("progressIcon");var d=m.node(this.progressDomId);m.empty(d);d.appendChild(b);d.appendChild(document.createTextNode(a));b=m.node(this.notificationContainerDomId);b.classList.remove("notificationHide");if(a&&0<a.length)b.classList.add("progressNormal"),b.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();b.classList.remove("notificationShow");b.classList.add("notificationHide")}},
setCancelFunction:function(a){this._cancelFunc=a},setProgressResult:function(a,b){this._clickToDisMiss=!1;this._cancelMsg=b;this.currentMessage=a;var f=a.responseText||a;if("string"===typeof f)try{f=JSON.parse(f)}catch(l){}this._init();var c=f.Message||f.toString(),n=k.UnknownError,g="core-sprite-information",h="progressNormal",u=document.createElement("span");u.classList.add("imageSprite");u.classList.add("progressIcon");var r=[];if(f.Severity)switch(f.Severity){case "Warning":n=k.UnknownWarning;
g="core-sprite-warning";h="progressWarning";r.push("progressInfo");r.push("progressError");r.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":g="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");u.classList.add(g);var t=m.node(this.progressDomId),g=m.node(this.notificationContainerDomId);
m.empty(t);t.appendChild(u);c===Object.prototype.toString()&&(c=n);f.HTML?(f=document.createElement("span"),f.innerHTML=c,t.appendChild(f)):((n=d.detectValidURL(c))?(c=document.createDocumentFragment(),d.processURLSegments(c,n),Array.prototype.forEach.call(m.$$("a",c),function(c){c.target="_blank"})):("Warning"!==f.Severity&&"Error"!==f.Severity&&!b&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
c=document.createTextNode(c)),t.appendChild(c));if(h&&this.progressDomId!==this.domId){g.classList.add(h);for(h=0;h<r.length;h++)g.classList.remove(r[h])}g.classList.add("notificationShow");if(r=m.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(a,b){var d=this;if(b){d.setProgressMessage(b);var l=function(){b===d.currentMessage&&d.setProgressMessage("")};a.then(l,l)}return a},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(a,b){return new g(this,++this._lastProgressId,a,b)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var a="",b=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(b||(a+=", "),a+=this._progressMonitors[d].status,
b=!1);this.setProgressMessage(a)}else this.setProgressMessage("")},_beginProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._renderOngoingMonitors()},_doneProgressMonitor:function(a){delete this._progressMonitors[a.progressId];this._progressMonitors.length--;a.status?this.setProgressResult(a.status):this._renderOngoingMonitors()}};b.prototype.constructor=
b;g=function(a,b,d,l){this.statusService=a;this.progressId=b;if(d){this.deferred=d;this.begin(l);var c=this;d.then(function(a,b){c.done.bind(c)()},function(a,b){c.done.bind(c)()})}};g.prototype.begin=function(a){this.status=a;this.statusService._beginProgressMonitor(this)};g.prototype.done=function(a){this.status=a;this.statusService._doneProgressMonitor(this)};g.prototype.worked=function(a){this.status=a;this.statusService._workedProgressMonitor(this)};g.prototype.constructor=g;return{StatusReportingService:b,
ProgressMonitor:g}});
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,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(k,m,h,d){function b(){}b.prototype={_initialize:function(b,a,e,f,l){this._tooltip=new d.Tooltip({node:b,hideDelay:l||0,afterShowing:this._afterShowingFunction(a).bind(this),afterHiding:e,trigger:f?f:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";b=document.createRange();b.selectNode(this.$parent);b=b.createContextualFragment(this.TEMPLATE);
this.messages&&h.processTextNodes(b,k);this.$parent.appendChild(b);var c=this._tooltip;this.$parent.addEventListener("keydown",function(a){a.keyCode===h.KEY.ESCAPE&&c.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(b){for(var a=0;a<b.childNodes.length;a++){var e=b.childNodes[a];e.id&&(this["$"+e.id]=e);this._bindElements(e)}},_afterShowingFunction:function(b){return function(){b&&b.bind(this)();if(!this.customFocus){var a=
h.firstTabbable(this.$parent);a&&a.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};b.prototype.constructor=b;return{PopupDialog:b}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(k,m,h,d){var b={};(function(){var g=!1;b.updateNavTools=function(a,b,d,l,c,n){var q=h.node(l);if(q)b.destroy(q);else throw k["could not find toolbar "]+l;b.renderCommands(l,q,n,d,"button");if(c&&(l=h.node(c)))b.destroy(l),b.renderCommands(c,l,null,d,"button");g||(g=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",function(a){var l=h.node(c);
l&&(b.destroy(l),b.renderCommands(c,l,a.selections,d,"button"))}))};b.createOperationsCommands=function(a,b,f){function l(c){return!c.operation||!c.operation.type?!1:"loadstart"===c.operation.type||"progress"===c.operation.type}var c=new d.Command({name:k["Remove Completed"],tooltip:k["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(c){f.removeCompletedOperations().then(function(c){b.loadOperations.bind(b)()})},visibleWhen:function(c){return!0}});a.addCommand(c);
c=new d.Command({name:k.Remove,tooltip:k["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(c){c=Array.isArray(c.items)?c.items:[c.items];for(var a=0;a<c.length;a++){var d=c[a];f.removeOperation.bind(f)(d.Location).then(function(){b.loadOperations.bind(b)()},function(){b.loadOperations.bind(b)()})}},visibleWhen:function(c){if(!Array.isArray(c)||0===c.length)return!l(c);for(var a in c)if(l(c[a]))return!1;return!0}});a.addCommand(c);
c=new d.Command({name:k.Cancel,tooltip:k["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(c){c=Array.isArray(c.items)?c.items:[c.items];for(var a=0;a<c.length;a++){var b=c[a];b.deferred&&b.deferred.cancel()}},visibleWhen:function(c){if(!Array.isArray(c)||0===c.length)return l(c)&&(c.operation&&c.operation.cancelable?!0:!1);for(var a in c)if(!l(c[a])||!c[a].operation||!c[a].operation.cancelable)return!1;return!0}});a.addCommand(c)}})();
return b});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(k,m,h,d,b){function g(a){this._options=a}g.prototype=new d.PopupDialog;g.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';g.prototype._init=
function(a){this._myOperations=[];this._operationsDeferreds=[];this._commandService=a.commandRegistry;b.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(a.triggerNode)};g.prototype._bindToDom=function(a){this.$allOperationsLink.href=m.toUrl("operations/list.html");this._setOperationsVisibility()};g.prototype.setOperations=function(a,b){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(a)for(var d in a)this._myOperations.push(a[d]),this._operationsDeferreds.push(b[d]);this._renderOperations()};g.prototype.parseProgressResult=function(a){if(!a)return{};a=a.responseText||a;try{a=JSON.parse(a)}catch(b){}var d={Message:a.Message||a,Severity:a.Severity};a.DetailedMessage&&a.DetailedMessage!==d.Message&&(d.DetailedMessage=a.DetailedMessage);return d};g.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};g.prototype._renderOperationsTable=function(a,b,d){h.empty(a);for(var l=0;l<b.length;l++){var c=b[l],n=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px";g.style.paddingRight="5px";g.textContent=c.Name;n.appendChild(g);var s=document.createElement("div");g.appendChild(s);g=document.createElement("span");g.style.paddingRight="5px";g.classList.add("imageSprite");switch(c.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.")}s.appendChild(g);g=document.createElement("span");g.classList.add("operationStatus");g.textContent=c.Name;s.appendChild(g);if(c.error){var u=c.error.Message||c.error;c.error.DetailedMessage&&""!==c.error.DetailedMessage&&(u+=": "+c.error.DetailedMessage);g.textContent=u;g.classList.remove("operationStatus");g.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",s,{operation:c,deferred:d[l]},this,"tool");a.appendChild(n)}this._setOperationsVisibility()};
g.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"};g.prototype.constructor=g;return{OperationsDialog:g}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(k,m,h,d,b){function g(a,f){if(!this._progressPane){this._progressPane=d.node(a);this._operationsDialog=new b.OperationsDialog({triggerNode:this._progressPane,commandRegistry:f});var l=this;this._progressPane.addEventListener("keydown",function(c){(" "===c.charOrCode||c.keyCode===d.KEY.ENTER)&&l._operationsDialog.show()});this._progressPane.addEventListener("click",
function(c){l._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function a(a,b,d,c){this._serviceRegistry=a;this._serviceRegistration=a.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=b;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=c}g.prototype={_switchIconTo:function(a){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=a;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(a,b){var d={},c;for(c in a)a[c].progressMonitor||(d[c]=a[c]);if(this._isEmpty(d))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 n="";for(c in d){var g=d[c];if(g.type&&("loadstart"===g.type||"progress"===g.type)){n=
"running";break}}""===n&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==n;switch(n){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(d,b)},_isEmpty:function(a){for(var b in a)return!1;return!0}};g.prototype.constructor=g;a.prototype={init:function(a){this._progressMonitorClass||(this._progressMonitorTool=new g(a,this._commandRegistry))},progress:function(a,b,d){var c=this,n=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(b));a.then(function(g){c._operations[n]&&
(g=c._operations[n],b&&(g.Name=b),c._lastOperation=g,g.type="loadend",d&&(g.progressMonitor=d),c.writeOperation.bind(c)(n,g,a),g.Location||c._removeOperationFromTheList.bind(c)(n))},function(g){if(c._operations[n]){var h=c._operations[n];b&&(h.Name=b);d&&(h.progressMonitor=d);c._lastOperation=h;h.type=g.canceled?"abort":"error";h.error=g;c.writeOperation.bind(c)(n,h,a);h.Location||c._removeOperationFromTheList.bind(c)(n)}},function(g){b&&(g.Name=b);d&&(g.progressMonitor=d);c.writeOperation.bind(c)(n,
g,a)});return a},removeOperation:function(a){for(var b in this._operations)if(this._operations[b].Location&&this._operations[b].Location===a){this._removeOperationFromTheList(b);break}this._operationsClient.removeOperation.bind(this._operationsClient)(a)},_removeOperationFromTheList:function(a){var b=this._operations[a].progressMonitor;delete this._operations[a];delete this._operationDeferrds[a];b?b.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var a in this._operations){var b=this._operations[a];b.type&&"loadstart"!==b.type&&"progress"!==b.type&&((b=this._operations[a].progressMonitor)&&b.done(),delete this._operations[a],delete this._operationDeferrds[a])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(a){this._serviceRegistry.getService("orion.page.message").setProgressResult(a)},showWhile:function(a,b,d){b&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(b);
var c=this;a.then(function(a){c._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){d?c._serviceRegistry.getService("orion.page.message").setProgressMessage(""):c.setProgressResult.bind(c)(a);return a});return this.progress(a,b)},writeOperation:function(a,b,d){this._operations[a]=b;this._operationDeferrds[a]=d;b.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(c){c.put(b.Location,{Name:b.Name,expires:b.expires})});
b.progressMonitor?b.progressMonitor.progress(b.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};a.prototype.constructor=a;return{ProgressService:a}});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,m){function h(d,b){b||(b="orion.page.selection");this._serviceRegistry=d;k.attach(this);this._serviceRegistration=d.registerService(b,this);this._selections=null}h.prototype={getSelection:function(d){var b=this._getSingleSelection();"function"===typeof d&&d(b);return b},getSelections:function(d){var b=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof d&&d(b);return b},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(d){var b=this._selections;Array.isArray(d)?this._selections=0<d.length?d.slice():null:this._selections=d?[d]:null;b!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};h.prototype.constructor=h;return{Selection:h}});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(k,m,h,d,b,g){function a(a,b){var c=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!b.id)throw Error("Missing required argument: id");this.id=b.id;if(!b.title)throw Error("Missing required argument: title");var e=b.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");a.appendChild(this.domNode);for(var g=0;g<e.length;g++)this.domNode.classList.add(e[g]);this.domNode.id=b.id;b.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(a){(a.target===c.titleNode||a.target===c.twistie||a.target===c.domNode)&&c._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===k.KEY.ENTER&&(a.target===c.domNode||a.target===c.titleNode||a.target===c.twistie)&&c._changeExpandedState()},!1));if(b.iconClass){var h=document.createElement("span");h.classList.add("sectionIcon");this.domNode.appendChild(h);e=Array.isArray(b.iconClass)?b.iconClass:[b.iconClass];e.forEach(function(c){h.classList.add(c)})}b.headerClass&&
(e=Array.isArray(b.headerClass)?b.headerClass:[b.headerClass],e.forEach(function(c){this.domNode.classList.add(c)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=b.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=b.title;"function"===typeof b.getItemCount&&(e=document.createElement("div"),e.classList.add("layoutLeft"),
e.classList.add("sectionItemCount"),this.domNode.appendChild(e),e.textContent=b.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=b.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);e=document.createElement("div");e.id=b.id+
"FilterSearchBox";this.domNode.appendChild(e);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=b.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=b.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=b.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);b.slideout&&(e=d.slideoutHTMLFragment(b.id),g=document.createRange(),g.selectNode(this.domNode),e=g.createContextualFragment(e),this.domNode.appendChild(e));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);a.appendChild(this._contentParent);b.content&&this.setContent(b.content);"function"===typeof b.onExpandCollapse&&(this._onExpandCollapse=b.onExpandCollapse);this._preferenceService=b.preferenceService;this._collapse();if(this._preferenceService){var u=this;this._preferenceService.getPreferences("/window/views").then(function(c){c=
c.get(u.id);void 0===c?b.hidden||u._expand():c&&u._expand();u._updateExpandedState(!1)})}else b.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=b.commandService;this._lastMonitor=0;this._loading={}}function e(a){this._section=a;this._id=++a._lastMonitor}a.prototype={setTitle:function(a){this.titleNode.textContent=a},getHeaderElement:function(a){return this.domNode},getTitleElement:function(a){return this.titleNode},getActionElement:function(a){return this._toolActionsNode},
setContent:function(a){"string"===typeof a?this._contentParent.innerHTML=a:(this._contentParent.innerHTML="",this._contentParent.appendChild(a))},getContentElement:function(){return this._contentParent},embedExplorer:function(a,e,c){this._contentParent.innerHTML="";a.parent||(a.parent=e);this._contentParent.appendChild(a.parent);a.section=this;b.mixin(a,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(c){if(!k.node(c)){var a=document.createElement("ul");
a.id=c;a.classList.add("commandList");a.classList.add("layoutRight");this.section.actionsNode.appendChild(a)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(c,a){this.section.actionsNode.style.visibility=c?"":"hidden";void 0===a&&(a=c?null:"cursorOnly");this.renderer.selectionPolicy=a;var b=this.getNavHandler();b&&b.setSelectionPolicy(a);c?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(c){k.node(c)&&
this.commandRegistry.destroy(c)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var c=this;this.actionsSections&&(this.actionsSections.forEach(function(a){delete c[a]}),delete this.actionsSections)},updateCommands:function(c){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,c))},loaded:function(){var a=this;!this.selection&&!c&&(this.serviceRegistry||this.registry?(this.selection=
new g.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(c){a.updateCommands(c.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var b=this.registerCommands();!b||!b.then?a.updateCommands():b.then(function(){a.updateCommands()})}});a.renderer&&(a.renderer.section=this,b.mixin(a.renderer,{getCellHeaderElement:function(c){(c=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
c))&&this.section.setTitle(c.innerHTML);return null}}))},createProgressMonitor:function(){return new e(this)},_setMonitorMessage:function(a,b){this._progressNode.style.visibility="visible";this._loading[a]=b;var c="",e;for(e in this._loading)""!==c&&(c+="\n"),c+=this._loading[e];this._progressNode.title=c},_monitorDone:function(a){delete this._loading[a];a="";for(var b in this._loading)""!==a&&(a+="\n"),a+=this._loading[b];this._progressNode.title=a;""===a&&(this._progressNode.style.visibility="hidden")},
_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(a){var b=!this.hidden,c=this.twistie,e=this.id;c&&(c.classList.add(b?this._expandImageClass:this._collapseImageClass),c.classList.remove(b?this._collapseImageClass:this._expandImageClass));this._preferenceService&&a&&this._preferenceService.getPreferences("/window/views").then(function(c){c.put(e,b)});this._onExpandCollapse&&this._onExpandCollapse(b,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")}};a.prototype.constructor=a;e.prototype={begin:function(a){this.status=a;this._section._setMonitorMessage(this.id,a)},worked:function(a){this.status=a;this._section._setMonitorMessage(this.id,a)},done:function(a){this.status=a;this._section._monitorDone(this.id)}};e.prototype.constructor=e;return{Section:a}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(k,m){function h(d){this._init(d)}h.prototype={_init:function(d){var b=d.parent,g=this,b=m.node(b);if(!b)throw k["no parent"];if(!d.model)throw k["no tree model"];if(!d.renderer)throw k["no renderer"];this._parent=b;this._treeModel=d.model;this._onComplete=d.onComplete;this._renderer=d.renderer;this._showRoot=void 0===d.showRoot?!1:d.showRoot;this._indent=void 0===d.indent?16:d.indent;this._onCollapse=d.onCollapse;
this._labelColumnIndex=void 0===d.labelColumnIndex?0:d.labelColumnIndex;this._id=void 0===d.id?"treetable":d.id;this._tableStyle=d.tableStyle;this._tableElement=d.tableElement||"table";this._tableBodyElement=d.tableBodyElement||"tbody";this._tableRowElement=d.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(a){g._showRoot?(a._depth=0,g._generate([a],0)):g._treeModel.getChildren(a,function(a){g.destroyed||g._generate(a,0)})})},destroy:function(){this.destroyed=!0},_generate:function(d,
b){m.empty(this._parent);var g=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(g);var a=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(a);a.id=this._id;this._tableStyle&&a.classList.add(this._tableStyle);this._renderer.initTable(a,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===d.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(d,b);a.appendChild(this._bodyElement);g.appendChild(a);this._parent.appendChild(g);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(d,b,g){for(var a=0;a<d.length;a++){var e=document.createElement(this._tableRowElement);e.id=this._treeModel.getId(d[a]);e._depth=b;e._item=d[a];this._renderer.render(d[a],e);e.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*b+"px";this._renderer.rowCallback&&this._renderer.rowCallback(e,d[a]);g?(this._bodyElement.insertBefore(e,g.nextSibling),g&&(g=e)):this._bodyElement.appendChild(e)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(d,b,g){var a=this._treeModel.getId(d),e;if(a===this._id)this._removeChildRows(a),this._generateChildren(b,0),this._rowsChanged();else{var f=m.node(a);f?(f._item=d,
f&&(g||f._expanded)?(this._removeChildRows(a),b?(f._expanded=!0,this._renderer.updateExpandVisuals(f,!0),this._generateChildren(b,f._depth+1,f),this._rowsChanged()):(e=this,this._renderer.updateExpandVisuals(f,"progress"),b=this._treeModel.getChildren(f._item,function(a){e.destroyed||(e._renderer.updateExpandVisuals(f,!0),f._expanded||(f._expanded=!0,e._generateChildren(a,f._depth+1,f),e._rowsChanged()))}))):this._renderer.updateExpandVisuals(f,!1)):console.log(k["could not find table row "]+a)}},
getItem:function(d){var b=m.node(d);return b&&b._item?b._item:d},toggle:function(d){var b=m.node(d);b&&(b._expanded?this.collapse(d):this.expand(d))},isExpanded:function(d){d="string"===typeof d?d:this._treeModel.getId(d);return(d=m.node(d))?d._expanded:!1},expand:function(d,b,g){d="string"===typeof d?d:this._treeModel.getId(d);var a=m.node(d);if(a){var e=this;a._expanded?b&&b.apply(e,g):(this._renderer.updateExpandVisuals(a,"progress"),this._treeModel.getChildren(a._item,function(d){e.destroyed||
(e._renderer.updateExpandVisuals(a,!0),a._expanded||(a._expanded=!0,e._generateChildren(d,a._depth+1,a),e._rowsChanged()),b&&b.apply(e,g))}))}},_removeChildRows:function(d){for(var b=d===this._id,g=!1,a=-1,e=[],f=m.$$array(".treeTableRow",this._parent),l=0;l<f.length;l++){var c=f[l];if(g)break;b?c._depth>a?e.push(c):g=!0:c.id===d&&(b=!0,a=c._depth)}for(d=0;d<e.length;d++)b=e[d],b.parentNode.removeChild(b)},collapse:function(d){d="string"===typeof d?d:this._treeModel.getId(d);var b=m.node(d);if(b){if(!b._expanded)return;
b._expanded=!1;this._renderer.updateExpandVisuals(b,!1);this._removeChildRows(d);this._rowsChanged()}this._onCollapse&&this._onCollapse(b._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,d){this.firstLevelChildren=h;this.reset();this._init(d)}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 d=this._getChildren(h),d=d&&0<d.length;this.isExpanded&&d&&(d=this.isExpanded(h));return d},_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 d=this._diveIn(this._cursor);
if(!d){if(h&&this._expandable(this._cursor)&&this.forceExpandFunc){var b=this;return this.forceExpandFunc(this._cursor,"first",function(d){d&&b.setCursor(d)})}(d=this._findSibling(this._cursor,!0))&&this.setCursor(d)}return d},_backward:function(h){if(!this._cursor)return null;var d=this._findSibling(this._cursor,!1);d&&d!==this._cursor.parent&&(d=this._drillToLast(d));if(h&&d&&this._expandable(d)&&this.forceExpandFunc&&d!==this._cursor.parent){var b=this;return this.forceExpandFunc(d,"last",function(d){d&&
b.setCursor(d)})}d&&this.setCursor(d);return d},_findSibling:function(h,d){for(var b=this.topLevel(h),g=this._getChildren(h.parent),g=b?this.firstLevelChildren:g,a=0;a<g.length;a++)if(g[a]===h)return 0===a&&!d?b?null:h.parent:a===g.length-1&&d?b?null:this._findSibling(h.parent,d):d?g[a+1]:g[a-1];return null},_inParentChain:function(h,d){for(var b=h.parent;b;){if(b===d)return!0;b=b.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,d,b){this.setCursor(d);var g=[];for(g.push(d);;){if(this.iterate(h))g.push(this.cursor());else break;if(b===this.cursor())return g}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,d){var b=this.cursor(),
g=this._scan(!0,h,d);g||(g=this._scan(!1,h,d));this.setCursor(b);return g},iterate:function(h,d){return h?this._forward(d):this._backward(d)},iterateOnTop:function(h,d){var b=this._findSibling(this._getTopLevelParent(this.cursor()),h);b?this.setCursor(b):d&&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,m,h){var d={},b=-1!==navigator.userAgent.indexOf("iPad"),g=-1!==window.navigator.platform.indexOf("Mac");d.ExplorerNavHandler=function(){function a(a,b,d){this.explorer=a;this.model=this.explorer.model;this._navDict=b;this._listeners=[];this._selections=[];this._currentColumn=0;a=this._getEventListeningDiv();a.tabIndex=0;a.classList.add("selectionModelContainer");var c=this;this._modelIterator=
new m.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:d.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(a){return c.explorer.renderer.isExpandable(a)}:function(a){return c.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,b,e){return c.explorer.forceExpandFunc(a,b,e)}:void 0});this._init(d);(!d||!1!==d.setFocus)&&a.focus();d=function(a){if(h.isFormElement(a.target)||c.explorer.preventDefaultFunc&&c.explorer.preventDefaultFunc(a,
c._modelIterator.cursor()))return!0;if(a.keyCode===k.KEY.DOWN)return c.onDownArrow(a);if(a.keyCode===k.KEY.UP)return c.onUpArrow(a);if(a.keyCode===k.KEY.RIGHT)return c.onRightArrow(a);if(a.keyCode===k.KEY.LEFT)return c.onLeftArrow(a);if(a.keyCode===k.KEY.SPACE)return c.onSpace(a);if(a.keyCode===k.KEY.ENTER)return c.onEnter(a)};a.addEventListener("keydown",d,!1);this._listeners.push({type:"keydown",listener:d});d=function(a){if(c.explorer.onFocus)c.explorer.onFocus(!1);else c.toggleCursor(null,!1)};
a.addEventListener("blur",d,!1);this._listeners.push({type:"blur",listener:d});d=function(a){if(c.explorer.onFocus)c.explorer.onFocus(!0);else c.toggleCursor(null,!0)};a.addEventListener("focus",d,!1);this._listeners.push({type:"focus",listener:d});this._parentDiv=a}a.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(a){this._linearGridMove=!1;a&&(this._selectionPolicy=a.selectionPolicy,this.gridClickSelectionPolicy=a.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=a.preventDefaultFunc,this.postDefaultFunc=a.postDefaultFunc)},_ctrlKeyOn:function(a){return g?a.metaKey:a.ctrlKey},removeListeners:function(){if(this._listeners)for(var a=0;a<this._listeners.length;a++)this._parentDiv.removeEventListener(this._listeners[a].type,this._listeners[a].listener,!1)},focus:function(){var a=this._getEventListeningDiv();a&&a.focus()},_getEventListeningDiv:function(a){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(a):k.node(this.explorer._parentId)},isExpandable:function(a){return!a?!1:k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(a)))?!0:!1},isExpanded:function(a){return!a?!1:this.explorer.myTree.isExpanded(this.model.getId(a))},refreshSelection:function(a,b){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(c){d._clearSelection(b);for(var g=0;g<c.length;g++)d._selections.push(c[g]);0<d._selections.length?d.cursorOn(d._selections[0],
!0,!1,a):d.cursorOn(null,!1,!1,a);d._shiftSelectionAnchor&&0<=d._inSelection(d._shiftSelectionAnchor)||(d._shiftSelectionAnchor=null)})},refreshModel:function(a,b,d,c){this._currentColumn=0;this.topIterationNodes=[];this.model=b;this._navDict=a;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():d&&(this.topIterationNodes=d);this._modelIterator.setTree(this.topIterationNodes);!c&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(a){a=this.model.getId(a);for(var b=0;b<this._selections.length;b++)if(a===this.model.getId(this._selections[b]))return b;return-1},_clearSelection:function(a){if(a)for(a=0;a<this._selections.length;a++)this._checkRow(this._selections[a],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(a){this._selectionPolicy!==
a&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===a)&&this._toggleSelectionClass("disabledRow","readonlySelection"===a),this._selectionPolicy=a,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(a,b,d){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?b&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(a,!0):this._isRowSelectable(a)&&(!b||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(a,!1),this._selections.push(a),this._lastSelection=a):(b=this._inSelection(a),0<=b?(this._checkRow(a,!0),this._selections.splice(b,1)):(this._checkRow(a,!1),this._selections.push(a),this._lastSelection=a)),d&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(a,b){a||(a=this.currentModel());var d=this._getGridChildren(a);if(d&&1<d.length||
0===b&&d){0!==b&&this.toggleCursor(a,!1);var c=this._currentColumn,g=!0,c=c+b;0>c?(this._linearGridMove&&0!==b&&(this._modelIterator.iterate(!1)?a=this.currentModel():g=!1),c=g?d.length-1:this._currentColumn):c>=d.length&&(this._linearGridMove&&0!==b&&(this._modelIterator.iterate(!0)?a=this.currentModel():g=!1),c=g?0:this._currentColumn);this._currentColumn=c;0!==b&&this.toggleCursor(a,!0);return!0}return!1},_getGridChildren:function(a){return this._navDict?this._navDict.getGridNavHolder(a):null},
getCurrentGrid:function(a){a||(a=this.currentModel());return(a=this._getGridChildren(a))&&0<a.length?a[this._currentColumn]:null},getAriaContainerElement:function(a){for(var b=this._parentDiv,d;a&&a!==b&&"grid"!==(d=a.getAttribute("role"))&&"tree"!==d&&"treegrid"!==d;)a=a.parentNode;return a===b?null:a},toggleCursor:function(a,b){var d=this.getRowDiv(a),c=this.getCurrentGrid(a);c?(d&&(b?d.classList.add("treeIterationCursorRow"):d.classList.remove("treeIterationCursorRow")),c.domNode&&(d=this.getAriaContainerElement(c.domNode),
b?(c.domNode.classList.add("treeIterationCursor"),d&&d.setAttribute("aria-activedescendant",c.domNode.id)):c.domNode.classList.remove("treeIterationCursor"))):d&&(b?d.classList.add("treeIterationCursorRow_Dotted"):d.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(a,b,d,c){var g,q;if(a||b){if(q===this._modelIterator.cursor())return;g=this._modelIterator.cursor();q=a;this._modelIterator.setCursor(q)}else g=this._modelIterator.prevCursor(),
q=this._modelIterator.cursor();if(g!==q||b)if(this.toggleCursor(g,!1),!b||q){this.moveColumn(null,0);this.toggleCursor(q,!0);if((a=this.getRowDiv())&&!c){c=a.parentNode;for(b=document.documentElement;c&&c!==b;){var h=window.getComputedStyle(c,null);if(!h)break;h=h.getPropertyValue("overflow-y");if("auto"===h||"scroll"===h)break;c=c.parentNode}c&&(b=!0,a.offsetTop<=c.scrollTop?(b=!1,void 0===d&&(d=!1)):a.offsetTop+a.offsetHeight>=c.scrollTop+c.clientHeight&&(b=!1,void 0===d&&(d=!0)),b||a.scrollIntoView(!d))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(g,
q)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var a=[],b=0;b<this._selections.length;b++)a.push(this.model.getId(this._selections[b]));return a},getRowDiv:function(a){a=a?a:this._modelIterator.cursor();if(!a)return null;a=this.model.getId(a);var b=this._navDict.getValue(a);return b&&b.rowDomNode?b.rowDomNode:k.node(a)},iterate:function(a,b,d,c){var g=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(c){c=this.currentModel();for((g=this._modelIterator.iterate(a,
b))&&this._setCursorOnItem(a,d);g&&g.isNotSelectable;)(g=this._modelIterator.iterate(a,b))&&this._setCursorOnItem(a,d);g||(this.cursorOn(c,!0,!1,!0),this._setCursorOnItem(a,d))}else this._modelIterator.iterate(a,b)&&this._setCursorOnItem(a,d)},_toggleSelectionClass:function(a,b){this._selections.forEach(function(d){(d=this.getRowDiv(d))&&(b?d.classList.add(a):d.classList.remove(a))}.bind(this))},_setCursorOnItem:function(a,b){this.cursorOn(null,!1,a);if(b){var d=this._inSelection(this._modelIterator.prevCursor()),
c=this._inSelection(this._modelIterator.cursor());0<=d&&0<=c?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(a,b){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var d=this.getRowDiv(a);if(d){var c=k.node(this.explorer.renderer.getCheckBoxId(d.id)),g=b?!c.checked:!0;if(g!==c.checked)this.explorer.renderer.onCheck(d,c,g,!0)}}else this._select(a,b)},_select:function(a,b){a||(a=this._modelIterator.cursor());
var d=this.getRowDiv(a);d&&(0>this._inSelection(a)?d.classList.add("checkedRow"):d.classList.remove("checkedRow"))},_onModelGrid:function(a,b){var d=this._getGridChildren(a);if(d)for(var c=0;c<d.length;c++)if(b.target===d[c].domNode)return!0;return!1},onClick:function(a,d){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(a)))k.stop(d);else{var g=k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(a)));if(d.target!==g&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(a,d)))if(this.cursorOn(a,!0,!1,!0),b)this.setSelection(a,!0);else if(this._ctrlKeyOn(d))this.setSelection(a,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(g=this._modelIterator.scan(this._shiftSelectionAnchor,a)){this._clearSelection(!0);for(var c=0;c<g.length;c++)this.setSelection(g[c],!0)}}else this.setSelection(a,!1,!0)}},onCollapse:function(a){this._modelIterator.collapse(a)&&this.cursorOn()},onUpArrow:function(a){this.iterate(!1,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&
!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},onDownArrow:function(a){this.iterate(!0,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},_shouldMoveColumn:function(a){var b=this.currentModel(),d=this._getGridChildren(b);return d&&1<d.length?this.isExpandable(b)?this._ctrlKeyOn(a):!0:!1},onLeftArrow:function(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,-1),a.preventDefault(),
!0;var b=this._modelIterator.cursor();if(!b)return!1;if(this.isExpandable(b)&&this.isExpanded(b))return this.explorer.myTree.collapse(b),a.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(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,1),a.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)),a.preventDefault(),!1},_isRowSelectable:function(a){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(a):!0},onSpace:function(a){this.setSelection(this.currentModel(),!0,!0);a.preventDefault()},onEnter:function(a){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 d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(a),!1,!1,!1,0,null);b.domNode.dispatchEvent(d)}else if(b=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(d=this.explorer.renderer.getRowActionElement(this.model.getId(b)),d.href&&(this._ctrlKeyOn(a)?window.open(d.href):window.location.href=d.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(a,
b),a.preventDefault(),!1},setIsNotSelectable:function(a,b){a.isNotSelectable=b},disableItem:function(a){var b=this.getRowDiv(a);this.isExpandable(a)&&this.isExpanded(a)&&(this._modelIterator.collapse(a),this.explorer.myTree.toggle(b.id));b.classList.remove("checkedRow");b.classList.add("disabledNavRow");this.setIsNotSelectable(a,!0)},isDisabled:function(a){return a.classList.contains("disabledNavRow")},enableItem:function(a){var b=this.getRowDiv(a);b&&(b.classList.remove("disabledNavRow"),this.setIsNotSelectable(a,
!1))}};return a}();d.ExplorerNavDict=function(){function a(a){this._dict={};this._model=a}a.prototype={addRow:function(a,b){var d=this._model.getId(a);this._dict[d]={model:a,rowDomNode:b}},getValue:function(a){return this._dict[a]},getGridNavHolder:function(a,b){if(!a)return null;var d=this._model.getId(a);return this._dict[d]?(!this._dict[d].gridChildren&&b&&(this._dict[d].gridChildren=[]),this._dict[d].gridChildren):null},initGridNavHolder:function(a){if(!a)return null;a=this._model.getId(a);this._dict[a]&&
(this._dict[a].gridChildren=null)}};return a}();return d});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(k,m,h,d,b,g){var a={};a.Explorer=function(){function a(b,d,c,e){this.registry=b;this.renderer=c;this.selection=d;this.commandService=e;this.renderer&&(this.renderer.explorer=this);this.myTree=null}a.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(a,b){this.myTree&&this.myTree.refresh.bind(this.myTree)(a,b,!0)},updateCommands:function(a){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(a)},makeNewItemPlaceHolder:function(a,b,c,d){a=this.getRow(a);if(c)return a=a.childNodes[c],a.appendChild(document.createElement("br")),d=document.createElement("span"),d.id=b+"placeHolderRow",a.appendChild(d),{tempNode:d,refNode:d};if(a){var e=document.createElement("tr");
e.id=b+"placeHolderRow";c=document.createElement("td");c.id=b+"placeHolderCol";e.appendChild(c);d?(a.parentNode.insertBefore(e,a.nextSibling),a=parseInt(a.firstChild.style.paddingLeft),c.style.paddingLeft=this.myTree.getIndent()+a+"px"):a.appendChild(e);d=h.node(b+"placeHolderRow");a=h.node(b+"placeHolderCol");if(d&&a)return{tempNode:d,refNode:a}}return null},getRow:function(a){if(a=this.model.getId(a))return h.node(a)},collapseAll:function(){for(var a=this._navHandler.getTopLevelNodes(),b=0;b<a.length;b++)this.myTree.collapse(a[b])},
expandAll:function(a){if(a)this._expandRecursively(a);else if(this._navHandler){a=this._navHandler.getTopLevelNodes();for(var b=0;b<a.length;b++)this._expandRecursively(a[b])}},_expandRecursively:function(a){if(this._navHandler&&this._navHandler.isExpandable(a)){var b=this;this.myTree.expand(a,function(){b.model.getChildren(a,function(a){if(!(void 0===a||null===a))for(var d=a.length,e=0;e<d;e++)b._expandRecursively(a[e])})})}},createTree:function(a,e,c){a="string"===typeof a?a:a.id||a;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var g=a+"innerTree",q=h.node(g);q&&h.empty(q);e&&(e.rootId=g);this.model=e;this._parentId=a;this._treeOptions=c;if(!c||c&&!c.noSelection)this.selectionPolicy=c?c.selectionPolicy:"",this._navDict=new b.ExplorerNavDict(this.model);this.myTree=new d.TableTree({id:g,model:e,parent:a,onComplete:c?c.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:c?!!c.showRoot:
!1,indent:c?c.indent:void 0,onCollapse:c?c.onCollapse:void 0,navHandlerFactory:c?c.navHandlerFactory:void 0,tableElement:c?c.tableElement:void 0,tableBodyElement:c?c.tableBodyElement:void 0,tableRowElement:c?c.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 a=this.getNavHandler(),b=[];
if(a&&this.getNavDict())for(var c=a.getSelection(),d=0;d<c.length;d++){var e=a.getRowDiv(c[d]);e&&e.parentNode&&(e=this.getNavDict().getValue(this.model.getId(c[d])),e.model&&b.push(e.model))}this.selection.setSelections(b)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var a=this._treeOptions;if(!a||a&&!a.noSelection){this.getNavHandler()||(this._navHandler=a&&a.navHandlerFactory&&"function"===typeof a.navHandlerFactory.createNavHandler?
a.navHandlerFactory.createNavHandler(this,this._navDict,a):new b.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:a?a.getChildrenFunc:null,setFocus:a&&a.setFocus,selectionPolicy:a?a.selectionPolicy:null}));var d=this;this.model.getRoot(function(c){c instanceof Array?d.getNavHandler().refreshModel(d.getNavDict(),d.model,c):c.children&&c.children instanceof Array&&d.getNavHandler().refreshModel(d.getNavDict(),d.model,c.children);a&&a.setFocus&&d.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,
checkbox:!1};return a}();a.createExplorerCommands=function(a,b){function d(a){return"function"===typeof a.getItemCount&&0<a.getItemCount()?b?b(a):!0:!1}var c=new g.Command({tooltip:k["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.expandAll()}}),n=new g.Command({tooltip:k["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",
visibleWhen:function(a){return d(a)},callback:function(a){a.items.collapseAll()}});a.addCommand(c);a.addCommand(n)};a.ExplorerModel=function(){function a(b,d,c){this.rootPath=b;this.fetchItems=d;this.idPrefix=c||""}a.prototype={destroy:function(){this.destroyed=!0},getRoot:function(a){var b=this;this.fetchItems(this.rootPath).then(function(c){b.root=c;a(c)})},getChildren:function(a,b){a.Children?b(a.Children):a.ChildrenLocation?this.fetchItems(a.ChildrenLocation).then(function(c){a.Children=c;b(c)}):
b([])},getId:function(a){if(a.Location===this.root.Location)return this.rootId;a=a.Location.replace(/[\\\/]/g,"");for(var b=this.idPrefix,c=0;c<a.length;c++)b=a[c].match(/[^\.\:\-\_0-9A-Za-z]/g)?b+a.charCodeAt(c):b+a[c];return b}};return a}();a.ExplorerFlatModel=function(){function b(a,d,c){this.rootPath=a;this.fetchItems=d;this.root=c}b.prototype=new a.ExplorerModel;b.prototype.getRoot=function(a){if(this.root)a(this.root);else{var b=this;this.fetchItems(this.rootPath).then(function(c){b.root=c;
a(c)})}};b.prototype.getChildren=function(a,b){a===this.root?b(this.root):b([])};return b}();a.ExplorerRenderer=function(){function a(b,d){this.explorer=d;this._init(b);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}a.prototype={_init:function(a){a&&(this._useCheckboxSelection=void 0===a.checkbox?!1:a.checkbox,this.selectionPolicy=a.singleSelection?"singleSelection":
"",this._cachePrefix=a.cachePrefix,this.getCheckedFunc=a.getCheckedFunc,this.onCheckedFunc=a.onCheckedFunc,this._highlightSelection=!0,this._treeTableClass=a.treeTableClass||"treetable",!1===a.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=a.actionScopeId),this.commandService||(this.commandService=a.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(a,b){this.tableTree=b;this.tableNode=a;h.empty(a);this._treeTableClass&&
a.classList.add(this._treeTableClass);this.renderTableHeader(a)},getActionsColumn:function(a,b,c,d,e){c=c||"tool";var g=document.createElement("td");g.id=b.id+"actionswrapper";d&&g.classList.add(d);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,g,a,this.explorer,c,null,e&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return g},initCheckboxColumn:function(a){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(a,b){if(this._useCheckboxSelection){var c=document.createElement("td"),d=document.createElement("span");d.id=this.getCheckBoxId(b.id);d.classList.add("core-sprite-check");d.classList.add("selectionCheckmarkSprite");d.rowId=b.id;this.getCheckedFunc&&(d.checked=this.getCheckedFunc(a),d.checked?(this._highlightSelection&&b.classList.add("checkedRow"),d.classList.add("core-sprite-check_on")):
(this._highlightSelection&&b.classList.remove("checkedRow"),d.classList.remove("core-sprite-check_on")));c.appendChild(d);var e=this;d.addEventListener("click",function(a){e.onCheck(b,a.target,a.target.checked?!1:!0,!0)},!1);return c}},getCheckBoxId:function(a){return a+"selectedState"},onCheck:function(a,b,c,d,e){(b.checked=c)?b.classList.add("core-sprite-check_on"):b.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(b.rowId,c,d);this.explorer.getNavHandler()&&e&&
this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(a.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var a=this.explorer.getNavHandler().getSelectionIds(),b=this._getUIStatePreferencePath();b&&window.sessionStorage&&(window.sessionStorage[b+"selection"]=JSON.stringify(a))}},_restoreSelections:function(a){var b=this.explorer.getNavDict(),c=this.explorer.getNavHandler();if(c&&b&&"cursorOnly"!==c.getSelectionPolicy()&&(a=window.sessionStorage[a+
"selection"],"string"===typeof a&&(a=0<a.length?JSON.parse(a):null),a)){for(var d=[],c=0;c<a.length;c++){var e=b.getValue(a[c]);if(e&&e.rowDomNode&&e.model&&(d.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=h.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(d),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(a){window.sessionStorage[a+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(a){var b=!1,c=window.sessionStorage[a+"expanded"];"string"===typeof c&&(c=0<c.length?JSON.parse(c):null);var d;if(c)for(d=0;d<c.length;d++)if(h.node(c[d])){this._expanded.push(c[d]);var e=this;this.tableTree.expand(c[d],function(){e._restoreSelections(a)});b=!0}return!b},_getUIStatePreferencePath:function(){if(this.explorer){var a=this.explorer.getRootPath();if(this._cachePrefix&&a)return a=a.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+a+"/uiState"}return null},expandCollapseImageId:function(a){return a+"__expand"},updateExpandVisuals:function(a,b){var c=h.node(this.expandCollapseImageId(a.id));c&&(c.classList.remove(this._expandImageClass),c.classList.remove(this._collapseImageClass),c.classList.remove(this._progressImageClass),c.classList.add("progress"===b?this._progressImageClass:b?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(a,b,c,d){var e=document.createElement("span");
e.id=this.expandCollapseImageId(a.id);b.appendChild(e);e.classList.add(this._twistieSpriteClass);e.classList.add(this._collapseImageClass);if(c){var g=document.createElement("span");b.appendChild(g);g.classList.add(d||"imageSprite");g.classList.add(c)}var h=this;e.onclick=function(c){if(!h.explorer.getNavHandler().isDisabled(a)){h.tableTree.toggle(a.id);if(h.tableTree.isExpanded(a.id))h._expanded.push(a.id),h.explorer.postUserExpand&&h.explorer.postUserExpand(a.id);else for(var b in h._expanded)if(h._expanded[b]===
a.id){h._expanded.splice(b,1);break}(c=h._getUIStatePreferencePath())&&window.sessionStorage&&h._storeExpansions(c)}};return e},render:function(a,b){b.classList.add("navRow");this.renderRow(a,b)},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(a,b){var c=!(b%
2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",d="darkSectionTreeTableRow"===c?"lightSectionTreeTableRow":"darkSectionTreeTableRow";a.classList.add(c);a.classList.remove(d)})},updateCommands:function(){if(this.commandService)for(var a=h.$$array(".treeTableRow"),b=0;b<a.length;b++){var c=a[b],d=h.node(c.id+"actionswrapper");this.commandService.destroy(d);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,d,c._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var a=this._getUIStatePreferencePath();a&&window.sessionStorage&&this._restoreExpansions(a)&&this._restoreSelections(a)}};return a}();a.SelectionRenderer=function(){function b(a,d){this._init(a);this.explorer=d}b.prototype=new a.ExplorerRenderer;b.prototype.renderTableHeader=function(a){var b=document.createElement("thead"),c=document.createElement("tr");b.classList.add("navTableHeading");this._useCheckboxSelection&&c.appendChild(this.initCheckboxColumn(a));for(var d=0,e=this.getCellHeaderElement(d);e;)0<
e.innerHTML.length&&e.classList.add("navColumn"),c.appendChild(e),e=this.getCellHeaderElement(++d);b.appendChild(c);0<d&&a.appendChild(b)};b.prototype.renderRow=function(a,b){b.verticalAlign="baseline";b.classList.add("treeTableRow");"cursorOnly"!==this.explorer.selectionPolicy&&b.classList.add("selectableNavRow");var c=this.explorer.getNavDict();if(c){c.addRow(a,b);var d=this;b.addEventListener("click",function(c){if(d.explorer.getNavHandler())d.explorer.getNavHandler().onClick(a,c)},!1)}if(c=this.getCheckboxColumn(a,
b))c.classList.add("checkColumn"),b.appendChild(c);for(var c=0,e=this.getCellElement(c,a,b);e;)b.appendChild(e),0===c?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(a)):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++c,a,b)};b.prototype.getCellHeaderElement=function(a){};b.prototype.getCellElement=function(a,b,c){};return b}();a.SimpleFlatModel=function(){function b(a,
d,c){this.items=a;this.getKey=c;this.idPrefix=d;this.root={children:a}}b.prototype=new a.ExplorerModel;b.prototype.getRoot=function(a){a(this.root)};b.prototype.getId=function(a){a=this.getKey(a).replace(/[\\\/]/g,"");for(var b="",c=0;c<a.length;c++)b=a[c].match(/[^\.\:\-\_0-9A-Za-z]/g)?b+a.charCodeAt(c):b+a[c];return this.idPrefix+b};b.prototype.getChildren=function(a,b){a===this.root?b(this.items):b([])};return b}();return a});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(k){function m(h,d,b){k.attach(this);this._binderFunc=d;this.setInputField(h);(h=b?b.group:null)||(h=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=h+"__completion__";this._proposeFromStart=b?b.proposeFromStart:!1;this._extendedProvider=b?b.extendedProvider:null;this._serviceRegistry=b?b.serviceRegistry:null;this._onDelete=b?b.onDelete:null;this._deleteToolTips=
b?b.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];b=function(b){this._binderFunc&&this._binderFunc(function(a){this._bind(a);b.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",b);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:b});b=function(b){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",b);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:b});b=function(b){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",b);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:b})}m.prototype._removeListeners=function(h){h&&h.forEach(function(d){d.evtTarget.removeEventListener(d.type,d.handler,!1)})};m.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};m.prototype.hasValueOf=function(h){return this._dataList.some(function(d){return d.value===h})};m.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(d){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(d){this.onKeyDown(d)}.bind(this);this._inputField.addEventListener("keydown",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:h});h=function(d){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",h);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:h});h=function(d){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(b){this._bind(b)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:h})};m.prototype.onKeyDown=function(h){if(this._dismissed)return!0;var d=h.charCode||h.keyCode;if(13===d){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===d||38===d)&&this._proposalList&&0<this._proposalList.length)return h.preventDefault(),this._walk(40===d),h.stopPropagation(),!1;if(27===d)return h.preventDefault(),this._dismiss(),!1;if(46===d&&-1<this._proposalIndex&&this._onDelete)return h.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),h.stopPropagation(),!1}return!0};m.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};m.prototype._bind=function(h){this._dataList=h};m.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};m.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
m.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)};m.prototype._createProposalLink=function(h,d,b,g){var a=document.createElement("a");
a.href=require.toUrl(d);a.appendChild(this._createBoldText(h,b,g));return a};m.prototype._createBoldText=function(h,d,b,g){if(0>d)return document.createTextNode(h);g=g?g:document.createElement("span");var a;0!==d&&(a=document.createTextNode(h.substring(0,d)),g.appendChild(a));var e=document.createElement("b");g.appendChild(e);a=document.createTextNode(h.substring(d,d+b));e.appendChild(a);d+b<h.length&&(a=document.createTextNode(h.substring(d+b)),g.appendChild(a));return g};m.prototype._proposeOnCategory=
function(h,d){if(0!==d.length){var b;if(h){b=document.createElement("li");b.className="inputCompletionLICategory";var g=document.createTextNode(h);b.appendChild(g);this._completionUL.appendChild(b)}d.forEach(function(a){b=document.createElement("li");b.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);b.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);b.className="inputCompletionLINormal";b.completionItem=a.item;var d;if("string"===typeof a.item.value){var g=
document.createElement("table");g.style.width="100%";g.style.tableLayout="fixed";g.style.borderSpacing="0";var l=document.createElement("tr");l.style.width=this._inputField.offsetWidth+"px";g.appendChild(l);var c=document.createElement("td");c.classList.add("inputCompletionLILeftTD");var n=this._createBoldText(a.item.value,a.boldIndex,a.boldLength);c.appendChild(n);c.style.overflow="hidden";l.appendChild(c);this._onDelete&&(d=document.createElement("button"),d.classList.add("inputCompletionDismissButton"),
d.classList.add("layoutRight"),d.classList.add("core-sprite-close"),d.classList.add("imageSprite"),d.style.display="none",d.style.margin="0 0 0",d.title=this._deleteToolTips,d.onclick=function(c){c.stopPropagation();this._onDelete(a.item.value,this);this._resetIndexAfterDeletion()}.bind(this),c=document.createElement("td"),c.classList.add("inputCompletionLIRightTD"),c.appendChild(d),l.appendChild(c));b.appendChild(g)}else a.item.value.name&&"link"===a.item.value.type&&b.appendChild(this._createProposalLink(a.item.value.name,
a.item.value.value,a.boldIndex,a.boldLength));this._completionUL.appendChild(b);this._proposalList.push({item:a.item,domNode:b,deleteBtn:d})}.bind(this))}};m.prototype._domNode2Index=function(h){if(this._proposalList)for(var d=0;d<this._proposalList.length;d++)if(this._proposalList[d].domNode===h)return d;return-1};m.prototype._highlight=function(h,d){var b=h,g,a=!1;isNaN(b)||(a=!0,this._proposalList&&0<=h&&h<this._proposalList.length?(b=this._proposalList[h].domNode,g=this._proposalList[h].deleteBtn):
b=null);b&&(b.className=d?"inputCompletionLISelected":"inputCompletionLINormal",g&&(g.style.display=d?"":"none"),d&&a&&(b.offsetTop<this._completionUIContainer.scrollTop?b.scrollIntoView(!0):b.offsetTop+b.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&b.scrollIntoView(!1)))};m.prototype._selectProposal=function(h,d){var b=h;isNaN(b)&&(b=this._domNode2Index(h));if(b!==this._proposalIndex||d)this._highlight(this._proposalIndex,!1),this._proposalIndex=b,
this._highlight(this._proposalIndex,!0)};m.prototype._dismiss=function(h,d){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&&(d?window.open(h.value):window.location.href=h.value),window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200))};m.prototype._show=function(){if(this._proposalList&&0<this._proposalList.length){for(var h=
0,d=0,b=this._inputField;b;)h+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=d+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"};m.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)};m.prototype._proposeOnList=function(h,d,b){var g="",a=[],e=d?d.length:0;h.forEach(function(f){if("category"===f.type)this._proposeOnCategory(g,a),g=f.label,a=[];else{var l=!0,c=-1;if(d&&b){var n;"string"===typeof f.value?n=f.value.toLowerCase():f.value.name&&(n=f.value.name.toLowerCase());c=n.indexOf(d);0>c?l=!1:this._proposeFromStart&&(l=0===c)}l&&a.push({item:f,boldIndex:c,
boldLength:e})}}.bind(this));this._proposeOnCategory(g,a)};m.prototype._proposeOn=function(h){this._completionUL.textContent="";var d=h?h.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,d,!0);this._extendedProvider&&d?this._extendedProvider(h,function(b){b&&b.forEach(function(b){this._proposeOnList(b.proposals,b.filterForMe?d:h,b.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};m.prototype.constructor=m;return{InputCompletion:m}});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/i18nUtil orion/commands orion/URL-shim".split(" "),function(k,m,h,d,b,g){function a(a){this.commandRegistry=a.commandRegistry;this.rootChangeListener=a.rootChangeListener;this.filesystemChangeDispatcher=a.filesystemChangeDispatcher;this.fileClient=a.fileClient;this.node=a.node;this.serviceRegistry=a.serviceRegistry;var b=this;this.listener=function(a){b.refresh(a.root)};this.rootChangeListener&&
this.rootChangeListener.addEventListener("rootChanged",this.listener);this.render()}m.mixin(a.prototype,{destroy:function(){this.rootChangeListener&&this.rootChangeListener.removeEventListener("rootChanged",this.listener);this.commandRegistry.destroy(this.node);h.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var a=this.commandRegistry,d=this.serviceRegistry,
g=new b.Command({name:k.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:k.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(a){return 1<d.getServiceReferences("orion.core.file").length},choiceCallback:this._switchFsMenuCallback.bind(this)});a.addCommand(g);a.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(a){var b=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(a){a=
a.getProperty("top");var c=b._fileServiceLabel(a,!0);return{checked:b.fileSystem===c,name:c,callback:b.setActiveFilesystem.bind(b,a)}})},render:function(){this.fsName=document.createElement("div");this.fsName.classList.add("filesystemName");this.fsName.classList.add("layoutLeft");this.menu=document.createElement("ul");this.menu.classList.add("filesystemSwitcher");this.menu.classList.add("commandList");this.menu.classList.add("layoutRight");this.menu.classList.add("pageActions");this.node.appendChild(this.fsName);
this.node.appendChild(this.menu);this.registerCommands();this.fsName.addEventListener("click",this._openMenu.bind(this))},_openMenu:function(a){if(a=h.$(".dropdownTrigger",this.menu)){var b=document.createEvent("MouseEvents");b.initEvent("click",!0,!0);a.dispatchEvent(b)}},_fileServiceHostname:function(a){a=this.fileClient.fileServiceRootURL(a);0===a.indexOf("filesystem:")&&(a=a.substr(11));var b=a;try{b=(new URL(a,window.location.href)).hostname}catch(d){}return b},_fileServiceLabel:function(a,b){var g=
this.fileClient.fileServiceName(a),c=this._fileServiceHostname(a);if(b)return d.formatMessage(k.FSTitle,g,c);var n=document.createDocumentFragment();n.textContent=k.FSTitle;h.processDOMNodes(n,[document.createTextNode(g),document.createTextNode(c)]);return n},refresh:function(a){var b=a;a.ChildrenLocation&&(b=a.ChildrenLocation);h.empty(this.fsName);this.fileSystem=this._fileServiceLabel(b,!0);this.fsName.appendChild(this._fileServiceLabel(b));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",
this.menu,{},"menu")},setActiveFilesystem:function(a){var b=a;a.ChildrenLocation&&(b=a.ChildrenLocation);a=this.fileClient.fileServiceRootURL(b);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:a})}});return{FilesystemSwitcher:a}});define("text!orion/globalSearch/searchBuilder.html",[],function(){return'\t\x3cdiv id\x3d"searchScope" class\x3d"searchScope"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"searchOptionBlock"\x3e\n\t\t\x3ctable\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cinput type\x3d"text" class\x3d"search-control" style\x3d"min-width:20em;" id\x3d"advSearchInput"\x3e\x3c/input\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cspan id\x3d"advSearchCmd" \x3e\x3c/span\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cinput type\x3d"text" class\x3d"search-control" style\x3d"min-width:20em;" id\x3d"advReplaceInput"\x3e\x3c/input\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cspan id\x3d"advReplacePreviewCmd" \x3e\x3c/span\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\x3c/table\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"searchOptionBlock"\x3e\n\t\t\x3ctable\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3clabel id\x3d"advSearchTypeLabel"  class\x3d"search-label"\x3e\x3c/label\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cselect id\x3d"advSearchTypes" class\x3d"search-control" style\x3d"min-width:10em;"\x3e\x3c/select\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3clabel id\x3d"advSortByLabel"  class\x3d"search-label"\x3e\x3c/label\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cselect id\x3d"advSortBy" class\x3d"search-control" style\x3d"min-width:10em;"\x3e\x3c/select\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3clabel id\x3d"advSearchCaseSensitiveLabel" class\x3d"search-label" \x3e\x3c/label\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cinput type\x3d"checkbox" id\x3d"advSearchCaseSensitive" class\x3d"search-control"\x3e\x3c/input\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3clabel id\x3d"advSearchRegExLabel"  class\x3d"search-label"\x3e\x3c/label\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cinput type\x3d"checkbox" id\x3d"advSearchRegEx" class\x3d"search-control"\x3e\x3c/input\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\x3c/table\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"searchOptionBlock"\x3e\n\t\t\x3ctable\x3e\n\t\t\t\x3ctr\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cinput type\x3d"text" class\x3d"search-control" style\x3d"min-width:20em;" id\x3d"advSaveSearchInput"\x3e\x3c/input\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\t\x3ctd\x3e\n\t\t\t\t\t\x3cspan id\x3d"advSaveSearchCmd" \x3e\x3c/span\x3e\n\t\t\t\t\x3c/td\x3e\n\t\t\t\x3c/tr\x3e\n\t\t\x3c/table\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"searchOptionBlock" id\x3d"moreOptions"\x3e\n\t\x3c/div\x3e'});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(k,m){var h;h=k.toUrl?(new URL(k.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(d){if(!d)return d;var b=window.location.protocol+"//"+window.location.host;return 0===d.indexOf(b)?d.substring(b.length):d},isAtRoot:function(d){return!d?!1:"/workspace"===d?!0:0===(new URL(d,window.location.href)).href.indexOf(h)}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(k,m,h,d,b,g,a,e,f){function l(a,c,b,d,e,g){this.registry=a;this.root=c;this.fileClient=b;this.idPrefix=d||"";this.excludeFiles=!!e;this.excludeFolders=!!g}function c(c){a.attach(this);this.registry=c.serviceRegistry;this.treeRoot=c.treeRoot;this.selection=c.selection;this.fileClient=
c.fileClient;this.excludeFiles=c.excludeFiles;this.excludeFolders=c.excludeFolders;this.navHandlerFactory=c.navHandlerFactory;this.parentId=c.parentId;this.renderer=c.rendererFactory(this);this.dragAndDrop=c.dragAndDrop;this.setFocus=c.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var b=c.modelEventDispatcher?c.modelEventDispatcher:new a;this.modelEventDispatcher=b;var d=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){b.addEventListener(a,
d._modelListeners[a]=d.modelHandler[a].bind(d))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)d.onLinkClick({type:"linkClick",item:a._item})}};(c=h.node(this.parentId))&&c.addEventListener("click",this._clickListener);var e=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";e.setTarget&&e.setTarget(a)}},
{pid:"nav.config"})}l.prototype=new g.ExplorerModel;e.mixin(l.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,c){var b=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var d=[],e;for(e in c)if(!(c[e].Directory?this.excludeFolders:this.excludeFiles))d.push(c[e]),c[e].parent=a,c[e].Parents||(c[e].Parents=b);c=d}else for(d in c)c[d].parent=a,c[d].Parents||(c[d].Parents=b);a.children=c;a.children.sort(function(a,c){var b=a.Directory;if(b!==c.Directory)return b?
-1:1;var b=a.Name&&a.Name.toLowerCase(),d=c.Name&&c.Name.toLowerCase();return b<d?-1:b>d?1:0});return c},getChildren:function(a,c){var b=this;if(a.children)c(a.children);else if(void 0!==a.Directory&&!1===a.Directory)c([]);else if(a.Children)c(b.processParent(a,a.Children));else if(a.Location){var d=null;this.registry&&(d=this.registry.getService("orion.page.progress"));(d?d.progress(this.fileClient.fetchChildren(a.ChildrenLocation),k["Fetching children of "]+a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(d){b.destroyed||
c(b.processParent(a,d))},function(){c([])})}else c([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});l.prototype.constructor=l;var n,q;c.prototype=Object.create(g.Explorer.prototype);e.mixin(c.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(c){a.modelEventDispatcher.removeEventListener(c,a._modelListeners[c])});var c=h.node(this.parentId);c&&c.removeEventListener("click",this._clickListener);g.Explorer.prototype.destroy.call(this)},
onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var c=this,b={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||c.treeRoot;b[a.Location]=a});return m.all(Object.keys(b).map(function(a){return c.changedItem(b[a],!0)}))},onModelMove:function(a){var c=this,b={};(a.items||[a]).forEach(function(a){var d=c.treeRoot;if((d.Location||d.ContentLocation)===a.oldValue.Location){var e=c.treeRoot;a=a.newValue;a=a.ChildrenLocation?
a:this.fileClient.read(a.ContentLocation,!0);return m.when(a,function(a){c.dispatchEvent({type:"rootMoved",oldValue:e,newValue:a});c.loadResourceList(a)})}d=(d=a.oldValue.parent)||c.treeRoot;b[d.Location]=d;d=(d=a.parent)||c.treeRoot;b[d.Location]=d;a.oldValue.Directory&&a.newValue&&c.isExpanded(a.oldValue)&&(b[a.newValue.Location]=a.newValue)});return m.all(Object.keys(b).map(function(a){return c.changedItem(b[a],!0)}))},onModelDelete:function(a){a=a.items||[a];var c=this,b=c.treeRoot,d;if(a.some(function(a){if(a.oldValue.Location===
(b.Location||b.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))d=a.parent;return!0}return!1}))return this.loadResourceList(d);var e={};a.forEach(function(a){a=a.parent;e[a.Location]=a});return m.all(Object.keys(e).map(function(a){return c.changedItem(e[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},
deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},_makeDropTarget:function(a,c,e){if(this.dragAndDrop){var g=this,l=this.dragAndDrop,m=function(a){n=a.target};e&&(this._oldDragStart&&c.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=m);c.addEventListener("dragstart",m,!1);m=function(a){n=null};e&&
(this._oldDragEnd&&c.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=m);c.addEventListener("dragend",m,!1);m=function(a){c.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};e&&(this._oldDragLeave&&c.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=m);c.addEventListener("dragleave",m,!1);m=function(a){if(n)q=a.dataTransfer.dropEffect=(f.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!f.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===
a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect="copy";c.classList.add("dragOver");h.stop(a)};e&&(this._oldDragEnter&&c.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=m);c.addEventListener("dragenter",m,!1);m=function(a){if(n)q=a.dataTransfer.dropEffect=(f.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!f.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect=
"copy";h.stop(a)};e&&!this._oldDragOver&&(c.addEventListener("dragover",m,!1),this._oldDragOver=m);var A=null,x=null;g.registry&&(A=g.registry.getService("orion.page.progress"),x=g.registry.getService("orion.page.message"));var z=function(a){if(x){var c=null,c="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;x.setProgressResult(c)}else window.console.log(a)},p=function(c,e,g,f,n,l,h){!g.Location&&g.fileMetadata&&(g=g.fileMetadata);e=e||"";if(c.isFile)b.isAtRoot(g.Location)?
z(k["You cannot copy files directly into the workspace.  Create a folder first."]):c.file(function(a){n(g,a,f,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(d.formatMessage(k["Unzip ${0}?"],a.name)))});else if(c.isDirectory){var q=c.createReader(),u=function(a){q.readEntries(function(b){for(var d=0;d<b.length;d++)p(b[d],e+c.name+"/",a,f,n,l,!0)})};b.isAtRoot(g.Location)?(A?A.progress(l.createProject(g.ChildrenLocation,c.name),d.formatMessage(k["Creating ${0}"],c.name)):l.createProject(g.ChildrenLocation,
c.name)).then(function(a){f.loadResourceList(f.treeRoot.Path,!0);(A?A.progress(l.read(a.ContentLocation,!0),k["Loading "]+a.name):l.read(a.ContentLocation,!0)).then(function(a){u(a)},z)},z):(A?A.progress(l.createFolder(g.Location,c.name),d.formatMessage(k["Creating ${0}"],c.name)):l.createFolder(g.Location,c.name)).then(function(c){var b=f.modelEventDispatcher;h||b.dispatchEvent({type:"create",parent:a,newValue:c});u(c)},z)}},m=function(e){var B;c.classList.remove("dragOver");if(n){B=g.fileClient;
for(var f=n,I;f;){if(f._item){I=f._item;break}f=f.parentNode}if(!I)return;var H="copy"===q,f=H?B.copyFile:B.moveFile;(A?A.showWhile(f.apply(B,[I.Location,a.Location]),d.formatMessage(k[H?"Copying ${0}":"Moving ${0}"],I.Location)):f.apply(B,[I.Location,a.Location])).then(function(c){g.modelEventDispatcher.dispatchEvent({type:H?"copy":"move",oldValue:I,newValue:c,parent:a})},z)}else if(e.dataTransfer.items&&0<e.dataTransfer.items.length)for(B=0;B<e.dataTransfer.items.length;B++)f=null,"function"===
typeof e.dataTransfer.items[B].getAsEntry?f=e.dataTransfer.items[B].getAsEntry():"function"===typeof e.dataTransfer.items[B].webkitGetAsEntry&&(f=e.dataTransfer.items[B].webkitGetAsEntry()),f&&p(f,null,a,g,l,g.fileClient);else if(e.dataTransfer.files&&0<e.dataTransfer.files.length)for(B=0;B<e.dataTransfer.files.length;B++)f=e.dataTransfer.files[B],!f.size&&!f.type?z(d.formatMessage(k["Did not drop ${0}.  Folder drop is not supported in this browser."],f.name)):b.isAtRoot(a.Location)?z(k["You cannot copy files directly into the workspace.  Create a folder first."]):
l(a,f,g,f.name.indexOf(".zip")===f.name.length-4&&window.confirm(d.formatMessage(k["Unzip ${0}?"],f.name)));h.stop(e)};e&&(this._oldDrop&&c.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=m);c.addEventListener("drop",m,!1)}},createModel:function(){return new l(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,c){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,c);var b=
this,d=new m;a.children=a.Children=null;this.model.getChildren(a,function(e){b.getNavHandler();b.myTree.refresh.bind(b.myTree)(a,e,c);d.resolve(e)});return d},showItem:function(a,c){var b=new m;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return b.reject();var d=this.getRow(a);if(d)b.resolve(d._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],c).then(function(c){var b=this.getRow(a);
return!b?this.changedItem(c,!0).then(function(){var c=this.getRow(a);return c?c._item:(new m).reject()}.bind(this)):b._item||a}.bind(this))):void 0===c||c?this.reroot(a):b.reject();return b},expandItem:function(a,c){var b=new m;this.showItem(a,c).then(function(a){this.myTree.isExpanded(a)?b.resolve(a):this.myTree.expand(this.model.getId(a),function(){b.resolve(a)})}.bind(this),b.reject);return b},reveal:function(a,c){return this.showItem(a,c).then(function(a){var c=this.getNavHandler();c&&(c.cursorOn(a,
!0),c.setSelection(a));return a}.bind(this))},reroot:function(a){return(new m).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return h.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},loadResourceList:function(a,c,d){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=b.makeRelative(a);if(!c&&a===this._lastPath)return(new m).resolve(this.treeRoot);this._lastPath=a;
var e=this;return c||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),k["Loading "]+a).then(function(c){e.treeRoot.Path=a;"function"===typeof d&&d();e.dispatchEvent({type:"rootChanged",root:e.treeRoot});return(new m).resolve(e.treeRoot)},function(a){e.treeRoot.Path=null;e.dispatchEvent({type:"rootChanged",root:e.treeRoot});return(new m).reject(a)}):(new m).resolve(e.treeRoot)},load:function(a,c,b){var d=h.node(this.parentId),e=h.node("progress");e||(e=document.createElement("div"),
e.id="progress",h.empty(d),d.appendChild(e));h.empty(e);var g=setTimeout(function(){h.empty(e);e.appendChild(document.createTextNode(c))},500),f=this;return m.when(a,function(a){clearTimeout(g);if(!f.destroyed){f.treeRoot={};for(var c in a)f.treeRoot[c]=a[c];f.model=f.createModel();f.dragAndDrop&&(f._hookedDrag?f._makeDropTarget(f.treeRoot,d,!0):(a=(a=d&&("draggable"in d||"ondragstart"in d&&"ondrop"in d))&&!(!window.File||!window.FileList||!window.FileReader),f._hookedDrag=!0,a?f._makeDropTarget(f.treeRoot,
d,!0):(f.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var p=new m;f.createTree(f.parentId,f.model,{onComplete:function(a){p.resolve(a)},navHandlerFactory:f.navHandlerFactory,setFocus:"undefined"===typeof f.setFocus?!0:f.setFocus,selectionPolicy:f.renderer.selectionPolicy,onCollapse:function(a){if(f.getNavHandler())f.getNavHandler().onCollapse(a)}});return p.then(function(){if("function"===typeof b)try{b()}catch(a){f.registry&&f.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===
typeof f.onchange)f.onchange(f.treeRoot);return f.treeRoot})}},function(a){clearTimeout(g);f.registry&&f.registry.getService("orion.page.message").setProgressResult(a);return(new m).reject(a)})},onchange:function(a){}});c.prototype.constructor=c;return{FileExplorer:c,FileModel:l}});
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,m,h,d,b,g,a,e){function f(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 l(c,d,e,l,h,k,A,x,z){d=g.clone(d);var p;if(d.Directory)p=document.createElement("a"),
p.className="navlinkonpage",p.href=!c?n:(new a(c+"#{,resource,params*}")).expand({resource:d.ChildrenLocation}),d.Name&&p.appendChild(document.createTextNode(d.Name));else{h||(h=b.getOpenWithCommands(e));p=document.createElement("a");p.className="navlink targetSelector";k&&"object"===typeof k&&Object.keys(k).forEach(function(a){p[a]=k[a]});var y=null,B=null;if(y=x?x.holderDom:p)B=document.createElement("span"),B.className="core-sprite-file modelDecorationSprite thumbnail",y.appendChild(B);d.Name&&
p.appendChild(document.createTextNode(d.Name));var C=d.Location;A&&"object"===typeof A&&(d.params={},g.mixin(d.params,A));(c=b.getOpenWithCommand(e,d,h))&&(C=c.hrefCallback({items:d}));m.when(l.getFileContentType(d),function(a){if(y){var c=y,b=B;if(a){var e,g=a.imageClass,n=a.image;g?(e=document.createElement("span"),e.className+=g,e.classList.add("thumbnail")):n&&(e=document.createElement("img"),e.src=n,e.classList.add("thumbnail"));e&&c.replaceChild(e,b)}}p.href=C;z&&"function"===typeof z.updateFileNode&&
z.updateFileNode(d,p,f(a))})}p.addEventListener("click",function(){q=d}.bind(this),!1);return p}function c(a,c,b,d){this.explorer=c;this.commandService=b;this.contentTypeService=d;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var n=new a("#{,resource,params*}"),q;c.prototype=new h.SelectionRenderer;c.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};c.prototype.tableCallback=function(a){a.setAttribute("aria-label",k.Navigator);a.setAttribute("role",
"presentation")};c.prototype.rowCallback=function(a,c){a.setAttribute("role","treeitem")};c.prototype.emptyCallback=function(a){var c=document.createElement("tr"),b=document.createElement("td");b.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=k.NoFile;var g=document.createElement("span");g.appendChild(document.createTextNode(k.File));e.processDOMNodes(d,[g]);b.appendChild(d);c.appendChild(b);a.appendChild(c)};c.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"}};c.prototype.setTarget=function(a){this.target=a};c.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};c.prototype.createFolderNode=function(a){var c;this.showFolderLinks?(c=l(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&
c.insertBefore(a,c.firstChild)):(c=document.createElement("span"),c.textContent=a.Name);return c};c.prototype.updateFileNode=function(a,c,b){};c.prototype.showFolderLinks=!0;c.prototype.getCellElement=function(a,c,e){switch(a){case 0:a=document.createElement("td");var g=document.createElement("span");g.id=e.id+"MainCol";g.setAttribute("role","presentation");a.appendChild(g);a.setAttribute("role","presentation");g.className="mainNavColumn";var f;c.Directory?(this.getExpandImage(e,g),f=this.createFolderNode(c),
g.appendChild(f),this.explorer._makeDropTarget(c,f),this.explorer._makeDropTarget(c,e)):(this.openWithCommands||(this.openWithCommands=b.getOpenWithCommands(this.commandService)),f=l("",c,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this),g.appendChild(f));f&&(f.id=e.id+"NameLink",1===f.nodeType&&(d.addNavGrid(this.explorer.getNavDict(),c,f),f.setAttribute("role","link"),f.setAttribute("tabindex","-1")));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,
g,c,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;e=document.createElement("td");c.LocalTimeStamp&&(e.textContent=(new Date(c.LocalTimeStamp)).toLocaleString());return e;case 2:if(this.oneColumn)return null;e=document.createElement("td");!c.Directory&&"number"===typeof c.Length&&(c=parseInt(c.Length,10)/1024,e.textContent=Math.ceil(c).toLocaleString()+" KB");e.style.textAlign="right";return e}};c.prototype.constructor=c;return{NavigatorRenderer:c,isImage:f,getClickedItem:function(){return q},
createLink:l}});
define("orion/globalSearch/advSearchOptContainer","i18n!orion/search/nls/messages require orion/fileClient orion/searchUtils orion/contentTypes orion/i18nUtil orion/webui/littlelib orion/inputCompletion/inputCompletion orion/Deferred orion/commands orion/section orion/objects orion/EventTarget orion/widgets/filesystem/filesystemSwitcher text!orion/globalSearch/searchBuilder.html orion/explorers/explorer-table orion/explorers/explorerNavHandler orion/explorers/navigatorRenderer orion/PageUtil orion/selection".split(" "),function(k,
m,h,d,b,g,a,e,f,l,c,n,q,s,u,r,t,v,w,A){function x(a,c,p,e){q.attach(this);this._parentDiv=a;this._searcher=c;this._serviceRegistry=p;(this._contentTypeService=this._serviceRegistry.getService("orion.core.contentTypeRegistry"))||(this._contentTypeService=new b.ContentTypeRegistry(this._serviceRegistry));this.contentTypesCache=this._contentTypeService.getContentTypes();this._commandService=e;this.fileClient=new h.FileClient(this._serviceRegistry);this.fsToolbar=null;this.fileSysChangeListener=function(a){a=
a.newInput;var c=d.generateSearchHref({resource:a});window.location=c;this._rootURL=a}.bind(this);this.addEventListener("filesystemChanged",this.fileSysChangeListener);this.fsToolbar||(a=this.fsToolbar=document.createElement("div"),a.classList.add("fsToolbarLayout"),a.classList.add("fsToolbar"),this._parentDiv.parentNode.insertBefore(a,this._parentDiv));this.fsSwitcher=new s.FilesystemSwitcher({commandRegistry:this._commandService,rootChangeListener:this,filesystemChangeDispatcher:this,fileClient:this.fileClient,
node:this.fsToolbar,serviceRegistry:this._serviceRegistry})}function z(c,b,p,d){this._parent=a.node(c);this._optRenderer=new x(this._parent,b,p,d);this._optRenderer.render()}function p(a){a.setFocus=!1;a.cachePrefix=null;a.excludeFiles=!0;a.rendererFactory=function(c){c=new C({checkbox:!1,showFolderImage:!0,treeTableClass:"sectionTreeTable"},c,a.commandRegistry,a.contentTypeRegistry);c.oneColumn=!0;c.showFolderLinks=!1;return c};a.navHandlerFactory={createNavHandler:function(a,c,b){b.setFocus=!1;
b.gridClickSelectionPolicy="active";return new y(a,c,b)}};B.apply(this,arguments);this.treeRoot={}}function y(a,c,b){I.apply(this,arguments)}n.mixin(x.prototype,{destroy:function(){this.removeEventListener("filesystemChanged",this.fileSysChangeListener);this.fileSysChangeListener=null;this._searchScopeExplorer&&(this._searchScopeExplorer.destroy(),this._searchScopeExplorer=null)},getOptions:function(){var a="";this._searchLocations.forEach(function(c){a&&(a=a.concat(","));a=a.concat(c)},this);return{keyword:this._searchBox.value,
sort:this._sortBy.options[this._sortBy.selectedIndex].value,rows:40,start:0,replace:this._replaceBox.value?this._replaceBox.value:void 0,caseSensitive:this._caseSensitiveCB.checked,regEx:this._regExCB.checked,fileType:this._fileTypes.options[this._fileTypes.selectedIndex].value,resource:a}},loadSearchParams:function(a){this._searchParams=a;this._locationName=null;this._rootURL=this.fileClient.fileServiceRootURL(this._searchParams.resource);a=function(){this._searchLocations=[this._rootURL];this._searchScopeExplorer&&
this._searchScopeExplorer.loadRoot(this._rootURL);this._locationName=k.root;this._searchNameBox&&(this._searchNameBox.value=this._getDefaultSaveName())}.bind(this);this.dispatchEvent({type:"rootChanged",root:this._rootURL});0<this._searchParams.resource.length&&this._rootURL!==this._searchParams.resource?this._serviceRegistry.getService("orion.page.progress").progress(this.fileClient.read(this._searchParams.resource,!0),"Getting file metadata "+this._searchParams.resource).then(function(a){var c=
a.Parents?d.fullPathNameByMeta(a.Parents):"";this._locationName=0===c.length?a.Name:c+"/"+a.Name;this._searchNameBox&&(this._searchNameBox.value=this._getDefaultSaveName());this._searchScopeSection&&(this._searchLocations=[this._searchParams.resource],this._searchScopeExplorer&&this._searchScopeExplorer.loadRoot(this._rootURL).then(function(){this._searchScopeExplorer.reveal(a)}.bind(this)))}.bind(this),a):a();this._loadSearchParams()},_loadSearchParams:function(){if(this._init&&this._searchParams){this._searchBox.value=
this._searchParams.keyword?this._searchParams.keyword:"";this._replaceBox.value=this._searchParams.replace?this._searchParams.replace:"";this._caseSensitiveCB.checked=this._searchParams.caseSensitive;this._regExCB.checked=this._searchParams.regEx;var a;for(a=0;a<this._fileTypes.options.length;a++)if(this._fileTypes.options[a].value===this._searchParams.fileType){this._fileTypes.selectedIndex=a;break}for(a=0;a<this._sortBy.options.length;a++)if(this._sortBy.options[a].value===this._searchParams.sort){this._sortBy.selectedIndex=
a;break}}},render:function(){this._contentTypeService.getContentTypes().then(function(a){this.contentTypesCache=a;this._render()}.bind(this))},_render:function(){this._parentDiv.innerHTML=u;this._initHTMLLabels();this._initControls();this._searchBox.focus()},_submitSearch:function(){var a=this.getOptions();a.replace=null;d.doSearch(this._searcher,this._serviceRegistry,a.keyword,a)},_replacePreview:function(){var a=this.getOptions();a.replace||(a.replace="");a.keyword&&d.doSearch(this._searcher,this._serviceRegistry,
a.keyword,a)},_saveSearch:function(){if(this._searchBox.value&&this._searchNameBox.value){var a=this.getOptions(),a=d.generateSearchHref(a).split("#")[1];this._serviceRegistry.getService("orion.core.savedSearches").addSearch(this._searchNameBox.value,a)}},_getDefaultSaveName:function(){if(this._searchBox&&this._searchBox.value){var a="'"+this._searchBox.value+"' in ",c=k.root;this._locationName&&(c=this._locationName);return a+c}return""},_initCompletion:function(){var a=function(a){d.getMixedSearches(this._serviceRegistry,
!0,!1,function(c){var b,p=[],d=!1,e=!1;for(b in c)c[b].label&&c[b].value?(d||(p.push({type:"category",label:k["Saved searches"]}),d=!0),p.push({type:"proposal",value:{name:c[b].label,value:m.toUrl("search/search.html")+"#"+c[b].value,type:"link"}})):(e||(p.push({type:"category",label:k["Recent searches"]}),e=!0),p.push({type:"proposal",label:c[b].name,value:c[b].name}));a(p)})}.bind(this),c=function(a,c){var b=this._serviceRegistry.getServiceReferences("orion.search.proposal");if(!b||0===b.length)c(null);
else{var p=[];b.forEach(function(c){var b=c.getProperty("filterForMe");p.push(this._serviceRegistry.getService(c).run(a).then(function(a){for(var c={filterForMe:b,proposals:[]},p=0;p<a.length;p++){c.proposals.push({type:"category",label:a[p].category});for(var d=0;d<a[p].datalist.length;d++)c.proposals.push({type:"proposal",label:a[p].datalist[d],value:a[p].datalist[d]})}return c}))}.bind(this));f.all(p).then(function(a){c(a)})}}.bind(this);this._completion=new e.InputCompletion(this._searchBox,a,
{serviceRegistry:this._serviceRegistry,group:"globalSearch",extendedProvider:c,onDelete:function(a,c){d.removeRecentSearch(this._serviceRegistry,a,c)}.bind(this),deleteToolTips:k["Click or use delete key to delete the search term"]})},_initControls:function(){this._searchBox=document.getElementById("advSearchInput");this._replaceBox=document.getElementById("advReplaceInput");this._searchNameBox=document.getElementById("advSaveSearchInput");this._fileTypes=document.getElementById("advSearchTypes");
this._sortBy=document.getElementById("advSortBy");this._caseSensitiveCB=document.getElementById("advSearchCaseSensitive");this._regExCB=document.getElementById("advSearchRegEx");for(var a=[{label:k["All types"],value:d.ALL_FILE_TYPE}],c=0;c<this.contentTypesCache.length;c++)if("text/plain"===this.contentTypesCache[c]["extends"]||"text/plain"===this.contentTypesCache[c].id)for(var b=0;b<this.contentTypesCache[c].extension.length;b++)a.push({label:this.contentTypesCache[c].extension[b],value:this.contentTypesCache[c].extension[b]});
a.forEach(function(a){var c=document.createElement("option"),b=document.createTextNode(a.label);c.appendChild(b);this._fileTypes.appendChild(c);c.value=a.value}.bind(this));[{label:k["Path name"],value:"Path asc"},{label:k["File name"],value:"NameLower asc"}].forEach(function(a){var c=document.createElement("option"),b=document.createTextNode(a.label);c.appendChild(b);this._sortBy.appendChild(c);c.value=a.value}.bind(this));this._init=!0;this._loadSearchParams();this._initCompletion();this._searchBox.addEventListener("keydown",
function(a){a.defaultPrevented||13===(a.charCode||a.keyCode)&&this._submitSearch()}.bind(this));this._searchBox.addEventListener("change",function(a){this._searchNameBox.value=this._getDefaultSaveName()}.bind(this));this._replaceBox.addEventListener("keydown",function(a){13===(a.charCode||a.keyCode)&&this._replacePreview()}.bind(this));this._fileTypes.addEventListener("change",function(a){a=this._fileTypes.options[this._fileTypes.selectedIndex].value;this._searchBox.placeholder=a===d.ALL_FILE_TYPE?
k["Type a search term"]:g.formatMessage(k["All ${0} files"],a)}.bind(this));a=new l.Command({name:k.Search,id:"orion.globalSearch.search",callback:function(a){this._submitSearch()}.bind(this),visibleWhen:function(a){return!0}});c=new l.Command({name:k.Replace,id:"orion.globalSearch.previewCurrentPage",callback:function(a){this._replacePreview()}.bind(this),visibleWhen:function(a){return!0}});b=new l.Command({name:k.Save,tooltip:k["Save the current search"],id:"orion.globalSearch.saveSearch",callback:function(a){this._saveSearch()},
visibleWhen:function(a){return!0}});this._commandService.addCommand(a);this._commandService.addCommand(c);this._commandService.addCommand(b);this._commandService.registerCommandContribution("advSearchCmd","orion.globalSearch.search",1);a=[];this._commandService.renderCommands("advSearchCmd","advSearchCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button");this._commandService.registerCommandContribution("advReplacePreviewCmd","orion.globalSearch.previewCurrentPage",1);a=[];this._commandService.renderCommands("advReplacePreviewCmd",
"advReplacePreviewCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button");this._commandService.registerCommandContribution("advSaveSearchCmd","orion.globalSearch.saveSearch",1);a=[];this._commandService.renderCommands("advSaveSearchCmd","advSaveSearchCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button");this._initSearchScope()},_initHTMLLabels:function(){document.getElementById("advSearchInput").placeholder=k["Type a search term"];document.getElementById("advReplaceInput").placeholder=
k["Type a replace term"];document.getElementById("advSaveSearchInput").placeholder=k["Type a name for the search"];document.getElementById("advSearchTypeLabel").appendChild(document.createTextNode(k["File type"]));document.getElementById("advSearchCaseSensitiveLabel").appendChild(document.createTextNode(k["Case sensitive"]));document.getElementById("advSearchRegExLabel").appendChild(document.createTextNode(k["Regular expression"]));document.getElementById("advSortByLabel").appendChild(document.createTextNode(k["Sort by"]))},
_initSearchScope:function(){this._searchLocations=[];var b=w.matchResourceParameters().resource;this._rootURL=this.fileClient.fileServiceRootURL(b);b?this._searchLocations.push(b):this._searchLocations.push(this._rootURL);this._searchScopeDiv=a.$("#searchScope",this._parentDiv);this._searchScopeSection=new c.Section(this._searchScopeDiv,{id:"searchScopeSection",title:k.Scope+": ",canHide:!0,hidden:!0});this._setSearchScopeTitle();b=document.createElement("div");b.id="searchScopeExplorerNode";var d=
new A.Selection(this._serviceRegistry,"searchScopeSelection");this._selectionListener=function(a){this._searchLocations=[];(a=a.selections)?a.forEach(function(a){this._searchLocations.push(a.Location)},this):this._searchLocations.push(this._rootURL);this._searchLocations&&this._searcher.setLocationbyURL(this._searchLocations.join(","));this._setSearchScopeTitle()}.bind(this);d.addEventListener("selectionChanged",this._selectionListener);this._searchScopeExplorer=new p({parentId:b,serviceRegistry:this._serviceRegistry,
fileClient:this.fileClient,commandRegistry:this._commandService,contentTypeRegistry:this._contentTypeService,selection:d,advSearchOptRenderer:this});this._searchScopeSection.embedExplorer(this._searchScopeExplorer,b);this._searchScopeExplorer.setCommandsVisible(!0,"singleSelection");this._searchScopeExplorer.loadRoot(this._rootURL)},_setSearchScopeTitle:function(){var c=this._searchScopeSection.getTitleElement();a.empty(c);c.appendChild(document.createTextNode(k.Scope+": "));this._searchLocations.forEach(function(a){var b=
decodeURI(a),p=b;if(this.fileClient.fileServiceRootURL(p)===a)p=k.root;else{var d=p.split("/");d&&((p=d.pop())||(p=d.pop()))}d=document.createElement("span");d.classList.add("searchScopeElement");d.dataset.locationString=a;d.title=b;p!==k.root?(a=document.createElement("span"),a.classList.add("searchScopePreButtonText"),a.appendChild(document.createTextNode(p)),d.appendChild(a),this._insertDeleteButton(d)):d.appendChild(document.createTextNode(p));c.appendChild(d)},this)},_insertDeleteButton:function(a){var c=
document.createElement("button");c.classList.add("imageSprite");c.classList.add("core-sprite-delete");c.classList.add("scopeDeleteButton");a.appendChild(c);var b=function(){var c=a.dataset.locationString,b=this._searchLocations.indexOf(c);this._searchLocations.splice(b,1);0===this._searchLocations.length&&this._searchLocations.push(this.fileClient.fileServiceRootURL());var b=this._searchScopeExplorer,p=b.getNavHandler();if("singleSelection"===p.getSelectionPolicy())b.selection.setSelections(null),
p.refreshSelection(!0,!0);else{var d=null;b.selection.getSelections().some(function(a){return a.Location===c?(d=a,!0):!1});d&&p.setSelection(d,!0,!1)}this._setSearchScopeTitle()}.bind(this);c.addEventListener("click",b)}});z.prototype.getRenderer=function(){return this._optRenderer};z.prototype.constructor=z;var B=r.FileExplorer,C=v.NavigatorRenderer,I=t.ExplorerNavHandler;p.prototype=Object.create(B.prototype);n.mixin(p.prototype,{loadRoot:function(a){a=a||this.fileClient.fileServiceRootURL();return this.loadResourceList(a)}});
p.prototype.constructor=p;y.prototype=Object.create(I.prototype);n.mixin(y.prototype,{onClick:function(c,b){I.prototype.onClick.call(this,c,b);var p=a.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(c)));b.target!==p&&this.isExpandable(c)&&(this.isExpanded(c)?this.explorer.myTree.collapse(c):this.explorer.myTree.expand(c))}});y.prototype.constructor=y;return{AdvSearchOptContainer:z,AdvSearchOptRenderer:x}});
define("orion/searchOutliner","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/section orion/commands orion/commandRegistry orion/keyBinding orion/selection orion/explorers/explorer orion/EventTarget orion/globalSearch/advSearchOptContainer".split(" "),function(k,m,h,d,b,g,a,e,f,l,c,n){function q(a){this._searches=[];c.attach(this);this._init(a);this._initializeSearches()}function s(a,c){this.explorer=c;this._init(a)}function u(a,c){this.selection=c;this.registry=
a;this.renderer=new s({checkbox:!1},this)}function r(c){var b=h.node(c.parent);if(!b)throw"no parent";if(!c.serviceRegistry)throw"no service registry";this._parent=b;this._registry=c.serviceRegistry;this.commandService=c.commandService;var b=new g.Command({name:k.Rename,imageClass:"core-sprite-rename",id:"eclipse.renameSearch",parameters:new a.ParametersDescription([new a.CommandParameter("name","text","Name:","")]),visibleWhen:function(a){a=Array.isArray(a)?a:[a];return 1===a.length&&a[0].query},
callback:function(a){var c=Array.isArray(a.items)?a.items[0]:a.items;a.parameters&&a.parameters.valueFor("name")&&this._registry.getService("orion.core.savedSearches").renameSearch(c.query,a.parameters.valueFor("name"))}.bind(this)}),e=new g.Command({name:"Delete",imageClass:"core-sprite-delete",id:"eclipse.deleteSearch",visibleWhen:function(a){a=Array.isArray(a)?a:[a];if(0===a.length)return!1;for(var c=0;c<a.length;c++)if(!a[c].query)return!1;return!0},callback:function(a){a=Array.isArray(a.items)?
a.items:[a.items];var b=1===a.length?d.formatMessage("Are you sure you want to delete '${0}' from the searches?",a[0].name):d.formatMessage("Are you sure you want to delete these ${0} searches?",a.length);if(window.confirm(b))for(b=0;b<a.length;b++)c.serviceRegistry.getService("orion.core.savedSearches").removeSearch(a[b].query)}});this.commandService.addCommand(b);this.commandService.addCommand(e);if(b=this._registry.getService("orion.core.savedSearches")){var f=this._registry;b.getSearches().then(function(a){this.render(a.searches,
f)}.bind(this));b.addEventListener("searchesChanged",function(a){this.render(a.searches,a.registry)}.bind(this))}}function t(a){var c=h.node(a.parent);if(!c)throw"no parent";if(!a.serviceRegistry)throw"no service registry";this._parent=c;this._registry=a.serviceRegistry;this.commandService=a.commandService;this.advSearchOptContainer=new n.AdvSearchOptContainer(this._parent,a.searcher,this._registry,this.commandService)}q.prototype={_init:function(a){this._registry=a.serviceRegistry;this._serviceRegistration=
this._registry.registerService("orion.core.savedSearches",this)},_notifyListeners:function(){this.dispatchEvent({type:"searchesChanged",searches:this._searches,registry:this._registry})},_initializeSearches:function(){var a=this;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var b;c=c.get("search");"string"===typeof c&&(c=JSON.parse(c));if(c)for(b in c)a._searches.push(c[b]);a._notifyListeners()})},_storeSearches:function(){var a=this._searches;
this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("search",a)})},addSearch:function(a,c){var b=!1,e;for(e in this._searches)this._searches[e].query===c&&(this._searches[e].name=a,b=!0);b?this._registry.getService("orion.page.message").setProgressResult({Message:d.formatMessage(k["${0} is already saved"],a),Severity:"Warning"}):this._searches.push({name:a,query:c});this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},
removeSearch:function(a){for(var c in this._searches)if(this._searches[c].query===a){this._searches.splice(c,1);break}this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},renameSearch:function(a,c){var b=!1,d;for(d in this._searches)if(this._searches[d].query===a){var e=this._searches[d];e.name!==c&&(e.name=c,b=!0)}b&&(this._searches.sort(this._sorter),this._storeSearches(),this._notifyListeners())},getSearches:function(){return{searches:this._searches}},_sorter:function(a,
c){var b=a.name.toLowerCase(),d=c.name.toLowerCase();return b>d?1:b<d?-1:0}};s.prototype=l.SelectionRenderer.prototype;s.prototype.constructor=s;s.prototype.getLabelColumnIndex=function(){return 0};s.prototype.getCellElement=function(a,c,b){if(c.query){a=m.toUrl("search/search.html")+"#"+c.query;var d=document.createElement("td");b.appendChild(d);d.classList.add("mainNavColumn");d.classList.add("singleNavColumn");b=document.createElement("a");b.href=a;b.className="navlinkonpage";d.appendChild(b);
b.appendChild(window.document.createTextNode(c.name))}};u.prototype=l.Explorer.prototype;u.prototype.constructor=u;r.prototype={render:function(a,c){var d=this.commandService;if(!this.searchesSection){this.searchesSection=new b.Section(this._parent,{id:"searchSection",title:k["My Saved Searches"],content:'\x3cdiv id\x3d"searchContent"\x3e\x3c/div\x3e',useAuxStyle:!0,preferenceService:c.getService("orion.core.preference"),slideout:!0,canHide:!0});this.searchSelection=new f.Selection(c,"orion.searches.selection");
var g=this.searchesSection.selectionNode.id,n;n=new e.KeyBinding(113);n.domScope="searchContent";n.scopeName=k["My Saved Searches"];this.commandService.registerCommandContribution(g,"eclipse.renameSearch",1,null,!1,n);n=new e.KeyBinding(46);n.domScope="searchContent";n.scopeName=k["My Saved Searches"];this.commandService.registerCommandContribution(g,"eclipse.deleteSearch",2,null,!1,n);d.registerSelectionService(g,this.searchSelection);c.getService("orion.searches.selection").addEventListener("selectionChanged",
function(a){var c=h.node(g);c&&(d.destroy(c),d.renderCommands(g,c,a.selections,this,"button"))})}if(0<a.length)this.searchTable=(new u(c,this.searchSelection)).createTree("searchContent",new l.SimpleFlatModel(a,"srch",function(a){return a.query}));else if(n=h.node("searchContent")){var p=document.createElement("p");p.textContent=k["Save frequently used searches by clicking on the ${0} button above."];var y=document.createElement("b");y.textContent=k.Save;h.processDOMNodes(p,[y]);h.empty(n);n.appendChild(p)}}};
r.prototype.constructor=r;t.prototype={loadSearchParams:function(a){this.advSearchOptContainer.getRenderer().loadSearchParams(a)}};t.prototype.constructor=r;return{SavedSearches:q,SearchOutliner:r,SearchBuilder:t}});
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,m,h,d,b,g,a,e,f){function l(a,c){this.serviceRegistry=a;this.commandRegistry=c;this.openWithCommands=null}function c(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new l(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}l.prototype.makeRenderFunction=function(c,g,l,u,r){var t=this.serviceRegistry,v=this.commandRegistry;this.openWithCommands=this.openWithCommands||e.createOpenWithCommands(t,c,v);var w=this;return function(e,x,t,p){f.when(w.openWithCommands,function(y){if(t)h.empty(g),y=document.createElement("div"),y.appendChild(document.createTextNode(k["Search failed."])),g.appendChild(y),"function"===typeof u&&u(g);else{var B=
function(){function a(c,b){var p=b.folderName?b.folderName:b.path,d=document.createElement("span");d.id=p.replace(/[^a-zA-Z0-9_\.:\-]/g,"");d.appendChild(document.createTextNode(" - "+p+" "));c.appendChild(d)}var c={};return function(b,p){var d=p.name;if(c.hasOwnProperty(d)){a(b,p);var e=c[d];"function"===typeof e&&(c[d]=null,e())}else c[d]=function(){a(b,p)}}}(),f=!1;h.empty(g);if(e&&0<e.length){var I=document.createElement("table");I.setAttribute("role","presentation");for(var H=0;H<e.length;H++){var G=
e[H],K;f||(f=!0,l&&(K=I.insertRow(0).insertCell(0),K.textContent=l));K=I.insertRow(-1).insertCell(0);K.colspan=2;r&&r(K);var F={Name:G.name,Directory:G.directory,Location:G.path||G.location},D=null;"number"===typeof G.LineNumber&&(D={},D.line=G.LineNumber);if(p&&p.keyword&&!p.nameSearch){var E=b.generateSearchHelper(p),D=D||{};D.find=E.inFileQuery.searchStr;D.regEx=E.inFileQuery.wildCard?!0:void 0}F=a.createLink(m.toUrl("edit/edit.html"),F,v,c,y,{"aria-describedby":(G.folderName?G.folderName:G.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},D);G.LineNumber&&F.appendChild(document.createTextNode(" (Line "+G.LineNumber+")"));K.appendChild(F);B(K,G)}g.appendChild(I);"function"===typeof u&&u(g)}!f&&x&&(y=d.formatMessage(k["No matches found for ${0}"],x),h.empty(g),g.appendChild(document.createTextNode(y)),"function"===typeof u&&u(g))}})}};c.prototype={search:function(a,c,d){var e=function(a){for(var d=[],e=0;e<a.response.docs.length;e++){var g=a.response.docs[e],f=g.Location,n=b.path2FolderName(g.Path?
g.Path:g.Location,g.Name),p=n?n:f;(c?0<=p.indexOf(c):1)&&d.push({name:g.Name,path:f,folderName:n,directory:g.Directory,lineNumber:g.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(c){d(e(c),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(c){var b=a.keyword,b=b.substring(b.indexOf("}")+1),b=b.substring(b.indexOf(":")+1);d(e(c),b,null,a)},function(a){d(null,
null,a,null)})}catch(f){"string"===typeof f&&-1<f.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(c){d(e(c),null,null,a)}):"string"===typeof f&&-1<f.indexOf("search")&&!a.nameSearch?(new g.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(c){d(e(c),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(f)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,c){console.error(a);h.empty(c);c.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,c){var b="",e=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);c&&a&&a.Parents&&0<a.Parents.length?e="last"===c.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(e=a);e?(this.setLocationbyURL(e.Location),b=e.Name,this._childrenLocation=e.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
b=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);e=h.node("search");b||(b="");if(e&&e.placeholder){e.value="";var g=d.formatMessage(k["Search ${0}"],b);e.placeholder=30<g.length?g.substring(0,27)+"...":d.formatMessage(k["Search ${0}"],b)}e&&e.title&&(e.title=k["Type a keyword or wild card to search in "]+b)},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,c,b,d){b=b?this.getSearchRootLocation():this.getSearchLocation();return c?{resource:b,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:b,sort:d&&d.sort?d.sort:"Path asc",rows:d&&d.rows?d.rows:40,start:0,caseSensitive:d?d.caseSensitive:void 0,regEx:d?d.regEx:void 0,fileType:d?d.fileType:void 0,keyword:a,replace:d?d.replace:void 0}}};c.prototype.constructor=c;return{Searcher:c}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(k,m){function h(a,b,d){return a[b].apply(a,d)}function d(a){this._location=a}function b(){var a=new m;a.reject(k["No Matching OperationService for location:"]+this._location);return a}function g(a){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=a.getService("orion.core.preference");for(var b=a.getServiceReferences("orion.core.operation"),
g=0;g<b.length;g++){var l=a.getService(b[g]);this._services[g]=l;l=b[g].getProperty("pattern")||".*";"^"!==l[0]&&(l="^"+l);this._patterns[g]=RegExp(l)}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 d(a)}}d.prototype={getOperation:b,getOperations:b,removeCompletedOperations:b,removeOperation:b,cancelOperation:b};d.prototype.constructor=d;g.prototype={getOperations:function(){var a=
new m;if(this._operations)return a.resolve(this._operations),a;var b=this;this._preferenceService.getPreferences("/operations").then(function(d){b._operations=d;a.resolve(b._operations)});return a},getOperation:function(a){return h(this._getService(a),"getOperation",arguments)},removeCompletedOperations:function(){for(var a=[],b=this,d=0;d<this._services.length;d++){var g=this._patterns[d],c=new m;a[d]=c.promise;h(this._services[d],"removeCompletedOperations").then(function(a){return function(c){Array.isArray(c)&&
b.getOperations.bind(b)().then(function(b){for(var d=b.keys(),e=0;e<d.length;e++){var f=d[e];g.test(f)&&0>c.indexOf(f)&&b.remove(f)}a.resolve()})}}(c),function(a){return function(c){a.reject(c)}}(c))}return m.all(a)},removeOperation:function(a){var b=this;return h(this._getService(a),"removeOperation",arguments).then(function(d){b.getOperations.bind(b)().then(function(b){b.remove(a)})},function(a){return a},function(a){return a})}};g.prototype.constructor=g;return{OperationsClient:g}});
define("text!orion/globalSearch/search-features.html",[],function(){return'\x3cdiv id\x3d"replaceTopWidget_id" style\x3d"height:100%;width:100%;position:relative;"\x3e\n\t\x3cdiv id\x3d"replaceTop" class\x3d"topPanelLayout"\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"replaceSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv id\x3d"replaceBottom" class\x3d"bottomPanelLayout"\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/globalSearch/search-features",["orion/webui/littlelib","orion/webui/splitter","orion/globalCommands","text!orion/globalSearch/search-features.html"],function(k,m,h,d){var b=b||{};b.SearchUIFactory=function(){function b(a){this._parentDivID=a.parentDivID}b.prototype={buildUI:function(){var a=k.node(this._parentDivID);a.innerHTML=d;var b=k.$("#replaceTop",a),g=k.$("#replaceBottom",a),a=k.$(".replaceSplitLayout",a);a.id="replaceSplitter";var l=new m.Splitter({node:a,sidePanel:b,mainPanel:g,
vertical:!0});window.setTimeout(function(){l._adjustToSplitPosition(!0)},100);l.addResizeListener(function(a){a===g&&this._compareWidget&&this._compareWidget.resizeEditors&&this._compareWidget.resizeEditors()}.bind(this));var c=h.getMainSplitter();c&&c.splitter&&c.splitter.addResizeListener(function(a){a===c.main&&this._compareWidget&&this._compareWidget.getSplitter()&&this._compareWidget.getSplitter()._adjustToSplitPosition(!0)}.bind(this))},destroy:function(){},setCompareWidget:function(a){this._compareWidget=
a},getMatchDivID:function(){return"replaceTop"},getCompareDivID:function(){return"replaceBottom"}};return b}();return b});define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\x3cdiv id\x3d"topWidget_id" style\x3d"height:100%;width:100%;position:relative"\x3e\n\t\x3cdiv class\x3d"leftPanelLayout "\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"left_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"left_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent" id\x3d"left_editor_id"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"left_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"split compareSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"rightPanelLayout"\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"right_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"right_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent"  id\x3d"right_editor_wrapper_id"\x3e\n\t\t\t\x3cdiv class\x3d"canvasContainer"\x3e\n\t\t\t\t\x3ccanvas id\x3d"diff_canvas_id" class\x3d"compareCanvas" width\x3d"46" height\x3d"3000"\x3e\x3c/canvas\x3e\n\t\t\t\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"compareEditorParentWithCanvas" id\x3d"right_editor_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"right_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(k,m,h){var d=d||{};d.TwoWayCompareUIFactory=function(){function b(b){this._parentDivID=b.parentDivID;this._commandSpanId=b.commandSpanId;this._showTitle=b.showTitle;this._leftTitle=b.leftTitle;this._rightTitle=b.rightTitle;this._showLineStatus=b.showLineStatus}b.prototype={_init:function(){var b=this._parentDivID+"_";this._topWidgetDiv=k.node("topWidget_id");
this._topWidgetDiv.id=b+"topWidget_id";this._leftEditorParentDiv=k.node("left_editor_id");this._leftEditorParentDiv.id=b+"left_editor_id";this._rightEditorParentDiv=k.node("right_editor_id");this._rightEditorParentDiv.id=b+"right_editor_id";this._rightEditorWrapperDiv=k.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=b+"right_editor_wrapper_id";this._leftActionDiv=k.node("left_action_id");this._leftActionDiv.id=b+"left_action_id";this._rightActionDiv=k.node("right_action_id");this._rightActionDiv.id=
b+"right_action_id";this._leftTitleDiv=k.node("left_title_id");this._leftTitleDiv.id=b+"left_title_id";this._rightTitleDiv=k.node("right_title_id");this._rightTitleDiv.id=b+"right_title_id";this._leftStatusDiv=k.node("left_status_id");this._leftStatusDiv.id=b+"left_status_id";this._rightStatusDiv=k.node("right_status_id");this._rightStatusDiv.id=b+"right_status_id";this._diffCanvasDiv=k.node("diff_canvas_id");this._diffCanvasDiv.id=b+"diff_canvas_id";this._splitterId=b+"orion_splitter";this._showTitle||
this.disableTitle();this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var b=k.$(".split",this._topWidgetDiv);b.id=this._splitterId;var a=k.$(".leftPanelLayout",this._topWidgetDiv),d=k.$(".rightPanelLayout",this._topWidgetDiv);b&&a&&d&&(this._splitter=new m.Splitter({node:b,sidePanel:a,mainPanel:d}))},buildUI:function(){k.node(this._parentDivID).innerHTML=h;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(b){return k.$(".leftPanelLayout",
this._topWidgetDiv)===b},getEditorParentDiv:function(b){return b?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(b){return b?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(b){return b?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(b){return b?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top=
"0px";this._rightEditorWrapperDiv.style.top="0px";this._leftTitleDiv.style.height="0px";this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px";this._rightEditorWrapperDiv.style.marginBottom="0px";this._leftStatusDiv.style.height="0px";this._rightStatusDiv.style.height="0px"}};return b}();return d});
define("orion/compare/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","Copy current change from left to right":"Copy current change from left to right","Switch to unified diff":"Switch to unified diff",Unified:"Unified","Switch to side by side diff":"Switch to side by side diff","Side by side":"Side by side","Generate link of the current diff":"Generate link of the current diff","Generate Link":"Generate Link","Next diff block":"Next diff block",
"Previous diff block":"Previous diff block","Next diff change":"Next diff change","Previous diff change":"Previous diff change","Copy the link URL:":"Copy the link URL:",Compare:"Compare","Open the compare page":"Open the compare page","fetching...":"fetching...","There are unsaved changes.":"There are unsaved changes.","ERROR: ":"ERROR: ","Compare...":"Compare...","files changed":" files changed",Location:"Location",Options:"Options","Sort by folders":"Sort by folders","Line 0 : Col 0":"Line 0 : Col 0",
"No Matching DiffService for location:":"No Matching DiffService for location:","${0} files compared. The two folders are identical.":"${0} files compared. The two folders are identical."});define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(k,m){var h={root:m};Object.keys(k).forEach(function(d){"undefined"===typeof h[d]&&(h[d]=k[d])});return h});
define("orion/compare/diffParser",[],function(){var k=k||{};k.DiffParser=function(){function k(d,b){this._lineDelimiter=d?d:h?"\r\n":"\n";this._diffLineDelimiter=b?b:this._lineDelimiter;this._DEBUG=!1}var h=-1!==window.navigator.platform.indexOf("Win");k.prototype={_init:function(){this._oFileContents=[];this._diffContents=[];this._oBlocks=[];this._nBlocks=[];this._hunkRanges=[];this._lastToken=" ";this._deltaMap=[];this._nFileContents=[];this._nNewLineAtEnd=this._oNewLineAtEnd=!0;this._diffContentIndex=
1},setLineDelim:function(d){this._diffLineDelimiter=this._lineDelimiter=d},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(d,b,g,a){this._init();if(""===b)return{outPutFile:d,mapper:[]};this._oFileContents=""===d?[]:d.split(this._lineDelimiter);this._diffContents=b.split(this._diffLineDelimiter);b=this._diffContents.length;this._hunkRanges=[];for(var e=0;e<b;e++){var f=this._parseHunkRange(e);f&&this._hunkRanges.push(f)}if(0===this._hunkRanges.length)return{outPutFile:d,
mapper:[]};this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(a){console.log(a)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(d=0;d<this._hunkRanges.length;d++)this._parseHunkBlock(d);this._DEBUG&&(console.log("***Original Hunk range blocks: \n"),console.log(JSON.stringify(this._oBlocks)),console.log("***New Hunk range blocks: \n"),console.log(JSON.stringify(this._nBlocks)));this._buildMap(g);this._DEBUG&&(console.log("***New Line at end of file(original): \n"),
console.log(JSON.stringify(this._oNewLineAtEnd)),console.log("***New Line at end of file(new): \n"),console.log(JSON.stringify(this._nNewLineAtEnd)),console.log("***Mapper: \n"),this._logMap(),console.log("***Total line number in original file: "+this._oFileContents.length));a||this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var d=0;d<this._deltaMap.length;d++)if(console.log(JSON.stringify(this._deltaMap[d])),
0<this._deltaMap[d][2]){console.log("    **Diff content on change/add: \n");for(var b=0;b<this._deltaMap[d][0];b++)console.log("    "+this._diffContents[this._deltaMap[d][2]+b-1])}},_logNewFile:function(){for(var d=0;d<this._nFileContents.length;d++)console.log(this._nFileContents[d])},_createBlock:function(d,b,g,a){a===g&&" "===d||(g=[g,a-g,"s"],"-"===d?g[2]="r":"+"===d?g[2]="a":"c"===d&&(g[2]="c"),b.push(g))},_createMinusBlock:function(d,b,g){var a=this._oBlocks.length;0===a||d!==this._oBlocks[a-
1][0]?(this._oBlocks.push([0===d?1:d,g]),this._nBlocks.push([b,0,-2])):this._oBlocks[a-1][1]+=g},_createPlusBlock:function(d,b,g,a){var e=this._nBlocks.length;0===e||b!==this._nBlocks[e-1][0]?(this._oBlocks.push([0===d?1:d,0]),this._nBlocks.push([b,g,a])):(this._nBlocks[e-1][1]+=g,this._nBlocks[e-1][2]=a)},_parseHunkBlock:function(d){for(var b=" ",g=this._hunkRanges[d][0]+1,a=d===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[d+1][0],e=0,f=0,l=this._hunkRanges[d][1],c=this._hunkRanges[d][3],
n=g,h=g;h<a;h++)if(0!==this._diffContents[h].length){var k=this._diffContents[h][0];if("\\"===k&&("\\ No newline at end of file"===this._diffContents[h].substring(0,this._diffContents[h].length-1)||"\\ No newline at end of file"===this._diffContents[h]))"-"===b?this._oNewLineAtEnd=!1:" "===b?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,h>g&&"\r"===this._diffContents[h-1][this._diffContents[h-1].length-1]&&(this._diffContents[h-1]=this._diffContents[h-1].substring(0,this._diffContents[h-
1].length-1));else{switch(k){case "-":case "+":case " ":break;default:continue}if(b!==k){"+"===k&&(n=h);switch(b){case " ":l=this._hunkRanges[d][1]+e;c=this._hunkRanges[d][3]+f;break;case "-":this._createMinusBlock(l,c,this._hunkRanges[d][1]+e-l);break;case "+":this._createPlusBlock(l,c,this._hunkRanges[d][3]+f-c,n)}b=k}switch(k){case "-":e++;break;case "+":f++;break;case " ":e++,f++}}}switch(b){case "-":this._createMinusBlock(l,c,this._hunkRanges[d][1]+e-l);break;case "+":this._createPlusBlock(l,
c,this._hunkRanges[d][3]+f-c,n)}},_detectConflictes:function(d,b){if(0>d)return!1;for(var g=d+b,a=d;a<g;a++){var e=this._diffContents[a];if(-1<e.indexOf("\x3c\x3c\x3c\x3c\x3c")||-1<e.indexOf("\x3e\x3e\x3e\x3e\x3e"))return!0}return!1},_buildMap:function(d){var b=this._oBlocks.length,g=this._oFileContents.length,a=0,e;e=1;for(var f=0;f<b;f++)e=this._oBlocks[f][0]-e,0<e&&(this._deltaMap.push([e,e,0]),a+=e),d&&this._detectConflictes(this._nBlocks[f][2],this._nBlocks[f][1])?this._deltaMap.push([this._nBlocks[f][1],
this._oBlocks[f][1],this._nBlocks[f][2]+1,1]):this._deltaMap.push([this._nBlocks[f][1],this._oBlocks[f][1],this._nBlocks[f][2]+1]),a+=this._oBlocks[f][1],e=this._oBlocks[f][0]+this._oBlocks[f][1];0<g-e&&(this._deltaMap.push([g-e+1,g-e+1,0]),a+=g-e+1);a<g&&(e=g-a,d=this._deltaMap[this._deltaMap.length-1],0===d[2]?(d[0]+=e,d[1]+=e):-1===d[2]?this._deltaMap.push([e,e,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([e,e,0]):(this._nNewLineAtEnd&&(d[0]+=e),this._oNewLineAtEnd&&(d[1]+=
e)))},_buildNewFile:function(){var d=1,b=!1,g=this._deltaMap.length,a,e;for(a=0;a<g;a++){b=!1;if(0===this._deltaMap[a][2]){for(e=0;e<this._deltaMap[a][0];e++)this._nFileContents.push(this._oFileContents[d+e-1]);b=!0}else if(0<this._deltaMap[a][2])for(e=0;e<this._deltaMap[a][0];e++)this._nFileContents.push(this._diffContents[this._deltaMap[a][2]+e-1].substring(1));d+=this._deltaMap[a][1]}this._nNewLineAtEnd&&!b&&this._nFileContents.push("")},_converHRangeBody:function(d,b){if(d){var g=parseInt(d,10);
b.push(0<=g?g:1)}else b.push(1)},_parseHunkRange:function(d){var b=this._diffContents[d],g=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,a=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/.exec(b),e=null;if(a&&5===a.length)e=[d],this._converHRangeBody(a[1],e),this._converHRangeBody(a[2],e),this._converHRangeBody(a[3],e),this._converHRangeBody(a[4],e);else if((a=g.exec(b))&&5===a.length)e=[d],this._converHRangeBody(a[3],e),this._converHRangeBody(a[4],
e),this._converHRangeBody(a[1],e),this._converHRangeBody(a[2],e);return e}};return k}();return k});
define("orion/compare/compareUtils",["orion/URITemplate"],function(k){var m=m||{};m.compareUtils=m.compareUtils||{};m.compareUtils.lookUpMapper=function(h,d,b){for(var g=0,a=0;a<h.length;a++){var e=h[a][d];0===e&&(e=1);if(b>=g&&b<g+e)return{mapperIndex:a,startFrom:g};if(a===h.length-1)break;g+=h[a][d]}return{mapperIndex:h.length-1,startFrom:g}};m.compareUtils.lookUpLineIndex=function(h,d,b){if(0===b)return 0;for(var g=0,a=0;a<b;a++)g+=h[a][d];return g};m.compareUtils.updateMapper=function(h,d,b,g,
a){if(g!==a&&(0<g||0<a)){var e=m.compareUtils.lookUpMapper(h,d,b);if(!(0>e.mapperIndex)){if(0<g){var f=b-e.startFrom;for(b=e.mapperIndex;b<h.length;b++){f=h[b][d]-f;if(g<=f){h[b][d]-=g;break}h[b][d]-=f;g-=f;f=0}}0<a&&(h[e.mapperIndex][d]+=a)}}};m.compareUtils.overlapMapper=function(h,d,b,g,a){h=b+h[d]-1;h<b&&(h=b);a<g&&(a=g);return h<g||a<b?!1:!0};m.compareUtils.findFirstDiff=function(h,d,b,g){for(var a=0,e=null,f=0;f<h.length&&!(a>g)&&(!m.compareUtils.overlapMapper(h[f],d,a,b,g)||!(e={mapperIndex:f,
startFrom:a},0!==h[f][2]));f++)a+=h[f][d];return e};m.compareUtils.matchMapper=function(h,d,b,g){if(0===h.length)return b;var a=b+Math.round((g-b)/3),e=m.compareUtils.findFirstDiff(h,d,b,g),f=0===h[e.mapperIndex][d]?e.startFrom:e.startFrom+h[e.mapperIndex][d]-1,l=m.compareUtils.lookUpLineIndex(h,1-d,e.mapperIndex),c=e.startFrom-b;return 0===h[e.mapperIndex][2]?l-c:a>=e.startFrom&&a<=f?l-Math.round((g-b)/3):a<e.startFrom?l-c:(0===h[e.mapperIndex][1-d]?l:l+h[e.mapperIndex][1-d]-1)-(f-b)};m.compareUtils.getMapperLineCount=
function(h){for(var d=0,b=0;b<h.length;b++)d+=Math.max(h[b][0],h[b][1]);return d};m.compareUtils.getAnnotationIndex=function(h,d){for(var b=0;b<h.length;b++)if(h[b][0]===d)return b;return-1};m.compareUtils.getAnnotationMapperIndex=function(h,d){return h[d][1]};m.compareUtils.getAnnotationIndexByMapper=function(h,d){for(var b=0;b<h.length;b++)if(h[b][1]===d)return{current:b,prev:b-1,next:b+1};return{current:-1,prev:-1,next:-1}};m.compareUtils.isMapperConflict=function(h,d){return 0>d||!h[d][3]?!1:
1===h[d][3]};m.compareUtils.mergeDiffBlocks=function(h,d,b,g,a,e){for(var f=0;f<d.length;f++){var l=d[f][0],c=b[d[f][1]];if(0<c[0]){for(var n="",q=0;q<c[0];q++)n=n+g[c[2]-1+q].substring(a)+e;c=h.getLineCount();l>=c&&(l=h.getLineEnd(c-1),q=h.getLineEnd(c-1,!0),l===q?(h.setText(e,l,l),l=c):l=c-1);l=h.getLineStart(l);h.setText(n,l,l)}}};m.compareUtils.generateCompareHref=function(h,d){var b=require.toUrl("compare/compare.html");d.conflict||(d.conflict=void 0);d.readonly||(d.readonly=void 0);return(new k(b+
"#{,resource,params*}")).expand({resource:h,params:d})};m.compareUtils.generateCompareTreeHref=function(h,d){var b=require.toUrl("compare-tree/compare-tree.html");return(new k(b+"#{,resource,params*}")).expand({resource:h,params:d})};return m.compareUtils});
define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(k){var m=m||{};m.CompareRuler=function(){function h(d,b,g){this._location=d||"left";this._overview=b||"page";this._rulerStyle=g;this._editor=null;var a=this;this._listener={onModelChanged:function(b){a._onModelChanged(b)}}}h.prototype={setView:function(d){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=d;this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",
this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(d){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(d){},isAnnotationTypeVisible:function(d){return!1},removeAnnotationType:function(d){},setAnnotationModel:function(d){},getAnnotations:function(d,b){for(var g=[],a=d;a<b;a++){var e=this.getStyle(a);e&&(g[a]={html:this.getHTML(a),style:e})}return g},getWidestAnnotation:function(){return{html:this.getHTML(-1),
style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}};return h}();m.LineNumberCompareRuler=function(){function h(d,b,g,a,e,f){m.CompareRuler.call(this,g,"page",a);this._diffNavigator=d;this._oddStyle=e||{style:{backgroundColor:"white"}};this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=b}h.prototype=new m.CompareRuler;h.prototype.getStyle=function(d){return void 0===d?this._rulerStyle:this._evenStyle};h.prototype.getHTML=function(d){var b=
this._editor.getModel(),g=this._diffNavigator.getFeeder(0===this._mapperColumnIndex);return!g?"":-1===d?b.getLineCount():g.getLineNumber?(d=g.getLineNumber(d),-1===d?"":d+1):d+1};h.prototype._onModelChanged=function(d){var b=d.start,g=this._editor.getModel();d=g.getLineCount();var a=(d+"").length;this._numOfDigits!==a&&(this._numOfDigits=a,b=g.getLineAtOffset(b),this._editor.redrawLines(b,d,this))};return h}();m.CompareOverviewRuler=function(){function h(d,b,g,a){this._diffNavigator=g;this._onClick=
a;m.CompareRuler.call(this,d,"document",b)}h.prototype=new m.CompareRuler;h.prototype.getStyle=function(d){var b,g;if(void 0===d)b=this._rulerStyle||{},g=b.style||(b.style={}),g.lineHeight="1px",g.fontSize="1px",g.width="14px";else if(b=-1!==d?{styleClass:"annotationOverview breakpoint"}:{},g=b.style||(b.style={}),g.cursor="pointer",g.width="8px",g.left="2px",0<=d){var a;if(this._diffNavigator&&this._diffNavigator.getFeeder())a=this._diffNavigator.getFeeder().getDiffBlocks();else return null;d=k.getAnnotationIndex(a,
d);if(-1===d)return null;a=k.getAnnotationMapperIndex(a,d);var e;e=this._diffNavigator.getMapper();if(a=k.isMapperConflict(e,a))g.border="1px #FF0000 solid";d===this._diffNavigator.getCurrentBlockIndex()&&(g.backgroundColor=a?"red":"blue");d=this._diffNavigator.getFeeder().getDiffBlockH(d);a=this._diffNavigator.getFeeder().getOverviewLineCount();if(0>d)return null;e=this._editor.getClientArea();d=Math.floor(e.height*d/a);2>d&&(d=2);g.height=d+"px"}else return null;return b};h.prototype.setDiffNavigator=
function(d){this._diffNavigator=d};h.prototype.getHTML=function(d){return"\x26nbsp;"};h.prototype.onClick=function(d,b){void 0!==d&&this._onClick(d,this)};h.prototype._onModelChanged=function(d){0<this._editor.getModel().getLineCount()&&this._editor.redrawLines(0,1,this)};return h}();m.CompareCurveRuler=function(){function h(d){this._canvasDiv=d;this._mapper=void 0}h.prototype={init:function(d,b,g,a){this._rightIniting=this._rightIniting=this._leftIniting=!0;this._mapper=d;this._leftEditor=b;this._rightEditor=
g;this._leftTextView=b.getTextView();this._rightTextView=g.getTextView();this._diffNavigator=a;this.render()},matchPositionFrom:function(d){var b=d?this._leftTextView:this._rightTextView,g=d?this._rightTextView:this._leftTextView,a=b.getTopIndex(),b=b.getBottomIndex();d=k.matchMapper(this._mapper,d?0:1,a,b);g.setTopIndex(d)},copyTo:function(d){if(this._diffNavigator.iterator){var b=this._diffNavigator.iterator.cursor();if(b&&("word"===b.type?!b.copied&&!b.parent.copied:!b.copied)){var g=d?this._rightTextView.getText(b.oldA.start,
b.oldA.end):this._leftTextView.getText(b.newA.start,b.newA.end),a=d?b.newA:b.oldA;(d?this._leftTextView:this._rightTextView).setText(g,a.start,a.end);b.copied=!0}}},render:function(){if(this._mapper){var d=this._canvasDiv.getContext("2d");d.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);d.strokeStyle="#AAAAAA";d.lineWidth=1;d.beginPath();var b=this._leftTextView.getTopIndex(),g=this._leftTextView.getBottomIndex(),a=this._rightTextView.getTopIndex(),e=this._rightTextView.getBottomIndex();
this._leftLineH=this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var f=0,l=0,c=!1,n=0;n<this._mapper.length;n++){if(0!==this._mapper[n][2])if(k.overlapMapper(this._mapper[n],0,f,b,g)||k.overlapMapper(this._mapper[n],1,l,a,e))this._renderCurve(n,f,l,this._canvasDiv,d,b,g,a,e),c=!0;else if(c)break;f+=this._mapper[n][0];l+=this._mapper[n][1]}d.stroke()}},_renderCurve:function(d,b,g,a,e,f,l,c,n){f=this._mapper[d];b=this._leftTextView.getLinePixel(b+f[0]/2)+f[0]%
2*this._leftLineH/3-this._leftTextView.getTopPixel();g=this._rightTextView.getLinePixel(g+f[1]/2)+f[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel();a=a.parentNode.clientWidth;d===this._diffNavigator.getCurrentMapperIndex()?(e.stroke(),e.strokeStyle="#000",e.lineWidth=1,e.beginPath(),e.moveTo(0,b),e.bezierCurveTo(a/3,b,0.666*a,g,a,g),e.stroke(),e.strokeStyle="#AAAAAA",e.lineWidth=1,e.beginPath()):(e.moveTo(0,b),e.bezierCurveTo(a/3,b,0.666*a,g,a,g),e.stroke())},onChanged:function(d,b){var g=
b?this._rightIniting:this._leftIniting;if(d.removedLineCount!==d.addedLineCount){var a=b?this._rightTextView:this._leftTextView;g||k.updateMapper(this._mapper,b?1:0,a.getModel().getLineAtOffset(d.start),d.removedLineCount,d.addedLineCount);(0<d.removedLineCount||0<d.addedLineCount)&&this.render()}b?this._rightIniting=!1:this._leftIniting=!1;return g}};return h}();return m});
define("orion/editor/i18n",{load:function(k,m,h,d){m.specified&&m.specified("orion/bootstrap")?m(["orion/i18n!"+k],function(b){h(b)}):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,m){var h={root:m},d;for(d in k)k.hasOwnProperty(d)&&"undefined"===typeof h[d]&&(h[d]=k[d]);return h});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(k,m,h){function d(b,d){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(b);this.setLineDelimiter(d)}d.prototype={destroy:function(){},find:function(b){1<this._text.length&&(this._text=[this._text.join("")]);var d=b.string,a=b.regex,e=d,f="",l=b.caseInsensitive;if(e)if(a){if(d=m.parse(e))e=d.pattern,f=d.flags}else e=d.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),l&&(e=e.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var c=null,n;if(e){var d=b.reverse,h=b.wrap,a=b.wholeWord,k=b.start||0;b=b.end;var u=null!==b&&void 0!==b;-1===f.indexOf("g")&&(f+="g");-1===f.indexOf("m")&&(f+="m");l&&-1===f.indexOf("i")&&(f+="i");a&&(e="\\b"+e+"\\b");var r=this._text[0],t,v,w=0;u&&(l=k<b?k:b,r=r.substring(l,k<b?b:k),w=l);var A=RegExp(e,f);d?n=function(){var a=null;for(A.lastIndex=0;;){v=A.lastIndex;t=A.exec(r);if(v===A.lastIndex)return null;if(t){if(!(t.index+w<k)){if(!h||a)break;k=r.length+w}a={start:t.index+
w,end:A.lastIndex+w}}else break}a&&(k=a.start);return a}:(u||(A.lastIndex=k),n=function(){for(;;){v=A.lastIndex;t=A.exec(r);if(v===A.lastIndex)break;if(t)return{start:t.index+w,end:A.lastIndex+w};if(!(0!==v&&h))break}return null});c=n()}return{next:function(){var a=c;a&&(c=n());return a},hasNext:function(){return null!==c}}},getCharCount:function(){for(var b=0,d=0;d<this._text.length;d++)b+=this._text[d].length;return b},getLine:function(b,d){var a=this.getLineCount();if(!(0<=b&&b<a))return null;
var e=this._lineOffsets[b];if(b+1<a){a=this.getText(e,this._lineOffsets[b+1]);if(d)return a;for(var e=a.length,f;10===(f=a.charCodeAt(e-1))||13===f;)e--;return a.substring(0,e)}return this.getText(e)},getLineAtOffset:function(b){var d=this.getCharCount();if(!(0<=b&&b<=d))return-1;var a=this.getLineCount();if(b===d)return a-1;var e,f,l=this._lastLineIndex;if(0<=l&&l<a&&(e=this._lineOffsets[l],f=l+1<a?this._lineOffsets[l+1]:d,e<=b&&b<f))return l;for(var c=a,n=-1;1<c-n;)if(l=Math.floor((c+n)/2),e=this._lineOffsets[l],
f=l+1<a?this._lineOffsets[l+1]:d,b<=e)c=l;else if(b<f){c=l;break}else n=l;return this._lastLineIndex=c},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(b,d){var a=this.getLineCount();if(!(0<=b&&b<a))return-1;if(b+1<a){a=this._lineOffsets[b+1];if(d)return a;for(var e=this.getText(Math.max(this._lineOffsets[b],a-2),a),f=e.length,l;10===(l=e.charCodeAt(f-1))||13===l;)f--;return a-(e.length-f)}return this.getCharCount()},
getLineStart:function(b){return!(0<=b&&b<this.getLineCount())?-1:this._lineOffsets[b]},getText:function(b,d){void 0===b&&(b=0);void 0===d&&(d=this.getCharCount());if(b===d)return"";for(var a=0,e=0,f;e<this._text.length;){f=this._text[e].length;if(b<=a+f)break;a+=f;e++}for(var l=a,c=e;e<this._text.length;){f=this._text[e].length;if(d<=a+f)break;a+=f;e++}if(c===e)return this._text[c].substring(b-l,d-a);l=this._text[c].substring(b-l);a=this._text[e].substring(0,d-a);return l+this._text.slice(c+1,e).join("")+
a},onChanging:function(b){return this.dispatchEvent(b)},onChanged:function(b){return this.dispatchEvent(b)},setLineDelimiter:function(b,d){"auto"===b&&(b=void 0,1<this.getLineCount()&&(b=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=b?b:h.platformDelimiter;if(d){var a=this.getLineCount();if(1<a){for(var e=Array(a),f=0;f<a;f++)e[f]=this.getLine(f);this.setText(e.join(this._lineDelimiter))}}},setText:function(b,d,a){void 0===b&&(b="");void 0===d&&(d=0);void 0===a&&(a=
this.getCharCount());if(!(d===a&&""===b)){for(var e=this.getLineAtOffset(d),f=this.getLineAtOffset(a),l=d,c=a-d,n=f-e,h=b.length,k=0,m=this.getLineCount(),r=0,t=0,v=0,w=[];;){-1!==r&&r<=v&&(r=b.indexOf("\r",v));-1!==t&&t<=v&&(t=b.indexOf("\n",v));if(-1===t&&-1===r)break;v=-1!==r&&-1!==t?r+1===t?t+1:(r<t?r:t)+1:-1!==r?r+1:t+1;w.push(d+v);k++}this.onChanging({type:"Changing",text:b,start:l,removedCharCount:c,addedCharCount:h,removedLineCount:n,addedLineCount:k});0===w.length&&(v=this.getLineStart(e),
f=f+1<m?this.getLineStart(f+1):this.getCharCount(),d!==v&&(b=this.getText(v,d)+b,d=v),a!==f&&(b+=this.getText(a,f),a=f));v=h-c;for(f=e+n+1;f<m;f++)this._lineOffsets[f]+=v;if(5E4>w.length)e=[e+1,n].concat(w),Array.prototype.splice.apply(this._lineOffsets,e);else{v=e+1;this._lineOffsets.splice(v,n);for(m=0;m<w.length;m+=5E4)e=[v,0].concat(w.slice(m,Math.min(w.length,m+5E4))),Array.prototype.splice.apply(this._lineOffsets,e),v+=5E4}for(v=m=0;v<this._text.length;){f=this._text[v].length;if(d<=m+f)break;
m+=f;v++}e=m;for(w=v;v<this._text.length;){f=this._text[v].length;if(a<=m+f)break;m+=f;v++}f=this._text[v];d=this._text[w].substring(0,d-e);a=f.substring(a-m);w=[w,v-w+1];d&&w.push(d);b&&w.push(b);a&&w.push(a);Array.prototype.splice.apply(this._text,w);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:l,removedCharCount:c,addedCharCount:h,removedLineCount:n,addedLineCount:k})}}};k.EventTarget.addMixin(d.prototype);return{TextModel:d}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(k,m){function h(b){b&&(this._view=b,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function d(b){h.call(this,b)}h.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(b){for(var d=[],a=this._keyBindings,e=0;e<a.length;e++)a[e].actionID===b&&d.push(a[e].keyBinding);return d},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(b){if("keydown"===
b.type)switch(b.keyCode){case 16:case 17:case 18:case 91:return}for(var d=this._keyBindingIndex,a=this._matchingKeyBindings||this._keyBindings,e=[],f=0;f<a.length;f++){var l=a[f],c=l.keyBinding.match(b,d);if(!0===c)return this._keyBindingIndex=0,this._matchingKeyBindings=null,l.actionID;"number"===typeof c&&e.push(l)}if(0===e.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=e,"noop"},setKeyBinding:function(b,d){for(var a=this._keyBindings,
e=0;e<a.length;e++){var f=a[e];if(f.keyBinding.equals(b)){d?f.actionID=d:f.predefined?f.actionID="noop":a.splice(e,1);return}}d&&a.push({keyBinding:b,actionID:d})},setView:function(b){this._view=b}};d.prototype=new h;d.prototype.createKeyBindings=function(){var b=k.KeyBinding,d=[];d.push({actionID:"lineUp",keyBinding:new b(38),predefined:!0});d.push({actionID:"lineDown",keyBinding:new b(40),predefined:!0});d.push({actionID:"charPrevious",keyBinding:new b(37),predefined:!0});d.push({actionID:"charNext",
keyBinding:new b(39),predefined:!0});m.isMac?(d.push({actionID:"scrollPageUp",keyBinding:new b(33),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new b(34),predefined:!0}),d.push({actionID:"pageUp",keyBinding:new b(33,null,null,!0),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new b(34,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,!0),predefined:!0}),d.push({actionID:"wordPrevious",
keyBinding:new b(37,null,null,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,null,null,!0),predefined:!0}),d.push({actionID:"scrollTextStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"scrollTextEnd",keyBinding:new b(35),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(40,!0),predefined:!0}),d.push({actionID:"scrollPageUp",keyBinding:new b(38,null,null,null,!0),predefined:!0}),d.push({actionID:"scrollPageDown",
keyBinding:new b(40,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(37,null,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(38,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(40,null,null,!0),predefined:!0})):(d.push({actionID:"pageUp",keyBinding:new b(33),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new b(34),predefined:!0}),
d.push({actionID:"lineStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(35),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,!0),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(36,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(35,!0),predefined:!0}));m.isFirefox&&m.isLinux&&(d.push({actionID:"lineUp",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"lineDown",
keyBinding:new b(40,!0),predefined:!0}));m.isWindows&&(d.push({actionID:"scrollLineUp",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"scrollLineDown",keyBinding:new b(40,!0),predefined:!0}));d.push({actionID:"selectLineUp",keyBinding:new b(38,null,!0),predefined:!0});d.push({actionID:"selectLineDown",keyBinding:new b(40,null,!0),predefined:!0});d.push({actionID:"selectCharPrevious",keyBinding:new b(37,null,!0),predefined:!0});d.push({actionID:"selectCharNext",keyBinding:new b(39,null,!0),
predefined:!0});d.push({actionID:"selectPageUp",keyBinding:new b(33,null,!0),predefined:!0});d.push({actionID:"selectPageDown",keyBinding:new b(34,null,!0),predefined:!0});m.isMac?(d.push({actionID:"selectLineStart",keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,!0,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new b(37,null,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,null,!0,!0),predefined:!0}),
d.push({actionID:"selectTextStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(40,!0,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new b(37,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineStart",
keyBinding:new b(38,null,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(40,null,!0,!0),predefined:!0})):(m.isLinux&&(d.push({actionID:"selectWholeLineUp",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectWholeLineDown",keyBinding:new b(40,!0,!0),predefined:!0})),d.push({actionID:"selectLineStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",
keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(36,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(35,!0,!0),predefined:!0}));d.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});m.isMac?d.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):d.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0});
d.push({actionID:"deletePrevious",keyBinding:new b(8),predefined:!0});d.push({actionID:"deletePrevious",keyBinding:new b(8,null,!0),predefined:!0});d.push({actionID:"deleteNext",keyBinding:new b(46),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0,!0),predefined:!0});d.push({actionID:"deleteWordNext",keyBinding:new b(46,!0),predefined:!0});d.push({actionID:"tab",keyBinding:new b(9),predefined:!0});
d.push({actionID:"shiftTab",keyBinding:new b(9,null,!0),predefined:!0});d.push({actionID:"enter",keyBinding:new b(13),predefined:!0});d.push({actionID:"enter",keyBinding:new b(13,null,!0),predefined:!0});d.push({actionID:"selectAll",keyBinding:new b("a",!0),predefined:!0});d.push({actionID:"toggleTabMode",keyBinding:new b("m",!0),predefined:!0});m.isMac&&(d.push({actionID:"deleteNext",keyBinding:new b(46,null,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,null,null,!0),
predefined:!0}),d.push({actionID:"deleteWordNext",keyBinding:new b(46,null,null,!0),predefined:!0}));d.push({actionID:"toggleWrapMode",keyBinding:new k.KeyBinding("w",!0,!1,!0)});d.push({actionID:"toggleOverwriteMode",keyBinding:new k.KeyBinding(45)});if(!m.isFirefox){var a=m.isMac&&m.isChrome;d.push({actionID:"noop",keyBinding:new b("u",!a,!1,!1,a),predefined:!0});d.push({actionID:"noop",keyBinding:new b("i",!a,!1,!1,a),predefined:!0});d.push({actionID:"noop",keyBinding:new b("b",!a,!1,!1,a),predefined:!0})}m.isFirefox&&
(d.push({actionID:"copy",keyBinding:new b(45,!0),predefined:!0}),d.push({actionID:"paste",keyBinding:new b(45,null,!0),predefined:!0}),d.push({actionID:"cut",keyBinding:new b(46,null,!0),predefined:!0}));m.isMac&&(d.push({actionID:"lineStart",keyBinding:new b("a",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b("e",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineUp",keyBinding:new b("p",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new b("n",!1,!1,
!1,!0),predefined:!0}),d.push({actionID:"charPrevious",keyBinding:new b("b",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charNext",keyBinding:new b("f",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deletePrevious",keyBinding:new b("h",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteNext",keyBinding:new b("d",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineEnd",keyBinding:new b("k",!1,!1,!1,!0),predefined:!0}),m.isFirefox?(d.push({actionID:"scrollPageDown",keyBinding:new b("v",!1,
!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineStart",keyBinding:new b("u",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new b("w",!1,!1,!1,!0),predefined:!0})):(d.push({actionID:"pageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"centerLine",keyBinding:new b("l",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"enterNoCursor",keyBinding:new b("o",!1,!1,!1,!0),predefined:!0})));return d};return{KeyMode:h,DefaultKeyMode:d}});
define("orion/editor/util",[],function(){return{contains:function(k,m){if(!m)return!1;if(!k.compareDocumentPosition){for(var h=m;h;){if(k===h)return!0;h=h.parentNode}return!1}return k===m||0!==(k.compareDocumentPosition(m)&16)},addEventListener:function(k,m,h,d){"function"===typeof k.addEventListener?k.addEventListener(m,h,!0===d):k.attachEvent("on"+m,h)},removeEventListener:function(k,m,h,d){"function"===typeof k.removeEventListener?k.removeEventListener(m,h,!0===d):k.detachEvent("on"+m,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,m,h,d,b,g,a){function e(c,b,d){if(d){b.className="";d=b.attributes;for(var e=d.length;0<e--;)(!a.isIE||9<=a.isIE||9>a.isIE&&d[e].specified)&&b.removeAttribute(d[e].name)}if(c){c.styleClass&&(b.className=c.styleClass);if(d=c.style)for(var f in d)d.hasOwnProperty(f)&&(b.style[f]=d[f]);if(c=c.attributes)for(var g in c)c.hasOwnProperty(g)&&
b.setAttribute(g,c[g])}}function f(a){return a instanceof Array?a.slice(0):a}function l(a,c){if(!a)return c;if(!c)return a;for(var b in c)c.hasOwnProperty(b)&&(a.hasOwnProperty(b)||(a[b]=c[b]));return a}function c(a,b){if(a===b)return!0;if(a&&!b||!a&&b||a&&a.constructor===String||b&&b.constructor===String)return!1;if(a instanceof Array||b instanceof Array){if(!(a instanceof Array&&b instanceof Array)||a.length!==b.length)return!1;for(var d=0;d<a.length;d++)if(!c(a[d],b[d]))return!1;return!0}if(!(a instanceof
Object)||!(b instanceof Object))return!1;for(d in a)if(a.hasOwnProperty(d)&&(!b.hasOwnProperty(d)||!c(a[d],b[d])))return!1;for(d in b)if(!a.hasOwnProperty(d))return!1;return!0}function n(a,c,b){for(var d=0,e=0,f=0,g=a.length;f<g;){-1!==d&&d<=f&&(d=a.indexOf("\r",f));-1!==e&&e<=f&&(e=a.indexOf("\n",f));var l=f,n;if(-1===e&&-1===d){c(a.substring(f));break}-1!==d&&-1!==e?d+1===e?(n=d,f=e+1):(n=d<e?d:e,f=(d<e?d:e)+1):-1!==d?(n=d,f=d+1):(n=e,f=e+1);c(a.substring(l,n));b()}}function q(a){var c,b,d,e,f=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(a=f.getComputedStyle(a,null),c=a.getPropertyValue("padding-left"),b=a.getPropertyValue("padding-top"),d=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom")):a.currentStyle&&(c=a.currentStyle.paddingLeft,b=a.currentStyle.paddingTop,d=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom);return{left:parseInt(c,10)||0,top:parseInt(b,10)||0,right:parseInt(d,10)||0,bottom:parseInt(e,10)||0}}function s(a){var c,
b,d,e,f=a._trim;if(!f){var f=q(a),g=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;g.getComputedStyle?(e=g.getComputedStyle(a,null),c=e.getPropertyValue("border-left-width"),b=e.getPropertyValue("border-top-width"),d=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width")):a.currentStyle&&(c=a.currentStyle.borderLeftWidth,b=a.currentStyle.borderTopWidth,d=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth);c=parseInt(c,10)||0;b=parseInt(b,10)||
0;d=parseInt(d,10)||0;e=parseInt(e,10)||0;f.left+=c;f.top+=b;f.right+=d;f.bottom+=e;a._trim=f}return f}function u(a,c,b,d){function e(c){if(c.animationName===g){var b=c.target;"function"===typeof b.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){b.__DOMReady()},0)}}function f(a,c){for(var b=["","-webkit-","-moz-","-ms-","-o-"],d="",p="body ."+a+" {\n",e=0;e<b.length;e++)d+="@"+b[e]+"keyframes "+c+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",p+=b[e]+"animation-duration: 0.001s;\n"+
b[e]+"animation-name: "+c+";\n";return d+(p+"}")}b="_"+b+"DOMReady";c.className=c.className?c.className+" "+b:b;c.__DOMReady=d;d=b+"Style";if(!a.getElementById(d)){var g=b+"Animation";a.addEventListener("animationstart",e,!1);a.addEventListener("MSAnimationStart",e,!1);a.addEventListener("webkitAnimationStart",e,!1);c=a.createElement("style");c.id=d;d=a.getElementsByTagName("head")[0]||a.documentElement;c.appendChild(a.createTextNode(f(b,g)));d.insertBefore(c,d.firstChild)}}function r(a,c,b){this.start=
a;this.end=c;this.caret=b}function t(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function v(a,c,b){this.view=a;this.lineIndex=c;this._lineDiv=b}function w(a){this._init(a||{})}var A=g.addEventListener,x=g.removeEventListener,z=function(){function a(c){this.options=c}a.prototype.play=function(){var a="number"===typeof this.options.duration?this.options.duration:350,c=this.options.easing||this.defaultEasing,b=this.options.onAnimate||function(){},d=this.options.curve[0],
p=this.options.curve[1],e=p-d,f=-1,g,l=this;this.interval=this.options.window.setInterval(function(){f=-1===f?(new Date).getTime():f;var n=((new Date).getTime()-f)/a;1>n?(n=c(n),g=d+n*e,b(g)):(b(p),l.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}};t.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};v.prototype={create:function(a,c){if(!this._lineDiv){var b=this._lineDiv=this._createLine(a,c,this.lineIndex);b._line=this;return b}},_createLine:function(b,d,f){var g=this.view,n=g._model,l=n.getLine(f),h=n.getLineStart(f),q={type:"LineStyle",textView:g,lineIndex:f,lineText:l,
lineStart:h};g.onLineStyle(q);var k=b.ownerDocument,n=d||a.createElement(k,"div");if(!d||!c(d.viewStyle,q.style))e(q.style,n,d),d&&(d._trim=null),n.viewStyle=q.style,n.setAttribute("role","presentation");n.lineIndex=f;if(d&&n.viewLineText===l&&c(q.ranges,n.viewRanges))return n;n.viewRanges=q.ranges;n.viewLineText=l;f=[];this._createRanges(q.ranges,l,0,l.length,h,{tabOffset:0,ranges:f});q=" ";!g._fullSelection&&9>a.isIE&&(q="\ufeff");g={text:q,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,E,m,u=q=0;if(a.isFirefox&&2E3<l.length){d&&(n.innerHTML="",d.lineWidth=void 0);d=k.createDocumentFragment();for(l=0;l<f.length;l++)g=f[l],h=g.text,s=g.style,s=this._createSpan(n,h,s,g.ignoreChars),d.appendChild(s);n.appendChild(d)}else{var r,x;if(d){if(E=d.modelChangedEvent)0===E.removedLineCount&&0===E.addedLineCount?(x=E.start-h,r=E.addedCharCount-E.removedCharCount):x=-1,d.modelChangedEvent=void 0;
E=d.firstChild}for(l=0;l<f.length;l++){g=f[l];h=g.text;q+=h.length;s=g.style;if(E)if(m=E.firstChild.data,k=E.viewStyle,m===h&&c(s,k)){u+=m.length;E._rectsCache=void 0;s=E=E.nextSibling;continue}else for(;E;){if(-1!==x){k=q;k>=x&&(k-=r);m=(m=E.firstChild.data)?m.length:0;if(u+m>k)break;u+=m}k=E.nextSibling;n.removeChild(E);E=k}s=this._createSpan(n,h,s,g.ignoreChars);E?n.insertBefore(s,E):n.appendChild(s);d&&(d.lineWidth=void 0)}if(d)for(r=s?s.nextSibling:null;r;)k=r.nextSibling,d.removeChild(r),r=
k}n.parentNode||b.appendChild(n);return n},_createRanges:function(a,b,d,e,f,g){if(!(d>e)){if(a)for(var n=0;n<a.length;n++){var l=a[n];if(!(l.end<f+d)){var h=Math.max(f+d,l.start)-f;if(h>e)break;var q=Math.min(f+e,l.end)-f;if(h<=q){h=Math.max(d,h);q=Math.min(e,q);d<h&&this._createRange(b,d,h,null,g);if(!l.style||!l.style.unmergeable)for(;n+1<a.length&&a[n+1].start-f===q&&c(l.style,a[n+1].style);)l=a[n+1],q=Math.min(f+e,l.end)-f,n++;this._createRange(b,h,q,l.style,g);d=q}}}d<e&&this._createRange(b,
d,e,null,g)}},_createRange:function(a,c,b,d,e){if(!(c>b)){var f=this.view._customTabSize;if(f&&8!==f)for(var g=a.indexOf("\t",c);-1!==g&&g<b;){c<g&&(c={text:a.substring(c,g),style:d},e.ranges.push(c),e.tabOffset+=c.text.length);c=f-e.tabOffset%f;if(0<c){for(var n="\u00a0",l=1;l<c;l++)n+=" ";c={text:n,style:d,ignoreChars:c-1};e.ranges.push(c);e.tabOffset+=c.text.length}c=g+1;if(c===b)return;g=a.indexOf("\t",c)}c<=b&&(c={text:a.substring(c,b),style:d},e.ranges.push(c),e.tabOffset+=c.text.length)}},
_createSpan:function(c,b,d,f){var g=this.view,n="span";d&&d.tagName&&(n=d.tagName.toLowerCase());var l="a"===n;l&&(this.hasLink=!0);l&&!g._linksVisible&&(n="span");l=c.ownerDocument;c=a.createElement(c.ownerDocument,n);c.appendChild(l.createTextNode(d&&d.text?d.text:b));d&&d.html?(c.innerHTML=d.html,c.ignore=!0):d&&d.node&&(c.appendChild(d.node),c.ignore=!0);e(d,c);if("a"===n){var h=g._getWindow();A(c,"click",function(a){return g._handleLinkClick(a?a:h.event)},!1)}c.viewStyle=d;f&&(c.ignoreChars=
f);return c},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(c,b){var d=this._ensureCreated(),e=this.view;if(void 0===c)return this._getLineBoundingClientRect(d,!0);var f=e._model,g=d.ownerDocument,n=this.lineIndex,l=null;if(c<f.getLineEnd(n)){var h=f.getLineStart(n);this.forEach(function(b){var f=b.firstChild,y=this._nodeLength(b);if(h+y>c){var n=c-h;if(1===f.length)l=new t(b.getBoundingClientRect());
else if(e._isRangeRects)y=g.createRange(),y.setStart(f,n),y.setEnd(f,n+1),l=new t(y.getBoundingClientRect());else if(a.isIE)y=g.body.createTextRange(),y.moveToElementText(b),y.collapse(),(f=0===n&&8===a.isIE)&&(n=1),y.moveEnd("character",n+1),y.moveStart("character",n),l=new t(y.getBoundingClientRect()),f&&(l.left=b.getClientRects()[0].left);else{var q=f.data;b.removeChild(f);b.appendChild(g.createTextNode(q.substring(0,n)));var k=a.createElement(g,"span");k.appendChild(g.createTextNode(q.substring(n,
n+1)));b.appendChild(k);b.appendChild(g.createTextNode(q.substring(n+1)));l=new t(k.getBoundingClientRect());b.innerHTML="";b.appendChild(f);this._createdDiv||(b=e._getSelection(),(h<=b.start&&b.start<h+y||h<=b.end&&b.end<h+y)&&e._updateDOMSelection())}a.isIE&&(n=d.ownerDocument.defaultView||d.ownerDocument.parentWindow,b=n.screen.logicalXDPI/n.screen.deviceXDPI,n=n.screen.logicalYDPI/n.screen.deviceYDPI,l.left*=b,l.right*=b,l.top*=n,l.bottom*=n);return!1}h+=y;return!0})}f=this.getBoundingClientRect();
l||(e._wrapMode?(n=this.getClientRects(),l=n[n.length-1],l.left=l.right,l.left+=f.left,l.top+=f.top,l.right+=f.left,l.bottom+=f.top):(l=new t(f),l.left=l.right));if(b||void 0===b)l.left-=f.left,l.top-=f.top,l.right-=f.left,l.bottom-=f.top;return l},forEach:function(a){for(var c=this._ensureCreated().firstChild;c;){var b=c.nextSibling;if(!c.ignore&&!a.call(this,c))break;c=b}},_getClientRects:function(a,c){var b,d,e,f;if(!a._rectsCache){b=a.getClientRects();d=Array(b.length);for(f=0;f<b.length;f++)e=
d[f]=new t(b[f]),e.left-=c.left,e.top-=c.top,e.right-=c.left,e.bottom-=c.top;a._rectsCache=d}b=a._rectsCache;d=[b.length];for(f=0;f<b.length;f++)d[f]=new t(b[f]);return d},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var c=[],b=this._ensureCreated().getBoundingClientRect();this.forEach(function(a){a=this._getClientRects(a,b);for(var d=0;d<a.length;d++){var p=a[d],e,f;if(p.top!==p.bottom){var g=p.top+(p.bottom-p.top)/2;for(e=0;e<c.length&&!(f=c[e],f.top<=
g&&g<f.bottom);e++);e===c.length?c.push(p):(p.left<f.left&&(f.left=p.left),p.top<f.top&&(f.top=p.top),p.right>f.right&&(f.right=p.right),p.bottom>f.bottom&&(f.bottom=p.bottom))}}return!0});return void 0!==a?c[a]:c},_getLineBoundingClientRect:function(a,c){var b=new t(a.getBoundingClientRect());if(!this.view._wrapMode){b.right=b.left;for(var d=a.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;d&&(d=d.getBoundingClientRect(),b.right=d.right+s(a).right)}c&&(d=s(a),b.left+=d.left,
b.right-=d.right);return b},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var c=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var b=0;b<c.length;b++)if(c[b].top<=a&&a<c[b].bottom)return b;return c.length-1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var c=this.getClientRects();return this.getOffset(c[a].left+
1,c[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var c=a.firstChild.length;a.ignoreChars&&(c-=a.ignoreChars);return c},getModelOffset:function(a,c){if(!a)return 0;var b=0;this.forEach(function(d){var e=d.firstChild;if(e===a)return d.ignoreChars&&(b-=d.ignoreChars),b+=c,!1;d.ignoreChars&&(b-=d.ignoreChars);b+=e.data.length;return!0});return Math.max(0,b)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var c=0,b,d,e=this.view._model,f=e.getLineStart(this.lineIndex),
g=a-f,l=e.getLineEnd(this.lineIndex)-f;this.forEach(function(a){var p=a.firstChild,e=this._nodeLength(a);if(e+c>g||c+e>=l)return b=p,d=g-c,a.ignoreChars&&0<e&&d===e&&(d+=a.ignoreChars),!1;c+=e;return!0});return{node:b,offset:d}},getText:function(a){var c="",b=0;this.forEach(function(d){var e;if(d.ignoreChars){e=d.lastChild;for(var f=0,g=[],l=-1;e;){var n=e.data;if(n)for(var h=n.length-1;0<=h;h--){var q=n.substring(h,h+1);f<d.ignoreChars&&(" "===q||"\ufeff"===q)?f++:g.push("\u00a0"===q?"\t":q)}a===
e&&(l=g.length);e=e.previousSibling}g=g.reverse().join("");-1!==l&&(b=c.length+g.length-l);c+=g}else for(e=d.firstChild;e;)a===e&&(b=c.length),c+=e.data,e=e.nextSibling;return!0});return{text:c,offset:b}},getOffset:function(c,b){function d(e,B,h){var C=e.firstChild,m=s._nodeLength(e),u=q.ownerDocument,r=u.defaultView||u.parentWindow,x=a.isIE?r.screen.logicalXDPI/r.screen.deviceXDPI:1,t=a.isIE?r.screen.logicalYDPI/r.screen.deviceYDPI:1,v,w,z,r=h.left+k.left,F,Q;if(a.isIE||f._isRangeRects){for(var u=
f._isRangeRects?u.createRange():u.body.createTextRange(),L=m,A=-1;1<L-A;){var T=Math.floor((L+A)/2);h=A+1;v=T===m-1&&e.ignoreChars?C.length:T+1;F=0===h&&8===a.isIE;f._isRangeRects?(u.setStart(C,h),u.setEnd(C,v)):(F&&(h=1),u.moveToElementText(e),u.move("character",h),u.moveEnd("character",v-h));Q=u.getClientRects();for(var W=!1,R=0;R<Q.length;R++)if(h=Q[R],v=(F?r:h.left)*x-k.left,z=h.right*x-k.left,w=h.top*t-k.top,h=h.bottom*t-k.top,v<=c&&c<z&&(!f._wrapMode||w<=b&&b<h)){W=!0;break}W?L=T:A=T}B+=L;h=
L;v=L===m-1&&e.ignoreChars?C.length:Math.min(L+1,C.length);f._isRangeRects?(u.setStart(C,h),u.setEnd(C,v)):(u.moveToElementText(e),u.move("character",h),u.moveEnd("character",v-h));Q=u.getClientRects();m=!1;0<Q.length&&(h=Q[0],v=(F?r:h.left)*x-k.left,z=h.right*x-k.left,m=c>v+(z-v)/2);e=B-n;C=g.getLine(l);x=C.charCodeAt(e);55296<=x&&56319>=x&&m?e<C.length&&(x=C.charCodeAt(e+1),56320<=x&&57343>=x&&(B+=1)):56320<=x&&57343>=x&&!m&&0<e&&(x=C.charCodeAt(e-1),55296<=x&&56319>=x&&(B-=1));m&&B++}else{x=[];
for(F=0;F<m;F++)x.push("\x3cspan\x3e"),F===m-1?x.push(C.data.substring(F)):x.push(C.data.substring(F,F+1)),x.push("\x3c/span\x3e");e.innerHTML=x.join("");for(x=e.firstChild;x;){h=x.getBoundingClientRect();v=h.left-k.left;z=h.right-k.left;if(v<=c&&c<z){c>v+(z-v)/2&&B++;break}B++;x=x.nextSibling}s._createdDiv||(e.innerHTML="",e.appendChild(C),e=f._getSelection(),(B<=e.start&&e.start<B+m||B<=e.end&&e.end<B+m)&&f._updateDOMSelection())}return B}function e(a){if(a.ignore)return null;a=s._getClientRects(a,
k);for(var d=0;d<a.length;d++){var g=a[d];if(g.left<=c&&c<g.right&&(!f._wrapMode||g.top<=b&&b<g.bottom))return g}return null}var f=this.view,g=f._model,l=this.lineIndex,n=g.getLineStart(l),h=g.getLineEnd(l);if(n===h)return n;var q=this._ensureCreated(),k=this.getBoundingClientRect(),s=this,m,u;if(f._wrapMode){m=this.getClientRects();b<m[0].top&&(b=m[0].top);for(var r=0;r<m.length&&!(u=m[r],u.top<=b&&b<u.bottom);r++);c<u.left&&(c=u.left);c>u.right&&(c=u.right-1)}else 0>c&&(c=0),c>k.right-k.left&&(c=
k.right-k.left);var x,t;if(this._lastHitChild&&this._lastHitChild.parentNode){if(x=this._lastHitOffset,t=this._lastHitChild,u=e(t),!u){m=x;for(var r=x+this._nodeLength(t),v=t.previousSibling,w=t.nextSibling;v||w;){if(v){m-=this._nodeLength(v);if(u=e(v)){t=v;x=m;break}v=v.previousSibling}if(w){if(u=e(w)){t=w;x=r;break}r+=this._nodeLength(w);w=w.nextSibling}}}}else x=n,this.forEach(function(a){t=a;if(u=e(t))return!1;x+=this._nodeLength(t);return!0});t&&u&&(this._lastHitChild=t,this._lastHitOffset=x,
x=d(t,x,u));return Math.min(h,Math.max(n,x))},getNextOffset:function(c,b){if("line"===b.unit){var d=this.view._model,e=d.getLineAtOffset(c);if(0<b.count)return b.count--,d.getLineEnd(e);b.count++;return d.getLineStart(e)}return"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit?this._getNextOffset_W3C(c,b):a.isIE?this._getNextOffset_IE(c,b):this._getNextOffset_W3C(c,b)},_getNextOffset_W3C:function(a,c){function b(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function d(a){return 32===
a||9===a}var e=this.view._model,f=e.getLineAtOffset(a),g=e.getLine(f),l=e.getLineStart(f),e=e.getLineEnd(f),f=g.length,n=a-l,h,q=0>c.count?-1:1;if("word"===c.unit||"wordend"===c.unit||"wordWS"===c.unit||"wordendWS"===c.unit)for(var k,s,m;0!==c.count;){if(0<c.count){if(n===f)return e;h=g.charCodeAt(n);k=b(h);s=!k&&!d(h);for(n++;n<f;){h=g.charCodeAt(n);if("wordWS"!==c.unit&&"wordendWS"!==c.unit){m=b(h);if("wordend"===c.unit){if(!m&&k)break}else if(m&&!k)break;h=!m&&!d(h)}else h=!d(h);if("wordend"===
c.unit||"wordendWS"===c.unit){if(!h&&s)break}else if(h&&!s)break;s=h;k=m;n++}}else{if(0===n)return l;n--;h=g.charCodeAt(n);k=b(h);for(s=!k&&!d(h);0<n;){h=g.charCodeAt(n-1);if("wordWS"!==c.unit&&"wordendWS"!==c.unit){m=b(h);if("wordend"===c.unit){if(m&&!k)break}else if(!m&&k)break;h=!m&&!d(h)}else h=!d(h);if("wordend"===c.unit||"wordendWS"===c.unit){if(h&&!s)break}else if(!h&&s)break;s=h;k=m;n--}}c.count-=q}else for(;0!==c.count&&0<=n+q&&n+q<=f;)n+=q,h=g.charCodeAt(n),56320<=h&&57343>=h&&0<n&&(h=g.charCodeAt(n-
1),55296<=h&&56319>=h&&(n+=q)),c.count-=q;return l+n},_getNextOffset_IE:function(a,c){var b=this._ensureCreated(),d=this.view._model,e=this.lineIndex,f=0,g;g=d.getLineStart(e);var n=b.ownerDocument,l=0>c.count?-1:1;if(a===d.getLineEnd(e)){for(b=b.lastChild;b&&b.ignoreChars===b.firstChild.length;)b=b.previousSibling;if(!b)return g;f=n.body.createTextRange();f.moveToElementText(b);g=f.text.length;f.moveEnd(c.unit,l);f=a+f.text.length-g}else if(a===g&&0>c.count)f=g;else for(b=b.firstChild;b;){d=this._nodeLength(b);
if(g+d>a){f=n.body.createTextRange();if(a===g&&0>c.count){for(g=b.previousSibling;g&&(!g.firstChild||!g.firstChild.length);)g=g.previousSibling;f.moveToElementText(g?g:b.previousSibling)}else f.moveToElementText(b),f.collapse(),f.moveEnd("character",a-g);g=f.text.length;f.moveEnd(c.unit,l);f=a+f.text.length-g;break}g=d+g;b=b.nextSibling}c.count-=l;return f},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var c=this;this.forEach(function(b){var d=b.viewStyle;d&&d.tagName&&"a"===
d.tagName.toLowerCase()&&a.replaceChild(c._createSpan(a,b.firstChild.data,d),b);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};w.prototype={addKeyMode:function(a,c){var b=this._keyModes;void 0!==c?b.splice(c,0,a):b.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,c){a.setView(this);var b=this._rulers;if(void 0!==c){var d,e;for(e=d=0;d<b.length&&e<c;d++)a.getLocation()===b[d].getLocation()&&e++;b.splice(e,0,a);c=e}else b.push(a);
this._createRuler(a,c);this._update()},computeSize:function(){var c=0,b=0,d=this._model,e=this._clientDiv;if(!e)return{width:c,height:b};var f=e.style.width;a.isWebkit&&(e.style.width="0x7fffffffpx");for(var d=d.getLineCount(),g=0;g<d;g++){var n=this._getLine(g),l=n.getBoundingClientRect(),c=Math.max(c,l.right-l.left),b=b+(l.bottom-l.top);n.destroy()}a.isWebkit&&(e.style.width=f);e=this._getViewPadding();c+=e.right+e.left+this._metrics.scrollWidth;b+=e.bottom+e.top+this._metrics.scrollWidth;return{width:c,
height:b}},convert:function(a,c,b){if(this._clientDiv){var d=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();"document"===c&&(void 0!==a.x&&(a.x+=-d.x+f.left+e.left),void 0!==a.y&&(a.y+=-d.y+f.top+e.top));"document"===b&&(void 0!==a.x&&(a.x+=d.x-f.left-e.left),void 0!==a.y&&(a.y+=d.y-f.top-e.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 c=[],b=this._actions,d;for(d in b)b.hasOwnProperty(d)&&(a||
!b[d].defaultHandler)&&c.push(d);return c},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 c=[],b=this._keyModes,d=0;d<b.length;d++)c=c.concat(b[d].getKeyBindings(a));return c},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 c=this._model;
a=Math.min(Math.max(0,a),c.getCharCount());var c=c.getLineAtOffset(a),b=this._getLine(c);a=b.getBoundingClientRect(a);b.destroy();b=a.left;c=this._getLinePixel(c)+a.top;return{x:b,y:c}},getNextOffset:function(a,c){var b=new r(a,a,!1);this._doMove(c,b);return b.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 f(this["_"+a])}else{a={};for(var c in arguments)arguments.hasOwnProperty(c)&&
(a[arguments[c]]=void 0)}for(var b in a)a.hasOwnProperty(b)&&(a[b]=f(this["_"+b]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,c){if(!this._clientDiv)return 0;var b=this._getLineIndex(c),d=this._getLine(b),b=d.getOffset(a,c-this._getLinePixel(b));d.destroy();return b},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,c){return this._model.getText(a,c)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,c,b){if(this._clientDiv){if(a=this._actions[a]){if(!c&&a.handler&&a.handler(b))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(b)}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,c){if(!(0<this._redrawCount))for(var b=this.getRulers(),d=0;d<b.length;d++)this.redrawLines(a,c,b[d])},
redrawLines:function(a,c,b){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===c&&(c=this._model.getLineCount()),a!==c)){var d=this._clientDiv;if(d){if(b)for(d=this._getRulerParent(b).firstChild;d&&d._ruler!==b;)d=d.nextSibling;b?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,c);if(!b||"page"===b.getOverview())for(d=d.firstChild;d;){var e=d.lineIndex;a<=e&&e<c&&(d.lineChanged=!0);d=d.nextSibling}!b&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<c&&(this._checkMaxLineIndex=
this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,c){if(!(0<this._redrawCount)){var b=this._model;void 0===a&&(a=0);void 0===c&&(c=b.getCharCount());var d=b.getLineAtOffset(a),b=b.getLineAtOffset(Math.max(a,c-1))+1;this.redrawLines(d,b)}},removeKeyMode:function(a){for(var c=this._keyModes,b=0;b<c.length;b++)if(c[b]===a){c.splice(b,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var c=this._rulers,b=0;b<c.length;b++)if(c[b]===
a){c.splice(b,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,c,b){if(a){var d=this._actions,e=d[a];e||(e=d[a]={});e.handler=c;void 0!==b&&(e.actionDescription=b)}},setKeyBinding:function(a,c){this._keyModes[0].setKeyBinding(a,c)},setCaretOffset:function(a,c,b){var d=this._model.getCharCount();a=Math.max(0,Math.min(a,d));a=new r(a,a,!1);this._setSelection(a,void 0===c||c,!0,b)},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 c=this._model.getLineCount(),b=this._model.getCharCount(),d=a.getLineCount(),e=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:b,
addedCharCount:e,removedLineCount:c,addedLineCount:d};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:b,addedCharCount:e,removedLineCount:c,addedLineCount:d};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(a){var b=this._defaultOptions(),d;for(d in a)if(a.hasOwnProperty(d)){var e=a[d];if(!c(this["_"+
d],e)){var g=b[d]?b[d].update:null;g?g.call(this,e):this["_"+d]=f(e)}}},setSelection:function(a,c,b,d){var e=a>c;if(e){var f=a;a=c;c=f}f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));c=Math.max(0,Math.min(c,f));a=new r(a,c,e);this._setSelection(a,void 0===b||b,!0,d)},setText:function(c,b,d){var e=void 0===b&&void 0===d;void 0===b&&(b=0);void 0===d&&(d=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:c,start:b,end:d,_code:!0},!e);e&&(this._columnX=-1,
this._setSelection(new r(0,0,!1),!0),13>a.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,c){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===c||c?this._update():this._queueUpdate())},_handleRootMouseDown:function(c){this._cancelCheckSelection();
if(!this._ignoreEvent(c)){13>a.isFirefox&&1===c.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var b=this._overlayDiv||this._clientDiv;9>a.isIE&&(b=this._viewDiv);for(var d=c.target?c.target:c.srcElement;d;){if(b===d)return;d=d.parentNode}c.preventDefault&&c.preventDefault();c.stopPropagation&&c.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(c){!this._ignoreEvent(c)&&
13>a.isFirefox&&1===c.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1)},_handleBlur:function(c){this._cancelCheckSelection();if(!this._ignoreBlur){this._hasFocus=!1;if(9>a.isIE&&!this._getSelection().isEmpty()){c=this._rootDiv;var b=a.createElement(c.ownerDocument,"div");c.appendChild(b);c.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",c=this._getWindow(),b=this._selDiv1.ownerDocument,c.getSelection){b=c.getSelection();for(c=b.anchorNode;c;){if(c===this._clientDiv){0<b.rangeCount&&b.removeAllRanges();break}c=c.parentNode}}else if(b.selection){this._ignoreSelect=!1;for(c=b.selection.createRange().parentElement();c;){if(c===this._clientDiv){b.selection.empty();break}c=c.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},
_handleContextMenu:function(c){if(!this._ignoreEvent(c)){a.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var b=!1;this.isListening("ContextMenu")?(b=this._createMouseEvent("ContextMenu",c),b.screenX=c.screenX,b.screenY=c.screenY,this.onContextMenu(b),b=b.defaultPrevented):a.isMac&&a.isFirefox&&0===c.button&&(b=!0);if(b)return c.preventDefault&&c.preventDefault(),!1;this._contextMenuOpen=!0;a.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(c){if(!this._ignoreEvent(c)){if(13>a.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",c)),this._dragOffset=-1;else return c.preventDefault&&c.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",
a))},_handleDragEnd:function(c){if(!this._ignoreEvent(c)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",c));13>a.isFirefox&&(this._fixCaret(),"none"===c.dataTransfer.dropEffect&&!c.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(c){if(!this._ignoreEvent(c)){var b=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(b=!1,this.onDragEnter(this._createMouseEvent("DragEnter",c)));if(a.isWebkit||b)return c.preventDefault&&
c.preventDefault(),!1}},_handleDragOver:function(c){if(!this._ignoreEvent(c)){var b=!0;this.isListening("DragOver")&&(b=!1,this.onDragOver(this._createMouseEvent("DragOver",c)));if(a.isWebkit||b)return b&&(c.dataTransfer.dropEffect="none"),c.preventDefault&&c.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(c){this._hasFocus=!0;a.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&&(c=this._highlightRGB,this._selDiv1.style.background=c,this._selDiv2.style.background=c,this._selDiv3.style.background=
c);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(c){this._cancelCheckSelection();if(!this._ignoreEvent(c)){if(this.isListening("KeyDown")){var b=this._createKeyEvent("KeyDown",c);this.onKeyDown(b);if(b.defaultPrevented){a.isFirefox&&(this._keyDownPrevented=!0);c.preventDefault();return}}b=!1;switch(c.keyCode){case 16:case 17:case 18:case 91:b=!0;break;default:this._setLinksVisible(!1)}if(229===c.keyCode){if(this._readonly)return c.preventDefault&&c.preventDefault(),!1;
b=!0;a.isSafari&&a.isMac&&c.ctrlKey&&(b=!1,c.keyCode=129);b&&this._startIME()}else b||this._commitIME();if((a.isMac||a.isLinux)&&4>a.isFirefox||12.16>a.isOpera)return this._keyDownEvent=c,!0;if(this._doAction(c))return c.preventDefault?(c.preventDefault(),c.stopPropagation()):(c.cancelBubble=!0,c.returnValue=!1,c.keyCode=0),!1}},_handleKeyPress:function(c){if(!this._ignoreEvent(c))if(this._keyDownPrevented)c.preventDefault&&(c.preventDefault(),c.stopPropagation()),this._keyDownPrevented=void 0;else{if(a.isMac&&
a.isWebkit&&(63232<=c.keyCode&&63487>=c.keyCode||13===c.keyCode||8===c.keyCode)||((a.isMac||a.isLinux)&&4>a.isFirefox||12.16>a.isOpera)&&this._doAction(this._keyDownEvent))return c.preventDefault&&c.preventDefault(),!1;var b=a.isMac?c.metaKey:c.ctrlKey;if(void 0!==c.charCode&&b)switch(c.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(b=this._createKeyEvent("KeyPress",c),this.onKeyPress(b),b.defaultPrevented))c.preventDefault();else{if(this._doAction(c))return c.preventDefault?
(c.preventDefault(),c.stopPropagation()):(c.cancelBubble=!0,c.returnValue=!1,c.keyCode=0),!1;b=!1;if(a.isMac){if(c.ctrlKey||c.metaKey)b=!0}else if(a.isFirefox){if(c.ctrlKey||c.altKey)b=!0}else c.ctrlKey^c.altKey&&(b=!0);if(!b&&(b=a.isOpera?c.which:void 0!==c.charCode?c.charCode:c.keyCode,31<b))return this._doContent(String.fromCharCode(b)),c.preventDefault&&c.preventDefault(),!1}}},_handleDocKeyUp:function(c){(a.isMac?c.metaKey:c.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var c=
this._createKeyEvent("KeyUp",a);this.onKeyUp(c);if(c.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(c){if(!(a.isMac?c.metaKey:c.ctrlKey))return c.preventDefault&&c.preventDefault(),!1},_handleMouse:function(c){var b=this._getWindow(),d=!0,e=b;if(a.isIE||a.isFirefox&&!this._overlayDiv)e=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?(d=this._setSelectionTo(c.clientX,c.clientY,c.shiftKey,(!a.isOpera||12.16<=a.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(c.clientX,c.clientY,c.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(c){if(!this._ignoreEvent(c)){if(this._linksVisible)if("A"!==(c.target||c.srcElement).tagName)this._setLinksVisible(!1);
else return;this._commitIME();var b=c.which;b||(4===c.button&&(b=2),2===c.button&&(b=3),1===c.button&&(b=1));var d=2!==b&&c.timeStamp?c.timeStamp:(new Date).getTime(),e=d-this._lastMouseTime,f=Math.abs(this._lastMouseX-c.clientX),g=Math.abs(this._lastMouseY-c.clientY),n=this._lastMouseButton===b;this._lastMouseX=c.clientX;this._lastMouseY=c.clientY;this._lastMouseTime=d;this._lastMouseButton=b;1===b&&(this._isMouseDown=!0,n&&e<=this._clickTime&&f<=this._clickDist&&g<=this._clickDist?this._clickCount++:
this._clickCount=1);if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",c),this.onMouseDown(d),d.defaultPrevented))c.preventDefault();else{if(1===b&&this._handleMouse(c)&&(9<=a.isIE||a.isOpera||a.isChrome||a.isSafari||a.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),c.preventDefault();a.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(c){if(!this._animation){var b=this._isClientDiv(c);if(this.isListening("MouseMove")&&b)this.onMouseMove(this._createMouseEvent("MouseMove",c));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==c.clientX||this._lastMouseMoveY!==c.clientY;this._lastMouseMoveX=c.clientX;this._lastMouseMoveY=c.clientY;
this._setLinksVisible(d&&!this._isMouseDown&&(a.isMac?c.metaKey:c.ctrlKey));if(!this._isW3CEvents){if(0===c.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===c.button&&0!==(this._clickCount&1)&&b)return this._clickCount=2,this._handleMouse(c,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){b=c.clientX;c=c.clientY;var e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),g=this._getClientWidth(),n=this._getClientHeight(),d=f.left+e.left,l=f.top+e.top,g=f.left+
e.left+g,e=f.top+e.top+n;c<l?this._doAutoScroll("up",b,c-l):c>e?this._doAutoScroll("down",b,c-e):b<d&&!this._wrapMode?this._doAutoScroll("left",b-d,c):b>g&&!this._wrapMode?this._doAutoScroll("right",b-g,c):(this._endAutoScroll(),this._setSelectionTo(b,c,!0))}}}},_isClientDiv:function(a){var c=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(c===a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,c){return{type:a,event:c,preventDefault:function(){this.defaultPrevented=
!0}}},_createMouseEvent:function(a,c){var b=this.convert({x:c.clientX,y:c.clientY},"page","document");return{type:a,event:c,clickCount:this._clickCount,x:b.x,y:b.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(c){var b=c.which?0===c.button:1===c.button;if(this.isListening("MouseUp")&&(this._isClientDiv(c)||b&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",c));if(!this._linksVisible){if(b&&this._isMouseDown){if(-1!==this._dragOffset){var d=this._getSelection();
d.extend(this._dragOffset);d.collapse();this._setSelection(d,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}b&&a.isFirefox&&(this._updateDOMSelection(),c.preventDefault())}},_handleMouseWheel:function(c){var b=this._getLineHeight(),d=0,e=0;a.isIE||a.isOpera?e=-c.wheelDelta/40*b:a.isFirefox?"wheel"===c.type?c.deltaMode?(d=Math.max(-256,Math.min(256,c.deltaX))*b,e=Math.max(-256,Math.min(256,c.deltaY))*b):(d=c.deltaX,e=c.deltaY):(b=a.isMac?
3*c.detail:Math.max(-256,Math.min(256,c.detail))*b,c.axis===c.HORIZONTAL_AXIS?d=b:e=b):a.isMac?(e=c.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=c.timeStamp,d=0!==c.wheelDeltaX%120?1:40>e?40/(40-e):40,e=0!==c.wheelDeltaY%120?1:40>e?40/(40-e):40,d=Math.ceil(-c.wheelDeltaX/d),-1<d&&0>d&&(d=-1),0<d&&1>d&&(d=1),e=Math.ceil(-c.wheelDeltaY/e),-1<e&&0>e&&(e=-1),0<e&&1>e&&(e=1)):(d=-c.wheelDeltaX,e=8*(-c.wheelDeltaY/120)*b);if(a.isSafari||a.isChrome&&a.isMac){for(b=c.target;b&&void 0===b.lineIndex;)b=
b.parentNode;this._mouseWheelLine=b}b=this._getScroll();this._scrollView(d,e);d=this._getScroll();if(b.x!==d.x||b.y!==d.y)return c.preventDefault&&c.preventDefault(),!1},_handlePaste:function(c){this._cancelCheckSelection();if(!this._ignoreEvent(c)&&!this._ignorePaste&&this._doPaste(c)){if(a.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();b._ignoreFocus=!1},0)}c.preventDefault&&c.preventDefault();return!1}},_handleResize:function(b){b=this._rootDiv.clientWidth;
var d=this._rootDiv.clientHeight;if(this._rootWidth!==b||this._rootHeight!==d)this._rootWidth!==b&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=b,this._rootHeight=d,b=9>a.isIE,d=this._calculateMetrics(),c(d,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=d,b=!0),b?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var c=a.target?a.target:a.srcElement,b=c.lineIndex;c&&!c._ruler;)void 0===b&&void 0!==c.lineIndex&&
(b=c.lineIndex),c=c.parentNode;var d=c?c._ruler:null;if(void 0===b&&d&&"document"===d.getOverview()){var b=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect(),b=Math.floor((a.clientY-g.top-this._metrics.scrollWidth)*e/(b+f.top+f.bottom-2*this._metrics.scrollWidth));0<=b&&b<e||(b=void 0)}if(d)switch(a.type){case "click":if(d.onClick)d.onClick(b,a);break;case "dblclick":if(d.onDblClick)d.onDblClick(b,a);break;case "mousemove":if(d.onMouseMove)d.onMouseMove(b,
a);break;case "mouseover":if(d.onMouseOver)d.onMouseOver(b,a);break;case "mouseout":if(d.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===c)return;e=e.parentNode}d.onMouseOut(b,a)}}},_handleScroll:function(){var a=this._getScroll(!1),c=this._hScroll,b=this._vScroll;if(c!==a.x||b!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(b===a.y),this.onScroll({type:"Scroll",oldValue:{x:c,y:b},newValue:a})},_handleSelectStart:function(a){var c=this._contextMenuOpen;this._contextMenuOpen=
!1;if(c)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,c){if(a){var b;b="DIV"===a.tagName?a:a.parentNode.parentNode;return!b._line?0:b._line.getModelOffset(a,c)}},_updateSelectionFromDOM:function(){if(!a.isOS&&!a.isAndroid&&!this._checkSelectionChange)return!1;var c=this._getWindow().getSelection(),b=this._getModelOffset(c.anchorNode,c.anchorOffset),d=this._getModelOffset(c.focusNode,c.focusOffset),e=this._getSelection();
if(void 0===b||void 0===d||e.start===b&&e.end===d)return!1;if(this._checkSelectionChange){var e=this._getLineNext(),f=this._getLinePrevious();if(c.anchorNode===e.firstChild.firstChild&&0===c.anchorOffset&&c.focusNode===f.firstChild.firstChild&&0===c.focusOffset)return!1;if(c.anchorNode===e.firstChild.firstChild&&0===c.anchorOffset&&c.focusNode===f.lastChild.firstChild||c.anchorNode===this._clientDiv&&c.focusNode===this._clientDiv)b=0,d=this.getModel().getCharCount()}this._setSelection(new r(b,d),
!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 c=this,b=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=b.setTimeout(function(){c._selPollTimer=null;c._clientDiv&&!c._updateSelectionFromDOM()&&
a&&c._pollSelectionChange(a)},100)},_handleSelectionChange:function(c){-1===this._imeOffset&&(a.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var c=this._getWindow().getSelection();if(c.anchorNode!==this._anchorNode||c.focusNode!==this._focusNode||c.anchorOffset!==this._anchorOffset||c.focusOffset!==this._focusOffset){for(var b=c.anchorNode;b&&void 0===b.lineIndex;)b=b.parentNode;if(b){var d=this._model,
e=b.lineIndex,f=d.getLine(e),g=f,n=0,d=d.getLineStart(e);0<c.rangeCount&&(c.getRangeAt(0).deleteContents(),e=b.ownerDocument.createTextNode(a.data),c.getRangeAt(0).insertNode(e),n=this._getDOMText(b,e),g=n.text,n=n.offset,e.parentNode.removeChild(e));b.lineRemoved=!0;for(b=0;f.charCodeAt(b)===g.charCodeAt(b)&&b<n;)b++;c=f.length-1;for(e=g.length-f.length;f.charCodeAt(c)===g.charCodeAt(c+e)&&c+e>=n+a.data.length;)c--;c++;f=g.substring(b,c+e);this._modifyContent({text:f,start:b+d,end:c+d,_ignoreDOMSelection:!0},
!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(c){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 d=c.touches;if(1===d.length){var d=d[0],e=d.clientX,f=d.clientY;this._touchStartX=e;this._touchStartY=f;if(a.isAndroid&&(f<d.pageY-b.pageYOffset||e<d.pageX-b.pageXOffset))e=d.pageX-b.pageXOffset,f=d.pageY-
b.pageYOffset;b=this.convert({x:e,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(b.x,b.y);this._touchStartTime=c.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var c=a.touches;if(1===c.length){c=c[0];this._touchCurrentX=c.clientX;this._touchCurrentY=c.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var b=this,d=this._getWindow();this._touchScrollTimer=
d.setInterval(function(){var a=0,c=0;if(b._touching)a=b._touchStartX-b._touchCurrentX,c=b._touchStartY-b._touchCurrentY,b._touchSpeedX=a/10,b._touchSpeedY=c/10,b._touchStartX=b._touchCurrentX,b._touchStartY=b._touchCurrentY;else{if(0.1>Math.abs(b._touchSpeedX)&&0.1>Math.abs(b._touchSpeedY)){b._vScrollDiv.style.display="none";b._hScrollDiv.style.display="none";d.clearInterval(b._touchScrollTimer);b._touchScrollTimer=null;return}a=10*b._touchSpeedX;c=10*b._touchSpeedY;b._touchSpeedX*=0.95;b._touchSpeedY*=
0.95}b._scrollView(a,c)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var c,b,d=this._keyModes;for(b=d.length-1;0<=b;b--)if(c=d[b],"function"===typeof c.match&&(c=c.match(a),void 0!==c))return this.invokeAction(c);return!1},_doMove:function(a,c){var b=this._model,d=c.getCaret(),e=b.getLineAtOffset(d);for(a.count||(a.count=1);0!==a.count;){var f=b.getLineStart(e);if(0>a.count&&d===f)if(0<e)"character"===
a.unit&&a.count++,e--,c.extend(b.getLineEnd(e));else break;else if(0<a.count&&d===b.getLineEnd(e))if(e+1<b.getLineCount())"character"===a.unit&&a.count--,e++,c.extend(b.getLineStart(e));else break;else{var g=!1;a.expandTab&&"character"===a.unit&&0===(d-f)%this._tabSize&&(f=b.getText(f,d),g=!/[^ ]/.test(f));g?(c.extend(d-this._tabSize),a.count+=0>a.count?1:-1):(f=this._getLine(e),c.extend(f.getNextOffset(d,a)),f.destroy())}d=c.getCaret()}return c},_doBackspace:function(a){var c=this._getSelection();
c.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,c));this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doCase:function(a){var c=this._getSelection();this._doMove(a,c);var b=this.getText(c.start,c.end);this._setSelection(c,!0);switch(a.type){case "lower":b=b.toLowerCase();break;case "capitalize":b=b.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(c=0;c<b.length;c++){var d=b[c],e=d.toLowerCase(),d=e!==
d?e:d.toUpperCase();a+=d}b=a;break;default:b=b.toUpperCase()}this._doContent(b);return!0},_doContent:function(a){var c=this._getSelection();if(this._overwriteMode&&c.isEmpty()){var b=this._model,d=b.getLineAtOffset(c.end);c.end<b.getLineEnd(d)&&(b=this._getLine(d),c.extend(b.getNextOffset(c.getCaret(),{unit:"character",count:1})),b.destroy())}this._modifyContent({text:a,start:c.start,end:c.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var c=this._getSelection();return!c.isEmpty()?(c=this._getBaseText(c.start,
c.end),this._setClipboardText(c,a)):!0},_doCursorNext:function(a){var c=this._getSelection();!c.isEmpty()&&!a.select?c.start=c.end:this._doMove(a,c);a.select||c.collapse();this._setSelection(c,!0);return!0},_doCursorPrevious:function(a){var c=this._getSelection();!c.isEmpty()&&!a.select?c.end=c.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,c));a.select||c.collapse();this._setSelection(c,!0);return!0},_doCut:function(a){var c=this._getSelection();return!c.isEmpty()?(c=this._getBaseText(c.start,
c.end),this._doContent(""),this._setClipboardText(c,a)):!0},_doDelete:function(a){var c=this._getSelection();c.isEmpty()&&this._doMove(a,c);this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doEnd:function(a){var c=this._getSelection(),b=this._model,d;if(a.ctrl)c.extend(b.getCharCount()),d=function(){};else{var e=c.getCaret(),f=b.getLineAtOffset(e);if(this._wrapMode){var g=this._getLine(f),e=g.getLineIndex(e),e=e===g.getLineCount()-1?b.getLineEnd(f):g.getLineStart(e+1)-1;g.destroy()}else a.count&&
0<a.count&&(f=Math.min(f+a.count-1,b.getLineCount()-1)),e=b.getLineEnd(f);c.extend(e)}a.select||c.collapse();this._setSelection(c,!0,!0,d);return!0},_doEnter:function(a){var c=this._model,b=this._getSelection();this._doContent(c.getLineDelimiter());a&&a.noCursor&&(b.end=b.start,this._setSelection(b,!0));return!0},_doHome:function(a){var c=this._getSelection(),b=this._model,d;if(a.ctrl)c.extend(0),d=function(){};else{var e=c.getCaret(),f=b.getLineAtOffset(e);this._wrapMode?(b=this._getLine(f),e=b.getLineIndex(e),
e=b.getLineStart(e),b.destroy()):e=b.getLineStart(f);c.extend(e)}a.select||c.collapse();this._setSelection(c,!0,!0,d);return!0},_doLineDown:function(c){var b=this._model,d=this._getSelection(),e=d.getCaret(),f=b.getLineAtOffset(e),g=this._getLine(f),n=this._columnX,l=1,h=!1;if(-1===n||c.wholeLine||c.select&&a.isIE)n=c.wholeLine?b.getLineEnd(f+1):e,n=g.getBoundingClientRect(n).left;(e=g.getLineIndex(e))<g.getLineCount()-1?l=g.getClientRects(e+1).top+1:(e=b.getLineCount()-1,h=f===e,c.count&&0<c.count?
f=Math.min(f+c.count,e):f++);e=!1;if(h){if(c.select||a.isMac||a.isLinux)d.extend(b.getCharCount()),e=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),d.extend(g.getOffset(n,l)),e=!0;e&&(c.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=n;g.destroy();return!0},_doLineUp:function(c){var b=this._model,d=this._getSelection(),e=d.getCaret(),f=b.getLineAtOffset(e),g=this._getLine(f),n=this._columnX,l=!1,h;if(-1===n||c.wholeLine||c.select&&a.isIE)n=c.wholeLine?b.getLineStart(f-1):
e,n=g.getBoundingClientRect(n).left;0<(e=g.getLineIndex(e))?h=g.getClientRects(e-1).top+1:(l=0===f,l||(c.count&&0<c.count?f=Math.max(f-c.count,0):f--,h=this._getLineHeight(f)-1));e=!1;if(l){if(c.select||a.isMac||a.isLinux)d.extend(0),e=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),d.extend(g.getOffset(n,h)),e=!0;e&&(c.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=n;g.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(c){var b=this,d=this._model,e=this._getSelection(),
f=e.getCaret(),g=d.getLineAtOffset(f),n=d.getLineCount(),l=this._getScroll(),d=this._getClientHeight(),h,q;if(this._lineHeight){h=this._columnX;l=this._getBoundsAtOffset(f);if(-1===h||c.select&&a.isIE)h=l.left;f=this._getLineIndex(l.top+d);q=this._getLine(f);g=this._getLinePixel(f);f=q.getOffset(h,l.top+d-g);d=q.getBoundingClientRect(f);q.destroy();e.extend(f);c.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=h},d.top+g-l.top);return!0}if(g<n-1){var k=this._getLineHeight(),s=
Math.min(n-g-1,Math.floor(d/k)),s=Math.max(1,s);h=this._columnX;if(-1===h||c.select&&a.isIE)q=this._getLine(g),h=q.getBoundingClientRect(f).left,q.destroy();q=this._getLine(g+s);e.extend(q.getOffset(h,0));q.destroy();c.select||e.collapse();c=n*k;f=l.y+s*k;f+d>c&&(f=c-d);this._setSelection(e,!0,!0,function(){b._columnX=h},f-l.y)}return!0},_doPageUp:function(c){var b=this,d=this._model,e=this._getSelection(),f=e.getCaret(),g=d.getLineAtOffset(f),n=this._getScroll(),l=this._getClientHeight(),h;if(this._lineHeight){h=
this._columnX;n=this._getBoundsAtOffset(f);if(-1===h||c.select&&a.isIE)h=n.left;f=this._getLineIndex(n.bottom-l);d=this._getLine(f);g=this._getLinePixel(f);f=d.getOffset(h,n.bottom-l-g);l=d.getBoundingClientRect(f);d.destroy();e.extend(f);c.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=h},l.top+g-n.top);return!0}if(0<g){var q=this._getLineHeight(),l=Math.max(1,Math.min(g,Math.floor(l/q)));h=this._columnX;if(-1===h||c.select&&a.isIE)d=this._getLine(g),h=d.getBoundingClientRect(f).left,
d.destroy();d=this._getLine(g-l);e.extend(d.getOffset(h,this._getLineHeight(g-l)-1));d.destroy();c.select||e.collapse();c=Math.max(0,n.y-l*q);this._setSelection(e,!0,!0,function(){b._columnX=h},c-n.y)}return!0},_doPaste:function(c){var b=this;return null!==this._getClipboardText(c,function(c){c&&(a.isLinux&&2===b._lastMouseButton&&(new Date).getTime()-b._lastMouseTime<=b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(c))})},_doScroll:function(a){var c=a.type,b=this._model,
d=b.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),d=d*e,f=this._getScroll().y,g;switch(c){case "textStart":g=0;break;case "textEnd":g=d-a;break;case "pageDown":g=f+a;break;case "pageUp":g=f-a;break;case "lineDown":g=f+e;break;case "lineUp":g=f-e;break;case "centerLine":c=this._getSelection(),g=b.getLineAtOffset(c.start),b=(b.getLineAtOffset(c.end)-g+1)*e,g=g*e-a/2+b/2}void 0!==g&&(g=Math.min(Math.max(0,g),d-a),this._scrollViewAnimated(0,g-f,function(){}));return!0},_doSelectAll:function(a){a=
this._model;var c=this._getSelection();c.setCaret(0);c.extend(a.getCharCount());this._setSelection(c,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var c=this._model;a=this._getSelection().getCaret();var b=c.getLineAtOffset(a),c=c.getLineStart(b);a=Array(this._tabSize-(a-c)%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 c=this._model,b=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=b.getCaret(),f=c.getLineCount(),g=c.getLineAtOffset(e),n;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)e=this._autoScrollY/this._getLineHeight(),e=0>e?Math.floor(e):Math.ceil(e),n=Math.max(0,
Math.min(f-1,g+e));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)n=this._getLineIndex(d.y),g=this._getLine(g),d.x+=g.getBoundingClientRect(e,!1).left,g.destroy();0===n&&(a.isMac||a.isLinux)?b.extend(0):n===f-1&&(a.isMac||a.isLinux)?b.extend(c.getCharCount()):(g=this._getLine(n),b.extend(g.getOffset(d.x,d.y-this._getLinePixel(n))),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 c=this._model.getLineCount(),b=0;if(a){a=0;for(var d=(new Date).getTime(),e=0;b<c&&!(this._lineHeight[b]||(a++,e||(e=b),this._lineHeight[b]=this._calculateLineHeight(b)),b++,100<(new Date).getTime()-d););this.redrawRulers(0,c);this._queueUpdate()}a=this._getWindow();if(b!==c){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 c=a.getBoundingClientRect();a.destroy();return Math.max(1,c.bottom-c.top)},_calculateMetrics:function(){var c=this._clientDiv,b=c.ownerDocument,d=a.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);e(f.style,d);d.style.position="fixed";
d.style.left="-1000px";var g=a.createElement(b,"span");g.appendChild(b.createTextNode(" "));d.appendChild(g);var n=a.createElement(b,"span");n.style.fontStyle="italic";n.appendChild(b.createTextNode(" "));d.appendChild(n);var l=a.createElement(b,"span");l.style.fontWeight="bold";l.appendChild(b.createTextNode(" "));d.appendChild(l);f=a.createElement(b,"span");f.style.fontWeight="bold";f.style.fontStyle="italic";f.appendChild(b.createTextNode(" "));d.appendChild(f);c.appendChild(d);var h=d.getBoundingClientRect(),
g=g.getBoundingClientRect(),n=n.getBoundingClientRect(),l=l.getBoundingClientRect(),f=f.getBoundingClientRect(),g=g.bottom-g.top,n=n.bottom-n.top,l=l.bottom-l.top,k=f.bottom-f.top,m=0,f=0>=h.bottom-h.top,h=Math.max(1,h.bottom-h.top);n>g&&(m=1);l>n&&(m=2);k>l&&(m=3);var E;0!==m&&(E={style:{}},0!==(m&1)&&(E.style.fontStyle="italic"),0!==(m&2)&&(E.style.fontWeight="bold"));g=s(d);c.removeChild(d);k=q(this._viewDiv);d=a.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=a.createElement(b,"div");k.style.width="100%";k.style.height="100%";d.appendChild(k);c.appendChild(d);m=d.getBoundingClientRect();n=k.getBoundingClientRect();l=0;this._singleMode||(d.style.overflow="hidden",k.style.height="200px",l=d.clientWidth,d.style.overflow="scroll",l-=d.clientWidth);c.removeChild(d);k={left:n.left-m.left,top:n.top-m.top,
right:m.right-n.right,bottom:m.bottom-n.bottom};n=m=0;if(!f&&(this._wrapOffset||this._marginOffset))d=a.createElement(b,"div"),d.style.position="fixed",d.style.left="-1000px",d.innerHTML=Array(this._wrapOffset+1+(a.isWebkit?0:1)).join(" "),c.appendChild(d),m=d.getBoundingClientRect(),m=Math.ceil(m.right-m.left),d.innerHTML=Array(this._marginOffset+1).join(" "),n=d.getBoundingClientRect(),n=Math.ceil(n.right-n.left),c.removeChild(d);return{lineHeight:h,largestFontStyle:E,lineTrim:g,viewPadding:k,scrollWidth:l,
wrapWidth:m,marginWidth:n,invalid:f}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var c=this._getSelection();if(c.isEmpty())return!1;"next"===a?c.start=c.end:c.end=c.start;this._setSelection(c,!0);return!0},_commitIME:function(){if(-1!==this._imeOffset){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,c=a.getLineAtOffset(this._imeOffset),b=a.getLineStart(c),d=this._getDOMText(this._getLineNode(c)).text,a=
a.getLine(c),b=this._imeOffset-b,a=b+d.length-a.length;b!==a&&(d=d.substring(b,a),this._doContent(d));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(c){return a._doLineUp(l(c,{select:!1}))},actionDescription:{name:k.lineUp}},lineDown:{defaultHandler:function(c){return a._doLineDown(l(c,{select:!1}))},actionDescription:{name:k.lineDown}},lineStart:{defaultHandler:function(c){return a._doHome(l(c,
{select:!1,ctrl:!1}))},actionDescription:{name:k.lineStart}},lineEnd:{defaultHandler:function(c){return a._doEnd(l(c,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineEnd}},charPrevious:{defaultHandler:function(c){return a._doCursorPrevious(l(c,{select:!1,unit:"character"}))},actionDescription:{name:k.charPrevious}},charNext:{defaultHandler:function(c){return a._doCursorNext(l(c,{select:!1,unit:"character"}))},actionDescription:{name:k.charNext}},pageUp:{defaultHandler:function(c){return a._doPageUp(l(c,
{select:!1}))},actionDescription:{name:k.pageUp}},pageDown:{defaultHandler:function(c){return a._doPageDown(l(c,{select:!1}))},actionDescription:{name:k.pageDown}},scrollPageUp:{defaultHandler:function(c){return a._doScroll(l(c,{type:"pageUp"}))},actionDescription:{name:k.scrollPageUp}},scrollPageDown:{defaultHandler:function(c){return a._doScroll(l(c,{type:"pageDown"}))},actionDescription:{name:k.scrollPageDown}},scrollLineUp:{defaultHandler:function(c){return a._doScroll(l(c,{type:"lineUp"}))},
actionDescription:{name:k.scrollLineUp}},scrollLineDown:{defaultHandler:function(c){return a._doScroll(l(c,{type:"lineDown"}))},actionDescription:{name:k.scrollLineDown}},wordPrevious:{defaultHandler:function(c){return a._doCursorPrevious(l(c,{select:!1,unit:"word"}))},actionDescription:{name:k.wordPrevious}},wordNext:{defaultHandler:function(c){return a._doCursorNext(l(c,{select:!1,unit:"word"}))},actionDescription:{name:k.wordNext}},textStart:{defaultHandler:function(c){return a._doHome(l(c,{select:!1,
ctrl:!0}))},actionDescription:{name:k.textStart}},textEnd:{defaultHandler:function(c){return a._doEnd(l(c,{select:!1,ctrl:!0}))},actionDescription:{name:k.textEnd}},scrollTextStart:{defaultHandler:function(c){return a._doScroll(l(c,{type:"textStart"}))},actionDescription:{name:k.scrollTextStart}},scrollTextEnd:{defaultHandler:function(c){return a._doScroll(l(c,{type:"textEnd"}))},actionDescription:{name:k.scrollTextEnd}},centerLine:{defaultHandler:function(c){return a._doScroll(l(c,{type:"centerLine"}))},
actionDescription:{name:k.centerLine}},selectLineUp:{defaultHandler:function(c){return a._doLineUp(l(c,{select:!0}))},actionDescription:{name:k.selectLineUp}},selectLineDown:{defaultHandler:function(c){return a._doLineDown(l(c,{select:!0}))},actionDescription:{name:k.selectLineDown}},selectWholeLineUp:{defaultHandler:function(c){return a._doLineUp(l(c,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(c){return a._doLineDown(l(c,
{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineDown}},selectLineStart:{defaultHandler:function(c){return a._doHome(l(c,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineStart}},selectLineEnd:{defaultHandler:function(c){return a._doEnd(l(c,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineEnd}},selectCharPrevious:{defaultHandler:function(c){return a._doCursorPrevious(l(c,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharPrevious}},selectCharNext:{defaultHandler:function(c){return a._doCursorNext(l(c,
{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharNext}},selectPageUp:{defaultHandler:function(c){return a._doPageUp(l(c,{select:!0}))},actionDescription:{name:k.selectPageUp}},selectPageDown:{defaultHandler:function(c){return a._doPageDown(l(c,{select:!0}))},actionDescription:{name:k.selectPageDown}},selectWordPrevious:{defaultHandler:function(c){return a._doCursorPrevious(l(c,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordPrevious}},selectWordNext:{defaultHandler:function(c){return a._doCursorNext(l(c,
{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordNext}},selectTextStart:{defaultHandler:function(c){return a._doHome(l(c,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextStart}},selectTextEnd:{defaultHandler:function(c){return a._doEnd(l(c,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextEnd}},deletePrevious:{defaultHandler:function(c){return a._doBackspace(l(c,{unit:"character"}))},actionDescription:{name:k.deletePrevious}},deleteNext:{defaultHandler:function(c){return a._doDelete(l(c,
{unit:"character"}))},actionDescription:{name:k.deleteNext}},deleteWordPrevious:{defaultHandler:function(c){return a._doBackspace(l(c,{unit:"word"}))},actionDescription:{name:k.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(c){return a._doDelete(l(c,{unit:"word"}))},actionDescription:{name:k.deleteWordNext}},deleteLineStart:{defaultHandler:function(c){return a._doBackspace(l(c,{unit:"line"}))},actionDescription:{name:k.deleteLineStart}},deleteLineEnd:{defaultHandler:function(c){return a._doDelete(l(c,
{unit:"line"}))},actionDescription:{name:k.deleteLineEnd}},tab:{defaultHandler:function(c){return a._doTab()},actionDescription:{name:k.tab}},shiftTab:{defaultHandler:function(c){return a._doShiftTab()},actionDescription:{name:k.shiftTab}},enter:{defaultHandler:function(c){return a._doEnter()},actionDescription:{name:k.enter}},enterNoCursor:{defaultHandler:function(c){return a._doEnter(l(c,{noCursor:!0}))},actionDescription:{name:k.enterNoCursor}},selectAll:{defaultHandler:function(c){return a._doSelectAll()},
actionDescription:{name:k.selectAll}},copy:{defaultHandler:function(c){return a._doCopy()},actionDescription:{name:k.copy}},cut:{defaultHandler:function(c){return a._doCut()},actionDescription:{name:k.cut}},paste:{defaultHandler:function(c){return a._doPaste()},actionDescription:{name:k.paste}},uppercase:{defaultHandler:function(c){return a._doCase(l(c,{type:"upper"}))},actionDescription:{name:k.uppercase}},lowercase:{defaultHandler:function(c){return a._doCase(l(c,{type:"lower"}))},actionDescription:{name:k.lowercase}},
capitalize:{defaultHandler:function(c){return a._doCase(l(c,{unit:"word",type:"capitalize"}))},actionDescription:{name:k.capitalize}},reversecase:{defaultHandler:function(c){return a._doCase(l(c,{type:"reverse"}))},actionDescription:{name:k.reversecase}},toggleOverwriteMode:{defaultHandler:function(c){return a._doOverwriteMode()},actionDescription:{name:k.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(c){return a._doTabMode()},actionDescription:{name:k.toggleTabMode}},toggleWrapMode:{defaultHandler:function(c){return a._doWrapMode()},
actionDescription:{name:k.toggleWrapMode}}}},_createRulerParent:function(c,b){var d=a.createElement(c,"div");d.className=b;d.tabIndex=-1;d.style.overflow="hidden";d.style.MozUserSelect="none";d.style.WebkitUserSelect="none";d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.cursor="default";d.style.display="none";d.setAttribute("aria-hidden","true");this._rootDiv.appendChild(d);return d},_createRuler:function(c,b){if(this._clientDiv){var d=this._getRulerParent(c);if(d){if(d!==
this._marginDiv||this._marginOffset)d.style.display="block";var e=a.createElement(d.ownerDocument,"div");e._ruler=c;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(void 0===b||0>b||b>=d.children.length)d.appendChild(e);else{for(var f=d.firstChild;f&&0<b--;)f=f.nextSibling;d.insertBefore(e,f)}}}},_createView:function(){function c(){g._rootDiv&&(g.update(!0),g._metrics.invalid&&g._getWindow().setTimeout(function(){c()},100))}
if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var d=b.ownerDocument,e=a.createElement(d,"div");this._rootDiv=e;e.tabIndex=-1;e.style.position="relative";e.style.overflow="hidden";e.style.width="100%";e.style.height="100%";e.style.overflow="hidden";e.style.WebkitTextSizeAdjust="100%";e.setAttribute("role","application");b.appendChild(e);this._leftDiv=this._createRulerParent(d,"textviewLeftRuler");b=a.createElement(d,"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";a.isMac&&a.isWebkit&&(b.style.pointerEvents="none",b.style.zIndex="2");e.appendChild(b);var f=this._createRulerParent(d,"textviewRightRuler");this._rightDiv=f;f.style.right="0px";this._scrollDiv=f=a.createElement(d,"div");f.style.margin="0px";f.style.borderWidth="0px";f.style.padding="0px";b.appendChild(f);(this._marginDiv=
this._createRulerParent(d,"textviewMarginRuler")).style.zIndex="4";!a.isIE&&!a.isIOS&&(this._clipDiv=b=a.createElement(d,"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",e.appendChild(b),this._clipScrollDiv=f=a.createElement(d,"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=a.createElement(d,"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(a.isIOS||a.isAndroid)b.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(b);if(a.isIOS||a.isAndroid)this._vScrollDiv=f=a.createElement(d,"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",e.appendChild(f),this._hScrollDiv=f=a.createElement(d,"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",e.appendChild(f);a.isFirefox&&!b.setCapture&&(this._overlayDiv=f=a.createElement(d,"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||e).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;u(d,e,"textview",c)}},_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:b.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var c=this._getRulerParent(a);if(c)for(var b=c.firstChild;b;){if(b._ruler===a){b._ruler=void 0;c.removeChild(b);if(0===c.children.length&&(c!==this._marginDiv||!this._marginOffset))c.style.display="none";break}b=b.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,
c,b){this._autoScrollDir=a;this._autoScrollX=c;this._autoScrollY=b;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 c=this._hasFocus;this._ignoreFocus=!0;c&&a.blur();a.contentEditable=!1;a.contentEditable=!0;c&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,c){var b=this._model;
b.getBaseModel&&(a=b.mapOffset(a),c=b.mapOffset(c),b=b.getBaseModel());return b.getText(a,c)},_getBottomIndex:function(a){var c=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=c.getBoundingClientRect();var b=this._clientDiv.getBoundingClientRect();a.bottom>b.bottom&&(c=this._getLinePrevious(c)||c)}return c.lineIndex},_getBoundsAtOffset:function(a){var c=this._getLine(this._model.getLineAtOffset(a));a=c.getBoundingClientRect(a);var b=this._getLinePixel(c.lineIndex);a.top+=
b;a.bottom+=b;c.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(c,b){var d=this._model.getLineDelimiter(),e,f,g=this._getWindow(),l=g.clipboardData;!l&&c&&(l=c.clipboardData);if(l)return e=[],f=l.getData(a.isIE?"Text":"text/plain"),n(f,function(a){e.push(a)},function(){e.push(d)}),
f=e.join(""),b&&b(f),f;if(a.isFirefox){this._ignoreFocus=!0;var h=this._clipboardDiv,l=this._rootDiv.ownerDocument;h||(this._clipboardDiv=h=a.createElement(l,"div"),h.style.position="fixed",h.style.whiteSpace="pre",h.style.left="-1000px",this._rootDiv.appendChild(h));h.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";h.firstChild.focus();var q=this,k=function(){var a=q._getTextFromElement(h);h.innerHTML="";e=[];n(a,function(a){e.push(a)},function(){e.push(d)});return e.join("")},s=!1;this._ignorePaste=
!0;if(!a.isLinux||2!==this._lastMouseButton)try{s=l.execCommand("paste",!1,null)}catch(m){s=1<h.childNodes.length||h.firstChild&&0<h.firstChild.childNodes.length}this._ignorePaste=!1;if(!s){if(c)return g.setTimeout(function(){q.focus();(f=k())&&b&&b(f);q._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(f=k())&&b&&b(f);return f}return""},_getDOMText:function(a,c){return a._line.getText(c)},_getTextFromElement:function(a){var c=a.ownerDocument,b=
c.defaultView;if(!b.getSelection)return a.innerText||a.textContent;c=c.createRange();c.selectNode(a);a=b.getSelection();var b=[],d;for(d=0;d<a.rangeCount;d++)b.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(d=0;d<b.length;d++)a.addRange(b[d]);this._ignoreSelect=!1;return c},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var c=this._getLineNode(a);return c&&!c.lineChanged&&!c.lineRemoved?c._line:
new v(this,a)},_getLineHeight:function(a,c){if(void 0!==a&&this._lineHeight){var b=this._lineHeight[a];if(b)return b;if(c||void 0===c)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var c=this._clientDiv.firstChild;c;){if(a===c.lineIndex)return c;c=c.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 c=this._getTopIndex(),b=-this._topIndexY+this._getScroll().y;if(a>c)for(;c<a;c++)b+=this._getLineHeight(c);else for(c-=1;c>=a;c--)b-=this._getLineHeight(c);return b}return this._getLineHeight()*a},_getLineIndex:function(a){var c,b=0,d=this._model.getLineCount();if(this._lineHeight){var b=this._getTopIndex(),e=-this._topIndexY+
this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<b;)a+=this._getLineHeight(--b);else for(c=this._getLineHeight(b);a-c>=e&&b<d-1;)a-=c,c=this._getLineHeight(++b)}else c=this._getLineHeight(),b=Math.floor(a/c);return Math.max(0,Math.min(d-1,b))},_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 c=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=c.getBoundingClientRect();var b=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+b.top&&(c=this._getLineNext(c)||c)}return c.lineIndex},_hookEvents:function(){var c=this;this._modelListener={onChanging:function(a){c._onModelChanging(a)},onChanged:function(a){c._onModelChanged(a)}};this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(a){c._setThemeClass(c._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var b=this._handlers=[],d=this._clientDiv,e=this._viewDiv,f=this._rootDiv,g=this._overlayDiv||d,n=d.ownerDocument,l=this._getWindow(),h=a.isIE?n:l;b.push({target:l,type:"resize",handler:function(a){return c._handleResize(a?a:l.event)}});b.push({target:d,
type:"blur",handler:function(a){return c._handleBlur(a?a:l.event)}});b.push({target:d,type:"focus",handler:function(a){return c._handleFocus(a?a:l.event)}});b.push({target:e,type:"focus",handler:function(a){d.focus()}});b.push({target:e,type:"scroll",handler:function(a){return c._handleScroll(a?a:l.event)}});b.push({target:d,type:"textInput",handler:function(a){return c._handleTextInput(a?a:l.event)}});b.push({target:d,type:"keydown",handler:function(a){return c._handleKeyDown(a?a:l.event)}});b.push({target:d,
type:"keypress",handler:function(a){return c._handleKeyPress(a?a:l.event)}});b.push({target:d,type:"keyup",handler:function(a){return c._handleKeyUp(a?a:l.event)}});a.isIE&&b.push({target:n,type:"keyup",handler:function(a){return c._handleDocKeyUp(a?a:l.event)}});b.push({target:d,type:"contextmenu",handler:function(a){return c._handleContextMenu(a?a:l.event)}});b.push({target:d,type:"copy",handler:function(a){return c._handleCopy(a?a:l.event)}});b.push({target:d,type:"cut",handler:function(a){return c._handleCut(a?
a:l.event)}});b.push({target:d,type:"paste",handler:function(a){return c._handlePaste(a?a:l.event)}});b.push({target:n,type:"selectionchange",handler:function(a){return c._handleSelectionChange(a?a:l.event)}});if(a.isIOS||a.isAndroid)b.push({target:d,type:"touchstart",handler:function(a){return c._handleTouchStart(a?a:l.event)}}),b.push({target:d,type:"touchmove",handler:function(a){return c._handleTouchMove(a?a:l.event)}}),b.push({target:d,type:"touchend",handler:function(a){return c._handleTouchEnd(a?
a:l.event)}});else{b.push({target:d,type:"selectstart",handler:function(a){return c._handleSelectStart(a?a:l.event)}});b.push({target:d,type:"mousedown",handler:function(a){return c._handleMouseDown(a?a:l.event)}});b.push({target:d,type:"mouseover",handler:function(a){return c._handleMouseOver(a?a:l.event)}});b.push({target:d,type:"mouseout",handler:function(a){return c._handleMouseOut(a?a:l.event)}});b.push({target:h,type:"mouseup",handler:function(a){return c._handleMouseUp(a?a:l.event)}});b.push({target:h,
type:"mousemove",handler:function(a){return c._handleMouseMove(a?a:l.event)}});b.push({target:f,type:"mousedown",handler:function(a){return c._handleRootMouseDown(a?a:l.event)}});b.push({target:f,type:"mouseup",handler:function(a){return c._handleRootMouseUp(a?a:l.event)}});b.push({target:g,type:"dragstart",handler:function(a){return c._handleDragStart(a?a:l.event)}});b.push({target:g,type:"drag",handler:function(a){return c._handleDrag(a?a:l.event)}});b.push({target:g,type:"dragend",handler:function(a){return c._handleDragEnd(a?
a:l.event)}});b.push({target:g,type:"dragenter",handler:function(a){return c._handleDragEnter(a?a:l.event)}});b.push({target:g,type:"dragover",handler:function(a){return c._handleDragOver(a?a:l.event)}});b.push({target:g,type:"dragleave",handler:function(a){return c._handleDragLeave(a?a:l.event)}});b.push({target:g,type:"drop",handler:function(a){return c._handleDrop(a?a:l.event)}});b.push({target:this._clientDiv,type:26<a.isFirefox?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?
a:l.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:26<a.isFirefox?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?a:l.event)}});if(a.isFirefox&&(!a.isWindows||15<=a.isFirefox))(e=l.MutationObserver||l.MozMutationObserver)?(this._mutationObserver=new e(function(a){c._handleDataModified(a)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(a){return c._handleDataModified(a?
a:l.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(a){return c._handleMouseDown(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(a){return c._handleMouseOver(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(a){return c._handleMouseOut(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"contextmenu",handler:function(a){return c._handleContextMenu(a?a:l.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,
type:"dblclick",handler:function(a){return c._handleDblclick(a?a:l.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(e=0;e<b.length;e++)f=b[e],A(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(c,b){if(c){var d=this,e=this._getWindow();a.isIE&&b.push({target:c,type:"selectstart",handler:function(){return!1}});b.push({target:c,type:26<a.isFirefox?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?
a:e.event)}});b.push({target:c,type:"click",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"mouseover",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"mouseout",handler:function(a){d._handleRulerEvent(a?a:e.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(c){var b=c.parent;"string"===typeof b&&(b=(c.document||document).getElementById(b));if(!b)throw"no parent";c.parent=b;c.model=c.model||new m.TextModel;var d=this._defaultOptions(),e;for(e in d)d.hasOwnProperty(e)&&(this["_"+e]=void 0!==c[e]?c[e]:d[e].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=(!a.isIE||9<=a.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,c){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(null===a.text||void 0===a.text)){var b=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),b.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}c&&(b=
this._getSelection(),b.setCaret(a.start+a.text.length),this._setSelection(b,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var c=a.start,b=a.addedCharCount,d=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,g=this._getSelection();g.end>c&&(g.end>c&&g.start<c+d?g.setCaret(c+b):(g.start+=b-d,g.end+=b-d),this._setSelection(g,!1,!1));c=this._model.getLineAtOffset(c);for(b=this._getLineNext();b;)d=b.lineIndex,c<=
d&&d<=c+f&&(c===d&&!b.modelChangedEvent&&!b.lineRemoved?(b.modelChangedEvent=a,b.lineChanged=!0):(b.lineRemoved=!0,b.lineChanged=!1,b.modelChangedEvent=null)),d>c+f&&(b.lineIndex=d+e-f,b._line.lineIndex=b.lineIndex),b=this._getLineNext(b);this._lineHeight&&(a=[c,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&c<=this._maxLineIndex&&this._maxLineIndex<=c+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,c){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==c)for(var b=a;b<c;b++)this._lineHeight[b]=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 c=this._clientDiv;if(c){for(c=c.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;13>a.isFirefox&&
this._fixCaret()}},_scrollViewAnimated:function(a,c,b){var d=this._getWindow();if(b&&this._scrollAnimation){var e=this;this._animation=new z({window:d,duration:this._scrollAnimation,curve:[c,0],onAnimate:function(a){a=c-Math.floor(a);e._scrollView(0,a);c-=a},onEnd:function(){e._animation=null;e._scrollView(a,c);b&&d.setTimeout(b,0)}});this._animation.play()}else this._scrollView(a,c),b&&d.setTimeout(b,0)},_scrollView:function(a,c){this._ensureCaretVisible=!1;var b=this._viewDiv;a&&(b.scrollLeft+=
a);c&&(b.scrollTop+=c)},_setClipboardText:function(c,b){var d,e=this._getWindow(),f=e.clipboardData;!f&&b&&(f=b.clipboardData);if(f&&(d=[],n(c,function(a){d.push(a)},function(){d.push(a.platformDelimiter)}),f.setData(a.isIE?"Text":"text/plain",d.join(""))))return!0;var g=this._parent.ownerDocument,l=a.createElement(g,"pre");l.style.position="fixed";l.style.left="-1000px";n(c,function(a){l.appendChild(g.createTextNode(a))},function(){l.appendChild(a.createElement(g,"br"))});l.appendChild(g.createTextNode(" "));
this._clientDiv.appendChild(l);f=g.createRange();f.setStart(l.firstChild,0);f.setEndBefore(l.lastChild);var h=e.getSelection();0<h.rangeCount&&h.removeAllRanges();h.addRange(f);var q=this,f=function(){l&&l.parentNode===q._clientDiv&&q._clientDiv.removeChild(l);q._updateDOMSelection()},h=!1;this._ignoreCopy=!0;try{h=g.execCommand("copy",!1,null)}catch(k){}this._ignoreCopy=!1;if(!h&&b)return e.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(c,b,d,e,f){this._setDOMFullSelection(c,b,d,e);c=
c._line.getNodeOffset(b);d=d._line.getNodeOffset(e);e=this._getWindow();b=this._parent.ownerDocument;if(e.getSelection){var g=e.getSelection();e=b.createRange();e.setStart(c.node,c.offset);e.setEnd(d.node,d.offset);if(this._hasFocus&&(g.anchorNode!==c.node||g.anchorOffset!==c.offset||g.focusNode!==d.node||g.focusOffset!==d.offset||g.anchorNode!==d.node||g.anchorOffset!==d.offset||g.focusNode!==c.node||g.focusOffset!==c.offset))this._anchorNode=c.node,this._anchorOffset=c.offset,this._focusNode=d.node,
this._focusOffset=d.offset,this._ignoreSelect=!1,0<g.rangeCount&&g.removeAllRanges(),g.addRange(e),this._ignoreSelect=!0;this._cursorDiv&&(e=b.createRange(),f?(e.setStart(c.node,c.offset),e.setEnd(c.node,c.offset)):(e.setStart(d.node,d.offset),e.setEnd(d.node,d.offset)),f=e.getClientRects()[0],c=this._cursorDiv.parentNode,d=c.getBoundingClientRect(),f&&d&&(this._cursorDiv.style.top=f.top-d.top+c.scrollTop+"px",this._cursorDiv.style.left=f.left-d.left+c.scrollLeft+"px"))}else b.selection&&this._hasFocus&&
(f=b.body,e=a.createElement(b,"div"),f.appendChild(e),f.removeChild(e),e=f.createTextRange(),e.moveToElementText(c.node.parentNode),e.moveStart("character",c.offset),f=f.createTextRange(),f.moveToElementText(d.node.parentNode),f.moveStart("character",d.offset),e.setEndPoint("EndToStart",f),this._ignoreSelect=!1,e.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,c,b,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===b&&c===d)){var f=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),l=this._viewDiv.getBoundingClientRect(),e=l.left+f.left,n=g.right,f=l.top+f.top,h=g.bottom,l=g=0;this._clipDiv?(l=this._clipDiv.getBoundingClientRect(),g=l.left-this._clipDiv.scrollLeft):(l=this._rootDiv.getBoundingClientRect(),g=l.left);l=l.top;this._ignoreDOMSelection=!0;var q=(new v(this,a.lineIndex,a)).getBoundingClientRect(c,
!1),k=q.left;c=(new v(this,b.lineIndex,b)).getBoundingClientRect(d,!1);var s=c.left;this._ignoreDOMSelection=!1;var m=this._selDiv1,k=Math.min(n,Math.max(e,k)),u=Math.min(h,Math.max(f,q.top)),r=n;d=Math.min(h,Math.max(f,q.bottom));m.style.left=k-g+"px";m.style.top=u-l+"px";m.style.width=Math.max(0,r-k)+"px";m.style.height=Math.max(0,d-u)+"px";a.lineIndex===b.lineIndex?(r=Math.min(s,n),m.style.width=Math.max(0,r-k)+"px"):(q=Math.min(h,Math.max(f,c.top)),s=Math.min(n,Math.max(e,s)),f=Math.min(h,Math.max(f,
c.bottom)),h=this._selDiv3,h.style.left=e-g+"px",h.style.top=q-l+"px",h.style.width=Math.max(0,s-e)+"px",h.style.height=Math.max(0,f-q)+"px",1<Math.abs(a.lineIndex-b.lineIndex)&&(a=this._selDiv2,a.style.left=e-g+"px",a.style.top=d-l+"px",a.style.width=Math.max(0,n-e)+"px",a.style.height=Math.max(0,q-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(c){if(this._linksVisible!==c){this._linksVisible=c;a.isIE&&c&&(this._hadFocus=this._hasFocus);var b=this._clientDiv;b.contentEditable=!c;this._hadFocus&&!c&&b.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=c?"-1":"1");for(c=this._getLineNext();c;)c._line.updateLinks(),c=this._getLineNext(c);this._updateDOMSelection()}},_setSelection:function(a,c,b,d,e){if(a){this._columnX=-1;void 0===b&&(b=!0);var f=this._selection;this._selection=a;!1!==c&&this._showCaret(!1,d,
c,e);b&&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,c,b,d){var e=this._model,f=this._getSelection();c=this.convert({x:a,y:c},"page","document");a=this._getLineIndex(c.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(c.x,c.y-this._getLinePixel(a));e.destroy();if(d&&!b&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);b||f.collapse()}else 0===
(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(c.x,c.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(b=this._doubleClickSelection.start,d=e.getNextOffset(a,{unit:"wordend",count:1})):(b=e.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(b=e.getNextOffset(a,{unit:"word",count:-1}),d=e.getNextOffset(b,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(d=e.getLineAtOffset(this._doubleClickSelection.start),a>=
d?(b=e.getLineStart(d),d=e.getLineEnd(a)):(b=e.getLineStart(a),d=e.getLineEnd(d))):(b=e.getLineStart(a),d=e.getLineEnd(a)),f.setCaret(b),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(c,b){this._fullSelection=c;a.isWebkit&&(this._fullSelection=!0);var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!a.isIOS){var e=d.ownerDocument;this._highlightRGB=a.isWebkit?"transparent":"Highlight";var f=a.createElement(e,"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";d.appendChild(f);var g=a.createElement(e,"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";d.appendChild(g);this._selDiv3=e=a.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";d.appendChild(e);if(a.isFirefox&&a.isMac){d=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";
break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;f.style.background=d;g.style.background=d;e.style.background=d}b||this._updateDOMSelection()}}else this._selDiv1&&(d.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&
(d.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(d.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 c=this._viewDiv,b=a.createElement(c.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;";c.appendChild(b);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,c){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";c||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,c){this._wrapOffset=
a;c||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,c){this._singleMode=a;this._updateOverflow();this._updateStyle(c)},_setTabSize:function(c,b){this._tabSize=c;this._customTabSize=void 0;var d=this._clientDiv;a.isOpera?d&&(d.style.OTabSize=this._tabSize+""):537.1<=a.isWebkit?d&&(d.style.tabSize=this._tabSize+""):4<=a.isFirefox?d&&(d.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,c){this._themeClass=a;var b="textview",d=this._theme.getThemeClass();d&&(b+=" "+d);this._themeClass&&d!==this._themeClass&&(b+=
" "+this._themeClass);this._rootDiv.className=b;this._updateStyle(c)},_setWrapMode:function(a,c){this._wrapMode=a&&this._wrappable;var b=this._clientDiv;this._wrapMode?(b.style.whiteSpace="pre-wrap",b.style.wordWrap="break-word"):(b.style.whiteSpace="pre",b.style.wordWrap="normal");this._updateOverflow();c||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,c,b,d){if(this._clientDiv){var e=this._model,f=this._getSelection(),g=this._getScroll(),l=f.getCaret(),n=f.start,
h=f.end,q=e.getLineAtOffset(n),k=e.getLineAtOffset(h),s=Math.max(Math.max(n,e.getLineStart(k)),h-1),e=this._getClientWidth(),m=this._getClientHeight(),u=e/4,r=this._getBoundsAtOffset(l===n?n:s),x=r.left,t=r.right,v=r.top,w=r.bottom,z=0,A="object"===typeof b;if((a||A)&&!f.isEmpty())r=this._getBoundsAtOffset(l===h?n:s),z=(r.bottom>w?r.bottom:w)-(r.top<v?r.top:v),a&&(r.top===v?l===n?t=x+Math.min(r.right-x,e):x=t-Math.min(t-r.left,e):l===n?w=v+Math.min(r.bottom-v,m):v=w-Math.min(w-r.top,m));a=0;x<g.x&&
(a=Math.min(x-g.x,-u));t>g.x+e&&(a=Math.max(t-g.x-e,u));f=0;v<g.y?f=v-g.y:w>g.y+m&&(f=w-g.y-m);d&&(0<d?0<f&&(f=Math.max(f,d)):0>f&&(f=Math.min(f,d)));d=A&&"always"===b.scrollPolicy;if(0!==a||0!==f||d)return A?(d=0<f,0===f&&(f=v-g.y),g=b.viewAnchor||"caret",v=b.selectionAnchor||"caret",b=Math.min(Math.max(0,b.viewAnchorOffset||0)),f="top"===g?f+Math.floor(d?(1-b)*m:-b*m):"bottom"===g?f+Math.floor(d?b*m:-(1-b)*m):"center"===g?f+Math.floor(d?m/2+b*m:m/2-(1-b)*m):f+Math.floor(d?b*m:-b*m),q!==k&&("top"===
v&&l!==n?f+=Math.floor(-z):"bottom"===v&&l!==h?f+=Math.floor(z):"center"===v&&(f+=Math.floor(z/2)))):0!==f&&"number"===typeof b&&(0>b&&(b=0),1<b&&(b=1),f+=Math.floor(0<f?b*m:-b*m)),this._scrollViewAnimated(a,f,c),m!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;c&&c();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 c=this._handlers[a];x(c.target,c.type,c.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(),c=this._model,b=c.getLineAtOffset(a.start),d=c.getLineAtOffset(a.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),g;b<e.lineIndex?(b=e,g=c.getLineStart(e.lineIndex)):b>f.lineIndex?(b=f,g=c.getLineStart(f.lineIndex)):(b=this._getLineNode(b),g=a.start);d<e.lineIndex?(d=e,c=c.getLineStart(e.lineIndex)):d>f.lineIndex?(d=f,c=c.getLineStart(f.lineIndex)):(d=this._getLineNode(d),c=a.end);this._setDOMSelection(b,
g,d,c,a.caret)}}},_update:function(c){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,c=!1);var b=this._clientDiv,d=this._viewDiv;if(b){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var e=this._model,f=this._getScroll(!1),g=this._getViewPadding(),l=e.getLineCount(),n=this._getLineHeight(),h=!1,q=!1,k=!1,s=this._metrics.scrollWidth;this._wrapMode&&(b.style.width=(this._metrics.wrapWidth||
this._getClientWidth())+"px");var m,u,r,x,t=0,w=0,z;if(this._lineHeight){for(;w<l;){z=this._getLineHeight(w);if(t+z>f.y)break;t+=z;w++}m=w;u=Math.max(0,m-1);r=e=f.y-t;0<m&&(e+=this._getLineHeight(m-1))}else x=Math.max(0,f.y)/n,m=Math.floor(x),u=Math.max(0,m-1),e=Math.round((x-u)*n),r=Math.round((x-m)*n);this._topIndexY=r;x=this._rootDiv;var A=x.clientWidth,P=x.clientHeight;if(c){n=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),n=m.right-m.left);m=this._getClientWidth();x=this._getClientHeight();
q=m;for(this._wrapMode?this._metrics.wrapWidth&&(q=this._metrics.wrapWidth):q=Math.max(this._maxLineWidth,q);w<l;)z=this._getLineHeight(w,!1),t+=z,w++;l=t}else{x=this._getClientHeight();r=Math.min(m+Math.floor((x+r)/n),l-1);var f=Math.min(r+1,l-1),M;for(z=b.firstChild;z;){M=z.lineIndex;var N=z.nextSibling;if(!(u<=M&&M<=f)||z.lineRemoved||-1===z.lineIndex)this._mouseWheelLine===z?(z.style.display="none",z.lineIndex=-1):b.removeChild(z);z=N}z=this._getLineNext();var N=d.ownerDocument,O=N.createDocumentFragment();
for(M=u;M<=f;M++)!z||z.lineIndex>M?(new v(this,M)).create(O,null):(O.firstChild&&(b.insertBefore(O,z),O=N.createDocumentFragment()),z&&z.lineChanged&&(z=(new v(this,M)).create(O,z),z.lineChanged=!1),z=this._getLineNext(z));O.firstChild&&b.insertBefore(O,z);a.isWebkit&&!this._wrapMode&&(b.style.width="0x7fffffffpx");z=this._getLineNext();M=x+e;for(O=!1;z;)u=z.lineWidth,void 0===u&&(N=z._line.getBoundingClientRect(),u=z.lineWidth=Math.ceil(N.right-N.left),N=N.bottom-N.top,this._lineHeight?this._lineHeight[z.lineIndex]=
N:0!==n&&0!==N&&Math.ceil(n)!==Math.ceil(N)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[z.lineIndex]=N)),this._lineHeight&&!O&&(M-=this._lineHeight[z.lineIndex],0>M&&(r=z.lineIndex,O=!0)),this._wrapMode||(u>=this._maxLineWidth&&(this._maxLineWidth=u,this._maxLineIndex=z.lineIndex),this._checkMaxLineIndex===z.lineIndex&&(this._checkMaxLineIndex=-1)),z.lineIndex===m&&(this._topChild=z),z.lineIndex===r&&(this._bottomChild=z),z=this._getLineNext(z);for(-1!==this._checkMaxLineIndex&&
(M=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=M&&M<l&&(n=new v(this,M),N=n.getBoundingClientRect(),u=N.right-N.left,u>=this._maxLineWidth&&(this._maxLineWidth=u,this._maxLineIndex=M),n.destroy()));w<l;)z=this._getLineHeight(w,w<=r),t+=z,w++;l=t;this._updateRuler(this._leftDiv,m,f,P);this._updateRuler(this._rightDiv,m,f,P);this._updateRuler(this._marginDiv,m,f,P);n=0;this._leftDiv&&(m=this._leftDiv.getBoundingClientRect(),n=m.right-m.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),
f=f.right-f.left);d.style.left=n+"px";d.style.right=f+"px";f=this._scrollDiv;f.style.height=l+"px";m=this._getClientWidth();!this._singleMode&&!this._wrapMode&&(t=h=x,(w="scroll"===d.style.overflowX)?h+=s:t-=s,z=r=m,(u="scroll"===d.style.overflowY)?r+=s:z-=s,x=h,m=r,l>x&&(k=!0,m=z),this._maxLineWidth>m&&(q=!0,x=t,l>x&&(k=!0,m=z)),w!==q&&(d.style.overflowX=q?"scroll":"hidden"),u!==k&&(d.style.overflowY=k?"scroll":"hidden"),h=w!==q||u!==k);k=m;this._wrapMode?this._metrics.wrapWidth&&(k=this._metrics.wrapWidth):
k=Math.max(this._maxLineWidth,k);q=k;if((!a.isIE||9<=a.isIE)&&this._maxLineWidth>m)k+=g.right+g.left;f.style.width=k+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=k+"px");f=this._getScroll(!1)}this._vScrollDiv&&(k=x-8,t=Math.max(15,Math.ceil(Math.min(1,k/(l+g.top+g.bottom))*k)),this._vScrollDiv.style.left=n+m-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*k/l))+"px",this._vScrollDiv.style.height=t+"px");!this._wrapMode&&this._hScrollDiv&&(k=m-8,t=Math.max(15,Math.ceil(Math.min(1,
k/(this._maxLineWidth+g.left+g.right))*k)),this._hScrollDiv.style.left=n+Math.floor(Math.max(0,Math.floor(f.x*k/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=x-9+"px",this._hScrollDiv.style.width=t+"px");w=f.x;t=this._clipDiv;k=this._overlayDiv;if(r=this._marginDiv)r.style.left=-w+n+this._metrics.marginWidth+g.left+"px",r.style.bottom=("scroll"===d.style.overflowX?s:0)+"px";t?(t.scrollLeft=w,t.scrollTop=0,d=n+g.left,s=g.top,c=m,n=x,w=0,r=-e,0===f.x&&(d-=g.left,c+=g.left,w=g.left),f.x+m===
q&&(c+=g.right),0===f.y&&(s-=g.top,n+=g.top,r+=g.top),f.y+x===l&&(n+=g.bottom),t.style.left=d+"px",t.style.top=s+"px",t.style.right=A-c-d+"px",t.style.bottom=P-n-s+"px",b.style.left=w+"px",b.style.top=r+"px",b.style.width=q+"px",b.style.height=x+e+"px",k&&(k.style.left=b.style.left,k.style.top=b.style.top,k.style.width=b.style.width,k.style.height=b.style.height)):(d=w,s=e,A=w+m,P=e+x,0===d&&(d-=g.left),0===s&&(s-=g.top),A===q&&(A+=g.right),f.y+x===l&&(P+=g.bottom),b.style.clip="rect("+s+"px,"+A+
"px,"+P+"px,"+d+"px)",b.style.left=-w+n+g.left+"px",b.style.width=(this._wrapMode||a.isWebkit?q:m+w)+"px",c||(b.style.top=-e+g.top+"px",b.style.height=x+e+"px"),k&&(k.style.clip=b.style.clip,k.style.left=b.style.left,k.style.width=b.style.width,c||(k.style.top=b.style.top,k.style.height=b.style.height)));this._updateDOMSelection();h&&(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(c,b,d,f){if(c){var g=this._parent.ownerDocument,l=this._getLineHeight(),n=this._getViewPadding();for(c=c.firstChild;c;){var h=c._ruler,q=l,k=h.getOverview();"page"===k&&(q+=this._topIndexY);c.style.top=-q+"px";c.style.height=f+q+"px";c.rulerChanged&&e(h.getRulerStyle(),c);var s,m=c.firstChild;m?(s=m,m=m.nextSibling):(s=a.createElement(g,"div"),s.style.visibility="hidden",c.appendChild(s));var u;if(c.rulerChanged&&
s){q=-1;if(u=h.getWidestAnnotation())e(u.style,s),u.html&&(s.innerHTML=u.html);s.lineIndex=q;s.style.height=l+n.top+"px"}var r;if("page"===k){for(h=h.getAnnotations(b,d+1);m;)q=m.lineIndex,u=m.nextSibling,(!(b<=q&&q<=d)||m.lineChanged)&&c.removeChild(m),m=u;m=c.firstChild.nextSibling;r=g.createDocumentFragment();for(q=b;q<=d;q++)if(!m||m.lineIndex>q){s=a.createElement(g,"div");if(u=h[q])e(u.style,s),u.html&&(s.innerHTML=u.html),s.annotation=u;s.lineIndex=q;s.style.height=this._getLineHeight(q)+"px";
r.appendChild(s)}else r.firstChild&&(c.insertBefore(r,m),r=g.createDocumentFragment()),m&&(m=m.nextSibling);r.firstChild&&c.insertBefore(r,m)}else{u=this._getClientHeight();q=this._model.getLineCount();m=u+n.top+n.bottom-2*this._metrics.scrollWidth;k=l*q<m?l:m/q;if(c.rulerChanged){for(u=c.childNodes.length;1<u;)c.removeChild(c.lastChild),u--;h=h.getAnnotations(0,q);r=g.createDocumentFragment();for(var x in h)q=x>>>0,0>q||(s=a.createElement(g,"div"),u=h[x],e(u.style,s),s.style.position="absolute",
s.style.top=this._metrics.scrollWidth+l+Math.floor(q*k)+"px",u.html&&(s.innerHTML=u.html),s.annotation=u,s.lineIndex=q,r.appendChild(s));c.appendChild(r)}else if(c._oldTrackHeight!==m)for(s=c.firstChild?c.firstChild.nextSibling:null;s;)s.style.top=this._metrics.scrollWidth+l+Math.floor(s.lineIndex*k)+"px",s=s.nextSibling;c._oldTrackHeight=m}c.rulerChanged=!1;c=c.nextSibling}}},_updateStyleSheet:function(){var c="";a.isWebkit&&0<this._metrics.scrollWidth&&(c+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
a.isFirefox&&a.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB&&(c+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(c){var b=this._clientDiv.ownerDocument,d=b.getElementById("_textviewStyle");if(d)d.removeChild(d.firstChild),d.appendChild(b.createTextNode(c));else{d=a.createElement(b,"style");d.id="_textviewStyle";var e=b.getElementsByTagName("head")[0]||b.documentElement;d.appendChild(b.createTextNode(c));e.insertBefore(d,e.firstChild)}}},_updateStyle:function(c){!c&&
a.isIE&&(this._rootDiv.style.lineHeight="normal");var b=this._metrics=this._calculateMetrics();this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=a.isIE?b.lineHeight-(b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();c||(this.redraw(),this._resetLineWidth())}};d.EventTarget.addMixin(w.prototype);return{TextView:w}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(k,m){function h(d){this._model=d;this._projections=[];var b=this;this._listener={onChanged:function(d){b._onChanged(d)},onChanging:function(d){b._onChanging(d)}};d.addEventListener("postChanged",this._listener.onChanged);d.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(d){if(d){var b=this._model,g=this._projections;d._lineIndex=b.getLineAtOffset(d.start);d._lineCount=b.getLineAtOffset(d.end)-d._lineIndex;var a=d.text;a||(a="");d._model="string"===typeof a?new k.TextModel(a,b.getLineDelimiter()):a;var b=this.mapOffset(d.start,!0),a=d.end-d.start,e=d._lineCount,f=d._model.getCharCount(),l=d._model.getLineCount()-1,c={type:"Changing",text:d._model.getText(),
start:b,removedCharCount:a,addedCharCount:f,removedLineCount:e,addedLineCount:l};this.onChanging(c);c=this._binarySearch(g,d.start);g.splice(c,0,d);this.onChanged({type:"Changed",start:b,removedCharCount:a,addedCharCount:f,removedLineCount:e,addedLineCount:l})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(d,b){var g=this._projections,a=0,e,f;if(b){for(e=0;e<g.length;e++){f=g[e];if(f.start>d)break;if(f.end>d)return-1;a+=
f._model.getCharCount()-(f.end-f.start)}return d+a}for(e=0;e<g.length;e++){f=g[e];if(f.start>d-a)break;var l=f._model.getCharCount();if(f.start+l>d-a)return-1;a+=l-(f.end-f.start)}return d-a},removeProjection:function(d){var b,g=0;for(b=0;b<this._projections.length;b++){var a=this._projections[b];if(a===d){d=a;break}g+=a._model.getCharCount()-(a.end-a.start)}if(b<this._projections.length){var a=this._model,g=d.start+g,e=d.end-d.start,f=d._lineCount,l=d._model.getCharCount(),c=d._model.getLineCount()-
1;d={type:"Changing",text:a.getText(d.start,d.end),start:g,removedCharCount:l,addedCharCount:e,removedLineCount:c,addedLineCount:f};this.onChanging(d);this._projections.splice(b,1);this.onChanged({type:"Changed",start:g,removedCharCount:l,addedCharCount:e,removedLineCount:c,addedLineCount:f})}},_binarySearch:function(d,b){for(var g=d.length,a=-1,e;1<g-a;)e=Math.floor((g+a)/2),b<=d[e].start?g=e:a=e;return g},getCharCount:function(){for(var d=this._model.getCharCount(),b=this._projections,g=0;g<b.length;g++)var a=
b[g],d=d+(a._model.getCharCount()-(a.end-a.start));return d},getLine:function(d,b){if(0>d)return null;var g=this._model,a=this._projections,e=0,f=[],l=0,c,n,h;for(c=0;c<a.length;c++){h=a[c];if(h._lineIndex>=d-e)break;n=h._model.getLineCount()-1;if(h._lineIndex+n>=d-e){l=d-(h._lineIndex+e);if(l<n)return h._model.getLine(l,b);f.push(h._model.getLine(n))}l=h.end;e+=n-h._lineCount}for(l=Math.max(l,g.getLineStart(d-e));c<a.length;c++){h=a[c];if(h._lineIndex>d-e)break;f.push(g.getText(l,h.start));n=h._model.getLineCount()-
1;if(h._lineIndex+n>d-e)return f.push(h._model.getLine(0,b)),f.join("");f.push(h._model.getText());l=h.end;e+=n-h._lineCount}a=g.getLineEnd(d-e,b);l<a&&f.push(g.getText(l,a));return f.join("")},getLineAtOffset:function(d){for(var b=this._model,g=this._projections,a=0,e=0,f=0;f<g.length;f++){var l=g[f];if(l.start>d-a)break;var c=l._model.getCharCount();if(l.start+c>d-a){g=d-(l.start+a);e+=l._model.getLineAtOffset(g);a+=g;break}e+=l._model.getLineCount()-1-l._lineCount;a+=c-(l.end-l.start)}return b.getLineAtOffset(d-
a)+e},getLineCount:function(){for(var d=this._projections,b=this._model.getLineCount(),g=0;g<d.length;g++)var a=d[g],b=b+(a._model.getLineCount()-1-a._lineCount);return b},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(d,b){if(0>d)return-1;for(var g=this._model,a=this._projections,e=0,f=0,l=0;l<a.length;l++){var c=a[l];if(c._lineIndex>d-e)break;var n=c._model.getLineCount()-1;if(c._lineIndex+n>d-e)return c._model.getLineEnd(d-(c._lineIndex+e),b)+c.start+f;f+=
c._model.getCharCount()-(c.end-c.start);e+=n-c._lineCount}return g.getLineEnd(d-e,b)+f},getLineStart:function(d){if(0>d)return-1;for(var b=this._model,g=this._projections,a=0,e=0,f=0;f<g.length;f++){var l=g[f];if(l._lineIndex>=d-a)break;var c=l._model.getLineCount()-1;if(l._lineIndex+c>=d-a)return l._model.getLineStart(d-(l._lineIndex+a))+l.start+e;e+=l._model.getCharCount()-(l.end-l.start);a+=c-l._lineCount}return b.getLineStart(d-a)+e},getText:function(d,b){void 0===d&&(d=0);var g=this._model,a=
this._projections,e=0,f=[],l,c,n;for(l=0;l<a.length;l++){c=a[l];if(c.start>d-e)break;n=c._model.getCharCount();if(c.start+n>d-e){if(void 0!==b&&c.start+n>b-e)return c._model.getText(d-(c.start+e),b-(c.start+e));f.push(c._model.getText(d-(c.start+e)));d=c.end+e+n-(c.end-c.start)}e+=n-(c.end-c.start)}var h=d-e;if(void 0!==b){for(;l<a.length;l++){c=a[l];if(c.start>b-e)break;f.push(g.getText(h,c.start));n=c._model.getCharCount();if(c.start+n>b-e)return f.push(c._model.getText(0,b-(c.start+e))),f.join("");
f.push(c._model.getText());h=c.end;e+=n-(c.end-c.start)}f.push(g.getText(h,b-e))}else{for(;l<a.length;l++)c=a[l],f.push(g.getText(h,c.start)),f.push(c._model.getText()),h=c.end;f.push(g.getText(h))}return f.join("")},_onChanged:function(d){d=this._change;var b=d.baseStart,g=d.baseEnd,a,e,f=this._projections;for(a=0;a<f.length&&!(e=f[a],e.end>b);a++);var l=a;for(a=0;a<f.length&&!(e=f[a],e.start>=g);a++);var c=a,n=this._model,b=d.baseText.length-(g-b);for(a=c;a<f.length;a++)e=f[a],e.start+=b,e.end+=
b,e._lineIndex=n.getLineAtOffset(e.start);e=f.splice(l,c-l);for(a=0;a<e.length;a++)e[a].annotation&&e[a].annotation._expand();this.onChanged({type:"Changed",start:d.start,removedCharCount:d.removedCharCount,addedCharCount:d.addedCharCount,removedLineCount:d.removedLineCount,addedLineCount:d.addedLineCount});this._change=void 0},_onChanging:function(d){var b=!!this._change,g=this._change||{},a=d.start,e=a+d.removedCharCount;g.baseStart=a;g.baseEnd=e;g.baseText=d.text;g.addedLineCount=d.addedLineCount;
if(!b){this._change=g;g.text=d.text;var f=this._projections,l,c,n;d=function(a){for(l=c=0;c<f.length;c++){n=f[c];if(n.start>a)break;if(n.end>a)return-1;l+=n._model.getCharCount()-(n.end-n.start)}return a+l};g.start=d(a);-1===g.start&&(g.text=this._model.getText(n.start,a)+g.text,g.addedLineCount+=this._model.getLineAtOffset(a)-this._model.getLineAtOffset(n.start),g.start=n.start+l);g.end=d(e);-1===g.end&&(g.text+=this._model.getText(e,n.end),g.addedLineCount+=this._model.getLineAtOffset(n.end)-this._model.getLineAtOffset(e),
g.end=n.start+l)}g.addedCharCount=g.text.length;g.removedCharCount=g.end-g.start;g.removedLineCount=this.getLineAtOffset(g.end)-this.getLineAtOffset(g.start);this.onChanging({type:"Changing",text:g.text,start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount})},onChanging:function(d){return this.dispatchEvent(d)},onChanged:function(d){return this.dispatchEvent(d)},setLineDelimiter:function(d){this._model.setLineDelimiter(d)},
setText:function(d,b,g){function a(a){for(f=l=0;l<e.length;l++){c=e[l];if(c.start>a-f)break;var b=c._model.getCharCount();if(c.start+b>a-f)return-1;f+=b-(c.end-c.start)}return a-f}this._change={text:d||"",start:b||0,end:void 0===g?this.getCharCount():g};var e=this._projections,f,l,c,n,h;d=a(this._change.start);-1===d&&(n={projection:c,start:this._change.start-(c.start+f)},d=c.end);b=a(this._change.end);-1===b&&(h={projection:c,end:this._change.end-(c.start+f)},b=c.start);n&&h&&n.projection===h.projection?
c._model.setText(this._change.text,n.start,h.end):(this._model.setText(this._change.text,d,b),n&&(c=n.projection,c._model.setText("",n.start)),h&&(c=h.projection,c._model.setText("",0,h.end),c.start=c.end,c._lineCount=0));this._change=void 0}};m.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,m,h,d,b,g){function a(a){this._view=a;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(a.getOptions("parent").ownerDocument)}a.getTooltip=function(b){b._tooltip||(b._tooltip=new a(b));return b._tooltip};a.prototype={_create:function(a){if(!this._tooltipDiv){var d=
this._tooltipDiv=g.createElement(a,"div");d.tabIndex=0;d.className="textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var l=this._tooltipContents=g.createElement(a,"div");d.appendChild(l);a.body.appendChild(d);var c=this;b.addEventListener(d,"mouseover",function(a){c._hideDelay&&(a=c._getWindow(),c._delayedHideTimeout&&(a.clearTimeout(c._delayedHideTimeout),c._delayedHideTimeout=null),c._hideTimeout&&(a.clearTimeout(c._hideTimeout),c._hideTimeout=null),
c._nextTarget=null)},!1);b.addEventListener(d,"mouseout",function(a){a=a.relatedTarget||a.toElement;!(a===d||c._hasFocus())&&(!a||!b.contains(d,a))&&c._hide()},!1);b.addEventListener(d,"keydown",function(a){27===a.keyCode&&c._hide()},!1);b.addEventListener(a,"mousedown",this._mouseDownHandler=function(a){c.isVisible()&&(b.contains(d,a.target||a.srcElement)||c._hide())},!0);this._view.addEventListener("Destroy",function(){c.destroy()});this._hide()}},_getWindow:function(){var a=this._tooltipDiv.ownerDocument;
return a.defaultView||a.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var a=this._tooltipDiv.parentNode;a&&a.removeChild(this._tooltipDiv);b.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var a=this._tooltipDiv;return!a?!1:b.contains(a,a.ownerDocument.activeElement)},hide:function(a){void 0===a&&(a=this._hideDelay);var b=this._getWindow();this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var d=this;a?d._delayedHideTimeout=b.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},a):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var a=this._tooltipDiv;a&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),a.style.visibility="hidden",a=this._getWindow(),this._showTimeout&&(a.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(a.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(a.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(a.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(a,b,d){if(this.isVisible())this._hasFocus()||(this._nextTarget=a,this.hide(d));else if(this._target=a){var c=
this;a=c._getWindow();c._showTimeout&&(a.clearTimeout(c._showTimeout),c._showTimeout=null);0===b?c.show(!0):c._showTimeout=a.setTimeout(function(){c._showTimeout=null;c.show(!0)},b?b:c._showDelay)}},show:function(a){if(this._target){var b=this._target.getTooltipInfo();if(b){var g=this._tooltipDiv,c=this._tooltipContents;g.style.left=g.style.right=g.style.width=g.style.height=c.style.width=c.style.height="auto";var n=b.contents;n instanceof Array&&(n=this._getAnnotationContents(n));if("string"===typeof n)c.innerHTML=
n;else if(this._isNode(n))c.appendChild(n);else if(n instanceof d.ProjectionTextModel){var h=this._view,k=h.getOptions();k.wrapMode=!1;k.parent=c;var u=k.themeClass;u?((u=u.replace("tooltipTheme",""))&&(u=" "+u),u="tooltipTheme"+u):u="tooltipTheme";k.themeClass=u;k=this._contentsView=new m.TextView(k);k.addEventListener("LineStyle",function(a){h.onLineStyle(a)});k.setModel(n);n=k.computeSize();c.style.width=n.width+"px";c.style.height=n.height+"px";k.resize()}else return;c=g.ownerDocument.documentElement;
"right"===b.anchor?(n=c.clientWidth-b.x,g.style.right=n+"px"):(n=parseInt(this._getNodeStyle(g,"padding-left","0"),10),n+=parseInt(this._getNodeStyle(g,"border-left-width","0"),10),n=b.x-n,g.style.left=n+"px");g.style.maxWidth=c.clientWidth-n-10+"px";n=parseInt(this._getNodeStyle(g,"padding-top","0"),10);n+=parseInt(this._getNodeStyle(g,"border-top-width","0"),10);n=b.y-n;g.style.top=n+"px";g.style.maxHeight=c.clientHeight-n-10+"px";g.style.opacity="1";g.style.visibility="visible";if(a){var r=this,
t=this._getWindow();r._hideTimeout=t.setTimeout(function(){r._hideTimeout=null;var a=parseFloat(r._getNodeStyle(g,"opacity","1"));r._fadeTimeout=t.setInterval(function(){"visible"===g.style.visibility&&0<a?(a-=0.1,g.style.opacity=a):r._hide()},r._fadeDelay/10)},r._autoHideDelay)}}}},_getAnnotationContents:function(a){function f(a,c){var b=v.getLineStart(v.getLineAtOffset(a)),d=v.getLineEnd(v.getLineAtOffset(c),!0);return v.getText(b,d)}function l(a){var c=a.title,d=g.createElement(m,"div");d.className=
"tooltipRow";a.html&&(d.innerHTML=a.html,d.lastChild&&b.addEventListener(d.lastChild,"click",function(c){c=a.start;var b=a.end;t.getBaseModel&&(c=t.mapOffset(c,!0),b=t.mapOffset(b,!0));r.setSelection(c,b,1/3,function(){s._hide()})},!1),d.appendChild(m.createTextNode("\u00a0")));c||(c=f(a.start,a.end));"function"===typeof c&&(c=a.title());if("string"===typeof c){var e=g.createElement(m,"span");e.appendChild(m.createTextNode(c));c=e}d.appendChild(c);return d}for(var c,n=[],h=0;h<a.length;h++)c=a[h],
""!==c.title&&!c.groupAnnotation&&n.push(c);a=n;if(0===a.length)return null;var s=this,m=this._tooltipDiv.ownerDocument,r=this._view,t=r.getModel(),v=t.getBaseModel?t.getBaseModel():t;if(1===a.length){c=a[0];if(void 0!==c.title)return c=l(c),c.firstChild&&((a=c.firstChild.className)&&(a+=" "),c.firstChild.className=a+"single"),c;a=new d.ProjectionTextModel(v);n=v.getLineStart(v.getLineAtOffset(c.start));h=v.getCharCount();c.end!==h&&a.addProjection({start:c.end,end:h});0<n&&a.addProjection({start:0,
end:n});return a}n=g.createElement(m,"div");c=g.createElement(m,"em");c.appendChild(m.createTextNode(k.multipleAnnotations));n.appendChild(c);for(h=0;h<a.length;h++)c=a[h],(c=l(c))&&n.appendChild(c);return n},_getNodeStyle:function(a,b,d){var c;if(a&&(c=a.style[b],!c))if(a.currentStyle){for(c=0;-1!==(c=b.indexOf("-",c));)b=b.substring(0,c)+b.substring(c+1,c+2).toUpperCase()+b.substring(c+2);c=a.currentStyle[b]}else c=(a=a.ownerDocument.defaultView.getComputedStyle(a,null))?a.getPropertyValue(b):null;
return c||d},_isNode:function(a){return"object"===typeof Node?a instanceof Node:a&&"object"===typeof a&&"number"===typeof a.nodeType&&"string"===typeof a.nodeName}};return{Tooltip:a}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(k,m){function h(){}function d(a,b,d){this.start=a;this.end=b;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function b(a,b){var d=a.lastIndexOf("."),d=a.substring(d+1),e={title:k[d],style:{styleClass:"annotation "+d},html:"\x3cdiv class\x3d'annotationHTML "+d+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+d}};b?e.lineStyle=
{styleClass:"annotationLine "+d}:e.rangeStyle={styleClass:"annotationRange "+d};h.registerType(a,e)}function g(){}function a(a,b){for(var d=a.length,e=-1,f;1<d-e;)f=Math.floor((d+e)/2),b<=a[f].start?d=f:e=f;return d}function e(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function f(a,b){this._view=a;this._annotationModel=b;var d=this;this._listener={onDestroy:function(a){d._onDestroy(a)},onLineStyle:function(a){d._onLineStyle(a)},
onChanged:function(a){d._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}d.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 d=b.next();d!==this&&d.type===h.ANNOTATION_FOLDING&&a.call(this,d)}},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 l={};h.registerType=function(a,b){var d=b;"function"!==typeof d&&(d=function(a,c,b){this.start=a;this.end=c;void 0!==b&&(this.title=b)},d.prototype=b);d.prototype.type=a;l[a]=d;return a};h.createAnnotation=function(a,b,d,e){return new (this.getType(a))(b,d,e)};h.getType=
function(a){return l[a]};b(h.ANNOTATION_ERROR);b(h.ANNOTATION_WARNING);b(h.ANNOTATION_TASK);b(h.ANNOTATION_BREAKPOINT);b(h.ANNOTATION_BOOKMARK);b(h.ANNOTATION_CURRENT_BRACKET);b(h.ANNOTATION_MATCHING_BRACKET);b(h.ANNOTATION_CURRENT_SEARCH);b(h.ANNOTATION_MATCHING_SEARCH);b(h.ANNOTATION_READ_OCCURRENCE);b(h.ANNOTATION_WRITE_OCCURRENCE);b(h.ANNOTATION_SELECTED_LINKED_GROUP);b(h.ANNOTATION_CURRENT_LINKED_GROUP);b(h.ANNOTATION_LINKED_GROUP);b(h.ANNOTATION_CURRENT_LINE,!0);b(h.ANNOTATION_BLAME,!0);b(h.ANNOTATION_CURRENT_BLAME,
!0);h.registerType(h.ANNOTATION_FOLDING,d);g.addMixin=function(a){var b=g.prototype,d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d])};g.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var d=b-1;void 0==b||!(0<=d&&d<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(d,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,d){a=a.getAnnotations(b,d);for(d=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&d.push(b);var e=this;d.sort(function(a,c){return e.getAnnotationTypePriority(a.type)-e.getAnnotationTypePriority(c.type)});return d},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}}};e.prototype={addAnnotation:function(c){if(c){var b=this._annotations,d=a(b,c.start);b.splice(d,0,c);c._annotationModel=this;this.onChanged({type:"Changed",added:[c],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var d=this._annotations,e,f=0,g;g=void 0===a&&void 0===b?function(){return f<d.length?d[f++]:null}:function(){for(;f<d.length;){var e=d[f++];if(a===e.start||(a>e.start?a<e.end:e.start<b))return e;if(e.start>=b)break}return null};
e=g();return{next:function(){var a=e;a&&(e=g());return a},hasNext:function(){return null!==e}}},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,d,e;if(a){d=[];for(e=b.length-1;0<=e;e--){var f=b[e];f.type===a&&(b.splice(e,1),d.splice(0,0,f),f._annotationModel=null)}}else d=b;this.onChanged({type:"Changed",removed:d,
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(c,b){var d=this._annotations,e,f,g,l=[];if(c)for(e=c.length-1;0<=e;e--)g=c[e],f=this._getAnnotationIndex(g),0>f||(g._annotationModel=null,d.splice(f,1),l.splice(0,0,g));b||(b=[]);for(e=0;e<b.length;e++)g=b[e],f=a(d,g.start),g._annotationModel=this,d.splice(f,
0,g);this.onChanged({type:"Changed",removed:l,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(c){for(var b=this._annotations,d=a(b,c.start);d<b.length&&b[d].start===c.start;){if(b[d]===c)return d;d++}return-1},_onChanged:function(a){var b=a.start,d=a.addedCharCount,e=a.removedCharCount,f=this._annotations,g=
b+e;if(0<f.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};d-=e;for(e=0;e<f.length;e++){var l=f[e];l.start>=g?(l._oldStart=l.start,l._oldEnd=l.end,l.start+=d,l.end+=d,a.changed.push(l)):l.end<=b||(l.start<b&&g<l.end?(l._oldStart=l.start,l._oldEnd=l.end,l.end+=d,a.changed.push(l)):(f.splice(e,1),a.removed.push(l),l._annotationModel=null,l.expand&&l.expand(),e--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};m.EventTarget.addMixin(e.prototype);
f.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 d;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(d in a.style||
(a.style={}),b.style)a.style[d]||(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)a.attributes[d]||(a.attributes[d]=b.attributes[d])}return a},_mergeStyleRanges:function(c,b){c||(c=[]);for(var d,e=a(c,b.start);e<c.length&&b;e++){var f=c[e];if(b.end<=f.start)break;if(!(b.start>=f.end)){d=this._mergeStyle({},f.style);d=this._mergeStyle(d,b.style);var g=[];g.push(e,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:d});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(c,g)}}b&&(d=this._mergeStyle({},b.style),c.splice(e,0,{start:b.start,end:b.end,style:d}));return c},_onAnnotationModelChanged:function(a){function b(a,c){g.getBaseModel&&(a=g.mapOffset(a,!0),c=g.mapOffset(c,!0));-1!==a&&-1!==c&&e.redrawRange(a,c)}function d(a,
c){for(var e=0;e<a.length;e++)if(f.isAnnotationTypeVisible(a[e].type)){var g=a[e];b(g.start,g.end);c&&void 0!==g._oldStart&&g._oldEnd&&b(g._oldStart,g._oldEnd)}}var e=this._view;if(e){var f=this,g=e.getModel();d(a.added);d(a.removed);d(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,d=a.textView.getModel(),e=b.getTextModel(),f=a.lineStart,g=a.lineStart+a.lineText.length;e!==d&&(f=d.mapOffset(f),g=d.mapOffset(g));for(b=b.getAnnotations(f,
g);b.hasNext();)if(f=b.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var g=f.start,l=f.end;e!==d&&(g=d.mapOffset(g,!0),l=d.mapOffset(l,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:g,end:l,style:f.rangeStyle})}f.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,f.lineStyle))}}};g.addMixin(f.prototype);return{FoldingAnnotation:d,AnnotationType:h,AnnotationTypeList:g,AnnotationModel:e,AnnotationStyler:f}});
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,m,h,d,b,g){function a(a){a=a||{};this._domNode=a.domNode;this._model=a.model;this._undoStack=a.undoStack;this._statusReporter=a.statusReporter;this._title=null;var c=this;this._listener={onChanged:function(a){c.onChanged(a)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function e(b){b=b||{};a.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 f=d.AnnotationType;a.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(a,c){return this.getModel().getText(a,c)},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(a){return this.dispatchEvent(a)},onInputChanged:function(a){return this.dispatchEvent(a)},onChanged:function(a){this.checkDirty()},reportStatus:function(a,c,b){this._statusReporter&&this._statusReporter(a,c,b)},resize:function(){},setDirty:function(a){this._dirty!==a&&(this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(a){this._model&&this._model.setText(a)},setInput:function(a,c,b,d){this._title=a;d||(c?this.reportStatus(c,"error"):null!==b&&void 0!==b&&"string"===typeof b&&this._setModelText(b),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:a,message:c,contents:b,contentsSaved:d})},setText:function(a,c,b){this.getModel().setText(a,c,b)},uninstall:function(){this.installed=!1}};m.EventTarget.addMixin(a.prototype);e.prototype=new a;
b.mixin(e.prototype,{destroy:function(){a.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 a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},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(a,c){if(this._annotationRulerVisible!==a||c)if(this._annotationRulerVisible=a,this._annotationRuler){var b=this._textView;a?b.addRuler(this._annotationRuler,0):b.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a,c){if(this._foldingRulerVisible!==a||c)if(this._foldingRulerVisible=
a,this._foldingRuler){var b=this._textView;b.getModel().getBaseModel&&(a?b.addRuler(this._foldingRuler):b.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(a,c){if(this._lineNumberRulerVisible!==a||c)if(this._lineNumberRulerVisible=a,this._lineNumberRuler){var b=this._textView;a?b.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):b.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a,c){if(this._overviewRulerVisible!==a||c)if(this._overviewRulerVisible=
a,this._overviewRuler){var b=this._textView;a?b.addRuler(this._overviewRuler):b.removeRuler(this._overviewRuler)}},mapOffset:function(a,c){var b=this._textView.getModel();b.getBaseModel&&(a=b.mapOffset(a,c));return a},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(this.mapOffset(a))},getLineStart:function(a){return this.getModel().getLineStart(a)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,c=a.getSelection(),
a=a.getModel();a.getBaseModel&&(c.start=a.mapOffset(c.start),c.end=a.mapOffset(c.end));return c},_expandOffset:function(a){var c=this._textView.getModel(),b=this._annotationModel;if(b&&c.getBaseModel)for(a=b.getAnnotations(a,a+1);a.hasNext();)c=a.next(),c.type===f.ANNOTATION_FOLDING&&c.expand&&c.expand()},setCaretOffset:function(a,c,b){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(a),a=e.mapOffset(a,!0));d.setCaretOffset(a,c,b)},setText:function(a,c,b){var d=this._textView,
e=d.getModel();e.getBaseModel&&(void 0!==c&&(this._expandOffset(c),c=e.mapOffset(c,!0)),void 0!==b&&(this._expandOffset(b),b=e.mapOffset(b,!0)));d.setText(a,c,b)},setSelection:function(a,c,b,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(a),this._expandOffset(c),a=f.mapOffset(a,!0),c=f.mapOffset(c,!0));e.setSelection(a,c,b,d)},moveSelection:function(a,c,b,d){var e=this._textView;this.setSelection(a,c||a,1/3,function(){(void 0===d||d)&&e.focus();b&&b()})},_getTooltipInfo:function(a,
c){var b=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;if(!e)return null;var f=b.getOffsetAtLocation(a,c);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;b=b.convert({x:a,y:c},"document","page");return{contents:d,anchor:"left",x:b.x+10,y:b.y+20}},_highlightCurrentLine:function(a,c){var b=this._annotationModel;if(b){var d=this._textView;if(!d.getOptions("singleMode")){var e=
d.getModel(),g=c?e.getLineAtOffset(c.start):-1,h=e.getLineAtOffset(a.start),d=a.start===a.end,k=!c||c.start===c.end,m=e.getLineStart(h),w=e.getLineEnd(h);e.getBaseModel&&(m=e.mapOffset(m),w=e.mapOffset(w));e=this._currentLineAnnotation;if(!(g===h&&k&&d&&e&&e.start===m&&e.end===w)){var g=e?[e]:null,A;d&&(e=f.createAnnotation(f.ANNOTATION_CURRENT_LINE,m,w),A=[e]);this._currentLineAnnotation=e;b.replaceAnnotations(g,A)}}}},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 b=this,c=this._textView,d=this;this._listener={onModelChanged:function(a){d.checkDirty()},onMouseOver:function(a){d._listener.onMouseMove(a)},onMouseMove:function(a){var b=
h.Tooltip.getTooltip(c);b&&!(d._listener.lastMouseX===a.event.clientX&&d._listener.lastMouseY===a.event.clientY)&&(d._listener.lastMouseX=a.event.clientX,d._listener.lastMouseY=a.event.clientY,b.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return d._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(a){var b=h.Tooltip.getTooltip(c);b&&!(d._listener.lastMouseX===a.event.clientX&&d._listener.lastMouseY===a.event.clientY)&&(d._listener.lastMouseX=a.event.clientX,d._listener.lastMouseY=a.event.clientY,
b.setTarget(null))},onScroll:function(a){(a=h.Tooltip.getTooltip(c))&&a.setTarget(null,0,0)},onSelection:function(a){d._updateCursorStatus();d._highlightCurrentLine(a.newValue,a.oldValue)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Selection",this._listener.onSelection);c.addEventListener("MouseOver",this._listener.onMouseOver);c.addEventListener("MouseOut",this._listener.onMouseOut);c.addEventListener("MouseMove",this._listener.onMouseMove);c.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var e;if(e="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(b,this._undoStack,this._contentAssist))this._textActions=e.textActions,this._linkedMode=e.linkedMode,this._sourceCodeActions=e.sourceCodeActions}e=function(a,c){if(void 0!==a&&-1!==a){for(var d=this.getView().getModel(),e=this.getAnnotationModel(),g=b.mapOffset(d.getLineStart(a)),
d=b.mapOffset(d.getLineEnd(a)),h=e.getAnnotations(g,d),n=null;h.hasNext();){var k=h.next();if(k.type===f.ANNOTATION_BOOKMARK){n=k;break}}n?e.removeAnnotation(n):(n=f.createAnnotation(f.ANNOTATION_BOOKMARK,g,d),n.title=void 0,e.addAnnotation(n))}};if(this._annotationFactory){var g=c.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(c,this._annotationModel))g.addAnnotationType(f.ANNOTATION_CURRENT_SEARCH),
g.addAnnotationType(f.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(f.ANNOTATION_ERROR),g.addAnnotationType(f.ANNOTATION_WARNING),g.addAnnotationType(f.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(f.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(f.ANNOTATION_CURRENT_LINE),g.addAnnotationType(f.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(f.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(f.ANNOTATION_SELECTED_LINKED_GROUP),g.addAnnotationType(f.ANNOTATION_CURRENT_LINKED_GROUP),g.addAnnotationType(f.ANNOTATION_LINKED_GROUP),
g.addAnnotationType("orion.annotation.highlightError");var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),k=this._annotationRuler=g.annotationRuler;k&&(k.onDblClick=e,k.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),k.addAnnotationType(f.ANNOTATION_ERROR),k.addAnnotationType(f.ANNOTATION_WARNING),k.addAnnotationType(f.ANNOTATION_TASK),k.addAnnotationType(f.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(k=this._overviewRuler=g.overviewRuler)k.addAnnotationType(f.ANNOTATION_CURRENT_SEARCH),k.addAnnotationType(f.ANNOTATION_MATCHING_SEARCH),k.addAnnotationType(f.ANNOTATION_READ_OCCURRENCE),k.addAnnotationType(f.ANNOTATION_WRITE_OCCURRENCE),k.addAnnotationType(f.ANNOTATION_CURRENT_BLAME),k.addAnnotationType(f.ANNOTATION_ERROR),k.addAnnotationType(f.ANNOTATION_WARNING),k.addAnnotationType(f.ANNOTATION_TASK),k.addAnnotationType(f.ANNOTATION_BOOKMARK),k.addAnnotationType(f.ANNOTATION_MATCHING_BRACKET),
k.addAnnotationType(f.ANNOTATION_CURRENT_BRACKET),k.addAnnotationType(f.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(f.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(f.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=e,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(f.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:c});a.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}),a.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var a=
this.getModel(),c=this.getCaretOffset(),b=a.getLineAtOffset(c),a=a.getLineStart(b),c=c-a,a=this.getKeyModes(),d=0;d<a.length;d++){var e=a[d];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(g.formatMessage(k.lineColumn,b+1,c+1))},showAnnotations:function(a,c,b,d){var e=this._annotationModel;if(e){for(var g=[],h=[],k=e.getTextModel(),m=e.getAnnotations(),w;m.hasNext();)w=m.next(),-1!==c.indexOf(w.type)&&w.creatorID===this&&g.push(w);if(a)for(c=0;c<a.length;c++)if(w=a[c]){if(b)w=
b(w);else{var A;"number"===typeof w.line?(A=k.getLineStart(w.line-1),m=A+w.start-1,A=A+w.end-1):(m=w.start,A=w.end);var x=d(w);if(!x)continue;w=f.createAnnotation(x,m,A,w.description)}w.creatorID=this;h.push(w)}e.replaceAnnotations(g,h)}},showProblems:function(a){this.showAnnotations(a,[f.ANNOTATION_ERROR,f.ANNOTATION_WARNING,f.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return f.ANNOTATION_ERROR;case "warning":return f.ANNOTATION_WARNING;case "task":return f.ANNOTATION_TASK}return null})},
showOccurrences:function(a){this.showAnnotations(a,[f.ANNOTATION_READ_OCCURRENCE,f.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?f.ANNOTATION_READ_OCCURRENCE:f.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(a){var c=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!c){var h=g.createElement(e,"div");h.className="annotation blame";e.body.appendChild(h);var m=(e.defaultView||e.parentWindow).getComputedStyle(h).getPropertyValue("background-color");h.parentNode.removeChild(h);
var h=m.indexOf("("),u=m.indexOf(")"),m=m.substring(h+1,u);this._blameRGB=c=m.split(",").slice(0,3)}var r=function(){var a=d.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=b.mixin({},a.style);a.style.style=b.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},t=function(){var a=g.createElement(e,"div");a.className="tooltipTitle";var c=this.blame.Message.indexOf("\n");
-1===c&&(c=this.blame.Message.length);var b=g.createElement(e,"a");b.href=this.blame.CommitLink;b.appendChild(e.createTextNode(this.blame.Message.substring(0,c)));a.appendChild(b);a.appendChild(g.createElement(e,"br"));a.appendChild(e.createTextNode(g.formatMessage(k.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},v=this.getModel();this.showAnnotations(a,[f.ANNOTATION_BLAME,f.ANNOTATION_CURRENT_BLAME],function(a){var e=v.getLineStart(a.Start-1),g=v.getLineEnd(a.End-1,!0),e=d.AnnotationType.createAnnotation(f.ANNOTATION_BLAME,
e,g,t),g=c.slice(0);g.push(a.Shade);e.style=b.mixin({},e.style);e.style.style=b.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+g.join()+")";e.groupId=a.Name;e.groupType=f.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=r;e.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+a.AuthorImage+'"/\x3e';e.blame=a;return e})},showSelection:function(a,c,b,d,e){"number"===typeof a?("number"!==typeof c&&(c=a),this.moveSelection(a,c)):"number"===typeof b&&(a=this.getModel().getLineStart(b-
1),"number"===typeof d&&(a+=d),"number"!==typeof e&&(e=0),this.moveSelection(a,a+e))},_setModelText:function(a){this._textView&&(this._textView.setText(a),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(b,c,d,e,f){a.prototype.setInput.call(this,b,c,d,e);this._textView&&!e&&!f&&this._textView.focus()},onGotoLine:function(a,c,b,d){if(this._textView){var e=this.getModel();a=Math.max(0,Math.min(a,e.getLineCount()-1));var f=
e.getLineStart(a),g=0;void 0===b&&(b=0);"string"===typeof c?(a=e.getLine(a).indexOf(c),-1!==a&&(g=a,b=g+c.length)):(g=c,c=e.getLineEnd(a)-f,g=Math.min(g,c),b=Math.min(b,c));this.moveSelection(f+g,f+b,d)}}});return{BaseEditor:a,Editor:e}});
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,m,h,d,b,g,a){function e(a){var d=a.getTextView();h.KeyMode.call(this,d);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";d.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));d.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var e=this;this._listener={onVerify:function(a){var c=e.editor,d=c.getModel(),f=c.mapOffset(a.start),c=c.mapOffset(a.end),d=d.getText(f,c);if((d=e._prefix.match(RegExp("^"+b.escape(d),"i")))&&0<d.length)e._prefix+=a.text,e._success=!0,e._status(),e.find(e._forward,!0),a.text=null},onSelection:function(){e._ignoreSelection||e.setActive(!1)}}}function f(a,b,d){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 e=this;this._listeners={onEditorFocus:function(a){e._removeCurrentAnnotation(a)}};this.setOptions(d)}}var l={};e.prototype=new h.KeyMode;g.mixin(e.prototype,{createKeyBindings:function(){var a=m.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 d=this._prefix;if(0===d.length)return!1;var e=this.editor,f=e.getModel(),f=a?this._success?b?this._start:e.getCaretOffset()+
1:0:this._success?b?this._start:e.getCaretOffset():f.getCharCount()-1;(d=e.getModel().find({string:d,start:f,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next())?(b||(this._start=f),this._ignoreSelection=this._success=!0,e.moveSelection(a?d.start:d.end,a?d.end:d.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 c;c=this._forward?this._success?k.incrementalFindStr:k.incrementalFindStrNotFound:this._success?k.incrementalFindReverseStr:k.incrementalFindReverseStrNotFound;c=a.formatMessage(c,this._prefix);this.editor.reportStatus(c,this._success?"":"error")}else this.editor.reportStatus("")}});
l.IncrementalFind=e;f.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var e=this.getFindString(),f;b&&(e=b.findString||e,f=b.count);a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((f=this._doFind(e,b,f))&&!d)this._startOffset=f.start;this.setOptions(a);this._hideAfterFind&&this.hide();return f},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=b.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="",d=!1,e=this._editor.getModel().getLineDelimiter(),f=0;f<a.length;f++){var g=a.substring(f,f+1);if(d){switch(g){case "R":b+=e;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+g}d=!1}else"\\"===g?d=!0:b+=g}d&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this._processReplaceString(this.getReplaceString()),e=b.getSelection().start;if(b=b.getModel().find({string:a,start:e,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var c=this.getFindString();if(c){this._replacingAll=!0;var b=this._editor,d=b.getTextView();b.reportStatus(k.replaceAll);var e=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var g=0,h=0;;){var l=f._doFind(c,g,null,!0);if(!l)break;h++;1===h&&(d.setRedraw(!1),f.startUndo());f._doReplace(l.start,l.end,c,e);g=f.getStartOffset()}0<
h&&(f.endUndo(),d.setRedraw(!0));0<g?b.reportStatus(a.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(d.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,d){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:d?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,e,f){e=e||1;var g=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var h,l;if(this._regex)try{l=this._find(a,b,f)}catch(m){g.reportStatus(m.message,
"error");return}else l=this._find(a,b,f);for(a=0;a<e&&l.hasNext();a++)h=l.next();if(!this._replacingAll){h?this._editor.reportStatus(""):this._editor.reportStatus(k.notFound,"error");if(this.isVisible()){e=d.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(l=g.getAnnotationModel())l.removeAnnotations(e),h&&l.addAnnotation(d.AnnotationType.createAnnotation(e,h.start,h.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var w=this;this._timer=window.setTimeout(function(){w._markAllOccurrences();
w._timer=null},500)}}this._findCallback?this._findCallback(h):h&&g.moveSelection(h.start,h.end,null,!1)}return h},_doReplace:function(a,b,d,e){var f=this._editor;if(!this._regex||!(e=f.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),e),!e))f.setText(e,a,b),f.setSelection(a,a+e.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=d.AnnotationType.ANNOTATION_MATCHING_SEARCH,e=a.getAnnotations(),f=[],g;e.hasNext();){var h=e.next();h.type===b&&
f.push(h)}if(this.isVisible()){e=this.getFindString();e=this._editor.getModel().find({string:e,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(g=[];e.hasNext();)h=e.next(),g.push(d.AnnotationType.createAnnotation(b,h.start,h.end))}a.replaceAnnotations(f,g)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(d.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(d.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(a){(a=this._editor.getAnnotationModel())&&a.removeAnnotations(d.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};l.Find=f;return l});
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,m,h,d,b,g){function a(a,d,e){this.editor=a;this.undoStack=d;this._incrementalFind=new b.IncrementalFind(a);this._find=e?e:new b.Find(a,d);this._lastEditLocation=null;this.init()}function e(a,b,d,e){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=e;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var f=h.AnnotationType,l={};a.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 c=1;for(a&&a.count&&(c=a.count);0<c;)this.undoStack.undo(),--c;return!0}return!1}.bind(this),
{name:k.undo});a.setAction("redo",function(a){if(this.undoStack){var c=1;for(a&&a.count&&(c=a.count);0<c;)this.undoStack.redo(),--c;return!0}return!1}.bind(this),{name:k.redo});a.setKeyBinding(new m.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 m.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 m.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 m.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:k.incrementalFind});a.setKeyBinding(new m.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 m.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:k.moveLinesUp});a.setKeyBinding(new m.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:k.moveLinesDown});a.setKeyBinding(new m.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:k.copyLinesUp});a.setKeyBinding(new m.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:k.copyLinesDown});a.setKeyBinding(new m.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:k.deleteLines});a.setKeyBinding(new m.KeyBinding("l",!g.isMac,!1,!1,g.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:k.gotoLine});a.setKeyBinding(new m.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:k.nextAnnotation});a.setKeyBinding(new m.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:k.prevAnnotation});a.setKeyBinding(new m.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:k.expand});a.setKeyBinding(new m.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:k.collapse});a.setKeyBinding(new m.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:k.expandAll});a.setKeyBinding(new m.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:k.collapseAll});a.setKeyBinding(new m.KeyBinding("q",!g.isMac,!1,!1,g.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(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineStart(e),e=b.getLineEnd(d,!0),g=b.getLineCount(),h="",f=b.getText(f,e);d===g-1&&(f=(h=b.getLineDelimiter())+f);a.setText(f,e,e);a.setSelection(e+h.length,e+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),e=b.getLineStart(e),f=b.getLineEnd(d,!0),g=b.getLineCount(),h="",f=b.getText(e,f);d===g-1&&(f+=h=b.getLineDelimiter());a.setText(f,e,e);a.setSelection(e,e+f.length-h.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var e=b.getSelection(),f=b.getModel(),g=f.getLineAtOffset(e.start);a=f.getLineStart(g);d=e.start!==e.end||1===d?f.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(g+d-1,f.getLineCount()-
1);d=f.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var e=b.getModel(),f=b.getCaretOffset(),g=e.getLineAtOffset(f),f=e.getLineStart(g),g=e.getLineEnd(g,!0);e.getBaseModel&&(f=e.mapOffset(f),g=e.mapOffset(g),e.getBaseModel());for(var l,d=d.getAnnotations(f,g);!l&&d.hasNext();)e=d.next(),e.type===h.AnnotationType.ANNOTATION_FOLDING&&(l=e);l&&a!==l.expanded&&(a?l.expand():(b.setCaretOffset(l.start),l.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var e=b.getAnnotations();for(d.setRedraw(!1);e.hasNext();)b=e.next(),b.type===h.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end>
e.start?e.end-1:e.end);if(f!==g){var h=[];h.push("");for(var l=f;l<=g;l++)h.push(d.getLine(l,!0));l=d.getLineStart(f);d=d.getLineEnd(g,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(h.join(b),l,d);a.setSelection(l===e.start?e.start:e.start+b.length,e.end+(g-f+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(),d=a.getSelection(),e=b.getLineAtOffset(d.start),f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=b.getLineCount();if(f===g-1)return!0;var e=b.getLineStart(e),d=b.getLineEnd(f,!0),h=b.getLineEnd(f+1,!0)-(d-e),l=0;f!==g-2?b=b.getText(e,d):(f=b.getLineEnd(f),
b=b.getText(f,d)+b.getText(e,f),l+=d-f);this.startUndo();a.setText("",e,d);a.setText(b,h,h);a.setSelection(h+l,h+l+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start);if(0===e)return!0;var f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=b.getLineCount(),d=b.getLineStart(e-1),h=b.getLineStart(e),l=b.getLineEnd(f,!0),k=b.getText(h,l),m=0;f===g-1&&(f=b.getLineEnd(e-
1),e=b.getLineEnd(e-1,!0),k+=b.getText(f,e),h=f,m=e-f);this.startUndo();a.setText("",h,l);a.setText(k,d,d);a.setSelection(d,d+k.length-m);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===f.ANNOTATION_MATCHING_BRACKET||a.type===f.ANNOTATION_CURRENT_BRACKET||!h.isAnnotationTypeVisible(a.type)}var e=this.editor,g=e.getAnnotationModel();if(!g)return!0;var h=e.getOverviewRuler()||e.getAnnotationStyler();if(!h)return!0;for(var l=e.getModel(),k=e.getCaretOffset(),
m=g.getAnnotations(a?k:0,a?l.getCharCount():k),w=null;m.hasNext();){var A=m.next();if(a){if(A.start<=k)continue}else if(A.start>=k)continue;if(!b(A)&&(w=A,a))break}if(w){for(var x=[w],m=g.getAnnotations(w.start,w.start);m.hasNext();)A=m.next(),A!==w&&!b(A)&&x.push(A);var z=e.getTextView(),p=l.getLineAtOffset(w.start),y=d.Tooltip.getTooltip(z);if(!y)return e.moveSelection(w.start),!0;e.moveSelection(w.start,w.start,function(){y.setTarget({getTooltipInfo:function(){var a=z.convert({x:z.getLocationAtOffset(w.start).x,
y:z.getLocationAtOffset(l.getLineStart(p)).y},"document","page");return{contents:x,x:a.x,y:a.y+Math.floor(1.33*z.getLineHeight(p))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),h=b.getOptions("tabSize"),l=Array(h+1).join(" "),k=[],m=b=0,x=f;x<=g;x++){var z=d.getLine(x,!0);if(d.getLineStart(x)!==
d.getLineEnd(x))if(0===z.indexOf("\t"))z=z.substring(1),b++;else if(0===z.indexOf(l))z=z.substring(h),b+=h;else return!0;x===f&&(m=b);k.push(z)}f=d.getLineStart(f);h=d.getLineEnd(g,!0);d=d.getLineStart(g);a.setText(k.join(""),f,h);g=f===e.start?e.start:e.start-m;e=Math.max(g,e.end-b+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(g,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};l.TextActions=
a;e.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 m.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:k.trimTrailingWhitespaces});a.setKeyBinding(new m.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:k.toggleLineComment});a.setKeyBinding(new m.KeyBinding(191,!0,!g.isMac,!1,g.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:k.addBlockComment});a.setKeyBinding(new m.KeyBinding(220,!0,!g.isMac,!1,g.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:k.removeBlockComment});a.setKeyBinding(new m.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new m.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new m.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new m.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new m.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new m.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new m.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new m.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new m.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new m.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 d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(),f=e.getLineAtOffset(d.start),
g=e.getLine(f,!1),h=e.getLineStart(f),l=0,k=d.start-h,m;l<k&&(32===(m=g.charCodeAt(l))||9===m);)l++;var h=g.substring(0,l),b=b.getOptions("tabSize","expandTab"),x=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=e.getLineDelimiter(),z=/^[\s]*\/\*[\*]*[\s]*$/,p=/^[\s]*\*/,y=/\*\/[\s]*$/,B=g.substring(0,k),C=g.substring(k),I;if(this.smartIndentation&&123===g.charCodeAt(I=B.trimRight().length-1))return e=k-I-1,C=C.length-C.trimLeft().length,g=125===g.charCodeAt(k+C)?b+h+x+b+h:b+h+x,a.setText(g,d.start-
e,d.end+C),a.setCaretOffset(d.start+b.length+h.length+x.length-e),!0;if(this.autoCompleteComments&&!y.test(B)&&(z.test(B)||p.test(B))){if(z.exec(B)){g=b+h+" * ";g=y.test(C)?g+C.substring(0,C.length-2).trim():g+C.trim();if(e.getLineCount()===f+1||!p.test(e.getLine(f+1)))g+=b+h+" */";a.setText(g,d.start,d.end+C.length);a.setCaretOffset(d.start+b.length+h.length+3);return!0}if(p.exec(B))for(f-=1;0<=f;f--){l=e.getLine(f,!1);if(z.test(l))return y.test(C)||47===g.charCodeAt(k)?(g=b+h+"*"+C,h=d.start+b.length+
h.length+1):(g=b+h+"* "+C,h=d.start+b.length+h.length+2),a.setText(g,d.start,d.end+C.length),a.setCaretOffset(h),!0;if(!p.test(l))break}}else{if(y.test(B)&&32===h.charCodeAt(h.length-1))return g=b+h.substring(0,h.length-1),a.setText(g,d.start,d.end),a.setCaretOffset(d.start+g.length),!0;if(0<l){for(l=k;l<g.length&&(32===(m=g.charCodeAt(l++))||9===m);)d.end++;a.setText(e.getLineDelimiter()+h,d.start,d.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=this._findEnclosingComment(b,d.start,d.end);if(void 0!==e.commentStart&&void 0!==e.commentEnd)return!0;b=b.getText(d.start,d.end);if(0===b.length)return!0;var e=b.length,b=b.replace(/\/\*|\*\//g,""),f=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(f-e));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var e=d.getSelection(),f=d.getModel(),g=d.getCaretOffset()===f.getCharCount()?"":f.getText(e.start,e.start+1).trim(),h=/^$|[)}\]>]/;return e.start===e.end&&h.test(g)?(d.setText(a+b,e.start,e.start),d.setCaretOffset(e.start+1),!0):e.start!==e.end?(f=f.getText(e.start,e.end),d.setText(a+f+b,e.start,e.end),d.setSelection(e.start+1,e.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel(),f=b.getCaretOffset(),g=0===f?"":e.getText(d.start-1,d.start).trim(),h=f===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),f=/^"$|^'$/,l=/\w/,k=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(f.test(e))return!1;b.setText(a+e+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else{if(h!==a){if(g===a||f.test(h)||l.test(g)||!k.test(h))return!1;b.setText(a+a,d.start,d.start)}b.setCaretOffset(d.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].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 d=a.getModel(),e=a.getCaretOffset(),f=0===e?"":d.getText(b.start-1,b.start),d=e===d.getCharCount()?"":d.getText(b.start,b.start+1);("("===f&&")"===d||"["===f&&"]"===d||"{"===f&&"}"===d||"\x3c"===f&&"\x3e"===d||'"'===f&&'"'===d||"'"===f&&"'"===d)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,d){var e=a.getLineAtOffset(b),
f=a.getLineAtOffset(d),g,h,l,k,m,x;for(g=e;0<=g&&!(h=a.getLine(g),l=g===e?b-a.getLineStart(e):h.length,k=h.lastIndexOf("/*",l),h=h.lastIndexOf("*/",l),h>k);g--)if(-1!==k){m=a.getLineStart(g)+k;break}for(g=f;g<a.getLineCount()&&!(h=a.getLine(g),l=g===f?d-a.getLineStart(f):0,k=h.indexOf("/*",l),h=h.indexOf("*/",l),-1!==k&&k<h);g++)if(-1!==h){x=a.getLineStart(g)+h;break}return{commentStart:m,commentEnd:x}},lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),e=b.getLineAtOffset(d),
f=b.getLineStart(e),b=b.getLine(e),e=0;e<b.length;e++){var g=b.charCodeAt(e);if(!(32===g||9===g))break}e+=f;return d!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getText(d.start,d.end),f,g,h;for(h=0;h<e.length;h++)if("/*"===e.substring(h,h+2)){f=d.start+h;break}for(;h<e.length;h++)if("*/"===e.substring(h,h+2)){g=d.start+h;break}if(void 0!==f&&void 0!==g)a.setText(b.getText(f+
2,g),f,g+2),a.setSelection(f,g);else{e=this._findEnclosingComment(b,d.start,d.end);if(void 0===e.commentStart||void 0===e.commentEnd)return!0;b=b.getText(e.commentStart+2,e.commentEnd);a.setText(b,e.commentStart,e.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=this.lineComment||"//",d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end>e.start?e.end-
1:e.end),h=!0,l=[],k,m,x=f;x<=g;x++)if(k=d.getLine(x,!0),l.push(k),!h||-1===(m=k.indexOf(b)))h=!1;else if(0!==m){var z;for(z=0;z<m;z++){var p=k.charCodeAt(z);if(!(32===p||9===p))break}h=z===m}p=b.length;x=d.getLineStart(f);z=d.getLineEnd(g,!0);if(h){for(h=0;h<l.length;h++)k=l[h],m=k.indexOf(b),l[h]=k.substring(0,m)+k.substring(m+p);b=l.join("");l=d.getLineStart(g);d=x===e.start?e.start:e.start-p;e=e.end-p*(g-f+1)+(e.end===l+1?p:0)}else l.splice(0,0,""),b=l.join(b),d=x===e.start?e.start:e.start+p,
e=e.end+p*(g-f+1);a.setText(b,x,z);a.setSelection(d,e);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,f=b.getLineCount(),g=0;g<f;g++){var h=b.getLine(g),l=e.exec(h);if(l){var k=b.getLineStart(g),h=l[0].length,l=k+l.index;b.setText("",l,l+h);d.start>l&&(d.start=Math.max(l,d.start-h));d.start!==d.end&&d.end>l&&(d.end=Math.max(l,d.end-h))}}a.getUndoStack().endCompoundChange();
a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel();return(b.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.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}};l.SourceCodeActions=e;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 l});
define("orion/editor/undoStack",[],function(){function k(d,b,g,a,e){this.model=d;this.offset=b;this.text=g;this.previousText=a;this.type=e}function m(d){this.owner=d;this.changes=[]}function h(d,b){this.size=void 0!==b?b:100;this.reset();var g=this;this._listener={onChanging:function(a){g._onChanging(a)},onDestroy:function(a){g._onDestroy(a)}};if(d.getModel){var a=d.getModel();a.getBaseModel&&(a=a.getBaseModel());this.model=a;this.setView(d)}else this.shared=!0,this.model=d;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(d,b){this._doUndoRedo(this.offset,this.previousText,this.text,d,b);return!0},redo:function(d,b){this._doUndoRedo(this.offset,this.text,this.previousText,d,b);return!0},merge:function(d,b,g,a,e){if(a===this.type){if(1===a&&d===
this.offset+this.text.length)return this.text+=b,!0;if(-1===a&&e===this.offset)return this.offset=d,this.previousText=g+this.previousText,!0;if(-1===a&&d===this.offset)return this.previousText+=g,!0}return!1},_doUndoRedo:function(d,b,g,a,e){this.model.setText(b,d,d+g.length);e&&a&&(g=a.getModel(),g!==this.model&&(d=g.mapOffset(d,!0)),a.setSelection(d,d+b.length))}};m.prototype={getRedoChanges:function(){for(var d=[],b=0;b<this.changes.length;b++)d=d.concat(this.changes[b].getRedoChanges());return d},
getUndoChanges:function(){for(var d=[],b=this.changes.length-1;0<=b;b--)d=d.concat(this.changes[b].getUndoChanges());return d},add:function(d){this.changes.push(d)},end:function(d){d&&(this.endSelection=d.getSelection(),this.endCaret=d.getCaretOffset());(d=this.owner)&&d.end&&d.end()},undo:function(d,b){1<this.changes.length&&d&&d.setRedraw(!1);for(var g=this.changes.length-1;0<=g;g--)this.changes[g].undo(d,!1);1<this.changes.length&&d&&d.setRedraw(!0);if(b&&d){var g=this.startSelection.start,a=this.startSelection.end;
d.setSelection(this.startCaret?g:a,this.startCaret?a:g)}(g=this.owner)&&g.undo&&g.undo();return 0<this.changes.length},redo:function(d,b){1<this.changes.length&&d&&d.setRedraw(!1);for(var g=0;g<this.changes.length;g++)this.changes[g].redo(d,!1);(1<this.changes.length,d)&&d.setRedraw(!0);if(b&&d){var g=this.endSelection.start,a=this.endSelection.end;d.setSelection(this.endCaret?g:a,this.endCaret?a:g)}(g=this.owner)&&g.redo&&g.redo();return 0<this.changes.length},merge:function(d,b,g,a,e){var f=this.changes.length;
return 0<f?this.changes[f-1].merge(d,b,g,a,e):!1},start:function(d){d&&(this.startSelection=d.getSelection(),this.startCaret=d.getCaretOffset());(d=this.owner)&&d.start&&d.start()}};h.prototype={destroy:function(){this._onDestroy()},add:function(d){this.compoundChange?this.compoundChange.add(d):(this.stack.splice(this.index,this.stack.length-this.index,d),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 d=[],b=this.index;b<this.stack.length;b++)d=d.concat(this.stack[b].getRedoChanges());
return d},getUndoChanges:function(){this._commitUndo();for(var d=[],b=this.index;0<=b;b--)d=d.concat(this.stack[b].getUndoChanges());return d},undo:function(){this._commitUndo();var d;d=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;d=this.stack[--this.index]}while(!(d=d.undo(this.view,!0)));this._ignoreUndo=!1;return d},redo:function(){this._commitUndo();var d;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;d=this.stack[this.index++]}while(!d.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(d){this.view!==d&&(this.view&&d.removeEventListener("Destroy",this._listener.onDestroy),(this.view=d)&&d.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(d){this._commitUndo();d=new m(d);this.add(d);this.compoundChange=d;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(d){(!d||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(d){if(!this._ignoreUndo){var b=d.text,g=d.start,a=d.addedCharCount,e=d.removedCharCount;d=g+e;var f=0;0===a&&1===e?f=-1:1===a&&0===e&&(f=1);a=this.stack.length;e=this.model.getText(g,d);(!(0<a&&this.index===a)||!this.stack[a-1].merge(g,b,e,f,d))&&this.add(new k(this.model,
g,b,e,f))}}};return{UndoStack:h}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(k,m,h,d){function b(a,b,d,e){this._location=b||"left";this._overview=d||"page";this._rulerStyle=e;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function g(a,c,d,e,f){b.call(this,a,c,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function a(a,c,d){b.call(this,a,c,"page",d)}function e(a,c,d){b.call(this,a,c,"document",d)}function f(b,c,d){a.call(this,b,c,d)}b.prototype={getAnnotations:function(a,b){var d=this._annotationModel;if(!d)return[];var e=this._view.getModel(),f=e.getLineStart(a),g=e.getLineEnd(b-1),h=e;e.getBaseModel&&(h=e.getBaseModel(),f=e.mapOffset(f),g=e.mapOffset(g));for(var k=[],d=this.getAnnotationsByType(d,f,g),f=0;f<
d.length;f++)for(var g=d[f],m=h.getLineAtOffset(g.start),w=h.getLineAtOffset(Math.max(g.start,g.end-1)),A=m;A<=w;A++){var x=A;if(e!==h){x=h.getLineStart(A);x=e.mapOffset(x,!0);if(-1===x)continue;x=e.getLineAtOffset(x)}if(a<=x&&x<b){var z=this._mergeAnnotation(k[x],g,A-m,w-m+1);z&&(k[x]=z)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var p in k)k[p]._multiple&&(k[p].html+=this._multiAnnotationOverlay.html);return k},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(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=
a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=e,g=e.getLineStart(a),k=g,m=g,v=this._annotationModel;if(v){d=d.getSelection();m=e.getLineEnd(a,!0);g<=d.start&&d.start<m&&(g=d.start);e.getBaseModel&&(g=e.mapOffset(g),
m=e.mapOffset(m),f=e.getBaseModel());for(var w,m=v.getAnnotations(g,m),v=null;!w&&m.hasNext();)d=m.next(),this.isAnnotationTypeVisible(d.type)&&(v=d,d.start<=g||(w=d));v&&void 0!==v.groupId&&(this._currentClickGroup=this._currentClickGroup===v.groupId?null:v.groupId,this._setCurrentGroup(a));w&&f.getLineAtOffset(w.start)===f.getLineAtOffset(g)?(g=w.start,m=w.end):m=g=k;e.getBaseModel&&(g=e.mapOffset(g,!0),m=e.mapOffset(m,!0))}(e=h.Tooltip.getTooltip(this._view))&&e.setTarget(null);this._view.setSelection(m,
g,1/3,function(){})}},onDblClick:function(a,b){},onMouseMove:function(a,b){var d=h.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var e=this;d.setTarget({y:b.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,b){this.onMouseMove(a,b);this._currentClickGroup||this._setCurrentGroup(a)},onMouseOut:function(a,b){this._currentClickGroup||this._setCurrentGroup(-1);var d=h.Tooltip.getTooltip(this._view);
d&&d.setTarget(null)},_getTooltipInfo:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=this._annotationModel,g=[];if(f){var g=e.getLineStart(a),h=e.getLineEnd(a);e.getBaseModel&&(g=e.mapOffset(g),h=e.mapOffset(h));g=this.getAnnotationsByType(f,g,h)}f=this._getTooltipContents(a,g);if(!f)return null;f={contents:f,anchor:this.getLocation()};g=d.getClientArea();"document"===this.getOverview()?g.y=d.convert({y:b},"view","document").y:g.y=d.getLocationAtOffset(e.getLineStart(a)).y;d.convert(g,
"document","page");f.x=g.x;f.y=g.y;"right"===f.anchor&&(f.x+=g.width);return f}},_getTooltipContents:function(a,b){return b},_onAnnotationModelChanged:function(a){function b(a){for(var c=0;c<a.length;c++)if(f.isAnnotationTypeVisible(a[c].type)){var g=a[c].start,h=a[c].end;e.getBaseModel&&(g=e.mapOffset(g,!0),h=e.mapOffset(h,!0));-1!==g&&-1!==h&&d.redrawLines(e.getLineAtOffset(g),e.getLineAtOffset(Math.max(g,h-1))+1,f)}}var d=this._view;if(d){var e=d.getModel(),f=this,g=e.getLineCount();a.textModelChangedEvent?
(a=a.textModelChangedEvent.start,e.getBaseModel&&(a=e.mapOffset(a,!0)),a=e.getLineAtOffset(a),d.redrawLines(a,g,f)):(b(a.added),b(a.removed),b(a.changed))}},_mergeAnnotation:function(a,b,d,e){a||(a={});0===d&&(a.html&&b.html?(b.html!==a.html&&!a._multiple&&this._multiAnnotation&&(a.html=this._multiAnnotation.html),a._multiple=!0):a.html=b.html);a.style=this._mergeStyle(a.style,b.style);return a},_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 d;if(b.style)for(d in a.style||(a.style={}),b.style)void 0===a.style[d]&&(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)void 0===a.attributes[d]&&(a.attributes[d]=b.attributes[d])}return a},_setCurrentGroup:function(a){var b=this._annotationModel,d=null,e=b.getTextModel(),f,g=this._currentGroupAnnotation;if(-1!==a){var h=e.getLineStart(a),k=e.getLineEnd(a);e.getBaseModel&&(h=e.mapOffset(h),k=e.mapOffset(k));
for(f=b.getAnnotations(h,k);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=h&&e.end>=k&&void 0!==e.groupId){d=e;break}if(g&&d&&g.groupId===d.groupId)return}this._currentGroupAnnotation=null;g&&b.removeAnnotations(g.groupType);if(d&&-1!==a){this._currentGroupAnnotation=d;f=b.getAnnotations();for(a=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===d.groupId&&(e=e.createGroupAnnotation(),a.push(e));b.replaceAnnotations(null,a)}}};m.AnnotationTypeList.addMixin(b.prototype);
g.prototype=new b;g.prototype.getAnnotations=function(a,c){for(var d=b.prototype.getAnnotations.call(this,a,c),e=this._view.getModel(),f=a;f<c;f++){var g=f&1?this._oddStyle:this._evenStyle,h=f;e.getBaseModel&&(h=e.getLineStart(h),h=e.getBaseModel().getLineAtOffset(e.mapOffset(h)));d[f]||(d[f]={});d[f].html=this._firstLine+h+"";d[f].style||(d[f].style=g)}return d};g.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};g.prototype.setFirstLine=
function(a){this._firstLine=void 0!==a?a:1};g.prototype._onTextModelChanged=function(a){var b=a.start;a=this._view.getModel();var d=a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount(),d=(this._firstLine+d-1+"").length;this._numOfDigits!==d&&(this._numOfDigits=d,b=a.getLineAtOffset(b),this._view.redrawLines(b,a.getLineCount(),this))};a.prototype=new b;e.prototype=new b;e.prototype.getRulerStyle=function(){return this._mergeStyle({style:{lineHeight:"1px",fontSize:"1px"}},this._rulerStyle)};
e.prototype._getTooltipContents=function(a,c){if(0===c.length){var e=this._view.getModel(),f=a;e.getBaseModel&&(f=e.getLineStart(f),f=e.getBaseModel().getLineAtOffset(e.mapOffset(f)));return d.formatMessage(k.line,f+1)}return b.prototype._getTooltipContents.call(this,a,c)};e.prototype._mergeAnnotation=function(a,b,d,e){if(0===d)return a||(a={html:"\x26nbsp;",style:{style:{height:3*e+"px"}}},a.style=this._mergeStyle(a.style,b.overviewStyle)),a};f.prototype=new a;f.prototype.onClick=function(a,b){if(void 0!==
a){var d=this._annotationModel;if(d){var e=this._view.getModel(),f=e.getLineStart(a),g=e.getLineEnd(a,!0);e.getBaseModel&&(f=e.mapOffset(f),g=e.mapOffset(g),e=e.getBaseModel());for(var k,d=d.getAnnotations(f,g);!k&&d.hasNext();)g=d.next(),this.isAnnotationTypeVisible(g.type)&&e.getLineAtOffset(g.start)===e.getLineAtOffset(f)&&(k=g);k&&((e=h.Tooltip.getTooltip(this._view))&&e.setTarget(null),k.expanded?k.collapse():k.expand())}}};f.prototype._getTooltipContents=function(b,c){if(0<c.length){var d=this._view.getModel(),
e=d.getLineStart(b);d.getBaseModel&&(e=d.mapOffset(e),d=d.getBaseModel());for(var e=d.getLineAtOffset(e),f=0;f<c.length;f++){var g=c[f];if(this.isAnnotationTypeVisible(g.type)&&d.getLineAtOffset(g.start)===e){if(c[f].expanded)break;return a.prototype._getTooltipContents.call(this,b,[g])}}}return null};f.prototype._onAnnotationModelChanged=function(b){function c(a){for(g=0;g<a.length;g++)if(f.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;e.getBaseModel&&(b=e.mapOffset(b,!0));-1!==b&&(k=Math.min(k,
e.getLineAtOffset(b)))}}if(b.textModelChangedEvent)a.prototype._onAnnotationModelChanged.call(this,b);else{var d=this._view;if(d){var e=d.getModel(),f=this,g,h=e.getLineCount(),k=h;c(b.added);c(b.removed);c(b.changed);b=d.getRulers();for(g=0;g<b.length;g++)d.redrawLines(k,h,b[g])}}};return{Ruler:b,AnnotationRuler:a,LineNumberRuler:g,OverviewRuler:e,FoldingRuler:f}});
define("orion/editor/textDND",["orion/util"],function(k){function m(h,d){this._view=h;this._undoStack=d;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var b=this;this._listener={onDragStart:function(d){b._onDragStart(d)},onDragEnd:function(d){b._onDragEnd(d)},onDragEnter:function(d){b._onDragEnter(d)},onDragOver:function(d){b._onDragOver(d)},onDrop:function(d){b._onDrop(d)},onDestroy:function(d){b._onDestroy(d)}};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)}m.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 d=this._view,b=d.getSelection(),d=d.getModel();d.getBaseModel&&(b.start=d.mapOffset(b.start),b.end=d.mapOffset(b.end),d=d.getBaseModel());if(d=d.getText(b.start,b.end))this._dragSelection=b,h.event.dataTransfer.effectAllowed="copyMove",h.event.dataTransfer.setData("Text",d)},_onDragEnd:function(h){if(this._dragSelection){var d=
this._view,b=h.event.dataTransfer.dropEffect;if(!k.isFirefox&&("none"!==b||this._dropText))b=h.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(h="move"===b)&&d.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var b=this._dropText,g=this._dropOffset;h&&(g>=this._dragSelection.end?g-=this._dragSelection.end-this._dragSelection.start:g>=this._dragSelection.start&&(g=this._dragSelection.start));d.setText(b,g,g);d.setSelection(g,
g+b.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 d=h.event.dataTransfer.types,b=!this._view.getOptions("readonly");b&&d&&(b=d.contains?d.contains("text/plain")||d.contains("Text"):-1!==d.indexOf("text/plain")||-1!==d.indexOf("Text"));b?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 d=this._view,b=h.event.dataTransfer.getData("Text");b&&(k.isFirefox||(h.event.dataTransfer.dropEffect=this._dropEffect),h=d.getOffsetAtLocation(h.x,h.y),this._dragSelection?(this._dropOffset=h,this._dropText=b):(d.setText(b,h,h),d.setSelection(h,h+b.length)))}};return{TextDND:m}});
define("orion/editor/templates",[],function(){function k(h,d,b,g){this.prefix=h;this.description=d;this.template=b;this.name=g;this._parse()}function m(h,d){this._keywords=h||[];this._templates=[];this.addTemplates(d||[])}k.prototype={getProposal:function(h,d,b){h=d-h.length;d={};var g,a=void 0!==b.delimiter?b.delimiter:"\n";b.indentation&&(a+=b.indentation);var e=void 0!==b.tab?b.tab:"\t",f=0,l=this.variables,c=this.segments;b=[];for(var k=0;k<c.length;k++){var m=c[k],s=l[m];if(void 0!==s)switch(m){case "${tab}":m=
e;break;case "${delimiter}":m=a;break;case "${cursor}":m="";g=f;break;default:var u=d[m];u||(u=d[m]={data:s.data,positions:[]});m=s.substitution;u.data&&u.data.values&&(m=u.data.values[0]);u.positions.push({offset:h+f,length:m.length})}b.push(m);f+=m.length}var a=[],r;for(r in d)d.hasOwnProperty(r)&&a.push(d[r]);b=b.join("");void 0===g&&(g=b.length);return{proposal:b,name:this.name,description:this.description,groups:a,escapePosition:h+g,style:"noemphasis"}},match:function(h){return 0===this.prefix.indexOf(h)},
_parse:function(){var h=this.template,d=[],b={},g,a=0,h=h.replace(/\n/g,"${delimiter}"),h=h.replace(/\t/g,"${tab}");h.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(e,f,l){var c=e.substring(2,e.length-1);f=e;var k=c,m=null,s=k.indexOf(":");-1!==s&&(k=k.substring(0,s),f="${"+k+"}",m=JSON.parse(c.substring(s+1).replace("\\}","}").trim()));(c=b[f])||(c=b[f]={});c.substitution=k;m&&(c.data=m);(g=h.substring(a,l))&&d.push(g);d.push(f);a=l+e.length;return k});(g=h.substring(a,h.length))&&d.push(g);this.segments=
d;this.variables=b}};m.prototype={addTemplates:function(h){for(var d=this.getTemplates(),b=0;b<h.length;b++)d.push(new k(h[b].prefix,h[b].description,h[b].template,h[b].name))},computeProposals:function(h,d,b){var g=this.getPrefix(h,d,b),a=[];this.isValid(g,h,d,b)&&(a=a.concat(this.getTemplateProposals(g,d,b)),a=a.concat(this.getKeywordProposals(g)));return a},getKeywords:function(){return this._keywords},getKeywordProposals:function(h){var d=[],b=this.getKeywords();if(b){for(var g=0;g<b.length;g++)0===
b[g].indexOf(h)&&d.push({proposal:b[g].substring(h.length),description:b[g],style:"noemphasis_keyword"});0<d.length&&d.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return d},getPrefix:function(h,d,b){return b.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(h,d,b){for(var g=[],a=this.getTemplates(),e=0;e<a.length;e++){var f=a[e];f.match(h)&&(f=f.getProposal(h,d,b),this.removePrefix(h,f),g.push(f))}0<g.length&&
(g.sort(function(a,b){return a.name<b.name?-1:a.name>b.name?1:0}),g.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return g},removePrefix:function(h,d){if(!(d.overwrite=d.proposal.substring(0,h.length)!==h))d.proposal=d.proposal.substring(h.length)},isValid:function(h,d,b,g){return!0}};return{Template:k,TemplateContentAssist:m}});
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,m,h,d,b,g){function a(a,b,c){var d=a.getTextView();h.KeyMode.call(this,d);this.editor=a;this.undoStack=b;this.contentAssist=c;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,l=a.text.length-(d-c);f=f.positions;for(var k,c=c-g.position.offset,p=d-g.position.offset,n=0;n<f.length;++n)k=f[n],d=k.position,k.oldOffset=d.offset,k.model===e&&k.group===g.group?(d.offset+=h,d.length+=l,h+=l):(d.offset+=h,k.ansestor&&(d.length+=g.count*l)),k.escape&&(k.model.escapePosition=d.offset);this.ignoreVerify=!0;for(n=f.length-1;0<=n;n--)k=f[n],k.model===e&&k.group===g.group&&b.setText(a.text,k.oldOffset+
c,k.oldOffset+p);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var e={};a.prototype=new h.KeyMode;g.mixin(a.prototype,{createKeyBindings:function(){var a=m.KeyBinding,b=[];b.push({actionID:"linkedModeEnter",keyBinding:new a(13)});b.push({actionID:"linkedModeCancel",keyBinding:new a(27)});b.push({actionID:"linkedModeNextGroup",keyBinding:new a(9)});b.push({actionID:"linkedModePreviousGroup",keyBinding:new a(9,!1,!0)});return b},enterLinkedMode:function(a){if(!this.linkedModeModel){var b=
this.editor.getTextView();b.addKeyMode(this);b.addEventListener("Verify",this.linkedModeListener.onVerify);b.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(k.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(a.previousModel=this.linkedModeModel,a.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=a);this.linkedModeModel=
a;this.selectLinkedGroup(0)},exitLinkedMode:function(a){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var b=this.linkedModeModel;this.linkedModeModel=b.previousModel;b.parentGroup=b.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var c=this.editor,d=c.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);a&&c.setCaretOffset(b.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var a=this,b=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:b,group:b.selectedGroupIndex,end:function(){a._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(a){var d=this.linkedModeModel;if(d){d.selectedGroupIndex=a;a=d.groups[a];var c=a.positions[0],e=this.editor;e.setSelection(c.offset,c.offset+c.length);if(d=this.contentAssist)d.offset=void 0,a.data&&"link"===a.data.type&&a.data.values?((this._groupContentAssistProvider=new b.TemplateContentAssist(a.data.values)).getPrefix=function(){var a=
e.getSelection();return a.start===a.end&&(a=e.getCaretOffset(),c.offset<=a&&a<=c.offset+c.length)?e.getText(c.offset,a):""},d.offset=c.offset,d.deactivate(),d.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,d.deactivate())}this._updateAnnotations()},_getModelPositions:function(a,b,c){for(var d=b.groups,e=0;e<d.length;e++)for(var g=d[e].positions,h=0;h<g.length;h++){var k=g[h];c&&(k={offset:k.offset+c,length:k.length});k={index:h,group:e,count:g.length,model:b,
position:k};a.push(k);b.nextModel&&b.nextModel.parentGroup===e&&(k.ansestor=!0,this._getModelPositions(a,b.nextModel,(c||0)+g[h].offset-g[0].offset))}},_getSortedPositions:function(a){var b=this._sortedPositions;if(!b){for(b=[];a.previousModel;)a=a.previousModel;for(this._getModelPositions(b,a);a;)void 0!==a.escapePosition&&b.push({escape:!0,model:a,position:{offset:a.escapePosition,length:0}}),a=a.nextModel;b.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=b}return b},
_getPositionChanged:function(a,b,c){var d;a=this._getSortedPositions(a);for(var e=a.length-1;0<=e;e--){var g=a[e].position;if(g.offset<=b&&c<=g.offset+g.length){d=a[e];break}}return{position:d,positions:a}},_updateAnnotations:function(a){var b=this.editor.getAnnotationModel();if(b){var c=[],e=[];b.getTextModel();for(var g=b.getAnnotations(),h;g.hasNext();)switch(h=g.next(),h.type){case d.AnnotationType.ANNOTATION_LINKED_GROUP:case d.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case d.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:c.push(h)}if(g=
this.linkedModeModel){a=a||this._getSortedPositions(g);for(var k=0;k<a.length;k++)if(h=a[k],h.model===g){var m=d.AnnotationType.ANNOTATION_LINKED_GROUP;h.group===g.selectedGroupIndex&&(m=0===h.index?d.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:d.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);h=h.position;h=d.AnnotationType.createAnnotation(m,h.offset,h.offset+h.length,"");e.push(h)}}b.replaceAnnotations(c,e)}}});e.LinkedMode=a;return e});
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,m,h,d,b,g){function a(){}function e(){}function f(){}function l(){}function c(){}function n(){}var q={};a.prototype={createKeyBindings:function(a,b,c,d){d=new k.TextActions(a,b,d);var e=new g.LinkedMode(a,b,c);a=new k.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};q.KeyBindingsFactory=
a;e.prototype={createUndoStack:function(a){a=a.getTextView();return new m.UndoStack(a,200)}};q.UndoFactory=e;f.prototype={createLineNumberRuler:function(a){return new h.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};q.LineNumberRulerFactory=f;l.prototype={createFoldingRuler:function(a){return new h.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};q.FoldingRulerFactory=l;c.prototype={createAnnotationModel:function(a){return new d.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new d.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}}};q.AnnotationFactory=c;n.prototype={createTextDND:function(a,c){return new b.TextDND(a.getTextView(),c)}};q.TextDNDFactory=n;return q});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(k,m,h,d){return d.mixin({},k,m,h)});
var JsDiff=function(){function k(a){for(var b=[],d=0;d<a.length;d++)a[d]&&b.push(a[d]);return b}function m(a){a=a.replace(/&/g,"\x26amp;");a=a.replace(/</g,"\x26lt;");a=a.replace(/>/g,"\x26gt;");return a.replace(/"/g,"\x26quot;")}var h=function(a){this.ignoreWhitespace=a};h.prototype={diff:function(a,b){if(b==a)return[{value:b}];if(!b)return[{value:a,removed:!0}];if(!a)return[{value:b,added:!0}];b=this.tokenize(b);a=this.tokenize(a);var d=b.length,c=a.length,g=d+c,h=[{newPos:-1,components:[]}],k=
this.extractCommon(h[0],b,a,0);if(h[0].newPos+1>=d&&k+1>=c)return h[0].components;for(var m=1;m<=g;m++)for(var r=-1*m;r<=m;r+=2){var t;t=h[r-1];var v=h[r+1],k=(v?v.newPos:0)-r;t&&(h[r-1]=void 0);var w=t&&t.newPos+1<d,A=v&&0<=k&&k<c;if(!w&&!A)h[r]=void 0;else{!w||A&&t.newPos<v.newPos?(t={newPos:v.newPos,components:v.components.slice(0)},this.pushComponent(t.components,a[k],void 0,!0)):(t={newPos:t.newPos,components:t.components.slice(0)},t.newPos++,this.pushComponent(t.components,b[t.newPos],!0,void 0));
k=this.extractCommon(t,b,a,r);if(t.newPos+1>=d&&k+1>=c)return t.components;h[r]=t}}},pushComponent:function(a,b,d,c){var g=a[a.length-1];g&&g.added===d&&g.removed===c?a[a.length-1]={value:this.join(g.value,b),added:d,removed:c}:a.push({value:b,added:d,removed:c})},extractCommon:function(a,b,d,c){var g=b.length,h=d.length,k=a.newPos;for(c=k-c;k+1<g&&c+1<h&&this.equals(b[k+1],d[c+1]);)k++,c++,this.pushComponent(a.components,b[k],void 0,void 0);a.newPos=k;return c},equals:function(a,b){var d=/\S/;return this.ignoreWhitespace&&
!d.test(a)&&!d.test(b)?!0:a==b},join:function(a,b){return a+b},tokenize:function(a){return a}};var d=new h,b=new h(!1);b.tokenize=function(a){return k(a.split(/(\s+|\b)/))};var g=new h(!0);g.tokenize=function(a){return k(a.split(/([{}:;,]|\s+)/))};var a=new h;a.tokenize=function(a){return a.split(/^/m)};return{diffChars:function(a,b){return d.diff(a,b)},diffWords:function(a,d){return b.diff(a,d)},diffLines:function(b,d){return a.diff(b,d)},diffCss:function(a,b){return g.diff(a,b)},createPatch:function(b,
d,g,c,h){var k=[];k.push("Index: "+b);k.push("\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d");k.push("--- "+b+"\t"+c);k.push("+++ "+b+"\t"+h);b=a.diff(d,g);b.push({value:"",lines:[]});g=d=0;c=[];for(var m=h=1,u=0;u<b.length;u++){var r=b[u],t=r.lines||r.value.replace(/\n$/,"").split("\n");
r.lines=t;if(r.added||r.removed){if(!d){var v=b[u-1];d=h;g=m;v&&(c.push.apply(c,v.lines.slice(-4).map(function(a){return" "+a})),d-=4,g-=4)}c.push.apply(c,t.map(function(a){return(r.added?"+":"-")+a}));r.added?m+=t.length:h+=t.length}else d&&(8>=t.length&&u<b.length-1?c.push.apply(c,t.map(function(a){return" "+a})):(v=Math.min(t.length,4),k.push("@@ -"+d+","+(h-d+v)+" +"+g+","+(m-g+v)+" @@"),k.push.apply(k,c),k.push.apply(k,t.slice(0,v).map(function(a){return" "+a})),g=d=0,c=[])),h+=t.length,m+=t.length}1<
b.length&&!/\n$/.test(b[b.length-2].value)&&k.push("\\ No newline at end of file\n");return k.join("\n")},convertChangesToXML:function(a){for(var b=[],d=0;d<a.length;d++){var c=a[d];c.added?b.push("\x3cins\x3e"):c.removed&&b.push("\x3cdel\x3e");b.push(m(c.value));c.added?b.push("\x3c/ins\x3e"):c.removed&&b.push("\x3c/del\x3e")}return b.join("")}}}();"undefined"!==typeof module&&(module.exports=JsDiff);"function"===typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff});
define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(k){var m=m||{};m.JSDiffAdapter=function(){function h(){}h.prototype={_specialLine:function(d,b,g){return b.value===d&&g!==d},adapt:function(d,b,g){g||(g="\n");var a=d.split(g),e=b.split(g),f=""===a[a.length-1],e=""===e[e.length-1],h=k.diffLines(d,b);d=[];b=[];for(var c=0,m=0,q=-1,s=0,u=!0,r=g,t=0;t<h.length;t++){var v=h[t],w=v.lines||v.value.split(g),A=w.length,x=0;1<w.length&&""===w[w.length-1]&&A--;1<A&&!u&&""===w[0]&&(A--,x++);v.lines=
w;if(!v.added&&!v.removed){if(!this._specialLine(g,v,r)){if(c||m)d.push([c,m,q]),m=c=0,q=-1,s+=m;d.push([A,A,0]);s+=A}}else if(v.added){-1===q&&(q=b.length+1);c+=A;for(u=x;u<A+x;u++)b.push(v.lines[u])}else m+=A;u=!1;1<w.length&&""===w[w.length-1]&&(u=!0);r=v.value?v.value[v.value.length-1]:g}if(c||m)d.push([c,m,q]),s+=m;s<a.length&&1<a.length&&(g=d[d.length-1],0===g[2]?(g[0]+=1,g[1]+=1):-1===g[2]?d.push([1,1,0]):f===e?d.push([1,1,0]):(e&&(g[0]+=1),f&&(g[1]+=1)));return{mapper:d,changContents:{array:b,
index:0}}},adaptCharDiff:function(d,b,g){d=g?k.diffWords(d,b):k.diffChars(d,b);b=[];for(var a=g=0,e=0,f=0,h=0;h<d.length;h++){var c=d[h];if(!c.added&&!c.removed){if(0<e||0<f)b.push([a,a+e,g,g+f]),a+=e,g+=f,f=e=0;a+=c.value.length;g+=c.value.length}else c.added?e+=c.value.length:f+=c.value.length}(0<e||0<f)&&b.push([a,a+e,g,g+f]);return b}};return h}();return m});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(k,m,h,d){var b={},g,a,e,f,l,c,n,q,s,u,r,t,v,w,A,x;b.DiffTreeNavigator=function(){function b(a,c,d,e,f,g){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,c,d,e,f,g)}g="orion.annotation.diff.addedBlock";a="orion.annotation.diff.currentAddedBlock";e="orion.annotation.diff.deletedBlock";f="orion.annotation.diff.currentDeletedBlock";
l="orion.annotation.diff.blockTop";c="orion.annotation.diff.currentBlockTop";n="orion.annotation.diff.blockConflict";q="orion.annotation.diff.currentBlockConflict";s="orion.annotation.diff.addedWord";u="orion.annotation.diff.currentAddedWord";r="orion.annotation.diff.deletedWord";t="orion.annotation.diff.currentDeletedWord";v="orion.annotation.diff.emptyDeletedWordLeft";w="orion.annotation.diff.emptyDeletedWordRight";A="orion.annotation.diff.emptyAddedWordLeft";x="orion.annotation.diff.emptyAddedWordRight";
h.AnnotationType.registerType(g,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});h.AnnotationType.registerType(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});h.AnnotationType.registerType(e,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});h.AnnotationType.registerType(f,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});h.AnnotationType.registerType(l,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
h.AnnotationType.registerType(c,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});h.AnnotationType.registerType(n,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});h.AnnotationType.registerType(q,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});h.AnnotationType.registerType(s,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});h.AnnotationType.registerType(u,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});h.AnnotationType.registerType(r,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});h.AnnotationType.registerType(t,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});h.AnnotationType.registerType(v,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});h.AnnotationType.registerType(w,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
h.AnnotationType.registerType(A,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});h.AnnotationType.registerType(x,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});b.prototype={initAll:function(a,b,c,d,e,f,g){this._charOrWordDiff=a?a:"word";b&&(this._initialized=!0);this.editorWrapper=[{editor:b,diffFeeder:d},{editor:c,diffFeeder:e}];this._curveRuler=g;(this._overviewRuler=f)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var b=
0;b<this.editorWrapper.length;b++)this.editorWrapper[b].diffFeeder.init(this.editorWrapper[b].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var b=0;b<this.editorWrapper[a].annoTypes.length;b++)this.editorWrapper[a].annoTypes[b].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].current),this.editorWrapper[a].annoTypes[b].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].normal)}this._root.children=[];b=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!b||0===b.length)this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),
this.replaceAllAnnotations(!0,1,"word",!1,[]),this.replaceAllAnnotations(!0,0,"block",!0,[]),this.replaceAllAnnotations(!0,1,"block",!0,[]),this.replaceAllAnnotations(!0,0,"word",!0,[]),this.replaceAllAnnotations(!0,1,"word",!0,[]);else{var c=new d.JSDiffAdapter;for(a=0;a<b.length;a++){var e=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(e);var f=this.generatePairWordAnnotations(e,a,c);f&&(e.children=f)}this.replaceAllAnnotations(!1,0,"block",!0);this.replaceAllAnnotations(!1,
1,"block",!0);this.replaceAllAnnotations(!1,0,"word",!0);this.replaceAllAnnotations(!1,1,"word",!0);this.iterator=new k.TreeModelIterator(this._root.children)}},replaceAllAnnotations:function(a,b,c,d,e){if(this.editorWrapper[b].annoTypes)for(var f=0;f<this.editorWrapper[b].annoTypes.length;f++)this.editorWrapper[b].annoTypes[f].type===c&&this.replaceDiffAnnotations(this.editorWrapper[b].editor,e?e:this.editorWrapper[b].annoTypes[f].list,d?this.editorWrapper[b].annoTypes[f].normal:this.editorWrapper[b].annoTypes[f].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,b){this.iterator&&(this.iterator.iterateOnTop(a,b),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(!this.iterator)return null;var b=this.iterator.iterate(a);if(b){var c=this.iterator.cursor();"block"===c.type&&c.children&&0<c.children.length&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}return b},
gotoBlock:function(a,b){if(this.iterator){if(0>a||a>=this._root.children.length||0===this._root.children.length)a=0;void 0!==b&&0<=b&&this._root.children[a].children&&b<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[b]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,b,c){if(c===this.editorWrapper[a].editor.getTextView()){for(var d=0;d<this._root.children.length;d++){c=
this._root.children[d];var e=0===a?c.oldA:c.newA;if(b>=e.start&&b<=e.end){d=c;if(c.children&&0<c.children.length)for(e=0;e<c.children.length;e++){var f=c.children[e],g=0===a?f.oldA:f.newA;if(b>=g.start&&b<=g.end){d=f;break}}return d}}return null}},gotoChange:function(a,b){for(var c=0;c<this.editorWrapper.length;c++){var d=this._hitDiffAnnotation(c,a,b);if(d)return this.iterator.setCursor(d),this.updateCurrentAnnotation(!1,b),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;
var a=this.iterator.cursor();return!a?-1:"block"===a.type?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return"block"===a.type?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();if(!b||0===b.length)return-1;a>b.length-1&&(a=0);return b[a][1]},replaceDiffAnnotations:function(a,b,c,d){if(b&&c&&(a=a.getAnnotationModel())){for(var e=
a.getAnnotations(),f=[];d&&e.hasNext();){var g=e.next();g.type===c&&f.push(g)}a.replaceAnnotations(f,b)}},updateCurrentAnnotation:function(a,b){this.replaceAllAnnotations(!0,0,"block",!1,[]);this.replaceAllAnnotations(!0,1,"block",!1,[]);this.replaceAllAnnotations(!0,0,"word",!1,[]);this.replaceAllAnnotations(!0,1,"word",!1,[]);if(this.iterator){var c=this.iterator.cursor();if(c){var d,e,f={start:c.oldA.start,end:c.oldA.end},g={start:c.newA.start,end:c.newA.end};"word"===c.type?(d=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(f,
this.editorWrapper[0].editor.getTextView().getModel()),e=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(g,this.editorWrapper[1].editor.getTextView().getModel())):(d=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(c.index),e=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(c.index));d&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new (h.AnnotationType.getType(d.current))(f.start,f.end)],d,!0);e&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (h.AnnotationType.getType(e.current))(g.start,
g.end)],e,!0);a?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1):b&&(this.autoSelecting=!0,b!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),b!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(a,
b){var c=this.generateBlockDiffAnnotations(0,b),d=this.generateBlockDiffAnnotations(1,b);return{parent:a,index:b,type:"block",oldA:c,newA:d}},generatePairWordAnnotations:function(a,b,c){var d=this.editorWrapper[0].diffFeeder.getTextOnBlock(b),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(b),f=0,g=0;if(d&&e&&d.text&&e.text&&5E3>=d.text.length&&5E3>=e.text.length)b=c.adaptCharDiff(d.text,e.text,"word"===this._charOrWordDiff),g=e.start,f=d.start;else return null;c=[];d=[];this.generateWordDiffAnnotations(0,
c,f,b,2,3);this.generateWordDiffAnnotations(1,d,g,b,0,1);b=[];for(f=0;f<c.length;f++)b.push({parent:a,index:f,type:"word",oldA:c[f],newA:d[f]});return b},getAnnoModelList:function(a,b,c){for(var d=0;d<this.editorWrapper[a].annoTypes.length;d++)if(this.editorWrapper[a].annoTypes[d].type===b&&this.editorWrapper[a].annoTypes[d].normal===c)return this.editorWrapper[a].annoTypes[d].list;return null},generateBlockDiffAnnotations:function(a,b){var c=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(b),
d=this.getAnnoModelList(a,"block",c.normal),e=this.editorWrapper[a].diffFeeder.getCharRange(b),c=h.AnnotationType.createAnnotation(c.normal,e.start,e.end);d&&d.push(c);return c},generateWordDiffAnnotations:function(a,b,c,d,e,f){if(d){var g=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1});a=this.getAnnoModelList(a,"word",g.normal);for(var l=0;l<d.length;l++){var k=h.AnnotationType.createAnnotation(g.normal,d[l][e]+c,d[l][f]+c);a.push(k);b.push(k)}}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,b){var c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(0<b-c?b-c:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();0!==b.length&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
b[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=m.lookUpLineIndex(this.getMapper(),0,b[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&(a=0>a?0:m.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a),this.gotoBlock(a))},gotoDiff:function(a,b){this.gotoChange(a,b)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){var a=this.iterateOnChange(!0);this._positionDiffBlock();return a},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return b}();b.DiffBlockFeeder=function(){function a(){}a.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(a){this._isAddedSide()?a.push({type:"word",current:u,normal:s,list:[]}):a.push({type:"word",
current:t,normal:r,list:[]});a.push({type:"word",current:v});a.push({type:"word",current:w});a.push({type:"word",current:A});a.push({type:"word",current:x})},getCurrentWordAnnoType:function(a,b){return a.start===a.end&&b?this._isAddedSide()?{current:this._repositionEmptyWord(a,b),normal:s}:{current:this._repositionEmptyWord(a,b),normal:r}:this._isAddedSide()?{current:u,normal:s}:{current:t,normal:r}},_repositionEmptyWord:function(a,b){var c=b.getLineAtOffset(a.start),d=b.getLineStart(c),e=b.getLineEnd(c);
if(d!==e){if(a.start===e)return a.start--,this._isAddedSide()?x:w;a.end++}else if(0<c&&(c--,d=b.getLineStart(c),e=b.getLineEnd(c),d!==e))return a.start=e-1,a.end=e,this._isAddedSide()?x:w;return this._isAddedSide()?A:v},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return-1===a?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var b=this._diffBlocks[a][0],c=b+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1;a=this._textModel.getLineStart(b);if(c<b)return{start:a,end:a};b=this._textModel.getLineEnd(c,!0);return{start:a,end:b}},getTextOnBlock:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return 0===this._mapper.length}};return a}();b.TwoWayDiffBlockFeeder=function(){function d(a,b,c,e){this._mapperColumnIndex=c;this._reverseAnnotation=e;this.init(a,b)}d.prototype=new b.DiffBlockFeeder;d.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex};d.prototype.init=function(a,b){this._textModel=a;this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];for(var c=0,d=0;d<this._mapper.length;d++)0!==
this._mapper[d][2]&&this._diffBlocks.push([c,d]),c+=this._mapper[d][this._mapperColumnIndex]}};d.prototype.getBlockAnnoTypes=function(b){this._isAddedSide()?b.push({type:"block",normal:g,current:a,list:[]}):b.push({type:"block",normal:e,current:f,list:[]});b.push({type:"block",normal:l,current:c,list:[]});b.push({type:"block",normal:n,current:q,list:[]})};d.prototype.getCurrentBlockAnnoType=function(b){if(!this._diffBlocks||0===this._diffBlocks.length||this._diffBlocks.length<=b)return null;b=this._diffBlocks[b][1];
return 0===this._mapper[b][this._mapperColumnIndex]?{normal:l,current:c}:m.isMapperConflict(this.getMapper(),b)?{normal:n,current:q}:this._isAddedSide()?{type:"block",normal:g,current:a,list:[]}:{type:"block",normal:e,current:f,list:[]}};return d}();b.inlineDiffBlockFeeder=function(){function c(a,b){this._mapperColumnIndex=b;this.init(a)}c.prototype=new b.DiffBlockFeeder;c.prototype.setModel=function(a){this._textModel=a};c.prototype.init=function(a){this._diffBlocks=void 0;if(a){this._mapper=a;this._diffBlocks=
[];this._gapBlocks=[];for(var b=a=0,c=0;c<this._mapper.length;c++){if(0!==this._mapper[c][2]){if(this._isAddedSide()){var d=a+this._mapper[c][1];this._diffBlocks.push([d,c]);this._gapBlocks.push([d,d+this._mapper[c][0],b])}else this._diffBlocks.push([a,c]),this._gapBlocks.push([a,a+this._mapper[c][1],b]);a+=this._mapper[c][0]+this._mapper[c][1]}else this._gapBlocks.push([a,a+this._mapper[c][this._mapperColumnIndex],b]),a+=this._mapper[c][this._mapperColumnIndex];b+=this._mapper[c][this._mapperColumnIndex]}}};
c.prototype.getBlockAnnoTypes=function(b){this._isAddedSide()?b.push({type:"block",normal:g,current:a,list:[]}):b.push({type:"block",normal:e,current:f,list:[]});b.push({type:"block",normal:n,current:q,list:[]})};c.prototype.getCurrentBlockAnnoType=function(b){if(!this._diffBlocks||0===this._diffBlocks.length)return null;b=this._diffBlocks[b][1];return 0===this._mapper[b][this._mapperColumnIndex]?{current:u,normal:s}:m.isMapperConflict(this.getMapper(),b)?{normal:n,current:q}:this._isAddedSide()?
{type:"block",normal:g,current:a,list:[]}:{type:"block",normal:e,current:f,list:[]}};c.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};c.prototype.getLineNumber=function(a){for(var b=0;b<this._gapBlocks.length;b++)if(this._gapBlocks[b][0]!==this._gapBlocks[b][1]&&a>=this._gapBlocks[b][0]&&a<this._gapBlocks[b][1])return a-this._gapBlocks[b][0]+this._gapBlocks[b][2];return-1};return c}();
return b});
define("orion/compare/compareView","i18n!orion/compare/nls/messages orion/Deferred orion/webui/littlelib orion/compare/diffParser orion/compare/compareRulers orion/editor/editor orion/editor/editorFeatures orion/keyBinding orion/editor/textView orion/compare/compareUIFactory orion/compare/compareUtils orion/compare/jsdiffAdapter orion/compare/diffTreeNavigator".split(" "),function(k,m,h,d,b,g,a,e,f,l,c,n,q,s,u,r){var t={};t.CompareView=function(){function a(){this._diffParser=new d.DiffParser}a.prototype=
{_clearOptions:function(){this.options={};this.options.blockNumber=1;this.options.changeNumber=0},_getLineDelim:function(a,b){return"\n"},_generateMapper:function(a,b,c,d,e){var f=this._getLineDelim(a,c);this._diffParser.setLineDelim(f);if(this.options.mapper&&this.options.toggler)return{delim:f,mapper:this.options.mapper,output:this.options.newFile.Content,diffArray:this.options.diffArray};if("string"===typeof b&&"string"===typeof a)return a=(new n.JSDiffAdapter).adapt(a,b,f),this.options.toggler&&
(this.options.mapper=a.mapper,this.options.newFile.Content=b,this.options.diffArray=a.changContents),{delim:f,mapper:a.mapper,output:b,diffArray:a.changContents};b=this._diffParser.parse(a,c,d,e);a=this._diffParser.getDiffArray();this.options.toggler&&(this.options.mapper=b.mapper,this.options.newFile.Content=b.outPutFile,this.options.diffArray=a);return{delim:f,mapper:b.mapper,output:b.outPutFile,diffArray:a}},_loadImageFile:function(a,b,c){var d=document.createElement("img");d.src=a;var e=new m;
d.onload=function(){b.appendChild(d);if(c){var a=document.createElement("hr");b.appendChild(a)}e.resolve(d.height)};d.onerror=function(){e.resolve(0)};return e},_initSyntaxHighlighter:function(a){this._syntaxHighlighters=null;if(this.options.highlighters&&0<this.options.highlighters.length&&!(1>a.length||2<a.length))this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:a[0]}],2===a.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],
target:a[1]})},_highlightSyntax:function(){if(this._syntaxHighlighters){var a=[];this._syntaxHighlighters.forEach(function(b){a.push(b.highlighter.highlight(b.target.fileName,b.target.contentType,b.target.editor))}.bind(this));m.all(a,function(a){return{_error:a}}).then(function(a){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1)}.bind(this),50)},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this));if(a.newFileOnRight){var c=this.options.newFile;this.options.newFile=this.options.oldFile;this.options.oldFile=c}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},
prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors();this.refresh(!0)},initEditors:function(a){},initImageMode:function(){}};return a}();t.TwoWayCompareView=function(){function c(a){this.setOptions(a,!0);this._diffNavigator=new q.DiffTreeNavigator("word");this.type="twoWay";(this._uiFactory=this.options.uiFactory)||
(this._uiFactory=new l.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI());this._viewLoadedCounter=0;this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._curveRuler=new b.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}c.prototype=new t.CompareView;c.prototype.initEditors=function(a){this._editors=
[];this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile));this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0));this._overviewRuler=new b.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));window.onbeforeunload=function(){if(this._editors&&this._editors.some(function(a){return a.isDirty()}))return k["There are unsaved changes."]}.bind(this)};
c.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(a){a.destroy()}),this._editors=null);this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode");this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode");this._uiFactory.disableTitle();this._uiFactory.disableLineStatus();this._imageMode=!0};c.prototype.getImageMode=function(){return this._imageMode};c.prototype.getEditors=function(){return this._editors};c.prototype.gotoDiff=
function(a,b,c){c=c?this._editors[1].getTextView():this._editors[0].getTextView();a=c.getModel().getLineStart(a)+b;this._diffNavigator.gotoDiff(a,c)};c.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)};c.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)};c.prototype.resizeEditors=function(){this._editors.forEach(function(a){a.getTextView().resize()})};c.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};c.prototype._createEditor=function(b,c,d,e,h){var l=
"undefined"===typeof e.readonly?!0:e.readonly,m=function(){var a=new f.TextView({parent:c,readonly:l,tabSize:4});this._viewLoadedCounter++;2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1);if(this.onLoad)this.onLoad();var b=this.getSplitter();b&&b.addResizeListener(function(b){b&&(this._uiFactory.isLeftPane(b)?h:!h)&&a.resize()}.bind(this));return a}.bind(this),n=e.keyBindingFactory;n||(n=new a.KeyBindingsFactory);var q=null;if(d)var r="",q=function(a,b){d&&(r=b?k["ERROR: "]+
a:a,d.textContent=""+r)};m=new g.Editor({textViewFactory:m,undoStackFactory:new a.UndoFactory,annotationFactory:new a.AnnotationFactory,keyBindingFactory:n,statusReporter:q,domNode:c});m.installTextView();m.setInput(null,null,e.Content?e.Content:b);m.setOverviewRulerVisible(!1);var G=m.getTextView();G.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=G.getCaretOffset(),
this._diffNavigator.gotoDiff(a,G))}.bind(this));G.getModel().addEventListener("Changed",function(a){this._curveRuler.onChanged(a,!h)||(this.options.mapper=null)}.bind(this));h?G.addEventListener("Scroll",function(a){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render());if(this.onScroll)this.onScroll()}.bind(this)):G.addEventListener("Scroll",function(a){this._curveRuler&&this._curveRuler.render()}.bind(this));return m};c.prototype.destroy=function(){this._editors&&(this._diffNavigator.destroy(),
this._editors.forEach(function(a){a.destroy()}),this._uiFactory.destroy())};c.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var a=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),c=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(a);this._editors[0].getTextView().addRuler(c);
this._editors[0].getTextView().addRuler(this._overviewRuler);this._hasRuler=!0}};c.prototype.refresh=function(a){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(a){return b._loadImageFile(b.options.oldFile.URL,b._uiFactory.getEditorParentDiv()).then(function(b){return(new m).resolve(a>b?a:b)})})}var c=this.options.oldFile.Content,
d=this.options.newFile.Content,e=this.options.diffContent;"string"===typeof d?e=this._generateMapper(c,d,e,this.options.hasConflicts):(e=this._generateMapper(c,d,e,this.options.hasConflicts),d=e.output);var f=new q.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),e.mapper,1,this.options.newFileOnRight),g=new q.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),e.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],
this._editors[1],f,g,this._overviewRuler,this._curveRuler);this._curveRuler.init(e.mapper,this._editors[1],this._editors[0],this._diffNavigator);a&&(this._editors[1].setInput(this.options.newFile.Name,null,d),this._editors[0].setInput(this.options.oldFile.Name,null,c));this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]);this._highlightSyntax();
this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);this.refreshTitle(0);this.refreshTitle(1);a=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5;c=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return a>c?a:c};c.prototype.refreshTitle=
function(a,b){if(1===a){var c=this._uiFactory.getTitleDiv(!0);c&&(h.empty(c),c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.newFile.Name+"*":this.options.newFile.Name)))}else if(c=this._uiFactory.getTitleDiv(!1))h.empty(c),c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.oldFile.Name+"*":this.options.oldFile.Name))};return c}();t.InlineCompareView=function(){function d(a){this.setOptions(a,!0);this._diffNavigator=new q.DiffTreeNavigator("word");
this.type="inline";this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._editorDiv=this.options.parentDivId}d.prototype=new t.CompareView;d.prototype.addRulers=function(){this._textView&&!this._hasRuler&&(this._textView.addRuler(this._rulerOrigin),this._textView.addRuler(this._rulerNew),this._textView.addRuler(this._overviewRuler),this._hasRuler=!0)};d.prototype.removeRulers=function(){this._textView&&this._hasRuler&&(this._textView.removeRuler(this._rulerOrigin),this._textView.removeRuler(this._rulerNew),
this._textView.removeRuler(this._overviewRuler),this._hasRuler=!1)};d.prototype.destroyEditor=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.setText(""),this.removeRulers())};d.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};d.prototype.initEditors=function(c){var d=h.node(this._editorDiv),e=function(){return new f.TextView({parent:d,readonly:!0,tabSize:4})}.bind(this);this._editor=new g.Editor({textViewFactory:e,undoStackFactory:new a.UndoFactory,
annotationFactory:new a.AnnotationFactory,domNode:d});this._editor.installTextView();this._editor.setInput(null,null,c);this._editor.setOverviewRulerVisible(!1);this._editor.setAnnotationRulerVisible(!1);this._textView=this._editor.getTextView();this._rulerOrigin=new b.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines inlineRulerLeft"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._rulerNew=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},
{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._overviewRuler=new b.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));this._textView.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=this._textView.getCaretOffset(),this._diffNavigator.gotoDiff(a,this._textView))}.bind(this))};
d.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null);h.node(this._editorDiv).classList.add("compareEditorParentImageMode");this._imageMode=!0};d.prototype.getImageMode=function(){return this._imageMode};d.prototype._initDiffPosition=function(a){var b=a.getModel();if(b&&b.getAnnotations&&(b=b.getAnnotations(),0<b.length)){var b=b[0][0],c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(0<b-c?b-c:0)}};d.prototype.refresh=function(){if(this._imageMode){this.options.commandProvider&&
this.options.commandProvider.renderCommands(this);var a=this;return this._loadImageFile(this.options.newFile.URL,h.node(this._editorDiv),!0).then(function(b){return a._loadImageFile(a.options.oldFile.URL,h.node(a._editorDiv)).then(function(a){return(new m).resolve(b+a+20)})})}var b=this.options.oldFile.Content,d=this.options.newFile.Content,e=this._generateMapper(b,d,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);"string"!==typeof d&&(d=e.output);this._textView.getModel().setText(b);
b=new q.inlineDiffBlockFeeder(e.mapper,1);d=new q.inlineDiffBlockFeeder(e.mapper,0);c.mergeDiffBlocks(this._textView.getModel(),d.getDiffBlocks(),e.mapper,e.diffArray.array,e.diffArray.index,this._diffParser._lineDelimiter);b.setModel(this._textView.getModel());d.setModel(this._textView.getModel());this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,b,d,this._overviewRuler);this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,
editor:this._editor}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();e=this._textView.getTopIndex();this._textView.redrawLines(e,e+1,this._overviewRuler);this._textView.redrawLines(e,e+1,this._rulerOrigin);this._textView.redrawLines(e,e+1,this._rulerNew);this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5};d.prototype.setConflicting=
function(a){this._conflcit=a};return d}();t.toggleableCompareView=function(){function a(b,c){c&&(c.toggler=this);this._widget="inline"===b?new t.InlineCompareView(c):new t.TwoWayCompareView(c)}a.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0;this._widget.initImageMode()},toggle:function(){var a=this._widget.options;if(!this._imageMode){var b=this._widget.getCurrentDiffPos();a.blockNumber=b.block;a.changeNumber=b.change}this._widget.destroy();h.empty(h.node(a.parentDivId));
this._widget="inline"===this._widget.type?new t.TwoWayCompareView(a):new t.InlineCompareView(a);this._imageMode?this._widget.initImageMode():this._widget.initEditors();this._widget.refresh(!0)},getWidget:function(){return this._widget}};return a}();return t});
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 m="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(?:"+m.join("|")+")\\b",name:"keyword.control.js"}]});return{id:k[k.length-1].id,grammars:k,keywords:m}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(k){var m="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(?:"+
m.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:k[k.length-1].id,grammars:k,keywords:m}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(k){var m="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)(?:"+m.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:m}});
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,m,h,d){function b(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function g(){b.call(this,null,!0)}function a(a){b.call(this,null,a)}function e(){b.call(this,null,!1)}function f(d,f,h){this.commentStart="/*";this.commentEnd="*/";var k=[];switch(f){case "java":k=c;break;
case "js":k=l;break;case "css":k=n}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new b(k,this.whitespacesVisible);this._firstScanner=new e;this._commentScanner=new a(this.whitespacesVisible);this._whitespaceScanner=new g;"css"===f&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=d;this.annotationModel=h;this._bracketAnnotations=void 0;var m=this;this._listener=
{onChanged:function(a){m._onModelChanged(a)},onDestroy:function(a){m._onDestroy(a)},onLineStyle:function(a){m._onLineStyle(a)},onMouseDown:function(a){m._onMouseDown(a)},onSelection:function(a){m._onSelection(a)}};f=d.getModel();f.getBaseModel&&(f=f.getBaseModel());f.addEventListener("Changed",this._listener.onChanged);d.addEventListener("MouseDown",this._listener.onMouseDown);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();d.redrawLines()}var l=m.keywords,c=h.keywords,n=d.keywords,q={styleClass:"comment"},s={styleClass:"comment"},u={styleClass:"comment block documentation"},r={styleClass:"keyword other documentation markup"},t={styleClass:"keyword other documentation task"},v={styleClass:"keyword other documentation tag"},w={styleClass:"string"},A={styleClass:"constant numeric"},x={styleClass:"keyword"},z={styleClass:"punctuation separator space",
unmergeable:!0},p={styleClass:"punctuation separator tab",unmergeable:!0},y={styleClass:"meta annotation currentLine"};b.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}};g.prototype=new b(null);g.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}}};a.prototype=new b(null);a.prototype.setType=function(a){this._type=a};a.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}}};e.prototype=new b(null);e.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};f.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 l=g.next();l.type===h&&e.push(l)}g=[];l=this._commentScanner;l.setText(f.getText(b,c));for(var m;m=l.nextToken();){var n=l.getStartOffset()+b;14===m&&(m=f.getLineEnd(f.getLineAtOffset(n)),6!==a&&(m=Math.min(m,c-this.commentEnd.length)),g.push(k.AnnotationType.createAnnotation(h,n,m,f.getText(n,m))))}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 y}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 l=g[h].start,k=g[h].end;f<l&&this._parse(b.substring(f-c,l-c),f,e);var m=g[h].type,n;switch(m){case 8:n=u;break;case 7:n=s;break;case 5:n=w}f=Math.max(f,
l);l=Math.min(d,k);(8===m||7===m)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,l-c),f,e,n,m):5===m&&this.whitespacesVisible?this._parseString(b.substring(f-c,l-c),f,e,w):e.push({start:f,end:l,style:n});f=k}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=x;break;case 3:f=A;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,w);continue}else f=w;break;case 8:this._parseComment(d.getData(),e,c,u,a);continue;case 6:this._parseComment(d.getData(),e,c,q,a);continue;case 7:this._parseComment(d.getData(),e,c,s,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=z)}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=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=z);break;case 12:g=r;break;case 13:g=v;break;case 14:g=t;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=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=z)}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),l=a.getLineEnd(g),c=this._findBrackets(d,f,c,h,h,l),l=0;l<c.length;l++)if(h=0<=c[l]?1:-1,c[l]*h-1===b){var k=1;if(e&1){for(l--;0<=l;l--)if(h=0<=c[l]?1:-1,k+=h,0===k)return c[l]*h-1;for(g-=1;0<=g;){c=a.getLine(g);h=a.getLineStart(g);l=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,l);for(e=c.length-1;0<=e;e--)if(h=0<=c[e]?1:-1,k+=h,0===k)return c[e]*h-1;g--}}else{for(l++;l<c.length;l++)if(h=0<=c[l]?1:-1,k+=h,0===k)return c[l]*
h-1;g+=1;for(e=a.getLineCount();g<e;){c=a.getLine(g);h=a.getLineStart(g);l=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,l);for(l=0;l<c.length;l++)if(h=0<=c[l]?1:-1,k+=h,0===k)return c[l]*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,l=this._scanner,k,m=this.comments,n=this._binarySearch(m,e,!0);n<m.length&&!(m[n].start>=f);n++){k=m[n].start;var p=m[n].end;if(h<k)for(l.setText(c.substring(h-e,k-e));k=l.nextToken();)k===a?g.push(l.getStartOffset()+
h-e+d+1):k===b&&g.push(-(l.getStartOffset()+h-e+d+1));h=p}if(h<f)for(l.setText(c.substring(h-e,f-e));k=l.nextToken();)k===a?g.push(l.getStartOffset()+h-e+d+1):k===b&&g.push(-(l.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,l;if(c.start===c.end&&0<(l=d.getCaretOffset()))l-=1,a.getBaseModel&&(l=a.mapOffset(l),a=a.getBaseModel()),a=this._findMatchingBracket(a,l),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,l,l+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,l=f.getLineStart(f.getLineAtOffset(b)),m=this._binarySearch(this.comments,l,!0),n=this._binarySearch(this.comments,c,!1,m-1,h);m<h&&this.comments[m].start<=l&&l<this.comments[m].end?(l=this.comments[m].start,l>b&&(l+=d)):l=m===h&&0<h&&g-d===this.comments[h-1].end?this.comments[h-1].start:l;var p;n<h?(p=this.comments[n].end,p>b&&(p+=d),
n+=1):(n=h,p=g);for(var g=f.getText(l,p),q,g=this._findComments(g,l),h=m;h<this.comments.length;h++)q=this.comments[h],q.start>b&&(q.start+=d),q.start>b&&(q.end+=d);var x=n-m!==g.length;if(!x)for(h=0;h<g.length;h++){q=this.comments[m+h];var y=g[h];if(q.start!==y.start||q.end!==y.end||q.type!==y.type){x=!0;break}}h=[m,n-m].concat(g);Array.prototype.splice.apply(this.comments,h);x&&(h=l,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;m=e.getAnnotations(l,p);l=[];for(p=[];m.hasNext();)if(q=m.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?(l.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(l,b)}}};return{TextStyler:f}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(k){function m(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=w(d,d.getText(this.start,this.end),this,this.start))}function d(a){this._styler=a}function b(a,b,c,e){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new m(c,e);this._accessor=new d(this);this._bracketAnnotations=void 0;var f=this;this._listener={onChanged:function(a){f._onModelChanged(a)},onDestroy:function(a){f._onDestroy(a)},
onLineStyle:function(a){f._onLineStyle(a)},onMouseDown:function(a){f._onMouseDown(a)},onSelection:function(a){f._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);e=c.getCharCount();this._rootBlock=
new h({start:0,contentStart:0,end:e,contentEnd:e},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(e=[],A(this._rootBlock,c,e),b.replaceAnnotations([],e));a.redrawLines()}var g={styleClass:"meta annotation currentLine"},a=/$/,e=/\\(\d)/g,f=/^\(\?i\)\s*/,l=/(.*)(?:[\r\n]|$)/g,c={regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},n={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},q=function(a,b,c,d){var e=c,f=
a.lastIndex;l.lastIndex=c;c=l.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=l.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=f;return null},s=function(a,b){var c=a.toString();e.lastIndex=0;if(!e.test(c))return a;
e.lastIndex=0;for(var d=e.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),e.lastIndex=0,d=e.exec(c);return RegExp(c.substring(1,c.length-1-1),"g")},u=function(a,b,c,d){if(b=q(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}},t=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})},v=function(b,c,d,e,f){if(b&&(d=d.getLinePatterns())){var g=[];d.forEach(function(a){var c=a.regex||a.regexBegin;c.oldLastIndex=c.lastIndex;(c=q(c,b,0))&&g.push({result:c,pattern:a})});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 l=g[0];g.splice(0,1);if(!(l.result.index<h)){var k=l.result.index,m,n=[];if(l.pattern.regex){h=l.result;m=k+h[0].length;m={start:c+k,end:c+m,style:l.pattern.pattern.name};if(!f){l.pattern.pattern.captures&&r(h,l.pattern.pattern.captures,c+k,n);n.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(k=0;k<n.length-1;k++)if(n[k+
1].start<n[k].end){var v={start:n[k+1].end,end:n[k].end,style:n[k].style};n[k].end=n[k+1].start;n.splice(k+2,0,v)}}t(m,n,e)}else h=l.pattern.regexEnd,h=s(h,l.result),(h=q(h,b,l.result.index+l.result[0].length))||(a.lastIndex=0,h=a.exec(b)),m=h.index+h[0].length,e.push({start:c+k,end:c+m,style:l.pattern.pattern.name});h=h.index+h[0].length}u(l,b,g,h)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},w=function(b,c,d,e){if(!c)return[];var f=[],g=[];d.getBlockPatterns().forEach(function(a){var b=
q(a.regexBegin||a.regex,c,0);b&&g.push({result:b,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 l=0;0<g.length;){var k=g[0];g.splice(0,1);if(!(k.result.index<l)){var l=e+k.result.index,m=k.result.index,n=null,r=k.pattern.regexEnd;if(r){var m=m+k.result[0].length,t=k.pattern,E=s(r,k.result);E!==r&&(t={pattern:t.pattern,regexBegin:t.regexBegin,regexEnd:E},
r=E);for(E=m;!n;){(E=q(r,c,E))||(a.lastIndex=0,E=a.exec(c));var J=new h({start:l,end:e+E.index+E[0].length,contentStart:e+m,contentEnd:e+E.index},t,d.getStyler(),b,d),v=J.getBlocks();if(!v.length||v[v.length-1].end<=E.index+e)n=J;E=E.index+E[0].length}}else n=new h({start:l,end:l+k.result[0].length,contentStart:l,contentEnd:l+k.result[0].length},k.pattern,d.getStyler(),b,d);f.push(n);l=n.end-e}u(k,c,g,l)}return f},A=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=[];v(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){A(a,b,c)}.bind(this))}};m.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 b=f.exec(a),c="g";b&&(a=a.substring(b[0].length),c+="i");return RegExp(a,
c)},b=-1,c=0;this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(d){var e;if(d.match&&!d.begin&&!d.end){if(e={regex:a(d.match),pattern:d},this._linePatterns.push(e),d.name&&0===d.name.indexOf("punctuation.section")&&(-1!==d.name.indexOf(".begin")||-1!==d.name.indexOf(".end")))this._enclosurePatterns[d.name]=e}else!d.match&&d.begin&&d.end&&(b=c,e={regexBegin:a(d.begin),regexEnd:a(d.end),pattern:d},this._linePatterns.push(e));c++}.bind(this));this._blockPatterns=
this._linePatterns.slice(0,b+1);this.pattern&&(this.pattern.pattern._enclosurePatterns=this._enclosurePatterns,this.pattern.pattern._linePatterns=this._linePatterns,this.pattern.pattern._blockPatterns=this._blockPatterns)}}};d.prototype={getPatterns:function(a){return this._styler.getPatterns(a)},getStyles:function(a){return this._styler.getStyles(a)}};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}},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=[];v(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=[],l=e,k=c.getBlocks(),m=this._binarySearch(k,e,!0);m<k.length&&!(k[m].start>=f);m++){var n=k[m].start,q=k[m].end;l<n&&(v(d.substring(l-e,n-e),l,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=[]);l=q}l<f&&(v(d.substring(l-e,f-e),l,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(),l=Object.keys(h),k=0;k<l.length;k++){var m=h[l[k]],n=q(m.regex,f,0);if(n&&0===n.index){g=m;break}}if(!g)return-1;f=!1;-1!==g.pattern.name.indexOf(".begin")?(f=!0,k=g.pattern.name.replace(".begin",
".end")):k=g.pattern.name.replace(".end",".begin");h=h[k];if(!h)return-1;l=a.getLine(d);m=a.getLineStart(d);e=this._findBrackets(g,h,b,l,m,e);for(k=0;k<e.length;k++)if(l=0<=e[k]?1:-1,e[k]*l-1===c){c=1;if(f){for(k++;k<e.length;k++)if(l=0<=e[k]?1:-1,c+=l,0===c)return e[k]*l-1;d+=1;for(k=a.getLineCount();d<k;){l=a.getLine(d);m=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,l,m,e);for(f=0;f<e.length;f++)if(l=0<=e[f]?1:-1,c+=l,0===c)return e[f]*l-1;d++}}else{for(k--;0<=k;k--)if(l=0<=e[k]?
1:-1,c+=l,0===c)return e[k]*l-1;for(d-=1;0<=d;){l=a.getLine(d);m=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,l,m,e);for(k=e.length-1;0<=k;k--)if(l=0<=e[k]?1:-1,c+=l,0===c)return e[k]*l-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 g}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(),l=this._binarySearch(h,d,!0);l<h.length&&!(h[l].start>=e);l++){var k=h[l].start,m=h[l].end;g<k&&v(c.substring(g-d,k-d),g,a,f);var n=Math.max(g,k);if(n===k&&h[l].pattern.regexBegin){var E=q(h[l].pattern.regexBegin,c.substring(n-d),0);if(E){var J=h[l].pattern.pattern.beginCaptures||h[l].pattern.pattern.captures;J?r(E,J,n,f):f.push({start:n,end:n+E[0].length,style:h[l].pattern.pattern.name});
n+=E[0].length}}var k=Math.min(e,m),s=[];if(k===m&&h[l].pattern.regexEnd&&(g=c.substring(k-g-(h[l].end-h[l].contentEnd)),E=q(h[l].pattern.regexEnd,g,0)))(J=h[l].pattern.pattern.endCaptures||h[l].pattern.pattern.captures)?r(E,J,k-E[0].length,s):h[l].pattern.pattern.name&&s.push({start:k-E[0].length,end:k,style:h[l].pattern.pattern.name}),k-=E[0].length;var g=this._getStyles(h[l],b,c.substring(n-d,k-d),n),u=h[l].pattern.pattern.contentName||h[l].pattern.pattern.name;if(u){var t=n;g.forEach(function(a){a.start-
t&&f.push({start:t,end:a.start,style:u});f.push(a);t=a.end});k-t&&f.push({start:t,end:k,style:u})}else f=f.concat(g);f=f.concat(s);g=m}g<e&&v(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(a){a.textView===this.view&&(a.style=
this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(this._rootBlock,a.textView.getModel(),a.lineText,a.lineStart);a.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(c,a.ranges,a.lineText,a.lineStart),this.tabsVisible&&this._spliceStyles(n,a.ranges,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,l;if(c.start===c.end&&0<(l=d.getCaretOffset()))l-=1,a.getBaseModel&&(l=a.mapOffset(l),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,l),a=this._findMatchingBracket(a,c,l),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,
a+1),k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,l,l+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(),l=h.length,m=f.getLineStart(f.getLineAtOffset(b)),n=this._binarySearch(h,m,!0),q=this._binarySearch(h,c,!1,n-1,l),E;n<l&&h[n].start<=m&&m<h[n].end?(E=h[n].start,E>b&&(E+=a)):E=n===l&&0<l&&g-a===h[l-1].end?h[l-1].start:m;var J;do q<l?(J=h[q].end,J>b&&(J+=a),q+=1):
(q=l,J=g),m=f.getText(E,J),m=w(f,m,this._rootBlock,E);while(m.length&&h.length&&q<l&&m[m.length-1].pattern.pattern.id!==h[q-1].pattern.pattern.id);for(g=n;g<h.length;g++)l=h[g],l.start>b&&l.adjustStart(a),l.start>b&&l.adjustEnd(a);var r=q-n!==m.length;if(!r)for(g=0;g<m.length;g++){var l=h[n+g],s=m[g];if(l.start!==s.start||l.end!==s.end||l.type!==s.type){r=!0;break}}g=[n,q-n].concat(m);Array.prototype.splice.apply(h,g);r&&(g=E,l=J,e!==f&&(g=e.mapOffset(g,!0),l=e.mapOffset(l,!0)),d.redrawRange(g,l));
if(this.annotationModel){d=[];h=[];n=[];E=this.annotationModel.getAnnotations(E,J);for(J=this.foldingEnabled&&f!==e;E.hasNext();)if(l=E.next(),J&&l.type===k.AnnotationType.ANNOTATION_FOLDING){n.push(l);for(g=0;g<m.length&&!(l.start===m[g].start&&l.end===m[g].end);g++);g===m.length?(d.push(l),l.expand()):(g=l.start,q=l.end,g>b&&(g-=a),q>b&&(q-=a),g<=b&&b<q&&g<=c&&c<q&&(g=f.getLineAtOffset(l.start),q=f.getLineAtOffset(l.end),g!==q?l.expanded||l.expand():this.annotationModel.removeAnnotation(l)));for(g=
0;g<m.length;g++){l=m[g];for(q=0;q<n.length&&!(n[q].start===l.start&&n[q].end===l.end);q++);q===n.length&&(l=this._createFoldingAnnotation(e,f,l.start,l.end))&&h.push(l)}}else l.type===k.AnnotationType.ANNOTATION_TASK&&d.push(l);if(this.detectTasks)for(g=0;g<m.length;g++)A(m[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 l={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,l);b.splice(f+1,0,h);f+=2}else b.splice(f,0,h),f++;g=e.exec(c)}}};return{TextStyler:b}});
define("orion/editor/textMateStyler",["orion/regex"],function(k){function m(b){var d;if(b instanceof Array){d=Array(b.length);for(var a=0;a<b.length;a++)d[a]=m(b[a])}else for(a in d={},b)if(Object.prototype.hasOwnProperty.call(b,a)){var e=b[a];d[a]="object"===typeof e&&null!==e?m(e):e}return d}function h(b,d,a){this.initialize(b);this.grammar=m(d);this.externalGrammars=a?m(a):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var d={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(b){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(b){return"\x3d"===b[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(b){return"atomic group"}}],toRegExp:function(b){function g(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var a="",e;b=d.processGlobalFlag("x",b,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var g=a.charAt(f);if(!d&&"#"===g)for(;f<e&&"\r"!==g&&"\n"!==g;)g=a.charAt(++f);
else if(!d&&/\s/.test(g))for(;f<e&&/\s/.test(g);)g=a.charAt(++f);else"\\"===g?(b+=g,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):("["===g?d=!0:"]"===g&&(d=!1),b+=g),f+=1}return b});b=d.processGlobalFlag("i",b,function(b){a+="i";return b});for(e=0;e<this.unsupported.length;e++){var f;(f=this.unsupported[e].regex.exec(b))&&g(this.unsupported[e].func(f),f)}return RegExp(b,a)},processGlobalFlag:function(b,d,a){var e="(?"+b+")";b="(?"+b+":";if(d.substring(0,e.length)===e)return a(d.substring(e.length));
if(d.substring(0,b.length)===b){for(var e=0,f=d.length,h=-1,c=0;c<f&&-1===h;c++)switch(d.charAt(c)){case "\\":c++;break;case "(":e++;break;case ")":e--,0===e&&(h=c)}e=h;if(e<d.length-1)throw Error("Only a "+b+") group that encloses the entire regex is supported in: "+d);return a(d.substring(b.length,e))}return d},hasBackReference:function(b){return/\\\d+/.test(b.source)},getSubstitutedRegex:function(b,d,a){a="undefined"===typeof a?!0:!1;b=b.source.split(/(\\\d+)/g);for(var e=[],f=0;f<b.length;f++){var h=
b[f],c=/\\(\d+)/.exec(h);c?(h=d[c[1]]||"",e.push(a?k.escape(h):h)):e.push(h)}return RegExp(e.join(""))},groupify:function(b,d){for(var a=b.source,e=a.length,f=[],h=0,c=[],k=1,m=1,s=[],u={},r={},t=0;t<e;t++){var v=f[f.length-1],w=a.charAt(t);switch(w){case "(":4===v&&(f.pop(),s.push(")"),c[c.length-1].end=t);var A=t+2<e?a.charAt(t+1)+""+a.charAt(t+2):null;if("?:"===A||"?\x3d"===A||"?!"===A){var x;"?:"===A?x=1:(x=3,h++);f.push(x);c.push({start:t,end:-1,type:x});s.push(w);s.push(A);t+=A.length}else f.push(2),
c.push({start:t,end:-1,type:2,oldNum:k,num:m}),s.push(w),0===h&&(r[m]=null),u[k]=m,k++,m++;break;case ")":v=f.pop();3===v&&h--;c[c.length-1].end=t;s.push(w);break;case "*":case "+":case "?":case "}":var z=w,p=a.charAt(t-1),A=t-1;if("}"===w){for(x=t-1;"{"!==a.charAt(x)&&0<=x;x--);p=a.charAt(x-1);A=x-1;z=a.substring(x,t+1)}x=c[c.length-1];if(")"===p&&(2===x.type||4===x.type)){s.splice(x.start,0,"(");s.push(z);s.push(")");w={start:x.start,end:s.length-1,type:4,num:x.num};for(p=0;p<c.length;p++)if(v=
c[p],(2===v.type||4===v.type)&&v.start>=x.start&&v.end<=A)v.start+=1,v.end+=1,v.num+=1,2===v.type&&(u[v.oldNum]=v.num);c.push(w);m++;break}default:"|"!==w&&2!==v&&4!==v&&0===h&&(f.push(4),c.push({start:t,end:-1,type:4,num:m}),s.push("("),r[m]=null,m++),s.push(w),"\\"===w&&(w=a.charAt(t+1),s.push(w),t+=1)}}for(;f.length;)f.pop(),s.push(")");a=RegExp(s.join(""));e={};d=d||u;for(var y in d)d.hasOwnProperty(y)&&(e[y]="\\"+d[y]);a=this.getSubstitutedRegex(a,e,!1);return[a,u,r]},complexCaptures:function(b){if(!b)return!1;
for(var d in b)if(b.hasOwnProperty(d)&&"0"!==d)return!0;return!1}};h.prototype={initialize:function(b){this.textView=b;this.textView.stylerOptions=this;var d=this;this._listener={onModelChanged:function(a){d.onModelChanged(a)},onDestroy:function(a){d.onDestroy(a)},onLineStyle:function(a){d.onLineStyle(a)},onStorage:function(a){d.onStorage(a)}};b.addEventListener("ModelChanged",this._listener.onModelChanged);b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("LineStyle",this._listener.onLineStyle);
b.redrawLines()},onDestroy:function(b){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(b){for(b=[b];0!==b.length;){var d=b.pop();if(!d._resolvedRule||!d._typedRule)if(d._resolvedRule=
this._resolve(d),d._typedRule=this._createTypedRule(d),this.addStyles(d.name),this.addStyles(d.contentName),this.addStylesForCaptures(d.captures),this.addStylesForCaptures(d.beginCaptures),this.addStylesForCaptures(d.endCaptures),d._resolvedRule!==d&&b.push(d._resolvedRule),d.patterns)for(var a=0;a<d.patterns.length;a++)b.push(d.patterns[a])}},addStyles:function(b){if(b&&!this._styles[b]){this._styles[b]=[];for(var d=b.split("."),a=0;a<d.length;a++)this._styles[b].push(d.slice(0,a+1).join("-"))}},
addStylesForCaptures:function(b){for(var d in b)b.hasOwnProperty(d)&&this.addStyles(b[d].name)},ContainerRule:function(){function b(b){this.rule=b;this.subrules=b.patterns}b.prototype.valueOf=function(){return"aa"};return b}(),BeginEndRule:function(){function b(b){this.rule=b;this.beginRegex=d.toRegExp(b.begin);this.endRegex=d.toRegExp(b.end);this.subrules=b.patterns||[];this.endRegexHasBackRef=d.hasBackReference(this.endRegex);var a=d.complexCaptures(b.captures);b=d.complexCaptures(b.beginCaptures)||
d.complexCaptures(b.endCaptures);if(this.isComplex=a||b)a=d.groupify(this.beginRegex),this.beginRegex=a[0],this.beginOld2New=a[1],this.beginConsuming=a[2],a=d.groupify(this.endRegex,this.beginOld2New),this.endRegex=a[0],this.endOld2New=a[1],this.endConsuming=a[2]}b.prototype.valueOf=function(){return this.beginRegex};return b}(),MatchRule:function(){function b(b){this.rule=b;this.matchRegex=d.toRegExp(b.match);if(this.isComplex=d.complexCaptures(b.captures))b=d.groupify(this.matchRegex),this.matchRegex=
b[0],this.matchOld2New=b[1],this.matchConsuming=b[2]}b.prototype.valueOf=function(){return this.matchRegex};return b}(),_createTypedRule:function(b){return b.match?new this.MatchRule(b):b.begin?new this.BeginEndRule(b):new this.ContainerRule(b)},_resolve:function(b){var d=b;if(b.include){if(b.begin||b.end||b.match)throw Error('Unexpected regex pattern in "include" rule '+b.include);b=b.include;if("#"===b.charAt(0)){if(d=this.grammar.repository&&this.grammar.repository[b.substring(1)],!d)throw Error("Couldn't find included rule "+
b+" in grammar repository");}else if("$self"===b)d=this.grammar;else{if("$base"===b)throw Error('Include "$base" is not supported');d=this._allGrammars[b];if(!d)for(var a=0;a<this.externalGrammars.length;a++){var e=this.externalGrammars[a];if(e.scopeName===b){this.preprocess(e);d=this._allGrammars[b]=e;break}}}}return d},ContainerNode:function(){function b(b,a){this.parent=b;this.rule=a;this.children=[];this.end=this.start=null}b.prototype.addChild=function(b){this.children.push(b)};b.prototype.valueOf=
function(){var b=this.rule;return"ContainerNode { "+(b.include||"")+" "+(b.name||"")+(b.comment||"")+"}"};return b}(),BeginEndNode:function(){function b(b,a,e){this.parent=b;this.rule=a;this.children=[];this.setStart(e);this.endMatch=this.end=null;this.endRegexSubstituted=a.endRegexHasBackRef?d.getSubstitutedRegex(a.endRegex,e):null}b.prototype.addChild=function(b){this.children.push(b)};b.prototype.getIndexInParent=function(b){return this.parent?this.parent.children.indexOf(this):-1};b.prototype.setStart=
function(b){this.start=b.index;this.beginMatch=b};b.prototype.setEnd=function(b){b&&"object"===typeof b?(this.endMatch=b,this.end=b.index+b[0].length):(this.endMatch=null,this.end=b)};b.prototype.shiftStart=function(b){this.start+=b;this.beginMatch.index+=b};b.prototype.shiftEnd=function(b){this.end+=b;this.endMatch&&(this.endMatch.index+=b)};b.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return b}(),push:function(b,d){if(d)for(var a=d.length;0<
a;)b.push(d[--a])},exec:function(b,d,a){if(d=b.exec(d))d.index+=a;b.lastIndex=0;return d},afterMatch:function(b){return b.index+b[0].length},getEndMatch:function(b,d,a){if(b instanceof this.BeginEndNode){var e=b.rule;b=b.endRegexSubstituted||e.endRegex;return!b?null:this.exec(b,d,a)}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(b){var d=b.addedCharCount,
a=b.removedCharCount;b=b.start;if(this._tree){var e=this.textView.getModel(),f=e.getCharCount(),e=e.getLineEnd(e.getLineAtOffset(b)-1),h=this.getFirstDamaged(e,e),e=-1===e?0:e,d=h?this.parse(h,!0,e,b,d,a):f;this.textView.redrawRange(e,d)}else this.initialParse()},getFirstDamaged:function(b,d){if(0>b)return this._tree;for(var a=[this._tree],e=null;a.length;){var f=a.pop();if(!f.parent||this.isDamaged(f,b,d)){f instanceof this.BeginEndNode&&(e=f);for(var h=0;h<f.children.length;h++)a.push(f.children[h])}}return e||
this._tree},isDamaged:function(b,d,a){return b.start<=a&&b.end>d},parse:function(b,d,a,e,f,h){var c=this.textView.getModel(),k=c.getLineStart(c.getLineCount()-1),m=c.getCharCount(),s=this.getInitialExpected(b,a),u=-1;d&&(b.repaired=!0,b.endNeedsUpdate=!0,u=(u=b.children[b.children.length-1])?c.getLineEnd(c.getLineAtOffset(u.end+(f-h))):-1,e=c.getLineEnd(c.getLineAtOffset(e+h)),u=Math.max(u,e));u=-1===u?m:u;e=s;for(var r=b,t=!1,v=a,w=-1;r&&(!d||v<u);){var A=this.getNextMatch(c,r,v);A||(v=v>=k?m:c.getLineStart(c.getLineAtOffset(v)+
1));var x=A&&A.match,z=A&&A.rule,p=A&&A.isEnd;if(A&&A.isSub)v=this.afterMatch(x),z instanceof this.BeginEndRule&&(t=!0,d&&z===e.rule&&r===e.parent?(r=e,r.setStart(x),r.repaired=!0,r.endNeedsUpdate=!0,e=this.getNextExpected(e,"begin")):(d&&(this.prune(r,e),d=!1),x=new this.BeginEndNode(r,z,x),r.addChild(x),r=x));else if(p||v===m)r instanceof this.BeginEndNode&&(x?(t=!0,w=Math.max(w,r.end),r.setEnd(x),v=this.afterMatch(x),d&&r===e&&r.parent===e.parent?(r.repaired=!0,delete r.endNeedsUpdate,e=this.getNextExpected(e,
"end")):d&&(this.prune(r,e),d=!1)):(r.setEnd(m),delete r.endNeedsUpdate)),r=r.parent;d&&v>=u&&!t&&(this.prune(b,s),d=!1)}this.removeUnrepairedChildren(b,d,a);this.cleanup(d,b,a,u,m,f,h);return d?Math.max(w,v):v},removeUnrepairedChildren:function(b,d,a){if(d){d=b.children;for(var e=-1,f=0;f<d.length;f++){var h=d[f];if(!h.repaired&&this.isDamaged(h,a,Number.MAX_VALUE)){e=f;break}}-1!==e&&(b.children.length=e)}},cleanup:function(b,d,a,e,f,h,c){if(b){b=h-c;f=this.getIntersecting(e-b+1,f);d=this.getIntersecting(a,
e);for(a=0;a<f.length;a++)e=f[a],!e.repaired&&e instanceof this.BeginEndNode&&(e.shiftEnd(b),e.shiftStart(b));for(a=0;a<d.length;a++)e=d[a],e.repaired&&e.endNeedsUpdate&&e.shiftEnd(b),delete e.endNeedsUpdate,delete e.repaired}else{d=this.getIntersecting(a,e);for(a=0;a<d.length;a++)delete d[a].repaired}},getNextMatch:function(b,d,a,e){var f=b.getLineAtOffset(a),f=b.getLineEnd(f),h=b.getText(a,f),c=[],k=[];b=[];f=[];for(this.push(c,d.rule.subrules);c.length;){var m=c.length?c.pop():null,m=m&&m._resolvedRule._typedRule;
if(m instanceof this.ContainerRule&&-1===k.indexOf(m))k.push(m),this.push(c,m.subrules);else if(!m||!e||m.matchRegex){var s=m&&this.exec(m.matchRegex||m.beginRegex,h,a);s&&(b.push(s),f.push(m))}}c=Number.MAX_VALUE;k=-1;for(m=0;m<b.length;m++)s=b[m],s.index<c&&(c=s.index,k=m);if(!e&&(a=this.getEndMatch(d,h,a)))if(e=d.rule.applyEndPatternLast,-1===k||a.index<c||!e&&a.index===c)return{isEnd:!0,rule:d.rule,match:a};return-1===k?null:{isSub:!0,rule:f[k],match:b[k]}},getInitialExpected:function(b,d){var a,
e;if(b===this._tree)for(a=0;a<b.children.length;a++){if(e=b.children[a],e.start>=d)return e}else if(b instanceof this.BeginEndNode&&b.endMatch){var f=b.endMatch.index;for(a=0;a<b.children.length&&!(e=b.children[a],e.start>=d);a++);if(e&&e.start<f)return e}return b},getNextExpected:function(b,d){if("begin"===d){var a=b.children[0];return a?a:b}if("end"===d&&(a=b.parent)){var e=a.children[a.children.indexOf(b)+1];return e?e:a}return null},prune:function(b,d){d.parent===b?b.children.length=d.getIndexInParent():
b instanceof this.BeginEndNode&&(b.endMatch=null,b.end=null);b.parent&&(b.parent.children.length=b.getIndexInParent()+1)},onLineStyle:function(b){this._tree||this.initialParse();var d=b.lineStart,a=this.textView.getModel(),e=a.getLineEnd(b.lineIndex),f=a.getLineEnd(a.getLineAtOffset(d)-1),f=this.getFirstDamaged(f,f),d=this.getLineScope(a,f,d,e);b.ranges=this.toStyleRanges(d);b.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(b,d,a,e){for(var f=a,h=this.getInitialExpected(d,
a),c=[],k=[];d&&f<e;){var m=this.getNextMatch(b,d,f);if(!m)break;var s=m&&m.match,u=m&&m.rule,r=m&&m.isSub,m=m&&m.isEnd;s.index!==f&&k.push({start:f,end:s.index,node:d});r?(f=this.afterMatch(s),u instanceof this.BeginEndRule?(this.addBeginScope(c,s,u),d=h,h=this.getNextExpected(h,"begin")):this.addMatchScope(c,s,u)):m&&(f=this.afterMatch(s),this.addEndScope(c,s,u),h=this.getNextExpected(h,"end"),d=d.parent)}f<e&&k.push({start:f,end:e,node:d});b=this.getInheritedLineScope(k,a,e);return c.concat(b)},
getInheritedLineScope:function(b,d,a){d=[];for(a=0;a<b.length;a++)for(var e=b[a],f=e.node;f;){var h=f.rule.rule,c=h.name;if(h=h.contentName||c){this.addScopeRange(d,e.start,e.end,h);break}f=f.parent}return d},addBeginScope:function(b,d,a){var e=a.rule;this.addCapturesScope(b,d,e.beginCaptures||e.captures,a.isComplex,a.beginOld2New,a.beginConsuming)},addEndScope:function(b,d,a){var e=a.rule;this.addCapturesScope(b,d,e.endCaptures||e.captures,a.isComplex,a.endOld2New,a.endConsuming)},addMatchScope:function(b,
d,a){var e=a.rule,f=e.name;(e=e.captures)?this.addCapturesScope(b,d,e,a.isComplex,a.matchOld2New,a.matchConsuming):this.addScope(b,d,f)},addScope:function(b,d,a){a&&b.push({start:d.index,end:this.afterMatch(d),scope:a})},addScopeRange:function(b,d,a,e){e&&b.push({start:d,end:a,scope:e})},addCapturesScope:function(b,d,a,e,f,h){if(a)if(e){e={1:0};for(var c=0,k=1;void 0!==d[k];k++)void 0!==h[k]&&(c+=d[k].length),void 0!==d[k+1]&&(e[k+1]=c);h=d.index;for(c=1;a[c];c++){var k=a[c].name,m=f[c],s=h+e[m];
"undefined"!==typeof d[m]&&this.addScopeRange(b,s,s+d[m].length,k)}}else this.addScope(b,d,a[0]&&a[0].name)},getIntersecting:function(b,d){for(var a=[],e=this._tree?[this._tree]:[];e.length;){var f=e.pop(),h=!1;f instanceof this.ContainerNode?h=!0:this.isDamaged(f,b,d)&&(h=!0,a.push(f));if(h)for(var h=f.children.length,c=0;c<h;c++)e.push(f.children[c])}return a.reverse()},toStyleRanges:function(b){for(var d=[],a=0;a<b.length;a++){var e=b[a],f=this._styles[e.scope];if(!f)throw Error("styles not found for "+
e.scope);f=f.join(" ");d.push({start:e.start,end:e.end,style:{styleClass:f}})}return d}};return{RegexUtil:d,TextMateStyler:h}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(k,m){function h(a){return-1!==a.getProperty("objectClass").indexOf(b)&&"highlighter"===a.getProperty("type")}function d(a,b,d){this.initialize(a,b,d);this.lineStyles=[]}var b="orion.edit.highlighter",g=b+" service must be an event emitter";m.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
d.prototype={initialize:function(a,d,f){this.textView=a;this.serviceRegistry=d;this.annotationModel=f;this.services=[];var g=this;this.listener={onModelChanging:function(a){g.onModelChanging(a)},onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStyleReady:function(a){g.onStyleReady(a)},onServiceAdded:function(a){g.onServiceAdded(a.serviceReference,g.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){g.onServiceRemoved(a.serviceReference,
g.serviceRegistry.getService(a.serviceReference))}};a.addEventListener("ModelChanging",this.listener.onModelChanging);a.addEventListener("ModelChanged",this.listener.onModelChanged);a.addEventListener("Destroy",this.listener.onDestroy);a.addEventListener("LineStyle",this.listener.onLineStyle);d.addEventListener("registered",this.listener.onServiceAdded);d.addEventListener("unregistering",this.listener.onServiceRemoved);a=d.getServiceReferences(b);for(f=0;f<a.length;f++){var c=a[f];h(c)&&this.addServiceListener(d.getService(c))}},
onDestroy:function(a){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 a=0;a<this.services.length;a++)this.removeServiceListener(this.services[a]);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(a){this.startLine=this.textView.getModel().getLineAtOffset(a.start)},onModelChanged:function(a){var b=this.startLine;(a.addedLineCount||a.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[b,a.removedLineCount].concat(this._getEmptyStyle(a.addedLineCount)))},
onStyleReady:function(a){var b=a.lineStyles||a.style;a=Number.MAX_VALUE;var d=-1,g=this.textView.getModel(),c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&(this.lineStyles[c]=b[c],a=Math.min(a,c),d=Math.max(d,c));a=Math.max(a,0);d=Math.min(d,g.getLineCount());if(b=this.annotationModel){for(var h=b.getAnnotations(g.getLineStart(a),g.getLineEnd(d)),k=[];h.hasNext();){var s=h.next();"orion.annotation.highlightError"===s.type&&k.push(s)}h=[];for(s=a;s<=d;s++){c=s;var u=this.lineStyles[c],u=u&&
u.errors;c=g.getLineStart(c);if(u)for(var r=0;r<u.length;r++){var t=u[r];h.push(m.AnnotationType.createAnnotation("orion.annotation.highlightError",t.start+c,t.end+c))}}b.replaceAnnotations(k,h)}this.textView.redrawLines(a,d+1)},onLineStyle:function(a){var b=this.lineStyles[a.lineIndex];if(b)if(b.ranges){for(var b=b.ranges,d=a.lineStart,g=b.length,c=[],h=0;h<g;h++){var k=b[h];c.push({start:k.start+d,end:k.end+d,style:k.style})}a.ranges=c}else b.style&&(a.style=b.style)},_getEmptyStyle:function(a){for(var b=
[],d=0;d<a;d++)b.push(null);return b},setContentType:function(a){this.contentType=a;if(this.services)for(a=0;a<this.services.length;a++){var b=this.services[a];if(b.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}},onServiceAdded:function(a,b){h(a)&&this.addServiceListener(b)},onServiceRemoved:function(a,
b){-1!==this.services.indexOf(b)&&this.removeServiceListener(b)},addServiceListener:function(a){if("function"===typeof a.addEventListener){if(a.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(a),a.setContentType&&this.contentType){var b=this.serviceRegistry.getService("orion.page.progress");b?b.progress(a.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):a.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(g))},removeServiceListener:function(a){"function"===typeof a.removeEventListener?(a.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),a=this.services.indexOf(a),-1!==a&&this.services.splice(a,1)):"undefined"!==typeof console&&console.log(Error(g))}};return d});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(k,m,h,d,b){function g(a,g,c,n,q,s,u){function r(a,d){var e=a.getProperty("contentType")||a.getProperty("contentTypes"),f=a.getProperty("fileTypes");return e?b.when(g.isSomeExtensionOf(c,e)).then(function(b){return b?a:null}):d&&f&&-1!==f.indexOf(d)?(e=new b,e.resolve(a),e):null}function t(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new k.TextStyler(n,"js",q);break;case "text/x-java-source":b=new k.TextStyler(n,"java",q);break;case "text/css":b=new k.TextStyler(n,"css",q)}return b}if(!e){var v=t(c);if(v)return s=new b,s.resolve(v),s}e&&!this.orionGrammars&&(this.orionGrammars={});v=s&&s.split(".").pop().toLowerCase();s=a.getServiceReferences("orion.edit.highlighter");for(var w=[],A=[],x=0;x<s.length;x++){var z=s[x],p=z.getProperty("type");"grammar"===p||!e&&"undefined"===typeof p?w.push(z.getProperty("grammar")):"highlighter"!==
p&&(p=z.getProperty("id"))&&!this.orionGrammars[p]&&(this.orionGrammars[p]={id:p,contentTypes:z.getProperty("contentTypes"),patterns:z.getProperty("patterns"),repository:z.getProperty("repository")});(z=r(z,v))&&A.push(z)}return b.all(A,function(a){return{_error:a}}).then(function(b){for(var g,l=b.length-1;0<=l;l--){var k=b[l];if(k&&!k._error&&(u||"highlighter"!==k.getProperty("type"))){g=k;break}}var p;if(g)if(b=g.getProperty("type"),"highlighter"===b)p=new d(n,a,q),p.setContentType(c);else if("grammar"===
b||!e&&"undefined"===typeof b)g=g.getProperty("grammar"),p=new h.TextMateStyler(n,g,w);else if(e){p=[];for(var r in this.orionGrammars)p.push(this.orionGrammars[r]);p=new m.TextStyler(n,q,p,g.getProperty("id"))}return p})}function a(a,b){this.serviceRegistry=a;this.contentTypeService=b;this.styler=null}var e=1;a.prototype={setup:function(a,b,c,d,e){e="undefined"===typeof e?!0:e;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var h=this;return g(this.serviceRegistry,this.contentTypeService?
this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),a,b,c,d,e).then(function(a){return h.styler=a})},getStyler:function(){return this.styler}};return{createStyler:g,SyntaxHighlighter:a}});
define("orion/searchExplorer","i18n!orion/search/nls/messages require orion/Deferred orion/webui/littlelib orion/contentTypes orion/i18nUtil orion/explorers/explorer orion/explorers/explorerNavHandler orion/fileClient orion/commands orion/searchUtils orion/globalSearch/search-features orion/compare/compareUIFactory orion/compare/compareView orion/highlight orion/explorers/navigationUtils orion/webui/tooltip orion/explorers/navigatorRenderer orion/extensionCommands".split(" "),function(k,m,h,d,b,g,
a,e,f,l,c,n,q,s,u,r,t,v,w){function A(a){(a=d.node(a))&&d.empty(a);return a}function x(a,b,c){(a=d.node(a))&&a.addEventListener(b,c,!1)}function z(a,b,c){if(b=d.node(b))"only"===c&&d.empty(b),b.appendChild(a)}function p(a,b,c,e){a=document.createElement(a);if(b)if(Array.isArray(b))for(var f=0;f<b.length;f++)a.classList.add(b[f]);else"string"===typeof b&&(a.className=b);c&&(a.id=c);(b=d.node(e))&&b.appendChild(a);return a}function y(a,b,c,d,e){a=p("a",a,b,d);a.href=c;e&&a.appendChild(document.createTextNode(e));
return a}function B(a,b,c,d){a=p("span",a,b,c);d&&a.appendChild(document.createTextNode(d));return a}function C(a){return!a?null:"file"===a.type?a:a.parent}function I(a){return"function"===typeof a.getValidFileList?a.getValidFileList():a.getListRoot().children}function H(a,b){this._init(a);this.explorer=b}function G(a,b){this._init(a);this.options=a;this.explorer=b}function K(a,b,c){this.parentId=a;this.reportList=b;this.resultModel=c;this.renderer=new G({checkbox:!1},this)}function F(a){this._syntaxHighlither=
new u.SyntaxHighlighter(a)}function D(a,c){this.registry=a;this._commandService=c;this.fileClient=new f.FileClient(this.registry);this.defaulRows=40;this._contentTypeService=new b.ContentTypeRegistry(this.registry);this.declareCommands()}H.prototype=new a.SelectionRenderer;H.prototype.initCheckboxColumn=function(a){if(this._useCheckboxSelection){a=p("th");var b=p("span",null,null,a);b.classList.add("selectionCheckmarkSprite");b.classList.add("core-sprite-check");this.getCheckedFunc&&(b.checked=this.getCheckedFunc(this.explorer.model.getListRoot()),
b.classList.toggle("core-sprite-check_on"));x(b,"click",function(a){this.onCheck(null,a.target,a.target.checked?!1:!0)}.bind(this));return a}};H.prototype.getCellHeaderElement=function(a){if(2<a)return null;var b,c;return 0!==a?(b=p("th"),c=p("h2","search_header",null,b),1===a?(a=this.explorer.model,a="function"===typeof a.getHeaderString?a.getHeaderString():k.Results,c.textContent=a):2===a&&(c.textContent=k.Location),b):p("th")};H.prototype.focus=function(){var a=d.node(this.explorer.getParentDivId());
window.setTimeout(function(){a.focus()},10)};H.prototype.staleFileElement=function(a,b){if(a.stale){var c=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null;r.removeNavGrid(c,d.node(this.getItemLinkId(a)));c=d.node(this.getFileSpanId(a));A(c);z(document.createTextNode(b?b:this.explorer.model.getFileName(a)),c,"last");c=d.node(this.getFileIconId(a));A(c)}else this.explorer._prepareFilter(a)};H.prototype.replaceFileElement=function(a){var b=a.totalMatches?this.explorer.model.getFileName(a)+
" ("+g.formatMessage(k["${0} matches"],a.totalMatches)+")":this.explorer.model.getFileName(a)+" ("+k["No matches"]+")";a.totalMatches?(a=d.node(this.getItemLinkId(a)),z(document.createTextNode(b),a,"only")):(a.stale=!0,this.staleFileElement(a,b))};H.prototype.replaceDetailIcon=function(a,b){if(!this.explorer.model.replaceMode()&&a&&"detail"===a.type){var c=d.node(this.getDetailIconId(a));c&&(A(c),c=B(null,null,c),c.classList.add("imageSprite"),"right"===b?c.classList.add("core-sprite-rightarrow"):
"left"===b?c.classList.add("core-sprite-leftarrow"):c.classList.add("core-sprite-none"))}};H.prototype.renderFileElement=function(a,b,d){var e=null;this.explorer.model._provideSearchHelper&&(e=this.explorer.model._provideSearchHelper());e=e?c.generateFindURLBinding(e.params,e.inFileQuery,null,e.params.replace,!0):null;e=v.createLink(null,{Location:a.location,Name:this.explorer.model._filterText?null:d},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,
{id:this.getItemLinkId(a)},e,{holderDom:this._lastFileIconDom});b.appendChild(e);r.addNavGrid(this.explorer.getNavDict(),a,e);if(this.explorer.model._filterText){a=p("span",null,null,e);b=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},d.toLowerCase(),!1);var f=[];f.push({name:d,startIndex:0,bold:!1,highlight:!1});b&&b.forEach(function(a){f=this._mergesingleSegment(f,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));
this._renderSegments(f,a)}};H.prototype.generateContextTip=function(a){for(var b=p("table"),c=0;c<a.context.length;c++){var d=p("tr",null,null,b);a.context[c].current?(d=p("td",null,null,d),d.noWrap=!0,d=p("span",null,null,d),this.generateDetailHighlight(a,d)):(d=p("td",null,null,d),d.noWrap=!0,d.textContent=a.context[c].context+"\u00a0")}return b};H.prototype._generateDetailSegments=function(a){for(var b=0,c=[],d=0;d<a.matches.length&&!(b>=a.lineString.length)&&(this.explorer.model.replaceMode()&&
d!==a.matchNumber||!(b!==a.matches[d].startIndex&&c.push({name:a.lineString.substring(b,a.matches[d].startIndex),startIndex:b,bold:!1,highlight:!1}),b=a.matches[d].length,c.push({name:a.lineString.substring(a.matches[d].startIndex,a.matches[d].startIndex+b),startIndex:a.matches[d].startIndex,bold:!0,highlight:!1}),b=a.matches[d].startIndex+b,this.explorer.model.replaceMode()));d++);b<a.lineString.length-1&&c.push({name:a.lineString.substring(b),startIndex:b,bold:!1,highlight:!1});return c};H.prototype._mergesingleSegment=
function(a,b){var c=[];a.forEach(function(a){var d=a.startIndex,e=a.startIndex+a.name.length;b.start>d&&b.end<e?(c.push({name:a.name.substring(0,b.start-d),startIndex:a.startIndex,bold:a.bold,highlight:!1}),c.push({name:a.name.substring(b.start-d,b.end-d),startIndex:b.start,bold:a.bold,highlight:!0}),c.push({name:a.name.substring(b.end-d),startIndex:b.end,bold:a.bold,highlight:!1})):b.start>d&&b.start<e?(c.push({name:a.name.substring(0,b.start-d),startIndex:a.startIndex,bold:a.bold,highlight:!1}),
c.push({name:a.name.substring(b.start-d),startIndex:b.start,bold:a.bold,highlight:!0})):d>=b.start&&e<=b.end?(a.highlight=!0,c.push(a)):b.end>d&&b.end<e?(c.push({name:a.name.substring(0,b.end-d),startIndex:a.startIndex,bold:a.bold,highlight:!0}),c.push({name:a.name.substring(b.end-d),startIndex:b.end,bold:a.bold,highlight:!1})):c.push(a)}.bind(this));return c};H.prototype._mergeFilteredSegments=function(a,b){if(!this.explorer.model._filterText)return a;var d=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),
searchStrLength:this.explorer.model._filterText.length},b.toLowerCase(),!1),e=a;d&&d.forEach(function(a){e=this._mergesingleSegment(e,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));return e};H.prototype._renderSegments=function(a,b){a.forEach(function(a){var c=a.bold?p("b",null,null,b):p("span",null,null,b);a.highlight&&c.classList.add("search-filter-text");z(document.createTextNode(a.name),c,"only")}.bind(this))};H.prototype.generateDetailHighlight=function(a,b,c){a=this.explorer.model.getDetailInfo(a);
var d=this._generateDetailSegments(a);c&&(d=this._mergeFilteredSegments(d,a.lineString));this._renderSegments(d,b)};H.prototype.renderDetailElement=function(a,b,c,d){b=this.getDetailElement(a,b,c);d&&this.renderDetailLineNumber(a,b);this.generateDetailHighlight(a,b,!0)};H.prototype.renderDetailLineNumber=function(a,b){var c=this.explorer.model.getDetailInfo(a),d=c.lineNumber+1;!this.explorer.model.replaceMode()||1>=c.matches.length?z(document.createTextNode(d+":"),b,"last"):z(document.createTextNode(d+
"("+(c.matchNumber+1)+"):"),b,"last")};H.prototype.getDetailElement=function(a,b,d){var e=this;b=null;this.explorer.model._provideSearchHelper&&(b=this.explorer.model._provideSearchHelper());b=b?c.generateFindURLBinding(b.params,b.inFileQuery,a.lineNumber,b.params.replace,!0):null;b=v.createLink(null,{Location:a.parent.location,Name:null},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,{id:this.getItemLinkId(a)},b,{});d.appendChild(b);r.addNavGrid(this.explorer.getNavDict(),
a,b);x(b,"click",function(){e.explorer.getNavHandler().cursorOn(a)});return p("span",null,null,b)};H.prototype.getRowActionElement=function(a){return d.node(this.getItemLinkId(a))};H.prototype.getLocationSpanId=function(a){return this.explorer.model.getId(a)+"_locationSpan"};H.prototype.getFileSpanId=function(a){return this.explorer.model.getId(a)+"_fileSpan"};H.prototype.getFileIconId=function(a){return this.explorer.model.getId(a)+"_fileIcon"};H.prototype.getItemLinkId=function(a){return"string"===
typeof a?a+"_itemLink":this.explorer.model.getId(a)+"_itemLink"};H.prototype.getDetailIconId=function(a){return this.explorer.model.getId(a)+"_detailIcon"};H.prototype.renderLocationElement=function(a,b){var e=b?b:d.node(this.getLocationSpanId(a));A(e);var f=this.explorer.model.getScopingParams(a),e=y("navlink",null,f.href,e,this.explorer.model._filterText?null:f.name);e.title=f.tooltip;r.addNavGrid(this.explorer.getNavDict(),a,e);var g=this;x(e,"click",function(){g.explorer.closeContextTip()});if(this.explorer.model._filterText){var e=
p("span",null,null,e),h=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},f.name.toLowerCase(),!1),l=[];l.push({name:f.name,startIndex:0,bold:!1,highlight:!1});h&&h.forEach(function(a){l=this._mergesingleSegment(l,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));this._renderSegments(l,e)}};H.prototype.getPrimColumnStyle=function(a){return a&&"file"===a.type?"search_primaryColumn":"search_primaryColumn_Details"};
H.prototype.getSecondaryColumnStyle=function(){return"search_secondaryColumn"};H.prototype.getCellElement=function(a,b,c){var d;switch(a){case 0:return a=p("td"),"file"===b.type?(a.noWrap=!0,this._lastFileIconDom=d=B(null,this.getFileIconId(b),a,null),this.explorer.model._provideSearchHelper&&""===this.explorer.model._provideSearchHelper().params.keyword||this.getExpandImage(c,d)):(d=B(null,null,a,null),a.noWrap=!0,a.align="right",this.renderDetailLineNumber(b,d)),a;case 1:return a=p("td"),d=B(null,
this.getFileSpanId(b),a,null),"file"===b.type?(c=b.totalMatches?this.explorer.model.getFileName(b)+" ("+b.totalMatches+" matches)":this.explorer.model.getFileName(b),this.renderFileElement(b,d,c)):(this.renderDetailElement(b,c,d),b=B(null,this.getDetailIconId(b),d,null),b=B(null,null,b,null),b.classList.add("imageSprite"),b.classList.add("core-sprite-none")),a;case 2:return a=p("td"),"file"===b.type&&(d=B(null,this.getLocationSpanId(b),a,null),b.parentLocation&&this.renderLocationElement(b,d)),a}};
H.prototype.constructor=H;G.prototype=new a.SelectionRenderer;G.prototype.getCellHeaderElement=function(a){switch(a){case 0:a=p("th","search_report",null,null);a=p("h2",null,null,a);a.textContent=k["Files replaced"];break;case 1:a=p("th","search_report",null,null),a=p("h2",null,null,a),a.textContent=k.Status}};G.prototype.getCellElement=function(a,b,c){switch(a){case 0:var d=p("td","search_report",null,null);a=p("div",null,null,d);var e=p("span","primaryColumn",null,a);z(document.createTextNode(b.model.fullPathName+
"/"+this.explorer.resultModel.getFileName(b.model)),e,"only");x(e,"click",function(){window.open(b.model.linkLocation)});x(e,"mouseover",function(){e.style.cursor="pointer"});x(e,"mouseout",function(){e.style.cursor="default"});a=p("span",null,null,a);a.classList.add("imageSprite");if(b.status)switch(b.status){case "warning":a.classList.add("core-sprite-warning");break;case "failed":a.classList.add("core-sprite-error");break;case "pass":a.classList.add("core-sprite-ok")}return d;case 1:if(b.status){switch(b.status){case "warning":d=
b.message;break;case "failed":d=b.message;break;case "pass":d=b.model.totalMatches?g.formatMessage(k["${0} out of ${1}  matches replaced."],b.matchesReplaced,b.model.totalMatches):b.message}a=p("td","search_report",null,null);a.textContent=d;return a}}};G.prototype.constructor=G;K.prototype=new a.Explorer;K.prototype.report=function(){this.createTree(this.parentId,new a.ExplorerFlatModel(null,null,this.reportList))};K.prototype.constructor=K;F.prototype={highlight:function(a,b,c){return this._syntaxHighlither.setup(b,
c.getTextView(),null,a,!1)}};D.prototype=new a.Explorer;D.prototype.onchange=function(a){};D.prototype.setResult=function(a,b){var c=this;this.parentNode=a;this.model=b;this.model.replaceMode()?(this.checkbox=this._hasCheckedItems=!0,this.renderer=new H({checkbox:!0,highlightSelection:!1,getCheckedFunc:function(a){return c.getItemChecked(a)},onCheckedFunc:function(a,b,d){c.onRowChecked(a,b,d)}},c)):(this.checkbox=!1,this.renderer=new H({checkbox:!1,highlightSelection:!1},this));this._reporting=!1;
this._currentPreviewModel=this._uiFactory=null;this._currentReplacedContents={contents:null};this._popUpContext=!1;this.timerRunning-=0;this.twoWayCompareView=this._filterTimer=this._timer=null};D.prototype.declareCommands=function(){var b=this,d=new l.Command({name:k["Apply Changes"],tooltip:k["Replace all selected matches"],id:"orion.globalSearch.replaceAll",callback:function(a){b.replaceAll()},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&b._hasCheckedItems}}),e=
new l.Command({name:k["Hide Compare"],tooltip:k["Hide compare view of changes"],id:"orion.globalSearch.hideCompare",callback:function(a){b.toggleCompare(!1)},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&b._uiFactory}}),f=new l.Command({name:k["Show Compare"],tooltip:k["Show compare view of changes"],id:"orion.globalSearch.showCompare",callback:function(a){b.toggleCompare(!0)},visibleWhen:function(a){return b.model&&b.model.replaceMode()&&!b._reporting&&!b._uiFactory}});
this._commandService.addCommand(e);this._commandService.addCommand(f);this._commandService.addCommand(d);this._commandService.addCommandGroup("pageActions","orion.searchActions.unlabeled",200);this._commandService.registerCommandContribution("pageActions","orion.globalSearch.hideCompare",1,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.showCompare",2,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions",
"orion.globalSearch.replaceAll",3,"orion.searchActions.unlabeled");var d=new l.Command({name:k["Show All"],tooltip:k["Show all the results in one page"],id:"orion.search.showAll",hrefCallback:function(){if(!this.model._provideSearchHelper)return null;var a=c.copySearchParams(this.model._provideSearchHelper().params,!0);a.start=0;a.rows=this.model.getPagingParams().totalNumber;return c.generateSearchHref(a)}.bind(this),visibleWhen:function(a){a=this.model.getPagingParams();return!this._crawling&&a.totalNumber>
a.rows}.bind(this)}),e=new l.Command({name:k["\x3c Previous Page"],tooltip:k["Show previous page of search result"],id:"orion.search.prevPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculatePrevPage(),d=c.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return c.generateSearchHref(d)},visibleWhen:function(a){a=b.caculatePrevPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),f=new l.Command({name:k["Next Page \x3e"],
tooltip:k["Show next page of search result"],id:"orion.search.nextPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculateNextPage(),d=c.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return c.generateSearchHref(d)},visibleWhen:function(a){a=b.caculateNextPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),g=new l.Command({tooltip:k["Next result"],imageClass:"core-sprite-move-down",id:"orion.search.nextResult",
groupId:"orion.searchGroup",visibleWhen:function(a){return!b._reporting},callback:function(){b.gotoNext(!0,!0)}}),h=new l.Command({tooltip:k["Previous result"],imageClass:"core-sprite-move-up",id:"orion.search.prevResult",groupId:"orion.searchGroup",visibleWhen:function(a){return!b._reporting},callback:function(){b.gotoNext(!1,!0)}});this._commandService.addCommand(d);this._commandService.addCommand(e);this._commandService.addCommand(f);this._commandService.addCommand(g);this._commandService.addCommand(h);
a.createExplorerCommands(this._commandService,function(a){var c=!1;b.model._provideSearchHelper&&""===b.model._provideSearchHelper().params.keyword&&(c=!0);return!a._reporting&&!c});this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.expandAll",1);this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.collapseAll",2);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextResult",3);this._commandService.registerCommandContribution("pageNavigationActions",
"orion.search.prevResult",4);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.showAll",5);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.prevPage",6);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextPage",7)};D.prototype._checkStale=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Checing file "+a.location+" for stale").then(function(b){this.model.staleCheck(b)&&
(a.stale=!1)}.bind(this),function(a){console.error("Error loading file contents: "+a.message);throw a;}.bind(this))};D.prototype.staleCheck=function(){var a=[];I(this.model).forEach(function(b){a.push(this._loadFileMetaData(b))}.bind(this));return h.all(a,function(a){return{_error:a}})};D.prototype._loadFileMetaData=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location,!0),"Getting file metadata "+a.location).then(function(b){a.fullPathName=c.fullPathNameByMeta(b.Parents);
a.parentLocation=b.Parents[0].Location;a.stale=a.lastModified!==b.LocalTimeStamp;a.ETag=b.ETag;if(a.stale)return this._checkStale(a).then(function(){this.renderer.staleFileElement(a)}.bind(this));this._prepareFilter(a);return a}.bind(this),function(b){console.error("Error loading file metadata: status "+b.status);a.stale=!0;this.renderer.staleFileElement(a);throw b;}.bind(this))};D.prototype.setCrawling=function(a){this._crawling=a};D.prototype.preview=function(){var a=this;this._commandService.openParameterCollector("pageActions",
function(b){var c=p("input",null,"globalSearchReplaceWith",b);c.type="text";c.name="ReplaceWith:";c.placeholder="Replace With";c.onkeydown=function(b){if(13===b.keyCode)return b=d.node("globalSearchReplaceWith"),a._commandService.closeParameterCollector(),a._doPreview(b.value);if(27===b.keyCode)return a._commandService.closeParameterCollector(),!1};p("span","parameters","globalSearchReplaceCommands",b);return c});var b=document.getElementById("globalSearchReplaceWith");b.value=this.model.defaultReplaceStr;
window.setTimeout(function(){b.select();b.focus()},10);var c=new l.Command({name:"Preview Changes",image:m.toUrl("images/replaceAll.gif"),id:"orion.globalSearch.innerReplaceAll",groupId:"orion.searchGroup",callback:function(){var b=d.node("globalSearchReplaceWith");a._commandService.closeParameterCollector();return a._doPreview(b.value)}});this._commandService.addCommand(c);this._commandService.registerCommandContribution("globalSearchReplaceCommands","orion.globalSearch.innerReplaceAll",1);this._commandService.renderCommands("globalSearchReplaceCommands",
"globalSearchReplaceCommands",this,this,"button")};D.prototype._fileExpanded=function(a,b){var c=I(this.model)[a];return null===b||void 0===b?{childrenNumber:0,childDiv:d.node(this.model.getId(c))}:c.children&&0<c.children.length?(0>b?b=c.children.length-1:b>=c.children.length&&(b=0),{childrenNumber:c.children.length,childDiv:d.node(this.model.getId(c.children[b]))}):{childrenNumber:0,childDiv:null}};D.prototype._doPreview=function(a,b){if(this.model._provideSearchHelper){this.model._storeGlobalStatus&&
this.model._storeGlobalStatus(a);var d=c.copySearchParams(this.model._provideSearchHelper().params,!0);d.replace=a;b&&(d.start=0,d.rows=this.model.getPagingParams().totalNumber);d=c.generateSearchHref(d);window.location.href=d}};D.prototype.searchAgain=function(){if(this.model._provideSearchHelper){var a=c.copySearchParams(this.model._provideSearchHelper().params,!0);a.replace=null;a.rows>this.defaulRows&&(a.rows=this.defaulRows);a=c.generateSearchHref(a);a===window.location.href?window.location.reload():
window.location.href=a}};D.prototype.replaceAll=function(){var a=[],b=this;this._reporting=!0;this.initCommands();this.reportStatus(k["Writing files..."]);this.model.writeReplacedContents(a).then(function(c){A(b.getParentDivId());(new K(b.getParentDivId(),a,b.model)).report();b.reportStatus("")})};D.prototype.toggleCompare=function(a){this.replacePreview(!1,a)};D.prototype.replacePreview=function(a,b){A(this.getParentDivId());b?(this._uiFactory=new n.SearchUIFactory({parentDivID:this.getParentDivId()}),
this._uiFactory.buildUI()):(this._uiFactory&&this._uiFactory.destroy(),this._uiFactory=null);this._currentPreviewModel=this.twoWayCompareView=null;this.initCommands();a&&this.reportStatus(k["Preparing preview..."]);var c=this;this.createTree(this._uiFactory?this._uiFactory.getMatchDivID():this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){c.onCollapse(a)}});a?(this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),
this.reportStatus(""),!this._crawling&&this.model.staleCheck&&this.staleCheck().then(function(){c.refreshValidFiles()})):this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null)};D.prototype.getItemChecked=function(a){void 0===a.checked&&(a.checked=!0);return a.checked};D.prototype._checkedItem=function(){for(var a=I(this.model),b=0;b<a.length;b++){if(a[b].checked)return!0;if(a[b].children)for(var c=0;c<a[b].children.length;c++)if(a[b].children[c].checked)return!0}return!1};
D.prototype.onRowChecked=function(a,b,c){if(a){if((a=d.node(a))&&a._item)this.onItemChecked(a._item,b,c);a=this._checkedItem()}else a=b,this.onItemChecked(this.model.getListRoot(),b,c);a!==this._hasCheckedItems&&(this._hasCheckedItems=a,this.initCommands())};D.prototype.onNewContentChanged=function(a){a===C(this.getNavHandler().currentModel())&&this.buildPreview(!0)};D.prototype.onItemChecked=function(a,b,c){a.checked=b;if("file"===a.type||a===this.model.getListRoot()){if(a.children)for(c=0;c<a.children.length;c++){var e=
d.node(this.renderer.getCheckBoxId(this.model.getId(a.children[c])));if(e)this.renderer.onCheck(null,e,b,!1);else a.children[c].checked=b}if("file"===a.type)this.onNewContentChanged(a)}else if(c)this.onNewContentChanged(a.parent)};D.prototype.buildPreview=function(a){if(this._uiFactory&&0!==I(this.model).length){var b=this._uiFactory,c=C(this.getNavHandler().currentModel());this._currentPreviewModel=c;var d=this;this.model.provideFileContent(c,function(c){if(d.model.onMatchNumberChanged)d.model.onMatchNumberChanged(c);
d.model.getReplacedFileContent(d._currentReplacedContents,a,c);var e=d._currentReplacedContents.contents;Array.isArray(e)&&(e=d._currentReplacedContents.contents.join(d._currentReplacedContents.lineDelim));var f=d.model.getFileName(c),h=d._contentTypeService.getFilenameContentType(f);c={readonly:!0,hasConflicts:!1,newFileOnRight:!0,oldFile:{Name:c.location,Type:h,Content:d.model.getFileContents(c)},newFile:{Name:c.location,Type:h,Content:e}};d.twoWayCompareView?(d.twoWayCompareView.setOptions(c),
d.twoWayCompareView.refresh(!0)):(d.uiFactoryCompare=new q.TwoWayCompareUIFactory({parentDivID:b.getCompareDivID(),showTitle:!0,rightTitle:g.formatMessage(k["Replaced File (${0})"],f),leftTitle:g.formatMessage(k["Original File (${0})"],f),showLineStatus:!1}),d.uiFactoryCompare.buildUI(),c.uiFactory=d.uiFactoryCompare,c.parentDivID=b.getCompareDivID(),d.twoWayCompareView=new s.TwoWayCompareView(c),d.twoWayCompareView.setOptions({highlighters:[new F(d.registry),new F(d.registry)]}),d.twoWayCompareView.startup(),
d._uiFactory.setCompareWidget(d.twoWayCompareView));A(d.uiFactoryCompare.getTitleDiv());z(document.createTextNode(g.formatMessage(k["Replaced File (${0})"],f)),d.uiFactoryCompare.getTitleDiv(),"only");A(d.uiFactoryCompare.getTitleDiv(!0));z(document.createTextNode(g.formatMessage(k["Original File (${0})"],f)),d.uiFactoryCompare.getTitleDiv(!0),"only");window.setTimeout(function(){d.renderer.focus()},100)})}};D.prototype.addSavedSearch=function(a,b){this.registry.getService("orion.core.savedSearches").addSearch(a,
b)};D.prototype.saveSearch=function(a){if(this.model._provideSearchHelper){var b=c.generateSearchHref(a).split("#")[1],d=b;"string"===typeof this.model._provideSearchHelper().displayedSearchTerm&&"string"===typeof a.resource?(d="'"+this.model._provideSearchHelper().displayedSearchTerm+"' in ",0<a.resource.length?this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.resource,!0),"Getting file metadata "+a.resource).then(function(a){var e=c.fullPathNameByMeta(a.Parents);this.addSavedSearch(d+
(0===e.length?a.Name:e+"/"+a.Name),b)}.bind(this),function(a){console.error("Error loading file meta data: "+a.message);this.addSavedSearch(d+"root",b)}.bind(this)):this.addSavedSearch(d+"root",b)):this.addSavedSearch(d,b)}};D.prototype.caculateNextPage=function(){var a=this.model.getPagingParams();return a.start+a.rows>=a.totalNumber?{start:a.start}:{start:a.start+a.rows}};D.prototype.caculatePrevPage=function(){var a=this.model.getPagingParams(),a=a.start-a.rows;0>a&&(a=0);return{start:a}};D.prototype.initCommands=
function(){this._commandService.destroy("pageActions");this._commandService.renderCommands("pageActions","pageActions",this,this,"button");this._commandService.destroy("pageNavigationActions");this._commandService.renderCommands("pageNavigationActions","pageNavigationActions",this,this,"button")};D.prototype.reportStatus=function(a){this.registry.getService("orion.page.message").setProgressMessage(a)};D.prototype.isExpanded=function(a){return this.myTree.isExpanded(this.model.getId(a))};D.prototype.popupContext=
function(a){this.contextTip&&(this.contextTip.destroy(),this.contextTip=null);var b=this.renderer.getDetailIconId(a);a=this.renderer.generateContextTip(a);var b=d.node(b),c=["below","right"];if(b)for(var e=this.myTree._parent.getClientRects()[0],f=b.getClientRects(),g=0,h=f.length;g<h;g++)if(f[g].bottom+100>e.bottom){c=["above","right"];break}this.contextTip=new t.Tooltip({node:b,showDelay:0,trigger:"none",position:c});this.contextTip.contentContainer().appendChild(a);this.contextTip.show()};D.prototype.closeContextTip=
function(a){this.model.replaceMode()||(this.contextTip&&(this.contextTip.destroy(),this.contextTip=null),a||(this._popUpContext=!1),this.renderer.replaceDetailIcon(this.getNavHandler().currentModel(),"right"))};D.prototype.onCollapse=function(a){var b=this.getNavHandler().currentModel();b&&"detail"===b.type&&C(a)===a&&this.getNavHandler().cursorOn(a)};D.prototype.onExpand=function(a,b,c){if(a&&a.children&&0<a.children.length&&"string"===typeof b){c="first"===b?0:"last"===b?a.children.length-1:JSON.parse(b);
if("string"===typeof c||0>c||c>=a.children.length)c=0;this.getNavHandler().cursorOn(a.children[c])}};D.prototype.forceExpandFunc=function(a,b,c){this.myTree.expand(a,function(){this.onExpand(a,b,c)}.bind(this));return null};D.prototype.keyEventListeningDiv=function(a){return d.node(this.getParentDivId(a))};D.prototype.onFocus=function(a){a||this.closeContextTip()};D.prototype.preventDefaultFunc=function(a,b){if(!b)return!0;if(!this.model.replaceMode()&&!a.ctrlKey&&"detail"===b.type){if(37===a.keyCode&&
this._popUpContext)return this.closeContextTip(),a.preventDefault(),!0;if(39===a.keyCode&&!this._popUpContext)return this._popUpContext=!0,this.renderer.replaceDetailIcon(b,"left"),this.popupContext(b),a.preventDefault(),!0}return!1};D.prototype.onReplaceCursorChanged=function(a,b){C(this._currentPreviewModel)!==C(b)&&this.buildPreview();if("detail"===b.type){var c=this.model.getDetailInfo(b);this.twoWayCompareView.gotoDiff(c.lineNumber,c.matches[c.matchNumber].startIndex,!1)}};D.prototype.onCursorChanged=
function(a,b){this.renderer.replaceDetailIcon(a,"none");this.model.storeLocationStatus&&this.model.storeLocationStatus(b);var c=this;this.model.replaceMode()?this._uiFactory&&(this._timer?this.timerRunning&&(window.clearTimeOut(this._timer),this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)):this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)):"detail"===b.type?this._popUpContext?(this.popupContext(b),
this.renderer.replaceDetailIcon(b,"left")):this.renderer.replaceDetailIcon(b,"right"):this._popUpContext&&this.closeContextTip(!0)};D.prototype._prepareFilter=function(a){this._validateFilter()&&(a?this.model.getChildren(a,function(a){}):I(this.model).forEach(function(a){this.model.getChildren(a,function(a){})}.bind(this)))};D.prototype._validateFilter=function(){return!this.model.replaceMode()&&"function"===typeof this.model.filterOn};D.prototype._startUp=function(){var a=A("filterBox"),b=this.model.getPagingParams();
this.model._provideSearchHelper&&(window.document.title=this.model._provideSearchHelper().displayedSearchTerm+" - "+g.formatMessage(k["${0} matches"],b.totalNumber));if(0===b.numberOnPage)a&&(a.style.visibility="hidden"),a=k["No matches"],this.model._provideSearchHelper&&(a=g.formatMessage(k["No matches found for ${0}"],this.model._provideSearchHelper().displayedSearchTerm)),this.parentNode.textContent="",b=p("b",null,null,this.parentNode),z(document.createTextNode(a),b,"only"),this.reportStatus("");
else{var c=this;if(a&&this._validateFilter()){a.style.visibility="visible";var d=p("input",["search-control","search-filter-input"],null,a);d.type="text";d.placeholder=k["Type filter text"];d.addEventListener("input",function(a){this._filterTimer&&window.clearTimeout(this._filterTimer);this._filterTimer=window.setTimeout(function(){this._filterTimer=null;this._renderFiltered(d.value)}.bind(this),1E3)}.bind(this))}this.model.buildResultModel();this.model.replaceMode()?c.replacePreview(!0,!0):(this.initCommands(),
A(this.getParentDivId()),this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),onCollapse:function(a){c.onCollapse(a)}}),this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),this.reportStatus(""),!this._crawling&&this.model.staleCheck?this.staleCheck().then(function(){c.refreshValidFiles()}):c._prepareFilter())}};D.prototype.startUp=function(){if(this._openWithCommands)this._startUp();
else{var a=w.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);h.when(a,function(a){this._openWithCommands=a;this._startUp()}.bind(this))}};D.prototype._incrementalRender=function(){var a=this;this.model.buildResultModel();this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),indent:0,onCollapse:function(b){a.onCollapse(b)}})};D.prototype.incrementalRender=
function(){if(this._openWithCommands)this._incrementalRender();else{var a=w.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);h.when(a,function(a){this._openWithCommands=a;this._incrementalRender()}.bind(this))}};D.prototype._renderFiltered=function(a){this.model.filterOn(a);this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){this.onCollapse(a)}.bind(this)});a&&this.expandAll()};D.prototype.refreshValidFiles=
function(){for(var a=[],b=C(this.getNavHandler().currentModel()),c=I(this.model),d=0;d<c.length;d++)c[d].stale?b===c[d]&&(b=null):a.push(c[d]);this.model.setValidFileList&&this.model.setValidFileList(a);0===I(this.model).length?(this.getNavHandler().refreshModel(this.getNavDict(),this.model,I(this.model)),this.getNavHandler().cursorOn(null,!0)):b?this.getNavHandler().refreshModel(this.getNavDict(),this.model,I(this.model),!0):(this.getNavHandler().cursorOn(null,!0),this.getNavHandler().refreshModel(this.getNavDict(),
this.model,I(this.model)),this.gotoCurrent())};D.prototype.getItemCount=function(){return this.model.getListRoot().children.length};D.prototype.getParentDivId=function(a){return!this.model.replaceMode()||!a?this.parentNode.id:this._uiFactory?this._uiFactory.getMatchDivID():this.parentNode.id};D.prototype.gotoCurrent=function(a){var b=null,c="none";a?(b=a.file,c=a.detail):b=this.getNavHandler().currentModel();b||(b=0<I(this.model).length?I(this.model)[0]:null);this.getNavHandler().cursorOn(b,!0);b&&
c&&"none"!==c&&this.myTree.expand(b,function(){this.onExpand(b,c)}.bind(this))};D.prototype.gotoNext=function(a,b){0!==I(this.model).length&&this.getNavHandler().iterate(a,b)};D.prototype.constructor=D;return{SearchResultExplorer:D}});
define("orion/searchModel","i18n!orion/search/nls/messages require orion/Deferred orion/i18nUtil orion/explorers/explorer orion/searchUtils".split(" "),function(k,m,h,d,b,g){function a(a,b,d,c,h,k){this.registry=a;this.fileClient=b;this._resultLocation=d;this._numberOnPage=d.length;this._totalNumber=c;this._listRoot={isRoot:!0,children:[]};this._filteredRoot={isRoot:!0,children:[]};this._filterText=null;this._indexedFileItems=[];this._location2ModelMap=[];this._lineDelimiter="\n";this.onMatchNumberChanged=
k.onMatchNumberChanged;this._searchHelper=g.generateSearchHelper(h)}a.prototype=new b.ExplorerModel;a.prototype.getRoot=function(a){a(this.getListRoot())};a.prototype.getChildren=function(a,b){a&&("file"===a.type&&this._filterText?a.filteredChildren?b(a.filteredChildren):b([]):a.children?b(a.children):"detail"===a.type?b([]):"file"===a.type&&a.location?""!==this._searchHelper.params.keyword&&this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Getting file contents "+
a.name).then(function(d){g.searchWithinFile(this._searchHelper.inFileQuery,a,d,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);if(this.onMatchNumberChanged)this.onMatchNumberChanged(a);b(a.children)}.bind(this),function(a){console.error("Error loading file content: "+a.message);b([])}.bind(this)):b([]))};a.prototype.getId=function(a){a===this.getListRoot()?a=this.rootId:(a=a.location,a=a.replace(/[^\.\:\-\_0-9A-Za-z]/g,""));return a};a.prototype.getListRoot=function(){return this._filterText?
this._filteredRoot:this._listRoot};a.prototype.buildResultModel=function(){this._restoreGlobalStatus();this._indexedFileItems=[];this.getListRoot().children=[];for(var a=0;a<this._resultLocation.length;a++){var b={parent:this.getListRoot(),type:"file",name:this._resultLocation[a].name,lastModified:this._resultLocation[a].lastModified,linkLocation:this._resultLocation[a].linkLocation,location:this._resultLocation[a].location,parentLocation:g.path2FolderName(this._resultLocation[a].location,this._resultLocation[a].name,
!0),fullPathName:g.path2FolderName(this._resultLocation[a].path,this._resultLocation[a].name)};this._location2ModelMap[b.location]=b;this.getListRoot().children.push(b);this._indexedFileItems.push(b)}};a.prototype.replaceMode=function(){return"string"===typeof this._searchHelper.params.replace};a.prototype.getPagingParams=function(){return{totalNumber:this._totalNumber,start:this._searchHelper.params.start,rows:this._searchHelper.params.rows,numberOnPage:this._numberOnPage}};a.prototype.getScopingParams=
function(a){var b=g.copySearchParams(this._searchHelper.params,!0);b.resource=a.parentLocation;b.start=0;var b=g.generateSearchHref(b),h=d.formatMessage(k['Search again in this folder with "${0}"'],this._searchHelper.displayedSearchTerm);return{name:a.fullPathName,href:b,tooltip:h}};a.prototype.getDetailInfo=function(a){return{lineString:a.name,lineNumber:a.lineNumber-1,matches:a.matches,matchNumber:a.matchNumber?a.matchNumber-1:0}};a.prototype.getFileName=function(a){return a.name};a.prototype.provideFileContent=
function(a,b){this._provideFileContent(a).then(function(){b(a)})};a.prototype._provideFileContent=function(a){return a.contents?(new h).resolve(a):this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Getting file contents "+a.Name).then(function(b){g.searchWithinFile(this._searchHelper.inFileQuery,a,b,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);return a}.bind(this),function(b){console.error("Error loading file content: "+b.message);
return a}.bind(this))};a.prototype.getFileContents=function(a){return a.contents.join(this._lineDelimiter)};a.prototype.getReplacedFileContent=function(a,b,d){g.generateNewContents(b,d.contents,a,d,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);a.lineDelim=this._lineDelimiter};a.prototype.writeReplacedContents=function(a){var b=[];this.getValidFileList().forEach(function(d){b.push(this._writeOneFile(d,a))}.bind(this));return h.all(b,function(a){return{_error:a}})};
a.prototype.getHeaderString=function(){var a=k.Results;if(this._searchHelper.displayedSearchTerm){var b=this.getPagingParams();if(0<b.numberOnPage)var a=b.start+1,g=a+b.numberOnPage-1,a=this.replaceMode()?d.formatMessage(k["Replace ${0} with ${1} for files ${2} of ${3}"],this._searchHelper.displayedSearchTerm,this._searchHelper.params.replace,a+"-"+g,b.totalNumber):d.formatMessage(k["Files ${0} of ${1} matching ${2}"],a+"-"+g,b.totalNumber,this._searchHelper.displayedSearchTerm)}return a};a.prototype.getValidFileList=
function(){return this._indexedFileItems};a.prototype.setValidFileList=function(a){this._indexedFileItems=a};a.prototype.storeLocationStatus=function(a){if(a){var b;(b=a?"file"===a.type?a:a.parent:null)&&(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]=b.location,window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"]="file"===a.type?"none":JSON.stringify(this._model2Index(a)))}};a.prototype.restoreLocationStatus=function(){var a=
this._location2Model(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]),b="none",d=window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"];"string"===typeof d&&0<d.length&&(b=d);return{file:a,detail:b}};a.prototype.staleCheck=function(a){a=a.toLowerCase();return this._searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this._searchHelper.inFileQuery,a,!0):g.searchOnelineLiteral(this._searchHelper.inFileQuery,a,!0)};
a.prototype.filterOn=function(a){if(this._filterText=a){var b=this._filterText.toLowerCase();this._filteredRoot.children=[];this._indexedFileItems.forEach(function(a){var c=!1;if(this._filterSingleString(a.name,b)||this._filterSingleString(a.fullPathName,b))c=!0;a.children&&(a.filteredChildren=[],a.children.forEach(function(d){this._filterSingleString(d.name,b)&&(a.filteredChildren.push(d),c=!0)}.bind(this)));c&&this._filteredRoot.children.push(a)}.bind(this))}};a.prototype.getFilteredChildren=function(a){return"file"===
a.type&&this._filterText&&a.filteredChildren?a.filteredChildren:a.isRoot&&this._filterText?this._filteredRoot.children:a.children};a.prototype._provideSearchHelper=function(){return this._searchHelper};a.prototype._filterSingleString=function(a,b){return 0<=a.toLowerCase().indexOf(b)};a.prototype._model2Index=function(a,b){var d=b;!d&&a.parent&&(d=a.parent.children);if(d)for(var c=0;c<d.length;c++)if(d[c]===a)return c;return-1};a.prototype._location2Model=function(a){return a&&this._location2ModelMap[a]?
this._location2ModelMap[a]:0<this._indexedFileItems.length?this._indexedFileItems[0]:null};a.prototype._restoreGlobalStatus=function(){this.defaultReplaceStr=this._searchHelper.displayedSearchTerm;var a=window.sessionStorage.global_search_default_replace_string;"string"===typeof a&&0<a.length&&(this.defaultReplaceStr=a);this.sortByName=-1<this._provideSearchHelper().params.sort.indexOf("Name")};a.prototype._storeGlobalStatus=function(a){window.sessionStorage.global_search_default_replace_string=a};
a.prototype._writeOneFile=function(a,b){var d=this._matchesReplaced(a);return 0<d?this._provideFileContent(a).then(function(){d=this._matchesReplaced(a);var c={};g.generateNewContents(!1,a.contents,c,a,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);var c=c.contents.join(this._lineDelimiter),h=a.ETag,h=h?{ETag:h}:null;return this.registry.getService("orion.page.progress").progress(this.fileClient.write(a.location,c,h),"Saving changes to "+a.location).then(function(c){b.push({model:a,
matchesReplaced:d,status:"pass"})}.bind(this),function(c){412===c.status?b.push({model:a,message:k["Resource has been changed by others."],matchesReplaced:d,status:"failed"}):(c.log=!0,b.push({model:a,message:k["Failed to write file."],matchesReplaced:d,status:"failed"}))}.bind(this))}.bind(this)):(new h).resolve(a)};a.prototype._matchesReplaced=function(a){var b=0;if(!a.children)return!1===a.checked?0:1;if(a.children)for(var d=0;d<a.children.length;d++)!1!==a.children[d].checked&&(b+=1);return b};
a.prototype.constructor=a;return{SearchResultModel:a}});
define("orion/searchResults","i18n!orion/search/nls/messages orion/i18nUtil require orion/webui/littlelib orion/searchExplorer orion/searchModel orion/searchUtils orion/crawler/searchCrawler".split(" "),function(k,m,h,d,b,g,a,e){function f(a,c,d,e,f,g){this.registry=a;this.fileService=e;this.resultsId=c;this.commandService=d;this.searcher=f;this.crawling=g;this.explorer=new b.SearchResultExplorer(this.registry,this.commandService)}f.prototype={_renderSearchResult:function(a,b,e,f,k){var m=!1,r=[];
d.empty(d.node(b));if(0<f.response.numFound)for(var t=0;t<f.response.docs.length;t++){var v=f.response.docs[t];if(!v.Directory){m||(m=!0);var w=v.Location;r.push({linkLocation:h.toUrl("edit/edit.html")+"#"+w,location:w,path:v.Path?v.Path:w,name:v.Name,lastModified:v.LastModified})}}this.explorer.setCrawling(a);var A=this;a=new g.SearchResultModel(this.registry,this.explorer.fileClient,r,f.response.numFound,e,{onMatchNumberChanged:function(a){A.explorer.renderer.replaceFileElement(a)}});this.explorer.setResult(b,
a);k?this.explorer.incrementalRender():this.explorer.startUp()},_search:function(a,b){this.crawling=b.regEx||b.caseSensitive;var f=d.node(this.resultsId),g=this;d.empty(d.node("pageNavigationActions"));d.empty(d.node("pageActions"));if("undefined"===typeof b.keyword)d.empty(f);else if(this.crawling)d.empty(f),f.appendChild(document.createTextNode("")),f=new e.SearchCrawler(this.registry,this.fileService,b,{childrenLocation:this.searcher.getChildrenLocation()}),f.search(function(d,e){g._renderSearchResult(!0,
a,b,d,e)});else{d.empty(f);this.registry.getService("orion.page.message").setProgressMessage(k["Searching..."]);try{this.registry.getService("orion.page.progress").progress(this.fileService.search(b),"Searching "+b.keyword).then(function(d){this.registry.getService("orion.page.message").setProgressMessage("");this._renderSearchResult(!1,a,b,d)}.bind(this),function(a){a=m.formatMessage(k["${0}. Try your search again."],a&&a.error?a.error:"Error");this.registry.getService("orion.page.message").setProgressResult({Message:a,
Severity:"Error"})}.bind(this))}catch(h){d.empty(f),f.appendChild(document.createTextNode("")),"string"===typeof h&&-1<h.indexOf("search")?(f=new e.SearchCrawler(this.registry,this.fileService,b,{childrenLocation:this.searcher.getChildrenLocation()}),f.search(function(d,e){g._renderSearchResult(!0,a,b,d,e)})):this.registry.getService("orion.page.message").setErrorMessage(h)}}},loadResults:function(a){var b=d.node(this.resultsId);this._search(b,a)}};f.prototype.constructor=f;return{SearchResultsGenerator:f}});
define("built-search.js","i18n!orion/search/nls/messages require orion/browserCompatibility orion/bootstrap orion/status orion/progress orion/dialogs orion/commandRegistry orion/searchOutliner orion/searchClient orion/fileClient orion/operationsClient orion/searchResults orion/globalCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/webui/littlelib".split(" "),function(k,m,h,d,b,g,a,e,f,l,c,n,q,s,u,r,t,v){function w(a,b,c,d,e,f,g,h){var l=g.resource,m=g.replace?k["Replace All Matches"]:
k["Search Results"];l?l===b.fileServiceRootURL(l)?(d.setRootLocationbyURL(l),d.setLocationbyURL(l),s.setPageTarget({task:"Search",title:m,serviceRegistry:a,commandService:c,searchService:d,fileService:b,breadcrumbRootName:"Search",staticBreadcrumb:!0}),d.setChildrenLocationbyURL(l),f.loadSearchParams(g),e.loadResults(g)):(h?h.progress(b.read(l,!0),"Loading file metadata "+l):b.read(l,!0)).then(function(h){s.setPageTarget({task:"Search",title:m,target:h,serviceRegistry:a,fileService:b,commandService:c,
searchService:d,staticBreadcrumb:!0,breadcrumbRootName:"Search"});f.loadSearchParams(g);e.loadResults(g)}.bind(this),function(a){window.console.error("Error loading file metadata: "+a.message)}.bind(this)):(s.setPageTarget({task:"Search",title:m,serviceRegistry:a,commandService:c,searchService:d,fileService:b,staticBreadcrumb:!0,breadcrumbRootName:"Search"}),f.loadSearchParams(g),e.loadResults(g))}d.startup().then(function(d){var h=d.serviceRegistry;d=d.preferences;new a.DialogService(h);var k=new n.OperationsClient(h);
new b.StatusReportingService(h,k,"statusPane","notifications","notificationArea");var m=new e.CommandRegistry({}),y=new g.ProgressService(h,k,m);new f.SavedSearches({serviceRegistry:h});var B=new c.FileClient(h);new u.ContentTypeRegistry(h);var C=new l.Searcher({serviceRegistry:h,commandService:m,fileService:B});new f.SearchOutliner({parent:"searchProgress",serviceRegistry:h,commandService:m});var I=new f.SearchBuilder({parent:"searchBuilder",searcher:C,serviceRegistry:h,commandService:m});s.generateBanner("orion-searchResults",
h,m,d,C,C,null,!1);var H=new q.SearchResultsGenerator(h,"results",m,B,C,!1),G=function(){var a=v.node("filterBox");a&&v.empty(a);a=t.matchResourceParameters();r.convertSearchParams(a);w(h,B,m,C,H,I,a,y);if(a=document.getElementById("pageActions"))m.destroy(a),m.renderCommands(a.id,a,C,C,"button")};window.addEventListener("hashchange",function(){G()},!0);G()})});
//@ sourceMappingURL=built-search.js.map