import{processDOM as C,removeBindings as g,Internals as k,DirectiveRegistry as B}from"../index.js";var{block:M,repeatCtx:E,internals:p,index:ie}=k,A="*foreach",h=Symbol(),b=new Range,T={attribute:(t,e)=>e===A,process:({targetNode:t,scopeNode:e,expression:r})=>{let o=document.createElement("template");t[M]="abort",t.removeAttribute(A);let i=t.outerHTML,a=document.createComment("*foreach"),u=t.parentElement||t.parentNode||e.shadowRoot||e;u.insertBefore(a,t);let n=[];function f(l=[]){let c=l.length,v=n.length;if(c<v){let{[c]:s,[v-1]:d}=n;b.setStartBefore(s),b.setEndAfter(d),b.deleteContents(),n.slice(c).forEach(m=>{m[p][h].clear(),g(e,m)}),n.length=c}v=n.length,o.innerHTML=i.repeat(Math.max(0,c-v)),b.selectNodeContents(o.content);let x=b.extractContents(),y=Array.from(x.children);y.forEach((s,d)=>{s[E]=l[n.length+d];let{bounds:m,clear:j}=C(e,s);s[p]=s[p]||{},s[p][h]={bounds:m,clear:j},m.forEach(R=>R())}),u.insertBefore(x,a),n.forEach((s,d)=>{s[E]=l[d],s[p][h].bounds.forEach(m=>m())}),n.push(...y)}return{update:f,removeNode:!0}}};B.add(T,!0);import{DirectiveRegistry as _,Internals as H,processDOM as I}from"../index.js";var{block:O}=H,w=(t,e)=>{let r=t.cloneNode(!0),{clear:o,bounds:i}=I(e,r);return{clear:o,bounds:i,copy:r}},L={attribute:(t,e)=>e==="*if",process:({scopeNode:t,targetNode:e,expression:r})=>{let o=document.createComment("*if");e[O]="abort",e.removeAttribute("*if"),e.parentNode?.insertBefore(o,e);let i,a,u;return{update:f=>{f?(!i&&({copy:i,bounds:a,clear:u}=w(e,t)),a.forEach(l=>l()),o.parentNode?.insertBefore(i,o)):i&&(i.remove(),u(),i=a=u=void 0)},removeNode:!0,removeAttribute:!0}},noExecution:!1};_.add(L);import{Utils as F,Internals as P,DirectiveRegistry as U,Slim as W}from"../index.js";var{dashToCamel:z}=F,{debug:S,block:$}=P,q={attribute:(t,e)=>e.startsWith("."),process:({attributeName:t,targetNode:e})=>{let r=z(t.slice(1));return{update:o=>{e[$]!=="abort"&&(e[r]=o)},removeAttribute:!W[S]}}};U.add(q);import{DirectiveRegistry as G,Internals as D}from"../index.js";var J={attribute:(t,e,r="")=>{let o=e[0];return r&&o!=="@"&&o!=="."&&o!=="*"&&r.slice(0,2)==="{{"&&r.slice(-2)==="}}"},process:({attributeName:t,targetNode:e})=>e[D.block]==="abort"?{}:{update:r=>{if(e[D.block]==="abort")return e.removeAttribute(t);typeof r=="boolean"||typeof r=="undefined"||r===null?r?e.setAttribute(t,""):e.removeAttribute(t):e.setAttribute(t,""+r)},removeNode:!1,removeAttribute:!0}};G.add(J);import{DirectiveRegistry as K,Utils as Q}from"../index.js";var{dashToCamel:V,memoize:X,createFunction:Y}=Q,Z=X(V),N=/(.+)(\((.*)\)){1}/,ee={attribute:(t,e)=>e.startsWith("@"),process:({attributeName:t,targetNode:e,scopeNode:r,expression:o,context:i})=>{let a=Z(t.slice(1)),u=N.test(o||""),n=function(f){let l=Y("event","item",`return ${o};`),c;return u||(c=l.call(r)),c?c(f,i):l.call(r,f,i())};return e.addEventListener(a,n),{removeAttribute:!0}}};K.add(ee);import{DirectiveRegistry as te}from"../index.js";var re={attribute:(t,e)=>e==="#ref",process:({attribute:t,targetNode:e,scopeNode:r})=>{let o=t.value;return Object.defineProperty(r,o,{value:e,configurable:!0}),{removeAttribute:!0}},noExecution:!0};te.add(re);
