import{ax as v,dz as b,B as H,b9 as i,bq as p,N as O,dA as E,dB as V,aY as Z,D as e,c0 as u,o as A,S as f,aw as x,aM as J,ah as k,ag as h,ab as c,cz as m,cM as K,a2 as W,K as s,L as X,M as Y,E as Q,bu as U,F as ee,G as te,T as re,I as ne,J as ae,bt as oe,bb as g}from"./index-CNZMR1GT.js";import{G as se}from"./index-3N2OqIV6.js";import ie from"./Common-DGmkJwav.js";import"./useTitle-BClow7LS.js";import"./index-DsSWFirV.js";import"./index-DUl6hczb.js";import"./SettingItem-EdBZszST.js";import"./item_type-CyD6qwPS.js";import"./ResponsiveGrid-VTNos9Q3.js";var de=v('<svg width=1em height=1em viewBox="0 0 24 24"><g fill=none stroke=currentColor stroke-linecap=round stroke-width=2><path stroke-dasharray=60 stroke-dashoffset=60 stroke-opacity=.3 d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill=freeze attributeName=stroke-dashoffset dur=1.3s values=60;0></animate></path><path stroke-dasharray=15 stroke-dashoffset=15 d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill=freeze attributeName=stroke-dashoffset dur=0.3s values=15;0></animate><animateTransform attributeName=transform dur=1.5s repeatCount=indefinite type=rotate values="0 12 12;360 12 12">'),le=v('<svg width=1em height=1em viewBox="0 0 24 24"><g stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=2><path fill=currentColor fill-opacity=0 stroke-dasharray=60 stroke-dashoffset=60 d="M3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"><animate fill=freeze attributeName=stroke-dashoffset dur=0.5s values=60;0></animate><animate fill=freeze attributeName=fill-opacity begin=0.8s dur=0.15s values=0;0.3></animate></path><path fill=none stroke-dasharray=14 stroke-dashoffset=14 d="M8 12L11 15L16 10"><animate fill=freeze attributeName=stroke-dashoffset begin=0.6s dur=0.2s values=14;0>');function ue(r){return(()=>{var n=de();return b(n,r,!0,!0),n})()}function ce(r){return(()=>{var n=le();return b(n,r,!0,!0),n})()}const we=()=>{const r=A(),[n,C]=H(),[w,$]=i(()=>p.get("/admin/index/progress")),o=async()=>{const t=await $();oe(t,a=>{C(a)})},y=setInterval(o,5e3);O(()=>clearInterval(y)),o();const[M,_]=i(E),I=async()=>{const t=await _();g(t),o()},[S,B]=i(()=>p.post("/admin/index/clear")),L=async()=>{const t=await B();g(t),o()},[N,R]=i(()=>p.post("/admin/index/stop")),z=async()=>{const t=await R();g(t),o()};let d,l;const[T,q]=i(V),D=async()=>{let t=[];d.value&&(t=d.value.split("\n"));let a=20;l.value&&(a=parseInt(l.value));const G=await q(t,a);g(G),o()},{isOpen:P,onOpen:j,onClose:F}=Z();return e(k,{spacing:"$2",w:"$full",alignItems:"start",get children(){return[e(u,{get children(){return r("manage.sidemenu.settings")}}),e(ie,{get group(){return se.INDEX}}),e(u,{get children(){return r("indexes.current")}}),e(f,{get when(){return n()},get children(){return e(x,{spacing:"$2",w:"fit-content",shadow:"$md",rounded:"$lg",get bg(){return W("","$neutral3")()},get children(){return[e(J,{boxSize:"$28",color:"$accent9",p:"$2",get as(){var t;return(t=n())!=null&&t.is_done?ce:ue}}),e(k,{spacing:"$2",flex:"1",alignItems:"start",mr:"$2",get children(){return[e(h,{get children(){return[c(()=>r("indexes.obj_count")),":",e(m,{colorScheme:"info",ml:"$2",get children(){var t;return(t=n())==null?void 0:t.obj_count}})]}}),e(h,{get children(){return[c(()=>r("indexes.last_done_time")),":",e(m,{colorScheme:"accent",ml:"$2",get children(){return c(()=>!!n().last_done_time)()?K(n().last_done_time):r("indexes.unknown")}})]}}),e(f,{get when(){var t;return(t=n())==null?void 0:t.error},get children(){return e(h,{css:{wordBreak:"break-all"},get children(){return[c(()=>r("indexes.error")),":",e(m,{colorScheme:"danger",ml:"$2",get children(){return n().error}})]}})}})]}})]}})}}),e(x,{spacing:"$2",get children(){return[e(s,{colorScheme:"accent",onClick:[o,void 0],get loading(){return w()},get children(){return r("global.refresh")}}),e(s,{colorScheme:"danger",onClick:[L,void 0],get loading(){return S()},get children(){return r("indexes.clear")}}),e(s,{colorScheme:"warning",onClick:[z,void 0],get loading(){return N()},get children(){return r("indexes.stop")}}),e(s,{onClick:[I,void 0],get loading(){return M()},get children(){var t;return r("indexes.".concat((t=n())!=null&&t.is_done?"rebuild":"build"))}})]}}),e(s,{onClick:j,get children(){return r("indexes.update")}}),e(X,{get opened(){return P()},onClose:F,get children(){return[e(Y,{}),e(Q,{get children(){return[e(U,{}),e(ee,{get children(){return r("indexes.update")}}),e(te,{get children(){return[e(u,{get children(){return r("indexes.paths_to_update")}}),e(re,{ref(t){var a=d;typeof a=="function"?a(t):d=t}}),e(u,{get children(){return r("indexes.max_depth")}}),e(ne,{value:20,type:"number",ref(t){var a=l;typeof a=="function"?a(t):l=t}})]}}),e(ae,{get children(){return e(s,{onClick:[D,void 0],get loading(){return T()},get children(){return r("indexes.update")}})}})]}})]}})]}})};export{we as default};
