//>>built
define("dojox/app/main","require dojo/_base/kernel dojo/_base/lang dojo/_base/declare dojo/_base/config dojo/_base/window dojo/Evented dojo/Deferred dojo/when dojo/has dojo/on dojo/ready dojo/dom-construct dojo/dom-attr ./utils/model ./utils/nls ./module/lifecycle ./utils/hash ./utils/constraints ./utils/config".split(" "),function(l,x,g,m,y,z,A,q,n,t,B,C,D,K,E,F,L,u,G,H){function v(a,c){a=H.configProcessHas(a);a.loaderConfig||(a.loaderConfig={});a.loaderConfig.paths||(a.loaderConfig.paths={});if(!a.loaderConfig.paths.app){var b=
window.location.pathname;"/"!=b.charAt(b.length)&&(b=b.split("/"),b.pop(),b=b.join("/"));a.loaderConfig.paths.app=b}l(a.loaderConfig);a.modules||(a.modules=[]);a.modules.push("./module/lifecycle");var d=a.modules.concat(a.dependencies?a.dependencies:[]);a.template&&(b=a.template,0==b.indexOf("./")&&(b="app/"+b),d.push("dojo/text!"+b));l(d,function(){for(var f=[I],h=0;h<a.modules.length;h++)f.push(arguments[h]);if(a.template)var k={templateString:arguments[arguments.length-1]};App=m(f,k);C(function(){var e=
new App(a,c||z.body());t("app-log-api")?e.log=function(){try{for(var p=0;p<arguments.length-1;p++);}catch(w){}}:e.log=function(){};e.transitionToView=function(p,w,J){B.emit(p,"startTransition",{bubbles:!0,cancelable:!0,detail:w,triggerEvent:J||null})};e.setStatus(e.lifecycle.STARTING);var r=e.id;window[r]&&m.safeMixin(e,window[r]);window[r]=e;e.start()})})}t.add("app-log-api",(y.app||{}).debugApp);var I=m(A,{constructor:function(a,c){m.safeMixin(this,a);this.params=a;this.id=a.id;this.defaultView=
a.defaultView;this.controllers=[];this.children={};this.loadedModels={};this.loadedStores={};this.setDomNode(D.create("div",{id:this.id+"_Root",style:"width:100%; height:100%; overflow-y:hidden; overflow-x:hidden;"}));c.appendChild(this.domNode)},createDataStore:function(a){if(a.stores)for(var c in a.stores)if("_"!==c.charAt(0)){var b=a.stores[c].type?a.stores[c].type:"dojo/store/Memory",d={};a.stores[c].params&&g.mixin(d,a.stores[c].params);try{var f=l(b)}catch(k){throw Error(b+" must be listed in the dependencies");
}d.data&&g.isString(d.data)&&(d.data=g.getObject(d.data));if(a.stores[c].observable){try{var h=l("dojo/store/Observable")}catch(k){throw Error("dojo/store/Observable must be listed in the dependencies");}a.stores[c].store=h(new f(d))}else a.stores[c].store=new f(d);this.loadedStores[c]=a.stores[c].store}},createControllers:function(a){if(a){for(var c=[],b=0;b<a.length;b++)c.push(a[b]);var d=new q;try{var f=l.on?l.on("error",function(k){d.isResolved()||d.isRejected()||(d.reject("load controllers error."),
f&&f.remove())}):null;l(c,function(){d.resolve.call(d,arguments);f&&f.remove()})}catch(k){d.reject(k),f&&f.remove()}var h=new q;n(d,g.hitch(this,function(k){for(var e=0;e<k.length;e++)this.controllers.push((new k[e](this)).bind());h.resolve(this)}),function(){h.reject("load controllers error.")});return h}},trigger:function(a,c){x.deprecated("dojox.app.Application.trigger","Use dojox.app.Application.emit instead","2.0");this.emit(a,c)},start:function(){this.createDataStore(this.params);var a=new q;
try{var c=E(this.params.models,this,this)}catch(b){return a.reject(b),a.promise}n(c,g.hitch(this,function(b){this.loadedModels=g.isArray(b)?b[0]:b;this.setupControllers();n(F(this.params),g.hitch(this,function(d){d&&g.mixin(this.nls={},d);this.startup()}))}),function(){a.reject("load model error.")})},setDomNode:function(a){var c=this.domNode;this.domNode=a;this.emit("app-domNode",{oldNode:c,newNode:a})},setupControllers:function(){var a=window.location.hash;this._startView=u.getTarget(a,this.defaultView);
this._startParams=u.getParams(a)},startup:function(){this.selectedChildren={};var a=this.createControllers(this.params.controllers);this.hasOwnProperty("constraint")?G.register(this.params.constraints):this.constraint="center";var c=function(){this.emit("app-load",{viewId:this.defaultView,initLoad:!0,params:this._startParams,callback:g.hitch(this,function(){this.emit("app-transition",{viewId:this.defaultView,forceTransitionNone:!0,opts:{params:this._startParams}});this.defaultView!==this._startView&&
this.emit("app-transition",{viewId:this._startView,opts:{params:this._startParams}});this.setStatus(this.lifecycle.STARTED)})})};n(a,g.hitch(this,function(){this.template?this.emit("app-init",{app:this,name:this.name,type:this.type,parent:this,templateString:this.templateString,controller:this.controller,callback:g.hitch(this,function(b){this.setDomNode(b.domNode);c.call(this)})}):c.call(this)}))}});return function(a,c){if(!a)throw Error("App Config Missing");a.validate?l(["dojox/json/schema","dojox/json/ref",
"dojo/text!dojox/application/schema/application.json"],function(b,d){b=dojox.json.ref.resolveJson(b);b.validate(a,d)&&v(a,c)}):v(a,c)}});