@jasonshimmy/custom-elements-runtime 2.5.8 → 2.6.0

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/README.md CHANGED
@@ -80,46 +80,47 @@ Below is the **complete list of public symbols** exported by the runtime and its
80
80
 
81
81
  **Package:** `@jasonshimmy/custom-elements-runtime`
82
82
 
83
- | Export | Description |
84
- | ---------------------------- | ----------------------------------------------------------------------------------------------------- |
85
- | `component` | Define a custom element with the functional component API. |
86
- | `html` | Template tag function producing runtime VNodes from template literals. |
87
- | `css` | Define component-scoped/JIT styles or register stylesheets. |
88
- | `ref` | Create a reactive reference object with a `.value` property. |
89
- | `computed` | Create a memoized, derived read-only value from other reactive sources. |
90
- | `watch` | Register watchers reacting to changes in reactive values. |
91
- | `watchEffect` | Auto-track reactive reads and re-run a side-effect whenever dependencies change. |
92
- | `nextTick` | Returns a Promise resolving after all pending DOM updates are flushed. |
93
- | `flushDOMUpdates` | Synchronously flush all pending DOM update tasks (useful in tests). |
94
- | `scheduleWithPriority` | Schedule a callback at a given `UpdatePriority` level. |
95
- | `provide` | Store a value on the current component for descendant injection. |
96
- | `inject` | Retrieve a value provided by an ancestor component. |
97
- | `createComposable` | Package reusable stateful logic (hooks, reactive state) into a composable. |
98
- | `getCurrentComponentContext` | Access the active component context from within a composable or render function. |
99
- | `useProps` | Hook to declare/consume typed component props with defaults. |
100
- | `useEmit` | Hook returning an emit function for dispatching custom events. |
101
- | `useOnConnected` | Hook that runs a callback when the component connects. |
102
- | `useOnDisconnected` | Hook that runs a callback when the component disconnects. |
103
- | `useOnAttributeChanged` | Hook observing host attribute changes. |
104
- | `useOnError` | Hook to register a component-level error handler. |
105
- | `useStyle` | Hook to register or compute component styles at runtime. |
106
- | `useExpose` | Publish methods and properties onto the host element as an imperative public API. |
107
- | `useSlots` | Inspect which named slots have been filled by the component consumer. |
108
- | `useTeleport` | Render virtual DOM content into any DOM node outside the shadow root. |
109
- | `registerKeepAlive` | Register `<cer-keep-alive>` to preserve component state across DOM removals. |
110
- | `registerSuspense` | Register the `<cer-suspense>` built-in component. |
111
- | `registerErrorBoundary` | Register the `<cer-error-boundary>` built-in component. |
112
- | `registerBuiltinComponents` | Register both `<cer-suspense>` and `<cer-error-boundary>` in one call. |
113
- | `unsafeHTML` | Insert raw HTML into a template (**unsafe; use carefully**). |
114
- | `decodeEntities` | Utility to decode HTML entities in strings. |
115
- | `setDevMode` | Toggle dev-mode logging on or off at runtime. |
116
- | `devLog` | Log a message to the console in dev mode only (no-op in production). |
117
- | `isReactiveState` | Type-guard returning `true` when a value is a `ReactiveState` instance. |
118
- | `createHealthMonitor` | Create a new health monitor instance (factory; each call returns an independent instance). |
119
- | `getHealthMonitor` | Return the global singleton health monitor instance (lazily created). |
120
- | `updateHealthMetric` | Update a named metric on the global singleton health monitor. |
121
- | `getHealthStatus` | Return the current `HealthReport` from the global singleton health monitor. |
122
- | **Types** | `HealthMonitorInstance`, `HealthReport`, `UpdatePriority`, `TeleportHandle`, `ReactiveState`, `VNode` |
83
+ | Export | Description |
84
+ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `component` | Define a custom element with the functional component API. |
86
+ | `html` | Template tag function producing runtime VNodes from template literals. |
87
+ | `css` | Define component-scoped/JIT styles or register stylesheets. |
88
+ | `ref` | Create a reactive reference object with a `.value` property. |
89
+ | `computed` | Create a memoized, derived read-only value from other reactive sources. |
90
+ | `watch` | Register watchers reacting to changes in reactive values. |
91
+ | `watchEffect` | Auto-track reactive reads and re-run a side-effect whenever dependencies change. |
92
+ | `nextTick` | Returns a Promise resolving after all pending DOM updates are flushed. |
93
+ | `flushDOMUpdates` | Synchronously flush all pending DOM update tasks (useful in tests). |
94
+ | `scheduleWithPriority` | Schedule a callback at a given `UpdatePriority` level. |
95
+ | `provide` | Store a value on the current component for descendant injection. |
96
+ | `inject` | Retrieve a value provided by an ancestor component. |
97
+ | `createComposable` | Package reusable stateful logic (hooks, reactive state) into a composable. |
98
+ | `getCurrentComponentContext` | Access the active component context from within a composable or render function. |
99
+ | `useProps` | Hook to declare/consume typed component props with defaults. |
100
+ | `defineModel` | Declare a two-way model binding prop; combines `useProps` + `useEmit` in one ergonomic hook. |
101
+ | `useEmit` | Hook returning an emit function for dispatching custom events. |
102
+ | `useOnConnected` | Hook that runs a callback when the component connects. |
103
+ | `useOnDisconnected` | Hook that runs a callback when the component disconnects. |
104
+ | `useOnAttributeChanged` | Hook observing host attribute changes. |
105
+ | `useOnError` | Hook to register a component-level error handler. |
106
+ | `useStyle` | Hook to register or compute component styles at runtime. |
107
+ | `useExpose` | Publish methods and properties onto the host element as an imperative public API. |
108
+ | `useSlots` | Inspect which named slots have been filled by the component consumer. |
109
+ | `useTeleport` | Render virtual DOM content into any DOM node outside the shadow root. |
110
+ | `registerKeepAlive` | Register `<cer-keep-alive>` to preserve component state across DOM removals. |
111
+ | `registerSuspense` | Register the `<cer-suspense>` built-in component. |
112
+ | `registerErrorBoundary` | Register the `<cer-error-boundary>` built-in component. |
113
+ | `registerBuiltinComponents` | Register `<cer-keep-alive>`, `<cer-suspense>` and `<cer-error-boundary>` in one call. |
114
+ | `unsafeHTML` | Insert raw HTML into a template (**unsafe; use carefully**). |
115
+ | `decodeEntities` | Utility to decode HTML entities in strings. |
116
+ | `setDevMode` | Toggle dev-mode logging on or off at runtime. |
117
+ | `devLog` | Log a message to the console in dev mode only (no-op in production). |
118
+ | `isReactiveState` | Type-guard returning `true` when a value is a `ReactiveState` instance. |
119
+ | `createHealthMonitor` | Create a new health monitor instance (factory; each call returns an independent instance). |
120
+ | `getHealthMonitor` | Return the global singleton health monitor instance (lazily created). |
121
+ | `updateHealthMetric` | Update a named metric on the global singleton health monitor. |
122
+ | `getHealthStatus` | Return the current `HealthReport` from the global singleton health monitor. |
123
+ | **Types** | `ModelRef`, `DefineModelOptions`, `HealthMonitorInstance`, `HealthReport`, `UpdatePriority`, `TeleportHandle`, `ReactiveState`, `VNode` |
123
124
 
124
125
  ---
