2024-08-04 17:55:30 +08:00
|
|
|
*/const z=typeof document<"u";function it(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const S=Object.assign;function ue(e,t){const n={};for(const r in t){const s=t[r];n[r]=L(s)?s.map(e):e(s)}return n}const F=()=>{},L=Array.isArray,Ge=/#/g,at=/&/g,lt=/\//g,ut=/=/g,ft=/\?/g,Ke=/\+/g,ht=/%5B/g,dt=/%5D/g,Ve=/%5E/g,pt=/%60/g,Ue=/%7B/g,mt=/%7C/g,De=/%7D/g,gt=/%20/g;function ge(e){return encodeURI(""+e).replace(mt,"|").replace(ht,"[").replace(dt,"]")}function vt(e){return ge(e).replace(Ue,"{").replace(De,"}").replace(Ve,"^")}function de(e){return ge(e).replace(Ke,"%2B").replace(gt,"+").replace(Ge,"%23").replace(at,"%26").replace(pt,"`").replace(Ue,"{").replace(De,"}").replace(Ve,"^")}function yt(e){return de(e).replace(ut,"%3D")}function Rt(e){return ge(e).replace(Ge,"%23").replace(ft,"%3F")}function Et(e){return e==null?"":Rt(e).replace(lt,"%2F")}function X(e){try{return decodeURIComponent(""+e)}catch{}return""+e}const Pt=/\/$/,wt=e=>e.replace(Pt,"");function fe(e,t,n="/"){let r,s={},u="",d="";const g=t.indexOf("#");let i=t.indexOf("?");return g<i&&g>=0&&(i=-1),i>-1&&(r=t.slice(0,i),u=t.slice(i+1,g>-1?g:t.length),s=e(u)),g>-1&&(r=r||t.slice(0,g),d=t.slice(g,t.length)),r=kt(r!=null?r:t,n),{fullPath:r+(u&&"?")+u+d,path:r,query:s,hash:X(d)}}function St(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Ce(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ct(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&G(t.matched[r],n.matched[s])&&Qe(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function G(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Qe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!bt(e[n],t[n]))return!1;return!0}function bt(e,t){return L(e)?be(e,t):L(t)?be(t,e):e===t}function be(e,t){return L(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function kt(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let u=n.length-1,d,g;for(d=0;d<r.length;d++)if(g=r[d],g!==".")if(g==="..")u>1&&u--;else break;return n.slice(0,u).join("/")+"/"+r.slice(d).join("/")}var Z;(function(e){e.pop="pop",e.push="push"})(Z||(Z={}));var Y;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Y||(Y={}));function At(e){if(!e)if(z){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),wt(e)}const _t=/^[^#]+#/;function Ot(e,t){return e.replace(_t,"#")+t}function xt(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const te=()=>({left:window.scrollX,top:window.scrollY});function Mt(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=xt(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function ke(e,t){return(history.state?history.state.position-t:-1)+e}const pe=new Map;function Lt(e,t){pe.set(e,t)}function Nt(e){const t=pe.get(e);return pe.delete(e),t}let It=()=>location.protocol+"//"+location.host;function We(e,t){const{pathname:n,search:r,hash:s}=t,u=e.indexOf("#");if(u>-1){let g=s.includes(e.slice(u))?e.slice(u).length:1,i=s.slice(g);return i[0]!=="/"&&(i="/"+i),Ce(i,"")}return Ce(n,e)+r+s}function $t(e,t,n,r){let s=[],u=[],d=null;const g=({state:a})=>{const m=We(e,location),R=n.value,k=t.value;let b=0;if(a){if(n.value=m,t.value=a,d&&d===R){d=null;return}b=k?a.position-k.position:0}else r(m);s.forEach(E=>{E(n.value,R,{delta:b,type:Z.pop,direction:b?b>0?Y.forward:Y.back:Y.unknown})})};function i(){d=n.value}function f(a){s.push(a);const m=()=>{const R=s.indexOf(a);R>-1&&s.splice(R,1)};return u.push(m),m}fu
|