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