125
126
 
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./template-compiler-DXKQZPJB.cjs"),c=require("./namespace-helpers-4qeKVqQw.cjs"),O=require("./transitions-Cm2TlhoN.cjs"),d=require("./logger-CSALKaYm.cjs"),x=100,k=3e4;function A(e,t,o){return o==="jitCacheHitRate"?e<t*.5?"critical":e<t?"warning":"healthy":e>t*2?"critical":e>t?"warning":"healthy"}function D(e){const t=[];return e.memoryUsage?.status!=="healthy"&&t.push("Consider reducing component complexity or implementing better memory cleanup"),e.averageRenderTime?.status!=="healthy"&&t.push("Optimize component render functions - consider lazy loading or virtualization"),e.jitCacheHitRate?.status!=="healthy"&&t.push("JIT CSS cache performance is poor - review CSS patterns for optimization"),e.componentErrorRate?.status!=="healthy"&&t.push("High component error rate detected - review error handling and component logic"),e.activeReactiveStates?.status!=="healthy"&&t.push("High number of reactive states - consider state consolidation or cleanup"),e.memoryLeakIndicator?.status!=="healthy"&&t.push("Potential memory leak detected - review component cleanup and event listener management"),t}function v(){const e=new Map,t=new Set;let o=null;function n(s,i,a){e.set(s,{name:s,value:i,threshold:a,status:"healthy",lastUpdated:Date.now(),history:[]})}function l(){n("activeComponents",0,1e3),n("componentCreateRate",0,50),n("componentErrorRate",0,.1),n("memoryUsage",0,50*1024*1024),n("memoryGrowthRate",0,1024*1024),n("averageRenderTime",0,16),n("slowRenderCount",0,10),n("jitCacheHitRate",100,80),n("activeReactiveStates",0,5e3),n("dependencyUpdates",0,100),n("memoryLeakIndicator",0,.1)}function m(s,i){const a=e.get(s);a&&(a.value=i,a.lastUpdated=Date.now(),a.history.push(i),a.history.length>x&&a.history.shift(),a.status=A(i,a.threshold,s))}function u(){const s={};let i="healthy";for(const[a,h]of e)s[a]={...h},h.status==="critical"?i="critical":h.status==="warning"&&i==="healthy"&&(i="warning");return{overall:i,metrics:s,timestamp:Date.now(),recommendations:D(s)}}function p(){if("memory"in performance&&performance.memory){const s=performance.memory;m("memoryUsage",s.usedJSHeapSize);const i=e.get("memoryUsage");if(i&&i.history.length>1){const a=i.history[i.history.length-2],h=i.history[i.history.length-1];m("memoryGrowthRate",Math.max(0,h-a))}}}function w(s){for(const i of t)try{i(s)}catch(a){d.devError("Error in health monitor listener:",a)}}function _(){p();const s=u();w(s),s.overall==="critical"?d.devError("🚨 Runtime Health: Critical issues detected",s.recommendations):s.overall==="warning"&&d.devWarn("⚠️ Runtime Health: Performance warnings",s.recommendations)}function R(){typeof window>"u"||(o=setInterval(_,k))}function H(){o!==null&&(clearInterval(o),o=null)}function M(s){t.add(s)}function L(s){t.delete(s)}function b(s){const i=e.get(s);return i?[...i.history]:[]}function T(){for(const s of e.values())s.history=[]}return l(),R(),{updateMetric:m,getHealthReport:u,addListener:M,removeListener:L,stop:H,getMetricHistory:b,clearHistory:T}}let f=null;function g(){return f||(f=v()),f}function I(e,t){g().updateMetric(e,t)}function U(){return g().getHealthReport()}function C(){typeof window>"u"||typeof customElements>"u"||customElements.get("cer-keep-alive")||customElements.define("cer-keep-alive",K())}function K(){return class extends HTMLElement{_cache=new Map;_slot=null;_slotListener=null;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot.querySelector("slot")||(this.shadowRoot.innerHTML="<slot></slot>"),this._slot=this.shadowRoot.querySelector("slot"),this._slot&&(this._slotListener=()=>this._handleSlotChange(),this._slot.addEventListener("slotchange",this._slotListener),this._handleSlotChange())}disconnectedCallback(){this._slot&&this._slotListener&&this._slot.removeEventListener("slotchange",this._slotListener),this._slotListener=null}clearCache(t){t?this._cache.delete(t):this._cache.clear()}_handleSlotChange(){if(!this._slot)return;const t=this._slot.assignedElements({flatten:!0});for(const o of t){const n=this._buildCacheKey(o);if(!this._cache.has(n))this._cache.set(n,o);else{const l=this._cache.get(n);if(l!==o)try{o.parentNode?.replaceChild(l,o)}catch{this._cache.set(n,o)}}}}_buildCacheKey(t){const o=t.tagName.toLowerCase(),n=t.getAttribute("id");return n?`${o}:${n}`:o}}}function S(){customElements.get("cer-suspense")||r.component("cer-suspense",()=>{const{pending:e}=r.useProps({pending:!1});return e?r.html`<slot name="fallback"><span>Loading…</span></slot>`:r.html`<slot></slot>`})}function E(){customElements.get("cer-error-boundary")||r.component("cer-error-boundary",()=>{const e=c.ref(!1),t=c.ref("");return r.useOnError(o=>{e.value=!0,t.value=o.message}),r.useExpose({_cerHandleChildError:o=>{e.peek()||(e.value=!0,t.value=o instanceof Error?o.message:String(o))},reset:()=>{e.value=!1,t.value=""}}),e.value?r.html`<slot name="fallback"
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./template-compiler-gn2qLc7f.cjs"),c=require("./namespace-helpers-4qeKVqQw.cjs"),O=require("./transitions-Cm2TlhoN.cjs"),d=require("./logger-CSALKaYm.cjs"),x=100,k=3e4;function A(e,t,o){return o==="jitCacheHitRate"?e<t*.5?"critical":e<t?"warning":"healthy":e>t*2?"critical":e>t?"warning":"healthy"}function D(e){const t=[];return e.memoryUsage?.status!=="healthy"&&t.push("Consider reducing component complexity or implementing better memory cleanup"),e.averageRenderTime?.status!=="healthy"&&t.push("Optimize component render functions - consider lazy loading or virtualization"),e.jitCacheHitRate?.status!=="healthy"&&t.push("JIT CSS cache performance is poor - review CSS patterns for optimization"),e.componentErrorRate?.status!=="healthy"&&t.push("High component error rate detected - review error handling and component logic"),e.activeReactiveStates?.status!=="healthy"&&t.push("High number of reactive states - consider state consolidation or cleanup"),e.memoryLeakIndicator?.status!=="healthy"&&t.push("Potential memory leak detected - review component cleanup and event listener management"),t}function v(){const e=new Map,t=new Set;let o=null;function r(s,i,a){e.set(s,{name:s,value:i,threshold:a,status:"healthy",lastUpdated:Date.now(),history:[]})}function l(){r("activeComponents",0,1e3),r("componentCreateRate",0,50),r("componentErrorRate",0,.1),r("memoryUsage",0,50*1024*1024),r("memoryGrowthRate",0,1024*1024),r("averageRenderTime",0,16),r("slowRenderCount",0,10),r("jitCacheHitRate",100,80),r("activeReactiveStates",0,5e3),r("dependencyUpdates",0,100),r("memoryLeakIndicator",0,.1)}function m(s,i){const a=e.get(s);a&&(a.value=i,a.lastUpdated=Date.now(),a.history.push(i),a.history.length>x&&a.history.shift(),a.status=A(i,a.threshold,s))}function u(){const s={};let i="healthy";for(const[a,h]of e)s[a]={...h},h.status==="critical"?i="critical":h.status==="warning"&&i==="healthy"&&(i="warning");return{overall:i,metrics:s,timestamp:Date.now(),recommendations:D(s)}}function f(){if("memory"in performance&&performance.memory){const s=performance.memory;m("memoryUsage",s.usedJSHeapSize);const i=e.get("memoryUsage");if(i&&i.history.length>1){const a=i.history[i.history.length-2],h=i.history[i.history.length-1];m("memoryGrowthRate",Math.max(0,h-a))}}}function w(s){for(const i of t)try{i(s)}catch(a){d.devError("Error in health monitor listener:",a)}}function _(){f();const s=u();w(s),s.overall==="critical"?d.devError("🚨 Runtime Health: Critical issues detected",s.recommendations):s.overall==="warning"&&d.devWarn("⚠️ Runtime Health: Performance warnings",s.recommendations)}function M(){typeof window>"u"||(o=setInterval(_,k))}function R(){o!==null&&(clearInterval(o),o=null)}function H(s){t.add(s)}function L(s){t.delete(s)}function b(s){const i=e.get(s);return i?[...i.history]:[]}function T(){for(const s of e.values())s.history=[]}return l(),M(),{updateMetric:m,getHealthReport:u,addListener:H,removeListener:L,stop:R,getMetricHistory:b,clearHistory:T}}let p=null;function g(){return p||(p=v()),p}function I(e,t){g().updateMetric(e,t)}function U(){return g().getHealthReport()}function C(){typeof window>"u"||typeof customElements>"u"||customElements.get("cer-keep-alive")||customElements.define("cer-keep-alive",K())}function K(){return class extends HTMLElement{_cache=new Map;_slot=null;_slotListener=null;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot.querySelector("slot")||(this.shadowRoot.innerHTML="<slot></slot>"),this._slot=this.shadowRoot.querySelector("slot"),this._slot&&(this._slotListener=()=>this._handleSlotChange(),this._slot.addEventListener("slotchange",this._slotListener),this._handleSlotChange())}disconnectedCallback(){this._slot&&this._slotListener&&this._slot.removeEventListener("slotchange",this._slotListener),this._slotListener=null}clearCache(t){t?this._cache.delete(t):this._cache.clear()}_handleSlotChange(){if(!this._slot)return;const t=this._slot.assignedElements({flatten:!0});for(const o of t){const r=this._buildCacheKey(o);if(!this._cache.has(r))this._cache.set(r,o);else{const l=this._cache.get(r);if(l!==o)try{o.parentNode?.replaceChild(l,o)}catch{this._cache.set(r,o)}}}}_buildCacheKey(t){const o=t.tagName.toLowerCase(),r=t.getAttribute("id");return r?`${o}:${r}`:o}}}function S(){customElements.get("cer-suspense")||n.component("cer-suspense",()=>{const{pending:e}=n.useProps({pending:!1});return e?n.html`<slot name="fallback"><span>Loading…</span></slot>`:n.html`<slot></slot>`})}function E(){customElements.get("cer-error-boundary")||n.component("cer-error-boundary",()=>{const e=c.ref(!1),t=c.ref("");return n.useOnError(o=>{e.value=!0,t.value=o.message}),n.useExpose({_cerHandleChildError:o=>{e.peek()||(e.value=!0,t.value=o instanceof Error?o.message:String(o))},reset:()=>{e.value=!1,t.value=""}}),e.value?n.html`<slot name="fallback"
2
2
  ><div role="alert">
3
3
  <strong>Something went wrong.</strong>
4
- ${t.value?r.html`<p>${t.value}</p>`:r.html``}
4
+ ${t.value?n.html`<p>${t.value}</p>`:n.html``}
5
5
  </div></slot
