import{D as s}from"./p-d50d0ec8.js";import{C as i}from"./p-d343a062.js";import{r as t,c as h}from"./p-f46dff5e.js";class r{constructor(s,i,t,h,r,o){this.apiData=s,this.callback=o,this.params=i,this.table=t,this.fields=r,this.query=h}fetchData(r){var o;if(r.isPending)return;this.callback(r.beforeFetch());const{name:a}=this.table,e=(null===(o=this.query)||void 0===o?void 0:o.filter)?t(h(this.query.filter),this.params):{comparison:i.Eq,id:"_id",value:this.params.itemId};this.apiData.query(a,{fields:this.fields,filter:e,limit:1,skip:0}).then((i=>{this.callback(r.afterFetch(i.results.length>0?i.results[0]:new s))}),(s=>{this.callback(r.afterFetchError(s))}))}}export{r as I}