import{n as e}from"./rolldown-runtime-BG2f4sTM.js";import{un as t}from"./app-initial~avatarOverlayCompositionSurface~index-9fQ9wihu~index-BFCcxPM5~mapbox-gl-DVWlwqb~kppdhley-CabsBVhy.js";import{Bl as n,C as r,S as i,c as a,n as o,o as s,r as c,s as l,xl as u}from"./app-initial~avatarOverlayCompositionSurface~artifact-tab-content.electron~notebook-preview-~ngwudnyz-D_QFwR2V.js";import{n as d,r as f,t as p}from"./recommended-skill-statsig-overrides-DBZ1fRw2.js";function m(e){let t=(0,g.c)(29),{hostId:r,loadOnMount:s}=e,u=s===void 0?!0:s,d=n(),m=f(),_;t[0]===r?_=t[1]:(_=c(`recommended-skills`,{hostId:r,refresh:!1}),t[0]=r,t[1]=_);let v=_,y;t[2]===r?y=t[3]:(y={hostId:r,refresh:!1},t[2]=r,t[3]=y);let b;t[4]===u?b=t[5]:(b={enabled:u,staleTime:i.FIVE_MINUTES},t[4]=u,t[5]=b);let x;t[6]!==y||t[7]!==b?(x={params:y,queryConfig:b},t[6]=y,t[7]=b,t[8]=x):x=t[8];let S=l(`recommended-skills`,x),C=S.data?.error??(S.error?String(S.error.message??S.error):null),w=a(`install-recommended-skill`),T;t[9]!==r||t[10]!==d||t[11]!==v?(T=async()=>{let e=await o(`recommended-skills`,{params:{hostId:r,refresh:!0}});d.setQueryData(v,e)},t[9]=r,t[10]=d,t[11]=v,t[12]=T):T=t[12];let E=T,D=h,O;t[13]!==r||t[14]!==S.data?.skills||t[15]!==d||t[16]!==v?(O=async e=>{let t=D(S.data?.skills??[],e);if(t)return t;let n=await o(`recommended-skills`,{params:{hostId:r,refresh:!1}});return d.setQueryData(v,n),D(n.skills,e)},t[13]=r,t[14]=S.data?.skills,t[15]=d,t[16]=v,t[17]=O):O=t[17];let k=O,A;t[18]!==r||t[19]!==w||t[20]!==m?(A=async e=>{let{skill:t,installRoot:n}=e,i=n===void 0?null:n;return w.mutateAsync({hostId:r,skillId:t.id,repoPath:t.repoPath,installRoot:i,skillStatsigOverride:p(m,t.id)})},t[18]=r,t[19]=w,t[20]=m,t[21]=A):A=t[21];let j=A,M;return t[22]!==k||t[23]!==C||t[24]!==j||t[25]!==S.data||t[26]!==S.isLoading||t[27]!==E?(M={data:S.data,errorMessage:C,isLoading:S.isLoading,refresh:E,ensureSkillByName:k,installSkill:j},t[22]=k,t[23]=C,t[24]=j,t[25]=S.data,t[26]=S.isLoading,t[27]=E,t[28]=M):M=t[28],M}function h(e,t){let n=t.toLowerCase();return e.find(e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t===n||r===n})??null}var g,_=e((()=>{g=t(),u(),r(),s(),d()}));export{m as n,_ as t};
//# sourceMappingURL=use-recommended-skills-BhQUxTs7.js.map