import{r as t,h as e,g as s}from"./p-3b76effa.js";class n{constructor(e){t(this,e),this.content=[],this.element="ul",this.template=""}componentDidLoad(){this.postRender()}componentDidUpdate(){this.postRender()}postRender(){this.el.innerHTML=this.html}async setData(t){this.content=t}async setTemplate(t){this.templateString=t}interpolate(t,e){if("object"==typeof e)for(let s in e){const n="${"+s+"}";t.indexOf(n)>-1&&(t=t.replace(n,e[s]),delete e[s])}return t}render(){const t=this.element;let s=null!==t?"<"+t.toLowerCase()+">":"";if(this.template&&(this.templateString=this.template),this.dataJson&&(this.content=JSON.parse(this.dataJson)),!Array.isArray(this.content))throw new Error("Content should be an Array of objects.");return this.content.forEach(t=>{s+=this.interpolate(this.templateString,t)}),s+=null!==t?"</"+t.toLowerCase()+">":"",this.html=s,e("div",null)}get el(){return s(this)}}export{n as ema_repeater};