@jasonshimmy/custom-elements-runtime 0.0.9 β 0.0.10-beta.1
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 +84 -81
- package/dist/custom-elements-runtime.cjs.js +16 -69
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +1506 -1455
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +16 -69
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/directives.d.ts +11 -0
- package/dist/router.d.ts +17 -6
- package/dist/runtime.d.ts +54 -137
- package/dist/store.d.ts +5 -1
- package/dist/style-utils.d.ts +9 -0
- package/dist/template-compiler.d.ts +4 -115
- package/dist/vdom.d.ts +32 -0
- package/package.json +5 -5
- package/dist/build-tools.d.ts +0 -66
- package/dist/computed-state.d.ts +0 -10
- package/dist/data-binding.d.ts +0 -8
- package/dist/dev-tools.d.ts +0 -21
- package/dist/ssr.d.ts +0 -49
- package/dist/template-helpers.d.ts +0 -43
- package/dist/v-dom.d.ts +0 -54
package/README.md
CHANGED
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
Build modern components with strict TypeScript, zero dependencies, and a clean functional API. Designed for speed, standards compliance, and productivity.
|
|
6
6
|
|
|
7
|
+
## π§ **Active Development Notice**
|
|
8
|
+
|
|
9
|
+
> β οΈ **This package is in active development and not yet ready for production use.**
|
|
10
|
+
> Features, APIs, and stability may change frequently. Please use for testing, experimentation, or contribution only.
|
|
11
|
+
|
|
12
|
+
## β¨ Why You'll Love It
|
|
13
|
+
|
|
14
|
+
- β‘ **Blazing Fast:** Minimal runtime, instant updates, zero dependencies.
|
|
15
|
+
- π¨ **JIT CSS:** On-demand, utility-first styling directly in your HTML.
|
|
16
|
+
- π§βπ» **TypeScript First:** Strict types, intellisense, and safety everywhere.
|
|
17
|
+
- π§© **Functional API:** No classes, no boilerplateβjust pure functions.
|
|
18
|
+
- π οΈ **SSR & HMR Ready:** Universal rendering and instant hot reloads.
|
|
19
|
+
- π **Extensible:** Directives, event bus, store, and more for advanced use cases.
|
|
20
|
+
- π **Developer Friendly:** Clean docs, examples, and a welcoming community.
|
|
21
|
+
|
|
7
22
|
---
|
|
8
23
|
|
|
9
24
|
## π Quick Start
|
|
@@ -19,102 +34,90 @@ npm install @jasonshimmy/custom-elements-runtime
|
|
|
19
34
|
```ts
|
|
20
35
|
import { component, html } from '@jasonshimmy/custom-elements-runtime';
|
|
21
36
|
|
|
22
|
-
component('my-counter',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<button data-on-click="increment">Count: ${count}</button>
|
|
26
|
-
`({ count }),
|
|
27
|
-
increment(event, state) { state.count++; }
|
|
28
|
-
});
|
|
37
|
+
component('my-counter', (ctx) => html`
|
|
38
|
+
<button @click="${() => ctx.count++}">Count: ${ctx.count}</button>
|
|
39
|
+
`, { state: { count: 0 } });
|
|
29
40
|
```
|
|
30
41
|
|
|
31
42
|
No config needed β TypeScript support is built-in.
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## β¨ Why Use It?
|
|
38
|
-
|
|
39
|
-
- **Stateful or Stateless:** Flexible components with or without internal state
|
|
40
|
-
- **Reactive & Declarative:** Auto updates, attribute sync, and data binding
|
|
41
|
-
- **Functional Templates:** Tagged helpers (`html`, `compile`), Promises, and styles
|
|
42
|
-
- **Refs & Computed:** Access elements or create derived state easily
|
|
43
|
-
- **Built-in Store & Events:** Global state and event bus included
|
|
44
|
-
- **SSR & Hydration:** Universal rendering with opt-in hydration
|
|
45
|
-
- **Error Handling & Focus Retention:** Smooth updates without breaking UX
|
|
46
|
-
- **Plugin System:** Hooks like `onInit`, `onRender`, `onError`
|
|
47
|
-
- **Lightweight Router:** SSR-ready with `<router-view>` and programmatic navigation
|
|
48
|
-
- **Tiny & Fast:** Tree-shakable, modular, no dependencies
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## β οΈ Things to Know
|
|
53
|
-
|
|
54
|
-
- Templates need a single root node (fragments allowed with keys)
|
|
55
|
-
- One handler per event type per element
|
|
56
|
-
- User input takes priority over programmatic changes
|
|
57
|
-
- SSR hydration is opt-in (`data-hydrate`)
|
|
58
|
-
- Only documented features are officially supported
|
|
59
|
-
- Plugins must be pure and side-effect free
|
|
60
|
-
- Router requires matching templates for SSR hydration
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## π§ Use Cases
|
|
44
|
+
## β±οΈ Getting Started in 60 Seconds
|
|
65
45
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
1. **Install:** `npm install @jasonshimmy/custom-elements-runtime`
|
|
47
|
+
2. **Create a Component:**
|
|
48
|
+
```ts
|
|
49
|
+
import { component, html } from '@jasonshimmy/custom-elements-runtime';
|
|
50
|
+
component('hello-world', () => html`<h1>Hello, World!</h1>`);
|
|
51
|
+
```
|
|
52
|
+
3. **Use in HTML:**
|
|
53
|
+
```html
|
|
54
|
+
<hello-world></hello-world>
|
|
55
|
+
```
|
|
56
|
+
4. **Enjoy instant reactivity and type safety!**
|
|
74
57
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## π₯οΈ SSR Highlights
|
|
58
|
+
# π Documentation Index
|
|
78
59
|
|
|
79
|
-
|
|
80
|
-
- Hydrate only what you need
|
|
81
|
-
- Robust support for fragments, keyed nodes, and error handling
|
|
82
|
-
- Compatible with routing and static site generation
|
|
60
|
+
Explore the full documentation for every runtime feature:
|
|
83
61
|
|
|
84
62
|
---
|
|
85
63
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
64
|
+
## ποΈ Core Concepts
|
|
65
|
+
- [Component Config](./docs/component-config.md)
|
|
66
|
+
- [Component](./docs/component.md)
|
|
67
|
+
- [Render](./docs/render.md)
|
|
68
|
+
- [Props](./docs/props.md)
|
|
69
|
+
- [State](./docs/state.md)
|
|
70
|
+
- [Computed](./docs/computed.md)
|
|
71
|
+
- [Watch](./docs/watch.md)
|
|
72
|
+
- [Store](./docs/store.md)
|
|
73
|
+
- [Event Bus](./docs/event-bus.md)
|
|
74
|
+
- [Template](./docs/template.md)
|
|
75
|
+
|
|
76
|
+
## π§© Reactivity & Patterns
|
|
77
|
+
- [Directives](./docs/directives.md)
|
|
78
|
+
- [Bindings](./docs/bindings.md)
|
|
79
|
+
- [Directives & Binding](./docs/directives-and-binding.md)
|
|
80
|
+
- [Slot](./docs/slot.md)
|
|
81
|
+
- [Advanced Usage Patterns](./docs/advanced-usage-patterns.md)
|
|
82
|
+
- [Cross-Component Communication](./docs/cross-component-communication.md)
|
|
83
|
+
|
|
84
|
+
## π¨ Styling
|
|
85
|
+
- [Style](./docs/style.md)
|
|
86
|
+
- [Deep Dive: JIT CSS](./docs/jit-css.md)
|
|
87
|
+
|
|
88
|
+
## β‘ Performance & Architecture
|
|
89
|
+
- [Virtual DOM](./docs/virtual-dom.md)
|
|
90
|
+
- [HMR](./docs/hmr.md)
|
|
91
|
+
- [SSR](./docs/ssr.md)
|
|
92
|
+
|
|
93
|
+
## π‘οΈ Error Handling & Lifecycle
|
|
94
|
+
- [Error](./docs/error.md)
|
|
95
|
+
- [Hooks](./docs/hooks.md)
|
|
96
|
+
- [Method Injection](./docs/method-injection.md)
|
|
97
|
+
|
|
98
|
+
## π§° Utilities & Troubleshooting
|
|
99
|
+
- [Troubleshooting](./docs/troubleshooting.md)
|
|
100
|
+
|
|
101
|
+
## π Framework Integration
|
|
102
|
+
- [Vue Integration](./docs/vue-integration.md)
|
|
103
|
+
- [React Integration](./docs/react-integration.md)
|
|
104
|
+
- [Svelte Integration](./docs/svelte-integration.md)
|
|
105
|
+
- [Angular Integration](./docs/angular-integration.md)
|
|
93
106
|
|
|
94
107
|
---
|
|
95
108
|
|
|
96
|
-
|
|
109
|
+
For deep dives, see each guide above or browse the source code in `src/lib/`.
|
|
97
110
|
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
---
|
|
111
|
+
## π§βπ¬ Real-World Examples
|
|
112
|
+
- [Form Input & Validation](./src/components/examples/FormInputValidation.ts)
|
|
113
|
+
- [Minimal Example](./src/components/examples/MinimalExample.ts)
|
|
114
|
+
- [Shopping Cart](./src/components/examples/ShoppingCart.ts)
|
|
115
|
+
- [Todo App](./src/components/examples/TodoApp.ts)
|
|
105
116
|
|
|
106
|
-
##
|
|
107
|
-
|
|
108
|
-
- [
|
|
109
|
-
-
|
|
110
|
-
- [π± Core Concepts](docs/core-concepts.md)
|
|
111
|
-
- [π₯ Data Model vs Data Bind](docs/data-model-vs-data-bind.md)
|
|
112
|
-
- [π¦ Examples](docs/examples.md)
|
|
113
|
-
- [ποΈ Form Input Bindings](docs/form-input-bindings.md)
|
|
114
|
-
- [π― Framework Comparison](docs/framework-comparison.md)
|
|
115
|
-
- [π Framework Integration](docs/framework-integration.md)
|
|
116
|
-
- [π¦ Routing](docs/routing.md)
|
|
117
|
-
- [π SSR Guide](docs/ssr.md)
|
|
117
|
+
## π Showcase & Community
|
|
118
|
+
- **Showcase your components!** Open a PR to add your project to our gallery.
|
|
119
|
+
- **Questions or ideas?** [Start a discussion](https://github.com/jasonshimmy/custom-elements-runtime/discussions) or [open an issue](https://github.com/jasonshimmy/custom-elements-runtime/issues).
|
|
120
|
+
- **Contribute:** We welcome PRs for docs, features, and examples.
|
|
118
121
|
|
|
119
122
|
---
|
|
120
123
|
|
|
@@ -1,72 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var O=typeof document<"u"?document.currentScript:null;function $(e){let t=new Proxy(e,{set:(i,a,c)=>(i[a]=c,s(),!0)});const r=[];function n(i){r.push(i),i(t)}function o(){return t}function s(){r.forEach(i=>i(t))}return{subscribe:n,getState:o}}class g extends EventTarget{handlers={};static instance;eventCounters=new Map;static getInstance(){return g.instance||(g.instance=new g),g.instance}emit(t,r){const n=Date.now(),o=this.eventCounters.get(t);if(!o||n-o.window>1e3)this.eventCounters.set(t,{count:1,window:n});else if(o.count++,o.count>50&&(console.error(`Event storm detected for "${t}": ${o.count} events in 1 second. Throttling...`),o.count>100)){console.warn(`Blocking further "${t}" events to prevent infinite loop`);return}this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!1,cancelable:!0}));const s=this.handlers[t];s&&s.forEach(i=>{try{i(r)}catch(a){console.error(`Error in global event handler for "${t}":`,a)}})}on(t,r){return this.handlers[t]||(this.handlers[t]=new Set),this.handlers[t].add(r),()=>this.off(t,r)}off(t,r){const n=this.handlers[t];n&&n.delete(r)}offAll(t){delete this.handlers[t]}listen(t,r,n){return this.addEventListener(t,r,n),()=>this.removeEventListener(t,r)}once(t,r){return new Promise(n=>{const o=this.on(t,s=>{o(),r(s),n(s)})})}getActiveEvents(){return Object.keys(this.handlers).filter(t=>this.handlers[t]&&this.handlers[t].size>0)}clear(){this.handlers={}}getHandlerCount(t){return this.handlers[t]?.size||0}getEventStats(){const t={};for(const[r,n]of this.eventCounters.entries())t[r]={count:n.count,handlersCount:this.getHandlerCount(r)};return t}resetEventCounters(){this.eventCounters.clear()}}const C=g.getInstance(),tt=typeof window>"u"||typeof document>"u";function et(e){return{state:e,emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{},render:()=>{}}}function U(e,t={}){tt||console.warn("[SSR] renderToString should only be used on the server");try{const r=e.state,n=et(r),o=e.template(r,n);let s="";t.includeStyles&&e.style&&(s=`<style>${typeof e.style=="function"?e.style(r):e.style}</style>`);const i=t.sanitizeAttributes?t.sanitizeAttributes(e.attrs||{}):e.attrs||{},a=Object.entries(i).map(([u,d])=>`${W(u)}="${W(d)}"`).join(" "),l=`${a?`<${e.tag} ${a}>`:`<${e.tag}>`}${s}${o}</${e.tag}>`;return t.prettyPrint?it(l):l}catch(r){return console.error(`[SSR] Error rendering ${e.tag}:`,r),`<${e.tag}><div style="color: red;">SSR Error: ${st(String(r))}</div></${e.tag}>`}}function rt(e,t={}){const r={components:new Map,styles:new Set},n=[];e.forEach(i=>{if(r.components.set(i.tag,i),i.style){const c=typeof i.style=="function"?i.style(i.state):i.style;r.styles.add(c)}const a=U(i,{...t,includeStyles:!1});n.push(a)});const o=Array.from(r.styles).join(`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Auto-hydrate when DOM is ready
|
|
9
|
-
if (document.readyState === 'loading') {
|
|
10
|
-
document.addEventListener('DOMContentLoaded', hydrate);
|
|
11
|
-
} else {
|
|
12
|
-
hydrate();
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function se(e){let t=new Proxy(e,{set:(o,c,d)=>(o[c]=d,s(),!0)});const r=[];function n(o){r.push(o),o(t)}function i(){return t}function s(){r.forEach(o=>o(t))}return{subscribe:n,getState:i}}class R extends EventTarget{handlers={};static instance;eventCounters=new Map;static getInstance(){return R.instance||(R.instance=new R),R.instance}emit(t,r){const n=Date.now(),i=this.eventCounters.get(t);if(!i||n-i.window>1e3)this.eventCounters.set(t,{count:1,window:n});else if(i.count++,i.count>50&&(console.error(`Event storm detected for "${t}": ${i.count} events in 1 second. Throttling...`),i.count>100)){console.warn(`Blocking further "${t}" events to prevent infinite loop`);return}this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!1,cancelable:!0}));const s=this.handlers[t];s&&s.forEach(o=>{try{o(r)}catch(c){console.error(`Error in global event handler for "${t}":`,c)}})}on(t,r){return this.handlers[t]||(this.handlers[t]=new Set),this.handlers[t].add(r),()=>this.off(t,r)}off(t,r){const n=this.handlers[t];n&&n.delete(r)}offAll(t){delete this.handlers[t]}listen(t,r,n){return this.addEventListener(t,r,n),()=>this.removeEventListener(t,r)}once(t,r){return new Promise(n=>{const i=this.on(t,s=>{i(),r(s),n(s)})})}getActiveEvents(){return Object.keys(this.handlers).filter(t=>this.handlers[t]&&this.handlers[t].size>0)}clear(){this.handlers={}}getHandlerCount(t){return this.handlers[t]?.size||0}getEventStats(){const t={};for(const[r,n]of this.eventCounters.entries())t[r]={count:n.count,handlersCount:this.getHandlerCount(r)};return t}resetEventCounters(){this.eventCounters.clear()}}const ae=R.getInstance();function P(e,t={},r,n){const i=n??t.key;return{tag:e,key:i,props:t,children:r}}function V(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function z(e){return typeof e=="object"&&e!==null&&"tag"in e&&!V(e)}function le(e,t){return e.key!=null?e:{...e,key:t}}function ce(e,t=[],r={}){const n={},i={},s={},o=/([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;let c;for(;c=o.exec(e);){const d=c[1],a=c[2],u=(c[4]||c[6])??"",y=u.match(/^{{(\d+)}}$/);let f=y?t[Number(y[1])]??null:u;if(y||(f==="true"?f=!0:f==="false"?f=!1:f==="null"?f=null:isNaN(Number(f))||(f=Number(f))),d===":")typeof f=="boolean"?i[a]=f:f!=null&&(n[a]=f);else if(d==="@"){const w="on"+a.charAt(0).toUpperCase()+a.slice(1);n[w]=typeof f=="function"?f:typeof r[f]=="function"?r[f]:void 0}else if(d==="#"){const[w,...p]=a.split("."),S=[...p];let g=f,l=[...S];if(w==="model"&&typeof g=="string"&&g.includes(".")){const b=["trim","number","lazy"],m=g.split(".");let h=g;const x=[];for(let C=m.length-1;C>0&&b.includes(m[C]);C--)x.unshift(m[C]),h=m.slice(0,C).join(".");g=h,l.push(...x)}s[w]={value:g,modifiers:l}}else i[a]=f}return{props:n,attrs:i,directives:s}}function fe(e,t,r){function n(l,b){return P("#text",{},l,b)}let i="";for(let l=0;l<e.length;l++)i+=e[l],l<t.length&&(i+=`{{${l}}}`);const s=/<\/?([a-zA-Z0-9-]+)([^>]*)\/?>|{{(\d+)}}|([^<]+)/g,o=[];let c=null,d,a=[],u=null,y={},f,w=0,p=[];function S(l){!l||typeof l!="object"||V(l)||(l.props||l.attrs?(l.props&&(y.props||(y.props={}),Object.assign(y.props,l.props)),l.attrs&&(y.attrs||(y.attrs={}),Object.keys(l.attrs).forEach(b=>{if(b==="style"&&y.attrs.style){const m=y.attrs.style.replace(/;?\s*$/,""),h=l.attrs.style.replace(/^;?\s*/,"");y.attrs.style=m+"; "+h}else if(b==="class"&&y.attrs.class){const m=y.attrs.class.trim().split(/\s+/).filter(Boolean),h=l.attrs.class.trim().split(/\s+/).filter(Boolean),x=[...new Set([...m,...h])];y.attrs.class=x.join(" ")}else y.attrs[b]=l.attrs[b]}))):(y.props||(y.props={}),Object.assign(y.props,l)))}function g(l,b){const m=u?a:p;if(V(l)){const h=l.key??b;let x=l.children;m.push({...l,key:h,children:x});return}if(z(l)){m.push(le(l,void 0));return}if(Array.isArray(l)){if(l.length===0)return;for(let h=0;h<l.length;h++){const x=l[h];V(x)||z(x)||Array.isArray(x)?g(x,`${b}-${h}`):x!==null&&typeof x=="object"?S(x):m.push(n(String(x),`${b}-${h}`))}return}if(l!==null&&typeof l=="object"){S(l);return}m.push(n(String(l),b))}for(;d=s.exec(i);)if(d[1]){const l=d[1],b=d[0][1]==="/",m=d[0][d[0].length-2]==="/",{props:h,attrs:x,directives:C}=ce(d[2]||"",t,r),k={props:{},attrs:{}};for(const _ in h)k.props[_]=h[_];for(const _ in x)k.attrs[_]=x[_];for(const[_,$]of Object.entries(C))if(_==="bind")if(typeof $.value=="object"&&$.value!==null)for(const[A,E]of Object.entries($.value))typeof E=="boolean"?k.attrs[A]=E:E!=null&&(k.attrs[A]=String(E));else $.value!=null&&(k.attrs[_]=String($.value));else if(_==="show"){const A=!!$.value;k.attrs.style=(k.attrs.style||"")+(A?"":"; display: none !important")}else if(_==="class"){const A=$.value;let E=[];if(typeof A=="string")E=A.split(/\s+/).filter(Boolean);else if(Array.isArray(A)){for(const L of A)if(typeof L=="string")E.push(...L.split(/\s+/).filter(Boolean));else if(L&&typeof L=="object")for(const[N,M]of Object.entries(L))M&&E.push(...N.split(/\s+/).filter(Boolean))}else if(A&&typeof A=="object")for(const[L,N]of Object.entries(A))N&&E.push(...L.split(/\s+/).filter(Boolean));const B=k.attrs.class||"",O=[...new Set([...B.split(/\s+/).filter(Boolean),...E])];k.attrs.class=O.join(" ")}else if(_==="style"){const A=$.value;let E="";if(typeof A=="string")E=A;else if(A&&typeof A=="object"){const O=[];for(const[L,N]of Object.entries(A))if(N!=null&&N!==""){const M=L.replace(/[A-Z]/g,oe=>`-${oe.toLowerCase()}`),ie=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let Q=String(N);typeof N=="number"&&ie.includes(M)&&(Q=`${N}px`),O.push(`${M}: ${Q}`)}E=O.join("; ")+(O.length>0?";":"")}const B=k.attrs.style||"";k.attrs.style=B+(B&&!B.endsWith(";")?"; ":"")+E}const v={};for(const[_,$]of Object.entries(C))["bind","show","class","style"].includes(_)||(v[_]=$);if(Object.keys(v).length>0&&(k.directives=v),b){const _=P(u,y,a.length===1&&z(a[0])&&a[0].tag==="#text"?typeof a[0].children=="string"?a[0].children:"":a.length?a:void 0,f),$=o.pop();$?(u=$.tag,y=$.props,f=$.key,a=$.children,a.push(_)):c=_}else m?(u?a:p).push(P(l,k,void 0,void 0)):(u&&o.push({tag:u,props:y,children:a,key:f}),u=l,y=k,a=[])}else if(typeof d[3]<"u"){const l=Number(d[3]),b=t[l],m=`interp-${l}`;g(b,m)}else if(d[4]){const l=d[4],b=u?a:p,m=l.split(/({{\d+}})/);for(const h of m){if(!h)continue;const x=h.match(/^{{(\d+)}}$/);if(x){const C=Number(x[1]),k=t[C],v=`interp-${C}`;g(k,v)}else{const C=`text-${w++}`;b.push(n(h,C))}}}if(c)return z(c)&&Array.isArray(c.children)&&(c.children=c.children.filter(l=>z(l)?l.tag!=="#text"||typeof l.children=="string"&&l.children.trim()!=="":!0)),c;if(p.length>0){const l=p.filter(b=>z(b)?b.tag!=="#text"||typeof b.children=="string"&&b.children.trim()!=="":!0);return l.length===1?l[0]:l}return P("div",{},"","fallback-root")}function de(e,...t){const r=t[t.length-1],n=typeof r=="object"&&r&&!Array.isArray(r)?r:void 0;return fe(e,t,n)}function ue(e,t){return H(e?t:[],"when-block")}function he(e,t){return e.map((r,n)=>{const i=typeof r=="object"?r?.key??r?.id??`idx-${n}`:String(r);return H(t(r,n),`each-${i}`)})}function pe(){const e=[];return{when(t,r){return e.push([t,r]),this},otherwise(t){return e.push([!0,t]),this},done(){return ge(...e)}}}function ge(...e){for(let t=0;t<e.length;t++){const[r,n]=e[t];if(r)return[H(n,`whenChain-branch-${t}`)]}return[H([],"whenChain-empty")]}function H(e,t){const r=e?Array.isArray(e)?e.filter(Boolean):[e].filter(Boolean):[];return{tag:"#anchor",key:t,children:r}}function j(e,t){return t.split(".").reduce((r,n)=>r?.[n],e)}function X(e,t,r){const n=t.split("."),i=n.pop();if(!i)return;const s=n.reduce((o,c)=>(c in o||(o[c]={}),o[c]),e);s[i]=r}function me(e,t,r,n,i,s,o){if(!s)return;const c=t.includes("lazy"),d=t.includes("trim"),a=t.includes("number"),u=()=>{const g=s._state||s;return j(g,e)},y=u();let f="text";const w=n?.type;if(o instanceof HTMLInputElement?f=w||o.type||"text":o instanceof HTMLSelectElement?f="select":o instanceof HTMLTextAreaElement&&(f="textarea"),f==="checkbox")if(Array.isArray(y)){const g=o?.getAttribute("value")||n?.value||"",l=y.includes(g);o&&o.checked!==l&&(r.checked=l)}else{const g=o?.getAttribute("true-value")||!0,l=y===g;o&&o.checked!==l&&(r.checked=l)}else if(f==="radio"){const g=n?.value||"",l=y===g;o&&o.checked!==l&&(r.checked=l)}else if(f==="select")if(o&&o.hasAttribute("multiple")){const g=o,l=Array.isArray(y)?y:[];setTimeout(()=>{Array.from(g.options).forEach(b=>{const m=l.includes(b.value);b.selected!==m&&(b.selected=m)})},0)}else setTimeout(()=>{o instanceof HTMLSelectElement&&o.value!==String(y)&&(o.value=String(y))},0);else{const g=String(y??"");(!o||o.value!==g)&&(r.value=y)}const p=c||f==="checkbox"||f==="radio"||f==="select"?"change":"input",S=g=>{if(g.isComposing||i._isComposing||g.isTrusted===!1)return;const l=g.target;if(l._modelUpdating)return;const b=u();let m=l.value;if(f==="checkbox")if(Array.isArray(b)){const k=l.getAttribute("value")||"",v=[...b];if(l.checked)v.includes(k)||v.push(k);else{const _=v.indexOf(k);_>-1&&v.splice(_,1)}m=v}else{const k=l.getAttribute("true-value")||!0,v=l.getAttribute("false-value")||!1;m=l.checked?k:v}else if(f==="radio")m=l.getAttribute("value")||l.value;else if(f==="select"&&l.multiple){const k=l;m=Array.from(k.selectedOptions).map(v=>v.value)}else if(d&&(m=m.trim()),a){const k=Number(m);isNaN(k)||(m=k)}const h=s._state||s,x=j(h,e);if(Array.isArray(m)&&Array.isArray(x)?JSON.stringify([...m].sort())!==JSON.stringify([...x].sort()):m!==x){const k=g.target;k._modelUpdating=!0,X(h,e,m),setTimeout(()=>{k._modelUpdating=!1},0),s._requestRender&&s._requestRender()}};if(i[p]=S,f==="text"||f==="textarea"){const g=()=>{i._isComposing=!0},l=b=>{i._isComposing=!1;const m=b.target;setTimeout(()=>{if(m){let h=m.value;if(d&&(h=h.trim()),a){const v=Number(h);isNaN(v)||(h=v)}const x=s._state||s,C=j(x,e);(Array.isArray(h)&&Array.isArray(C)?JSON.stringify([...h].sort())!==JSON.stringify([...C].sort()):h!==C)&&(m&&(m._modelUpdating=!0,setTimeout(()=>{m._modelUpdating=!1},0)),X(x,e,h),s._requestRender&&s._requestRender())}},0)};i.compositionstart=g,i.compositionend=l}}function ye(e,t,r,n){if(n)try{const i=JSON.parse(e);if(typeof i=="object")for(const[s,o]of Object.entries(i))t[s]=o}catch{const i=j(n,e);r[e]=i}}function be(e,t,r){if(!r)return;const n=j(r,e),i=t.style||"",s=n?"":"none";if(i){const o=i.split(";").filter(Boolean),c=o.findIndex(d=>d.trim().startsWith("display:"));c>=0?o[c]=`display: ${s}`:o.push(`display: ${s}`),t.style=o.join("; ")}else t.style=`display: ${s}`}function xe(e,t,r){if(!r)return;const n=j(r,e);let i=[];typeof n=="string"?i=[n]:Array.isArray(n)?i=n.filter(Boolean):typeof n=="object"&&(i=Object.entries(n).filter(([,c])=>!!c).map(([c])=>c));const s=t.class||"",o=s?`${s} ${i.join(" ")}`.trim():i.join(" ");o&&(t.class=o)}function ve(e,t,r){let n;if(typeof e=="string"){if(!r)return;n=j(r,e)}else n=e;let i="";if(typeof n=="string")i=n;else if(n&&typeof n=="object"){const o=[];for(const[c,d]of Object.entries(n))if(d!=null&&d!==""){const a=c.replace(/[A-Z]/g,f=>`-${f.toLowerCase()}`),u=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let y=String(d);typeof d=="number"&&u.includes(a)&&(y=`${d}px`),o.push(`${a}: ${y}`)}i=o.join("; ")+(o.length>0?";":"")}const s=t.style||"";t.style=s+(s&&!s.endsWith(";")?"; ":"")+i}function re(e,t,r,n){const i={},s={...n||{}},o={};for(const[c,d]of Object.entries(e)){const{value:a,modifiers:u}=d;switch(c){case"model":me(typeof a=="string"?a:String(a),u,i,s,o,t,r);break;case"bind":ye(a,i,s,t);break;case"show":be(a,s,t);break;case"class":xe(a,s,t);break;case"style":ve(a,s,t);break}}return{props:i,attrs:s,listeners:o}}function J(e,t){if(Array.isArray(e)){const s=new Set;return e.map(o=>{if(!o||typeof o!="object")return o;let c=o.props?.key??o.key;if(!c){const y=o.tag||"node",f=o.props?.attrs?.id??o.props?.attrs?.name??o.props?.attrs?.["data-key"]??"";c=f?`${t}:${y}:${f}`:`${t}:${y}`}let d=c,a=1;for(;s.has(d);)d=`${c}#${a++}`;s.add(d);let u=o.children;return Array.isArray(u)&&(u=J(u,d)),{...o,key:d,children:u}})}const r=e;let n=r.props?.key??r.key??t,i=r.children;return Array.isArray(i)&&(i=J(i,n)),{...r,key:n,children:i}}function we(e,t,r,n){const i=r.directives??{},s=re(i,n,e,r.attrs),o={...t.props,...r.props,...s.props},c={...t.attrs,...r.attrs,...s.attrs},d=t.props??{},a=o;for(const f in{...d,...a}){const w=d[f],p=a[f];w!==p&&(f==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)?e.value!==p&&(e.value=p??""):f==="checked"&&e instanceof HTMLInputElement?e.checked=!!p:f.startsWith("on")&&typeof p=="function"?(typeof w=="function"&&e.removeEventListener(f.slice(2).toLowerCase(),w),e.addEventListener(f.slice(2).toLowerCase(),p)):p==null||p===!1?e.removeAttribute(f):e.setAttribute(f,String(p)))}for(const[f,w]of Object.entries(s.listeners||{}))e.addEventListener(f,w);const u=t.attrs??{},y=c;for(const f in{...u,...y}){const w=u[f],p=y[f];w!==p&&(p==null||p===!1?e.removeAttribute(f):e.setAttribute(f,String(p)))}}function T(e,t){if(typeof e=="string")return document.createTextNode(e);if(e.tag==="#text"){const a=document.createTextNode(typeof e.children=="string"?e.children:"");return e.key!=null&&(a.key=e.key),a}if(e.tag==="#anchor"){const a=e,u=Array.isArray(a.children)?a.children:[],y=document.createTextNode(""),f=document.createTextNode("");a.key!=null&&(y.key=`${a.key}:start`,f.key=`${a.key}:end`),a._startNode=y,a._endNode=f;const w=document.createDocumentFragment();w.appendChild(y);for(const p of u)w.appendChild(T(p,t));return w.appendChild(f),w}const r=document.createElement(e.tag);e.key!=null&&(r.key=e.key);const{props:n={},attrs:i={},directives:s={}}=e.props??{},o=re(s,t,r,i),c={...n,...o.props},d={...i,...o.attrs};for(const a in d){const u=d[a];typeof u=="boolean"?u&&r.setAttribute(a,""):u!=null&&r.setAttribute(a,String(u))}for(const a in c){const u=c[a];if(a==="value"&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement))r.value=u??"";else if(a==="checked"&&r instanceof HTMLInputElement)r.checked=!!u;else if(a.startsWith("on")&&typeof u=="function")r.addEventListener(a.slice(2).toLowerCase(),u);else{if(a.startsWith("on")&&u===void 0)continue;u==null||u===!1?r.removeAttribute(a):r.setAttribute(a,String(u))}}for(const[a,u]of Object.entries(o.listeners||{}))r.addEventListener(a,u);if(Array.isArray(e.children))for(const a of e.children)r.appendChild(T(a,t));else typeof e.children=="string"&&(r.textContent=e.children);return r}function ke(e,t,r,n){if(typeof r=="string"){e.textContent!==r&&(e.textContent=r);return}if(!Array.isArray(r))return;const i=Array.from(e.childNodes),s=Array.isArray(t)?t:[],o=new Map;for(const f of s)f&&f.key!=null&&o.set(f.key,f);const c=new Map;for(const f of i){const w=f.key;w!=null&&c.set(w,f)}const d=new Set;let a=e.firstChild;function u(f,w){let p=f;for(;p&&(d.add(p),p!==w);)p=p.nextSibling}function y(f,w,p,S){const g=[];let l=f.nextSibling;for(;l&&l!==w;)g.push(l),l=l.nextSibling;const b=Array.isArray(p)?p:[];if(S.some(h=>h&&h.key!=null)||b.some(h=>h&&h.key!=null)){const h=new Map,x=new Map;for(const v of b)v&&v.key!=null&&h.set(v.key,v);for(const v of g){const _=v.key;_!=null&&x.set(_,v)}const C=new Set;let k=f.nextSibling;for(const v of S){let _;if(v.key!=null&&x.has(v.key)){const $=h.get(v.key);_=I(x.get(v.key),$,v,n),C.add(_),_!==k&&e.contains(_)&&e.insertBefore(_,k)}else _=T(v,n),e.insertBefore(_,k),C.add(_);k=_.nextSibling}for(const v of g)!C.has(v)&&e.contains(v)&&e.removeChild(v)}else{const h=Math.min(b.length,S.length);for(let x=0;x<h;x++){const C=b[x],k=S[x],v=I(g[x],C,k,n);v!==g[x]&&(e.insertBefore(v,g[x]),e.removeChild(g[x]))}for(let x=h;x<S.length;x++)e.insertBefore(T(S[x],n),w);for(let x=h;x<g.length;x++)e.removeChild(g[x])}}for(const f of r){let w;if(f.tag==="#anchor"){const p=f.key,S=`${p}:start`,g=`${p}:end`;let l=c.get(S),b=c.get(g);const m=Array.isArray(f.children)?f.children:[];if(l||(l=document.createTextNode(""),l.key=S),b||(b=document.createTextNode(""),b.key=g),f._startNode=l,f._endNode=b,!e.contains(l)||!e.contains(b)){e.insertBefore(l,a);for(const h of m)e.insertBefore(T(h,n),a);e.insertBefore(b,a)}else y(l,b,o.get(p)?.children,m);u(l,b),a=b.nextSibling;continue}if(f.key!=null&&c.has(f.key)){const p=o.get(f.key);w=I(c.get(f.key),p,f,n),d.add(w),w!==a&&e.contains(w)&&(a&&!e.contains(a)&&(a=null),e.insertBefore(w,a))}else w=T(f,n),a&&!e.contains(a)&&(a=null),e.insertBefore(w,a),d.add(w);a=w.nextSibling}for(const f of i)!d.has(f)&&e.contains(f)&&e.removeChild(f)}function I(e,t,r,n){if(t===r)return e;if(typeof r=="string"){if(e.nodeType===Node.TEXT_NODE)return e.textContent!==r&&(e.textContent=r),e;{const s=document.createTextNode(r);return e.parentNode?.replaceChild(s,e),s}}if(r&&typeof r!="string"&&r.tag==="#anchor"){const s=r,o=Array.isArray(s.children)?s.children:[],c=s._startNode??document.createTextNode(""),d=s._endNode??document.createTextNode("");s.key!=null&&(c.key=`${s.key}:start`,d.key=`${s.key}:end`),s._startNode=c,s._endNode=d;const a=document.createDocumentFragment();a.appendChild(c);for(const u of o)a.appendChild(T(u,n));return a.appendChild(d),e.parentNode?.replaceChild(a,e),c}if(!r){const s=document.createComment("removed");return e.parentNode?.replaceChild(s,e),s}if(!t||typeof t=="string"){const s=T(r,n);return e.parentNode?.replaceChild(s,e),s}if(r.tag==="#anchor"){const s=Array.isArray(r.children)?r.children:[],o=r._startNode??document.createTextNode(""),c=r._endNode??document.createTextNode("");r.key!=null&&(o.key=`${r.key}:start`,c.key=`${r.key}:end`),r._startNode=o,r._endNode=c;const d=document.createDocumentFragment();d.appendChild(o);for(const a of s)d.appendChild(T(a,n));return d.appendChild(c),e.parentNode?.replaceChild(d,e),o}if(typeof t!="string"&&typeof r!="string"&&t.tag===r.tag&&t.key===r.key){const s=e;return we(s,t.props||{},r.props||{},n),ke(s,t.children,r.children,n),s}const i=T(r,n);return e.parentNode?.replaceChild(i,e),i}function _e(e,t,r){const n=a=>a.key==null?{...a,key:"__root__"}:a;let i=Array.isArray(t)?{tag:"div",key:"__root__",children:t}:n(t);i=J(i,String(i.key??"root"));const s=e._prevVNode??null,o=e._prevDom??e.firstChild??null;let c;s&&o?typeof s!="string"&&typeof i!="string"&&s.tag===i.tag&&s.key===i.key?c=I(o,s,i,r):(c=T(i,r),e.replaceChild(c,o)):(c=T(i,r),e.firstChild?e.replaceChild(c,e.firstChild):e.appendChild(c));const d=[];for(let a=0;a<e.childNodes.length;a++){const u=e.childNodes[a];u!==c&&u.nodeName!=="STYLE"&&d.push(u)}d.forEach(a=>e.removeChild(a)),e._prevVNode=i,e._prevDom=c}function $e(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;,>+~])\s*/g,"$1").replace(/;}/g,"}").trim()}const Se=`
|
|
2
|
+
:host {
|
|
3
|
+
box-sizing:border-box;
|
|
4
|
+
line-height:1.5;
|
|
5
|
+
font-family:ui-sans-serif,system-ui,sans-serif;
|
|
6
|
+
-webkit-text-size-adjust:100%;
|
|
7
|
+
text-size-adjust:100%;
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
context.components.forEach(({ tag, state }) => {
|
|
20
|
-
const elements = document.querySelectorAll(tag);
|
|
21
|
-
elements.forEach(el => {
|
|
22
|
-
// Mark as hydrated to prevent re-initialization
|
|
23
|
-
if (!el.hasAttribute('data-hydrated')) {
|
|
24
|
-
el.setAttribute('data-hydrated', 'true');
|
|
25
|
-
// Restore state if component supports it
|
|
26
|
-
if (el._hydrateWithState) {
|
|
27
|
-
el._hydrateWithState(state);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Clean up
|
|
34
|
-
delete window.__SSR_CONTEXT__;
|
|
9
|
+
*,::before,::after {
|
|
10
|
+
box-sizing:inherit;
|
|
11
|
+
margin:0;
|
|
12
|
+
padding:0;
|
|
13
|
+
border:0 solid currentColor;
|
|
35
14
|
}
|
|
36
|
-
<\/script>`.trim()}const st=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),W=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),it=e=>e.replace(/></g,`>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
`);function F(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function j(e,t){if(typeof e!="string"||!t)return String(e);for(const r in t){if(typeof t[r]=="string"&&e===t[r])return F(e);if(Array.isArray(t[r])){for(const n of t[r])if(n&&typeof n=="object"){for(const o in n)if(typeof n[o]=="string"&&e===n[o])return F(e)}}}return String(e)}function T(e,...t){function r(n,o,s){if(Array.isArray(n)){const i=n.map(a=>r(a,o,s));return i.some(a=>a instanceof Promise)?Promise.all(i).then(a=>a.join("")):i.join("")}if(typeof n=="function"){const i=r(n(o,s),o,s);return i instanceof Promise,i}return n==null?"":n instanceof Promise?n:String(n)}return(n,o)=>{let s="",i=!1;const a=[];for(let c=0;c<e.length;c++)if(s+=e[c],c<t.length){let l=t[c];const u=e[c],d=/data-on-[a-z]+="?$/.test(u);l=r(l,n,o),l instanceof Promise?(i=!0,a.push(l)):/=\s*"?$/.test(u)&&typeof l=="string"&&!d?(l=l.replace(/"/g,""").replace(/'/g,"'"),s+=l):!d&&!/=\s*"?$/.test(u)?s+=j(l,n):s+=l}return i?Promise.all(a).then(c=>{let l="",u=0;for(let d=0;d<e.length;d++)if(l+=e[d],d<t.length){let f=t[d];const h=e[d],m=/data-on-[a-z]+="?$/.test(h);f=r(f,n,o),f instanceof Promise?l+=c[u++]:/=\s*"?$/.test(h)&&typeof f=="string"&&!m?(f=f.replace(/"/g,""").replace(/'/g,"'"),l+=f):!m&&!/=\s*"?$/.test(h)?l+=j(f,n):l+=f}return l}):s}}function ot(e,...t){const r="compiled-"+Math.random().toString(36).slice(2);function n(s,i,a){return Array.isArray(s)?s.map(c=>n(c,i,a)).join(""):typeof s=="function"?n(s(i,a),i,a):s==null?"":String(s)}const o=(s,i)=>{let a="";for(let c=0;c<e.length;c++)if(a+=e[c],c<t.length){let l=t[c];const u=e[c],d=/data-on-[a-z]+="?$/.test(u);l=n(l,s,i),/=\s*"?$/.test(u)&&typeof l=="string"&&!d?(l=l.replace(/"/g,""").replace(/'/g,"'"),a+=l):!d&&!/=\s*"?$/.test(u)?a+=j(l,s):a+=l??""}return a};return o.id=r,o}function K(e,...t){let r="";for(let n=0;n<e.length;n++)r+=e[n],n<t.length&&(r+=t[n]??"");return r}function at(e){return Object.keys(e).filter(t=>e[t]).join(" ")}function ct(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join("; ")}function B(e,t,r){const[n,...o]=r.split("|").map(a=>a.trim());if(!n||n==="__proto__"||n==="constructor"||n==="prototype")return;function s(a,c,l){const u=c.split(".");let d=a;for(let f=0;f<u.length-1;f++)u[f]in d||(d[u[f]]={}),d=d[u[f]];d[u[u.length-1]]=l}const i=a=>{let c;if(e instanceof HTMLInputElement&&e.type==="checkbox"){c=e.value;const l=e.getAttribute("data-true-value"),u=e.getAttribute("data-false-value");let d=Array.isArray(t[n])?t[n]:void 0;if(d){if(e.checked)d.includes(c)||d.push(c);else{const f=d.indexOf(c);f!==-1&&d.splice(f,1)}s(t,n,[...d])}else l!==null||u!==null?e.checked?s(t,n,l):s(t,n,u!==null?u:!1):s(t,n,e.checked)}else e instanceof HTMLInputElement&&e.type==="radio"?(c=e.value,s(t,n,c),((e.form||e.closest("form")||e.getRootNode())instanceof Element?(e.form||e.closest("form")||e.getRootNode()).querySelectorAll(`input[type="radio"][name="${e.name}"][data-model="${r}"]`):[]).forEach(u=>{u.checked=u.value===String(c)})):(c=e.value,e instanceof HTMLInputElement&&e.type==="number"&&(c=Number(c)),o.includes("trim")&&typeof c=="string"&&(c=c.trim()),o.includes("number")&&(c=Number(c)),s(t,n,c));if("_vnode"in e&&typeof e._vnode=="object"&&e._vnode?.props&&(e._vnode.props.value=c),a.type==="input"&&(e._isDirty=!0),a.type==="keydown"&&a.key==="Enter"&&(e._isDirty=!1,e instanceof HTMLElement&&e.isConnected)){let l=e.parentElement;for(;l&&!(l instanceof HTMLElement&&l.shadowRoot);)l=l.parentElement;l&&typeof l=="object"&&l!==null&&"render"in l&&typeof l.render=="function"&&l.render()}a.type==="blur"&&(e._isDirty=!1)};e.addEventListener("input",i),e.addEventListener("change",i),e.addEventListener("keydown",i),e.addEventListener("blur",i)}const z=(()=>{try{if(typeof process<"u"&&process.env)return process.env.NODE_ENV==="development"}catch{}return typeof window<"u"?window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1":!1})();function lt(e,t={}){const{development:r=z,cache:n=!0,optimize:o=!0}=t,s=Z(e);if(n&&L.has(s)){if(r){const i=A.get(s)||{compilationTime:0,renderTime:0,updateTime:0,cacheHits:0,cacheMisses:0};i.cacheHits++,A.set(s,i)}return L.get(s)}if(r){const i=A.get(s)||{compilationTime:0,renderTime:0,updateTime:0,cacheHits:0,cacheMisses:0};i.cacheMisses++,A.set(s,i)}try{const i=dt(e,{development:r,optimize:o});return n&&L.set(s,i),i}catch(i){return r&&(console.error("[Template Compiler] Error compiling template:",i),console.error("[Template Compiler] Template:",e)),{statics:[e],dynamics:[],fragment:null,id:s,hasDynamics:!1,render:()=>e}}}function ut(e,t){if(typeof document>"u")return[0];try{let r=function(a,c=[]){if(a.nodeType===Node.TEXT_NODE){if(a.textContent?.includes(t))return c}else if(a.nodeType===Node.ELEMENT_NODE){let l=0;for(let u=0;u<a.childNodes.length;u++){const d=a.childNodes[u],f=r(d,[...c,l]);if(f)return f;l++}}return null};const s=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return r(s)||[0]}catch(r){return z&&console.warn("[Template Compiler] Error finding DOM path for placeholder:",t,r),[0]}}function dt(e,t){return new ft(e,t).compile()}class ft{template;options;dynamics=[];statics=[];constructor(t,r){this.template=t,this.options=r}compile(){this.parseTemplate();const t=this.createStaticFragment(),r=Z(this.template),n=(o,s)=>{let i="";for(let a=0;a<this.statics.length;a++)if(i+=this.statics[a],a<this.dynamics.length){let c=this.dynamics[a].getValue(o,s);if(c instanceof Promise)return Promise.all(this.dynamics.map(l=>{const u=l.getValue(o,s);return u instanceof Promise?u:Promise.resolve(u)})).then(l=>{let u="";for(let d=0;d<this.statics.length;d++)u+=this.statics[d],d<l.length&&(u+=l[d]);return u});i+=c}return i};return{statics:this.statics,dynamics:this.dynamics,fragment:t,id:r,hasDynamics:this.dynamics.length>0,render:n}}parseTemplate(){const t=/\{\{([^}]+)\}\}/g;let r=0,n;for(;(n=t.exec(this.template))!==null;){const s=this.template.slice(r,n.index);this.statics.push(s);let i=s.match(/([a-zA-Z0-9_-]+)\s*=\s*"?$/),a=i?i[1]:void 0,c;if(s.endsWith('style="color:'))a="style",c="color";else if(a==="style"){const u=s.match(/style\s*=\s*"?([^:;]+):\s*$/);u&&(c=u[1].trim())}const l=n[1].trim();this.analyzeDynamicExpression(l,this.dynamics.length,a,c),r=n.index+n[0].length}const o=this.template.slice(r);this.statics.push(o)}analyzeDynamicExpression(t,r,n,o){let s="text",i;n?n==="class"?(s="class",i="class"):n==="style"?(s="style",i=o||"style"):n==="value"?(s="property",i="value"):(s="attribute",i=n):t.includes("class.")?(s="class",i=t.split(".")[1]):t.includes("style.")?(s="style",i=t.split(".")[1]):t.includes("@")?(s="event",i=t.split("@")[1]):t==="class"?(s="class",i="class"):t==="style"?(s="style",i="style"):t==="value"?(s="property",i="value"):t==="title"&&(s="attribute",i="title");const a=`__DYNAMIC_${r}__`,c=this.statics.join(a);let l=ut(c,a);this.statics.length===2&&s!=="text"?l=[0]:this.statics.length===2&&l.length===0&&(l=[0]),this.dynamics.push({path:l,type:s,target:i,getValue:this.createValueGetter(t)})}createValueGetter(t){return(r,n)=>{try{let o;if(t&&typeof t=="function")o=t(r);else if(typeof t=="string"&&t.startsWith("state.")){const s=t.slice(6);o=r[s]}else typeof t=="string"&&/^[a-zA-Z0-9_$]+$/.test(t)?o=r[t]:(typeof t=="string"&&t.includes("("),o="");return o}catch(o){return this.options.development&&console.warn(`[Template Compiler] Error evaluating expression: ${t}`,o),""}}}createStaticFragment(){if(typeof document>"u")return null;try{const t=this.statics.join("");if(!t.trim())return null;const n=new DOMParser().parseFromString(t,"text/html"),o=document.createDocumentFragment();for(;n.body.firstChild;)o.appendChild(n.body.firstChild);return o}catch(t){return this.options.development&&console.warn("[Template Compiler] Could not create static fragment:",t),null}}}function H(e,t){try{if(t.length===1&&t[0]===0&&e instanceof Element)return e;let r=e;for(let n=0;n<t.length;n++){const o=t[n];if(!r.childNodes||r.childNodes.length<=o)return null;r=r.childNodes[o]}return r}catch{return null}}function x(e,t,r){let n;return e.fragment&&!e.hasDynamics?n=e.fragment.cloneNode(!0):n=ht(e,t,r),n}function G(e,t,r,n,o){if(e.hasDynamics)for(const s of e.dynamics)try{const i=s.getValue(r,n);if(o!==void 0&&s.getValue(o,n)===i)continue;V(t,s,i)}catch(i){console.warn("[Template Compiler] Error applying update:",i)}}function ht(e,t,r){let n="";for(let a=0;a<e.statics.length;a++)if(n+=e.statics[a],a<e.dynamics.length){const c=e.dynamics[a];if(c.type==="text"||c.type==="attribute"){const l=c.getValue(t,r);n+=String(l??"")}else(c.type==="property"||c.type==="class"||c.type==="style")&&(n+="")}if(typeof document>"u")return new DocumentFragment;const s=new DOMParser().parseFromString(n,"text/html"),i=document.createDocumentFragment();for(;s.body.firstChild;)i.appendChild(s.body.firstChild);for(const a of e.dynamics){const c=a.getValue(t,r),l=H(i,a.path);V(l,a,c)}return i}function V(e,t,r){try{if(t.type==="text"){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=!1,i;for(;i=o.nextNode();){const c=i.textContent||"";if(c.includes("Count: ")){const l=c.replace(/Count: \d+/,`Count: ${r}`);i.textContent=l,s=!0}}if(s)return;const a=H(e,t.path);a&&a.nodeType===Node.TEXT_NODE&&(a.textContent=r==null?"":String(r));return}const n=H(e,t.path);if(!n)return;switch(t.type){case"attribute":if(n.nodeType===Node.ELEMENT_NODE&&t.target){const o=n;r==null||r===""?o.removeAttribute(t.target):o.setAttribute(t.target,String(r))}break;case"property":n.nodeType===Node.ELEMENT_NODE&&t.target&&(n[t.target]=r??"",n.setAttribute(t.target,r==null?"":String(r)));break;case"class":if(n.nodeType===Node.ELEMENT_NODE&&t.target){const o=n;o.className=r==null?"":String(r),o.setAttribute("class",r==null?"":String(r))}break;case"style":if(n.nodeType===Node.ELEMENT_NODE&&t.target){const o=n;o.style[t.target]=r==null?"":String(r),o.setAttribute("style",r==null?`${t.target}:`:`${t.target}:${r}`)}break;default:throw new Error(`Unknown update type: ${t.type}`)}}catch(n){(typeof globalThis<"u"?globalThis.isDevelopment:z)&&console.warn("[Template Compiler] Error applying update:",t,n)}}const L=new Map,A=new Map;function Z(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return`tpl_${Math.abs(t).toString(36)}`}function N(e,t,r,n,o){return n&&o?`${t}.${e}[${r}]:${n}:${o}`:n?`${t}.${e}[${r}]:${n}`:`${t}.${e}[${r}]`}function D(e,t,r){if(!(!e||!(e instanceof Element))&&e.contains(r)&&r.parentNode===e)try{e.replaceChild(t,r)}catch(n){console.error("[VDOM] safeReplaceChild: error replacing child",n,{parent:e,newChild:t,oldChild:r,parentHTML:e.outerHTML,newChildHTML:t.outerHTML,oldChildHTML:r.outerHTML})}}function y(e){if(e.type==="#whitespace")return null;if(e.type==="#text"){const r=document.createTextNode(e.props.nodeValue??"");return e.dom=r,r}const t=document.createElement(e.type);for(const[r,n]of Object.entries(e.props))r==="value"&&t instanceof HTMLInputElement?t.type==="radio"?t.setAttribute("value",n):(t.type,t.value=n,t.setAttribute("value",n)):t.setAttribute(r,n);e.dom=t;for(const r of e.children){const n=y(r);n&&t.appendChild(n)}return t}function X(e){const t=document.createElement("template");t.innerHTML=e.trim();const r=Array.from(t.content.childNodes);return r.length===1?w(r[0]):{type:"#fragment",key:void 0,props:{},children:r.map((o,s)=>w(o,"#fragment",s)),dom:void 0}}function w(e,t="",r=0){if(!e)return{type:"#unknown",key:void 0,props:{},children:[],dom:void 0};if(e.nodeType===Node.TEXT_NODE)return!e.nodeValue||/^\s*$/.test(e.nodeValue)?{type:"#whitespace",key:void 0,props:{},children:[],dom:void 0}:{type:"#text",key:N("#text",t,r),props:{nodeValue:e.nodeValue},children:[],dom:e};if(e.nodeType===Node.ELEMENT_NODE){const n=e,o={};Array.from(n.attributes).forEach(l=>{o[l.name]=l.value});const s=n.tagName.toLowerCase();let i;if((s==="input"||s==="select"||s==="textarea")&&n.hasAttribute("data-model")){const l=n.getAttribute("data-model"),u=n.getAttribute("type")??"";i=`${s}:${l}:${u}`,o["data-uid"]=i,n.setAttribute("data-uid",i);let d=n.getAttribute("value"),f=n.getAttribute("checked");d&&(o.value=d),f&&(o.checked=f)}else s==="input"||s==="textarea"||s==="select"||n.hasAttribute("contenteditable")?(i=`${s}:${t}:${r}`,o["data-uid"]=i,n.setAttribute("data-uid",i)):(i=N(s,t,r),s==="li"&&(o["data-uid"]=i,n.setAttribute("data-uid",i)));const a=Array.from(n.childNodes).map((l,u)=>w(l,i,u));return{type:s,key:i,props:o,children:a,dom:n}}return{type:"#unknown",key:void 0,props:{},children:[],dom:void 0}}function R(e,t,r){if(!t||!r)return;function n(c){return!!c&&c.type!=="#whitespace"&&!(c.type==="#text"&&(!c.props?.nodeValue||/^\s*$/.test(c.props.nodeValue)))}const o=Array.isArray(t.children)?t.children.filter(n):[],s=Array.isArray(r.children)?r.children.filter(n):[],i=r.type==="input"||r.type==="select"||r.type==="textarea";if(t.type!==r.type||t.key!==r.key){const c=y(r);if(c instanceof Node&&t.dom instanceof Node&&e.contains(t.dom)){if(D(e,c,t.dom),i&&r.props&&e.firstChild instanceof HTMLInputElement){const l=e.firstChild;l.type==="radio"||l.type,l.value=r.props.value,l.setAttribute("value",r.props.value),"checked"in r.props&&(l.checked=r.props.checked===!0||r.props.checked==="true")}}else if(c instanceof Node)if(c){if(e.appendChild(c),r.dom=c,i&&r.props&&e.firstChild instanceof HTMLInputElement){const l=e.firstChild;l.type==="radio"?l.setAttribute("value",r.props.value):(l.type,l.value=r.props.value,l.setAttribute("value",r.props.value)),"checked"in r.props&&(l.checked=r.props.checked===!0||r.props.checked==="true")}}else r.dom=void 0;else r.dom=void 0;return}if(i&&t.dom instanceof HTMLElement&&r.props){for(const[c,l]of Object.entries(r.props))if(c==="value"&&e.firstChild instanceof HTMLInputElement)e.firstChild.value=l;else if(c==="checked"&&e.firstChild instanceof HTMLInputElement)e.firstChild.checked=l===!0||l==="true";else if(c in t.dom)try{t.dom[c]=l}catch{}else t.dom.setAttribute(c,l);for(let c=r.children.length;c<o.length;c++)o[c]&&o[c].dom&&t.dom&&t.dom.contains(o[c].dom)&&t.dom.removeChild(o[c].dom);return}const a=t.dom;if(a&&a instanceof Element&&r.props){const c=a.tagName.toLowerCase()==="input"?a.getAttribute("type"):void 0,l=a.tagName.includes("-");for(const[u,d]of Object.entries(r.props))if(!(c==="radio"&&u==="value")){if(c==="checkbox"&&u==="value"){a.setAttribute("value",d);continue}a.setAttribute(u,d)}if(l)for(const[u,d]of Object.entries(r.props))a.setAttribute(u,d);for(const u of Array.from(a.attributes).map(d=>d.name))if(!(u in r.props)){if(c==="radio"&&u==="value"||c==="checkbox"&&u==="value")continue;a.removeAttribute(u)}}if(r.type==="#text"){if(a&&a.nodeType===Node.TEXT_NODE)a.nodeValue!==r.props.nodeValue&&(a.nodeValue=r.props.nodeValue),r.dom=a;else{const c=document.createTextNode(r.props.nodeValue??"");a&&e.contains(a)&&a.parentNode===e?D(e,c,a):e.appendChild(c),r.dom=c}return}if(a instanceof Element){const c=new Map;o.forEach(f=>f.key&&c.set(f.key,f));const l=new Set(s.map(f=>f.key));let u=[];for(let f=0;f<s.length;f++){const h=s[f],m=h.key?c.get(h.key):o[f];let p;const k=h.type==="input"||h.type==="select"||h.type==="textarea";if(m&&m.dom&&(!k||m.type===h.type&&m.key===h.key))R(a,m,h),p=m.dom;else{const _=y(h);if(p=_ instanceof Node?_:void 0,p){if((p instanceof Element||p instanceof Node)&&p.contains(a))throw console.error("[VDOM] Attempted to insert a parent into its own child:",{parentTag:a.tagName,childTag:p.tagName,parentUid:a.getAttribute?.("data-uid"),childUid:p.getAttribute?.("data-uid"),parent:a,child:p}),new Error("VDOM patch error: Attempted to insert a parent into its own child");a.insertBefore(p,a.childNodes[f]||null)}}h.dom=p,p&&u.push(p)}for(o.forEach(f=>{!l.has(f.key)&&f.dom&&a.contains(f.dom)&&a.removeChild(f.dom)});a.childNodes.length>s.length;)a.removeChild(a.lastChild);for(let f=0;f<u.length;f++)if(a.childNodes[f]!==u[f]){if((u[f]instanceof Element||u[f]instanceof Node)&&u[f].contains(a))throw new Error("VDOM patch error: Attempted to insert a parent into its own child");a.insertBefore(u[f],a.childNodes[f]||null)}r.dom=a;const d=new Set(s.map(f=>f.key));Array.from(a.childNodes).forEach((f,h)=>{const m=f.getAttribute?.("data-uid");(m&&!d.has(m)||h>=s.length)&&a.removeChild(f)})}}const pt=e=>e?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(e)):{},b=(e,t)=>{for(const r of e){const n=[],o=r.path.replace(/:[^/]+/g,a=>(n.push(a.slice(1)),"([^/]+)")),s=new RegExp(`^${o}$`),i=t.match(s);if(i){const a={};return n.forEach((c,l)=>{a[c]=i[l+1]}),{route:r,params:a}}}return{route:null,params:{}}},M={};async function Y(e){if(e.component)return e.component;if(e.load){if(M[e.path])return M[e.path];try{const t=await e.load();return M[e.path]=t.default,t.default}catch{throw new Error(`Failed to load component for route: ${e.path}`)}}throw new Error(`No component or loader defined for route: ${e.path}`)}function J(e){const{routes:t,base:r=""}=e;let n,o,s,i,a,c,l;if(typeof window<"u"&&typeof document<"u"){n=()=>{const d=new URL(window.location.href),f=d.pathname.replace(r,"")||"/",h=pt(d.search);return{path:f,query:h}},o=n();const u=b(t,o.path);s=$({path:o.path,params:u.params,query:o.query}),i=()=>{const d=n(),f=b(t,d.path),h=s.getState();h.path=d.path,h.params=f.params,h.query=d.query},window.addEventListener("popstate",i),a=d=>{window.history.pushState({},"",r+d),i()},c=d=>{window.history.replaceState({},"",r+d),i()},l=()=>window.history.back()}else{n=()=>({path:"/",query:{}}),o=n();const u=b(t,o.path);s=$({path:o.path,params:u.params,query:o.query}),i=()=>{},a=()=>{},c=()=>{},l=()=>{}}return{store:s,push:a,replace:c,back:l,subscribe:s.subscribe,matchRoute:u=>b(t,u),getCurrent:()=>s.getState(),resolveRouteComponent:Y}}function mt(e,t){return b(e,t)}function I(e,t){const r=[],n=t?Object.keys(t):[],o={...e};let s=null;function i(u){return r.push(u),()=>{const d=r.indexOf(u);d!==-1&&r.splice(d,1)}}function a(u){Object.assign(s,u),r.forEach(d=>d(s))}const c=new WeakMap;function l(u){if(c.has(u))return c.get(u);const d=new Proxy(u,{get(f,h,m){if(h==="subscribe")return i;if(h==="set")return a;if(t&&n.includes(h))return t[h](s);const p=Reflect.get(f,h,m);return typeof p=="object"&&p!==null?l(p):p},set(f,h,m,p){if(t&&n.includes(h))return!1;const k=f[h],_=Reflect.set(f,h,m,p);return k!==m&&r.forEach(Q=>Q(s)),_},deleteProperty(f,h){if(t&&n.includes(h))return!1;const m=Reflect.deleteProperty(f,h);return r.forEach(p=>p(s)),m}});return c.set(u,d),d}return s=l(o),s}const E=[];function yt(e){E.push(e)}function v(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e))return e;if(t.add(e),Array.isArray(e))return e.map(o=>v(o,t));Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null&&Object.setPrototypeOf(e,null);const r=["__proto__","constructor","prototype"],n=Object.create(null);for(const o of Object.keys(e))r.includes(o)||(n[o]=v(e[o],t));return n}function S(e){return!!e&&typeof e.then=="function"}let P;typeof HTMLElement<"u"?P=class extends HTMLElement{syncStateToAttributes(){if(!this.stateObj||!this.config?.reflect||!Array.isArray(this.config.reflect))return;const e=["__proto__","constructor","prototype"];this.config.reflect.forEach(t=>{if(e.includes(t)){this.removeAttribute(t);return}const r=this.stateObj[t];["string","number","boolean"].includes(typeof r)?r==null?this.removeAttribute(t):this.setAttribute(t,String(r)):this.removeAttribute(t)})}setTemplate(e){const t=this.config;typeof e=="function"?t.template=e:t.template=()=>e,this.render()}_hasError=!1;_mountedCalled=!1;_unmountedCalled=!1;_autoWiredHandlers={};removeEventListener(e,t,r){super.removeEventListener(e,t,r),this._autoWiredHandlers[e]&&(this._autoWiredHandlers[e]=this._autoWiredHandlers[e].filter(n=>n===t?(super.removeEventListener(e,n,r),!1):!0),this._autoWiredHandlers[e].length===0&&delete this._autoWiredHandlers[e])}static get observedAttributes(){const e=this.stateObj||{};return Object.keys(e).filter(t=>["string","number","boolean"].includes(typeof e[t]))}attributeChangedCallback(e,t,r){if(e==="__proto__"||e==="constructor"||e==="prototype"||!this.stateObj)return;const n=e.replace(/-([a-z])/g,(s,i)=>i.toUpperCase()),o=e in this.stateObj?e:n in this.stateObj?n:null;if(o){const s=typeof this.config?.state?.[o];let i=r;if(r===null)i=void 0;else if(s==="number")if(i===void 0||i==="")i=this.config?.state?.[o];else{const a=Number(i);i=isNaN(a)?this.config?.state?.[o]:a}else s==="boolean"&&(i=i==="true");i=v(i),this.stateObj[o]!==i&&(this.config?.debug&&console.log("[runtime] state update:",{stateKey:o,value:i}),this.stateObj[o]=i,this.render())}}forceSyncControlledInputs(){this.shadowRoot&&(this.shadowRoot.querySelectorAll("input[data-model]").forEach(e=>{const t=e.getAttribute("data-model");if(!t||!this.stateObj||typeof this.stateObj[t]>"u")return;const r=e,n=String(this.stateObj[t]),o=document.activeElement===r;r._hasDirtyListener||(r.addEventListener("input",()=>{r._isDirty=!0}),r.addEventListener("blur",()=>{r._isDirty=!1}),r._hasDirtyListener=!0);const s=!!r._isDirty;o||s||r.type!=="radio"&&r.type!=="checkbox"&&r.value!==n&&(r.value=n)}),this.rebindEventListeners())}syncControlledInputsAndEvents(){this.shadowRoot&&(this.shadowRoot.querySelectorAll('input[type="radio"][data-model]').forEach(e=>{const t=e.getAttribute("data-model");if(!t||!this.stateObj||typeof this.stateObj[t]>"u")return;const r=e,n=String(this.stateObj[t]);r.checked=r.value===n}),this.shadowRoot.querySelectorAll("input[data-model]").forEach(e=>{const t=e.getAttribute("data-model");if(!t||!this.stateObj||typeof this.stateObj[t]>"u")return;const r=e,n=String(this.stateObj[t]);if(r.type==="checkbox"){const o=this.stateObj[t];if(Array.isArray(o))r.checked=o.includes(r.value);else{const s=r.getAttribute("data-true-value"),i=r.getAttribute("data-false-value");s!==null||i!==null?String(o)===s?r.checked=!0:String(o)===i?r.checked=!1:o===!0?r.checked=!0:r.checked=!1:r.checked=o===!0||o==="true"||o===1}}else r.type==="radio"||(r.value=n)}),this.shadowRoot.querySelectorAll("textarea[data-model]").forEach(e=>{const t=e.getAttribute("data-model");!t||!this.stateObj||typeof this.stateObj[t]>"u"||(e.value=String(this.stateObj[t]))}),this.shadowRoot.querySelectorAll("select[data-model]").forEach(e=>{const t=e.getAttribute("data-model");!t||!this.stateObj||typeof this.stateObj[t]>"u"||(e.value=String(this.stateObj[t]))}))}attachListItemModelListeners(){this.shadowRoot&&this.shadowRoot.querySelectorAll("input[data-bind]").forEach(e=>{const t=e.getAttribute("data-bind");if(!t)return;e._listItemModelListener&&(e.removeEventListener("input",e._listItemModelListener),e.removeEventListener("change",e._listItemModelListener),delete e._listItemModelListener);const r=t.match(/^([a-zA-Z0-9_]+)\[(\d+)\]\.([a-zA-Z0-9_]+)$/);if(r){const[,o,s,i]=r,a=parseInt(s,10),c=this.stateObj[o];e instanceof HTMLInputElement&&e.type==="checkbox"&&(e.checked=!!(Array.isArray(c)&&c[a]&&c[a][i]));const l=u=>{!Array.isArray(c)||!c[a]||(e instanceof HTMLInputElement&&e.type==="checkbox"?c[a][i]=e.checked:c[a][i]=e.value)};e.addEventListener("input",l),e.addEventListener("change",l),e._listItemModelListener=l;return}const n=t.match(/^([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)((?:\|[a-zA-Z0-9_]+)*)$/);if(n){const[,o,s,i]=n,a=this.stateObj[o],c=i?i.split("|").map(u=>u.trim()).filter(Boolean):[];e instanceof HTMLInputElement&&e.type==="checkbox"?e.checked=!!(a&&a[s]):e instanceof HTMLInputElement&&(e.value=a?String(a[s]??""):"");const l=u=>{if(!a)return;let d;e instanceof HTMLInputElement&&e.type==="checkbox"?d=e.checked:(d=e.value,c.includes("number")&&(d=Number(d)),c.includes("trim")&&typeof d=="string"&&(d=d.trim())),a[s]=d};e.addEventListener("input",l),e.addEventListener("change",l),e._listItemModelListener=l}})}attachControlledInputListeners(){const e=this.shadowRoot;e&&(e.querySelectorAll("[data-model]").forEach(t=>{const r=t.getAttribute("data-model");r&&(t._dataModelBound||(B(t,this.stateObj,r),t._dataModelBound=!0))}),e.querySelectorAll("[data-model]").forEach(t=>{const[r]=t.getAttribute("data-model")?.split("|").map(n=>n.trim())??[];if(!(!r||!(r in this.stateObj)))if(t instanceof HTMLInputElement)if(t.type==="checkbox"){const n=this.stateObj[r],o=t.getAttribute("data-true-value"),s=t.getAttribute("data-false-value");Array.isArray(n)?t.checked=n.includes(t.value):o!==null||s!==null?String(n)===o?t.checked=!0:String(n)===s?t.checked=!1:n===!0?t.checked=!0:t.checked=!1:t.checked=n===!0||n==="true"||n===1}else t.type==="radio"?t.checked=t.value===String(this.stateObj[r]):t.value=String(this.stateObj[r]??"");else(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t.value=String(this.stateObj[r]??""))}))}config;stateObj;api;_globalUnsubscribes=[];unsubscribes=[];lastCompiledTemplate=null;lastState=null;rafId=null;constructor(){super()}initializeConfig(){if(this.config)return;const e=this.tagName.toLowerCase(),r=(window.__componentRegistry||{})[e];if(!r||typeof r!="object")throw new Error("Invalid component config: must be an object");if(!r.state||typeof r.state!="object")throw new Error("Invalid component config: state must be an object");this.config=r;const n=r.computed?I(r.state,r.computed):I(r.state);if(this.stateObj=n,typeof this.stateObj.subscribe=="function"&&this.unsubscribes.push(this.stateObj.subscribe(()=>{this.scheduleRender()})),this.api={state:this.stateObj,emit:(s,i)=>this.dispatchEvent(new CustomEvent(s,{detail:i,bubbles:!0})),onGlobal:(s,i)=>{const a=C.on(s,i);return this._globalUnsubscribes.push(a),a},offGlobal:(s,i)=>C.off(s,i),emitGlobal:(s,i)=>C.emit(s,i),render:()=>this.render()},Object.keys(this.config).forEach(s=>{if(s.startsWith("on")&&s.length>2&&typeof this.config[s]=="function"){const i=s.charAt(2).toLowerCase()+s.slice(3),a=c=>{const l=c.detail??c;this.config[s](l,this.api.state,this.api)};this.addEventListener(i,a),this._autoWiredHandlers[i]||(this._autoWiredHandlers[i]=[]),this._autoWiredHandlers[i].push(a)}}),this.attachShadow({mode:"open"}),r.style){const s=document.createElement("style");s.textContent=typeof r.style=="function"?r.style(this.stateObj):r.style,this.shadowRoot.appendChild(s)}if(typeof this.config.hydrate=="function"){const s=this.shadowRoot?.querySelectorAll("[data-hydrate]");try{s&&s.length>0?s.forEach(i=>{try{this.config.hydrate(i,this.stateObj,this.api)}catch(a){typeof this.config.onError=="function"&&this.config.onError(a instanceof Error?a:new Error(String(a)),this.api.state,this.api),this._handleRenderError(a)}}):this.config.hydrate(this.shadowRoot,this.stateObj,this.api)}catch(i){typeof this.config.onError=="function"&&this.config.onError(i instanceof Error?i:new Error(String(i)),this.api.state,this.api),this._handleRenderError(i)}}if(this.hasAttribute("data-hydrated")?this.processRefs():this.render(),!this._mountedCalled&&typeof this.config.onMounted=="function")try{const s=this.config.onMounted(this.api.state,this.api);S(s)?s.catch(i=>{typeof this.config.onError=="function"&&this.config.onError(i,this.api.state,this.api),this._handleRenderError(i)}).finally(()=>{this._mountedCalled=!0}):this._mountedCalled=!0}catch(s){typeof this.config.onError=="function"&&this.config.onError(s,this.api.state,this.api),this._handleRenderError(s),this._mountedCalled=!0}}connectedCallback(){if(this.initializeConfig(),this.stateObj)for(const e of this.getAttributeNames()){const r=e.replace(/-([a-z])/g,(n,o)=>o.toUpperCase());if(r in this.stateObj){const n=typeof this.config?.state?.[r];let o=this.getAttribute(e);n==="number"?o=Number(o):n==="boolean"&&(o=o==="true"),this.stateObj[r]=o===null?void 0:o}}if(!this._mountedCalled&&typeof this.config.onMounted=="function")try{const e=this.config.onMounted(this.api.state,this.api);S(e)?e.catch(t=>{typeof this.config.onError=="function"&&this.config.onError(t,this.api.state,this.api),this._handleRenderError(t)}).finally(()=>{this._mountedCalled=!0}):this._mountedCalled=!0}catch(e){typeof this.config.onError=="function"&&this.config.onError(e,this.api.state,this.api),this._handleRenderError(e),this._mountedCalled=!0}typeof this.render=="function"&&this.render()}disconnectedCallback(){if(Object.entries(this._autoWiredHandlers).forEach(([e,t])=>{t.forEach(r=>{super.removeEventListener(e,r)})}),this._autoWiredHandlers={},this.unsubscribes.forEach(e=>e()),this.unsubscribes=[],this._globalUnsubscribes.forEach(e=>e()),this._globalUnsubscribes=[],!this._unmountedCalled&&typeof this.config.onUnmounted=="function")try{const e=this.config.onUnmounted(this.api.state,this.api);S(e)?e.catch(t=>{typeof this.config.onError=="function"&&this.config.onError(t,this.api.state,this.api),this._handleRenderError(t)}).finally(()=>{this._unmountedCalled=!0}):this._unmountedCalled=!0}catch(e){typeof this.config.onError=="function"&&this.config.onError(e,this.api.state,this.api),this._handleRenderError(e),this._unmountedCalled=!0}this._mountedCalled=!1,this._unmountedCalled=!1}render(){this._hasError=!1,this.syncControlledInputsAndEvents(),setTimeout(()=>this.attachControlledInputListeners(),0);try{E.forEach(t=>{try{t.onRender?.(this.stateObj,this.api)}catch(r){this._handleRenderError(r)}}),this.config.computed&&Object.values(this.config.computed).forEach(t=>{try{t(this.stateObj)}catch(r){this._handleRenderError(r)}});const e=this.config.template(this.stateObj,this.api);e instanceof Promise?e.then(t=>{this._hasError||(this._renderTemplateResult(t),this.syncStateToAttributes(),setTimeout(()=>this.attachListItemModelListeners(),0))}).catch(t=>{this._handleRenderError(t)}):this._hasError||(this._renderTemplateResult(e),this.syncStateToAttributes(),setTimeout(()=>this.attachListItemModelListeners(),0))}catch(e){this._handleRenderError(e),this.renderError(e instanceof Error?e:new Error(String(e)))}}_prevVNode=null;rebindEventListeners(){if(!this.shadowRoot)return;["data-on-input","data-on-change","data-on-blur","data-on-click"].forEach(t=>{this.shadowRoot.querySelectorAll(`[${t}]`).forEach(r=>{const n=t.replace("data-on-",""),o=r.getAttribute(t);if(!o||typeof this.config[o]!="function")return;r._boundHandlers&&r._boundHandlers[n]&&r.removeEventListener(n,r._boundHandlers[n]);const s=this.config[o],i=a=>s.call(this,a,this.stateObj,this.api);r.addEventListener(n,i),r._boundHandlers||(r._boundHandlers={}),r._boundHandlers[n]=i})}),Array.from(this.shadowRoot.children).forEach(t=>{t instanceof HTMLElement&&typeof t.rebindEventListeners=="function"&&t.rebindEventListeners()})}_renderTemplateResult(e){if(!this._hasError)try{let t=function(r){const n=new WeakSet;function o(s){if(s===null||typeof s!="object"||n.has(s))return s;if(n.add(s),Array.isArray(s))return s.map(o);const i={};for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=o(s[a]));return i}return o(r)};if(typeof e=="string"){let r=function(c){return c.replace(/<([a-zA-Z0-9]+)([^>]*)>/g,(l,u,d)=>{const f=d.replace(/\s+on[a-zA-Z]+\s*=\s*(['"][^'"]*['"]|[^\s>]*)/gi,"");return`<${u}${f}>`})},n=function(c){c.children.forEach(n)};const o=r(e),s=X(o);n(s);const i=this.shadowRoot;if(!i)return;let a=i.querySelector("style");if(a||(a=document.createElement("style"),i.appendChild(a)),this.config.style?a.textContent=typeof this.config.style=="function"?this.config.style(this.stateObj):this.config.style:a.textContent="",s.type==="#fragment"){const c=Array.from(i.childNodes).find(l=>l.nodeType===1&&l!==a);if(c){Array.from(c.childNodes).forEach(d=>{d.nodeType===1&&d.nodeName==="STYLE"||c.removeChild(d)});const l={type:"#fragment",dom:c,children:s.children,props:{},key:void 0},u=this._prevVNode&&this._prevVNode.type==="#fragment"?{...this._prevVNode,dom:c}:l;R(c,u,l)}else s.children.forEach(l=>{const u=y(l);u&&i.appendChild(u),l.dom=u??void 0})}else{let c=Array.from(this.shadowRoot.childNodes).find(l=>l!==a&&l.nodeType===1);if(c)if(this._prevVNode&&(this._prevVNode.type!==s.type||this._prevVNode.key!==s.key)){const l=y(s);l&&(this.shadowRoot.contains(c)&&this.shadowRoot.replaceChild(l,c),c=l)}else R(c,this._prevVNode,s);else c=y(s),c&&this.shadowRoot.appendChild(c);s.dom=c}this._prevVNode=s,this.forceSyncControlledInputs(),this.lastCompiledTemplate=null}else{const r=!this.shadowRoot.firstElementChild,n=this.lastCompiledTemplate?.id===e.id;if(r){const o=x(e,this.stateObj,this.api);this.shadowRoot.appendChild(o)}else if(n&&this.shadowRoot.firstElementChild){const o=this.lastState;G(e,this.shadowRoot.firstElementChild,this.stateObj,this.api,o||void 0)}else{const o=x(e,this.stateObj,this.api);let s=this.shadowRoot.querySelector("style");s||(s=document.createElement("style"),this.shadowRoot.insertBefore(s,this.shadowRoot.firstChild)),this.config.style?s.textContent=typeof this.config.style=="function"?this.config.style(this.stateObj):this.config.style:s.textContent="";let i=this.shadowRoot.querySelector("[data-root]");for(i||(i=document.createElement("div"),i.setAttribute("data-root",""),this.shadowRoot.appendChild(i));i.firstChild;)i.removeChild(i.firstChild);i.appendChild(o)}this.lastCompiledTemplate=e}this.lastState=t(this.stateObj),this.updateStyle(),this.processRefs(),this.bindEvents(),this.syncControlledInputsAndEvents()}catch(t){this._handleRenderError(t)}}_handleRenderError(e){if(this._hasError=!0,this.config.debug&&console.error(`[runtime] Render error in <${this.tagName.toLowerCase()}>:`,e),E.forEach(t=>t.onError?.(e instanceof Error?e:new Error(String(e)),this.stateObj,this.api)),"onError"in this.config&&typeof this.config.onError=="function")try{this.config.onError(e instanceof Error?e:new Error(String(e)),this.api.state,this.api)}catch(t){this.config.debug&&console.error("[runtime] Error in onError handler:",t)}this.renderError(e instanceof Error?e:new Error(String(e)))}scheduleRender(){this.rafId!==void 0&&this.rafId!==null&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.render(),this.rafId=null})}updateStyle(){const e=this.shadowRoot.querySelector("style");if(!e||!this.config.style)return;const t=typeof this.config.style=="function"?this.config.style(this.api.state):this.config.style;e.textContent=t}processRefs(){if(!this.config.refs)return;const e=new WeakMap;Object.entries(this.config.refs).forEach(([t,r])=>{const n=this.shadowRoot.querySelector(`[data-ref="${t}"]`);if(n){e.has(n)||e.set(n,new Set);const o=e.get(n),s=n.addEventListener;n.addEventListener=function(i,a,c){const l=`${i}`;o.has(l)||(o.add(l),s.call(n,i,a,c))},n.setAttribute("data-refs-processed","true");try{r(n,this.api.state,this.api)}catch(i){this._handleRenderError(i)}}})}bindEvents(){if(!this.shadowRoot)return;const e=document.createTreeWalker(this.shadowRoot,NodeFilter.SHOW_ELEMENT);let t=e.nextNode();for(;t;){const r=t;Array.from(r.attributes).forEach(n=>{if(n.name.startsWith("data-on-")){const o=n.name.slice(8),s=n.value,i=this.config[s];if(typeof i=="function"){r._boundHandlers&&r._boundHandlers[o]&&r.removeEventListener(o,r._boundHandlers[o]);const a=c=>{i.call(this.config,c,this.api.state,this.api),this.syncControlledInputsAndEvents()};r.addEventListener(o,a),r._boundHandlers||(r._boundHandlers={}),r._boundHandlers[o]=a}else this.config.debug&&console.warn(`[runtime] Handler '${s}' not found on config for event '${o}'`,r)}}),t=e.nextNode()}}renderError(e){const t=this.config.style?typeof this.config.style=="function"?this.config.style(this.api.state):this.config.style:"";this.shadowRoot.innerHTML=`
|
|
40
|
-
<style>${t}</style>
|
|
41
|
-
<div style="color: red; border: 1px solid red; padding: 1rem; border-radius: 4px;">
|
|
42
|
-
<h3>Error Boundary</h3>
|
|
43
|
-
<div>Error: ${e.message}</div>
|
|
44
|
-
</div>
|
|
45
|
-
`}}:P=class{constructor(){}};function q(e,t){if(t=v(t),t.debug&&console.log(`[runtime] Debugging component: ${e}`,t),!e||!t.template){t&&typeof t.onError=="function"&&t.onError(new Error("Component requires tag and template"),t.state??{},{state:t.state??{},emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Malformed config:",{tag:e,config:t});return}E.forEach(u=>{try{u.onInit?.(t)}catch(d){t&&typeof t.onError=="function"&&t.onError(d instanceof Error?d:new Error(String(d)),t.state,{state:t.state,emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Plugin onInit error:",d)}});const n=typeof window<"u"&&window.VITE_DEV_HMR,o=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:O&&O.tagName.toUpperCase()==="SCRIPT"&&O.src||new URL("custom-elements-runtime.cjs.js",document.baseURI).href}<"u"&&void 0;if((n||o)&&typeof customElements<"u"&&customElements.get(e))try{document.querySelectorAll(e).forEach(u=>u.remove()),window.customElements._definitions&&delete window.customElements._definitions[e]}catch{}if(typeof customElements<"u"&&customElements.get(e)){t.debug&&console.warn(`[runtime] Component "${e}" already registered`);return}const s=I(t.state??{},t.computed);t.state=s,t._subscribe=s.subscribe;const i=t.state??{},a=Object.keys(i).filter(u=>["string","number","boolean"].includes(typeof i[u]));class c extends P{static get observedAttributes(){return a}constructor(){super()}}const l=c;typeof customElements<"u"&&!customElements.get(e)&&(window.__componentRegistry=window.__componentRegistry||{},window.__componentRegistry[e]=t,customElements.define(e,l))}function gt(e){const t=J(e);return q("router-view",{template:async()=>{if(!t)return"<div>Router not initialized.</div>";const r=t.getCurrent(),{path:n}=r,o=t.matchRoute(n);return o.route?(o.route.load&&await o.route.load(),`<${o.route.component}></${o.route.component}>`):"<div>Not found</div>"},onMounted(r,n){t&&typeof t.subscribe=="function"&&t.subscribe(()=>{n.render()})}}),q("router-link",{state:{to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,style:K`
|
|
46
|
-
[aria-disabled="true"] {
|
|
47
|
-
pointer-events: none;
|
|
48
|
-
opacity: 0.5;
|
|
49
|
-
}
|
|
50
|
-
`},computed:{current(){return t.getCurrent()},isExactActive(r){return r.current.path===r.to},isActive(r){const n=r.current;return r.exact?r.isExactActive:n&&typeof n.path=="string"?n.path.startsWith(r.to):!1},className(r){return r.isExactActive?r.exactActiveClass:r.isActive?r.activeClass:""},ariaCurrent(r){return r.isExactActive?`aria-current="${r.ariaCurrentValue}"`:""},isButton(r){return r.tag==="button"},disabledAttr(r){return r.disabled?r.isButton?'disabled aria-disabled="true" tabindex="-1"':'aria-disabled="true" tabindex="-1"':""},externalAttr(r){return r.external&&(r.tag==="a"||!r.tag)?'target="_blank" rel="noopener noreferrer"':""}},reflect:["to","tag","replace","exact","activeClass","exactActiveClass","ariaCurrentValue","disabled","external","style"],style:r=>r.style,template:r=>T`
|
|
51
|
-
${r.isButton?T`
|
|
52
|
-
<button
|
|
53
|
-
part="button"
|
|
54
|
-
class="${r.className}"
|
|
55
|
-
${r.ariaCurrent}
|
|
56
|
-
${r.disabledAttr}
|
|
57
|
-
${r.externalAttr}
|
|
58
|
-
data-on-click="navigate"
|
|
59
|
-
><slot></slot></button>
|
|
60
|
-
`(r):T`
|
|
61
|
-
<a
|
|
62
|
-
part="link"
|
|
63
|
-
href="${r.to}"
|
|
64
|
-
class="${r.className}"
|
|
65
|
-
${r.ariaCurrent}
|
|
66
|
-
${r.disabledAttr}
|
|
67
|
-
${r.externalAttr}
|
|
68
|
-
data-on-click="navigate"
|
|
69
|
-
><slot></slot></a>
|
|
70
|
-
`(r)}
|
|
71
|
-
`(r),navigate:(r,n)=>{if(n.disabled){r.preventDefault();return}n.external&&(n.tag==="a"||!n.tag)||(r.preventDefault(),n.replace?t.replace(n.to):t.push(n.to))}}),t}exports.Store=$;exports.classes=at;exports.compile=ot;exports.compileTemplate=lt;exports.component=q;exports.createVNodeFromElement=w;exports.css=K;exports.deepSanitizeObject=v;exports.eventBus=C;exports.generateHydrationScript=nt;exports.getVNodeKey=N;exports.html=T;exports.initRouter=gt;exports.isPromise=S;exports.matchRouteSSR=mt;exports.mountVNode=y;exports.parseVNodeFromHTML=X;exports.patchVNode=R;exports.renderCompiledTemplate=x;exports.renderComponentsToString=rt;exports.renderToString=U;exports.resolveRouteComponent=Y;exports.runtimePlugins=E;exports.safeReplaceChild=D;exports.styles=ct;exports.updateCompiledTemplate=G;exports.useDataModel=B;exports.useRouter=J;exports.useRuntimePlugin=yt;
|
|
15
|
+
`,Ce={gray:{50:"var(--color-gray-50, #f9fafb)",100:"var(--color-gray-100, #f3f4f6)",200:"var(--color-gray-200, #e5e7eb)",300:"var(--color-gray-300, #d1d5db)",400:"var(--color-gray-400, #9ca3af)",500:"var(--color-gray-500, #6b7280)",600:"var(--color-gray-600, #4b5563)",700:"var(--color-gray-700, #374151)",800:"var(--color-gray-800, #1f2937)",900:"var(--color-gray-900, #111827)"},slate:{50:"var(--color-slate-50, #f8fafc)",100:"var(--color-slate-100, #f1f5f9)",200:"var(--color-slate-200, #e2e8f0)",300:"var(--color-slate-300, #cbd5e1)",400:"var(--color-slate-400, #94a3b8)",500:"var(--color-slate-500, #64748b)",600:"var(--color-slate-600, #475569)",700:"var(--color-slate-700, #334155)",800:"var(--color-slate-800, #1e293b)",900:"var(--color-slate-900, #0f172a)"},zinc:{50:"var(--color-zinc-50, #fafafa)",100:"var(--color-zinc-100, #f4f4f5)",200:"var(--color-zinc-200, #e4e4e7)",300:"var(--color-zinc-300, #d4d4d8)",400:"var(--color-zinc-400, #a1a1aa)",500:"var(--color-zinc-500, #71717a)",600:"var(--color-zinc-600, #52525b)",700:"var(--color-zinc-700, #3f3f46)",800:"var(--color-zinc-800, #27272a)",900:"var(--color-zinc-900, #18181b)"},red:{50:"var(--color-red-50, #fef2f2)",100:"var(--color-red-100, #fee2e2)",200:"var(--color-red-200, #fecaca)",300:"var(--color-red-300, #fca5a5)",400:"var(--color-red-400, #f87171)",500:"var(--color-red-500, #ef4444)",600:"var(--color-red-600, #dc2626)",700:"var(--color-red-700, #b91c1c)",800:"var(--color-red-800, #991b1b)",900:"var(--color-red-900, #7f1d1d)"},blue:{50:"var(--color-blue-50, #eff6ff)",100:"var(--color-blue-100, #dbeafe)",200:"var(--color-blue-200, #bfdbfe)",300:"var(--color-blue-300, #93c5fd)",400:"var(--color-blue-400, #60a5fa)",500:"var(--color-blue-500, #3b82f6)",600:"var(--color-blue-600, #2563eb)",700:"var(--color-blue-700, #1d4ed8)",800:"var(--color-blue-800, #1e40af)",900:"var(--color-blue-900, #1e3a8a)"},green:{50:"var(--color-green-50, #f0fdf4)",100:"var(--color-green-100, #dcfce7)",200:"var(--color-green-200, #bbf7d0)",300:"var(--color-green-300, #86efac)",400:"var(--color-green-400, #4ade80)",500:"var(--color-green-500, #22c55e)",600:"var(--color-green-600, #16a34a)",700:"var(--color-green-700, #15803d)",800:"var(--color-green-800, #166534)",900:"var(--color-green-900, #14532d)"},amber:{50:"var(--color-amber-50, #fffbeb)",100:"var(--color-amber-100, #fef3c7)",200:"var(--color-amber-200, #fde68a)",300:"var(--color-amber-300, #fcd34d)",400:"var(--color-amber-400, #fbbf24)",500:"var(--color-amber-500, #f59e0b)",600:"var(--color-amber-600, #d97706)",700:"var(--color-amber-700, #b45309)",800:"var(--color-amber-800, #92400e)",900:"var(--color-amber-900, #78350f)"},indigo:{50:"var(--color-indigo-50, #eef2ff)",100:"var(--color-indigo-100, #e0e7ff)",200:"var(--color-indigo-200, #c7d2fe)",300:"var(--color-indigo-300, #a5b4fc)",400:"var(--color-indigo-400, #818cf8)",500:"var(--color-indigo-500, #6366f1)",600:"var(--color-indigo-600, #4f46e5)",700:"var(--color-indigo-700, #4338ca)",800:"var(--color-indigo-800, #3730a3)",900:"var(--color-indigo-900, #312e81)"},emerald:{50:"var(--color-emerald-50, #ecfdf5)",100:"var(--color-emerald-100, #d1fae5)",200:"var(--color-emerald-200, #a7f3d0)",300:"var(--color-emerald-300, #6ee7b7)",400:"var(--color-emerald-400, #34d399)",500:"var(--color-emerald-500, #10b981)",600:"var(--color-emerald-600, #059669)",700:"var(--color-emerald-700, #047857)",800:"var(--color-emerald-800, #065f46)",900:"var(--color-emerald-900, #064e3b)"},rose:{50:"var(--color-rose-50, #fff1f2)",100:"var(--color-rose-100, #ffe4e6)",200:"var(--color-rose-200, #fecdd3)",300:"var(--color-rose-300, #fda4af)",400:"var(--color-rose-400, #fb7185)",500:"var(--color-rose-500, #f43f5e)",600:"var(--color-rose-600, #e11d48)",700:"var(--color-rose-700, #be123c)",800:"var(--color-rose-800, #9f1239)",900:"var(--color-rose-900, #881337)"},white:{DEFAULT:"var(--color-white, #ffffff)"},black:{DEFAULT:"var(--color-black, #000000)"}},W={block:"display:block;",inline:"display:inline;","inline-block":"display:inline-block;",flex:"display:flex;","inline-flex":"display:inline-flex;",grid:"display:grid;",hidden:"display:none;","sr-only":"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;","not-sr-only":"position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal;","grid-cols-1":"grid-template-columns:repeat(1,minmax(0,1fr));","grid-cols-2":"grid-template-columns:repeat(2,minmax(0,1fr));","grid-cols-3":"grid-template-columns:repeat(3,minmax(0,1fr));","grid-cols-4":"grid-template-columns:repeat(4,minmax(0,1fr));","grid-cols-5":"grid-template-columns:repeat(5,minmax(0,1fr));","grid-cols-6":"grid-template-columns:repeat(6,minmax(0,1fr));","grid-cols-12":"grid-template-columns:repeat(12,minmax(0,1fr));","grid-rows-1":"grid-template-rows:repeat(1,minmax(0,1fr));","grid-rows-2":"grid-template-rows:repeat(2,minmax(0,1fr));","grid-rows-3":"grid-template-rows:repeat(3,minmax(0,1fr));","grid-rows-4":"grid-template-rows:repeat(4,minmax(0,1fr));","grid-rows-6":"grid-template-rows:repeat(6,minmax(0,1fr));","grid-rows-12":"grid-template-rows:repeat(12,minmax(0,1fr));","col-span-1":"grid-column:span 1 / span 1;","col-span-2":"grid-column:span 2 / span 2;","col-span-3":"grid-column:span 3 / span 3;","col-span-4":"grid-column:span 4 / span 4;","col-span-5":"grid-column:span 5 / span 5;","col-span-6":"grid-column:span 6 / span 6;","col-span-12":"grid-column:span 12 / span 12;","row-span-1":"grid-row:span 1 / span 1;","row-span-2":"grid-row:span 2 / span 2;","row-span-3":"grid-row:span 3 / span 3;","row-span-4":"grid-row:span 4 / span 4;","row-span-6":"grid-row:span 6 / span 6;","row-span-12":"grid-row:span 12 / span 12;",absolute:"position:absolute;",relative:"position:relative;",fixed:"position:fixed;",sticky:"position:sticky;","font-bold":"font-weight:700;","font-semibold":"font-weight:600;","font-medium":"font-weight:500;","font-light":"font-weight:300;",underline:"text-decoration-line:underline;",overline:"text-decoration-line:overline;","line-through":"text-decoration-line:line-through;","no-underline":"text-decoration-line:none;",italic:"font-style:italic;","not-italic":"font-style:normal;",uppercase:"text-transform:uppercase;",lowercase:"text-transform:lowercase;",capitalize:"text-transform:capitalize;","normal-case":"text-transform:none;","text-left":"text-align:left;","text-center":"text-align:center;","text-right":"text-align:right;","text-xs":"font-size:0.75rem;line-height:calc(1 / 0.75)","text-sm":"font-size:0.875rem;line-height:calc(1.25 / 0.875)","text-base":"font-size:1rem;line-height:calc(1.5 / 1)","text-lg":"font-size:1.125rem;line-height:calc(1.75 / 1.125)","text-xl":"font-size:1.25rem;line-height:calc(1.75 / 1.25)","text-2xl":"font-size:1.5rem;line-height:calc(2 / 1.5)","text-3xl":"font-size:1.875rem;line-height:calc(2.25 / 1.875)","text-4xl":"font-size:2.25rem;line-height:calc(2.5 / 2.25)","text-5xl":"font-size:3rem;line-height:1","text-6xl":"font-size:3.75rem;line-height:1","text-7xl":"font-size:4.5rem;line-height:1","text-8xl":"font-size:6rem;line-height:1",border:"border-width:1px;","rounded-none":"border-radius:0;","rounded-xs":"border-radius:0.125rem;","rounded-sm":"border-radius:0.25rem;","rounded-md":"border-radius:0.375rem;","rounded-lg":"border-radius:0.5rem;","rounded-full":"border-radius:9999px;","ring-0":"box-shadow:none;","ring-1":"box-shadow:0 0 0 1px rgba(59,130,246,0.5);","ring-2":"box-shadow:0 0 0 2px rgba(59,130,246,0.5);","ring-4":"box-shadow:0 0 0 4px rgba(59,130,246,0.5);","ring-8":"box-shadow:0 0 0 8px rgba(59,130,246,0.5);","shadow-none":"box-shadow:0 0 #0000;","shadow-xs":"box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);","shadow-sm":"box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);","shadow-md":"box-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);","shadow-lg":"box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);","shadow-xl":"box-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);","shadow-2xl":"box-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);",transition:"transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4,0,0.2,1);",truncate:"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",visible:"visibility:visible;",invisible:"visibility:hidden;",grow:"flex-grow:1;",shrink:"flex-shrink:1;","grow-0":"flex-grow:0;","shrink-0":"flex-shrink:0;","font-sans":"font-family:ui-sans-serif,system-ui,sans-serif;","font-serif":"font-family:ui-serif,Georgia,serif;","font-mono":"font-family:ui-monospace,SFMono-Regular,monospace;","line-clamp-1":"display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-2":"display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-3":"display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-4":"display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;","transition-colors":"transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;","transition-opacity":"transition-property:opacity;","transition-transform":"transition-property:transform;"},Ae="0.25rem",Y={m:["margin"],mx:["margin-inline"],my:["margin-block"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],p:["padding"],px:["padding-inline"],py:["padding-block"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],inset:["inset"],"inset-x":["inset-inline"],"inset-y":["inset-block"],top:["top"],bottom:["bottom"],left:["left"],right:["right"],gap:["gap"],"gap-x":["column-gap"],"gap-y":["row-gap"]},Ee={before:(e,t)=>`${e}::before{${t}}`,after:(e,t)=>`${e}::after{${t}}`,hover:(e,t)=>`${e}:hover{${t}}`,focus:(e,t)=>`${e}:focus{${t}}`,active:(e,t)=>`${e}:active{${t}}`,disabled:(e,t)=>`${e}:disabled{${t}}`,visited:(e,t)=>`${e}:visited{${t}}`,checked:(e,t)=>`${e}:checked{${t}}`,first:(e,t)=>`${e}:first-child{${t}}`,last:(e,t)=>`${e}:last-child{${t}}`,odd:(e,t)=>`${e}:nth-child(odd){${t}}`,even:(e,t)=>`${e}:nth-child(even){${t}}`,"focus-within":(e,t)=>`${e}:focus-within{${t}}`,"focus-visible":(e,t)=>`${e}:focus-visible{${t}}`,"group-hover":(e,t)=>`.group:hover ${e}{${t}}`,"group-focus":(e,t)=>`.group:focus ${e}{${t}}`,"group-active":(e,t)=>`.group:active ${e}{${t}}`,"group-disabled":(e,t)=>`.group:disabled ${e}{${t}}`,"peer-hover":(e,t)=>`.peer:hover ~ ${e}{${t}}`,"peer-focus":(e,t)=>`.peer:focus ~ ${e}{${t}}`,"peer-checked":(e,t)=>`.peer:checked ~ ${e}{${t}}`,"peer-disabled":(e,t)=>`.peer:disabled ~ ${e}{${t}}`},G={sm:"(min-width:640px)",md:"(min-width:768px)",lg:"(min-width:1024px)",xl:"(min-width:1280px)","2xl":"(min-width:1536px)",dark:"(prefers-color-scheme: dark)"},K=["sm","md","lg","xl","2xl"];function F(e){const t=e.startsWith("-"),n=(t?e.slice(1):e).split("-");if(n.length<2)return null;const i=n.slice(0,-1).join("-"),s=n[n.length-1],o=parseFloat(s);if(Number.isNaN(o)||!Y[i])return null;const c=t?"-":"";return Y[i].map(d=>`${d}:calc(${c}${Ae} * ${o});`).join("")}function ee(e){const t=e.replace("#",""),r=parseInt(t,16),n=r>>16&255,i=r>>8&255,s=r&255;return`${n} ${i} ${s}`}function Te(e){const t=/^(bg|text|border|shadow|outline|caret|accent)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);if(!t)return null;const[,r,n,i="DEFAULT"]=t,s=Ce[n]?.[i];return s?`${{bg:"background-color",text:"color",border:"border-color",shadow:"box-shadow",outline:"outline-color",caret:"caret-color",accent:"accent-color"}[r]}:${s};`:null}function Le(e){const[t,r]=e.split("/");if(!r)return{base:t};const n=parseInt(r,10);return isNaN(n)||n<0||n>100?{base:t}:{base:t,opacity:n/100}}function U(e){const{base:t,opacity:r}=Le(e),n=Te(t);if(n){if(r!==void 0){const s=/#([0-9a-f]{6})/i.exec(n);if(s){const o=ee(s[0]);return n.replace(/#([0-9a-f]{6})/i,`rgb(${o} / ${r})`)}}return n}const i=D(t);if(i&&r!==void 0){const s=/#([0-9a-f]{6})/i.exec(i);if(s){const o=ee(s[0]);return i.replace(/#([0-9a-f]{6})/i,`rgb(${o} / ${r})`)}}return i}function D(e){const t=e.indexOf("-["),r=e.endsWith("]");if(t>0&&r){const n=e.slice(0,t);let i=e.slice(t+2,-1);i=i.replace(/_/g," ");const o={bg:"background-color",text:"color",p:"padding",px:"padding-inline",py:"padding-block",m:"margin",mx:"margin-inline",my:"margin-block",w:"width",h:"height","min-w":"min-width","max-w":"max-width","min-h":"min-height","max-h":"max-height","border-t":"border-top","border-b":"border-bottom","border-l":"border-left","border-r":"border-right","border-x":"border-inline","border-y":"border-block",shadow:"box-shadow",duration:"transition-duration",list:"list-style",break:"word-break",flex:"flex-direction",items:"align-items",justify:"justify-content",whitespace:"white-space",select:"user-select",content:"align-content",self:"align-self",basis:"flex-basis",tracking:"letter-spacing",scroll:"scroll-behavior",delay:"transition-delay",weight:"font-weight",leading:"line-height",z:"z-index"}[n]??n.replace(/_/g,"-");if(o&&i)return`${o}:${i};`}return null}function Ne(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function je(e){const t=/class\s*=\s*["']([^"']+)["']/g,r=[];let n;for(;n=t.exec(e);){let i="",s=!1;for(const o of n[1])o==="["&&(s=!0),o==="]"&&(s=!1),o===" "&&!s?(i&&r.push(i),i=""):i+=o;i&&r.push(i)}return r.filter(Boolean)}const te=new Map,ze=16;function Re(e){const t=Date.now(),r=te.get(e);if(r&&t-r.timestamp<ze)return r.css;const n=je(e),i=new Set(n),s=[],o=[],c=[],d=[],a={};function u(p,S=!1){const g=(S?"dark|":"")+p;if(g in a)return a[g];const l=f(p,S);return a[g]=l,l}function y(p){const S=p.some(l=>K.includes(l)),g=p.includes("dark");return p.length===0?1:!S&&!g?2:S&&!g?3:4}function f(p,S=!1){const g=p.split(":"),l=g.find($=>W[$]||F($)||U($)||D($));if(!l)return null;const b=W[l]??F(l)??U(l)??D(l);if(!b)return null;let m=`.${Ne(p)}`,h=b;const x=g.indexOf(l);let C=x>=0?g.slice(0,x):[];S&&(C=C.filter($=>$!=="dark"));const k=C.filter($=>K.includes($)),v=k.length?k[k.length-1]:null;for(const $ of C){if(K.includes($))continue;const A=Ee[$];typeof A=="function"&&(m=A(m,h).replace(/\{.*$/,""))}let _=`${m}{${h}}`;return S&&v?_=`@media (prefers-color-scheme: dark) and ${G[v]}{${_}}`:S?_=`@media (prefers-color-scheme: dark){${_}}`:v&&(_=`@media ${G[v]}{${_}}`),_}for(const p of i){const S=p.split(":"),g=S.find(h=>W[h]||F(h)||U(h)||D(h));if(!g)continue;const l=S.indexOf(g),b=l>=0?S.slice(0,l):[],m=y(b);if(m===4){const h=u(p,!0);h&&d.push(h)}else{const h=u(p);h&&(m===1?s.push(h):m===2?o.push(h):m===3&&c.push(h))}}const w=[...s,...o,...c,...d].join("");return te.set(e,{css:w,timestamp:t}),w}const Be=new Map;function Z(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function q(e){return typeof e=="string"?e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]):e}function Oe(e){return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi,"").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi,"").replace(/expression\s*\([^)]*\)/gi,"")}function Me(e,...t){let r="";for(let n=0;n<e.length;n++)r+=e[n],n<t.length&&(r+=t[n]);return r}function Pe(e,t,r){let n=Z(e);n.includes("-")||(n=`cer-${n}`);let i;typeof t=="function"?i={...r,render:t}:i=t,typeof i.onError!="function"&&(i.onError=(s,o)=>{console.error(`[${n}] Error:`,s,o)}),Be.set(n,i),typeof window<"u"&&!customElements.get(n)&&customElements.define(n,ne(i))}function ne(e){if(!e.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_styleSheet=null;_lastHtmlStringForJitCSS="";_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=e,this.context=this._initContext(e),Object.keys(e).forEach(t=>{const r=e[t];typeof r=="function"&&!t.startsWith("on")&&(this.context[t]=(...n)=>r(...n,this.context))}),this._applyProps(e),this._applyComputed(e),this._initializing=!1,this._initWatchers(e),this._render(e)}connectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{e.onConnected&&!this._mounted&&(e.onConnected(this.context),this._mounted=!0)})}disconnectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{e.onDisconnected&&e.onDisconnected(this.context),this._listeners.forEach(t=>t()),this._listeners=[],this._watchers.clear(),this._templateLoading=!1,this._templateError=null,this._mounted=!1})}attributeChangedCallback(t,r,n){this._runLogicWithinErrorBoundary(e,()=>{this._applyProps(e),e.onAttributeChanged&&e.onAttributeChanged(t,r,n,this.context)})}static get observedAttributes(){return e.props?Object.keys(e.props).map(Z):[]}_applyComputed(t){this._runLogicWithinErrorBoundary(e,()=>{t.computed&&Object.entries(t.computed).forEach(([r,n])=>{Object.defineProperty(this.context,r,{get:()=>{const i=n(this.context);return q(i)},enumerable:!0})})})}_render(t){this._runLogicWithinErrorBoundary(t,()=>{if(!this.shadowRoot)return;if(this._templateLoading&&t.loadingTemplate){this._renderOutput(t.loadingTemplate(this.context));return}if(this._templateError&&t.errorTemplate){this._renderOutput(t.errorTemplate(this._templateError,this.context));return}const r=t.render(this.context);if(r instanceof Promise){this._templateLoading=!0,r.then(n=>(this._templateLoading=!1,this._templateError=null,this._renderOutput(n),n)).catch(n=>{if(this._templateLoading=!1,this._templateError=n,t.errorTemplate){const i=t.errorTemplate(n,this.context);return this._renderOutput(i),i}throw n}),t.loadingTemplate&&this._renderOutput(t.loadingTemplate(this.context));return}this._renderOutput(r),this._applyStyle(t)})}_renderOutput(t){if(!this.shadowRoot)return;const r=new Proxy(this.context,{get:(n,i)=>i==="_requestRender"?()=>this._requestRender():i==="context"?n:typeof i=="string"&&i.includes(".")?i.split(".").reduce((s,o)=>s?.[o],n):n[i],set:(n,i,s)=>{if(typeof i=="string"&&i.includes(".")){const o=i.split("."),c=o.pop();if(!c)return!1;const d=o.reduce((a,u)=>(u in a||(a[u]={}),a[u]),n);return d[c]=s,!0}return n[i]=s,!0}});_e(this.shadowRoot,Array.isArray(t)?t:[t],r),this._lastHtmlStringForJitCSS=this.shadowRoot.innerHTML}_requestRender(){if(this._renderTimeoutId!==null&&clearTimeout(this._renderTimeoutId),Date.now()-this._lastRenderTime<16){if(this._renderCount++,this._renderCount>10){console.warn(`[${this.tagName}] Potential infinite render loop detected. Skipping render.`),this._renderTimeoutId=null;return}}else this._renderCount=0;this._renderTimeoutId=setTimeout(()=>{this._lastRenderTime=Date.now(),this._render(this._cfg),this._renderTimeoutId=null},0)}_applyStyle(t){this._runLogicWithinErrorBoundary(t,()=>{if(!this.shadowRoot)return;const r=Re(this._lastHtmlStringForJitCSS);if(!t.style&&(!r||r.trim()==="")){this._styleSheet=null;return}let n="";t.style&&(typeof t.style=="string"?n=t.style:typeof t.style=="function"&&(n=t.style(this.context)));let i=Oe(`${Se}
|
|
16
|
+
${n}
|
|
17
|
+
${r}
|
|
18
|
+
`);t.minifyCSS&&(i=$e(i)),this._styleSheet||(this._styleSheet=new CSSStyleSheet),this._styleSheet.replaceSync(i),this.shadowRoot.adoptedStyleSheets=[this._styleSheet]})}_runLogicWithinErrorBoundary(t,r){this._hasError&&(this._hasError=!1);try{r()}catch(n){this._hasError=!0,t.onError&&t.onError(n,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(n,this.context))}}_initContext(t){try{let r=function(i,s=""){return Array.isArray(i)?new Proxy(i,{get(o,c,d){const a=Reflect.get(o,c,d);return typeof a=="function"&&typeof c=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(c)?function(...y){const f=a.apply(o,y);if(!n._initializing){const w=s||"root";n._triggerWatchers(w,o),n._render(t)}return f}:a},set(o,c,d){if(o[c]=d,!n._initializing){const a=s?`${s}.${String(c)}`:String(c);n._triggerWatchers(a,d),n._render(t)}return!0},deleteProperty(o,c){if(delete o[c],!n._initializing){const d=s?`${s}.${String(c)}`:String(c);n._triggerWatchers(d,void 0),n._render(t)}return!0}}):i&&typeof i=="object"?(Object.keys(i).forEach(o=>{const c=s?`${s}.${o}`:o;i[o]=r(i[o],c)}),new Proxy(i,{set(o,c,d){const a=s?`${s}.${String(c)}`:String(c);return o[c]=r(d,a),n._initializing||(n._triggerWatchers(a,o[c]),n._render(t)),!0},get(o,c,d){return Reflect.get(o,c,d)}})):i};const n=this;return r({...t.state})}catch{return{}}}_initWatchers(t){if(t.watch)for(const[r,n]of Object.entries(t.watch)){let i,s={};if(Array.isArray(n)?(i=n[0],s=n[1]||{}):i=n,this._watchers.set(r,{callback:i,options:s,oldValue:this._getNestedValue(r)}),s.immediate)try{const o=this._getNestedValue(r);i(o,void 0,this.context)}catch(o){console.error(`Error in immediate watcher for "${r}":`,o)}}}_getNestedValue(t){return t.split(".").reduce((r,n)=>r?.[n],this.context)}_triggerWatchers(t,r){const n=(s,o)=>{if(s===o)return!0;if(typeof s!=typeof o||typeof s!="object"||s===null||o===null)return!1;if(Array.isArray(s)&&Array.isArray(o))return s.length!==o.length?!1:s.every((a,u)=>n(a,o[u]));const c=Object.keys(s),d=Object.keys(o);return c.length!==d.length?!1:c.every(a=>n(s[a],o[a]))},i=this._watchers.get(t);if(i&&!n(r,i.oldValue))try{i.callback(r,i.oldValue,this.context),i.oldValue=r}catch(s){console.error(`Error in watcher for "${t}":`,s)}for(const[s,o]of this._watchers.entries())if(o.options.deep&&t.startsWith(s+"."))try{const c=this._getNestedValue(s);n(c,o.oldValue)||(o.callback(c,o.oldValue,this.context),o.oldValue=c)}catch(c){console.error(`Error in deep watcher for "${s}":`,c)}}_applyProps(t){try{let r=function(n,i){return i===Boolean?n==="true":i===Number?Number(n):n};if(!t.props)return;Object.entries(t.props).forEach(([n,i])=>{const s=this.getAttribute(Z(n));s!==null?this.context[n]=q(r(s,i.type)):"default"in i&&i.default!==void 0&&(this.context[n]=q(i.default))})}catch(r){this._hasError=!0,t.onError&&t.onError(r,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(r,this.context))}}}}exports.component=Pe;exports.createElementClass=ne;exports.createStore=se;exports.css=Me;exports.each=he;exports.eventBus=ae;exports.html=de;exports.match=pe;exports.when=ue;
|
|
72
19
|
//# sourceMappingURL=custom-elements-runtime.cjs.js.map
|