6
- >`:r.html`<slot></slot>`})}function P(){S(),E(),C()}function q(e){if(typeof document>"u")return{portal:()=>{},destroy:()=>{}};if(r.isDiscoveryRender())return{portal:()=>{},destroy:()=>{}};if(r.getCurrentComponentContext()){const o=c.reactiveSystem.getOrCreateState(null),n=o.peek();if(n!==null)return n;const l=y(e,()=>o.initSilent(null));return o.initSilent(l),l}return y(e)}function y(e,t){const o=typeof e=="string"?document.querySelector(e):e;if(!o)return console.warn(`[useTeleport] Target "${String(e)}" not found in the document. Teleported content will not be rendered.`),{portal:()=>{},destroy:()=>{}};const n=document.createElement("cer-teleport");n.dataset.cerTeleport="",o.appendChild(n);const l={};return{portal(u){const p=u==null?[]:Array.isArray(u)?u:[u];r.vdomRenderer(n,p,void 0,l)},destroy(){try{r.vdomRenderer(n,[],void 0,l)}catch{}n.parentNode&&n.parentNode.removeChild(n),t?.()}}}exports.component=r.component;exports.createComposable=r.createComposable;exports.getCurrentComponentContext=r.getCurrentComponentContext;exports.html=r.html;exports.inject=r.inject;exports.provide=r.provide;exports.useEmit=r.useEmit;exports.useExpose=r.useExpose;exports.useOnAttributeChanged=r.useOnAttributeChanged;exports.useOnConnected=r.useOnConnected;exports.useOnDisconnected=r.useOnDisconnected;exports.useOnError=r.useOnError;exports.useProps=r.useProps;exports.useSlots=r.useSlots;exports.useStyle=r.useStyle;exports.ReactiveState=c.ReactiveState;exports.computed=c.computed;exports.decodeEntities=c.decodeEntities;exports.flushDOMUpdates=c.flushDOMUpdates;exports.isReactiveState=c.isReactiveState;exports.nextTick=c.nextTick;exports.ref=c.ref;exports.scheduleWithPriority=c.scheduleWithPriority;exports.unsafeHTML=c.unsafeHTML;exports.watch=c.watch;exports.watchEffect=c.watchEffect;exports.css=O.css;exports.devLog=d.devLog;exports.setDevMode=d.setDevMode;exports.createHealthMonitor=v;exports.getHealthMonitor=g;exports.getHealthStatus=U;exports.registerBuiltinComponents=P;exports.registerErrorBoundary=E;exports.registerKeepAlive=C;exports.registerSuspense=S;exports.updateHealthMetric=I;exports.useTeleport=q;
6
+ >`:n.html`<slot></slot>`})}function P(){S(),E(),C()}function q(e){if(typeof document>"u")return{portal:()=>{},destroy:()=>{}};if(n.isDiscoveryRender())return{portal:()=>{},destroy:()=>{}};if(n.getCurrentComponentContext()){const o=c.reactiveSystem.getOrCreateState(null),r=o.peek();if(r!==null)return r;const l=y(e,()=>o.initSilent(null));return o.initSilent(l),l}return y(e)}function y(e,t){const o=typeof e=="string"?document.querySelector(e):e;if(!o)return console.warn(`[useTeleport] Target "${String(e)}" not found in the document. Teleported content will not be rendered.`),{portal:()=>{},destroy:()=>{}};const r=document.createElement("cer-teleport");r.dataset.cerTeleport="",o.appendChild(r);const l={};return{portal(u){const f=u==null?[]:Array.isArray(u)?u:[u];n.vdomRenderer(r,f,void 0,l)},destroy(){try{n.vdomRenderer(r,[],void 0,l)}catch{}r.parentNode&&r.parentNode.removeChild(r),t?.()}}}exports.component=n.component;exports.createComposable=n.createComposable;exports.defineModel=n.defineModel;exports.getCurrentComponentContext=n.getCurrentComponentContext;exports.html=n.html;exports.inject=n.inject;exports.provide=n.provide;exports.useEmit=n.useEmit;exports.useExpose=n.useExpose;exports.useOnAttributeChanged=n.useOnAttributeChanged;exports.useOnConnected=n.useOnConnected;exports.useOnDisconnected=n.useOnDisconnected;exports.useOnError=n.useOnError;exports.useProps=n.useProps;exports.useSlots=n.useSlots;exports.useStyle=n.useStyle;exports.ReactiveState=c.ReactiveState;exports.computed=c.computed;exports.decodeEntities=c.decodeEntities;exports.flushDOMUpdates=c.flushDOMUpdates;exports.isReactiveState=c.isReactiveState;exports.nextTick=c.nextTick;exports.ref=c.ref;exports.scheduleWithPriority=c.scheduleWithPriority;exports.unsafeHTML=c.unsafeHTML;exports.watch=c.watch;exports.watchEffect=c.watchEffect;exports.css=O.css;exports.devLog=d.devLog;exports.setDevMode=d.setDevMode;exports.createHealthMonitor=v;exports.getHealthMonitor=g;exports.getHealthStatus=U;exports.registerBuiltinComponents=P;exports.registerErrorBoundary=E;exports.registerKeepAlive=C;exports.registerSuspense=S;exports.updateHealthMetric=I;exports.useTeleport=q;
7
7
  //# sourceMappingURL=custom-elements-runtime.cjs.js.map
@@ -1,13 +1,13 @@
1
- import { c as v, u as b, a as T, h as l, b as x, g as k, v as m, i as A } from "./template-compiler-DbHgEJzb.js";
2
- import { d as ee, e as te, p as ne, f as re, j as oe, k as se, l as ie, m as ae, n as ce } from "./template-compiler-DbHgEJzb.js";
1
+ import { c as v, u as b, a as T, h as l, b as x, g as k, v as m, i as A } from "./template-compiler-xSxUyqRI.js";
2
+ import { d as ee, e as te, f as ne, p as oe, j as re, k as se, l as ie, m as ae, n as ce, o as le } from "./template-compiler-xSxUyqRI.js";
3
3
  import { r as p, a as I } from "./namespace-helpers-DcD_6_K1.js";
4
- import { R as ue, c as he, d as de, f as fe, i as me, n as pe, s as ye, u as ge, w as ve, b as Ce } from "./namespace-helpers-DcD_6_K1.js";
5
- import { c as Se } from "./transitions-Bo0DVkSp.js";
4
+ import { R as he, c as de, d as fe, f as me, i as pe, n as ye, s as ge, u as ve, w as Ce, b as we } from "./namespace-helpers-DcD_6_K1.js";
5
+ import { c as _e } from "./transitions-Bo0DVkSp.js";
6
6
  import { d as y, a as O } from "./logger-BvkEbVM4.js";
7
- import { b as Re, s as Ee } from "./logger-BvkEbVM4.js";
7
+ import { b as Ee, s as He } from "./logger-BvkEbVM4.js";
8
8
  const U = 100, D = 3e4;
