1import{b as w,j as e,g as R,h as K,B as I,R as h,i as F,u as H,c as b,k as Y,f as k,e as q,z as Q,G as D,O as J}from"./index.LmkOyOng.js";import{A as V}from"./AlertDialogBase.OSvV2ypZ.js";import{u as M}from"./useTranslation.CXlQ4DWn.js";import W from"./chevron-left.DxcWwdjA.js";import{B as X,a as Z,b as _,d as ee,c as te,e as oe}from"./breadcrumb.2gZSEsap.js";import{u as se,S as re}from"./sidebar.BkPym8jU.js";import{r as u,R as ae}from"./milkdown.B0s1CGU6.js";import{S}from"./index.K4DFcKAZ.js";import{u as ie}from"./useGetOrgById.CnMnO0eR.js";import{u as $}from"./useMutation.kETI4RWh.js";import{u as ne}from"./useHandleError.DQw33NwS.js";import{u as le}from"./useNavigateBotProfile.03EM6MEA.js";import{A as ce}from"./index.CFf-a9nn.js";import me from"./message-circle.DvalanmF.js";import"./alert-dialog.BrERo_Wa.js";import"./index.CAA2dV6z.js";import"./index.x8BzfTPt.js";import"./createLucideIcon.CxVq9CfB.js";import"./chevron-right.SikmoHOE.js";import"./input.Dv1TfntM.js";import"./separator.BGMzEETa.js";import"./sheet.VgARdzp2.js";import"./x.DBKWSlwY.js";import"./skeleton.6W7RAkxz.js";import"./use-mobile.V3ySw_6b.js";import"./menu.D-7hKcy6.js";import"./useFetchPublicArtifactId.D3iLXzQB.js";import"./index.BepUGmbA.js";import"./AttachmentPreviewContainer.CvTdj6Vd.js";import"./IconLoading.DxAw1x0q.js";import"./loader-circle.VIyOI9_Q.js";import"./index.C6bGZ8cp.js";import"./index.FHfZhMkM.js";import"./useFetchArtifactsId.DyhAW2Oz.js";import"./ShareArtifactDialog.L3b4s2f8.js";import"./checkbox.Bj08_2w_.js";import"./index.IqPjIXx5.js";import"./check.BBfPUTTN.js";import"./dialog.Cizir9nw.js";import"./label.ibTFzqto.js";import"./switch.D9eNYrSt.js";import"./tabs.zA6UGIQ-.js";import"./link-2.CJBGXd23.js";import"./copy.D-T7mHrc.js";import"./ArtifactRenderer.BpyqOd49.js";import"./MarkDownV2.BdwNwyQb.js";import"./index.k2tBymHm.js";import"./external-link.DL-wWBXI.js";import"./common.CmvySTnP.js";import"./chevron-down.DKyrDQzJ.js";import"./chevron-up.O5DgX2y2.js";import"./card.DnyJZMHk.js";import"./dropdown-menu.Biv4bV2a.js";import"./circle.CTVlqqwT.js";import"./html2canvas.esm.QH1iLAAe.js";import"./jspdf.es.min.mApofuDu.js";import"./FileSaver.min.D-1ycwhj.js";import"./string.Dxbu2j2U.js";import"./dayjs.min.DN0qZFL-.js";import"./eye.CnJknAVy.js";import"./code-xml.BXT3f1nm.js";import"./share-2.BUfFbmB1.js";import"./minimize-2.BpflGvwt.js";import"./maximize-2.BwhgwrDi.js";import"./file.DcyOn_VS.js";import"./useResolvedFileUrl.zVUUy0Dv.js";import"./printer.CKnODN88.js";const pe=({to:t,tooltip:a})=>{const l=w(),{t:c}=M();return e.jsxs(R,{children:[e.jsx(K,{children:e.jsx(I,{variant:"ghost",size:"icon",onClick:()=>l(t||h.chat),title:a,children:e.jsx(W,{})})}),e.jsx(F,{children:a||c("common.goBackToChat")})]})},ue=({title:t,breadcrumbs:a,actions:l,className:c,showBackButton:n,backTo:x,backTooltip:d,hasSidebarTrigger:y})=>{const{isMobile:m}=se(),j=H(),f=w(),v=u.useMemo(()=>j.pathname.includes("/chat"),[j.pathname]),r=n!==void 0?n:!v,p=o=>{if(o!=null&&o.includes("http")){window.location.href=o;return}f(o)};return e.jsxs("header",{className:b("flex sticky top-0 z-10 gap-2 items-center px-4 h-16 bg-background max-lg:h-auto max-lg:py-2 max-lg:px-0",c),children:[m&&y&&e.jsx(re,{}),r&&e.jsx(pe,{to:x,tooltip:d}),e.jsxs("div",{className:"flex flex-col",children:[typeof t=="string"?e.jsx("h1",{className:"text-base font-medium",children:t}):t,a&&!m&&a.length>0&&e.jsx(X,{children:e.jsx(Z,{children:a.map((o,g)=>e.jsxs(ae.Fragment,{children:[e.jsx(_,{children:o.href?e.jsx(ee,{asChild:!0,onClick:()=>p(o.href),children:e.jsx("button",{className:b("hover:text-foreground transition-colors max-w-xs truncate cursor-pointer",o.className),children:o.label})}):e.jsx(te,{className:b("max-w-xs truncate",o.className),children:o.label})}),g<a.length-1&&e.jsx(oe,{})]},g))})})]}),e.jsx("div",{className:"flex flex-1 justify-end",children:l})]})},de=u.memo(ue),he="getGroupDetailById";function xe({enabled:t=!0,...a}){const{data:l,isLoading:c,isFetching:n,isFetched:x,refetch:d}=Y({queryKey:k(he,a),queryFn:()=>S.getGroupDetailById(a),enabled:t});return{data:l,isLoading:c,isFetching:n,isFetched:x,refetch:d}}const fe="unpublishBotGroup",ge=()=>$({mutationFn:t=>S.unpublishGroup(t),mutationKey:k(fe,{})}),be="unpublishBotOrg",je=()=>$({mutationFn:t=>S.unpublishOrg(t),mutationKey:k(be,{})}),Ot=()=>{const{t}=M(),a=w(),[l]=q(),{handleError:c}=ne(),n=l.get("tab")||"botProfile",[x,d]=u.useState(!1),[y,m]=u.useState(!1),{toast:j}=Q(),{profile:{botToken:f,botName:v,organizeId:r,groupId:p,organizationId:o,level:g},profile:A}=D(B=>B.bot),{url:O}=le({botProfile:A}),{mutateAsync:G}=ge(),{mutateAsync:P}=je(),{data:s}=ie({id:r||"",enabled:!!r}),{data:i}=xe({enabled:!!(p&&r),groupId:p||"",orgId:r||""}
1),T=window.location.pathname.split("/").filter(Boolean),z=T[T.length-1],L={orgData:s,groupData:i},C=u.useMemo(()=>(i==null?void 0:i.userRole)||"",[i]),N=u.useMemo(()=>!!(p&&(o||r)),[p,o,r]),U=u.useMemo(()=>g<2||!s?!1:s.isOwner?!0:N&&C==="ADMIN"||s.userRole==="ADMIN",[N,g,s,C]),E=async()=>{try{d(!0),N?await G({organizationId:r||o||"",groupId:p||"",botToken:f}):await P({organizationId:r||o||"",botToken:f}),j({variant:"success",title:t("success.unPublish")}),m(!1),window.location.replace(`${h.privateSpace}/${r||o}`)}catch(B){c(B)}finally{d(!1)}};return e.jsxs("div",{className:"flex flex-row h-screen relative overflow-y-auto",children:[e.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[e.jsxs("div",{className:"py-4 px-12 max-md:py-1 flex justify-between gap-2 items-center relative z-[6] max-md:flex-col max-md:justify-start max-md:items-start",children:[e.jsx("div",{className:"flex flex-col gap-1 ",children:e.jsx(de,{showBackButton:!1,actions:!0,title:t("common.profileAIAgent"),className:"bg-transparent",breadcrumbs:[{label:t(r?"common.privateSpace":"common.agentManagement"),href:r?`${window.location.origin}/private-space`:`${h.agents}`},...s!=null&&s.aliasName||s!=null&&s.name?[{label:s.name,href:`${h.privateSpace}/${s.organizationId}`}]:[],...i!=null&&i.name?[{label:i.name,href:`${h.privateSpace}/${s==null?void 0:s.organizationId}/group/${i.groupId}`}]:[],{label:f===z?v:"",href:O,className:"font-bold text-foreground"}]})}),e.jsxs("div",{className:"flex items-center gap-2 max-md:flex-col max-md:items-start ",children:[U&&e.jsx(I,{type:"button",variant:"outline",className:"border-destructive text-destructive hover:text-destructive",onClick:()=>m(!0),children:t("common.unPublish")}),e.jsxs(I,{type:"button",onClick:()=>a(`${h.chat}/${z}`),children:[t("common.openInChat")," ",e.jsx(me,{})]})]})]}),e.jsx("div",{className:"fixed bg-fixed inset-0 bg-[url('/kami/assets/images/bg-create-agent.png')] bg-cover opacity-20 z-[5] dark:hidden pointer-events-none"}),e.jsx("main",{className:b("flex-1 w-full z-[6] relative",n!=="update-knowledge"?"px-8":"px-2"),children:e.jsx("div",{className:b("mx-auto",n!=="update-knowledge"?"max-w-screen-2xl":""),children:e.jsx("div",{className:"py-1",children:e.jsx(J,{context:L})})})})]}),n==="botProfile"&&e.jsx("div",{className:"sticky top-0 z-1000",children:e.jsx(ce,{allowMaximize:!1})}),e.jsx(V,{onAction:E,isLoading:x,open:y,onOpenChange:m,title:t("dialog.unpublish.title",{botName:v}),description:t("dialog.unpublish.content"),onCancel:()=>m(!1)})]})};export{Ot as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.