ladrillosjs 2.0.0-beta.10 → 2.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,6 +34,7 @@
34
34
  - [Using with Vite](#-using-with-vite)
35
35
  - [Browser Support](#-browser-support)
36
36
  - [Examples](#-examples)
37
+ - [Security & Trust Model](#-security--trust-model)
37
38
  - [Contributing](#-contributing)
38
39
  - [License](#-license)
39
40
 
@@ -591,9 +592,9 @@ A complete CRUD example combining all directives:
591
592
  <ul>
592
593
  <for each="todo in todos" key="todo.id">
593
594
  <li>
594
- <input type="checkbox" onclick="toggleTodo({todo.id})" />
595
+ <input type="checkbox" onclick="toggleTodo(todo.id)" />
595
596
  <span class="{todo.completed ? 'done' : ''}">{todo.text}</span>
596
- <button onclick="removeTodo({todo.id})">🗑️</button>
597
+ <button onclick="removeTodo(todo.id)">🗑️</button>
597
598
  </li>
598
599
  </for>
599
600
  </ul>
@@ -633,6 +634,36 @@ A complete CRUD example combining all directives:
633
634
 
634
635
  ---
635
636
 
637
+ ## 🔒 Security & Trust Model
638
+
639
+ **Component HTML is trusted code. Treat a `.html` component the same way you'd
640
+ treat a `.js` file you `import`.**
641
+
642
+ LadrillosJS runs the `<script>` in each component, evaluates your `{expression}`
643
+ bindings, and compiles your inline event handlers as JavaScript with full access
644
+ to the page (`window`, `document`, `fetch`, `localStorage`, …). This is by design
645
+ — it's what lets components feel like plain HTML + JS with no build step, exactly
646
+ like the template in a Vue single-file component or a Svelte `.svelte` file. It
647
+ also means the framework is **not** a sandbox: you should only register and run
648
+ component files that you wrote or otherwise trust.
649
+
650
+ Practical guidance:
651
+
652
+ - ✅ **Do** author your own components and load them from your own origin.
653
+ - ❌ **Don't** fetch and register component HTML from untrusted third parties, or
654
+ build component files by concatenating user input into a template — that's
655
+ equivalent to running arbitrary code from that source.
656
+ - ✅ **Dynamic *data* is fine.** Rendering untrusted **data** — API responses,
657
+ user comments, list items — through bindings and `<for>` loops is safe: values
658
+ are set via `textContent`/`setAttribute` and passed to event handlers as
659
+ arguments, never executed as code. (Interpolating into `innerHTML` yourself, or
660
+ into a `<script>`/handler you assemble by hand, is not — same rule as above.)
661
+
662
+ In short: untrusted **data** through LadrillosJS's bindings is safe; untrusted
663
+ **templates/scripts** are not, because those *are* your application code.
664
+
665
+ ---
666
+
636
667
  ## 🤝 Contributing
637
668
 
638
669
  Contributions are welcome! Here's how you can help:
@@ -651,6 +682,7 @@ cd LadrillosJS
651
682
  npm install
652
683
  npm run dev # Watch mode for development
653
684
  npm run build # Build for production
685
+ npm test # Unit tests (Vitest)
654
686
  ```
655
687
 
656
688
  ---
@@ -31,6 +31,8 @@ export declare function applyBindingsDeferred(host: HTMLElement | ShadowRoot, bi
31
31
  * Extracts function definitions from script content.
32
32
  * These will be re-created in the event handler context with current state values.
33
33
  *
34
+ * Memoized: the output is a pure function of (content, skipFunctions).
35
+ *
34
36
  * @param content - The script content to extract functions from
35
37
  * @param skipFunctions - Function names to skip (already in state as reactive functions)
36
38
  */
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- import{d as s,h as r,m as e,p as a}from"./shared-CCPr4_4R.js";import{t as o}from"./shared-cwUZzSZ7.js";var t={registerComponent:e,registerComponents:r,$use:a,configure:o};export{a as $use,s as ErrorCode,o as configure,t as default,e as registerComponent,r as registerComponents};
1
+ import{d as s,h as r,m as e,p as a}from"./shared-BXkP1Y3n.js";import{t as o}from"./shared-BniKFfL6.js";var t={registerComponent:e,registerComponents:r,$use:a,configure:o};export{a as $use,s as ErrorCode,o as configure,t as default,e as registerComponent,r as registerComponents};
2
2
  //# sourceMappingURL=core.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a,c as s,d as e,h as o,l as n,m as t,o as r,p as l,s as i,t as m}from"./shared-CCPr4_4R.js";import{n as d,t as p}from"./shared-D-P0qKQY.js";import{t as y}from"./shared-cwUZzSZ7.js";var z=a=>m.loadLazyComponent(a),f={registerComponent:t,registerComponents:o,$use:l,$emit:p,$listen:d,loadLazyComponent:z,configure:y,lazyOnIdle:r,lazyOnVisible:n,lazyOnMedia:s,lazyOnInteraction:i,lazyOnDelay:a};export{p as $emit,d as $listen,l as $use,e as ErrorCode,y as configure,f as default,a as lazyOnDelay,r as lazyOnIdle,i as lazyOnInteraction,s as lazyOnMedia,n as lazyOnVisible,z as loadLazyComponent,t as registerComponent,o as registerComponents};
1
+ import{a,c as s,d as e,h as o,l as n,m as t,o as r,p as l,s as i,t as m}from"./shared-BXkP1Y3n.js";import{n as d,t as p}from"./shared-D-P0qKQY.js";import{t as y}from"./shared-BniKFfL6.js";var z=a=>m.loadLazyComponent(a),f={registerComponent:t,registerComponents:o,$use:l,$emit:p,$listen:d,loadLazyComponent:z,configure:y,lazyOnIdle:r,lazyOnVisible:n,lazyOnMedia:s,lazyOnInteraction:i,lazyOnDelay:a};export{p as $emit,d as $listen,l as $use,e as ErrorCode,y as configure,f as default,a as lazyOnDelay,r as lazyOnIdle,i as lazyOnInteraction,s as lazyOnMedia,n as lazyOnVisible,z as loadLazyComponent,t as registerComponent,o as registerComponents};
2
2
  //# sourceMappingURL=index.js.map
package/dist/lazy.js CHANGED
@@ -1 +1 @@
1
- import{a as s,c as a,i as r,l as o,n as e,o as i,r as m,s as p}from"./shared-CCPr4_4R.js";export{r as defaultLazyStrategy,e as forceLoadLazyComponent,m as isLazyComponent,s as lazyOnDelay,i as lazyOnIdle,p as lazyOnInteraction,a as lazyOnMedia,o as lazyOnVisible};
1
+ import{a as s,c as a,i as r,l as o,n as e,o as i,r as m,s as p}from"./shared-BXkP1Y3n.js";export{r as defaultLazyStrategy,e as forceLoadLazyComponent,m as isLazyComponent,s as lazyOnDelay,i as lazyOnIdle,p as lazyOnInteraction,a as lazyOnMedia,o 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 on.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 on.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 on.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,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)&&y(r,t)}return e}function b(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)v(e.raw,o)&&n.get(o).add(r);return n}(t,Object.keys(e));return y(e,()=>{r&&r()}),new Proxy(e,{get:(e,t)=>e[t],set(e,s,i){const a=!(s in e);return!a&&e[s]===i||(e[s]=Array.isArray(i)?_(i,()=>{r&&r()}):i,a&&function(e,t,n){n.set(e,/* @__PURE__ */new Set);for(const r of t)for(const t of r.bindings)v(t.raw,e)&&n.get(e).add(r)}(s,t,o),e.__suspendReactivity||((e,t)=>{const s=o.get(e);if(s)for(const r of s)n(r,t);r&&r()})(s,e),!0)}})}function v(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 S(e){$=e}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 C(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 x=/* @__PURE__ */new Map,R=/* @__PURE__ */new Map,k=/(?:import|export)\s+(?:[\s\S]*?\s+from\s+)?['"]([^'"]+)['"]/g,L=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g,T=[".ts",".tsx",".mts"];function I(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 P(e,t){let n=e;const r=[],o=[];return n=n.replace(k,(e,n)=>{if(I(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(L,(e,n)=>{if(I(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 D=/^(?:export\s+)?(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/gm,j=["$emit","$listen","$refs","registerComponent","registerComponents","$use"];async function F(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=P(await r.text(),e.src),s=function(e){const t=function(e){const t=[];let n;for(D.lastIndex=0;null!==(n=D.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);`)}else{const e=`__raw_${i}`;s.push(`${i} as ${e}`),t.push(`const ${i} = __wrapReactiveArray(${e}, __ladrillos_componentId);`)}}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 j){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\nconst __wrapReactiveArray = (arr, componentId) => {\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();\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);\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) : 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 z=/* @__PURE__ */new Map;async function U(e){if(R.has(e))return R.get(e);const t=(async()=>{try{return await(0,eval)(`import("${e}")`)}catch(N){throw N}})();return R.set(e,t),t}function W(e,t){return t&&Array.isArray(e)?_(e,t):e}async function B(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 U(I(s.specifier)?new URL(s.specifier,t).href:s.specifier);continue}const e=I(s.specifier)?new URL(s.specifier,t).href:s.specifier;try{const t=await U(e);for(const e of s.imports){let r;r="*"===e.imported?t:"default"===e.imported?t.default:t[e.imported],o[e.local]=W(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=H(d,h),_=Object.keys(p),y=Object.values(p),b=`\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],v={...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:v},E=new Set(_),A=[..._],$=_.map((e,t)=>e in w?w[e]:y[t]),S=(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]))}};S(n,l),S(c,h),S(e,g),S(f,p),S(["ladrillosjs"],[v]);const N=await new Function(...A,b)(...$);return{...i||{},...N||{}}}catch(N){throw N}}function H(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+=H(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+(${Z(a)})\\s*=`,"g");o=o.replace(e,`__state__.${a} ??=`)}for(const a of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${Z(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 Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var q=new DOMParser,X=["___vscode_livepreview_injected_script","/livereload.js","browser-sync-client","browser-sync/dist","webpack-dev-server","sockjs-node","__webpack_hmr"],V=["aka.ms/live-preview","Live Preview Extension","___vscode_livepreview","__bs_script__","browser-sync","Browsersync","browserSync","LiveReload","webpackHotUpdate","__webpack_hmr"],G=["__bs_script__"];async function J(e,t,n){const r=function(e){return q.parseFromString(e,"text/html")}(e),o=Array.from(r.querySelectorAll("script")),i=o.filter(e=>!function(e){const t=e.getAttribute("src")||"";if(t&&X.some(e=>t.includes(e)))return!0;const n=e.getAttribute("id")||"";if(n&&G.includes(n))return!0;const r=e.textContent||"";return!(!r||!V.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=P(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,b=y(r.body)??y(r.head);let v;if(b){const e=document.createElement("div");e.appendChild(b.content.cloneNode(!0)),v=e.innerHTML.trim()}else v=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)}(v);return{tagName:t,template:v,scripts:l,externalScripts:p,externalStyles:m,styles:_,sourcePath:n,lazy:!1,templateBindings:w}}var Y=/* @__PURE__ */new Map,K=25,Q=e=>{if(!Number.isFinite(e)||e<1)throw new Error(`[LadrillosJS] configure({ cacheSize }) requires a positive integer, got ${e}`);for(K=Math.floor(e);Y.size>K;){const e=Y.keys().next().value;if(!e)break;Y.delete(e)}},ee=(e,t)=>{if(Y.has(e))Y.delete(e);else if(Y.size>=K){const e=Y.keys().next().value;e&&Y.delete(e)}Y.set(e,t)};async function te(e){if(!e)throw new Error("Path cannot be null or empty");const t=(e=>{const t=Y.get(e);return t&&(Y.delete(e),Y.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 ee(e,n),t.path!==e&&ee(t.path,n),{source:n,resolvedPath:t.path}}catch(N){return}}function ne(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=re(e.slice(0,t).trim());return r?{calleePath:r,args:oe(e.slice(t+1,n))}:null}(t);if(n)return{raw:t,path:n.calleePath,isFunction:!0,isExpression:!0,functionArgs:n.args};const r=re(t);return r?{raw:t,path:r,isFunction:!1,isExpression:!1}:{raw:t,path:[],isExpression:!0}}function re(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 oe(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 se=globalThis.requestIdleCallback||(e=>setTimeout(e,1)),ie=globalThis.cancelIdleCallback||(e=>clearTimeout(e)),ae=(e=1e4)=>t=>{const n=se(t,{timeout:e});return()=>ie(n)},ce=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()},le=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)},ue=(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}},fe=(e=0)=>t=>{const n=setTimeout(t,e);return()=>clearTimeout(n)},pe=ce({rootMargin:"100px"});function de(e){const t=e.querySelector(':scope > template[slot="placeholder"]');return t?(t.remove(),t.content.cloneNode(!0)):null}function he(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 ue();const n=t.split(",").map(e=>e.trim()).filter(Boolean);return ue(1===n.length?n[0]:n)}if(e.hasAttribute("media"))return le(e.getAttribute("media")||"");if(e.hasAttribute("delay"))return fe(Number(e.getAttribute("delay"))||0);if(e.hasAttribute("idle")||e.hasAttribute("idle-timeout")){const t=e.getAttribute("idle-timeout");return t?ae(Number(t)||1e4):ae()}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?ce(t):pe}(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=de(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(()=>rn)).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=de(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 me(e){const t=Array.from(e.querySelectorAll("lazy"));for(const n of t)ge(n)||he(n)}function ge(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 ye(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let r;for(;r=n.nextNode();){if(be(r)||ve(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=>ne(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&&!be(o)&&!o.hasAttribute("$no:bind")&&!ve(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=>ne(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 be(e){let t=(Node,e.parentElement);for(;t;){if("FOR"===t.tagName)return!0;t=t.parentElement}return!1}function ve(e){let t=e.parentElement;for(;t;){if(t.hasAttribute&&t.hasAttribute("$no:bind"))return!0;t=t.parentElement}return!1}var we=["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"],Ee="$bind";function Ae(e){const t=e.currentTarget?.__ladrillosBindSync;t&&t.eventType===e.type&&t.sync()}var $e="$ref",Se=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]+)$/,Ne=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Ce=/^\(|\)$/g;function xe(e){return e.replace(/\$/g,"\\$")}var Re=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"]),ke=Object.freeze([]),Le=/* @__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"]),Te=(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"}),Ie=["ctrl","alt","shift","meta"],Oe=["prevent","stop","self","once","passive","capture"],Me={left:0,middle:1,right:2};function Pe(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?Oe.includes(e)?o.eventModifiers.push(e):Ie.includes(e)?o.systemModifiers.push(e):e in Me?o.mouseModifier=e:o.keyModifiers.push(e):o.exact=!0}return o}function De(e){const t={};return e.includes("passive")&&(t.passive=!0),e.includes("capture")&&(t.capture=!0),e.includes("once")&&(t.once=!0),t}function je(e,t){return function(n){t.eventModifiers.includes("self")&&n.target!==n.currentTarget||t.mouseModifier&&n instanceof MouseEvent&&!function(e,t){return e.button===Me[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 Ie)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=Te[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 Fe(e){return e.startsWith("$on:")}var ze=e=>e instanceof ShadowRoot?e.host:e;function Ue(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(!Be(o)){for(const e of we){const s=o.getAttribute(e);if(s){o.removeAttribute(e);const i=e.slice(2),a=He(s,t,n,r);a&&o.addEventListener(i,a)}}We(o,t,n,r)}}}function We(e,t,n,r){const o=Array.from(e.attributes).filter(e=>Fe(e.name));for(const s of o){const o=Pe(s.name);if(!o)continue;const i=s.value;e.removeAttribute(s.name);const a=He(i,t,n,r);if(!a)continue;const c=je(a,o),l=De(o.eventModifiers);e.addEventListener(o.eventName,c,l)}}function Be(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 He(e,t,n,r){try{const o=r?.__componentUrl,s=r?.__componentId,i=Qe(o,s),a=Ke(),c=["event","__state__","$refs",...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${Ye(o)}\\b(?!\\s*[:(])`,"g");r=r.replace(e,`__state__.${o}`)}return`\${${r}}`}));for(const s of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${Ye(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}(Xe(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",b=_?`"use strict"; ${d} ${h} ${m} try { await (async () => { ${e} })(); } finally { ${g} }\n//# sourceURL=${y}`:`"use strict"; ${d} ${h} ${m} ${e}; ${g}\n//# sourceURL=${y}`,v=Object.getPrototypeOf(async function(){}).constructor,w=_?new v(...c,b):new Function(...c,b);return e=>{try{Ae(e);const n=[e,t,r&&r.__refs||/* @__PURE__ */new Map,...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};C(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};C(0,n,{context:e.tagName?e:E(),errorCode:A.EVENT_HANDLER_FAILED})}}}catch(o){return r?.tagName&&r.tagName.toLowerCase(),null}}var Ze=/* @__PURE__ */new Map,qe=500;function Xe(e,t=[]){const n=t.join(",")+"\0"+e,r=Ze.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=Ve(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=Ve(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(Ze.size>=qe){const e=Ze.keys().next().value;void 0!==e&&Ze.delete(e)}return Ze.set(n,o),o}function Ve(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 Ge(e,t,n,r,o,s,i=[]){try{const a=Je(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${Ye(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+(${Ye(s)})\\s*=`,"g");r=r.replace(e,`__state__.${s} ??=`)}for(const s of t){const e=new RegExp(`(?<![^.]\\.)(?<!__state__\\.)\\b${Ye(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=Qe(n,r),u=Ke(),f=["__state__","$host","$refs",...u,...l.keys],p=[t,o,s,...u.map(()=>{}),...l.values];new Function(...f,c)(...p)}catch(a){}}function Je(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 Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(){return ke.filter(e=>!Le.has(e))}function Qe(n,r){const o=[],s=[];for(const e of Re)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 et=/* @__PURE__ */new Map,tt=/^[A-Za-z_$][\w$]*$/,nt=null,rt=null;function ot(e,t){try{const n=Object.keys(t),r=[],o=[];for(let e=0;e<n.length;e++){const s=n[e];tt.test(s)&&(r.push(s),o.push(t[s]))}null===nt&&(nt=Ke(),rt=nt.map(()=>{}));const s=nt,i=r.join(",")+"\0"+e;let a=et.get(i);if(!a){if(et.size>=5e3){const e=et.keys().next().value;void 0!==e&&et.delete(e)}a=new Function(...s,...r,`"use strict"; return ${e};`),et.set(i,a)}return a(...rt,...o)}catch(n){return C(0,n,{context:E()}),`{${e}}`}}var st=/* @__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 it(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=ot(e.bindings[0].raw,t);return void(r&&(n=o,null===n||"object"!=typeof n&&"function"!=typeof n?function(e,t,n){st.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=ot(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 at(e,t){for(const n of e)it(n,t)}function ct(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(null===e||null===t)return e===t;if("object"!=typeof e)return e===t;const n=e,r=t,o=Object.keys(n);if(o.length!==Object.keys(r).length)return!1;for(const s of o)if(n[s]!==r[s])return!1;return!0}var lt="ELSE-IF",ut="ELSE";function ft(e){const t=e.trim();return t.startsWith("{")&&t.endsWith("}")?t.slice(1,-1).trim():t}function pt(e,t){const n=Array.from(e.querySelectorAll(`[${xe($e)}]`));for(const r of n){const e=r.getAttribute($e);e&&(t.refs.set(e,r),r.removeAttribute($e))}}function dt(e,t){const n=Array.from(e.querySelectorAll("for"));for(const r of n){if(!r.parentNode)continue;if(mt(r))continue;const n=r.getAttribute("each")||r.getAttribute("of")||"";if(!n)continue;let o=gt(n);if(!o)continue;const s=r.getAttribute("key")||r.getAttribute("track-by")||o.key,i=ht(r);if(!i)continue;const a=document.createComment(` <for> ${n} `),c=r.parentElement||e;c.insertBefore(a,r),r.remove(),t.loops.push({template:i,expression:n,itemName:o.item,indexName:o.index,arrayName:o.array,keyAttribute:s,placeholder:a,renderedElements:[],originalParent:c})}}function ht(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 mt(e){let t=e.parentElement;for(;t;){if("FOR"===t.tagName)return!0;t=t.parentElement}return!1}function gt(e){const t=e.match(Se);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(Ce,"").trim(),a=i.match(Ne);let c,l,u;return a?(c=i.replace(Ne,"").trim(),l=a[1]?.trim(),u=a[2]?.trim()):c=i,{item:c,index:l||u,key:n,array:o}}function _t(e,t){const n=Array.from(e.querySelectorAll("if"));for(const r of n){if(mt(r))continue;const n=[],o=ft(r.getAttribute("condition")||""),s=document.createComment(` <if> ${o} `),i=r.parentElement||e,a=r.nextSibling;i.insertBefore(s,r),n.push(yt(r,o,"if",s,i,a));let c=r.nextElementSibling;for(;c;){const e=c.tagName;if(e!==lt){if(e===ut){n.push(yt(c,"","else",s,i,c.nextSibling)),c.remove();break}break}{const e=ft(c.getAttribute("condition")||""),t=c.nextElementSibling;n.push(yt(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 yt(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 bt(e,t){const n=Array.from(e.querySelectorAll("show"));for(const r of n){if(!r.parentNode)continue;if(mt(r))continue;const e=ft(r.getAttribute("condition")||""),n=r;n.style.display="contents",t.showElements.push({element:n,expression:e,originalDisplay:"contents"}),r.removeAttribute("condition")}}function vt(e,t){const n=Array.from(e.querySelectorAll(`[${xe(Ee)}]`));for(const r of n){const e=r.getAttribute(Ee);if(!e)continue;if(wt(r))continue;const n={element:r,path:e.split("."),raw:e,isContentEditable:r.hasAttribute("contenteditable")};t.twoWayBindings.push(n),r.removeAttribute(Ee)}}function wt(e,t){return mt(e)}function Et(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=(r,o)=>{const s=e.template.cloneNode(!0),i=function(e,t,n,r){const o=At(e);return o[t.itemName]=n,t.indexName&&(o[t.indexName]=r),o}(t,e,r,o);return kt(s,i,n),Lt(s,i,n),s},l=new Array(s.length),u=new Array(s.length),f=At(t);if(e.keyAttribute){const t=function(e,t,n){const r=[],o=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;for(let p=0;p<e.length;p++)o.set(n(e[p],p),p);for(let p=0;p<t.length;p++)s.set(n(t[p],p),p);const i=/* @__PURE__ */new Set;for(let p=0;p<e.length;p++){const t=n(e[p],p);s.has(t)||r.push({type:"remove",oldIndex:p,key:t,item:e[p]})}for(let p=0;p<t.length;p++){const e=n(t[p],p);o.has(e)||(r.push({type:"insert",newIndex:p,key:e,item:t[p]}),i.add(p))}const a=[],c=[];for(let p=0;p<e.length;p++){const t=n(e[p],p),r=s.get(t);void 0!==r&&(a.push(r),c[p]=r)}const l=function(e){if(0===e.length)return[];const t=e.length,n=new Array(t).fill(1),r=new Array(t).fill(-1);let o=1,s=0;for(let c=1;c<t;c++){for(let t=0;t<c;t++)e[t]<e[c]&&n[t]+1>n[c]&&(n[c]=n[t]+1,r[c]=t);n[c]>o&&(o=n[c],s=c)}const i=[];let a=s;for(;-1!==a;)i.unshift(a),a=r[a];return i}(a),u=new Set(l.map(e=>a[e]));let f=0;for(const p of a){for(;f<e.length&&!s.has(n(e[f],f));)f++;if(f<e.length){const t=n(e[f],f),o=f,i=s.get(t);u.has(i)||r.push({type:"move",oldIndex:o,newIndex:i,key:t,item:e[o]}),f++}}for(let p=0;p<t.length;p++){const s=n(t[p],p),i=o.get(s);if(void 0!==i){const n=t[p];ct(e[i],n)||r.push({type:"update",oldIndex:i,newIndex:p,key:s,item:n})}}return r}(i,s,e.keyGetter),r=/* @__PURE__ */new Map,o=/* @__PURE__ */new Map;for(let n=0;n<i.length;n++){const t=e.keyGetter(i[n],n);o.set(t,n),a[n]&&r.set(t,a[n])}for(const e of t)if("remove"===e.type&&void 0!==e.key){const t=r.get(e.key);t&&(t.remove(),r.delete(e.key))}for(let i=0;i<s.length;i++){const t=s[i],a=e.keyGetter(t,i),p=r.get(a);p?(f[e.itemName]=t,e.indexName&&(f[e.indexName]=i),$t(p,f,n),l[i]=p,u[i]=o.get(a)??-1):(l[i]=c(t,i),u[i]=-1)}}else{const t=Math.min(i.length,s.length);for(let r=0;r<s.length;r++)r<t?(f[e.itemName]=s[r],e.indexName&&(f[e.indexName]=r),$t(a[r],f,n),l[r]=a[r],u[r]=r):(l[r]=c(s[r],r),u[r]=-1);for(let e=t;e<a.length;e++)a[e]?.remove()}const p=function(e){const t=e.length,n=/* @__PURE__ */new Set;if(0===t)return n;const r=[],o=new Array(t).fill(-1);for(let i=0;i<t;i++){const t=e[i];if(t<0)continue;let n=0,s=r.length;for(;n<s;){const o=n+s>>1;e[r[o]]<t?n=o+1:s=o}n>0&&(o[i]=r[n-1]),r[n]=i}let s=r.length>0?r[r.length-1]:-1;for(;-1!==s;)n.add(s),s=o[s];return n}(u),d=e.placeholder.parentNode;if(d){let t=e.placeholder;for(let e=0;e<l.length;e++){const n=l[e];p.has(e)||t.nextSibling!==n&&d.insertBefore(n,t.nextSibling),t=n}}e.renderedElements=l,e.previousItems=[...s]}function At(e){const t=e.__scriptContent;return{...e,__reactiveState__:e,__scriptContent__:t||"",__componentUrl__:e.__componentUrl||""}}function $t(e,t,n){!function(e,t,n){const r=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),o=[];let s;for(;s=r.nextNode();)s[Nt]&&o.push(s);for(const i of o){const e=i[Nt],r=Ct(e.branches,t,n);if(r!==e.currentIndex&&(e.currentEl&&e.currentEl.parentNode&&e.currentEl.remove(),e.currentEl=null,e.currentIndex=-1,r>=0)){const o=xt(e.branches[r]);i.parentNode.insertBefore(o,i.nextSibling),e.currentIndex=r,e.currentEl=o,kt(o,t,n),Lt(o,t,n)}}}(e,t,n);const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o;for(;o=r.nextNode();){const e=o.__originalTemplate;e&&(o.textContent=e.replace(/\{([^}]+)\}/g,(e,r)=>{const o=n(r.trim(),t);return String(o??"")}))}St(e,t,n);const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let i;for(;i=s.nextNode();)St(i,t,n)}function St(e,t,n){for(const r of Array.from(e.attributes)){const e=r.__originalTemplate;e&&(r.value=e.replace(/\{([^}]+)\}/g,(e,r)=>{const o=n(r.trim(),t);return null!==o&&"object"==typeof o?JSON.stringify(o):String(o??"")}))}}var Nt="__ladrillosLoopCond";function Ct(e,t,n){for(let r=0;r<e.length;r++){const o=e[r];if("else"===o.type)return r;try{if(n(o.condition,t))return r}catch{}}return-1}function xt(e){const t=document.createElement("span");return t.style.display="contents",t.appendChild(e.template.content.cloneNode(!0)),t}function Rt(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?"":ft(e.getAttribute("condition")||""),template:n}}function kt(e,t,n){let r=1e4;for(;r-- >0;){let r=null;const o=e.querySelectorAll("IF");for(let e=0;e<o.length;e++){const t=o[e];if(t.parentNode&&!mt(t)){r=t;break}}if(!r)return;const s=[];s.push(Rt(r,"if"));const i=[];let a=r.nextElementSibling;for(;a;){if(a.tagName!==lt){if(a.tagName===ut){s.push(Rt(a,"else")),i.push(a);break}break}s.push(Rt(a,"else-if")),i.push(a),a=a.nextElementSibling}const c=document.createComment(" <if> (loop) "),l={branches:s,currentIndex:-1,currentEl:null};c[Nt]=l,r.parentNode.insertBefore(c,r),r.remove();for(const e of i)e.remove();const u=Ct(s,t,n);if(u>=0){const e=xt(s[u]);c.parentNode.insertBefore(e,c.nextSibling),l.currentIndex=u,l.currentEl=e}}}function Lt(e,t,n){for(const i of Array.from(e.attributes))we.includes(i.name)||Fe(i.name)||i.value.includes("{")&&(i.__originalTemplate=i.value,i.value=i.value.replace(/\{([^}]+)\}/g,(e,r)=>{const o=n(r.trim(),t);return null!==o&&"object"==typeof o?JSON.stringify(o):String(o??"")}));!function(e,t){for(const n of we){const r=e.getAttribute(n);if(r){e.removeAttribute(n);const o=n.slice(2),s=It(Tt(r),t);s&&e.addEventListener(o,s)}}!function(e,t){const n=Array.from(e.attributes).filter(e=>Fe(e.name));for(const r of n){const n=Pe(r.name);if(!n)continue;const o=Tt(r.value);e.removeAttribute(r.name);const s=It(o,t);if(!s)continue;const i=je(s,n),a=De(n.eventModifiers);e.addEventListener(n.eventName,i,a)}}(e,t)}(e,t);const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=[];let s;for(;s=r.nextNode();)s.textContent?.includes("{")&&o.push(s);for(const i of o)i.__originalTemplate=i.textContent,i.textContent=i.textContent.replace(/\{([^}]+)\}/g,(e,r)=>{const o=n(r.trim(),t);return String(o??"")});for(const i of Array.from(e.children))Lt(i,t,n)}function Tt(e){return e.replace(/\{([^}]+)\}/g,(e,t)=>`(${t.trim()})`)}function It(e,n){try{const r=n.__reactiveState__,o=n.__scriptContent__||"",s=Object.keys(n).filter(e=>!e.startsWith("__")),i=r?Object.keys(r).filter(e=>!e.startsWith("__")&&"function"!=typeof r[e]):[],a=s.filter(e=>!i.includes(e)&&"function"!=typeof n[e]),c=o.trim().length>0,l=s.filter(e=>"function"==typeof n[e]),u=r&&!0===r.__hasModuleScripts;let f="",p="";u?p=l.length>0?`const { ${l.join(", ")} } = context;`:"":c?f=Xe(o,[]):p=l.length>0?`const { ${l.join(", ")} } = context;`:"";const d=a.length>0?`const { ${a.join(", ")} } = context;`:"",h=r&&i.length>0?"reactiveState":"context",m=i.length>0?`let { ${i.join(", ")} } = ${h};`:"",g=!u&&r&&i.length>0?i.map(e=>`reactiveState.${e} = ${e};`).join(" "):"",_=t(n.__componentId__||r?.__componentId||"anonymous"),y=new Function("event","context","reactiveState","$emit","$listen",`"use strict";\n ${d}\n ${m}\n ${p}\n ${f}\n ${e};\n ${g}`);return t=>{try{Ae(t),y(t,n,r,_.$emit,_.$listen)}catch(o){N(`Error in loop event handler: ${e}`,null,o)}}}catch(r){return null}}function Ot(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 Mt(e,t,n,r){const o=e.element,{raw:s,path:i,isContentEditable:a}=e;Pt(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 Pt(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 Dt=[],jt=/* @__PURE__ */new Set,Ft=!1,zt=!1,Ut=0,Wt=Promise.resolve();function Bt(){zt=!1,Ft=!0,Dt.sort((e,t)=>(e.id??0)-(t.id??0));try{for(const t of Dt)if(!1!==t.active)try{t()}catch(e){N("Error in scheduled update",null,e)}}finally{Dt.length=0,jt.clear(),Ft=!1}}var Ht=/* @__PURE__ */new Map;var Zt=/* @__PURE__ */new Set(["state","_root","_initialized","_componentId","_directives","_evaluator","_updateBoundInputs","_pendingProps","_propsReady"]);function qt(e,t){const{tagName:r,template:o,scripts:s,externalScripts:i,externalStyles:a,styles:c,sourcePath:l,templateBindings:u=[]}=e,f=Je(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=t,me(n.content),e.innerHTML="",e.appendChild(n.content);const r=ye(e);for(const o of _e(e))r.push(...ye(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(Zt.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(`[${xe($e)}]`));for(const r of n){const e=r.getAttribute($e);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=z.get(r.href);if(!e){const t=await fetch(r.href);if(!t.ok)continue;e=await t.text(),z.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 F(n)}catch(N){}}(i),this.state=await async function(e,t,n,r={},o,s=!1,i,a,c,l=[]){const u=ze(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=b(f,n,(e,t)=>it(e,t),o);d.__suspendReactivity=!0;try{for(const e of t)Ge(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||(Ue(e,d,p,u),at(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,()=>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 F(p,r,n)}catch(N){}for(const p of u)try{const e=await F(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 B(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=ze(e);Ue(e,n,r.__scriptContent||"",r),at(t,n)}(this._root,f,this.state),this._evaluator=ot,this._directives=function(e,t){const n={loops:[],conditionals:[],twoWayBindings:[],refs:t,showElements:[]},r=[e,..._e(e)];for(const o of r)pt(o,n),dt(o,n),bt(o,n),vt(o,n),_t(o,n);return me(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)Mt(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),Pt(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=x.get(e);if(t){for(const e of t)URL.revokeObjectURL(e);x.delete(e)}}(this._componentId),n(this._componentId),function(e){const t=Ht.get(e);t&&(t.active=!1,Ht.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.state[e]=r}adoptedCallback(){}_updateDirectives(){this._directives&&this._evaluator&&function(e,t){let n=Ht.get(e);n||(n=function(){const e=()=>{t()};return e.id=++Ut,e.active=!0,e}(),Ht.set(e,n)),function(e){void 0===e.id&&(e.id=++Ut),jt.has(e.id)||(jt.add(e.id),Dt.push(e),Ft||zt||(zt=!0,Wt.then(Bt)))}(n)}(this._componentId,()=>{this._performDirectiveUpdates()})}_performDirectiveUpdates(){this._directives&&this._evaluator&&(this._directives.loops.length>0&&function(e,t,n){for(const r of e)Et(r,t,n)}(this._directives.loops,this.state,this._evaluator),this._directives.conditionals.length>0&&function(e,t,n){for(const r of e)Ot(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(Zt.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 Xt(e,t){const{tagName:n}=e;if(!customElements.get(n)){const r=qt(e,t);customElements.define(n,r)}}var Vt,Gt=/* @__PURE__ */new Map,Jt=/* @__PURE__ */new Map,Yt=/* @__PURE__ */new Set,Kt=/* @__PURE__ */new Map;function Qt(e,t,n,r){var o;Kt.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=Kt.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 en(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 en(e){const t=function(e){return`${e}--loaded`}(e);if(Yt.has(e))return t;if(Gt.has(e))return await Gt.get(e),t;const n=Kt.get(e);if(!n)throw new Error(`Lazy component "${e}" not registered`);const r=(async()=>{const r=await te(n.absolutePath);if(!r)throw new Error(`Failed to fetch component source for "${e}"`);const o=await J(r.source,e,r.resolvedPath);Vt[e]=o;const s=qt(o,n.useShadowDOM);return customElements.get(t)||customElements.define(t,s),Yt.add(e),Jt.set(e,{component:o,useShadowDOM:n.useShadowDOM}),o})();Gt.set(e,r);try{return await r,t}finally{Gt.delete(e)}}function tn(e){return Kt.has(e)||Yt.has(e)}async function nn(e){return Kt.has(e)&&await en(e),Vt[e]}var rn=/* @__PURE__ */o({ladrillos:()=>on}),on=new class{components;constructor(){this.components={},Vt=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)Qt(e,o,n,!0===r?pe:r);else try{const t=await te(o);if(!t)throw new Error(`Failed to fetch component source from ${o}`);const r=await J(t.source,e,t.resolvedPath);this.components[e]=r,Xt(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{Qt(c.name,c.absolutePath,c.useShadowDOM??!0,!0===c.lazy?pe: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 te(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 J(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{Xt(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 nn(e)}};export{fe as a,le as c,A as d,S as f,f as h,pe as i,ce as l,u as m,nn as n,ae as o,p,tn as r,ue as s,on as t,Q as u};
3
+ //# sourceMappingURL=shared-BXkP1Y3n.js.map