/*******************************************************************************
 * @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) 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, 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) 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) 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
*/
(function(c,g){typeof define==="function"&&define.amd?define("orion/Deferred",g):typeof exports==="object"?module.exports=g():(c.orion=c.orion||{},c.orion.Deferred=g())})(this,function(){function c(){for(var b;b=e.shift();)b();d=!1}function g(b){e.push(b);d||(d=!0,setTimeout(c,0))}function j(b){return function(){b.apply(void 0,arguments)}}function h(){function b(){for(var d;d=k.shift();){var b=d.deferred,o=l==="fulfilled"?"resolve":"reject";if(typeof d[o]==="function")try{var f=(0,d[o])(a),c=f&&(typeof f===
"object"||typeof f==="function")&&f.then;if(typeof c==="function")if(f===b.promise)b.reject(new TypeError);else{var i=f.cancel;typeof i==="function"?b._protected(e).parentCancel=i.bind(f):delete b._protected(e).parentCancel;c.call(f,j(b.resolve),j(b.reject),j(b.progress))}else b.resolve(f)}catch(h){b.reject(h)}else b[o](a)}}function d(f){delete o.parentCancel;l="rejected";a=f;k.length&&g(b)}function i(p){function c(b){return function(a){e||(e=!0,b(a))}}var e=!1;delete o.parentCancel;try{var j=p&&
(typeof p==="object"||typeof p==="function")&&p.then;if(typeof j==="function")if(p===f)d(new TypeError);else{l="assumed";var q=p&&p.cancel;if(typeof q!=="function"){var s=new h,p=s.promise;try{j(s.resolve,s.reject,s.progress)}catch(t){s.reject(t)}q=p.cancel;j=p.then}a=p;j.call(p,c(i),c(d));o.parentCancel=q.bind(p)}else l="fulfilled",a=p,k.length&&g(b)}catch(z){c(d)(z)}}function c(){var b=o.parentCancel;if(b)delete o.parentCancel,b();else if(!l)b=Error("Cancel"),b.name="Cancel",d(b)}var a,l,k=[],f=
this,o={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==e)throw Error("protected");return o}});this.resolve=function(b){l||i(b);return f};this.reject=function(b){l||d(b);return f};this.progress=function(b){l||k.forEach(function(a){if(a.progress)try{a.progress(b)}catch(d){}});return f.promise};this.cancel=function(){o.parentCancel?setTimeout(c,0):c();return f};this.then=function(a,d,o){a={resolve:a,reject:d,progress:o,deferred:new h};k.push(a);a.deferred._protected(e).parentCancel=
f.promise.cancel.bind(f);(l==="fulfilled"||l==="rejected")&&g(b);return a.deferred.promise};this.promise={then:f.then,cancel:f.cancel}}var e=[],d=!1;h.all=function(b,d){function c(b,d){k||(l[b]=d,--a===0&&f.resolve(l))}function e(b,a){if(!k){if(d)try{c(b,d(a));return}catch(l){a=l}f.reject(a)}}var a=b.length,l=[],k=!1,f=new h;f.then(void 0,function(){k=!0;b.forEach(function(b){b.cancel&&b.cancel()})});a===0?f.resolve(l):b.forEach(function(b,a){b.then(c.bind(void 0,a),e.bind(void 0,a))});return f.promise};
h.when=function(b,d,c,e){var a;if(!(b&&typeof b.then==="function"))a=new h,a.resolve(b),b=a.promise;return b.then(d,c,e)};return h});
(function(c,g){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],g):typeof exports==="object"?module.exports=g(require("orion/Deferred")):(c.orion=c.orion||{},c.orion.PluginProvider=g(c.orion.Deferred))})(this,function(c){function g(c,h){this.__objectId=c;this.__methods=h}return function(j){function h(b){f&&(typeof ArrayBuffer==="undefined"&&(b=JSON.stringify(b)),f===self?f.postMessage(b):f.postMessage(b,"*"))}function e(){var b=[];Object.keys(s).forEach(function(a){var d=
s[a];b.push({serviceId:a,names:d.names,methods:d.methods,properties:d.properties})});return{headers:l||{},services:b}}function d(b,a){if(a&&a instanceof XMLHttpRequest){var d,f;try{d=a.status,f=a.statusText}catch(n){d=0,f=""}return{status:d||0,statusText:f}}return a}function b(b){var a=b?JSON.parse(JSON.stringify(b,d)):b;if(b instanceof Error)a.__isError=!0,a.message=a.message||b.message,a.name=a.name||b.name;return a}function m(b){if(!f)return(new c).reject(Error("plugin not connected"));b.id=String(o++);
var a=new c;v[b.id]=a;a.then(null,function(a){k&&a instanceof Error&&a.name==="Cancel"&&t({requestId:b.id,method:"cancel",params:a.message?[a.message]:[]})});var d=Object.prototype.toString;b.params.forEach(function(f,n){if(d.call(f)==="[object Object]"&&!(f instanceof g)){var r,c;for(r in f)d.call(f[r])==="[object Function]"&&(c=c||[],c.push(r));if(c){var A=p++;w[A]=f;r=function(){delete w[A]};a.then(r,r);b.params[n]=new g(A,c)}}});t(b);return a.promise}function i(b,a){b||b===0?t({id:b,result:null,
error:a}):console.log(a)}function q(a,d,f,c){c.forEach(function(n,a){if(n&&typeof n.__objectId!=="undefined"){var b={};n.__methods.forEach(function(a){b[a]=function(){return m({objectId:n.__objectId,method:a,params:Array.prototype.slice.call(arguments)})}});c[a]=b}});var n=typeof a===void 0?null:{id:a,result:null,error:null};try{var r=f.apply(d,c);if(n)r&&typeof r.then==="function"?(u[a]=r,r.then(function(b){delete u[a];n.result=b;t(n)},function(d){if(u[a])delete u[a],n.error=b(d),t(n)},function(){t({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(n.result=r,t(n))}catch(k){if(n)n.error=b(k),t(n)}}function a(a){if(a.source===f){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,d=a.params||[];if("serviceId"in a){var c=s[a.serviceId];c||i(a.id,"service not found");c=c.implementation;b in c?q(a.id,c,c[b],d):i(a.id,"method not found")}else if("objectId"in a){var n=w[a.objectId];n||i(a.id,"object not found");!b in n?q(a.id,n,n[b],d):i(a.id,"method not found")}else if("requestId"in
a){var r=u[a.requestId];r&&b==="cancel"&&r.cancel&&r.cancel.apply(r,d)}else if("responseId"in a){var k=v[a.responseId];k&&b==="progress"&&k.progress&&k.progress.apply(k,d)}else throw Error("Bad method: "+a.method);}else{var l=v[String(a.id)];delete v[String(a.id)];a.error?l.reject(a.error):l.resolve(a.result)}}catch(o){console.log("Plugin._messageHandler "+o)}}}var l=j,k=!1,f=null,o=0,p=0,x=0,u={},v={},w={},s={},t=h;this.updateHeaders=function(a){if(k)throw Error("Cannot update headers. Plugin Provider is connected");
l=a};this.registerServiceProvider=this.registerService=function(a,b,d){if(k)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var f=null,n=[];for(f in b)typeof b[f]==="function"&&n.push(f);s[x++]={names:a,methods:n,implementation:b,properties:d||{},listeners:{}}};this.connect=function(b,d){if(!k){if(typeof window==="undefined")f=self;else if(window!==window.parent)f=window.parent;else if(window.opener!==null)f=window.opener;else{d&&
d("No valid plugin target");return}addEventListener("message",a,!1);var c={method:"plugin",params:[e()]};h(c);k=!0}b&&b()};this.disconnect=function(){k&&(removeEventListener("message",a),f=null,k=!1)}}});
define("orion/xhr",["orion/Deferred"],function(c){function g(c,h,e,d){var b=typeof e.response!=="undefined"?e.response:e.responseText,g;try{g=e.status}catch(i){g=0}c={args:h,response:b,responseText:typeof b==="string"?b:null,status:g,url:c,xhr:e};if(typeof d!=="undefined")c.error=d;return c}return function(j,h,e){var e=e||{},d=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new c,m=e.headers||{},i=e.log||!1,q;typeof m["X-Requested-With"]==="undefined"&&(m["X-Requested-With"]="XMLHttpRequest");
if(typeof e.data!=="undefined"&&(j==="POST"||j==="PUT"))q=e.data;var a=!1,l=!1;b.promise.then(void 0,function(b){a=!0;!l&&b instanceof Error&&b.name==="Cancel"&&d.abort()});d.onabort=function(){l=!0;if(!a){var d=Error("Cancel");d.name="Cancel";b.reject(d)}};d.onload=function(){var a=g(h,e,d);200<=d.status&&d.status<400?b.resolve(a):(b.reject(a),i&&typeof console!=="undefined"&&console.log(Error(d.statusText)))};d.onerror=function(){var a=g(h,e,d);b.reject(a);i&&typeof console!=="undefined"&&console.log(Error(d.statusText))};
d.onprogress=function(a){a.xhr=d;b.progress(a)};try{d.open(j,h,!0);if(typeof e.responseType==="string")d.responseType=e.responseType;if(typeof e.timeout==="number")if(typeof d.timeout==="number")d.timeout=e.timeout,d.addEventListener("timeout",function(){b.reject(g(h,e,d,"Timeout exceeded"))});else{var k=setTimeout(function(){b.reject(g(h,e,d,"Timeout exceeded"))},e.timeout);b.promise.then(clearTimeout.bind(null,k),clearTimeout.bind(null,k))}Object.keys(m).forEach(function(a){d.setRequestHeader(a,
m[a])});d.send(q||null)}catch(f){b.reject(g(h,e,d,f))}return b.promise}});
define("orion/URITemplate",[],function(){function c(a){this._text=a}function g(a){return a.replace("%25","%")}function j(a,b){if(b==="U")return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(b==="U+R")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(q,g);if(b==="U+R-,")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function h(a,b,d){for(var c=
[],e=0;e<a.length;e++)typeof a[e]!=="undefined"&&c.push(j(a[e],b));return c.join(d)}function e(a,b,d,c){for(var e=Object.keys(a),h=[],i=0;i<e.length;i++)typeof a[e[i]]!=="undefined"&&h.push(j(e[i],b)+d+j(a[e[i]],b));return h.join(c)}function d(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=m[a[0]])?a=a.substring(1):this._operator=m.NUL;for(var b=[],d=a.split(","),c=0;c<d.length;c++){var e=d[c].match(i);if(e===null)throw Error("Bad VarSpec: "+a);b.push({name:e[1],
explode:!!e[2],prefix:e[3]?parseInt(e[3],10):-1})}this._varSpecList=b}function b(a){for(var b=[],e=0,f=a.indexOf("{",e);f!==-1;){b.push(new c(a.substring(e,f)));e=a.indexOf("}",f+1);if(e===-1)throw Error("Invalid template: "+a);b.push(new d(a.substring(f+1,e)));e+=1;f=a.indexOf("{",e)}b.push(new c(a.substring(e)));this._templateComponents=b}var m={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},i=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,q=/%25[0-9A-F][0-9A-F]/g;c.prototype={expand:function(){return encodeURI(this._text)}};
d.prototype={expand:function(a){for(var b=[],d=0;d<this._varSpecList.length;d++){var c=this._varSpecList[d],i=c.name,g=a[i],q=typeof g;if(q!=="undefined"&&g!==null){var m=b.length===0?this._operator.first:this._operator.sep;if(q==="string")this._operator.named&&(m+=j(i,"U+R"),m+=g.length===0?this._operator.ifemp:"="),c.prefix!==-1&&c.prefix<g.length&&(g=g.substring(0,c.prefix)),m+=j(g,this._operator.allow);else if(Array.isArray(g)){if(g.length===0)continue;c.explode?m+=h(g,this._operator.allow,this._operator.sep):
(c=h(g,this._operator.allow,","),this._operator.named&&(m+=j(i,"U+R"),m+=c.length===0?this._operator.ifemp:"="),m+=c)}else if(q==="object"){if(Object.keys(g).length===0)continue;c.explode?m+=e(g,this._operator.allow,"=",this._operator.sep):(c=e(g,this._operator.allow,",",","),this._operator.named&&(m+=j(i,"U+R"),m+=c.length===0?this._operator.ifemp:"="),m+=c)}else throw Error("bad param type: "+i+" : "+q);b.push(m)}}return b.join("")}};b.prototype={expand:function(a){for(var b=[],d=0;d<this._templateComponents.length;d++)b.push(this._templateComponents[d].expand(a));
return b.join("")}};return b});
(function(){function c(a){if(typeof a!=="string")throw new TypeError;}function g(a){return a?a.split("&"):[]}function j(a){return a.length===0?"":a.join("&")}function h(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 d(a,b){var d="",c=[],e=0;return{next:function(){if(d!==a.query)d=a.query,c=g(d);if(e<c.length){var f=h(c[e++]);
switch(b){case "keys":return f[0];case "values":return f[1];case "keys+values":return[f[0],f[1]];default:throw new TypeError;}}throw B;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function m(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function i(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function q(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,b){if(typeof a!==
"string")throw new TypeError;var a=q(a),d=o.exec(a);if(!d)return null;var c={};c.scheme=d[1]||"";if(c.scheme&&!x.test(c.scheme))return null;var e=d[2];if(e&&(e=p.exec(e),c.userinfo=e[1],c.host=e[2],c.port=e[3],c.port&&!u.test(c.port)))return null;c.path=d[3];c.query=d[4];c.fragment=d[5];if(!c.scheme&&b&&(c.scheme=b.scheme,!c.host&&b.host))c.userinfo=b.userinfo,c.host=b.host,c.port=b.port,c.pathRelative=!0;if(c.pathRelative)if(c.path){if(c.path[0]!=="/")d=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",c.path=
d+c.path}else c.path=b.path;if(c.scheme)c.scheme=c.scheme.toLowerCase();if(c.port)c.port=m(c.port);if(c.host&&c.path)c.path=i(c.path);return c}function l(c,d){var e;if(d){d=d.href||d;e=a(d);if(!e||!e.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:e})}e=a(c,e);if(!e)throw new SyntaxError;Object.defineProperty(this,"_input",{value:c,writable:!0});Object.defineProperty(this,"_url",{value:e,writable:!0});var f=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?
f:null},enumerable:!0})}try{var k;if(typeof window.URL==="function"&&window.URL.length!==0&&(k=new window.URL("http://www.w3.org?q")).protocol==="http:"&&k.query)return}catch(f){}var o=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,p=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,x=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,u=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,s=/^([^?#\s]*)$/,t=/^([^\s]*)$/,z=/^\S*$/,y=/([^:]*):?(.*)/,B=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),C={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){c(a);var b;g(this._url.query).some(function(c){c=h(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){c(a);c(b);var d=g(this._url.query);d.some(function(c,f){var g=h(c);if(g[0]===a)return g[1]=b,d[f]=e(g),!0})||d.push(e([a,b]));this._url.query=j(d)},enumerable:!0},has:{value:function(a){c(a);
return g(this._url.query).some(function(b){if(h(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){c(a);var b=g(this._url.query),d=b.filter(function(b){return h(b)[0]!==a});return d.length!==b.length?(this._url.query=j(d),!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=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){c(a);var b=[];g(this._url.query).forEach(function(c){c=h(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){c(a);c(b);var d=g(this._url.query);d.push(e([a,b]));this._url.query=
j(d)},enumerable:!0}});Object.defineProperties(l.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(b){c(b);this._input=b;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){c(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,a===""||x.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){c(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){c(a);if(this._url){var b=
y.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=y.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){c(a);if(this._url){var b=[y.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){c(a);if(this._url&&(a=w.exec(a)))this._url.host=a[1],this._url.port=m(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){c(a);if(this._url&&v.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===C[this.protocol]&&(a="");return a},set:function(a){c(a);if(this._url&&u.exec(a))this._url.port=m(a)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){c(a);
if(this._url&&s.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?i(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){c(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){c(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),z.exec(a)))this._url.fragment=a},enumerable:!0}});
if((k=window.URL||window.webkitURL)&&k.createObjectURL)Object.defineProperty(l,"createObjectURL",{value:k.createObjectURL.bind(k),enumerable:!1}),Object.defineProperty(l,"revokeObjectURL",{value:k.revokeObjectURL.bind(k),enumerable:!1});window.URL=l})();define("orion/URL-shim",function(){});
define("plugins/filePlugin/GerritFileImpl",["orion/Deferred","orion/xhr","orion/URITemplate","orion/URL-shim"],function(c,g,j){function h(c,b){this._listTemplate=new j(c+"/list{/project,ref,path:0}{+path}");this._contentTemplate=new j(c+"/contents{/project,ref,path:0}{+path}");this._repoURL=this._listTemplate.expand({project:b})}var e=/.*\/(?:contents|list)\/([^\/]*)(?:\/([^\/]*)(?:\/(.*))?)?/;h.prototype={_getParents:function(c){var b=(new URL(c)).pathname.match(e),c=b[1]?decodeURIComponent(b[1]):
b[1],g=b[2]?decodeURIComponent(b[2]):b[2],i=b[3]?decodeURIComponent(b[3]):b[3];if(!g)return null;b=[];if(!i)return b;i=i.split("/");i.pop();var h=this._listTemplate.expand({project:c,ref:g});b.push({Name:g.split("/").pop(),Location:h,ChildrenLocation:h});for(var a="",l=0;l<i.length;++l){var k=i[l];a+=k;h=this._listTemplate.expand({project:c,ref:g,path:a});b.push({Name:k,Location:h,ChildrenLocation:h});a+="/"}return b.reverse()},fetchChildren:function(c){var b=this;return g("GET",c,{headers:this._headers,
timeout:15E3}).then(function(c){return JSON.parse(c.response).map(function(c){var d=c.type==="file"?b._contentTemplate:b._listTemplate,a=c.name.split("/").pop(),d=d.expand(c),a={Attributes:{Archive:!1,Hidden:!1,ReadOnly:!0,SymLink:!1},Location:d,Name:a,Length:c.size,LocalTimeStamp:0,Directory:!1};if(c.type!=="file")a.Directory=!0,a.ChildrenLocation=d;return a})})},loadWorkspaces:function(){return this.loadWorkspace(this._repoURL)},loadWorkspace:function(c){var b=this,g=(new URL(c)).pathname.match(e),
h=g[2]?decodeURIComponent(g[2]):g[2],j=g[3]?decodeURIComponent(g[3]):g[3];return this.fetchChildren(c).then(function(a){a={Attributes:{Archive:!1,Hidden:!1,ReadOnly:!0,SymLink:!1},Location:c,Name:null,Length:0,LocalTimeStamp:0,Directory:!0,ChildrenLocation:c,Children:a};h?j?(a.Name=j.split("/").pop(),a.Parents=b._getParents(c)):(a.Name=h,a.Parents=[]):(a.Name="repo_root",a.Location=c,a.ChildrenLocation=c);return a})},createProject:function(){throw"Not supported";},createFolder:function(){throw"Not supported";
},createFile:function(){throw"Not supported";},deleteFile:function(){throw"Not supported";},moveFile:function(){throw"Not supported";},copyFile:function(){throw"Not supported";},read:function(c,b){if(b){var h=this,i=(new URL(c)).pathname.match(e),j=i[2]?decodeURIComponent(i[2]):i[2],i=i[3]?decodeURIComponent(i[3]):i[3];return!j||!i?{Attributes:{Archive:!1,Hidden:!1,ReadOnly:!0,SymLink:!1},Name:j||"",Location:c,Length:0,LocalTimeStamp:0,Parents:this._getParents(c),Directory:!0,ChildrenLocation:c}:
this.fetchChildren(this._getParents(c)[0].Location).then(function(a){var b;a.some(function(a){if(a.Location===c)return b=a,b.Parents=h._getParents(c),!0});return b})}return g("GET",c,{timeout:15E3}).then(function(a){return a.responseText})},write:function(){throw"Not supported";},remoteImport:function(){throw"Not supported";},remoteExport:function(){throw"Not supported";},readBlob:function(c){return g("GET",c,{responseType:"arraybuffer",timeout:15E3}).then(function(b){return b.response})},writeBlob:function(){throw"Not supported";
}};return h.prototype.constructor=h});
define('built-GerritFilePlugin.js',["orion/plugin","orion/Deferred","plugins/filePlugin/GerritFileImpl","orion/URL-shim"],function(c,g,j){var c=new c({name:"Gerrit File Plugin",version:"1.0",description:"Gerrit File Plugin"}),h=new URL(window.location.href),g=h.query.get("project"),h=new URL("../..",h);h.search="";j=new j(h.href,g);c.registerService("orion.core.file",j,{Name:"Gerrit File contents",top:j._repoURL,pattern:h.href.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")});c.connect()});