/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/******************************************************************************* 
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 *******************************************************************************/

/**
 * @license 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
 */

/******************************************************************************* 
 * @license
 * 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) 2011, 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) 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(f,h){typeof define==="function"&&define.amd?define("orion/Deferred",h):typeof exports==="object"?module.exports=h():(f.orion=f.orion||{},f.orion.Deferred=h())})(this,function(){function f(){for(var d;d=e.shift();)d();g=!1}function h(d){e.push(d);g||(g=!0,setTimeout(f,0))}function i(d){return function(){d.apply(void 0,arguments)}}function k(){function d(){for(var a;a=g.shift();){var b=a.deferred,c=m==="fulfilled"?"resolve":"reject";if(typeof a[c]==="function")try{var d=(0,a[c])(j),l=d&&(typeof d===
"object"||typeof d==="function")&&d.then;if(typeof l==="function")if(d===b.promise)b.reject(new TypeError);else{var h=d.cancel;typeof h==="function"?b._protected(e).parentCancel=h.bind(d):delete b._protected(e).parentCancel;l.call(d,i(b.resolve),i(b.reject),i(b.progress))}else b.resolve(d)}catch(n){b.reject(n)}else b[c](j)}}function a(b){delete n.parentCancel;m="rejected";j=b;g.length&&h(d)}function b(c){function e(b){return function(a){i||(i=!0,b(a))}}var i=!1;delete n.parentCancel;try{var f=c&&
(typeof c==="object"||typeof c==="function")&&c.then;if(typeof f==="function")if(c===l)a(new TypeError);else{m="assumed";var r=c&&c.cancel;if(typeof r!=="function"){var s=new k,c=s.promise;try{f(s.resolve,s.reject,s.progress)}catch(t){s.reject(t)}r=c.cancel;f=c.then}j=c;f.call(c,e(b),e(a));n.parentCancel=r.bind(c)}else m="fulfilled",j=c,g.length&&h(d)}catch(y){e(a)(y)}}function c(){var b=n.parentCancel;if(b)delete n.parentCancel,b();else if(!m)b=Error("Cancel"),b.name="Cancel",a(b)}var j,m,g=[],l=
this,n={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==e)throw Error("protected");return n}});this.resolve=function(a){m||b(a);return l};this.reject=function(b){m||a(b);return l};this.progress=function(b){m||g.forEach(function(a){if(a.progress)try{a.progress(b)}catch(c){}});return l.promise};this.cancel=function(){n.parentCancel?setTimeout(c,0):c();return l};this.then=function(b,a,c){b={resolve:b,reject:a,progress:c,deferred:new k};g.push(b);b.deferred._protected(e).parentCancel=
l.promise.cancel.bind(l);(m==="fulfilled"||m==="rejected")&&h(d);return b.deferred.promise};this.promise={then:l.then,cancel:l.cancel}}var e=[],g=!1;k.all=function(d,a){function b(b,a){g||(e[b]=a,--j===0&&l.resolve(e))}function c(c,d){if(!g){if(a)try{b(c,a(d));return}catch(j){d=j}l.reject(d)}}var j=d.length,e=[],g=!1,l=new k;l.then(void 0,function(){g=!0;d.forEach(function(b){b.cancel&&b.cancel()})});j===0?l.resolve(e):d.forEach(function(a,d){a.then(b.bind(void 0,d),c.bind(void 0,d))});return l.promise};
k.when=function(d,a,b,c){var j;if(!(d&&typeof d.then==="function"))j=new k,j.resolve(d),d=j.promise;return d.then(a,b,c)};return k});
(function(f,h){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],h):typeof exports==="object"?module.exports=h(require("orion/Deferred")):(f.orion=f.orion||{},f.orion.PluginProvider=h(f.orion.Deferred))})(this,function(f){function h(h,f){this.__objectId=h;this.__methods=f}return function(i){function k(b){l&&(typeof ArrayBuffer==="undefined"&&(b=JSON.stringify(b)),l===self?l.postMessage(b):l.postMessage(b,"*"))}function e(){var b=[];Object.keys(s).forEach(function(a){var c=
s[a];b.push({serviceId:a,names:c.names,methods:c.methods,properties:c.properties})});return{headers:m||{},services:b}}function g(b,a){if(a&&a instanceof XMLHttpRequest){var c,d;try{c=a.status,d=a.statusText}catch(q){c=0,d=""}return{status:c||0,statusText:d}}return a}function d(b){var a=b?JSON.parse(JSON.stringify(b,g)):b;if(b instanceof Error)a.__isError=!0,a.message=a.message||b.message,a.name=a.name||b.name;return a}function a(b){if(!l)return(new f).reject(Error("plugin not connected"));b.id=String(n++);
var a=new f;p[b.id]=a;a.then(null,function(a){o&&a instanceof Error&&a.name==="Cancel"&&t({requestId:b.id,method:"cancel",params:a.message?[a.message]:[]})});var c=Object.prototype.toString;b.params.forEach(function(d,q){if(c.call(d)==="[object Object]"&&!(d instanceof h)){var j,e;for(j in d)c.call(d[j])==="[object Function]"&&(e=e||[],e.push(j));if(e){var g=x++;r[g]=d;j=function(){delete r[g]};a.then(j,j);b.params[q]=new h(g,e)}}});t(b);return a.promise}function b(b,a){b||b===0?t({id:b,result:null,
error:a}):console.log(a)}function c(b,c,j,e){e.forEach(function(b,c){if(b&&typeof b.__objectId!=="undefined"){var d={};b.__methods.forEach(function(c){d[c]=function(){return a({objectId:b.__objectId,method:c,params:Array.prototype.slice.call(arguments)})}});e[c]=d}});var q=typeof b===void 0?null:{id:b,result:null,error:null};try{var g=j.apply(c,e);if(q)g&&typeof g.then==="function"?(v[b]=g,g.then(function(a){delete v[b];q.result=a;t(q)},function(a){if(v[b])delete v[b],q.error=d(a),t(q)},function(){t({responseId:b,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(q.result=g,t(q))}catch(l){if(q)q.error=d(l),t(q)}}function j(a){if(a.source===l){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var d=a.method,j=a.params||[];if("serviceId"in a){var e=s[a.serviceId];e||b(a.id,"service not found");e=e.implementation;d in e?c(a.id,e,e[d],j):b(a.id,"method not found")}else if("objectId"in a){var q=r[a.objectId];q||b(a.id,"object not found");!d in q?c(a.id,q,q[d],j):b(a.id,"method not found")}else if("requestId"in
a){var g=v[a.requestId];g&&d==="cancel"&&g.cancel&&g.cancel.apply(g,j)}else if("responseId"in a){var h=p[a.responseId];h&&d==="progress"&&h.progress&&h.progress.apply(h,j)}else throw Error("Bad method: "+a.method);}else{var i=p[String(a.id)];delete p[String(a.id)];a.error?i.reject(a.error):i.resolve(a.result)}}catch(m){console.log("Plugin._messageHandler "+m)}}}var m=i,o=!1,l=null,n=0,x=0,u=0,v={},p={},r={},s={},t=k;this.updateHeaders=function(a){if(o)throw Error("Cannot update headers. Plugin Provider is connected");
m=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(o)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,j=[];for(d in b)typeof b[d]==="function"&&j.push(d);s[u++]={names:a,methods:j,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!o){if(typeof window==="undefined")l=self;else if(window!==window.parent)l=window.parent;else if(window.opener!==null)l=window.opener;else{b&&
b("No valid plugin target");return}addEventListener("message",j,!1);var c={method:"plugin",params:[e()]};k(c);o=!0}a&&a()};this.disconnect=function(){o&&(removeEventListener("message",j),l=null,o=!1)}}});
define("orion/xhr",["orion/Deferred"],function(f){function h(h,f,e,g){var d=typeof e.response!=="undefined"?e.response:e.responseText,a;try{a=e.status}catch(b){a=0}h={args:f,response:d,responseText:typeof d==="string"?d:null,status:a,url:h,xhr:e};if(typeof g!=="undefined")h.error=g;return h}return function(i,k,e){var e=e||{},g=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,d=new f,a=e.headers||{},b=e.log||!1,c;typeof a["X-Requested-With"]==="undefined"&&(a["X-Requested-With"]="XMLHttpRequest");
if(typeof e.data!=="undefined"&&(i==="POST"||i==="PUT"))c=e.data;var j=!1,m=!1;d.promise.then(void 0,function(a){j=!0;!m&&a instanceof Error&&a.name==="Cancel"&&g.abort()});g.onabort=function(){m=!0;if(!j){var a=Error("Cancel");a.name="Cancel";d.reject(a)}};g.onload=function(){var a=h(k,e,g);200<=g.status&&g.status<400?d.resolve(a):(d.reject(a),b&&typeof console!=="undefined"&&console.log(Error(g.statusText)))};g.onerror=function(){var a=h(k,e,g);d.reject(a);b&&typeof console!=="undefined"&&console.log(Error(g.statusText))};
g.onprogress=function(a){a.xhr=g;d.progress(a)};try{g.open(i,k,!0);if(typeof e.responseType==="string")g.responseType=e.responseType;if(typeof e.timeout==="number")if(typeof g.timeout==="number")g.timeout=e.timeout,g.addEventListener("timeout",function(){d.reject(h(k,e,g,"Timeout exceeded"))});else{var o=setTimeout(function(){d.reject(h(k,e,g,"Timeout exceeded"))},e.timeout);d.promise.then(clearTimeout.bind(null,o),clearTimeout.bind(null,o))}Object.keys(a).forEach(function(b){g.setRequestHeader(b,
a[b])});g.send(c||null)}catch(l){d.reject(h(k,e,g,l))}return d.promise}});
define("orion/EventTarget",[],function(){function f(){this._namedListeners={}}f.prototype={dispatchEvent:function(h){if(!h.type)throw Error("unspecified type");var f=this._namedListeners[h.type];f&&f.forEach(function(f){try{typeof f==="function"?f(h):f.handleEvent(h)}catch(e){typeof console!=="undefined"&&console.log(e)}});return!h.defaultPrevented},addEventListener:function(h,f){if(typeof f==="function"||f.handleEvent)this._namedListeners[h]=this._namedListeners[h]||[],this._namedListeners[h].push(f)},
removeEventListener:function(h,f){var k=this._namedListeners[h];if(k)for(var e=0;e<k.length;e++)if(k[e]===f){k.length===1?delete this._namedListeners[h]:k.splice(e,1);break}}};f.prototype.constructor=f;f.attach=function(h){var i=new f;h.dispatchEvent=i.dispatchEvent.bind(i);h.addEventListener=i.addEventListener.bind(i);h.removeEventListener=i.removeEventListener.bind(i)};return f});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(f,h){function i(a,b,c){this._properties=c||{};this._properties["service.id"]=a;this._properties.objectClass=b;this._properties["service.names"]=b}function k(a,b,c){this._serviceId=a;this._serviceReference=b;this._internalRegistry=c}function e(a,b){function c(c){return function(){var d;try{if(!b())throw Error("Service was unregistered");var j=a[c].apply(a,Array.prototype.slice.call(arguments));if(j&&typeof j.then==="function")return j;
else d=new f,d.resolve(j)}catch(e){d=new f,d.reject(e)}return d.promise}}for(var d in a)typeof a[d]==="function"&&(this[d]=c(d))}function g(a,b){this.type=a;this.serviceReference=b}function d(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new h;var a=this;this._internalRegistry={isRegistered:function(b){return a._entries[b]?!0:!1},unregisterService:function(b){var c=a._entries[b];if(!c)throw Error("Service has already been unregistered: "+b);var d=c.reference;a._serviceEventTarget.dispatchEvent(new g("unregistering",
d));a._entries[b]=null;d.getProperty("objectClass").forEach(function(b){for(var c=a._namedReferences[b],e=0;e<c.length;e++)if(c[e]===d){c.length===1?delete a._namedReferences[b]:c.splice(e,1);break}})},modifyService:function(b){var c=a._entries[b];if(!c)throw Error("Service not found while trying to send modified event: "+b);a._serviceEventTarget.dispatchEvent(new g("modified",c.reference))}}}i.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]}};i.prototype.constructor=i;k.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)}};k.prototype.constructor=k;d.prototype={getService:function(a){var b;if(typeof a==="string")(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,b,c){if(typeof b==="undefined"||b===null)throw Error("invalid service");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=this._entries.length,h=new i(d,a,c),f=this._namedReferences;a.forEach(function(a){f[a]=f[a]||[];f[a].push(h)});a=new e(b,this._internalRegistry.isRegistered.bind(null,d));this._entries.push({reference:h,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",
h));return new k(d,h,a)},addEventListener:function(a,b){this._serviceEventTarget.addEventListener(a,b)},removeEventListener:function(a,b){this._serviceEventTarget.removeEventListener(a,b)}};d.prototype.constructor=d;return{ServiceRegistry:d}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(f,h){function i(e,g,d,a){f("GET",e,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=b.response?JSON.parse(b.response):null;g.progress(b);!b.type||b.type==="loadstart"||b.type==="progress"?setTimeout(function(){i(e,g,d,a)},2E3):(b.type==="error"||b.type==="abort"?g.reject(a?a(b):b.Result):g.resolve(d?d(b):b.Result.JsonData),b.Location||f("DELETE",e,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(a){var c=a;if(a.responseText!==
void 0){c=a.responseText;try{c=JSON.parse(a.responseText)}catch(d){}}c.Message!==void 0?(c.HttpCode=c.HttpCode===void 0?a.status:c.HttpCode,c.Severity=c.Severity===void 0?"Error":c.Severity,g.reject(c)):g.reject({Severity:"Error",Message:c,HttpCode:a.status})})}function k(e,g){g.then(null,function(d){d instanceof Error&&d.name==="Cancel"&&f("PUT",e,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(e,g,d){var a=new h;k(e,a);i(e,a,g,d);return a}}});
define("orion/git/gitClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(f,h,i,k){var e=e||{};e.GitService=function(){function e(d){if(d)this._serviceRegistry=d,this._serviceRegistration=d.registerService("orion.git.provider",this)}e.prototype={checkGitService:function(){},cloneGitRepository:function(d,a,b,c,j,e,g,l,n,k,u){var v=this,p={};if(d)p.Name=d;if(b)p.Path=b;if(a)p.GitUrl=a;p.Location=c;if(j)p.GitSshUsername=j;if(e)p.GitSshPassword=e;if(g)p.GitSshKnownHost=g;if(l)p.GitSshPrivateKey=
l;if(n)p.GitSshPassphrase=n;if(k){if(k.GitMail)p.GitMail=k.GitMail;if(k.GitName)p.GitName=k.GitName}if(u)p.initProject=u;var d=f.toUrl("gitapi/clone/._"),d=d.substring(0,d.length-2),r=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(p)}).then(function(a){v._getGitServiceResponse(r,a)},function(a){v._handleGitServiceResponseError(r,a)});return r},removeGitRepository:function(d){var a=this,b=new i;h("DELETE",
d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},getGitStatus:function(d){var a=this,b=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},stage:function(d){var a=
this,b=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},stageMultipleFiles:function(d,a){var b=this,c=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,
a)});return c},unstageAll:function(d,a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Reset:a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},unstage:function(d,a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a})}).then(function(a){b._getGitServiceResponse(c,
a)},function(a){b._handleGitServiceResponseError(c,a)});return c},checkoutPath:function(d,a){var b=this,c=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:a,RemoveUntracked:"true"})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},commitAll:function(d,a,b){var c=this,e=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},
timeout:15E3,handleAs:"json",data:b}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},getGitClone:function(d){var a=this,b=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},getGitCloneConfig:function(d){var a=this,b=new i;h("GET",d,{headers:{"Orion-Version":"1",
"Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},getGitBranch:function(d){var a=this,b=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},getGitRemote:function(d){var a=this,
b=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},checkoutBranch:function(d,a){var b=this,c=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Branch:a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,
a)});return c},resetIndex:function(d,a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Commit:a,Reset:"HARD"})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},addBranch:function(d,a,b){var c=this,e={};if(a)e.Name=a;if(b)e.Branch=b;var g=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify(e)}).then(function(a){c._getGitServiceResponse(g,a)},function(a){c._handleGitServiceResponseError(g,a)});return g},removeBranch:function(d){var a=this,b=new i;h("DELETE",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},addRemote:function(d,a,b){var c=this,e=new i;h("POST",d,{headers:{"Orion-Version":"1",
"Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Remote:a,RemoteURI:b})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},removeRemote:function(d){var a=this,b=new i;h("DELETE",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});
return b},doGitLog:function(d){var a=this,b=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},getDiff:function(d,a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({New:a})}).then(function(a){b._getGitServiceResponse(c,
a)},function(a){b._handleGitServiceResponseError(c,a)});return c},doFetch:function(d,a,b,c,e,g,f){var l=this,n=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Fetch:"true",Force:a,GitSshUsername:b,GitSshPassword:c,GitSshKnownHost:e,GitSshPrivateKey:g,GitSshPassphrase:f})}).then(function(a){l._getGitServiceResponse(n,a)},function(a){l._handleGitServiceResponseError(n,a)});return n},doPull:function(d,
a,b,c,e,g,f){var l=this,n=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Pull:"true",Force:a,GitSshUsername:b,GitSshPassword:c,GitSshKnownHost:e,GitSshPrivateKey:g,GitSshPassphrase:f})}).then(function(a){l._getGitServiceResponse(n,a)},function(a){l._handleGitServiceResponseError(n,a)});return n},doMerge:function(d,a,b){var c=this,e=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Merge:a,Squash:b})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},doCherryPick:function(d,a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({"Cherry-Pick":a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},doRevert:function(d,
a){var b=this,c=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Revert:a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},doRebase:function(d,a,b){var c=this,e={};e.Rebase=a;if(b)e.Operation=b;var g=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(e)}).then(function(a){c._getGitServiceResponse(g,
a)},function(a){c._handleGitServiceResponseError(g,a)});return g},doPush:function(d,a,b,c,e,g,f,l,n){var k=this,u=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({PushSrcRef:a,PushTags:b,Force:c,GitSshUsername:e,GitSshPassword:g,GitSshKnownHost:f,GitSshPrivateKey:l,GitSshPassphrase:n})}).then(function(a){k._getGitServiceResponse(u,a)},function(a){k._handleGitServiceResponseError(u,a)});return u},getLog:function(d,
a){var b=this,c=new i,e=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({New:a})}).then(function(a){e.resolve(a.xhr.getResponseHeader("Location"))},function(a){b._handleGitServiceResponseError(c,a)});e.then(function(a){h("GET",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,
a)})});return c},getDefaultRemoteBranch:function(d){var a=this,b=new i,c=new i;h("GET",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){a._getGitServiceResponse(c,b)},function(c){a._handleGitServiceResponseError(b,c)});c.then(function(c){h("GET",c.Children[0].Location,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,
c)},function(c){a._handleGitServiceResponseError(b,c)})});return b},doAddTag:function(d,a){var b=this,c=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Name:a})}).then(function(a){b._getGitServiceResponse(c,a)},function(a){b._handleGitServiceResponseError(c,a)});return c},doRemoveTag:function(d){var a=this,b=new i;h("DELETE",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},
timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},checkoutTag:function(d,a,b){var c=this,e=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Tag:a,Branch:b})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},addCloneConfigurationProperty:function(d,a,b){var c=
this,e=new i;h("POST",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Key:a,Value:b})}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(e,a)});return e},editCloneConfigurationProperty:function(d,a){var b=this,c=new i;h("PUT",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Value:a})}).then(function(a){b._getGitServiceResponse(c,
a)},function(a){b._handleGitServiceResponseError(c,a)});return c},deleteCloneConfigurationProperty:function(d){var a=this,b=new i;h("DELETE",d,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json"}).then(function(c){a._getGitServiceResponse(b,c)},function(c){a._handleGitServiceResponseError(b,c)});return b},sendCommitReviewRequest:function(d,a,b,c,e,g){var f=this,l=new i;h("POST",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset=UTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({ReviewReqCommit:d,ReviewReqUrl:c,ReviewReqNotifyLogin:b,ReviewReqAuthorName:e,ReviewMessage:g})}).then(function(a){f._getGitServiceResponse(l,a)},function(a){f._handleGitServiceResponseError(l,a)});return l},_getGitServiceResponse:function(d,a){var b=a.response?JSON.parse(a.response):null;if(a.xhr&&a.xhr.status===202){var c=k.handle(b.Location);c.then(d.resolve,function(a){a.failedOperation=b.Location;d.reject(a)},d.progress);d.then(null,function(a){c.reject(a)})}else d.resolve(b)},
_handleGitServiceResponseError:function(d,a){d.reject(a)}};return e}();return e});
define("orion/ssh/sshTools",["orion/Deferred","orion/xhr"],function(f,h){var i=i||{};i.SshService=function(){function i(e){if(e&&(this._serviceRegistry=e,this._authService=e.getService("orion.core.auth"),this._serviceRegistration=e.registerService("orion.net.ssh",this),!this._authService)){var g;this._authService={getUser:function(){if(g){var d=new f;d.resolve(g);return d}return h("POST","../../login",{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return g=a.response?JSON.parse(a.response):
null},function(a){g=null;return a instanceof Error&&a.name==="Cancel"?"_cancel":a.response?JSON.parse(a.response):null})}}}}i.prototype={KNOWN_HOSTS:"knownHosts",addKnownHost:function(e){var e=e||{},g=new f,d=this,a=e.host,b=e.keyType,c=e.hostKey,h=e.port||22;if(!a||!b||!c||!h)return g.reject(),g;this._authService.getUser().then(function(e){for(var f=localStorage.getItem(e.login+"/"+d.KNOWN_HOSTS),f=f?JSON.parse(f):[],l=0;l<f.length;++l){var i=f[l];if(i.host===a&&i.port===h){g.resolve(i.host+" "+
i.keyType+" "+i.hostKey);return}}i={host:a,port:h,keyType:b,hostKey:c};f.push(i);localStorage.setItem(e.login+"/"+d.KNOWN_HOSTS,JSON.stringify(f));g.resolve(i.host+" "+i.keyType+" "+i.hostKey)},function(a){g.reject(a)});return g},clearKnownHosts:function(){var e=new f,g=this;this._authService.getUser().then(function(d){var a=localStorage.getItem(d.login+"/"+g.KNOWN_HOSTS),a=a?JSON.parse(a):[];localStorage.removeItem(d.login+"/"+g.KNOWN_HOSTS);e.resolve(a)},function(d){e.reject(d)});return e},getKnownHostCredentials:function(e,
g){var d=new f,a=this,g=g||22;if(!e||!g)return d.reject(),d;this._authService.getUser().then(function(b){for(var b=(b=localStorage.getItem(b.login+"/"+a.KNOWN_HOSTS))?JSON.parse(b):[],c=0;c<b.length;++c){var f=b[c];if(f.host===e&&f.port===g){d.resolve(f.host+" "+f.keyType+" "+f.hostKey);return}}d.resolve("")},function(a){d.reject(a)});return d}};return i}();return i});
define("orion/i18nUtil",["require","orion/Deferred"],function(f,h){function i(e){if(e=localStorage.getItem("orion/messageBundle/"+e))if(e=JSON.parse(e),e._expires&&e._expires>(new Date).getTime())return delete e._expires,e;return null}var k={};return{getMessageBundle:function(e){function g(b){b?f(["i18n!"+e],function(b){if(b){var c=e;b._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+c,JSON.stringify(b));delete b._expires}a.resolve(b)}):d(Error(e))}function d(b){a.reject(b)}
if(k[e])return k[e];var a=new h;k[e]=a;var b=i(e);if(b)return a.resolve(b),a;try{f([e],g,d)}catch(c){f(["orion/i18n!"+e],g,d)}return a},formatMessage:function(e){var g=arguments;return e.replace(/\$\{([^\}]+)\}/g,function(d,a){return g[(a<<0)+1]})}}});
(function(){function f(a){if(typeof a!=="string")throw new TypeError;}function h(a){return a?a.split("&"):[]}function i(a){return a.length===0?"":a.join("&")}function k(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function e(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function g(a,b){var c="",d=[],e=0;return{next:function(){if(c!==a.query)c=a.query,d=h(c);if(e<d.length){var g=k(d[e++]);
switch(b){case "keys":return g[0];case "values":return g[1];case "keys+values":return[g[0],g[1]];default:throw new TypeError;}}throw z;}}}function d(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function a(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function b(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function c(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function j(d,e){if(typeof d!==
"string")throw new TypeError;var d=c(d),g=n.exec(d);if(!g)return null;var f={};f.scheme=g[1]||"";if(f.scheme&&!u.test(f.scheme))return null;var h=g[2];if(h&&(h=x.exec(h),f.userinfo=h[1],f.host=h[2],f.port=h[3],f.port&&!v.test(f.port)))return null;f.path=g[3];f.query=g[4];f.fragment=g[5];if(!f.scheme&&e&&(f.scheme=e.scheme,!f.host&&e.host))f.userinfo=e.userinfo,f.host=e.host,f.port=e.port,f.pathRelative=!0;if(f.pathRelative)if(f.path){if(f.path[0]!=="/")g=/^(.*\/)[^\/]*$/.exec(e.path)[1]||"/",f.path=
g+f.path}else f.path=e.path;if(f.scheme)f.scheme=f.scheme.toLowerCase();if(f.port)f.port=a(f.port);if(f.host&&f.path)f.path=b(f.path);return f}function m(a,b){var c;if(b){b=b.href||b;c=j(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=j(a,c);if(!c)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:c,writable:!0});var e=new d(this);Object.defineProperty(this,"query",{get:function(){return this._url?
e:null},enumerable:!0})}try{var o;if(typeof window.URL==="function"&&window.URL.length!==0&&(o=new window.URL("http://www.w3.org?q")).protocol==="http:"&&o.query)return}catch(l){}var n=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,x=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,u=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,v=/^\d*$/,p=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,r=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,s=/^([^?#\s]*)$/,t=/^([^\s]*)$/,y=/^\S*$/,w=/([^:]*):?(.*)/,z=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),A={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(d.prototype,{get:{value:function(a){f(a);var b;h(this._url.query).some(function(c){c=k(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){f(a);f(b);var c=h(this._url.query);c.some(function(d,f){var g=k(d);if(g[0]===a)return g[1]=b,c[f]=e(g),!0})||c.push(e([a,b]));this._url.query=i(c)},enumerable:!0},has:{value:function(a){f(a);
return h(this._url.query).some(function(b){if(k(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){f(a);var b=h(this._url.query),c=b.filter(function(b){return k(b)[0]!==a});return c.length!==b.length?(this._url.query=i(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var c=g(this._url,"keys+values");try{for(;;){var d=c.next();a.call(b,d[1],d[0],this)}}catch(e){if(e!==z)throw e;
}},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 h(this._url.query).length},enumerable:!0},getAll:{value:function(a){f(a);var b=[];h(this._url.query).forEach(function(c){c=k(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){f(a);f(b);var c=h(this._url.query);c.push(e([a,b]));this._url.query=
i(c)},enumerable:!0}});Object.defineProperties(m.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(a){f(a);this._input=a;this._url=j(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){f(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,a===""||u.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){f(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=w.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){f(a);if(this._url){var b=
w.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=w.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){f(a);if(this._url){var b=[w.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){f(b);if(this._url&&(b=r.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){f(a);if(this._url&&p.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===A[this.protocol]&&(a="");return a},set:function(b){f(b);if(this._url&&v.exec(b))this._url.port=a(b)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){f(a);
if(this._url&&s.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?b(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){f(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),t.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){f(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),y.exec(a)))this._url.fragment=a},enumerable:!0}});
if((o=window.URL||window.webkitURL)&&o.createObjectURL)Object.defineProperty(m,"createObjectURL",{value:o.createObjectURL.bind(o),enumerable:!1}),Object.defineProperty(m,"revokeObjectURL",{value:o.revokeObjectURL.bind(o),enumerable:!1});window.URL=m})();define("orion/URL-shim",function(){});
define("orion/git/util",["orion/URL-shim"],function(){function f(e){for(var f=0;f<k.length;f++)if(e.type===k[f])return!0;return!1}function h(e){for(var f=0;f<i.length;f++)if(e.type===i[f])return!0;return!1}var i=["Missing","Modified","Untracked","Conflicting"],k=["Added","Changed","Removed"];return{statusUILocation:"git/git-status.html",isStaged:f,isUnstaged:h,isChange:function(e){return f(e)||h(e)},hasStagedChanges:function(e){for(var f=0;f<k.length;f++)if(e[k[f]].length>0)return!0;return!1},hasUnstagedChanges:function(e){for(var f=
0;f<i.length;f++)if(e[i[f]].length>0)return!0;return!1},parseSshGitUrl:function(e){try{var f=new URL(e);return{host:f.hostname,port:f.port}}catch(d){try{var a=e.split(":")[0].split("@");return{host:a.length>1?a[1]:a[0],port:22}}catch(b){return{host:"",port:""}}}}}});
define("domReady",[],function(){function f(){if(!d){d=!0;e&&clearInterval(e);var c=b;if(d&&c.length){b=[];var f;for(f=0;f<c.length;f+=1)c[f](a)}}}function h(c){d?c(a):b.push(c);return h}var i,k,e,g=typeof window!=="undefined"&&window.document,d=!g,a=g?document:null,b=[];if(g){if(document.addEventListener)document.addEventListener("DOMContentLoaded",f,!1),window.addEventListener("load",f,!1);else if(window.attachEvent){window.attachEvent("onload",f);k=document.createElement("div");try{i=window.frameElement===
null}catch(c){}k.doScroll&&i&&window.external&&(e=setInterval(function(){try{k.doScroll(),f()}catch(a){}},30))}document.readyState==="complete"&&f()}h.version="2.0.1";h.load=function(a,b,c,d){d.isBuild?c(null):h(c)};return h});
define('built-gitPlugin.js',"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(f,h,i,k,e,g,d,a){function b(a){var b=a,c={};a.indexOf("://")>0&&(b=a.substring(a.indexOf("://")+3));a=b.split("/");c.serverName=a[0];if(c.serverName.indexOf("@"))c.serverName=c.serverName.substring(c.serverName.indexOf("@")+1);c.repoName=a[a.length-1];if(c.repoName.indexOf(".git")>0)c.repoName=
c.repoName.substring(0,c.repoName.lastIndexOf(".git"));return c}function c(a){return a.indexOf("@")>0&&a.indexOf("ssh://")>=0?a.substring(0,a.indexOf("ssh://")+6)+a.substring(a.indexOf("@")+1):a}var j=document.createElement("a");j.href="../mixloginstatic/LoginWindow.html";var i=new i.ServiceRegistry,m=new k.GitService(i),o=new e.SshService(i),f=new f({name:"Orion Git Support",version:"1.0",description:"This plugin provides Git Support to the Orion File Service.",login:j.href});f.registerService("orion.page.link.category",
null,{id:"git",nameKey:"Git",nls:"git/nls/gitmessages",imageClass:"core-sprite-repository",order:20});f.registerService("orion.page.link",{},{nameKey:"Repositories",id:"orion.git.repositories",nls:"git/nls/gitmessages",category:"git",order:110,"default":!0,force:!0,uriTemplate:"{+OrionHome}/git/git-repository.html#"});f.registerService("orion.navigate.command",{},{nameKey:"Git Status",id:"eclipse.git.status",tooltipKey:"Go to Git Status",nls:"git/nls/gitmessages",validationProperties:[{source:"Git:StatusLocation",
variableName:"GitStatusLocation"},{source:"Directory",match:!0}],uriTemplate:"{+OrionHome}/git/git-status.html#{,GitStatusLocation}",forceSingleItem:!0});f.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=1",forceSingleItem:!0});f.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=1",forceSingleItem:!0});f.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}"});f.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=URL"});f.registerService("orion.page.link.related",
null,{id:"eclipse.git.status",category:"git",order:10});f.registerService("orion.page.link.related",null,{nameKey:"Git Status",id:"eclipse.git.status2",tooltipKey:"Go to Git Status",nls:"git/nls/gitmessages",category:"git",order:10,validationProperties:[{source:"StatusLocation|Clone:StatusLocation",variableName:"GitStatusLocation"}],uriTemplate:"{+OrionHome}/git/git-status.html#{,GitStatusLocation}"});f.registerService("orion.page.link.related",null,{id:"eclipse.git.log",category:"git"});f.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=1",forceSingleItem:!0});f.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=1",forceSingleItem:!0});f.registerService("orion.page.link.related",null,{id:"eclipse.git.repository2",category:"git",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}"});f.registerService("orion.page.link.related",null,{id:"eclipse.git.repository",category:"git"});f.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}"});f.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}"});f.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}"});f.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={+commitName}"});j.href="../../gitapi/diff/";f.registerService("orion.core.diff",{getDiffContent:function(a){a=new URL(a,window.location);a.query.set("parts","diff");return h("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 h("GET",a.href,{headers:{"Orion-Version":"1"},
timeout:15E3}).then(function(a){return JSON.parse(a.responseText)})}},{pattern:j.href});f.registerService("orion.project.handler",{paramsToDependencyDescription:function(a){return{Type:"git",Location:c(a.url)}},_cloneRepository:function(e,f,h,i){var k=this,j=new d,r=a.parseSshGitUrl(e);o.getKnownHostCredentials(r.host,r.port).then(function(d){m.cloneGitRepository(null,e,null,h,f.sshuser,f.sshpassword,d,f.sshprivateKey,f.sshpassphrase,null,i).then(function(a){m.getGitClone(a.Location).then(function(a){a.Children&&
(a=a.Children[0]);var d=b(a.GitUrl);i?j.resolve({ContentLocation:a.ContentLocation}):j.resolve({Type:"git",Location:c(a.GitUrl),Name:(d.repoName||a.Name)+" at "+d.serverName})},j.reject,j.progress)}.bind(this),function(b){try{if(b&&b.status!==void 0)try{b=JSON.parse(b.responseText)}catch(c){b={Message:"Problem while performing the action"}}}catch(d){j.reject(b);return}if(b.JsonData){if(b.JsonData.HostKey){if(confirm(g.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 i=a.parseSshGitUrl(b.JsonData.Url);o.addKnownHost({host:b.JsonData.Host,keyType:b.JsonData.KeyType,hostKey:b.JsonData.HostKey,port:i.port}).then(function(){k._cloneRepository(e,f,h).then(j.resolve,j.reject,j.progress)})}else j.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:"}]};j.reject(b);return}}j.reject(b)}.bind(this),j.progress)});return j},initDependency:function(a,b,d){return this._cloneRepository(c(a.Location||b.url),b,d.WorkspaceLocation)},initProject:function(a,b){return this._cloneRepository(c(a.url),a,b.WorkspaceLocation,!0)},getDependencyDescription:function(a){if(!a.Git)return null;var e=new d;m.getGitClone(a.Git.CloneLocation).then(function(a){a.Children&&(a=a.Children[0]);
if(a.GitUrl){var d=b(a.GitUrl);e.resolve({Type:"git",Location:c(a.GitUrl),Name:(d.repoName||a.Name)+" at "+d.serverName})}},e.reject,e.progress);return e},getAdditionalProjectProperties:function(a){if(!a.Git)return null;var b=new d;m.getGitClone(a.Git.CloneLocation).then(function(c){c.Children&&(c=c.Children[0]);b.resolve([{Name:"Git",Children:[{Name:"Git Url",Value:c.GitUrl},{Name:"Git Status",Value:"Git Status",Href:"{+OrionHome}/git/git-status.html#"+a.Git.StatusLocation}]}])},b.reject,b.progress);
return b}},{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"}]});f.connect()});