/*

 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, 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) 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, 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). 


 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) 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(b,a){"function"===typeof define&&define.amd?define("orion/Deferred",a):"object"===typeof exports?module.exports=a():(b.orion=b.orion||{},b.orion.Deferred=a())})(this,function(){function b(){for(var a;a=e.shift();)a();m=!1}function a(a){e.push(a);m||(m=!0,p())}function d(a){return function(d){a(d)}}function l(){function b(){for(var c;c=g.shift();){var a=c.deferred,k="fulfilled"===h?"resolve":"reject";c=c[k];if("function"===typeof c)try{var e=c(r),s=e&&("object"===typeof e||"function"===typeof e)&&
e.then;if("function"===typeof s)if(e===a.promise)a.reject(new TypeError);else{var f=e.cancel;"function"===typeof f?a._parentCancel=f.bind(e):delete a._parentCancel;s.call(e,d(a.resolve),d(a.reject),d(a.progress))}else a.resolve(e)}catch(l){a.reject(l)}else a[k](r)}}function e(c){delete f._parentCancel;h="rejected";r=c;g.length&&a(b)}function m(c){function d(c){return function(a){(!h||"assumed"===h)&&c(a)}}delete f._parentCancel;try{var k=c&&("object"===typeof c||"function"===typeof c)&&c.then;if("function"===
typeof k)if(c===f)e(new TypeError);else{h="assumed";var s=c&&c.cancel;if("function"!==typeof s){var p=new l;c=p.promise;try{k(p.resolve,p.reject,p.progress)}catch(x){p.reject(x)}s=c.cancel;k=c.then}r=c;k.call(c,d(m),d(e));f._parentCancel=s.bind(c)}else h="fulfilled",r=c,g.length&&a(b)}catch(v){d(e)(v)}}function s(){var c=f._parentCancel;c?(delete f._parentCancel,c()):h||(c=Error("Cancel"),c.name="Cancel",e(c))}var r,h,g=[],f=this;this.resolve=function(c){h||m(c);return f};this.reject=function(c){h||
e(c);return f};this.progress=function(c){h||g.forEach(function(a){if(a.progress)try{a.progress(c)}catch(k){}});return f.promise};this.cancel=function(){f._parentCancel?setTimeout(s,0):s();return f};this.then=function(c,e,k){var d=new l;d._parentCancel=f.promise.cancel;g.push({resolve:c,reject:e,progress:k,deferred:d});("fulfilled"===h||"rejected"===h)&&a(b);return d.promise};this.promise={then:f.then,cancel:f.cancel}}var e=[],m=!1,p=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var a=
process.nextTick;return function(){a(b)}}if("function"===typeof MutationObserver){var e=document.createElement("div");(new MutationObserver(b)).observe(e,{attributes:!0});return function(){e.setAttribute("class","_tick")}}return function(){setTimeout(b,0)}}();l.all=function(a,e){function d(c,a){g||(h[c]=a,0===--b&&f.resolve(h))}function s(c,a){if(!g){if(e)try{d(c,e(a));return}catch(k){a=k}f.reject(a)}}var b=a.length,h=[],g=!1,f=new l;f.then(void 0,function(){g=!0;a.forEach(function(c){c.cancel&&c.cancel()})});
0===b?f.resolve(h):a.forEach(function(c,a){c.then(d.bind(void 0,a),s.bind(void 0,a))});return f.promise};l.when=function(a,e,d,b){var r;a&&"function"===typeof a.then||(r=new l,r.resolve(a),a=r.promise);return a.then(e,d,b)};return l});
define("orion/PageUtil",[],function(){var b=/^http[s]?/i;return{hash:function(){var a=window.location.href.split("#")[1];return a?"#"+a:""},matchResourceParameters:function(a){a=a||window.location.toString();var d={resource:""},b=a.indexOf("#");if(-1!==b&&(a=a.substring(b+1),0!==a.length)){a=a.split(",");d.resource=decodeURIComponent(a[0]);for(b=1;b<a.length;b++){var e=/([^=]*)(=?)(.*)/.exec(a[b]),m=decodeURIComponent(e[1]||""),e=decodeURIComponent(e[3]||"");""!==m&&"resource"!==m&&(d[m]=e)}}return d},
validateURLScheme:function(a,d){var l=a;if(-1===a.indexOf("://")){var e=document.createElement("a");e.href=a;l=e.href}e=!1;if(e=d?d.some(function(a){return RegExp("^"+a+":","i").test(l)}):b.test(l))return a;console.log("Illegal URL Scheme: '"+a+"'");return""}}});
define("orion/URITemplate",[],function(){function b(a){this._text=a}function a(a){return a.replace("%25","%")}function d(e,d){if("U"===d)return encodeURIComponent(e).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===d)return encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(w,a);if("U+R-,"===d)return encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+d);}function l(a,e,b){for(var g=
[],f=0;f<a.length;f++)"undefined"!==typeof a[f]&&g.push(d(a[f],e));return g.join(b)}function e(a,e,b,g){for(var f=Object.keys(a),c=[],l=0;l<f.length;l++)"undefined"!==typeof a[f[l]]&&c.push(d(f[l],e)+b+d(a[f[l]],e));return c.join(g)}function m(a){if(0===a.length)throw Error("Invalid Expression: 0 length expression");(this._operator=t[a[0]])?a=a.substring(1):this._operator=t.NUL;for(var e=[],d=a.split(","),b=0;b<d.length;b++){var f=d[b].match(u);if(null===f)throw Error("Bad VarSpec: "+a);e.push({name:f[1],
explode:!!f[2],prefix:f[3]?parseInt(f[3],10):-1})}this._varSpecList=e}function p(a){for(var e=[],d=0,g=a.indexOf("{",d);-1!==g;){e.push(new b(a.substring(d,g)));d=a.indexOf("}",g+1);if(-1===d)throw Error("Invalid template: "+a);e.push(new m(a.substring(g+1,d)));d+=1;g=a.indexOf("{",d)}e.push(new b(a.substring(d)));this._templateComponents=e}var t={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-,"}},u=/^((?:(?:[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;b.prototype={expand:function(a){return encodeURI(this._text)}};
m.prototype={expand:function(a){for(var b=[],h=0;h<this._varSpecList.length;h++){var g=this._varSpecList[h],f=g.name,c=a[f],m=typeof c;if("undefined"!==m&&null!==c){var k=0===b.length?this._operator.first:this._operator.sep;if("string"===m)this._operator.named&&(k+=d(f,"U+R"),k+=0===c.length?this._operator.ifemp:"\x3d"),-1!==g.prefix&&g.prefix<c.length&&(c=c.substring(0,g.prefix)),k+=d(c,this._operator.allow);else if(Array.isArray(c)){if(0===c.length)continue;g.explode?k+=l(c,this._operator.allow,
this._operator.sep):(g=l(c,this._operator.allow,","),this._operator.named&&(k+=d(f,"U+R"),k+=0===g.length?this._operator.ifemp:"\x3d"),k+=g)}else if("object"===m){if(0===Object.keys(c).length)continue;g.explode?k+=e(c,this._operator.allow,"\x3d",this._operator.sep):(g=e(c,this._operator.allow,",",","),this._operator.named&&(k+=d(f,"U+R"),k+=0===g.length?this._operator.ifemp:"\x3d"),k+=g)}else throw Error("bad param type: "+f+" : "+m);b.push(k)}}return b.join("")}};p.prototype={expand:function(a){for(var e=
[],d=0;d<this._templateComponents.length;d++)e.push(this._templateComponents[d].expand(a));return e.join("")}};return p});
define("orion/i18nUtil",["require","orion/Deferred"],function(b,a){function d(a){if(a=localStorage.getItem("orion/messageBundle/"+a))if(a=JSON.parse(a),a._expires&&a._expires>(new Date).getTime())return delete a._expires,a;return null}var l={};return{getMessageBundle:function(e){function m(a){a?b(["i18n!"+e],function(a){if(a){var d=e;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+d,JSON.stringify(a));delete a._expires}t.resolve(a)}):p(Error(e))}function p(a){t.reject(a)}
if(l[e])return l[e];var t=new a;l[e]=t;var u=d(e);if(u)return t.resolve(u),t;try{b([e],m,p)}catch(w){b(["orion/i18n!"+e],m,p)}return t},formatMessage:function(a){var d=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,e){return d[(e<<0)+1]})}}});
define("orion/objects",[],function(){function b(a){for(var d=Object.prototype.hasOwnProperty,b=1,e=arguments.length;b<e;b++){var m=arguments[b],p;for(p in m)d.call(m,p)&&(a[p]=m[p])}return a}return{clone:function(a){if(Array.isArray(a))return Array.prototype.slice.call(a);var d=Object.create(Object.getPrototypeOf(a));b(d,a);return d},mixin:b,toArray:function(a){return Array.isArray(a)?a:[a]}}});
(function(){function b(n){if("string"!==typeof n)throw new TypeError;}function a(n){return n?n.split("\x26"):[]}function d(n){return 0===n.length?"":n.join("\x26")}function l(n){var a=/([^=]*)(?:=?)(.*)/.exec(n);n=a[1]?decodeURIComponent(a[1]):"";a=a[2]?decodeURIComponent(a[2]):"";return[n,a]}function e(a){var c=encodeURIComponent(a[0]);a[1]&&(c+="\x3d"+encodeURIComponent(a[1]));return c}function m(n,c){var d="",e=[],b=0;return{next:function(){d!==n.query&&(d=n.query,e=a(d));if(b<e.length){var q=
l(e[b++]);switch(c){case "keys":return q[0];case "values":return q[1];case "keys+values":return[q[0],q[1]];default:throw new TypeError;}}throw C;}}}function p(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function t(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function u(a){var c=[];a.split("/").forEach(function(a){".."===a?c.pop():"."!==a&&c.push(a)});return c.join("/")}function w(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function s(a,d){if("string"!==
typeof a)throw new TypeError;a=w(a);var e=f.exec(a);if(!e)return null;var b={};b.scheme=e[1]||"";if(b.scheme&&!A.test(b.scheme))return null;var q=e[2];if(q&&(q=c.exec(q),b.userinfo=q[1],b.host=q[2],b.port=q[3],b.port&&!k.test(b.port)))return null;b.path=e[3];b.query=e[4];b.fragment=e[5];!b.scheme&&d&&(b.scheme=d.scheme,!b.host&&d.host&&(b.userinfo=d.userinfo,b.host=d.host,b.port=d.port,b.pathRelative=!0));b.pathRelative&&(b.path?"/"!==b.path[0]&&(e=/^(.*\/)[^\/]*$/.exec(d.path)[1]||"/",b.path=e+b.path):
b.path=d.path);b.scheme&&(b.scheme=b.scheme.toLowerCase());b.port&&(b.port=t(b.port));b.host&&b.path&&(b.path=u(b.path));return b}function r(a,b){var c;if(b){b=b.href||b;c=s(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=s(a,c);if(!c)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:c,writable:!0});var d=new p(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var h;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(h=new window.URL("http://www.w3.org?q")).protocol&&h.query)return}catch(g){}var f=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,c=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,A=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,k=/^\d*$/,y=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,z=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,v=/^([^\s]*)$/,q=/^\S*$/,B=/([^:]*):?(.*)/,C="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),D={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(p.prototype,{get:{value:function(n){b(n);var c;a(this._url.query).some(function(a){a=l(a);if(a[0]===n)return c=a[1],!0});return c},enumerable:!0},set:{value:function(n,c){b(n);b(c);var q=a(this._url.query);q.some(function(a,b){var d=l(a);if(d[0]===n)return d[1]=c,q[b]=e(d),!0})||q.push(e([n,c]));this._url.query=d(q)},enumerable:!0},has:{value:function(n){b(n);
return a(this._url.query).some(function(a){if(l(a)[0]===n)return!0})},enumerable:!0},"delete":{value:function(n){b(n);var c=a(this._url.query),e=c.filter(function(a){return l(a)[0]!==n});return e.length!==c.length?(this._url.query=d(e),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if("function"!==typeof a)throw new TypeError;var c=m(this._url,"keys+values");try{for(;;){var d=c.next();a.call(b,d[1],d[0],this)}}catch(e){if(e!==C)throw e;
}},enumerable:!0},keys:{value:function(){return m(this._url,"keys")},enumerable:!0},values:{value:function(){return m(this._url,"values")},enumerable:!0},items:{value:function(){return m(this._url,"keys+values")}},size:{get:function(){return a(this._url.query).length},enumerable:!0},getAll:{value:function(n){b(n);var c=[];a(this._url.query).forEach(function(a){a=l(a);a[0]===n&&c.push(a[1])});return c},enumerable:!0},append:{value:function(n,c){b(n);b(c);var q=a(this._url.query);q.push(e([n,c]));this._url.query=
d(q)},enumerable:!0}});Object.defineProperties(r.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var c=a.scheme?a.scheme+":":"";a.host&&(c+="//",a.userinfo&&(c+=a.userinfo+"@"),c+=a.host,a.port&&(c+=":"+a.port));c+=a.path;a.query&&(c+="?"+a.query);a.fragment&&(c+="#"+a.fragment);a=c}else a=this._input;return a},set:function(a){b(a);this._input=a;this._url=s(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){b(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||A.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){b(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=B.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){b(a);if(this._url){var c=
B.exec(this._userinfo);a=[encodeURIComponent(a||"")];c[2]&&a.push(c[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=B.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){b(a);if(this._url){var c=[B.exec(this._userinfo)[1]||""];a&&c.push(encodeURIComponent(a));this._userinfo=c.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){b(a);if(this._url&&(a=z.exec(a)))this._url.host=a[1],this._url.port=t(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){b(a);this._url&&y.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===D[this.protocol]&&(a="");return a},set:function(a){b(a);this._url&&k.exec(a)&&(this._url.port=t(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){b(a);
this._url&&x.exec(a)&&(this._url.host&&(a&&"/"!==a[0])&&(a="/"+a),this._url.path=a?u(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){b(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),v.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){b(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),q.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((h=window.URL||window.webkitURL)&&h.createObjectURL)Object.defineProperty(r,"createObjectURL",{value:h.createObjectURL.bind(h),enumerable:!1}),Object.defineProperty(r,"revokeObjectURL",{value:h.revokeObjectURL.bind(h),enumerable:!1});window.URL=r})();define("orion/URL-shim",function(){});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(b,a,d,l,e,m,p){function t(){return b.toUrl?(new URL(b.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function u(a){var b={};a.getPropertyKeys().forEach(function(d){"objectClass"!==d&&("service.names"!==d&&"service.id"!==d&&"__plugin__"!==d)&&(b[d]=a.getProperty(d))});return b}function w(a){return e.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(b){a.textContent=a.nameKey||a.name;return a})}function s(c,b){var e=c.getServiceReferences(b||"orion.page.link"),f=d.matchResourceParameters(window.location.href),g={OrionHome:t(),Location:f.resource},h=[];e.forEach(function(c){c=u(c);if(c.uriTemplate&&(c.nls||c.name)){var b=(new l(c.uriTemplate)).expand(g),b=d.validateURLScheme(b);c.href=b;c.nls?h.push(w(c)):(c.textContent=c.name,h.push((new a).resolve(c)))}});return a.all(h)}function r(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function h(a){this.allPageLinks=a;this.allPageLinks.sort(g)}function g(a,b){var d=a.textContent&&a.textContent.toLowerCase(),e=b.textContent&&b.textContent.toLowerCase();return d<e?-1:d>e?1:0}var f;m.mixin(r.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});m.mixin(h.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href;a=
a.textContent;var d=document.createElement("a");d.href=b;d.target="_self";d.classList.add("targetSelector");d.textContent=a;return d})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(b){var d;return!f?(d=[],b.getServiceReferences("orion.page.link.category").forEach(function(e){var f=u(e);if(f.id&&(f.name||f.nameKey))f.service=b.getService(e),f.nls?d.push(w(f)):(f.textContent=f.name,d.push((new a).resolve(f)))}),a.all(d).then(function(a){return f=new r(a)})):(new a).resolve(f)},
getPageLinksInfo:function(a,b){return s(a,b).then(function(a){return new h(a)})},getOrionHome:t}});
(function(b,a){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],a):"object"===typeof exports?module.exports=a(require("orion/Deferred")):(b.orion=b.orion||{},b.orion.PluginProvider=a(b.orion.Deferred))})(this,function(b){function a(a,b){this.__objectId=a;this.__methods=b}return function(d){function l(a){g&&("undefined"===typeof ArrayBuffer&&(a=JSON.stringify(a)),g===self?g.postMessage(a):g.postMessage(a,"*"))}function e(){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:r||{},services:a}}function m(a,b){if(b&&b instanceof XMLHttpRequest){var c,d;try{c=b.status,d=b.statusText}catch(e){c=0,d=""}return{status:c||0,statusText:d}}return b}function p(a){var b=a?JSON.parse(JSON.stringify(a,m)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function t(d){if(!g)return(new b).reject(Error("plugin not connected"));d.id=String(f++);
var e=new b;y[d.id]=e;e.then(null,function(a){h&&(a instanceof Error&&"Cancel"===a.name)&&v({requestId:d.id,method:"cancel",params:a.message?[a.message]:[]})});var k=Object.prototype.toString;d.params.forEach(function(b,f){if("[object Object]"===k.call(b)&&!(b instanceof a)){var g,h;for(g in b)"[object Function]"===k.call(b[g])&&(h=h||[],h.push(g));if(h){var l=c++;z[l]=b;g=function(){delete z[l]};e.then(g,g);d.params[f]=new a(l,h)}}});v(d);return e.promise}function u(a,b){a||0===a?v({id:a,result:null,
error:b}):console.log(b)}function w(a,b,c,d){d.forEach(function(a,b){if(a&&"undefined"!==typeof a.__objectId){var c={};a.__methods.forEach(function(b){c[b]=function(){return t({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=c}});var e=void 0===typeof a?null:{id:a,result:null,error:null};try{var f=c.apply(b,d);e&&(f&&"function"===typeof f.then?(k[a]=f,f.then(function(b){delete k[a];e.result=b;v(e)},function(b){k[a]&&(delete k[a],e.error=p(b),v(e))},function(){v({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(e.result=f,v(e)))}catch(g){e&&(e.error=p(g),v(e))}}function s(a){if(!(a.source!==g&&"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 d=x[a.serviceId];d||u(a.id,"service not found");d=d.implementation;b in d?w(a.id,d,d[b],c):u(a.id,"method not found")}else if("objectId"in a){var e=z[a.objectId];e||u(a.id,"object not found");!b in
e?w(a.id,e,e[b],c):u(a.id,"method not found")}else if("requestId"in a){var f=k[a.requestId];f&&("cancel"===b&&f.cancel)&&f.cancel.apply(f,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 l=y[String(a.id)];delete y[String(a.id)];a.error?l.reject(a.error):l.resolve(a.result)}}catch(m){console.log("Plugin._messageHandler "+m)}}}var r=d,h=!1,g=null,f=0,c=0,A=0,k={},y={},z={},x={},v=l;this.updateHeaders=
function(a){if(h)throw Error("Cannot update headers. Plugin Provider is connected");r=a};this.registerServiceProvider=this.registerService=function(a,b,d){if(h)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var c=null,e=[];for(c in b)"function"===typeof b[c]&&e.push(c);x[A++]={names:a,methods:e,implementation:b,properties:d||{},listeners:{}}};this.connect=function(a,b){if(!h){if("undefined"===typeof window)g=self;else if(window!==
window.parent)g=window.parent;else if(null!==window.opener)g=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",s,!1);var c={method:"plugin",params:[e()]};l(c);h=!0}a&&a()};this.disconnect=function(){h&&(removeEventListener("message",s),g=null,h=!1)}}});
define("plugins/pageLinksPlugin",["require","orion/PageLinks","orion/plugin","orion/URITemplate"],function(b,a,d,l){var e={};d=new d({name:"Orion Page Links",version:"1.0",description:"This plugin provides the top-level page links for Orion."});d.registerService("orion.page.link.category",null,{id:"edit",nameKey:"Editor",nls:"orion/nls/messages",imageClass:"core-sprite-edit",order:10});d.registerService("orion.page.link.category",null,{id:"search",nameKey:"Search",nls:"orion/nls/messages",imageClass:"core-sprite-search",
order:30});d.registerService("orion.page.link.category",null,{id:"shell",nameKey:"Shell",nls:"orion/nls/messages",imageClass:"core-sprite-shell",order:40});d.registerService("orion.page.link.category",null,{id:"settings",nameKey:"Settings",nls:"orion/widgets/nls/messages",imageClass:"core-sprite-gear",order:60});d.registerService("orion.page.link",null,{nameKey:"EditorLinkWorkspace",nls:"orion/nls/messages",tooltip:"Edit code",category:"edit",order:1E3,uriTemplate:"{+OrionHome}/edit/edit.html"});
d.registerService("orion.page.link",e,{nameKey:"ShellLinkWorkspace",id:"orion.shell",nls:"orion/nls/messages",category:"shell",order:1E3,uriTemplate:"{+OrionHome}/shell/shellPage.html"});d.registerService("orion.page.link",e,{nameKey:"Search",id:"orion.Search",nls:"orion/nls/messages",category:"search",order:1E3,uriTemplate:"{+OrionHome}/search/search.html"});d.registerService("orion.page.link",null,{nameKey:"Settings",id:"orion.settings",nls:"orion/widgets/nls/messages",category:"settings",order:1E3,
uriTemplate:"{+OrionHome}/settings/settings.html"});d.registerService("orion.page.link.related",null,{id:"orion.editFromMetadata",nameKey:"EditorRelatedLink",nls:"orion/nls/messages",tooltip:"Open Editor page",category:"edit",order:1,validationProperties:[{source:"ChildrenLocation|ContentLocation",variableName:"EditorLocation",replacements:[{pattern:"\\?depth\x3d1$",replacement:""}]}],uriTemplate:"{+OrionHome}/edit/edit.html#{,EditorLocation}"});d.registerService("orion.page.link.related",null,{id:"orion.editParent",
nameKey:"EditorRelatedLinkParent",nls:"orion/nls/messages",category:"edit",order:3,validationProperties:[{source:"Parents[0]:Location",variableName:"EditorLocation",replacements:[{pattern:"\\?depth\x3d1$",replacement:""}]}],uriTemplate:"{+OrionHome}/edit/edit.html#{,EditorLocation}"});d.registerService("orion.page.link.related",null,{id:"orion.editProjectRoot",nameKey:"EditorRelatedLinkProj",nls:"orion/nls/messages",category:"edit",order:5,validationProperties:[{source:"Parents[-1]:Location",variableName:"EditorLocation",
replacements:[{pattern:"\\?depth\x3d1$",replacement:""}]}],uriTemplate:"{+OrionHome}/edit/edit.html#{,EditorLocation}"});d.registerService("orion.page.link.user",null,{id:"orion.help",nameKey:"Help",nls:"orion/widgets/nls/messages",uriTemplate:b.toUrl("help/index.jsp"),category:"user.0"});d.registerService("orion.page.link.user",null,{id:"orion.report.bug",nameKey:"Report a Bug",nls:"orion/widgets/nls/messages",uriTemplate:"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26component\x3dClient\x26version\x3d5.0",
category:"user.0"});b=document.createElement("a");b.href="./contentTemplates/helloWorld.zip";e=document.createElement("a");e.href="./contentTemplates/pluginHelloWorld.zip";d.registerService("orion.core.content",null,{id:"orion.content.html5",nameKey:"Sample HTML5 Site",nls:"orion/nls/messages",descriptionKey:"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.",contentURITemplate:b.href});d.registerService("orion.core.content",null,{id:"orion.content.plugin",nameKey:"Sample Orion Plugin",
nls:"orion/nls/messages",descriptionKey:"Generate a sample plugin for integrating with Orion.",contentURITemplate:e.href});d.registerService("orion.core.setting",null,{settings:[{pid:"nav.config",nls:"orion/settings/nls/messages",nameKey:"Navigation",category:"general",categoryKey:"General",properties:[{id:"links.newtab",nameKey:"Links",type:"boolean",defaultValue:!1,options:[{value:!0,labelKey:"Open in new tab"},{value:!1,labelKey:"Open in same tab"}]}]}]});d.registerService("orion.core.getplugins",
null,{uri:decodeURIComponent((new l("http://orion-plugins.googlecode.com/git/index.html#?target\x3d{InstallTarget}\x26version\x3d{Version}\x26OrionHome\x3d{OrionHome}")).expand({Version:"5.0",InstallTarget:a.getOrionHome()+"/settings/settings.html",OrionHome:a.getOrionHome()}))});d.registerService("orion.page.getstarted",null,{data:[{label:"Add",image:"../images/add.png",secondaryImage:"../images/add-large-dulled.png",alt:"Add Content",media:"../media/Create.gif"},{label:"Modify",image:"../images/modify.png",
secondaryImage:"../images/gear-large-dulled.png",alt:"Modify Content",media:"../media/Modify.gif"},{label:"Manage",image:"../images/manage.png",secondaryImage:"../images/hamburger-large-dulled.png",alt:"Manage Content",media:"../media/Manage.gif"}]});d.connect()});
//@ sourceMappingURL=pageLinksPlugin.js.map