text: /*!
   * Weld - A Widget Framework v0.9.2
   */(function(a,b){var c={},d=function(b){return b===a?"global":{}.toString.call(b).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};(function(a,c){"use strict";var d=0;a.App=function(e){function p(){e.paths&&(j.base=e.paths.base||j.base,j.middlewares=e.paths.middlewares||j.middlewares,j.services=e.paths.services||j.services,j.widgets=e.paths.widgets||j.widgets),o=c.config({context:d++,baseUrl:j.base})}function q(a){return l[a]||null}function r(a,b,c){var d=[];for(var e=0,f=b.length;e<f;e++)d.push(j[a]+"/"+b[e]);o(d,function(){var a=[];a.push.apply(a,arguments),c(a)})}function s(a){return{options:a.options||{},handler:a.handler}}function t(a,b){u(a,function(c){b(c[a])})}function u(a,b){r("middlewares",a,function(c){var d={};for(var e=0,f=a.length;e<f;e++)d[a[e]]=s(c[e]);b(d)})}function v(a){return a}function w(a,b){x([a],function(c){b(c[a])})}function x(a,b){r("services",a,function(c){var d={};for(var e=0,f=a.length;e<f;e++)d[a[e]]=v(c[e]);b(d)})}function y(a){if(a===null)throw new Error("The widget was not defined properly");return{options:a.options||{},creator:a.creator}}function z(a,c){r("widgets",[a],function(d){var e=d[0];if(e===b)throw new m(a);c(y(e))})}function A(a,c){if(a!==b&&c!==b){var d=a.concat(c);for(var e=0;e<d.length;e++)for(var f=e+1;f<d.length;f++)d[e]===d[f]&&d.splice(f,1);return d}return a||c}e=e||{};var f=a.App,g=new a.Messenger,h=e.defaultServices||[],i=0,j={base:"",middlewares:"middlewares",services:"services",widgets:"widgets"},k=e.prefix||"weld-module-",l={},m=f.WidgetNotFoundError,n=f.RequiredCreatorMethodError,o;return g.create=function(a,b){var c=k+i++;return l[c]={type:a,instance:null,options:b},c},g.start=function(c){var d=q(c),e={},f,i,j,k;return d!==null&&d.instance===null?(z(d.type,function(l){var m=l.creator,o=l.options.middlewares,p=l.options.services;u(o||[],function(m){k=A(h,p);if(o)for(var q=0,r=o.length;q<r;q++)k=A(k,m[o[q]].options.services);x(k,function(h){e.app=g,e.options=d.options,e.services=h,j=new a.Sandbox(c,e),f=function(){d.instance=l.creator(j);if(d.instance.create===b)throw new n("create");d.instance.create()};if(o){var k=0,p=o.length;i=function(){k+1>p?f():m[o[k++]].handler.call(null,j,i)},i()}else f()})})}),c):null},g.stop=function(a){var c=q(a);if(c!==null&&c.instance!==null){if(c.instance.destroy===b)throw new n("destroy");return c.instance.destroy(),c.instance=null,a}return null},p(),g},a.App.WidgetNotFoundError=function(a){this.name="WidgetNotFoundError",this.message="Widget "+(a?""+a+" ":"")+"doesn't exist"},a.App.RequiredCreatorMethodError=function(){this.name="RequiredCreatorMethodError",this.message='Widgets creator functions are required to return both a "create" and "destroy" function.'},a.App.WidgetNotFoundError.prototype=new Error,a.App.RequiredCreatorMethodError.prototype=new Error})(c,requirejs),function(a){a.Messenger=function(){var a=this,c={},d,e,f,g,h,i;a.publish=function(a,d,e){var f,g;if(c[a]){thisMessage=d!==b?d:[],g=c[a];for(var h=0,i=g.length;h<i;h++)g[h].call(e||null,thisMessage)}},a.publishMany=function(b,c,d){for(var e=0,f=b.length;e<f;e++)a.publish(b[e],c,d)},a.subscribe=function(a,d){return c[a]===b&&(c[a]=[]),c[a].push(d),{channel:a,callback:d}},a.subscribeMany=function(b,c){var d=[];for(var e=0,f=b.length;e<f;e++)d.push(a.subscribe(b[e],c));return d},a.unsubscribe=function(a){var b=a.channel;if(b&&c[b]){var d=c[b];for(var e=0,f=d.length;e<f;e++)d[e]===a.callback&&d.splice(e,1)}},a.unsubscribeMany=function(b){for(var c=0,d=b.length;c<d;c++)a.unsubscribe(b[c])}},a.Messenger.Scoped=function(b,c){var d=a.Messenger,e=this,f=[],g,h,i,j;c||(c=new d),e.publish=function(a,d,e){c.publish(b+a,d,e)},e.subscribe=function(a,d){var e=c.subscribe(b+a,d);return f.push(e),e},e.unsubscribe=function(a){c.unsubscribe(a)},e.unsubscribeAll=function(){c.unsubscribeMany(f)}}}(c),function(a){a.Sandbox=function(b,c){c=c||{};var d=new a.Messenger.Scoped("/"+b,c.app||null),e=c.options||{},f=c.services||{};return d.app=c.app,d.getId=function(){return b},d.getOption=function(a){return e[a]},d.getService=function(a){return f[a]},d}}(c),function(a){a.SimpleCache=function(a){var c={},d=function(a,e){var f=null;if(e!==b)f=c[a]=e;else{if(Object.prototype.toString.call(a)==="[object String]")return c[a];if(Object.prototype.toString.call(a)==="[object Array]"){f={};for(var g=0,h=a.length;g<h;g++)f[a[g]]=d(a[g])}}return f};for(var e in a)a.hasOwnProperty(e)&&d(e,a[e]);return d}}(c),a.Weld=c})(this);