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 0.7.6 to 0.7.7

lib/dsl.js

4

dist/vue-router.min.js
/*!
* vue-router v0.7.6
* vue-router v0.7.7
* (c) 2015 Evan You
* Released under the MIT License.
*/
!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){this.path=t,this.matcher=e,this.delegate=n}function e(t){this.routes={},this.children={},this.target=t}function n(e,r,o){return function(i,a){var s=e+i;return a?void a(n(s,r,o)):new t(e+i,r,o)}}function r(t,e,n){for(var r=0,o=0,i=t.length;i>o;o++)r+=t[o].path.length;e=e.substr(r);var a={path:e,handler:n};t.push(a)}function o(t,e,n,i){var a=e.routes;for(var s in a)if(a.hasOwnProperty(s)){var h=t.slice();r(h,s,a[s]),e.children[s]?o(h,e.children[s],n,i):n.call(i,h)}}function i(t,r){var i=new e;t(n("",i,this.delegate)),o([],i,function(t){r?r(this,t):this.add(t)},this)}function a(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t){this.string=t}function h(t){this.name=t}function c(t){this.name=t}function u(){}function l(t,e,n){"/"===t.charAt(0)&&(t=t.substr(1));var r=t.split("/"),o=[];n.val="";for(var i=0,a=r.length;a>i;i++){var l,p=r[i];(l=p.match(/^:([^\/]+)$/))?(o.push(new h(l[1])),e.push(l[1]),n.val+="3"):(l=p.match(/^\*([^\/]+)$/))?(o.push(new c(l[1])),n.val+="2",e.push(l[1])):""===p?(o.push(new u),n.val+="1"):(o.push(new s(p)),n.val+="4")}return n.val=+n.val,o}function p(t){this.charSpec=t,this.nextStates=[]}function f(t){return t.sort(function(t,e){return e.specificity.val-t.specificity.val})}function d(t,e){for(var n=[],r=0,o=t.length;o>r;r++){var i=t[r];n=n.concat(i.match(e))}return n}function v(t){this.queryParams=t||{}}function g(t,e,n){for(var r=t.handlers,o=t.regex,i=e.match(o),a=1,s=new v(n),h=0,c=r.length;c>h;h++){for(var u=r[h],l=u.names,p={},f=0,d=l.length;d>f;f++)p[l[f]]=i[a++];s.push({handler:u.handler,params:p,isDynamic:!!l.length})}return s}function y(t,e){return e.eachChar(function(e){t=t.put(e)}),t}function m(t){return t=t.replace(/\+/gm,"%20"),decodeURIComponent(t)}function _(t){window.console&&(console.warn("[vue-router] "+t),(!U.Vue||U.Vue.config.debug)&&console.warn(new Error("warning stack trace:").stack))}function w(t,e,n){var r=t.match(/(\?.*)$/);if(r&&(r=r[1],t=t.slice(0,-r.length)),"?"===e.charAt(0))return t+e;var o=t.split("/");n&&o[o.length-1]||o.pop();for(var i=e.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];"."!==s&&(".."===s?o.pop():o.push(s))}return""!==o[0]&&o.unshift(""),o.join("/")}function b(t){return t&&"function"==typeof t.then}function C(t,e){var n=t&&(t.$options||t.options);return n&&n.route&&n.route[e]}function R(t,e){B?B.$options.components._=t.component:B={resolve:U.Vue.prototype._resolveComponent,$options:{components:{_:t.component}}},B.resolve("_",function(n){t.component=n,e(n)})}function $(t,e,n){return void 0===e&&(e={}),t=t.replace(/:([^\/]+)/g,function(n,r){var o=e[r];return o||_('param "'+r+'" not found when generating path for "'+t+'" with params '+JSON.stringify(e)),o||""}),n&&(t+=I(n)),t}function x(t,e,n){var r=t.childVM;if(!r||!e)return!1;if(t.Component!==e.component)return!1;var o=C(r,"canReuse");return"boolean"==typeof o?o:o?o.call(r,{to:n.to,from:n.from}):!0}function A(t,e,n){var r=t.childVM,o=C(r,"canDeactivate");o?e.callHook(o,r,n,{expectBoolean:!0}):n()}function E(t,e,n){R(t,function(t){if(!e.aborted){var r=C(t,"canActivate");r?e.callHook(r,null,n,{expectBoolean:!0}):n()}})}function k(t,e,n){var r=t.childVM,o=C(r,"deactivate");o?e.callHooks(o,r,n):n()}function S(t,e,n,r,o){var i=e.activateQueue[n];if(!i)return t._bound&&t.setComponent(null),void(r&&r());var a=t.Component=i.component,s=C(a,"activate"),h=C(a,"data"),c=C(a,"waitForData");t.depth=n,t.activated=!1;var u=void 0,l=!(!h||c);if(o=o&&t.childVM&&t.childVM.constructor===a)u=t.childVM,u.$loadingRouteData=l;else{if(t.unbuild(!0),t.keepAlive){var p=e.router._views,f=p.indexOf(t);f>0&&(e.router._views=p.slice(f),t.childVM&&(t.childVM._routerViews=p.slice(0,f)))}if(u=t.build({_meta:{$loadingRouteData:l}}),t.keepAlive){u.$loadingRouteData=l;var d=u._routerViews;d&&(e.router._views=d.concat(e.router._views),t.childView=d[d.length-1],u._routerViews=null)}}var v=function(){u.$destroy()},g=function(){if(o)return void(r&&r());var n=e.router;n._rendered||n._transitionOnLoad?t.transition(u):(t.setCurrent?t.setCurrent(u):t.childVM=u,u.$before(t.anchor,null,!1)),r&&r()},y=function(){t.activated=!0,t.childView&&S(t.childView,e,n+1,null,o||t.keepAlive),h&&c?V(u,e,h,g,v):(h&&V(u,e,h),g())};s?e.callHooks(s,u,y,{cleanup:v}):y()}function P(t,e){var n=t.childVM,r=C(n,"data");r&&V(n,e,r)}function V(t,e,n,r,o){t.$loadingRouteData=!0,e.callHooks(n,t,function(e,n){Array.isArray(e)&&e._needMerge&&(e=e.reduce(function(t,e){return O(e)&&Object.keys(e).forEach(function(n){t[n]=e[n]}),t},Object.create(null)));var o=[];O(e)&&Object.keys(e).forEach(function(n){var r=e[n];b(r)?o.push(r.then(function(e){t.$set(n,e)})):t.$set(n,r)}),o.length?o[0].constructor.all(o).then(function(e){t.$loadingRouteData=!1,r&&r()},n):(t.$loadingRouteData=!1,r&&r())},{cleanup:o,expectData:!0})}function O(t){return"[object Object]"===Object.prototype.toString.call(t)}function T(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){var e=t.util,n=t.prototype._init;t.prototype._init=function(t){var r=t._parent||t.parent||this,o=r.$route;o&&(o.router._children.push(this),this.$route||(this._defineMeta?this._defineMeta("$route",o):e.defineReactive(this,"$route",o))),n.call(this,t)};var r=t.prototype._destroy;t.prototype._destroy=function(){if(!this._isBeingDestroyed){var t=this.$root.$route;t&&t.router._children.$remove(this),r.apply(this,arguments)}};var o=t.config.optionMergeStrategies,i=/^(data|activate|deactivate)$/;o&&(o.route=function(t,n){if(!n)return t;if(!t)return n;var r={};e.extend(r,t);for(var o in n){var a=r[o],s=n[o];a&&i.test(o)?r[o]=(e.isArray(a)?a:[a]).concat(s):r[o]=s}return r})}function H(t){var e=t.util,n=t.directive("_component")||t.internalDirectives.component,r=e.extend({},n);e.extend(r,{_isRouterView:!0,bind:function(){var t=this.vm.$route;if(!t)return void _("<router-view> can only be used inside a router-enabled app.");this._isDynamicLiteral=!0,n.bind.call(this);var e=this.router=t.router;e._views.unshift(this);var r=e._views[1];r&&(r.childView=this);var o=t.router._currentTransition;if(!r&&o.done||r&&r.activated){var i=r?r.depth+1:0;S(this,o,i)}},unbind:function(){this.router._views.$remove(this),n.unbind.call(this)}}),t.elementDirective("router-view",r)}function Q(t){function e(t){return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port}var n=t.util;t.directive("link",{bind:function(){var t=this,r=this.vm;if(!r.$route)return void _("v-link can only be used inside a router-enabled app.");var o=r.$route.router;this.handler=function(n){if(!(n.metaKey||n.ctrlKey||n.shiftKey||n.defaultPrevented||0!==n.button)){var r=t.target,i=function(t){n.preventDefault(),null!=t&&o.go(t)};if("A"===t.el.tagName||n.target===t.el)i(r);else{for(var a=n.target;a&&"A"!==a.tagName&&a!==t.el;)a=a.parentNode;if(!a)return;"A"===a.tagName&&a.href?e(a)&&i({path:a.pathname,replace:r&&r.replace,append:r&&r.append}):i(r)}}},this.el.addEventListener("click",this.handler),this.unwatch=r.$watch("$route.path",n.bind(this.updateClasses,this))},update:function(t){var e=this.vm.$route.router,r=void 0;this.target=t,n.isObject(t)&&(r=t.append,this.exact=t.exact,this.prevActiveClass=this.activeClass,this.activeClass=t.activeClass),t=this.path=e._stringifyPath(t),this.activeRE=t&&!this.exact?new RegExp("^"+t.replace(/\/$/,"").replace(tt,"\\$&")+"(\\/|$)"):null,this.updateClasses(this.vm.$route.path);var o="/"===t.charAt(0),i=t&&("hash"===e.mode||o)?e.history.formatPath(t,r):t;"A"===this.el.tagName&&(i?this.el.href=i:this.el.removeAttribute("href"))},updateClasses:function(t){var e=this.el,r=this.path,o=this.vm.$route.router,i=this.activeClass||o._linkActiveClass;this.prevActiveClass!==i&&n.removeClass(e,this.prevActiveClass),t=t.replace(/\?.*$/,""),this.exact?r===t||"/"!==r.charAt(r.length-1)&&r===t.replace(Z,"")?n.addClass(e,i):n.removeClass(e,i):this.activeRE&&this.activeRE.test(t)?n.addClass(e,i):n.removeClass(e,i)},unbind:function(){this.el.removeEventListener("click",this.handler),this.unwatch&&this.unwatch()}})}function q(t,e){var n=e.component;nt.util.isPlainObject(n)&&(n=e.component=nt.extend(n)),"function"!=typeof n&&(e.component=null,_('invalid component for route "'+t+'".'))}var D={};D.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.prototype={to:function(t,e){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),e){if(0===e.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,e,this.delegate)}return this}},e.prototype={add:function(t,e){this.routes[t]=e},addChild:function(t,r,o,i){var a=new e(r);this.children[t]=a;var s=n(t,a,i);i&&i.contextEntered&&i.contextEntered(r,s),o(s)}};var M=["/",".","*","+","?","|","(",")","[","]","{","}","\\"],z=new RegExp("(\\"+M.join("|\\")+")","g");s.prototype={eachChar:function(t){for(var e,n=this.string,r=0,o=n.length;o>r;r++)e=n.charAt(r),t({validChars:e})},regex:function(){return this.string.replace(z,"\\$1")},generate:function(){return this.string}},h.prototype={eachChar:function(t){t({invalidChars:"/",repeat:!0})},regex:function(){return"([^/]+)"},generate:function(t){return t[this.name]}},c.prototype={eachChar:function(t){t({invalidChars:"",repeat:!0})},regex:function(){return"(.+)"},generate:function(t){return t[this.name]}},u.prototype={eachChar:function(){},regex:function(){return""},generate:function(){return""}},p.prototype={get:function(t){for(var e=this.nextStates,n=0,r=e.length;r>n;n++){var o=e[n],i=o.charSpec.validChars===t.validChars;if(i=i&&o.charSpec.invalidChars===t.invalidChars)return o}},put:function(t){var e;return(e=this.get(t))?e:(e=new p(t),this.nextStates.push(e),t.repeat&&e.nextStates.push(e),e)},match:function(t){for(var e,n,r,o=this.nextStates,i=[],a=0,s=o.length;s>a;a++)e=o[a],n=e.charSpec,"undefined"!=typeof(r=n.validChars)?-1!==r.indexOf(t)&&i.push(e):"undefined"!=typeof(r=n.invalidChars)&&-1===r.indexOf(t)&&i.push(e);return i}};var F=Object.create||function(t){function e(){}return e.prototype=t,new e};v.prototype=F({splice:Array.prototype.splice,slice:Array.prototype.slice,push:Array.prototype.push,length:0,queryParams:null});var L=function(){this.rootState=new p,this.names={}};L.prototype={add:function(t,e){for(var n,r=this.rootState,o="^",i={},a=[],s=[],h=!0,c=0,p=t.length;p>c;c++){var f=t[c],d=[],v=l(f.path,d,i);s=s.concat(v);for(var g=0,m=v.length;m>g;g++){var _=v[g];_ instanceof u||(h=!1,r=r.put({validChars:"/"}),o+="/",r=y(r,_),o+=_.regex())}var w={handler:f.handler,names:d};a.push(w)}h&&(r=r.put({validChars:"/"}),o+="/"),r.handlers=a,r.regex=new RegExp(o+"$"),r.specificity=i,(n=e&&e.as)&&(this.names[n]={segments:s,handlers:a})},handlersFor:function(t){var e=this.names[t],n=[];if(!e)throw new Error("There is no route named "+t);for(var r=0,o=e.handlers.length;o>r;r++)n.push(e.handlers[r]);return n},hasRoute:function(t){return!!this.names[t]},generate:function(t,e){var n=this.names[t],r="";if(!n)throw new Error("There is no route named "+t);for(var o=n.segments,i=0,a=o.length;a>i;i++){var s=o[i];s instanceof u||(r+="/",r+=s.generate(e))}return"/"!==r.charAt(0)&&(r="/"+r),e&&e.queryParams&&(r+=this.generateQueryString(e.queryParams)),r},generateQueryString:function(t){var e=[],n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(r);n.sort();for(var o=0,i=n.length;i>o;o++){r=n[o];var s=t[r];if(null!=s){var h=encodeURIComponent(r);if(a(s))for(var c=0,u=s.length;u>c;c++){var l=r+"[]="+encodeURIComponent(s[c]);e.push(l)}else h+="="+encodeURIComponent(s),e.push(h)}}return 0===e.length?"":"?"+e.join("&")},parseQueryString:function(t){for(var e=t.split("&"),n={},r=0;r<e.length;r++){var o,i=e[r].split("="),a=m(i[0]),s=a.length,h=!1;1===i.length?o="true":(s>2&&"[]"===a.slice(s-2)&&(h=!0,a=a.slice(0,s-2),n[a]||(n[a]=[])),o=i[1]?m(i[1]):""),h?n[a].push(o):n[a]=o}return n},recognize:function(t){var e,n,r,o,i=[this.rootState],a={},s=!1;if(o=t.indexOf("?"),-1!==o){var h=t.substr(o+1,t.length);t=t.substr(0,o),a=this.parseQueryString(h)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),s=!0),n=0,r=t.length;r>n&&(i=d(i,t.charAt(n)),i.length);n++);var c=[];for(n=0,r=i.length;r>n;n++)i[n].handlers&&c.push(i[n]);i=f(c);var u=c[0];return u&&u.handlers?(s&&"(.+)$"===u.regex.source.slice(-5)&&(t+="/"),g(u,t,a)):void 0}},L.prototype.map=i,L.VERSION="0.1.9";var I=L.prototype.generateQueryString,U={},B=void 0,N=/#.*$/,G=function(){function t(e){var n=e.root,r=e.onChange;D.classCallCheck(this,t),n?("/"!==n.charAt(0)&&(n="/"+n),this.root=n.replace(/\/$/,""),this.rootRE=new RegExp("^\\"+this.root)):this.root=null,this.onChange=r;var o=document.querySelector("base");this.base=o&&o.getAttribute("href")}return t.prototype.start=function(){var t=this;this.listener=function(e){var n=decodeURI(location.pathname+location.search);t.root&&(n=n.replace(t.rootRE,"")),t.onChange(n,e&&e.state,location.hash)},window.addEventListener("popstate",this.listener),this.listener()},t.prototype.stop=function(){window.removeEventListener("popstate",this.listener)},t.prototype.go=function(t,e,n){var r=this.formatPath(t,n);e?history.replaceState({},"",r):(history.replaceState({pos:{x:window.pageXOffset,y:window.pageYOffset}},""),history.pushState({},"",r));var o=t.match(N),i=o&&o[0];t=r.replace(N,"").replace(this.rootRE,""),this.onChange(t,null,i)},t.prototype.formatPath=function(t,e){return"/"===t.charAt(0)?this.root?this.root+"/"+t.replace(/^\//,""):t:w(this.base||location.pathname,t,e)},t}(),K=function(){function t(e){var n=e.hashbang,r=e.onChange;D.classCallCheck(this,t),this.hashbang=n,this.onChange=r}return t.prototype.start=function(){var t=this;this.listener=function(){var e=location.hash,n=e.replace(/^#!?/,"");"/"!==n.charAt(0)&&(n="/"+n);var r=t.formatPath(n);if(r!==e)return void location.replace(r);var o=decodeURI(e.replace(/^#!?/,"")+location.search);t.onChange(o)},window.addEventListener("hashchange",this.listener),this.listener()},t.prototype.stop=function(){window.removeEventListener("hashchange",this.listener)},t.prototype.go=function(t,e,n){t=this.formatPath(t,n),e?location.replace(t):location.hash=t},t.prototype.formatPath=function(t,e){var n="/"===t.charAt(0),r="#"+(this.hashbang?"!":"");return n?r+t:r+w(location.hash.replace(/^#!?/,""),t,e)},t}(),X=function(){function t(e){var n=e.onChange;D.classCallCheck(this,t),this.onChange=n,this.currentPath="/"}return t.prototype.start=function(){this.onChange("/")},t.prototype.stop=function(){},t.prototype.go=function(t,e,n){t=this.currentPath=this.formatPath(t,n),this.onChange(t)},t.prototype.formatPath=function(t,e){return"/"===t.charAt(0)?t:w(this.currentPath,t,e)},t}(),Y=function(){function t(e,n,r){D.classCallCheck(this,t),this.router=e,this.to=n,this.from=r,this.next=null,this.aborted=!1,this.done=!1,this.deactivateQueue=e._views;var o=n.matched?Array.prototype.slice.call(n.matched):[];this.activateQueue=o.map(function(t){return t.handler})}return t.prototype.abort=function(){if(!this.aborted){this.aborted=!0;var t=!this.from.path&&"/"===this.to.path;t||this.router.replace(this.from.path||"/")}},t.prototype.redirect=function(t){this.aborted||(this.aborted=!0,"string"==typeof t?t=$(t,this.to.params,this.to.query):(t.params=this.to.params,t.query=this.to.query),this.router.replace(t))},t.prototype.start=function(t){var e=this,n=this.deactivateQueue,r=this.activateQueue,o=n.slice().reverse(),i=void 0,a=void 0;for(a=0;a<o.length&&x(o[a],r[a],e);a++);a>0&&(i=o.slice(0,a),n=o.slice(a).reverse(),r=r.slice(a)),e.runQueue(n,A,function(){e.runQueue(r,E,function(){e.runQueue(n,k,function(){if(e.router._onTransitionValidated(e),i&&i.forEach(function(t){P(t,e)}),n.length){var r=n[n.length-1],o=i?i.length:0;S(r,e,o,t)}else t()})})})},t.prototype.runQueue=function(t,e,n){function r(i){i>=t.length?n():e(t[i],o,function(){r(i+1)})}var o=this;r(0)},t.prototype.callHook=function(t,e,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=r.expectBoolean,i=void 0===o?!1:o,a=r.expectData,s=void 0===a?!1:a,h=r.cleanup,c=this,u=!1,l=function(){h&&h(),c.abort()},p=function(t){if(h?f():l(),t&&!c.router._suppress)throw _("Uncaught error during transition: "),t instanceof Error?t:new Error(t)},f=function(t){return u?void _("transition.next() should be called only once."):(u=!0,c.aborted?void(h&&h()):void(n&&n(t,p)))},d={to:c.to,from:c.from,abort:l,next:f,redirect:function(){c.redirect.apply(c,arguments)}},v=void 0;try{v=t.call(e,d)}catch(g){return p(g)}var y=b(v);i?"boolean"==typeof v?v?f():l():y?v.then(function(t){t?f():l()},p):t.length||f(v):y?v.then(f,p):(s&&T(v)||!t.length)&&f(v)},t.prototype.callHooks=function(t,e,n,r){var o=this;Array.isArray(t)?!function(){var i=[];i._needMerge=!0;var a=void 0;o.runQueue(t,function(t,n,a){o.aborted||o.callHook(t,e,function(t,e){t&&i.push(t),e=e,a()},r)},function(){n(i,a)})}():this.callHook(t,e,n,r)},t}(),J=/^(component|subRoutes)$/,W=function ot(t,e){var n=this;D.classCallCheck(this,ot);var r=e._recognizer.recognize(t);r&&([].forEach.call(r,function(t){for(var e in t.handler)J.test(e)||(n[e]=t.handler[e])}),this.query=r.queryParams,this.params=[].reduce.call(r,function(t,e){if(e.params)for(var n in e.params)t[n]=e.params[n];return t},{})),this.path=t,this.router=e,this.matched=r||e._notFoundHandler,Object.freeze(this)},Z=/\/$/,tt=/[-.*+?^${}()|[\]\/\\]/g,et={"abstract":X,hash:K,html5:G},nt=void 0,rt=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.hashbang,r=void 0===n?!0:n,o=e["abstract"],i=void 0===o?!1:o,a=e.history,s=void 0===a?!1:a,h=e.saveScrollPosition,c=void 0===h?!1:h,u=e.transitionOnLoad,l=void 0===u?!1:u,p=e.suppressTransitionError,f=void 0===p?!1:p,d=e.root,v=void 0===d?null:d,g=e.linkActiveClass,y=void 0===g?"v-link-active":g;if(D.classCallCheck(this,t),!t.installed)throw new Error("Please install the Router with Vue.use() before creating an instance.");this.app=null,this._views=[],this._children=[],this._recognizer=new L,this._guardRecognizer=new L,this._started=!1,this._startCb=null,this._currentRoute={},this._currentTransition=null,this._previousTransition=null,this._notFoundHandler=null,this._notFoundRedirect=null,this._beforeEachHooks=[],this._afterEachHooks=[],this._hasPushState="undefined"!=typeof window&&window.history&&window.history.pushState,this._rendered=!1,this._transitionOnLoad=l,this._abstract=i,this._hashbang=r,this._history=this._hasPushState&&s,this._saveScrollPosition=c,this._linkActiveClass=y,this._suppress=f;var m=nt.util.inBrowser;this.mode=!m||this._abstract?"abstract":this._history?"html5":"hash";var _=et[this.mode],w=this;this.history=new _({root:v,hashbang:this._hashbang,onChange:function(t,e,n){w._match(t,e,n)}})}return t.prototype.map=function(t){for(var e in t)this.on(e,t[e])},t.prototype.on=function(t,e){"*"===t?this._notFound(e):this._addRoute(t,e,[])},t.prototype.redirect=function(t){for(var e in t)this._addRedirect(e,t[e])},t.prototype.alias=function(t){for(var e in t)this._addAlias(e,t[e])},t.prototype.beforeEach=function(t){this._beforeEachHooks.push(t)},t.prototype.afterEach=function(t){this._afterEachHooks.push(t)},t.prototype.go=function(t){var e=!1,n=!1;nt.util.isObject(t)&&(e=t.replace,n=t.append),t=this._stringifyPath(t),t&&this.history.go(t,e,n)},t.prototype.replace=function(t){"string"==typeof t&&(t={path:t}),t.replace=!0,this.go(t)},t.prototype.start=function(t,e,n){if(this._started)return void _("already started.");if(this._started=!0,this._startCb=n,!this.app){if(!t||!e)throw new Error("Must start vue-router with a component and a root container.");this._appContainer=e;var r=this._appConstructor="function"==typeof t?t:nt.extend(t);r.options.name=r.options.name||"RouterApp"}this.history.start()},t.prototype.stop=function(){this.history.stop(),this._started=!1},t.prototype._addRoute=function(t,e,n){if(q(t,e),e.path=t,e.fullPath=(n.reduce(function(t,e){return t+e.path},"")+t).replace("//","/"),n.push({path:t,handler:e}),this._recognizer.add(n,{as:e.name}),e.subRoutes)for(var r in e.subRoutes)this._addRoute(r,e.subRoutes[r],n.slice())},t.prototype._notFound=function(t){q("*",t),this._notFoundHandler=[{handler:t}]},t.prototype._addRedirect=function(t,e){"*"===t?this._notFoundRedirect=e:this._addGuard(t,e,this.replace)},t.prototype._addAlias=function(t,e){this._addGuard(t,e,this._match)},t.prototype._addGuard=function(t,e,n){var r=this;this._guardRecognizer.add([{path:t,handler:function(t,o){var i=$(e,t.params,o);n.call(r,i)}}])},t.prototype._checkGuard=function(t){var e=this._guardRecognizer.recognize(t);return e?(e[0].handler(e[0],e.queryParams),!0):this._notFoundRedirect&&(e=this._recognizer.recognize(t),!e)?(this.replace(this._notFoundRedirect),!0):void 0},t.prototype._match=function(t,e,n){var r=this;if(!this._checkGuard(t)){var o=this._currentRoute,i=this._currentTransition;if(i){if(i.to.path===t)return;if(o.path===t)return i.aborted=!0,void(this._currentTransition=this._prevTransition);i.aborted=!0}var a=new W(t,this),s=new Y(this,a,o);this._prevTransition=i,this._currentTransition=s,this.app||(this.app=new this._appConstructor({el:this._appContainer,_meta:{$route:a}}));var h=this._beforeEachHooks,c=function(){s.start(function(){r._postTransition(a,e,n)})};h.length?s.runQueue(h,function(t,e,n){s===r._currentTransition&&s.callHook(t,null,n,{expectBoolean:!0})},c):c(),!this._rendered&&this._startCb&&this._startCb.call(null),this._rendered=!0}},t.prototype._onTransitionValidated=function(t){var e=this._currentRoute=t.to;this.app.$route!==e&&(this.app.$route=e,this._children.forEach(function(t){t.$route=e})),this._afterEachHooks.length&&this._afterEachHooks.forEach(function(e){return e.call(null,{to:t.to,from:t.from})}),this._currentTransition.done=!0},t.prototype._postTransition=function(t,e,n){var r=e&&e.pos;r&&this._saveScrollPosition?nt.nextTick(function(){window.scrollTo(r.x,r.y)}):n&&nt.nextTick(function(){var t=document.getElementById(n.slice(1));t&&window.scrollTo(window.scrollX,t.offsetTop)})},t.prototype._stringifyPath=function(t){if(t&&"object"==typeof t){if(t.name){var e=t.params||{};return t.query&&(e.queryParams=t.query),this._recognizer.generate(t.name,e)}if(t.path){var n=t.path;if(t.query){var r=this._recognizer.generateQueryString(t.query);n+=n.indexOf("?")>-1?"&"+r.slice(1):r}return n}return""}return t?t+"":""},t}();return rt.installed=!1,rt.install=function(t){return rt.installed?void _("already installed."):(nt=t,j(nt),H(nt),Q(nt),U.Vue=nt,void(rt.installed=!0))},"undefined"!=typeof window&&window.Vue&&window.Vue.use(rt),rt});
!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){this.path=t,this.matcher=e,this.delegate=n}function e(t){this.routes={},this.children={},this.target=t}function n(e,r,o){return function(i,a){var s=e+i;return a?void a(n(s,r,o)):new t(e+i,r,o)}}function r(t,e,n){for(var r=0,o=0,i=t.length;i>o;o++)r+=t[o].path.length;e=e.substr(r);var a={path:e,handler:n};t.push(a)}function o(t,e,n,i){var a=e.routes;for(var s in a)if(a.hasOwnProperty(s)){var h=t.slice();r(h,s,a[s]),e.children[s]?o(h,e.children[s],n,i):n.call(i,h)}}function i(t,r){var i=new e;t(n("",i,this.delegate)),o([],i,function(t){r?r(this,t):this.add(t)},this)}function a(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t){this.string=t}function h(t){this.name=t}function c(t){this.name=t}function u(){}function l(t,e,n){"/"===t.charAt(0)&&(t=t.substr(1));var r=t.split("/"),o=[];n.val="";for(var i=0,a=r.length;a>i;i++){var l,p=r[i];(l=p.match(/^:([^\/]+)$/))?(o.push(new h(l[1])),e.push(l[1]),n.val+="3"):(l=p.match(/^\*([^\/]+)$/))?(o.push(new c(l[1])),n.val+="2",e.push(l[1])):""===p?(o.push(new u),n.val+="1"):(o.push(new s(p)),n.val+="4")}return n.val=+n.val,o}function p(t){this.charSpec=t,this.nextStates=[]}function f(t){return t.sort(function(t,e){return e.specificity.val-t.specificity.val})}function d(t,e){for(var n=[],r=0,o=t.length;o>r;r++){var i=t[r];n=n.concat(i.match(e))}return n}function v(t){this.queryParams=t||{}}function g(t,e,n){for(var r=t.handlers,o=t.regex,i=e.match(o),a=1,s=new v(n),h=0,c=r.length;c>h;h++){for(var u=r[h],l=u.names,p={},f=0,d=l.length;d>f;f++)p[l[f]]=i[a++];s.push({handler:u.handler,params:p,isDynamic:!!l.length})}return s}function y(t,e){return e.eachChar(function(e){t=t.put(e)}),t}function m(t){return t=t.replace(/\+/gm,"%20"),decodeURIComponent(t)}function _(t){window.console&&(console.warn("[vue-router] "+t),(!N.Vue||N.Vue.config.debug)&&console.warn(new Error("warning stack trace:").stack))}function w(t,e,n){var r=t.match(/(\?.*)$/);if(r&&(r=r[1],t=t.slice(0,-r.length)),"?"===e.charAt(0))return t+e;var o=t.split("/");n&&o[o.length-1]||o.pop();for(var i=e.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];"."!==s&&(".."===s?o.pop():o.push(s))}return""!==o[0]&&o.unshift(""),o.join("/")}function b(t){return t&&"function"==typeof t.then}function C(t,e){var n=t&&(t.$options||t.options);return n&&n.route&&n.route[e]}function R(t,e){U?U.$options.components._=t.component:U={resolve:N.Vue.prototype._resolveComponent,$options:{components:{_:t.component}}},U.resolve("_",function(n){t.component=n,e(n)})}function x(t,e,n){return void 0===e&&(e={}),t=t.replace(/:([^\/]+)/g,function(n,r){var o=e[r];return o||_('param "'+r+'" not found when generating path for "'+t+'" with params '+JSON.stringify(e)),o||""}),n&&(t+=I(n)),t}function $(t,e,n){var r=t.childVM;if(!r||!e)return!1;if(t.Component!==e.component)return!1;var o=C(r,"canReuse");return"boolean"==typeof o?o:o?o.call(r,{to:n.to,from:n.from}):!0}function A(t,e,n){var r=t.childVM,o=C(r,"canDeactivate");o?e.callHook(o,r,n,{expectBoolean:!0}):n()}function E(t,e,n){R(t,function(t){if(!e.aborted){var r=C(t,"canActivate");r?e.callHook(r,null,n,{expectBoolean:!0}):n()}})}function k(t,e,n){var r=t.childVM,o=C(r,"deactivate");o?e.callHooks(o,r,n):n()}function S(t,e,n,r,o){var i=e.activateQueue[n];if(!i)return t._bound&&t.setComponent(null),void(r&&r());var a=t.Component=i.component,s=C(a,"activate"),h=C(a,"data"),c=C(a,"waitForData");t.depth=n,t.activated=!1;var u=void 0,l=!(!h||c);if(o=o&&t.childVM&&t.childVM.constructor===a)u=t.childVM,u.$loadingRouteData=l;else{if(t.unbuild(!0),t.keepAlive){var p=e.router._views,f=p.indexOf(t);f>0&&(e.router._views=p.slice(f),t.childVM&&(t.childVM._routerViews=p.slice(0,f)))}if(u=t.build({_meta:{$loadingRouteData:l}}),t.keepAlive){u.$loadingRouteData=l;var d=u._routerViews;d&&(e.router._views=d.concat(e.router._views),t.childView=d[d.length-1],u._routerViews=null)}}var v=function(){u.$destroy()},g=function(){if(o)return void(r&&r());var n=e.router;n._rendered||n._transitionOnLoad?t.transition(u):(t.setCurrent?t.setCurrent(u):t.childVM=u,u.$before(t.anchor,null,!1)),r&&r()},y=function(){t.activated=!0,t.childView&&S(t.childView,e,n+1,null,o||t.keepAlive),h&&c?V(u,e,h,g,v):(h&&V(u,e,h),g())};s?e.callHooks(s,u,y,{cleanup:v}):y()}function P(t,e){var n=t.childVM,r=C(n,"data");r&&V(n,e,r)}function V(t,e,n,r,o){t.$loadingRouteData=!0,e.callHooks(n,t,function(e,n){Array.isArray(e)&&e._needMerge&&(e=e.reduce(function(t,e){return O(e)&&Object.keys(e).forEach(function(n){t[n]=e[n]}),t},Object.create(null)));var o=[];O(e)&&Object.keys(e).forEach(function(n){var r=e[n];b(r)?o.push(r.then(function(e){t.$set(n,e)})):t.$set(n,r)}),o.length?o[0].constructor.all(o).then(function(e){t.$loadingRouteData=!1,r&&r()},n):(t.$loadingRouteData=!1,r&&r())},{cleanup:o,expectData:!0})}function O(t){return"[object Object]"===Object.prototype.toString.call(t)}function T(t){return"[object Object]"===Object.prototype.toString.call(t)}function j(t){var e=t.util,n=t.prototype._init;t.prototype._init=function(t){var r=t._parent||t.parent||this,o=r.$route;o&&(o.router._children.push(this),this.$route||(this._defineMeta?this._defineMeta("$route",o):e.defineReactive(this,"$route",o))),n.call(this,t)};var r=t.prototype._destroy;t.prototype._destroy=function(){if(!this._isBeingDestroyed){var t=this.$root.$route;t&&t.router._children.$remove(this),r.apply(this,arguments)}};var o=t.config.optionMergeStrategies,i=/^(data|activate|deactivate)$/;o&&(o.route=function(t,n){if(!n)return t;if(!t)return n;var r={};e.extend(r,t);for(var o in n){var a=r[o],s=n[o];a&&i.test(o)?r[o]=(e.isArray(a)?a:[a]).concat(s):r[o]=s}return r})}function H(t){var e=t.util,n=t.directive("_component")||t.internalDirectives.component,r=e.extend({},n);e.extend(r,{_isRouterView:!0,bind:function(){var t=this.vm.$route;if(!t)return void _("<router-view> can only be used inside a router-enabled app.");this._isDynamicLiteral=!0,n.bind.call(this);var e=this.router=t.router;e._views.unshift(this);var r=e._views[1];r&&(r.childView=this);var o=t.router._currentTransition;if(!r&&o.done||r&&r.activated){var i=r?r.depth+1:0;S(this,o,i)}},unbind:function(){this.router._views.$remove(this),n.unbind.call(this)}}),t.elementDirective("router-view",r)}function q(t){function e(t){return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port}var n=t.util;t.directive("link",{bind:function(){var t=this,r=this.vm;if(!r.$route)return void _("v-link can only be used inside a router-enabled app.");if("A"!==this.el.tagName||"_blank"!==this.el.getAttribute("target")){var o=r.$route.router;this.handler=function(n){if(!(n.metaKey||n.ctrlKey||n.shiftKey||n.defaultPrevented||0!==n.button)){var r=t.target,i=function(t){n.preventDefault(),null!=t&&o.go(t)};if("A"===t.el.tagName||n.target===t.el)i(r);else{for(var a=n.target;a&&"A"!==a.tagName&&a!==t.el;)a=a.parentNode;if(!a)return;"A"===a.tagName&&a.href?e(a)&&i({path:a.pathname,replace:r&&r.replace,append:r&&r.append}):i(r)}}},this.el.addEventListener("click",this.handler),this.unwatch=r.$watch("$route.path",n.bind(this.updateClasses,this))}},update:function(t){var e=this.vm.$route.router,r=void 0;this.target=t,n.isObject(t)&&(r=t.append,this.exact=t.exact,this.prevActiveClass=this.activeClass,this.activeClass=t.activeClass),t=this.path=e._stringifyPath(t),this.activeRE=t&&!this.exact?new RegExp("^"+t.replace(/\/$/,"").replace(tt,"\\$&")+"(\\/|$)"):null,this.updateClasses(this.vm.$route.path);var o="/"===t.charAt(0),i=t&&("hash"===e.mode||o)?e.history.formatPath(t,r):t;"A"===this.el.tagName&&(i?this.el.href=i:this.el.removeAttribute("href"))},updateClasses:function(t){var e=this.el,r=this.vm.$route.router,o=this.activeClass||r._linkActiveClass;this.prevActiveClass!==o&&n.removeClass(e,this.prevActiveClass);var i=this.path.replace(et,"");t=t.replace(et,""),this.exact?i===t||"/"!==i.charAt(i.length-1)&&i===t.replace(Z,"")?n.addClass(e,o):n.removeClass(e,o):this.activeRE&&this.activeRE.test(t)?n.addClass(e,o):n.removeClass(e,o)},unbind:function(){this.el.removeEventListener("click",this.handler),this.unwatch&&this.unwatch()}})}function Q(t,e){var n=e.component;rt.util.isPlainObject(n)&&(n=e.component=rt.extend(n)),"function"!=typeof n&&(e.component=null,_('invalid component for route "'+t+'".'))}var D={};D.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.prototype={to:function(t,e){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),e){if(0===e.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,e,this.delegate)}return this}},e.prototype={add:function(t,e){this.routes[t]=e},addChild:function(t,r,o,i){var a=new e(r);this.children[t]=a;var s=n(t,a,i);i&&i.contextEntered&&i.contextEntered(r,s),o(s)}};var M=["/",".","*","+","?","|","(",")","[","]","{","}","\\"],z=new RegExp("(\\"+M.join("|\\")+")","g");s.prototype={eachChar:function(t){for(var e,n=this.string,r=0,o=n.length;o>r;r++)e=n.charAt(r),t({validChars:e})},regex:function(){return this.string.replace(z,"\\$1")},generate:function(){return this.string}},h.prototype={eachChar:function(t){t({invalidChars:"/",repeat:!0})},regex:function(){return"([^/]+)"},generate:function(t){return t[this.name]}},c.prototype={eachChar:function(t){t({invalidChars:"",repeat:!0})},regex:function(){return"(.+)"},generate:function(t){return t[this.name]}},u.prototype={eachChar:function(){},regex:function(){return""},generate:function(){return""}},p.prototype={get:function(t){for(var e=this.nextStates,n=0,r=e.length;r>n;n++){var o=e[n],i=o.charSpec.validChars===t.validChars;if(i=i&&o.charSpec.invalidChars===t.invalidChars)return o}},put:function(t){var e;return(e=this.get(t))?e:(e=new p(t),this.nextStates.push(e),t.repeat&&e.nextStates.push(e),e)},match:function(t){for(var e,n,r,o=this.nextStates,i=[],a=0,s=o.length;s>a;a++)e=o[a],n=e.charSpec,"undefined"!=typeof(r=n.validChars)?-1!==r.indexOf(t)&&i.push(e):"undefined"!=typeof(r=n.invalidChars)&&-1===r.indexOf(t)&&i.push(e);return i}};var F=Object.create||function(t){function e(){}return e.prototype=t,new e};v.prototype=F({splice:Array.prototype.splice,slice:Array.prototype.slice,push:Array.prototype.push,length:0,queryParams:null});var L=function(){this.rootState=new p,this.names={}};L.prototype={add:function(t,e){for(var n,r=this.rootState,o="^",i={},a=[],s=[],h=!0,c=0,p=t.length;p>c;c++){var f=t[c],d=[],v=l(f.path,d,i);s=s.concat(v);for(var g=0,m=v.length;m>g;g++){var _=v[g];_ instanceof u||(h=!1,r=r.put({validChars:"/"}),o+="/",r=y(r,_),o+=_.regex())}var w={handler:f.handler,names:d};a.push(w)}h&&(r=r.put({validChars:"/"}),o+="/"),r.handlers=a,r.regex=new RegExp(o+"$"),r.specificity=i,(n=e&&e.as)&&(this.names[n]={segments:s,handlers:a})},handlersFor:function(t){var e=this.names[t],n=[];if(!e)throw new Error("There is no route named "+t);for(var r=0,o=e.handlers.length;o>r;r++)n.push(e.handlers[r]);return n},hasRoute:function(t){return!!this.names[t]},generate:function(t,e){var n=this.names[t],r="";if(!n)throw new Error("There is no route named "+t);for(var o=n.segments,i=0,a=o.length;a>i;i++){var s=o[i];s instanceof u||(r+="/",r+=s.generate(e))}return"/"!==r.charAt(0)&&(r="/"+r),e&&e.queryParams&&(r+=this.generateQueryString(e.queryParams)),r},generateQueryString:function(t){var e=[],n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(r);n.sort();for(var o=0,i=n.length;i>o;o++){r=n[o];var s=t[r];if(null!=s){var h=encodeURIComponent(r);if(a(s))for(var c=0,u=s.length;u>c;c++){var l=r+"[]="+encodeURIComponent(s[c]);e.push(l)}else h+="="+encodeURIComponent(s),e.push(h)}}return 0===e.length?"":"?"+e.join("&")},parseQueryString:function(t){for(var e=t.split("&"),n={},r=0;r<e.length;r++){var o,i=e[r].split("="),a=m(i[0]),s=a.length,h=!1;1===i.length?o="true":(s>2&&"[]"===a.slice(s-2)&&(h=!0,a=a.slice(0,s-2),n[a]||(n[a]=[])),o=i[1]?m(i[1]):""),h?n[a].push(o):n[a]=o}return n},recognize:function(t){var e,n,r,o,i=[this.rootState],a={},s=!1;if(o=t.indexOf("?"),-1!==o){var h=t.substr(o+1,t.length);t=t.substr(0,o),a=this.parseQueryString(h)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),s=!0),n=0,r=t.length;r>n&&(i=d(i,t.charAt(n)),i.length);n++);var c=[];for(n=0,r=i.length;r>n;n++)i[n].handlers&&c.push(i[n]);i=f(c);var u=c[0];return u&&u.handlers?(s&&"(.+)$"===u.regex.source.slice(-5)&&(t+="/"),g(u,t,a)):void 0}},L.prototype.map=i,L.VERSION="0.1.9";var I=L.prototype.generateQueryString,N={},U=void 0,B=/#.*$/,G=function(){function t(e){var n=e.root,r=e.onChange;D.classCallCheck(this,t),n?("/"!==n.charAt(0)&&(n="/"+n),this.root=n.replace(/\/$/,""),this.rootRE=new RegExp("^\\"+this.root)):this.root=null,this.onChange=r;var o=document.querySelector("base");this.base=o&&o.getAttribute("href")}return t.prototype.start=function(){var t=this;this.listener=function(e){var n=decodeURI(location.pathname+location.search);t.root&&(n=n.replace(t.rootRE,"")),t.onChange(n,e&&e.state,location.hash)},window.addEventListener("popstate",this.listener),this.listener()},t.prototype.stop=function(){window.removeEventListener("popstate",this.listener)},t.prototype.go=function(t,e,n){var r=this.formatPath(t,n);e?history.replaceState({},"",r):(history.replaceState({pos:{x:window.pageXOffset,y:window.pageYOffset}},""),history.pushState({},"",r));var o=t.match(B),i=o&&o[0];t=r.replace(B,"").replace(this.rootRE,""),this.onChange(t,null,i)},t.prototype.formatPath=function(t,e){return"/"===t.charAt(0)?this.root?this.root+"/"+t.replace(/^\//,""):t:w(this.base||location.pathname,t,e)},t}(),K=function(){function t(e){var n=e.hashbang,r=e.onChange;D.classCallCheck(this,t),this.hashbang=n,this.onChange=r}return t.prototype.start=function(){var t=this;this.listener=function(){var e=location.hash,n=e.replace(/^#!?/,"");"/"!==n.charAt(0)&&(n="/"+n);var r=t.formatPath(n);if(r!==e)return void location.replace(r);var o=location.search&&e.indexOf("?")>-1?"&"+location.search.slice(1):location.search;t.onChange(decodeURI(e.replace(/^#!?/,"")+o))},window.addEventListener("hashchange",this.listener),this.listener()},t.prototype.stop=function(){window.removeEventListener("hashchange",this.listener)},t.prototype.go=function(t,e,n){t=this.formatPath(t,n),e?location.replace(t):location.hash=t},t.prototype.formatPath=function(t,e){var n="/"===t.charAt(0),r="#"+(this.hashbang?"!":"");return n?r+t:r+w(location.hash.replace(/^#!?/,""),t,e)},t}(),X=function(){function t(e){var n=e.onChange;D.classCallCheck(this,t),this.onChange=n,this.currentPath="/"}return t.prototype.start=function(){this.onChange("/")},t.prototype.stop=function(){},t.prototype.go=function(t,e,n){t=this.currentPath=this.formatPath(t,n),this.onChange(t)},t.prototype.formatPath=function(t,e){return"/"===t.charAt(0)?t:w(this.currentPath,t,e)},t}(),Y=function(){function t(e,n,r){D.classCallCheck(this,t),this.router=e,this.to=n,this.from=r,this.next=null,this.aborted=!1,this.done=!1,this.deactivateQueue=e._views;var o=n.matched?Array.prototype.slice.call(n.matched):[];this.activateQueue=o.map(function(t){return t.handler})}return t.prototype.abort=function(){if(!this.aborted){this.aborted=!0;var t=!this.from.path&&"/"===this.to.path;t||this.router.replace(this.from.path||"/")}},t.prototype.redirect=function(t){this.aborted||(this.aborted=!0,"string"==typeof t?t=x(t,this.to.params,this.to.query):(t.params=t.params||this.to.params,t.query=t.query||this.to.query),this.router.replace(t))},t.prototype.start=function(t){var e=this,n=this.deactivateQueue,r=this.activateQueue,o=n.slice().reverse(),i=void 0,a=void 0;for(a=0;a<o.length&&$(o[a],r[a],e);a++);a>0&&(i=o.slice(0,a),n=o.slice(a).reverse(),r=r.slice(a)),e.runQueue(n,A,function(){e.runQueue(r,E,function(){e.runQueue(n,k,function(){if(e.router._onTransitionValidated(e),i&&i.forEach(function(t){P(t,e)}),n.length){var r=n[n.length-1],o=i?i.length:0;S(r,e,o,t)}else t()})})})},t.prototype.runQueue=function(t,e,n){function r(i){i>=t.length?n():e(t[i],o,function(){r(i+1)})}var o=this;r(0)},t.prototype.callHook=function(t,e,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=r.expectBoolean,i=void 0===o?!1:o,a=r.expectData,s=void 0===a?!1:a,h=r.cleanup,c=this,u=!1,l=function(){h&&h(),c.abort()},p=function(t){if(h?f():l(),t&&!c.router._suppress)throw _("Uncaught error during transition: "),t instanceof Error?t:new Error(t)},f=function(t){return u?void _("transition.next() should be called only once."):(u=!0,c.aborted?void(h&&h()):void(n&&n(t,p)))},d={to:c.to,from:c.from,abort:l,next:f,redirect:function(){c.redirect.apply(c,arguments)}},v=void 0;try{v=t.call(e,d)}catch(g){return p(g)}var y=b(v);i?"boolean"==typeof v?v?f():l():y?v.then(function(t){t?f():l()},p):t.length||f(v):y?v.then(f,p):(s&&T(v)||!t.length)&&f(v)},t.prototype.callHooks=function(t,e,n,r){var o=this;Array.isArray(t)?!function(){var i=[];i._needMerge=!0;var a=void 0;o.runQueue(t,function(t,n,a){o.aborted||o.callHook(t,e,function(t,e){t&&i.push(t),e=e,a()},r)},function(){n(i,a)})}():this.callHook(t,e,n,r)},t}(),J=/^(component|subRoutes)$/,W=function it(t,e){var n=this;D.classCallCheck(this,it);var r=e._recognizer.recognize(t);r&&([].forEach.call(r,function(t){for(var e in t.handler)J.test(e)||(n[e]=t.handler[e])}),this.query=r.queryParams,this.params=[].reduce.call(r,function(t,e){if(e.params)for(var n in e.params)t[n]=e.params[n];return t},{})),this.path=t,this.router=e,this.matched=r||e._notFoundHandler,Object.freeze(this)},Z=/\/$/,tt=/[-.*+?^${}()|[\]\/\\]/g,et=/\?.*$/,nt={"abstract":X,hash:K,html5:G},rt=void 0,ot=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.hashbang,r=void 0===n?!0:n,o=e["abstract"],i=void 0===o?!1:o,a=e.history,s=void 0===a?!1:a,h=e.saveScrollPosition,c=void 0===h?!1:h,u=e.transitionOnLoad,l=void 0===u?!1:u,p=e.suppressTransitionError,f=void 0===p?!1:p,d=e.root,v=void 0===d?null:d,g=e.linkActiveClass,y=void 0===g?"v-link-active":g;if(D.classCallCheck(this,t),!t.installed)throw new Error("Please install the Router with Vue.use() before creating an instance.");this.app=null,this._views=[],this._children=[],this._recognizer=new L,this._guardRecognizer=new L,this._started=!1,this._startCb=null,this._currentRoute={},this._currentTransition=null,this._previousTransition=null,this._notFoundHandler=null,this._notFoundRedirect=null,this._beforeEachHooks=[],this._afterEachHooks=[],this._hasPushState="undefined"!=typeof window&&window.history&&window.history.pushState,this._rendered=!1,this._transitionOnLoad=l,this._abstract=i,this._hashbang=r,this._history=this._hasPushState&&s,this._saveScrollPosition=c,this._linkActiveClass=y,this._suppress=f;var m=rt.util.inBrowser;this.mode=!m||this._abstract?"abstract":this._history?"html5":"hash";var _=nt[this.mode],w=this;this.history=new _({root:v,hashbang:this._hashbang,onChange:function(t,e,n){w._match(t,e,n)}})}return t.prototype.map=function(t){for(var e in t)this.on(e,t[e])},t.prototype.on=function(t,e){"*"===t?this._notFound(e):this._addRoute(t,e,[])},t.prototype.redirect=function(t){for(var e in t)this._addRedirect(e,t[e])},t.prototype.alias=function(t){for(var e in t)this._addAlias(e,t[e])},t.prototype.beforeEach=function(t){this._beforeEachHooks.push(t)},t.prototype.afterEach=function(t){this._afterEachHooks.push(t)},t.prototype.go=function(t){var e=!1,n=!1;rt.util.isObject(t)&&(e=t.replace,n=t.append),t=this._stringifyPath(t),t&&this.history.go(t,e,n)},t.prototype.replace=function(t){"string"==typeof t&&(t={path:t}),t.replace=!0,this.go(t)},t.prototype.start=function(t,e,n){if(this._started)return void _("already started.");if(this._started=!0,this._startCb=n,!this.app){if(!t||!e)throw new Error("Must start vue-router with a component and a root container.");this._appContainer=e;var r=this._appConstructor="function"==typeof t?t:rt.extend(t);r.options.name=r.options.name||"RouterApp"}this.history.start()},t.prototype.stop=function(){this.history.stop(),this._started=!1},t.prototype._addRoute=function(t,e,n){if(Q(t,e),e.path=t,e.fullPath=(n.reduce(function(t,e){return t+e.path},"")+t).replace("//","/"),n.push({path:t,handler:e}),this._recognizer.add(n,{as:e.name}),e.subRoutes)for(var r in e.subRoutes)this._addRoute(r,e.subRoutes[r],n.slice())},t.prototype._notFound=function(t){Q("*",t),this._notFoundHandler=[{handler:t}]},t.prototype._addRedirect=function(t,e){"*"===t?this._notFoundRedirect=e:this._addGuard(t,e,this.replace)},t.prototype._addAlias=function(t,e){this._addGuard(t,e,this._match)},t.prototype._addGuard=function(t,e,n){var r=this;this._guardRecognizer.add([{path:t,handler:function(t,o){var i=x(e,t.params,o);n.call(r,i)}}])},t.prototype._checkGuard=function(t){var e=this._guardRecognizer.recognize(t);return e?(e[0].handler(e[0],e.queryParams),!0):this._notFoundRedirect&&(e=this._recognizer.recognize(t),!e)?(this.replace(this._notFoundRedirect),!0):void 0},t.prototype._match=function(t,e,n){var r=this;if(!this._checkGuard(t)){var o=this._currentRoute,i=this._currentTransition;if(i){if(i.to.path===t)return;if(o.path===t)return i.aborted=!0,void(this._currentTransition=this._prevTransition);i.aborted=!0}var a=new W(t,this),s=new Y(this,a,o);this._prevTransition=i,this._currentTransition=s,this.app||(this.app=new this._appConstructor({el:this._appContainer,_meta:{$route:a}}));var h=this._beforeEachHooks,c=function(){s.start(function(){r._postTransition(a,e,n)})};h.length?s.runQueue(h,function(t,e,n){s===r._currentTransition&&s.callHook(t,null,n,{expectBoolean:!0})},c):c(),!this._rendered&&this._startCb&&this._startCb.call(null),this._rendered=!0}},t.prototype._onTransitionValidated=function(t){var e=this._currentRoute=t.to;this.app.$route!==e&&(this.app.$route=e,this._children.forEach(function(t){t.$route=e})),this._afterEachHooks.length&&this._afterEachHooks.forEach(function(e){return e.call(null,{to:t.to,from:t.from})}),this._currentTransition.done=!0},t.prototype._postTransition=function(t,e,n){var r=e&&e.pos;r&&this._saveScrollPosition?rt.nextTick(function(){window.scrollTo(r.x,r.y)}):n&&rt.nextTick(function(){var t=document.getElementById(n.slice(1));t&&window.scrollTo(window.scrollX,t.offsetTop)})},t.prototype._stringifyPath=function(t){if(t&&"object"==typeof t){if(t.name){var e=t.params||{};return t.query&&(e.queryParams=t.query),this._recognizer.generate(t.name,e)}if(t.path){var n=t.path;if(t.query){var r=this._recognizer.generateQueryString(t.query);n+=n.indexOf("?")>-1?"&"+r.slice(1):r}return n}return""}return t?t+"":""},t}();return ot.installed=!1,ot.install=function(t){return ot.installed?void _("already installed."):(rt=t,j(rt),H(rt),q(rt),N.Vue=rt,void(ot.installed=!0))},"undefined"!=typeof window&&window.Vue&&window.Vue.use(ot),ot});
{
"name": "vue-router",
"version": "0.7.6",
"version": "0.7.7",
"description": "A router for Vue.js",

@@ -9,3 +9,4 @@ "main": "dist/vue-router.common.js",

"dist",
"src"
"src",
"lib"
],

