if(!customElements.get("remex-router")){class t extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),
this.shadowRoot.innerHTML="\n \n \n ",
this.route=null,this.params={}}connectedCallback(){this.route=this.getAttribute("route"),this.checkActiveRoute()}checkActiveRoute(){const e=window.location.pathname;this.matchRoute(e)?t.activeRoute&&t.activeRoute!==this?t.activeRoute.hide().then((()=>{this.show().then((()=>t.activeRoute=this)),this.dispatchEvent(new CustomEvent("route-activated",{bubbles:!0,detail:{route:this.route,params:this.params}}))})):(this.show().then((()=>t.activeRoute=this)),this.dispatchEvent(new CustomEvent("route-activated",{bubbles:!0,detail:{route:this.route,params:this.params}}))):t.activeRoute===this?this.hide().then((()=>t.activeRoute=null)):this.hide()}matchRoute(t){const e=this.route.replace(/\//g,"\\/").replace(/:\w+/g,"([^\\/]+)"),a=new RegExp(`^${e}$`),s=t.match(a);if(s){const t=this.route.match(/:\w+/g)||[];return this.params={},t.forEach(((t,e)=>{this.params[t.slice(1)]=s[e+1]})),!0}return!1}show(){const t=this.getAttribute("transition-in")||"fade";return new Promise((e=>{
this.style.display="block",this.classList.remove("animate-out-"+t),this.offsetWidth,this.classList.add("animate-in-"+t),this.classList.add("active"),this.setAttribute("active",""),setTimeout((()=>{this.classList.remove("animate-in-"+t),e()}),251)}))}hide(){const t=this.getAttribute("transition-out")||"fade";return new Promise((e=>{this.hasAttribute("active")?(this.classList.remove("animate-in-"+t),this.offsetWidth,this.classList.add("animate-out-"+t),setTimeout((()=>{this.classList.remove("animate-out-"+t),this.classList.remove("active"),this.removeAttribute("active"),this.style.display="none",e()}),251)):e()}))}}t.activeRoute=null,customElements.define("remex-router",t)}