import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{At as n}from"./vendor-all-0-fRSUBfCr.js";import{Ll as t,Vm as i,zm as a}from"./shared-0-C4kdVF7Y.js";import{Mi as r}from"./vendor-frame-CwiylG4Y.js";import{rn as s}from"./vendor-all-2-BJdkbLSj.js";var o=e(r()),u=(e,n)=>["interviews",e,n];function c(e,n=!0){const{activeOrganization:a,account:r}=t(),s=a?.uuid,o=r?.uuid;return i(`/api/organizations/${s}/interviews/${e}`,{queryKey:u(o||"",e),enabled:Boolean(s&&o&&n&&e),meta:{noToast:!0,silent:!0},retry:!1,retryOnMount:!1,refetchOnMount:!1,staleTime:1/0})}function l(e,n=!0){const{activeOrganization:a,account:r}=t(),s=a?.uuid,o=r?.uuid;return i(`/api/organizations/${s}/interviews/${e}/config`,{enabled:Boolean(s&&o&&n&&e),meta:{noToast:!0,silent:!0},retry:!1,retryOnMount:!1,refetchOnMount:!1,staleTime:1/0})}function v(e,i){const r=function(){const e=s(),{activeOrganization:i,account:r}=t(),c=i?.uuid,l=r?.uuid,v=n(),{mutateAsync:m}=a(e=>`/api/organizations/${c}/interviews/${e.interviewType}`,"POST",{transformVariables:e=>{const{interviewType:n,...t}=e;return t},onSuccess:(e,n)=>{v.setQueryData(u(l||"",n.interviewType),e)},meta:{noToast:!0}});return(0,o.useCallback)((n,t)=>m({interviewType:n,use_conversation:t?.useConversation,locale:e.locale}),[m,e.locale])}(),c=function(){const{activeOrganization:e,account:i}=t(),r=e?.uuid,s=i?.uuid,c=n(),{mutateAsync:l}=a(e=>`/api/organizations/${r}/interviews/${e.interviewType}/status`,"PUT",{transformVariables:e=>{const{interviewType:n,...t}=e;return t},onSuccess:(e,n)=>{c.setQueryData(u(s||"",n.interviewType),e)},meta:{noToast:!0}});return(0,o.useCallback)((e,n)=>l({interviewType:e,status:n}),[l])}(),l=function(){const{activeOrganization:e,account:i}=t(),r=e?.uuid,s=i?.uuid,c=n(),{mutateAsync:l}=a(e=>`/api/organizations/${r}/interviews/${e.interviewType}`,"DELETE",{onSuccess:(e,n)=>{c.removeQueries({queryKey:u(s||"",n.interviewType)})},meta:{noToast:!0}});return(0,o.useCallback)(e=>l({interviewType:e}),[l])}();return{startInterview:(0,o.useCallback)(async n=>r(e,{sessionId:n,useConversation:i?.useConversation}),[r,e,i?.useConversation]),dismissInterview:(0,o.useCallback)(async()=>c(e,"dismissed"),[c,e]),completeInterview:(0,o.useCallback)(async()=>c(e,"completed"),[c,e]),deleteInterview:(0,o.useCallback)(async()=>l(e),[l,e])}}function m(){const{activeOrganization:e,account:i}=t(),r=e?.uuid,s=i?.uuid,c=n(),l=a(e=>`/api/organizations/${r}/interviews/${e.interviewType}/followup_consents`,"PUT",{transformVariables:e=>{const{interviewType:n,...t}=e;return t},onSuccess:(e,n)=>{c.setQueryData(u(s||"",n.interviewType),e)},meta:{noToast:!0}}),{mutateAsync:v}=l;return{submitFollowupConsents:(0,o.useCallback)((e,n)=>v({interviewType:e,answers:n}),[v]),isSubmitting:l.isPending,error:l.error,reset:l.reset}}function y(){const{activeOrganization:e,account:i}=t(),r=e?.uuid,s=i?.uuid,c=n(),l=a(e=>`/api/organizations/${r}/interviews/${e.interviewType}/compensation`,"PUT",{transformVariables:e=>{const{interviewType:n,...t}=e;return t},onSuccess:(e,n)=>{c.setQueryData(u(s||"",n.interviewType),e)},meta:{noToast:!0}}),{mutateAsync:v}=l;return{claimCompensation:(0,o.useCallback)((e,n,t)=>v({interviewType:e,email:n,first_name:t}),[v]),isSubmitting:l.isPending,error:l.error}}export{m as a,v as i,c as n,l as r,y as t};