You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
22 KiB
1 line
22 KiB
2 years ago
|
var VueRouter=function(e,M){"use strict";const l="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,t=e=>l?Symbol(e):"_vr_"+e,r=t("rvlm"),n=t("rvd"),_=t("r"),T=t("rl"),B=t("rvl"),G="undefined"!=typeof window,F=Object.assign;function I(e,t){const r={};for(const n in t){const o=t[n];r[n]=Array.isArray(o)?o.map(e):e(o)}return r}let K=()=>{};const o=/\/$/;function U(e,t,r="/"){let n,o={},a="",i="";var c=t.indexOf("?"),l=t.indexOf("#",-1<c?c:0);return-1<c&&(n=t.slice(0,c),a=t.slice(c+1,-1<l?l:t.length),o=e(a)),-1<l&&(n=n||t.slice(0,l),i=t.slice(l,t.length)),n=function(e,t){if(e.startsWith("/"))return e;if(!e)return t;const r=t.split("/"),n=e.split("/");let o,a,i=r.length-1;for(o=0;o<n.length;o++)if(a=n[o],1!==i&&"."!==a){if(".."!==a)break;i--}return r.slice(0,i).join("/")+"/"+n.slice(o-(o===n.length?1:0)).join("/")}(null!=n?n:t,r),{fullPath:n+(a&&"?")+a+i,path:n,query:o,hash:i}}function i(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function V(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function H(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(n=e[r],r=t[r],!(Array.isArray(n)?a(n,r):Array.isArray(r)?a(r,n):n===r))return!1;var n;return!0}function a(e,r){return Array.isArray(r)?e.length===r.length&&e.every((e,t)=>e===r[t]):1===e.length&&e[0]===r}var W,f,c;(c=W=W||{}).pop="pop",c.push="push",(c=f=f||{}).back="back",c.forward="forward",c.unknown="";const s=/^[^#]+#/;function u(e,t){return e.replace(s,"#")+t}const D=()=>({left:window.pageXOffset,top:window.pageYOffset});function N(e,t){return(history.state?history.state.position-t:-1)+e}const z=new Map;function p(r,e){const{pathname:t,search:n,hash:o}=e,a=r.indexOf("#");if(-1<a){let e=o.includes(r.slice(a))?r.slice(a).length:1,t=o.slice(e);return"/"!==t[0]&&(t="/"+t),i(t,"")}return i(t,r)+n+o}function h(e,t,r,n=!1,o=!1){return{back:e,current:t,forward:r,replaced:n,position:window.history.length,scroll:o?D():null}}function d(e){const t=function(o){const{history:a,location:i}=window;let n={value:p(o,i)},c={value:a.state};function l(t,e,r){var n=o.indexOf("#"),t=-1<n?(i.host&&document.querySelector("base")?o:o.slice(n))+t:location.protocol+"//"+location.host+o+t;try{a[r?"replaceState":"pushState"](e,"",t),c.value=e}catch(e){console.error(e),i[r?"replace":"assign"](t)}}return c.value||l(n.value,{back:null,current:n.value,forward:null,position:a.length-1,replaced:!0,scroll:null},!0),{location:n,state:c,push:function(e,t){var r=F({},c.value,a.state,{forward:e,scroll:D()});l(r.current,r,!0),l(e,F({},h(n.value,e,null),{position:r.position+1},t),!1),n.value=e},replace:function(e,t){l(e,F({},a.state,h(c.value.back,e,c.value.forward,!0),t,{position:c.value.position}),!0),n.value=e}}}(e=function(e){if(!e)if(G){const t=document.querySelector("base");e=(e=t&&t.getAttribute("href")||"/").replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return(e="/"!==e[0]&&"#"!==e[0]?"/"+e:e).replace(o,"")}(e)),r=function(a,i,c,l){let s=[],r=[],u=null;const t=({state:e})=>{const t=p(a,location),r=c.value,n=i.value;let o=0;if(e){if(c.value=t,i.value=e,u&&u===r)return void(u=null);o=n?e.position-n.position:0}else l(t);s.forEach(e=>{e(c.value,r,{delta:o,type:W.pop,direction:o?0<o?f.forward:f.back:f.unknown})})};function n(){const{history:e}=window;e.state&&e.replaceState(F({},e.state,{scroll:D()}),"")}return window.addEventListener("popstate",t),window.addEventListener("beforeunload",n),{pauseListeners:function(){u=c.value},listen:function(t){s.push(t);var e=()=>{var e=s.indexOf(t);-1<e&&s.splice(e,1)};return r.push(e),e},destroy:function(){for(const e of r)e();r=[],window.removeEventListener("popstate",t),window.removeEventListener("beforeunload",n)}}}(e,t.state,t.location,t.replace);e=F({location:"",base:e,go:function(e,t=!0){t||r.pauseListeners(),history.go(e)},createHref:u.bind(null,e)},t,r);return Object.defineProperty(e,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(e,"state",{enumerable:!0,get:()=>t.state.value}),e}function Q(e){return"string"==typeof e||"symbol"==typeof e}const X={path:"/",name:void 0,pa
|