import{n as e,s as t}from"./jsx-runtime-Bzw2jH9X.js";import{ut as n}from"./services-Ddh4dHvP.js";import{r}from"./modalStore-B5-16H5z.js";var i=t(e(),1),a=r(e=>({category:null,isLoadingCategory:!1,setCategory:t=>e({category:t}),setLoading:t=>e({isLoadingCategory:t})}));function o(e){let t=[[`business`,`DOC_BUSINESS`],[`type`,`DOC_TYPE`],[`target`,`DOC_TARGET`],[`label`,`DOC_LABEL`],[`keyBusiness`,`KEYWORD_BUSINESS`],[`keyHot`,`KEYWORD_HOT`],[`chart`,`CHART_TYPE`],[`paidReportLabel`,`PAID_REPORT_LABEL`]],n={};for(let[r,i]of t){let t=e[i]||[],a={},o=[];for(let e of t)a[e.id]=e.name,o.push(e.id);n[r+`Map`]=a,n[r+`List`]=o}return{businessOptions:e.DOC_BUSINESS,typeOptions:e.DOC_TYPE,targetOptions:e.DOC_TARGET,labelOptions:e.DOC_LABEL,keyBusinessOptions:e.KEYWORD_BUSINESS,keyHotOptions:e.KEYWORD_HOT,chartOptions:e.CHART_TYPE,paidReportLabelOptions:e.PAID_REPORT_LABEL,...n}}var s=null;async function c(){let e=a.getState().category;if(e)return e;if(!s){let{setCategory:e,setLoading:t}=a.getState();s=(async()=>{t(!0);try{let t=o(await n());return e(t),t}finally{t(!1)}})().finally(()=>{s=null})}return s}function l(){let{category:e,isLoadingCategory:t}=a(),n=(0,i.useCallback)(()=>c(),[]);return(0,i.useEffect)(()=>{e||n()},[e,n]),{category:e,isLoadingCategory:t,getCategory:n}}export{l as t};