PHP Classes

File: src/js/Dromeo.min.js

Recommend this page to a friend!
  Classes of Nikos M.   Dromeo PHP Router Library   src/js/Dromeo.min.js   Download  
File: src/js/Dromeo.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Dromeo PHP Router Library
Route HTTP requests to functions with URL patterns
Author: By
Last change: v.1.2.0, contd

* namedroutes are passed on to top router
* .off() is handled recursively in subrouters
* various edits and changes
Date: 1 year ago
Size: 17,597 bytes
 

Contents

Class file image Download
/** * * Dromeo * Simple and Flexible Pattern Routing Framework for PHP, JavaScript, Python * @version: 1.2.0 * * https://github.com/foo123/Dromeo * **/ !function(e,t,n){"use strict";var r;"undefined"!=typeof Components&&"object"==typeof Components.classes&&"object"==typeof Components.classesByID&&Components.utils&&"function"==typeof Components.utils.import?(e.EXPORTED_SYMBOLS=[t],e[t]=n.call(e)):"object"==typeof module&&module.exports?module.exports=n.call(e):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(t)?define(t,["require","exports","module"],function(){return n.call(e)}):t in e||(e[t]=r=n.call(e))&&"function"==typeof define&&define.amd&&define(function(){return r})}("undefined"!=typeof self?self:this,"Dromeo",function(){"use strict";var E=/^([^|]+\|.+)$/,k=/\((\d+)\)$/,t=/^\s+|\s+$/g,n=/([*+\[\]\(\)?^$\/\\:.])/g,e="prototype",r=Object[e],u=(Array[e],Function[e],r.toString),A=r.hasOwnProperty,l="undefined"!=typeof global&&"[object global]"==u.call(global),N=String[e].trim?function(e){return e.trim()}:function(e){return e.replace(t,"")},i={php:/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},a=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"];function j(e){return 0<e.length}function w(e){return e.replace(n,"\\$1")}function C(e){return"[object Array]"===u.call(e)}function y(e){return"[object Object]"===u.call(e)&&"function"==typeof e.constructor&&"Object"===e.constructor.name}function T(e){return"string"==typeof e||"[object String]"===u.call(e)}function m(e){return"function"==typeof e}function S(e,t,n){var r,l,o;if(n=!0===n,t)for(r in t)A.call(t,r)&&(l=t[r],"number"==typeof(o=l)||"[object Number]"===u.call(o)?e[r]=0+l:T(l)?e[r]=l.slice():C(l)?e[r]=n?S(new Array(l.length),l,n):l:y(l)?e[r]=n?S({},l,n):l:e[r]=l);return e}function R(e){return decodeURIComponent(String(e))}function s(e){return encodeURIComponent(String(e)).split("!").join("%21").split("'").join("%27").split("(").join("%28").split(")").join("%29").split("*").join("%2A")}function f(e){return s(e).split("%20").join("+")}function o(e){for(var t,n,r,l,o,u,i,a,s,f,c,p,h=e.replace(/^&+|&+$/g,"").split("&"),d=h.length,g={},m=[],_=0;_<d;++_)if(u=h[_].split("="),o=R(N(u[0])),u=u.length<2?"":R(N(u[1])),-1<(t=o.indexOf("\0"))&&(o=o.slice(0,t)),o&&"["!==o.charAt(0)){for(a=[],t=i=0;t<o.length;++t)if("["!==o.charAt(t)||i){if("]"===o.charAt(t)&&i&&(a.length||a.push(o.slice(0,i-1)),a.push(o.substr(i,t-i)),i=0,"["!==o.charAt(t+1)))break}else i=t+1;for(a.length||(a=[o]),t=0;t<a[0].length&&(" "!==(l=a[0].charAt(t))&&"."!==l&&"["!==l||(a[0]=a[0].substr(0,t)+"_"+a[0].substr(t+1)),"["!==l);++t);for(o=null,n=r=g,f=a.length?N(a[a.length-1].replace(/^['"]|['"]$/g,"")):null,t=0,s=a.length;t<s;++t)c=o,o=a[t].replace(/^['"]|['"]$/g,""),p=n,n=r,""!==N(o)||0===t?(A.call(r,o)||(r[o]=t+1===s-1&&""===f?[]:{}),r=r[o]):o=!0;!0===o?n.push(u):(o==+o&&m.push({key:c,obj:p}),n[o]=u)}for(_=m.length-1;0<=_;--_)(function(e){if(C(e))return!0;if(y(e)){var t,n=function(e){if("function"==typeof Object.keys)return Object.keys(e);var t,n,r;if(C(e))for(t=new Array(r=e.length),n=0;n<r;++n)t[n]=String(n);else for(n in t=[],e)A.call(e,n)&&t.push(n);return t}(e),r=n.length;for(t=0;t<r;++t)if(t!==+n[t])return!1;return!0}return!1})(r=m[_].key?m[_].obj[m[_].key]:m[_].obj)&&(r=function(e){if(C(e))return e;if("function"==typeof Object.values)return Object.values(e);var t,n=[];for(t in e)A.call(e,t)&&n.push(e[t]);return n}(r),m[_].key?m[_].obj[m[_].key]=r:g=r);return g}function c(e,t,n){var r,l=t.length;if(!0===n)return 0<l&&-1!==t.indexOf(e);for(r=0;r<l;++r)if(e==t[r])return 1}function p(e,t,n){var r,l,o=[];for(r in arguments.length<2&&(t="&"),arguments.length<3&&(n=!1),e)A.call(e,r)&&""!=(l=function e(t,n,r,l){var o,u,i=l?s:f;if(!0===n?n="1":!1===n&&(n="0"),null==n)return"";if("object"!=typeof n)return i(t)+"="+i(n);for(o in u=[],n)A.call(n,o)&&null!=n[o]&&u.push(e(t+"["+o+"]",n[o],r,l));return u.join(r)}(r,e[r],t,n))&&o.push(l);return o.join(t)}function x(e,t,n){if(t!==n&&n){var r,l,o=[];for(e=e.split(t),l=0;l<e.length;++l)r=(r=e[l]).split(n),o.push(r[0]),1<r.length&&o.push(r[1]);return o}return e.split(t)}function L(t){return function(e){return t}}function q(t){return function(e){return e[t]?e[t].length:0}}function h(e,t,n,r,l){var o,u,i,a,s,f,c,p,h,d,g,m,_,y,R,P,T,S,b,v;if(n.indexOf(e[0])<0)return[n,l&&l.length?l+n:n,{},r,!0,[n]];for(a=(o=x(n,e[0],e[1])).length,c=!1,p="",S=[],d=T=0,m={},P=[],l&&l.length&&(p+=w(l),T=l.length),i=0;i<a;++i)u=o[i],c=c?(f=s=!1,g=null,b=[],(h=u.split(e[4]))[0].length||(h[0]=e[2]+"PART"+e[3]),y=function(e,t,n){for(var r,l,o=0,u={},i=[],a=[],s=[],f=null,c=(n=x(n,e[2],e[3])).length,p=!1,h=0;h<c;++h)p=p?(n[h].length&&(A.call(t,n[h])?(i.push("("+t[n[h]][0]+")"),++o,t[n[h]][1]&&(u[o]=t[n[h]][1]),null==f&&(f=i[i.length-1]),s.push([o])):(r=n[h].match(E))?(i.push("("+r[1].split("|").filter(j).map(w).join("|")+")"),++o,null==f&&(f=i[i.length-1]),s.push([o])):n[h].length&&(i.push("("+w(n[h])+")"),++o,null==f&&(f=i[i.length-1]),s.push([o]))),a.push(!0),!1):(n[h].length&&(i.push(w(n[h])),a.push(n[h]),s.push(n[h].length)),!0);return 1===i.length&&1===o?(u[0]=u[1]?u[1]:null,[l=i.join(""),o,u,a,f||l,s]):(u[0]=null,[l="("+i.join("")+")",o+1,u,a,f||l,s])}(e,t,h[0]),1<h.length&&((s=(_=N(h[1])).length&&"?"===_.charAt(0))&&(_=_.slice(1)),(h=_.match(k))?(_=_.slice(0,-h[0].length),R=parseInt(h[1],10),g=A.call(y[2],R)?y[2][R]:null,0<R&&R<y[1]?(v=!1,b=y[5].reduce(function(e,t){return C(t)&&t[0]>=R&&(v=!0),v||e.push(C(t)?q(t[0]+d+1):L(t)),e},[]),R+=d+1):R=d+1):(g=y[2][0]?y[2][0]:null,R=d+1),f=0<_.length),p+=y[0],s&&(p+="?"),f&&(m[_]=[R,g,function(e){return function(n){return e.reduce(function(e,t){return e+t(n)},0)}}(S.concat(b))]),f&&P.push({name:_,optional:s,re:new RegExp("^"+y[4]+"$"),tpl:y[3]}),T=0,S.push(q(d+1)),d+=y[1],!1):(p+=w(u),T+=u.length,P.push(u),S.push(L(T)),!0);return[n,new RegExp("^"+p+"$"),m,r,!1,P]}function d(e,t){return t.join(",")+"->"+e}function g(e){return c("*",e=e?e.map?e.map(function(e){return e.toLowerCase()}):[String(e).toLowerCase()]:["*"])&&(e=["*"]),e.sort(),e}function _(e,t,n){if(t&&T(t.route)&&t.handler&&m(t.handler)){n=!0===n;for(var r=t.handler,l=t.defaults||{},o=t.types||null,u=t.name||null,i=g(t.method),a=d(t=e.key+t.route,i),s=null,f=0,c=e._routes.length;f<c;++f)if(a===e._routes[f].key){s=e._routes[f];break}s||(s=new P(e._delims,e._patterns,t,i,u,e._prefix),e._routes.push(s),e._addNamedRoute(s)),s.handlers.push([r,l,o,n,0])}}function b(e,t){for(var n,r=e._routes.length-1;0<=r;--r)t===e._routes[r].key&&(n=e._routes[r],e._routes.splice(r,1),e._delNamedRoute(n),n.dispose())}function P(e,t,n,r,l,o){var u=this;u.__args__=[e,t],u.isParsed=!1,u.handlers=[],u.route=null!=n?String(n):"",u.prefix=null!=o?String(o):"",u.method=r,u.pattern=null,u.captures=null,u.literal=!1,u.namespace=null,u.tpl=null,u.name=null!=l?String(l):null,u.key=d(u.route,u.method)}function v(e,t,n){var r=this;if(!(r instanceof v))return new v(e,t,n);r._delims=["{","}","%","%",":"],r._patterns={},r.definePattern("ALPHA","[a-zA-Z\\-_]+"),r.definePattern("ALNUM","[a-zA-Z0-9\\-_]+"),r.definePattern("NUMBR","[0-9]+"),r.definePattern("INT","[0-9]+","INT"),r.definePattern("PART","[^\\/?#]+"),r.definePattern("VAR","[^=?&#\\/]+","VAR"),r.definePattern("QUERY","\\?[^?#]+"),r.definePattern("FRAGMENT","#[^?#]+"),r.definePattern("URLENCODED","[^\\/?#]+","URLENCODED"),r.definePattern("ALL",".+"),r._routes=[],r._named_routes={},r._fallback=!1,r._top=n instanceof v?n:r,r.key=r===r._top?"":r._top.key+String(t),r._prefix=null==e?"":String(e)}return P.to_key=d,P[e]={constructor:P,__args__:null,isParsed:!1,handlers:null,route:null,prefix:null,pattern:null,captures:null,tpl:null,method:null,literal:null,namespace:null,name:null,key:null,dispose:function(){var e=this;return e.__args__=null,e.isParsed=null,e.handlers=null,e.route=null,e.prefix=null,e.pattern=null,e.captures=null,e.tpl=null,e.method=null,e.literal=null,e.namespace=null,e.name=null,e.key=null,e},parse:function(){var e=this;if(e.isParsed)return e;var t=h(e.__args__[0],e.__args__[1],e.route,e.method,e.prefix);return e.pattern=t[1],e.captures=t[2],e.tpl=t[5],e.literal=!0===t[4],e.__args__=null,e.isParsed=!0,e},match:function(e,t){var n=this;return c(t=t||"*",n.method)||"*"===n.method[0]?(n.isParsed||n.parse(),e=String(e),n.literal?e===n.pattern?[]:null:e.match(n.pattern)):null},make:function(e,t){var n,r,l,o,u,i,a,s=this,f="";for(e=e||{},t=!0===t,s.isParsed||s.parse(),n=0,r=(a=s.tpl).length;n<r;++n)if(T(a[n]))f+=a[n];else if(A.call(e,a[n].name)&&null!=e[a[n].name]){if(u=String(e[a[n].name]),t&&!a[n].re.test(u))throw new ReferenceError('Dromeo: Route "'+s.name+'" (Pattern: "'+s.route+'") parameter "'+a[n].name+'" value "'+u+'" does not match pattern!');for(l=0,o=(i=a[n].tpl).length;l<o;++l)f+=!0===i[l]?u:i[l]}else if(!a[n].optional)throw new ReferenceError('Dromeo: Route "'+s.name+'" (Pattern: "'+s.route+'") missing parameter "'+a[n].name+'"!');return f},sub:function(e,t,n,r,l){var o,u,i,a,s,f,c,p,h,d,g=this;if(!g.isParsed||g.literal)return g;for(o in a=e[0],s=T(r)&&r!==a,c=(f=T(l))?{}:null,g.captures)A.call(g.captures,o)&&(p=(i=g.captures[o])[0],u=i[1],i=i[2],e[p]?(p=e[p],h=s?(h=i(e),r.slice(h,h+p.length)):p,n&&A.call(n,o)&&n[o]?(T(d=n[o])&&A.call(v.TYPES,d)&&(d=v.TYPES[d]),t[o]=m(d)?d(p):p,f&&(c[o]=m(d)?d(h):h)):u?(d=u,t[o]=m(d)?d(p):p,f&&(c[o]=m(d)?d(h):h)):(t[o]=p,f&&(c[o]=h))):A.call(t,o)?f&&(c[o]=t[o]):(t[o]=null,f&&(c[o]=null)));return f&&(t[String(l)]=c),g}},v.VERSION="1.2.0",v.HTTP_STATUS={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",419:"Authentication Timeout",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",440:"Login Timeout",444:"No Response",449:"Retry With",450:"Blocked by Windows Parental Controls",451:"Unavailable For Legal Reasons",494:"Request Header Too Large",495:"Cert Error",496:"No Cert",497:"HTTP to HTTPS",498:"Token expired/invalid",499:"Client Closed Request",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required",520:"Origin Error",521:"Web server is down",522:"Connection timed out",523:"Proxy Declined Request",524:"A timeout occurred",598:"Network read timeout error",599:"Network connect timeout error"},v.Route=P,v.to_method=g,(v.TYPES={INTEGER:function(e){return parseInt(e,10)||0},STRING:function(e){return T(e)?e:""+String(e)},URLDECODE:function(e){return R(String(e).split("+").join("%20"))},ARRAY:function(e){return C(e)?e:[e]},PARAMS:function(e){return T(e)?v.unglue_params(e):e}}).INT=v.TYPES.INTEGER,v.TYPES.STR=v.TYPES.STRING,v.TYPES.VAR=v.TYPES.URLDECODE,v.TYPES.URLENCODED=v.TYPES.PARAMS,v.glue_params=function(e){var t="";return e&&(t+=p(e,"&",!0)),t},v.unglue_params=function(e){return e?o(e):{}},v.parse_components=function(e,t,n){var r={};return e&&((arguments.length<3||null==n)&&(n="fragment_params"),(arguments.length<2||null==t)&&(t="query_params"),r=function(e,t,n){for(var r=i[n||"php"].exec(e),l={},o=14;o--;)r[o]&&(l[a[o]]=r[o]);return A.call(l,"port")&&(l.port=parseInt(l.port,10)),t?l[t.replace("PHP_URL_","").toLowerCase()]||null:(l.source&&delete l.source,l)}(e),t&&(r.query?r[t]=this.unglue_params(r.query):r[t]={}),n&&(r.fragment?r[n]=this.unglue_params(r.fragment):r[n]={})),r},v.build_components=function(e,t,n,r,l){e=""+e;return(arguments.length<5||null==l)&&(l="#"),(arguments.length<4||null==r)&&(r="?"),t&&(e+=r+this.glue_params(t)),n&&(e+=l+this.glue_params(n)),e},v.defType=function(e,t){e&&m(t)&&(v.TYPES[e]=t)},v.TYPE=function(e){return e&&A.call(v.TYPES,e)?v.TYPES[e]:null},v[e]={constructor:v,_delims:null,_patterns:null,_routes:null,_named_routes:null,_fallback:!1,_prefix:"",_top:null,key:"",dispose:function(){var e,t,n=this;if(n._top=null,n._delims=null,n._patterns=null,n._fallback=null,n._prefix=null,n._routes)for(e=0,t=n._routes.length;e<t;++e)n._routes[e].dispose();return n._routes=null,n._named_routes=null,n},top:function(){return this._top},isTop:function(){return null==this._top||this===this._top},clone:function(e){var t,n,r=this,l=new v(r._prefix,e,r);for(t in l.defineDelimiters(r._delims),r._patterns)A.call(r._patterns,t)&&(n=r._patterns[t],l.definePattern(t,n[0],1<n.length?n[1]:null));return l},reset:function(){return this._routes=[],this._named_routes={},this._fallback=!1,this},defineDelimiters:function(e){var t,n=this._delims;return e&&(0<(t=e.length)&&e[0]&&(n[0]=e[0]),1<t&&e[1]&&(n[1]=e[1]),2<t&&e[2]&&(n[2]=e[2]),3<t&&e[3]&&(n[3]=e[3]),4<t&&e[4]&&(n[4]=e[4])),this},definePattern:function(e,t,n){return n&&T(n)&&n.length&&A.call(v.TYPES,n)&&(n=v.TYPES[n]),n&&m(n)||(n=null),this._patterns[e]=[t,n],this},dropPattern:function(e){var t=this._patterns;return A.call(t,e)&&delete t[e],this},defineType:function(e,t){return v.defType(e,t),this},glue:function(e){return v.glue_params(e)},unglue:function(e){return v.unglue_params(e)},parse:function(e,t,n){return v.parse_components(e,t,n)},build:function(e,t,n,r,l){return v.build_components(e,t,n,r,l)},redirect:function(e,t,n,r){return e&&(l?t&&(arguments.length<3&&(n=302),arguments.length<4&&(r=!0),r?(!0===r&&(r=v.HTTP_STATUS[n]||""),t.writeHead(n,r,{Location:e})):t.writeHead(n,{Location:e}),t.end()):document.location.href=e),this},onGroup:function(e,t){return(e=String(e)).length&&m(t)&&(e=this.clone(e),this._routes.push(e),t(e)),this},on:function(){for(var e=arguments,t=e.length,n=1===t?C(e[0])?e[0]:[e[0]]:2===t&&T(e[0])&&m(e[1])?[{route:e[0],handler:e[1],method:"*",defaults:{},types:null}]:e,r=0;r<n.length;++r)_(this,n[r],!1);return this},one:function(){for(var e=arguments,t=e.length,n=1===t?C(e[0])?e[0]:[e[0]]:2===t&&T(e[0])&&m(e[1])?[{route:e[0],handler:e[1],method:"*",defaults:{},types:null}]:e,r=0;r<n.length;++r)_(this,n[r],!0);return this},off:function(e,t,n){var r,l,o,u,i=this,a=i._routes;if(!e)return i;if(null==n&&(n="*"),y(e)){if(t=e.handler||t,n=e.method||n,!(e=e.route))return i;for(u=d(e=String(e),g(n)),l=null,r=0,o=a.length;r<o;++r)if(a[r]instanceof v)a[r].off(e,t,n);else if(u===a[r].key){l=a[r];break}if(!l)return i;if(t&&m(t)){for(r=(o=l.handlers.length)-1;0<=r;--r)t===l.handlers[r][0]&&l.handlers.splice(r,1);l.handlers.length||b(i,u)}else b(i,u)}else if(T(e)&&e.length){for(u=d(e=String(e),g(n)),l=null,r=0,o=a.length;r<o;++r)if(a[r]instanceof v){if(e===a[r].key){l=a[r];break}a[r].off(e,t,n)}else if(u===a[r].key){l=a[r];break}if(!l)return i;if(l instanceof v)a.splice(r,1),l.dispose();else if(t&&m(t)){for(r=(o=l.handlers.length)-1;0<=r;--r)t===l.handlers[r][0]&&l.handlers.splice(r,1);l.handlers.length||b(i,u)}else b(i,u)}return i},fallback:function(e){return arguments.length<1&&(e=!1),!1!==e&&null!==e&&!m(e)||(this._fallback=e),this},make:function(e,t,n){var r=this._named_routes;return A.call(r,e)?r[e].make(t,n):null},route:function(e,t,n,r,l){var o,u,i,a,s,f,c,p,h,d,g,m,_,y,R,P=this;if(!P.isTop()&&!P._routes.length)return!1;if(R=!(o=!0),e=null!=e?String(e):"",(u=P._prefix+P.key).length&&(o=u===e.slice(0,u.length)),o){for(n=!1!==n,t=null!=t?String(t).toLowerCase():"*",h=(i=P._routes.slice()).length,p=0;p<h;++p){if((a=i[p])instanceof v){if(!(m=a.route(e,t,n,r,l)))continue;R=!0}else{if(null==(m=a.match(e,t)))continue;for(R=!0,c=[],d=(_=a.handlers.slice()).length,g=0;g<d;++g)(y=_[g])[3]&&y[4]?c.unshift(g):(s=y[1],f=y[2],s={route:e,method:t,pattern:a.route,fallback:!1,data:S({},s,!0)},T(r)&&(s.route_original=r),a.sub(m,s.data,f,r,l),y[4]=1,y[3]&&c.unshift(g),y[0](s));for(g=0,d=c.length;g<d;++g)a.handlers.splice(c[g],1);a.handlers.length||b(P,a.key)}if(n)return!0}if(R)return!0}return P._fallback&&P.isTop()&&P._fallback({route:e,method:t,pattern:null,fallback:!0,data:null}),!1},_addNamedRoute:function(e){return this.isTop()?e instanceof v.Route&&e.name&&e.name.length&&(this._named_routes[e.name]=e):this.top()._addNamedRoute(e),this},_delNamedRoute:function(e){var t=this;return t.isTop()?e instanceof v.Route&&e.name&&A.call(t._named_routes,e.name)&&delete t._named_routes[e.name]:t.top()._delNamedRoute(e),t}},v});