/*

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