!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.frontexpress=t()}(this,function(){"use strict";var e=["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"],t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(){function e(e,t){for(var r=0;r=1&&(n=t.slice(0,a),i=t.slice(a,t.length)),n=Object.keys(r).reduce(function(e,t,i){return e+=0===i&&e.indexOf("?")===-1?"?":"&",e+=t+"="+r[t]},n),n+i},data:function(e){e.uri,e.headers,e.data}}},this.rules={"http requester":function(e){if("function"!=typeof e.fetch)throw new TypeError("setting http requester has no fetch method")}}}return r(e,[{key:"set",value:function(e,t){var r=this.rules[e];r&&r(t),this.settings[e]=t}},{key:"get",value:function(e){return this.settings[e]}}]),e}(),o=function(){function e(){var r=arguments.length<=0||void 0===arguments[0]?"":arguments[0];t(this,e),this.name=r}return r(e,[{key:"entered",value:function(e){}},{key:"exited",value:function(e){}},{key:"updated",value:function(e,t){}},{key:"failed",value:function(e,t){}},{key:"next",value:function(){return!0}}]),e}(),s=function(){function e(r,i,n,a){t(this,e),this.router=r,this.uriPart=i,this.method=n,this.middleware=a,this.visited=!1}return r(e,[{key:"uri",get:function(){if(this.uriPart||this.method)return this.uriPart instanceof RegExp?this.uriPart:this.router.baseUri instanceof RegExp?this.router.baseUri:this.router.baseUri&&this.uriPart?(this.router.baseUri.trim()+this.uriPart.trim()).replace(/\/{2,}/,"/"):this.router.baseUri?this.router.baseUri.trim():this.uriPart}}]),e}(),u=function(){function i(e){t(this,i),e&&(this._baseUri=e),this._routes=[]}return r(i,[{key:"_add",value:function(e){return this._routes.push(e),this}},{key:"routes",value:function(e,t){return this._routes.filter(function(r){if(!r.uri&&!r.method)return!0;if(r.method!==t)return!1;if(!r.uri)return!0;var i=e,n=i.indexOf("?");n>=0&&(i=i.slice(0,n));var a=i.indexOf("#");return a>=0&&(i=i.slice(0,a)),r.uri instanceof RegExp?i.match(r.uri):r.uri===i})}},{key:"visited",value:function(){return this._routes.filter(function(e){return e.visited})}},{key:"use",value:function(e){if(!(e instanceof o)&&"function"!=typeof e)throw new TypeError("use method takes at least a middleware");return this._add(new s(this,void 0,void 0,e)),this}},{key:"all",value:function(){for(var t=arguments.length,r=Array(t),i=0;i