@wsxjs/wsx-router 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 WSX Framework Contributors
3
+ Copyright (c) 2026 WSXJS Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @wsxjs/wsx-router
2
2
 
3
- WSX Router - Native History API-based routing for WSX Framework
3
+ WSX Router - Native History API-based routing for WSXJS
4
4
 
5
5
  ## Features
6
6
 
@@ -207,7 +207,7 @@ wsx-link {
207
207
  --link-color: #007bff;
208
208
  --link-hover-color: #0056b3;
209
209
  --link-active-color: #6c757d;
210
- --link-focus-color: #007bff;
210
+ --link-focus-color: var(--primary-red); /* 使用主题颜色 */
211
211
  }
212
212
 
213
213
  wsx-view {
@@ -238,7 +238,7 @@ wsx-view::part(view) {
238
238
 
239
239
  ## Contributing
240
240
 
241
- See the main [WSX Framework Contributing Guide](../../CONTRIBUTING.md).
241
+ See the main [WSXJS Contributing Guide](../../CONTRIBUTING.md).
242
242
 
243
243
  ## License
244
244
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("@wsxjs/wsx-core"),nt=":host{display:block;width:100%;height:100%}.router-outlet{width:100%;height:100%}";var ft;let pt,vt;function Y(r,t,e){return(t=gt(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function xt(r,t,e,n,m,_){function C(i,c,u){return function(s,a){return u&&u(s),i[c].call(s,a)}}function P(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function b(i,c,u,s){if(typeof i!="function"&&(s||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(s?"":" or undefined"));return i}function $(i,c,u,s,a,W,A,j,N,y,g,f,p){function w(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,x=c[0],k=c[3],R=!j;if(!R){u||Array.isArray(x)||(x=[x]);var o={},E=[],v=a===3?"get":a===4||f?"set":"value";y?(g||f?o={get:it(function(){return k(this)},s,"get"),set:function(l){c[4](this,l)}}:o[v]=k,g||it(o[v],s,a===2?"":v)):g||(o=Object.getOwnPropertyDescriptor(i,s))}for(var d=i,z=x.length-1;z>=0;z-=u?2:1){var H=x[z],K=u?x[z-1]:void 0,Q={},O={kind:["field","accessor","method","getter","setter","class"][a],name:s,metadata:W,addInitializer:(function(l,S){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");b(S,"An initializer","be",!0),A.push(S)}).bind(null,Q)};try{if(R)(h=b(H.call(K,d,O),"class decorators","return"))&&(d=h);else{var I,U;O.static=N,O.private=y,y?a===2?I=function(l){return w(l),o.value}:(a<4&&(I=C(o,"get",w)),a!==3&&(U=C(o,"set",w))):(I=function(l){return l[s]},(a<2||a===4)&&(U=function(l,S){l[s]=S}));var J=O.access={has:y?p.bind():function(l){return s in l}};if(I&&(J.get=I),U&&(J.set=U),d=H.call(K,f?{get:o.get,set:o.set}:o[v],O),f){if(typeof d=="object"&&d)(h=b(d.get,"accessor.get"))&&(o.get=h),(h=b(d.set,"accessor.set"))&&(o.set=h),(h=b(d.init,"accessor.init"))&&E.push(h);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else b(d,(g?"field":"method")+" decorators","return")&&(g?E.push(d):o[v]=d)}}finally{Q.v=!0}}return(g||f)&&j.push(function(l,S){for(var M=E.length-1;M>=0;M--)S=E[M].call(l,S);return S}),g||R||(y?f?j.push(C(o,"get"),C(o,"set")):j.push(a===2?o[v]:C.call.bind(o[v])):Object.defineProperty(i,s,o)),d}function D(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var V=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var L=Object.create(V??null),X=function(i,c,u,s){var a,W,A=[],j=function(v){return Et(v)===i},N=new Map;function y(v){v&&A.push(P.bind(null,v))}for(var g=0;g<c.length;g++){var f=c[g];if(Array.isArray(f)){var p=f[1],w=f[2],h=f.length>3,x=16&p,k=!!(8&p),R=(p&=7)==0,o=w+"/"+k;if(!R&&!h){var E=N.get(o);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+w);N.set(o,!(p>2)||p)}$(k?i:i.prototype,f,x,h?"#"+w:gt(w),p,s,k?W=W||[]:a=a||[],A,k,h,R,p===1,k&&h?j:u)}}return y(a),y(W),A}(r,t,m,L);return e.length||D(r,L),{e:X,get c(){var i=[];return e.length&&[D($(r,[e],n,r.name,5,L,i),L),P.bind(null,i,r)]}}}function gt(r){var t=kt(r,"string");return typeof t=="symbol"?t:t+""}function kt(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function it(r,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(r,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return r}function Et(r){if(Object(r)!==r)throw TypeError("right-hand side of 'in' should be an object, got "+(r!==null?typeof r:"null"));return r}const B=T.createLogger("WsxRouter");vt=[T.autoRegister({tagName:"wsx-router"})];exports.WsxRouter=void 0;class St extends T.LightComponent{constructor(){super({styles:nt,styleName:"wsx-router"}),Y(this,"_autoStyles",nt),Y(this,"views",new Map),Y(this,"currentView",null),Y(this,"handleRouteChange",()=>{const t=window.location.pathname;B.debug(`Route changed to: ${t}`),this.currentView&&(this.currentView.style.display="none",B.debug("Hiding previous view"));const e=this.matchRoute(t);if(e){e.style.display="block",this.currentView=e,B.debug(`Showing view for route: ${e.getAttribute("route")}`);const n=this.extractParams(e.getAttribute("route")||"/",t);n&&e.setAttribute("params",JSON.stringify(n))}else B.warn(`No view found for path: ${t}`);this.dispatchEvent(new CustomEvent("route-changed",{detail:{path:t,view:e},bubbles:!0,composed:!0}))}),Y(this,"interceptLinks",t=>{const e=t.target.closest("a");if(!e)return;const n=e.getAttribute("href");!n||n.startsWith("http")||n.startsWith("#")||(t.preventDefault(),this.navigate(n))})}render(){return T.jsx("div",{class:"router-outlet"})}onConnected(){B.debug("WsxRouter connected to DOM"),this.collectViews(),B.debug("WsxRouter collected views:",this.views.size),window.addEventListener("popstate",this.handleRouteChange),this.addEventListener("click",this.interceptLinks),this.handleRouteChange()}onDisconnected(){window.removeEventListener("popstate",this.handleRouteChange)}collectViews(){const t=Array.from(this.children).filter(e=>e.tagName.toLowerCase()==="wsx-view");B.debug("WsxRouter found views:",t.length),t.forEach(e=>{const n=e.getAttribute("route")||"/";this.views.set(n,e),e.style.display="none",B.debug(`WsxRouter hiding view for route: ${n}`)})}matchRoute(t){if(this.views.has(t))return this.views.get(t);for(const[e,n]of this.views)if(e.includes(":")){const m=e.replace(/:[^/]+/g,"([^/]+)");if(new RegExp(`^${m}$`).test(t))return n}return this.views.get("*")||null}extractParams(t,e){var b;if(!t.includes(":"))return null;const n=((b=t.match(/:([^/]+)/g))==null?void 0:b.map($=>$.slice(1)))||[],m=t.replace(/:[^/]+/g,"([^/]+)"),_=new RegExp(`^${m}$`),C=e.match(_);if(!C||!n.length)return null;const P={};return n.forEach(($,D)=>{P[$]=C[D+1]}),P}navigate(t){window.history.pushState(null,"",t),this.handleRouteChange()}}ft=St;[exports.WsxRouter,pt]=xt(ft,[],vt,0,void 0,T.LightComponent).c;pt();const ot=":host{display:block;width:100%;height:100%}.route-view{width:100%;height:100%;position:relative}:host([loading]) .route-view{opacity:.5;transition:opacity .3s ease}:host([error]) .route-view{border:1px solid var(--error-color, #ff0000);padding:1rem}.route-view.entering{animation:fadeIn .3s ease-out}.route-view.leaving{animation:fadeOut .3s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}";var Z,F;let st,mt,at;function G(r,t,e){return(t=bt(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function Ct(r,t,e,n,m,_){function C(i,c,u){return function(s,a){return u&&u(s),i[c].call(s,a)}}function P(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function b(i,c,u,s){if(typeof i!="function"&&(s||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(s?"":" or undefined"));return i}function $(i,c,u,s,a,W,A,j,N,y,g,f,p){function w(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,x=c[0],k=c[3],R=!j;if(!R){u||Array.isArray(x)||(x=[x]);var o={},E=[],v=a===3?"get":a===4||f?"set":"value";y?(g||f?o={get:ct(function(){return k(this)},s,"get"),set:function(l){c[4](this,l)}}:o[v]=k,g||ct(o[v],s,a===2?"":v)):g||(o=Object.getOwnPropertyDescriptor(i,s))}for(var d=i,z=x.length-1;z>=0;z-=u?2:1){var H=x[z],K=u?x[z-1]:void 0,Q={},O={kind:["field","accessor","method","getter","setter","class"][a],name:s,metadata:W,addInitializer:(function(l,S){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");b(S,"An initializer","be",!0),A.push(S)}).bind(null,Q)};try{if(R)(h=b(H.call(K,d,O),"class decorators","return"))&&(d=h);else{var I,U;O.static=N,O.private=y,y?a===2?I=function(l){return w(l),o.value}:(a<4&&(I=C(o,"get",w)),a!==3&&(U=C(o,"set",w))):(I=function(l){return l[s]},(a<2||a===4)&&(U=function(l,S){l[s]=S}));var J=O.access={has:y?p.bind():function(l){return s in l}};if(I&&(J.get=I),U&&(J.set=U),d=H.call(K,f?{get:o.get,set:o.set}:o[v],O),f){if(typeof d=="object"&&d)(h=b(d.get,"accessor.get"))&&(o.get=h),(h=b(d.set,"accessor.set"))&&(o.set=h),(h=b(d.init,"accessor.init"))&&E.push(h);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else b(d,(g?"field":"method")+" decorators","return")&&(g?E.push(d):o[v]=d)}}finally{Q.v=!0}}return(g||f)&&j.push(function(l,S){for(var M=E.length-1;M>=0;M--)S=E[M].call(l,S);return S}),g||R||(y?f?j.push(C(o,"get"),C(o,"set")):j.push(a===2?o[v]:C.call.bind(o[v])):Object.defineProperty(i,s,o)),d}function D(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var V=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var L=Object.create(V??null),X=function(i,c,u,s){var a,W,A=[],j=function(v){return jt(v)===i},N=new Map;function y(v){v&&A.push(P.bind(null,v))}for(var g=0;g<c.length;g++){var f=c[g];if(Array.isArray(f)){var p=f[1],w=f[2],h=f.length>3,x=16&p,k=!!(8&p),R=(p&=7)==0,o=w+"/"+k;if(!R&&!h){var E=N.get(o);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+w);N.set(o,!(p>2)||p)}$(k?i:i.prototype,f,x,h?"#"+w:bt(w),p,s,k?W=W||[]:a=a||[],A,k,h,R,p===1,k&&h?j:u)}}return y(a),y(W),A}(r,t,m,L);return e.length||D(r,L),{e:X,get c(){var i=[];return e.length&&[D($(r,[e],n,r.name,5,L,i),L),P.bind(null,i,r)]}}}function bt(r){var t=_t(r,"string");return typeof t=="symbol"?t:t+""}function _t(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ct(r,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(r,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return r}function jt(r){if(Object(r)!==r)throw TypeError("right-hand side of 'in' should be an object, got "+(r!==null?typeof r:"null"));return r}function Rt(r){return r}const tt=T.createLogger("WsxView");mt=[T.autoRegister({tagName:"wsx-view"})];exports.WsxView=void 0;new(at=(F=class extends T.LightComponent{constructor(){super({styles:ot,styleName:"wsx-view"}),G(this,"_autoStyles",ot),G(this,"component",null),G(this,"params",{}),G(this,"componentInstance",null)}render(){return T.jsx("div",{class:"route-view"})}onConnected(){const t=this.getAttribute("component");t&&!this.componentInstance&&this.loadComponent(t)}onAttributeChanged(t,e,n){if(t==="component"&&n&&!this.componentInstance)this.loadComponent(n);else if(t==="params"&&this.componentInstance)try{this.params=JSON.parse(n),Object.entries(this.params).forEach(([m,_])=>{this.componentInstance.setAttribute(m,_)})}catch(m){tt.error("Failed to parse params:",m)}}async loadComponent(t){if(this.componentInstance&&(this.componentInstance.remove(),this.componentInstance=null),!customElements.get(t)){tt.warn(`Component ${t} not found in customElements registry`);return}this.componentInstance=document.createElement(t),Object.keys(this.params).length>0&&Object.entries(this.params).forEach(([m,_])=>{this.componentInstance.setAttribute(m,_)});const n=this.querySelector(".route-view");n?n.appendChild(this.componentInstance):tt.error("Route view container not found")}onDisconnected(){this.componentInstance&&(this.componentInstance.remove(),this.componentInstance=null)}},[exports.WsxView,st]=Ct(F,[],mt,0,void 0,T.LightComponent).c,F),Z=class extends Rt{constructor(){super(exports.WsxView),G(this,"observedAttributes",["route","component","params"]),st()}},G(Z,at,void 0),Z);const $t=':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, #007bff);outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';var et,rt;let lt,yt,ut;function q(r,t,e){return(t=wt(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function Lt(r,t,e,n,m,_){function C(i,c,u){return function(s,a){return u&&u(s),i[c].call(s,a)}}function P(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function b(i,c,u,s){if(typeof i!="function"&&(s||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(s?"":" or undefined"));return i}function $(i,c,u,s,a,W,A,j,N,y,g,f,p){function w(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,x=c[0],k=c[3],R=!j;if(!R){u||Array.isArray(x)||(x=[x]);var o={},E=[],v=a===3?"get":a===4||f?"set":"value";y?(g||f?o={get:ht(function(){return k(this)},s,"get"),set:function(l){c[4](this,l)}}:o[v]=k,g||ht(o[v],s,a===2?"":v)):g||(o=Object.getOwnPropertyDescriptor(i,s))}for(var d=i,z=x.length-1;z>=0;z-=u?2:1){var H=x[z],K=u?x[z-1]:void 0,Q={},O={kind:["field","accessor","method","getter","setter","class"][a],name:s,metadata:W,addInitializer:(function(l,S){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");b(S,"An initializer","be",!0),A.push(S)}).bind(null,Q)};try{if(R)(h=b(H.call(K,d,O),"class decorators","return"))&&(d=h);else{var I,U;O.static=N,O.private=y,y?a===2?I=function(l){return w(l),o.value}:(a<4&&(I=C(o,"get",w)),a!==3&&(U=C(o,"set",w))):(I=function(l){return l[s]},(a<2||a===4)&&(U=function(l,S){l[s]=S}));var J=O.access={has:y?p.bind():function(l){return s in l}};if(I&&(J.get=I),U&&(J.set=U),d=H.call(K,f?{get:o.get,set:o.set}:o[v],O),f){if(typeof d=="object"&&d)(h=b(d.get,"accessor.get"))&&(o.get=h),(h=b(d.set,"accessor.set"))&&(o.set=h),(h=b(d.init,"accessor.init"))&&E.push(h);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else b(d,(g?"field":"method")+" decorators","return")&&(g?E.push(d):o[v]=d)}}finally{Q.v=!0}}return(g||f)&&j.push(function(l,S){for(var M=E.length-1;M>=0;M--)S=E[M].call(l,S);return S}),g||R||(y?f?j.push(C(o,"get"),C(o,"set")):j.push(a===2?o[v]:C.call.bind(o[v])):Object.defineProperty(i,s,o)),d}function D(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var V=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var L=Object.create(V??null),X=function(i,c,u,s){var a,W,A=[],j=function(v){return At(v)===i},N=new Map;function y(v){v&&A.push(P.bind(null,v))}for(var g=0;g<c.length;g++){var f=c[g];if(Array.isArray(f)){var p=f[1],w=f[2],h=f.length>3,x=16&p,k=!!(8&p),R=(p&=7)==0,o=w+"/"+k;if(!R&&!h){var E=N.get(o);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+w);N.set(o,!(p>2)||p)}$(k?i:i.prototype,f,x,h?"#"+w:wt(w),p,s,k?W=W||[]:a=a||[],A,k,h,R,p===1,k&&h?j:u)}}return y(a),y(W),A}(r,t,m,L);return e.length||D(r,L),{e:X,get c(){var i=[];return e.length&&[D($(r,[e],n,r.name,5,L,i),L),P.bind(null,i,r)]}}}function wt(r){var t=Wt(r,"string");return typeof t=="symbol"?t:t+""}function Wt(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ht(r,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(r,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return r}function At(r){if(Object(r)!==r)throw TypeError("right-hand side of 'in' should be an object, got "+(r!==null?typeof r:"null"));return r}function Ot(r){return r}const dt=T.createLogger("WsxLink");yt=[T.autoRegister({tagName:"wsx-link"})];exports.WsxLink=void 0;new(ut=(rt=class extends T.WebComponent{constructor(){super(),q(this,"_autoStyles",$t),q(this,"to",void 0),q(this,"replace",void 0),q(this,"activeClass",void 0),q(this,"exact",void 0),q(this,"handleClick",$=>{if($.preventDefault(),!this.to){dt.warn("No 'to' attribute specified");return}if(this.isExternalLink(this.to)){window.open(this.to,"_blank");return}this.replace?window.history.replaceState(null,"",this.to):window.history.pushState(null,"",this.to),window.dispatchEvent(new PopStateEvent("popstate")),dt.debug(`Navigated to: ${this.to}`)}),q(this,"updateActiveState",()=>{var L;const $=window.location.pathname,D=this.exact?$===this.to:$.startsWith(this.to)&&this.to!=="/",V=(L=this.shadowRoot)==null?void 0:L.querySelector("a");V&&(D?(V.classList.add(this.activeClass),this.setAttribute("active","")):(V.classList.remove(this.activeClass),this.removeAttribute("active")))});const[t,e]=this.useState("to","");Object.defineProperty(this,"to",{get:t,set:e,enumerable:!0,configurable:!0});const[n,m]=this.useState("replace",!1);Object.defineProperty(this,"replace",{get:n,set:m,enumerable:!0,configurable:!0});const[_,C]=this.useState("activeClass","active");Object.defineProperty(this,"activeClass",{get:_,set:C,enumerable:!0,configurable:!0});const[P,b]=this.useState("exact",!1);Object.defineProperty(this,"exact",{get:P,set:b,enumerable:!0,configurable:!0})}render(){return T.jsx("a",{href:this.to,class:"wsx-link",onClick:this.handleClick,part:"link"},T.jsx("slot",null))}onConnected(){this.to=this.getAttribute("to")||"",this.replace=this.hasAttribute("replace"),this.activeClass=this.getAttribute("active-class")||"active",this.exact=this.hasAttribute("exact");const t=this.shadowRoot.querySelector(".wsx-link");t&&(t.href=this.to),window.addEventListener("popstate",this.updateActiveState),document.addEventListener("route-changed",this.updateActiveState),this.updateActiveState()}onDisconnected(){window.removeEventListener("popstate",this.updateActiveState),document.removeEventListener("route-changed",this.updateActiveState)}onAttributeChanged(t,e,n){switch(t){case"to":this.to=n||"",this.updateActiveState();break;case"replace":this.replace=n!==null&&n!=="false";break;case"active-class":this.activeClass=n||"active",this.updateActiveState();break;case"exact":this.exact=n!==null&&n!=="false",this.updateActiveState();break}}isExternalLink(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("mailto:")||t.startsWith("tel:")}navigate(){this.to&&this.handleClick(new MouseEvent("click",{bubbles:!0,cancelable:!0}))}},[exports.WsxLink,lt]=Lt(rt,[],yt,0,void 0,T.WebComponent).c,rt),et=class extends Ot{constructor(){super(exports.WsxLink),q(this,"observedAttributes",["to","replace","active-class","exact"]),lt()}},q(et,ut,void 0),et);const It=T.createLogger("RouterUtils");class Tt{static navigate(t,e=!1){e?window.history.replaceState(null,"",t):window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate")),It.debug(`Navigated to: ${t} (replace: ${e})`)}static getCurrentRoute(){const t=new URL(window.location.href);return{path:t.pathname,params:{},query:Object.fromEntries(t.searchParams.entries()),hash:t.hash.slice(1)}}static parseRoute(t,e){var n;if(t===e)return{route:t,params:{},exact:!0};if(t==="*")return{route:t,params:{},exact:!1};if(t.includes(":")){const m=((n=t.match(/:([^/]+)/g))==null?void 0:n.map(b=>b.slice(1)))||[],_=t.replace(/:[^/]+/g,"([^/]+)"),C=new RegExp(`^${_}$`),P=e.match(C);if(P&&m.length>0){const b={};return m.forEach(($,D)=>{b[$]=P[D+1]}),{route:t,params:b,exact:!0}}}if(t.endsWith("/*")){const m=t.slice(0,-2);if(e.startsWith(m))return{route:t,params:{},exact:!1}}return null}static buildPath(t,e={}){let n=t;return Object.entries(e).forEach(([m,_])=>{n=n.replace(`:${m}`,encodeURIComponent(_))}),n}static isRouteActive(t,e=!1){const n=window.location.pathname;return e?n===t:t==="/"?n==="/":n.startsWith(t)}static getRouteDepth(t){return t.split("/").filter(e=>e.length>0).length}static getParentRoute(t){const e=t.split("/").filter(n=>n.length>0);return e.length<=1?"/":(e.pop(),"/"+e.join("/"))}static joinPaths(...t){return t.map(e=>e.replace(/^\/+|\/+$/g,"")).filter(e=>e.length>0).join("/").replace(/^/,"/")}static isExternalUrl(t){return/^https?:\/\//.test(t)||/^mailto:/.test(t)||/^tel:/.test(t)}static getQueryParam(t){return new URL(window.location.href).searchParams.get(t)}static setQueryParam(t,e,n=!1){const m=new URL(window.location.href);m.searchParams.set(t,e);const _=m.pathname+m.search+m.hash;this.navigate(_,n)}static removeQueryParam(t,e=!1){const n=new URL(window.location.href);n.searchParams.delete(t);const m=n.pathname+n.search+n.hash;this.navigate(m,e)}static goBack(){window.history.back()}static goForward(){window.history.forward()}static replace(t){this.navigate(t,!0)}static getHistoryLength(){return window.history.length}static onRouteChange(t){const e=()=>{const n=this.getCurrentRoute();t(n)};return window.addEventListener("popstate",e),document.addEventListener("route-changed",e),()=>{window.removeEventListener("popstate",e),document.removeEventListener("route-changed",e)}}}exports.RouterUtils=Tt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("@wsxjs/wsx-core");function He(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var le={exports:{}};function Be(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Ke=Je;function Je(t,e,n){var r=n&&n.stringify||Be,s=1;if(typeof t=="object"&&t!==null){var l=e.length+s;if(l===1)return t;var g=new Array(l);g[0]=r(t);for(var m=1;m<l;m++)g[m]=r(e[m]);return g.join(" ")}if(typeof t!="string")return t;var u=e.length;if(u===0)return t;for(var i="",p=1-s,v=-1,z=t&&t.length||0,x=0;x<z;){if(t.charCodeAt(x)===37&&x+1<z){switch(v=v>-1?v:0,t.charCodeAt(x+1)){case 100:case 102:if(p>=u||e[p]==null)break;v<x&&(i+=t.slice(v,x)),i+=Number(e[p]),v=x+2,x++;break;case 105:if(p>=u||e[p]==null)break;v<x&&(i+=t.slice(v,x)),i+=Math.floor(Number(e[p])),v=x+2,x++;break;case 79:case 111:case 106:if(p>=u||e[p]===void 0)break;v<x&&(i+=t.slice(v,x));var o=typeof e[p];if(o==="string"){i+="'"+e[p]+"'",v=x+2,x++;break}if(o==="function"){i+=e[p].name||"<anonymous>",v=x+2,x++;break}i+=r(e[p]),v=x+2,x++;break;case 115:if(p>=u)break;v<x&&(i+=t.slice(v,x)),i+=String(e[p]),v=x+2,x++;break;case 37:v<x&&(i+=t.slice(v,x)),i+="%",v=x+2,x++,p--;break}++p}++x}return v===-1?t:(v<z&&(i+=t.slice(v)),i)}const xe=Ke;le.exports=J;const ie=lt().console||{},Qe={mapHttpRequest:oe,mapHttpResponse:oe,wrapRequestSerializer:he,wrapResponseSerializer:he,wrapErrorSerializer:he,req:oe,res:oe,err:Re,errWithCause:Re};function Z(t,e){return t==="silent"?1/0:e.levels.values[t]}const ye=Symbol("pino.logFuncs"),ve=Symbol("pino.hierarchy"),Ge={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Ee(t,e){const n={logger:e,parent:t[ve]};e[ve]=n}function Xe(t,e,n){const r={};e.forEach(s=>{r[s]=n[s]?n[s]:ie[s]||ie[Ge[s]||"log"]||re}),t[ye]=r}function Ye(t,e){return Array.isArray(t)?t.filter(function(r){return r!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function J(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||ie;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},s=Ye(t.browser.serialize,r);let l=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const g=Object.keys(t.customLevels||{}),m=["error","fatal","warn","info","debug","trace"].concat(g);typeof n=="function"&&m.forEach(function(c){n[c]=n}),(t.enabled===!1||t.browser.disabled)&&(t.level="silent");const u=t.level||"info",i=Object.create(n);i.log||(i.log=re),Xe(i,m,n),Ee({},i),Object.defineProperty(i,"levelVal",{get:v}),Object.defineProperty(i,"level",{get:z,set:x});const p={transmit:e,serialize:s,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:m,timestamp:ot(t),messageKey:t.messageKey||"msg",onChild:t.onChild||re};i.levels=Ze(t),i.level=u,i.isLevelEnabled=function(c){return this.levels.values[c]?this.levels.values[c]>=this.levels.values[this.level]:!1},i.setMaxListeners=i.getMaxListeners=i.emit=i.addListener=i.on=i.prependListener=i.once=i.prependOnceListener=i.removeListener=i.removeAllListeners=i.listeners=i.listenerCount=i.eventNames=i.write=i.flush=re,i.serializers=r,i._serialize=s,i._stdErrSerialize=l,i.child=function(...c){return o.call(this,p,...c)},e&&(i._logEvent=be());function v(){return Z(this.level,this)}function z(){return this._level}function x(c){if(c!=="silent"&&!this.levels.values[c])throw Error("unknown level "+c);this._level=c,ee(this,p,i,"error"),ee(this,p,i,"fatal"),ee(this,p,i,"warn"),ee(this,p,i,"info"),ee(this,p,i,"debug"),ee(this,p,i,"trace"),g.forEach(f=>{ee(this,p,i,f)})}function o(c,f,h){if(!f)throw new Error("missing bindings for child Pino");h=h||{},s&&f.serializers&&(h.serializers=f.serializers);const d=h.serializers;if(s&&d){var T=Object.assign({},r,d),V=t.browser.serialize===!0?Object.keys(T):s;delete f.serializers,we([f],V,T,this._stdErrSerialize)}function A(k){this._childLevel=(k._childLevel|0)+1,this.bindings=f,T&&(this.serializers=T,this._serialize=V),e&&(this._logEvent=be([].concat(k._logEvent.bindings,f)))}A.prototype=this;const I=new A(this);return Ee(this,I),I.child=function(...k){return o.call(this,c,...k)},I.level=h.level||this.level,c.onChild(I),I}return i}function Ze(t){const e=t.customLevels||{},n=Object.assign({},J.levels.values,e),r=Object.assign({},J.levels.labels,et(e));return{values:n,labels:r}}function et(t){const e={};return Object.keys(t).forEach(function(n){e[t[n]]=n}),e}J.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};J.stdSerializers=Qe;J.stdTimeFunctions=Object.assign({},{nullTime:Ae,epochTime:Te,unixTime:at,isoTime:ct});function tt(t){const e=[];t.bindings&&e.push(t.bindings);let n=t[ve];for(;n.parent;)n=n.parent,n.logger.bindings&&e.push(n.logger.bindings);return e.reverse()}function ee(t,e,n,r){if(Object.defineProperty(t,r,{value:Z(t.level,n)>Z(r,n)?re:n[ye][r],writable:!0,enumerable:!0,configurable:!0}),t[r]===re){if(!e.transmit)return;const l=e.transmit.level||t.level,g=Z(l,n);if(Z(r,n)<g)return}t[r]=rt(t,e,n,r);const s=tt(t);s.length!==0&&(t[r]=nt(s,t[r]))}function nt(t,e){return function(){return e.apply(this,[...t,...arguments])}}function rt(t,e,n,r){return function(s){return function(){const g=e.timestamp(),m=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ie?ie:this;for(var i=0;i<m.length;i++)m[i]=arguments[i];var p=!1;if(e.serialize&&(we(m,this._serialize,this.serializers,this._stdErrSerialize),p=!0),e.asObject||e.formatters?s.call(u,...it(this,r,m,g,e)):s.apply(u,m),e.transmit){const v=e.transmit.level||t._level,z=Z(v,n),x=Z(r,n);if(x<z)return;st(this,{ts:g,methodLevel:r,methodValue:x,transmitValue:n.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:Z(t._level,n)},m,p)}}}(t[ye][r])}function it(t,e,n,r,s){const{level:l,log:g=v=>v}=s.formatters||{},m=n.slice();let u=m[0];const i={};let p=(t._childLevel|0)+1;if(p<1&&(p=1),r&&(i.time=r),l){const v=l(e,t.levels.values[e]);Object.assign(i,v)}else i.level=t.levels.values[e];if(s.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;p--&&typeof m[0]=="object";)Object.assign(i,m.shift());return[g(i),...m]}else{if(u!==null&&typeof u=="object"){for(;p--&&typeof m[0]=="object";)Object.assign(i,m.shift());u=m.length?xe(m.shift(),m):void 0}else typeof u=="string"&&(u=xe(m.shift(),m));return u!==void 0&&(i[s.messageKey]=u),[g(i)]}}function we(t,e,n,r){for(const s in t)if(r&&t[s]instanceof Error)t[s]=J.stdSerializers.err(t[s]);else if(typeof t[s]=="object"&&!Array.isArray(t[s])&&e)for(const l in t[s])e.indexOf(l)>-1&&l in n&&(t[s][l]=n[l](t[s][l]))}function st(t,e,n,r=!1){const s=e.send,l=e.ts,g=e.methodLevel,m=e.methodValue,u=e.val,i=t._logEvent.bindings;r||we(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=l,t._logEvent.messages=n.filter(function(p){return i.indexOf(p)===-1}),t._logEvent.level.label=g,t._logEvent.level.value=m,s(g,t._logEvent,u),t._logEvent=be(i)}function be(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Re(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)e[n]===void 0&&(e[n]=t[n]);return e}function ot(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Ae:Te}function oe(){return{}}function he(t){return t}function re(){}function Ae(){return!1}function Te(){return Date.now()}function at(){return Math.round(Date.now()/1e3)}function ct(){return new Date(Date.now()).toISOString()}function lt(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}le.exports.default=J;le.exports.pino=J;var ut=le.exports;const ae=He(ut);function ce(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function ht(){var t;return typeof process<"u"&&((t=process.versions)==null?void 0:t.node)!==void 0}function ft(){return typeof window<"u"&&typeof document<"u"}const fe={name:"WSX",level:ce()?"info":"debug",pretty:!ce()};function dt(t={}){const{name:e,level:n,pretty:r,pinoOptions:s}={...fe,...t},l={name:e||fe.name,level:n||fe.level,...s};if(ft()&&(l.browser={asObject:!1,write:void 0,...(s==null?void 0:s.browser)||{}}),r&&ht()&&!ce())try{return ae(l,ae.transport({target:"pino-pretty",options:{colorize:!0,translateTime:"HH:MM:ss.l",ignore:"pid,hostname",singleLine:!1}}))}catch{return console.warn("[wsx-logger] pino-pretty not available, using default formatter"),ae(l)}return ae(l)}class Ve{constructor(e={}){this.isProd=ce(),this.pinoLogger=dt(e)}debug(e,...n){this.isProd||(n.length>0?this.pinoLogger.debug({args:n},e):this.pinoLogger.debug(e))}info(e,...n){this.isProd?n.length>0?this.pinoLogger.info({args:n},e):this.pinoLogger.info(e):n.length>0?this.pinoLogger.info({args:n},e):this.pinoLogger.info(e)}warn(e,...n){n.length>0?this.pinoLogger.warn({args:n},e):this.pinoLogger.warn(e)}error(e,...n){n.length>0?this.pinoLogger.error({args:n},e):this.pinoLogger.error(e)}fatal(e,...n){n.length>0?this.pinoLogger.fatal({args:n},e):this.pinoLogger.fatal(e)}trace(e,...n){this.isProd||(n.length>0?this.pinoLogger.trace({args:n},e):this.pinoLogger.trace(e))}getPinoLogger(){return this.pinoLogger}}new Ve;function ue(t,e={}){return new Ve({...e,name:e.name||`WSX:${t}`})}const gt=ue("RouterUtils"),ne=class ne{static _setCurrentRoute(e){ne._currentRoute=e}static navigate(e,n=!1){n?window.history.replaceState(null,"",e):window.history.pushState(null,"",e),window.dispatchEvent(new PopStateEvent("popstate")),gt.debug(`Navigated to: ${e} (replace: ${n})`)}static getCurrentRoute(){if(ne._currentRoute)return ne._currentRoute;const e=new URL(window.location.href);return{path:e.pathname,params:{},query:Object.fromEntries(e.searchParams.entries()),hash:e.hash.slice(1)}}static parseRoute(e,n){var r;if(e===n)return{route:e,params:{},exact:!0};if(e==="*")return{route:e,params:{},exact:!1};if(e.includes(":")){const s=((r=e.match(/:([^/]+)/g))==null?void 0:r.map(u=>u.slice(1)))||[],l=e.replace(/:[^/]+/g,"([^/]+)"),g=new RegExp(`^${l}$`),m=n.match(g);if(m&&s.length>0){const u={};return s.forEach((i,p)=>{u[i]=m[p+1]}),{route:e,params:u,exact:!0}}}if(e.endsWith("/*")){const s=e.slice(0,-2);if(n.startsWith(s))return{route:e,params:{},exact:!1}}return null}static buildPath(e,n={}){let r=e;return Object.entries(n).forEach(([s,l])=>{r=r.replace(`:${s}`,encodeURIComponent(l))}),r}static isRouteActive(e,n=!1){const r=window.location.pathname;return n?r===e:e==="/"?r==="/":r.startsWith(e)}static getRouteDepth(e){return e.split("/").filter(n=>n.length>0).length}static getParentRoute(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=1?"/":(n.pop(),"/"+n.join("/"))}static joinPaths(...e){return e.map(n=>n.replace(/^\/+|\/+$/g,"")).filter(n=>n.length>0).join("/").replace(/^/,"/")}static isExternalUrl(e){return/^https?:\/\//.test(e)||/^mailto:/.test(e)||/^tel:/.test(e)}static getQueryParam(e){return new URL(window.location.href).searchParams.get(e)}static setQueryParam(e,n,r=!1){const s=new URL(window.location.href);s.searchParams.set(e,n);const l=s.pathname+s.search+s.hash;this.navigate(l,r)}static removeQueryParam(e,n=!1){const r=new URL(window.location.href);r.searchParams.delete(e);const s=r.pathname+r.search+r.hash;this.navigate(s,n)}static goBack(){window.history.back()}static goForward(){window.history.forward()}static replace(e){this.navigate(e,!0)}static getHistoryLength(){return window.history.length}static onRouteChange(e){const n=()=>{const r=this.getCurrentRoute();e(r)};return document.addEventListener("route-changed",n),()=>{document.removeEventListener("route-changed",n)}}};ne._currentRoute=null;let se=ne;const Le=":host{display:grid;width:100%}.router-outlet{width:100%}:host>wsx-view{grid-area:1 / 1}";var Ie;let Pe,De;function B(t,e,n){return(e=Me(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mt(t,e,n,r,s,l){function g(o,c,f){return function(h,d){return f&&f(h),o[c].call(h,d)}}function m(o,c){for(var f=0;f<o.length;f++)o[f].call(c);return c}function u(o,c,f,h){if(typeof o!="function"&&(h||o!==void 0))throw new TypeError(c+" must "+(f||"be")+" a function"+(h?"":" or undefined"));return o}function i(o,c,f,h,d,T,V,A,I,k,j,E,R){function $(b){if(!R(b))throw new TypeError("Attempted to access private element on non-instance")}var y,_=c[0],S=c[3],P=!A;if(!P){f||Array.isArray(_)||(_=[_]);var a={},O=[],L=d===3?"get":d===4||E?"set":"value";k?(j||E?a={get:je(function(){return S(this)},h,"get"),set:function(b){c[4](this,b)}}:a[L]=S,j||je(a[L],h,d===2?"":L)):j||(a=Object.getOwnPropertyDescriptor(o,h))}for(var w=o,N=_.length-1;N>=0;N-=f?2:1){var Q=_[N],G=f?_[N-1]:void 0,X={},D={kind:["field","accessor","method","getter","setter","class"][d],name:h,metadata:T,addInitializer:(function(b,W){if(b.v)throw Error("attempted to call addInitializer after decoration was finished");u(W,"An initializer","be",!0),V.push(W)}).bind(null,X)};try{if(P)(y=u(Q.call(G,w,D),"class decorators","return"))&&(w=y);else{var M,F;D.static=I,D.private=k,k?d===2?M=function(b){return $(b),a.value}:(d<4&&(M=g(a,"get",$)),d!==3&&(F=g(a,"set",$))):(M=function(b){return b[h]},(d<2||d===4)&&(F=function(b,W){b[h]=W}));var Y=D.access={has:k?R.bind():function(b){return h in b}};if(M&&(Y.get=M),F&&(Y.set=F),w=Q.call(G,E?{get:a.get,set:a.set}:a[L],D),E){if(typeof w=="object"&&w)(y=u(w.get,"accessor.get"))&&(a.get=y),(y=u(w.set,"accessor.set"))&&(a.set=y),(y=u(w.init,"accessor.init"))&&O.push(y);else if(w!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else u(w,(j?"field":"method")+" decorators","return")&&(j?O.push(w):a[L]=w)}}finally{X.v=!0}}return(j||E)&&A.push(function(b,W){for(var H=O.length-1;H>=0;H--)W=O[H].call(b,W);return W}),j||P||(k?E?A.push(g(a,"get"),g(a,"set")):A.push(d===2?a[L]:g.call.bind(a[L])):Object.defineProperty(o,h,a)),w}function p(o,c){return Object.defineProperty(o,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var v=l[Symbol.metadata||Symbol.for("Symbol.metadata")];var z=Object.create(v??null),x=function(o,c,f,h){var d,T,V=[],A=function(L){return vt(L)===o},I=new Map;function k(L){L&&V.push(m.bind(null,L))}for(var j=0;j<c.length;j++){var E=c[j];if(Array.isArray(E)){var R=E[1],$=E[2],y=E.length>3,_=16&R,S=!!(8&R),P=(R&=7)==0,a=$+"/"+S;if(!P&&!y){var O=I.get(a);if(O===!0||O===3&&R!==4||O===4&&R!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+$);I.set(a,!(R>2)||R)}i(S?o:o.prototype,E,_,y?"#"+$:Me($),R,h,S?T=T||[]:d=d||[],V,S,y,P,R===1,S&&y?A:f)}}return k(d),k(T),V}(t,e,s,z);return n.length||p(t,z),{e:x,get c(){var o=[];return n.length&&[p(i(t,[n],r,t.name,5,z,o),z),m.bind(null,o,t)]}}}function Me(t){var e=pt(t,"string");return typeof e=="symbol"?e:e+""}function pt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function je(t,e,n){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:n?n+" "+e:e})}catch{}return t}function vt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const C=ue("WsxRouter");De=[U.autoRegister({tagName:"wsx-router"})];exports.WsxRouter=void 0;class bt extends U.LightComponent{constructor(){super({styles:Le,styleName:"wsx-router"}),B(this,"_autoStyles",Le),B(this,"views",new Map),B(this,"currentView",null),B(this,"currentPath",""),B(this,"isHandlingRoute",!1),B(this,"compiledRoutes",new Map),B(this,"matchCache",new Map),B(this,"enableViewTransitions",!0),B(this,"scrollRestoration","manual"),B(this,"handleRouteChange",()=>{if(this.isHandlingRoute){C.debug("Route change already in progress, skipping");return}this.views.size===0&&(this.collectViews(),C.debug(`WsxRouter re-collected views: ${this.views.size}`)),this.isHandlingRoute=!0;try{const e=window.location.pathname;C.debug(`WsxRouter: Route changed to: ${e}`);const n=new CustomEvent("before-navigate",{detail:{to:e,from:this.currentPath},bubbles:!0,cancelable:!0});if(!this.dispatchEvent(n)){C.debug(`Navigation to ${e} was cancelled`);return}this.performNavigation(e)}finally{requestAnimationFrame(()=>{this.isHandlingRoute=!1})}}),B(this,"interceptLinks",e=>{const n=e.target.closest("a");if(!n)return;const r=n.getAttribute("href");!r||r.startsWith("http")||r.startsWith("#")||(e.preventDefault(),this.navigate(r))})}render(){return U.jsx("div",{class:"router-outlet"})}onRendered(){this.views.size===0&&(this.collectViews(),C.debug("WsxRouter collected views in onRendered:",this.views.size)),this.views.size>0&&!this.currentView&&requestAnimationFrame(()=>{this.handleRouteChange()})}onConnected(){C.debug("WsxRouter connected to DOM"),"scrollRestoration"in history&&(history.scrollRestoration=this.scrollRestoration),window.addEventListener("popstate",this.handleRouteChange),this.addEventListener("click",this.interceptLinks),requestAnimationFrame(()=>{this.views.size===0&&(this.collectViews(),C.debug(`WsxRouter collected views in onConnected: ${this.views.size}`)),requestAnimationFrame(()=>{C.debug(`WsxRouter handling initial route: ${window.location.pathname}`),this.handleRouteChange()})})}onDisconnected(){window.removeEventListener("popstate",this.handleRouteChange)}collectViews(){const e=Array.from(this.children).filter(n=>n.tagName.toLowerCase()==="wsx-view");C.debug(`WsxRouter found ${e.length} views`),this.views.clear(),this.compiledRoutes.clear(),this.matchCache.clear(),e.forEach(n=>{const r=n.getAttribute("route")||"/";if(this.views.set(r,n),C.debug(`WsxRouter registered route: ${r}`),r.includes(":")){const s=r.replace(/:[^/]+/g,"([^/]+)"),l=new RegExp(`^${s}$`);this.compiledRoutes.set(r,l),C.debug(`WsxRouter compiled regex for route: ${r} -> ${l}`)}n.style.display="none"})}performNavigation(e){const n=()=>{const r=this.matchRoute(e);if(r){r.style.display="block",r.style.visibility="visible";const s=r.getAttribute("route")||"/";C.debug(`Showing view for route: ${s}`);for(const[p,v]of this.views)v!==r&&(v.style.display="none",v.style.visibility="");this.currentView=r;const l=this.extractParams(s,e);C.debug(`Extracted params for route ${s} and path ${e}:`,l),l&&requestAnimationFrame(()=>{r.setAttribute("params",JSON.stringify(l)),C.debug(`Set params attribute on view: ${JSON.stringify(l)}`)});const g=window.location.href||`${window.location.pathname}${window.location.search}${window.location.hash}`,m=new URL(g,window.location.origin||"http://localhost"),u={path:e,params:l||{},query:Object.fromEntries(m.searchParams.entries()),hash:m.hash.slice(1)};se._setCurrentRoute(u),C.debug("Updated RouterUtils._currentRoute:",u);const i=new CustomEvent("route-changed",{detail:u,bubbles:!0});document.dispatchEvent(i)}else{for(const[u,i]of this.views)i.style.display="none";this.currentView=null,C.warn(`No view found for path: ${e}`);const s=window.location.href||`${window.location.pathname}${window.location.search}${window.location.hash}`,l=new URL(s,window.location.origin||"http://localhost"),g={path:e,params:{},query:Object.fromEntries(l.searchParams.entries()),hash:l.hash.slice(1)};se._setCurrentRoute(g);const m=new CustomEvent("route-changed",{detail:g,bubbles:!0});document.dispatchEvent(m)}this.handleScrollRestoration(e),this.dispatchEvent(new CustomEvent("after-navigate",{detail:{to:e,from:this.currentPath},bubbles:!0})),this.currentPath=e};this.enableViewTransitions&&"startViewTransition"in document?document.startViewTransition(n):n()}handleScrollRestoration(e){this.scrollRestoration==="manual"&&(this.isBackNavigation()||(window.scrollTo(0,0),C.debug("Scrolled to top for forward navigation")))}isBackNavigation(){var e;return"navigation"in performance&&performance.navigation?performance.navigation.type===2:((e=window.history.state)==null?void 0:e.navigationType)==="back"}matchRoute(e){if(C.warn(`matchRoute called for path: ${e}, views count: ${this.views.size}`),this.matchCache.has(e)){const r=this.matchCache.get(e);return C.warn(`matchRoute: found in cache, route: ${r}`),this.views.get(r)||null}if(this.views.has(e))return this.matchCache.set(e,e),C.warn(`matchRoute: exact match found for ${e}`),this.views.get(e);C.warn(`matchRoute: checking parameter routes, compiledRoutes count: ${this.compiledRoutes.size}`);for(const[r,s]of this.views)if(r.includes(":")){const l=this.compiledRoutes.get(r);if(l){const g=l.test(e);if(C.warn(`matchRoute: testing route ${r} against ${e}, matches: ${g}`),g)return this.matchCache.set(e,r),C.warn(`matchRoute: parameter match found, route: ${r}, path: ${e}`),s}else C.warn(`matchRoute: route ${r} has ':' but no compiled regex found`)}const n=this.views.get("*")||null;return n?(this.matchCache.set(e,"*"),C.warn(`matchRoute: wildcard match found for ${e}`)):C.warn(`matchRoute: no match found for ${e}, no wildcard view available`),n}extractParams(e,n){var u;if(!e.includes(":"))return null;const r=((u=e.match(/:([^/]+)/g))==null?void 0:u.map(i=>i.slice(1)))||[],s=e.replace(/:[^/]+/g,"([^/]+)"),l=new RegExp(`^${s}$`),g=n.match(l);if(!g||!r.length)return null;const m={};return r.forEach((i,p)=>{m[i]=g[p+1]}),m}clearMatchCache(){this.matchCache.clear(),C.debug("WsxRouter cleared match cache")}setViewTransitions(e){this.enableViewTransitions=e,C.debug(`View Transitions ${e?"enabled":"disabled"}`)}setScrollRestoration(e){this.scrollRestoration=e,"scrollRestoration"in history&&(history.scrollRestoration=e),C.debug(`Scroll Restoration set to ${e}`)}navigate(e){window.history.pushState(null,"",e),this.handleRouteChange()}}Ie=bt;[exports.WsxRouter,Pe]=mt(Ie,[],De,0,void 0,U.LightComponent).c;Pe();const ke=":host{display:block;width:100%;height:100%}.route-view{width:100%;height:100%;position:relative}:host([loading]) .route-view{opacity:.5;transition:opacity .3s ease}:host([error]) .route-view{border:1px solid var(--error-color, #ff0000);padding:1rem}.route-view.entering{animation:fadeIn .3s ease-out}.route-view.leaving{animation:fadeOut .3s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}";var de,ge;let Ce,qe,$e;function te(t,e,n){return(e=Ne(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yt(t,e,n,r,s,l){function g(o,c,f){return function(h,d){return f&&f(h),o[c].call(h,d)}}function m(o,c){for(var f=0;f<o.length;f++)o[f].call(c);return c}function u(o,c,f,h){if(typeof o!="function"&&(h||o!==void 0))throw new TypeError(c+" must "+(f||"be")+" a function"+(h?"":" or undefined"));return o}function i(o,c,f,h,d,T,V,A,I,k,j,E,R){function $(b){if(!R(b))throw new TypeError("Attempted to access private element on non-instance")}var y,_=c[0],S=c[3],P=!A;if(!P){f||Array.isArray(_)||(_=[_]);var a={},O=[],L=d===3?"get":d===4||E?"set":"value";k?(j||E?a={get:_e(function(){return S(this)},h,"get"),set:function(b){c[4](this,b)}}:a[L]=S,j||_e(a[L],h,d===2?"":L)):j||(a=Object.getOwnPropertyDescriptor(o,h))}for(var w=o,N=_.length-1;N>=0;N-=f?2:1){var Q=_[N],G=f?_[N-1]:void 0,X={},D={kind:["field","accessor","method","getter","setter","class"][d],name:h,metadata:T,addInitializer:(function(b,W){if(b.v)throw Error("attempted to call addInitializer after decoration was finished");u(W,"An initializer","be",!0),V.push(W)}).bind(null,X)};try{if(P)(y=u(Q.call(G,w,D),"class decorators","return"))&&(w=y);else{var M,F;D.static=I,D.private=k,k?d===2?M=function(b){return $(b),a.value}:(d<4&&(M=g(a,"get",$)),d!==3&&(F=g(a,"set",$))):(M=function(b){return b[h]},(d<2||d===4)&&(F=function(b,W){b[h]=W}));var Y=D.access={has:k?R.bind():function(b){return h in b}};if(M&&(Y.get=M),F&&(Y.set=F),w=Q.call(G,E?{get:a.get,set:a.set}:a[L],D),E){if(typeof w=="object"&&w)(y=u(w.get,"accessor.get"))&&(a.get=y),(y=u(w.set,"accessor.set"))&&(a.set=y),(y=u(w.init,"accessor.init"))&&O.push(y);else if(w!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else u(w,(j?"field":"method")+" decorators","return")&&(j?O.push(w):a[L]=w)}}finally{X.v=!0}}return(j||E)&&A.push(function(b,W){for(var H=O.length-1;H>=0;H--)W=O[H].call(b,W);return W}),j||P||(k?E?A.push(g(a,"get"),g(a,"set")):A.push(d===2?a[L]:g.call.bind(a[L])):Object.defineProperty(o,h,a)),w}function p(o,c){return Object.defineProperty(o,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var v=l[Symbol.metadata||Symbol.for("Symbol.metadata")];var z=Object.create(v??null),x=function(o,c,f,h){var d,T,V=[],A=function(L){return xt(L)===o},I=new Map;function k(L){L&&V.push(m.bind(null,L))}for(var j=0;j<c.length;j++){var E=c[j];if(Array.isArray(E)){var R=E[1],$=E[2],y=E.length>3,_=16&R,S=!!(8&R),P=(R&=7)==0,a=$+"/"+S;if(!P&&!y){var O=I.get(a);if(O===!0||O===3&&R!==4||O===4&&R!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+$);I.set(a,!(R>2)||R)}i(S?o:o.prototype,E,_,y?"#"+$:Ne($),R,h,S?T=T||[]:d=d||[],V,S,y,P,R===1,S&&y?A:f)}}return k(d),k(T),V}(t,e,s,z);return n.length||p(t,z),{e:x,get c(){var o=[];return n.length&&[p(i(t,[n],r,t.name,5,z,o),z),m.bind(null,o,t)]}}}function Ne(t){var e=wt(t,"string");return typeof e=="symbol"?e:e+""}function wt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _e(t,e,n){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:n?n+" "+e:e})}catch{}return t}function xt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}function Et(t){return t}const q=ue("WsxView");qe=[U.autoRegister({tagName:"wsx-view"})];exports.WsxView=void 0;new($e=(ge=class extends U.LightComponent{constructor(){super({styles:ke,styleName:"wsx-view"}),te(this,"_autoStyles",ke),te(this,"component",null),te(this,"params",{}),te(this,"componentInstance",null),te(this,"isLoading",!1)}render(){return U.jsx("div",{class:"route-view"})}onConnected(){requestAnimationFrame(()=>{if(!this.connected||this.isLoading||this.componentInstance)return;const e=this.getAttribute("component");e&&this.loadComponent(e)})}onAttributeChanged(e,n,r){if(this.connected){if(e==="component"&&r&&!this.componentInstance&&!this.isLoading)requestAnimationFrame(()=>{this.connected&&!this.componentInstance&&!this.isLoading&&this.loadComponent(r)});else if(e==="params"&&this.componentInstance)try{this.params=JSON.parse(r),q.debug("WsxView: params attribute changed, setting on component:",this.params),Object.entries(this.params).forEach(([s,l])=>{this.componentInstance.setAttribute(s,l)}),q.debug(`WsxView: params set on component ${this.componentInstance.tagName}`)}catch(s){q.warn("Failed to parse params:",s)}}}async loadComponent(e){if(!this.connected||this.isLoading||this.componentInstance){q.debug(`Skipping loadComponent for ${e}: connected=${this.connected}, isLoading=${this.isLoading}, hasInstance=${!!this.componentInstance}`);return}q.debug(`WsxView: Loading component ${e}`),this.isLoading=!0;try{const n=this.componentInstance;if(n&&(n.remove(),this.componentInstance=null),!customElements.get(e)){q.warn(`Component ${e} not found in customElements registry`),this.isLoading=!1;return}q.warn(`WsxView: Creating instance of ${e}`),this.componentInstance=document.createElement(e),Object.keys(this.params).length>0&&(q.warn(`WsxView: Setting initial params on ${e}:`,this.params),Object.entries(this.params).forEach(([l,g])=>{this.componentInstance.setAttribute(l,g)}));const s=this.querySelector(".route-view");if(s){if(q.warn(`WsxView: Appending ${e} to container`),!customElements.get(e)){q.error(`WsxView: Component ${e} is not registered in customElements registry!`),this.isLoading=!1,this.componentInstance=null;return}s.appendChild(this.componentInstance),q.warn(`WsxView: Component ${e} appended successfully, waiting for connectedCallback...`),setTimeout(()=>{this.componentInstance&&this.componentInstance.isConnected?q.warn(`WsxView: Component ${e} is now connected to DOM`):q.error(`WsxView: Component ${e} was not connected to DOM!`)},0)}else q.error("WsxView: Route view container not found"),this.componentInstance=null}catch(n){q.warn(`Error loading component ${e}:`,n),this.componentInstance=null}finally{this.isLoading=!1,q.warn(`WsxView: loadComponent for ${e} completed, isLoading=${this.isLoading}`)}}onDisconnected(){this.componentInstance&&(this.componentInstance.remove(),this.componentInstance=null)}},[exports.WsxView,Ce]=yt(ge,[],qe,0,void 0,U.LightComponent).c,ge),de=class extends Et{constructor(){super(exports.WsxView),te(this,"observedAttributes",["route","component","params"]),Ce()}},te(de,$e,void 0),de);const Rt=':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, var(--focus-color, #dc2626));outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';var me,pe;let Se,Fe,Oe;function K(t,e,n){return(e=Ue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lt(t,e,n,r,s,l){function g(o,c,f){return function(h,d){return f&&f(h),o[c].call(h,d)}}function m(o,c){for(var f=0;f<o.length;f++)o[f].call(c);return c}function u(o,c,f,h){if(typeof o!="function"&&(h||o!==void 0))throw new TypeError(c+" must "+(f||"be")+" a function"+(h?"":" or undefined"));return o}function i(o,c,f,h,d,T,V,A,I,k,j,E,R){function $(b){if(!R(b))throw new TypeError("Attempted to access private element on non-instance")}var y,_=c[0],S=c[3],P=!A;if(!P){f||Array.isArray(_)||(_=[_]);var a={},O=[],L=d===3?"get":d===4||E?"set":"value";k?(j||E?a={get:We(function(){return S(this)},h,"get"),set:function(b){c[4](this,b)}}:a[L]=S,j||We(a[L],h,d===2?"":L)):j||(a=Object.getOwnPropertyDescriptor(o,h))}for(var w=o,N=_.length-1;N>=0;N-=f?2:1){var Q=_[N],G=f?_[N-1]:void 0,X={},D={kind:["field","accessor","method","getter","setter","class"][d],name:h,metadata:T,addInitializer:(function(b,W){if(b.v)throw Error("attempted to call addInitializer after decoration was finished");u(W,"An initializer","be",!0),V.push(W)}).bind(null,X)};try{if(P)(y=u(Q.call(G,w,D),"class decorators","return"))&&(w=y);else{var M,F;D.static=I,D.private=k,k?d===2?M=function(b){return $(b),a.value}:(d<4&&(M=g(a,"get",$)),d!==3&&(F=g(a,"set",$))):(M=function(b){return b[h]},(d<2||d===4)&&(F=function(b,W){b[h]=W}));var Y=D.access={has:k?R.bind():function(b){return h in b}};if(M&&(Y.get=M),F&&(Y.set=F),w=Q.call(G,E?{get:a.get,set:a.set}:a[L],D),E){if(typeof w=="object"&&w)(y=u(w.get,"accessor.get"))&&(a.get=y),(y=u(w.set,"accessor.set"))&&(a.set=y),(y=u(w.init,"accessor.init"))&&O.push(y);else if(w!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else u(w,(j?"field":"method")+" decorators","return")&&(j?O.push(w):a[L]=w)}}finally{X.v=!0}}return(j||E)&&A.push(function(b,W){for(var H=O.length-1;H>=0;H--)W=O[H].call(b,W);return W}),j||P||(k?E?A.push(g(a,"get"),g(a,"set")):A.push(d===2?a[L]:g.call.bind(a[L])):Object.defineProperty(o,h,a)),w}function p(o,c){return Object.defineProperty(o,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var v=l[Symbol.metadata||Symbol.for("Symbol.metadata")];var z=Object.create(v??null),x=function(o,c,f,h){var d,T,V=[],A=function(L){return kt(L)===o},I=new Map;function k(L){L&&V.push(m.bind(null,L))}for(var j=0;j<c.length;j++){var E=c[j];if(Array.isArray(E)){var R=E[1],$=E[2],y=E.length>3,_=16&R,S=!!(8&R),P=(R&=7)==0,a=$+"/"+S;if(!P&&!y){var O=I.get(a);if(O===!0||O===3&&R!==4||O===4&&R!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+$);I.set(a,!(R>2)||R)}i(S?o:o.prototype,E,_,y?"#"+$:Ue($),R,h,S?T=T||[]:d=d||[],V,S,y,P,R===1,S&&y?A:f)}}return k(d),k(T),V}(t,e,s,z);return n.length||p(t,z),{e:x,get c(){var o=[];return n.length&&[p(i(t,[n],r,t.name,5,z,o),z),m.bind(null,o,t)]}}}function Ue(t){var e=jt(t,"string");return typeof e=="symbol"?e:e+""}function jt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function We(t,e,n){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:n?n+" "+e:e})}catch{}return t}function kt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}function Ct(t){return t}const ze=ue("WsxLink");Fe=[U.autoRegister({tagName:"wsx-link"})];exports.WsxLink=void 0;new(Oe=(pe=class extends U.WebComponent{constructor(){super(),K(this,"_autoStyles",Rt),K(this,"to",void 0),K(this,"replace",void 0),K(this,"activeClass",void 0),K(this,"exact",void 0),K(this,"handleClick",i=>{if(i.preventDefault(),!this.to){ze.warn("No 'to' attribute specified");return}if(this.isExternalLink(this.to)){window.open(this.to,"_blank");return}this.replace?window.history.replaceState(null,"",this.to):window.history.pushState(null,"",this.to),window.dispatchEvent(new PopStateEvent("popstate")),ze.debug(`Navigated to: ${this.to}`)}),K(this,"updateActiveState",()=>{var z;const i=window.location.pathname,p=this.exact?i===this.to:i.startsWith(this.to)&&this.to!=="/",v=(z=this.shadowRoot)==null?void 0:z.querySelector("a");v&&(p?(v.classList.add(this.activeClass),this.setAttribute("active","")):(v.classList.remove(this.activeClass),this.removeAttribute("active")))});const[e,n]=this.useState("to","");Object.defineProperty(this,"to",{get:e,set:n,enumerable:!0,configurable:!0});const[r,s]=this.useState("replace",!1);Object.defineProperty(this,"replace",{get:r,set:s,enumerable:!0,configurable:!0});const[l,g]=this.useState("activeClass","active");Object.defineProperty(this,"activeClass",{get:l,set:g,enumerable:!0,configurable:!0});const[m,u]=this.useState("exact",!1);Object.defineProperty(this,"exact",{get:m,set:u,enumerable:!0,configurable:!0})}render(){return U.jsx("a",{href:this.to,class:"wsx-link",onClick:this.handleClick,part:"link"},U.jsx("slot",null))}onConnected(){this.to=this.getAttribute("to")||"",this.replace=this.hasAttribute("replace"),this.activeClass=this.getAttribute("active-class")||"active",this.exact=this.hasAttribute("exact");const e=this.shadowRoot.querySelector(".wsx-link");e&&(e.href=this.to),window.addEventListener("popstate",this.updateActiveState),document.addEventListener("route-changed",this.updateActiveState),this.updateActiveState()}onDisconnected(){window.removeEventListener("popstate",this.updateActiveState),document.removeEventListener("route-changed",this.updateActiveState)}onAttributeChanged(e,n,r){switch(e){case"to":this.to=r||"",this.updateActiveState();break;case"replace":this.replace=r!==null&&r!=="false";break;case"active-class":this.activeClass=r||"active",this.updateActiveState();break;case"exact":this.exact=r!==null&&r!=="false",this.updateActiveState();break}}isExternalLink(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")}navigate(){this.to&&this.handleClick(new MouseEvent("click",{bubbles:!0,cancelable:!0}))}},[exports.WsxLink,Se]=Lt(pe,[],Fe,0,void 0,U.WebComponent).c,pe),me=class extends Ct{constructor(){super(exports.WsxLink),K(this,"observedAttributes",["to","replace","active-class","exact"]),Se()}},K(me,Oe,void 0),me);exports.RouterUtils=se;