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
var VueRouter=function(e,M){"use strict";const s="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,t=e=>s?Symbol(e):"_vr_"+e,n=t("rvlm"),r=t("rvd"),_=t("r"),T=t("rl"),B=t("rvl"),G="undefined"!=typeof window,F=Object.assign;function I(e,t){const n={};for(const r in t){const o=t[r];n[r]=Array.isArray(o)?o.map(e):e(o)}return n}const K=()=>{},o=/\/$/;function U(e,t,n="/"){let r,o={},a="",i="";var c=t.indexOf("?"),s=t.indexOf("#",-1<c?c:0);return-1<c&&(r=t.slice(0,c),a=t.slice(c+1,-1<s?s:t.length),o=e(a)),-1<s&&(r=r||t.slice(0,s),i=t.slice(s,t.length)),r=function(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/");let o,a,i=n.length-1;for(o=0;o<r.length;o++)if(a=r[o],1!==i&&"."!==a){if(".."!==a)break;i--}return n.slice(0,i).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}(null!=r?r:t,n),{fullPath:r+(a&&"?")+a+i,path:r,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(const o in e)if(n=e[o],r=t[o],!(Array.isArray(n)?a(n,r):Array.isArray(r)?a(r,n):n===r))return!1;var n,r;return!0}function a(e,n){return Array.isArray(n)?e.length===n.length&&e.every((e,t)=>e===n[t]):1===e.length&&e[0]===n}var W,f,c;function l(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,"")}(c=W=W||{}).pop="pop",c.push="push",(c=f=f||{}).back="back",c.forward="forward",c.unknown="";const u=/^[^#]+#/;function p(e,t){return e.replace(u,"#")+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 h(n,e){const{pathname:t,search:r,hash:o}=e,a=n.indexOf("#");if(-1<a){let e=o.includes(n.slice(a))?n.slice(a).length:1,t=o.slice(e);return"/"!==t[0]&&(t="/"+t),i(t,"")}return i(t,n)+r+o}function d(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?D():null}}function m(e){const t=function(o){const{history:a,location:i}=window,r={value:h(o,i)},c={value:a.state};function s(t,e,n){var r=o.indexOf("#"),t=-1<r?(i.host&&document.querySelector("base")?o:o.slice(r))+t:location.protocol+"//"+location.host+o+t;try{a[n?"replaceState":"pushState"](e,"",t),c.value=e}catch(e){console.error(e),i[n?"replace":"assign"](t)}}return c.value||s(r.value,{back:null,current:r.value,forward:null,position:a.length-1,replaced:!0,scroll:null},!0),{location:r,state:c,push:function(e,t){var n=F({},c.value,a.state,{forward:e,scroll:D()});s(n.current,n,!0),s(e,F({},d(r.value,e,null),{position:n.position+1},t),!1),r.value=e},replace:function(e,t){s(e,F({},a.state,d(c.value.back,e,c.value.forward,!0),t,{position:c.value.position}),!0),r.value=e}}}(e=l(e)),n=function(a,i,c,s){let l=[],n=[],u=null;const t=({state:e})=>{const t=h(a,location),n=c.value,r=i.value;let o=0;if(e){if(c.value=t,i.value=e,u&&u===n)return void(u=null);o=r?e.position-r.position:0}else s(t);l.forEach(e=>{e(c.value,n,{delta:o,type:W.pop,direction:o?0<o?f.forward:f.back:f.unknown})})};function r(){const e=window["history"];e.state&&e.replaceState(F({},e.state,{scroll:D()}),"")}return window.addEventListener("popstate",t),window.addEventListener("beforeunload",r),{pauseListeners:function(){u=c.value},listen:function(t){l.push(t);var e=()=>{var e=l.indexOf(t);-1<e&&l.splice(e,1)};return n.push(e),e},destroy:function(){for(const e of n)e();n=[],window.removeEventListener("popstate",t),window.removeEventListener("beforeunload",r)}}}(e,t.state,t.location,t.replace);e=F({location:"",base:e,go:function(e,t=!0){t||n.pauseListeners(),history.go(e)},createHref:p.bind(null,e)},t,n);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,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},v=t("nf");function Y(e,t){return F(new Error,{type:e,[v]:!0},t)}function Z(e,t){return e instanceof Error&&v in e&&(null==t||!!(e.type&t))}e.NavigationFailureType=void 0,(c=e.NavigationFailureType||(e.NavigationFailureType={}))[c.aborted=4]="aborted",c[c.cancelled=8]="cancelled",c[c.duplicated=16]="duplicated";const g="[^/]+?",y={sensitive:!1,strict:!1,start:!0,end:!0},b=/[.+*?^${}()[\]/\\]/g;function w(e,t){let n=0;for(var r=e.score,o=t.score;n<r.length&&n<o.length;){const e=function(e,t){let n=0;for(;n<e.length&&n<t.length;){var r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?1===e.length&&80===e[0]?-1:1:e.length>t.length?1===t.length&&80===t[0]?1:-1:0}(r[n],o[n]);if(e)return e;n++}return o.length-r.length}const E={type:0,value:""},R=/[a-zA-Z0-9_]/;function A(e,t,n){n=function(l,r){const o=F({},y,r),e=[];let a=o.start?"^":"";const i=[];for(const r of l){const l=r.length?[]:[90];o.strict&&!r.length&&(a+="/");for(let n=0;n<r.length;n++){const c=r[n];let t=40+(o.sensitive?.25:0);if(0===c.type)n||(a+="/"),a+=c.value.replace(b,"\\$&"),t+=40;else if(1===c.type){const{value:l,repeatable:o,optional:s,regexp:u}=c;i.push({name:l,repeatable:o,optional:s});const F=u||g;if(F!==g){t+=10;try{new RegExp(`(${F})`)}catch(r){throw new Error(`Invalid custom RegExp for param "${l}" (${F}): `+r.message)}}let e=o?`((?:${F})(?:/(?:${F}))*)`:`(${F})`;n||(e=s&&r.length<2?`(?:/${e})`:"/"+e),s&&(e+="?"),a+=e,t+=20,s&&(t+=-8),o&&(t+=-20),".*"===F&&(t+=-50)}l.push(t)}e.push(l)}if(o.strict&&o.end){const l=e.length-1;e[l][e[l].length-1]+=.7000000000000001}o.strict||(a+="/?"),o.end?a+="$":o.strict&&(a+="(?:/|$)");const c=new RegExp(a,o.sensitive?"":"i");return{re:c,score:e,keys:i,parse:function(e){const t=e.match(c),n={};if(!t)return null;for(let e=1;e<t.length;e++){const r=t[e]||"",o=i[e-1];n[o.name]=r&&o.repeatable?r.split("/"):r}return n},stringify:function(e){let t="",n=!1;for(const o of l){n&&t.endsWith("/")||(t+="/"),n=!1;for(const l of o)if(0===l.type)t+=l.value;else if(1===l.type){const{value:a,repeatable:i,optional:c}=l,s=a in e?e[a]:"";if(Array.isArray(s)&&!i)throw new Error(`Provided param "${a}" is an array but it is not repeatable (* or + modifiers)`);var r=Array.isArray(s)?s.join("/"):s;if(!r){if(!c)throw new Error(`Missing required param "${a}"`);o.length<2&&(t.endsWith("/")?t=t.slice(0,-1):n=!0)}t+=r}}return t}}}(function(e){if(!e)return[[]];if("/"===e)return[[E]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(e){throw new Error(`ERR (${n})/"${l}": ${e}`)}let n=0,r=n;const o=[];let a;function i(){a&&o.push(a),a=[]}let c,s=0,l="",u="";function f(){l&&(0===n?a.push({type:0,value:l}):1===n||2===n||3===n?(1<a.length&&("*"===c||"+"===c)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:l,regexp:u,repeatable:"*"===c||"+"===c,optional:"*"===c||"?"===c})):t("Invalid state to consume buffer"),l="")}function p(){l+=c}for(;s<e.length;)if(c=e[s++],"\\"!==c||2===n)switch(n){case 0:"/"===c?(l&&f(),i()):":"===c?(f(),n=1):p();break;case 4:p(),n=r;break;case 1:"("===c?n=2:R.test(c)?p():(f(),n=0,"*"!==c&&"?"!==c&&"+"!==c&&s--);break;case 2:")"===c?"\\"==u[u.length-1]?u=u.slice(0,-1)+c:n=3:u+=c;break;case 3:f(),n=0,"*"!==c&&"?"!==c&&"+"!==c&&s--,u="";break;default:t("Unknown state")}else r=n,n=4;return 2===n&&t(`Unfinished custom RegExp for param "${l}"`),f(),i(),o}(e.path),n),e=F(n,{record:e,parent:t,children:[],alias:[]});return t&&!e.record.aliasOf==!t.record.aliasOf&&t.children.push(e),e}function J(e,u){const f=[],p=new Map;function h(t,e,n){const r=!n,o={path:(a=t).path,redirect:a.redirect,name:a.name,meta:a.meta||{},aliasOf:void 0,beforeEnter:a.beforeEnter,props:function(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]="boolean"==typeof n?n:n[r];return t}(a),children:a.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in a?a.components||{}:{default:a.component}};var a;o.aliasOf=n&&n.record;const i=O(u,t),c=[o];if("alias"in t){const u="string"==typeof t.alias?[t.alias]:t.alias;for(const t of u)c.push(F({},o,{components:(n?n.record:o).components,path:t,aliasOf:n?n.record:o}))}let s,l;for(const u of c){const F=u["path"];if(e&&"/"!==F[0]){const t=e.record.path,n="/"===t[t.length-1]?"":"/";u.path=e.record.path+(F&&n+F)}if(s=A(u,e,i),n?n.alias.push(s):(l=l||s,l!==s&&l.alias.push(s),r&&t.name&&!k(s)&&d(t.name)),"children"in o){const t=o.children;for(let e=0;e<t.length;e++)h(t[e],s,n&&n.children[e])}n=n||s,function(e){let t=0;for(;t<f.length&&0<=w(e,f[t]);)t++;f.splice(t,0,e),e.record.name&&!k(e)&&p.set(e.record.name,e)}(s)}return l?()=>{d(l)}:K}function d(e){if(Q(e)){const n=p.get(e);n&&(p.delete(e),f.splice(f.indexOf(n),1),n.children.forEach(d),n.alias.forEach(d))}else{var t=f.indexOf(e);-1<t&&(f.splice(t,1),e.record.name&&p.delete(e.record.name),e.children.forEach(d),e.alias.forEach(d))}}return u=O({strict:!1,end:!0,sensitive:!1},u),e.forEach(e=>h(e)),{addRoute:h,resolve:function(e,t){let r,n,o,a={};if("name"in e&&e.name){if(r=p.get(e.name),!r)throw Y(1,{location:e});o=r.record.name,a=F(function(e){const t={};for(const n of r.keys.filter(e=>!e.optional).map(e=>e.name))n in e&&(t[n]=e[n]);return t}(t.params),e.params),n=r.stringify(a)}else if("path"in e)n=e.path,r=f.find(e=>e.re.test(n)),r&&(a=r.parse(n),o=r.record.name);else{if(r=t.name?p.get(t.name):f.find(e=>e.re.test(t.path)),!r)throw Y(1,{location:e,currentLocation:t});o=r.record.name,a=F({},t.params,e.params),n=r.stringify(a)}const i=[];let c=r;for(;c;)i.unshift(c.record),c=c.parent;return{name:o,path:n,params:a,matched:i,meta:i.reduce((e,t)=>F(e,t.meta),{})}},removeRoute:d,getRoutes:function(){return f},getRecordMatcher:function(e){return p.get(e)}}}function k(e){for(;e;){if(e.record.aliasOf)return 1;e=e.parent}}function O(e,t){const n={};for(const r in e)n[r]=(r in t?t:e)[r];return n}const P=/#/g,j=/&/g,x=/\//g,C=/=/g,$=/\?/g,S=/\+/g,L=/%5B/g,q=/%5D/g,ee=/%5E/g,te=/%60/g,ne=/%7B/g,re=/%7C/g,oe=/%7D/g,ae=/%20/g;function ie(e){return encodeURI(""+e).replace(re,"|").replace(L,"[").replace(q,"]")}function ce(e){return ie(e).replace(S,"%2B").replace(ae,"+").replace(P,"%23").replace(j,"%26").replace(te,"`").replace(ne,"{").replace(oe,"}").replace(ee,"^")}function se(e){return null==e?"":ie(e).replace(P,"%23").replace($,"%3F").replace(x,"%2F")}function le(e){try{return decodeURIComponent(""+e)}catch(e){}return""+e}function ue(e){const t={};if(""===e||"?"===e)return t;const n=("?"===e[0]?e.slice(1):e).split("&");for(let e=0;e<n.length;++e){const r=n[e].replace(S," "),o=r.indexOf("="),a=le(o<0?r:r.slice(0,o)),i=o<0?null:le(r.slice(o+1));if(a in t){let e=t[a];Array.isArray(e)||(e=t[a]=[e]),e.push(i)}else t[a]=i}return t}function fe(e){let n="";for(let t in e){const r=e[t];(t=ce(t).replace(C,"%3D"),null!=r)?(Array.isArray(r)?r.map(e=>e&&ce(e)):[r&&ce(r)]).forEach(e=>{void 0!==e&&(n+=(n.length?"&":"")+t,null!=e&&(n+="="+e))}):void 0!==r&&(n+=(n.length?"&":"")+t)}return n}function pe(){let n=[];return{add:function(t){return n.push(t),()=>{var e=n.indexOf(t);-1<e&&n.splice(e,1)}},list:()=>n,reset:function(){n=[]}}}function he(e,t,n){var r=()=>{e[t].delete(n)};M.onUnmounted(r),M.onDeactivated(r),M.onActivated(()=>{e[t].add(n)}),e[t].add(n)}function de(a,i,c,s,l){const u=s&&(s.enterCallbacks[l]=s.enterCallbacks[l]||[]);return()=>new Promise((t,n)=>{var e=e=>{!1===e?n(Y(4,{from:c,to:i})):e instanceof Error?n(e):"string"==typeof e||e&&"object"==typeof e?n(Y(2,{from:i,to:e})):(u&&s.enterCallbacks[l]===u&&"function"==typeof e&&u.push(e),t())},r=a.call(s&&s.instances[l],i,c,e);let o=Promise.resolve(r);a.length<3&&(o=o.then(e)),o.catch(e=>n(e))})}function me(n,r,o,a){const i=[];for(const c of n)for(const n in c.components){let t=c.components[n];if("beforeRouteEnter"===r||c.instances[n])if("object"==typeof(e=t)||"displayName"in e||"props"in e||"__vccOpts"in e){const s=(t.__vccOpts||t)[r];s&&i.push(de(s,o,a,c,n))}else{let e=t();i.push(()=>e.then(e=>{if(!e)return Promise.reject(new Error(`Couldn't resolve component "${n}" at "${c.path}"`));var t,e=(t=e).__esModule||s&&"Module"===t[Symbol.toStringTag]?e.default:e,e=((c.components[n]=e).__vccOpts||e)[r];return e&&de(e,o,a,c,n)()}))}}var e;return i}function ve(t){const n=M.inject(_),i=M.inject(T),c=M.computed(()=>n.resolve(M.unref(t.to))),e=M.computed(()=>{const e=c.value["matched"],t=e["length"],n=e[t-1],r=i.matched;if(!n||!r.length)return-1;var o=r.findIndex(V.bind(null,n));if(-1<o)return o;var a=ye(e[t-2]);return 1<t&&ye(n)===a&&r[r.length-1].path!==a?r.findIndex(V.bind(null,e[t-2])):o}),r=M.computed(()=>-1<e.value&&function(e,t){for(const n in t){const r=t[n],o=e[n];if("string"==typeof r){if(r!==o)return!1}else if(!Array.isArray(o)||o.length!==r.length||r.some((e,t)=>e!==o[t]))return!1}return!0}(i.params,c.value.params)),o=M.computed(()=>-1<e.value&&e.value===i.matched.length-1&&H(i.params,c.value.params));return{route:c,href:M.computed(()=>c.value.href),isActive:r,isExactActive:o,navigate:function(e={}){return function(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){var t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),1}}(e)?n[M.unref(t.replace)?"replace":"push"](M.unref(t.to)).catch(K):Promise.resolve()}}}const ge=M.defineComponent({name:"RouterLink",props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:ve,setup(t,{slots:n}){const r=M.reactive(ve(t)),e=M.inject(_)["options"],o=M.computed(()=>({[be(t.activeClass,e.linkActiveClass,"router-link-active")]:r.isActive,[be(t.exactActiveClass,e.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{var e=n.default&&n.default(r);return t.custom?e:M.h("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:o.value},e)}}});function ye(e){return e?(e.aliasOf||e).path:""}const be=(e,t,n)=>null!=e?e:null!=t?t:n;function we(e,t){if(!e)return null;t=e(t);return 1===t.length?t[0]:t}const Ee=M.defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},setup(c,{attrs:s,slots:l}){const e=M.inject(B),u=M.computed(()=>c.route||e.value),t=M.inject(r,0),f=M.computed(()=>u.value.matched[t]);M.provide(r,t+1),M.provide(n,f),M.provide(B,u);const p=M.ref();return M.watch(()=>[p.value,f.value,c.name],([t,e,n],[r,o])=>{e&&(e.instances[n]=t,o&&o!==e&&t&&t===r&&(e.leaveGuards.size||(e.leaveGuards=o.leaveGuards),e.updateGuards.size||(e.updateGuards=o.updateGuards))),!t||!e||o&&V(e,o)&&r||(e.enterCallbacks[n]||[]).forEach(e=>e(t))},{flush:"post"}),()=>{const e=u.value,t=f.value,n=t&&t.components[c.name],r=c.name;if(!n)return we(l.default,{Component:n,route:e});const o=t.props[c.name],a=o?!0===o?e.params:"function"==typeof o?o(e):o:null,i=M.h(n,F({},a,s,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(t.instances[r]=null)},ref:p}));return we(l.default,{Component:i,route:e})||i}}});function Re(e){return e.reduce((e,t)=>e.then(()=>t()),Promise.resolve())}return e.RouterLink=ge,e.RouterView=Ee,e.START_LOCATION=X,e.createMemoryHistory=function(e=""){let a=[],o=[""],i=0;function n(e){i++,i===o.length||o.splice(i),o.push(e)}e={location:"",state:{},base:e=l(e),createHref:p.bind(null,e),replace(e){o.splice(i--,1),n(e)},push(e,t){n(e)},listen:t=>(a.push(t),()=>{var e=a.indexOf(t);-1<e&&a.splice(e,1)}),destroy(){a=[],o=[""],i=0},go(e,t=!0){var n=this.location,r=e<0?f.back:f.forward;i=Math.max(0,Math.min(i+e,o.length-1)),t&&function(e,t,{direction:n,delta:r}){var o={direction:n,delta:r,type:W.pop};for(const n of a)n(e,t,o)}(this.location,n,{direction:r,delta:e})}};return Object.defineProperty(e,"location",{enumerable:!0,get:()=>o[i]}),e},e.createRouter=function(s){const i=J(s.routes,s),c=s.parseQuery||ue,d=s.stringifyQuery||fe,l=s.history,u=pe(),f=pe(),o=pe(),m=M.shallowRef(X);let v=X;G&&s.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const p=I.bind(null,e=>""+e),h=I.bind(null,se),g=I.bind(null,le);function y(e,t){if(t=F({},t||m.value),"string"==typeof e){const d=U(c,e,t.path),n=i.resolve({path:d.path},t),r=l.createHref(d.fullPath);return F(d,n,{params:g(n.params),hash:le(d.hash),redirectedFrom:void 0,href:r})}let n;if("path"in e)n=F({},e,{path:U(c,e.path,t.path).path});else{const i=F({},e.params);for(const e in i)null==i[e]&&delete i[e];n=F({},e,{params:h(e.params)}),t.params=h(t.params)}const r=i.resolve(n,t),o=e.hash||"";r.params=p(g(r.params));var a=function(e,t){e=t.query?e(t.query):"";return t.path+(e&&"?")+e+(t.hash||"")}(d,F({},e,{hash:ie(o).replace(ne,"{").replace(oe,"}").replace(ee,"^"),path:r.path})),t=l.createHref(a);return F({fullPath:a,hash:o,query:d===fe?function(e){const t={};for(const n in e){const r=e[n];void 0!==r&&(t[n]=Array.isArray(r)?r.map(e=>null==e?null:""+e):null==r?r:""+r)}return t}(e.query):e.query||{}},r,{redirectedFrom:void 0,href:t})}function b(e){return"string"==typeof e?U(c,e,m.value.path):F({},e)}function w(e,t){if(v!==e)return Y(8,{from:t,to:e})}function r(e){return R(e)}function E(t){var n=t.matched[t.matched.length-1];if(n&&n.redirect){const r=n["redirect"];let e="function"==typeof r?r(t):r;return"string"==typeof e&&(e=e.includes("?")||e.includes("#")?e=b(e):{path:e},e.params={}),F({query:t.query,hash:t.hash,params:t.params},e)}}function R(e,t){const n=v=y(e),r=m.value,o=e.state,a=e.force,i=!0===e.replace,c=E(n);if(c)return R(F(b(c),{state:o,force:a,replace:i}),t||n);const s=n;let l;return s.redirectedFrom=t,!a&&(u=d,f=r,p=n,h=f.matched.length-1,e=p.matched.length-1,-1<h&&h==e&&V(f.matched[h],p.matched[e])&&H(f.params,p.params)&&u(f.query)===u(p.query)&&f.hash===p.hash)&&(l=Y(16,{to:s,from:r}),S(r,r,!0,!1)),(l?Promise.resolve(l):A(s,r)).catch(e=>Z(e)?e:C(e,s,r)).then(e=>{if(e){if(Z(e,2))return R(F(b(e.to),{state:o,force:a,replace:i}),t||s)}else e=O(s,r,!0,i,o);return k(s,r,e),e});var u,f,p,h}function A(n,r){let o;const[e,t,a]=function(t,n){const r=[],o=[],a=[],i=Math.max(n.matched.length,t.matched.length);for(let e=0;e<i;e++){const i=n.matched[e];i&&(t.matched.find(e=>V(e,i))?o:r).push(i);const c=t.matched[e];c&&(n.matched.find(e=>V(e,c))||a.push(c))}return[r,o,a]}(n,r);o=me(e.reverse(),"beforeRouteLeave",n,r);for(const t of e)t.leaveGuards.forEach(e=>{o.push(de(e,n,r))});const i=function(e,t){return(t=w(e,t))?Promise.reject(t):Promise.resolve()}.bind(null,n,r);return o.push(i),Re(o).then(()=>{o=[];for(const e of u.list())o.push(de(e,n,r));return o.push(i),Re(o)}).then(()=>{o=me(t,"beforeRouteUpdate",n,r);for(const e of t)e.updateGuards.forEach(e=>{o.push(de(e,n,r))});return o.push(i),Re(o)}).then(()=>{o=[];for(const e of n.matched)if(e.beforeEnter&&!r.matched.includes(e))if(Array.isArray(e.beforeEnter))for(const t of e.beforeEnter)o.push(de(t,n,r));else o.push(de(e.beforeEnter,n,r));return o.push(i),Re(o)}).then(()=>(n.matched.forEach(e=>e.enterCallbacks={}),o=me(a,"beforeRouteEnter",n,r),o.push(i),Re(o))).then(()=>{o=[];for(const e of f.list())o.push(de(e,n,r));return o.push(i),Re(o)}).catch(e=>Z(e,8)?e:Promise.reject(e))}function k(e,t,n){for(const r of o.list())r(e,t,n)}function O(e,t,n,r,o){var a=w(e,t);if(a)return a;var i=t===X,a=G?history.state:{};n&&(r||i?l.replace(e.fullPath,F({scroll:i&&a&&a.scroll},o)):l.push(e.fullPath,o)),S(m.value=e,t,n,i),$()}let a;let P,j=pe(),x=pe();function C(t,n,r){$(t);const e=x.list();return e.length?e.forEach(e=>e(t,n,r)):console.error(t),Promise.reject(t)}function $(n){P||(P=!0,a=l.listen((e,t,n)=>{const r=y(e),o=E(r);if(o)R(F(o,{replace:!0}),r).catch(K);else{v=r;const i=m.value;var a;G&&(a=N(i.fullPath,n.delta),e=D(),z.set(a,e)),A(r,i).catch(e=>Z(e,12)?e:Z(e,2)?(R(e.to,r).then(e=>{Z(e,20)&&!n.delta&&n.type===W.pop&&l.go(-1,!1)}).catch(K),Promise.reject()):(n.delta&&l.go(-n.delta,!1),C(e,r,i))).then(e=>{(e=e||O(r,i,!1))&&(n.delta?l.go(-n.delta,!1):n.type===W.pop&&Z(e,20)&&l.go(-1,!1)),k(r,i,e)}).catch(K)}}),j.list().forEach(([e,t])=>n?t(n):e()),j.reset())}function S(t,n,e,r){const o=s["scrollBehavior"];if(!G||!o)return Promise.resolve();const a=!e&&(i=N(t.fullPath,0),c=z.get(i),z.delete(i),c)||(r||!e)&&history.state&&history.state.scroll||null;var i,c;return M.nextTick().then(()=>o(t,n,a)).then(e=>e&&function(e){let t;if("el"in e){const a=e.el,i="string"==typeof a&&a.startsWith("#"),c="string"==typeof a?i?document.getElementById(a.slice(1)):document.querySelector(a):a;if(!c)return;t=(n=c,r=e,o=document.documentElement.getBoundingClientRect(),n=n.getBoundingClientRect(),{behavior:r.behavior,left:n.left-o.left-(r.left||0),top:n.top-o.top-(r.top||0)})}else t=e;var n,r,o;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}(e)).catch(e=>C(e,t,n))}const e=e=>l.go(e);let L;const q=new Set;return{currentRoute:m,addRoute:function(e,t){let n,r;return r=Q(e)?(n=i.getRecordMatcher(e),t):e,i.addRoute(r,n)},removeRoute:function(e){e=i.getRecordMatcher(e);e&&i.removeRoute(e)},hasRoute:function(e){return!!i.getRecordMatcher(e)},getRoutes:function(){return i.getRoutes().map(e=>e.record)},resolve:y,options:s,push:r,replace:function(e){return r(F(b(e),{replace:!0}))},go:e,back:()=>e(-1),forward:()=>e(1),beforeEach:u.add,beforeResolve:f.add,afterEach:o.add,onError:x.add,isReady:function(){return P&&m.value!==X?Promise.resolve():new Promise((e,t)=>{j.add([e,t])})},install(e){e.component("RouterLink",ge),e.component("RouterView",Ee),e.config.globalProperties.$router=this,Object.defineProperty(e.config.globalProperties,"$route",{enumerable:!0,get:()=>M.unref(m)}),G&&!L&&m.value===X&&(L=!0,r(l.location).catch(e=>{}));const t={};for(const e in X)t[e]=M.computed(()=>m.value[e]);e.provide(_,this),e.provide(T,M.reactive(t)),e.provide(B,m);const n=e.unmount;q.add(e),e.unmount=function(){q.delete(e),q.size<1&&(v=X,a&&a(),m.value=X,L=!1,P=!1),n()}}}},e.createRouterMatcher=J,e.createWebHashHistory=function(e){return(e=location.host?e||location.pathname+location.search:"").includes("#")||(e+="#"),m(e)},e.createWebHistory=m,e.isNavigationFailure=Z,e.matchedRouteKey=n,e.onBeforeRouteLeave=function(e){var t=M.inject(n,{}).value;t&&he(t,"leaveGuards",e)},e.onBeforeRouteUpdate=function(e){var t=M.inject(n,{}).value;t&&he(t,"updateGuards",e)},e.parseQuery=ue,e.routeLocationKey=T,e.routerKey=_,e.routerViewLocationKey=B,e.stringifyQuery=fe,e.useLink=ve,e.useRoute=function(){return M.inject(T)},e.useRouter=function(){return M.inject(_)},e.viewDepthKey=r,Object.defineProperty(e,"__esModule",{value:!0}),e}({},Vue); |