//>>built define("dojo/_base/lang dojo/_base/declare dojo/topic dojo/on ../Controller ../utils/hash dojo/hash".split(" "),function(e,g,f,k,h,d){return g("dojox.app.controllers.HistoryHash",h,{constructor:function(a){this.events={"app-domNode":this.onDomNodeChange};if(this.app.domNode)this.onDomNodeChange({oldNode:null,newNode:this.app.domNode});f.subscribe("/dojo/hashchange",e.hitch(this,function(a){this._onHashChange(a)}));this._historyStack=[];this._historyDiff=this._historyLen=0;this._previous=this._next= this._current=null;this._newHistoryLen=this._oldHistoryLen=this._index=0;this._startTransitionEvent=this._addToHistoryStack=!1;(a=window.location.hash)&&1this._index||this._index>window.history.length-1)throw Error("Application history out of management.");this._newHistoryLen=window.history.length;this._oldHistoryLen>this._newHistoryLen&&(this._historyStack.splice(this._newHistoryLen-this._historyDiff-1, this._historyStack.length-1),this._historyLen=this._historyStack.length,this._oldHistoryLen=0);if(this._addToHistoryStack&&this._oldHistoryLen===this._newHistoryLen)this._historyStack.splice(this._newHistoryLen-this._historyDiff-1,this._historyStack.length-1),this._addHistory(a);else{if(this._historyLena||a>window.history.length-1)throw Error("Application history.go steps out of management, index: "+a+" length: "+window.history.length);this._index=a;this._current=this._historyStack[a].hash;this._previous=this._historyStack[a-1]?this._historyStack[a-1].hash: null;this._next=this._historyStack[a+1]?this._historyStack[a+1].hash:null;var c=d.getTarget(this._current,this.app.defaultView);f.publish("/app/history/go",{viewId:c,step:b,detail:this._historyStack[a].detail});this.app.emit("app-transition",{viewId:c,opts:e.mixin({reverse:0>=b},this._historyStack[a].detail,{params:d.getParams(this._current)})})}})});