/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation
 RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/domReady for details

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation
*/
(function(e,g){"function"===typeof define&&define.amd?define("orion/Deferred",g):"object"===typeof exports?module.exports=g():(e.orion=e.orion||{},e.orion.Deferred=g())})(this,function(){function e(){for(var a;a=f.shift();)a();d=!1}function g(a){f.push(a);d||(d=!0,b())}function h(a){return function(c){a(c)}}function m(){function a(){for(var c;c=p.shift();){var a=c.deferred,l="fulfilled"===f?"resolve":"reject";c=c[l];if("function"===typeof c)try{var b=c(d),k=b&&("object"===typeof b||"function"===typeof b)&&
b.then;if("function"===typeof k)if(b===a.promise)a.reject(new TypeError);else{var g=b.cancel;"function"===typeof g?a._parentCancel=g.bind(b):delete a._parentCancel;k.call(b,h(a.resolve),h(a.reject),h(a.progress))}else a.resolve(b)}catch(n){a.reject(n)}else a[l](d)}}function c(c){delete n._parentCancel;f="rejected";d=c;p.length&&g(a)}function l(b){function k(c){return function(a){(!f||"assumed"===f)&&c(a)}}delete n._parentCancel;try{var h=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof h)if(b===n)c(new TypeError);else{f="assumed";var e=b&&b.cancel;if("function"!==typeof e){var s=new m;b=s.promise;try{h(s.resolve,s.reject,s.progress)}catch(z){s.reject(z)}e=b.cancel;h=b.then}d=b;h.call(b,k(l),k(c));n._parentCancel=e.bind(b)}else f="fulfilled",d=b,p.length&&g(a)}catch(v){k(c)(v)}}function b(){var a=n._parentCancel;a?(delete n._parentCancel,a()):f||(a=Error("Cancel"),a.name="Cancel",c(a))}var d,f,p=[],n=this;this.resolve=function(c){f||l(c);return n};this.reject=function(a){f||
c(a);return n};this.progress=function(c){f||p.forEach(function(a){if(a.progress)try{a.progress(c)}catch(b){}});return n.promise};this.cancel=function(){n._parentCancel?setTimeout(b,0):b();return n};this.then=function(c,b,l){var k=new m;k._parentCancel=n.promise.cancel;p.push({resolve:c,reject:b,progress:l,deferred:k});("fulfilled"===f||"rejected"===f)&&g(a);return k.promise};this.promise={then:n.then,cancel:n.cancel}}var f=[],d=!1,b=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var a=
process.nextTick;return function(){a(e)}}if("function"===typeof MutationObserver){var c=document.createElement("div");(new MutationObserver(e)).observe(c,{attributes:!0});return function(){c.setAttribute("class","_tick")}}return function(){setTimeout(e,0)}}();m.all=function(a,c){function b(c,a){g||(f[c]=a,0===--d&&h.resolve(f))}function k(a,k){if(!g){if(c)try{b(a,c(k));return}catch(d){k=d}h.reject(k)}}var d=a.length,f=[],g=!1,h=new m;h.then(void 0,function(){g=!0;a.forEach(function(a){a.cancel&&a.cancel()})});
0===d?h.resolve(f):a.forEach(function(a,c){a.then(b.bind(void 0,c),k.bind(void 0,c))});return h.promise};m.when=function(a,c,b,k){var d;a&&"function"===typeof a.then||(d=new m,d.resolve(a),a=d.promise);return a.then(c,b,k)};return m});
(function(e,g){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],g):"object"===typeof exports?module.exports=g(require("orion/Deferred")):(e.orion=e.orion||{},e.orion.PluginProvider=g(e.orion.Deferred))})(this,function(e){function g(g,e){this.__objectId=g;this.__methods=e}return function(h){function m(a){p&&("undefined"===typeof ArrayBuffer&&(a=JSON.stringify(a)),p===self?p.postMessage(a):p.postMessage(a,"*"))}function f(){var a=[];Object.keys(z).forEach(function(c){var b=
z[c];a.push({serviceId:c,names:b.names,methods:b.methods,properties:b.properties})});return{headers:u||{},services:a}}function d(a,c){if(c&&c instanceof XMLHttpRequest){var b,l;try{b=c.status,l=c.statusText}catch(t){b=0,l=""}return{status:b||0,statusText:l}}return c}function b(a){var c=a?JSON.parse(JSON.stringify(a,d)):a;a instanceof Error&&(c.__isError=!0,c.message=c.message||a.message,c.name=c.name||a.name);return c}function a(a){if(!p)return(new e).reject(Error("plugin not connected"));a.id=String(n++);
var c=new e;r[a.id]=c;c.then(null,function(c){q&&(c instanceof Error&&"Cancel"===c.name)&&v({requestId:a.id,method:"cancel",params:c.message?[c.message]:[]})});var b=Object.prototype.toString;a.params.forEach(function(l,t){if("[object Object]"===b.call(l)&&!(l instanceof g)){var k,d;for(k in l)"[object Function]"===b.call(l[k])&&(d=d||[],d.push(k));if(d){var f=x++;s[f]=l;k=function(){delete s[f]};c.then(k,k);a.params[t]=new g(f,d)}}});v(a);return c.promise}function c(c,a){c||0===c?v({id:c,result:null,
error:a}):console.log(a)}function l(c,l,k,d){d.forEach(function(c,b){if(c&&"undefined"!==typeof c.__objectId){var l={};c.__methods.forEach(function(b){l[b]=function(){return a({objectId:c.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=l}});var t=void 0===typeof c?null:{id:c,result:null,error:null};try{var f=k.apply(l,d);t&&(f&&"function"===typeof f.then?(w[c]=f,f.then(function(a){delete w[c];t.result=a;v(t)},function(a){w[c]&&(delete w[c],t.error=b(a),v(t))},function(){v({responseId:c,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(t.result=f,v(t)))}catch(g){t&&(t.error=b(g),v(t))}}function k(a){if(!(a.source!==p&&"undefined"!==typeof window)){a="string"!==typeof a.data?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,k=a.params||[];if("serviceId"in a){var d=z[a.serviceId];d||c(a.id,"service not found");d=d.implementation;b in d?l(a.id,d,d[b],k):c(a.id,"method not found")}else if("objectId"in a){var t=s[a.objectId];t||c(a.id,"object not found");!b in
t?l(a.id,t,t[b],k):c(a.id,"method not found")}else if("requestId"in a){var f=w[a.requestId];f&&("cancel"===b&&f.cancel)&&f.cancel.apply(f,k)}else if("responseId"in a){var g=r[a.responseId];g&&("progress"===b&&g.progress)&&g.progress.apply(g,k)}else throw Error("Bad method: "+a.method);}else{var h=r[String(a.id)];delete r[String(a.id)];a.error?h.reject(a.error):h.resolve(a.result)}}catch(e){console.log("Plugin._messageHandler "+e)}}}var u=h,q=!1,p=null,n=0,x=0,y=0,w={},r={},s={},z={},v=m;this.updateHeaders=
function(a){if(q)throw Error("Cannot update headers. Plugin Provider is connected");u=a};this.registerServiceProvider=this.registerService=function(a,c,b){if(q)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var l=null,k=[];for(l in c)"function"===typeof c[l]&&k.push(l);z[y++]={names:a,methods:k,implementation:c,properties:b||{},listeners:{}}};this.connect=function(a,c){if(!q){if("undefined"===typeof window)p=self;else if(window!==
window.parent)p=window.parent;else if(null!==window.opener)p=window.opener;else{c&&c("No valid plugin target");return}addEventListener("message",k,!1);var b={method:"plugin",params:[f()]};m(b);q=!0}a&&a()};this.disconnect=function(){q&&(removeEventListener("message",k),p=null,q=!1)}}});
define("orion/xhr",["orion/Deferred"],function(e){function g(g,e,f,d){var b="undefined"!==typeof f.response?f.response:f.responseText,a;try{a=f.status}catch(c){a=0}g={args:e,response:b,responseText:"string"===typeof b?b:null,status:a,url:g,xhr:f};"undefined"!==typeof d&&(g.error=d);return g}return function(h,m,f){f=f||{};var d=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new e,a=f.headers||{},c=f.log||!1,l;"undefined"===typeof a["X-Requested-With"]&&(a["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof f.data&&("POST"===h||"PUT"===h))l=f.data;var k=!1,u=!1;b.promise.then(void 0,function(a){k=!0;!u&&(a instanceof Error&&"Cancel"===a.name)&&d.abort()});d.onabort=function(){u=!0;if(!k){var a=Error("Cancel");a.name="Cancel";b.reject(a)}};d.onload=function(){var a=g(m,f,d);200<=d.status&&400>d.status?b.resolve(a):(b.reject(a),c&&"undefined"!==typeof console&&console.log(Error(d.statusText)))};d.onerror=function(){var a=g(m,f,d);b.reject(a);c&&"undefined"!==typeof console&&console.log(Error(d.statusText))};
d.onprogress=function(a){a.xhr=d;b.progress(a)};try{d.open(h,m,!0);"string"===typeof f.responseType&&(d.responseType=f.responseType);if("number"===typeof f.timeout)if("number"===typeof d.timeout)d.timeout=f.timeout,d.addEventListener("timeout",function(a){b.reject(g(m,f,d,"Timeout exceeded"))});else{var q=setTimeout(function(){b.reject(g(m,f,d,"Timeout exceeded"))},f.timeout);b.promise.then(clearTimeout.bind(null,q),clearTimeout.bind(null,q))}Object.keys(a).forEach(function(c){d.setRequestHeader(c,
a[c])});d.send(l||null)}catch(p){b.reject(g(m,f,d,p))}return b.promise}});
define("orion/EventTarget",[],function(){function e(){this._namedListeners={}}e.prototype={dispatchEvent:function(g){if(!g.type)throw Error("unspecified type");var h=this._namedListeners[g.type];h&&h.forEach(function(h){try{"function"===typeof h?h(g):h.handleEvent(g)}catch(f){"undefined"!==typeof console&&console.log(f)}});return!g.defaultPrevented},addEventListener:function(g,h){if("function"===typeof h||h.handleEvent)this._namedListeners[g]=this._namedListeners[g]||[],this._namedListeners[g].push(h)},
removeEventListener:function(g,h){var e=this._namedListeners[g];if(e)for(var f=0;f<e.length;f++)if(e[f]===h){1===e.length?delete this._namedListeners[g]:e.splice(f,1);break}}};e.prototype.constructor=e;e.attach=function(g){var h=new e;g.dispatchEvent=h.dispatchEvent.bind(h);g.addEventListener=h.addEventListener.bind(h);g.removeEventListener=h.removeEventListener.bind(h)};return e});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(e,g){function h(a,c,b){this._properties=b||{};this._properties["service.id"]=a;this._properties.objectClass=c;this._properties["service.names"]=c}function m(a,c,b){this._serviceId=a;this._serviceReference=c;this._internalRegistry=b}function f(a,c){function b(l){return function(){var b;try{if(!c())throw Error("Service was unregistered");var k=a[l].apply(a,Array.prototype.slice.call(arguments));if(k&&"function"===typeof k.then)return k;
b=new e;b.resolve(k)}catch(d){b=new e,b.reject(d)}return b.promise}}for(var k in a)"function"===typeof a[k]&&(this[k]=b(k))}function d(a,c){this.type=a;this.serviceReference=c}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new g;var a=this;this._internalRegistry={isRegistered:function(c){return a._entries[c]?!0:!1},unregisterService:function(c){var b=a._entries[c];if(!b)throw Error("Service has already been unregistered: "+c);var k=b.reference;a._serviceEventTarget.dispatchEvent(new d("unregistering",
k));a._entries[c]=null;k.getProperty("objectClass").forEach(function(c){for(var b=a._namedReferences[c],l=0;l<b.length;l++)if(b[l]===k){1===b.length?delete a._namedReferences[c]:b.splice(l,1);break}})},modifyService:function(c){var b=a._entries[c];if(!b)throw Error("Service not found while trying to send modified event: "+c);a._serviceEventTarget.dispatchEvent(new d("modified",b.reference))}}}h.prototype={getPropertyKeys:function(){var a=[],c;for(c in this._properties)this._properties.hasOwnProperty(c)&&
a.push(c);return a},getProperty:function(a){return this._properties[a]}};h.prototype.constructor=h;m.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 c=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;
a.objectClass=c.objectClass;a["service.names"]=c["service.names"];this._internalRegistry.modifyService(this._serviceId)}};m.prototype.constructor=m;b.prototype={getService:function(a){var c;if("string"===typeof a)(a=this._namedReferences[a])&&a.some(function(a){c=this._entries[a.getProperty("service.id")].service;return!!c},this);else if(a=this._entries[a.getProperty("service.id")])c=a.service;return c||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:
[];var c=[];this._entries.forEach(function(a){a&&c.push(a.reference)});return c},registerService:function(a,c,b){if("undefined"===typeof c||null===c)throw Error("invalid service");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var k=this._entries.length,g=new h(k,a,b),e=this._namedReferences;a.forEach(function(a){e[a]=e[a]||[];e[a].push(g)});a=new f(c,this._internalRegistry.isRegistered.bind(null,k));this._entries.push({reference:g,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new d("registered",
g));return new m(k,g,a)},addEventListener:function(a,c){this._serviceEventTarget.addEventListener(a,c)},removeEventListener:function(a,c){this._serviceEventTarget.removeEventListener(a,c)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(e,g){function h(f,d,b,a){e("GET",f,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=c.response?JSON.parse(c.response):null;d.progress(c);!c.type||"loadstart"===c.type||"progress"===c.type?setTimeout(function(){h(f,d,b,a)},2E3):("error"===c.type||"abort"===c.type?d.reject(a?a(c):c.Result):d.resolve(b?b(c):c.Result.JsonData),c.Location||e("DELETE",f,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(a){var b=a;if(void 0!==
a.responseText){b=a.responseText;try{b=JSON.parse(a.responseText)}catch(k){}}void 0!==b.Message?(b.HttpCode=void 0===b.HttpCode?a.status:b.HttpCode,b.Severity=void 0===b.Severity?"Error":b.Severity,d.reject(b)):d.reject({Severity:"Error",Message:b,HttpCode:a.status})})}function m(f,d){d.then(null,function(b){b instanceof Error&&"Cancel"===b.name&&e("PUT",f,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(f,d,b){var a=new g;m(f,a);h(f,a,d,b);return a}}});
define("orion/git/gitClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(e,g,h,m){var f=f||{};f.GitService=function(){function d(b){b&&(this._serviceRegistry=b,this._serviceRegistration=b.registerService("orion.git.provider",this))}d.prototype={checkGitService:function(){},cloneGitRepository:function(b,a,c,l,k,d,f,p,n,x,m){var w=this,r={};b&&(r.Name=b);c&&(r.Path=c);a&&(r.GitUrl=a);r.Location=l;k&&(r.GitSshUsername=k);d&&(r.GitSshPassword=d);f&&(r.GitSshKnownHost=f);p&&(r.GitSshPrivateKey=
p);n&&(r.GitSshPassphrase=n);x&&(x.GitMail&&(r.GitMail=x.GitMail),x.GitName&&(r.GitName=x.GitName));m&&(r.initProject=m);b=e.toUrl("gitapi/clone/._");b=b.substring(0,b.length-2);var s=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(r)}).then(function(a){w._getGitServiceResponse(s,a)},function(a){w._handleGitServiceResponseError(s,a)});return s},removeGitRepository:function(b){var a=this,c=new h;g("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},getGitStatus:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},
stage:function(b){var a=this,c=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},stageMultipleFiles:function(b,a){var c=this,l=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a})}).then(function(a){c._getGitServiceResponse(l,
a)},function(a){c._handleGitServiceResponseError(l,a)});return l},unstageAll:function(b,a){var c=this,l=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Reset:a})}).then(function(a){c._getGitServiceResponse(l,a)},function(a){c._handleGitServiceResponseError(l,a)});return l},unstage:function(b,a){var c=this,l=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a})}).then(function(a){c._getGitServiceResponse(l,a)},function(a){c._handleGitServiceResponseError(l,a)});return l},checkoutPath:function(b,a){var c=this,l=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a,RemoveUntracked:"true"})}).then(function(a){c._getGitServiceResponse(l,a)},function(a){c._handleGitServiceResponseError(l,a)});return l},
commitAll:function(b,a,c){var l=this,k=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:c}).then(function(a){l._getGitServiceResponse(k,a)},function(a){l._handleGitServiceResponseError(k,a)});return k},getGitClone:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},
function(b){a._handleGitServiceResponseError(c,b)});return c},getGitCloneConfig:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},getGitBranch:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,
b)},function(b){a._handleGitServiceResponseError(c,b)});return c},getGitRemote:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},checkoutBranch:function(b,a){var c=this,l=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify({Branch:a})}).then(function(a){c._getGitServiceResponse(l,a)},function(a){c._handleGitServiceResponseError(l,a)});return l},resetIndex:function(b,a,c){var l=this,k=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Commit:a,Reset:c?c:"HARD"})}).then(function(a){l._getGitServiceResponse(k,a)},function(a){l._handleGitServiceResponseError(k,a)});return k},addBranch:function(b,a,c){var l=
this,k={};a&&(k.Name=a);c&&(k.Branch=c);var d=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(k)}).then(function(a){l._getGitServiceResponse(d,a)},function(a){l._handleGitServiceResponseError(d,a)});return d},removeBranch:function(b){var a=this,c=new h;g("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,
b)},function(b){a._handleGitServiceResponseError(c,b)});return c},addRemote:function(b,a,c){var d=this,k=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Remote:a,RemoteURI:c})}).then(function(a){d._getGitServiceResponse(k,a)},function(a){d._handleGitServiceResponseError(k,a)});return k},removeRemote:function(b){var a=this,c=new h;g("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},doGitLog:function(b){var a=this,c=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},getDiff:function(b,a){var c=this,d=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({New:a})}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)});return d},doFetch:function(b,a,c,d,k,f,e){var p=this,n=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Fetch:"true",Force:a,GitSshUsername:c,GitSshPassword:d,GitSshKnownHost:k,GitSshPrivateKey:f,GitSshPassphrase:e})}).then(function(a){p._getGitServiceResponse(n,
a)},function(a){p._handleGitServiceResponseError(n,a)});return n},doPull:function(b,a,c,d,k,f,e){var p=this,n=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Pull:"true",Force:a,GitSshUsername:c,GitSshPassword:d,GitSshKnownHost:k,GitSshPrivateKey:f,GitSshPassphrase:e})}).then(function(a){p._getGitServiceResponse(n,a)},function(a){p._handleGitServiceResponseError(n,a)});return n},doMerge:function(b,
a,c){var d=this,k=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Merge:a,Squash:c})}).then(function(a){d._getGitServiceResponse(k,a)},function(a){d._handleGitServiceResponseError(k,a)});return k},doCherryPick:function(b,a){var c=this,d=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({"Cherry-Pick":a})}).then(function(a){c._getGitServiceResponse(d,
a)},function(a){c._handleGitServiceResponseError(d,a)});return d},doRevert:function(b,a){var c=this,d=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Revert:a})}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)});return d},doRebase:function(b,a,c){var d=this,k={};k.Rebase=a;c&&(k.Operation=c);var f=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify(k)}).then(function(a){d._getGitServiceResponse(f,a)},function(a){d._handleGitServiceResponseError(f,a)});return f},doPush:function(b,a,c,d,k,f,e,p,n){var m=this,y=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({PushSrcRef:a,PushTags:c,Force:d,GitSshUsername:k,GitSshPassword:f,GitSshKnownHost:e,GitSshPrivateKey:p,GitSshPassphrase:n})}).then(function(a){m._getGitServiceResponse(y,
a)},function(a){m._handleGitServiceResponseError(y,a)});return y},getLog:function(b,a){var c=this,d=new h,k=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({New:a})}).then(function(a){k.resolve(a.xhr.getResponseHeader("Location"))},function(a){c._handleGitServiceResponseError(d,a)});k.then(function(a){g("GET",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,
handleAs:"json"}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)})});return d},getDefaultRemoteBranch:function(b){var a=this,c=new h,d=new h;g("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(d,b)},function(b){a._handleGitServiceResponseError(c,b)});d.then(function(b){g("GET",b.Children[0].Location,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)})});return c},doAddTag:function(b,a){var c=this,d=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Name:a})}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)});return d},doRemoveTag:function(b){var a=this,c=new h;g("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},checkoutTag:function(b,a,c){var d=this,f=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Tag:a,Branch:c})}).then(function(a){d._getGitServiceResponse(f,a)},function(a){d._handleGitServiceResponseError(f,
a)});return f},addCloneConfigurationProperty:function(b,a,c){var d=this,f=new h;g("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Key:a,Value:c})}).then(function(a){d._getGitServiceResponse(f,a)},function(a){d._handleGitServiceResponseError(f,a)});return f},editCloneConfigurationProperty:function(b,a){var c=this,d=new h;g("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Value:a})}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)});return d},deleteCloneConfigurationProperty:function(b){var a=this,c=new h;g("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(b){a._handleGitServiceResponseError(c,b)});return c},sendCommitReviewRequest:function(b,
a,c,d,f,e){var m=this,p=new h;g("POST",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({ReviewReqCommit:b,ReviewReqUrl:d,ReviewReqNotifyLogin:c,ReviewReqAuthorName:f,ReviewMessage:e})}).then(function(a){m._getGitServiceResponse(p,a)},function(a){m._handleGitServiceResponseError(p,a)});return p},_getGitServiceResponse:function(b,a){var c=a.response?JSON.parse(a.response):null;if(a.xhr&&202===a.xhr.status){var d=m.handle(c.Location);
d.then(b.resolve,function(a){a.failedOperation=c.Location;b.reject(a)},b.progress);b.then(null,function(a){d.reject(a)})}else b.resolve(c)},_handleGitServiceResponseError:function(b,a){b.reject(a)}};return d}();return f});
define("orion/ssh/sshTools",["orion/Deferred","orion/xhr"],function(e,g){var h=h||{};h.SshService=function(){function h(f){if(f&&(this._serviceRegistry=f,this._authService=f.getService("orion.core.auth"),this._serviceRegistration=f.registerService("orion.net.ssh",this),!this._authService)){var d;this._authService={getUser:function(){if(d){var b=new e;b.resolve(d);return b}return g("POST","../../login",{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return d=a.response?JSON.parse(a.response):
null},function(a){d=null;return a instanceof Error&&"Cancel"===a.name?"_cancel":a.response?JSON.parse(a.response):null})}}}}h.prototype={KNOWN_HOSTS:"knownHosts",addKnownHost:function(f){f=f||{};var d=new e,b=this,a=f.host,c=f.keyType,g=f.hostKey,k=f.port||22;if(!a||!c||!g||!k)return d.reject(),d;this._authService.getUser().then(function(f){for(var e=localStorage.getItem(f.login+"/"+b.KNOWN_HOSTS),e=e?JSON.parse(e):[],h=0;h<e.length;++h){var n=e[h];if(n.host===a&&n.port===k){d.resolve(n.host+" "+
n.keyType+" "+n.hostKey);return}}n={host:a,port:k,keyType:c,hostKey:g};e.push(n);localStorage.setItem(f.login+"/"+b.KNOWN_HOSTS,JSON.stringify(e));d.resolve(n.host+" "+n.keyType+" "+n.hostKey)},function(a){d.reject(a)});return d},clearKnownHosts:function(){var f=new e,d=this;this._authService.getUser().then(function(b){var a=localStorage.getItem(b.login+"/"+d.KNOWN_HOSTS),a=a?JSON.parse(a):[];localStorage.removeItem(b.login+"/"+d.KNOWN_HOSTS);f.resolve(a)},function(b){f.reject(b)});return f},getKnownHostCredentials:function(f,
d){var b=new e,a=this;d=d||22;if(!f||!d)return b.reject(),b;this._authService.getUser().then(function(c){c=(c=localStorage.getItem(c.login+"/"+a.KNOWN_HOSTS))?JSON.parse(c):[];for(var g=0;g<c.length;++g){var e=c[g];if(e.host===f&&e.port===d){b.resolve(e.host+" "+e.keyType+" "+e.hostKey);return}}b.resolve("")},function(a){b.reject(a)});return b}};return h}();return h});
define("orion/i18nUtil",["require","orion/Deferred"],function(e,g){function h(f){if(f=localStorage.getItem("orion/messageBundle/"+f))if(f=JSON.parse(f),f._expires&&f._expires>(new Date).getTime())return delete f._expires,f;return null}var m={};return{getMessageBundle:function(f){function d(c){c?e(["i18n!"+f],function(b){if(b){var c=f;b._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+c,JSON.stringify(b));delete b._expires}a.resolve(b)}):b(Error(f))}function b(b){a.reject(b)}
if(m[f])return m[f];var a=new g;m[f]=a;var c=h(f);if(c)return a.resolve(c),a;try{e([f],d,b)}catch(l){e(["orion/i18n!"+f],d,b)}return a},formatMessage:function(f){var d=arguments;return f.replace(/\$\{([^\}]+)\}/g,function(b,a){return d[(a<<0)+1]})}}});
(function(){function e(a){if("string"!==typeof a)throw new TypeError;}function g(a){return a?a.split("\x26"):[]}function h(a){return 0===a.length?"":a.join("\x26")}function m(a){var b=/([^=]*)(?:=?)(.*)/.exec(a);a=b[1]?decodeURIComponent(b[1]):"";b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function f(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="\x3d"+encodeURIComponent(a[1]));return b}function d(a,b){var c="",d=[],f=0;return{next:function(){c!==a.query&&(c=a.query,d=g(c));if(f<d.length){var e=
m(d[f++]);switch(b){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 b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function a(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function c(a){var b=[];a.split("/").forEach(function(a){".."===a?b.pop():"."!==a&&b.push(a)});return b.join("/")}function l(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function k(b,d){if("string"!==
typeof b)throw new TypeError;b=l(b);var f=n.exec(b);if(!f)return null;var e={};e.scheme=f[1]||"";if(e.scheme&&!y.test(e.scheme))return null;var g=f[2];if(g&&(g=x.exec(g),e.userinfo=g[1],e.host=g[2],e.port=g[3],e.port&&!w.test(e.port)))return null;e.path=f[3];e.query=f[4];e.fragment=f[5];!e.scheme&&d&&(e.scheme=d.scheme,!e.host&&d.host&&(e.userinfo=d.userinfo,e.host=d.host,e.port=d.port,e.pathRelative=!0));e.pathRelative&&(e.path?"/"!==e.path[0]&&(f=/^(.*\/)[^\/]*$/.exec(d.path)[1]||"/",e.path=f+e.path):
e.path=d.path);e.scheme&&(e.scheme=e.scheme.toLowerCase());e.port&&(e.port=a(e.port));e.host&&e.path&&(e.path=c(e.path));return e}function u(a,c){var d;if(c){c=c.href||c;d=k(c);if(!d||!d.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:d})}d=k(a,d);if(!d)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:d,writable:!0});var e=new b(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(p){}var n=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,x=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,y=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,w=/^\d*$/,r=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,s=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,z=/^([^?#\s]*)$/,v=/^([^\s]*)$/,C=/^\S*$/,A=/([^:]*):?(.*)/,B="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),D={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){e(a);var b;g(this._url.query).some(function(c){c=m(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){e(a);e(b);var c=g(this._url.query);c.some(function(d,e){var g=m(d);if(g[0]===a)return g[1]=b,c[e]=f(g),!0})||c.push(f([a,b]));this._url.query=h(c)},enumerable:!0},has:{value:function(a){e(a);
return g(this._url.query).some(function(b){if(m(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){e(a);var b=g(this._url.query),c=b.filter(function(b){return m(b)[0]!==a});return c.length!==b.length?(this._url.query=h(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if("function"!==typeof a)throw new TypeError;var c=d(this._url,"keys+values");try{for(;;){var e=c.next();a.call(b,e[1],e[0],this)}}catch(f){if(f!==B)throw f;
}},enumerable:!0},keys:{value:function(){return d(this._url,"keys")},enumerable:!0},values:{value:function(){return d(this._url,"values")},enumerable:!0},items:{value:function(){return d(this._url,"keys+values")}},size:{get:function(){return g(this._url.query).length},enumerable:!0},getAll:{value:function(a){e(a);var b=[];g(this._url.query).forEach(function(c){c=m(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){e(a);e(b);var c=g(this._url.query);c.push(f([a,b]));this._url.query=
h(c)},enumerable:!0}});Object.defineProperties(u.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(a){e(a);this._input=a;this._url=k(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){e(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||y.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){e(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){e(a);if(this._url){var b=
A.exec(this._userinfo);a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){e(a);if(this._url){var b=[A.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(b){e(b);if(this._url&&(b=s.exec(b)))this._url.host=b[1],this._url.port=a(b[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){e(a);this._url&&r.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===D[this.protocol]&&(a="");return a},set:function(b){e(b);this._url&&w.exec(b)&&(this._url.port=a(b))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){e(a);
this._url&&z.exec(a)&&(this._url.host&&(a&&"/"!==a[0])&&(a="/"+a),this._url.path=a?c(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){e(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),v.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){e(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),C.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((q=window.URL||window.webkitURL)&&q.createObjectURL)Object.defineProperty(u,"createObjectURL",{value:q.createObjectURL.bind(q),enumerable:!1}),Object.defineProperty(u,"revokeObjectURL",{value:q.revokeObjectURL.bind(q),enumerable:!1});window.URL=u})();define("orion/URL-shim",function(){});
define("orion/git/util",["orion/URL-shim"],function(e){function g(d){for(var b=0;b<f.length;b++)if(d.type===f[b])return!0;return!1}function h(d){for(var b=0;b<m.length;b++)if(d.type===m[b])return!0;return!1}var m=["Missing","Modified","Untracked","Conflicting"],f=["Added","Changed","Removed"];return{statusUILocation:"git/git-status.html",isStaged:g,isUnstaged:h,isChange:function(d){return g(d)||h(d)},hasStagedChanges:function(d){for(var b=0;b<f.length;b++)if(0<d[f[b]].length)return!0;return!1},hasUnstagedChanges:function(d){for(var b=
0;b<m.length;b++)if(0<d[m[b]].length)return!0;return!1},parseSshGitUrl:function(d){try{var b=new URL(d);return{host:b.hostname,port:b.port}}catch(a){try{var c=d.split(":")[0].split("@");return{host:1<c.length?c[1]:c[0],port:22}}catch(e){return{host:"",port:""}}}},trimCommitMessage:function(d){d=d.split(/\r\n|\n/);for(var b=0;0<d.length&&/^\s*$/.test(d[b]);)b++;return 100<d[b].length?d[b].substring(0,100)+"...":d[b]},getGerritFooter:function(d){d=d.split(/\r\n|\n/);for(var b={},a=0,c=d.length-1;0<=
c;--c)if(0===d[c].indexOf("Change-Id: ")){if(b.changeId=d[c].substring(11,d[c].length),1<++a){b={};break}}else 0===d[c].indexOf("Signed-off-by: ")&&(b.signedOffBy=d[c].substring(15,d[c].length));return b}}});
define("domReady",[],function(){function e(){if(!b){b=!0;f&&clearInterval(f);var d=c;if(b&&d.length){c=[];var e;for(e=0;e<d.length;e+=1)d[e](a)}}}function g(d){b?d(a):c.push(d);return g}var h,m,f,d="undefined"!==typeof window&&window.document,b=!d,a=d?document:null,c=[];if(d){if(document.addEventListener)document.addEventListener("DOMContentLoaded",e,!1),window.addEventListener("load",e,!1);else if(window.attachEvent){window.attachEvent("onload",e);m=document.createElement("div");try{h=null===window.frameElement}catch(l){}m.doScroll&&
(h&&window.external)&&(f=setInterval(function(){try{m.doScroll(),e()}catch(a){}},30))}"complete"===document.readyState&&e()}g.version="2.0.1";g.load=function(a,b,c,d){d.isBuild?c(null):g(c)};return g});
define("git/plugins/gitPlugin","orion/plugin orion/xhr orion/serviceregistry orion/git/gitClient orion/ssh/sshTools orion/i18nUtil orion/Deferred orion/git/util orion/URL-shim domReady!".split(" "),function(e,g,h,m,f,d,b,a){function c(a){var b=a,c={};0<a.indexOf("://")&&(b=a.substring(a.indexOf("://")+3));a=b.split("/");c.serverName=a[0];c.serverName.indexOf("@")&&(c.serverName=c.serverName.substring(c.serverName.indexOf("@")+1));c.repoName=a[a.length-1];0<c.repoName.indexOf(".git")&&(c.repoName=
c.repoName.substring(0,c.repoName.lastIndexOf(".git")));return c}function l(a){return 0<a.indexOf("@")&&0<=a.indexOf("ssh://")?a.substring(0,a.indexOf("ssh://")+6)+a.substring(a.indexOf("@")+1):a}var k=document.createElement("a");k.href="../mixloginstatic/LoginWindow.html";h=new h.ServiceRegistry;var u=new m.GitService(h),q=new f.SshService(h);e=new e({name:"Orion Git Support",version:"1.0",description:"This plugin provides Git Support to the Orion File Service.",login:k.href});e.registerService("orion.page.link.category",
null,{id:"git",nameKey:"Git",nls:"git/nls/gitmessages",imageClass:"core-sprite-git-logo",order:20});e.registerService("orion.page.link",{},{nameKey:"Repositories",id:"orion.git.repositories",nls:"git/nls/gitmessages",category:"git",order:1E3,uriTemplate:"{+OrionHome}/git/git-repository.html#"});e.registerService("orion.navigate.command",{},{nameKey:"Git Log",id:"eclipse.git.log",tooltipKey:"Go to Git Log",nls:"git/nls/gitmessages",validationProperties:[{source:"Git:CommitLocation",variableName:"GitLogLocation"}],
uriTemplate:"{+OrionHome}/git/git-log.html#{,GitLogLocation}?page\x3d1",forceSingleItem:!0});e.registerService("orion.navigate.command",{},{nameKey:"Git Remote",id:"eclipse.git.remote",tooltipKey:"Go to Git Remote",nls:"git/nls/gitmessages",validationProperties:[{source:"Git:DefaultRemoteBranchLocation",variableName:"GitRemoteLocation"}],uriTemplate:"{+OrionHome}/git/git-log.html#{,GitRemoteLocation}?page\x3d1",forceSingleItem:!0});e.registerService("orion.navigate.command",null,{id:"eclipse.git.repository",
nameKey:"Git Repository",tooltipKey:"Go to the git repository",nls:"git/nls/gitmessages",category:"git",validationProperties:[{source:"Git:CloneLocation",variableName:"GitRepoLocation"}],uriTemplate:"{+OrionHome}/git/git-repository.html#{,GitRepoLocation}"});e.registerService("orion.core.content",null,{id:"orion.content.gitClone",nls:"git/nls/gitmessages",nameKey:"Clone Git Repository",descriptionKey:"Go to the Orion repositories page to provide a git repository URL. Once the repository is created, it will appear in the Navigator.",
uriTemplate:"{+OrionHome}/git/git-repository.html#,cloneGitRepository\x3dURL"});e.registerService("orion.page.link.related",null,{id:"eclipse.git.repository",category:"git",order:10});e.registerService("orion.page.link.related",null,{id:"eclipse.git.log",category:"git"});e.registerService("orion.page.link.related",null,{nameKey:"Active Branch Log",id:"eclipse.orion.git.switchToCurrentLocal",tooltipKey:"Show the log for the active local branch",nls:"git/nls/gitmessages",category:"git",validationProperties:[{source:"Clone:ActiveBranch",
variableName:"GitBranchLocation"},{source:"toRef:Type",match:"RemoteTrackingBranch"}],uriTemplate:"{+OrionHome}/git/git-log.html#{,GitBranchLocation}?page\x3d1",forceSingleItem:!0});e.registerService("orion.page.link.related",null,{nameKey:"Remote Branch Log",id:"eclipse.orion.git.switchToRemote2",tooltipKey:"Show the log for the corresponding remote tracking branch",nls:"git/nls/gitmessages",category:"git",validationProperties:[{source:"toRef:RemoteLocation:0:Children:0:CommitLocation",variableName:"GitRemoteLocation"}],
uriTemplate:"{+OrionHome}/git/git-log.html#{,GitRemoteLocation}?page\x3d1",forceSingleItem:!0});e.registerService("orion.page.link.related",null,{id:"eclipse.git.repository2",category:"git",order:10,nameKey:"Git Repository",tooltipKey:"Go to the git repository",nls:"git/nls/gitmessages",validationProperties:[{source:"CloneLocation",variableName:"GitCloneLocation"},{source:"Type",match:"Commit"}],uriTemplate:"{+OrionHome}/git/git-repository.html#{,GitCloneLocation}"});e.registerService("orion.page.link.related",
null,{id:"eclipse.git.repository3",category:"git",order:10,nameKey:"Git Repository",tooltipKey:"Go to the git repository",nls:"git/nls/gitmessages",validationProperties:[{source:"Location",variableName:"GitCloneLocation"},{source:"Type",match:"Clone"}],uriTemplate:"{+OrionHome}/git/git-repository.html#{,GitCloneLocation}"});e.registerService("orion.page.link.related",null,{id:"eclipse.git.repository",category:"git"});e.registerService("orion.page.link.related",null,{id:"orion.git.gotoEclipseGit",
nameKey:"Show Repository in eclipse.org",tooltipKey:"Show this repository in eclipse.org",nls:"git/nls/gitmessages",category:"git",validationProperties:[{source:"GitUrl|Clone:GitUrl",match:"git.eclipse.org/gitroot",variableName:"EclipseGitLocation",variableMatchPosition:"after"}],uriTemplate:"http://git.eclipse.org/c{+EclipseGitLocation}"});e.registerService("orion.page.link.related",null,{id:"orion.git.gotoGithub",nameKey:"Show Repository in GitHub",nls:"git/nls/gitmessages",tooltipKey:"Show this repository in GitHub",
category:"git",validationProperties:[{source:"GitUrl|Clone:GitUrl",match:"github.com.*.git",variableName:"GitHubLocation",variableMatchPosition:"only",replacements:[{pattern:":",replacement:"/"},{pattern:".git$",replacement:""}]}],uriTemplate:"https://{+GitHubLocation}"});e.registerServiceProvider("orion.page.link.related",null,{id:"orion.git.gotoGithubCommit",nameKey:"Show Commit in GitHub",nls:"git/nls/gitmessages",tooltipKey:"Show this commit in GitHub",category:"git",validationProperties:[{source:"GitUrl",
match:"github.com.*.git",variableName:"GitHubLocation",variableMatchPosition:"only",replacements:[{pattern:":",replacement:"/"},{pattern:".git$",replacement:""}]},{source:"Type",match:"Commit"},{source:"Name",variableName:"commitName"}],uriTemplate:"https://{+GitHubLocation}/commit/{+commitName}"});e.registerServiceProvider("orion.page.link.related",null,{id:"orion.git.gotoEclipseGitCommit",nameKey:"Show Commit in eclipse.org",nls:"git/nls/gitmessages",tooltipKey:"Show this commit in eclipse.org",
category:"git",validationProperties:[{source:"GitUrl",match:"git.eclipse.org/gitroot",variableName:"EclipseGitLocation",variableMatchPosition:"after"},{source:"Type",match:"Commit"},{source:"Name",variableName:"commitName"}],uriTemplate:"http://git.eclipse.org/c{+EclipseGitLocation}/commit/?id\x3d{+commitName}"});k.href="../../gitapi/diff/";e.registerService("orion.core.diff",{getDiffContent:function(a){a=new URL(a,window.location);a.query.set("parts","diff");return g("GET",a.href,{headers:{"Orion-Version":"1"},
timeout:15E3}).then(function(a){return a.responseText})},getDiffFileURI:function(a){a=new URL(a,window.location);a.query.set("parts","uris");return g("GET",a.href,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return JSON.parse(a.responseText)})}},{pattern:k.href});e.registerService("orion.project.handler",{paramsToDependencyDescription:function(a){return{Type:"git",Location:l(a.url)}},_cloneRepository:function(e,f,g,h){var k=this,m=new b,s=a.parseSshGitUrl(e);q.getKnownHostCredentials(s.host,
s.port).then(function(b){u.cloneGitRepository(null,e,null,g,f.sshuser,f.sshpassword,b,f.sshprivateKey,f.sshpassphrase,null,h).then(function(a){u.getGitClone(a.Location).then(function(a){a.Children&&(a=a.Children[0]);var b=c(a.GitUrl);h?m.resolve({ContentLocation:a.ContentLocation}):m.resolve({Type:"git",Location:l(a.GitUrl),Name:(b.repoName||a.Name)+" at "+b.serverName})},m.reject,m.progress)}.bind(this),function(b){try{if(b&&void 0!==b.status)try{b=JSON.parse(b.responseText)}catch(c){b={Message:"Problem while performing the action"}}}catch(h){m.reject(b);
return}if(b.JsonData){if(b.JsonData.HostKey){if(confirm(d.formatMessage("Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.",b.JsonData.KeyType,b.JsonData.Host,b.JsonData.HostFingerprint))){var l=a.parseSshGitUrl(b.JsonData.Url);q.addKnownHost({host:b.JsonData.Host,keyType:b.JsonData.KeyType,hostKey:b.JsonData.HostKey,port:l.port}).then(function(){k._cloneRepository(e,f,g).then(m.resolve,m.reject,m.progress)})}else m.reject(b);return}if(b.JsonData.Host){b.Retry=
{addParameters:[{id:"sshuser",type:"text",name:"User Name:"},{id:"sshpassword",type:"password",name:"Password:"}],optionalParameters:[{id:"sshprivateKey",type:"textarea",name:"Ssh Private Key:"},{id:"sshpassphrase",type:"password",name:"Ssh Passphrase:"}]};m.reject(b);return}}m.reject(b)}.bind(this),m.progress)});return m},initDependency:function(a,b,c){a=l(a.Location||b.url);return this._cloneRepository(a,b,c.WorkspaceLocation)},initProject:function(a,b){var c=l(a.url);return this._cloneRepository(c,
a,b.WorkspaceLocation,!0)},getDependencyDescription:function(a){if(!a.Git)return null;var d=new b;u.getGitClone(a.Git.CloneLocation).then(function(a){a.Children&&(a=a.Children[0]);if(a.GitUrl){var b=c(a.GitUrl);d.resolve({Type:"git",Location:l(a.GitUrl),Name:(b.repoName||a.Name)+" at "+b.serverName})}},d.reject,d.progress);return d},getAdditionalProjectProperties:function(a,c){if(!a.Git)return null;var d=new b;u.getGitClone(a.Git.CloneLocation).then(function(b){b.Children&&(b=b.Children[0]);d.resolve([{Name:"Git",
Children:[{Name:"Git Url",Value:b.GitUrl},{Name:"Git Status",Value:"Git Status",Href:"{+OrionHome}/git/git-status.html#"+a.Git.StatusLocation}]}])},d.reject,d.progress);return d}},{id:"orion.git.projecthandler",type:"git",addParameters:[{id:"url",type:"url",name:"Url:"}],optionalParameters:[{id:"sshuser",type:"text",name:"User Name:"},{id:"sshpassword",type:"password",name:"Password:"},{id:"sshprivateKey",type:"textarea",name:"Ssh Private Key:"},{id:"sshpassphrase",type:"password",name:"Ssh Passphrase:"}],
addDependencyName:"Git Repository",addDependencyTooltip:"Associate a git repository with this project.",addProjectName:"Git Repository",addProjectTooltip:"Create a project from a git repository.",actionComment:"Cloning ${url}",validationProperties:[{source:"Git"}]});e.connect()});
//@ sourceMappingURL=gitPlugin.js.map