(function(){var e=function(e){var t=this;e.require().script("mvc/lang.observe","mvc/event.hashchange","mvc/lang.string.deparam").done(function(){var n=function(){var t=/\:([\w\.]+)/g,n=/^(?:&[^=]+=[^&]*)+/,r=function(e){var t=[],n,r;return l(e,function(e,n){e==="className"&&(e="class"),n&&t.push(i(e),'="',i(n),'" ')}),t.join("")},i=function(e){return e.replace(/"/g,"&#34;").replace(/'/g,"&#39;")},s=function(e,t){var n=0;for(var r=0;r<e.names.length;r++){if(!t.hasOwnProperty(e.names[r]))return-1;n++}return n},o=!0,u=window.location,a=encodeURIComponent,f=decodeURIComponent,l=e.each,c=e.extend;e.route=function(n,r){var i=[],s=n.replace(t,function(e,t){return i.push(t),"([^\\/\\&]*)"});return e.route.routes[n]={test:RegExp("^"+s+"($|&)"),route:n,names:i,defaults:r||{},length:n.split("/").length},e.route},c(e.route,{param:function(n){var r,i=0,o,u=n.route;delete n.route,(!u||!(r=e.route.routes[u]))&&l(e.route.routes,function(e,t){o=s(t,n),o>i&&(r=t,i=o)});if(r){var f=c({},n),h=r.route.replace(t,function(e,t){return delete f[t],n[t]===r.defaults[t]?"":a(n[t])}),p;return l(r.defaults,function(e,t){f[e]===t&&delete f[e]}),p=e.param(f),h+(p?"&"+p:"")}return e.isEmptyObject(n)?"":"&"+e.param(n)},deparam:function(t){var r={length:-1};l(e.route.routes,function(e,n){n.test.test(t)&&n.length>r.length&&(r=n)});if(r.length>-1){var i=t.match(r.test),s=i.shift(),o=t.substr(s.length-(i[i.length-1]==="&"?1:0)),u=o&&n.test(o)?e.String.deparam(o.slice(1)):{};return u=c(!0,{},r.defaults,u),l(i,function(e,t){t&&t!=="&"&&(u[r.names[e]]=f(t))}),u.route=r.route,u}return t.charAt(0)!=="&"&&(t="&"+t),n.test(t)?e.String.deparam(t.slice(1)):{}},data:new e.Observe({}),routes:{},ready:function(t){return t===!1&&(o=!1),(t===!0||o===!0)&&d(),e.route},url:function(t,n){return n?"#!"+e.route.param(c({},p,t)):"#!"+e.route.param(t)},link:function(t,n,i,s){return"<a "+r(c({href:e.route.url(n,s)},i))+">"+t+"</a>"},current:function(t){return u.hash=="#!"+e.route.param(t)}}),e(function(){e.route.ready()}),l(["bind","unbind","delegate","undelegate","attr","attrs","serialize","removeAttr"],function(t,n){e.route[n]=function(){return e.route.data[n].apply(e.route.data,arguments)}});var h=function(e){var t;return function(){var n=arguments,r=this;clearTimeout(t),t=setTimeout(function(){e.apply(r,n)},1)}},p,d=function(){var t=u.hash.substr(1,1)==="!"?u.hash.slice(2):u.hash.slice(1);p=e.route.deparam(t),e.route.attrs(p,!0)};e(window).bind("hashchange",d),e.route.bind("change",h(function(){u.hash="#!"+e.route.param(e.route.serialize())}))};n(),t.resolveWith(n)})};dispatch("mvc/dom.route").containing(e).to("Foundry/2.1 Modules")})();