//>>built
define("dojox/mobile/SwapView","dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/dom dojo/dom-class dijit/registry ./View ./_ScrollableMixin ./sniff ./_css3 dojo/has!dojo-bidi?dojox/mobile/bidi/SwapView".split(" "),function(p,q,r,t,e,l,k,u,m,v,w){k=r(m("dojo-bidi")?"dojox.mobile.NonBidiSwapView":"dojox.mobile.SwapView",[k,u],{scrollDir:"f",weight:1.2,_endOfTransitionTimeoutHandle:null,buildRendering:function(){this.inherited(arguments);e.add(this.domNode,"mblSwapView");this.setSelectable(this.domNode,
!1);this.containerNode=this.domNode;this.subscribe("/dojox/mobile/nextPage","handleNextPage");this.subscribe("/dojox/mobile/prevPage","handlePrevPage");this.noResize=!0},startup:function(){this._started||this.inherited(arguments)},resize:function(){this.inherited(arguments);p.forEach(this.getChildren(),function(a){a.resize&&a.resize()})},onTouchStart:function(a){if(this._siblingViewsInMotion())this.propagatable?a.preventDefault():event.stop(a);else{var b=this.domNode.offsetTop,c=this.nextView(this.domNode);
c&&(c.stopAnimation(),e.add(c.domNode,"mblIn"),c.containerNode.style.paddingTop=b+"px");if(c=this.previousView(this.domNode))c.stopAnimation(),e.add(c.domNode,"mblIn"),c.containerNode.style.paddingTop=b+"px";this._setSiblingViewsInMotion(!0);this.inherited(arguments)}},onTouchEnd:function(a){a&&(this._moved?this._endOfTransitionTimeoutHandle=this.defer(function(){this._setSiblingViewsInMotion(!1)},1E3):this._setSiblingViewsInMotion(!1));this.inherited(arguments)},handleNextPage:function(a){a=a.refId&&
t.byId(a.refId)||a.domNode;this.domNode.parentNode===a.parentNode&&this.getShowingView()===this&&this.goTo(1)},handlePrevPage:function(a){a=a.refId&&t.byId(a.refId)||a.domNode;this.domNode.parentNode===a.parentNode&&this.getShowingView()===this&&this.goTo(-1)},goTo:function(a,b){var c=b?l.byId(b):1==a?this.nextView(this.domNode):this.previousView(this.domNode);c&&c!==this&&(this.stopAnimation(),c.stopAnimation(),this.domNode._isShowing=!1,c.domNode._isShowing=!0,this.performTransition(c.id,a,"slide",
null,function(){q.publish("/dojox/mobile/viewChanged",[c])}))},isSwapView:function(a){return a&&1===a.nodeType&&e.contains(a,"mblSwapView")},nextView:function(a){for(a=a.nextSibling;a;a=a.nextSibling)if(this.isSwapView(a))return l.byNode(a);return null},previousView:function(a){for(a=a.previousSibling;a;a=a.previousSibling)if(this.isSwapView(a))return l.byNode(a);return null},scrollTo:function(a){if(!this._beingFlipped){if(a.x)if(0>a.x){var b=this.nextView(this.domNode);var c=a.x+this.domNode.offsetWidth}else b=
this.previousView(this.domNode),c=a.x-this.domNode.offsetWidth;b&&("none"===b.domNode.style.display&&(b.domNode.style.display="",b.resize()),b._beingFlipped=!0,b.scrollTo({x:c}),b._beingFlipped=!1)}this.inherited(arguments)},findDisp:function(a){if(!e.contains(a,"mblSwapView"))return this.inherited(arguments);if(!a.parentNode)return null;for(var b=a.parentNode.childNodes,c=0;c<b.length;c++){var f=b[c];if(1===f.nodeType&&e.contains(f,"mblSwapView")&&!e.contains(f,"mblIn")&&"none"!==f.style.display)return f}return a},
slideTo:function(a,b,c,f){if(!this._beingFlipped){var g=this.domNode.offsetWidth,n=f||this.getPos();if(0>n.x){var d=this.nextView(this.domNode);if(n.x<-g/4){if(d){a.x=-g;var h=0}}else d&&(h=g)}else d=this.previousView(this.domNode),n.x>g/4?d&&(a.x=g,h=0):d&&(h=-g);d&&(d._beingFlipped=!0,d.slideTo({x:h},b,c),d._beingFlipped=!1,d.domNode._isShowing=d&&0===h);this.domNode._isShowing=!(d&&0===h)}this.inherited(arguments)},onAnimationEnd:function(a){a&&a.target&&e.contains(a.target,"mblScrollableScrollTo2")||
this.inherited(arguments)},onFlickAnimationEnd:function(a){this._endOfTransitionTimeoutHandle&&(this._endOfTransitionTimeoutHandle=this._endOfTransitionTimeoutHandle.remove());a&&a.target&&!e.contains(a.target,"mblScrollableScrollTo2")||(this.inherited(arguments),this.domNode._isShowing?(p.forEach(this.domNode.parentNode.childNodes,function(b){this.isSwapView(b)&&(e.remove(b,"mblIn"),b._isShowing||(b.style.display="none",b.style[v.name("transform")]="",b.style.left="0px",b.style.paddingTop=""))},
this),q.publish("/dojox/mobile/viewChanged",[this]),this.containerNode.style.paddingTop=""):m("css3-animations")||(this.containerNode.style.left="0px"),this._setSiblingViewsInMotion(!1))},_setSiblingViewsInMotion:function(a){var b=this.domNode.parentNode;b&&b.setAttribute("data-dojox-mobile-swapview-inmotion",a?"true":!1)},_siblingViewsInMotion:function(){var a=this.domNode.parentNode;return a?"true"==a.getAttribute("data-dojox-mobile-swapview-inmotion"):!1}});return m("dojo-bidi")?r("dojox.mobile.SwapView",
[k,w]):k});