import{r as i,d as t,B as s,h as n,H as o}from"./p-03169580.js";let r=class{constructor(s){i(this,s);this.fireenjinFetch=t(this,"fireenjinFetch",7);this.params={}}async onError(i){var t;if(i.detail.name===this.name){let s=((t=i===null||i===void 0?void 0:i.detail)===null||t===void 0?void 0:t.data)||null;if(typeof this.error==="function")this.error(s)}}async onSuccess(i){var t;if(i.detail.name===this.name){let s=((t=i===null||i===void 0?void 0:i.detail)===null||t===void 0?void 0:t.data)||[];if(this.resultsKey){try{s=this.resultsKey.split(".").reduce(((i,t)=>i[t]),i.detail.data)}catch(t){console.log("Error getting results",i.detail,this.resultsKey)}}if(typeof this.success==="function")this.success(s)}}async fetch(){this.fireenjinFetch.emit({name:this.name,endpoint:this.endpoint,dataPropsMap:this.dataPropsMap?this.dataPropsMap:null,params:this.params||{}})}componentDidLoad(){if(!(s===null||s===void 0?void 0:s.isBrowser))return;if(!this.name)this.name=this.endpoint;this.fetch()}render(){return n(o,null,n("slot",null))}};export{r as fireenjin_query};
//# sourceMappingURL=p-2143342f.entry.js.map