import{aR as i}from"./main-tangy-colts-beg.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const a=async()=>i("pro_get_edd_all_product",void 0,void 0,"GET"),c=async()=>i("pro_get_edd_all_discount_code",void 0,void 0,"GET");globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const d=async o=>{o.setComponent("product-id",t=>{t.loading=!0});const{data:e,status:s}=await a();if(s==="error"){o.setComponent("product-id",t=>{o.util.isSelectComponent(t)&&(t.status=s,t.loading=!1,t.invalidMessage=e)}),console.error("Failed to fetch product");return}o.setComponent("product-id",t=>{o.util.isSelectComponent(t)&&(t.options=e,t.loading=!1,t.status=void 0)})},u=async o=>{o.setComponent("discount-id",t=>{t.loading=!0});const{data:e,status:s}=await c();if(s==="error"){o.setComponent("discount-id",t=>{o.util.isSelectComponent(t)&&(t.status=s,t.loading=!1,t.invalidMessage=e)}),console.error("Failed to fetch discount");return}o.setComponent("discount-id",t=>{o.util.isSelectComponent(t)&&(t.options=e,t.loading=!1,t.status=void 0)})};export{u as a,d as f};
