import{aR as i}from"./main-tangy-colts-beg.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,n){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,n),n)}};const c=async()=>i("pro_get_all_rank_type",void 0,void 0,"GET"),l=async()=>i("pro_get_all_achievement_type",void 0,void 0,"GET"),r=async e=>i("pro_get_all_rank_by_types",void 0,{rankType:e},"GET"),d=async e=>i("pro_get_all_award_by_achievement_type",void 0,{achievementType:e},"GET");globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,n){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,n),n)}};const h=async e=>{e.setComponent("rank-type",t=>{t.loading=!0});const{data:n,status:o}=await c();if(o==="error"){e.setComponent("rank-type",t=>{e.util.isSelectComponent(t)&&(t.status=o,t.loading=!1,t.invalidMessage=n)}),console.error("Failed to fetch rank");return}e.setComponent("rank-type",t=>{e.util.isSelectComponent(t)&&(t.options=n,t.loading=!1,t.status=void 0)})},g=async e=>{var s;e.setComponent("rank-id",a=>{a.loading=!0});const n=(s=e.getComponent("rank-type"))==null?void 0:s.value,{data:o,status:t}=await r(n);if(t==="error"){e.setComponent("rank-id",a=>{e.util.isSelectComponent(a)&&(a.status=t,a.loading=!1,a.invalidMessage=JSON.stringify(o))}),console.error("Failed to fetch ranks");return}e.setComponent("rank-id",a=>{e.util.isSelectComponent(a)&&(a.options=o,a.loading=!1,a.status=void 0)})},f=async e=>{e.setComponent("achievement-type",t=>{t.loading=!0});const{data:n,status:o}=await l();if(o==="error"){e.setComponent("achievement-type",t=>{e.util.isSelectComponent(t)&&(t.status=o,t.loading=!1,t.invalidMessage=n)}),console.error("Failed to fetch achievement-type");return}e.setComponent("achievement-type",t=>{e.util.isSelectComponent(t)&&(t.options=n,t.loading=!1,t.status=void 0)})},m=async e=>{var s;e.setComponent("award-id",a=>{a.loading=!0});const n=(s=e.getComponent("achievement-type"))==null?void 0:s.value,{data:o,status:t}=await d(n);if(t==="error"){e.setComponent("award-id",a=>{e.util.isSelectComponent(a)&&(a.status=t,a.loading=!1,a.invalidMessage=JSON.stringify(o))}),console.error("Failed to fetch ranks");return}e.setComponent("award-id",a=>{e.util.isSelectComponent(a)&&(a.options=o,a.loading=!1,a.status=void 0)})};export{f as a,g as b,h as c,m as f};