9
- function K(e, t, r) {
10
- return r === "jitCacheHitRate" ? e < t * 0.5 ? "critical" : e < t ? "warning" : "healthy" : e > t * 2 ? "critical" : e > t ? "warning" : "healthy";
9
+ function K(e, t, o) {
10
+ return o === "jitCacheHitRate" ? e < t * 0.5 ? "critical" : e < t ? "warning" : "healthy" : e > t * 2 ? "critical" : e > t ? "warning" : "healthy";
11
11
  }
12
12
  function z(e) {
13
13
  const t = [];
@@ -27,10 +27,10 @@ function z(e) {
27
27
  }
28
28
  function j() {
29
29
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
30
- let r = null;
31
- function n(o, s, i) {
32
- e.set(o, {
33
- name: o,
30
+ let o = null;
31
+ function n(r, s, i) {
32
+ e.set(r, {
33
+ name: r,
34
34
  value: s,
35
35
  threshold: i,
36
36
  status: "healthy",
@@ -41,26 +41,26 @@ function j() {
41
41
  function a() {
42
42
  n("activeComponents", 0, 1e3), n("componentCreateRate", 0, 50), n("componentErrorRate", 0, 0.1), n("memoryUsage", 0, 50 * 1024 * 1024), n("memoryGrowthRate", 0, 1024 * 1024), n("averageRenderTime", 0, 16), n("slowRenderCount", 0, 10), n("jitCacheHitRate", 100, 80), n("activeReactiveStates", 0, 5e3), n("dependencyUpdates", 0, 100), n("memoryLeakIndicator", 0, 0.1);
43
43
  }
44
- function h(o, s) {
45
- const i = e.get(o);
46
- i && (i.value = s, i.lastUpdated = Date.now(), i.history.push(s), i.history.length > U && i.history.shift(), i.status = K(s, i.threshold, o));
44
+ function h(r, s) {
45
+ const i = e.get(r);
46
+ i && (i.value = s, i.lastUpdated = Date.now(), i.history.push(s), i.history.length > U && i.history.shift(), i.status = K(s, i.threshold, r));
47
47
  }
48
48
  function c() {
49
- const o = {};
49
+ const r = {};
50
50
  let s = "healthy";
51
51
  for (const [i, u] of e)
52
- o[i] = { ...u }, u.status === "critical" ? s = "critical" : u.status === "warning" && s === "healthy" && (s = "warning");
52
+ r[i] = { ...u }, u.status === "critical" ? s = "critical" : u.status === "warning" && s === "healthy" && (s = "warning");
53
53
  return {
54
54
  overall: s,
55
- metrics: o,
55
+ metrics: r,
56
56
  timestamp: Date.now(),
57
- recommendations: z(o)
57
+ recommendations: z(r)
58
58
  };
59
59
  }
60
60
  function d() {
61
61
  if ("memory" in performance && performance.memory) {
62
- const o = performance.memory;
63
- h("memoryUsage", o.usedJSHeapSize);
62
+ const r = performance.memory;
63
+ h("memoryUsage", r.usedJSHeapSize);
64
64
  const s = e.get("memoryUsage");
65
65
  if (s && s.history.length > 1) {
66
66
  const i = s.history[s.history.length - 2], u = s.history[s.history.length - 1];
@@ -68,43 +68,43 @@ function j() {
68
68
  }
69
69
  }
70
70
  }
71
- function w(o) {
71
+ function w(r) {
72
72
  for (const s of t)
73
73
  try {
74
- s(o);
74
+ s(r);
75
75
  } catch (i) {
76
76
  y("Error in health monitor listener:", i);
77
77
  }
78
78
  }
79
79
  function S() {
80
80
  d();
81
- const o = c();
82
- w(o), o.overall === "critical" ? y(
81
+ const r = c();
82
+ w(r), r.overall === "critical" ? y(
83
83
  "🚨 Runtime Health: Critical issues detected",
84
- o.recommendations
85
- ) : o.overall === "warning" && O(
84
+ r.recommendations
85
+ ) : r.overall === "warning" && O(
86
86
  "⚠️ Runtime Health: Performance warnings",
87
- o.recommendations
87
+ r.recommendations
88
88
  );
89
89
  }
90
90
  function _() {
91
- typeof window > "u" || (r = setInterval(S, D));
91
+ typeof window > "u" || (o = setInterval(S, D));
92
92
  }
93
93
  function R() {
94
- r !== null && (clearInterval(r), r = null);
94
+ o !== null && (clearInterval(o), o = null);
95
95
  }
96
- function E(o) {
97
- t.add(o);
96
+ function E(r) {
97
+ t.add(r);
98
98
  }
99
- function H(o) {
100
- t.delete(o);
99
+ function H(r) {
100
+ t.delete(r);
101
101
  }
102
- function M(o) {
103
- const s = e.get(o);
102
+ function M(r) {
103
+ const s = e.get(r);
104
104
  return s ? [...s.history] : [];
105
105
  }
106
106
  function L() {
107
- for (const o of e.values()) o.history = [];
107
+ for (const r of e.values()) r.history = [];
108
108
  }
109
109
  return a(), _(), {
110
110
  updateMetric: h,
@@ -151,24 +151,24 @@ function $() {
151
151
  _handleSlotChange() {
152
152
  if (!this._slot) return;
153
153
  const t = this._slot.assignedElements({ flatten: !0 });
154
- for (const r of t) {
155
- const n = this._buildCacheKey(r);
154
+ for (const o of t) {
155
+ const n = this._buildCacheKey(o);
156
156
  if (!this._cache.has(n))
157
- this._cache.set(n, r);
157
+ this._cache.set(n, o);
158
158
  else {
159
159
  const a = this._cache.get(n);
160
- if (a !== r)
160
+ if (a !== o)
161
161
  try {
162
- r.parentNode?.replaceChild(a, r);
162
+ o.parentNode?.replaceChild(a, o);
163
163
  } catch {
164
- this._cache.set(n, r);
164
+ this._cache.set(n, o);
165
165
  }
166
166
  }
167
167
  }
168
168
  }
169
169
  _buildCacheKey(t) {
170
- const r = t.tagName.toLowerCase(), n = t.getAttribute("id");
171
- return n ? `${r}:${n}` : r;
170
+ const o = t.tagName.toLowerCase(), n = t.getAttribute("id");
171
+ return n ? `${o}:${n}` : o;
172
172
  }
173
173
  };
174
174
  }
@@ -181,11 +181,11 @@ function P() {
181
181
  function q() {
182
182
  customElements.get("cer-error-boundary") || v("cer-error-boundary", () => {
183
183
  const e = p(!1), t = p("");
184
- return b((r) => {
185
- e.value = !0, t.value = r.message;
184
+ return b((o) => {
185
+ e.value = !0, t.value = o.message;
186
186
  }), T({
187
- _cerHandleChildError: (r) => {
188
- e.peek() || (e.value = !0, t.value = r instanceof Error ? r.message : String(r));
187
+ _cerHandleChildError: (o) => {
188
+ e.peek() || (e.value = !0, t.value = o instanceof Error ? o.message : String(o));
189
189
  },
190
190
  reset: () => {
191
191
  e.value = !1, t.value = "";
@@ -211,24 +211,24 @@ function Z(e) {
211
211
  }, destroy: () => {
212
212
  } };
213
213
  if (k()) {
214
- const r = I.getOrCreateState(null), n = r.peek();
214
+ const o = I.getOrCreateState(null), n = o.peek();
215
215
  if (n !== null)
216
216
  return n;
217
- const a = g(e, () => r.initSilent(null));
218
- return r.initSilent(a), a;
217
+ const a = g(e, () => o.initSilent(null));
218
+ return o.initSilent(a), a;
219
219
  }
220
220
  return g(e);
221
221
  }
222
222
  function g(e, t) {
223
- const r = typeof e == "string" ? document.querySelector(e) : e;
224
- if (!r)
223
+ const o = typeof e == "string" ? document.querySelector(e) : e;
224
+ if (!o)
225
225
  return console.warn(
226
226
  `[useTeleport] Target "${String(e)}" not found in the document. Teleported content will not be rendered.`
227
227
  ), { portal: () => {
228
228
  }, destroy: () => {
229
229
  } };
230
230
  const n = document.createElement("cer-teleport");
231
- n.dataset.cerTeleport = "", r.appendChild(n);
231
+ n.dataset.cerTeleport = "", o.appendChild(n);
232
232
  const a = {};
233
233
  return {
234
234
  portal(c) {
@@ -245,43 +245,44 @@ function g(e, t) {
245
245
  };
246
246
  }
247
247
  export {
248
- ue as ReactiveState,
248
+ he as ReactiveState,
249
249
  v as component,
250
- he as computed,
250
+ de as computed,
251
251
  ee as createComposable,
252
252
  j as createHealthMonitor,
253
- Se as css,
254
- de as decodeEntities,
255
- Re as devLog,
256
- fe as flushDOMUpdates,
253
+ _e as css,
254
+ fe as decodeEntities,
255
+ te as defineModel,
256
+ Ee as devLog,
257
+ me as flushDOMUpdates,
257
258
  k as getCurrentComponentContext,
258
259
  C as getHealthMonitor,
259
260
  V as getHealthStatus,
260
261
  l as html,
261
- te as inject,
262
- me as isReactiveState,
263
- pe as nextTick,
264
- ne as provide,
262
+ ne as inject,
263
+ pe as isReactiveState,
264
+ ye as nextTick,
265
+ oe as provide,
265
266
  p as ref,
266
267
  Y as registerBuiltinComponents,
267
268
  q as registerErrorBoundary,
268
269
  N as registerKeepAlive,
269
270
  P as registerSuspense,
270
- ye as scheduleWithPriority,
271
- Ee as setDevMode,
272
- ge as unsafeHTML,
271
+ ge as scheduleWithPriority,
272
+ He as setDevMode,
273
+ ve as unsafeHTML,
273
274
  W as updateHealthMetric,
274
275
  re as useEmit,
275
276
  T as useExpose,
276
- oe as useOnAttributeChanged,
277
- se as useOnConnected,
278
- ie as useOnDisconnected,
277
+ se as useOnAttributeChanged,
278
+ ie as useOnConnected,
279
+ ae as useOnDisconnected,
279
280
  b as useOnError,
280
281
  x as useProps,
281
- ae as useSlots,
282
- ce as useStyle,
282
+ ce as useSlots,
283
+ le as useStyle,
283
284
  Z as useTeleport,
284
- ve as watch,
285
- Ce as watchEffect
285
+ Ce as watch,
286
+ we as watchEffect
286
287
  };
287
288
  //# sourceMappingURL=custom-elements-runtime.es.js.map
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./logger-CSALKaYm.cjs"),$=require("./namespace-helpers-4qeKVqQw.cjs"),x=require("./template-compiler-DXKQZPJB.cjs"),ot=require("./custom-elements-runtime.store.cjs.js"),bt=require("./custom-elements-runtime.directives.cjs.js"),rt={enabled:!0,offset:0,timeoutMs:2e3},tt=t=>t?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(t)):{},ft=t=>{if(!t||Object.keys(t).length===0)return"";try{return"?"+new URLSearchParams(t).toString()}catch{return""}},nt=t=>t?/^\s*javascript\s*:/i.test(t):!1,U=t=>/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)||t.startsWith("//"),dt=t=>{try{return decodeURIComponent(t)}catch{return t}};function A(t){if(!t)return"/";let r=t.replace(/\/+/g,"/");return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r}const ht=t=>{if(!t)return"";const r=A(t);return r==="/"?"":r},st=new WeakMap;function wt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function St(t){const r=t.path||"/",v=A(r),a=v==="/"?[]:v.split("/").filter(Boolean),l=[],o=[];for(let u=0;u<a.length;u++){const f=a[u];if(f==="*"){if(u!==a.length-1)return c.devWarn(`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};const W=`splat${l.length}`;l.push(W),o.push("__SPLAT__");continue}const y=f.match(/^:([A-Za-z0-9_-]+)(\*)?$/);if(y){const W=y[1],k=!!y[2];if(k&&u!==a.length-1)return c.devWarn(`Route '${t.path}' contains a splat param ':${W}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};l.push(W),o.push(k?"__SPLAT__":"([^/]+)");continue}o.push(wt(f))}let b;if(o.length===0)b="^/$";else if(o[o.length-1]==="__SPLAT__"){const f=o.slice(0,-1).join("/");f?b=`^/${f}(?:/(.*))?(?:/)?$`:b="^(?:/(.*))?(?:/)?$"}else b=`^/${o.join("/")}(?:/)?$`;try{return{regex:new RegExp(b),paramNames:l}}catch(u){return c.devWarn(`Failed to compile route regex for '${t.path}': ${String(u)}`),{invalid:!0}}}const F=(t,r)=>{const v=A(r);for(const a of t){let l=st.get(a);if(l||(l=St(a),st.set(a,l)),l.invalid)continue;const{regex:o,paramNames:b}=l,u=o.exec(v);if(u){const f={};for(let y=0;y<b.length;y++){const W=u[y+1]||"";f[b[y]]=W?dt(W):""}return{route:a,params:f}}}return{route:null,params:{}}};function Z(t,r){for(const v of t)if(F([v],r).route!==null)return v;return null}function Rt(t,r){return F(t,r)}const ct=50;let G={},L={};function pt(){G={},L={}}function Et(){const t=Object.entries(G);if(t.length<=ct)return;const v=t.sort(([,a],[,l])=>a.lastAccessed-l.lastAccessed).slice(0,t.length-ct);for(const[a]of v)delete G[a]}async function yt(t){if(t.component)return t.component;if(t.load){const r=G[t.path];if(r)return r.lastAccessed=Date.now(),r.component;if(L[t.path]!==void 0)return L[t.path];const v=typeof window>"u";try{const a=t.load().then(l=>{Et();const o=l.default;return G[t.path]={component:o,lastAccessed:Date.now()},delete L[t.path],o}).catch(l=>{delete L[t.path];const o=l instanceof Error?l.message:String(l);throw v&&c.devError(`SSR component load failed for route: ${t.path}. ${o}`),new Error(`Failed to load component for route: ${t.path}. ${o}`)});return L[t.path]=a,await a}catch(a){const l=a instanceof Error?a.message:String(a);throw new Error(`Failed to load component for route: ${t.path}. ${l}`,{cause:a})}}throw new Error(`No component or loader defined for route: ${t.path}`)}let g=null;function $t(t){g=t}function it(){return g}const j=new Set;let N=null;function mt(){if(N){try{N()}catch{}N=null}if(g)try{let t=!1;N=g.subscribe(r=>{t=!0;for(const v of j)try{v(r)}catch{}});try{C.base=g.base}catch{}if(t){const r=g.getCurrent();for(const v of j)try{v(r)}catch{}}else{const r=g.getCurrent();for(const v of j)try{v(r)}catch{}}try{typeof window<"u"&&$.flushDOMUpdates()}catch{}}catch{N=null}}function Ct(){mt()}const C={store:{subscribe(t){if(g)return g.store.subscribe(t);try{t({path:"/",params:{},query:{}})}catch{}return()=>{}},getState(){return g?g.getCurrent():{path:"/",params:{},query:{}}},setState(t){if(g)try{g.store.setState(t)}catch{}}},subscribe(t){if(typeof t!="function")return c.devWarn("activeRouterProxy.subscribe: listener must be a function"),()=>{};if(j.add(t),g)if(!N)mt();else try{const r=g.getCurrent();r&&t(r)}catch(r){c.devWarn("activeRouterProxy subscription failed",r)}else try{t({path:"/",params:{},query:{}})}catch(r){c.devWarn("activeRouterProxy fallback state delivery failed",r)}return()=>{try{if(j.delete(t),j.size===0&&N){try{N()}catch(r){c.devWarn("activeRouterProxy inner unsubscribe failed",r)}N=null}}catch(r){c.devWarn("activeRouterProxy unsubscribe failed",r)}}},getCurrent(){return g?g.getCurrent():{path:"/",params:{},query:{}}},async push(t){return g?g.push(t):Promise.resolve()},async replace(t){return g?g.replace(t):Promise.resolve()},back(){if(g)return g.back()},matchRoute(t){return g?g.matchRoute(t):{route:null,params:{}}},resolveRouteComponent(t){return g?g.resolveRouteComponent(t):Promise.reject(new Error("No active router"))},base:"",scrollToFragment(t){return g?g.scrollToFragment(t):Promise.resolve(!1)}};function vt(t){const{routes:r,base:v="",initialUrl:a,scrollToFragment:l=!0}=t,o=ht(v),b=typeof l=="boolean"?{...rt,enabled:l}:{...rt,...l};let u,f,y,W,k,z,B;const _=new Set,K=10;let q=0;const J=async(s,i)=>{const e=Z(r,s.path);if(!e||!e.beforeEnter)return!0;try{const n=await e.beforeEnter(s,i);if(typeof n=="string"){const p=`${s.path}->${n}`;return _.has(p)||q>=K?(c.devError(`Redirect loop detected: ${p}`),!1):n}return n!==!1}catch(n){c.devError("beforeEnter error",n);try{y.setState(i)}catch{}throw n}},X=async(s,i)=>{const e=Z(r,s.path);if(!e||!e.onEnter)return!0;try{const n=await e.onEnter(s,i);if(typeof n=="string"){const p=`${s.path}->${n}`;return _.has(p)||q>=K?(c.devError(`Redirect loop detected: ${p}`),!1):n}return n!==!1}catch(n){c.devError("onEnter error",n);try{y.setState(i)}catch{}throw n}},et=(s,i)=>{const e=Z(r,s.path);if(!(!e||!e.afterEnter))try{e.afterEnter(s,i)}catch(n){c.devError("afterEnter error",n)}},I=new Map,M=100,T=s=>{if(I.has(s))return I.get(s);const i=F(r,s);if(I.size>=M){const e=Math.floor(M*.25),n=Array.from(I.keys());for(let p=0;p<e&&p<n.length;p++)I.delete(n[p])}return I.set(s,i),i},Y=()=>{};async function V(s,i=0){try{const e=document.getElementById(s);if(!e)return!1;if(i>0)try{const n=e.getBoundingClientRect(),p=Math.max(0,window.scrollY+n.top-i);typeof window.scrollTo=="function"&&window.scrollTo({top:p,behavior:"auto"})}catch{try{e.scrollIntoView()}catch{return!1}}else if(typeof e.scrollIntoView=="function")try{e.scrollIntoView({behavior:"auto",block:"start",inline:"nearest"})}catch{try{e.scrollIntoView()}catch{return!1}}return!0}catch{return!1}}function h(s,i=0,e=2e3){return new Promise(n=>{let p=!1,m=null;const w=Date.now(),S=P=>{p||(p=!0,m&&clearTimeout(m),n(P))},E=async()=>{if(!p)try{if(await V(s,i))return S(!0);const P=async()=>{if(p)return;if(Date.now()-w>=e)return S(!1);try{if(await V(s,i))return S(!0);requestAnimationFrame(P)}catch(gt){c.devWarn("Scroll retry attempt failed:",gt),requestAnimationFrame(P)}};requestAnimationFrame(P)}catch(P){c.devWarn("Initial scroll attempt failed:",P),S(!1)}};m=setTimeout(()=>{S(!1)},e),E().catch(P=>{c.devWarn("Scroll attempt failed:",P),S(!1)})})}let R=!1;const d=async(s,i=!1)=>{if(R){c.devWarn(`Navigation to ${s} blocked - navigation already in progress`);return}R=!0,q=0,_.clear();try{await D(s,i)}finally{R=!1,q=0,_.clear()}},O=s=>{const i=s.indexOf("#"),e=i>=0?s.slice(i+1):"",n=i>=0?s.slice(0,i):s,p=n.indexOf("?"),m=p>=0?n.slice(0,p):n,w=p>=0?tt(n.slice(p)):{},S=m.startsWith(o)?m.slice(o.length):m;return{path:A(S||"/"),query:w,fragment:e}},D=async(s,i=!1)=>{try{const e=O(s),n=T(e.path);if(!n.route)throw new Error(`No route found for ${e.path}`);const p=y.getState(),m={path:e.path,params:n.params,query:e.query,fragment:e.fragment},w=await J(m,p);if(w===!1)return;if(typeof w=="string"){q++;const E=`${m.path}->${w}`;_.add(E),await D(w,!0);return}const S=await X(m,p);if(S===!1)return;if(typeof S=="string"){q++;const E=`${m.path}->${S}`;_.add(E),await D(S,!0);return}if(typeof window<"u"&&typeof document<"u"){const E=ft(e.query),P=o+e.path+(E||"")+(e.fragment?"#"+e.fragment:"");i?window.history.replaceState({},"",P):window.history.pushState({},"",P)}if(y.setState(m),et(m,p),typeof window<"u"&&typeof document<"u")try{const E=m.fragment;b.enabled&&E&&h(String(E),b.offset,b.timeoutMs).catch(()=>{})}catch{}}catch(e){if(c.devError("Navigation error:",e),e instanceof Error&&(e.stack?.includes("runBeforeEnter")||e.stack?.includes("runOnEnter")))throw e;try{const n=y.getState();if(!F(r,n.path).route){let m=r.find(w=>w.path==="/");if(m||(m=r.find(w=>!w.path.includes(":")&&!w.path.includes("*"))),!m&&r.length>0&&(m=r[0]),m){const w=F(r,m.path);y.setState({path:m.path,params:w.params,query:{}})}else c.devError("No fallback route available for error recovery")}}catch(n){c.devWarn("State recovery failed during navigation error:",n)}}};if((s=>{if(!s||s.length===0)return c.devError("Router configuration error: No routes provided"),!1;const i=new Set;for(const e of s){if(!e.path)return c.devError("Router configuration error: Route missing path",e),!1;i.has(e.path)&&c.devWarn(`Duplicate route path detected: ${e.path}`),i.add(e.path),!e.component&&!e.load&&c.devWarn(`Route '${e.path}' has no component or load function`)}return!0})(r),typeof window>"u"||typeof a<"u"){for(const s of r)T(s.path);c.devWarn(`Pre-compiled ${r.length} routes for SSR`)}if(typeof window<"u"&&typeof document<"u"&&typeof a>"u"){u=()=>{try{const e=new URL(window.location.href),n=e.pathname,p=n.startsWith(o)?n.slice(o.length):n,m=A(p||"/"),w=tt(e.search),S=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:m,query:w,fragment:S}}catch(e){return c.devWarn("Invalid URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},f=u();const s=T(f.path);y=ot.createStore({path:f.path,params:s.params,query:f.query,fragment:f.fragment}),W=async(e=!1)=>{const n=u();await d(n.path,e)};const i=()=>W(!0);window.addEventListener("popstate",i),k=e=>d(e,!1),z=e=>d(e,!0),B=()=>window.history.back()}else{u=()=>{try{const e=new URL(a||"/","http://localhost"),n=e.pathname,p=n.startsWith(o)?n.slice(o.length):n,m=A(p||"/"),w=tt(e.search),S=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:m,query:w,fragment:S}}catch(e){return c.devWarn("Invalid SSR URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},f=u();const s=T(f.path);y=ot.createStore({path:f.path,params:s.params,query:f.query,fragment:f.fragment}),W=async()=>{const e=u();await i(e.path)};const i=async e=>{if(q++,q>K){c.devError(`SSR redirect depth exceeded for path: ${e}`);return}try{const n=O(e),p=T(n.path);if(!p.route)throw new Error(`No route found for ${n.path}`);const m=y.getState(),w={path:n.path,params:p.params,query:n.query,fragment:n.fragment},S=Z(r,w.path);if(S?.beforeEnter){const E=await S.beforeEnter(w,m);if(typeof E=="string"){const P=`${w.path}->${E}`;_.add(P),await i(E);return}if(E===!1)return}if(S?.onEnter){const E=await S.onEnter(w,m);if(typeof E=="string"){const P=`${w.path}->${E}`;_.add(P),await i(E);return}if(E===!1)return}y.setState(w),S?.afterEnter&&S.afterEnter(w,m)}catch(n){throw c.devError("SSR navigation error:",n),n}};k=async e=>(q=0,_.clear(),i(e)),z=async e=>(q=0,_.clear(),i(e)),B=()=>{}}return{_cleanupScrollState:Y,store:y,push:k,replace:z,back:B,subscribe:y.subscribe,matchRoute:s=>T(s),getCurrent:()=>y.getState(),resolveRouteComponent:yt,base:o,scrollToFragment:s=>{const i=s||y.getState().fragment;return!i||typeof window>"u"||typeof document>"u"?Promise.resolve(!1):h(i,b.offset,b.timeoutMs)}}}function At(t){pt();const r=vt(t),v=it();if(v)try{v._cleanupScrollState?.()}catch{}$t(r);try{Ct();try{typeof window<"u"&&$.flushDOMUpdates()}catch{}try{typeof window<"u"&&queueMicrotask(()=>{try{$.flushDOMUpdates()}catch{}})}catch{}}catch{}return x.component("router-view",async()=>{if(!it())return x.html`<div>Router not initialized.</div>`;const a=$.ref(C.getCurrent()),l=typeof window>"u";let o;l||(x.useOnConnected(()=>{try{typeof C.subscribe=="function"&&(o=C.subscribe(u=>{try{u&&typeof u=="object"&&typeof u.path=="string"?a.value=u:(c.devWarn("router-view received invalid state",u),a.value={path:"/",params:{},query:{}})}catch(f){c.devWarn("router-view subscription update failed",f);try{a.value={path:"/",params:{},query:{}}}catch{}}}))}catch(u){c.devWarn("router-view subscribe failed",u)}}),x.useOnDisconnected(()=>{if(typeof o=="function"){try{o()}catch(u){c.devWarn("router-view unsubscribe failed",u)}o=void 0}}));const b=C.matchRoute(a.value.path);if(!b||!b.route)return x.html`<div>Not found</div>`;try{const f=await C.resolveRouteComponent(b.route);if(typeof f=="string")return{tag:f,props:{},children:[]};if(typeof f=="function"){const y=f();return(y instanceof Promise?y:Promise.resolve(y)).then(k=>typeof k=="string"?{tag:k,props:{},children:[]}:k)}return x.html`<div>Invalid route component</div>`}catch{return x.html`<div>Invalid route component</div>`}}),x.component("router-link",()=>{const a=x.useProps({to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,class:"",style:""}),l=typeof window>"u",o=$.ref(C.getCurrent()),b=o.value?.path||"/",u=String(a.to||""),f=l?{isExactActive:lt(b,u,C.base),isActive:ut(b,u,C.base),isExternal:U(u)||!!a.external}:null;let y;x.useStyle(()=>"a,button{display:inline-block;}");const W=$.ref(a.class||""),k=$.ref(a.style||"");if(!l){let h=null;x.useOnConnected(R=>{try{if(typeof C.subscribe=="function"){y=C.subscribe(d=>{try{d&&typeof d=="object"&&typeof d.path=="string"?o.value=d:(c.devWarn("router-link received invalid state",d),o.value={path:"/",params:{},query:{}})}catch(O){c.devWarn("router-link subscription update failed",O);try{o.value={path:"/",params:{},query:{}}}catch{}}});try{const d=C.getCurrent();d&&typeof d.path=="string"&&(o.value=d)}catch(d){c.devWarn("router-link initial state sync failed",d)}h=setInterval(()=>{try{const d=C.getCurrent();d&&typeof d.path=="string"&&JSON.stringify(o.value)!==JSON.stringify(d)&&(o.value=d)}catch{}},100)}}catch(d){c.devWarn("router-link subscribe failed",d)}try{const d=R?._host;if(d instanceof HTMLElement){const O=d.getAttribute("class"),D=d.getAttribute("style");O&&(W.value=O),D&&(k.value=D),O!==null&&d.removeAttribute("class"),D!==null&&d.removeAttribute("style");try{R?._requestRender?.();try{$.flushDOMUpdates()}catch{}}catch{}}}catch(d){c.devWarn("router-link host migration failed",d)}}),x.useOnDisconnected(()=>{if(typeof y=="function")try{y()}catch(R){c.devWarn("router-link unsubscribe failed",R)}finally{y=void 0}if(h)try{clearInterval(h)}catch(R){c.devWarn("router-link sync interval cleanup failed",R)}finally{h=null}})}const z=$.computed(()=>{if(l&&f)return f.isExactActive;try{const h=C.base??"",R=a.to||"";return!o.value||typeof o.value.path!="string"?!1:lt(o.value.path,R,h)}catch(h){return c.devWarn("isExactActive computation error",h),!1}}),B=$.computed(()=>{if(l&&f)return f.isActive;try{const h=C.base??"",R=a.to||"";return!o.value||typeof o.value.path!="string"?!1:a.exact?z.value:ut(o.value.path,R,h)}catch(h){return c.devWarn("isActive computation error",h),!1}}),_=$.computed(()=>{const h=String(a.to||"");if(nt(h))return null;if(U(h))return h;const[R,d]=h.split("#"),[O,D]=(R||"").split("?"),H=C.base??"";let Q=O||"/";if(H&&H!=="/"){const s=A(H),i=A(Q);i.startsWith(s)?Q=i.slice(s.length)||"/":Q=i}const at=A(Q||"/");return H+at+(D?"?"+D:"")+(d?"#"+d:"")}),K=$.computed(()=>{const R=(W&&W.value||a.class||"").split(/\s+/).filter(Boolean),d={};for(const O of R)d[O]=!0;return d}),q=$.computed(()=>({...K.value,[a.activeClass||"active"]:B.value,[a.exactActiveClass||"exact-active"]:z.value})),J=$.computed(()=>Object.keys(q.value).filter(h=>q.value[h]).join(" ")),X=$.computed(()=>a.tag||"a"),et=$.computed(()=>X.value==="button"),I=$.computed(()=>z.value?a.ariaCurrentValue:null),M=$.computed(()=>!!a.disabled),T=$.computed(()=>{const h=String(a.to||"");return(U(h)||!!a.external)&&X.value==="a"}),Y=$.computed(()=>k&&k.value||a.style||""),V=h=>{if(h.defaultPrevented||h.button!==0||h.metaKey||h.altKey||h.ctrlKey||h.shiftKey)return;if(M.value){h.preventDefault();return}const R=String(a.to||"");if(nt(R)){try{h.preventDefault()}catch{}c.devWarn("Blocked unsafe javascript: URI in router-link.to");return}T.value||(h.preventDefault(),a.replace?C.replace(a.to):C.push(a.to))};return x.html`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./logger-CSALKaYm.cjs"),$=require("./namespace-helpers-4qeKVqQw.cjs"),x=require("./template-compiler-gn2qLc7f.cjs"),ot=require("./custom-elements-runtime.store.cjs.js"),bt=require("./custom-elements-runtime.directives.cjs.js"),rt={enabled:!0,offset:0,timeoutMs:2e3},tt=t=>t?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(t)):{},ft=t=>{if(!t||Object.keys(t).length===0)return"";try{return"?"+new URLSearchParams(t).toString()}catch{return""}},nt=t=>t?/^\s*javascript\s*:/i.test(t):!1,U=t=>/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)||t.startsWith("//"),dt=t=>{try{return decodeURIComponent(t)}catch{return t}};function A(t){if(!t)return"/";let r=t.replace(/\/+/g,"/");return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r}const ht=t=>{if(!t)return"";const r=A(t);return r==="/"?"":r},st=new WeakMap;function wt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function St(t){const r=t.path||"/",v=A(r),a=v==="/"?[]:v.split("/").filter(Boolean),l=[],o=[];for(let u=0;u<a.length;u++){const f=a[u];if(f==="*"){if(u!==a.length-1)return c.devWarn(`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};const W=`splat${l.length}`;l.push(W),o.push("__SPLAT__");continue}const y=f.match(/^:([A-Za-z0-9_-]+)(\*)?$/);if(y){const W=y[1],k=!!y[2];if(k&&u!==a.length-1)return c.devWarn(`Route '${t.path}' contains a splat param ':${W}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};l.push(W),o.push(k?"__SPLAT__":"([^/]+)");continue}o.push(wt(f))}let b;if(o.length===0)b="^/$";else if(o[o.length-1]==="__SPLAT__"){const f=o.slice(0,-1).join("/");f?b=`^/${f}(?:/(.*))?(?:/)?$`:b="^(?:/(.*))?(?:/)?$"}else b=`^/${o.join("/")}(?:/)?$`;try{return{regex:new RegExp(b),paramNames:l}}catch(u){return c.devWarn(`Failed to compile route regex for '${t.path}': ${String(u)}`),{invalid:!0}}}const F=(t,r)=>{const v=A(r);for(const a of t){let l=st.get(a);if(l||(l=St(a),st.set(a,l)),l.invalid)continue;const{regex:o,paramNames:b}=l,u=o.exec(v);if(u){const f={};for(let y=0;y<b.length;y++){const W=u[y+1]||"";f[b[y]]=W?dt(W):""}return{route:a,params:f}}}return{route:null,params:{}}};function Z(t,r){for(const v of t)if(F([v],r).route!==null)return v;return null}function Rt(t,r){return F(t,r)}const ct=50;let G={},L={};function pt(){G={},L={}}function Et(){const t=Object.entries(G);if(t.length<=ct)return;const v=t.sort(([,a],[,l])=>a.lastAccessed-l.lastAccessed).slice(0,t.length-ct);for(const[a]of v)delete G[a]}async function yt(t){if(t.component)return t.component;if(t.load){const r=G[t.path];if(r)return r.lastAccessed=Date.now(),r.component;if(L[t.path]!==void 0)return L[t.path];const v=typeof window>"u";try{const a=t.load().then(l=>{Et();const o=l.default;return G[t.path]={component:o,lastAccessed:Date.now()},delete L[t.path],o}).catch(l=>{delete L[t.path];const o=l instanceof Error?l.message:String(l);throw v&&c.devError(`SSR component load failed for route: ${t.path}. ${o}`),new Error(`Failed to load component for route: ${t.path}. ${o}`)});return L[t.path]=a,await a}catch(a){const l=a instanceof Error?a.message:String(a);throw new Error(`Failed to load component for route: ${t.path}. ${l}`,{cause:a})}}throw new Error(`No component or loader defined for route: ${t.path}`)}let g=null;function $t(t){g=t}function it(){return g}const j=new Set;let N=null;function mt(){if(N){try{N()}catch{}N=null}if(g)try{let t=!1;N=g.subscribe(r=>{t=!0;for(const v of j)try{v(r)}catch{}});try{C.base=g.base}catch{}if(t){const r=g.getCurrent();for(const v of j)try{v(r)}catch{}}else{const r=g.getCurrent();for(const v of j)try{v(r)}catch{}}try{typeof window<"u"&&$.flushDOMUpdates()}catch{}}catch{N=null}}function Ct(){mt()}const C={store:{subscribe(t){if(g)return g.store.subscribe(t);try{t({path:"/",params:{},query:{}})}catch{}return()=>{}},getState(){return g?g.getCurrent():{path:"/",params:{},query:{}}},setState(t){if(g)try{g.store.setState(t)}catch{}}},subscribe(t){if(typeof t!="function")return c.devWarn("activeRouterProxy.subscribe: listener must be a function"),()=>{};if(j.add(t),g)if(!N)mt();else try{const r=g.getCurrent();r&&t(r)}catch(r){c.devWarn("activeRouterProxy subscription failed",r)}else try{t({path:"/",params:{},query:{}})}catch(r){c.devWarn("activeRouterProxy fallback state delivery failed",r)}return()=>{try{if(j.delete(t),j.size===0&&N){try{N()}catch(r){c.devWarn("activeRouterProxy inner unsubscribe failed",r)}N=null}}catch(r){c.devWarn("activeRouterProxy unsubscribe failed",r)}}},getCurrent(){return g?g.getCurrent():{path:"/",params:{},query:{}}},async push(t){return g?g.push(t):Promise.resolve()},async replace(t){return g?g.replace(t):Promise.resolve()},back(){if(g)return g.back()},matchRoute(t){return g?g.matchRoute(t):{route:null,params:{}}},resolveRouteComponent(t){return g?g.resolveRouteComponent(t):Promise.reject(new Error("No active router"))},base:"",scrollToFragment(t){return g?g.scrollToFragment(t):Promise.resolve(!1)}};function vt(t){const{routes:r,base:v="",initialUrl:a,scrollToFragment:l=!0}=t,o=ht(v),b=typeof l=="boolean"?{...rt,enabled:l}:{...rt,...l};let u,f,y,W,k,z,B;const _=new Set,K=10;let q=0;const J=async(s,i)=>{const e=Z(r,s.path);if(!e||!e.beforeEnter)return!0;try{const n=await e.beforeEnter(s,i);if(typeof n=="string"){const p=`${s.path}->${n}`;return _.has(p)||q>=K?(c.devError(`Redirect loop detected: ${p}`),!1):n}return n!==!1}catch(n){c.devError("beforeEnter error",n);try{y.setState(i)}catch{}throw n}},X=async(s,i)=>{const e=Z(r,s.path);if(!e||!e.onEnter)return!0;try{const n=await e.onEnter(s,i);if(typeof n=="string"){const p=`${s.path}->${n}`;return _.has(p)||q>=K?(c.devError(`Redirect loop detected: ${p}`),!1):n}return n!==!1}catch(n){c.devError("onEnter error",n);try{y.setState(i)}catch{}throw n}},et=(s,i)=>{const e=Z(r,s.path);if(!(!e||!e.afterEnter))try{e.afterEnter(s,i)}catch(n){c.devError("afterEnter error",n)}},I=new Map,M=100,T=s=>{if(I.has(s))return I.get(s);const i=F(r,s);if(I.size>=M){const e=Math.floor(M*.25),n=Array.from(I.keys());for(let p=0;p<e&&p<n.length;p++)I.delete(n[p])}return I.set(s,i),i},Y=()=>{};async function V(s,i=0){try{const e=document.getElementById(s);if(!e)return!1;if(i>0)try{const n=e.getBoundingClientRect(),p=Math.max(0,window.scrollY+n.top-i);typeof window.scrollTo=="function"&&window.scrollTo({top:p,behavior:"auto"})}catch{try{e.scrollIntoView()}catch{return!1}}else if(typeof e.scrollIntoView=="function")try{e.scrollIntoView({behavior:"auto",block:"start",inline:"nearest"})}catch{try{e.scrollIntoView()}catch{return!1}}return!0}catch{return!1}}function h(s,i=0,e=2e3){return new Promise(n=>{let p=!1,m=null;const w=Date.now(),S=P=>{p||(p=!0,m&&clearTimeout(m),n(P))},E=async()=>{if(!p)try{if(await V(s,i))return S(!0);const P=async()=>{if(p)return;if(Date.now()-w>=e)return S(!1);try{if(await V(s,i))return S(!0);requestAnimationFrame(P)}catch(gt){c.devWarn("Scroll retry attempt failed:",gt),requestAnimationFrame(P)}};requestAnimationFrame(P)}catch(P){c.devWarn("Initial scroll attempt failed:",P),S(!1)}};m=setTimeout(()=>{S(!1)},e),E().catch(P=>{c.devWarn("Scroll attempt failed:",P),S(!1)})})}let R=!1;const d=async(s,i=!1)=>{if(R){c.devWarn(`Navigation to ${s} blocked - navigation already in progress`);return}R=!0,q=0,_.clear();try{await D(s,i)}finally{R=!1,q=0,_.clear()}},O=s=>{const i=s.indexOf("#"),e=i>=0?s.slice(i+1):"",n=i>=0?s.slice(0,i):s,p=n.indexOf("?"),m=p>=0?n.slice(0,p):n,w=p>=0?tt(n.slice(p)):{},S=m.startsWith(o)?m.slice(o.length):m;return{path:A(S||"/"),query:w,fragment:e}},D=async(s,i=!1)=>{try{const e=O(s),n=T(e.path);if(!n.route)throw new Error(`No route found for ${e.path}`);const p=y.getState(),m={path:e.path,params:n.params,query:e.query,fragment:e.fragment},w=await J(m,p);if(w===!1)return;if(typeof w=="string"){q++;const E=`${m.path}->${w}`;_.add(E),await D(w,!0);return}const S=await X(m,p);if(S===!1)return;if(typeof S=="string"){q++;const E=`${m.path}->${S}`;_.add(E),await D(S,!0);return}if(typeof window<"u"&&typeof document<"u"){const E=ft(e.query),P=o+e.path+(E||"")+(e.fragment?"#"+e.fragment:"");i?window.history.replaceState({},"",P):window.history.pushState({},"",P)}if(y.setState(m),et(m,p),typeof window<"u"&&typeof document<"u")try{const E=m.fragment;b.enabled&&E&&h(String(E),b.offset,b.timeoutMs).catch(()=>{})}catch{}}catch(e){if(c.devError("Navigation error:",e),e instanceof Error&&(e.stack?.includes("runBeforeEnter")||e.stack?.includes("runOnEnter")))throw e;try{const n=y.getState();if(!F(r,n.path).route){let m=r.find(w=>w.path==="/");if(m||(m=r.find(w=>!w.path.includes(":")&&!w.path.includes("*"))),!m&&r.length>0&&(m=r[0]),m){const w=F(r,m.path);y.setState({path:m.path,params:w.params,query:{}})}else c.devError("No fallback route available for error recovery")}}catch(n){c.devWarn("State recovery failed during navigation error:",n)}}};if((s=>{if(!s||s.length===0)return c.devError("Router configuration error: No routes provided"),!1;const i=new Set;for(const e of s){if(!e.path)return c.devError("Router configuration error: Route missing path",e),!1;i.has(e.path)&&c.devWarn(`Duplicate route path detected: ${e.path}`),i.add(e.path),!e.component&&!e.load&&c.devWarn(`Route '${e.path}' has no component or load function`)}return!0})(r),typeof window>"u"||typeof a<"u"){for(const s of r)T(s.path);c.devWarn(`Pre-compiled ${r.length} routes for SSR`)}if(typeof window<"u"&&typeof document<"u"&&typeof a>"u"){u=()=>{try{const e=new URL(window.location.href),n=e.pathname,p=n.startsWith(o)?n.slice(o.length):n,m=A(p||"/"),w=tt(e.search),S=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:m,query:w,fragment:S}}catch(e){return c.devWarn("Invalid URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},f=u();const s=T(f.path);y=ot.createStore({path:f.path,params:s.params,query:f.query,fragment:f.fragment}),W=async(e=!1)=>{const n=u();await d(n.path,e)};const i=()=>W(!0);window.addEventListener("popstate",i),k=e=>d(e,!1),z=e=>d(e,!0),B=()=>window.history.back()}else{u=()=>{try{const e=new URL(a||"/","http://localhost"),n=e.pathname,p=n.startsWith(o)?n.slice(o.length):n,m=A(p||"/"),w=tt(e.search),S=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:m,query:w,fragment:S}}catch(e){return c.devWarn("Invalid SSR URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},f=u();const s=T(f.path);y=ot.createStore({path:f.path,params:s.params,query:f.query,fragment:f.fragment}),W=async()=>{const e=u();await i(e.path)};const i=async e=>{if(q++,q>K){c.devError(`SSR redirect depth exceeded for path: ${e}`);return}try{const n=O(e),p=T(n.path);if(!p.route)throw new Error(`No route found for ${n.path}`);const m=y.getState(),w={path:n.path,params:p.params,query:n.query,fragment:n.fragment},S=Z(r,w.path);if(S?.beforeEnter){const E=await S.beforeEnter(w,m);if(typeof E=="string"){const P=`${w.path}->${E}`;_.add(P),await i(E);return}if(E===!1)return}if(S?.onEnter){const E=await S.onEnter(w,m);if(typeof E=="string"){const P=`${w.path}->${E}`;_.add(P),await i(E);return}if(E===!1)return}y.setState(w),S?.afterEnter&&S.afterEnter(w,m)}catch(n){throw c.devError("SSR navigation error:",n),n}};k=async e=>(q=0,_.clear(),i(e)),z=async e=>(q=0,_.clear(),i(e)),B=()=>{}}return{_cleanupScrollState:Y,store:y,push:k,replace:z,back:B,subscribe:y.subscribe,matchRoute:s=>T(s),getCurrent:()=>y.getState(),resolveRouteComponent:yt,base:o,scrollToFragment:s=>{const i=s||y.getState().fragment;return!i||typeof window>"u"||typeof document>"u"?Promise.resolve(!1):h(i,b.offset,b.timeoutMs)}}}function At(t){pt();const r=vt(t),v=it();if(v)try{v._cleanupScrollState?.()}catch{}$t(r);try{Ct();try{typeof window<"u"&&$.flushDOMUpdates()}catch{}try{typeof window<"u"&&queueMicrotask(()=>{try{$.flushDOMUpdates()}catch{}})}catch{}}catch{}return x.component("router-view",async()=>{if(!it())return x.html`<div>Router not initialized.</div>`;const a=$.ref(C.getCurrent()),l=typeof window>"u";let o;l||(x.useOnConnected(()=>{try{typeof C.subscribe=="function"&&(o=C.subscribe(u=>{try{u&&typeof u=="object"&&typeof u.path=="string"?a.value=u:(c.devWarn("router-view received invalid state",u),a.value={path:"/",params:{},query:{}})}catch(f){c.devWarn("router-view subscription update failed",f);try{a.value={path:"/",params:{},query:{}}}catch{}}}))}catch(u){c.devWarn("router-view subscribe failed",u)}}),x.useOnDisconnected(()=>{if(typeof o=="function"){try{o()}catch(u){c.devWarn("router-view unsubscribe failed",u)}o=void 0}}));const b=C.matchRoute(a.value.path);if(!b||!b.route)return x.html`<div>Not found</div>`;try{const f=await C.resolveRouteComponent(b.route);if(typeof f=="string")return{tag:f,props:{},children:[]};if(typeof f=="function"){const y=f();return(y instanceof Promise?y:Promise.resolve(y)).then(k=>typeof k=="string"?{tag:k,props:{},children:[]}:k)}return x.html`<div>Invalid route component</div>`}catch{return x.html`<div>Invalid route component</div>`}}),x.component("router-link",()=>{const a=x.useProps({to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,class:"",style:""}),l=typeof window>"u",o=$.ref(C.getCurrent()),b=o.value?.path||"/",u=String(a.to||""),f=l?{isExactActive:lt(b,u,C.base),isActive:ut(b,u,C.base),isExternal:U(u)||!!a.external}:null;let y;x.useStyle(()=>"a,button{display:inline-block;}");const W=$.ref(a.class||""),k=$.ref(a.style||"");if(!l){let h=null;x.useOnConnected(R=>{try{if(typeof C.subscribe=="function"){y=C.subscribe(d=>{try{d&&typeof d=="object"&&typeof d.path=="string"?o.value=d:(c.devWarn("router-link received invalid state",d),o.value={path:"/",params:{},query:{}})}catch(O){c.devWarn("router-link subscription update failed",O);try{o.value={path:"/",params:{},query:{}}}catch{}}});try{const d=C.getCurrent();d&&typeof d.path=="string"&&(o.value=d)}catch(d){c.devWarn("router-link initial state sync failed",d)}h=setInterval(()=>{try{const d=C.getCurrent();d&&typeof d.path=="string"&&JSON.stringify(o.value)!==JSON.stringify(d)&&(o.value=d)}catch{}},100)}}catch(d){c.devWarn("router-link subscribe failed",d)}try{const d=R?._host;if(d instanceof HTMLElement){const O=d.getAttribute("class"),D=d.getAttribute("style");O&&(W.value=O),D&&(k.value=D),O!==null&&d.removeAttribute("class"),D!==null&&d.removeAttribute("style");try{R?._requestRender?.();try{$.flushDOMUpdates()}catch{}}catch{}}}catch(d){c.devWarn("router-link host migration failed",d)}}),x.useOnDisconnected(()=>{if(typeof y=="function")try{y()}catch(R){c.devWarn("router-link unsubscribe failed",R)}finally{y=void 0}if(h)try{clearInterval(h)}catch(R){c.devWarn("router-link sync interval cleanup failed",R)}finally{h=null}})}const z=$.computed(()=>{if(l&&f)return f.isExactActive;try{const h=C.base??"",R=a.to||"";return!o.value||typeof o.value.path!="string"?!1:lt(o.value.path,R,h)}catch(h){return c.devWarn("isExactActive computation error",h),!1}}),B=$.computed(()=>{if(l&&f)return f.isActive;try{const h=C.base??"",R=a.to||"";return!o.value||typeof o.value.path!="string"?!1:a.exact?z.value:ut(o.value.path,R,h)}catch(h){return c.devWarn("isActive computation error",h),!1}}),_=$.computed(()=>{const h=String(a.to||"");if(nt(h))return null;if(U(h))return h;const[R,d]=h.split("#"),[O,D]=(R||"").split("?"),H=C.base??"";let Q=O||"/";if(H&&H!=="/"){const s=A(H),i=A(Q);i.startsWith(s)?Q=i.slice(s.length)||"/":Q=i}const at=A(Q||"/");return H+at+(D?"?"+D:"")+(d?"#"+d:"")}),K=$.computed(()=>{const R=(W&&W.value||a.class||"").split(/\s+/).filter(Boolean),d={};for(const O of R)d[O]=!0;return d}),q=$.computed(()=>({...K.value,[a.activeClass||"active"]:B.value,[a.exactActiveClass||"exact-active"]:z.value})),J=$.computed(()=>Object.keys(q.value).filter(h=>q.value[h]).join(" ")),X=$.computed(()=>a.tag||"a"),et=$.computed(()=>X.value==="button"),I=$.computed(()=>z.value?a.ariaCurrentValue:null),M=$.computed(()=>!!a.disabled),T=$.computed(()=>{const h=String(a.to||"");return(U(h)||!!a.external)&&X.value==="a"}),Y=$.computed(()=>k&&k.value||a.style||""),V=h=>{if(h.defaultPrevented||h.button!==0||h.metaKey||h.altKey||h.ctrlKey||h.shiftKey)return;if(M.value){h.preventDefault();return}const R=String(a.to||"");if(nt(R)){try{h.preventDefault()}catch{}c.devWarn("Blocked unsafe javascript: URI in router-link.to");return}T.value||(h.preventDefault(),a.replace?C.replace(a.to):C.push(a.to))};return x.html`
2
2
  ${bt.match().when(et.value,x.html`
3
3
  <button
4
4
  part="button"