/*! * ractive-route 0.3.11 * https://github.com/MartinKolarik/ractive-route/ * * Copyright (c) 2014 Martin Kolárik * martin@kolarik.sk * https://kolarik.sk * * Licensed under the MIT license * http://www.opensource.org/licenses/MIT */ !function(a){"undefined"!=typeof module&&module.exports?module.exports=a(require("ractive")):"function"==typeof define&&define.amd?define(["ractive"],a):a(window.Ractive)}(function(a){function b(a,b,e,g){this.pattern=a,this.map=c(a),this.regExp=d(a),this.strictRegExp=f(a),this.isComponent=!!b.extend,this.Handler=b,this.observe=i({qs:[],hash:[],state:[]},e),this.allObserved=this.observe.qs.concat(this.observe.hash,this.observe.state),this.router=g||{},this.view=null}function c(a){return(a.match(/\/:\w+/g)||[]).map(function(a){return a.substr(2)})}function d(a){return new RegExp(e(a).replace(/^\^(\\\/)?/,"^\\/?").replace(/(\\\/)?\$$/,"\\/?$"),"i")}function e(a){return("^"+a+"$").replace(/\/:\w+(\([^)]+\))?/g,"(?:/([^/]+)$1)").replace(/\(\?:\/\(\[\^\/]\+\)\(/g,"(?:/(").replace(/\//g,"\\/")}function f(a){return new RegExp(e(a))}function g(a){this.globals=a.globals||[],this.basePath=a.basePath||"",this.el=a.el,this.data=a.data||function(){return{}},this.history=a.history||history,this.strictMode=!!a.strictMode,this.reloadOnClick=a.reloadOnClick,this.linksWatcher=null,this.stateWatcher=null,this.route=null,this.routes=[],this.uri={}}function h(a,b,c){return a.path!==b.path||a.qs!==b.qs||decodeURIComponent(a.hash)!==decodeURIComponent(b.hash)&&(!c||c.observe.hash.length)}function i(a,b){for(var c=1,d=arguments.length;c