/*******************************************************************************
 * @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) 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) 2010, 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) 2010-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) 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 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) 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

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

 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
 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) 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
*/
(function(g,n){typeof define==="function"&&define.amd?define("orion/Deferred",[],n):typeof exports==="object"?module.exports=n():(g.orion=g.orion||{},g.orion.Deferred=n())})(this,function(){function g(f){if(a)d?(m.next={fn:f,next:null},m=m.next):m=d={fn:f,next:null};else{a=!0;do{for(;f;){f();if(h)d?m.next=h:d=h,m=k;d?(h=d.next,k=m,f=d.fn,d=m=null):f=null}a=!1}while(a)}}function n(f){return function(){f.apply(null,arguments)}}function i(f){function b(){for(;l;){var c=l;l=l.next;var b=c.deferred,e=
d.isResolved()?"resolve":"reject";if(c[e])try{var f=c[e](j);f&&typeof f.then==="function"?(c.cancel=f.cancel,f.then(n(b.resolve),n(b.reject),b.progress)):b.resolve(f)}catch(h){b.reject(h)}else b[e](j)}l=a=null}function c(b){if(e){if(b)throw Error("already "+e);return!0}return!1}var j,e,l,a,h=!1,d=this;this.reject=function(f,a){c(a)||(e="rejected",j=f,l&&g(b));return d.promise};this.resolve=function(f,a){c(a)||(e="resolved",j=f,l&&g(b));return d.promise};this.progress=function(b,e){if(!c(e))for(var j=
l;j;)j.progress&&j.progress(b),j=j.next;return d.promise};this.cancel=function(e,j){if(!c(j))return h=!0,f&&(e=f(e)||e),e=e||Error("canceled"),g(d.reject.bind(d,e)),e;for(var a=l;a;){if(a.canceling)return delete a.canceling,b(),a.cancel&&a.cancel(e);a=a.next}};this.then=function(c,j,f){var d={resolve:c,reject:j,progress:f,cancel:this.cancel,deferred:new i(function(b){d.canceling=!0;return d.cancel&&d.cancel(b)})};l?a.next=d:l=d;a=d;e&&g(b);return d.deferred.promise};this.isResolved=function(){return e===
"resolved"};this.isRejected=function(){return e==="rejected"};this.isFulfilled=function(){return!!e};this.isCanceled=function(){return h};this.promise={then:this.then,cancel:this.cancel,isResolved:this.isResolved,isRejected:this.isRejected,isFulfilled:this.isFulfilled,isCanceled:this.isCanceled};this.notify=this.progress;this.state=function(){return e||"pending"};this.promise.state=this.state}var d,m,h,k,a=!1;i.all=function(f,b){function c(b,c){a.isFulfilled()||(l[b]=c,--e===0&&a.resolve(l))}function j(e,
j){if(!a.isFulfilled()){if(b)try{c(e,b(j));return}catch(l){j=l}a.reject(j)}}var e=f.length,l=[],a=new i(function(b){f.forEach(function(c){c.cancel&&c.cancel(b)})});e===0?a.resolve(l):f.forEach(function(b,e){b.then(c.bind(null,e),j.bind(null,e))});return a.promise};i.when=function(a,b,c,j){var e;if(!(a&&typeof a.then==="function"))e=new i,e.resolve(a),a=e.promise;return a.then(b,c,j)};return i});
define("orion/EventTarget",[],function(){function g(){this._namedListeners={}}g.prototype={dispatchEvent:function(g){if(!g.type)throw Error("unspecified type");var i=this._namedListeners[g.type];i&&i.forEach(function(d){try{typeof d==="function"?d(g):d.handleEvent(g)}catch(i){typeof console!=="undefined"&&console.log(i)}});return!g.defaultPrevented},addEventListener:function(g,i){if(typeof i==="function"||i.handleEvent)this._namedListeners[g]=this._namedListeners[g]||[],this._namedListeners[g].push(i)},
removeEventListener:function(g,i){var d=this._namedListeners[g];if(d)for(var m=0;m<d.length;m++)if(d[m]===i){d.length===1?delete this._namedListeners[g]:d.splice(m,1);break}}};g.prototype.constructor=g;g.attach=function(n){var i=new g;n.dispatchEvent=i.dispatchEvent.bind(i);n.addEventListener=i.addEventListener.bind(i);n.removeEventListener=i.removeEventListener.bind(i)};return g});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(g,n){function i(a,f,b){this._properties=b||{};this._properties["service.id"]=a;this._properties.objectClass=f;this._properties["service.names"]=f}function d(a,f,b){this._serviceId=a;this._serviceReference=f;this._internalRegistry=b}function m(a,f){function b(b){return function(){var c;try{if(!f())throw Error("Service was unregistered");var l=a[b].apply(a,Array.prototype.slice.call(arguments));if(l&&typeof l.then==="function")return l;
else c=new g,c.resolve(l)}catch(d){c=new g,c.reject(d)}return c.promise}}for(var c in a)typeof a[c]==="function"&&(this[c]=b(c))}function h(a,f){this.type=a;this.serviceReference=f}function k(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new n;var a=this;this._internalRegistry={isRegistered:function(f){return a._entries[f]?!0:!1},unregisterService:function(f){var b=a._entries[f];if(!b)throw Error("already unregistered");var c=b.reference;a._serviceEventTarget.dispatchEvent(new h("unregistering",
c));a._entries[f]=null;c.getProperty("objectClass").forEach(function(b){for(var e=a._namedReferences[b],l=0;l<e.length;l++)if(e[l]===c){e.length===1?delete a._namedReferences[b]:e.splice(l,1);break}})},modifyService:function(f){f=a._entries[f];if(!f)throw Error("already unregistered");a._serviceEventTarget.dispatchEvent(new h("modified",f.reference))}}}i.prototype={getPropertyKeys:function(){var a=[],f;for(f in this._properties)this._properties.hasOwnProperty(f)&&a.push(f);return a},getProperty:function(a){return this._properties[a]}};
i.prototype.constructor=i;d.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("already unregistered");return this._serviceReference},setProperties:function(a){var f=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;a.objectClass=f.objectClass;a["service.names"]=f["service.names"];this._internalRegistry.modifyService(this._serviceId)}};
d.prototype.constructor=d;k.prototype={getService:function(a){var f;if(typeof a==="string")(a=this._namedReferences[a])&&a.some(function(b){f=this._entries[b.getProperty("service.id")].service;return!!f},this);else if(a=this._entries[a.getProperty("service.id")])f=a.service;return f||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:[];var f=[];this._entries.forEach(function(b){b&&f.push(b.reference)});return f},registerService:function(a,f,b){if(typeof f===
"undefined"||f===null)throw Error("invalid service");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var c=this._entries.length,j=new i(c,a,b),e=this._namedReferences;a.forEach(function(b){e[b]=e[b]||[];e[b].push(j)});a=new m(f,this._internalRegistry.isRegistered.bind(null,c));this._entries.push({reference:j,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new h("registered",j));return new d(c,j,a)},addEventListener:function(a,f){this._serviceEventTarget.addEventListener(a,
f)},removeEventListener:function(a,f){this._serviceEventTarget.removeEventListener(a,f)}};k.prototype.constructor=k;return{ServiceRegistry:k}});
define("orion/xhr",["orion/Deferred"],function(g){function n(d){return encodeURIComponent(d).replace(/[!'()*]/g,function(d){return"%"+d.charCodeAt(0).toString(16).toUpperCase()})}function i(d,g,h,i){var a=typeof h.response!=="undefined"?h.response:h.responseText,d={args:g,response:a,responseText:typeof a==="string"?a:null,status:h.status,url:d,xhr:h};if(typeof i!=="undefined")d.error=i;return d}return function(d,m,h){var h=h||{},k=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,a=
new g,f=h.headers||{},b=h.log||!1,c,j;typeof f["X-Requested-With"]==="undefined"&&(f["X-Requested-With"]="XMLHttpRequest");if(h.query&&typeof h.query==="object"){var e=h.query,l=Object.keys(e),C=[];for(j=0;j<l.length;j++){var w=l[j],t=e[w];C.push(n(w)+"="+n(t))}C.length&&(e=m.split("#"),e[0]+=(e[0].indexOf("?")===-1?"?":"&")+C.join("&"),m=e.join("#"))}if(typeof h.data!=="undefined"&&(d==="POST"||d==="PUT"))c=h.data;if(typeof h.responseType==="string")k.responseType=h.responseType;k.onreadystatechange=
function(){if(k.readyState===4){var c=i(m,h,k),e=k.status;200<=e&&e<400?a.resolve(c):(b&&typeof console!=="undefined"&&console.log(Error(k.statusText)),a.reject(c))}};try{k.open(d,m,!0);if(typeof h.timeout==="number")typeof k.timeout==="number"?(k.timeout=h.timeout,k.addEventListener("timeout",function(){a.reject(i(m,h,k,"Timeout exceeded"))})):setTimeout(function(){a.state()!=="resolved"&&a.state()!=="rejected"&&a.reject(i(m,h,k,"Timeout exceeded"))},h.timeout);var o=Object.keys(f);for(j=0;j<o.length;j++){var x=
o[j];k.setRequestHeader(x,f[x])}k.send(c)}catch(y){a.reject(i(m,h,k,y))}return a}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(g,n,i){function d(b,c){this._name=b;this._providers=c;this._flushPending=!1;this._cached=null;this._stores=[];this._dirty=[]}function m(b,c){return{get:function(j,e){if(c===0)return null;var a=localStorage.getItem(b+j);if(a===null)return null;a=JSON.parse(a);return e||c===-1||a._expires&&a._expires>(new Date).getTime()?(delete a._expires,a):null},set:function(j,e){if(c!==0){if(c!==-1)e._expires=(new Date).getTime()+1E3*c;
if(Object.keys(e).length===0)localStorage.removeItem(b+j);else{var a=JSON.stringify(e);localStorage.setItem(b+j,a);delete e._expires}}},remove:function(c){localStorage.removeItem(b+c)}}}function h(b){this._currentPromises={};this._cache=new m("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var c=b.getServiceReferences("orion.core.preference.provider");if(c.length>0)this._service=b.getService(c[0])}return!!this._service}}function k(b){this._location=
b;this._currentPromise=null;this._cache=new m("/orion/preferences/default",3600)}function a(){this._cache=new m("/orion/preferences/local",-1)}function f(b,c){this._userProvider=new h(b);this._localProvider=new a;c=c||"defaults.pref";c.indexOf("://")===-1&&(c=g.toUrl(c));this._defaultsProvider=new k(c);this._serviceRegistration=b.registerService("orion.core.preference",this)}d.prototype={_flush:function(){for(var b=[],c=0;c<this._stores.length;++c){var a=this._stores[c];this._dirty.indexOf(a)!==-1&&
b.push(this._providers[c].put(this._name,a))}this._dirty=[];return n.all(b)},_scheduleFlush:function(b){this._dirty.indexOf(b)===-1&&this._dirty.push(b);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),0)},_getCached:function(){if(!this._cached){this._cached={};for(var b=0;b<this._stores.length;++b){var c=this._stores[b],a;for(a in c)c.hasOwnProperty(a)&&typeof this._cached[a]==="undefined"&&(this._cached[a]=
c[a])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(b){return this._getCached()[b]},put:function(b,c){if(this._stores.length!==0){var a=this._stores[0];if(a[b]!==c)a[b]=c,this._cached=null,this._scheduleFlush(a)}},remove:function(b){for(var c=0;c<this._stores.length;++c){var a=this._stores[c];if(a.hasOwnProperty(b))return delete a[b],this._cached=null,this._scheduleFlush(a),!0}return!1},clear:function(){for(var b=0;b<this._stores.length;++b)this._stores[b]=
{},this._scheduleFlush(this._stores[b]);this._cached=null},sync:function(b){if(this._flushPending)return this._flushPending=!1,this._flush();for(var c=this,a=[],e=0;e<this._providers.length;++e)a.push(this._providers[e].get(this._name,b).then(function(b){return function(e){c._stores[b]=e}}(e)));return n.all(a).then(function(){c._cached=null;c._getCached()})},flush:function(){this._flush()}};h.prototype={get:function(b,c){if(this._currentPromises[b])return this._currentPromises[b];var a=new n,e=null;
c?this._cache.remove(b):e=this._cache.get(b);if(e!==null)a.resolve(e);else{this._currentPromises[b]=a;var f=this;this._service.get(b).then(function(c){f._cache.set(b,c);delete f._currentPromises[b];a.resolve(c)},function(c){c.status===404?(c={},f._cache.set(b,c),delete f._currentPromises[b],a.resolve(c)):(delete f._currentPromises[b],a.resolve(f._cache.get(b,!0)||{}))})}return a},put:function(b,c){this._cache.set(b,c);return this._service.put(b,c)}};k.prototype={get:function(b,c){if(this._currentPromise)return this._currentPromise;
var a=new n,e=null;c?this._cache.remove(b):e=this._cache.get(b);if(e!==null)a.resolve(e);else{this._currentPromise=a;var f=this;i("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=JSON.parse(c.response);f._cache.set(b,c[b]||{});f._currentPromise=null;a.resolve(c[b]||{})},function(c){c.xhr.status===401||c.xhr.status===404?(f._cache.set(b,{}),f._currentPromise=null,a.resolve({})):(f._currentPromise=null,c=f._cache.get(b,!0),c!==null?a.resolve(c[b]||{}):a.resolve({}))})}return a},
put:function(){var b=new n;b.resolve();return b}};a.prototype={get:function(b){var c=new n,b=this._cache.get(b);b!==null?c.resolve(b):c.resolve({});return c},put:function(b,c){var a=new n;this._cache.set(b,c);a.resolve();return a}};f.DEFAULT_SCOPE=1;f.LOCAL_SCOPE=2;f.USER_SCOPE=4;f.prototype={listenForChangedSettings:function(b){window.addEventListener("storage",b,!1);return"/orion/preferences/local/settings"},getPreferences:function(b,c){if(!c||typeof c!=="number"||c>7||c<1)c=f.DEFAULT_SCOPE|f.LOCAL_SCOPE|
f.USER_SCOPE;var a=[];f.USER_SCOPE&c&&this._userProvider.available()&&a.push(this._userProvider);f.LOCAL_SCOPE&c&&a.push(this._localProvider);f.DEFAULT_SCOPE&c&&a.push(this._defaultsProvider);var e=new d(b,a);return e.sync().then(function(){return e})},getSetting:function(b,c,a){for(var e,f=0;f<b.length;f++)if(b[f].label===c)for(var d=0;d<b[f].data.length;d++)if(b[f].data[d].label===a){e=b[f].data[d].value;break}return e}};return{PreferencesService:f}});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget"],function(g,n){function i(a,b){var c=Object.keys(a),j=Object.keys(b);if(c.length!==j.length)return!1;c.sort();j.sort();for(var e=0,l=c.length;e<l;e++){var d=c[e];if(d!==j[e])return!1;var h=a[d],d=b[d];if(h!==d&&JSON.stringify(h)!==JSON.stringify(d))return!1}return!0}function d(a){if(a.indexOf("://")===-1){var b=document.createElement("a");b.href=a;return b.href}return a}function m(a){var b=null;return{key:function(c){return(b=b||
Object.keys(a))[c]},getItem:function(c){return a[c]},setItem:function(c,d){a[c]=d;b=null},removeItem:function(c){delete a[c];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(c){delete a[c]}.bind(this));b=null}}}function h(a,b){return{type:a,plugin:b}}function k(a,b,c){function d(a,b,e){if(!r)return(new g).reject(Error("plugin not connected"));var f=D++,l=new g(function(a){p==="active"&&c.postMessage({id:f,cancel:typeof a==="string"?a:"canceled"},r)});B[String(f)]=l;c.postMessage({id:f,
serviceId:a,method:b,params:e},r);return l.promise}function e(a){var c={};if(a.methods&&(a.methods.forEach(function(b){c[b]=function(){var c=Array.prototype.slice.call(arguments);return p==="active"?d(a.serviceId,b,c):o.start({"transient":!0}).then(function(){return d(a.serviceId,b,c)})}}),c.addEventListener&&c.removeEventListener)){var b=new n;c.dispatchEvent=b.dispatchEvent.bind(b);var e=c.addEventListener;c.addEventListener=function(a,c){b._namedListeners[a]||e(a);b.addEventListener(a,c)};var f=
c.removeEventListener;c.removeEventListener=function(a,c){b.removeEventListener(a,c);b._namedListeners[a]&&f(a)}}return c}function l(c){var b=JSON.parse(JSON.stringify(c.properties));b.__plugin__=a;c=c.names||c.type||[];Array.isArray(c)||(c=[c]);b.objectClass=c;return b}function m(a){var b=e(a),f=l(a),f=c.registerService(a.names||a.type,b,f);q[a.serviceId]={registration:f,proxy:b}}function k(){c.persist(a,{created:x,headers:y,services:z,autostart:v,lastModified:A})}function t(b){var e;try{if(b.method)if("manifest"===
b.method||"plugin"===b.method){var d=b.params[0];d.headers=d.headers||{};d.services=d.services||{};i(d.headers,y)&&i(d.services,z)?s.resolve(o):o.update({headers:d.headers,services:d.services}).then(function(){s.resolve(o)})}else if("dispatchEvent"===b.method){var l=q[b.serviceId].proxy;l.dispatchEvent.apply(l,b.params)}else if("progress"===b.method)e=B[String(b.requestId)],e.progress.apply(e,b.params);else if("timeout"===b.method)s&&s.reject(Error("Load timeout for plugin: "+a));else throw Error("Bad response method: "+
b.method);else if(e=B[String(b.id)],delete B[String(b.id)],b.error){var j=c.handleServiceError(o,b.error);e.reject(j)}else e.resolve(b.result)}catch(x){console.log("Plugin._responseHandler "+x)}}var o=this,b=b||{},x=b.created||(new Date).getTime(),y=b.headers||{},z=b.services||[],v=b.autostart,A=b.lastModified||0,p="installed",u,s,r,q={},D=0,B={};this._persist=k;this._resolve=function(){p="resolved";c.dispatchEvent(new h("resolved",o))};this._getAutostart=function(){return v};this._getCreated=function(){return x};
this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(y))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return A};this.getServiceReferences=function(){var a=[];Object.keys(q).forEach(function(c){a.push(q[c].registration.getReference())});return a};this.getState=function(){return p};this.start=function(b){if(p===
"uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(u)return u.promise.then(this.start.bind(this,b));if(p==="active")return(new g).resolve();if(!b||!b["transient"]){var e=b&&b.lazy?"lazy":"started";e!==v&&(v=e,k())}e=c.getState();if(e!=="starting"&&e!=="active")return b["transient"]?(new g).reject(Error("start transient error")):(new g).resolve();if(p==="installed")try{this._resolve()}catch(d){return(new g).reject(d)}p==="resolved"&&z.forEach(function(a){m(a)});if(b&&b.lazy)return p!==
"starting"&&(p="starting",c.dispatchEvent(new h("lazy activation",o))),(new g).resolve();var l=new g;u=l;p="starting";c.dispatchEvent(new h("starting",o));s=new g;r=c.connect(a,t);s.then(function(){s=null;p="active";c.dispatchEvent(new h("started",o));u=null;l.resolve()},function(){s=null;p="stopping";c.dispatchEvent(new h("stopping",o));Object.keys(q).forEach(function(a){q[a].registration.unregister();delete q[a]});c.disconnect(r);r=null;p="resolved";u=null;c.dispatchEvent(new h("stopped",o));l.reject(Error("plugin activation error"))});
return l.promise};this.stop=function(a){if(p==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(u)return u.promise.then(this.stop.bind(this,a));if((!a||!a["transient"])&&"stopped"!==v)v="stopped",k();if(p!=="active"&&p!=="starting")return(new g).resolve();u=a=new g;p="stopping";c.dispatchEvent(new h("stopping",o));Object.keys(q).forEach(function(a){q[a].registration.unregister();delete q[a]});r&&(c.disconnect(r),r=null);p="resolved";u=null;c.dispatchEvent(new h("stopped",o));
a.resolve();return a.promise};this.update=function(b){if(p==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(!b)return A===0&&(A=(new Date).getTime(),k()),c.loadManifest(a).then(this.update.bind(this));y=b.headers||{};z=b.services||{};v=b.autostart||v;b.lastModified?A=b.lastModified:(A=(new Date).getTime(),k());if(p==="active"||p==="starting"){var e=[];Object.keys(z).forEach(function(a){var b=z[a];e.push(a);var c=q[a];if(c){if(i(b.methods,Object.keys(c.proxy))){var a=l(b),f=
c.registration.getReference(),d={};f.getPropertyKeys().forEach(function(a){d[a]=f.getProperty(a)});i(a,d)||c.registration.setProperties(a);return}c.registration.unregister();delete q[a]}m(b)});Object.keys(q).forEach(function(a){e.indexOf(a)===-1&&(q[a].registration.unregister(),delete q[a])})}p==="active"&&(c.disconnect(r),s=new g,r=c.connect(a,t),s.then(function(){s=null},function(){s=null;p="stopping";c.dispatchEvent(new h("stopping"),o);Object.keys(q).forEach(function(a){q[a].registration.unregister();
delete q[a]});c.disconnect(r);r=null;p="resolved";c.dispatchEvent(new h("stopped",o))}));c.dispatchEvent(new h("updated",o));return(new g).resolve()};this.uninstall=function(){if(p==="uninstalled")return(new g).reject(Error("Plugin is uninstalled"));if(p==="active"||p==="starting"||p==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));c.removePlugin(this);p="uninstalled";c.dispatchEvent(new h("uninstalled",o));return(new g).resolve()}}var a=/^http[s]?/i;return{Plugin:k,
PluginRegistry:function(f,b){function c(a){var b=a.source;i.some(function(c){if(b===c.target){if(typeof c.useStructuredClone==="undefined")c.useStructuredClone=typeof a.data!=="string";c.handler(c.useStructuredClone?a.data:JSON.parse(a.data));return!0}})}var b=b||{},j=b.storage||localStorage;j.getItem||(j=m(j));var e="installed",l=[],i=[],w=new n,t={},o={registerService:f.registerService.bind(f),connect:function(a,c,e){function f(){c({method:"timeout"})}var d={handler:c,url:a},l=setTimeout(f,e||15E3);
if(a.match(/\.js$/)&&typeof Worker!=="undefined"){var j=new Worker(a);j.onmessage=function(a){if(typeof d.useStructuredClone==="undefined")d.useStructuredClone=typeof a.data!=="string";d.handler(d.useStructuredClone?a.data:JSON.parse(a.data))};d.target=j;d.close=function(){j.terminate()}}else{var h=document.createElement("iframe");h.name=a+"_"+(new Date).getTime();if(!b.visible)h.style.display="none",h.style.visibility="hidden";h.src=a;h.onload=function(){clearTimeout(l);setTimeout(f,5E3)};h.sandbox=
"allow-scripts allow-same-origin";document.body.appendChild(h);d.target=h.contentWindow;d.close=function(){h&&(document.body.removeChild(h),h=null)}}i.push(d);return d},disconnect:function(a){for(var b=0;b<i.length;b++)if(a===i[b]){i.splice(b,1);try{a.close()}catch(c){}break}},removePlugin:function(a){for(var b=0;b<l.length;b++)if(a===l[b]){l.splice(b,1);break}j.removeItem("plugin."+a.getLocation())},persist:function(a,b){j.setItem("plugin."+a,JSON.stringify(b))},postMessage:function(a,b){b.target.postMessage(b.useStructuredClone?
a:JSON.stringify(a),b.url)},dispatchEvent:function(a){try{w.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new g,c=o.connect(a,function(e){c&&e.method&&("manifest"===e.method||"plugin"===e.method?(e=e.params[0],o.disconnect(c),c=null,b.resolve(e)):"timeout"===e.method&&(o.disconnect(c),c=null,b.reject(Error("Load timeout for plugin: "+a))))});return b.promise},getState:function(){return e},handleServiceError:function(b,c){if(c&&c.status===
401){var e=b.getHeaders(),f=b.getName()||b.getLocation(),d=document.createElement("span");d.appendChild(document.createTextNode("Authentication required for: "+f+"."));if(e.login)d.appendChild(document.createTextNode(" ")),f=document.createElement("a"),f.target="_blank",f.textContent="Login",f.href=e.login,a.test(f.href)?(d.appendChild(f),d.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+e.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(d)}}return c}};
this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=o.getState;this.init=function(){if(!(e==="starting"||e==="active"||e==="stopping")){addEventListener("message",c,!1);for(var f=[],h=0,g=j.length;h<g;h++)f.push(j.key(h));f.forEach(function(a){if(a.indexOf("plugin.")===0){var b=a.substring(7),a=JSON.parse(j.getItem(a));a.created&&l.push(new k(b,
a,o))}});l.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});b.plugins&&Object.keys(b.plugins).forEach(function(c){c=d(c);if(a.test(c)){if(!this.getPlugin(c)){var e=b.plugins[c],e=typeof e==="object"||{};e.autostart=e.autostart||b.defaultAutostart||"lazy";l.push(new k(c,e,o))}}else console.log("Illegal Plugin URL: "+c)}.bind(this));e="starting"}};this.start=function(){e!=="starting"&&this.init();if(e!=="starting")return(new g).reject("Cannot start framework. Framework is already "+
e+".");var a=[];l.forEach(function(b){var c=b._getAutostart();b.getLastModified()===0?a.push(b.update().then(function(){if("started"===c)return b.start({"transient":!0});if("lazy"===c)return b.start({lazy:!0,"transient":!0});b._resolve()})):"started"===c?a.push(b.start({"transient":!0})):"lazy"===c?a.push(b.start({lazy:!0,"transient":!0})):b._resolve()});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){e="active"})};this.stop=function(){if(e!=="starting"&&e!=="active")return(new g).reject("Cannot stop registry. Registry is already "+
e+".");e="stopping";var a=[];l.forEach(function(b){a.push(b.stop({"transient":!0}))});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){removeEventListener("message",c);e="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new g).reject("Cannot uninstall registry")};this.installPlugin=function(b,c){b=d(b);if(!a.test(b))return(new g).reject("Illegal Plugin URL: "+b);var e=this.getPlugin(b);if(e)return(new g).resolve(e);
if(t[b])return t[b];if(c)return e=new k(b,c,o),l.push(e),e._persist(),o.dispatchEvent(new h("installed",e)),(new g).resolve(e);var f=o.loadManifest(b).then(function(a){e=new k(b,a,o);l.push(e);e._persist();delete t[b];o.dispatchEvent(new h("installed",e));return e},function(a){delete t[b];throw a;});return t[b]=f};this.getPlugins=function(){return l.slice()};this.getPlugin=function(a){var b=null,a=d(a);l.some(function(c){if(a===c.getLocation())return b=c,!0});return b};this.addEventListener=w.addEventListener.bind(w);
this.removeEventListener=w.removeEventListener.bind(w);this.resolvePlugins=function(){var a=!0;l.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/textview/eventTarget",[],function(){function g(){}g.addMixin=function(n){var i=g.prototype,d;for(d in i)i.hasOwnProperty(d)&&(n[d]=i[d])};g.prototype={addEventListener:function(g,i,d){if(!this._eventTypes)this._eventTypes={};var m=this._eventTypes[g];m||(m=this._eventTypes[g]={level:0,listeners:[]});m.listeners.push({listener:i,useCapture:d})},dispatchEvent:function(g){var i=g.type;this._dispatchEvent("pre"+i,g);this._dispatchEvent(i,g);this._dispatchEvent("post"+i,g)},_dispatchEvent:function(g,
i){var d=this._eventTypes?this._eventTypes[g]:null;if(d){var m=d.listeners;try{if(d.level++,m)for(var h=0,k=m.length;h<k;h++)if(m[h]){var a=m[h].listener;typeof a==="function"?a.call(this,i):a.handleEvent&&typeof a.handleEvent==="function"&&a.handleEvent(i)}}finally{if(d.level--,d.compact&&d.level===0){for(h=m.length-1;h>=0;h--)m[h]||m.splice(h,1);m.length===0&&delete this._eventTypes[g];d.compact=!1}}}},isListening:function(g){return!this._eventTypes?!1:this._eventTypes[g]!==void 0},removeEventListener:function(g,
i,d){if(this._eventTypes){var m=this._eventTypes[g];if(m){for(var h=m.listeners,k=0,a=h.length;k<a;k++){var f=h[k];if(f&&f.listener===i&&f.useCapture===d){m.level!==0?(h[k]=null,m.compact=!0):h.splice(k,1);break}}h.length===0&&delete this._eventTypes[g]}}}};return{EventTarget:g}});
define("orion/serviceTracker",[],function(){function g(d,g){function h(b){var c=b.getProperty("service.id"),d=this.addingService(b);d&&(a[c]=b,f[c]=d)}function k(b){var c=b.getProperty("service.id"),d=f[c];delete a[c];delete f[c];this.removedService(b,d)}this.serviceRegistry=d;var a={},f={},b=n,c,j;this.close=function(){if(b!==i)throw"Already closed";b=n;d.removeEventListener("registered",c);d.removeEventListener("unregistering",j);j=c=null;var a=this;this.getServiceReferences().forEach(function(b){k.call(a,
b)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var a=a;return a.length?Object.keys(a).map(function(b){return a[b]}):null};this.open=function(){if(b!==n)throw"Already open";b=i;var a=this;c=function(b){if(b.serviceReference.getProperty("objectClass").indexOf(g)!==-1&&(h.call(a,b.serviceReference),typeof a.onServiceAdded==="function"))return a.onServiceAdded(b.serviceReference,a.serviceRegistry.getService(b.serviceReference))};j=function(b){b.serviceReference.getProperty("objectClass").indexOf(g)!==
-1&&k.call(a,b.serviceReference)};d.addEventListener("registered",c);d.addEventListener("unregistering",j);d.getServiceReferences(g).forEach(function(b){h.call(a,b)});if(typeof this.onOpen==="function")this.onOpen()}}var n=0,i=1;g.prototype={addingService:function(d){return this.serviceRegistry.getService(d)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return g});
define("orion/config",["orion/textview/eventTarget","orion/Deferred","orion/serviceTracker"],function(g,n,i){var d,m,h,k,a="pid";d=function(b,c,f){function e(a,b,e){b.forEach(function(f,d){try{var g=a[d].getProperty("__plugin__"),h=g&&c.getPlugin(g);(!g||h&&h.getState()==="active")&&b[d].updated(e)}catch(j){typeof console!=="undefined"&&console.log(j)}})}i.call(this,b,"orion.cm.managedservice");var d={},g={},h=function(c){var e=[];c.plugin.getServiceReferences().forEach(function(c){if(c.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var d=c.getProperty(a),c=b.getService(c);d&&c&&(d=(d=f._find(d))&&d.getProperties(),e.push(c.updated(d)))}});return n.all(e)};this.addingService=function(c){var e=c.getProperty(a),f=b.getService(c);if(!e||!f)return null;d[e]||(d[e]=[]);g[e]||(g[e]=[]);d[e].push(c);g[e].push(f);return f};this.onServiceAdded=function(b,c){var d=b.getProperty(a),d=f._find(d);e([b],[c],d&&d.getProperties())};this.onOpen=function(){c.addEventListener("started",h)};this.onClose=function(){c.removeEventListener("started",
h)};this.notifyUpdated=function(a){var b=a.getPid();e(d[b]||[],g[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();e(d[a]||[],g[a]||[],null)};this.removedService=function(b,c){var e=b.getProperty(a),f=d[e],h=g[e];f.length>1?f.splice(f.indexOf(b),1):delete d[e];h.length>1?h.splice(h.indexOf(c),1):delete g[e]}};g=function(){function a(b,f,e){this.store=new m(this,e);this.configAdmin=new h(this,this.store);this.tracker=new d(b,f,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(b){a.tracker.open();return b})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();h=function(){function a(b,d){this.factory=b;this.store=d}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var f="/cm/configurations";
m=function(){function b(b,d){this.factory=b;this.prefsService=d;this.configs=Object.create(null);this.pref=null;var e=this;this.initPromise=this.prefsService.getPreferences(f).then(function(b){e.pref=b;b.keys().forEach(function(c){if(!e.configs[c]){var d=b.get(c);typeof d==="object"&&d!==null&&Object.keys(d).length>0&&(d[a]=c,e.configs[c]=new k(e.factory,e,d))}})})}b.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var b=this._find(a);
b||(b=new k(this.factory,this,a),this.configs[a]=b);return b},list:function(){var a=this,b=[];this.pref.keys().forEach(function(e){(e=a._find(e))&&e.getProperties()!==null&&b.push(e)});return b},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,b){this.pref.put(a,b.getProperties(!0)||{})}};return b}();k=function(){function b(a){for(var b={},c=Object.keys(a),d=0;d<c.length;d++){var f=c[d],g=a[f];b[f]=g instanceof Array?g.slice():g}return b}function c(c,e,d){this.factory=
c;this.store=e;if(d!==null&&typeof d==="object")this.pid=d[a],c=b(d),delete c[a],this.properties=c;else if(typeof d==="string")this.pid=d,this.properties=null;else throw Error("Invalid pid/properties "+d);}c.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(c){this._checkRemoved();var e=null;if(this.properties&&(e=b(this.properties),!c))e[a]=this.pid;return e},remove:function(){this._checkRemoved();
this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=!0},update:function(c){this._checkRemoved();c=b(c);delete c[a];this.properties=c;this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return c}();return{ConfigurationAdminFactory:g}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(g,n,i,d,m,h){var k;return{startup:function(){if(k)return k;k=new n;var a=window.serviceRegistry=new i.ServiceRegistry,f=new d.PreferencesService(a);return f.getPreferences("/plugins").then(function(b){var c={plugins:{}};b.keys().forEach(function(a){var d=g.toUrl(a);c.plugins[d]=b[a]});var d=window.pluginRegistry=new m.PluginRegistry(a,c);return d.start().then(function(){if(a.getServiceReferences("orion.core.preference.provider").length>
0)return f.getPreferences("/plugins",f.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=g.toUrl(a);d.getPlugin(a)||b.push(d.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return n.all(b,function(a){console.log(a)})})}).then(function(){return(new h.ConfigurationAdminFactory(a,d,f)).getConfigurationAdmin().then(a.registerService.bind(a,"orion.cm.configadmin"))}).then(function(){var b=a.getService("orion.core.auth");
if(b){var c=b.getUser().then(function(a){if(a)localStorage.setItem("lastLogin",(new Date).getTime());else return b.getAuthForm(window.location.href).then(function(a){window.location=a})}),d=localStorage.getItem("lastLogin");if(!d||d<(new Date).getTime()-9E5)return c}}).then(function(){var b={serviceRegistry:a,preferences:f,pluginRegistry:d};k.resolve(b);return b})})}}});
define("domReady",[],function(){function g(a){for(var b=0,c;c=a[b];b++)c(k)}function n(){var c=a,d=f;h&&(c.length&&(a=[],g(c)),b.resourcesDone&&d.length&&(f=[],g(d)))}function i(){h||(h=!0,j&&clearInterval(j),n())}function d(b){h?b(k):a.push(b);return d}var m=typeof window!=="undefined"&&window.document,h=!m,k=m?document:null,a=[],f=[],b=requirejs||require||{},c=b.resourcesReady,j;if("resourcesReady"in b)b.resourcesReady=function(a){c&&c(a);a&&n()};m&&(document.addEventListener?(document.addEventListener("DOMContentLoaded",
i,!1),window.addEventListener("load",i,!1)):window.attachEvent&&(window.attachEvent("onload",i),self===self.top&&(j=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),i())}catch(a){}},30))),document.readyState==="complete"&&i());d.withResources=function(a){h&&b.resourcesDone?a(k):f.push(a);return d};d.version="1.0.0";d.load=function(a,b,c,f){f.isBuild?c(null):d(c)};return d});
define("index",["orion/bootstrap","domReady!"],function(g){g.startup().then(function(){window.location="navigate/table.html"})});