kdu-router 2.7.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * kdu-router v2.7.0
2
+ * kdu-router v3.0.0
3
3
  * (c) 2022 NKDuy
4
4
  * @license MIT
5
5
  */
@@ -56,7 +56,7 @@ var View = {
56
56
  var depth = 0;
57
57
  var inactive = false;
58
58
  while (parent && parent._routerRoot !== parent) {
59
- if (parent.$vnode && parent.$vnode.data.routerView) {
59
+ if (parent.$knode && parent.$knode.data.routerView) {
60
60
  depth++;
61
61
  }
62
62
  if (parent._inactive) {
@@ -93,14 +93,22 @@ var View = {
93
93
  }
94
94
  }
95
95
 
96
- // also regiseter instance in prepatch hook
96
+ // also register instance in prepatch hook
97
97
  // in case the same component instance is reused across different routes
98
- ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
99
- matched.instances[name] = vnode.componentInstance;
98
+ ;(data.hook || (data.hook = {})).prepatch = function (_, knode) {
99
+ matched.instances[name] = knode.componentInstance;
100
100
  };
101
101
 
102
102
  // resolve props
103
103
  data.props = resolveProps(route, matched.props && matched.props[name]);
104
+ data.attrs = {};
105
+
106
+ for (var key in data.props) {
107
+ if (!('props' in component) || !(key in component.props)) {
108
+ data.attrs[key] = data.props[key];
109
+ delete data.props[key];
110
+ }
111
+ }
104
112
 
105
113
  return h(component, data, children)
106
114
  }
@@ -158,8 +166,7 @@ function resolveQuery (
158
166
  parsedQuery = {};
159
167
  }
160
168
  for (var key in extraQuery) {
161
- var val = extraQuery[key];
162
- parsedQuery[key] = Array.isArray(val) ? val.slice() : val;
169
+ parsedQuery[key] = extraQuery[key];
163
170
  }
164
171
  return parsedQuery
165
172
  }
@@ -236,12 +243,18 @@ function createRoute (
236
243
  router
237
244
  ) {
238
245
  var stringifyQuery$$1 = router && router.options.stringifyQuery;
246
+
247
+ var query = location.query || {};
248
+ try {
249
+ query = clone(query);
250
+ } catch (e) {}
251
+
239
252
  var route = {
240
253
  name: location.name || (record && record.name),
241
254
  meta: (record && record.meta) || {},
242
255
  path: location.path || '/',
243
256
  hash: location.hash || '',
244
- query: location.query || {},
257
+ query: query,
245
258
  params: location.params || {},
246
259
  fullPath: getFullPath(location, stringifyQuery$$1),
247
260
  matched: record ? formatMatch(record) : []
@@ -252,6 +265,20 @@ function createRoute (
252
265
  return Object.freeze(route)
253
266
  }
254
267
 
268
+ function clone (value) {
269
+ if (Array.isArray(value)) {
270
+ return value.map(clone)
271
+ } else if (value && typeof value === 'object') {
272
+ var res = {};
273
+ for (var key in value) {
274
+ res[key] = clone(value[key]);
275
+ }
276
+ return res
277
+ } else {
278
+ return value
279
+ }
280
+ }
281
+
255
282
  // the starting route that represents the initial state
256
283
  var START = createRoute(null, {
257
284
  path: '/'
@@ -305,6 +332,8 @@ function isObjectEqual (a, b) {
305
332
  if ( a === void 0 ) a = {};
306
333
  if ( b === void 0 ) b = {};
307
334
 
335
+ // handle null value #1566
336
+ if (!a || !b) { return a === b }
308
337
  var aKeys = Object.keys(a);
309
338
  var bKeys = Object.keys(b);
310
339
  if (aKeys.length !== bKeys.length) {
@@ -484,7 +513,7 @@ function findAnchor (children) {
484
513
  var _Kdu;
485
514
 
486
515
  function install (Kdu) {
487
- if (install.installed) { return }
516
+ if (install.installed && _Kdu === Kdu) { return }
488
517
  install.installed = true;
489
518
 
490
519
  _Kdu = Kdu;
@@ -492,7 +521,7 @@ function install (Kdu) {
492
521
  var isDef = function (v) { return v !== undefined; };
493
522
 
494
523
  var registerInstance = function (vm, callVal) {
495
- var i = vm.$options._parentVnode;
524
+ var i = vm.$options._parentKnode;
496
525
  if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
497
526
  i(vm, callVal);
498
527
  }
@@ -606,14 +635,14 @@ function cleanPath (path) {
606
635
  return path.replace(/\/\//g, '/')
607
636
  }
608
637
 
609
- var index$1 = Array.isArray || function (arr) {
638
+ var isarray = Array.isArray || function (arr) {
610
639
  return Object.prototype.toString.call(arr) == '[object Array]';
611
640
  };
612
641
 
613
642
  /**
614
643
  * Expose `pathToRegexp`.
615
644
  */
616
- var index = pathToRegexp;
645
+ var pathToRegexp_1 = pathToRegexp;
617
646
  var parse_1 = parse;
618
647
  var compile_1 = compile;
619
648
  var tokensToFunction_1 = tokensToFunction;
@@ -718,7 +747,7 @@ function parse (str, options) {
718
747
  * @return {!function(Object=, Object=)}
719
748
  */
720
749
  function compile (str, options) {
721
- return tokensToFunction(parse(str, options))
750
+ return tokensToFunction(parse(str, options), options)
722
751
  }
723
752
 
724
753
  /**
@@ -748,14 +777,14 @@ function encodeAsterisk (str) {
748
777
  /**
749
778
  * Expose a method for transforming tokens into the path function.
750
779
  */
751
- function tokensToFunction (tokens) {
780
+ function tokensToFunction (tokens, options) {
752
781
  // Compile all the tokens into regexps.
753
782
  var matches = new Array(tokens.length);
754
783
 
755
784
  // Compile all the patterns before compilation.
756
785
  for (var i = 0; i < tokens.length; i++) {
757
786
  if (typeof tokens[i] === 'object') {
758
- matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
787
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
759
788
  }
760
789
  }
761
790
 
@@ -790,7 +819,7 @@ function tokensToFunction (tokens) {
790
819
  }
791
820
  }
792
821
 
793
- if (index$1(value)) {
822
+ if (isarray(value)) {
794
823
  if (!token.repeat) {
795
824
  throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
796
825
  }
@@ -868,7 +897,7 @@ function attachKeys (re, keys) {
868
897
  * @return {string}
869
898
  */
870
899
  function flags (options) {
871
- return options.sensitive ? '' : 'i'
900
+ return options && options.sensitive ? '' : 'i'
872
901
  }
873
902
 
874
903
  /**
@@ -941,7 +970,7 @@ function stringToRegexp (path, keys, options) {
941
970
  * @return {!RegExp}
942
971
  */
943
972
  function tokensToRegExp (tokens, keys, options) {
944
- if (!index$1(keys)) {
973
+ if (!isarray(keys)) {
945
974
  options = /** @type {!Object} */ (keys || options);
946
975
  keys = [];
947
976
  }
@@ -1017,7 +1046,7 @@ function tokensToRegExp (tokens, keys, options) {
1017
1046
  * @return {!RegExp}
1018
1047
  */
1019
1048
  function pathToRegexp (path, keys, options) {
1020
- if (!index$1(keys)) {
1049
+ if (!isarray(keys)) {
1021
1050
  options = /** @type {!Object} */ (keys || options);
1022
1051
  keys = [];
1023
1052
  }
@@ -1028,20 +1057,21 @@ function pathToRegexp (path, keys, options) {
1028
1057
  return regexpToRegexp(path, /** @type {!Array} */ (keys))
1029
1058
  }
1030
1059
 
1031
- if (index$1(path)) {
1060
+ if (isarray(path)) {
1032
1061
  return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
1033
1062
  }
1034
1063
 
1035
1064
  return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
1036
1065
  }
1037
1066
 
1038
- index.parse = parse_1;
1039
- index.compile = compile_1;
1040
- index.tokensToFunction = tokensToFunction_1;
1041
- index.tokensToRegExp = tokensToRegExp_1;
1067
+ pathToRegexp_1.parse = parse_1;
1068
+ pathToRegexp_1.compile = compile_1;
1069
+ pathToRegexp_1.tokensToFunction = tokensToFunction_1;
1070
+ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
1042
1071
 
1043
1072
  /* */
1044
1073
 
1074
+ // $flow-disable-line
1045
1075
  var regexpCompileCache = Object.create(null);
1046
1076
 
1047
1077
  function fillParams (
@@ -1052,7 +1082,7 @@ function fillParams (
1052
1082
  try {
1053
1083
  var filler =
1054
1084
  regexpCompileCache[path] ||
1055
- (regexpCompileCache[path] = index.compile(path));
1085
+ (regexpCompileCache[path] = pathToRegexp_1.compile(path));
1056
1086
  return filler(params || {}, { pretty: true })
1057
1087
  } catch (e) {
1058
1088
  {
@@ -1072,7 +1102,9 @@ function createRouteMap (
1072
1102
  ) {
1073
1103
  // the path list is used to control path matching priority
1074
1104
  var pathList = oldPathList || [];
1105
+ // $flow-disable-line
1075
1106
  var pathMap = oldPathMap || Object.create(null);
1107
+ // $flow-disable-line
1076
1108
  var nameMap = oldNameMap || Object.create(null);
1077
1109
 
1078
1110
  routes.forEach(function (route) {
@@ -1114,8 +1146,12 @@ function addRouteRecord (
1114
1146
  );
1115
1147
  }
1116
1148
 
1117
- var normalizedPath = normalizePath(path, parent);
1118
1149
  var pathToRegexpOptions = route.pathToRegexpOptions || {};
1150
+ var normalizedPath = normalizePath(
1151
+ path,
1152
+ parent,
1153
+ pathToRegexpOptions.strict
1154
+ );
1119
1155
 
1120
1156
  if (typeof route.caseSensitive === 'boolean') {
1121
1157
  pathToRegexpOptions.sensitive = route.caseSensitive;
@@ -1203,9 +1239,9 @@ function addRouteRecord (
1203
1239
  }
1204
1240
 
1205
1241
  function compileRouteRegex (path, pathToRegexpOptions) {
1206
- var regex = index(path, [], pathToRegexpOptions);
1242
+ var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
1207
1243
  {
1208
- var keys = {};
1244
+ var keys = Object.create(null);
1209
1245
  regex.keys.forEach(function (key) {
1210
1246
  warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
1211
1247
  keys[key.name] = true;
@@ -1214,8 +1250,8 @@ function compileRouteRegex (path, pathToRegexpOptions) {
1214
1250
  return regex
1215
1251
  }
1216
1252
 
1217
- function normalizePath (path, parent) {
1218
- path = path.replace(/\/$/, '');
1253
+ function normalizePath (path, parent, strict) {
1254
+ if (!strict) { path = path.replace(/\/$/, ''); }
1219
1255
  if (path[0] === '/') { return path }
1220
1256
  if (parent == null) { return path }
1221
1257
  return cleanPath(((parent.path) + "/" + path))
@@ -1487,6 +1523,8 @@ function resolveRecordPath (path, record) {
1487
1523
  var positionStore = Object.create(null);
1488
1524
 
1489
1525
  function setupScroll () {
1526
+ // Fix for #1585 for Firefox
1527
+ window.history.replaceState({ key: getStateKey() }, '');
1490
1528
  window.addEventListener('popstate', function (e) {
1491
1529
  saveScrollPosition();
1492
1530
  if (e.state && e.state.key) {
@@ -1518,25 +1556,21 @@ function handleScroll (
1518
1556
  router.app.$nextTick(function () {
1519
1557
  var position = getScrollPosition();
1520
1558
  var shouldScroll = behavior(to, from, isPop ? position : null);
1559
+
1521
1560
  if (!shouldScroll) {
1522
1561
  return
1523
1562
  }
1524
- var isObject = typeof shouldScroll === 'object';
1525
- if (isObject && typeof shouldScroll.selector === 'string') {
1526
- var el = document.querySelector(shouldScroll.selector);
1527
- if (el) {
1528
- var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
1529
- offset = normalizeOffset(offset);
1530
- position = getElementPosition(el, offset);
1531
- } else if (isValidPosition(shouldScroll)) {
1532
- position = normalizePosition(shouldScroll);
1533
- }
1534
- } else if (isObject && isValidPosition(shouldScroll)) {
1535
- position = normalizePosition(shouldScroll);
1536
- }
1537
1563
 
1538
- if (position) {
1539
- window.scrollTo(position.x, position.y);
1564
+ if (typeof shouldScroll.then === 'function') {
1565
+ shouldScroll.then(function (shouldScroll) {
1566
+ scrollToPosition((shouldScroll), position);
1567
+ }).catch(function (err) {
1568
+ {
1569
+ assert(false, err.toString());
1570
+ }
1571
+ });
1572
+ } else {
1573
+ scrollToPosition(shouldScroll, position);
1540
1574
  }
1541
1575
  });
1542
1576
  }
@@ -1590,6 +1624,26 @@ function isNumber (v) {
1590
1624
  return typeof v === 'number'
1591
1625
  }
1592
1626
 
1627
+ function scrollToPosition (shouldScroll, position) {
1628
+ var isObject = typeof shouldScroll === 'object';
1629
+ if (isObject && typeof shouldScroll.selector === 'string') {
1630
+ var el = document.querySelector(shouldScroll.selector);
1631
+ if (el) {
1632
+ var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
1633
+ offset = normalizeOffset(offset);
1634
+ position = getElementPosition(el, offset);
1635
+ } else if (isValidPosition(shouldScroll)) {
1636
+ position = normalizePosition(shouldScroll);
1637
+ }
1638
+ } else if (isObject && isValidPosition(shouldScroll)) {
1639
+ position = normalizePosition(shouldScroll);
1640
+ }
1641
+
1642
+ if (position) {
1643
+ window.scrollTo(position.x, position.y);
1644
+ }
1645
+ }
1646
+
1593
1647
  /* */
1594
1648
 
1595
1649
  var supportsPushState = inBrowser && (function () {
@@ -1685,7 +1739,7 @@ function resolveAsyncComponents (matched) {
1685
1739
  pending++;
1686
1740
 
1687
1741
  var resolve = once(function (resolvedDef) {
1688
- if (resolvedDef.__esModule && resolvedDef.default) {
1742
+ if (isESModule(resolvedDef)) {
1689
1743
  resolvedDef = resolvedDef.default;
1690
1744
  }
1691
1745
  // save resolved on async factory in case it's used elsewhere
@@ -1720,7 +1774,7 @@ function resolveAsyncComponents (matched) {
1720
1774
  if (typeof res.then === 'function') {
1721
1775
  res.then(resolve, reject);
1722
1776
  } else {
1723
- // new syntax in Kdu
1777
+ // new syntax in Kdu 2.3
1724
1778
  var comp = res.component;
1725
1779
  if (comp && typeof comp.then === 'function') {
1726
1780
  comp.then(resolve, reject);
@@ -1751,6 +1805,14 @@ function flatten (arr) {
1751
1805
  return Array.prototype.concat.apply([], arr)
1752
1806
  }
1753
1807
 
1808
+ var hasSymbol =
1809
+ typeof Symbol === 'function' &&
1810
+ typeof Symbol.toStringTag === 'symbol';
1811
+
1812
+ function isESModule (obj) {
1813
+ return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
1814
+ }
1815
+
1754
1816
  // in Webpack 2, require.ensure now also returns a Promise
1755
1817
  // so the resolve/reject functions may get called an extra time
1756
1818
  // if the user uses an arrow function shorthand that happens to
@@ -2079,9 +2141,18 @@ var HTML5History = (function (History$$1) {
2079
2141
  setupScroll();
2080
2142
  }
2081
2143
 
2144
+ var initLocation = getLocation(this.base);
2082
2145
  window.addEventListener('popstate', function (e) {
2083
2146
  var current = this$1.current;
2084
- this$1.transitionTo(getLocation(this$1.base), function (route) {
2147
+
2148
+ // Avoiding first `popstate` event dispatched in some browsers but first
2149
+ // history route not updated since async guard at the same time.
2150
+ var location = getLocation(this$1.base);
2151
+ if (this$1.current === START && location === initLocation) {
2152
+ return
2153
+ }
2154
+
2155
+ this$1.transitionTo(location, function (route) {
2085
2156
  if (expectScroll) {
2086
2157
  handleScroll(router, route, current, true);
2087
2158
  }
@@ -2165,26 +2236,50 @@ var HashHistory = (function (History$$1) {
2165
2236
  HashHistory.prototype.setupListeners = function setupListeners () {
2166
2237
  var this$1 = this;
2167
2238
 
2168
- window.addEventListener('hashchange', function () {
2239
+ var router = this.router;
2240
+ var expectScroll = router.options.scrollBehavior;
2241
+ var supportsScroll = supportsPushState && expectScroll;
2242
+
2243
+ if (supportsScroll) {
2244
+ setupScroll();
2245
+ }
2246
+
2247
+ window.addEventListener(supportsPushState ? 'popstate' : 'hashchange', function () {
2248
+ var current = this$1.current;
2169
2249
  if (!ensureSlash()) {
2170
2250
  return
2171
2251
  }
2172
2252
  this$1.transitionTo(getHash(), function (route) {
2173
- replaceHash(route.fullPath);
2253
+ if (supportsScroll) {
2254
+ handleScroll(this$1.router, route, current, true);
2255
+ }
2256
+ if (!supportsPushState) {
2257
+ replaceHash(route.fullPath);
2258
+ }
2174
2259
  });
2175
2260
  });
2176
2261
  };
2177
2262
 
2178
2263
  HashHistory.prototype.push = function push (location, onComplete, onAbort) {
2264
+ var this$1 = this;
2265
+
2266
+ var ref = this;
2267
+ var fromRoute = ref.current;
2179
2268
  this.transitionTo(location, function (route) {
2180
2269
  pushHash(route.fullPath);
2270
+ handleScroll(this$1.router, route, fromRoute, false);
2181
2271
  onComplete && onComplete(route);
2182
2272
  }, onAbort);
2183
2273
  };
2184
2274
 
2185
2275
  HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
2276
+ var this$1 = this;
2277
+
2278
+ var ref = this;
2279
+ var fromRoute = ref.current;
2186
2280
  this.transitionTo(location, function (route) {
2187
2281
  replaceHash(route.fullPath);
2282
+ handleScroll(this$1.router, route, fromRoute, false);
2188
2283
  onComplete && onComplete(route);
2189
2284
  }, onAbort);
2190
2285
  };
@@ -2234,15 +2329,27 @@ function getHash () {
2234
2329
  return index === -1 ? '' : href.slice(index + 1)
2235
2330
  }
2236
2331
 
2332
+ function getUrl (path) {
2333
+ var href = window.location.href;
2334
+ var i = href.indexOf('#');
2335
+ var base = i >= 0 ? href.slice(0, i) : href;
2336
+ return (base + "#" + path)
2337
+ }
2338
+
2237
2339
  function pushHash (path) {
2238
- window.location.hash = path;
2340
+ if (supportsPushState) {
2341
+ pushState(getUrl(path));
2342
+ } else {
2343
+ window.location.hash = path;
2344
+ }
2239
2345
  }
2240
2346
 
2241
2347
  function replaceHash (path) {
2242
- var href = window.location.href;
2243
- var i = href.indexOf('#');
2244
- var base = i >= 0 ? href.slice(0, i) : href;
2245
- window.location.replace((base + "#" + path));
2348
+ if (supportsPushState) {
2349
+ replaceState(getUrl(path));
2350
+ } else {
2351
+ window.location.replace(getUrl(path));
2352
+ }
2246
2353
  }
2247
2354
 
2248
2355
  /* */
@@ -2344,7 +2451,7 @@ var KduRouter = function KduRouter (options) {
2344
2451
  }
2345
2452
  };
2346
2453
 
2347
- var prototypeAccessors = { currentRoute: {} };
2454
+ var prototypeAccessors = { currentRoute: { configurable: true } };
2348
2455
 
2349
2456
  KduRouter.prototype.match = function match (
2350
2457
  raw,
@@ -2502,7 +2609,7 @@ function createHref (base, fullPath, mode) {
2502
2609
  }
2503
2610
 
2504
2611
  KduRouter.install = install;
2505
- KduRouter.version = '2.7.0';
2612
+ KduRouter.version = '3.0.0';
2506
2613
 
2507
2614
  if (inBrowser && window.Kdu) {
2508
2615
  window.Kdu.use(KduRouter);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Kdu-router v2.7.0
2
+ * kdu-router v3.0.0
3
3
  * (c) 2022 NKDuy
4
4
  * @license MIT
5
5
  */
6
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.KduRouter=e()}(this,function(){"use strict";function t(t, e){}function e(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function r(t, e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t, e, r){void 0===e&&(e={});var n,i=r||o;try{n=i(t||"")}catch(t){n={}}for(var a in e){var u=e[a];n[a]=Array.isArray(u)?u.slice():u}return n}function o(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var r=t.replace(/\+/g," ").split("="),n=$t(r.shift()),o=r.length>0?$t(r.join("=")):null;void 0===e[n]?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]}),e):e}function i(t){var e=t?Object.keys(t).map(function(e){var r=t[e];if(void 0===r)return"";if(null===r)return Tt(e);if(Array.isArray(r)){var n=[];return r.forEach(function(t){void 0!==t&&(null===t?n.push(Tt(e)):n.push(Tt(e)+"="+Tt(t)))}),n.join("&")}return Tt(e)+"="+Tt(r)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function a(t, e, r, n){var o=n&&n.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:c(e,o),matched:t?u(t):[]};return r&&(i.redirectedFrom=c(r,o)),Object.freeze(i)}function u(t){for(var e=[]; t;)e.unshift(t),t=t.parent;return e}function c(t, e){var r=t.path,n=t.query;void 0===n&&(n={});var o=t.hash;void 0===o&&(o="");var a=e||i;return(r||"/")+a(n)+o}function s(t, e){return e===qt?t===e:!!e&&(t.path&&e.path?t.path.replace(St,"")===e.path.replace(St,"")&&t.hash===e.hash&&p(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&p(t.query,e.query)&&p(t.params,e.params)))}function p(t, e){void 0===t&&(t={}),void 0===e&&(e={});var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(r){var n=t[r],o=e[r];return"object"==typeof n&&"object"==typeof o?p(n,o):String(n)===String(o)})}function f(t, e){return 0===t.path.replace(St,"/").indexOf(e.path.replace(St,"/"))&&(!e.hash||t.hash===e.hash)&&h(t.query,e.query)}function h(t, e){for(var r in e)if(!(r in t))return!1;return!0}function l(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function d(t){if(t)for(var e,r=0; r<t.length; r++){if("a"===(e=t[r]).tag)return e;if(e.children&&(e=d(e.children)))return e}}function y(t){if(!y.installed){y.installed=!0,Ot=t;var e=function(t){return void 0!==t},r=function(t, r){var n=t.$options._parentVnode;e(n)&&e(n=n.data)&&e(n=n.registerRouteInstance)&&n(t,r)};t.mixin({beforeCreate:function(){e(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(t.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this._routerRoot._route}}),t.component("router-view",Ct),t.component("router-link",Ut);var n=t.config.optionMergeStrategies;n.beforeRouteEnter=n.beforeRouteLeave=n.beforeRouteUpdate=n.created}}function v(t, e, r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;var o=e.split("/");r&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0; a<i.length; a++){var u=i[a];".."===u?o.pop():"."!==u&&o.push(u)}return""!==o[0]&&o.unshift(""),o.join("/")}function m(t){var e="",r="",n=t.indexOf("#");n>=0&&(e=t.slice(n),t=t.slice(0,n));var o=t.indexOf("?");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{path:t,query:r,hash:e}}function g(t){return t.replace(/\/\//g,"/")}function b(t, e){for(var r,n=[],o=0,i=0,a="",u=e&&e.delimiter||"/"; null!=(r=Ft.exec(t));){var c=r[0],s=r[1],p=r.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=r[2],l=r[3],d=r[4],y=r[5],v=r[6],m=r[7];a&&(n.push(a),a="");var g=null!=h&&null!=f&&f!==h,b="+"===v||"*"===v,w="?"===v||"*"===v,x=r[2]||u,k=d||y;n.push({name:l||o++,prefix:h||"",delimiter:x,optional:w,repeat:b,partial:g,asterisk:!!m,pattern:k?E(k):m?".*":"[^"+R(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&n.push(a),n}function w(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function x(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(t){for(var e=new Array(t.length),r=0; r<t.length; r++)"object"==typeof t[r]&&(e[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r, n){for(var o="",i=r||{},a=(n||{}).pretty?w:encodeURIComponent,u=0; u<t.length; u++){var c=t[u];if("string"!=typeof c){var s,p=i[c.name];if(null==p){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(It(p)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var f=0; f<p.length; f++){if(s=a(p[f]),!e[u].test(s))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(s)+"`");o+=(0===f?c.prefix:c.delimiter)+s}}else{if(s=c.asterisk?x(p):a(p),!e[u].test(s))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+s+'"');o+=c.prefix+s}}else o+=c}return o}}function R(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function E(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function O(t, e){return t.keys=e,t}function C(t){return t.sensitive?"":"i"}function A(t, e){var r=t.source.match(/\((?!\?)/g);if(r)for(var n=0; n<r.length; n++)e.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return O(t,e)}function j(t, e, r){for(var n=[],o=0; o<t.length; o++)n.push($(t[o],e,r).source);return O(new RegExp("(?:"+n.join("|")+")",C(r)),e)}function _(t, e, r){return T(b(t,r),e,r)}function T(t, e, r){It(e)||(r=e||r,e=[]);for(var n=(r=r||{}).strict,o=!1!==r.end,i="",a=0; a<t.length; a++){var u=t[a];if("string"==typeof u)i+=R(u);else{var c=R(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),i+=s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")"}}var p=R(r.delimiter||"/"),f=i.slice(-p.length)===p;return n||(i=(f?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":n&&f?"":"(?="+p+"|$)",O(new RegExp("^"+i,C(r)),e)}function $(t, e, r){return It(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp?A(t,e):It(t)?j(t,e,r):_(t,e,r)}function S(t, e, r){try{return(Dt[t]||(Dt[t]=Mt.compile(t)))(e||{},{pretty:!0})}catch(t){return""}}function q(t, e, r, n){var o=e||[],i=r||Object.create(null),a=n||Object.create(null);t.forEach(function(t){L(o,i,a,t)});for(var u=0,c=o.length; u<c; u++)"*"===o[u]&&(o.push(o.splice(u,1)[0]),c--,u--);return{pathList:o,pathMap:i,nameMap:a}}function L(t, e, r, n, o, i){var a=n.path,u=n.name,c=U(a,o),s=n.pathToRegexpOptions||{};"boolean"==typeof n.caseSensitive&&(s.sensitive=n.caseSensitive);var p={path:c,regex:P(c,s),components:n.components||{default:n.component},instances:{},name:u,parent:o,matchAs:i,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{},props:null==n.props?{}:n.components?n.props:{default:n.props}};n.children&&n.children.forEach(function(n){var o=i?g(i+"/"+n.path):void 0;L(t,e,r,n,p,o)}),void 0!==n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach(function(i){var a={path:i,children:n.children};L(t,e,r,a,o,p.path||"/")}),e[p.path]||(t.push(p.path),e[p.path]=p),u&&(r[u]||(r[u]=p))}function P(t, e){return Mt(t,[],e)}function U(t, e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:g(e.path+"/"+t)}function H(t, e, r, o){var i="string"==typeof t?{path:t}:t;if(i.name||i._normalized)return i;if(!i.path&&i.params&&e){(i=I({},i))._normalized=!0;var a=I(I({},e.params),i.params);if(e.name)i.name=e.name,i.params=a;else if(e.matched.length){var u=e.matched[e.matched.length-1].path;i.path=S(u,a,"path "+e.path)}return i}var c=m(i.path||""),s=e&&e.path||"/",p=c.path?v(c.path,s,r||i.append):s,f=n(c.query,i.query,o&&o.options.parseQuery),h=i.hash||c.hash;return h&&"#"!==h.charAt(0)&&(h="#"+h),{_normalized:!0,path:p,query:f,hash:h}}function I(t, e){for(var r in e)t[r]=e[r];return t}function M(t, e){function r(t, r, n){var o=H(t,r,!1,e),a=o.name;if(a){var u=p[a];if(!u)return i(null,o);var f=u.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof o.params&&(o.params={}),r&&"object"==typeof r.params)for(var h in r.params)!(h in o.params)&&f.indexOf(h)>-1&&(o.params[h]=r.params[h]);if(u)return o.path=S(u.path,o.params,'named route "'+a+'"'),i(u,o,n)}else if(o.path){o.params={};for(var l=0; l<c.length; l++){var d=c[l],y=s[d];if(V(y.regex,o.path,o.params))return i(y,o,n)}}return i(null,o)}function n(t, n){var o=t.redirect,u="function"==typeof o?o(a(t,n,null,e)):o;if("string"==typeof u&&(u={path:u}),!u||"object"!=typeof u)return i(null,n);var c=u,s=c.name,f=c.path,h=n.query,l=n.hash,d=n.params;if(h=c.hasOwnProperty("query")?c.query:h,l=c.hasOwnProperty("hash")?c.hash:l,d=c.hasOwnProperty("params")?c.params:d,s){p[s];return r({_normalized:!0,name:s,query:h,hash:l,params:d},void 0,n)}if(f){var y=z(f,t);return r({_normalized:!0,path:S(y,d,'redirect route with path "'+y+'"'),query:h,hash:l},void 0,n)}return i(null,n)}function o(t, e, n){var o=r({_normalized:!0,path:S(n,e.params,'aliased route with path "'+n+'"')});if(o){var a=o.matched,u=a[a.length-1];return e.params=o.params,i(u,e)}return i(null,e)}function i(t, r, i){return t&&t.redirect?n(t,i||r):t&&t.matchAs?o(t,r,t.matchAs):a(t,r,i,e)}var u=q(t),c=u.pathList,s=u.pathMap,p=u.nameMap;return{match:r,addRoutes:function(t){q(t,c,s,p)}}}function V(t, e, r){var n=e.match(t);if(!n)return!1;if(!r)return!0;for(var o=1,i=n.length; o<i; ++o){var a=t.keys[o-1],u="string"==typeof n[o]?decodeURIComponent(n[o]):n[o];a&&(r[a.name]=u)}return!0}function z(t, e){return v(t,e.parent?e.parent.path:"/",!0)}function B(){window.addEventListener("popstate",function(t){D(),t.state&&t.state.key&&Z(t.state.key)})}function F(t, e, r, n){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick(function(){var t=K(),i=o(e,r,n?t:null);if(i){var a="object"==typeof i;if(a&&"string"==typeof i.selector){var u=document.querySelector(i.selector);if(u){var c=i.offset&&"object"==typeof i.offset?i.offset:{};t=J(u,c=X(c))}else N(i)&&(t=Q(i))}else a&&N(i)&&(t=Q(i));t&&window.scrollTo(t.x,t.y)}})}}function D(){var t=G();t&&(Kt[t]={x:window.pageXOffset,y:window.pageYOffset})}function K(){var t=G();if(t)return Kt[t]}function J(t, e){var r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-r.left-e.x,y:n.top-r.top-e.y}}function N(t){return Y(t.x)||Y(t.y)}function Q(t){return{x:Y(t.x)?t.x:window.pageXOffset,y:Y(t.y)?t.y:window.pageYOffset}}function X(t){return{x:Y(t.x)?t.x:0,y:Y(t.y)?t.y:0}}function Y(t){return"number"==typeof t}function W(){return Nt.now().toFixed(3)}function G(){return Qt}function Z(t){Qt=t}function tt(t, e){D();var r=window.history;try{e?r.replaceState({key:Qt},"",t):(Qt=W(),r.pushState({key:Qt},"",t))}catch(r){window.location[e?"replace":"assign"](t)}}function et(t){tt(t,!0)}function rt(t, e, r){var n=function(o){o>=t.length?r():t[o]?e(t[o],function(){n(o+1)}):n(o+1)};n(0)}function nt(t){return function(r, n, o){var i=!1,a=0,u=null;ot(t,function(t, r, n, c){if("function"==typeof t&&void 0===t.cid){i=!0,a++;var s,p=at(function(e){e.__esModule&&e.default&&(e=e.default),t.resolved="function"==typeof e?e:Ot.extend(e),n.components[c]=e,--a<=0&&o()}),f=at(function(t){var r="Failed to resolve async component "+c+": "+t;u||(u=e(t)?t:new Error(r),o(u))});try{s=t(p,f)}catch(t){f(t)}if(s)if("function"==typeof s.then)s.then(p,f);else{var h=s.component;h&&"function"==typeof h.then&&h.then(p,f)}}}),i||o()}}function ot(t, e){return it(t.map(function(t){return Object.keys(t.components).map(function(r){return e(t.components[r],t.instances[r],t,r)})}))}function it(t){return Array.prototype.concat.apply([],t)}function at(t){var e=!1;return function(){for(var r=[],n=arguments.length; n--;)r[n]=arguments[n];if(!e)return e=!0,t.apply(this,r)}}function ut(t){if(!t)if(Ht){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function ct(t, e){var r,n=Math.max(t.length,e.length);for(r=0; r<n&&t[r]===e[r]; r++);return{updated:e.slice(0,r),activated:e.slice(r),deactivated:t.slice(r)}}function st(t, e, r, n){var o=ot(t,function(t, n, o, i){var a=pt(t,e);if(a)return Array.isArray(a)?a.map(function(t){return r(t,n,o,i)}):r(a,n,o,i)});return it(n?o.reverse():o)}function pt(t, e){return"function"!=typeof t&&(t=Ot.extend(t)),t.options[e]}function ft(t){return st(t,"beforeRouteLeave",lt,!0)}function ht(t){return st(t,"beforeRouteUpdate",lt)}function lt(t, e){if(e)return function(){return t.apply(e,arguments)}}function dt(t, e, r){return st(t,"beforeRouteEnter",function(t, n, o, i){return yt(t,o,i,e,r)})}function yt(t, e, r, n, o){return function(i, a, u){return t(i,a,function(t){u(t),"function"==typeof t&&n.push(function(){vt(t,e.instances,r,o)})})}}function vt(t, e, r, n){e[r]?t(e[r]):n()&&setTimeout(function(){vt(t,e,r,n)},16)}function mt(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 gt(t){var e=mt(t);if(!/^\/#/.test(e))return window.location.replace(g(t+"/#"+e)),!0}function bt(){var t=wt();return"/"===t.charAt(0)||(kt("/"+t),!1)}function wt(){var t=window.location.href,e=t.indexOf("#");return-1===e?"":t.slice(e+1)}function xt(t){window.location.hash=t}function kt(t){var e=window.location.href,r=e.indexOf("#"),n=r>=0?e.slice(0,r):e;window.location.replace(n+"#"+t)}function Rt(t, e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}function Et(t, e, r){var n="hash"===r?"#"+e:e;return t?g(t+"/"+n):n}var Ot,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t, e){var n=e.props,o=e.children,i=e.parent,a=e.data;a.routerView=!0;for(var u=i.$createElement,c=n.name,s=i.$route,p=i._routerViewCache||(i._routerViewCache={}),f=0,h=!1; i&&i._routerRoot!==i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(h=!0),i=i.$parent;if(a.routerViewDepth=f,h)return u(p[c],a,o);var l=s.matched[f];if(!l)return p[c]=null,u();var d=p[c]=l.components[c];return a.registerRouteInstance=function(t, e){var r=l.instances[c];(e&&r!==t||!e&&r===t)&&(l.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t, e){l.instances[c]=e.componentInstance},a.props=r(s,l.props&&l.props[c]),u(d,a,o)}},At=/[!'()*]/g,jt=function(t){return"%"+t.charCodeAt(0).toString(16)},_t=/%2C/g,Tt=function(t){return encodeURIComponent(t).replace(At,jt).replace(_t,",")},$t=decodeURIComponent,St=/\/?$/,qt=a(null,{path:"/"}),Lt=[String,Object],Pt=[String,Array],Ut={name:"router-link",props:{to:{type:Lt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Pt,default:"click"}},render:function(t){var e=this,r=this.$router,n=this.$route,o=r.resolve(this.to,n,this.append),i=o.location,u=o.route,c=o.href,p={},h=r.options.linkActiveClass,y=r.options.linkExactActiveClass,v=null==h?"router-link-active":h,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,b=null==this.exactActiveClass?m:this.exactActiveClass,w=i.path?a(null,i,null,r):u;p[b]=s(n,w),p[g]=this.exact?p[b]:f(n,w);var x=function(t){l(t)&&(e.replace?r.replace(i):r.push(i))},k={click:l};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var R={class:p};if("a"===this.tag)R.on=k,R.attrs={href:c};else{var E=d(this.$slots.default);if(E){E.isStatic=!1;var O=Ot.util.extend;(E.data=O({},E.data)).on=k,(E.data.attrs=O({},E.data.attrs)).href=c}else R.on=k}return t(this.tag,R,this.$slots.default)}},Ht="undefined"!=typeof window,It=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Mt=$,Vt=b,zt=k,Bt=T,Ft=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");Mt.parse=Vt,Mt.compile=function(t, e){return k(b(t,e))},Mt.tokensToFunction=zt,Mt.tokensToRegExp=Bt;var Dt=Object.create(null),Kt=Object.create(null),Jt=Ht&&function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)}(),Nt=Ht&&window.performance&&window.performance.now?window.performance:Date,Qt=W(),Xt=function(t, e){this.router=t,this.base=ut(e),this.current=qt,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Xt.prototype.listen=function(t){this.cb=t},Xt.prototype.onReady=function(t, e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Xt.prototype.onError=function(t){this.errorCbs.push(t)},Xt.prototype.transitionTo=function(t, e, r){var n=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){n.updateRoute(o),e&&e(o),n.ensureURL(),n.ready||(n.ready=!0,n.readyCbs.forEach(function(t){t(o)}))},function(t){r&&r(t),t&&!n.ready&&(n.ready=!0,n.readyErrorCbs.forEach(function(e){e(t)}))})},Xt.prototype.confirmTransition=function(r, n, o){var i=this,a=this.current,u=function(r){e(r)&&(i.errorCbs.length?i.errorCbs.forEach(function(t){t(r)}):(t(!1,"uncaught error during route navigation:"),console.error(r))),o&&o(r)};if(s(r,a)&&r.matched.length===a.matched.length)return this.ensureURL(),u();var c=ct(this.current.matched,r.matched),p=c.updated,f=c.deactivated,h=c.activated,l=[].concat(ft(f),this.router.beforeHooks,ht(p),h.map(function(t){return t.beforeEnter}),nt(h));this.pending=r;var d=function(t, n){if(i.pending!==r)return u();try{t(r,a,function(t){!1===t||e(t)?(i.ensureURL(!0),u(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(u(),"object"==typeof t&&t.replace?i.replace(t):i.push(t)):n(t)})}catch(t){u(t)}};rt(l,d,function(){var t=[];rt(dt(h,t,function(){return i.current===r}).concat(i.router.resolveHooks),d,function(){if(i.pending!==r)return u();i.pending=null,n(r),i.router.app&&i.router.app.$nextTick(function(){t.forEach(function(t){t()})})})})},Xt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(r){r&&r(t,e)})};var Yt=function(t){function e(e, r){var n=this;t.call(this,e,r);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){var r=n.current;n.transitionTo(mt(n.base),function(t){o&&F(e,t,r,!0)})})}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, e, r){var n=this,o=this.current;this.transitionTo(t,function(t){tt(g(n.base+t.fullPath)),F(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t, e, r){var n=this,o=this.current;this.transitionTo(t,function(t){et(g(n.base+t.fullPath)),F(n.router,t,o,!1),e&&e(t)},r)},e.prototype.ensureURL=function(t){if(mt(this.base)!==this.current.fullPath){var e=g(this.base+this.current.fullPath);t?tt(e):et(e)}},e.prototype.getCurrentLocation=function(){return mt(this.base)},e}(Xt),Wt=function(t){function e(e, r, n){t.call(this,e,r),n&&gt(this.base)||bt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){bt()&&t.transitionTo(wt(),function(t){kt(t.fullPath)})})},e.prototype.push=function(t, e, r){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},r)},e.prototype.replace=function(t, e, r){this.transitionTo(t,function(t){kt(t.fullPath),e&&e(t)},r)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;wt()!==e&&(t?xt(e):kt(e))},e.prototype.getCurrentLocation=function(){return wt()},e}(Xt),Gt=function(t){function e(e, r){t.call(this,e,r),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, e, r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)},r)},e.prototype.replace=function(t, e, r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)},r)},e.prototype.go=function(t){var e=this,r=this.index+t;if(!(r<0||r>=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){e.index=r,e.updateRoute(n)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Xt),Zt=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=M(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Jt&&!1!==t.fallback,this.fallback&&(e="hash"),Ht||(e="abstract"),this.mode=e,e){case"history":this.history=new Yt(this,t.base);break;case"hash":this.history=new Wt(this,t.base,this.fallback);break;case"abstract":this.history=new Gt(this,t.base)}},te={currentRoute:{}};return Zt.prototype.match=function(t, e, r){return this.matcher.match(t,e,r)},te.currentRoute.get=function(){return this.history&&this.history.current},Zt.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var r=this.history;if(r instanceof Yt)r.transitionTo(r.getCurrentLocation());else if(r instanceof Wt){var n=function(){r.setupListeners()};r.transitionTo(r.getCurrentLocation(),n,n)}r.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},Zt.prototype.beforeEach=function(t){return Rt(this.beforeHooks,t)},Zt.prototype.beforeResolve=function(t){return Rt(this.resolveHooks,t)},Zt.prototype.afterEach=function(t){return Rt(this.afterHooks,t)},Zt.prototype.onReady=function(t, e){this.history.onReady(t,e)},Zt.prototype.onError=function(t){this.history.onError(t)},Zt.prototype.push=function(t, e, r){this.history.push(t,e,r)},Zt.prototype.replace=function(t, e, r){this.history.replace(t,e,r)},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(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Zt.prototype.resolve=function(t, e, r){var n=H(t,e||this.history.current,r,this),o=this.match(n,e),i=o.redirectedFrom||o.fullPath;return{location:n,route:o,href:Et(this.history.base,i,this.mode),normalizedTo:n,resolved:o}},Zt.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==qt&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Zt.prototype,te),Zt.install=y,Zt.version="2.7.0",Ht&&window.Kdu&&window.Kdu.use(Zt),Zt});
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.KduRouter=e()}(this,function(){"use strict";function f(t){return-1<Object.prototype.toString.call(t).indexOf("Error")}var U={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){for(var r=e.props,n=e.children,o=e.parent,i=e.data,e=(i.routerView=!0,o.$createElement),a=r.name,r=o.$route,u=o._routerViewCache||(o._routerViewCache={}),c=0,s=!1;o&&o._routerRoot!==o;)o.$knode&&o.$knode.data.routerView&&c++,o._inactive&&(s=!0),o=o.$parent;if(i.routerViewDepth=c,s)return e(u[a],i,n);var p=r.matched[c];if(!p)return u[a]=null,e();var h,f=u[a]=p.components[a];for(h in i.registerRouteInstance=function(t,e){var r=p.instances[a];(e&&r!==t||!e&&r===t)&&(p.instances[a]=e)},(i.hook||(i.hook={})).prepatch=function(t,e){p.instances[a]=e.componentInstance},i.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}(r,p.props&&p.props[a]),i.attrs={},i.props)"props"in f&&h in f.props||(i.attrs[h]=i.props[h],delete i.props[h]);return e(f,i,n)}};function o(t){return encodeURIComponent(t).replace(M,H).replace(I,",")}var M=/[!'()*]/g,H=function(t){return"%"+t.charCodeAt(0).toString(16)},I=/%2C/g,z=decodeURIComponent;function B(t){var r={};return(t=t.trim().replace(/^(\?|#|&)/,""))&&t.split("&").forEach(function(t){var t=t.replace(/\+/g," ").split("="),e=z(t.shift()),t=0<t.length?z(t.join("=")):null;void 0===r[e]?r[e]=t:Array.isArray(r[e])?r[e].push(t):r[e]=[r[e],t]}),r}function K(n){var t=n?Object.keys(n).map(function(e){var r,t=n[e];return void 0===t?"":null===t?o(e):Array.isArray(t)?(r=[],t.forEach(function(t){void 0!==t&&r.push(null===t?o(e):o(e)+"="+o(t))}),r.join("&")):o(e)+"="+o(t)}).filter(function(t){return 0<t.length}).join("&"):null;return t?"?"+t:""}var r=/\/?$/;function d(t,e,r,n){var n=n&&n.options.stringifyQuery,o=e.query||{};try{o=i(o)}catch(t){}o={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:o,params:e.params||{},fullPath:F(e,n),matched:t?function(t){var e=[];for(;t;)e.unshift(t),t=t.parent;return e}(t):[]};return r&&(o.redirectedFrom=F(r,n)),Object.freeze(o)}function i(t){if(Array.isArray(t))return t.map(i);if(t&&"object"==typeof t){var e,r={};for(e in t)r[e]=i(t[e]);return r}return t}var u=d(null,{path:"/"});function F(t,e){var r=t.path,n=t.query,t=t.hash;return void 0===t&&(t=""),(r||"/")+(e||K)(n=void 0===n?{}:n)+t}function V(t,e){return e===u?t===e:!!e&&(t.path&&e.path?t.path.replace(r,"")===e.path.replace(r,"")&&t.hash===e.hash&&a(t.query,e.query):!(!t.name||!e.name)&&t.name===e.name&&t.hash===e.hash&&a(t.query,e.query)&&a(t.params,e.params))}function a(r,n){var t,e;return void 0===n&&(n={}),(r=void 0===r?{}:r)&&n?(t=Object.keys(r),e=Object.keys(n),t.length===e.length&&t.every(function(t){var e=r[t],t=n[t];return"object"==typeof e&&"object"==typeof t?a(e,t):String(e)===String(t)})):r===n}function D(t,e){return 0===t.path.replace(r,"/").indexOf(e.path.replace(r,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var r in e)if(!(r in t))return!1;return!0}(t.query,e.query)}var l,t=[String,Object],e=[String,Array],J={name:"router-link",props:{to:{type:t,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:e,default:"click"}},render:function(t){function e(t){N(t)&&(r.replace?n.replace(a):n.push(a))}var r=this,n=this.$router,o=this.$route,i=n.resolve(this.to,o,this.append),a=i.location,u=i.route,i=i.href,c={},s=n.options.linkActiveClass,p=n.options.linkExactActiveClass,s=null==this.activeClass?null==s?"router-link-active":s:this.activeClass,p=null==this.exactActiveClass?null==p?"router-link-exact-active":p:this.exactActiveClass,u=a.path?d(null,a,null,n):u,h=(c[p]=V(o,u),c[s]=this.exact?c[p]:D(o,u),{click:N}),s=(Array.isArray(this.event)?this.event.forEach(function(t){h[t]=e}):h[this.event]=e,{class:c});return"a"===this.tag?(s.on=h,s.attrs={href:i}):(p=function t(e){if(e)for(var r,n=0;n<e.length;n++){if("a"===(r=e[n]).tag)return r;if(r.children&&(r=t(r.children)))return r}}(this.$slots.default))?(p.isStatic=!1,o=l.util.extend,(p.data=o({},p.data)).on=h,(p.data.attrs=o({},p.data.attrs)).href=i):s.on=h,t(this.tag,s,this.$slots.default)}};function N(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function c(t){var n,e,r;c.installed&&l===t||(c.installed=!0,n=function(t){return void 0!==t},e=function(t,e){var r=t.$options._parentKnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)},(l=t).mixin({beforeCreate:function(){n(this.$options.router)?((this._routerRoot=this)._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,e(this,this)},destroyed:function(){e(this)}}),Object.defineProperty(t.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this._routerRoot._route}}),t.component("router-view",U),t.component("router-link",J),(r=t.config.optionMergeStrategies).beforeRouteEnter=r.beforeRouteLeave=r.beforeRouteUpdate=r.created)}var n="undefined"!=typeof window;function Q(t,e,r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;for(var o=e.split("/"),i=(r&&o[o.length-1]||o.pop(),t.replace(/^\//,"").split("/")),a=0;a<i.length;a++){var u=i[a];".."===u?o.pop():"."!==u&&o.push(u)}return""!==o[0]&&o.unshift(""),o.join("/")}function h(t){return t.replace(/\/\//g,"/")}function X(t,e){return Z(v(t,e),e)}var y=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},s=et,t=v,e=Z,Y=tt,W=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function v(t,e){for(var r=[],n=0,o=0,i="",a=e&&e.delimiter||"/";null!=(h=W.exec(t));){var u,c,s,p,h,f=h[0],l=h[1],d=h.index;i+=t.slice(o,d),o=d+f.length,l?i+=l[1]:(d=t[o],f=h[2],l=h[3],u=h[4],c=h[5],s=h[6],p=h[7],d=(i&&(r.push(i),i=""),null!=f&&null!=d&&d!==f),h=h[2]||a,r.push({name:l||n++,prefix:f||"",delimiter:h,optional:"?"===s||"*"===s,repeat:"+"===s||"*"===s,partial:d,asterisk:!!p,pattern:(l=u||c)?l.replace(/([=!:$\/()])/g,"\\$1"):p?".*":"[^"+m(h)+"]+?"}))}return o<t.length&&(i+=t.substr(o)),i&&r.push(i),r}function G(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Z(p,t){for(var h=new Array(p.length),e=0;e<p.length;e++)"object"==typeof p[e]&&(h[e]=new RegExp("^(?:"+p[e].pattern+")$",b(t)));return function(t,e){for(var r="",n=t||{},o=(e||{}).pretty?G:encodeURIComponent,i=0;i<p.length;i++){var a=p[i];if("string"==typeof a)r+=a;else{var u,c=n[a.name];if(null==c){if(a.optional){a.partial&&(r+=a.prefix);continue}throw new TypeError('Expected "'+a.name+'" to be defined')}if(y(c)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but received `'+JSON.stringify(c)+"`");if(0===c.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var s=0;s<c.length;s++){if(u=o(c[s]),!h[i].test(u))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'", but received `'+JSON.stringify(u)+"`");r+=(0===s?a.prefix:a.delimiter)+u}}else{if(u=a.asterisk?encodeURI(c).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):o(c),!h[i].test(u))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but received "'+u+'"');r+=a.prefix+u}}}return r}}function m(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function g(t,e){return t.keys=e,t}function b(t){return t&&t.sensitive?"":"i"}function tt(t,e,r){y(e)||(r=e||r,e=[]);for(var n=(r=r||{}).strict,o=!1!==r.end,i="",a=0;a<t.length;a++){var u,c,s=t[a];"string"==typeof s?i+=m(s):(u=m(s.prefix),c="(?:"+s.pattern+")",e.push(s),s.repeat&&(c+="(?:"+u+c+")*"),i+=c=s.optional?s.partial?u+"("+c+")?":"(?:"+u+"("+c+"))?":u+"("+c+")")}var p=m(r.delimiter||"/"),h=i.slice(-p.length)===p;return n||(i=(h?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":n&&h?"":"(?="+p+"|$)",g(new RegExp("^"+i,b(r)),e)}function et(t,e,r){if(y(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp){var n=t,o=e,i=n.source.match(/\((?!\?)/g);if(i)for(var a=0;a<i.length;a++)o.push({name:a,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return g(n,o)}if(y(t)){for(var u=t,c=e,s=r,p=[],h=0;h<u.length;h++)p.push(et(u[h],c,s).source);return g(new RegExp("(?:"+p.join("|")+")",b(s)),c)}return n=e,tt(v(t,e=r),n,e)}s.parse=t,s.compile=X,s.tokensToFunction=e,s.tokensToRegExp=Y;var rt=Object.create(null);function w(t,e){try{return(rt[t]||(rt[t]=s.compile(t)))(e||{},{pretty:!0})}catch(t){return""}}function nt(t,e,r,n){var o=e||[],i=r||Object.create(null),a=n||Object.create(null);t.forEach(function(t){!function r(n,o,i,e,a,u){var t=e.path;var c=e.name;var s=e.pathToRegexpOptions||{};t=it(t,a,s.strict);"boolean"==typeof e.caseSensitive&&(s.sensitive=e.caseSensitive);var p={path:t,regex:ot(t,s),components:e.components||{default:e.component},instances:{},name:c,parent:a,matchAs:u,redirect:e.redirect,beforeEnter:e.beforeEnter,meta:e.meta||{},props:null==e.props?{}:e.components?e.props:{default:e.props}};e.children&&e.children.forEach(function(t){var e=u?h(u+"/"+t.path):void 0;r(n,o,i,t,p,e)});void 0!==e.alias&&(Array.isArray(e.alias)?e.alias:[e.alias]).forEach(function(t){t={path:t,children:e.children};r(n,o,i,t,a,p.path||"/")});o[p.path]||(n.push(p.path),o[p.path]=p);!c||i[c]||(i[c]=p)}(o,i,a,t)});for(var u=0,c=o.length;u<c;u++)"*"===o[u]&&(o.push(o.splice(u,1)[0]),c--,u--);return{pathList:o,pathMap:i,nameMap:a}}function ot(t,e){return s(t,[],e)}function it(t,e,r){return"/"===(t=r?t:t.replace(/\/$/,""))[0]||null==e?t:h(e.path+"/"+t)}function at(t,e,r,n){var o,i,a,u,t="string"==typeof t?{path:t}:t;return t.name||t._normalized?t:!t.path&&t.params&&e?((t=ut({},t))._normalized=!0,i=ut(ut({},e.params),t.params),e.name?(t.name=e.name,t.params=i):e.matched.length&&(o=e.matched[e.matched.length-1].path,t.path=w(o,i,e.path)),t):(o=t.path||"",u=i="",0<=(a=o.indexOf("#"))&&(i=o.slice(a),o=o.slice(0,a)),0<=(a=o.indexOf("?"))&&(u=o.slice(a+1),o=o.slice(0,a)),a=e&&e.path||"/",{_normalized:!0,path:(e={path:o,query:u,hash:i}).path?Q(e.path,a,r||t.append):a,query:function(t,e,r){void 0===e&&(e={});var n,o,r=r||B;try{n=r(t||"")}catch(t){n={}}for(o in e)n[o]=e[o];return n}(e.query,t.query,n&&n.options.parseQuery),hash:u=(u=t.hash||e.hash)&&"#"!==u.charAt(0)?"#"+u:u})}function ut(t,e){for(var r in e)t[r]=e[r];return t}function ct(t,c){var t=nt(t),s=t.pathList,p=t.pathMap,h=t.nameMap;function f(t,e,r){var n=at(t,e,!1,c),t=n.name;if(t){t=h[t];if(!t)return l(null,n);var o=t.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof n.params&&(n.params={}),e&&"object"==typeof e.params)for(var i in e.params)!(i in n.params)&&-1<o.indexOf(i)&&(n.params[i]=e.params[i]);if(t)return n.path=w(t.path,n.params),l(t,n,r)}else if(n.path){n.params={};for(var a=0;a<s.length;a++){var u=s[a],u=p[u];if(function(t,e,r){var n=e.match(t);{if(!n)return;if(!r)return 1}for(var o=1,i=n.length;o<i;++o){var a=t.keys[o-1],u="string"==typeof n[o]?decodeURIComponent(n[o]):n[o];a&&(r[a.name]=u)}return 1}(u.regex,n.path,n.params))return l(u,n,r)}}return l(null,n)}function a(t,e){var r,n,o,i,a,u=t.redirect,u="function"==typeof u?u(d(t,e,null,c)):u;return(u="string"==typeof u?{path:u}:u)&&"object"==typeof u?(r=(u=u).name,n=u.path,o=e.query,i=e.hash,a=e.params,o=u.hasOwnProperty("query")?u.query:o,i=u.hasOwnProperty("hash")?u.hash:i,a=u.hasOwnProperty("params")?u.params:a,r?f({_normalized:!0,name:r,query:o,hash:i,params:a},void 0,e):n?f({_normalized:!0,path:w(Q(n,(u=t).parent?u.parent.path:"/",!0),a),query:o,hash:i},void 0,e):l(null,e)):l(null,e)}function l(t,e,r){var n,o,i;return t&&t.redirect?a(t,r||e):t&&t.matchAs?(n=e,(o=f({_normalized:!0,path:w(o=t.matchAs,n.params)}))?(i=(i=o.matched)[i.length-1],n.params=o.params,l(i,n)):l(null,n)):d(t,e,r,c)}return{match:f,addRoutes:function(t){nt(t,s,p,h)}}}var st=Object.create(null);function pt(){window.history.replaceState({key:R},""),window.addEventListener("popstate",function(t){ht(),t.state&&t.state.key&&(t=t.state.key,R=t)})}function p(t,r,n,o){var i;t.app&&(i=t.options.scrollBehavior)&&t.app.$nextTick(function(){var e=function(){var t=R;if(t)return st[t]}(),t=i(r,n,o?e:null);t&&("function"==typeof t.then?t.then(function(t){dt(t,e)}).catch(function(t){}):dt(t,e))})}function ht(){R&&(st[R]={x:window.pageXOffset,y:window.pageYOffset})}function ft(t){return x(t.x)||x(t.y)}function lt(t){return{x:x(t.x)?t.x:window.pageXOffset,y:x(t.y)?t.y:window.pageYOffset}}function x(t){return"number"==typeof t}function dt(t,e){var r,n,o,i="object"==typeof t;i&&"string"==typeof t.selector?(r=document.querySelector(t.selector))?(n=t.offset&&"object"==typeof t.offset?t.offset:{},n={x:x((o=n).x)?o.x:0,y:x(o.y)?o.y:0},o=r,r=n,n=document.documentElement.getBoundingClientRect(),e={x:(o=o.getBoundingClientRect()).left-n.left-r.x,y:o.top-n.top-r.y}):ft(t)&&(e=lt(t)):i&&ft(t)&&(e=lt(t)),e&&window.scrollTo(e.x,e.y)}var k=n&&(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,yt=n&&window.performance&&window.performance.now?window.performance:Date,R=vt();function vt(){return yt.now().toFixed(3)}function E(e,r){ht();var t=window.history;try{r?t.replaceState({key:R},"",e):(R=vt(),t.pushState({key:R},"",e))}catch(t){window.location[r?"replace":"assign"](e)}}function mt(t){E(t,!0)}function gt(e,r,n){function o(t){t>=e.length?n():e[t]?r(e[t],function(){o(t+1)}):o(t+1)}o(0)}function bt(r){return function(t,e,u){var c=!1,s=0,p=null;wt(r,function(r,t,n,o){if("function"==typeof r&&void 0===r.cid){c=!0,s++;var e,i=Rt(function(t){var e;((e=t).__esModule||kt&&"Module"===e[Symbol.toStringTag])&&(t=t.default),r.resolved="function"==typeof t?t:l.extend(t),n.components[o]=t,--s<=0&&u()}),a=Rt(function(t){var e="Failed to resolve async component "+o+": "+t;p||(p=f(t)?t:new Error(e),u(p))});try{e=r(i,a)}catch(t){a(t)}e&&("function"==typeof e.then?e.then(i,a):(e=e.component)&&"function"==typeof e.then&&e.then(i,a))}}),c||u()}}function wt(t,r){return xt(t.map(function(e){return Object.keys(e.components).map(function(t){return r(e.components[t],e.instances[t],e,t)})}))}function xt(t){return Array.prototype.concat.apply([],t)}var kt="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Rt(r){var n=!1;return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(!n)return n=!0,r.apply(this,t)}}function O(t,e){this.router=t,this.base=function(t){{var e;t=t||(n?(e=document.querySelector("base"),(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")):"/")}"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=u,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]}function Et(t,o,i,e){t=wt(t,function(t,e,r,n){t=function(t,e){"function"!=typeof t&&(t=l.extend(t));return t.options[e]}(t,o);if(t)return Array.isArray(t)?t.map(function(t){return i(t,e,r,n)}):i(t,e,r,n)});return xt(e?t.reverse():t)}function Ot(t,e){if(e)return function(){return t.apply(e,arguments)}}O.prototype.listen=function(t){this.cb=t},O.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},O.prototype.onError=function(t){this.errorCbs.push(t)},O.prototype.transitionTo=function(t,e,r){var n=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){n.updateRoute(o),e&&e(o),n.ensureURL(),n.ready||(n.ready=!0,n.readyCbs.forEach(function(t){t(o)}))},function(e){r&&r(e),e&&!n.ready&&(n.ready=!0,n.readyErrorCbs.forEach(function(t){t(e)}))})},O.prototype.confirmTransition=function(r,e,t){var n=this,o=this.current,i=function(e){f(e)&&(n.errorCbs.length?n.errorCbs.forEach(function(t){t(e)}):console.error(e)),t&&t(e)};if(V(r,o)&&r.matched.length===o.matched.length)return this.ensureURL(),i();function a(t,e){if(n.pending!==r)return i();try{t(r,o,function(t){!1===t||f(t)?(n.ensureURL(!0),i(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(i(),"object"==typeof t&&t.replace?n.replace(t):n.push(t)):e(t)})}catch(t){i(t)}}var u=function(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r<n&&t[r]===e[r];r++);return{updated:e.slice(0,r),activated:e.slice(r),deactivated:t.slice(r)}}(this.current.matched,r.matched),c=u.updated,s=u.deactivated,h=u.activated,u=[].concat(Et(s,"beforeRouteLeave",Ot,!0),this.router.beforeHooks,Et(c,"beforeRouteUpdate",Ot),h.map(function(t){return t.beforeEnter}),bt(h));this.pending=r;gt(u,a,function(){var s,p,t=[];s=t,p=function(){return n.current===r},gt(Et(h,"beforeRouteEnter",function(t,e,r,n){return o=t,i=r,a=n,u=s,c=p,function(t,e,r){return o(t,e,function(t){r(t),"function"==typeof t&&u.push(function(){!function t(e,r,n,o){r[n]?e(r[n]):o()&&setTimeout(function(){t(e,r,n,o)},16)}(t,i.instances,a,c)})})};var o,i,a,u,c}).concat(n.router.resolveHooks),a,function(){if(n.pending!==r)return i();n.pending=null,e(r),n.router.app&&n.router.app.$nextTick(function(){t.forEach(function(t){t()})})})})},O.prototype.updateRoute=function(e){var r=this.current;this.current=e,this.cb&&this.cb(e),this.router.afterHooks.forEach(function(t){t&&t(e,r)})};(C=O)&&(j.__proto__=C),((j.prototype=Object.create(C&&C.prototype)).constructor=j).prototype.go=function(t){window.history.go(t)},j.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){E(h(n.base+t.fullPath)),p(n.router,t,o,!1),e&&e(t)},r)},j.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){mt(h(n.base+t.fullPath)),p(n.router,t,o,!1),e&&e(t)},r)},j.prototype.ensureURL=function(t){A(this.base)!==this.current.fullPath&&(t?E:mt)(h(this.base+this.current.fullPath))},j.prototype.getCurrentLocation=function(){return A(this.base)};var C,Ct=j;function j(n,t){var o=this,i=(C.call(this,n,t),n.options.scrollBehavior),a=(i&&pt(),A(this.base));window.addEventListener("popstate",function(t){var e=o.current,r=A(o.base);o.current===u&&r===a||o.transitionTo(r,function(t){i&&p(n,t,e,!0)})})}function A(t){var e=window.location.pathname;return((e=t&&0===e.indexOf(t)?e.slice(t.length):e)||"/")+window.location.search+window.location.hash}(_=O)&&(T.__proto__=_),((T.prototype=Object.create(_&&_.prototype)).constructor=T).prototype.setupListeners=function(){var r=this,t=this.router.options.scrollBehavior,n=k&&t;n&&pt(),window.addEventListener(k?"popstate":"hashchange",function(){var e=r.current;At()&&r.transitionTo(S(),function(t){n&&p(r.router,t,e,!0),k||$(t.fullPath)})})},T.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){Tt(t.fullPath),p(n.router,t,o,!1),e&&e(t)},r)},T.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){$(t.fullPath),p(n.router,t,o,!1),e&&e(t)},r)},T.prototype.go=function(t){window.history.go(t)},T.prototype.ensureURL=function(t){var e=this.current.fullPath;S()!==e&&(t?Tt:$)(e)},T.prototype.getCurrentLocation=S;var _,jt=T;function T(t,e,r){_.call(this,t,e),r&&function(t){var e=A(t);if(!/^\/#/.test(e))return window.location.replace(h(t+"/#"+e)),1}(this.base)||At()}function At(){var t=S();if("/"===t.charAt(0))return 1;$("/"+t)}function S(){var t=window.location.href,e=t.indexOf("#");return-1===e?"":t.slice(e+1)}function _t(t){var e=window.location.href,r=e.indexOf("#");return(0<=r?e.slice(0,r):e)+"#"+t}function Tt(t){k?E(_t(t)):window.location.hash=t}function $(t){k?mt(_t(t)):window.location.replace(_t(t))}(q=O)&&(L.__proto__=q),((L.prototype=Object.create(q&&q.prototype)).constructor=L).prototype.push=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)},r)},L.prototype.replace=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)},r)},L.prototype.go=function(t){var e,r=this,n=this.index+t;n<0||n>=this.stack.length||(e=this.stack[n],this.confirmTransition(e,function(){r.index=n,r.updateRoute(e)}))},L.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},L.prototype.ensureURL=function(){};var q,St=L;function L(t,e){q.call(this,t,e),this.stack=[],this.index=-1}function P(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=ct(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!k&&!1!==t.fallback,this.fallback&&(e="hash"),this.mode=e=n?e:"abstract"){case"history":this.history=new Ct(this,t.base);break;case"hash":this.history=new jt(this,t.base,this.fallback);break;case"abstract":this.history=new St(this,t.base)}}e={currentRoute:{configurable:!0}};function $t(e,r){return e.push(r),function(){var t=e.indexOf(r);-1<t&&e.splice(t,1)}}return P.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},e.currentRoute.get=function(){return this.history&&this.history.current},P.prototype.init=function(t){var e,r=this;this.apps.push(t),this.app||(this.app=t,(e=this.history)instanceof Ct?e.transitionTo(e.getCurrentLocation()):e instanceof jt&&(t=function(){e.setupListeners()},e.transitionTo(e.getCurrentLocation(),t,t)),e.listen(function(e){r.apps.forEach(function(t){t._route=e})}))},P.prototype.beforeEach=function(t){return $t(this.beforeHooks,t)},P.prototype.beforeResolve=function(t){return $t(this.resolveHooks,t)},P.prototype.afterEach=function(t){return $t(this.afterHooks,t)},P.prototype.onReady=function(t,e){this.history.onReady(t,e)},P.prototype.onError=function(t){this.history.onError(t)},P.prototype.push=function(t,e,r){this.history.push(t,e,r)},P.prototype.replace=function(t,e,r){this.history.replace(t,e,r)},P.prototype.go=function(t){this.history.go(t)},P.prototype.back=function(){this.go(-1)},P.prototype.forward=function(){this.go(1)},P.prototype.getMatchedComponents=function(t){t=t?t.matched?t:this.resolve(t).route:this.currentRoute;return t?[].concat.apply([],t.matched.map(function(e){return Object.keys(e.components).map(function(t){return e.components[t]})})):[]},P.prototype.resolve=function(t,e,r){t=at(t,e||this.history.current,r,this),r=this.match(t,e),e=r.redirectedFrom||r.fullPath;return{location:t,route:r,href:function(t,e,r){r="hash"===r?"#"+e:e;return t?h(t+"/"+r):r}(this.history.base,e,this.mode),normalizedTo:t,resolved:r}},P.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==u&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(P.prototype,e),P.install=c,P.version="3.0.0",n&&window.Kdu&&window.Kdu.use(P),P});