/*******************************************************************************
 * @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) 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) 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 RequireJS domReady 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */
/*******************************************************************************
 * @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
 ******************************************************************************/
/*

 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) 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 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details

 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) 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(){var d=this;if(!d.define)d.define=function(i){d.orion=d.orion||{};d.orion.PluginProvider=i();d.eclipse=d.orion;delete d.define}})();
define("orion/plugin",[],function(){return function(d){function i(a){n&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),n===self?n.postMessage(a):n.postMessage(a,"*"))}function j(a,b){return b&&b instanceof XMLHttpRequest?{status:b.status,statusText:b.statusText}:b}function m(a){var b=a?JSON.parse(JSON.stringify(a,j)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function f(a){return function(b){g&&i({serviceId:a,method:"dispatchEvent",
params:[b]})}}function a(a){if(a.source===n){var b=typeof a.data!=="string"?a.data:JSON.parse(a.data);if(typeof b.cancel==="string"){var h=k[b.id];h&&(delete k[b.id],h.cancel&&h.cancel(b.cancel))}else{var a=b.serviceId,l=b.method,c=b.params,d=e[a],p=d.implementation,g=p[l];l==="addEventListener"?(l=c[0],d.listeners[l]=d.listeners[l]||f(a),c=[l,d.listeners[l]]):l==="removeEventListener"&&(l=c[0],c=[l,d.listeners[l]],delete d.listeners[l]);var j={id:b.id,result:null,error:null};try{(h=g.apply(p,c))&&
typeof h.then==="function"?(k[b.id]=h,h.then(function(a){delete k[b.id];j.result=a;i(j)},function(a){if(k[b.id])delete k[b.id],j.error=m(a),i(j)},function(){i({requestId:b.id,method:"progress",params:Array.prototype.slice.call(arguments)})})):(j.result=h,i(j))}catch(q){j.error=m(q),i(j)}}}}var c=d,e=[],g=!1,k={},n=null;this.updateHeaders=function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");c=a};this.registerServiceProvider=this.registerService=function(a,b,h){if(g)throw Error("Cannot register service. Plugin Provider is connected");
typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var l=null,c=[];for(l in b)typeof b[l]==="function"&&c.push(l);e[e.length]={names:a,methods:c,implementation:b,properties:h||{},listeners:{}}};this.connect=function(k,b){if(!g){if(typeof window==="undefined")n=self;else if(window!==window.parent)n=window.parent;else if(window.opener!==null)n=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",a,!1);for(var h=[],l=0;l<e.length;l++)h.push({serviceId:l,names:e[l].names,
methods:e[l].methods,properties:e[l].properties});i({method:"plugin",params:[{headers:c||{},services:h}]});g=!0}k&&k()};this.disconnect=function(){g&&(removeEventListener("message",a),n=null,g=!1)}}});
(function(d,i){typeof define==="function"&&define.amd?define("orion/Deferred",[],i):typeof exports==="object"?module.exports=i():(d.orion=d.orion||{},d.orion.Deferred=i())})(this,function(){function d(){for(var a;a=c.shift()||e.shift();)a();g=!1}function i(a,f){(f?e:c).push(a);g||(g=!0,f?setTimeout(d,0):d())}function j(a){return function(){a.apply(null,arguments)}}function m(){}function f(){var a=Error("Cancel");a.name="Cancel";return a}function a(){function c(){for(var a;a=b.shift();){var h=a.deferred,
k=d==="resolved"?"resolve":"reject";if(typeof a[k]==="function")try{var f=a[k](e);f&&typeof f.then==="function"?(h.cancel=f.cancel||m,f.then(j(h.resolve),j(h.reject),h.progress)):h.resolve(f)}catch(g){h.reject(g)}else h[k](e)}}var e,d,b=[],h=this;this.reject=function(a){d||(d="rejected",e=a,b.length&&i(c));return h.promise};this.resolve=function(a){d||(d="resolved",e=a,b.length&&i(c));return h.promise};this.progress=function(a){d||b.forEach(function(b){b.progress&&b.progress(a)});return h.promise};
this.cancel=function(){d||h.reject(f())};this.then=function(h,e,f){var h={resolve:h,reject:e,progress:f,deferred:new a},g=h.deferred,j=this.cancel.bind(this),n=function(){i(function(){(g.cancel===n?j:g.cancel)()},!0)};g.cancel=n;e=g.promise;e.cancel=function(){g.cancel()};b.push(h);d&&i(c,!0);return e};this.promise={then:this.then,cancel:this.cancel}}var c=[],e=[],g=!1;a.all=function(c,e){function f(b,a){d||(l[b]=a,--h===0&&g.resolve(l))}function b(b,a){if(!d){if(e)try{f(b,e(a));return}catch(h){a=
h}g.reject(a)}}var h=c.length,l=[],d=!1,g=new a;g.then(null,function(){d=!0;c.forEach(function(b){b.cancel&&b.cancel()})});h===0?g.resolve(l):c.forEach(function(a,h){a.then(f.bind(null,h),b.bind(null,h))});return g.promise};a.when=function(c,e,f,b){var h;if(!(c&&typeof c.then==="function"))h=new a,h.resolve(c),c=h.promise;return c.then(e,f,b)};return a});
define("orion/xhr",["orion/Deferred"],function(d){function i(d,i,f,a){var c=typeof f.response!=="undefined"?f.response:f.responseText,e;try{e=f.status}catch(g){e=0}d={args:i,response:c,responseText:typeof c==="string"?c:null,status:e,url:d,xhr:f};if(typeof a!=="undefined")d.error=a;return d}return function(j,m,f){var f=f||{},a=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,c=new d,e=f.headers||{},g=f.log||!1,k;typeof e["X-Requested-With"]==="undefined"&&(e["X-Requested-With"]="XMLHttpRequest");
if(typeof f.data!=="undefined"&&(j==="POST"||j==="PUT"))k=f.data;if(typeof f.responseType==="string")a.responseType=f.responseType;a.onprogress=function(b){b.xhr=a;c.progress(b)};a.onreadystatechange=function(){if(a.readyState===4){var b=i(m,f,a),h=a.status;200<=h&&h<400?c.resolve(b):(g&&typeof console!=="undefined"&&console.log(Error(a.statusText)),c.reject(b))}};try{a.open(j,m,!0);if(typeof f.timeout==="number")if(typeof a.timeout==="number")a.timeout=f.timeout,a.addEventListener("timeout",function(){c.reject(i(m,
f,a,"Timeout exceeded"))});else{var n=setTimeout(function(){c.reject(i(m,f,a,"Timeout exceeded"))},f.timeout);c.then(clearTimeout.bind(null,n),clearTimeout.bind(null,n))}Object.keys(e).forEach(function(b){a.setRequestHeader(b,e[b])});a.send(k)}catch(o){c.reject(i(m,f,a,o))}return c.promise}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(d,i){function j(f,a){d("GET",f,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=c.response?JSON.parse(c.response):null;a.progress(c);!c.type||c.type==="loadstart"||c.type==="progress"?setTimeout(function(){j(f,a)},2E3):(c.type==="error"||c.type==="abort"?a.reject(c.Result):a.resolve(c.Result.JsonData),c.Location||d("DELETE",f,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(c){var e=c;if(c.responseText!==void 0){e=
c.responseText;try{e=JSON.parse(c.responseText)}catch(d){}}e.Message!==void 0?(e.HttpCode=e.HttpCode===void 0?c.status:e.HttpCode,e.Severity=e.Severity===void 0?"Error":e.Severity,a.reject(e)):a.reject({Severity:"Error",Message:e,HttpCode:c.status})})}function m(f,a){a.then(null,function(a){a instanceof Error&&a.name==="Cancel"&&d("PUT",f,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(d){var a=new i;m(d,a);j(d,a);return a}}});
(function(){function d(b){return b?b.slice(1).split("&"):[]}function i(b){return b.length===0?"":"?"+b.join("&")}function j(b){var a=/([^=]*)(?:=?)(.*)/.exec(b),b=a[1]?decodeURIComponent(a[1]):"",a=a[2]?decodeURIComponent(a[2]):"";return[b,a]}function m(b){var a=encodeURIComponent(b[0]);b[1]&&(a+="="+encodeURIComponent(b[1]));return a}function f(b,a){var c="",e=[],f=0;return{next:function(){if(c!==b.search)c=b.search,e=d(c);if(f<e.length){var g=j(e[f++]);switch(a){case "keys":return g[0];case "values":return g[1];
case "keys+values":return[g[0],g[1]];default:throw new TypeError;}}throw o;}}}function a(b){if(typeof b!=="string")throw new TypeError;}function c(b){var a=b.protocol;return!a||a===":"||a==="http:"&&!b.hostname?!1:!0}function e(b){Object.defineProperty(this,"_anchor",{value:b})}function g(b,a){b=b||"";if(typeof b!=="string")throw new TypeError("url");a=a?a.href||a:"";if(typeof a!=="string")throw new TypeError("base");Object.defineProperty(this,"_input",{value:b,writable:!0});var d=document.implementation.createHTMLDocument("");
if(a){var f=d.createElement("a");f.href=a;if(f.protocol.length<2||!f.host)throw Error("InvalidStateError");var g=d.createElement("base");g.href=f.href;d.head.appendChild(g)}var k=d.createElement("a");k.href=b;d.body.appendChild(k);Object.defineProperty(this,"_urlAnchor",{value:k});var i=new e(k);Object.defineProperty(this,"query",{get:function(){return c(k)?i:null},enumerable:!0})}try{if(typeof window.URL==="function"&&window.URL.length!==0&&(new window.URL("http://www.w3.org")).protocol==="http:")return}catch(k){}var n=
/([^:]*):?(.*)/,o=typeof StopIteration!=="undefined"?StopIteration:Error("Stop Iteration");Object.defineProperties(e.prototype,{get:{value:function(b){a(b);var c;d(this._anchor.search).some(function(a){a=j(a);if(a[0]===b)return c=a[1],!0});return c},enumerable:!0},set:{value:function(b,c){a(b);a(c);var e=d(this._anchor.search);e.some(function(a,d){var f=j(a);if(f[0]===b)return f[1]=c,e[d]=m(f),!0})||e.push(m([b,c]));this._anchor.search=i(e)},enumerable:!0},has:{value:function(b){a(b);return d(this._anchor.search).some(function(a){if(j(a)[0]===
b)return!0})},enumerable:!0},"delete":{value:function(b){a(b);var c=d(this._anchor.search),e=c.filter(function(a){return j(a)[0]!==b});return e.length!==c.length?(this._anchor.search=i(e),!0):!1},enumerable:!0},clear:{value:function(){this._anchor.search=""},enumerable:!0},forEach:{value:function(a,c){if(typeof a!=="function")throw new TypeError;var e=f(this._anchor,"keys+values");try{for(;;){var d=e.next();a.call(c,d[1],d[0],this)}}catch(g){if(g!==o)throw g;}},enumerable:!0},keys:{value:function(){return f(this._anchor,
"keys")},enumerable:!0},values:{value:function(){return f(this._anchor,"values")},enumerable:!0},items:{value:function(){return f(this._anchor,"keys+values")}},size:{get:function(){return d(this._anchor.search).length},enumerable:!0},getAll:{value:function(b){a(b);var c=[];d(this._anchor.search).forEach(function(a){a=j(a);a[0]===b&&c.push(a[1])});return c},enumerable:!0},append:{value:function(b,c){a(b);a(c);var e=d(this._anchor.search);e.push(m([b,c]));this._anchor.search=i(e)},enumerable:!0}});
Object.defineProperties(g.prototype,{href:{get:function(){return c(this._urlAnchor)?this._urlAnchor.href:this._input},set:function(b){a(b);this._input=b;this._urlAnchor.href=b},enumerable:!0},origin:{get:function(){return c(this._urlAnchor)?this._urlAnchor.protocol+"//"+this._urlAnchor.host:""},enumerable:!0},protocol:{get:function(){return c(this._urlAnchor)?this._urlAnchor.protocol:":"},set:function(b){a(b);this._urlAnchor.protocol=b},enumerable:!0},_userinfo:{get:function(){return!c(this._urlAnchor)?
"":RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host).exec(this._urlAnchor.href)[2]||""},set:function(b){a(b);this._urlAnchor.href=this._urlAnchor.href.replace(RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host),this._urlAnchor.protocol+"//"+(b?b+"@":"")+this._urlAnchor.host)}},username:{get:function(){if(!c(this._urlAnchor))return"";var a=n.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(b){a(b);var c=n.exec(this._userinfo),
b=[encodeURIComponent(b||"")];c[2]&&b.push(c[2]);this._userinfo=b.join(":")},enumerable:!0},password:{get:function(){if(!c(this._urlAnchor))return"";var a=n.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(b){a(b);var c=[n.exec(this._userinfo)[1]||""];b&&c.push(encodeURIComponent(b));this._userinfo=c.join(":")},enumerable:!0},host:{get:function(){return c(this._urlAnchor)?this._urlAnchor.host:""},set:function(b){a(b);this._urlAnchor.host=b},enumerable:!0},hostname:{get:function(){return c(this._urlAnchor)?
this._urlAnchor.hostname:""},set:function(b){a(b);this._urlAnchor.hostname=b},enumerable:!0},port:{get:function(){return c(this._urlAnchor)?this._urlAnchor.port:""},set:function(b){a(b);this._urlAnchor.port=b},enumerable:!0},pathname:{get:function(){return c(this._urlAnchor)?this._urlAnchor.pathname:""},set:function(b){a(b);this._urlAnchor.pathname=b},enumerable:!0},search:{get:function(){return c(this._urlAnchor)?this._urlAnchor.search:""},set:function(b){a(b);this._urlAnchor.search=b},enumerable:!0},
hash:{get:function(){return c(this._urlAnchor)?this._urlAnchor.hash:""},set:function(b){a(b);this._urlAnchor.hash=b},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(g,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(g,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=g})();define("orion/URL-shim",function(){});
define("domReady",[],function(){function d(a){for(var e=0,d;d=a[e];e++)d(c)}function i(){var b=e,c=g;a&&(b.length&&(e=[],d(b)),k.resourcesDone&&c.length&&(g=[],d(c)))}function j(){a||(a=!0,o&&clearInterval(o),i())}function m(b){a?b(c):e.push(b);return m}var f=typeof window!=="undefined"&&window.document,a=!f,c=f?document:null,e=[],g=[],k=requirejs||require||{},n=k.resourcesReady,o;if("resourcesReady"in k)k.resourcesReady=function(a){n&&n(a);a&&i()};f&&(document.addEventListener?(document.addEventListener("DOMContentLoaded",
j,!1),window.addEventListener("load",j,!1)):window.attachEvent&&(window.attachEvent("onload",j),self===self.top&&(o=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),j())}catch(a){}},30))),document.readyState==="complete"&&j());m.withResources=function(b){a&&k.resourcesDone?b(c):g.push(b);return m};m.version="1.0.0";m.load=function(a,c,e,d){d.isBuild?e(null):m(e)};return m});
define("plugins/taskPlugin","orion/xhr,orion/plugin,orion/operation,orion/Deferred,orion/URL-shim,domReady!".split(","),function(d,i,j,m){function f(c){c&&typeof c==="object"&&Object.keys(c).forEach(function(d){var k=c[d];d.indexOf("Location")!==-1?(a.href=k,c[d]=a.href):f(k)});return c}var a=document.createElement("a");a.href="../mixloginstatic/LoginWindow.html";i=new i({name:"Orion Task Management Service",version:"1.0",description:"This plugin provides access to the tasks a user is currently running or ran recently, and provides management of those tasks.",
login:a.href});a.href="../task";var c=function(a){try{if(window.location.host===parent.location.host&&window.location.protocol===parent.location.protocol)return a.substring(parent.location.href.indexOf(parent.location.host)+parent.location.host.length)}catch(c){}return a}(a.href);i.registerService("orion.core.operation",{getOperations:function(a){var g=new URL(c,window.location);a&&typeof a==="object"&&Object.keys(a).forEach(function(c){g.query.set(c,a[c])});return d("GET",g.href,{headers:{"Orion-Version":"1"},
timeout:a.Longpolling?7E4:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;f(a);return a})},getOperation:function(a){return j.handle(a)},removeCompletedOperations:function(){return d("DELETE",c,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;f(a);return a})},removeOperation:function(a){var c=new m;d("DELETE",a,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;f(a);c.resolve(a)},
function(a){var d=a;if(a.responseText){d=a.responseText;try{d=JSON.parse(a.responseText)}catch(e){}}d.Message?c.reject(d):c.reject({Severity:"Error",Message:d})});return c}},{name:"Tasks",pattern:c});i.connect()});