text: const e=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g"),t=e=>e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1"),r=e=>e.replace(/([=!:$\/()])/g,"\\$1"),a=e=>e&&e.sensitive?"":"i",n=(e,r,n)=>{for(var s=(n=n||{}).strict,h=!1!==n.end,i=t(n.delimiter||"/"),l=n.delimiters||"./",c=[].concat(n.endsWith||[]).map(t).concat("$").join("|"),p="",o=!1,u=0;u<e.length;u++){var f=e[u];if("string"==typeof f)p+=t(f),o=u===e.length-1&&l.indexOf(f[f.length-1])>-1;else{var g=t(f.prefix||""),m=f.repeat?"(?:"+f.pattern+")(?:"+g+"(?:"+f.pattern+"))*":f.pattern;r&&r.push(f),p+=f.optional?f.partial?g+"("+m+")?":"(?:"+g+"("+m+"))?":g+"("+m+")"}}return h?(s||(p+="(?:"+i+")?"),p+="$"===c?"$":"(?="+c+")"):(s||(p+="(?:"+i+"(?="+c+"))?"),o||(p+="(?="+i+"|"+c+")")),new RegExp("^"+p,a(n))},s=(h,i,l)=>h instanceof RegExp?((e,t)=>{if(!t)return e;var r=e.source.match(/\((?!\?)/g);if(r)for(var a=0;a<r.length;a++)t.push({name:a,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,pattern:null});return e})(h,i):Array.isArray(h)?((e,t,r)=>{for(var n=[],h=0;h<e.length;h++)n.push(s(e[h],t,r).source);return new RegExp("(?:"+n.join("|")+")",a(r))})(h,i,l):((a,s,h)=>n(((a,n)=>{for(var s,h=[],i=0,l=0,c="",p=n&&n.delimiter||"/",o=n&&n.delimiters||"./",u=!1;null!==(s=e.exec(a));){var f=s[0],g=s[1],m=s.index;if(c+=a.slice(l,m),l=m+f.length,g)c+=g[1],u=!0;else{var d="",y=a[l],v=s[2],x=s[3],b=s[4],A=s[5];if(!u&&c.length){var $=c.length-1;o.indexOf(c[$])>-1&&(d=c[$],c=c.slice(0,$))}c&&(h.push(c),c="",u=!1);var O=d||p,k=x||b;h.push({name:v||i++,prefix:d,delimiter:O,optional:"?"===A||"*"===A,repeat:"+"===A||"*"===A,partial:""!==d&&void 0!==y&&y!==d,pattern:k?r(k):"[^"+t(O)+"]+?"})}}return(c||l<a.length)&&h.push(c+a.substr(l)),h})(a,h),s,h))(h,i,l),h=(e,t)=>new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e),i=(e,t)=>h(e,t)?e.substr(t.length):e,l=e=>"/"===e.charAt(e.length-1)?e.slice(0,-1):e,c=e=>"/"===e.charAt(0)?e:"/"+e,p=e=>"/"===e.charAt(0)?e.substr(1):e,o=e=>{const{pathname:t,search:r,hash:a}=e;let n=t||"/";return r&&"?"!==r&&(n+="?"===r.charAt(0)?r:`?${r}`),a&&"#"!==a&&(n+="#"===a.charAt(0)?a:`#${a}`),n},u=e=>"/"===e.charAt(0),f=e=>Math.random().toString(36).substr(2,e),g=(e,t)=>{for(let r=t,a=r+1,n=e.length;a<n;r+=1,a+=1)e[r]=e[a];e.pop()},m=(e,t)=>{if(e===t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every((e,r)=>m(e,t[r]));const r=typeof e;if(r!==typeof t)return!1;if("object"===r){const r=e.valueOf(),a=t.valueOf();if(r!==e||a!==t)return m(r,a);const n=Object.keys(e),s=Object.keys(t);return n.length===s.length&&n.every(r=>m(e[r],t[r]))}return!1},d=(e,t)=>e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&m(e.state,t.state),y=(e,t,r,a)=>{let n;"string"==typeof e?(n=(e=>{let t=e||"/",r="",a="";const n=t.indexOf("#");-1!==n&&(a=t.substr(n),t=t.substr(0,n));const s=t.indexOf("?");return-1!==s&&(r=t.substr(s),t=t.substr(0,s)),{pathname:t,search:"?"===r?"":r,hash:"#"===a?"":a,query:{},key:""}})(e),void 0!==t&&(n.state=t)):((n=Object.assign({pathname:""},e)).search&&"?"!==n.search.charAt(0)&&(n.search="?"+n.search),n.hash&&"#"!==n.hash.charAt(0)&&(n.hash="#"+n.hash),void 0!==t&&void 0===n.state&&(n.state=t));try{n.pathname=decodeURI(n.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+n.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n.key=r,a?n.pathname?"/"!==n.pathname.charAt(0)&&(n.pathname=((e,t="")=>{let r,a=t&&t.split("/")||[],n=0;const s=e&&e.split("/")||[],h=e&&u(e),i=t&&u(t),l=h||i;if(e&&u(e)?a=s:s.length&&(a.pop(),a=a.concat(s)),!a.length)return"/";if(a.length){const e=a[a.length-1];r="."===e||".."===e||""===e}else r=!1;for(let e=a.length;e>=0;e--){const t=a[e];"."===t?g(a,e):".."===t?(g(a,e),n++):n&&(g(a,e),n--)}if(!l)for(;n--;n)a.unshift("..");!l||""===a[0]||a[0]&&u(a[0])||a.unshift("");let c=a.join("/");return r&&"/"!==c.substr(-1)&&(c+="/"),c})(n.pathname,a.pathname)):n.pathname=a.pathname:n.pathname||(n.pathname="/"),n.query=(e=>e?(/^[?#]/.test(e)?e.slice(1):e).split("&").reduce((e,t)=>{let[r,a]=t.split("=");return e[r]=a?decodeURIComponent(a.replace(/\+/g," ")):"",e},{}):{})(n.search||""),n};let v=0;const x={},b=(e,t={})=>{"string"==typeof t&&(t={path:t});const{path:r="/",exact:a=!1,strict:n=!1}=t,{re:h,keys:i}=((e,t)=>{const r=`${t.end}${t.strict}`,a=x[r]||(x[r]={}),n=JSON.stringify(e);if(a[n])return a[n];const h=[],i={re:s(e,h,t),keys:h};return v<1e4&&(a[n]=i,v+=1),i})(r,{end:a,strict:n}),l=h.exec(e);if(!l)return null;const[c,...p]=l,o=e===c;return a&&!o?null:{path:r,url:"/"===r&&""===c?"/":c,isExact:o,params:i.reduce((e,t,r)=>(e[t.name]=p[r],e),{})}},A=(e,t)=>null==e&&null==t||null!=t&&e&&t&&e.path===t.path&&e.url===t.url&&m(e.params,t.params);export{A as a,c as b,y as c,f as d,i as e,o as f,p as g,h,d as l,b as m,l as s};