dispatch.to("Foundry/2.1 Core Plugins").at(function($,manifest){var Component=$.Component=function(name,options,callback){return arguments.length<1?Component.registry:arguments.length<2?Component.registry[name]:Component.register(name,options,callback)};Component.registry={},Component.proxy=function(component,property,value){component[property]=$.isFunction(value)?$.proxy(value,component):value},Component.register=function(name,options,callback){var queue=window[name]?window[name].queue||[]:[],self=Component.registry[name]=window[name]=function(command){return $.isFunction(command)?command($):component
};$.each(Component.prototype,function(property,value){Component.proxy(self,property,value)}),self.$=$,self.options=options,self.className=name,self.identifier=name.toLowerCase(),self.componentName="com_"+self.identifier,self.version=options.version,self.safeVersion=self.version.replace(/\./g,""),self.environment=options.environment||$.environment,self.debug="development"==self.environment,self.language=options.language||$.locale.lang||"en",self.baseUrl=options.baseUrl||$.indexUrl+"?option="+self.componentName,self.scriptPath=options.scriptPath||$.rootPath+"media/"+self.componentName+(self.debug?"/scripts_/":"/scripts/"),self.templatePath=options.templatePath||options.scriptPath,self.languagePath=options.languagePath||self.baseUrl+"&tmpl=component&no_html=1&controller=lang&task=getLanguage",self.viewPath=options.viewPath||self.baseUrl+"&tmpl=component&no_html=1&controller=themes&task=getAjaxTemplate",self.prefix=self.identifier+"/",self.optimizeResources=options.optimizeResources||"optimized"===self.environment?!0:!1,self.resourcePath=options.resourcePath||self.baseUrl+"&tmpl=component&no_html=1&controller=foundry&task=getResource",self.resourceCollectionInterval=1200,self.scriptVersioning=options.scriptVersioning||!1,self.initRecovery=options.initRecovery||!1,self.isReady=!1,self.dependencies=$.Deferred(),self.console=function(method){if(self.debug){var console=window.console;
if(console){var method=console[method];if(method){var args=$.makeArray(arguments).slice(1);method.apply?method.apply(console,args):method(args.join(" "))}}}};var resolveComponent=function(){self.dependencies.resolve(),self.ready(function(){self.isReady=!0,self.run(callback)})};if($.isFunction(options.dependencies)){var require=self.require({loadingComponentDependencies:!0});options.dependencies.call(self,require),require.done(resolveComponent)}else resolveComponent();$.each(queue,function(i,func){if($.isPlainObject(func)&&self[func.method].apply(self,func.args),$.isArray(func)){var chain=func,context=self;
$.each(chain,function(i,func){context=context[func.method].apply(context,func.args)})}}),self.initRecovery&&$(document).ready(function(){if("pending"===self.module("init").state()){var initializer=$("script[data-id='"+self.identifier+"-init']")[0];if(initializer)try{eval(initializer.innerHTML)}catch(e){throw"Unable to recover component initializer for "+self.className+". "+e}}})},Component.extend=function(property,value){Component.prototype[property]=value,$.each(Component.registry,function(name,component){Component.proxy(component,property,value)
})},$.extend(Component.prototype,{run:function(command){return $.isFunction(command)?command($):component},ready:function(callback){if($.isFunction(callback)){var self=this;$.module("component/mvc").done(function(){self.dependencies.done(function(){$(document).ready(function(){self.run(callback)})})})}},template:function(name){var self=this;return void 0==name?$.grep($.template(),function(template){return 0==template.indexOf(self.prefix)}):(arguments[0]=self.prefix+name,$.template.apply(null,arguments))},require:function(options){var self=this,options=options||{},require=$.require($.extend({path:self.scriptPath},options)),_require={};
return $.each(["library","script","language","template","done"],function(i,method){_require[method]=require[method]}),require.resource=function(resource){if($.isPlainObject(resource)&&resource.type&&resource.name&&$.isDeferred(resource.loader)){var resourceCollector=self.resourceCollector;resourceCollector||(resourceCollector=self.resourceCollector=$.Deferred(),$.extend(resourceCollector,{name:$.uid("ResourceCollector"),manifest:[],loaderList:[],loaders:[],load:function(){return delete self.resourceCollector,resourceCollector.manifest.length<0?(resourceCollector.resolve(),void 0):($.Ajax({type:"POST",url:self.resourcePath,dataType:"json",data:{resource:resourceCollector.manifest}}).done(function(manifest){return $.isArray(manifest)?($.each(manifest,function(i,resource){var content=resource.content;
resourceCollector.loaders[resource.id][void 0!==content?"resolve":"reject"](content)}),void 0):(resourceCollector.reject("Server did not return a valid resource manifest."),void 0)}),$.when.apply(null,resourceCollector.loaderList).done(resourceCollector.resolve).fail(resourceCollector.reject),void 0)}}),setTimeout(resourceCollector.load,self.resourceCollectionInterval));var id=resource.id=$.uid("Resource");return resourceCollector.loaders[id]=resource.loader,resourceCollector.loaderList.push(resource.loader),delete resource.loader,resourceCollector.manifest.push(resource),require
}},require.view=function(){var batch=this,request=batch.expand(arguments,{path:self.viewPath}),loaders={},options=request.options,names=$.map(request.names,function(name){var absoluteName=self.prefix+name,loader=$.template.loader(absoluteName);return/resolved|failed/.test(loader.state())&&options.reload&&(loader=loader.reset()),batch.addTask(loader),"pending"===loader.state()?self.optimizeResources?(require.resource({type:"view",name:name,loader:loader}),void 0):(loaders[name]=loader,name):void 0});return names.length>0&&$.Ajax({url:options.path,dataType:"json",data:{names:names}}).done(function(templates){$.isArray(templates)&&$.each(templates,function(i,template){var content=template.content;
loaders[template.name][void 0!==content?"resolve":"reject"](content)})}),require},require.language=function(){var batch=this,request=batch.expand(arguments,{path:self.languagePath});return self.optimizeResources?$.each(request.names,function(i,name){var loader=$.Deferred();loader.name=name,loader.done(function(val){$.language.add(name,val)}),batch.addTask(loader),require.resource({type:"language",name:name,loader:loader})}):_require.language.apply(require,[request.options].concat(request.names)),require},require.library=function(){var o=require.script;
return require.script=_require.script,_require.library.apply(require,arguments),require.script=o,require},require.script=function(){var batch=this,request=batch.expand(arguments);return names=$.map(request.names,function(name){if($.isArray(name)||$.isUrl(name)||/^(\/|\.)/.test(name))return name;var moduleName=self.prefix+name,moduleUrl=$.uri(batch.options.path).toPath("./"+name+"."+(request.options.extension||"js")+(self.scriptVersioning?"?version="+self.safeVersion:"")).toString();return[[moduleName,moduleUrl,!0]]
}),_require.script.apply(require,names)},require.template=function(){var batch=this,request=batch.expand(arguments,{path:self.templatePath});return _require.template.apply(require,[request.options].concat($.map(request.names,function(name){return[[self.prefix+name,name]]})))},require.done=function(callback){return _require.done.call(require,function(){$.module("component/mvc").done(options.loadingComponentDependencies?function(){callback.call(self,$)}:function(){self.ready(callback)})})},require},module:function(name,factory){var self=this;
if(!$.isArray(name)){var fullname=self.prefix+name;return factory?$.module.apply(null,[fullname,function(){var module=this;return"init"===name?(factory.call(module,$),void 0):($.module("component/mvc").done(function(){factory.call(module,$)}),void 0)}]):$.module(fullname)}}}),$.module("component/mvc",function(){var module=this;$.require().library("server","mvc/controller","mvc/model","mvc/model.list","mvc/view","mvc/view.ejs","mvc/lang.json").done(function(){$.Component.extend("ajax",function(namespace,params,callback){var self=this,options={url:self.baseUrl,data:$.extend(params,{option:self.componentName,namespace:namespace})};
options=$.extend(!0,options,self.options.ajax);var token=$("span#"+self.identifier+"-token input").attr("name");if(token&&(options.data[token]=1),options.data.hasOwnProperty("args")&&(options.data.args=$.toJSON(options.data.args)),$.isPlainObject(callback)){if(callback.type){switch(callback.type){case"jsonp":callback.dataType="jsonp",callback.crossDomain=!0,options.data.transport="jsonp";break;case"iframe":callback.iframe=!0,callback.processData=!1,callback.files=options.data.files,delete options.data.files,options.data.transport="iframe"
}delete callback.type}$.extend(options,callback)}return $.isFunction(callback)&&(options.success=callback),$.server(options)}),$.Component.extend("Controller",function(){var staticProps,protoFactory,self=this,args=$.makeArray(arguments),name=self.className+".Controller."+args[0];return 1==args.length?$.String.getObject(args[0]):(args.length>2?(staticProps=args[1],protoFactory=args[2]):(staticProps={},protoFactory=args[1]),$.extend(staticProps,{component:self}),$.Controller.apply(this,[name,staticProps,protoFactory]))
}),$.Component.extend("Model",function(){var staticProps,protoFactory,self=this,args=$.makeArray(arguments),name=self.className+".Model."+args[0];return 1==args.length?$.String.getObject(args[0]):(2==args.length&&(staticProps={},protoFactory=args[1]),args.length>2&&(staticProps=args[1],protoFactory=args[2]),$.extend(staticProps,{component:self}),$.Model.apply(this,[name,staticProps,protoFactory]))}),$.Component.extend("Model.List",function(){var staticProps,protoFactory,self=this,args=$.makeArray(arguments),name=self.className+".Model.List."+args[0];
return 1==args.length?$.String.getObject(args[0]):(2==args.length&&(staticProps={},protoFactory=args[1]),args.length>2&&(staticProps=args[1],protoFactory=args[2]),$.extend(staticProps,{component:self}),$.Model.List.apply(this,[name,staticProps,protoFactory]))}),$.Component.extend("View",function(){var self=this;return arguments.length<1?self.template():(arguments[0]=self.prefix+arguments[0],$.View.apply(this,arguments))}),module.resolve()})}),dispatch("Foundry/2.1").toAll()});