//>>built
define("dojox/mobile/ViewController","dojo/_base/kernel dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/_base/lang dojo/_base/window dojo/_base/Deferred dojo/dom dojo/dom-class dojo/dom-construct dojo/on dojo/ready dijit/registry ./ProgressIndicator ./TransitionEvent ./viewRegistry".split(" "),function(w,x,p,q,k,h,r,t,y,z,u,v,f,A,m,l){var e=q("dojox.mobile.ViewController",null,{dataHandlerClass:"dojox/mobile/dh/DataHandler",dataSourceClass:"dojox/mobile/dh/UrlDataSource",fileTypeMapClass:"dojox/mobile/dh/SuffixFileTypeMap",
constructor:function(){this.viewMap={};v(k.hitch(this,function(){u(h.body(),"startTransition",k.hitch(this,"onStartTransition"))}))},findTransitionViews:function(b){if(!b)return[];b.match(/^#?([^&?]+)(.*)/);b=RegExp.$2;var a=f.byId(RegExp.$1);if(!a)return[];for(var d=a.getParent();d;d=d.getParent())if(d.isVisible&&!d.isVisible()){var c=a.getShowingView();c&&c.id!==a.id&&a.show();a=d}return[a.getShowingView(),a,b]},openExternalView:function(b,a){var d=new r,c=this.viewMap[b.url];if(c)return b.moveTo=
c,b.noTransition?f.byId(c).hide():(new m(h.body(),b)).dispatch(),d.resolve(!0),d;for(var n=null,c=a.childNodes.length-1;0<=c;c--){var g=a.childNodes[c];if(1===g.nodeType&&"bottom"===(g.getAttribute("fixed")||g.getAttribute("data-mobile-fixed")||f.byNode(g)&&f.byNode(g).fixed)){n=g;break}}require([b.dataHandlerClass||this.dataHandlerClass,b.dataSourceClass||this.dataSourceClass,b.fileTypeMapClass||this.fileTypeMapClass],k.hitch(this,function(c,g,e){c=new c(new g(b.data||b.url),a,n);e=b.contentType||
e.getContentType(b.url)||"html";c.processData(e,k.hitch(this,function(a){a?(this.viewMap[b.url]=b.moveTo=a,b.noTransition?f.byId(a).hide():(new m(h.body(),b)).dispatch(),d.resolve(!0)):d.reject("Failed to load "+b.url)}))}));return d},onStartTransition:function(b){b.preventDefault();if(b.detail){var a=b.detail;if(a.moveTo||a.href||a.url||a.scene)if(a.url&&!a.moveTo){var d=a.urlTarget,c=f.byId(d),d=c&&c.containerNode||t.byId(d);d||(d=(c=l.getEnclosingView(b.target))&&c.domNode.parentNode||h.body());
(b=f.getEnclosingWidget(b.target))&&b.callback&&(a.context=b,a.method=b.callback);this.openExternalView(a,d)}else if(a.href)if(a.hrefTarget&&"_self"!=a.hrefTarget)h.global.open(a.href,a.hrefTarget);else{for(c=l.getEnclosingView(b.target);c;c=l.getParentView(c))d=c;d&&d.performTransition(null,a.transitionDir,a.transition,b.target,function(){location.href=a.href})}else if(a.scene)p.publish("/dojox/mobile/app/pushScene",[a.scene]);else{var e=this.findTransitionViews(a.moveTo),d=e[0],c=e[1],e=e[2];location.hash||
a.hashchange||(l.initialView=d);a.moveTo&&c&&(a.moveTo=("#"===a.moveTo.charAt(0)?"#"+c.id:c.id)+e);!d||a.moveTo&&d===f.byId(a.moveTo.replace(/^#?([^&?]+).*/,"$1"))||((b=f.getEnclosingWidget(b.target))&&b.callback&&(a.context=b,a.method=b.callback),d.performTransition(a))}}}});e._instance=new e;e.getInstance=function(){return e._instance};return e});