Socket
Socket
Sign inDemoInstall

vue-router

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-router - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

33

dist/vue-router.js
/**
* vue-router v2.0.2
* vue-router v2.0.3
* (c) 2016 Evan You

@@ -1038,2 +1038,4 @@ * @license MIT

var regexpParamsCache = Object.create(null)
var regexpCompileCache = Object.create(null)

@@ -1056,2 +1058,3 @@

var record = nameMap[name]
var paramNames = getParams(record.path)

@@ -1064,3 +1067,3 @@ if (typeof location.params !== 'object') {

for (var key in currentRoute.params) {
if (!(key in location.params)) {
if (!(key in location.params) && paramNames.indexOf(key) > -1) {
location.params[key] = currentRoute.params[key]

@@ -1180,9 +1183,6 @@ }

function matchRoute (
path,
params,
pathname
) {
function getRouteRegex (path) {
var hit = regexpCache[path]
var keys, regexp
var hit = regexpCache[path]
if (hit) {

@@ -1196,2 +1196,14 @@ keys = hit.keys

}
return { keys: keys, regexp: regexp }
}
function matchRoute (
path,
params,
pathname
) {
var ref = getRouteRegex(path);
var regexp = ref.regexp;
var keys = ref.keys;
var m = pathname.match(regexp)

@@ -1230,2 +1242,7 @@

function getParams (path) {
return regexpParamsCache[path] ||
(regexpParamsCache[path] = getRouteRegex(path).keys.map(function (key) { return key.name; }))
}
function resolveRecordPath (path, record) {

@@ -1232,0 +1249,0 @@ return resolvePath(path, record.parent ? record.parent.path : '/', true)

/**
* vue-router v2.0.2
* vue-router v2.0.3
* (c) 2016 Evan You
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e,n){if("/"===t.charAt(0))return t;if("?"===t.charAt(0)||"#"===t.charAt(0))return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var o=t.replace(/^\//,"").split("/"),i=0;i<o.length;i++){var a=o[i];"."!==a&&(".."===a?r.pop():r.push(a))}return""!==r[0]&&r.unshift(""),r.join("/")}function e(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function n(t){return t.replace(/\/\//g,"/")}function r(t,e){if(!t)throw new Error("[vue-router] "+e)}function o(t,e){t||"undefined"!=typeof console&&console.warn("[vue-router] "+e)}function i(t,e){if(void 0===e&&(e={}),t){var n;try{n=a(t)}catch(t){o(!1,t.message),n={}}for(var r in e)n[r]=e[r];return n}return e}function a(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=dt(n.shift()),o=n.length>0?dt(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function u(t){var e=t?Object.keys(t).sort().map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return lt(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(lt(e)):r.push(lt(e)+"="+lt(t)))}),r.join("&")}return lt(e)+"="+lt(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function c(t,e,n){var r={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:f(e),matched:t?s(t):[]};return n&&(r.redirectedFrom=f(n)),Object.freeze(r)}function s(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function f(t){var e=t.path,n=t.query;void 0===n&&(n={});var r=t.hash;return void 0===r&&(r=""),(e||"/")+u(n)+r}function p(t,e){return e===yt?t===e:!!e&&(t.path&&e.path?t.path.replace(vt,"")===e.path.replace(vt,"")&&t.hash===e.hash&&h(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&h(t.query,e.query)&&h(t.params,e.params)))}function h(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function l(t,e){return 0===t.path.indexOf(e.path.replace(/\/$/,""))&&(!e.hash||t.hash===e.hash)&&d(t.query,e.query)}function d(t,e){for(var n in e)if(!(n in t))return!1;return!0}function y(n,r,o){var a="string"==typeof n?{path:n}:n;if(a.name||a._normalized)return a;var u=e(a.path||""),c=r&&r.path||"/",s=u.path?t(u.path,c,o):r&&r.path||"/",f=i(u.query,a.query),p=a.hash||u.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:s,query:f,hash:p}}function v(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=v(e.children)))return e}}function m(t,e,r){var o="hash"===r?"/#"+e:e;return t?n(t+o):o}function g(t){if(!g.installed){g.installed=!0,pt=t,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}}),t.mixin({beforeCreate:function(){this.$options.router&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current))}}),t.component("router-view",ht),t.component("router-link",gt);var e=t.config.optionMergeStrategies;e.beforeRouteEnter=e.beforeRouteLeave=e.created}}function w(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=jt.exec(t));){var c=n[0],s=n[1],f=n.index;if(a+=t.slice(i,f),i=f+c.length,s)a+=s[1];else{var p=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=p&&p!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?R(k):m?".*":"[^"+E(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function b(t,e){return O(w(t,e))}function x(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function O(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=r||{},u=a.pretty?x:encodeURIComponent,c=0;c<t.length;c++){var s=t[c];if("string"!=typeof s){var f,p=i[s.name];if(null==p){if(s.optional){s.partial&&(o+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(bt(p)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<p.length;h++){if(f=u(p[h]),!e[c].test(f))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(f)+"`");o+=(0===h?s.prefix:s.delimiter)+f}}else{if(f=s.asterisk?k(p):u(p),!e[c].test(f))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+f+'"');o+=s.prefix+f}}else o+=s}return o}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function R(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function j(t,e){return t.keys=e,t}function A(t){return t.sensitive?"":"i"}function $(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return j(t,e)}function _(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(q(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",A(n));return j(i,e)}function S(t,e,n){return T(w(t,n),e,n)}function T(t,e,n){bt(e)||(n=e||n,e=[]),n=n||{};for(var r=n.strict,o=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=E(u);else{var c=E(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")",i+=s}}var f=E(n.delimiter||"/"),p=i.slice(-f.length)===f;return r||(i=(p?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":r&&p?"":"(?="+f+"|$)",j(new RegExp("^"+i,A(n)),e)}function q(t,e,n){return bt(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?$(t,e):bt(t)?_(t,e,n):S(t,e,n)}function C(t){var e=Object.create(null),n=Object.create(null);return t.forEach(function(t){P(e,n,t)}),{pathMap:e,nameMap:n}}function P(t,e,n,i,a){var u=n.path,c=n.name;r(null!=u,'"path" is required in a route configuration.');var s={path:U(u,i),components:n.components||{default:n.component},instances:{},name:c,parent:i,matchAs:a,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{}};n.children&&n.children.forEach(function(n){P(t,e,n,s)}),void 0!==n.alias&&(Array.isArray(n.alias)?n.alias.forEach(function(n){P(t,e,{path:n},i,s.path)}):P(t,e,{path:n.alias},i,s.path)),t[s.path]=s,c&&(e[c]?o(!1,'Duplicate named routes definition: { name: "'+c+'", path: "'+s.path+'" }'):e[c]=s)}function U(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:n(e.path+"/"+t)}function L(t){function e(t,e,n){var r=y(t,e),o=r.name;if(o){var i=f[o];if("object"!=typeof r.params&&(r.params={}),e&&"object"==typeof e.params)for(var u in e.params)u in r.params||(r.params[u]=e.params[u]);if(i)return r.path=M(i.path,r.params,'named route "'+o+'"'),a(i,r,n)}else if(r.path){r.params={};for(var c in s)if(V(c,r.params,r.path))return a(s[c],r,n)}return a(null,r)}function n(t,n){var i=t.redirect,u="function"==typeof i?i(c(t,n)):i;if("string"==typeof u&&(u={path:u}),!u||"object"!=typeof u)return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n);var s=u,p=s.name,h=s.path,l=n.query,d=n.hash,y=n.params;if(l=s.hasOwnProperty("query")?s.query:l,d=s.hasOwnProperty("hash")?s.hash:d,y=s.hasOwnProperty("params")?s.params:y,p){var v=f[p];return r(v,'redirect failed: named route "'+p+'" not found.'),e({_normalized:!0,name:p,query:l,hash:d,params:y},void 0,n)}if(h){var m=B(h,t),g=M(m,y,'redirect route with path "'+m+'"');return e({_normalized:!0,path:g,query:l,hash:d},void 0,n)}return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n)}function i(t,n,r){var o=M(r,n.params,'aliased route with path "'+r+'"'),i=e({_normalized:!0,path:o});if(i){var u=i.matched,c=u[u.length-1];return n.params=i.params,a(c,n)}return a(null,n)}function a(t,e,r){return t&&t.redirect?n(t,r||e):t&&t.matchAs?i(t,e,t.matchAs):c(t,e,r)}var u=C(t),s=u.pathMap,f=u.nameMap;return e}function V(t,e,n){var r,o,i=At[t];i?(r=i.keys,o=i.regexp):(r=[],o=xt(t,r),At[t]={keys:r,regexp:o});var a=n.match(o);if(!a)return!1;if(!e)return!0;for(var u=1,c=a.length;u<c;++u){var s=r[u-1],f="string"==typeof a[u]?decodeURIComponent(a[u]):a[u];s&&(e[s.name]=f)}return!0}function M(t,e,n){try{var o=$t[t]||($t[t]=xt.compile(t));return o(e||{},{pretty:!0})}catch(t){return r(!1,"missing param for "+n+": "+t.message),""}}function B(e,n){return t(e,n.parent?n.parent.path:"/",!0)}function H(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function z(t){if(!t)if(_t){var e=document.querySelector("base");t=e?e.getAttribute("href"):"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function F(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{activated:e.slice(n),deactivated:t.slice(n)}}function I(t,e){return"function"!=typeof t&&(t=pt.extend(t)),t.options[e]}function D(t){return G(W(t,function(t,e){var n=I(t,"beforeRouteLeave");if(n)return Array.isArray(n)?n.map(function(t){return J(t,e)}):J(n,e)}).reverse())}function J(t,e){return function(){return t.apply(e,arguments)}}function N(t,e,n){return G(W(t,function(t,r,o,i){var a=I(t,"beforeRouteEnter");if(a)return Array.isArray(a)?a.map(function(t){return K(t,e,o,i,n)}):K(a,e,o,i,n)}))}function K(t,e,n,r,o){return function(i,a,u){return t(i,a,function(t){u(t),"function"==typeof t&&e.push(function(){X(t,n.instances,r,o)})})}}function X(t,e,n,r){e[n]?t(e[n]):r()&&setTimeout(function(){X(t,e,n,r)},16)}function Y(t){return W(t,function(t,e,n,r){if("function"==typeof t&&!t.options)return function(e,i,a){var u=function(t){n.components[r]=t,a()},c=function(t){o(!1,"Failed to resolve async component "+r+": "+t),a(!1)},s=t(u,c);s&&"function"==typeof s.then&&s.then(u,c)}})}function W(t,e){return G(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function G(t){return Array.prototype.concat.apply([],t)}function Q(t){t&&(qt[t]={x:window.pageXOffset,y:window.pageYOffset})}function Z(t){if(t)return qt[t]}function tt(t){var e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-e.left,y:n.top-e.top}}function et(t){return rt(t.x)||rt(t.y)}function nt(t){return{x:rt(t.x)?t.x:window.pageXOffset,y:rt(t.y)?t.y:window.pageYOffset}}function rt(t){return"number"==typeof t}function ot(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function it(t,e){var n=window.history;try{e?n.replaceState({key:Pt},"",t):(Pt=Ct(),n.pushState({key:Pt},"",t)),Q(Pt)}catch(n){window.location[e?"assign":"replace"](t)}}function at(t){it(t,!0)}function ut(){var t=ct();return"/"===t.charAt(0)||(ft("/"+t),!1)}function ct(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function st(t){window.location.hash=t}function ft(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}var pt,ht={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$route,u=o._routerViewCache||(o._routerViewCache={}),c=0,s=!1;o;)o.$vnode&&o.$vnode.data.routerView&&c++,o._inactive&&(s=!0),o=o.$parent;i.routerViewDepth=c;var f=a.matched[c];if(!f)return t();var p=n.name,h=s?u[p]:u[p]=f.components[p];if(!s){var l=i.hook||(i.hook={});l.init=function(t){f.instances[p]=t.child},l.prepatch=function(t,e){f.instances[p]=e.child},l.destroy=function(t){f.instances[p]===t.child&&(f.instances[p]=void 0)}}return t(h,i,r)}},lt=encodeURIComponent,dt=decodeURIComponent,yt=c(null,{path:"/"}),vt=/\/$/,mt=[String,Object],gt={name:"router-link",props:{to:{type:mt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String},render:function(t){var e=this,n=this.$router,r=this.$route,o=y(this.to,r,this.append),i=n.match(o,r),a=i.redirectedFrom||i.fullPath,u=n.history.base,s=m(u,a,n.mode),f={},h=this.activeClass||n.options.linkActiveClass||"router-link-active",d=o.path?c(null,o):i;f[h]=this.exact?p(r,d):l(r,d);var g={click:function(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||0!==t.button)){var r=t.target.getAttribute("target");/\b_blank\b/i.test(r)||(t.preventDefault(),e.replace?n.replace(o):n.push(o))}}},w={class:f};if("a"===this.tag)w.on=g,w.attrs={href:s};else{var b=v(this.$slots.default);if(b){b.isStatic=!1;var x=pt.util.extend,k=b.data=x({},b.data);k.on=g;var O=b.data.attrs=x({},b.data.attrs);O.href=s}else w.on=g}return t(this.tag,w,this.$slots.default)}},wt=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},bt=wt,xt=q,kt=w,Ot=b,Et=O,Rt=T,jt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");xt.parse=kt,xt.compile=Ot,xt.tokensToFunction=Et,xt.tokensToRegExp=Rt;var At=Object.create(null),$t=Object.create(null),_t="undefined"!=typeof window,St=_t&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Tt=function(t,e){this.router=t,this.base=z(e),this.current=yt,this.pending=null};Tt.prototype.listen=function(t){this.cb=t},Tt.prototype.transitionTo=function(t,e){var n=this,r=this.router.match(t,this.current);this.confirmTransition(r,function(){n.updateRoute(r),e&&e(r),n.ensureURL()})},Tt.prototype.confirmTransition=function(t,e){var n=this,r=this.current;if(p(t,r))return void this.ensureURL();var o=F(this.current.matched,t.matched),i=o.deactivated,a=o.activated,u=[].concat(D(i),this.router.beforeHooks,a.map(function(t){return t.beforeEnter}),Y(a));this.pending=t;var c=function(e,o){n.pending===t&&e(t,r,function(t){t===!1?n.ensureURL(!0):"string"==typeof t||"object"==typeof t?n.push(t):o(t)})};H(u,c,function(){var r=[],o=N(a,r,function(){return n.current===t});H(o,c,function(){n.pending===t&&(n.pending=null,e(t),n.router.app.$nextTick(function(){r.forEach(function(t){return t()})}))})})},Tt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var qt=Object.create(null),Ct=function(){return String(Date.now())},Pt=Ct(),Ut=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;window.addEventListener("popstate",function(t){Pt=t.state&&t.state.key;var e=r.current;r.transitionTo(ot(r.base),function(t){o&&r.handleScroll(t,e,!0)})}),o&&window.addEventListener("scroll",function(){Q(Pt)})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t){var e=this,r=this.current;this.transitionTo(t,function(t){it(n(e.base+t.fullPath)),e.handleScroll(t,r,!1)})},e.prototype.replace=function(t){var e=this,r=this.current;this.transitionTo(t,function(t){at(n(e.base+t.fullPath)),e.handleScroll(t,r,!1)})},e.prototype.ensureURL=function(t){if(ot(this.base)!==this.current.fullPath){var e=n(this.base+this.current.fullPath);t?it(e):at(e)}},e.prototype.handleScroll=function(t,e,n){var o=this.router;if(o.app){var i=o.options.scrollBehavior;i&&(r("function"==typeof i,"scrollBehavior must be a function"),o.app.$nextTick(function(){var r=Z(Pt),o=i(t,e,n?r:null);if(o){var a="object"==typeof o;if(a&&"string"==typeof o.selector){var u=document.querySelector(o.selector);u?r=tt(u):et(o)&&(r=nt(o))}else a&&et(o)&&(r=nt(o));r&&window.scrollTo(r.x,r.y)}}))}},e}(Tt),Lt=function(t){function e(e,n,r){t.call(this,e,n),r&&this.checkFallback()||ut()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.checkFallback=function(){var t=ot(this.base);if(!/^\/#/.test(t))return window.location.replace(n(this.base+"/#"+t)),!0},e.prototype.onHashChange=function(){ut()&&this.transitionTo(ct(),function(t){ft(t.fullPath)})},e.prototype.push=function(t){this.transitionTo(t,function(t){st(t.fullPath)})},e.prototype.replace=function(t){this.transitionTo(t,function(t){ft(t.fullPath)})},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ct()!==e&&(t?st(e):ft(e))},e}(Tt),Vt=function(t){function e(e){t.call(this,e),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t){var e=this;this.transitionTo(t,function(t){e.stack=e.stack.slice(0,e.index+1).concat(t),e.index++})},e.prototype.replace=function(t){var e=this;this.transitionTo(t,function(t){e.stack=e.stack.slice(0,e.index).concat(t)})},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.ensureURL=function(){},e}(Tt),Mt=function(t){void 0===t&&(t={}),this.app=null,this.options=t,this.beforeHooks=[],this.afterHooks=[],this.match=L(t.routes||[]);var e=t.mode||"hash";switch(this.fallback="history"===e&&!St,this.fallback&&(e="hash"),_t||(e="abstract"),this.mode=e,e){case"history":this.history=new Ut(this,t.base);break;case"hash":this.history=new Lt(this,t.base,this.fallback);break;case"abstract":this.history=new Vt(this);break;default:r(!1,"invalid mode: "+e)}},Bt={currentRoute:{}};return Bt.currentRoute.get=function(){return this.history&&this.history.current},Mt.prototype.init=function(t){var e=this;r(g.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.app=t;var n=this.history;n instanceof Ut?n.transitionTo(ot(n.base)):n instanceof Lt&&n.transitionTo(ct(),function(){window.addEventListener("hashchange",function(){n.onHashChange()})}),n.listen(function(t){e.app._route=t})},Mt.prototype.beforeEach=function(t){this.beforeHooks.push(t)},Mt.prototype.afterEach=function(t){this.afterHooks.push(t)},Mt.prototype.push=function(t){this.history.push(t)},Mt.prototype.replace=function(t){this.history.replace(t)},Mt.prototype.go=function(t){this.history.go(t)},Mt.prototype.back=function(){this.go(-1)},Mt.prototype.forward=function(){this.go(1)},Mt.prototype.getMatchedComponents=function(){return this.currentRoute?[].concat.apply([],this.currentRoute.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Object.defineProperties(Mt.prototype,Bt),Mt.install=g,_t&&window.Vue&&window.Vue.use(Mt),Mt});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e,n){if("/"===t.charAt(0))return t;if("?"===t.charAt(0)||"#"===t.charAt(0))return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var o=t.replace(/^\//,"").split("/"),i=0;i<o.length;i++){var a=o[i];"."!==a&&(".."===a?r.pop():r.push(a))}return""!==r[0]&&r.unshift(""),r.join("/")}function e(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function n(t){return t.replace(/\/\//g,"/")}function r(t,e){if(!t)throw new Error("[vue-router] "+e)}function o(t,e){t||"undefined"!=typeof console&&console.warn("[vue-router] "+e)}function i(t,e){if(void 0===e&&(e={}),t){var n;try{n=a(t)}catch(t){o(!1,t.message),n={}}for(var r in e)n[r]=e[r];return n}return e}function a(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=vt(n.shift()),o=n.length>0?vt(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function u(t){var e=t?Object.keys(t).sort().map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return yt(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(yt(e)):r.push(yt(e)+"="+yt(t)))}),r.join("&")}return yt(e)+"="+yt(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function c(t,e,n){var r={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:f(e),matched:t?s(t):[]};return n&&(r.redirectedFrom=f(n)),Object.freeze(r)}function s(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function f(t){var e=t.path,n=t.query;void 0===n&&(n={});var r=t.hash;return void 0===r&&(r=""),(e||"/")+u(n)+r}function p(t,e){return e===mt?t===e:!!e&&(t.path&&e.path?t.path.replace(gt,"")===e.path.replace(gt,"")&&t.hash===e.hash&&h(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&h(t.query,e.query)&&h(t.params,e.params)))}function h(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function l(t,e){return 0===t.path.indexOf(e.path.replace(/\/$/,""))&&(!e.hash||t.hash===e.hash)&&d(t.query,e.query)}function d(t,e){for(var n in e)if(!(n in t))return!1;return!0}function y(n,r,o){var a="string"==typeof n?{path:n}:n;if(a.name||a._normalized)return a;var u=e(a.path||""),c=r&&r.path||"/",s=u.path?t(u.path,c,o):r&&r.path||"/",f=i(u.query,a.query),p=a.hash||u.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:s,query:f,hash:p}}function v(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=v(e.children)))return e}}function m(t,e,r){var o="hash"===r?"/#"+e:e;return t?n(t+o):o}function g(t){if(!g.installed){g.installed=!0,lt=t,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}}),t.mixin({beforeCreate:function(){this.$options.router&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current))}}),t.component("router-view",dt),t.component("router-link",bt);var e=t.config.optionMergeStrategies;e.beforeRouteEnter=e.beforeRouteLeave=e.created}}function w(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=$t.exec(t));){var c=n[0],s=n[1],f=n.index;if(a+=t.slice(i,f),i=f+c.length,s)a+=s[1];else{var p=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=p&&p!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?j(k):m?".*":"[^"+E(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function b(t,e){return O(w(t,e))}function x(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function O(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=r||{},u=a.pretty?x:encodeURIComponent,c=0;c<t.length;c++){var s=t[c];if("string"!=typeof s){var f,p=i[s.name];if(null==p){if(s.optional){s.partial&&(o+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(kt(p)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<p.length;h++){if(f=u(p[h]),!e[c].test(f))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(f)+"`");o+=(0===h?s.prefix:s.delimiter)+f}}else{if(f=s.asterisk?k(p):u(p),!e[c].test(f))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+f+'"');o+=s.prefix+f}}else o+=s}return o}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function j(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function R(t,e){return t.keys=e,t}function A(t){return t.sensitive?"":"i"}function $(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return R(t,e)}function _(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(q(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",A(n));return R(i,e)}function S(t,e,n){return T(w(t,n),e,n)}function T(t,e,n){kt(e)||(n=e||n,e=[]),n=n||{};for(var r=n.strict,o=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=E(u);else{var c=E(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")",i+=s}}var f=E(n.delimiter||"/"),p=i.slice(-f.length)===f;return r||(i=(p?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":r&&p?"":"(?="+f+"|$)",R(new RegExp("^"+i,A(n)),e)}function q(t,e,n){return kt(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?$(t,e):kt(t)?_(t,e,n):S(t,e,n)}function C(t){var e=Object.create(null),n=Object.create(null);return t.forEach(function(t){P(e,n,t)}),{pathMap:e,nameMap:n}}function P(t,e,n,i,a){var u=n.path,c=n.name;r(null!=u,'"path" is required in a route configuration.');var s={path:U(u,i),components:n.components||{default:n.component},instances:{},name:c,parent:i,matchAs:a,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{}};n.children&&n.children.forEach(function(n){P(t,e,n,s)}),void 0!==n.alias&&(Array.isArray(n.alias)?n.alias.forEach(function(n){P(t,e,{path:n},i,s.path)}):P(t,e,{path:n.alias},i,s.path)),t[s.path]=s,c&&(e[c]?o(!1,'Duplicate named routes definition: { name: "'+c+'", path: "'+s.path+'" }'):e[c]=s)}function U(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:n(e.path+"/"+t)}function L(t){function e(t,e,n){var r=y(t,e),o=r.name;if(o){var i=f[o],u=H(i.path);if("object"!=typeof r.params&&(r.params={}),e&&"object"==typeof e.params)for(var c in e.params)!(c in r.params)&&u.indexOf(c)>-1&&(r.params[c]=e.params[c]);if(i)return r.path=B(i.path,r.params,'named route "'+o+'"'),a(i,r,n)}else if(r.path){r.params={};for(var p in s)if(M(p,r.params,r.path))return a(s[p],r,n)}return a(null,r)}function n(t,n){var i=t.redirect,u="function"==typeof i?i(c(t,n)):i;if("string"==typeof u&&(u={path:u}),!u||"object"!=typeof u)return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n);var s=u,p=s.name,h=s.path,l=n.query,d=n.hash,y=n.params;if(l=s.hasOwnProperty("query")?s.query:l,d=s.hasOwnProperty("hash")?s.hash:d,y=s.hasOwnProperty("params")?s.params:y,p){var v=f[p];return r(v,'redirect failed: named route "'+p+'" not found.'),e({_normalized:!0,name:p,query:l,hash:d,params:y},void 0,n)}if(h){var m=z(h,t),g=B(m,y,'redirect route with path "'+m+'"');return e({_normalized:!0,path:g,query:l,hash:d},void 0,n)}return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n)}function i(t,n,r){var o=B(r,n.params,'aliased route with path "'+r+'"'),i=e({_normalized:!0,path:o});if(i){var u=i.matched,c=u[u.length-1];return n.params=i.params,a(c,n)}return a(null,n)}function a(t,e,r){return t&&t.redirect?n(t,r||e):t&&t.matchAs?i(t,e,t.matchAs):c(t,e,r)}var u=C(t),s=u.pathMap,f=u.nameMap;return e}function V(t){var e,n,r=_t[t];return r?(e=r.keys,n=r.regexp):(e=[],n=Ot(t,e),_t[t]={keys:e,regexp:n}),{keys:e,regexp:n}}function M(t,e,n){var r=V(t),o=r.regexp,i=r.keys,a=n.match(o);if(!a)return!1;if(!e)return!0;for(var u=1,c=a.length;u<c;++u){var s=i[u-1],f="string"==typeof a[u]?decodeURIComponent(a[u]):a[u];s&&(e[s.name]=f)}return!0}function B(t,e,n){try{var o=Tt[t]||(Tt[t]=Ot.compile(t));return o(e||{},{pretty:!0})}catch(t){return r(!1,"missing param for "+n+": "+t.message),""}}function H(t){return St[t]||(St[t]=V(t).keys.map(function(t){return t.name}))}function z(e,n){return t(e,n.parent?n.parent.path:"/",!0)}function F(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function I(t){if(!t)if(qt){var e=document.querySelector("base");t=e?e.getAttribute("href"):"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function D(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{activated:e.slice(n),deactivated:t.slice(n)}}function J(t,e){return"function"!=typeof t&&(t=lt.extend(t)),t.options[e]}function N(t){return Z(Q(t,function(t,e){var n=J(t,"beforeRouteLeave");if(n)return Array.isArray(n)?n.map(function(t){return K(t,e)}):K(n,e)}).reverse())}function K(t,e){return function(){return t.apply(e,arguments)}}function X(t,e,n){return Z(Q(t,function(t,r,o,i){var a=J(t,"beforeRouteEnter");if(a)return Array.isArray(a)?a.map(function(t){return Y(t,e,o,i,n)}):Y(a,e,o,i,n)}))}function Y(t,e,n,r,o){return function(i,a,u){return t(i,a,function(t){u(t),"function"==typeof t&&e.push(function(){W(t,n.instances,r,o)})})}}function W(t,e,n,r){e[n]?t(e[n]):r()&&setTimeout(function(){W(t,e,n,r)},16)}function G(t){return Q(t,function(t,e,n,r){if("function"==typeof t&&!t.options)return function(e,i,a){var u=function(t){n.components[r]=t,a()},c=function(t){o(!1,"Failed to resolve async component "+r+": "+t),a(!1)},s=t(u,c);s&&"function"==typeof s.then&&s.then(u,c)}})}function Q(t,e){return Z(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function Z(t){return Array.prototype.concat.apply([],t)}function tt(t){t&&(Ut[t]={x:window.pageXOffset,y:window.pageYOffset})}function et(t){if(t)return Ut[t]}function nt(t){var e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-e.left,y:n.top-e.top}}function rt(t){return it(t.x)||it(t.y)}function ot(t){return{x:it(t.x)?t.x:window.pageXOffset,y:it(t.y)?t.y:window.pageYOffset}}function it(t){return"number"==typeof t}function at(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function ut(t,e){var n=window.history;try{e?n.replaceState({key:Vt},"",t):(Vt=Lt(),n.pushState({key:Vt},"",t)),tt(Vt)}catch(n){window.location[e?"assign":"replace"](t)}}function ct(t){ut(t,!0)}function st(){var t=ft();return"/"===t.charAt(0)||(ht("/"+t),!1)}function ft(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function pt(t){window.location.hash=t}function ht(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}var lt,dt={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$route,u=o._routerViewCache||(o._routerViewCache={}),c=0,s=!1;o;)o.$vnode&&o.$vnode.data.routerView&&c++,o._inactive&&(s=!0),o=o.$parent;i.routerViewDepth=c;var f=a.matched[c];if(!f)return t();var p=n.name,h=s?u[p]:u[p]=f.components[p];if(!s){var l=i.hook||(i.hook={});l.init=function(t){f.instances[p]=t.child},l.prepatch=function(t,e){f.instances[p]=e.child},l.destroy=function(t){f.instances[p]===t.child&&(f.instances[p]=void 0)}}return t(h,i,r)}},yt=encodeURIComponent,vt=decodeURIComponent,mt=c(null,{path:"/"}),gt=/\/$/,wt=[String,Object],bt={name:"router-link",props:{to:{type:wt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String},render:function(t){var e=this,n=this.$router,r=this.$route,o=y(this.to,r,this.append),i=n.match(o,r),a=i.redirectedFrom||i.fullPath,u=n.history.base,s=m(u,a,n.mode),f={},h=this.activeClass||n.options.linkActiveClass||"router-link-active",d=o.path?c(null,o):i;f[h]=this.exact?p(r,d):l(r,d);var g={click:function(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||0!==t.button)){var r=t.target.getAttribute("target");/\b_blank\b/i.test(r)||(t.preventDefault(),e.replace?n.replace(o):n.push(o))}}},w={class:f};if("a"===this.tag)w.on=g,w.attrs={href:s};else{var b=v(this.$slots.default);if(b){b.isStatic=!1;var x=lt.util.extend,k=b.data=x({},b.data);k.on=g;var O=b.data.attrs=x({},b.data.attrs);O.href=s}else w.on=g}return t(this.tag,w,this.$slots.default)}},xt=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},kt=xt,Ot=q,Et=w,jt=b,Rt=O,At=T,$t=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");Ot.parse=Et,Ot.compile=jt,Ot.tokensToFunction=Rt,Ot.tokensToRegExp=At;var _t=Object.create(null),St=Object.create(null),Tt=Object.create(null),qt="undefined"!=typeof window,Ct=qt&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Pt=function(t,e){this.router=t,this.base=I(e),this.current=mt,this.pending=null};Pt.prototype.listen=function(t){this.cb=t},Pt.prototype.transitionTo=function(t,e){var n=this,r=this.router.match(t,this.current);this.confirmTransition(r,function(){n.updateRoute(r),e&&e(r),n.ensureURL()})},Pt.prototype.confirmTransition=function(t,e){var n=this,r=this.current;if(p(t,r))return void this.ensureURL();var o=D(this.current.matched,t.matched),i=o.deactivated,a=o.activated,u=[].concat(N(i),this.router.beforeHooks,a.map(function(t){return t.beforeEnter}),G(a));this.pending=t;var c=function(e,o){n.pending===t&&e(t,r,function(t){t===!1?n.ensureURL(!0):"string"==typeof t||"object"==typeof t?n.push(t):o(t)})};F(u,c,function(){var r=[],o=X(a,r,function(){return n.current===t});F(o,c,function(){n.pending===t&&(n.pending=null,e(t),n.router.app.$nextTick(function(){r.forEach(function(t){return t()})}))})})},Pt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var Ut=Object.create(null),Lt=function(){return String(Date.now())},Vt=Lt(),Mt=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;window.addEventListener("popstate",function(t){Vt=t.state&&t.state.key;var e=r.current;r.transitionTo(at(r.base),function(t){o&&r.handleScroll(t,e,!0)})}),o&&window.addEventListener("scroll",function(){tt(Vt)})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t){var e=this,r=this.current;this.transitionTo(t,function(t){ut(n(e.base+t.fullPath)),e.handleScroll(t,r,!1)})},e.prototype.replace=function(t){var e=this,r=this.current;this.transitionTo(t,function(t){ct(n(e.base+t.fullPath)),e.handleScroll(t,r,!1)})},e.prototype.ensureURL=function(t){if(at(this.base)!==this.current.fullPath){var e=n(this.base+this.current.fullPath);t?ut(e):ct(e)}},e.prototype.handleScroll=function(t,e,n){var o=this.router;if(o.app){var i=o.options.scrollBehavior;i&&(r("function"==typeof i,"scrollBehavior must be a function"),o.app.$nextTick(function(){var r=et(Vt),o=i(t,e,n?r:null);if(o){var a="object"==typeof o;if(a&&"string"==typeof o.selector){var u=document.querySelector(o.selector);u?r=nt(u):rt(o)&&(r=ot(o))}else a&&rt(o)&&(r=ot(o));r&&window.scrollTo(r.x,r.y)}}))}},e}(Pt),Bt=function(t){function e(e,n,r){t.call(this,e,n),r&&this.checkFallback()||st()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.checkFallback=function(){var t=at(this.base);if(!/^\/#/.test(t))return window.location.replace(n(this.base+"/#"+t)),!0},e.prototype.onHashChange=function(){st()&&this.transitionTo(ft(),function(t){ht(t.fullPath)})},e.prototype.push=function(t){this.transitionTo(t,function(t){pt(t.fullPath)})},e.prototype.replace=function(t){this.transitionTo(t,function(t){ht(t.fullPath)})},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ft()!==e&&(t?pt(e):ht(e))},e}(Pt),Ht=function(t){function e(e){t.call(this,e),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t){var e=this;this.transitionTo(t,function(t){e.stack=e.stack.slice(0,e.index+1).concat(t),e.index++})},e.prototype.replace=function(t){var e=this;this.transitionTo(t,function(t){e.stack=e.stack.slice(0,e.index).concat(t)})},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.ensureURL=function(){},e}(Pt),zt=function(t){void 0===t&&(t={}),this.app=null,this.options=t,this.beforeHooks=[],this.afterHooks=[],this.match=L(t.routes||[]);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Ct,this.fallback&&(e="hash"),qt||(e="abstract"),this.mode=e,e){case"history":this.history=new Mt(this,t.base);break;case"hash":this.history=new Bt(this,t.base,this.fallback);break;case"abstract":this.history=new Ht(this);break;default:r(!1,"invalid mode: "+e)}},Ft={currentRoute:{}};return Ft.currentRoute.get=function(){return this.history&&this.history.current},zt.prototype.init=function(t){var e=this;r(g.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.app=t;var n=this.history;n instanceof Mt?n.transitionTo(at(n.base)):n instanceof Bt&&n.transitionTo(ft(),function(){window.addEventListener("hashchange",function(){n.onHashChange()})}),n.listen(function(t){e.app._route=t})},zt.prototype.beforeEach=function(t){this.beforeHooks.push(t)},zt.prototype.afterEach=function(t){this.afterHooks.push(t)},zt.prototype.push=function(t){this.history.push(t)},zt.prototype.replace=function(t){this.history.replace(t)},zt.prototype.go=function(t){this.history.go(t)},zt.prototype.back=function(){this.go(-1)},zt.prototype.forward=function(){this.go(1)},zt.prototype.getMatchedComponents=function(){return this.currentRoute?[].concat.apply([],this.currentRoute.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Object.defineProperties(zt.prototype,Ft),zt.install=g,qt&&window.Vue&&window.Vue.use(zt),zt});
{
"name": "vue-router",
"version": "2.0.2",
"version": "2.0.3",
"description": "Official router for Vue.js 2.0",

@@ -5,0 +5,0 @@ "author": "Evan You",

@@ -17,2 +17,6 @@ /* @flow */