@@ -12,0 +13,0 @@ "scripts": {

import { warn } from '../util'
const trailingSlashRE = /\/$/
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
const queryStringRE = /\?.*$/

@@ -23,2 +24,10 @@ // install v-link, which provides navigation support for

}
// no need to handle click if link expects to be opened
// in a new window/tab.
/* istanbul ignore if */
if (this.el.tagName === 'A' &&
this.el.getAttribute('target') === '_blank') {
return
}
// handle click
let router = vm.$route.router

@@ -106,3 +115,2 @@ this.handler = (e) => {

let el = this.el
let dest = this.path
let router = this.vm.$route.router

@@ -115,3 +123,4 @@ let activeClass = this.activeClass || router._linkActiveClass

// remove query string before matching
path = path.replace(/\?.*$/, '')
let dest = this.path.replace(queryStringRE, '')
path = path.replace(queryStringRE, '')
// add new class

@@ -118,0 +127,0 @@ if (this.exact) {

@@ -24,6 +24,9 @@ import { resolvePath } from '../util'

}
let pathToMatch = decodeURI(
path.replace(/^#!?/, '') + location.search
)
self.onChange(pathToMatch)
// determine query
// note it's possible to have queries in both the actual URL
// and the hash fragment itself.
let query = location.search && path.indexOf('?') > -1
? '&' + location.search.slice(1)
: location.search
self.onChange(decodeURI(path.replace(/^#!?/, '') + query))
}

@@ -30,0 +33,0 @@ window.addEventListener('hashchange', this.listener)

@@ -74,4 +74,4 @@ import { warn, mapParams, isPromise } from './util'

} else {
path.params = this.to.params
path.query = this.to.query
path.params = path.params || this.to.params
path.query = path.query || this.to.query
}

@@ -78,0 +78,0 @@ this.router.replace(path)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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