@topvisor/ui
Version:
Topvisor UI-kit Vue
3 lines (2 loc) • 1.47 kB
JavaScript
define(["require","exports"],(function(p,s){"use strict";if(typeof l>"u")var l=window.Vue;const h=function(t,r=location.hash){const e=new RegExp("[#?&]"+t+"=([^&]*)"),n=r.match(e);return!n||n.length!=2?"":(n[1]=decodeURIComponent(n[1]),n[1]=n[1].replace(/\+/g," "),n[1])},i=function(t,r,e=!0){let n=u(t,r);f(!!e,n)},g=function(t,r,e=!0){i(t,null,e)},u=function(t,r,e=location.hash){const n=new RegExp("&?"+t+"=[^&]*","g");return e=e.replace(n,""),r!==null&&(r=(r+"").replace(" ","%20"),e=e.replace(n,"&"+t+"="+r),e.indexOf("&"+t+"=")==-1&&(e+="&"+t+"="+r)),e=e.replace(/&+/g,"&"),e=e.replace(/^(#)?&|&$/g,"$1"),e="#"+e,e=e.replace(/^#+/,"#"),e==="#"&&(e=""),e},o=function(t,r){t instanceof Map&&(t=Object.fromEntries(t)),r===void 0&&(r=!0);let e=location.hash;for(const n in t){const c=new RegExp("&?"+n+"=[^&]*","g");e=e.replace(c,""),t[n]!==null&&(t[n]=(t[n]+"").replace(" ","%20"),e+="&"+n+"="+t[n])}e=e.replace(/&+/g,"&"),e=e.replace(/^(#)?&|&$/g,"$1"),e="#"+e,e=e.replace(/^#+/,"#"),e==="#"&&(e=""),f(!!r,e)},f=(t=!1,r)=>{if(r===location.hash)return;const e=location.href,n=location.href.replace(/#.*/,"")+r;t?history.replaceState(history.state,"",n):history.pushState(history.state,"",n);const c=new HashChangeEvent("hashchange",{oldURL:e,newURL:n});window.dispatchEvent(c)};s.delHash=g,s.genHash=u,s.getHash=h,s.historySetState=f,s.setHash=i,s.setHashs=o,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
//# sourceMappingURL=route.amd.js.map