/*******************************************************************************
 * @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 j(){function f(){for(var a;a=m.shift();){var b=a.deferred,f=p==="fulfilled"?"resolve":"reject";if(typeof a[f]==="function")try{var c=(0,a[f])(n),d=c&&(typeof c===
"object"||typeof c==="function")&&c.then;if(typeof d==="function")if(c===b.promise)b.reject(new TypeError);else{var k=c.cancel;typeof k==="function"?b._protected(e).parentCancel=k.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](n)}}function c(b){delete a.parentCancel;p="rejected";n=b;m.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{p="assumed";var q=h&&h.cancel;if(typeof q!=="function"){var r=new j,h=r.promise;try{i(r.resolve,r.reject,r.progress)}catch(s){r.reject(s)}q=h.cancel;i=h.then}n=h;i.call(h,e(d),e(c));a.parentCancel=q.bind(h)}else p="fulfilled",n=h,m.length&&g(f)}catch(w){e(c)(w)}}function q(){var b=a.parentCancel;if(b)delete a.parentCancel,b();else if(!p)b=Error("Cancel"),b.name="Cancel",c(b)}var n,p,m=[],b=
this,a={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==e)throw Error("protected");return a}});this.resolve=function(a){p||d(a);return b};this.reject=function(a){p||c(a);return b};this.progress=function(a){p||m.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 j};m.push(a);a.deferred._protected(e).parentCancel=
b.promise.cancel.bind(b);(p==="fulfilled"||p==="rejected")&&g(f);return a.deferred.promise};this.promise={then:b.then,cancel:b.cancel}}var e=[],c=!1;j.all=function(c,e){function d(a,h){m||(i[a]=h,--n===0&&b.resolve(i))}function g(a,h){if(!m){if(e)try{d(a,e(h));return}catch(c){h=c}b.reject(h)}}var n=c.length,i=[],m=!1,b=new j;b.then(void 0,function(){m=!0;c.forEach(function(a){a.cancel&&a.cancel()})});n===0?b.resolve(i):c.forEach(function(a,b){a.then(d.bind(void 0,b),g.bind(void 0,b))});return b.promise};
j.when=function(c,e,d,g){var i;if(!(c&&typeof c.then==="function"))i=new j,i.resolve(c),c=i.promise;return c.then(e,d,g)};return j});
(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 j(a){b&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),b===self?b.postMessage(a):b.postMessage(a,"*"))}function e(){var a=[];Object.keys(r).forEach(function(b){var c=
r[b];a.push({serviceId:b,names:c.names,methods:c.methods,properties:c.properties})});return{headers:p||{},services:a}}function c(a,b){if(b&&b instanceof XMLHttpRequest){var c,o;try{c=b.status,o=b.statusText}catch(B){c=0,o=""}return{status:c||0,statusText:o}}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 l(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){m&&a instanceof Error&&a.name==="Cancel"&&s({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 d,y;for(d in a)f.call(a[d])==="[object Function]"&&(y=y||[],y.push(d));if(y){var t=h++;x[t]=a;d=function(){delete x[t]};e.then(d,d);c.params[b]=new g(t,y)}}});s(c);return e.promise}function k(a,b){a||a===0?s({id:a,result:null,
error:b}):console.log(b)}function q(a,b,c,o){o.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)})}});o[b]=c}});var h=typeof a===void 0?null:{id:a,result:null,error:null};try{var e=c.apply(b,o);if(h)e&&typeof e.then==="function"?(u[a]=e,e.then(function(b){delete u[a];h.result=b;s(h)},function(b){if(u[a])delete u[a],h.error=f(b),s(h)},function(){s({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(h.result=e,s(h))}catch(d){if(h)h.error=f(d),s(h)}}function n(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 o=r[a.serviceId];o||k(a.id,"service not found");o=o.implementation;c in o?q(a.id,o,o[c],h):k(a.id,"method not found")}else if("objectId"in a){var e=x[a.objectId];e||k(a.id,"object not found");!c in e?q(a.id,e,e[c],h):k(a.id,"method not found")}else if("requestId"in
a){var d=u[a.requestId];d&&c==="cancel"&&d.cancel&&d.cancel.apply(d,h)}else if("responseId"in a){var f=v[a.responseId];f&&c==="progress"&&f.progress&&f.progress.apply(f,h)}else throw Error("Bad method: "+a.method);}else{var t=v[String(a.id)];delete v[String(a.id)];a.error?t.reject(a.error):t.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}}var p=i,m=!1,b=null,a=0,h=0,t=0,u={},v={},x={},r={},s=j;this.updateHeaders=function(a){if(m)throw Error("Cannot update headers. Plugin Provider is connected");
p=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(m)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var o=null,h=[];for(o in b)typeof b[o]==="function"&&h.push(o);r[t++]={names:a,methods:h,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,c){if(!m){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",n,!1);var h={method:"plugin",params:[e()]};j(h);m=!0}a&&a()};this.disconnect=function(){m&&(removeEventListener("message",n),b=null,m=!1)}}});
define("orion/xhr",["orion/Deferred"],function(d){function g(d,g,e,c){var f=typeof e.response!=="undefined"?e.response:e.responseText,l;try{l=e.status}catch(k){l=0}d={args:g,response:f,responseText:typeof f==="string"?f:null,status:l,url:d,xhr:e};if(typeof c!=="undefined")d.error=c;return d}return function(i,j,e){var e=e||{},c=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,f=new d,l=e.headers||{},k=e.log||!1,q;typeof l["X-Requested-With"]==="undefined"&&(l["X-Requested-With"]="XMLHttpRequest");
if(typeof e.data!=="undefined"&&(i==="POST"||i==="PUT"))q=e.data;var n=!1,p=!1;f.promise.then(void 0,function(a){n=!0;!p&&a instanceof Error&&a.name==="Cancel"&&c.abort()});c.onabort=function(){p=!0;if(!n){var a=Error("Cancel");a.name="Cancel";f.reject(a)}};c.onload=function(){var a=g(j,e,c);200<=c.status&&c.status<400?f.resolve(a):(f.reject(a),k&&typeof console!=="undefined"&&console.log(Error(c.statusText)))};c.onerror=function(){var a=g(j,e,c);f.reject(a);k&&typeof console!=="undefined"&&console.log(Error(c.statusText))};
c.onprogress=function(a){a.xhr=c;f.progress(a)};try{c.open(i,j,!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(j,e,c,"Timeout exceeded"))});else{var m=setTimeout(function(){f.reject(g(j,e,c,"Timeout exceeded"))},e.timeout);f.promise.then(clearTimeout.bind(null,m),clearTimeout.bind(null,m))}Object.keys(l).forEach(function(a){c.setRequestHeader(a,
l[a])});c.send(q||null)}catch(b){f.reject(g(j,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 j(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=j(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 z;}}}function f(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function l(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function k(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function q(o,c){if(typeof o!=="string")throw new TypeError;var o=k(o),e=b.exec(o);
if(!e)return null;var d={};d.scheme=e[1]||"";if(d.scheme&&!h.test(d.scheme))return null;var f=e[2];if(f&&(f=a.exec(f),d.userinfo=f[1],d.host=f[2],d.port=f[3],d.port&&!t.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=/[1-9]\d*$/.exec(d.port)[0];if(d.host&&d.path)d.path=l(d.path);return d}function n(a,b){var c;if(b){b=b.href||b;c=q(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=q(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 p;if(typeof window.URL==="function"&&window.URL.length!==0&&(p=new window.URL("http://www.w3.org?q")).protocol==="http:"&&p.query)return}catch(m){}var b=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,a=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,h=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,t=/^\d*$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,r=/^([^\s]*)$/,s=/^\S*$/,w=/([^:]*):?(.*)/,z=typeof StopIteration!=="undefined"?
StopIteration:Error("Stop Iteration"),A={"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=j(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=j(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(j(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 j(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!==z)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=j(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=q(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,h.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=w.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){d(a);if(this._url){var b=
w.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=w.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){d(a);if(this._url){var b=[w.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=v.exec(a)))this._url.host=a[1],this._url.port=/[1-9]\d*$/.exec(a[2])[0]},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){d(a);if(this._url&&u.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===A[this.protocol]&&(a="");return a},set:function(a){d(a);if(this._url&&t.exec(a))this._url.port=/[1-9]\d*$/.exec(a)[0]},enumerable:!0},pathname:{get:function(){return this._url?
this._url.path:""},set:function(a){d(a);if(this._url&&x.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?l(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)),r.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)),s.exec(a)))this._url.fragment=
a},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(n,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(n,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),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(k){k=k.response?JSON.parse(k.response):null;c.progress(k);!k.type||k.type==="loadstart"||k.type==="progress"?setTimeout(function(){i(e,c,f,g)},2E3):(k.type==="error"||k.type==="abort"?c.reject(g?g(k):k.Result):c.resolve(f?f(k):k.Result.JsonData),k.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 j(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 l=new g;j(d,l);i(d,l,c,f);return l}}});
define("plugins/filePlugin/fileImpl",["orion/Deferred","orion/xhr","orion/URL-shim","orion/operation"],function(d,g,i,j){function e(b){b&&typeof b==="object"&&Object.keys(b).forEach(function(a){var c=b[a];a.indexOf("Location")!==-1?(m.href=c,b[a]=m.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 l(b){return b.replace(/([^\u0020-\u007e]|%)+/g,encodeURIComponent)}function k(){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;j.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 n(b,a){this.fileBase=b;this.makeAbsolute=(this.workspaceBase=a)&&a.indexOf("://")!==-1}function p(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 m=document.createElement("a");n.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:l(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:l(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:l(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:l(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 k("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 k("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)n.prototype.readBlob=function(b){return p("GET",b).then(function(a){return a.response})},n.prototype.writeBlob=function(b,a,c){var d={};if(c&&c.ETag)d["If-Match"]=c.ETag;return p("PUT",b,d,a)};return n});
define("domReady",[],function(){function d(){if(!f){f=!0;e&&clearInterval(e);var c=k;if(f&&c.length){k=[];var d;for(d=0;d<c.length;d+=1)c[d](l)}}}function g(c){f?c(l):k.push(c);return g}var i,j,e,c=typeof window!=="undefined"&&window.document,f=!c,l=c?document:null,k=[];if(c){if(document.addEventListener)document.addEventListener("DOMContentLoaded",d,!1),window.addEventListener("load",d,!1);else if(window.attachEvent){window.attachEvent("onload",d);j=document.createElement("div");try{i=window.frameElement===
null}catch(q){}j.doScroll&&i&&window.external&&(e=setInterval(function(){try{j.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 j(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=j(c.href);c.href="../workspace";var f=j(c.href);c.href="..";c=j(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()});