vue-router.min.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. /**
  2. * vue-router v3.0.1
  3. * (c) 2017 Evan You
  4. * @license MIT
  5. */
  6. ! function(t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.VueRouter = e() }(this, function() {
  7. "use strict";
  8. function t(t, e) {}
  9. function e(t) { return Object.prototype.toString.call(t).indexOf("Error") > -1 }
  10. function r(t, e) {
  11. switch (typeof e) {
  12. case "undefined":
  13. return;
  14. case "object":
  15. return e;
  16. case "function":
  17. return e(t);
  18. case "boolean":
  19. return e ? t.params : void 0
  20. }
  21. }
  22. function n(t, e) { for (var r in e) t[r] = e[r]; return t }
  23. function o(t, e, r) { void 0 === e && (e = {}); var n, o = r || i; try { n = o(t || "") } catch (t) { n = {} } for (var a in e) n[a] = e[a]; return n }
  24. function i(t) {
  25. var e = {};
  26. return (t = t.trim().replace(/^(\?|#|&)/, "")) ? (t.split("&").forEach(function(t) {
  27. var r = t.replace(/\+/g, " ").split("="),
  28. n = Ut(r.shift()),
  29. o = r.length > 0 ? Ut(r.join("=")) : null;
  30. void 0 === e[n] ? e[n] = o : Array.isArray(e[n]) ? e[n].push(o) : e[n] = [e[n], o]
  31. }), e) : e
  32. }
  33. function a(t) { var e = t ? Object.keys(t).map(function(e) { var r = t[e]; if (void 0 === r) return ""; if (null === r) return Pt(e); if (Array.isArray(r)) { var n = []; return r.forEach(function(t) { void 0 !== t && (null === t ? n.push(Pt(e)) : n.push(Pt(e) + "=" + Pt(t))) }), n.join("&") } return Pt(e) + "=" + Pt(r) }).filter(function(t) { return t.length > 0 }).join("&") : null; return e ? "?" + e : "" }
  34. function u(t, e, r, n) {
  35. var o = n && n.options.stringifyQuery,
  36. i = e.query || {};
  37. try { i = c(i) } catch (t) {}
  38. var a = { name: e.name || t && t.name, meta: t && t.meta || {}, path: e.path || "/", hash: e.hash || "", query: i, params: e.params || {}, fullPath: p(e, o), matched: t ? s(t) : [] };
  39. return r && (a.redirectedFrom = p(r, o)), Object.freeze(a)
  40. }
  41. function c(t) { if (Array.isArray(t)) return t.map(c); if (t && "object" == typeof t) { var e = {}; for (var r in t) e[r] = c(t[r]); return e } return t }
  42. function s(t) { for (var e = []; t;) e.unshift(t), t = t.parent; return e }
  43. function p(t, e) {
  44. var r = t.path,
  45. n = t.query;
  46. void 0 === n && (n = {});
  47. var o = t.hash;
  48. void 0 === o && (o = "");
  49. var i = e || a;
  50. return (r || "/") + i(n) + o
  51. }
  52. function f(t, e) { return e === Ht ? t === e : !!e && (t.path && e.path ? t.path.replace(Mt, "") === e.path.replace(Mt, "") && t.hash === e.hash && h(t.query, e.query) : !(!t.name || !e.name) && (t.name === e.name && t.hash === e.hash && h(t.query, e.query) && h(t.params, e.params))) }
  53. function h(t, e) {
  54. if (void 0 === t && (t = {}), void 0 === e && (e = {}), !t || !e) return t === e;
  55. var r = Object.keys(t),
  56. n = Object.keys(e);
  57. return r.length === n.length && r.every(function(r) {
  58. var n = t[r],
  59. o = e[r];
  60. return "object" == typeof n && "object" == typeof o ? h(n, o) : String(n) === String(o)
  61. })
  62. }
  63. function l(t, e) { return 0 === t.path.replace(Mt, "/").indexOf(e.path.replace(Mt, "/")) && (!e.hash || t.hash === e.hash) && d(t.query, e.query) }
  64. function d(t, e) {
  65. for (var r in e)
  66. if (!(r in t)) return !1;
  67. return !0
  68. }
  69. function y(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 } }
  70. function v(t) {
  71. if (t)
  72. for (var e, r = 0; r < t.length; r++) { if ("a" === (e = t[r]).tag) return e; if (e.children && (e = v(e.children))) return e }
  73. }
  74. function m(t) {
  75. if (!m.installed || Tt !== t) {
  76. m.installed = !0, Tt = t;
  77. var e = function(t) { return void 0 !== t },
  78. r = function(t, r) {
  79. var n = t.$options._parentVnode;
  80. e(n) && e(n = n.data) && e(n = n.registerRouteInstance) && n(t, r)
  81. };
  82. 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", St), t.component("router-link", zt);
  83. var n = t.config.optionMergeStrategies;
  84. n.beforeRouteEnter = n.beforeRouteLeave = n.beforeRouteUpdate = n.created
  85. }
  86. }
  87. function g(t, e, r) {
  88. var n = t.charAt(0);
  89. if ("/" === n) return t;
  90. if ("?" === n || "#" === n) return e + t;
  91. var o = e.split("/");
  92. r && o[o.length - 1] || o.pop();
  93. for (var i = t.replace(/^\//, "").split("/"), a = 0; a < i.length; a++) { var u = i[a]; ".." === u ? o.pop() : "." !== u && o.push(u) }
  94. return "" !== o[0] && o.unshift(""), o.join("/")
  95. }
  96. function b(t) {
  97. var e = "",
  98. r = "",
  99. n = t.indexOf("#");
  100. n >= 0 && (e = t.slice(n), t = t.slice(0, n));
  101. var o = t.indexOf("?");
  102. return o >= 0 && (r = t.slice(o + 1), t = t.slice(0, o)), { path: t, query: r, hash: e }
  103. }
  104. function w(t) { return t.replace(/\/\//g, "/") }
  105. function x(t, e) {
  106. for (var r, n = [], o = 0, i = 0, a = "", u = e && e.delimiter || "/"; null != (r = Qt.exec(t));) {
  107. var c = r[0],
  108. s = r[1],
  109. p = r.index;
  110. if (a += t.slice(i, p), i = p + c.length, s) a += s[1];
  111. else {
  112. var f = t[i],
  113. h = r[2],
  114. l = r[3],
  115. d = r[4],
  116. y = r[5],
  117. v = r[6],
  118. m = r[7];
  119. a && (n.push(a), a = "");
  120. var g = null != h && null != f && f !== h,
  121. b = "+" === v || "*" === v,
  122. w = "?" === v || "*" === v,
  123. x = r[2] || u,
  124. k = d || y;
  125. n.push({ name: l || o++, prefix: h || "", delimiter: x, optional: w, repeat: b, partial: g, asterisk: !!m, pattern: k ? C(k) : m ? ".*" : "[^" + O(x) + "]+?" })
  126. }
  127. }
  128. return i < t.length && (a += t.substr(i)), a && n.push(a), n
  129. }
  130. function k(t) { return encodeURI(t).replace(/[\/?#]/g, function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase() }) }
  131. function R(t) { return encodeURI(t).replace(/[?#]/g, function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase() }) }
  132. function E(t) {
  133. for (var e = new Array(t.length), r = 0; r < t.length; r++) "object" == typeof t[r] && (e[r] = new RegExp("^(?:" + t[r].pattern + ")$"));
  134. return function(r, n) {
  135. for (var o = "", i = r || {}, a = (n || {}).pretty ? k : encodeURIComponent, u = 0; u < t.length; u++) {
  136. var c = t[u];
  137. if ("string" != typeof c) {
  138. var s, p = i[c.name];
  139. if (null == p) { if (c.optional) { c.partial && (o += c.prefix); continue } throw new TypeError('Expected "' + c.name + '" to be defined') }
  140. if (Ft(p)) {
  141. if (!c.repeat) throw new TypeError('Expected "' + c.name + '" to not repeat, but received `' + JSON.stringify(p) + "`");
  142. if (0 === p.length) { if (c.optional) continue; throw new TypeError('Expected "' + c.name + '" to not be empty') }
  143. for (var f = 0; f < p.length; f++) {
  144. 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) + "`");
  145. o += (0 === f ? c.prefix : c.delimiter) + s
  146. }
  147. } else {
  148. if (s = c.asterisk ? R(p) : a(p), !e[u].test(s)) throw new TypeError('Expected "' + c.name + '" to match "' + c.pattern + '", but received "' + s + '"');
  149. o += c.prefix + s
  150. }
  151. } else o += c
  152. }
  153. return o
  154. }
  155. }
  156. function O(t) { return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g, "\\$1") }
  157. function C(t) { return t.replace(/([=!:$\/()])/g, "\\$1") }
  158. function j(t, e) { return t.keys = e, t }
  159. function A(t) { return t.sensitive ? "" : "i" }
  160. function _(t, e) {
  161. var r = t.source.match(/\((?!\?)/g);
  162. if (r)
  163. 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 });
  164. return j(t, e)
  165. }
  166. function T(t, e, r) { for (var n = [], o = 0; o < t.length; o++) n.push(q(t[o], e, r).source); return j(new RegExp("(?:" + n.join("|") + ")", A(r)), e) }
  167. function S(t, e, r) { return $(x(t, r), e, r) }
  168. function $(t, e, r) {
  169. Ft(e) || (r = e || r, e = []);
  170. for (var n = (r = r || {}).strict, o = !1 !== r.end, i = "", a = 0; a < t.length; a++) {
  171. var u = t[a];
  172. if ("string" == typeof u) i += O(u);
  173. else {
  174. var c = O(u.prefix),
  175. s = "(?:" + u.pattern + ")";
  176. e.push(u), u.repeat && (s += "(?:" + c + s + ")*"), i += s = u.optional ? u.partial ? c + "(" + s + ")?" : "(?:" + c + "(" + s + "))?" : c + "(" + s + ")"
  177. }
  178. }
  179. var p = O(r.delimiter || "/"),
  180. f = i.slice(-p.length) === p;
  181. return n || (i = (f ? i.slice(0, -p.length) : i) + "(?:" + p + "(?=$))?"), i += o ? "$" : n && f ? "" : "(?=" + p + "|$)", j(new RegExp("^" + i, A(r)), e)
  182. }
  183. function q(t, e, r) { return Ft(e) || (r = e || r, e = []), r = r || {}, t instanceof RegExp ? _(t, e) : Ft(t) ? T(t, e, r) : S(t, e, r) }
  184. function L(t, e, r) { try { return (Xt[t] || (Xt[t] = Dt.compile(t)))(e || {}, { pretty: !0 }) } catch (t) { return "" } }
  185. function P(t, e, r, n) {
  186. var o = e || [],
  187. i = r || Object.create(null),
  188. a = n || Object.create(null);
  189. t.forEach(function(t) { U(o, i, a, t) });
  190. for (var u = 0, c = o.length; u < c; u++) "*" === o[u] && (o.push(o.splice(u, 1)[0]), c--, u--);
  191. return { pathList: o, pathMap: i, nameMap: a }
  192. }
  193. function U(t, e, r, n, o, i) {
  194. var a = n.path,
  195. u = n.name,
  196. c = n.pathToRegexpOptions || {},
  197. s = H(a, o, c.strict);
  198. "boolean" == typeof n.caseSensitive && (c.sensitive = n.caseSensitive);
  199. var p = { path: s, regex: M(s, c), 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 } };
  200. n.children && n.children.forEach(function(n) {
  201. var o = i ? w(i + "/" + n.path) : void 0;
  202. U(t, e, r, n, p, o)
  203. }), void 0 !== n.alias && (Array.isArray(n.alias) ? n.alias : [n.alias]).forEach(function(i) {
  204. var a = { path: i, children: n.children };
  205. U(t, e, r, a, o, p.path || "/")
  206. }), e[p.path] || (t.push(p.path), e[p.path] = p), u && (r[u] || (r[u] = p))
  207. }
  208. function M(t, e) { return Dt(t, [], e) }
  209. function H(t, e, r) { return r || (t = t.replace(/\/$/, "")), "/" === t[0] ? t : null == e ? t : w(e.path + "/" + t) }
  210. function I(t, e, r, n) {
  211. var i = "string" == typeof t ? { path: t } : t;
  212. if (i.name || i._normalized) return i;
  213. if (!i.path && i.params && e) {
  214. (i = V({}, i))._normalized = !0;
  215. var a = V(V({}, e.params), i.params);
  216. if (e.name) i.name = e.name, i.params = a;
  217. else if (e.matched.length) {
  218. var u = e.matched[e.matched.length - 1].path;
  219. i.path = L(u, a, "path " + e.path)
  220. }
  221. return i
  222. }
  223. var c = b(i.path || ""),
  224. s = e && e.path || "/",
  225. p = c.path ? g(c.path, s, r || i.append) : s,
  226. f = o(c.query, i.query, n && n.options.parseQuery),
  227. h = i.hash || c.hash;
  228. return h && "#" !== h.charAt(0) && (h = "#" + h), { _normalized: !0, path: p, query: f, hash: h }
  229. }
  230. function V(t, e) { for (var r in e) t[r] = e[r]; return t }
  231. function z(t, e) {
  232. function r(t, r, n) {
  233. var o = I(t, r, !1, e),
  234. a = o.name;
  235. if (a) {
  236. var u = p[a];
  237. if (!u) return i(null, o);
  238. var f = u.regex.keys.filter(function(t) { return !t.optional }).map(function(t) { return t.name });
  239. if ("object" != typeof o.params && (o.params = {}), r && "object" == typeof r.params)
  240. for (var h in r.params) !(h in o.params) && f.indexOf(h) > -1 && (o.params[h] = r.params[h]);
  241. if (u) return o.path = L(u.path, o.params, 'named route "' + a + '"'), i(u, o, n)
  242. } else if (o.path) {
  243. o.params = {};
  244. for (var l = 0; l < c.length; l++) {
  245. var d = c[l],
  246. y = s[d];
  247. if (B(y.regex, o.path, o.params)) return i(y, o, n)
  248. }
  249. }
  250. return i(null, o)
  251. }
  252. function n(t, n) {
  253. var o = t.redirect,
  254. a = "function" == typeof o ? o(u(t, n, null, e)) : o;
  255. if ("string" == typeof a && (a = { path: a }), !a || "object" != typeof a) return i(null, n);
  256. var c = a,
  257. s = c.name,
  258. p = c.path,
  259. f = n.query,
  260. h = n.hash,
  261. l = n.params;
  262. if (f = c.hasOwnProperty("query") ? c.query : f, h = c.hasOwnProperty("hash") ? c.hash : h, l = c.hasOwnProperty("params") ? c.params : l, s) return r({ _normalized: !0, name: s, query: f, hash: h, params: l }, void 0, n);
  263. if (p) { var d = F(p, t); return r({ _normalized: !0, path: L(d, l, 'redirect route with path "' + d + '"'), query: f, hash: h }, void 0, n) }
  264. return i(null, n)
  265. }
  266. function o(t, e, n) {
  267. var o = r({ _normalized: !0, path: L(n, e.params, 'aliased route with path "' + n + '"') });
  268. if (o) {
  269. var a = o.matched,
  270. u = a[a.length - 1];
  271. return e.params = o.params, i(u, e)
  272. }
  273. return i(null, e)
  274. }
  275. function i(t, r, i) { return t && t.redirect ? n(t, i || r) : t && t.matchAs ? o(t, r, t.matchAs) : u(t, r, i, e) }
  276. var a = P(t),
  277. c = a.pathList,
  278. s = a.pathMap,
  279. p = a.nameMap;
  280. return { match: r, addRoutes: function(t) { P(t, c, s, p) } }
  281. }
  282. function B(t, e, r) {
  283. var n = e.match(t);
  284. if (!n) return !1;
  285. if (!r) return !0;
  286. for (var o = 1, i = n.length; o < i; ++o) {
  287. var a = t.keys[o - 1],
  288. u = "string" == typeof n[o] ? decodeURIComponent(n[o]) : n[o];
  289. a && (r[a.name] = u)
  290. }
  291. return !0
  292. }
  293. function F(t, e) { return g(t, e.parent ? e.parent.path : "/", !0) }
  294. function D() { window.history.replaceState({ key: et() }, ""), window.addEventListener("popstate", function(t) { J(), t.state && t.state.key && rt(t.state.key) }) }
  295. function K(t, e, r, n) {
  296. if (t.app) {
  297. var o = t.options.scrollBehavior;
  298. o && t.app.$nextTick(function() {
  299. var t = N(),
  300. i = o(e, r, n ? t : null);
  301. i && ("function" == typeof i.then ? i.then(function(e) { Z(e, t) }).catch(function(t) {}) : Z(i, t))
  302. })
  303. }
  304. }
  305. function J() {
  306. var t = et();
  307. t && (Yt[t] = { x: window.pageXOffset, y: window.pageYOffset })
  308. }
  309. function N() { var t = et(); if (t) return Yt[t] }
  310. function Q(t, e) {
  311. var r = document.documentElement.getBoundingClientRect(),
  312. n = t.getBoundingClientRect();
  313. return { x: n.left - r.left - e.x, y: n.top - r.top - e.y }
  314. }
  315. function X(t) { return G(t.x) || G(t.y) }
  316. function Y(t) { return { x: G(t.x) ? t.x : window.pageXOffset, y: G(t.y) ? t.y : window.pageYOffset } }
  317. function W(t) { return { x: G(t.x) ? t.x : 0, y: G(t.y) ? t.y : 0 } }
  318. function G(t) { return "number" == typeof t }
  319. function Z(t, e) {
  320. var r = "object" == typeof t;
  321. if (r && "string" == typeof t.selector) {
  322. var n = document.querySelector(t.selector);
  323. if (n) {
  324. var o = t.offset && "object" == typeof t.offset ? t.offset : {};
  325. e = Q(n, o = W(o))
  326. } else X(t) && (e = Y(t))
  327. } else r && X(t) && (e = Y(t));
  328. e && window.scrollTo(e.x, e.y)
  329. }
  330. function tt() { return Gt.now().toFixed(3) }
  331. function et() { return Zt }
  332. function rt(t) { Zt = t }
  333. function nt(t, e) { J(); var r = window.history; try { e ? r.replaceState({ key: Zt }, "", t) : (Zt = tt(), r.pushState({ key: Zt }, "", t)) } catch (r) { window.location[e ? "replace" : "assign"](t) } }
  334. function ot(t) { nt(t, !0) }
  335. function it(t, e, r) {
  336. var n = function(o) { o >= t.length ? r() : t[o] ? e(t[o], function() { n(o + 1) }) : n(o + 1) };
  337. n(0)
  338. }
  339. function at(t) {
  340. return function(r, n, o) {
  341. var i = !1,
  342. a = 0,
  343. u = null;
  344. ut(t, function(t, r, n, c) {
  345. if ("function" == typeof t && void 0 === t.cid) {
  346. i = !0, a++;
  347. var s, p = pt(function(e) { st(e) && (e = e.default), t.resolved = "function" == typeof e ? e : Tt.extend(e), n.components[c] = e, --a <= 0 && o() }),
  348. f = pt(function(t) {
  349. var r = "Failed to resolve async component " + c + ": " + t;
  350. u || (u = e(t) ? t : new Error(r), o(u))
  351. });
  352. try { s = t(p, f) } catch (t) { f(t) }
  353. if (s)
  354. if ("function" == typeof s.then) s.then(p, f);
  355. else {
  356. var h = s.component;
  357. h && "function" == typeof h.then && h.then(p, f)
  358. }
  359. }
  360. }), i || o()
  361. }
  362. }
  363. function ut(t, e) { return ct(t.map(function(t) { return Object.keys(t.components).map(function(r) { return e(t.components[r], t.instances[r], t, r) }) })) }
  364. function ct(t) { return Array.prototype.concat.apply([], t) }
  365. function st(t) { return t.__esModule || te && "Module" === t[Symbol.toStringTag] }
  366. function pt(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) } }
  367. function ft(t) {
  368. if (!t)
  369. if (Bt) {
  370. var e = document.querySelector("base");
  371. t = (t = e && e.getAttribute("href") || "/").replace(/^https?:\/\/[^\/]+/, "")
  372. } else t = "/";
  373. return "/" !== t.charAt(0) && (t = "/" + t), t.replace(/\/$/, "")
  374. }
  375. function ht(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) } }
  376. function lt(t, e, r, n) { var o = ut(t, function(t, n, o, i) { var a = dt(t, e); if (a) return Array.isArray(a) ? a.map(function(t) { return r(t, n, o, i) }) : r(a, n, o, i) }); return ct(n ? o.reverse() : o) }
  377. function dt(t, e) { return "function" != typeof t && (t = Tt.extend(t)), t.options[e] }
  378. function yt(t) { return lt(t, "beforeRouteLeave", mt, !0) }
  379. function vt(t) { return lt(t, "beforeRouteUpdate", mt) }
  380. function mt(t, e) { if (e) return function() { return t.apply(e, arguments) } }
  381. function gt(t, e, r) { return lt(t, "beforeRouteEnter", function(t, n, o, i) { return bt(t, o, i, e, r) }) }
  382. function bt(t, e, r, n, o) { return function(i, a, u) { return t(i, a, function(t) { u(t), "function" == typeof t && n.push(function() { wt(t, e.instances, r, o) }) }) } }
  383. function wt(t, e, r, n) { e[r] ? t(e[r]) : n() && setTimeout(function() { wt(t, e, r, n) }, 16) }
  384. function xt(t) { var e = window.location.pathname; return t && 0 === e.indexOf(t) && (e = e.slice(t.length)), (e || "/") + window.location.search + window.location.hash }
  385. function kt(t) { var e = xt(t); if (!/^\/#/.test(e)) return window.location.replace(w(t + "/#" + e)), !0 }
  386. function Rt() { var t = Et(); return "/" === t.charAt(0) || (jt("/" + t), !1) }
  387. function Et() {
  388. var t = window.location.href,
  389. e = t.indexOf("#");
  390. return -1 === e ? "" : t.slice(e + 1)
  391. }
  392. function Ot(t) {
  393. var e = window.location.href,
  394. r = e.indexOf("#");
  395. return (r >= 0 ? e.slice(0, r) : e) + "#" + t
  396. }
  397. function Ct(t) { Wt ? nt(Ot(t)) : window.location.hash = t }
  398. function jt(t) { Wt ? ot(Ot(t)) : window.location.replace(Ot(t)) }
  399. function At(t, e) {
  400. return t.push(e),
  401. function() {
  402. var r = t.indexOf(e);
  403. r > -1 && t.splice(r, 1)
  404. }
  405. }
  406. function _t(t, e, r) { var n = "hash" === r ? "#" + e : e; return t ? w(t + "/" + n) : n }
  407. var Tt, St = {
  408. name: "router-view",
  409. functional: !0,
  410. props: { name: { type: String, default: "default" } },
  411. render: function(t, e) {
  412. var o = e.props,
  413. i = e.children,
  414. a = e.parent,
  415. u = e.data;
  416. u.routerView = !0;
  417. for (var c = a.$createElement, s = o.name, p = a.$route, f = a._routerViewCache || (a._routerViewCache = {}), h = 0, l = !1; a && a._routerRoot !== a;) a.$vnode && a.$vnode.data.routerView && h++, a._inactive && (l = !0), a = a.$parent;
  418. if (u.routerViewDepth = h, l) return c(f[s], u, i);
  419. var d = p.matched[h];
  420. if (!d) return f[s] = null, c();
  421. var y = f[s] = d.components[s];
  422. u.registerRouteInstance = function(t, e) {
  423. var r = d.instances[s];
  424. (e && r !== t || !e && r === t) && (d.instances[s] = e)
  425. }, (u.hook || (u.hook = {})).prepatch = function(t, e) { d.instances[s] = e.componentInstance };
  426. var v = u.props = r(p, d.props && d.props[s]);
  427. if (v) { v = u.props = n({}, v); var m = u.attrs = u.attrs || {}; for (var g in v) y.props && g in y.props || (m[g] = v[g], delete v[g]) }
  428. return c(y, u, i)
  429. }
  430. },
  431. $t = /[!'()*]/g,
  432. qt = function(t) { return "%" + t.charCodeAt(0).toString(16) },
  433. Lt = /%2C/g,
  434. Pt = function(t) { return encodeURIComponent(t).replace($t, qt).replace(Lt, ",") },
  435. Ut = decodeURIComponent,
  436. Mt = /\/?$/,
  437. Ht = u(null, { path: "/" }),
  438. It = [String, Object],
  439. Vt = [String, Array],
  440. zt = {
  441. name: "router-link",
  442. props: { to: { type: It, required: !0 }, tag: { type: String, default: "a" }, exact: Boolean, append: Boolean, replace: Boolean, activeClass: String, exactActiveClass: String, event: { type: Vt, default: "click" } },
  443. render: function(t) {
  444. var e = this,
  445. r = this.$router,
  446. n = this.$route,
  447. o = r.resolve(this.to, n, this.append),
  448. i = o.location,
  449. a = o.route,
  450. c = o.href,
  451. s = {},
  452. p = r.options.linkActiveClass,
  453. h = r.options.linkExactActiveClass,
  454. d = null == p ? "router-link-active" : p,
  455. m = null == h ? "router-link-exact-active" : h,
  456. g = null == this.activeClass ? d : this.activeClass,
  457. b = null == this.exactActiveClass ? m : this.exactActiveClass,
  458. w = i.path ? u(null, i, null, r) : a;
  459. s[b] = f(n, w), s[g] = this.exact ? s[b] : l(n, w);
  460. var x = function(t) { y(t) && (e.replace ? r.replace(i) : r.push(i)) },
  461. k = { click: y };
  462. Array.isArray(this.event) ? this.event.forEach(function(t) { k[t] = x }) : k[this.event] = x;
  463. var R = { class: s };
  464. if ("a" === this.tag) R.on = k, R.attrs = { href: c };
  465. else {
  466. var E = v(this.$slots.default);
  467. if (E) {
  468. E.isStatic = !1;
  469. var O = Tt.util.extend;
  470. (E.data = O({}, E.data)).on = k, (E.data.attrs = O({}, E.data.attrs)).href = c
  471. } else R.on = k
  472. }
  473. return t(this.tag, R, this.$slots.default)
  474. }
  475. },
  476. Bt = "undefined" != typeof window,
  477. Ft = Array.isArray || function(t) { return "[object Array]" == Object.prototype.toString.call(t) },
  478. Dt = q,
  479. Kt = x,
  480. Jt = E,
  481. Nt = $,
  482. Qt = new RegExp(["(\\\\.)", "([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"), "g");
  483. Dt.parse = Kt, Dt.compile = function(t, e) { return E(x(t, e)) }, Dt.tokensToFunction = Jt, Dt.tokensToRegExp = Nt;
  484. var Xt = Object.create(null),
  485. Yt = Object.create(null),
  486. Wt = Bt && 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) }(),
  487. Gt = Bt && window.performance && window.performance.now ? window.performance : Date,
  488. Zt = tt(),
  489. te = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag,
  490. ee = function(t, e) { this.router = t, this.base = ft(e), this.current = Ht, this.pending = null, this.ready = !1, this.readyCbs = [], this.readyErrorCbs = [], this.errorCbs = [] };
  491. ee.prototype.listen = function(t) { this.cb = t }, ee.prototype.onReady = function(t, e) { this.ready ? t() : (this.readyCbs.push(t), e && this.readyErrorCbs.push(e)) }, ee.prototype.onError = function(t) { this.errorCbs.push(t) }, ee.prototype.transitionTo = function(t, e, r) {
  492. var n = this,
  493. o = this.router.match(t, this.current);
  494. 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) })) })
  495. }, ee.prototype.confirmTransition = function(r, n, o) {
  496. var i = this,
  497. a = this.current,
  498. 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) };
  499. if (f(r, a) && r.matched.length === a.matched.length) return this.ensureURL(), u();
  500. var c = ht(this.current.matched, r.matched),
  501. s = c.updated,
  502. p = c.deactivated,
  503. h = c.activated,
  504. l = [].concat(yt(p), this.router.beforeHooks, vt(s), h.map(function(t) { return t.beforeEnter }), at(h));
  505. this.pending = r;
  506. 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) } };
  507. it(l, d, function() {
  508. var t = [];
  509. it(gt(h, t, function() { return i.current === r }).concat(i.router.resolveHooks), d, function() {
  510. if (i.pending !== r) return u();
  511. i.pending = null, n(r), i.router.app && i.router.app.$nextTick(function() { t.forEach(function(t) { t() }) })
  512. })
  513. })
  514. }, ee.prototype.updateRoute = function(t) {
  515. var e = this.current;
  516. this.current = t, this.cb && this.cb(t), this.router.afterHooks.forEach(function(r) { r && r(t, e) })
  517. };
  518. var re = function(t) {
  519. function e(e, r) {
  520. var n = this;
  521. t.call(this, e, r);
  522. var o = e.options.scrollBehavior;
  523. o && D();
  524. var i = xt(this.base);
  525. window.addEventListener("popstate", function(t) {
  526. var r = n.current,
  527. a = xt(n.base);
  528. n.current === Ht && a === i || n.transitionTo(a, function(t) { o && K(e, t, r, !0) })
  529. })
  530. }
  531. 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) {
  532. var n = this,
  533. o = this.current;
  534. this.transitionTo(t, function(t) { nt(w(n.base + t.fullPath)), K(n.router, t, o, !1), e && e(t) }, r)
  535. }, e.prototype.replace = function(t, e, r) {
  536. var n = this,
  537. o = this.current;
  538. this.transitionTo(t, function(t) { ot(w(n.base + t.fullPath)), K(n.router, t, o, !1), e && e(t) }, r)
  539. }, e.prototype.ensureURL = function(t) {
  540. if (xt(this.base) !== this.current.fullPath) {
  541. var e = w(this.base + this.current.fullPath);
  542. t ? nt(e) : ot(e)
  543. }
  544. }, e.prototype.getCurrentLocation = function() { return xt(this.base) }, e
  545. }(ee),
  546. ne = function(t) {
  547. function e(e, r, n) { t.call(this, e, r), n && kt(this.base) || Rt() }
  548. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.setupListeners = function() {
  549. var t = this,
  550. e = this.router.options.scrollBehavior,
  551. r = Wt && e;
  552. r && D(), window.addEventListener(Wt ? "popstate" : "hashchange", function() {
  553. var e = t.current;
  554. Rt() && t.transitionTo(Et(), function(n) { r && K(t.router, n, e, !0), Wt || jt(n.fullPath) })
  555. })
  556. }, e.prototype.push = function(t, e, r) {
  557. var n = this,
  558. o = this.current;
  559. this.transitionTo(t, function(t) { Ct(t.fullPath), K(n.router, t, o, !1), e && e(t) }, r)
  560. }, e.prototype.replace = function(t, e, r) {
  561. var n = this,
  562. o = this.current;
  563. this.transitionTo(t, function(t) { jt(t.fullPath), K(n.router, t, o, !1), e && e(t) }, r)
  564. }, e.prototype.go = function(t) { window.history.go(t) }, e.prototype.ensureURL = function(t) {
  565. var e = this.current.fullPath;
  566. Et() !== e && (t ? Ct(e) : jt(e))
  567. }, e.prototype.getCurrentLocation = function() { return Et() }, e
  568. }(ee),
  569. oe = function(t) {
  570. function e(e, r) { t.call(this, e, r), this.stack = [], this.index = -1 }
  571. return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.push = function(t, e, r) {
  572. var n = this;
  573. this.transitionTo(t, function(t) { n.stack = n.stack.slice(0, n.index + 1).concat(t), n.index++, e && e(t) }, r)
  574. }, e.prototype.replace = function(t, e, r) {
  575. var n = this;
  576. this.transitionTo(t, function(t) { n.stack = n.stack.slice(0, n.index).concat(t), e && e(t) }, r)
  577. }, e.prototype.go = function(t) {
  578. var e = this,
  579. r = this.index + t;
  580. if (!(r < 0 || r >= this.stack.length)) {
  581. var n = this.stack[r];
  582. this.confirmTransition(n, function() { e.index = r, e.updateRoute(n) })
  583. }
  584. }, e.prototype.getCurrentLocation = function() { var t = this.stack[this.stack.length - 1]; return t ? t.fullPath : "/" }, e.prototype.ensureURL = function() {}, e
  585. }(ee),
  586. ie = function(t) {
  587. void 0 === t && (t = {}), this.app = null, this.apps = [], this.options = t, this.beforeHooks = [], this.resolveHooks = [], this.afterHooks = [], this.matcher = z(t.routes || [], this);
  588. var e = t.mode || "hash";
  589. switch (this.fallback = "history" === e && !Wt && !1 !== t.fallback, this.fallback && (e = "hash"), Bt || (e = "abstract"), this.mode = e, e) {
  590. case "history":
  591. this.history = new re(this, t.base);
  592. break;
  593. case "hash":
  594. this.history = new ne(this, t.base, this.fallback);
  595. break;
  596. case "abstract":
  597. this.history = new oe(this, t.base)
  598. }
  599. },
  600. ae = { currentRoute: { configurable: !0 } };
  601. return ie.prototype.match = function(t, e, r) { return this.matcher.match(t, e, r) }, ae.currentRoute.get = function() { return this.history && this.history.current }, ie.prototype.init = function(t) {
  602. var e = this;
  603. if (this.apps.push(t), !this.app) {
  604. this.app = t;
  605. var r = this.history;
  606. if (r instanceof re) r.transitionTo(r.getCurrentLocation());
  607. else if (r instanceof ne) {
  608. var n = function() { r.setupListeners() };
  609. r.transitionTo(r.getCurrentLocation(), n, n)
  610. }
  611. r.listen(function(t) { e.apps.forEach(function(e) { e._route = t }) })
  612. }
  613. }, ie.prototype.beforeEach = function(t) { return At(this.beforeHooks, t) }, ie.prototype.beforeResolve = function(t) { return At(this.resolveHooks, t) }, ie.prototype.afterEach = function(t) { return At(this.afterHooks, t) }, ie.prototype.onReady = function(t, e) { this.history.onReady(t, e) }, ie.prototype.onError = function(t) { this.history.onError(t) }, ie.prototype.push = function(t, e, r) { this.history.push(t, e, r) }, ie.prototype.replace = function(t, e, r) { this.history.replace(t, e, r) }, ie.prototype.go = function(t) { this.history.go(t) }, ie.prototype.back = function() { this.go(-1) }, ie.prototype.forward = function() { this.go(1) }, ie.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] }) })) : [] }, ie.prototype.resolve = function(t, e, r) {
  614. var n = I(t, e || this.history.current, r, this),
  615. o = this.match(n, e),
  616. i = o.redirectedFrom || o.fullPath;
  617. return { location: n, route: o, href: _t(this.history.base, i, this.mode), normalizedTo: n, resolved: o }
  618. }, ie.prototype.addRoutes = function(t) { this.matcher.addRoutes(t), this.history.current !== Ht && this.history.transitionTo(this.history.getCurrentLocation()) }, Object.defineProperties(ie.prototype, ae), ie.install = m, ie.version = "3.0.1", Bt && window.Vue && window.Vue.use(ie), ie
  619. });