import{l as e,a6 as t,aF as n,ca as a}from"./c2ee0272b-DPDuX889.js";import{u as s}from"./vendor-query-CRl6sF7K.js";import{r as o,j as i}from"./vendor-react-Dp9pL_Wn.js";import{lV as r,sp as l,sq as c,LH as d,h_ as m}from"./index-XoaBlZfC.js";import{u}from"./vendor-intl-D2wGIp4M.js";import{x as p}from"./vendor-lodash-BvMLws5K.js";import{M as f,B as g,I as b}from"./vendor-ant-cds-BLsR_p72.js";const h="ccr-channel-config";function k(e){return!0===e?.effective_disabled&&!0!==e.config?.disabled}function x(e){return e instanceof a&&400===e.statusCode&&"channel_disable_write_disabled_error"===e.type}function _(e){return{"anthropic-version":"2023-06-01","anthropic-beta":"ccr-triggers-2026-01-30",...e?{"x-organization-uuid":e}:{}}}const v=/^[A-Z0-9]{1,32}$/;function y(e){return v.test(e)?e:"invalid-slack-id"}function w(e,t){return`/v1/code/slack/channels/${y(e)}/${y(t)}/config`}const $=(n,a)=>{const{activeOrganization:s}=e(),o=s?.uuid;return t(w(n,a),{queryKey:[h,{orgUuid:o,slackTeamId:n,slackChannelId:a}],enabled:Boolean(s&&n&&a),headers:_(o),meta:{noToast:!0}})};const j=(t,a)=>{const{activeOrganization:o}=e(),i=s(),r=o?.uuid;return n(w(t,a),"POST",{onSuccess:(e,n)=>{i.setQueryData([h,{orgUuid:r,slackTeamId:t,slackChannelId:a}],t=>function(e,t,n){if(!t.config)return t;const a=t.config.disabled??n?.disabled??e?.config?.disabled;return{...e,...t,effective_disabled:k(e)||!0===a,config:{...e?.config,...t.config,disabled:a,system_prompt_addendum:t.config.system_prompt_addendum??(n?.clear_system_prompt_addendum?"":e?.config?.system_prompt_addendum),resolved_connections:t.config.resolved_connections?.length?t.config.resolved_connections:e?.config?.resolved_connections,resolved_source_urls:t.config.resolved_source_urls?.length?t.config.resolved_source_urls:e?.config?.resolved_source_urls,member_config_disabled:t.config.member_config_disabled??e?.config?.member_config_disabled,channel_name:t.config.channel_name||e?.config?.channel_name}}}(t,e,n))},meta:{noToast:!0},headers:_(r)})};function z(){const t=u(),{account:n,activeOrganization:a}=e(),{switchAndRefresh:s}=r(),m=l(),h=o.useMemo(()=>p((n?.memberships??[]).filter(e=>e.organization.capabilities.includes("chat")&&e.organization.capabilities.includes("raven")),e=>e.organization.name),[n?.memberships]);if(!a)return null;const k=!!a.has_icon,x=h.map(e=>{const n=e.organization,o=n.uuid===a.uuid,r=!o&&null!==m&&!m.includes(n.uuid.toLowerCase());return{label:n.name,leading:i.jsx("span",{"aria-hidden":!0,children:i.jsx(c,{org:n})}),description:r?t.formatMessage({defaultMessage:"Restricted by your admin",id:"QeMzvK0zhW"}):void 0,checked:o,checkedRole:"radio",keepOpen:o,disabled:r,onSelect:o?void 0:()=>s(n.uuid)}}),_=i.jsx("span",{"aria-hidden":!0,className:"inline-flex",children:k?i.jsx(d,{organization:a,size:"sm"}):i.jsx(b,{name:"Organization",size:"sm",className:"text-muted"})});return i.jsx(f,{align:"start",items:x,renderTrigger:i.jsxs(g,{variant:"secondary",size:"sm",icon:_,"data-testid":"admin-settings-org-switcher",className:"mb-4 w-full [&>span:not([aria-hidden])]:w-full [&>span:not([aria-hidden])]:min-w-0",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:a.name}),i.jsx(b,{name:"CaretDown",size:"sm",className:"shrink-0 opacity-60"})]})})}function S({surfaceIconSrc:e="/images/install-hub/slack-icon.svg"}){return i.jsxs("span",{"aria-hidden":!0,className:"mb-md flex items-center font-normal",children:[i.jsx("span",{className:"flex size-[34px] rotate-[2.8deg] items-center justify-center rounded-lg bg-fill-brand",children:i.jsx(m,{size:24,color:"var(--cds-on-brand)"})}),i.jsx("span",{className:"mx-1 h-0 w-[23px] border-t-[1.4px] border-dashed border-alpha-3"}),i.jsx("span",{className:"flex size-[34px] -rotate-3 items-center justify-center rounded-[10px] border border-alpha-2 bg-surface-1 shadow-sm",children:i.jsx("img",{loading:"lazy",src:e,alt:"",width:20,height:20})})]})}
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/const T=Object.freeze(Object.defineProperty({__proto__:null,conf:{comments:{lineComment:"//"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:'"',close:'"',notIn:["string","comment"]},{open:"'",close:"'",notIn:["string","comment"]},{open:"{",close:"}",notIn:["string","comment"]},{open:"[",close:"]",notIn:["string","comment"]},{open:"(",close:")",notIn:["string","comment"]}],folding:{offSide:!0}},language:{defaultToken:"",tokenPostfix:".pug",ignoreCase:!0,brackets:[{token:"delimiter.curly",open:"{",close:"}"},{token:"delimiter.array",open:"[",close:"]"},{token:"delimiter.parenthesis",open:"(",close:")"}],keywords:["append","block","case","default","doctype","each","else","extends","for","if","in","include","mixin","typeof","unless","var","when"],tags:["a","abbr","acronym","address","area","article","aside","audio","b","base","basefont","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","tracks","tt","u","ul","video","wbr"],symbols:/[\+\-\*\%\&\|\!\=\/\.\,\:]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/^(\s*)([a-zA-Z_-][\w-]*)/,{cases:{"$2@tags":{cases:{"@eos":["","tag"],"@default":["",{token:"tag",next:"@tag.$1"}]}},"$2@keywords":["",{token:"keyword.$2"}],"@default":["",""]}}],[/^(\s*)(#[a-zA-Z_-][\w-]*)/,{cases:{"@eos":["","tag.id"],"@default":["",{token:"tag.id",next:"@tag.$1"}]}}],[/^(\s*)(\.[a-zA-Z_-][\w-]*)/,{cases:{"@eos":["","tag.class"],"@default":["",{token:"tag.class",next:"@tag.$1"}]}}],[/^(\s*)(\|.*)$/,""],{include:"@whitespace"},[/[a-zA-Z_$][\w$]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":""}}],[/[{}()\[\]]/,"@brackets"],[/@symbols/,"delimiter"],[/\d+\.\d+([eE][\-+]?\d+)?/,"number.float"],[/\d+/,"number"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],tag:[[/(\.)(\s*$)/,[{token:"delimiter",next:"@blockText.$S2."},""]],[/\s+/,{token:"",next:"@simpleText"}],[/#[a-zA-Z_-][\w-]*/,{cases:{"@eos":{token:"tag.id",next:"@pop"},"@default":"tag.id"}}],[/\.[a-zA-Z_-][\w-]*/,{cases:{"@eos":{token:"tag.class",next:"@pop"},"@default":"tag.class"}}],[/\(/,{token:"delimiter.parenthesis",next:"@attributeList"}]],simpleText:[[/[^#]+$/,{token:"",next:"@popall"}],[/[^#]+/,{token:""}],[/(#{)([^}]*)(})/,{cases:{"@eos":["interpolation.delimiter","interpolation",{token:"interpolation.delimiter",next:"@popall"}],"@default":["interpolation.delimiter","interpolation","interpolation.delimiter"]}}],[/#$/,{token:"",next:"@popall"}],[/#/,""]],attributeList:[[/\s+/,""],[/(\w+)(\s*=\s*)("|')/,["attribute.name","delimiter",{token:"attribute.value",next:"@value.$3"}]],[/\w+/,"attribute.name"],[/,/,{cases:{"@eos":{token:"attribute.delimiter",next:"@popall"},"@default":"attribute.delimiter"}}],[/\)$/,{token:"delimiter.parenthesis",next:"@popall"}],[/\)/,{token:"delimiter.parenthesis",next:"@pop"}]],whitespace:[[/^(\s*)(\/\/.*)$/,{token:"comment",next:"@blockText.$1.comment"}],[/[ \t\r\n]+/,""],[/<!--/,{token:"comment",next:"@comment"}]],blockText:[[/^\s+.*$/,{cases:{"($S2\\s+.*$)":{token:"$S3"},"@default":{token:"@rematch",next:"@popall"}}}],[/./,{token:"@rematch",next:"@popall"}]],comment:[[/[^<\-]+/,"comment.content"],[/-->/,{token:"comment",next:"@pop"}],[/<!--/,"comment.content.invalid"],[/[<\-]/,"comment.content"]],string:[[/[^\\"'#]+/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}],[/@escapes/,{cases:{"@eos":{token:"string.escape",next:"@popall"},"@default":"string.escape"}}],[/\\./,{cases:{"@eos":{token:"string.escape.invalid",next:"@popall"},"@default":"string.escape.invalid"}}],[/(#{)([^}]*)(})/,["interpolation.delimiter","interpolation","interpolation.delimiter"]],[/#/,"string"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":{token:"string"}}}]],value:[[/[^\\"']+/,{cases:{"@eos":{token:"attribute.value",next:"@popall"},"@default":"attribute.value"}}],[/\\./,{cases:{"@eos":{token:"attribute.value",next:"@popall"},"@default":"attribute.value"}}],[/["']/,{cases:{"$#==$S2":{token:"attribute.value",next:"@pop"},"@default":{token:"attribute.value"}}}]]}}},Symbol.toStringTag,{value:"Module"}));export{z as A,S as P,v as S,j as a,x as b,k as i,T as p,$ as u};
