YUI.add("history-hash",function(n,e){var s,r,h,i=n.HistoryBase,l=n.Lang,c=n.Array,o=n.Object,a=YUI.namespace("Env.HistoryHash"),u="hash",f=n.config.win,t=n.config.useHistoryHTML5;function H(){H.superclass.constructor.apply(this,arguments)}n.extend(H,i,{_init:function(e){var a=H.parseHash();this._initialState=(e=e||{}).initialState?n.merge(e.initialState,a):a,n.after("hashchange",n.bind(this._afterHashChange,this),f),H.superclass._init.apply(this,arguments)},_change:function(e,t,a){return o.each(t,function(e,a){l.isValue(e)&&(t[a]=e.toString())}),H.superclass._change.call(this,e,t,a)},_storeState:function(e,a){var t=H.decode,n=H.createHash(a);H.superclass._storeState.apply(this,arguments),e!==u&&t(H.getHash())!==t(n)&&H[e===i.SRC_REPLACE?"replaceHash":"setHash"](n)},_afterHashChange:function(e){this._resolveChanges(u,H.parseHash(e.newHash),{})}},{NAME:"historyHash",SRC_HASH:u,hashPrefix:"",_REGEX_HASH:/([^\?#&=]+)=?([^&=]*)/g,createHash:function(e){var t=H.encode,n=[];return o.each(e,function(e,a){l.isValue(e)&&n.push(t(a)+"="+t(e))}),n.join("&")},decode:function(e){return decodeURIComponent(e.replace(/\+/g," "))},encode:function(e){return encodeURIComponent(e).replace(/%20/g,"+")},getHash:n.UA.gecko?function(){var e=n.getLocation(),e=/#(.*)$/.exec(e.href),e=e&&e[1]||"",a=H.hashPrefix;return a&&0===e.indexOf(a)?e.replace(a,""):e}:function(){var e=n.getLocation().hash.substring(1),a=H.hashPrefix;return a&&0===e.indexOf(a)?e.replace(a,""):e},getUrl:function(){return location.href},parseHash:function(e){var a,t,n,s,r,h,i=H.decode,c={},o=H.hashPrefix;for(e=l.isValue(e)?e:H.getHash(),a=0,t=(s=(e=o&&(0===(h=e.indexOf(o))||1===h&&"#"===e.charAt(0))?e.replace(o,""):e).match(H._REGEX_HASH)||[]).length;a<t;++a)1<(r=(n=s[a]).split("=")).length?c[i(r[0])]=i(r[1]):c[i(n)]="";return c},replaceHash:function(e){var a=n.getLocation(),t=a.href.replace(/#.*$/,"");"#"===e.charAt(0)&&(e=e.substring(1)),a.replace(t+"#"+(H.hashPrefix||"")+e)},setHash:function(e){var a=n.getLocation();"#"===e.charAt(0)&&(e=e.substring(1)),a.hash=(H.hashPrefix||"")+e}}),s=(s=a._notifiers)||(a._notifiers=[]),n.Event.define("hashchange",{on:function(e,a,t){(e.compareTo(f)||e.compareTo(n.config.doc.body))&&s.push(t)},detach:function(e,a,t){t=c.indexOf(s,t);-1!==t&&s.splice(t,1)}}),r=H.getHash(),h=H.getUrl(),i.nativeHashChange?a._hashHandle||(a._hashHandle=n.Event.attach("hashchange",function(a){var t=H.getHash(),n=H.getUrl();c.each(s.concat(),function(e){e.fire({_event:a,oldHash:r,oldUrl:h,newHash:t,newUrl:n})}),r=t,h=n},f)):a._hashPoll||(a._hashPoll=n.later(50,null,function(){var a,e,t=H.getHash();r!==t&&(e=H.getUrl(),a={oldHash:r,oldUrl:h,newHash:t,newUrl:e},r=t,h=e,c.each(s.concat(),function(e){e.fire(a)}))},null,!0)),n.HistoryHash=H,!1!==t&&(n.History||!0===t||i.html5&&n.HistoryHTML5)||(n.History=H)},"patched-v3.18.7",{requires:["event-synthetic","history-base","yui-later"]});