/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/**
 * @license 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) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 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
 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) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
*/
(function(d,g){typeof define==="function"&&define.amd?define("orion/Deferred",g):typeof exports==="object"?module.exports=g():(d.orion=d.orion||{},d.orion.Deferred=g())})(this,function(){function d(){for(var f;f=e.shift();)f();c=!1}function g(f){e.push(f);c||(c=!0,setTimeout(d,0))}function i(f){return function(){f.apply(void 0,arguments)}}function k(){function f(){for(var a;a=l.shift();){var b=a.deferred,f=n==="fulfilled"?"resolve":"reject";if(typeof a[f]==="function")try{var c=(0,a[f])(o),d=c&&(typeof c===
"object"||typeof c==="function")&&c.then;if(typeof d==="function")if(c===b.promise)b.reject(new TypeError);else{var j=c.cancel;typeof j==="function"?b._protected(e).parentCancel=j.bind(c):delete b._protected(e).parentCancel;d.call(c,i(b.resolve),i(b.reject),i(b.progress))}else b.resolve(c)}catch(g){b.reject(g)}else b[f](o)}}function c(b){delete a.parentCancel;n="rejected";o=b;l.length&&g(f)}function d(h){function e(a){return function(b){u||(u=!0,a(b))}}var u=!1;delete a.parentCancel;try{var i=h&&
(typeof h==="object"||typeof h==="function")&&h.then;if(typeof i==="function")if(h===b)c(new TypeError);else{n="assumed";var q=h&&h.cancel;if(typeof q!=="function"){var s=new k,h=s.promise;try{i(s.resolve,s.reject,s.progress)}catch(t){s.reject(t)}q=h.cancel;i=h.then}o=h;i.call(h,e(d),e(c));a.parentCancel=q.bind(h)}else n="fulfilled",o=h,l.length&&g(f)}catch(z){e(c)(z)}}function q(){var b=a.parentCancel;if(b)delete a.parentCancel,b();else if(!n)b=Error("Cancel"),b.name="Cancel",c(b)}var o,n,l=[],b=
this,a={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==e)throw Error("protected");return a}});this.resolve=function(a){n||d(a);return b};this.reject=function(a){n||c(a);return b};this.progress=function(a){n||l.forEach(function(b){if(b.progress)try{b.progress(a)}catch(c){}});return b.promise};this.cancel=function(){a.parentCancel?setTimeout(q,0):q();return b};this.then=function(a,c,d){a={resolve:a,reject:c,progress:d,deferred:new k};l.push(a);a.deferred._protected(e).parentCancel=
b.promise.cancel.bind(b);(n==="fulfilled"||n==="rejected")&&g(f);return a.deferred.promise};this.promise={then:b.then,cancel:b.cancel}}var e=[],c=!1;k.all=function(c,e){function d(a,h){l||(i[a]=h,--o===0&&b.resolve(i))}function g(a,h){if(!l){if(e)try{d(a,e(h));return}catch(c){h=c}b.reject(h)}}var o=c.length,i=[],l=!1,b=new k;b.then(void 0,function(){l=!0;c.forEach(function(a){a.cancel&&a.cancel()})});o===0?b.resolve(i):c.forEach(function(a,b){a.then(d.bind(void 0,b),g.bind(void 0,b))});return b.promise};
k.when=function(c,e,d,g){var i;if(!(c&&typeof c.then==="function"))i=new k,i.resolve(c),c=i.promise;return c.then(e,d,g)};return k});
(function(d,g){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],g):typeof exports==="object"?module.exports=g(require("orion/Deferred")):(d.orion=d.orion||{},d.orion.PluginProvider=g(d.orion.Deferred))})(this,function(d){function g(d,g){this.__objectId=d;this.__methods=g}return function(i){function k(a){b&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),b===self?b.postMessage(a):b.postMessage(a,"*"))}function e(){var a=[];Object.keys(s).forEach(function(b){var c=
s[b];a.push({serviceId:b,names:c.names,methods:c.methods,properties:c.properties})});return{headers:n||{},services:a}}function c(a,b){if(b&&b instanceof XMLHttpRequest){var c,h;try{c=b.status,h=b.statusText}catch(p){c=0,h=""}return{status:c||0,statusText:h}}return b}function f(a){var b=a?JSON.parse(JSON.stringify(a,c)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function m(c){if(!b)return(new d).reject(Error("plugin not connected"));c.id=String(a++);
var e=new d;v[c.id]=e;e.then(null,function(a){l&&a instanceof Error&&a.name==="Cancel"&&t({requestId:c.id,method:"cancel",params:a.message?[a.message]:[]})});var f=Object.prototype.toString;c.params.forEach(function(a,b){if(f.call(a)==="[object Object]"&&!(a instanceof g)){var r,d;for(r in a)f.call(a[r])==="[object Function]"&&(d=d||[],d.push(r));if(d){var A=h++;w[A]=a;r=function(){delete w[A]};e.then(r,r);c.params[b]=new g(A,d)}}});t(c);return e.promise}function j(a,b){a||a===0?t({id:a,result:null,
error:b}):console.log(b)}function q(a,b,c,h){h.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var p={};a.__methods.forEach(function(b){p[b]=function(){return m({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});h[b]=p}});var p=typeof a===void 0?null:{id:a,result:null,error:null};try{var r=c.apply(b,h);if(p)r&&typeof r.then==="function"?(u[a]=r,r.then(function(b){delete u[a];p.result=b;t(p)},function(b){if(u[a])delete u[a],p.error=f(b),t(p)},function(){t({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(p.result=r,t(p))}catch(e){if(p)p.error=f(e),t(p)}}function o(a){if(a.source===b){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var c=a.method,h=a.params||[];if("serviceId"in a){var e=s[a.serviceId];e||j(a.id,"service not found");e=e.implementation;c in e?q(a.id,e,e[c],h):j(a.id,"method not found")}else if("objectId"in a){var p=w[a.objectId];p||j(a.id,"object not found");!c in p?q(a.id,p,p[c],h):j(a.id,"method not found")}else if("requestId"in
a){var r=u[a.requestId];r&&c==="cancel"&&r.cancel&&r.cancel.apply(r,h)}else if("responseId"in a){var d=v[a.responseId];d&&c==="progress"&&d.progress&&d.progress.apply(d,h)}else throw Error("Bad method: "+a.method);}else{var f=v[String(a.id)];delete v[String(a.id)];a.error?f.reject(a.error):f.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}}var n=i,l=!1,b=null,a=0,h=0,x=0,u={},v={},w={},s={},t=k;this.updateHeaders=function(a){if(l)throw Error("Cannot update headers. Plugin Provider is connected");
n=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(l)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var h=null,p=[];for(h in b)typeof b[h]==="function"&&p.push(h);s[x++]={names:a,methods:p,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,c){if(!l){if(typeof window==="undefined")b=self;else if(window!==window.parent)b=window.parent;else if(window.opener!==null)b=window.opener;else{c&&
c("No valid plugin target");return}addEventListener("message",o,!1);var h={method:"plugin",params:[e()]};k(h);l=!0}a&&a()};this.disconnect=function(){l&&(removeEventListener("message",o),b=null,l=!1)}}});
define("orion/xhr",["orion/Deferred"],function(d){function g(d,g,e,c){var f=typeof e.response!=="undefined"?e.response:e.responseText,m;try{m=e.status}catch(j){m=0}d={args:g,response:f,responseText:typeof f==="string"?f:null,status:m,url:d,xhr:e};if(typeof c!=="undefined")d.error=c;return d}return function(i,k,e){var e=e||{},c=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,f=new d,m=e.headers||{},j=e.log||!1,q;typeof m["X-Requested-With"]==="undefined"&&(m["X-Requested-With"]="XMLHttpRequest");
if(typeof e.data!=="undefined"&&(i==="POST"||i==="PUT"))q=e.data;var o=!1,n=!1;f.promise.then(void 0,function(a){o=!0;!n&&a instanceof Error&&a.name==="Cancel"&&c.abort()});c.onabort=function(){n=!0;if(!o){var a=Error("Cancel");a.name="Cancel";f.reject(a)}};c.onload=function(){var a=g(k,e,c);200<=c.status&&c.status<400?f.resolve(a):(f.reject(a),j&&typeof console!=="undefined"&&console.log(Error(c.statusText)))};c.onerror=function(){var a=g(k,e,c);f.reject(a);j&&typeof console!=="undefined"&&console.log(Error(c.statusText))};
c.onprogress=function(a){a.xhr=c;f.progress(a)};try{c.open(i,k,!0);if(typeof e.responseType==="string")c.responseType=e.responseType;if(typeof e.timeout==="number")if(typeof c.timeout==="number")c.timeout=e.timeout,c.addEventListener("timeout",function(){f.reject(g(k,e,c,"Timeout exceeded"))});else{var l=setTimeout(function(){f.reject(g(k,e,c,"Timeout exceeded"))},e.timeout);f.promise.then(clearTimeout.bind(null,l),clearTimeout.bind(null,l))}Object.keys(m).forEach(function(a){c.setRequestHeader(a,
m[a])});c.send(q||null)}catch(b){f.reject(g(k,e,c,b))}return f.promise}});
(function(){function d(a){if(typeof a!=="string")throw new TypeError;}function g(a){return a?a.split("&"):[]}function i(a){return a.length===0?"":a.join("&")}function k(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function e(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function c(a,b){var c="",h=[],e=0;return{next:function(){if(c!==a.query)c=a.query,h=g(c);if(e<h.length){var d=k(h[e++]);
switch(b){case "keys":return d[0];case "values":return d[1];case "keys+values":return[d[0],d[1]];default:throw new TypeError;}}throw B;}}}function f(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function m(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function j(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function q(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function o(b,c){if(typeof b!==
"string")throw new TypeError;var b=q(b),e=a.exec(b);if(!e)return null;var d={};d.scheme=e[1]||"";if(d.scheme&&!x.test(d.scheme))return null;var f=e[2];if(f&&(f=h.exec(f),d.userinfo=f[1],d.host=f[2],d.port=f[3],d.port&&!u.test(d.port)))return null;d.path=e[3];d.query=e[4];d.fragment=e[5];if(!d.scheme&&c&&(d.scheme=c.scheme,!d.host&&c.host))d.userinfo=c.userinfo,d.host=c.host,d.port=c.port,d.pathRelative=!0;if(d.pathRelative)if(d.path){if(d.path[0]!=="/")e=/^(.*\/)[^\/]*$/.exec(c.path)[1]||"/",d.path=
e+d.path}else d.path=c.path;if(d.scheme)d.scheme=d.scheme.toLowerCase();if(d.port)d.port=m(d.port);if(d.host&&d.path)d.path=j(d.path);return d}function n(a,b){var c;if(b){b=b.href||b;c=o(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=o(a,c);if(!c)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:c,writable:!0});var d=new f(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var l;if(typeof window.URL==="function"&&window.URL.length!==0&&(l=new window.URL("http://www.w3.org?q")).protocol==="http:"&&l.query)return}catch(b){}var a=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,h=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,x=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,u=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,s=/^([^?#\s]*)$/,t=/^([^\s]*)$/,z=/^\S*$/,y=/([^:]*):?(.*)/,B=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),C={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(f.prototype,{get:{value:function(a){d(a);var b;g(this._url.query).some(function(c){c=k(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){d(a);d(b);var c=g(this._url.query);c.some(function(d,h){var f=k(d);if(f[0]===a)return f[1]=b,c[h]=e(f),!0})||c.push(e([a,b]));this._url.query=i(c)},enumerable:!0},has:{value:function(a){d(a);
return g(this._url.query).some(function(b){if(k(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){d(a);var b=g(this._url.query),c=b.filter(function(b){return k(b)[0]!==a});return c.length!==b.length?(this._url.query=i(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=c(this._url,"keys+values");try{for(;;){var h=d.next();a.call(b,h[1],h[0],this)}}catch(e){if(e!==B)throw e;
}},enumerable:!0},keys:{value:function(){return c(this._url,"keys")},enumerable:!0},values:{value:function(){return c(this._url,"values")},enumerable:!0},items:{value:function(){return c(this._url,"keys+values")}},size:{get:function(){return g(this._url.query).length},enumerable:!0},getAll:{value:function(a){d(a);var b=[];g(this._url.query).forEach(function(c){c=k(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){d(a);d(b);var c=g(this._url.query);c.push(e([a,b]));this._url.query=
i(c)},enumerable:!0}});Object.defineProperties(n.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(a){d(a);this._input=a;this._url=o(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){d(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,a===""||x.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){d(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){d(a);if(this._url){var b=
y.exec(this._userinfo),a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){d(a);if(this._url){var b=[y.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){d(a);if(this._url&&(a=w.exec(a)))this._url.host=a[1],this._url.port=m(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){d(a);if(this._url&&v.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===C[this.protocol]&&(a="");return a},set:function(a){d(a);if(this._url&&u.exec(a))this._url.port=m(a)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){d(a);
if(this._url&&s.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?j(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){d(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),t.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){d(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),z.exec(a)))this._url.fragment=a},enumerable:!0}});
if((l=window.URL||window.webkitURL)&&l.createObjectURL)Object.defineProperty(n,"createObjectURL",{value:l.createObjectURL.bind(l),enumerable:!1}),Object.defineProperty(n,"revokeObjectURL",{value:l.revokeObjectURL.bind(l),enumerable:!1});window.URL=n})();define("orion/URL-shim",function(){});
define("orion/operation",["orion/xhr","orion/Deferred"],function(d,g){function i(e,c,f,g){d("GET",e,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(j){j=j.response?JSON.parse(j.response):null;c.progress(j);!j.type||j.type==="loadstart"||j.type==="progress"?setTimeout(function(){i(e,c,f,g)},2E3):(j.type==="error"||j.type==="abort"?c.reject(g?g(j):j.Result):c.resolve(f?f(j):j.Result.JsonData),j.Location||d("DELETE",e,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(d){var e=d;if(d.responseText!==
void 0){e=d.responseText;try{e=JSON.parse(d.responseText)}catch(f){}}e.Message!==void 0?(e.HttpCode=e.HttpCode===void 0?d.status:e.HttpCode,e.Severity=e.Severity===void 0?"Error":e.Severity,c.reject(e)):c.reject({Severity:"Error",Message:e,HttpCode:d.status})})}function k(e,c){c.then(null,function(c){c instanceof Error&&c.name==="Cancel"&&d("PUT",e,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(d,c,f){var m=new g;k(d,m);i(d,m,c,f);return m}}});
define("plugins/filePlugin/fileImpl",["orion/Deferred","orion/xhr","orion/URL-shim","orion/operation"],function(d,g,i,k){function e(b){b&&typeof b==="object"&&Object.keys(b).forEach(function(a){var c=b[a];a.indexOf("Location")!==-1?(l.href=c,b[a]=l.href):e(c)});return b}function c(b){b&&(b=b.replace(";","%3B"));return b}function f(b,a,d){return g(b,c(a),d)}function m(b){return b.replace(/([^\u0020-\u007e]|%)+/g,encodeURIComponent)}function j(){return f.apply(null,Array.prototype.slice.call(arguments)).then(function(b){if(b.xhr&&
b.xhr.status===202){var b=b.response?JSON.parse(b.response):null,a=new d;k.handle(b.Location,function(a){return a.Result}).then(a.resolve,a.reject,a.progress);return a}return b.response?JSON.parse(b.response):null})}function q(b){var a;a=b.keyword;for(var c="",d=0;d<a.length;d++){var e=a.charAt(d);'+-&|!(){}[]^"~:\\'.indexOf(e)>=0&&(c+="\\");c+=e}a=c;c=b.sort;b.nameSearch?(d=/\*$/.test(b.keyword)?"":"*",a="NameLower:"+a+d):b.fileType&&b.fileType!=="*.*"?a!==""?(a.indexOf(" ")>=0&&(a='"'+a+'"'),a=
encodeURIComponent(a)+"+NameLower:*."+b.fileType):(a="NameLower:*."+b.fileType,c=c.replace("Path","NameLower")):a=a.indexOf(" ")>=0?encodeURIComponent('"'+a+'"'):encodeURIComponent(a);return"?sort="+c+"&rows="+b.rows+"&start="+b.start+"&q="+a+"+Location:"+b.resource+"*"}function o(b,a){this.fileBase=b;this.makeAbsolute=(this.workspaceBase=a)&&a.indexOf("://")!==-1}function n(b,a,e,f){var g=new d,i=new XMLHttpRequest;try{i.open(b,c(a)),e&&Object.keys(e).forEach(function(a){i.setRequestHeader(a,e[a])}),
i.responseType="arraybuffer",i.send(f),i.onload=function(){g.resolve({status:i.status,statusText:i.statusText,headers:i.getAllResponseHeaders(),response:i.response})}}catch(j){g.reject(j)}return g}var l=document.createElement("a");o.prototype={fetchChildren:function(b){if(b===this.fileBase)return this.loadWorkspace(b).then(function(a){return a.Children||[]});b.indexOf("?depth=")===-1&&(b+="?depth=1");return f("GET",b,{headers:{"Orion-Version":"1","Content-Type":"charset=UTF-8"},timeout:15E3}).then(function(a){return(a.response?
JSON.parse(a.response):{}).Children||[]}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},_createWorkspace:function(b){return f("POST",this.workspaceBase,{headers:{"Orion-Version":"1",Slug:m(b)},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):{}})},loadWorkspaces:function(){return f("GET",this.workspaceBase,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){return(b.response?JSON.parse(b.response):{}).Workspaces}).then(function(b){this.makeAbsolute&&
e(b);return b}.bind(this))},loadWorkspace:function(b){b===this.fileBase&&(b=null);return f("GET",b?b:this.workspaceBase,{headers:{"Orion-Version":"1"},timeout:15E3,log:!1}).then(function(a){a=a.response?JSON.parse(a.response):{};return b?a:a.Workspaces.length>0?this.loadWorkspace(a.Workspaces[0].Location):this._createWorkspace("Orion Content")}.bind(this)).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},createProject:function(b,a,c,d){if(b){a={Name:a};if(c)a.ContentLocation=c;if(d)a.CreateIfDoesntExist=
d;return f("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json;charset=UTF-8"},timeout:15E3,data:JSON.stringify(a)}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))}else console.error("url is undefined, make sure you're signed in before creating a project")},createFolder:function(b,a){return f("POST",b,{headers:{"Orion-Version":"1","X-Create-Options":"no-overwrite",Slug:m(a),"Content-Type":"application/json;charset=UTF-8"},
data:JSON.stringify({Name:a,LocalTimeStamp:"0",Directory:"true"}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},createFile:function(b,a){return f("POST",b,{headers:{"Orion-Version":"1","X-Create-Options":"no-overwrite",Slug:m(a),"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Name:a,LocalTimeStamp:"0",Directory:"false"}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):
null}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},deleteFile:function(b){return f("DELETE",b,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},moveFile:function(b,a,c){return this._doCopyMove(b,a,!0,c).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},copyFile:function(b,a,c){return this._doCopyMove(b,a,!1,c).then(function(a){this.makeAbsolute&&
e(a);return a}.bind(this))},_doCopyMove:function(b,a,c,d){d||(d=b.split("/"),d=d.pop()||d.pop());return f("POST",a,{headers:{"Orion-Version":"1",Slug:m(d),"X-Create-Options":"no-overwrite,"+(c?"move":"copy"),"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Location:b,Name:d}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null})},read:function(b,a,c){b=new URL(b,window.location);a&&b.query.set("parts","meta");return f("GET",b.href,{timeout:15E3,headers:{"Orion-Version":"1"},
log:!1}).then(function(b){return a?b.response?JSON.parse(b.response):null:c?{result:b.response,acceptPatch:b.xhr.getResponseHeader("Accept-Patch")}:b.response}).then(function(a){this.makeAbsolute&&e(c?a.result:a);return a}.bind(this))},write:function(b,a,c){var b=new URL(b,window.location),d={"Orion-Version":"1","Content-Type":"text/plain;charset=UTF-8"};if(c&&c.ETag)d["If-Match"]=c.ETag;var c={timeout:15E3,headers:d,data:a,log:!1},g="PUT";if(typeof a!=="string")a.sourceLocation?(c.query={source:a.sourceLocation},
c.data=null):a.diff?(g="POST",d["X-HTTP-Method-Override"]="PATCH",c.data=JSON.stringify(c.data)):b.query.set("parts","meta");return f(g,b.href,c).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},remoteImport:function(b,a){var c={"Orion-Version":"1"};if(a.OptionHeader)c["X-Xfer-Options"]=a.OptionHeader,delete a.OptionHeader;return j("POST",b,{headers:c,data:JSON.stringify(a),timeout:15E3}).then(function(a){this.makeAbsolute&&
e(a);return a}.bind(this))},remoteExport:function(b,a){var c={"Orion-Version":"1"};if(a.OptionHeader)c["X-Xfer-Options"]=a.OptionHeader,delete a.OptionHeader;return j("POST",b,{headers:c,data:JSON.stringify(a),timeout:15E3}).then(function(a){this.makeAbsolute&&e(a);return a}.bind(this))},search:function(b){b=q(b);return f("GET",this.fileBase+"/../filesearch"+b,{headers:{Accept:"application/json","Orion-Version":"1"},timeout:6E4}).then(function(a){return a.response?JSON.parse(a.response):{}}).then(function(a){this.makeAbsolute&&
e(a);return a}.bind(this))}};if(window.Blob)o.prototype.readBlob=function(b){return n("GET",b).then(function(a){return a.response})},o.prototype.writeBlob=function(b,a,c){var d={};if(c&&c.ETag)d["If-Match"]=c.ETag;return n("PUT",b,d,a)};return o});
define("domReady",[],function(){function d(){if(!f){f=!0;e&&clearInterval(e);var c=j;if(f&&c.length){j=[];var d;for(d=0;d<c.length;d+=1)c[d](m)}}}function g(c){f?c(m):j.push(c);return g}var i,k,e,c=typeof window!=="undefined"&&window.document,f=!c,m=c?document:null,j=[];if(c){if(document.addEventListener)document.addEventListener("DOMContentLoaded",d,!1),window.addEventListener("load",d,!1);else if(window.attachEvent){window.attachEvent("onload",d);k=document.createElement("div");try{i=window.frameElement===
null}catch(q){}k.doScroll&&i&&window.external&&(e=setInterval(function(){try{k.doScroll(),d()}catch(c){}},30))}document.readyState==="complete"&&d()}g.version="2.0.1";g.load=function(c,d,e,b){b.isBuild?e(null):g(e)};return g});
define('built-fileClientPlugin.js',["orion/Deferred","orion/plugin","plugins/filePlugin/fileImpl","domReady!"],function(d,g,i){function k(c){if(e)try{if(window.location.host===parent.location.host&&window.location.protocol===parent.location.protocol)return c.substring(parent.location.href.indexOf(parent.location.host)+parent.location.host.length);else e=!1}catch(d){e=!1}return c}var e=!0,c=document.createElement("a");c.href="../mixloginstatic/LoginWindow.html";g=new g({name:"Orion File Service",version:"1.0",
description:"This plugin provides file access to a user's workspace.",login:c.href});c.href="../file";d=k(c.href);c.href="../workspace";var f=k(c.href);c.href="..";c=k(c.href);i=new i(d,f);g.registerService("orion.core.file",i,{Name:"Orion Content",NameKey:"Orion Content",nls:"orion/navigate/nls/messages",top:d,pattern:c});g.connect()});