kdu-router 3.0.1 → 3.0.7

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
- /**
2
- * kdu-router v3.0.1
1
+ /*!
2
+ * kdu-router v3.0.7
3
3
  * (c) 2022 NKDuy
4
4
  * @license MIT
5
5
  */
@@ -27,8 +27,15 @@ function isError (err) {
27
27
  return Object.prototype.toString.call(err).indexOf('Error') > -1
28
28
  }
29
29
 
30
+ function extend (a, b) {
31
+ for (var key in b) {
32
+ a[key] = b[key];
33
+ }
34
+ return a
35
+ }
36
+
30
37
  var View = {
31
- name: 'router-view',
38
+ name: 'RouterView',
32
39
  functional: true,
33
40
  props: {
34
41
  name: {
@@ -42,6 +49,7 @@ var View = {
42
49
  var parent = ref.parent;
43
50
  var data = ref.data;
44
51
 
52
+ // used by devtools to display a router-view badge
45
53
  data.routerView = true;
46
54
 
47
55
  // directly use parent context's createElement() function
@@ -56,11 +64,14 @@ var View = {
56
64
  var depth = 0;
57
65
  var inactive = false;
58
66
  while (parent && parent._routerRoot !== parent) {
59
- if (parent.$knode && parent.$knode.data.routerView) {
60
- depth++;
61
- }
62
- if (parent._inactive) {
63
- inactive = true;
67
+ var knodeData = parent.$knode && parent.$knode.data;
68
+ if (knodeData) {
69
+ if (knodeData.routerView) {
70
+ depth++;
71
+ }
72
+ if (knodeData.keepAlive && parent._inactive) {
73
+ inactive = true;
74
+ }
64
75
  }
65
76
  parent = parent.$parent;
66
77
  }
@@ -99,6 +110,17 @@ var View = {
99
110
  matched.instances[name] = knode.componentInstance;
100
111
  };
101
112
 
113
+ // register instance in init hook
114
+ // in case kept-alive component be actived when routes changed
115
+ data.hook.init = function (knode) {
116
+ if (knode.data.keepAlive &&
117
+ knode.componentInstance &&
118
+ knode.componentInstance !== matched.instances[name]
119
+ ) {
120
+ matched.instances[name] = knode.componentInstance;
121
+ }
122
+ };
123
+
102
124
  // resolve props
103
125
  var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
104
126
  if (propsToPass) {
@@ -116,7 +138,7 @@ var View = {
116
138
 
117
139
  return h(component, data, children)
118
140
  }
119
- };
141
+ }
120
142
 
121
143
  function resolveProps (route, config) {
122
144
  switch (typeof config) {
@@ -139,13 +161,6 @@ function resolveProps (route, config) {
139
161
  }
140
162
  }
141
163
 
142
- function extend (to, from) {
143
- for (var key in from) {
144
- to[key] = from[key];
145
- }
146
- return to
147
- }
148
-
149
164
  /* */
150
165
 
151
166
  var encodeReserveRE = /[!'()*]/g;
@@ -244,7 +259,6 @@ function stringifyQuery (obj) {
244
259
 
245
260
  /* */
246
261
 
247
-
248
262
  var trailingSlashRE = /\/?$/;
249
263
 
250
264
  function createRoute (
@@ -387,7 +401,7 @@ var toTypes = [String, Object];
387
401
  var eventTypes = [String, Array];
388
402
 
389
403
  var Link = {
390
- name: 'router-link',
404
+ name: 'RouterLink',
391
405
  props: {
392
406
  to: {
393
407
  type: toTypes,
@@ -422,17 +436,17 @@ var Link = {
422
436
  var globalExactActiveClass = router.options.linkExactActiveClass;
423
437
  // Support global empty active class
424
438
  var activeClassFallback = globalActiveClass == null
425
- ? 'router-link-active'
426
- : globalActiveClass;
439
+ ? 'router-link-active'
440
+ : globalActiveClass;
427
441
  var exactActiveClassFallback = globalExactActiveClass == null
428
- ? 'router-link-exact-active'
429
- : globalExactActiveClass;
442
+ ? 'router-link-exact-active'
443
+ : globalExactActiveClass;
430
444
  var activeClass = this.activeClass == null
431
- ? activeClassFallback
432
- : this.activeClass;
445
+ ? activeClassFallback
446
+ : this.activeClass;
433
447
  var exactActiveClass = this.exactActiveClass == null
434
- ? exactActiveClassFallback
435
- : this.exactActiveClass;
448
+ ? exactActiveClassFallback
449
+ : this.exactActiveClass;
436
450
  var compareTarget = location.path
437
451
  ? createRoute(null, location, null, router)
438
452
  : route;
@@ -472,7 +486,6 @@ var Link = {
472
486
  if (a) {
473
487
  // in case the <a> is a static node
474
488
  a.isStatic = false;
475
- var extend = _Kdu.util.extend;
476
489
  var aData = a.data = extend({}, a.data);
477
490
  aData.on = on;
478
491
  var aAttrs = a.data.attrs = extend({}, a.data.attrs);
@@ -485,7 +498,7 @@ var Link = {
485
498
 
486
499
  return h(this.tag, data, this.$slots.default)
487
500
  }
488
- };
501
+ }
489
502
 
490
503
  function guardEvent (e) {
491
504
  // don't redirect with control keys
@@ -563,8 +576,8 @@ function install (Kdu) {
563
576
  get: function get () { return this._routerRoot._route }
564
577
  });
565
578
 
566
- Kdu.component('router-view', View);
567
- Kdu.component('router-link', Link);
579
+ Kdu.component('RouterView', View);
580
+ Kdu.component('RouterLink', Link);
568
581
 
569
582
  var strats = Kdu.config.optionMergeStrategies;
570
583
  // use the same hook merging strategy for route hooks
@@ -1074,7 +1087,6 @@ function pathToRegexp (path, keys, options) {
1074
1087
 
1075
1088
  return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
1076
1089
  }
1077
-
1078
1090
  pathToRegexp_1.parse = parse_1;
1079
1091
  pathToRegexp_1.compile = compile_1;
1080
1092
  pathToRegexp_1.tokensToFunction = tokensToFunction_1;
@@ -1090,16 +1102,24 @@ function fillParams (
1090
1102
  params,
1091
1103
  routeMsg
1092
1104
  ) {
1105
+ params = params || {};
1093
1106
  try {
1094
1107
  var filler =
1095
1108
  regexpCompileCache[path] ||
1096
1109
  (regexpCompileCache[path] = pathToRegexp_1.compile(path));
1097
- return filler(params || {}, { pretty: true })
1110
+
1111
+ // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
1112
+ if (params.pathMatch) { params[0] = params.pathMatch; }
1113
+
1114
+ return filler(params, { pretty: true })
1098
1115
  } catch (e) {
1099
1116
  {
1100
1117
  warn(false, ("missing param for " + routeMsg + ": " + (e.message)));
1101
1118
  }
1102
1119
  return ''
1120
+ } finally {
1121
+ // delete the 0 if it was added
1122
+ delete params[0];
1103
1123
  }
1104
1124
  }
1105
1125
 
@@ -1270,7 +1290,6 @@ function normalizePath (path, parent, strict) {
1270
1290
 
1271
1291
  /* */
1272
1292
 
1273
-
1274
1293
  function normalizeLocation (
1275
1294
  raw,
1276
1295
  current,
@@ -1279,15 +1298,17 @@ function normalizeLocation (
1279
1298
  ) {
1280
1299
  var next = typeof raw === 'string' ? { path: raw } : raw;
1281
1300
  // named target
1282
- if (next.name || next._normalized) {
1301
+ if (next._normalized) {
1283
1302
  return next
1303
+ } else if (next.name) {
1304
+ return extend({}, raw)
1284
1305
  }
1285
1306
 
1286
1307
  // relative params
1287
1308
  if (!next.path && next.params && current) {
1288
- next = assign({}, next);
1309
+ next = extend({}, next);
1289
1310
  next._normalized = true;
1290
- var params = assign(assign({}, current.params), next.params);
1311
+ var params = extend(extend({}, current.params), next.params);
1291
1312
  if (current.name) {
1292
1313
  next.name = current.name;
1293
1314
  next.params = params;
@@ -1325,16 +1346,10 @@ function normalizeLocation (
1325
1346
  }
1326
1347
  }
1327
1348
 
1328
- function assign (a, b) {
1329
- for (var key in b) {
1330
- a[key] = b[key];
1331
- }
1332
- return a
1333
- }
1334
-
1335
1349
  /* */
1336
1350
 
1337
1351
 
1352
+
1338
1353
  function createMatcher (
1339
1354
  routes,
1340
1355
  router
@@ -1378,10 +1393,8 @@ function createMatcher (
1378
1393
  }
1379
1394
  }
1380
1395
 
1381
- if (record) {
1382
- location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
1383
- return _createRoute(record, location, redirectedFrom)
1384
- }
1396
+ location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
1397
+ return _createRoute(record, location, redirectedFrom)
1385
1398
  } else if (location.path) {
1386
1399
  location.params = {};
1387
1400
  for (var i = 0; i < pathList.length; i++) {
@@ -1402,8 +1415,8 @@ function createMatcher (
1402
1415
  ) {
1403
1416
  var originalRedirect = record.redirect;
1404
1417
  var redirect = typeof originalRedirect === 'function'
1405
- ? originalRedirect(createRoute(record, location, null, router))
1406
- : originalRedirect;
1418
+ ? originalRedirect(createRoute(record, location, null, router))
1419
+ : originalRedirect;
1407
1420
 
1408
1421
  if (typeof redirect === 'string') {
1409
1422
  redirect = { path: redirect };
@@ -1517,7 +1530,8 @@ function matchRoute (
1517
1530
  var key = regex.keys[i - 1];
1518
1531
  var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
1519
1532
  if (key) {
1520
- params[key.name] = val;
1533
+ // Fix #1994: using * with props: true generates a param named 0
1534
+ params[key.name || 'pathMatch'] = val;
1521
1535
  }
1522
1536
  }
1523
1537
 
@@ -1530,12 +1544,17 @@ function resolveRecordPath (path, record) {
1530
1544
 
1531
1545
  /* */
1532
1546
 
1533
-
1534
1547
  var positionStore = Object.create(null);
1535
1548
 
1536
1549
  function setupScroll () {
1537
1550
  // Fix for #1585 for Firefox
1538
- window.history.replaceState({ key: getStateKey() }, '');
1551
+ // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
1552
+ // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
1553
+ // window.location.protocol + '//' + window.location.host
1554
+ // location.host contains the port and location.hostname doesn't
1555
+ var protocolAndPath = window.location.protocol + '//' + window.location.host;
1556
+ var absolutePath = window.location.href.replace(protocolAndPath, '');
1557
+ window.history.replaceState({ key: getStateKey() }, '', absolutePath);
1539
1558
  window.addEventListener('popstate', function (e) {
1540
1559
  saveScrollPosition();
1541
1560
  if (e.state && e.state.key) {
@@ -1566,7 +1585,7 @@ function handleScroll (
1566
1585
  // wait until re-render finishes before scrolling
1567
1586
  router.app.$nextTick(function () {
1568
1587
  var position = getScrollPosition();
1569
- var shouldScroll = behavior(to, from, isPop ? position : null);
1588
+ var shouldScroll = behavior.call(router, to, from, isPop ? position : null);
1570
1589
 
1571
1590
  if (!shouldScroll) {
1572
1591
  return
@@ -2107,7 +2126,6 @@ function bindEnterGuard (
2107
2126
  ) {
2108
2127
  return function routeEnterGuard (to, from, next) {
2109
2128
  return guard(to, from, function (cb) {
2110
- next(cb);
2111
2129
  if (typeof cb === 'function') {
2112
2130
  cbs.push(function () {
2113
2131
  // #750
@@ -2118,6 +2136,7 @@ function bindEnterGuard (
2118
2136
  poll(cb, match.instances, key, isValid);
2119
2137
  });
2120
2138
  }
2139
+ next(cb);
2121
2140
  })
2122
2141
  }
2123
2142
  }
@@ -2128,7 +2147,10 @@ function poll (
2128
2147
  key,
2129
2148
  isValid
2130
2149
  ) {
2131
- if (instances[key]) {
2150
+ if (
2151
+ instances[key] &&
2152
+ !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
2153
+ ) {
2132
2154
  cb(instances[key]);
2133
2155
  } else if (isValid()) {
2134
2156
  setTimeout(function () {
@@ -2139,16 +2161,16 @@ function poll (
2139
2161
 
2140
2162
  /* */
2141
2163
 
2142
-
2143
- var HTML5History = (function (History$$1) {
2164
+ var HTML5History = /*@__PURE__*/(function (History$$1) {
2144
2165
  function HTML5History (router, base) {
2145
2166
  var this$1 = this;
2146
2167
 
2147
2168
  History$$1.call(this, router, base);
2148
2169
 
2149
2170
  var expectScroll = router.options.scrollBehavior;
2171
+ var supportsScroll = supportsPushState && expectScroll;
2150
2172
 
2151
- if (expectScroll) {
2173
+ if (supportsScroll) {
2152
2174
  setupScroll();
2153
2175
  }
2154
2176
 
@@ -2164,7 +2186,7 @@ var HTML5History = (function (History$$1) {
2164
2186
  }
2165
2187
 
2166
2188
  this$1.transitionTo(location, function (route) {
2167
- if (expectScroll) {
2189
+ if (supportsScroll) {
2168
2190
  handleScroll(router, route, current, true);
2169
2191
  }
2170
2192
  });
@@ -2218,7 +2240,7 @@ var HTML5History = (function (History$$1) {
2218
2240
  }(History));
2219
2241
 
2220
2242
  function getLocation (base) {
2221
- var path = window.location.pathname;
2243
+ var path = decodeURI(window.location.pathname);
2222
2244
  if (base && path.indexOf(base) === 0) {
2223
2245
  path = path.slice(base.length);
2224
2246
  }
@@ -2227,8 +2249,7 @@ function getLocation (base) {
2227
2249
 
2228
2250
  /* */
2229
2251
 
2230
-
2231
- var HashHistory = (function (History$$1) {
2252
+ var HashHistory = /*@__PURE__*/(function (History$$1) {
2232
2253
  function HashHistory (router, base, fallback) {
2233
2254
  History$$1.call(this, router, base);
2234
2255
  // check history fallback deeplinking
@@ -2337,7 +2358,22 @@ function getHash () {
2337
2358
  // consistent across browsers - Firefox will pre-decode it!
2338
2359
  var href = window.location.href;
2339
2360
  var index = href.indexOf('#');
2340
- return index === -1 ? '' : href.slice(index + 1)
2361
+ // empty path
2362
+ if (index < 0) { return '' }
2363
+
2364
+ href = href.slice(index + 1);
2365
+ // decode the hash but not the search or hash
2366
+ // as search(query) is already decoded
2367
+ var searchIndex = href.indexOf('?');
2368
+ if (searchIndex < 0) {
2369
+ var hashIndex = href.indexOf('#');
2370
+ if (hashIndex > -1) { href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex); }
2371
+ else { href = decodeURI(href); }
2372
+ } else {
2373
+ if (searchIndex > -1) { href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex); }
2374
+ }
2375
+
2376
+ return href
2341
2377
  }
2342
2378
 
2343
2379
  function getUrl (path) {
@@ -2365,8 +2401,7 @@ function replaceHash (path) {
2365
2401
 
2366
2402
  /* */
2367
2403
 
2368
-
2369
- var AbstractHistory = (function (History$$1) {
2404
+ var AbstractHistory = /*@__PURE__*/(function (History$$1) {
2370
2405
  function AbstractHistory (router, base) {
2371
2406
  History$$1.call(this, router, base);
2372
2407
  this.stack = [];
@@ -2424,6 +2459,8 @@ var AbstractHistory = (function (History$$1) {
2424
2459
 
2425
2460
  /* */
2426
2461
 
2462
+
2463
+
2427
2464
  var KduRouter = function KduRouter (options) {
2428
2465
  if ( options === void 0 ) options = {};
2429
2466
 
@@ -2487,7 +2524,18 @@ KduRouter.prototype.init = function init (app /* Kdu component instance */) {
2487
2524
 
2488
2525
  this.apps.push(app);
2489
2526
 
2490
- // main app already initialized.
2527
+ // set up app destroyed handler
2528
+ app.$once('hook:destroyed', function () {
2529
+ // clean out app from this.apps array once destroyed
2530
+ var index = this$1.apps.indexOf(app);
2531
+ if (index > -1) { this$1.apps.splice(index, 1); }
2532
+ // ensure we still have a main app or null if no apps
2533
+ // we do not release the router so it can be reused
2534
+ if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
2535
+ });
2536
+
2537
+ // main app previously initialized
2538
+ // return as we don't need to set up new history listener
2491
2539
  if (this.app) {
2492
2540
  return
2493
2541
  }
@@ -2577,9 +2625,10 @@ KduRouter.prototype.resolve = function resolve (
2577
2625
  current,
2578
2626
  append
2579
2627
  ) {
2628
+ current = current || this.history.current;
2580
2629
  var location = normalizeLocation(
2581
2630
  to,
2582
- current || this.history.current,
2631
+ current,
2583
2632
  append,
2584
2633
  this
2585
2634
  );
@@ -2620,7 +2669,7 @@ function createHref (base, fullPath, mode) {
2620
2669
  }
2621
2670
 
2622
2671
  KduRouter.install = install;
2623
- KduRouter.version = '3.0.1';
2672
+ KduRouter.version = '3.0.7';
2624
2673
 
2625
2674
  if (inBrowser && window.Kdu) {
2626
2675
  window.Kdu.use(KduRouter);
@@ -1,6 +1,11 @@
1
- /**
2
- * kdu-router v3.0.1
1
+ /*!
2
+ * kdu-router v3.0.7
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 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,e=e.data,i=(e.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(e.routerViewDepth=c,s)return i(u[a],e,n);var p=r.matched[c];if(!p)return u[a]=null,i();var h=u[a]=p.components[a];if(e.registerRouteInstance=function(t,e){var r=p.instances[a];(e&&r!==t||!e&&r===t)&&(p.instances[a]=e)},(e.hook||(e.hook={})).prepatch=function(t,e){p.instances[a]=e.componentInstance},l=e.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])){var f,l=e.props=function(t,e){for(var r in e)t[r]=e[r];return t}({},l),d=e.attrs=e.attrs||{};for(f in l)h.props&&f in h.props||(d[f]=l[f],delete l[f])}return i(h,e,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.1",n&&window.Kdu&&window.Kdu.use(P),P});
6
+ /*!
7
+ * kdu-router v3.0.7
8
+ * (c) 2022 NKDuy
9
+ * @license MIT
10
+ */
11
+ var t,e;t=this,e=function(){"use strict";function t(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function e(t,e){for(var r in e)t[r]=e[r];return t}var r={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,r){var n=r.props,o=r.children,i=r.parent,a=r.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;){var l=i.$knode&&i.$knode.data;l&&(l.routerView&&f++,l.keepAlive&&i._inactive&&(h=!0)),i=i.$parent}if(a.routerViewDepth=f,h)return u(p[c],a,o);var d=s.matched[f];if(!d)return p[c]=null,u();var y=p[c]=d.components[c];a.registerRouteInstance=function(t,e){var r=d.instances[c];(e&&r!==t||!e&&r===t)&&(d.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){d.instances[c]=e.componentInstance},a.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==d.instances[c]&&(d.instances[c]=t.componentInstance)};var v=a.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}}(s,d.props&&d.props[c]);if(v){v=a.props=e({},v);var m=a.attrs=a.attrs||{};for(var g in v)y.props&&g in y.props||(m[g]=v[g],delete v[g])}return u(y,a,o)}},n=/[!'()*]/g,o=function(t){return"%"+t.charCodeAt(0).toString(16)},i=/%2C/g,a=function(t){return encodeURIComponent(t).replace(n,o).replace(i,",")},u=decodeURIComponent;function c(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var r=t.replace(/\+/g," ").split("="),n=u(r.shift()),o=r.length>0?u(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 s(t){var e=t?Object.keys(t).map((function(e){var r=t[e];if(void 0===r)return"";if(null===r)return a(e);if(Array.isArray(r)){var n=[];return r.forEach((function(t){void 0!==t&&(null===t?n.push(a(e)):n.push(a(e)+"="+a(t)))})),n.join("&")}return a(e)+"="+a(r)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var p=/\/?$/;function f(t,e,r,n){var o=n&&n.options.stringifyQuery,i=e.query||{};try{i=h(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:y(e,o),matched:t?d(t):[]};return r&&(a.redirectedFrom=y(r,o)),Object.freeze(a)}function h(t){if(Array.isArray(t))return t.map(h);if(t&&"object"==typeof t){var e={};for(var r in t)e[r]=h(t[r]);return e}return t}var l=f(null,{path:"/"});function d(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function y(t,e){var r=t.path,n=t.query;void 0===n&&(n={});var o=t.hash;return void 0===o&&(o=""),(r||"/")+(e||s)(n)+o}function v(t,e){return e===l?t===e:!!e&&(t.path&&e.path?t.path.replace(p,"")===e.path.replace(p,"")&&t.hash===e.hash&&m(t.query,e.query):!(!t.name||!e.name)&&t.name===e.name&&t.hash===e.hash&&m(t.query,e.query)&&m(t.params,e.params))}function m(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===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?m(n,o):String(n)===String(o)}))}var g,b={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:[String,Array],default:"click"}},render:function(t){var r=this,n=this.$router,o=this.$route,i=n.resolve(this.to,o,this.append),a=i.location,u=i.route,c=i.href,s={},h=n.options.linkActiveClass,l=n.options.linkExactActiveClass,d=null==h?"router-link-active":h,y=null==l?"router-link-exact-active":l,m=null==this.activeClass?d:this.activeClass,g=null==this.exactActiveClass?y:this.exactActiveClass,b=a.path?f(null,a,null,n):u;s[g]=v(o,b),s[m]=this.exact?s[g]:function(t,e){return 0===t.path.replace(p,"/").indexOf(e.path.replace(p,"/"))&&(!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)}(o,b);var x=function(t){w(t)&&(r.replace?n.replace(a):n.push(a))},k={click:w};Array.isArray(this.event)?this.event.forEach((function(t){k[t]=x})):k[this.event]=x;var R={class:s};if("a"===this.tag)R.on=k,R.attrs={href:c};else{var E=function t(e){var r;if(e)for(var 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);E?(E.isStatic=!1,(E.data=e({},E.data)).on=k,(E.data.attrs=e({},E.data.attrs)).href=c):R.on=k}return t(this.tag,R,this.$slots.default)}};function w(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}}var x="undefined"!=typeof window;function k(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 R(t){return t.replace(/\/\//g,"/")}var E=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},O=B,A=S,C=function(t,e){return L(S(t,e),e)},j=L,_=M,T=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function S(t,e){for(var r,n=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(r=T.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?U(k):m?".*":"[^"+q(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&n.push(a),n}function $(t){return encodeURI(t).replace(/[\/?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}))}function L(t,e){for(var r=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(r[n]=new RegExp("^(?:"+t[n].pattern+")$",I(e)));return function(e,n){for(var o="",i=e||{},a=(n||{}).pretty?$: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(E(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]),!r[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?encodeURI(p).replace(/[?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})):a(p),!r[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 q(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function U(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function P(t,e){return t.keys=e,t}function I(t){return t&&t.sensitive?"":"i"}function M(t,e,r){E(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+=q(u);else{var c=q(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=q(r.delimiter||"/"),f=i.slice(-p.length)===p;return n||(i=(f?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":n&&f?"":"(?="+p+"|$)",P(new RegExp("^"+i,I(r)),e)}function B(t,e,r){return E(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp?function(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 P(t,e)}(t,e):E(t)?function(t,e,r){for(var n=[],o=0;o<t.length;o++)n.push(B(t[o],e,r).source);return P(new RegExp("(?:"+n.join("|")+")",I(r)),e)}(t,e,r):function(t,e,r){return M(S(t,r),e,r)}(t,e,r)}O.parse=A,O.compile=C,O.tokensToFunction=j,O.tokensToRegExp=_;var H=Object.create(null);function z(t,e,r){e=e||{};try{var n=H[t]||(H[t]=O.compile(t));return e.pathMatch&&(e[0]=e.pathMatch),n(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function K(t,e,r,n){var o=e||[],i=r||Object.create(null),a=n||Object.create(null);t.forEach((function(t){!function t(e,r,n,o,i,a){var u=o.path,c=o.name,s=o.pathToRegexpOptions||{},p=function(t,e,r){return r||(t=t.replace(/\/$/,"")),"/"===t[0]||null==e?t:R(e.path+"/"+t)}(u,i,s.strict);"boolean"==typeof o.caseSensitive&&(s.sensitive=o.caseSensitive);var f={path:p,regex:V(p,s),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:a,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach((function(o){var i=a?R(a+"/"+o.path):void 0;t(e,r,n,o,f,i)})),void 0!==o.alias&&(Array.isArray(o.alias)?o.alias:[o.alias]).forEach((function(a){var u={path:a,children:o.children};t(e,r,n,u,i,f.path||"/")})),r[f.path]||(e.push(f.path),r[f.path]=f),c&&(n[c]||(n[c]=f))}(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 V(t,e){return O(t,[],e)}function D(t,r,n,o){var i="string"==typeof t?{path:t}:t;if(i._normalized)return i;if(i.name)return e({},t);if(!i.path&&i.params&&r){(i=e({},i))._normalized=!0;var a=e(e({},r.params),i.params);if(r.name)i.name=r.name,i.params=a;else if(r.matched.length){var u=r.matched[r.matched.length-1].path;i.path=z(u,a,r.path)}return i}var s=function(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}}(i.path||""),p=r&&r.path||"/",f=s.path?k(s.path,p,n||i.append):p,h=function(t,e,r){void 0===e&&(e={});var n,o=r||c;try{n=o(t||"")}catch(t){n={}}for(var i in e)n[i]=e[i];return n}(s.query,i.query,o&&o.options.parseQuery),l=i.hash||s.hash;return l&&"#"!==l.charAt(0)&&(l="#"+l),{_normalized:!0,path:f,query:h,hash:l}}function F(t,e){var r=K(t),n=r.pathList,o=r.pathMap,i=r.nameMap;function a(t,r,a){var u=D(t,r,!1,e),s=u.name;if(s){var p=i[s];if(!p)return c(null,u);var f=p.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof u.params&&(u.params={}),r&&"object"==typeof r.params)for(var h in r.params)!(h in u.params)&&f.indexOf(h)>-1&&(u.params[h]=r.params[h]);return u.path=z(p.path,u.params),c(p,u,a)}if(u.path){u.params={};for(var l=0;l<n.length;l++){var d=n[l],y=o[d];if(J(y.regex,u.path,u.params))return c(y,u,a)}}return c(null,u)}function u(t,r){var n=t.redirect,o="function"==typeof n?n(f(t,r,null,e)):n;if("string"==typeof o&&(o={path:o}),!o||"object"!=typeof o)return c(null,r);var u=o,s=u.name,p=u.path,h=r.query,l=r.hash,d=r.params;if(h=u.hasOwnProperty("query")?u.query:h,l=u.hasOwnProperty("hash")?u.hash:l,d=u.hasOwnProperty("params")?u.params:d,s)return i[s],a({_normalized:!0,name:s,query:h,hash:l,params:d},void 0,r);if(p){var y=function(t,e){return k(t,e.parent?e.parent.path:"/",!0)}(p,t);return a({_normalized:!0,path:z(y,d),query:h,hash:l},void 0,r)}return c(null,r)}function c(t,r,n){return t&&t.redirect?u(t,n||r):t&&t.matchAs?function(t,e,r){var n=a({_normalized:!0,path:z(r,e.params)});if(n){var o=n.matched,i=o[o.length-1];return e.params=n.params,c(i,e)}return c(null,e)}(0,r,t.matchAs):f(t,r,n,e)}return{match:a,addRoutes:function(t){K(t,n,o,i)}}}function J(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||"pathMatch"]=u)}return!0}var N=Object.create(null);function Q(){var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,"");window.history.replaceState({key:at()},"",e),window.addEventListener("popstate",(function(t){var e;Y(),t.state&&t.state.key&&(e=t.state.key,ot=e)}))}function X(t,e,r,n){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick((function(){var i=function(){var t=at();if(t)return N[t]}(),a=o.call(t,e,r,n?i:null);a&&("function"==typeof a.then?a.then((function(t){tt(t,i)})).catch((function(t){})):tt(a,i))}))}}function Y(){var t=at();t&&(N[t]={x:window.pageXOffset,y:window.pageYOffset})}function W(t){return Z(t.x)||Z(t.y)}function G(t){return{x:Z(t.x)?t.x:window.pageXOffset,y:Z(t.y)?t.y:window.pageYOffset}}function Z(t){return"number"==typeof t}function tt(t,e){var r,n="object"==typeof t;if(n&&"string"==typeof t.selector){var o=document.querySelector(t.selector);if(o){var i=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(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}}(o,i={x:Z((r=i).x)?r.x:0,y:Z(r.y)?r.y:0})}else W(t)&&(e=G(t))}else n&&W(t)&&(e=G(t));e&&window.scrollTo(e.x,e.y)}var et,rt=x&&(-1===(et=window.navigator.userAgent).indexOf("Android 2.")&&-1===et.indexOf("Android 4.0")||-1===et.indexOf("Mobile Safari")||-1!==et.indexOf("Chrome")||-1!==et.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,nt=x&&window.performance&&window.performance.now?window.performance:Date,ot=it();function it(){return nt.now().toFixed(3)}function at(){return ot}function ut(t,e){Y();var r=window.history;try{e?r.replaceState({key:ot},"",t):(ot=it(),r.pushState({key:ot},"",t))}catch(r){window.location[e?"replace":"assign"](t)}}function ct(t){ut(t,!0)}function st(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 pt(e){return function(r,n,o){var i=!1,a=0,u=null;ft(e,(function(e,r,n,c){if("function"==typeof e&&void 0===e.cid){i=!0,a++;var s,p=dt((function(t){var r;((r=t).__esModule||lt&&"Module"===r[Symbol.toStringTag])&&(t=t.default),e.resolved="function"==typeof t?t:g.extend(t),n.components[c]=t,--a<=0&&o()})),f=dt((function(e){var r="Failed to resolve async component "+c+": "+e;u||(u=t(e)?e:new Error(r),o(u))}));try{s=e(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 ft(t,e){return ht(t.map((function(t){return Object.keys(t.components).map((function(r){return e(t.components[r],t.instances[r],t,r)}))})))}function ht(t){return Array.prototype.concat.apply([],t)}var lt="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function dt(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)}}var yt=function(t,e){this.router=t,this.base=function(t){if(!t)if(x){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}(e),this.current=l,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function vt(t,e,r,n){var o=ft(t,(function(t,n,o,i){var a=function(t,e){return"function"!=typeof t&&(t=g.extend(t)),t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return r(t,n,o,i)})):r(a,n,o,i)}));return ht(n?o.reverse():o)}function mt(t,e){if(e)return function(){return t.apply(e,arguments)}}yt.prototype.listen=function(t){this.cb=t},yt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},yt.prototype.onError=function(t){this.errorCbs.push(t)},yt.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)})))}))},yt.prototype.confirmTransition=function(e,r,n){var o=this,i=this.current,a=function(e){t(e)&&(o.errorCbs.length?o.errorCbs.forEach((function(t){t(e)})):console.error(e)),n&&n(e)};if(v(e,i)&&e.matched.length===i.matched.length)return this.ensureURL(),a();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,e.matched),c=u.updated,s=u.deactivated,p=u.activated,f=[].concat(function(t){return vt(t,"beforeRouteLeave",mt,!0)}(s),this.router.beforeHooks,function(t){return vt(t,"beforeRouteUpdate",mt)}(c),p.map((function(t){return t.beforeEnter})),pt(p));this.pending=e;var h=function(r,n){if(o.pending!==e)return a();try{r(e,i,(function(e){!1===e||t(e)?(o.ensureURL(!0),a(e)):"string"==typeof e||"object"==typeof e&&("string"==typeof e.path||"string"==typeof e.name)?(a(),"object"==typeof e&&e.replace?o.replace(e):o.push(e)):n(e)}))}catch(t){a(t)}};st(f,h,(function(){var t=[];st(function(t,e,r){return vt(t,"beforeRouteEnter",(function(t,n,o,i){return function(t,e,r,n,o){return function(i,a,u){return t(i,a,(function(t){"function"==typeof t&&n.push((function(){!function t(e,r,n,o){r[n]&&!r[n]._isBeingDestroyed?e(r[n]):o()&&setTimeout((function(){t(e,r,n,o)}),16)}(t,e.instances,r,o)})),u(t)}))}}(t,o,i,e,r)}))}(p,t,(function(){return o.current===e})).concat(o.router.resolveHooks),h,(function(){if(o.pending!==e)return a();o.pending=null,r(e),o.router.app&&o.router.app.$nextTick((function(){t.forEach((function(t){t()}))}))}))}))},yt.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 gt=function(t){function e(e,r){var n=this;t.call(this,e,r);var o=e.options.scrollBehavior,i=rt&&o;i&&Q();var a=bt(this.base);window.addEventListener("popstate",(function(t){var r=n.current,o=bt(n.base);n.current===l&&o===a||n.transitionTo(o,(function(t){i&&X(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){ut(R(n.base+t.fullPath)),X(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){ct(R(n.base+t.fullPath)),X(n.router,t,o,!1),e&&e(t)}),r)},e.prototype.ensureURL=function(t){if(bt(this.base)!==this.current.fullPath){var e=R(this.base+this.current.fullPath);t?ut(e):ct(e)}},e.prototype.getCurrentLocation=function(){return bt(this.base)},e}(yt);function bt(t){var e=decodeURI(window.location.pathname);return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var wt=function(t){function e(e,r,n){t.call(this,e,r),n&&function(t){var e=bt(t);if(!/^\/#/.test(e))return window.location.replace(R(t+"/#"+e)),!0}(this.base)||xt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this,e=this.router.options.scrollBehavior,r=rt&&e;r&&Q(),window.addEventListener(rt?"popstate":"hashchange",(function(){var e=t.current;xt()&&t.transitionTo(kt(),(function(n){r&&X(t.router,n,e,!0),rt||Ot(n.fullPath)}))}))},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,(function(t){Et(t.fullPath),X(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){Ot(t.fullPath),X(n.router,t,o,!1),e&&e(t)}),r)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;kt()!==e&&(t?Et(e):Ot(e))},e.prototype.getCurrentLocation=function(){return kt()},e}(yt);function xt(){var t=kt();return"/"===t.charAt(0)||(Ot("/"+t),!1)}function kt(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var r=(t=t.slice(e+1)).indexOf("?");if(r<0){var n=t.indexOf("#");t=n>-1?decodeURI(t.slice(0,n))+t.slice(n):decodeURI(t)}else r>-1&&(t=decodeURI(t.slice(0,r))+t.slice(r));return t}function Rt(t){var e=window.location.href,r=e.indexOf("#");return(r>=0?e.slice(0,r):e)+"#"+t}function Et(t){rt?ut(Rt(t)):window.location.hash=t}function Ot(t){rt?ct(Rt(t)):window.location.replace(Rt(t))}var At=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}(yt),Ct=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=F(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!rt&&!1!==t.fallback,this.fallback&&(e="hash"),x||(e="abstract"),this.mode=e,e){case"history":this.history=new gt(this,t.base);break;case"hash":this.history=new wt(this,t.base,this.fallback);break;case"abstract":this.history=new At(this,t.base)}},jt={currentRoute:{configurable:!0}};function _t(t,e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}return Ct.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},jt.currentRoute.get=function(){return this.history&&this.history.current},Ct.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var r=e.apps.indexOf(t);r>-1&&e.apps.splice(r,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var r=this.history;if(r instanceof gt)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}))}))}},Ct.prototype.beforeEach=function(t){return _t(this.beforeHooks,t)},Ct.prototype.beforeResolve=function(t){return _t(this.resolveHooks,t)},Ct.prototype.afterEach=function(t){return _t(this.afterHooks,t)},Ct.prototype.onReady=function(t,e){this.history.onReady(t,e)},Ct.prototype.onError=function(t){this.history.onError(t)},Ct.prototype.push=function(t,e,r){this.history.push(t,e,r)},Ct.prototype.replace=function(t,e,r){this.history.replace(t,e,r)},Ct.prototype.go=function(t){this.history.go(t)},Ct.prototype.back=function(){this.go(-1)},Ct.prototype.forward=function(){this.go(1)},Ct.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]}))}))):[]},Ct.prototype.resolve=function(t,e,r){var n=D(t,e=e||this.history.current,r,this),o=this.match(n,e),i=o.redirectedFrom||o.fullPath;return{location:n,route:o,href:function(t,e,r){var n="hash"===r?"#"+e:e;return t?R(t+"/"+n):n}(this.history.base,i,this.mode),normalizedTo:n,resolved:o}},Ct.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==l&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Ct.prototype,jt),Ct.install=function t(e){if(!t.installed||g!==e){t.installed=!0,g=e;var n=function(t){return void 0!==t},o=function(t,e){var r=t.$options._parentKnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};e.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),e.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,o(this,this)},destroyed:function(){o(this)}}),Object.defineProperty(e.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(e.prototype,"$route",{get:function(){return this._routerRoot._route}}),e.component("RouterView",r),e.component("RouterLink",b);var i=e.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created}},Ct.version="3.0.7",x&&window.Kdu&&window.Kdu.use(Ct),Ct},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.KduRouter=e();