/*******************************************************************************
 * @license
 * Copyright (c) 2011, 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). 
 *
 *******************************************************************************/

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

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

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 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
 ******************************************************************************/

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


 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, 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) 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) 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) 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, 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) 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 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/domReady 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(){function a(){for(var a=navigator.userAgent,i={browser:!1,version:!1},l=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:5}],f=0;f<l.length;f++){var h=l[f],c=a.match(h.regExp);if(c){i.browser=!0;i.version=c[1]>=h.minVersion;i.name=h.name;break}}return i}function i(){try{return"localStorage"in
window&&window.localStorage!==null}catch(a){return!1}}function j(a){alert(a);throw Error("unsupported browser");}var l=a();if(l.browser)l.version||j("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+l.name+".\n");else if(i()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=1;else throw"unsupported browser";
else i()||j("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:a,supportsLocalStorage:i,throwBrowserAlert:j}})();define("orion/browserCompatibility",function(){});
(function(a,i){typeof define==="function"&&define.amd?define("orion/Deferred",i):typeof exports==="object"?module.exports=i():(a.orion=a.orion||{},a.orion.Deferred=i())})(this,function(){function a(){for(var a;a=m.shift();)a();k=!1}function i(i){m.push(i);k||(k=!0,setTimeout(a,0))}function j(a){return function(){a.apply(void 0,arguments)}}function l(){function a(){for(var g;g=d.shift();){var c=g.deferred,s=b==="fulfilled"?"resolve":"reject";if(typeof g[s]==="function")try{var f=(0,g[s])(e),h=f&&(typeof f===
"object"||typeof f==="function")&&f.then;if(typeof h==="function")if(f===c.promise)c.reject(new TypeError);else{var i=f.cancel;typeof i==="function"?c._protected(m).parentCancel=i.bind(f):delete c._protected(m).parentCancel;h.call(f,j(c.resolve),j(c.reject),j(c.progress))}else c.resolve(f)}catch(w){c.reject(w)}else c[s](e)}}function f(g){delete s.parentCancel;b="rejected";e=g;d.length&&i(a)}function h(c){function m(b){return function(c){j||(j=!0,b(c))}}var j=!1;delete s.parentCancel;try{var k=c&&
(typeof c==="object"||typeof c==="function")&&c.then;if(typeof k==="function")if(c===g)f(new TypeError);else{b="assumed";var v=c&&c.cancel;if(typeof v!=="function"){var p=new l,c=p.promise;try{k(p.resolve,p.reject,p.progress)}catch(w){p.reject(w)}v=c.cancel;k=c.then}e=c;k.call(c,m(h),m(f));s.parentCancel=v.bind(c)}else b="fulfilled",e=c,d.length&&i(a)}catch(t){m(f)(t)}}function c(){var c=s.parentCancel;if(c)delete s.parentCancel,c();else if(!b)c=Error("Cancel"),c.name="Cancel",f(c)}var e,b,d=[],g=
this,s={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==m)throw Error("protected");return s}});this.resolve=function(c){b||h(c);return g};this.reject=function(c){b||f(c);return g};this.progress=function(c){b||d.forEach(function(b){if(b.progress)try{b.progress(c)}catch(g){}});return g.promise};this.cancel=function(){s.parentCancel?setTimeout(c,0):c();return g};this.then=function(c,e,s){c={resolve:c,reject:e,progress:s,deferred:new l};d.push(c);c.deferred._protected(m).parentCancel=
g.promise.cancel.bind(g);(b==="fulfilled"||b==="rejected")&&i(a);return c.deferred.promise};this.promise={then:g.then,cancel:g.cancel}}var m=[],k=!1;l.all=function(a,f){function h(c,f){d||(b[c]=f,--e===0&&g.resolve(b))}function c(c,b){if(!d){if(f)try{h(c,f(b));return}catch(e){b=e}g.reject(b)}}var e=a.length,b=[],d=!1,g=new l;g.then(void 0,function(){d=!0;a.forEach(function(c){c.cancel&&c.cancel()})});e===0?g.resolve(b):a.forEach(function(b,g){b.then(h.bind(void 0,g),c.bind(void 0,g))});return g.promise};
l.when=function(a,f,h,c){var e;if(!(a&&typeof a.then==="function"))e=new l,e.resolve(a),a=e.promise;return a.then(f,h,c)};return l});
define("orion/EventTarget",[],function(){function a(){this._namedListeners={}}a.prototype={dispatchEvent:function(a){if(!a.type)throw Error("unspecified type");var j=this._namedListeners[a.type];j&&j.forEach(function(l){try{typeof l==="function"?l(a):l.handleEvent(a)}catch(m){typeof console!=="undefined"&&console.log(m)}});return!a.defaultPrevented},addEventListener:function(a,j){if(typeof j==="function"||j.handleEvent)this._namedListeners[a]=this._namedListeners[a]||[],this._namedListeners[a].push(j)},
removeEventListener:function(a,j){var l=this._namedListeners[a];if(l)for(var m=0;m<l.length;m++)if(l[m]===j){l.length===1?delete this._namedListeners[a]:l.splice(m,1);break}}};a.prototype.constructor=a;a.attach=function(i){var j=new a;i.dispatchEvent=j.dispatchEvent.bind(j);i.addEventListener=j.addEventListener.bind(j);i.removeEventListener=j.removeEventListener.bind(j)};return a});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(a,i){function j(f,a,c){this._properties=c||{};this._properties["service.id"]=f;this._properties.objectClass=a;this._properties["service.names"]=a}function l(f,a,c){this._serviceId=f;this._serviceReference=a;this._internalRegistry=c}function m(f,h){function c(c){return function(){var d;try{if(!h())throw Error("Service was unregistered");var g=f[c].apply(f,Array.prototype.slice.call(arguments));if(g&&typeof g.then==="function")return g;
else d=new a,d.resolve(g)}catch(e){d=new a,d.reject(e)}return d.promise}}for(var e in f)typeof f[e]==="function"&&(this[e]=c(e))}function k(f,a){this.type=f;this.serviceReference=a}function n(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new i;var f=this;this._internalRegistry={isRegistered:function(a){return f._entries[a]?!0:!1},unregisterService:function(a){var c=f._entries[a];if(!c)throw Error("Service has already been unregistered: "+a);var e=c.reference;f._serviceEventTarget.dispatchEvent(new k("unregistering",
e));f._entries[a]=null;e.getProperty("objectClass").forEach(function(c){for(var d=f._namedReferences[c],g=0;g<d.length;g++)if(d[g]===e){d.length===1?delete f._namedReferences[c]:d.splice(g,1);break}})},modifyService:function(a){var c=f._entries[a];if(!c)throw Error("Service not found while trying to send modified event: "+a);f._serviceEventTarget.dispatchEvent(new k("modified",c.reference))}}}j.prototype={getPropertyKeys:function(){var a=[],h;for(h in this._properties)this._properties.hasOwnProperty(h)&&
a.push(h);return a},getProperty:function(a){return this._properties[a]}};j.prototype.constructor=j;l.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(a){var h=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;
a.objectClass=h.objectClass;a["service.names"]=h["service.names"];this._internalRegistry.modifyService(this._serviceId)}};l.prototype.constructor=l;n.prototype={getService:function(a){var h;if(typeof a==="string")(a=this._namedReferences[a])&&a.some(function(c){h=this._entries[c.getProperty("service.id")].service;return!!h},this);else if(a=this._entries[a.getProperty("service.id")])h=a.service;return h||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:
[];var h=[];this._entries.forEach(function(c){c&&h.push(c.reference)});return h},registerService:function(a,h,c){if(typeof h==="undefined"||h===null)throw Error("invalid service");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var e=this._entries.length,b=new j(e,a,c),d=this._namedReferences;a.forEach(function(c){d[c]=d[c]||[];d[c].push(b)});a=new m(h,this._internalRegistry.isRegistered.bind(null,e));this._entries.push({reference:b,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new k("registered",
b));return new l(e,b,a)},addEventListener:function(a,h){this._serviceEventTarget.addEventListener(a,h)},removeEventListener:function(a,h){this._serviceEventTarget.removeEventListener(a,h)}};n.prototype.constructor=n;return{ServiceRegistry:n}});
define("orion/xhr",["orion/Deferred"],function(a){function i(a,i,m,k){var n=typeof m.response!=="undefined"?m.response:m.responseText,f;try{f=m.status}catch(h){f=0}a={args:i,response:n,responseText:typeof n==="string"?n:null,status:f,url:a,xhr:m};if(typeof k!=="undefined")a.error=k;return a}return function(j,l,m){var m=m||{},k=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,n=new a,f=m.headers||{},h=m.log||!1,c;typeof f["X-Requested-With"]==="undefined"&&(f["X-Requested-With"]="XMLHttpRequest");
if(typeof m.data!=="undefined"&&(j==="POST"||j==="PUT"))c=m.data;var e=!1,b=!1;n.promise.then(void 0,function(c){e=!0;!b&&c instanceof Error&&c.name==="Cancel"&&k.abort()});k.onabort=function(){b=!0;if(!e){var c=Error("Cancel");c.name="Cancel";n.reject(c)}};k.onload=function(){var c=i(l,m,k);200<=k.status&&k.status<400?n.resolve(c):(n.reject(c),h&&typeof console!=="undefined"&&console.log(Error(k.statusText)))};k.onerror=function(){var c=i(l,m,k);n.reject(c);h&&typeof console!=="undefined"&&console.log(Error(k.statusText))};
k.onprogress=function(c){c.xhr=k;n.progress(c)};try{k.open(j,l,!0);if(typeof m.responseType==="string")k.responseType=m.responseType;if(typeof m.timeout==="number")if(typeof k.timeout==="number")k.timeout=m.timeout,k.addEventListener("timeout",function(){n.reject(i(l,m,k,"Timeout exceeded"))});else{var d=setTimeout(function(){n.reject(i(l,m,k,"Timeout exceeded"))},m.timeout);n.promise.then(clearTimeout.bind(null,d),clearTimeout.bind(null,d))}Object.keys(f).forEach(function(c){k.setRequestHeader(c,
f[c])});k.send(c||null)}catch(g){n.reject(i(l,m,k,g))}return n.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(a,i,j){function l(c,a){this._name=c;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function m(c,a){return{get:function(b,d){if(a===0)return null;var g=localStorage.getItem(c+b);if(g===null)return null;g=JSON.parse(g);return d||a===-1||g._expires&&g._expires>(new Date).getTime()?(delete g._expires,g):null},set:function(b,d){if(a!==0){if(a!==-1)d._expires=(new Date).getTime()+
1E3*a;if(Object.keys(d).length===0)localStorage.removeItem(c+b);else{var g=JSON.stringify(d);localStorage.setItem(c+b,g);delete d._expires}}},remove:function(b){localStorage.removeItem(c+b)}}}function k(c){this._currentPromises={};this._cache=new m("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=c.getServiceReferences("orion.core.preference.provider");if(a.length>0)this._service=c.getService(a[0])}return!!this._service}}function n(c){this._location=
c;this._currentPromise=null;this._cache=new m("/orion/preferences/default",3600)}function f(){this._cache=new m("/orion/preferences/local",-1)}function h(c,e){this._userProvider=new k(c);this._localProvider=new f;e=e||"defaults.pref";e.indexOf("://")===-1&&(e=a.toUrl(e));this._defaultsProvider=new n(e);this._serviceRegistration=c.registerService("orion.core.preference",this)}l.prototype={_flush:function(){for(var c=[],a=0;a<this._stores.length;++a){var b=this._stores[a];this._dirty.indexOf(b)!==-1&&
c.push(this._providers[a].put(this._name,b));if(this._pendingDeletes[a]&&this._pendingDeletes[a].length>0){for(b=0;b<this._pendingDeletes[a].length;b++)c.push(this._providers[a].remove(this._name,this._pendingDeletes[a][b]));delete this._pendingDeletes[a]}}this._dirty=[];return i.all(c)},_scheduleFlush:function(c){c&&this._dirty.indexOf(c)===-1&&this._dirty.push(c);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 c=0;c<this._stores.length;++c){var a=this._stores[c],b;for(b in a)a.hasOwnProperty(b)&&typeof this._cached[b]==="undefined"&&(this._cached[b]=a[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(c){return this._getCached()[c]},put:function(c,a){if(this._stores.length!==0){var b=this._stores[0];if(b[c]!==a)b[c]=a,this._cached=null,this._scheduleFlush(b)}},remove:function(c){for(var a=0;a<
this._stores.length;++a){var b=this._stores[a];if(b.hasOwnProperty(c))return delete b[c],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(c),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var c=0;c<this._stores.length;++c)this._stores[c]={},this._scheduleFlush(this._stores[c]);this._cached=null},sync:function(c){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,b=[],d=0;d<this._providers.length;++d)b.push(this._providers[d].get(this._name,
c).then(function(c){return function(b){a._stores[c]=b}}(d)));return i.all(b).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};k.prototype={get:function(c,a){if(this._currentPromises[c])return this._currentPromises[c];var b=new i,d=null;a?this._cache.remove(c):d=this._cache.get(c);if(d!==null)b.resolve(d);else{this._currentPromises[c]=b;var g=this;this._service.get(c).then(function(a){g._cache.set(c,a);delete g._currentPromises[c];b.resolve(a)},function(a){a.status===
404?(a={},g._cache.set(c,a),delete g._currentPromises[c],b.resolve(a)):(delete g._currentPromises[c],b.resolve(g._cache.get(c,!0)||{}))})}return b},put:function(a,e){this._cache.set(a,e);return this._service.put(a,e)},remove:function(a,e){var b=this._cache.get(a);delete b[e];this._cache.set(a,b);return this._service.remove(a,e)}};n.prototype={get:function(a,e){if(this._currentPromise)return this._currentPromise;var b=new i,d=null;e?this._cache.remove(a):d=this._cache.get(a);if(d!==null)b.resolve(d);
else{this._currentPromise=b;var g=this;j("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(d){d=JSON.parse(d.response);g._cache.set(a,d[a]||{});g._currentPromise=null;b.resolve(d[a]||{})},function(d){d.xhr.status===401||d.xhr.status===404?(g._cache.set(a,{}),g._currentPromise=null,b.resolve({})):(g._currentPromise=null,d=g._cache.get(a,!0),d!==null?b.resolve(d[a]||{}):b.resolve({}))})}return b},put:function(){var a=new i;a.resolve();return a},remove:function(a,e){var b=
this._cache.get(a);delete b[e];this.put(a,b)}};f.prototype={get:function(a){var e=new i,a=this._cache.get(a);a!==null?e.resolve(a):e.resolve({});return e},put:function(a,e){var b=new i;this._cache.set(a,e);b.resolve();return b},remove:function(a,e){var b=this._cache.get(a);delete b[e];this.put(a,b)}};h.DEFAULT_SCOPE=1;h.LOCAL_SCOPE=2;h.USER_SCOPE=4;h.prototype={listenForChangedSettings:function(a,e,b){if(!e||typeof e!=="number"||e>7||e<1)b=e,e=h.DEFAULT_SCOPE|h.LOCAL_SCOPE|h.USER_SCOPE;window.addEventListener("storage",
b,!1);if((h.USER_SCOPE&e)!==0)return"/orion/preferences/user"+a;else if((h.LOCAL_SCOPE&e)!==0)return"/orion/preferences/local"+a;return"/orion/preferences/default"+a},getPreferences:function(a,e){if(!e||typeof e!=="number"||e>7||e<1)e=h.DEFAULT_SCOPE|h.LOCAL_SCOPE|h.USER_SCOPE;var b=[];h.USER_SCOPE&e&&this._userProvider.available()&&b.push(this._userProvider);h.LOCAL_SCOPE&e&&b.push(this._localProvider);h.DEFAULT_SCOPE&e&&b.push(this._defaultsProvider);var d=new l(a,b);return d.sync().then(function(){return d})},
getSetting:function(a,e,b){for(var d,g=0;g<a.length;g++)if(a[g].label===e)for(var f=0;f<a[g].data.length;f++)if(a[g].data[f].label===b){d=a[g].data[f].value;break}return d}};return{PreferencesService:h}});
(function(){function a(a){if(typeof a!=="string")throw new TypeError;}function i(a){return a?a.split("&"):[]}function j(a){return a.length===0?"":a.join("&")}function l(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function m(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function k(a,b){var c="",d=[],g=0;return{next:function(){if(c!==a.query)c=a.query,d=i(c);if(g<d.length){var e=l(d[g++]);
switch(b){case "keys":return e[0];case "values":return e[1];case "keys+values":return[e[0],e[1]];default:throw new TypeError;}}throw q;}}}function n(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function f(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function h(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function c(a,b){if(typeof a!=="string")throw new TypeError;var a=h(a),c=g.exec(a);
if(!c)return null;var d={};d.scheme=c[1]||"";if(d.scheme&&!J.test(d.scheme))return null;var e=c[2];if(e&&(e=s.exec(e),d.userinfo=e[1],d.host=e[2],d.port=e[3],d.port&&!K.test(d.port)))return null;d.path=c[3];d.query=c[4];d.fragment=c[5];if(!d.scheme&&b&&(d.scheme=b.scheme,!d.host&&b.host))d.userinfo=b.userinfo,d.host=b.host,d.port=b.port,d.pathRelative=!0;if(d.pathRelative)if(d.path){if(d.path[0]!=="/")c=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",d.path=c+d.path}else d.path=b.path;if(d.scheme)d.scheme=
d.scheme.toLowerCase();if(d.port)d.port=/[1-9]\d*$/.exec(d.port)[0];if(d.host&&d.path)d.path=f(d.path);return d}function e(a,b){var d;if(b){b=b.href||b;d=c(b);if(!d||!d.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:d})}d=c(a,d);if(!d)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:d,writable:!0});var g=new n(this);Object.defineProperty(this,"query",{get:function(){return this._url?g:null},enumerable:!0})}
try{var b;if(typeof window.URL==="function"&&window.URL.length!==0&&(b=new window.URL("http://www.w3.org?q")).protocol==="http:"&&b.query)return}catch(d){}var g=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,s=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,J=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,K=/^\d*$/,M=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,y=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,v=/^([^?#\s]*)$/,p=/^([^\s]*)$/,w=/^\S*$/,t=/([^:]*):?(.*)/,q=typeof StopIteration!=="undefined"?
StopIteration:Error("Stop Iteration"),F={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(n.prototype,{get:{value:function(b){a(b);var d;i(this._url.query).some(function(a){a=l(a);if(a[0]===b)return d=a[1],!0});return d},enumerable:!0},set:{value:function(b,d){a(b);a(d);var c=i(this._url.query);c.some(function(a,g){var e=l(a);if(e[0]===b)return e[1]=d,c[g]=m(e),!0})||c.push(m([b,d]));this._url.query=j(c)},enumerable:!0},has:{value:function(b){a(b);
return i(this._url.query).some(function(a){if(l(a)[0]===b)return!0})},enumerable:!0},"delete":{value:function(b){a(b);var d=i(this._url.query),c=d.filter(function(a){return l(a)[0]!==b});return c.length!==d.length?(this._url.query=j(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var d=k(this._url,"keys+values");try{for(;;){var c=d.next();a.call(b,c[1],c[0],this)}}catch(g){if(g!==q)throw g;
}},enumerable:!0},keys:{value:function(){return k(this._url,"keys")},enumerable:!0},values:{value:function(){return k(this._url,"values")},enumerable:!0},items:{value:function(){return k(this._url,"keys+values")}},size:{get:function(){return i(this._url.query).length},enumerable:!0},getAll:{value:function(b){a(b);var d=[];i(this._url.query).forEach(function(a){a=l(a);a[0]===b&&d.push(a[1])});return d},enumerable:!0},append:{value:function(b,d){a(b);a(d);var c=i(this._url.query);c.push(m([b,d]));this._url.query=
j(c)},enumerable:!0}});Object.defineProperties(e.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(b){a(b);this._input=b;this._url=c(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(b){a(b);if(this._url&&(b=b.slice(-1)===":"?b.substring(0,b.length-1):b,J.test(b)))this._url.scheme=b.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(b){a(b);if(this._url)this._url.userinfo=b}},username:{get:function(){if(!this._url)return"";var a=t.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(b){a(b);if(this._url){var d=
t.exec(this._userinfo),b=[encodeURIComponent(b||"")];d[2]&&b.push(d[2]);this._userinfo=b.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=t.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(b){a(b);if(this._url){var d=[t.exec(this._userinfo)[1]||""];b&&d.push(encodeURIComponent(b));this._userinfo=d.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(b){a(b);if(this._url&&(b=y.exec(b)))this._url.host=b[1],this._url.port=/[1-9]\d*$/.exec(b[2])[0]},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(b){a(b);if(this._url&&M.exec(b))this._url.host=b},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===F[this.protocol]&&(a="");return a},set:function(b){a(b);if(this._url&&K.exec(b))this._url.port=/[1-9]\d*$/.exec(b)[0]},enumerable:!0},pathname:{get:function(){return this._url?
this._url.path:""},set:function(b){a(b);if(this._url&&v.exec(b))this._url.host&&b&&b[0]!=="/"&&(b="/"+b),this._url.path=b?f(b):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(b){a(b);if(this._url&&(b&&b[0]==="?"&&(b=b.substring(1)),p.exec(b)))this._url.query=b},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(b){a(b);if(this._url&&(b&&b[0]==="#"&&(b=b.substring(1)),w.exec(b)))this._url.fragment=
b},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(e,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(e,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=e})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(a,i){function j(a,d){var c=Object.keys(a),e=Object.keys(d);if(c.length!==e.length)return!1;c.sort();e.sort();for(var f=0,h=c.length;f<h;f++){var i=c[f];if(i!==e[f])return!1;var l=a[i],i=d[i];if(l!==i&&JSON.stringify(l)!==JSON.stringify(i))return!1}return!0}function l(a){if(a.indexOf("://")===-1)try{return(new URL(a,location.href)).href}catch(d){}return a}function m(a){var d=null,c={key:function(c){return(d=
d||Object.keys(a))[c]},getItem:function(d){return a[d]},setItem:function(c,g){a[c]=g;d=null},removeItem:function(c){delete a[c];d=null},clear:function(){(d=d||Object.keys(a)).forEach(function(d){delete a[d]}.bind(this));d=null}};Object.defineProperty(c,"length",{get:function(){return(d=d||Object.keys(a)).length}});return c}function k(a,d){if(d&&d instanceof XMLHttpRequest){var c,e;try{c=d.status,e=d.statusText}catch(f){c=0,e=""}return{status:c||0,statusText:e}}return d}function n(a){var d=a?JSON.parse(JSON.stringify(a,
k)):a;if(a instanceof Error)d.__isError=!0,d.message=d.message||a.message,d.name=d.name||a.name;return d}function f(a,d){this.type=a;this.plugin=d}function h(a,d){this.__objectId=a;this.__methods=d}function c(b,d,c){function e(a){u&&c.postMessage(a,u)}function l(b){if(!u)return(new a).reject(Error("plugin not connected"));b.id=String(N++);var d=new a;G[b.id]=d;d.then(null,function(a){o==="active"&&a instanceof Error&&a.name==="Cancel"&&e({requestId:b.id,method:"cancel",params:a.message?[a.message]:
[]})});var f=Object.prototype.toString;b.params.forEach(function(a,c){if(f.call(a)==="[object Object]"&&!(a instanceof h)){var e,g;for(e in a)f.call(a[e])==="[object Function]"&&(g=g||[],g.push(e));if(g){var i=L++;H[i]=a;e=function(){delete H[i]};d.then(e,e);b.params[c]=new h(i,g)}}});c.postMessage(b,u);return d.promise}function m(a,b){a||a===0?e({id:a,result:null,error:b}):console.log(b)}function k(a,b,c,d){d.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var c={};a.__methods.forEach(function(b){c[b]=
function(){return l({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=c}});var g=typeof a===void 0?null:{id:a,result:null,error:null};try{var f=c.apply(b,d);if(g)f&&typeof f.then==="function"?(E[a]=f,f.then(function(b){delete E[a];g.result=b;e(g)},function(b){if(E[a])delete E[a],g.error=n(b),e(g)},function(){e({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(g.result=f,e(g))}catch(i){if(g)g.error=n(i),e(g)}}function y(a){try{if(a.method){var b=
a.method,d=a.params||[];if("serviceId"in a){var e=O[a.serviceId];e||m(a.id,"service not found");b in e?k(a.id,e,e[b],d):m(a.id,"method not found")}else if("objectId"in a){var f=H[a.objectId];f||m(a.id,"object not found");b in f?k(a.id,f,f[b],d):m(a.id,"method not found")}else if("requestId"in a){var i=E[a.requestId];i&&b==="cancel"&&i.cancel&&i.cancel.apply(i,d)}else if("responseId"in a){var h=G[a.responseId];h&&b==="progress"&&h.progress&&h.progress.apply(h,d)}else if("plugin"===a.method){var l=
a.params[0];I({headers:l.headers,services:l.services}).then(function(){x.resolve(q)})}else if("timeout"===a.method)x&&x.reject(a.error);else throw Error("Bad method: "+a.method);}else{var w=G[String(a.id)];delete G[String(a.id)];if(a.error){var t=c.handleServiceError(q,a.error);w.reject(t)}else w.resolve(a.result)}}catch(j){console.log("Plugin._messageHandler "+j)}}function v(a){var b={};if(a.methods&&(a.methods.forEach(function(c){b[c]=function(){var b={serviceId:a.serviceId,method:c,params:Array.prototype.slice.call(arguments)};
return o==="active"?l(b):q.start({"transient":!0}).then(function(){return l(b)})}}),b.addEventListener&&b.removeEventListener)){var c=new i,d=L++;H[d]={handleEvent:c.dispatchEvent.bind(c)};var e=new h(d,["handleEvent"]),g=b.addEventListener;b.addEventListener=function(a,b){c._namedListeners[a]||g(a,e);c.addEventListener(a,b)};var f=b.removeEventListener;b.removeEventListener=function(a,b){c.removeEventListener(a,b);c._namedListeners[a]||f(a,e)}}return b}function p(a){var c=JSON.parse(JSON.stringify(a.properties));
c.__plugin__=b;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);c.objectClass=a;return c}function w(a){var b=v(a),d=p(a),d=c.registerService(a.names||a.type,b,d);r[a.serviceId]={registration:d,proxy:b}}function t(){c.persist(b,{created:F,headers:D,services:B,autostart:z,lastModified:C})}var q=this,d=d||{},F=d.created||(new Date).getTime(),D=d.headers||{},B=d.services||[],z=d.autostart,C=d.lastModified||0,o="installed",A,x,u,r={},N=0,L=0,E={},G={},H={},O={},I;this._persist=t;this._resolve=function(){o=
"resolved";c.dispatchEvent(new f("resolved",q))};this._getAutostart=function(){return z};this._getCreated=function(){return F};this.getLocation=function(){return b};this.getHeaders=function(){return JSON.parse(JSON.stringify(D))};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 C};this.getServiceReferences=function(){var a=[];Object.keys(r).forEach(function(b){a.push(r[b].registration.getReference())});
return a};this.getState=function(){return o};this.start=function(d){if(o==="uninstalled")return(new a).reject(Error("Plugin is uninstalled"));if(A)return A.promise.then(this.start.bind(this,d));if(o==="active")return(new a).resolve();if(!d||!d.transient){var e=d&&d.lazy?"lazy":"started";e!==z&&(z=e,t())}e=c.getState();if(e!=="starting"&&e!=="active")return d.transient?(new a).reject(Error("start transient error")):(new a).resolve();if(o==="installed")try{this._resolve()}catch(i){return(new a).reject(i)}o===
"resolved"&&B.forEach(function(a){w(a)});if(d&&d.lazy)return o!=="starting"&&(o="starting",c.dispatchEvent(new f("lazy activation",q))),(new a).resolve();var h=new a;A=h;o="starting";c.dispatchEvent(new f("starting",q));x=new a;u=c.connect(b,y);x.then(function(){x=null;o="active";c.dispatchEvent(new f("started",q));A=null;h.resolve()},function(){x=null;o="stopping";c.dispatchEvent(new f("stopping",q));Object.keys(r).forEach(function(a){r[a].registration.unregister();delete r[a]});c.disconnect(u);
u=null;o="resolved";A=null;c.dispatchEvent(new f("stopped",q));h.reject(Error("plugin activation error"))});return h.promise};this.stop=function(b){if(o==="uninstalled")return(new a).reject(Error("Plugin is uninstalled"));if(A)return A.promise.then(this.stop.bind(this,b));if((!b||!b.transient)&&"stopped"!==z)z="stopped",t();if(o!=="active"&&o!=="starting")return(new a).resolve();A=b=new a;o="stopping";c.dispatchEvent(new f("stopping",q));Object.keys(r).forEach(function(a){r[a].registration.unregister();
delete r[a]});u&&(c.disconnect(u),u=null);o="resolved";A=null;c.dispatchEvent(new f("stopped",q));b.resolve();return b.promise};I=function(d){if(o==="uninstalled")return(new a).reject(Error("Plugin is uninstalled"));if(!d)return C===0&&(C=(new Date).getTime(),t()),c.loadManifest(b).then(I);var e=D,i=B,h=z;D=d.headers||{};B=d.services||{};z=d.autostart||z;d.lastModified?C=d.lastModified:(C=(new Date).getTime(),t());if(j(D,e)&&j(B,i)&&z===h)return(new a).resolve();if(o==="active"||o==="starting"){var l=
[];Object.keys(B).forEach(function(a){var b=B[a];l.push(a);var d=r[a];if(d){if(j(b.methods,Object.keys(d.proxy))){var a=p(b),c=d.registration.getReference(),e={};c.getPropertyKeys().forEach(function(a){e[a]=c.getProperty(a)});j(a,e)||d.registration.setProperties(a);return}d.registration.unregister();delete r[a]}w(b)});Object.keys(r).forEach(function(a){l.indexOf(a)===-1&&(r[a].registration.unregister(),delete r[a])})}o==="active"&&(c.disconnect(u),x=new a,u=c.connect(b,y),x.then(function(){x=null},
function(){x=null;o="stopping";c.dispatchEvent(new f("stopping"),q);Object.keys(r).forEach(function(a){r[a].registration.unregister();delete r[a]});c.disconnect(u);u=null;o="resolved";c.dispatchEvent(new f("stopped",q))}));return(new a).resolve()};this.update=function(a){return I(a).then(function(){c.dispatchEvent(new f("updated",q))})};this.uninstall=function(){if(o==="uninstalled")return(new a).reject(Error("Plugin is uninstalled"));if(o==="active"||o==="starting"||o==="stopping")return this.stop().then(this.uninstall.bind(this),
this.uninstall.bind(this));c.removePlugin(this);o="uninstalled";c.dispatchEvent(new f("uninstalled",q));return(new a).resolve()}}var e=/^http[s]?/i;return{Plugin:c,PluginRegistry:function(b,d){function g(a){var b=a.source;n.some(function(d){if(b===d.target){try{var c;if(typeof d.useStructuredClone==="undefined"){var e=typeof a.data!=="string";c=e?a.data:JSON.parse(a.data);d.useStructuredClone=e}else c=d.useStructuredClone?a.data:JSON.parse(a.data);d.handler(c)}catch(g){}return!0}})}var d=d||{},h=
d.storage||localStorage;h.getItem||(h=m(h));var j="installed",k=[],n=[],y=new i,v={},p={registerService:b.registerService.bind(b),connect:function(a,b,c){function e(a){a=Error(a);a.name="timeout";b({method:"timeout",error:a})}var g={handler:b,url:a},f=setTimeout(e.bind(null,"Load timeout for: "+a),c||15E3),h=document.createElement("iframe");h.name=a+"_"+(new Date).getTime();if(!d.visible)h.style.display="none",h.style.visibility="hidden";h.src=a;h.onload=function(){clearTimeout(f);setTimeout(e.bind(null,
"Plugin handshake timeout for: "+a),5E3)};h.sandbox="allow-scripts allow-same-origin";document.body.appendChild(h);g.target=h.contentWindow;g.close=function(){h&&(document.body.removeChild(h),h=null)};n.push(g);return g},disconnect:function(a){for(var b=0;b<n.length;b++)if(a===n[b]){n.splice(b,1);try{a.close()}catch(d){}break}},removePlugin:function(a){for(var b=0;b<k.length;b++)if(a===k[b]){k.splice(b,1);break}h.removeItem("plugin."+a.getLocation())},persist:function(a,b){h.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{y.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(b){var d=new a,c=p.connect(b,function(a){c&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],p.disconnect(c),c=null,d.resolve(a)):"timeout"===a.method&&(p.disconnect(c),c=null,d.reject(a.error)))});return d.promise},getState:function(){return j},handleServiceError:function(a,
b){if(b&&b.status===401){var d=a.getHeaders(),c=a.getName()||a.getLocation(),g=document.createElement("span");g.appendChild(document.createTextNode("Authentication required for: "+c+"."));if(d.login)g.appendChild(document.createTextNode(" ")),c=document.createElement("a"),c.target="_blank",c.textContent="Login",c.href=d.login,e.test(c.href)?(g.appendChild(c),g.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+d.login);return{Severity:"Error",HTML:!0,
Message:(new XMLSerializer).serializeToString(g)}}if(b.__isError){var f=b,b=Error(f.message);Object.keys(f).forEach(function(a){b[a]=f[a]});delete b.__isError}return b}};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=p.getState;this.init=function(){if(!(j==="starting"||j==="active"||j==="stopping")){addEventListener("message",g,
!1);for(var a=[],b=0,e=h.length;b<e;b++)a.push(h.key(b));a.forEach(function(a){if(a.indexOf("plugin.")===0){var b=a.substring(7),a=JSON.parse(h.getItem(a));a.created&&k.push(new c(b,a,p))}});k.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});d.plugins&&Object.keys(d.plugins).forEach(function(a){a=l(a);if(!this.getPlugin(a)){var b=d.plugins[a],b=typeof b==="object"||{};b.autostart=b.autostart||d.defaultAutostart||"lazy";k.push(new c(a,b,p))}}.bind(this));j="starting"}};this.start=function(){j!==
"starting"&&this.init();if(j!=="starting")return(new a).reject("Cannot start framework. Framework is already "+j+".");var b=[],d=(new Date).getTime();k.forEach(function(a){var c=a._getAutostart();a.getLastModified()===0?b.push(a.update().then(function(){if("started"===c)return a.start({"transient":!0});if("lazy"===c)return a.start({lazy:!0,"transient":!0});a._resolve()})):"started"===c?b.push(a.start({"transient":!0})):"lazy"===c?(b.push(a.start({lazy:!0,"transient":!0})),d>a.getLastModified()+864E5&&
a.update()):a._resolve()});return a.all(b,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){j="active"})};this.stop=function(){if(j!=="starting"&&j!=="active")return(new a).reject("Cannot stop registry. Registry is already "+j+".");j="stopping";var b=[];k.forEach(function(a){b.push(a.stop({"transient":!0}))});return a.all(b,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){removeEventListener("message",g);j="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};
this.uninstall=function(){return(new a).reject("Cannot uninstall registry")};this.installPlugin=function(b,d){var b=l(b),e=this.getPlugin(b);if(e)return(new a).resolve(e);if(v[b])return v[b];if(d)return e=new c(b,d,p),k.push(e),e._persist(),p.dispatchEvent(new f("installed",e)),(new a).resolve(e);var g=p.loadManifest(b).then(function(a){e=new c(b,a,p);k.push(e);e._persist();delete v[b];p.dispatchEvent(new f("installed",e));return e},function(a){delete v[b];throw a;});return v[b]=g};this.getPlugins=
function(){return k.slice()};this.getPlugin=function(a){var b=null,a=l(a);k.some(function(d){if(a===d.getLocation())return b=d,!0});return b};this.addEventListener=y.addEventListener.bind(y);this.removeEventListener=y.removeEventListener.bind(y);this.resolvePlugins=function(){var a=!0;k.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function a(a,m){function k(a){var b=a.getProperty("service.id"),c=this.addingService(a);c&&(f[b]=a,h[b]=c)}function n(a){var b=a.getProperty("service.id"),c=h[b];delete f[b];delete h[b];this.removedService(a,c)}this.serviceRegistry=a;var f={},h={},c=i,e,b;this.close=function(){if(c!==j)throw"Already closed";c=i;a.removeEventListener("registered",e);a.removeEventListener("unregistering",b);b=e=null;var d=this;this.getServiceReferences().forEach(function(a){n.call(d,
a)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var a=Object.keys(f);return!a.length?null:a.map(function(a){return f[a]})};this.open=function(){if(c!==i)throw"Already open";c=j;var d=this;e=function(a){if(a.serviceReference.getProperty("objectClass").indexOf(m)!==-1&&(k.call(d,a.serviceReference),typeof d.onServiceAdded==="function"))return d.onServiceAdded(a.serviceReference,d.serviceRegistry.getService(a.serviceReference))};b=function(a){a.serviceReference.getProperty("objectClass").indexOf(m)!==
-1&&n.call(d,a.serviceReference)};a.addEventListener("registered",e);a.addEventListener("unregistering",b);a.getServiceReferences(m).forEach(function(a){k.call(d,a)});if(typeof this.onOpen==="function")this.onOpen()}}var i=0,j=1;a.prototype={addingService:function(a){return this.serviceRegistry.getService(a)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return a});
define("orion/objects",[],function(){function a(a){for(var j=1;j<arguments.length;j++){var l=arguments[j],m;for(m in l)Object.prototype.hasOwnProperty.call(l,m)&&(a[m]=l[m])}return a}return{clone:function(i){if(Array.isArray(i))return Array.prototype.slice.call(i);var j=Object.create(Object.getPrototypeOf(i));a(j,i);return j},mixin:a,toArray:function(a){return Array.isArray(a)?a:[a]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(a,i,j){var l,m,k,n,f,h="pid";l=function(c,b,d){function g(a,c,d){c.forEach(function(e,g){try{var f=a[g].getProperty("__plugin__"),h=f&&b.getPlugin(f);(!f||h&&h.getState()==="active")&&c[g].updated(d)}catch(i){typeof console!=="undefined"&&console.log(i)}})}i.call(this,c,"orion.cm.managedservice");var f={},j={},k=function(b){var g=[];b.plugin.getServiceReferences().forEach(function(a){if(a.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var b=a.getProperty(h),a=c.getService(a);b&&a&&(b=(b=d._find(b))&&b.getProperties(),g.push(a.updated(b)))}});return a.all(g)};this.addingService=function(a){var b=a.getProperty(h),d=c.getService(a);if(!b||!d)return null;f[b]||(f[b]=[]);j[b]||(j[b]=[]);f[b].push(a);j[b].push(d);return d};this.onServiceAdded=function(a,b){var c=a.getProperty(h),c=d._find(c);g([a],[b],c&&c.getProperties())};this.onOpen=function(){b.addEventListener("started",k)};this.onClose=function(){b.removeEventListener("started",
k)};this.notifyUpdated=function(a){var b=a.getPid();g(f[b]||[],j[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();g(f[a]||[],j[a]||[],null)};this.removedService=function(a,b){var c=a.getProperty(h),d=f[c],e=j[c];d.length>1?d.splice(d.indexOf(a),1):delete f[c];e.length>1?e.splice(e.indexOf(b),1):delete j[c]}};m=function(){function a(b,c,e){this.store=new k(this,e);this.configAdmin=new n(this,this.store);this.tracker=new l(b,c,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(c){a.tracker.open();return c})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();n=function(){function a(b,c){this.factory=b;this.store=c}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 c="/cm/configurations";
k=function(){function a(b,d){this.factory=b;this.prefsService=d;this.configs=Object.create(null);this.pref=null;var e=this;this.initPromise=this.prefsService.getPreferences(c).then(function(a){e.pref=a;a.keys().forEach(function(b){if(!e.configs[b]){var c=a.get(b);typeof c==="object"&&c!==null&&Object.keys(c).length>0&&(c[h]=b,e.configs[b]=new f(e.factory,e,c))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var c=this._find(a);
c||(c=new f(this.factory,this,a),this.configs[a]=c);return c},list:function(){var a=this,c=[];this.pref.keys().forEach(function(e){(e=a._find(e))&&e.getProperties()!==null&&c.push(e)});return c},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,c){this.pref.put(a,c.getProperties(!0)||{})}};return a}();f=function(){function a(b,c){c=j.clone(c);delete c[h];b.properties=c}function b(b,c,f){this.factory=b;this.store=c;if(f!==null&&typeof f==="object")this.pid=f[h],a(this,
f);else if(typeof f==="string")this.pid=f,this.properties=null;else throw Error("Invalid pid/properties "+f);}b.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var b=null;if(this.properties&&(b=j.clone(this.properties),!a))b[h]=this.pid;return b},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(b){this._checkRemoved();a(this,b);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:m}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(a,i,j,l,m,k){var n;return{startup:function(){if(n)return n;n=new i;var f=new j.ServiceRegistry,h=new l.PreferencesService(f);return h.getPreferences("/plugins").then(function(c){var e={plugins:{}};c.keys().forEach(function(b){var f=a.toUrl(b);e.plugins[f]=c[b]});var b=new m.PluginRegistry(f,e);return b.start().then(function(){if(f.getServiceReferences("orion.core.preference.provider").length>
0)return h.getPreferences("/plugins",h.USER_SCOPE).then(function(c){var e=[];c.keys().forEach(function(c){c=a.toUrl(c);b.getPlugin(c)||e.push(b.installPlugin(c,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return i.all(e,function(a){console.log(a)})})}).then(function(){return(new k.ConfigurationAdminFactory(f,b,h)).getConfigurationAdmin().then(f.registerService.bind(f,"orion.cm.configadmin"))}).then(function(){var a=f.getService("orion.core.auth");
if(a){var b=a.getUser().then(function(b){if(b)localStorage.setItem("lastLogin",(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),c=localStorage.getItem("lastLogin");if(!c||c<(new Date).getTime()-9E5)return b}}).then(function(){var a={serviceRegistry:f,preferences:h,pluginRegistry:b};n.resolve(a);return a})})}}});
define("domReady",[],function(){function a(){if(!n){n=!0;m&&clearInterval(m);var a=h;if(n&&a.length){h=[];var b;for(b=0;b<a.length;b+=1)a[b](f)}}}function i(a){n?a(f):h.push(a);return i}var j,l,m,k=typeof window!=="undefined"&&window.document,n=!k,f=k?document:null,h=[];if(k){if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,!1),window.addEventListener("load",a,!1);else if(window.attachEvent){window.attachEvent("onload",a);l=document.createElement("div");try{j=window.frameElement===
null}catch(c){}l.doScroll&&j&&window.external&&(m=setInterval(function(){try{l.doScroll(),a()}catch(c){}},30))}document.readyState==="complete"&&a()}i.version="2.0.1";i.load=function(a,b,c,f){f.isBuild?c(null):i(c)};return i});define('built-index.js',["orion/browserCompatibility","orion/bootstrap","domReady!"],function(a,i){i.startup().then(function(){window.location="edit/edit.html"})});