const regexpParamsCache: {
[key: string]: Array<string>
} = Object.create(null)
const regexpCompileCache: {

@@ -35,2 +39,3 @@ [key: string]: Function

const record = nameMap[name]
const paramNames = getParams(record.path)

@@ -43,3 +48,3 @@ if (typeof location.params !== 'object') {

for (const key in currentRoute.params) {
if (!(key in location.params)) {
if (!(key in location.params) && paramNames.indexOf(key) > -1) {
location.params[key] = currentRoute.params[key]

@@ -156,9 +161,6 @@ }

function matchRoute (
path: string,
params: Object,
pathname: string
): boolean {
function getRouteRegex (path: string): Object {
const hit = regexpCache[path]
let keys, regexp
const hit = regexpCache[path]
if (hit) {

@@ -172,2 +174,12 @@ keys = hit.keys

}
return { keys, regexp }
}
function matchRoute (
path: string,
params: Object,
pathname: string
): boolean {
const { regexp, keys } = getRouteRegex(path)
const m = pathname.match(regexp)

@@ -206,4 +218,9 @@

function getParams (path: string): Array<string> {
return regexpParamsCache[path] ||
(regexpParamsCache[path] = getRouteRegex(path).keys.map(key => key.name))
}
function resolveRecordPath (path: string, record: RouteRecord): string {
return resolvePath(path, record.parent ? record.parent.path : '/', true)
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc