ladrillosjs 2.0.0-beta.11 → 2.0.0-beta.11.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 +124 -12
- package/dist/core/configure.d.ts +24 -0
- package/dist/core/html/controlTagEscape.d.ts +47 -0
- package/dist/core/js/moduleExecutor.d.ts +19 -0
- package/dist/core/js/scriptParser.d.ts +33 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lazy.js +1 -1
- package/dist/shared-B9h4a1Iw.js +3 -0
- package/dist/shared-B9h4a1Iw.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/utils/jsevents.d.ts +5 -0
- package/package.json +1 -1
- package/dist/shared-BXkP1Y3n.js +0 -3
- package/dist/shared-BXkP1Y3n.js.map +0 -1
- package/dist/shared-BniKFfL6.js +0 -2
- package/dist/shared-BniKFfL6.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,14 +26,16 @@
|
|
|
26
26
|
- [Quick Start](#-quick-start)
|
|
27
27
|
- [Installation](#-installation)
|
|
28
28
|
- [Core Concepts](#-core-concepts)
|
|
29
|
-
- [Directives](#-directives)
|
|
29
|
+
- [Built-in Elements & Directives](#-built-in-elements--directives)
|
|
30
30
|
- [Event Bus](#-event-bus)
|
|
31
31
|
- [Element References](#-element-references)
|
|
32
32
|
- [Lazy Loading](#-lazy-loading)
|
|
33
33
|
- [API Reference](#-api-reference)
|
|
34
34
|
- [Using with Vite](#-using-with-vite)
|
|
35
35
|
- [Browser Support](#-browser-support)
|
|
36
|
+
- [Benchmarks](#-benchmarks)
|
|
36
37
|
- [Examples](#-examples)
|
|
38
|
+
- [Documentation](#-documentation)
|
|
37
39
|
- [Security & Trust Model](#-security--trust-model)
|
|
38
40
|
- [Contributing](#-contributing)
|
|
39
41
|
- [License](#-license)
|
|
@@ -42,16 +44,7 @@
|
|
|
42
44
|
|
|
43
45
|
## 🚀 Quick Start
|
|
44
46
|
|
|
45
|
-
### 1.
|
|
46
|
-
|
|
47
|
-
```html
|
|
48
|
-
<script type="module">
|
|
49
|
-
import ladrillosjs from "https://cdn.jsdelivr.net/npm/ladrillosjs@2/dist/index.js";
|
|
50
|
-
window.ladrillosjs = ladrillosjs;
|
|
51
|
-
</script>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### 2. Create a Component
|
|
47
|
+
### 1. Create a Component
|
|
55
48
|
|
|
56
49
|
Save this as `counter.html`:
|
|
57
50
|
|
|
@@ -87,7 +80,10 @@ Save this as `counter.html`:
|
|
|
87
80
|
</style>
|
|
88
81
|
```
|
|
89
82
|
|
|
90
|
-
###
|
|
83
|
+
### 2. Register and Use It
|
|
84
|
+
|
|
85
|
+
In your `index.html`, import LadrillosJS from the CDN, register the
|
|
86
|
+
component, and drop the tag anywhere on the page:
|
|
91
87
|
|
|
92
88
|
```html
|
|
93
89
|
<!DOCTYPE html>
|
|
@@ -104,8 +100,21 @@ Save this as `counter.html`:
|
|
|
104
100
|
</html>
|
|
105
101
|
```
|
|
106
102
|
|
|
103
|
+
### 3. Serve It
|
|
104
|
+
|
|
105
|
+
Components are fetched over HTTP, so serve the folder with any static server
|
|
106
|
+
(opening the file directly via `file://` won't work — browsers block `fetch`
|
|
107
|
+
from local files):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx serve # or: python -m http.server 8080
|
|
111
|
+
```
|
|
112
|
+
|
|
107
113
|
That's it! Your reactive component is ready. 🎉
|
|
108
114
|
|
|
115
|
+
> 📚 **Want more?** The [full documentation](docs/README.md) covers every
|
|
116
|
+
> feature step by step, from your first component to building a design system.
|
|
117
|
+
|
|
109
118
|
---
|
|
110
119
|
|
|
111
120
|
## 📦 Installation
|
|
@@ -206,6 +215,20 @@ Attach events directly in HTML with inline expressions or function calls:
|
|
|
206
215
|
<form onsubmit="handleSubmit(event)">...</form>
|
|
207
216
|
```
|
|
208
217
|
|
|
218
|
+
Or use the `$on:` directive with **modifiers** — dot-separated flags for
|
|
219
|
+
common patterns like `preventDefault`, key filtering, and modifier keys:
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<form $on:submit.prevent="handleSubmit()">...</form>
|
|
223
|
+
<input $on:keyup.enter="search()" />
|
|
224
|
+
<textarea $on:keydown.ctrl.s.prevent="save()"></textarea>
|
|
225
|
+
<div $on:click.self="closeModal()">...</div>
|
|
226
|
+
<button $on:click.once="trackFirstClick()">Buy</button>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
See the [Event Modifiers reference](docs/20-event-modifiers.md) for every
|
|
230
|
+
modifier and combination.
|
|
231
|
+
|
|
209
232
|
### Two-Way Binding
|
|
210
233
|
|
|
211
234
|
Use `$bind` to sync form inputs with state:
|
|
@@ -326,6 +349,8 @@ Use `<lazy>` to defer rendering until a trigger fires (viewport, idle, delay, in
|
|
|
326
349
|
| `<lazy>` | Defer rendering | `<lazy idle><analytics-pixel /></lazy>` |
|
|
327
350
|
| `$bind` | Two-way binding | `<input $bind="email" />` |
|
|
328
351
|
| `$ref` | Element reference | `<input $ref="inputEl" />` |
|
|
352
|
+
| `$on:` + modifiers | Events with modifiers | `<form $on:submit.prevent="save()">` |
|
|
353
|
+
| `$no:bind` | Escape `{}` binding | `<code $no:bind>{literal}</code>` |
|
|
329
354
|
|
|
330
355
|
---
|
|
331
356
|
|
|
@@ -532,9 +557,32 @@ import { configure } from "ladrillosjs";
|
|
|
532
557
|
configure({
|
|
533
558
|
cacheSize: 50, // Component LRU cache size (default: 25)
|
|
534
559
|
onError: (err) => telemetry.capture(err), // Custom error handler
|
|
560
|
+
delegateLoopEvents: true, // Opt-in loop event delegation (default: false)
|
|
535
561
|
});
|
|
536
562
|
```
|
|
537
563
|
|
|
564
|
+
#### `delegateLoopEvents`
|
|
565
|
+
|
|
566
|
+
By default every handler inside a `<for>` row gets its own listener. With
|
|
567
|
+
`delegateLoopEvents: true`, eligible handlers share **one listener per event
|
|
568
|
+
type** on the loop's container — thousands of rows, a handful of listeners.
|
|
569
|
+
Templates and handler code don't change at all, and render performance is
|
|
570
|
+
the same either way; enable it when listener count itself matters (very
|
|
571
|
+
large lists, memory-constrained devices, many handlers per row).
|
|
572
|
+
|
|
573
|
+
Fine print:
|
|
574
|
+
|
|
575
|
+
- Non-bubbling events (`focus`, `blur`, `mouseenter`, …) and handlers using
|
|
576
|
+
the `.self`, `.capture`, `.once`, or `.passive` modifiers automatically
|
|
577
|
+
keep per-element listeners. `.stop`, `.prevent`, and key/system modifiers
|
|
578
|
+
work identically in both modes.
|
|
579
|
+
- `event.currentTarget` inside a delegated handler is the list container,
|
|
580
|
+
not the row element (`event.target` is unaffected).
|
|
581
|
+
- If you manually attach your own listener on an element inside a row and
|
|
582
|
+
call `stopPropagation()`, delegated handlers above it won't fire.
|
|
583
|
+
- Call `configure()` before your components render; already-rendered loops
|
|
584
|
+
keep the mode they were created with.
|
|
585
|
+
|
|
538
586
|
### Event Bus
|
|
539
587
|
|
|
540
588
|
| Function | Description |
|
|
@@ -576,6 +624,54 @@ See the [samples/](samples/) directory for complete examples:
|
|
|
576
624
|
|
|
577
625
|
---
|
|
578
626
|
|
|
627
|
+
## 📊 Benchmarks
|
|
628
|
+
|
|
629
|
+
A [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark)–style
|
|
630
|
+
suite lives in [benchmarks/](benchmarks/). It renders the same keyed
|
|
631
|
+
1,000-row list in LadrillosJS, React 18 (keyed, memoized rows — the
|
|
632
|
+
idiomatic fast path), and hand-optimized vanilla JS, and measures each
|
|
633
|
+
operation from invocation until the live DOM reflects the change.
|
|
634
|
+
Medians of 10 runs, headless Chromium on an Apple M5 Pro,
|
|
635
|
+
`ladrillosjs@2.0.0-beta.11`:
|
|
636
|
+
|
|
637
|
+
| Operation | LadrillosJS | React 18.3 (keyed, memoized rows) | Vanilla JS (hand-optimized) |
|
|
638
|
+
|---|---:|---:|---:|
|
|
639
|
+
| create 1,000 rows | **3.7 ms** | 4.1 ms | 1.8 ms |
|
|
640
|
+
| replace all 1,000 rows | **4.1 ms** | 7 ms | 2 ms |
|
|
641
|
+
| partial update (every 10th of 1,000) | 1.1 ms | 1.2 ms | 0.2 ms |
|
|
642
|
+
| select row | 0.7 ms | 0.4 ms | 0 ms |
|
|
643
|
+
| swap 2 rows | **1.1 ms** | 3.3 ms | 0.1 ms |
|
|
644
|
+
| remove row | 1 ms | 1 ms | 0 ms |
|
|
645
|
+
| append 1,000 to 1,000 rows | **3.8 ms** | 4.3 ms | 1.3 ms |
|
|
646
|
+
| clear 1,000 rows | **1.3 ms** | 5.1 ms | 0.8 ms |
|
|
647
|
+
| create 10,000 rows | **28.9 ms** | 218.3 ms | 13 ms |
|
|
648
|
+
| **JS payload (min+gzip)** | **25.9 KB** | **47 KB** | ~1 KB |
|
|
649
|
+
| JS heap after 1,000 rows | 2.4 MB | 6.2 MB | 1.3 MB |
|
|
650
|
+
|
|
651
|
+
**How to read this honestly:**
|
|
652
|
+
|
|
653
|
+
- Every operation lands well within a single 60 fps frame (16.7 ms):
|
|
654
|
+
updates on a 1,000-row list take about a millisecond, and bulk creation
|
|
655
|
+
of 1,000 rows is under 5 ms.
|
|
656
|
+
- LadrillosJS beats React on bulk creation (and by 7× on 10,000 rows),
|
|
657
|
+
full replaces, row swaps, and clearing, while shipping **half the JS**
|
|
658
|
+
and using **~60% less memory** for the same UI.
|
|
659
|
+
- React 18 remains faster on single-row selection, and partial updates
|
|
660
|
+
are a tie. We publish these numbers to track and improve them — not to
|
|
661
|
+
claim LadrillosJS wins everything.
|
|
662
|
+
- Vanilla JS is the baseline.
|
|
663
|
+
|
|
664
|
+
Reproduce it yourself (no benchmark numbers should be trusted otherwise):
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
cd benchmarks && npm install && npm run bench
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Methodology, fairness notes, and raw samples: [benchmarks/README.md](benchmarks/README.md)
|
|
671
|
+
and [benchmarks/results.json](benchmarks/results.json).
|
|
672
|
+
|
|
673
|
+
---
|
|
674
|
+
|
|
579
675
|
## 📚 Examples
|
|
580
676
|
|
|
581
677
|
### Todo List
|
|
@@ -634,6 +730,22 @@ A complete CRUD example combining all directives:
|
|
|
634
730
|
|
|
635
731
|
---
|
|
636
732
|
|
|
733
|
+
## 📚 Documentation
|
|
734
|
+
|
|
735
|
+
Full guides live in the [docs/](docs/README.md) folder:
|
|
736
|
+
|
|
737
|
+
| Start here | Reference | Advanced |
|
|
738
|
+
| ---------- | --------- | -------- |
|
|
739
|
+
| [Quick Start](docs/01-quick-start.md) | [Built-in Elements & Directives](docs/06-directives.md) | [Event Bus](docs/12-event-bus.md) |
|
|
740
|
+
| [Installation](docs/02-installation.md) | [Event Modifiers (`$on:`)](docs/20-event-modifiers.md) | [Lazy Loading](docs/13-lazy-loading.md) |
|
|
741
|
+
| [Components](docs/03-components.md) | [Conditionals & Loops](docs/07-conditionals.md) | [Shadow DOM](docs/14-shadow-dom.md) |
|
|
742
|
+
| [Reactivity](docs/04-reactivity.md) | [Two-Way Binding](docs/09-two-way-binding.md) | [Design System Guide](docs/19-design-system.md) |
|
|
743
|
+
|
|
744
|
+
Upgrading from v1? See the [Migration Guide](docs/17-migration-v1-to-v2.md).
|
|
745
|
+
Using TypeScript? See the [TypeScript guide](docs/18-typescript.md).
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
637
749
|
## 🔒 Security & Trust Model
|
|
638
750
|
|
|
639
751
|
**Component HTML is trusted code. Treat a `.html` component the same way you'd
|
package/dist/core/configure.d.ts
CHANGED
|
@@ -18,7 +18,31 @@ export interface LadrillosConfig {
|
|
|
18
18
|
* });
|
|
19
19
|
*/
|
|
20
20
|
onError?: LadrillosErrorHandler | null;
|
|
21
|
+
/**
|
|
22
|
+
* Opt-in event delegation for `<for>` loop rows. When enabled, eligible
|
|
23
|
+
* inline handlers (onclick, $on:… on bubbling events) inside loop rows
|
|
24
|
+
* share ONE listener per event type on the loop's container instead of
|
|
25
|
+
* one listener per element — faster bulk row creation and less memory on
|
|
26
|
+
* large lists. Handler code and template syntax are unchanged.
|
|
27
|
+
*
|
|
28
|
+
* Two observable differences versus direct listeners:
|
|
29
|
+
* 1. `event.currentTarget` inside a loop handler is the list container,
|
|
30
|
+
* not the row element (`event.target` is unaffected).
|
|
31
|
+
* 2. A manual `stopPropagation()` call from a listener you attach
|
|
32
|
+
* yourself between the row and the container stops delegated
|
|
33
|
+
* handlers from firing.
|
|
34
|
+
*
|
|
35
|
+
* Non-bubbling events (focus, blur, mouseenter, …) and handlers using
|
|
36
|
+
* the `.self`, `.capture`, `.once`, or `.passive` modifiers automatically
|
|
37
|
+
* keep per-element listeners.
|
|
38
|
+
*
|
|
39
|
+
* Set this before components render; templates already rendered keep the
|
|
40
|
+
* mode they were created with. Defaults to false.
|
|
41
|
+
*/
|
|
42
|
+
delegateLoopEvents?: boolean;
|
|
21
43
|
}
|
|
44
|
+
/** Whether opt-in loop event delegation is active (see LadrillosConfig). */
|
|
45
|
+
export declare function isLoopDelegationEnabled(): boolean;
|
|
22
46
|
/**
|
|
23
47
|
* Configure framework-level options.
|
|
24
48
|
*
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table-safe parsing for built-in control elements.
|
|
3
|
+
*
|
|
4
|
+
* The HTML parser's table insertion modes foster-parent anything that is
|
|
5
|
+
* not valid table content out of `<table>`/`<thead>`/`<tbody>`/`<tr>`.
|
|
6
|
+
* Built-in control elements (`<for>`, `<if>`, `<else-if>`, `<else>`,
|
|
7
|
+
* `<show>`) are unknown to the parser, so markup like
|
|
8
|
+
*
|
|
9
|
+
* <table><tbody>
|
|
10
|
+
* <for each="row in rows" key="row.id">
|
|
11
|
+
* <tr><td>{row.id}</td></tr>
|
|
12
|
+
* </for>
|
|
13
|
+
* </tbody></table>
|
|
14
|
+
*
|
|
15
|
+
* gets mangled BEFORE the framework ever sees the tree: `<for>` is
|
|
16
|
+
* hoisted out of the table and the raw `<tr>` template is left behind,
|
|
17
|
+
* un-bound. This applies to every parse entry point — `DOMParser` and
|
|
18
|
+
* `template.innerHTML` alike.
|
|
19
|
+
*
|
|
20
|
+
* `<template>` elements, however, ARE valid anywhere inside a table, and
|
|
21
|
+
* their content model is parsed leniently (a bare `<tr>` or `<td>` inside
|
|
22
|
+
* template content survives). So before parsing we rewrite control tags to
|
|
23
|
+
* `<template data-l-ctrl="…">` placeholders at the string level, and after
|
|
24
|
+
* parsing we rebuild the real control elements with DOM APIs — which the
|
|
25
|
+
* parser's content rules cannot touch.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Rewrites control-element tags to `<template data-l-ctrl="…">`
|
|
29
|
+
* placeholders so the HTML parser cannot foster-parent them out of table
|
|
30
|
+
* contexts. Must be paired with {@link restoreControlTags} on the parsed
|
|
31
|
+
* tree.
|
|
32
|
+
*/
|
|
33
|
+
export declare function escapeControlTags(html: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Rebuilds real control elements from the placeholders produced by
|
|
36
|
+
* {@link escapeControlTags}. Runs until no placeholder remains: restoring
|
|
37
|
+
* an outer placeholder moves its (previously inert) template content into
|
|
38
|
+
* the live tree, exposing any nested placeholders to the next iteration.
|
|
39
|
+
* User-authored `<template>` elements are recursed into so control tags
|
|
40
|
+
* inside their inert content are restored as well.
|
|
41
|
+
*/
|
|
42
|
+
export declare function restoreControlTags(root: ParentNode): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns true when the element is a restored control element
|
|
45
|
+
* (`<for>`, `<if>`, `<else-if>`, `<else>`, `<show>`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function isControlElement(el: Element): boolean;
|
|
@@ -20,6 +20,25 @@ export declare function rewriteImports(code: string, baseUrl: string): string;
|
|
|
20
20
|
* @returns Promise that resolves when the module has executed
|
|
21
21
|
*/
|
|
22
22
|
export declare function executeModuleScript(script: ScriptElement, componentUrl: string, componentId?: string): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Transforms import statements to wrap imported values in reactive proxies.
|
|
25
|
+
* This enables imported arrays to trigger UI updates when mutated.
|
|
26
|
+
*
|
|
27
|
+
* Transforms:
|
|
28
|
+
* import { foo, bar } from "./module.js";
|
|
29
|
+
*
|
|
30
|
+
* Into:
|
|
31
|
+
* import { foo as __raw_foo, bar as __raw_bar } from "./module.js";
|
|
32
|
+
* const foo = __wrapReactiveArray(__raw_foo, __ladrillos_componentId, "foo");
|
|
33
|
+
* const bar = __wrapReactiveArray(__raw_bar, __ladrillos_componentId, "bar");
|
|
34
|
+
*
|
|
35
|
+
* @param code - The module code with imports
|
|
36
|
+
* @returns Transformed code with reactive import wrapping
|
|
37
|
+
*
|
|
38
|
+
* Exported for tests (the blob-URL execution path can't run under Node).
|
|
39
|
+
*/
|
|
40
|
+
export declare function transformImportsForReactivity(code: string): string;
|
|
41
|
+
export declare function generateHelperInjectionCode(componentId?: string, componentUrl?: string, exclude?: ReadonlySet<string>): string;
|
|
23
42
|
/**
|
|
24
43
|
* Executes an external module script.
|
|
25
44
|
* For external scripts, we fetch the content, auto-export all declarations,
|
|
@@ -46,9 +46,41 @@ export declare function extractFunctionDefinitions(content: string, skipFunction
|
|
|
46
46
|
* Exported so webcomponent.ts can use it for observedAttributes.
|
|
47
47
|
*/
|
|
48
48
|
export declare function extractVariableNames(content: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* A pass-scoped evaluator bound to one context object, produced by
|
|
51
|
+
* `DirectiveEvaluator.forContext`. Callable as `(expr) => unknown`; the
|
|
52
|
+
* optional members let hot loops skip per-eval overhead (see
|
|
53
|
+
* `createContextEvaluator` for the mode semantics).
|
|
54
|
+
*/
|
|
55
|
+
export interface BoundEvaluator {
|
|
56
|
+
(expr: string): unknown;
|
|
57
|
+
/**
|
|
58
|
+
* Refill argument slots from the context: the volatile slots in static
|
|
59
|
+
* mode, all slots in legacy mode. Static-mode callers MUST call this
|
|
60
|
+
* after mutating a volatile context value.
|
|
61
|
+
*/
|
|
62
|
+
refresh?: () => void;
|
|
63
|
+
/** Compiled Function for `expr` under this key set, or null on a syntax error. */
|
|
64
|
+
compile?: (expr: string) => Function | null;
|
|
65
|
+
/** Invoke a Function from `compile` against the current argument slots. */
|
|
66
|
+
invoke?: (fn: Function, expr: string) => unknown;
|
|
67
|
+
/** Key-set signature; compiled Functions are only valid for a matching sig. */
|
|
68
|
+
sig?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Directive-facing expression evaluator. Callable as
|
|
72
|
+
* `(expr, context) => unknown`; `forContext` additionally builds a
|
|
73
|
+
* pass-scoped fast evaluator bound to one context object (see
|
|
74
|
+
* `createContextEvaluator`) whose key set must not change for the
|
|
75
|
+
* lifetime of the returned function.
|
|
76
|
+
*/
|
|
77
|
+
export interface DirectiveEvaluator {
|
|
78
|
+
(expr: string, context: Record<string, unknown>): unknown;
|
|
79
|
+
forContext(context: Record<string, unknown>, volatileKeys?: readonly string[]): BoundEvaluator;
|
|
80
|
+
}
|
|
49
81
|
/**
|
|
50
82
|
* Creates and returns an expression evaluator function for use by directives.
|
|
51
83
|
* This allows directives to evaluate expressions like "item.name" or "count > 5"
|
|
52
84
|
* in the context of the component's state.
|
|
53
85
|
*/
|
|
54
|
-
export declare function createExpressionEvaluator():
|
|
86
|
+
export declare function createExpressionEvaluator(): DirectiveEvaluator;
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as s,
|
|
1
|
+
import{d as s,f as e,i as r,m as a,p as o}from"./shared-B9h4a1Iw.js";var t={registerComponent:o,registerComponents:a,$use:e,configure:r};export{e as $use,s as ErrorCode,r as configure,t as default,o as registerComponent,a as registerComponents};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["/**\r\n * LadrillosJS Core - Minimal bundle\r\n *\r\n * This is the core module containing only essential functionality.\r\n * Use this for the smallest possible bundle size.\r\n *\r\n * @example\r\n * ```ts\r\n * import { registerComponent } from 'ladrillosjs/core';\r\n * ```\r\n *\r\n * For additional features, import from:\r\n * - 'ladrillosjs/lazy' - Lazy loading strategies\r\n * - 'ladrillosjs/events' - Event bus for cross-component communication\r\n */\r\n\r\nimport { ComponentConfig, RegisterComponentsResult } from \"./core/ladrillos\";\r\nimport {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n} from \"./core/helpers/frameworkHelpers\";\r\nimport { configure, LadrillosConfig } from \"./core/configure\";\r\nimport { ErrorCode, type LadrillosErrorHandler } from \"./utils/devWarnings\";\r\n\r\n// Export public types\r\nexport type {\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n LadrillosConfig,\r\n LadrillosErrorHandler,\r\n};\r\nexport type { LadrillosComponent } from \"./types\";\r\n\r\n// Export error code enum\r\nexport { ErrorCode };\r\n\r\n// Public exports\r\nexport { registerComponent, registerComponents, $use, configure };\r\n\r\n// Default export for CDN usage\r\nexport default {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n configure,\r\n};\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["/**\r\n * LadrillosJS Core - Minimal bundle\r\n *\r\n * This is the core module containing only essential functionality.\r\n * Use this for the smallest possible bundle size.\r\n *\r\n * @example\r\n * ```ts\r\n * import { registerComponent } from 'ladrillosjs/core';\r\n * ```\r\n *\r\n * For additional features, import from:\r\n * - 'ladrillosjs/lazy' - Lazy loading strategies\r\n * - 'ladrillosjs/events' - Event bus for cross-component communication\r\n */\r\n\r\nimport { ComponentConfig, RegisterComponentsResult } from \"./core/ladrillos\";\r\nimport {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n} from \"./core/helpers/frameworkHelpers\";\r\nimport { configure, LadrillosConfig } from \"./core/configure\";\r\nimport { ErrorCode, type LadrillosErrorHandler } from \"./utils/devWarnings\";\r\n\r\n// Export public types\r\nexport type {\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n LadrillosConfig,\r\n LadrillosErrorHandler,\r\n};\r\nexport type { LadrillosComponent } from \"./types\";\r\n\r\n// Export error code enum\r\nexport { ErrorCode };\r\n\r\n// Public exports\r\nexport { registerComponent, registerComponents, $use, configure };\r\n\r\n// Default export for CDN usage\r\nexport default {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n configure,\r\n};\r\n"],"mappings":"qEAyCA,IAAA,EAAe,CACb,oBACA,qBACA,OACA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,
|
|
1
|
+
import{c as a,d as s,f as e,i as n,l as o,m as t,o as r,p as l,s as i,t as m,u as d}from"./shared-B9h4a1Iw.js";import{n as p,t as y}from"./shared-D-P0qKQY.js";var z=a=>m.loadLazyComponent(a),f={registerComponent:l,registerComponents:t,$use:e,$emit:y,$listen:p,loadLazyComponent:z,configure:n,lazyOnIdle:i,lazyOnVisible:d,lazyOnMedia:o,lazyOnInteraction:a,lazyOnDelay:r};export{y as $emit,p as $listen,e as $use,s as ErrorCode,n as configure,f as default,r as lazyOnDelay,i as lazyOnIdle,a as lazyOnInteraction,o as lazyOnMedia,d as lazyOnVisible,z as loadLazyComponent,l as registerComponent,t as registerComponents};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\r\n ladrillos,\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n} from \"./core/ladrillos\";\r\nimport {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n} from \"./core/helpers/frameworkHelpers\";\r\nimport { $emit, $listen, EventCallback } from \"./core/events/eventBus\";\r\nimport { configure, LadrillosConfig } from \"./core/configure\";\r\nimport { ErrorCode, type LadrillosErrorHandler } from \"./utils/devWarnings\";\r\n\r\n// Import lazy loading strategies\r\nimport {\r\n LazyStrategy,\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n} from \"./core/lazy\";\r\n\r\n// Export public types\r\nexport type {\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n EventCallback,\r\n LazyStrategy,\r\n LadrillosConfig,\r\n LadrillosErrorHandler,\r\n};\r\nexport type { LadrillosComponent } from \"./types\";\r\n\r\n// Export error code enum for consumers to branch on\r\nexport { ErrorCode };\r\n\r\n// Export lazy loading strategies\r\nexport {\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n};\r\n\r\n// Force load a lazy component\r\nexport const loadLazyComponent = (name: string) =>\r\n ladrillos.loadLazyComponent(name);\r\n\r\n// Framework configuration\r\nexport { configure };\r\n\r\n// Component registration + $use alias + event bus helpers\r\nexport { registerComponent, registerComponents, $use, $emit, $listen };\r\n\r\n// Default export with all methods for CDN usage\r\n// This allows: ladrillosjs.registerComponent() in CDN mode\r\nexport default {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n $emit,\r\n $listen,\r\n loadLazyComponent,\r\n configure,\r\n // Lazy loading strategies\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n};\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\r\n ladrillos,\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n} from \"./core/ladrillos\";\r\nimport {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n} from \"./core/helpers/frameworkHelpers\";\r\nimport { $emit, $listen, EventCallback } from \"./core/events/eventBus\";\r\nimport { configure, LadrillosConfig } from \"./core/configure\";\r\nimport { ErrorCode, type LadrillosErrorHandler } from \"./utils/devWarnings\";\r\n\r\n// Import lazy loading strategies\r\nimport {\r\n LazyStrategy,\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n} from \"./core/lazy\";\r\n\r\n// Export public types\r\nexport type {\r\n ComponentConfig,\r\n RegisterComponentsResult,\r\n EventCallback,\r\n LazyStrategy,\r\n LadrillosConfig,\r\n LadrillosErrorHandler,\r\n};\r\nexport type { LadrillosComponent } from \"./types\";\r\n\r\n// Export error code enum for consumers to branch on\r\nexport { ErrorCode };\r\n\r\n// Export lazy loading strategies\r\nexport {\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n};\r\n\r\n// Force load a lazy component\r\nexport const loadLazyComponent = (name: string) =>\r\n ladrillos.loadLazyComponent(name);\r\n\r\n// Framework configuration\r\nexport { configure };\r\n\r\n// Component registration + $use alias + event bus helpers\r\nexport { registerComponent, registerComponents, $use, $emit, $listen };\r\n\r\n// Default export with all methods for CDN usage\r\n// This allows: ladrillosjs.registerComponent() in CDN mode\r\nexport default {\r\n registerComponent,\r\n registerComponents,\r\n $use,\r\n $emit,\r\n $listen,\r\n loadLazyComponent,\r\n configure,\r\n // Lazy loading strategies\r\n lazyOnIdle,\r\n lazyOnVisible,\r\n lazyOnMedia,\r\n lazyOnInteraction,\r\n lazyOnDelay,\r\n};\r\n"],"mappings":"+JAgDA,IAAa,EAAqB,GAChC,EAAU,kBAAkB,GAU9B,EAAe,CACb,oBACA,qBACA,OACA,QACA,UACA,oBACA,YAEA,aACA,gBACA,cACA,oBACA"}
|
package/dist/lazy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as a,
|
|
1
|
+
import{a as s,c as a,l as r,n as o,o as e,r as m,s as p,u as t}from"./shared-B9h4a1Iw.js";export{s as defaultLazyStrategy,o as forceLoadLazyComponent,m as isLazyComponent,e as lazyOnDelay,p as lazyOnIdle,a as lazyOnInteraction,r as lazyOnMedia,t as lazyOnVisible};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,i as t,r as n}from"./shared-D-P0qKQY.js";var r=Object.defineProperty,o=(e,t)=>{let n={};for(var o in e)r(n,o,{get:e[o],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:"Module"}),n},s=/{([^}]+)}/g;function i(e,t){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e.startsWith("/")?new URL(e,window.location.origin).href:e:new URL(e,t).href}function a(e){return{registerComponent:function(t,n,r=!0,o=!1){const s=i(n,e);return Pn.registerComponent(t,s,r,o)},registerComponents:function(t){const n=Array.isArray(t)?t.map(t=>({...t,path:i(t.path,e)})):Object.entries(t).map(([t,n])=>"string"==typeof n?{name:t,path:i(n,e)}:{name:t,...n,path:i(n.path,e)});return Pn.registerComponents(n)},$use:function(t,n=!0,r=!1){const o=function(e){return(e.split("/").pop()?.replace(/\.[^.]+$/,"")||e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}(t),s=i(t,e);return Pn.registerComponent(o,s,n,r)}}}var c=["registerComponent","registerComponents","$use"],l=a(window.location.href),u=l.registerComponent,f=l.registerComponents,p=l.$use,d=/* @__PURE__ */new Map,h=Symbol("reactive-array"),m=Symbol("reactive-array-subscribers"),g=["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"];function _(e,t){if(e[h]){const n=e[m];return n&&t&&n.add(t),e}const n=/* @__PURE__ */new Set;t&&n.add(t);const r=()=>{for(const e of n)e()};return new Proxy(e,{get(e,t){if(t===h)return!0;if(t===m)return n;const o=e[t];return"string"==typeof t&&g.includes(t)&&"function"==typeof o?(...t)=>{const n=t.map(e=>Array.isArray(e)?_(e,r):e),s=o.apply(e,n);return r(),s}:Array.isArray(o)?_(o,r):o},set(e,t,n){const o=!isNaN("string"==typeof t?parseInt(t,10):NaN),s="length"===t,i=Array.isArray(n)?_(n,r):n;return e[t]===i||(e[t]=i,(o||s)&&r()),!0},deleteProperty(e,t){const n=delete e[t];return n&&r(),n}})}function y(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function v(e,t){for(const n of Object.keys(e)){const r=e[n];Array.isArray(r)?e[n]=_(r,t):r&&"object"==typeof r&&!Array.isArray(r)&&v(r,t)}return e}function b(e,t){return function(e){let t=d.get(e);if(!t){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`\\b${n}\\b`),d.set(e,t)}return t}(t).test(e)}var w=null;function E(){return w}var A=/* @__PURE__ */function(e){return e[e.EXPRESSION_EVAL_FAILED=101]="EXPRESSION_EVAL_FAILED",e[e.EXPRESSION_SYNTAX_ERROR=102]="EXPRESSION_SYNTAX_ERROR",e[e.EXPRESSION_UNDEFINED_VAR=103]="EXPRESSION_UNDEFINED_VAR",e[e.EXPRESSION_NULL_ACCESS=104]="EXPRESSION_NULL_ACCESS",e[e.SCRIPT_EXTRACT_FAILED=201]="SCRIPT_EXTRACT_FAILED",e[e.SCRIPT_EXECUTION_FAILED=202]="SCRIPT_EXECUTION_FAILED",e[e.EVENT_HANDLER_FAILED=301]="EVENT_HANDLER_FAILED",e[e.DIRECTIVE_ERROR=401]="DIRECTIVE_ERROR",e[e.LOOP_ERROR=402]="LOOP_ERROR",e[e.CONDITIONAL_ERROR=403]="CONDITIONAL_ERROR",e[e.COMPONENT_LOAD_FAILED=501]="COMPONENT_LOAD_FAILED",e[e.COMPONENT_NOT_FOUND=502]="COMPONENT_NOT_FOUND",e[e.MODULE_LOAD_FAILED=601]="MODULE_LOAD_FAILED",e[e.MODULE_EXECUTION_FAILED=602]="MODULE_EXECUTION_FAILED",e}({}),$=null;function N(e,t,n){const r=function(e,t){return`${e}${function(e){const t=void 0!==e?e:w;if(!t)return"";const n=[];if(t.tagName&&n.push(`<${t.tagName}>`),t.sourcePath){const e=t.sourcePath.split("/").pop()||t.sourcePath;n.push(`(${e})`)}return n.length>0?` in ${n.join(" ")}`:""}(t)}`}(e,t);"undefined"!=typeof window&&"undefined"!=typeof console&&console,function(e,t){if($)try{const n=e instanceof Error?e:new Error(String(e));$(n,t??null)}catch{}}(n instanceof Error?n:new Error(r,void 0!==n?{cause:n}:void 0),t)}function x(e,t,n={}){var r;n.errorCode||(r=t)instanceof SyntaxError||r instanceof ReferenceError||r instanceof TypeError&&(r.message.includes("Cannot read properties of null")||r.message.includes("Cannot read properties of undefined")),function(e){if(e instanceof SyntaxError)return"Invalid expression syntax";if(e instanceof ReferenceError){const t=e.message.match(/(\w+) is not defined/);return t?`Undefined variable: "${t[1]}"`:"Undefined variable"}e instanceof TypeError&&(e.message.includes("Cannot read properties of null")||e.message.includes("Cannot read properties of undefined"))}(t)}var S=/* @__PURE__ */new Map,C=/* @__PURE__ */new Map,R=/(?:import|export)\s+(?:[\s\S]*?\s+from\s+)?['"]([^'"]+)['"]/g,k=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g,T=[".ts",".tsx",".mts"];function L(e){return e.startsWith("./")||e.startsWith("../")}function O(e){return T.some(t=>e.endsWith(t))}function M(e){return!(e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:"))}function I(e,t){let n=e;const r=[],o=[];return n=n.replace(R,(e,n)=>{if(L(n)){const r=new URL(n,t).href;return O(n)&&o.push(n),e.replace(n,r)}return M(n)&&r.push(n),e}),n=n.replace(k,(e,n)=>{if(L(n)){const e=new URL(n,t).href;return O(n)&&o.push(n),`import("${e}")`}return M(n)&&r.push(n),e}),n}var P=/^(?:export\s+)?(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/gm,D=["$emit","$listen","$refs","registerComponent","registerComponents","$use"];async function j(e,t,n){if(e.external)return document.querySelector(`script[src="${e.src}"]`)?Promise.resolve(void 0):new Promise((t,n)=>{const r=document.createElement("script");r.src=e.src,e.type&&(r.type=e.type),r.onload=()=>t(void 0),r.onerror=t=>n(/* @__PURE__ */new Error(`Failed to load external script: ${e.src}`)),document.head.appendChild(r)});if("module"!==e.type)return document.querySelector(`script[src="${e.src}"]`)?Promise.resolve(void 0):new Promise((t,n)=>{const r=document.createElement("script");r.src=e.src,e.type&&(r.type=e.type),r.onload=()=>t(void 0),r.onerror=t=>n(/* @__PURE__ */new Error(`Failed to load script: ${e.src}`)),document.head.appendChild(r)});try{const r=await fetch(e.src);if(!r.ok)throw new Error(`Failed to fetch module: ${e.src}`);const o=I(await r.text(),e.src),s=function(e){const t=function(e){const t=[];let n;for(P.lastIndex=0;null!==(n=P.exec(e));)t.push(n[1]);const r=/^(?:export\s+)?function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/gm;for(;null!==(n=r.exec(e));)t.includes(n[1])||t.push(n[1]);return t}(e),n=/* @__PURE__ */new Set,r=/export\s+(?:let|const|var|function)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;let o;for(;null!==(o=r.exec(e));)n.add(o[1]);const s=/export\s*\{([^}]+)\}/g;for(;null!==(o=s.exec(e));)o[1].split(",").map(e=>e.trim().split(/\s+as\s+/)[0].trim()).forEach(e=>n.add(e));const i=t.filter(e=>!n.has(e));return 0===i.length?e:`${e}\nexport { ${i.join(", ")} };`}(function(e){const t=[];let n=e;if(n=n.replace(/import\s*\{([^}]+)\}\s*from\s*(['"][^'"]+['"])\s*;?/g,(e,n,r)=>{const o=n.split(",").map(e=>e.trim()),s=[];for(const i of o){if(!i)continue;const e=i.match(/^(\w+)\s+as\s+(\w+)$/);if(e){const[,n,r]=e,o=`__raw_${r}`;s.push(`${n} as ${o}`),t.push(`const ${r} = __wrapReactiveArray(${o}, __ladrillos_componentId, "${r}");`)}else{const e=`__raw_${i}`;s.push(`${i} as ${e}`),t.push(`const ${i} = __wrapReactiveArray(${e}, __ladrillos_componentId, "${i}");`)}}return`import { ${s.join(", ")} } from ${r};`}),t.length>0){const e=n.split("\n");let r=-1;for(let t=0;t<e.length;t++){const n=e[t].trim();(n.startsWith("import ")||n.startsWith("import{"))&&(r=t)}r>=0&&(e.splice(r+1,0,"","// === Reactive Import Wrappers ===",...t,"// === End Reactive Import Wrappers ===",""),n=e.join("\n"))}return n}(o)),i=function(e){const t=/* @__PURE__ */new Set;for(const n of D){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");new RegExp(`(?:^|[\\s,{])${r}(?:\\s+as\\b|[\\s,}=;(])|\\b(?:let|const|var|function)\\s+${r}\\b`,"m").test(e)&&t.add(n)}return t}(o),a=function(e,t,n=/* @__PURE__ */new Set){const r=(e,t)=>n.has(e)?"":t;return`\n// === LadrillosJS Framework Helpers (auto-injected) ===\nconst __ladrillos_componentId = "${e||"anonymous"}";\nconst __ladrillos_componentUrl = "${t||"unknown"}";\n\n// Global event bus (shared across all components)\nif (!globalThis.__ladrillosEventBus) {\n globalThis.__ladrillosEventBus = {\n listeners: new Map(),\n componentListeners: new Map()\n };\n}\n\n// Global state change callbacks (for reactive array updates)\nif (!globalThis.__ladrillosStateCallbacks) {\n globalThis.__ladrillosStateCallbacks = new Map();\n}\n\n// Reactive array symbol\nconst __REACTIVE_ARRAY = Symbol.for("ladrillos-reactive-array");\n\n// Array mutation methods to intercept\nconst __ARRAY_METHODS = ["push", "pop", "shift", "unshift", "splice", "sort", "reverse", "fill", "copyWithin"];\n\n// Wrap an array in a reactive proxy. stateKey is the local binding name the\n// array is exported/merged into component state under; passing it to the\n// component's callback lets mutations refresh the text/attribute bindings\n// that depend on that key (not just directives).\nconst __wrapReactiveArray = (arr, componentId, stateKey) => {\n if (!Array.isArray(arr) || arr[__REACTIVE_ARRAY]) return arr;\n\n const onMutate = () => {\n const callback = globalThis.__ladrillosStateCallbacks?.get(componentId);\n if (callback) callback(stateKey);\n };\n\n return new Proxy(arr, {\n get(target, key) {\n if (key === __REACTIVE_ARRAY) return true;\n const value = target[key];\n if (typeof key === "string" && __ARRAY_METHODS.includes(key) && typeof value === "function") {\n return (...args) => {\n const result = value.apply(target, args);\n onMutate();\n return result;\n };\n }\n if (Array.isArray(value)) return __wrapReactiveArray(value, componentId, stateKey);\n return value;\n },\n set(target, key, value) {\n const index = parseInt(key, 10);\n const isIndex = !isNaN(index);\n const isLength = key === "length";\n target[key] = Array.isArray(value) ? __wrapReactiveArray(value, componentId, stateKey) : value;\n if (isIndex || isLength) onMutate();\n return true;\n }\n });\n};\n\nconst __ladrillos_emit = (eventName, data) => {\n const listeners = globalThis.__ladrillosEventBus.listeners.get(eventName);\n if (!listeners || listeners.size === 0) return;\n for (const registration of listeners) {\n try {\n registration.callback(data);\n } catch (error) {\n console.error(\`[LadrillosJS] Error in event listener for "\${eventName}":\`, error);\n }\n }\n};\n${r("$emit","const $emit = __ladrillos_emit;")}\n\nconst __ladrillos_listen = (eventName, callback) => {\n const bus = globalThis.__ladrillosEventBus;\n let listeners = bus.listeners.get(eventName);\n if (!listeners) {\n listeners = new Set();\n bus.listeners.set(eventName, listeners);\n }\n const registration = { callback, componentId: __ladrillos_componentId };\n listeners.add(registration);\n\n // Track by component ID for cleanup\n let componentRegs = bus.componentListeners.get(__ladrillos_componentId);\n if (!componentRegs) {\n componentRegs = new Set();\n bus.componentListeners.set(__ladrillos_componentId, componentRegs);\n }\n componentRegs.add({ event: eventName, registration });\n\n // Return unsubscribe function\n return () => {\n listeners?.delete(registration);\n if (listeners?.size === 0) bus.listeners.delete(eventName);\n const compRegs = bus.componentListeners.get(__ladrillos_componentId);\n if (compRegs) {\n for (const reg of compRegs) {\n if (reg.registration === registration) {\n compRegs.delete(reg);\n break;\n }\n }\n if (compRegs.size === 0) bus.componentListeners.delete(__ladrillos_componentId);\n }\n };\n};\n${r("$listen","const $listen = __ladrillos_listen;")}\n\n// Global refs registry (shared across all components)\n// Each component gets its own Map, keyed by component ID\nif (!globalThis.__ladrillosRefs) {\n globalThis.__ladrillosRefs = new Map();\n}\n\n// Helper to wrap refs Map in Proxy for cleaner dot notation access\nconst __createRefsProxy = (map) => new Proxy(map, {\n get(target, prop, receiver) {\n if (prop in target) {\n const value = Reflect.get(target, prop, receiver);\n return typeof value === "function" ? value.bind(target) : value;\n }\n if (typeof prop === "string") return target.get(prop);\n return undefined;\n },\n set(target, prop, value) {\n if (typeof prop === "string") { target.set(prop, value); return true; }\n return false;\n },\n has(target, prop) {\n return typeof prop === "string" ? target.has(prop) || prop in target : prop in target;\n }\n});\n\n// Get or create refs Map for this component (wrapped in Proxy)\nif (!globalThis.__ladrillosRefs.has(__ladrillos_componentId)) {\n globalThis.__ladrillosRefs.set(__ladrillos_componentId, __createRefsProxy(new Map()));\n}\n\n// $refs for this component - supports both $refs.inputEl and $refs.get("inputEl")\nconst __ladrillos_refs = globalThis.__ladrillosRefs.get(__ladrillos_componentId);\n${r("$refs","const $refs = __ladrillos_refs;")}\n\n// Helper to resolve relative paths against component URL\nconst __resolvePath = (path) => {\n if (path.startsWith("http://") || path.startsWith("https://") || path.startsWith("/")) {\n return path.startsWith("/") ? new URL(path, window.location.origin).href : path;\n }\n return new URL(path, __ladrillos_componentUrl).href;\n};\n\n// Helper to convert filename to tag name\nconst __filenameToTagName = (path) => {\n const filename = path.split("/").pop()?.replace(/\\.[^.]+$/, "") || path;\n return filename.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\\s]+/g, "-").toLowerCase();\n};\n\n// registerComponent - Register a child component\nconst __ladrillos_registerComponent = async (name, path, useShadowDOM = true) => {\n const resolvedPath = __resolvePath(path);\n return globalThis.ladrillosjs.registerComponent({ name, path: resolvedPath, useShadowDOM });\n};\n${r("registerComponent","const registerComponent = __ladrillos_registerComponent;")}\n\n// registerComponents - Register multiple components at once\nconst __ladrillos_registerComponents = async (configs) => {\n const resolvedConfigs = configs.map(config => ({\n ...config,\n path: __resolvePath(config.path)\n }));\n return globalThis.ladrillosjs.registerComponents(resolvedConfigs);\n};\n${r("registerComponents","const registerComponents = __ladrillos_registerComponents;")}\n\n// $use - Shorthand for registerComponent with auto-derived tag name\nconst __ladrillos_use = async (path, useShadowDOM = true) => {\n const tagName = __filenameToTagName(path);\n return __ladrillos_registerComponent(tagName, path, useShadowDOM);\n};\n${r("$use","const $use = __ladrillos_use;")}\n\n// === End Framework Helpers ===\n\n`}(t,n||e.src,i)+s,c=new Blob([a],{type:"text/javascript"}),l=URL.createObjectURL(c);try{return await(0,eval)(`import("${l}")`)}finally{URL.revokeObjectURL(l)}}catch(N){throw N}}var F=/* @__PURE__ */new Map;async function z(e){if(C.has(e))return C.get(e);const t=(async()=>{try{return await(0,eval)(`import("${e}")`)}catch(N){throw N}})();return C.set(e,t),t}function U(e,t){return t&&Array.isArray(e)?_(e,t):e}async function W(n,r,o,s,i,l,u){if("module"!==n.type)throw new Error('executeModuleScriptWithReactivity only handles type="module" scripts');const f=n.content,p=await async function(e,t,n){const r=function(e){const t=[],n=/import\s+(?:(\{[^}]+\})|(\*\s+as\s+\w+)|(\w+)(?:\s*,\s*(\{[^}]+\}))?)?\s*(?:from\s+)?['"]([^'"]+)['"]/g;let r;for(;null!==(r=n.exec(e));){const[e,n,o,s,i,a]=r,c={statement:e,specifier:a,imports:[],isDefault:!1,isNamespace:!1,isSideEffect:!1};if(n||o||s||(c.isSideEffect=!0),s&&(c.isDefault=!0,c.imports.push({imported:"default",local:s})),o){c.isNamespace=!0;const e=o.replace(/\*\s+as\s+/,"").trim();c.imports.push({imported:"*",local:e})}const l=n||i;if(l){const e=l.slice(1,-1).split(",").map(e=>e.trim()).filter(Boolean);for(const t of e){const e=t.match(/(\w+)\s+as\s+(\w+)/);c.imports.push(e?{imported:e[1],local:e[2]}:{imported:t,local:t})}}t.push(c)}return t}(e),o={};for(const s of r){if(s.isSideEffect){await z(L(s.specifier)?new URL(s.specifier,t).href:s.specifier);continue}const e=L(s.specifier)?new URL(s.specifier,t).href:s.specifier;try{const t=await z(e);for(const e of s.imports){let r;r="*"===e.imported?t:"default"===e.imported?t.default:t[e.imported],o[e.local]=U(r,n)}}catch(N){}}return o}(f,r,l);if(i){const t=/* @__PURE__ */new Set([...c,...e,"ladrillosjs","$host","$refs","event","state"]);for(const[e,n]of Object.entries(p))t.has(e)||e in i||(i[e]=n)}const d=function(e){return e.replace(/import\s+(?:(?:\{[^}]+\}|\*\s+as\s+\w+|\w+)(?:\s*,\s*\{[^}]+\})?\s+from\s+)?['"][^'"]+['"]\s*;?/g,"").trim()}(f),{variables:h,functions:m}=function(e){const t=[],n=[],r=e.replace(/`[^`]*`/g,e=>" ".repeat(e.length)).replace(/"(?:[^"\\]|\\.)*"/g,e=>" ".repeat(e.length)).replace(/'(?:[^'\\]|\\.)*'/g,e=>" ".repeat(e.length)).replace(/\/\*[\s\S]*?\*\//g,e=>" ".repeat(e.length)).replace(/\/\/[^\n]*/g,e=>" ".repeat(e.length));let o=0,s=0;for(;s<r.length;){const e=r[s];if("{"!==e)if("}"!==e){if(0===o){const e=r.slice(s).match(/^(?:async\s+)?function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(e){n.push(e[1]),s+=e[0].length;continue}const o=r.slice(s).match(/^(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(o){t.push(o[1]),s+=o[0].length;continue}}s++}else o--,s++;else o++,s++}return{variables:t,functions:n}}(d),g=B(d,h),_=Object.keys(p),y=Object.values(p),v=`\n "use strict";\n return (async () => {\n ${g}\n ${m.length>0?`return { ${m.join(", ")} };`:"return {};"}\n })();\n `;try{const n=["console","alert","Math","JSON","Date","Array","Object","String","Number","Boolean","Promise","setTimeout","setInterval","clearTimeout","clearInterval"],l=n.map(e=>globalThis[e]),f=["$refs","__state__","$host"],p=[s||/* @__PURE__ */new Map,i||{},u],d=a(r),h=[d.registerComponent,d.registerComponents,d.$use],m=t(o||"anonymous"),g=[m.$emit,m.$listen],b={...globalThis.ladrillosjs||{},registerComponent:d.registerComponent,registerComponents:d.registerComponents},w={registerComponent:d.registerComponent,registerComponents:d.registerComponents,$use:d.$use,$emit:m.$emit,$listen:m.$listen,ladrillosjs:b},E=new Set(_),A=[..._],$=_.map((e,t)=>e in w?w[e]:y[t]),N=(e,t)=>{for(let n=0;n<e.length;n++){const r=e[n];E.has(r)||(E.add(r),A.push(r),$.push(t[n]))}};N(n,l),N(c,h),N(e,g),N(f,p),N(["ladrillosjs"],[b]);const x=await new Function(...A,v)(...$);return{...i||{},...x||{}}}catch(N){throw N}}function B(e,t){if(0===t.length)return e;const n=[],r=e=>(n.push(e),`__STRING_PLACEHOLDER_${n.length-1}__`);let o="",s=0;for(;s<e.length;){const n=e[s];if("/"===n&&"/"===e[s+1]){const t=e.indexOf("\n",s),n=-1===t?e.length:t;o+=e.slice(s,n),s=n;continue}if("/"===n&&"*"===e[s+1]){const t=e.indexOf("*/",s+2),n=-1===t?e.length:t+2;o+=e.slice(s,n),s=n;continue}if('"'===n||"'"===n){let t=s+1;for(;t<e.length&&e[t]!==n;)"\\"===e[t]?t+=2:t++;o+=r(e.slice(s,t+1)),s=t+1;continue}if("`"===n){o+="`",s++;let n=s;for(;s<e.length&&"`"!==e[s];)if("\\"!==e[s]){if("$"===e[s]&&"{"===e[s+1]){s>n&&(o+=r(e.slice(n,s))),o+="${",s+=2;const i=s;let a=1;for(;s<e.length&&a>0;){const t=e[s];if('"'!==t&&"'"!==t){if("`"===t){s++;let t=0;for(;s<e.length;)if("\\"!==e[s]){if("`"===e[s]&&0===t){s++;break}"$"!==e[s]||"{"!==e[s+1]?("}"===e[s]&&t>0&&t--,s++):(t++,s+=2)}else s+=2;continue}if("{"===t)a++;else if("}"===t&&(a--,0===a))break;s++}else{for(s++;s<e.length&&e[s]!==t;)"\\"===e[s]?s+=2:s++;s++}}o+=B(e.slice(i,s),t),"}"===e[s]&&s++,o+="}",n=s;continue}s++}else s+=2;s>n&&(o+=r(e.slice(n,s))),o+="`",s++;continue}o+=n,s++}for(const a of t){const e=new RegExp(`\\b(let|const|var)\\s+(${H(a)})\\s*=`,"g");o=o.replace(e,`__state__.${a} ??=`)}for(const a of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${H(a)}\\b(?!\\s*[:(])`,"g");o=o.replace(e,`__state__.${a}`)}let i=o;for(let a=0;a<n.length;a++)i=i.replace(`__STRING_PLACEHOLDER_${a}__`,n[a]);return i}function H(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Z="data-l-ctrl",q=/* @__PURE__ */new Set(["FOR","IF","ELSE-IF","ELSE","SHOW"]),X=/<(for|else-if|if|else|show)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/gi,V=/<\/(for|else-if|if|else|show)\s*>/gi,G=/(<script\b[\s\S]*?<\/script\s*>|<style\b[\s\S]*?<\/style\s*>|<!--[\s\S]*?-->)/gi,K=/<\/?(?:for|if|else|show)\b/i;function J(e){return K.test(e)?e.split(G).map((e,t)=>t%2==1?e:e.replace(X,(e,t,n)=>`<template ${Z}="${t.toLowerCase()}"${n}>`).replace(V,"</template>")).join(""):e}function Y(e){let t;for(;t=e.querySelector(`template[${Z}]`);){const e=t.ownerDocument.createElement(t.getAttribute(Z));for(const n of Array.from(t.attributes))n.name!==Z&&e.setAttribute(n.name,n.value);e.appendChild(t.content),t.replaceWith(e)}for(const n of Array.from(e.querySelectorAll("template")))Y(n.content)}function Q(e){return q.has(e.tagName)}var ee=new DOMParser,te=["___vscode_livepreview_injected_script","/livereload.js","browser-sync-client","browser-sync/dist","webpack-dev-server","sockjs-node","__webpack_hmr"],ne=["aka.ms/live-preview","Live Preview Extension","___vscode_livepreview","__bs_script__","browser-sync","Browsersync","browserSync","LiveReload","webpackHotUpdate","__webpack_hmr"],re=["__bs_script__"];async function oe(e,t,n){const r=function(e){const t=ee.parseFromString(J(e),"text/html");Y(t.head),Y(t.body);const n=Array.from(t.head.children).filter(Q),r=t.body.firstChild;for(const o of n)t.body.insertBefore(o,r);return t}(e),o=Array.from(r.querySelectorAll("script")),i=o.filter(e=>!function(e){const t=e.getAttribute("src")||"";if(t&&te.some(e=>t.includes(e)))return!0;const n=e.getAttribute("id")||"";if(n&&re.includes(n))return!0;const r=e.textContent||"";return!(!r||!ne.some(e=>r.includes(e)))}(e)),a=i.filter(e=>!e.src).map(e=>({content:(e.textContent??"").trim(),type:e.getAttribute("type")})).filter(e=>e.content.length>0),c=i.filter(e=>(e.getAttribute("src")||"").includes("html-proxy")&&"module"===e.getAttribute("type")),l=[...a,...(await Promise.all(c.map(async e=>{const t=e.getAttribute("src")||"";try{const e=await fetch(t);if(e.ok)return{content:(await e.text()).trim(),type:"module"}}catch(n){}return null}))).filter(e=>null!==e&&e.content.length>0)],u=i.filter(e=>{if(!e.src)return!1;const t=e.getAttribute("src")||"";return!t.includes("@vite/client")&&!t.includes("html-proxy")}).map(e=>{const t=e.getAttribute("type");let r=e.src;if(n)try{r=new URL(e.getAttribute("src")??e.src,n).toString()}catch{}return{src:r,type:t,external:e.hasAttribute("external")}}).filter(e=>e.src.length>0),f=u.filter(e=>!e.external),p=u.filter(e=>e.external),d=await Promise.all(f.map(async e=>{try{const t=await fetch(e.src);if(t.ok){let n=(await t.text()).trim();if(n.length>0)return"module"===e.type&&(n=I(n,e.src)),{content:n,type:e.type}}}catch{}return null}));for(const s of d)s&&l.push(s);o.forEach(e=>e.remove());const h=Array.from(r.querySelectorAll('link[rel="stylesheet"]')),m=h.map(e=>{let t=e.getAttribute("href")||"";const r=e.getAttribute("rel")||"stylesheet";if(n&&t&&!t.startsWith("http"))try{t=new URL(t,n).toString()}catch{}return{href:t,rel:r}}).filter(e=>e.href.length>0);h.forEach(e=>e.remove());const g=Array.from(r.querySelectorAll("style")),_=g.map(e=>e.textContent??"").join("\n").trim();g.forEach(e=>e.remove());const y=e=>e?Array.from(e.children).find(e=>"TEMPLATE"===e.tagName):void 0,v=y(r.body)??y(r.head);let b;if(v){const e=document.createElement("div");e.appendChild(v.content.cloneNode(!0)),b=e.innerHTML.trim()}else b=r.body.innerHTML.trim();const w=function(e){const t=/* @__PURE__ */new Set,n=function(e){const t=/* @__PURE__ */new Set,n=/<for\b[^>]*?\beach\s*=\s*["']([^"']+)["'][^>]*>/gi;let r;for(;null!==(r=n.exec(e));){const e=r[1].trim(),n=e.match(/^\(\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*,\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\)\s+in\s+/);if(n){t.add(n[1]),t.add(n[2]);continue}const o=e.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s+in\s+/);o&&t.add(o[1])}return t}(e),r=e.matchAll(s);for(const o of r){const e=o[1].trim().match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);if(e){const r=e[1];["true","false","null","undefined","new","this","typeof","instanceof","void","delete","in","of","if","else","for","while","do","switch","case","break","continue","return","throw","try","catch","finally","function","class","const","let","var","Math","Date","JSON","Array","Object","String","Number","Boolean","console","window","document"].includes(r)||n.has(r)||t.add(r)}}for(const o of function(e){const t=/* @__PURE__ */new Set,n=/<for\b[^>]*?\beach\s*=\s*["']([^"']+)["'][^>]*>/gi;let r;for(;null!==(r=n.exec(e));){const e=r[1].trim().match(/\bin\b\s+(.+)$/);if(!e)continue;const n=e[1].trim().match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);n&&t.add(n[1])}return t}(e))n.has(o)||t.add(o);return Array.from(t)}(b);return{tagName:t,template:b,scripts:l,externalScripts:p,externalStyles:m,styles:_,sourcePath:n,lazy:!1,templateBindings:w}}var se=/* @__PURE__ */new Map,ie=25,ae=(e,t)=>{if(se.has(e))se.delete(e);else if(se.size>=ie){const e=se.keys().next().value;e&&se.delete(e)}se.set(e,t)};async function ce(e){if(!e)throw new Error("Path cannot be null or empty");const t=(e=>{const t=se.get(e);return t&&(se.delete(e),se.set(e,t)),t})(e);if(t)return{source:t,resolvedPath:e};try{const t=await async function(e){if(e.endsWith(".html")){const t=await fetch(e);return t.ok?{path:e,response:t}:null}const t=e.endsWith("/")?e.slice(0,-1):e,n=`${t}/index.html`;try{const e=await fetch(n);if(e.ok)return{path:n,response:e}}catch{}try{const e=await fetch(t);if(e.ok&&(e.headers.get("content-type")||"").includes("text/html"))return{path:t,response:e}}catch{}return null}(e);if(!t)throw new Error(`Failed to fetch component from ${e}: Could not resolve path. Tried: ${e}${e.endsWith(".html")?"":` and ${e}/index.html`}`);const n=await t.response.text();return ae(e,n),t.path!==e&&ae(t.path,n),{source:n,resolvedPath:t.path}}catch(N){return}}function le(e){const t=e.trim(),n=function(e){const t=function(e){let t=0,n=0,r=0,o=!1,s=!1,i=!1,a=!1;for(let c=0;c<e.length;c++){const l=e[c];if(a)a=!1;else if("\\"!==l)if(s||i||"'"!==l)if(o||i||'"'!==l)if(o||s||"`"!==l){if(!(o||s||i)&&("("===l?t++:")"===l?t=Math.max(0,t-1):"["===l?n++:"]"===l?n=Math.max(0,n-1):"{"===l?r++:"}"===l&&(r=Math.max(0,r-1)),"("===l&&0===t&&0===n&&0===r))return c}else i=!i;else s=!s;else o=!o;else a=!0}return-1}(e);if(t<0)return null;const n=function(e,t){let n=0,r=!1,o=!1,s=!1,i=!1;for(let a=t;a<e.length;a++){const t=e[a];if(i)i=!1;else if("\\"!==t)if(o||s||"'"!==t)if(r||s||'"'!==t)if(r||o||"`"!==t){if(!(r||o||s))if("("===t)n++;else if(")"===t){if(n--,0===n)return a;if(n<0)return-1}}else s=!s;else o=!o;else r=!r;else i=!0}return-1}(e,t);if(n<0)return null;if(0!==e.slice(n+1).trim().length)return null;const r=ue(e.slice(0,t).trim());return r?{calleePath:r,args:fe(e.slice(t+1,n))}:null}(t);if(n)return{raw:t,path:n.calleePath,isFunction:!0,isExpression:!0,functionArgs:n.args};const r=ue(t);return r?{raw:t,path:r,isFunction:!1,isExpression:!1}:{raw:t,path:[],isExpression:!0}}function ue(e){return/^[$A-Z_][0-9A-Z_$]*(?:\s*\.\s*[$A-Z_][0-9A-Z_$]*)*$/i.test(e)?e.split(".").map(e=>e.trim()).filter(e=>e.length>0):null}function fe(e){const t=[];let n="",r=0,o=0,s=0,i=!1,a=!1,c=!1,l=!1;for(let f=0;f<e.length;f++){const u=e[f];if(l)n+=u,l=!1;else if("\\"!==u)if(a||c||"'"!==u)if(i||c||'"'!==u)if(i||a||"`"!==u){if(!i&&!a&&!c&&("("===u?r++:")"===u?r=Math.max(0,r-1):"["===u?o++:"]"===u?o=Math.max(0,o-1):"{"===u?s++:"}"===u&&(s=Math.max(0,s-1)),","===u&&0===r&&0===o&&0===s)){const e=n.trim();e.length>0&&t.push(e),n="";continue}n+=u}else c=!c,n+=u;else a=!a,n+=u;else i=!i,n+=u;else n+=u,l=!0}const u=n.trim();return u.length>0&&t.push(u),t}var pe=globalThis.requestIdleCallback||(e=>setTimeout(e,1)),de=globalThis.cancelIdleCallback||(e=>clearTimeout(e)),he=(e=1e4)=>t=>{const n=pe(t,{timeout:e});return()=>de(n)},me=e=>(t,n)=>{if(function(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:s,innerWidth:i}=window;return(t>0&&t<s||r>0&&r<s)&&(n>0&&n<i||o>0&&o<i)}(n))return void t();const r=new IntersectionObserver(e=>{for(const n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return r.observe(n),()=>r.disconnect()},ge=e=>t=>{if(!e)return void t();const n=matchMedia(e);if(n.matches)return void t();const r=()=>t();return n.addEventListener("change",r,{once:!0}),()=>n.removeEventListener("change",r)},_e=(e=["click","focusin"])=>{const t="string"==typeof e?[e]:e;return(e,n)=>{let r=!1;const o=t=>{r||(r=!0,s(),e(),queueMicrotask(()=>{t.target&&t.target instanceof Element&&t.target.dispatchEvent(new t.constructor(t.type,t))}))},s=()=>{for(const e of t)n.removeEventListener(e,o)};for(const i of t)n.addEventListener(i,o,{once:!0,passive:!0});return s}},ye=(e=0)=>t=>{const n=setTimeout(t,e);return()=>clearTimeout(n)},ve=me({rootMargin:"100px"});function be(e){const t=e.querySelector(':scope > template[slot="placeholder"]');return t?(t.remove(),t.content.cloneNode(!0)):null}function we(e){const t=e.parentNode;if(!t)return;const n=function(e){if(e.hasAttribute("eager"))return null;if(e.hasAttribute("interaction")){const t=(e.getAttribute("interaction")||"").trim();if(!t)return _e();const n=t.split(",").map(e=>e.trim()).filter(Boolean);return _e(1===n.length?n[0]:n)}if(e.hasAttribute("media"))return ge(e.getAttribute("media")||"");if(e.hasAttribute("delay"))return ye(Number(e.getAttribute("delay"))||0);if(e.hasAttribute("idle")||e.hasAttribute("idle-timeout")){const t=e.getAttribute("idle-timeout");return t?he(Number(t)||1e4):he()}const t={},n=e.getAttribute("margin");n&&(t.rootMargin=n);const r=e.getAttribute("threshold");if(null!==r){const e=Number(r);Number.isNaN(e)||(t.threshold=e)}return Object.keys(t).length>0?me(t):ve}(e),r=e.getAttribute("src"),o=e.getAttribute("component"),s=/* @__PURE__ */new Set(["eager","visible","margin","threshold","idle","idle-timeout","delay","interaction","media","src","component"]),i=document.createComment(r?` <lazy src="${r}"> `:" <lazy> ");if(t.insertBefore(i,e),e.remove(),r){const t=(o||(a=r,(a.split(/[?#]/)[0].split("/").pop()?.replace(/\.[^.]+$/,"")||a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase())).trim();if(!t.includes("-"))return;const c=be(e),l=()=>{const n=document.createElement(t);for(const t of Array.from(e.attributes))s.has(t.name)||n.setAttribute(t.name,t.value);i.parentNode?.replaceChild(n,i)};let u=null;c&&(u=document.createComment(" /lazy-placeholder "),i.parentNode?.insertBefore(u,i.nextSibling),i.parentNode?.insertBefore(c,u));const f=async()=>{try{if(customElements.get(t)||await async function(e,t){return(await Promise.resolve().then(()=>In)).ladrillos.registerComponent(e,t,!0,!1)}(t,r),u){let e=i.nextSibling;for(;e&&e!==u;){const t=e.nextSibling;e.parentNode?.removeChild(e),e=t}u.parentNode?.removeChild(u)}l()}catch(e){}};if(!n)return void f();const p=document.createElement("span");let d;p.setAttribute("data-lazy-sentinel",""),p.style.cssText="display:inline-block;width:0;height:0;padding:0;margin:0;border:0;",i.parentNode?.insertBefore(p,i.nextSibling);const h=()=>{d?.(),p.remove(),f()};return void(d=n(h,p))}var a;const c=be(e),l=document.createDocumentFragment();for(;e.firstChild;)l.appendChild(e.firstChild);const u=document.createComment(" /lazy ");i.parentNode?.insertBefore(u,i.nextSibling),c&&i.parentNode?.insertBefore(c,u);const f=()=>{let e=i.nextSibling;for(;e&&e!==u;){const t=e.nextSibling;e.parentNode?.removeChild(e),e=t}u.parentNode?.insertBefore(l,u)};if(!n)return void f();const p=document.createElement("span");let d;p.setAttribute("data-lazy-sentinel",""),p.style.cssText="display:inline-block;width:0;height:0;padding:0;margin:0;border:0;",i.parentNode?.insertBefore(p,i.nextSibling),p.__lazyContent=l,d=n(()=>{d?.(),p.remove(),f()},p)}function Ee(e){const t=Array.from(e.querySelectorAll("lazy"));for(const n of t)Ae(n)||we(n)}function Ae(e){let t=e.parentElement;for(;t;){if("FOR"===t.tagName)return!0;t=t.parentElement}return!1}function $e(e){const t=[],n=e.querySelectorAll("[data-lazy-sentinel]");for(const r of Array.from(n)){const e=r.__lazyContent;e&&t.push(e)}return t}function Ne(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let r;for(;r=n.nextNode();){if(xe(r)||Se(r))continue;const e=r.textContent;if(!e)continue;const n=[...e.matchAll(s)];if(n.length>0){const o=e,s=n.map(e=>le(e[1].trim()));t.push({node:r,bindings:s,original:o})}}const o=function(e){const t=[],n=["$bind","$ref","$no:bind","condition","each","key","track-by"],r=Array.from(e.querySelectorAll("*"));for(const o of r)if("FOR"!==o.tagName&&!xe(o)&&!o.hasAttribute("$no:bind")&&!Se(o))for(const e of Array.from(o.attributes)){if(n.includes(e.name))continue;const r=[...e.value.matchAll(s)];if(r.length>0){const n=document.createTextNode(e.value),s=r.map(e=>le(e[1].trim()));t.push({node:n,bindings:s,original:e.value,isAttribute:!0,attributeName:e.name,element:o})}}return t}(e);return t.push(...o),t}function xe(e){let t=(Node,e.parentElement);for(;t;){if("FOR"===t.tagName)return!0;t=t.parentElement}return!1}function Se(e){let t=e.parentElement;for(;t;){if(t.hasAttribute&&t.hasAttribute("$no:bind"))return!0;t=t.parentElement}return!1}var Ce=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","oninput","onsubmit","onreset","onscroll","onload","onerror","ontouchstart","ontouchmove","ontouchend","ontouchcancel","ondragstart","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondrop"],Re=new Set(Ce),ke="$bind";function Te(e){const t=e.currentTarget?.__ladrillosBindSync;t&&t.eventType===e.type&&t.sync()}var Le="$ref",Oe=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]+)$/,Me=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Ie=/^\(|\)$/g;function Pe(e){return e.replace(/\$/g,"\\$")}var De=Object.freeze(["alert","confirm","prompt","console","JSON","Math","Date","Array","Object","String","Number","Boolean","Map","Set","WeakMap","WeakSet","Symbol","BigInt","Promise","Proxy","Reflect","parseInt","parseFloat","isNaN","isFinite","Infinity","NaN","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","setTimeout","clearTimeout","setInterval","clearInterval","requestAnimationFrame","cancelAnimationFrame","requestIdleCallback","cancelIdleCallback","queueMicrotask","fetch","AbortController","AbortSignal","Headers","Request","Response","URL","URLSearchParams","navigator","location","history","localStorage","sessionStorage","crypto","document","window","globalThis","Element","HTMLElement","Event","CustomEvent","EventTarget","TextEncoder","TextDecoder","Blob","File","FileReader","FormData","Error","TypeError","RangeError","SyntaxError","ReferenceError","atob","btoa","structuredClone"]),je=Object.freeze([]),Fe=/* @__PURE__ */new Set(["with","eval","arguments","constructor","prototype","break","case","catch","continue","debugger","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","class","const","enum","export","extends","import","super","implements","interface","let","package","private","protected","public","static","yield","null","true","false"]),ze=(Object.freeze(["registerComponent","$use"]),{enter:"Enter",tab:"Tab",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",delete:"Delete",backspace:"Backspace",insert:"Insert",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"}),Ue=["ctrl","alt","shift","meta"],We=["prevent","stop","self","once","passive","capture"],Be={left:0,middle:1,right:2};function He(e){if(!e.startsWith("$on:"))return null;const t=e.slice(4).split(".");if(0===t.length||!t[0])return null;const n=t[0],r=t.slice(1),o={eventName:n,keyModifiers:[],systemModifiers:[],eventModifiers:[],mouseModifier:null,exact:!1};for(const s of r){const e=s.toLowerCase();"exact"!==e?We.includes(e)?o.eventModifiers.push(e):Ue.includes(e)?o.systemModifiers.push(e):e in Be?o.mouseModifier=e:o.keyModifiers.push(e):o.exact=!0}return o}function Ze(e){const t={};return e.includes("passive")&&(t.passive=!0),e.includes("capture")&&(t.capture=!0),e.includes("once")&&(t.once=!0),t}function qe(e,t){return function(n){t.eventModifiers.includes("self")&&n.target!==n.currentTarget||t.mouseModifier&&n instanceof MouseEvent&&!function(e,t){return e.button===Be[t]}(n,t.mouseModifier)||(t.systemModifiers.length>0||t.exact)&&(n instanceof KeyboardEvent||n instanceof MouseEvent)&&!function(e,t,n){const r={ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey};for(const o of t)if(!r[o])return!1;if(n)for(const o of Ue)if(!t.includes(o)&&r[o])return!1;return!0}(n,t.systemModifiers,t.exact)||t.keyModifiers.length>0&&n instanceof KeyboardEvent&&!t.keyModifiers.some(e=>function(e,t){const n=t.toLowerCase(),r=ze[n];if(r)return e.key===r;if(1===n.length)return e.key.toLowerCase()===n;const o=n.split("-").map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");return e.key.toLowerCase()===n||e.key.toLowerCase()===o.toLowerCase()}(n,e))||(t.eventModifiers.includes("prevent")&&n.preventDefault(),t.eventModifiers.includes("stop")&&n.stopPropagation(),e(n))}}function Xe(e){return e.startsWith("$on:")}var Ve=e=>e instanceof ShadowRoot?e.host:e;function Ge(e,t,n,r){const o=[e,...$e(e)];for(const s of o){const e=Array.from(s.querySelectorAll("*"));for(const o of e)if(!Je(o)){for(const e of Ce){const s=o.getAttribute(e);if(s){o.removeAttribute(e);const i=e.slice(2),a=Ye(s,t,n,r);a&&o.addEventListener(i,a)}}Ke(o,t,n,r)}}}function Ke(e,t,n,r){const o=Array.from(e.attributes).filter(e=>Xe(e.name));for(const s of o){const o=He(s.name);if(!o)continue;const i=s.value;e.removeAttribute(s.name);const a=Ye(i,t,n,r);if(!a)continue;const c=qe(a,o),l=Ze(o.eventModifiers);e.addEventListener(o.eventName,c,l)}}function Je(e){if(e.hasAttribute("$for")||"FOR"===e.tagName)return!0;let t=e.parentElement;for(;t;){if(t.hasAttribute("$for")||"FOR"===t.tagName)return!0;t=t.parentElement}return!1}function Ye(e,t,n,r){try{const o=r?.__componentUrl,s=r?.__componentId,i=at(o,s),a=it(),c=["event","__state__","$refs","$host",...a,...i.keys],l=Object.keys(t),u=l.filter(e=>"function"==typeof t[e]),f=l.filter(e=>"function"!=typeof t[e]),p=!0===t.__hasModuleScripts,d=f.length>0?`let { ${f.join(", ")} } = __state__;`:"",h=p&&u.length>0?`const { ${u.join(", ")} } = __state__;`:"",m=function(e,t){if(!e||0===t.length)return e;const n=[];let r=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,e=>(n.push(e),`__STRING_PLACEHOLDER_${n.length-1}__`));r=r.replace(/`(?:[^`\\$]|\\.|\$(?!\{)|\$\{[^}]*\})*`/g,e=>e.replace(/\$\{([^}]+)\}/g,(e,n)=>{let r=n;for(const o of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${st(o)}\\b(?!\\s*[:(])`,"g");r=r.replace(e,`__state__.${o}`)}return`\${${r}}`}));for(const s of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${st(s)}\\b(?!\\s*[:(])`,"g");r=r.replace(e,`__state__.${s}`)}let o=r;for(let s=0;s<n.length;s++)o=o.replace(`__STRING_PLACEHOLDER_${s}__`,n[s]);return o}(tt(n,p?u:[]),f),g=f.some(t=>new RegExp(`\\b${t}\\b`).test(e))?f.filter(t=>new RegExp(`\\b${t}\\b`).test(e)).map(e=>`__state__.${e} = ${e};`).join(" "):"",_=/\bawait\b/.test(e)||/\bawait\b/.test(m)||/\basync\b/.test(m),y=o||"ladrillos-event-handler",v=_?`"use strict"; ${d} ${h} ${m} try { await (async () => { ${e} })(); } finally { ${g} }\n//# sourceURL=${y}`:`"use strict"; ${d} ${h} ${m} ${e}; ${g}\n//# sourceURL=${y}`,b=Object.getPrototypeOf(async function(){}).constructor,w=_?new b(...c,v):new Function(...c,v);return e=>{try{Te(e);const n=[e,t,r&&r.__refs||/* @__PURE__ */new Map,r,...a.map(()=>{}),...i.values],o=w(...n);o&&"function"==typeof o.catch&&o.catch(e=>{const n={tagName:r?.tagName?.toLowerCase(),sourcePath:t.__componentUrl,instanceId:t.__componentId};x(0,e,{context:n.tagName?n:E(),errorCode:A.EVENT_HANDLER_FAILED})})}catch(n){const e={tagName:r?.tagName?.toLowerCase(),sourcePath:t.__componentUrl,instanceId:t.__componentId};x(0,n,{context:e.tagName?e:E(),errorCode:A.EVENT_HANDLER_FAILED})}}}catch(o){return r?.tagName&&r.tagName.toLowerCase(),null}}var Qe=/* @__PURE__ */new Map,et=500;function tt(e,t=[]){const n=t.join(",")+"\0"+e,r=Qe.get(n);if(void 0!==r)return r;const o=function(e,t=[]){const n=[],r=/(?:async\s+)?function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\([^)]*\)\s*\{/g;let o;for(;null!==(o=r.exec(e));){if(t.includes(o[1]))continue;const r=nt(e,o.index);r&&n.push(r)}const s=/(?:const|let)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>\s*\{/g;for(;null!==(o=s.exec(e));){if(t.includes(o[1]))continue;const r=o.index,s=nt(e,r,e.indexOf("{",r+o[0].length-1));s&&n.push(s)}return n.map(e=>e.trim()).join(";\n")+(n.length>0?";":"")}(e,t);if(Qe.size>=et){const e=Qe.keys().next().value;void 0!==e&&Qe.delete(e)}return Qe.set(n,o),o}function nt(e,t,n){let r=0,o=t,s=!1,i="",a=!1;for(let c=n??t;c<e.length;c++){const t=e[c];if('"'!==t&&"'"!==t&&"`"!==t||"\\"===(c>0?e[c-1]:"")||(s?t===i&&(s=!1):(s=!0,i=t)),!s&&("{"===t&&(r++,a=!0),"}"===t&&r--,a&&0===r&&"}"===t)){o=c+1;break}}return 0!==r?null:e.slice(t,o)}function rt(e,t,n,r,o,s,i=[]){try{const a=ot(e),c=`\n "use strict";\n ${function(e,t){if(0===t.length)return e;const n=[];let r=e.replace(/(["'])(?:(?!\1)[^\\]|\\.)*\1/g,e=>(n.push(e),`__STRING_PLACEHOLDER_${n.length-1}__`));r=r.replace(/`(?:[^`\\$]|\\.|\$(?!\{)|\$\{[^}]*\})*`/g,e=>e.replace(/\$\{([^}]+)\}/g,(e,n)=>{let r=n;for(const o of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${st(o)}\\b(?!\\s*[:(])`,"g");r=r.replace(e,`__state__.${o}`)}return`\${${r}}`}));for(const s of t){const e=new RegExp(`\\b(let|const|var)\\s+(${st(s)})\\s*=`,"g");r=r.replace(e,`__state__.${s} ??=`)}for(const s of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${st(s)}\\b(?!\\s*[:(])`,"g");r=r.replace(e,`__state__.${s}`)}let o=r;for(let s=0;s<n.length;s++)o=o.replace(`__STRING_PLACEHOLDER_${s}__`,n[s]);return o}(e,[.../* @__PURE__ */new Set([...a,...i])])}\n//# sourceURL=${n||"ladrillos-component"}\n `,l=at(n,r),u=it(),f=["__state__","$host","$refs",...u,...l.keys],p=[t,o,s,...u.map(()=>{}),...l.values];new Function(...f,c)(...p)}catch(a){}}function ot(e){const t=function(e){const t=e.split(""),n=e.length;let r=0,o=0,s=!1;const i=[],a=()=>i.length>0,c=(e,n)=>{for(let r=e;r<n;r++){const e=t[r];"\n"!==e&&"\r"!==e&&(t[r]=" ")}},l=t=>{let r=t;for(;r<n&&"\n"!==e[r];)r++;return r},u=t=>{let r=t+2;for(;r<n-1&&("*"!==e[r]||"/"!==e[r+1]);)r++;return Math.min(n,r+2)},f=(t,r)=>{let o=t+1;for(;o<n;)if("\\"!==e[o]){if(e[o]===r)return o+1;if("\n"===e[o])return o;o++}else o+=2;return o},p=t=>{let r=t+1;for(;r<n;)if("\\"!==e[r]){if("`"===e[r])return r+1;if("$"===e[r]&&"{"===e[r+1]){r+=2;let t=1;for(;r<n&&t>0;){const n=e[r];"`"!==n?'"'!==n&&"'"!==n?"/"!==n||"/"!==e[r+1]?"/"!==n||"*"!==e[r+1]?("{"===n?t++:"}"===n&&t--,r++):r=u(r):r=l(r):r=f(r,n):r=p(r)}continue}r++}else r+=2;return r},d=t=>{let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n<0||!!"([{,;:!&|?=+-*%^~<>".includes(e[n])||/\b(return|typeof|delete|void|in|of|new|instanceof|throw)$/.test(e.slice(0,n+1))},h=t=>{let r=t+1,o=!1;for(;r<n;){const t=e[r];if("\\"!==t){if("["===t)o=!0;else if("]"===t)o=!1;else{if("/"===t&&!o){r++;break}if("\n"===t)break}r++}else r+=2}for(;r<n&&/[a-zA-Z]/.test(e[r]);)r++;return r};for(;r<n;){const m=e[r];if("/"===m&&"/"===e[r+1]){const e=l(r);a()&&c(r,e),r=e;continue}if("/"===m&&"*"===e[r+1]){const e=u(r);a()&&c(r,e),r=e;continue}if('"'===m||"'"===m){const e=f(r,m);a()&&c(r,e),r=e;continue}if("`"===m){const e=p(r);a()&&c(r,e),r=e;continue}if("/"===m&&d(r)){const e=h(r);a()&&c(r,e),r=e;continue}if("{"!==m)if("}"!==m)if("="!==m||">"!==e[r+1]){if(/[a-zA-Z_$]/.test(m)){const t=r;for(;r<n&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;const o=e.slice(t,r);a()?c(t,r):"function"===o&&(s=!0);continue}a()&&"\n"!==m&&"\r"!==m&&(t[r]=" "),r++}else{if(a())t[r]=" ",t[r+1]=" ";else{let t=r+2;for(;t<n;){const n=e[t];if(/\s/.test(n))t++;else if("/"!==n||"/"!==e[t+1]){if("/"!==n||"*"!==e[t+1])break;t=u(t)}else t=l(t)}"{"===e[t]&&(s=!0)}r+=2}else a()&&i[i.length-1]===o?i.pop():a()&&(t[r]=" "),o--,r++;else o++,s?(i.push(o),s=!1):a()&&(t[r]=" "),r++}return t.join("")}(e),n=[],r=/(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/g;let o;for(;null!==(o=r.exec(t));)n.push(o[1]);return n}function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(){return je.filter(e=>!Fe.has(e))}function at(n,r){const o=[],s=[];for(const e of De)e in globalThis&&(o.push(e),s.push(globalThis[e]));const i=a(n||window.location.href);o.push(...c),s.push(i.registerComponent,i.registerComponents,i.$use);const l=t(r||"anonymous");return o.push(...e),s.push(l.$emit,l.$listen),{keys:o,values:s}}var ct=/* @__PURE__ */new Map,lt=/^[A-Za-z_$][\w$]*$/,ut=null,ft=null;function pt(e,t){try{const n=Object.keys(t),r=[],o=[];for(let e=0;e<n.length;e++){const s=n[e];lt.test(s)&&(r.push(s),o.push(t[s]))}return dt(),mt(r,ht(r.join(",")),e)(...ft,...o)}catch(n){return x(0,n,{context:E()}),`{${e}}`}}function dt(){return null===ut&&(ut=it(),ft=ut.map(()=>{})),ut}function ht(e){let t=ct.get(e);if(!t){if(ct.size>=100){const e=ct.keys().next().value;void 0!==e&&ct.delete(e)}t=/* @__PURE__ */new Map,ct.set(e,t)}return t}function mt(e,t,n){let r=t.get(n);if(!r){if(t.size>=5e3){const e=t.keys().next().value;void 0!==e&&t.delete(e)}r=new Function(...ut,...e,`"use strict"; return ${n};`),t.set(n,r)}return r}function gt(e,t){const n=dt(),r=Object.keys(e),o=[];for(let h=0;h<r.length;h++)lt.test(r[h])&&o.push(r[h]);const s=o.join(","),i=ht(s),a=n.length,c=new Array(a+o.length).fill(void 0),l=()=>{for(let t=0;t<o.length;t++)c[a+t]=e[o[t]]},u=void 0!==t;let f=null,p=null;if(u){l(),f=[],p=[];for(const e of t){const t=o.indexOf(e);t>=0&&(f.push(a+t),p.push(e))}}const d=e=>{try{const t=mt(o,i,e);return u||l(),t.apply(null,c)}catch(t){return x(0,t,{context:E()}),`{${e}}`}};return d.sig=s,d.refresh=u?()=>{for(let t=0;t<f.length;t++)c[f[t]]=e[p[t]]}:l,d.compile=e=>{try{return mt(o,i,e)}catch(t){return x(0,t,{context:E()}),null}},d.invoke=(e,t)=>{try{return u||l(),e.apply(null,c)}catch(n){return x(0,n,{context:E()}),`{${t}}`}},d}var _t=/* @__PURE__ */new Set(["disabled","checked","readonly","required","selected","hidden","multiple","autofocus","open","novalidate","formnovalidate","inert","reversed","loop","muted","controls","autoplay","playsinline","default","ismap","allowfullscreen"]);function yt(e,t){if(function(e){if(!e.isAttribute||!e.attributeName)return!1;if(1!==e.bindings.length)return!1;const t=e.original.trim();return!!/^\{[\s\S]*\}$/.test(t)&&t.slice(1,-1).trim()===e.bindings[0].raw.trim()}(e)){const r=e.element??e.node.parentElement,o=pt(e.bindings[0].raw,t);return void(r&&(n=o,null===n||"object"!=typeof n&&"function"!=typeof n?function(e,t,n){_t.has(t)?n?e.setAttribute(t,""):e.removeAttribute(t):null!=n?e.setAttribute(t,String(n)):e.removeAttribute(t)}(r,e.attributeName,o):(r.hasAttribute?.(e.attributeName)&&r.removeAttribute(e.attributeName),r[e.attributeName]=o)))}var n;let r=e.original;for(const o of e.bindings){const e=pt(o.raw,t),n=String(e??"");r=r.replace(`{${o.raw}}`,n)}if(e.isAttribute&&e.attributeName){const t=e.element??e.node.parentElement;t&&t.setAttribute(e.attributeName,r)}else e.node.textContent=r}function vt(e,t){for(const n of e)yt(n,t)}var bt=!1;function wt(e){void 0!==e.cacheSize&&(e=>{if(!Number.isFinite(e)||e<1)throw new Error(`[LadrillosJS] configure({ cacheSize }) requires a positive integer, got ${e}`);for(ie=Math.floor(e);se.size>ie;){const e=se.keys().next().value;if(!e)break;se.delete(e)}})(e.cacheSize),void 0!==e.onError&&($=e.onError),void 0!==e.delegateLoopEvents&&(bt=e.delegateLoopEvents)}var Et="ELSE-IF",At="ELSE";function $t(e){const t=e.trim();return t.startsWith("{")&&t.endsWith("}")?t.slice(1,-1).trim():t}function Nt(e,t){const n=Array.from(e.querySelectorAll(`[${Pe(Le)}]`));for(const r of n){const e=r.getAttribute(Le);e&&(t.refs.set(e,r),r.removeAttribute(Le))}}function xt(e,t){const n=Array.from(e.querySelectorAll("for"));for(const r of n){if(!r.parentNode)continue;if(Ct(r))continue;const n=r.getAttribute("each")||r.getAttribute("of")||"";if(!n)continue;let o=Rt(n);if(!o)continue;const s=r.getAttribute("key")||r.getAttribute("track-by")||o.key,i=St(r);if(!i)continue;const a=document.createComment(` <for> ${n} `),c=r.parentElement||e;c.insertBefore(a,r),r.remove();const l={template:i,expression:n,itemName:o.item,indexName:o.index,arrayName:o.array,keyAttribute:s,placeholder:a,renderedElements:[],originalParent:c,hasConditionals:null!==i.querySelector("IF")};t.loops.push(l)}}function St(e){const t=[];for(const r of Array.from(e.childNodes))(r.nodeType!==Node.TEXT_NODE||r.textContent?.trim())&&t.push(r);if(0===t.length)return null;if(1===t.length&&t[0].nodeType===Node.ELEMENT_NODE)return t[0];const n=document.createElement("span");n.style.display="contents";for(const r of Array.from(e.childNodes))n.appendChild(r);return n}function Ct(e){let t=e.parentElement;for(;t;){if("FOR"===t.tagName)return!0;t=t.parentElement}return!1}function Rt(e){const t=e.match(Oe);if(!t)return null;let n,[,r,o]=t;r=r.trim(),o=o.trim();const s=o.match(/\s+track\s+by\s+(.+)$/i);s&&(n=s[1].trim(),o=o.slice(0,s.index).trim());const i=r.replace(Ie,"").trim(),a=i.match(Me);let c,l,u;return a?(c=i.replace(Me,"").trim(),l=a[1]?.trim(),u=a[2]?.trim()):c=i,{item:c,index:l||u,key:n,array:o}}function kt(e,t){const n=Array.from(e.querySelectorAll("if"));for(const r of n){if(Ct(r))continue;const n=[],o=$t(r.getAttribute("condition")||""),s=document.createComment(` <if> ${o} `),i=r.parentElement||e,a=r.nextSibling;i.insertBefore(s,r),n.push(Tt(r,o,"if",s,i,a));let c=r.nextElementSibling;for(;c;){const e=c.tagName;if(e!==Et){if(e===At){n.push(Tt(c,"","else",s,i,c.nextSibling)),c.remove();break}break}{const e=$t(c.getAttribute("condition")||""),t=c.nextElementSibling;n.push(Tt(c,e,"else-if",s,i,c.nextSibling)),c.remove(),c=t}}r.remove();for(const e of n)e.group=n;t.conditionals.push(n)}}function Tt(e,t,n,r,o,s){return e.removeAttribute("condition"),e.style.display="contents",{element:e,condition:t,type:n,placeholder:r,group:[],originalParent:o,nextSibling:s}}function Lt(e,t){const n=Array.from(e.querySelectorAll("show"));for(const r of n){if(!r.parentNode)continue;if(Ct(r))continue;const e=$t(r.getAttribute("condition")||""),n=r;n.style.display="contents",t.showElements.push({element:n,expression:e,originalDisplay:"contents"}),r.removeAttribute("condition")}}function Ot(e,t){const n=Array.from(e.querySelectorAll(`[${Pe(ke)}]`));for(const r of n){const e=r.getAttribute(ke);if(!e)continue;if(Mt(r))continue;const n={element:r,path:e.split("."),raw:e,isContentEditable:r.hasAttribute("contenteditable")};t.twoWayBindings.push(n),r.removeAttribute(ke)}}function Mt(e,t){return Ct(e)}function It(e,t,n){const r=n(e.arrayName,t);if(!r||null==(o=r)||!Array.isArray(o)&&"function"!=typeof o[Symbol.iterator]&&"object"!=typeof o){for(const t of e.renderedElements)t.remove();return e.renderedElements=[],void(e.previousItems=[])}var o;const s=Array.from(r),i=e.previousItems||[],a=e.renderedElements;e.keyGetter||(e.keyGetter=function(e,t){if(!e)return(e,t)=>t;const n=e.startsWith(t+".")?e.slice(t.length+1).split("."):e.split(".");return e=>{let t=e;for(const r of n){if(null==t)return;t=t[r]}return t}}(e.keyAttribute,e.itemName));const c=function(e){const t=e.__scriptContent;return{...e,__reactiveState__:e,__scriptContent__:t||"",__componentUrl__:e.__componentUrl||""}}(t);c[e.itemName]=null,e.indexName&&(c[e.indexName]=0);const l="function"==typeof n.forContext?n.forContext(c,e.indexName?[e.itemName,e.indexName]:[e.itemName]):e=>n(e,c),u=(t,n)=>{c[e.itemName]=t,e.indexName&&(c[e.indexName]=n),l.refresh?.()};let f=null;const p=()=>f??=ln(t,e.indexName?[e.itemName,e.indexName]:[e.itemName]),d=(t,n,r)=>{const o=t[zt];o&&(o[e.itemName]=n,e.indexName&&(o[e.indexName]=r))},h=function(e){let t=Gt.get(e);return void 0===t&&(t=function(e){if(e.hasConditionals)return null;if(null!==e.template.querySelector("FOR"))return null;const t=[],n=[],r=[],o=[],s=e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e.attributes;for(let e=0;e<t.length;e++){const s=t[e];if(Re.has(s.name))r.push({path:o.slice(),attrName:s.name,eventName:s.name.slice(2),code:rn(s.value),directive:null});else if(Xe(s.name)){const e=He(s.name);e&&r.push({path:o.slice(),attrName:s.name,eventName:e.eventName,code:rn(s.value),directive:e,options:Ze(e.eventModifiers)})}else s.value.includes("{")&&n.push({path:o.slice(),name:s.name,parsed:jt(s.value)})}}else if(e.nodeType===Node.TEXT_NODE){const n=e.textContent;n&&n.includes("{")&&t.push({path:o.slice(),parsed:jt(n)})}const i=e.childNodes;for(let t=0;t<i.length;t++)o.push(t),s(i[t]),o.pop()};s(e.template);let i=r,a=null;const c=[];if(bt&&r.length>0){i=[];const t=/* @__PURE__ */new Map;for(const n of r)if(Zt(n.eventName,n.directive)){const r=n.path.join(",");let o=t.get(r);if(!o){const s=[];o={path:n.path,entries:s,stamp:{owner:e,entries:s}},t.set(r,o)}o.entries.push(n),c.includes(n.eventName)||c.push(n.eventName)}else i.push(n);t.size>0&&(a=[...t.values()])}return{texts:t,attrs:n,handlers:i,delegated:a,delegatedEvents:c}}(e),Gt.set(e,t)),t}(e),m=(t,r)=>{const o=e.template.cloneNode(!0);u(t,r);const s=Object.create(p().proto);return s[e.itemName]=t,e.indexName&&(s[e.indexName]=r),o[zt]=s,h?(function(e,t,n,r,o,s){const i=void 0!==n.invoke&&void 0!==n.sig,a=t=>{let n=e;for(let e=0;e<t.length;e++)n=n.childNodes[t[e]];return n},c=new Array(t.texts.length);for(let u=0;u<t.texts.length;u++){const{path:e,parsed:r}=t.texts[u],o=a(e);o.__originalTemplate=o.textContent;const{statics:s,exprs:l}=r,f=i?Dt(r,n):null;let p=s[0];for(let t=0;t<l.length;t++){const e=null!==f?f[t]:null,r=null!==e?n.invoke(e,l[t]):n(l[t]);p+=String(r??"")+s[t+1]}o.textContent=p,c[u]={node:o,parsed:r}}const l=new Array(t.attrs.length);for(let u=0;u<t.attrs.length;u++){const{path:e,name:r,parsed:o}=t.attrs[u],s=a(e).getAttributeNode(r);s.__originalTemplate=s.value;const{statics:c,exprs:f}=o,p=i?Dt(o,n):null;let d=c[0];for(let t=0;t<f.length;t++){const e=null!==p?p[t]:null,r=null!==e?n.invoke(e,f[t]):n(f[t]);d+=(null!==r&&"object"==typeof r?JSON.stringify(r):String(r??""))+c[t+1]}s.value=d,l[u]={attr:s,parsed:o}}if(t.handlers.length>0||null!==t.delegated){const n=o();for(const e of t.handlers){const t=a(e.path);t.removeAttribute(e.attrName);const o=fn(e.code,r,n);o&&(e.directive?t.addEventListener(e.eventName,qe(o,e.directive),e.options):t.addEventListener(e.eventName,o))}if(null!==t.delegated){e[Ht]=s;for(const e of t.delegated){const t=a(e.path);for(const n of e.entries)t.removeAttribute(n.attrName);t[Bt]=e.stamp}!function(e,t,n){let r=qt.get(e);r||(r={container:e.placeholder.parentNode??e.originalParent,setup:t,events:/* @__PURE__ */new Set},qt.set(e,r)),r.setup=t;for(const o of n)if(!r.events.has(o)){r.events.add(o);const t=r;r.container.addEventListener(o,n=>Xt(n,e,t))}}(s,n,t.delegatedEvents)}}e[Ft]={texts:c,attrs:l,conds:[]}}(o,h,l,s,p,e),o):(e.hasConditionals&&tn(o,c,n,l),nn(o,c,n,l,s,p),o)},g=new Array(s.length),_=new Array(s.length);if(s.length===i.length&&a.length===s.length){let t=!0;for(let e=0;e<s.length;e++)if(s[e]!==i[e]){t=!1;break}if(t){for(let e=0;e<s.length;e++)u(s[e],e),d(a[e],s[e],e),Kt(a[e],c,n,l,p);return void(e.previousItems=s)}}if(e.keyAttribute){const t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;for(let n=0;n<i.length;n++){const o=e.keyGetter(i[n],n);r.set(o,n),a[n]&&t.set(o,a[n])}const o=/* @__PURE__ */new Set;for(let n=0;n<s.length;n++)o.add(e.keyGetter(s[n],n));for(const[e,n]of t)o.has(e)||(n.remove(),t.delete(e));for(let i=0;i<s.length;i++){const o=s[i],a=e.keyGetter(o,i),f=t.get(a);f?(u(o,i),d(f,o,i),Kt(f,c,n,l,p),g[i]=f,_[i]=r.get(a)??-1):(g[i]=m(o,i),_[i]=-1)}}else{const e=Math.min(i.length,s.length);for(let t=0;t<s.length;t++)t<e?(u(s[t],t),d(a[t],s[t],t),Kt(a[t],c,n,l,p),g[t]=a[t],_[t]=t):(g[t]=m(s[t],t),_[t]=-1);for(let t=e;t<a.length;t++)a[t]?.remove()}const y=function(e){const t=e.length,n=/* @__PURE__ */new Set;if(0===t)return n;let r=-1,o=!0;for(let c=0;c<t;c++){const t=e[c];if(!(t<0)){if(t<=r){o=!1;break}r=t}}if(o){for(let r=0;r<t;r++)e[r]>=0&&n.add(r);return n}const s=[],i=new Array(t).fill(-1);for(let c=0;c<t;c++){const t=e[c];if(t<0)continue;let n=0,r=s.length;for(;n<r;){const o=n+r>>1;e[s[o]]<t?n=o+1:r=o}n>0&&(i[c]=s[n-1]),s[n]=c}let a=s.length>0?s[s.length-1]:-1;for(;-1!==a;)n.add(a),a=i[a];return n}(_),v=e.placeholder.parentNode;if(v){let t=e.placeholder;for(let e=0;e<g.length;e++){const n=g[e];y.has(e)||t.nextSibling!==n&&v.insertBefore(n,t.nextSibling),t=n}}e.renderedElements=g,e.previousItems=[...s]}var Pt=/* @__PURE__ */new Map;function Dt(e,t){if(e.fnsSig!==t.sig){const n=new Array(e.exprs.length);for(let r=0;r<e.exprs.length;r++)n[r]=t.compile(e.exprs[r]);e.fns=n,e.fnsSig=t.sig}return e.fns}function jt(e){let t=Pt.get(e);if(t)return t;const n=[],r=[],o=/\{([^}]+)\}/g;let s,i=0;for(;s=o.exec(e);)n.push(e.slice(i,s.index)),r.push(s[1].trim()),i=s.index+s[0].length;return n.push(e.slice(i)),t={statics:n,exprs:r},Pt.set(e,t),t}var Ft="__ladrillosBindingCache",zt="__ladrillosLoopCtx";function Ut(e){const t=[],n=[],r=[],o=e=>{const t=e.attributes;for(let r=0;r<t.length;r++){const e=t[r].__originalTemplate;e&&n.push({attr:t[r],parsed:jt(e)})}};o(e);const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let i;for(;i=s.nextNode();)if(i.nodeType===Node.TEXT_NODE){const e=i.__originalTemplate;e&&t.push({node:i,parsed:jt(e)})}else i.nodeType===Node.ELEMENT_NODE?o(i):i[Jt]&&r.push(i);return{texts:t,attrs:n,conds:r}}var Wt=/* @__PURE__ */new Set(["click","dblclick","auxclick","contextmenu","mousedown","mouseup","mousemove","mouseover","mouseout","pointerdown","pointerup","pointermove","pointerover","pointerout","pointercancel","touchstart","touchend","touchmove","touchcancel","keydown","keyup","keypress","input","beforeinput","change","submit","reset","focusin","focusout","wheel","dragstart","drag","dragend","dragenter","dragover","dragleave","drop","cut","copy","paste"]),Bt="__ladrillosDelegated",Ht="__ladrillosLoopOwner";function Zt(e,t){if(!Wt.has(e))return!1;if(t){const e=t.eventModifiers;if(e.includes("self")||e.includes("capture")||e.includes("once")||e.includes("passive"))return!1}return!0}var qt=/* @__PURE__ */new WeakMap;function Xt(e,t,n){const r=n.container,o=[];let s=null,i=e.target;for(;i&&i!==r;){const e=i[Bt];if(e&&e.owner===t&&o.push(e.entries),i[Ht]===t){s=i[zt]??null;break}i=i.parentNode}if(null!==s&&0!==o.length)for(const a of o)for(const t of a)if(t.eventName===e.type&&(Vt(t,e,s,n.setup),e.cancelBubble))return}function Vt(e,t,n,r){const o=un(e.code,r);if(!o)return;const s=t=>{try{Te(t),o(t,n,r.reactiveState,r.emit,r.listen)}catch(s){N(`Error in loop event handler: ${e.code}`,null,s)}};e.directive?qe(s,e.directive)(t):s(t)}var Gt=/* @__PURE__ */new WeakMap;function Kt(e,t,n,r=e=>n(e,t),o){let s=e[Ft];s||(s=Ut(e),e[Ft]=s),s.conds.length>0&&function(e,t,n,r,o,s){let i=!1;for(const a of e){const e=a[Jt],c=Yt(e.branches,r);if(c!==e.currentIndex&&(i=!0,e.currentEl&&e.currentEl.parentNode&&e.currentEl.remove(),e.currentEl=null,e.currentIndex=-1,c>=0)){const i=Qt(e.branches[c]);a.parentNode.insertBefore(i,a.nextSibling),e.currentIndex=c,e.currentEl=i,tn(i,t,n,r),nn(i,t,n,r,o,s)}}return i}(s.conds,t,n,r,e[zt]??t,o)&&(s=Ut(e),e[Ft]=s);const i=void 0!==r.invoke&&void 0!==r.sig,a=s.texts;for(let l=0;l<a.length;l++){const{node:e,parsed:t}=a[l],{statics:n,exprs:o}=t,s=i?Dt(t,r):null;let c=n[0];for(let i=0;i<o.length;i++){const e=null!==s?s[i]:null,t=null!==e?r.invoke(e,o[i]):r(o[i]);c+=String(t??"")+n[i+1]}e.textContent!==c&&(e.textContent=c)}const c=s.attrs;for(let l=0;l<c.length;l++){const{attr:e,parsed:t}=c[l],{statics:n,exprs:o}=t,s=i?Dt(t,r):null;let a=n[0];for(let i=0;i<o.length;i++){const e=null!==s?s[i]:null,t=null!==e?r.invoke(e,o[i]):r(o[i]);a+=(null!==t&&"object"==typeof t?JSON.stringify(t):String(t??""))+n[i+1]}e.value!==a&&(e.value=a)}}var Jt="__ladrillosLoopCond";function Yt(e,t){for(let n=0;n<e.length;n++){const r=e[n];if("else"===r.type)return n;try{if(t(r.condition))return n}catch{}}return-1}function Qt(e){const t=document.createElement("span");return t.style.display="contents",t.appendChild(e.template.content.cloneNode(!0)),t}function en(e,t){const n=document.createElement("template");for(const r of Array.from(e.childNodes))n.content.appendChild(r.cloneNode(!0));return{type:t,condition:"else"===t?"":$t(e.getAttribute("condition")||""),template:n}}function tn(e,t,n,r){const o=r??(e=>n(e,t));let s=1e4;for(;s-- >0;){let t=null;const n=e.querySelectorAll("IF");for(let e=0;e<n.length;e++){const r=n[e];if(r.parentNode&&!Ct(r)){t=r;break}}if(!t)return;const r=[];r.push(en(t,"if"));const s=[];let i=t.nextElementSibling;for(;i;){if(i.tagName!==Et){if(i.tagName===At){r.push(en(i,"else")),s.push(i);break}break}r.push(en(i,"else-if")),s.push(i),i=i.nextElementSibling}const a=document.createComment(" <if> (loop) "),c={branches:r,currentIndex:-1,currentEl:null};a[Jt]=c,t.parentNode.insertBefore(a,t),t.remove();for(const e of s)e.remove();const l=Yt(r,o);if(l>=0){const e=Qt(r[l]);a.parentNode.insertBefore(e,a.nextSibling),c.currentIndex=l,c.currentEl=e}}}function nn(e,t,n,r,o,s){const i=[],a=[],c=[],l=r??("function"==typeof n.forContext?n.forContext(t):e=>n(e,t)),u=o??t;let f=null;const p=s??(()=>f??=function(e){const t=e.__reactiveState__??e;return ln(t,Object.keys(e).filter(n=>!n.startsWith("__")&&"function"!=typeof e[n]&&!Object.prototype.hasOwnProperty.call(t,n)))}(t)),d=void 0!==l.invoke&&void 0!==l.sig,h=(e,t,n)=>{const r=null!==e?e[n]:null;return null!==r?l.invoke(r,t[n]):l(t[n])},m=e=>{for(const t of Array.from(e.attributes))if(!Re.has(t.name)&&!Xe(t.name)&&t.value.includes("{")){const e=jt(t.value);t.__originalTemplate=t.value;const n=d?Dt(e,l):null;let r=e.statics[0];for(let t=0;t<e.exprs.length;t++){const o=h(n,e.exprs,t);r+=(null!==o&&"object"==typeof o?JSON.stringify(o):String(o??""))+e.statics[t+1]}t.value=r,a.push({attr:t,parsed:e})}!function(e,t,n){const r=e.attributes;let o=null;for(let i=0;i<r.length;i++){const e=r[i].name;(Re.has(e)||Xe(e))&&(o??=[]).push({name:e,value:r[i].value})}if(!o)return;const s=n();for(const{name:i,value:a}of o)if(Re.has(i)){e.removeAttribute(i);const n=i.slice(2),r=fn(rn(a),t,s);r&&e.addEventListener(n,r)}else on(e,i,a,t,s)}(e,u,p)};m(e);const g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let _;for(;_=g.nextNode();)if(_.nodeType===Node.TEXT_NODE){const e=_.textContent;if(e&&e.includes("{")){const t=jt(e);_.__originalTemplate=e;const n=d?Dt(t,l):null;let r=t.statics[0];for(let e=0;e<t.exprs.length;e++)r+=String(h(n,t.exprs,e)??"")+t.statics[e+1];_.textContent=r,i.push({node:_,parsed:t})}}else _.nodeType===Node.ELEMENT_NODE?m(_):_[Jt]&&c.push(_);e[Ft]={texts:i,attrs:a,conds:c}}function rn(e){return e.replace(/\{([^}]+)\}/g,(e,t)=>`(${t.trim()})`)}function on(e,t,n,r,o){const s=He(t);if(!s)return;const i=rn(n);e.removeAttribute(t);const a=fn(i,r,o);if(!a)return;const c=qe(a,s),l=Ze(s.eventModifiers);e.addEventListener(s.eventName,c,l)}var sn=/* @__PURE__ */new Map,an=/* @__PURE__ */new Map,cn=1e3;function ln(e,n){const r=e.__scriptContent||"",o=r.trim().length>0,s=!0===e.__hasModuleScripts,i=[],a=[];for(const t of Object.keys(e))t.startsWith("__")||("function"==typeof e[t]?a.push(t):i.push(t));const c=n.filter(e=>!i.includes(e)),l=a.filter(e=>!n.includes(e));let u="",f="";if(s||!o)f=l.length>0?`const { ${l.join(", ")} } = context;`:"";else{const e=sn.get(r);void 0!==e?u=e:(u=tt(r,[]),sn.set(r,u))}const p=c.length>0?`const { ${c.join(", ")} } = context;`:"",d=i.length>0?`let { ${i.join(", ")} } = reactiveState;`:"",h=!s&&i.length>0?i.map(e=>`reactiveState.${e} = ${e};`).join(" "):"",m=t(e.__componentId||"anonymous"),g={__reactiveState__:e,__scriptContent__:r,__componentUrl__:e.__componentUrl||""};for(const t of a)g[t]=e[t];return{reactiveState:e,proto:g,bodyPrefix:`"use strict";\n ${p}\n ${d}\n ${f}\n ${u}\n `,bodySuffix:`;\n ${h}`,emit:m.$emit,listen:m.$listen,fnCache:/* @__PURE__ */new Map}}function un(e,t){let n=t.fnCache.get(e);if(void 0!==n)return n;const r=t.bodyPrefix+e+t.bodySuffix;if(n=an.get(r)??null,null===n)try{if(an.size>=cn){const e=an.keys().next().value;void 0!==e&&an.delete(e)}n=new Function("event","context","reactiveState","$emit","$listen",r),an.set(r,n)}catch(o){n=null}return t.fnCache.set(e,n),n}function fn(e,t,n){const r=un(e,n);if(!r)return null;const{reactiveState:o,emit:s,listen:i}=n;return n=>{try{Te(n),r(n,t,o,s,i)}catch(a){N(`Error in loop event handler: ${e}`,null,a)}}}function pn(e,t,n){for(const r of e)r.element.parentNode&&r.element.remove();for(const r of e){let e=!1;if("else"===r.type)e=!0;else{const o=n(r.condition,t);e=Boolean(o)}if(e){r.placeholder.parentNode?.insertBefore(r.element,r.placeholder.nextSibling);break}}}function dn(e,t,n,r){const o=e.element,{raw:s,path:i,isContentEditable:a}=e;hn(o,n(s,t),a);const c=i[0];r.has(c)||r.set(c,[]),r.get(c).push({element:o,path:i,isContentEditable:a}),s===c||r.has(s)||r.set(s,[]),s!==c&&r.get(s).push({element:o,path:i,isContentEditable:a});const l=function(e){if(e instanceof HTMLSelectElement)return"change";if(e instanceof HTMLInputElement){const t=e.type.toLowerCase();if("checkbox"===t||"radio"===t)return"change"}return"input"}(o);let u=!1;o.__isUpdatingFromState=()=>u,o.__setUpdatingFromState=e=>{u=e};const f=()=>{if(u)return;const e=function(e,t){if(t)return e.textContent||"";if(e instanceof HTMLInputElement){const t=e.type.toLowerCase();return"checkbox"===t?e.checked:"number"===t||"range"===t?e.valueAsNumber:e.value}return e instanceof HTMLSelectElement?e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value:e instanceof HTMLTextAreaElement?e.value:e.value??""}(o,a);!function(e,t,n){let r=e;for(let o=0;o<t.length-1;o++){const e=t[o];e in r&&"object"==typeof r[e]||(r[e]={}),r=r[e]}r[t[t.length-1]]=n}(t,i,e)};o.__ladrillosBindSync={eventType:l,sync:f},o.addEventListener(l,f)}function hn(e,t,n){n?e.textContent=String(t??""):e instanceof HTMLInputElement?"checkbox"===e.type.toLowerCase()?e.checked=Boolean(t):e.value=String(t??""):e.value=e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?String(t??""):t}var mn=[],gn=/* @__PURE__ */new Set,_n=!1,yn=!1,vn=0,bn=Promise.resolve();function wn(){yn=!1,_n=!0,mn.sort((e,t)=>(e.id??0)-(t.id??0));try{for(const t of mn)if(!1!==t.active)try{t()}catch(e){N("Error in scheduled update",null,e)}}finally{mn.length=0,gn.clear(),_n=!1}}var En=/* @__PURE__ */new Map;var An=/* @__PURE__ */new Set(["state","_root","_initialized","_componentId","_directives","_evaluator","_updateBoundInputs","_pendingProps","_propsReady"]);function $n(e,t){const{tagName:r,template:o,scripts:s,externalScripts:i,externalStyles:a,styles:c,sourcePath:l,templateBindings:u=[]}=e,f=ot(s.map(e=>e.content).join("\n")),p=[.../* @__PURE__ */new Set([...f,...u])];class d extends HTMLElement{static get observedAttributes(){return p}state={};_root=null;_initialized=!1;_componentId=`${r}-${Math.random().toString(36).slice(2)}`;_directives=null;_evaluator=null;_updateBoundInputs=null;_pendingProps=/* @__PURE__ */new Map;_propsReady=!1;constructor(){super()}async connectedCallback(){if(this._initialized)return;this._initialized=!0,w={tagName:r,sourcePath:l,instanceId:this._componentId};const e=this.innerHTML,n=document.createDocumentFragment();if(t)for(const t of Array.from(this.childNodes))n.appendChild(t.cloneNode(!0));else for(;this.firstChild;)n.appendChild(this.firstChild);this.__originalHTML=e,this.__originalChildren=n,this._root=t?this.shadowRoot??this.attachShadow({mode:"open"}):this;const{bindings:f}=((e,t)=>{const n=document.createElement("template");n.innerHTML=J(t),Y(n.content),Ee(n.content),e.innerHTML="",e.appendChild(n.content);const r=Ne(e);for(const o of $e(e))r.push(...Ne(o));return{bindings:r}})(this._root,o);((e,t,n)=>{if(!t)return;const r=document.createElement("style");r.textContent=t,n?e.appendChild(r):document.head.appendChild(r)})(this._root,c,t);const d=this._getAttributeOverrides();for(const t of p){if(An.has(t))continue;Object.prototype.hasOwnProperty.call(this,t)&&(this._pendingProps.set(t,this[t]),delete this[t]);const e=t.toLowerCase();e!==t&&Object.prototype.hasOwnProperty.call(this,e)&&(this._pendingProps.set(t,this[e]),delete this[e])}for(const[t,r]of this._pendingProps)d[t]=r;const h=s.filter(e=>"module"!==e.type),m=s.some(e=>"module"===e.type),g=new Proxy(/* @__PURE__ */new Map,{get(e,t,n){if(t in e){const r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}if("string"==typeof t)return e.get(t)},set:(e,t,n)=>"string"==typeof t&&(e.set(t,n),!0),has:(e,t)=>"string"==typeof t&&e.has(t)||t in e});if(function(e,t){const n=Array.from(e.querySelectorAll(`[${Pe(Le)}]`));for(const r of n){const e=r.getAttribute(Le);e&&t.set(e,r)}}(this._root,g),a&&a.length>0&&await async function(e,t,n){for(const r of e)if(n&&t)try{let e=F.get(r.href);if(!e){const t=await fetch(r.href);if(!t.ok)continue;e=await t.text(),F.set(r.href,e)}const n=document.createElement("style");n.textContent=e,n.setAttribute("data-external-href",r.href),t.insertBefore(n,t.firstChild)}catch(N){}else{if(document.querySelector(`link[href="${r.href}"]`))continue;await new Promise(e=>{const t=document.createElement("link");t.rel=r.rel||"stylesheet",t.href=r.href,t.onload=()=>e(),t.onerror=()=>{e()},document.head.appendChild(t)})}}(a,this._root,t),i.length>0&&await async function(e){const t=e.filter(e=>e.external);for(const n of t)try{await j(n)}catch(N){}}(i),this.state=await async function(e,t,n,r={},o,s=!1,i,a,c,l=[]){const u=Ve(e),f={},p=t.map(e=>e.content).join("\n");for(const[h,m]of Object.entries(r))f[h]=m;f.__scriptContent=p,f.__componentUrl=i,f.__componentId=a;const d=function(e,t,n,r){const o=function(e,t){const n=/* @__PURE__ */new Map;for(const r of t)n.set(r,/* @__PURE__ */new Set);for(const r of e)for(const e of r.bindings)for(const o of t)b(e.raw,o)&&n.get(o).add(r);return n}(t,Object.keys(e)),s=(e,t)=>{const s=o.get(e);if(s)for(const r of s)n(r,t);r&&r()},i=t=>()=>{e.__suspendReactivity?r&&r():s(t,e)},a=e=>{i(e)()};for(const u of Object.keys(e)){const t=e[u];Array.isArray(t)?e[u]=_(t,i(u)):t&&"object"==typeof t&&v(t,i(u))}const c=/* @__PURE__ */new WeakMap,l=(t,n)=>{let r=c.get(t);const o=r?.get(n);if(o)return o;const a=new Proxy(t,{get(e,t){const r=e[t];return"string"==typeof t&&y(r)?l(r,n):r},set:(t,r,o)=>"string"!=typeof r?(t[r]=o,!0):(r in t&&t[r]===o||(t[r]=Array.isArray(o)?_(o,i(n)):o,e.__suspendReactivity||s(n,e)),!0),deleteProperty(t,r){const o=r in t;return delete t[r],o&&"string"==typeof r&&!e.__suspendReactivity&&s(n,e),!0}});return r||(r=/* @__PURE__ */new Map,c.set(t,r)),r.set(n,a),a};return new Proxy(e,{get(e,t){if("__notifyKeyChanged"===t)return a;const n=e[t];return"string"==typeof t&&y(n)?l(n,t):n},set(e,n,r){const a=!(n in e);return!a&&e[n]===r||(e[n]=Array.isArray(r)?_(r,i(n)):r,a&&function(e,t,n){n.set(e,/* @__PURE__ */new Set);for(const r of t)for(const t of r.bindings)b(t.raw,e)&&n.get(e).add(r)}(n,t,o),e.__suspendReactivity||s(n,e),!0)}})}(f,n,(e,t)=>yt(e,t),o);d.__suspendReactivity=!0;try{for(const e of t)rt(e.content,d,i,a,u,c,l)}finally{d.__suspendReactivity=!1}return u.__state=d,u.__scriptContent=p,u.__componentUrl=i,u.__componentId=a,s||(Ge(e,d,p,u),vt(n,d)),d}(this._root,h,f,d,()=>this._updateDirectives(),m,l,this._componentId,g,u),this._propsReady=!0,this._pendingProps.size>0){for(const[e,t]of this._pendingProps)this.state[e]=t;this._pendingProps.clear()}if("undefined"!=typeof globalThis&&(globalThis.__ladrillosStateCallbacks||(globalThis.__ladrillosStateCallbacks=/* @__PURE__ */new Map),globalThis.__ladrillosStateCallbacks.set(this._componentId,e=>{const t=this.state?.__notifyKeyChanged;e&&"function"==typeof t?t(e):this._updateDirectives()})),l){this.state.__suspendReactivity=!0;try{const e=await async function(e,t,n,r,o,s,i,a){const c={},l=e.filter(e=>"module"===e.type),u=t.filter(e=>"module"===e.type),f=t.filter(e=>"module"!==e.type);for(const p of f)try{await j(p,r,n)}catch(N){}for(const p of u)try{const e=await j(p,r,n);if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))"default"!==t&&(c[t]=n,s&&(s[t]=n))}catch(N){}for(const p of l)try{const e=await W(p,n,r,o,s,i,a);Object.assign(c,e)}catch(N){}return c}(s,i,l,this._componentId,g,this.state,()=>this._updateDirectives(),this);(m||i.length>0)&&(this.state.__hasModuleScripts=!0);for(const[t,n]of Object.entries(e))"function"==typeof n&&(this.state[t]=n)}finally{this.state.__suspendReactivity=!1}}if(m&&function(e,t,n){const r=Ve(e);Ge(e,n,r.__scriptContent||"",r),vt(t,n)}(this._root,f,this.state),this._evaluator=function(){const e=pt;return e.forContext=gt,e}(),this._directives=function(e,t){const n={loops:[],conditionals:[],twoWayBindings:[],refs:t,showElements:[]},r=[e,...$e(e)];for(const o of r)Nt(o,n),xt(o,n),Lt(o,n),Ot(o,n),kt(o,n);return Ee(e),n}(this._root,g),"undefined"!=typeof globalThis){globalThis.__ladrillosRefs||(globalThis.__ladrillosRefs=/* @__PURE__ */new Map);let e=globalThis.__ladrillosRefs.get(this._componentId);e||(e=/* @__PURE__ */new Map,globalThis.__ladrillosRefs.set(this._componentId,e));for(const[t,n]of this._directives.refs)e.set(t,n)}this.refs=this._directives.refs,this.__refs=this._directives.refs,this._updateDirectives(),this._directives.twoWayBindings.length>0&&(this._updateBoundInputs=function(e,t,n){const r=/* @__PURE__ */new Map;for(const o of e)dn(o,t,n,r);return e=>{!function(e,t,n,r){const o=r?[r]:Array.from(e.keys());for(const s of o){const r=e.get(s);if(r)for(const e of r){const{element:r,path:o,isContentEditable:s}=e,i=n(o.join("."),t),a=r.__setUpdatingFromState;a&&a(!0),hn(r,i,s),a&&queueMicrotask(()=>a(!1))}}}(r,t,n,e)}}(this._directives.twoWayBindings,this.state,this._evaluator)),this.dispatchEvent(new CustomEvent("ladrillos:ready",{bubbles:!0,composed:!0,detail:{state:this.state,refs:this._directives.refs}}))}disconnectedCallback(){!function(e){const t=S.get(e);if(t){for(const e of t)URL.revokeObjectURL(e);S.delete(e)}}(this._componentId),n(this._componentId),function(e){const t=En.get(e);t&&(t.active=!1,En.delete(e))}(this._componentId),"undefined"!=typeof globalThis&&globalThis.__ladrillosStateCallbacks?.delete(this._componentId),this._initialized=!1,this._propsReady=!1}attributeChangedCallback(e,t,n){if(t===n)return;if(!this._initialized)return;const r=this._parseAttributeValue(n);this._propsReady?this.state[e]=r:this._pendingProps.set(e,r)}adoptedCallback(){}_updateDirectives(){this._directives&&this._evaluator&&function(e,t){let n=En.get(e);n||(n=function(){const e=()=>{t()};return e.id=++vn,e.active=!0,e}(),En.set(e,n)),function(e){void 0===e.id&&(e.id=++vn),gn.has(e.id)||(gn.add(e.id),mn.push(e),_n||yn||(yn=!0,bn.then(wn)))}(n)}(this._componentId,()=>{this._performDirectiveUpdates()})}_performDirectiveUpdates(){this._directives&&this._evaluator&&(this._directives.loops.length>0&&function(e,t,n){for(const r of e)It(r,t,n)}(this._directives.loops,this.state,this._evaluator),this._directives.conditionals.length>0&&function(e,t,n){for(const r of e)pn(r,t,n)}(this._directives.conditionals,this.state,this._evaluator),this._directives.showElements.length>0&&function(e,t,n){for(const r of e){const e=n(r.expression,t);r.element.style.display=Boolean(e)?r.originalDisplay:"none"}}(this._directives.showElements,this.state,this._evaluator),this._updateBoundInputs&&this._updateBoundInputs())}_getAttributeOverrides(){const e={},t=[];for(const r of Array.from(this.attributes))if(this._isReservedAttribute(r.name))r.value&&""!==r.value.trim()&&t.push(r.name);else if(e[r.name]=this._parseAttributeValue(r.value),r.name.includes("-")){const t=r.name.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());t===r.name||t in e||(e[t]=e[r.name])}const n=t.filter(e=>!u.includes(e));if(n.length>0){const e=n.map(e=>`"${e}" → try "${{title:"heading",class:"className",style:"customStyle",id:"componentId",hidden:"isHidden"}[e]||`my${e.charAt(0).toUpperCase()}${e.slice(1)}`}"`);
|
|
2
|
+
/* @__PURE__ */n.map(e=>`"${e}"`).join(", "),e.join(", ")}return e}_isReservedAttribute(e){return!u.includes(e)&&(["id","class","style","slot","part","is","tabindex","title","lang","dir","hidden","draggable","contenteditable"].includes(e.toLowerCase())||e.startsWith("data-"))}_parseAttributeValue(e){if(null===e)return null;if(""===e)return!0;if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);if(!isNaN(t)&&""!==e.trim())return t;try{const t=e.trim();if(t.startsWith("[")||t.startsWith("{"))return JSON.parse(t)}catch{}return e}get root(){return this._root}}for(const n of p){if(An.has(n))continue;if(n in HTMLElement.prototype)continue;if(Object.prototype.hasOwnProperty.call(d.prototype,n))continue;Object.defineProperty(d.prototype,n,{configurable:!0,enumerable:!1,get(){return this._propsReady?this.state[n]:this._pendingProps.get(n)},set(e){this._propsReady?this.state[n]=e:this._pendingProps.set(n,e)}});const e=n.toLowerCase();e===n||e in HTMLElement.prototype||Object.prototype.hasOwnProperty.call(d.prototype,e)||Object.defineProperty(d.prototype,e,{configurable:!0,enumerable:!1,get(){return this._propsReady?this.state[n]:this._pendingProps.get(n)},set(e){this._propsReady?this.state[n]=e:this._pendingProps.set(n,e)}})}return d}function Nn(e,t){const{tagName:n}=e;if(!customElements.get(n)){const r=$n(e,t);customElements.define(n,r)}}var xn,Sn=/* @__PURE__ */new Map,Cn=/* @__PURE__ */new Map,Rn=/* @__PURE__ */new Set,kn=/* @__PURE__ */new Map;function Tn(e,t,n,r){var o;kn.set(e,{name:e,absolutePath:t,useShadowDOM:n,strategy:r}),customElements.get(e)||customElements.define(e,(o=e,class extends HTMLElement{teardown;isLoading=!1;isUpgraded=!1;connectedCallback(){if(this.hasAttribute("eager"))return void this.triggerLoad();const e=kn.get(o);e?this.teardown=e.strategy(()=>this.triggerLoad(),this):this.triggerLoad()}disconnectedCallback(){this.teardown?.(),this.teardown=void 0}async triggerLoad(){if(!this.isLoading&&!this.isUpgraded){this.isLoading=!0,this.teardown?.(),this.teardown=void 0;try{const e=await Ln(o);this.isUpgraded=!0,this.upgradeToRealComponent(e)}catch(e){N(`Failed to load lazy component "<${o}>"`,{tagName:o}),this.isLoading=!1}}}upgradeToRealComponent(e){const t=document.createElement(e);for(const n of Array.from(this.attributes))"eager"!==n.name&&"tabindex"!==n.name&&t.setAttribute(n.name,n.value);for(;this.firstChild;)t.appendChild(this.firstChild);this.parentNode?this.parentNode.replaceChild(t,this):N("No parent node for placeholder - cannot upgrade lazy component",{tagName:o})}}))}async function Ln(e){const t=function(e){return`${e}--loaded`}(e);if(Rn.has(e))return t;if(Sn.has(e))return await Sn.get(e),t;const n=kn.get(e);if(!n)throw new Error(`Lazy component "${e}" not registered`);const r=(async()=>{const r=await ce(n.absolutePath);if(!r)throw new Error(`Failed to fetch component source for "${e}"`);const o=await oe(r.source,e,r.resolvedPath);xn[e]=o;const s=$n(o,n.useShadowDOM);return customElements.get(t)||customElements.define(t,s),Rn.add(e),Cn.set(e,{component:o,useShadowDOM:n.useShadowDOM}),o})();Sn.set(e,r);try{return await r,t}finally{Sn.delete(e)}}function On(e){return kn.has(e)||Rn.has(e)}async function Mn(e){return kn.has(e)&&await Ln(e),xn[e]}var In=/* @__PURE__ */o({ladrillos:()=>Pn}),Pn=new class{components;constructor(){this.components={},xn=this.components}async registerComponent(e,t,n=!0,r=!1){if(this.components[e])return;const o=new URL(t,window.location.href).href;if(r)Tn(e,o,n,!0===r?ve:r);else try{const t=await ce(o);if(!t)throw new Error(`Failed to fetch component source from ${o}`);const r=await oe(t.source,e,t.resolvedPath);this.components[e]=r,Nn(r,n)}catch(s){N(`Error registering component "<${e}>"`,{tagName:e,sourcePath:t},s)}}async registerComponents(e){const t=Array.isArray(e)?e:Object.entries(e).map(([e,t])=>"string"==typeof t?{name:e,path:t}:{name:e,...t}),n={success:[],failed:[],skipped:[]},r=[],o=[];for(const c of t){if(this.components[c.name]){n.skipped.push(c.name);continue}const e=new URL(c.path,window.location.href).href,t={...c,absolutePath:e};c.lazy?r.push(t):o.push(t)}for(const c of r)try{Tn(c.name,c.absolutePath,c.useShadowDOM??!0,!0===c.lazy?ve:c.lazy),n.success.push(c.name)}catch(a){n.failed.push({name:c.name,error:a instanceof Error?a:new Error(String(a))})}if(0===o.length)return n;const s=await Promise.allSettled(o.map(async e=>({config:e,result:await ce(e.absolutePath)}))),i=await Promise.allSettled(s.map(async(e,t)=>{if("rejected"===e.status)throw e.reason;const{config:n,result:r}=e.value;if(!r)throw new Error(`Failed to fetch component source from ${n.absolutePath}`);return{config:n,component:await oe(r.source,n.name,r.resolvedPath)}}));for(let c=0;c<i.length;c++){const e=i[c],t=o[c];if("rejected"===e.status){n.failed.push({name:t.name,error:e.reason instanceof Error?e.reason:new Error(String(e.reason))}),N(`Error registering component "${t.name}"`,{tagName:t.name,sourcePath:t.path},e.reason);continue}const{component:r}=e.value,s=t.useShadowDOM??!0;this.components[t.name]=r;try{Nn(r,s),n.success.push(t.name)}catch(a){n.failed.push({name:t.name,error:a instanceof Error?a:new Error(String(a))}),delete this.components[t.name]}}return n}async loadLazyComponent(e){return Mn(e)}};export{ve as a,_e as c,A as d,p as f,wt as i,ge as l,f as m,Mn as n,ye as o,u as p,On as r,he as s,Pn as t,me as u};
|
|
3
|
+
//# sourceMappingURL=shared-B9h4a1Iw.js.map
|