1import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{C as t,S as n,a as r,g as i,h as a,k as o,m as s,p as c,t as l}from"./framework-m_1FVxd5.js";import{A as u,M as d,N as f,O as p,R as m,X as h,a as g,b as _,c as v,ct as y,d as b,k as x,lt as S,m as C,o as w,ot as T,s as E,t as D,tt as O,u as k,y as A,z as ee}from"./ui-D0N3zdbQ.js";import{t as j}from"./SkeletonBlock-HWeXZELV.js";import{C as M,S as te,_ as N,h as P,r as F,w as I,y as L}from"./src-B3rduyys.js";import{d as ne,u as re}from"./permissions-CGNOHeaf.js";import{t as ie}from"./error-codes-J9uZ1Y_R.js";import{t as ae}from"./RouteLoading-hk8ouzQf.js";import{t as oe}from"./noop-actions-DlJfSYbg.js";import{t as se}from"./platform-page-B4EPvZDC.js";import{t as R}from"./PanelSkeleton-EX1zOPop.js";import{t as ce}from"./SkeletonPage-BrH5VFrS.js";var z=e(o(),1),B=l();function V({code:e,dataClick:t,label:n,language:r,copyDisabled:i=!1,copyLoading:a=!1,onCopy:o}){let{showToast:s}=k(),[c,l]=(0,z.useState)(!1);return(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-burgundy-500/20 bg-paper-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-burgundy-500/15 border-b bg-lavender-300 px-3 py-2`,children:[(0,B.jsx)(`p`,{className:`min-w-0 truncate font-medium text-burgundy-500 text-xs`,children:n}),(0,B.jsx)(u,{animate:!1,size:`sm`,type:`button`,variant:`ghost`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:c?`check`:`content_copy`}),onClick:async()=>{if(!(i||a)){if(o){o();return}if(!await T(e)){s(`Could not copy the code`,`error`);return}l(!0),s(`${n} copied`,`success`),window.setTimeout(()=>l(!1),2e3)}},disabled:i||a,loading:a,"data-click":t,children:c?`Copied`:`Copy`})]}),(0,B.jsx)(`pre`,{className:`max-w-full overflow-x-auto p-4 text-ink-900 text-sm leading-6`,children:(0,B.jsx)(`code`,{children:le(e,r)})})]})}function le(e,t){return t===`text`?[e]:ue(e,t).map(e=>(0,B.jsx)(`span`,{className:e.className,children:e.value},e.start))}function ue(e,t){let n=t===`yaml`?/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\$\{\{.*?\}\}|^[\t -]*[\w-]+(?=:))/gm:t===`dotenv`?/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|^[A-Z_][A-Z0-9_]*(?==))/gm:/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\$\{[^}]+\}|\$[A-Z_][A-Z0-9_]*|--[\w-]+|\b(?:bash|curl|exit|export|fi|if|set|then)\b)/gm,r=[],i=0;for(let a of e.matchAll(n)){let n=a.index;n>i&&r.push({start:i,value:e.slice(i,n)}),r.push({className:de(a[0],t),start:n,value:a[0]}),i=n+a[0].length}return i<e.length&&r.push({start:i,value:e.slice(i)}),r}function de(e,t){return e.startsWith(`#`)?`text-ink-500`:e.startsWith(`"`)||e.startsWith(`'`)?`text-cobalt-500`:e.includes("${")||e.startsWith(`$`)?`text-coral-600`:t===`yaml`||e.startsWith(`--`)?`font-medium text-cobalt-500`:`font-semibold text-burgundy-500`}var H=`embroidery:installer-download-progress`,fe=1e3,U=10,pe=P({requestId:N().required(),_action:N().oneOf([`download_script`,`download_claude_plugin`]).required(),orgId:N().required()}),me=P({_action:N().oneOf([`poll_integrations`]).required(),orgId:N().required(),integrationName:N().oneOf([`google`,`microsoft`]).required()}),W=P({_action:N().oneOf([`get_access_token`]).required(),orgId:N().required(),claimFor:N().required()}),he=P({_action:N().oneOf([`rotate_access_token`]).required(),orgId:N().required(),claimFor:N().required()}),G=P({_action:N().oneOf([`update_agent_integration`]).required(),orgId:N().required(),integrationName:N().required(),integrationStatus:N().oneOf([`ACTIVE`,`INACTIVE`]).required()}),ge=P({_action:N().oneOf([`disconnect_integration`]).required(),orgId:N().required(),integrationName:N().oneOf([`google`,`microsoft`]).required()}),_e=P({_action:N().oneOf([`disconnect_splunk`]).required(),orgId:N().required()}),ve=P({_action:N().oneOf([`configure_splunk`]).required(),orgId:N().required(),hecUrl:N().url().required(),hecToken:N().required(),destination:N().optional(),eventType:N().optional()});async function K(e,t){let n=t.toUpperCase();for(let t=0;t<U;t++){await new Promise(e=>setTimeout(e,fe));let[t,r]=await F.get(`/api/v1/organizations/{orgId}/integrations`,{orgId:e});if(!(t||!r)){if(r.some(e=>e.integrationStatus.toUpperCase()===`BROKEN`))return[Error(`Integration failed to connect`),null];if(r.find(e=>e.integrationName.toUpperCase()===n)?.integrationStatus.toUpperCase()===`ACTIVE`)return[null,{action:`poll_integrations`}]}}return[Error(`Integration did not become available in time`),null]}async function ye({request:e}){let[t,n]=await y(()=>e.formData());if(t)return[Error(`error reading form data`,{cause:t}),null];let r=n.get(`_action`);if(r===`poll_integrations`){let[e,t]=await h(n,me);return e?[Error(`error validating poll integrations form`,{cause:e}),null]:K(t.orgId,t.integrationName)}if(r===`get_access_token`){let[e,t]=await h(n,W);
1if(e)return[Error(`error validating access token form`,{cause:e}),null];let[i,a]=await F.get(`/api/v1/organizations/{orgId}/access-tokens/{claimFor}`,{orgId:t.orgId,claimFor:t.claimFor});return i||!a?I(i)?.response?.status===403?[Error(`You don't have the required permissions to view integration access tokens.`,{cause:i}),null]:[Error(`Failed to get access token`,{cause:i}),null]:[null,{action:r,accessToken:a}]}if(r===`rotate_access_token`){let[e,t]=await h(n,he);if(e)return[Error(`error validating access token form`,{cause:e}),null];let[i,a]=await F.post(`/api/v1/organizations/{orgId}/access-tokens`,{orgId:t.orgId},{claimFor:t.claimFor});return i||!a?I(i)?.response?.status===403?[Error(`You don't have the required permissions to rotate integration access tokens.`,{cause:i}),null]:[Error(`Failed to get access token`,{cause:i}),null]:[null,{action:r,accessToken:a}]}if(r===`download_script`||r===`download_claude_plugin`){let[t,i]=await h(n,pe);if(t)return[Error(`error validating download script form`,{cause:t}),null];let a=`embroidery-claude.zip`;if(r===`download_script`){let[t,n]=await F.get(`/api/v1/integrations/corellia/versions/current`,null,{signal:e.signal});if(t||!n)return[Error(`Failed to get corellia version`,{cause:t}),null];a=`embroidery.${n}.zip`}let[o,s]=await(r===`download_claude_plugin`?F.url(`/api/v1/organizations/{orgId}/integrations/corellia/installers/clouds/claudecowork`,{orgId:i.orgId}):F.url(`/api/v1/organizations/{orgId}/integrations/corellia/scripts`,{orgId:i.orgId,$search:{}}));if(o)return[Error(`Could not prepare the download. Please retry.`,{cause:o}),null];let[c,l]=await M(s,{signal:e.signal,onProgress:e=>window.dispatchEvent(new CustomEvent(H,{detail:{requestId:i.requestId,...e}}))});return c||!l?I(c)?.response?.status===403?[Error(`You don't have the required permissions to download integration scripts.`,{cause:c}),null]:[Error(c?.message??`Failed to download installer. Please retry.`,{cause:c}),null]:[null,{action:`download_script`,url:URL.createObjectURL(l),filename:a}]}if(r===`update_agent_integration`){let[e,t]=await h(n,G);if(e)return[Error(`error validating agent integration form`,{cause:e}),null];let[r]=await F.patch(`/api/v1/organizations/{orgId}/integrations`,{orgId:t.orgId},{orgId:t.orgId,integrationName:t.integrationName,integrationStatus:t.integrationStatus});return r?I(r)?.response?.status===403?[Error(`You don't have the required permissions to update integrations.`,{cause:r}),null]:[Error(`Failed to update integration`,{cause:r}),null]:[null,{action:`update_agent_integration`,integrationStatus:t.integrationStatus,integrationName:t.integrationName}]}if(r===`disconnect_integration`){let[e,t]=await h(n,ge);if(e)return[Error(`error validating disconnect integration form`,{cause:e}),null];let[r]=await F.delete(`/api/v1/organizations/{orgId}/integrations/{integrationName}`,{orgId:t.orgId,integrationName:t.integrationName.toUpperCase()});return r?I(r)?.response?.status===403?[Error(`You don't have the required permissions to disconnect integrations.`,{cause:r}),null]:[Error(`Failed to disconnect integration`,{cause:r}),null]:[null,{action:`disconnect_integration`,integrationName:t.integrationName}]}if(r===`configure_splunk`){let[e,t]=await h(n,ve);if(e)return[Error(`Invalid Splunk configuration`,{cause:e}),null];let[r,i]=await F.put(`/api/v1/organizations/{orgId}/integrations/splunk`,{orgId:t.orgId},{hecUrl:t.hecUrl,hecToken:t.hecToken,destination:t.destination,eventType:t.eventType});return r?I(r)?.response?.status===403?[Error(`You don't have the required permissions to connect Splunk.`,{cause:r}),null]:[Error(`Failed to validate Splunk HEC configuration`,{cause:r}),null]:i?[null,{action:`configure_splunk`,integration:i}]:[Error(`Splunk HEC configuration returned no integration`),null]}if(r===`disconnect_splunk`){let[e,t]=await h(n,_e);if(e)return[Error(`Invalid Splunk disconnect request`,{cause:e}),null];let[r]=await F.delete(`/api/v1/organizations/{orgId}/integrations/{integrationName}`,{orgId:t.orgId,integrationName:`splunk`});return r?I(r)?.response?.status===403?[Error(`You don't have the required permissions to disconnect Splunk.`,{cause:r}),null]:[Error(`Failed to disconnect Splunk`,{cause:r}),null]:[null,{action:`disconnect_splunk`}]}return[Error(`Unknown action: ${r}`),null]}function be(){let e=t(),n=e instanceof Error?e.message:`Failed to load integration settings`;return(0,B.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,B.jsxs)(`div`,{className:`rounded-xl border border-burgundy-500/18 bg-paper-100 p-6 text-center`,children:[(0,B.jsx)(`h2`,{className:`font-semibold text-burgundy-500 text-lg`,children:`Failed to load integration settings`}),(0,B.jsx)(`p`,{className:`mt-2 text-ink-500 text-sm`,children:n})]})})}function xe(e,t,n){let i=r(),a=(0,z.useRef)(``),o=(0,z.useRef)(!0),[s,c]=(0,z.useState)({receivedBytes:0,totalBytes:null}),[l,u]=(0,z.useState)(null),d=i.state!==`idle`;return(0,z.useEffect)(()=>{let e=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;t.requestId===a.current&&c(t)};return window.addEventListener(H,e),()=>window.removeEventListener(H,e)},[]),(0,z.useEffect)(()=>
1{if(d||!i.data||o.current)return;o.current=!0;let[e,t]=i.data;if(e){u(e.message);return}if(t.action!==`download_script`)return;let n=document.createElement(`a`);n.href=t.url,n.download=t.filename,document.body.appendChild(n),n.click(),n.remove(),window.setTimeout(()=>URL.revokeObjectURL(t.url),1e3)},[d,i.data]),{progress:s,error:l,pending:d,start:()=>{!n||d||(o.current=!1,a.current=crypto.randomUUID(),c({receivedBytes:0,totalBytes:null}),u(null),i.submit({_action:e,orgId:t,requestId:a.current},{method:`post`}))}}}function Se(e,t){return xe(`download_script`,e,t)}var Ce=[`claude`,`claudecowork`,`codex`,`cursor`,`antigravity`,`githubcopilot`,`opencode`,`openclaw`];function we(e,t){return e?.find(e=>te(e.integrationName.toLowerCase())&&e.integrationName.toLowerCase()===t&&e.integrationStatus.toUpperCase()!==`INACTIVE`)}function Te(e){return Ce.filter(t=>we(e,t)?.integrationStatus.toUpperCase()===`ACTIVE`)}var q=`integrations`,Ee=`You need admin privileges for this.`,J=`https://embroidery.io/apps/naboo-router-api`,Y=new URL(`https://embroidery.io`).hostname,X=`[REPLACE-WITH-REAL-TOKEN]`,De=[`claude`,`claudecowork`,`cursor`,`githubcopilot`],Oe=`set -euo pipefail 2 3export EMBROIDERY_ACCESS_TOKEN="${X}" 4 5export EMBROIDERY_PROVIDER="CLAUDE" 6export EMBROIDERY_HOME_DIR="/home/user" 7export EMBROIDERY_PROJECT_DIR="$PWD" 8 9curl -fsSL \\ 10 ${J}/api/v1/integrations/corellia/installers/clouds \\ 11 | bash -s -- ${J} 12 13"$EMBROIDERY_HOME_DIR/.embroidery/bin/embroidery" headless`,ke=`set -euo pipefail 14 15curl -fsSL \\ 16 ${J}/api/v1/integrations/corellia/installers/clouds \\ 17 | bash -s -- ${J}`,Ae=`sudo -E \\ 18HOME="$HOME" \\ 19EMBROIDERY_PROVIDER="CURSOR" \\ 20EMBROIDERY_HOME_DIR="$HOME" \\ 21EMBROIDERY_PROJECT_DIR="$PWD" \\ 22"$HOME/.embroidery/bin/embroidery" headless`,je=`name: Copilot Setup Steps 23 24on: 25 workflow_dispatch: 26 27jobs: 28 copilot-setup-steps: 29 runs-on: ubuntu-latest 30 31 permissions: 32 contents: read 33 34 steps: 35 - name: Checkout repository 36 uses: actions/checkout@v6 37 38 - name: Install and start Embroidery 39 shell: bash 40 env: 41 COPILOT_AGENT_INPUTS: \${{ github.event.inputs.COPILOT_AGENT_INPUTS }} 42 EMBROIDERY_ACCESS_TOKEN: \${{ secrets.EMBROIDERY_ACCESS_TOKEN }} 43 EMBROIDERY_PROVIDER: GITHUBCOPILOT 44 EMBROIDERY_HOME_DIR: /home/runner 45 EMBROIDERY_PROJECT_DIR: \${{ github.workspace }} 46 run: | 47 set -euo pipefail 48 49 if [ -z "\${EMBROIDERY_ACCESS_TOKEN:-}" ]; then 50 echo "EMBROIDERY_ACCESS_TOKEN was not injected" 51 exit 1 52 fi 53 54 curl -fsSL \\ 55 ${J}/api/v1/integrations/corellia/installers/clouds \\ 56 | bash -s -- ${J} 57 58 "$EMBROIDERY_HOME_DIR/.embroidery/bin/embroidery" headless`,Me={claudecowork:{provider:`claudecowork`,label:`Claude Cowork`,description:`Use the shared Claude plugin to track Cowork cloud sessions according to your organization's integration settings.`,steps:[{title:`Download the Claude plugin`,description:`Enable Claude Cowork in Embroidery, then select Download Claude plugin. The same ZIP also supports Claude Code. It includes your organization's configuration; the client downloads when the first hook runs.`},{title:`Upload and enable it in Claude`,description:`Open Customize â Plugins, choose the custom plugin upload option, and select the ZIP without extracting it. Enable Embroidery for Cowork. Downloading the ZIP alone does not activate tracking.`},{title:`Allow network access`,description:`At claude.ai/code, open the cloud environment selector near the prompt box. Open the settings for the cloud environment assigned to your project. Set Network access to Custom and add ${Y} under Allowed domains, one domain per line. Allow the domain itself, without https:// or a URL path. Keep existing domains and enable Also include default list of common package managers. Embroidery needs this access to download its client, fetch tracking settings, and send activity.`},{title:`Assign the environment to your project`,description:`Open Project settings â Environment â Cloud environment and select the environment that allows ${Y}. This is required for both Claude Code and Cowork project workers to download Embroidery and send activity. Selecting an environment near the prompt box alone does not assign it to the project. Start a new project thread after saving; existing threads keep their previous environment.`},{title:`Start a fresh cloud session`,description:`Start a new Cowork cloud session and confirm new Cowork activity appears in Embroidery. The plugin detects the running Claude product and only tracks it when that integration is enabled. Embroidery updates its client and hooks automatically. Your organizationâs skill and MCP scan settings apply to Cowork, including skills and tools added during a task. Settings changes add or remove hooks automatically without a manual restart. Disabling a product stops its collection after the settings refresh. After rotating your token, start a fresh cloud environment with the updated plugin. Use the desktop installer for local Claude Code tracking.`}]},claude:{provider:`claude`,label:`Claude Code`,description:`Track Claude Code cloud agent activity by installing the Embroidery headless client during environment setup.`,steps:[{title:`Open your Claude Code cloud environment`,description:`Open Claude Code on the web and click the cloud icon with the environment name above the message box. Choose Add cloud environment, or hover over an existing environment and click its settings icon.`,links:[{label:`Open Claude Code on the web`,href:`https://claude.ai/code`},{label:`Claude Code environment settings guide`,href:`https://code.claude.com/docs/en/cloud-environments#configure-your-environment`}]},{title:`Allow network access`,description:`In the environment editor, set Network access to Custom. Enter ${Y} in Allowed domains, keeping any domains your project already needs. Use the domain below, not a full URL.`,codeBlocks:[{label:`Allowed domain`,language:`text`,code:Y}]},{title:`Configure the environment`,description:`Click Copy to retrieve your organization's access token and insert it into the copied text, then paste into Environment variables. The preview always shows a placeholder; the clipboard contains the real token. These values are visible to anyone using the environment. Claude API credentials do not supply variables to setup scripts.`,codeBlocks:[{label:`Environment variables`,language:`dotenv`,code:`EMBROIDERY_HOME_DIR=/home/user 59EMBROIDERY_PROVIDER=CLAUDE 60EMBROIDERY_ACCESS_TOKEN=${X}`}]},{title:`Paste the setup script and save`,description:`Click Copy to insert your organization's access token, then paste into Setup script. The export makes it available to the installer subprocess. Never commit the copied script or print the token. Save the environment and select it for a new task; existing sessions do not pick up edits. Keep /home/user for this integration.`,codeBlocks:[{label:`Setup script`,language:`bash`,code:Oe}]}]},cursor:{provider:`cursor`,label:`Cursor`,description:`Track Cursor cloud agent activity by installing Embroidery once and starting its headless client with the agent.`,steps:[{title:`Open the repository's Cursor environment`,description:`Open the Cloud Agents dashboard, choose Environments, and open the environment assigned to your repository. If none exists, create one for that repository first. Configure the environment here, not through a prompt to an agent.`,links:[{label:`Open Cursor Cloud Agents`,href:`https://cursor.com/dashboard/cloud-agents`},{label:`Cursor environment settings guide`,href:`https://cursor.com/docs/cloud-agent/settings`}]},{title:`Add the access token`,description:`Click Copy to copy EMBROIDERY_ACCESS_TOKEN with your real token as an environment-variable assignment. In the environment's Secrets section, click New Secret. Use EMBROIDERY_ACCESS_TOKEN as the name and the token after the equals sign as the value, select Runtime Secret, and save it with access to this environment/repository. Keep the token out of both scripts.`,links:[{label:`Cursor secrets documentation`,href:`https://cursor.com/docs/cloud-agent/security-network`}],codeBlocks:[{label:`Environment variable`,language:`dotenv`,code:`EMBROIDERY_ACCESS_TOKEN=${X}`}]},{title:`Add the install script`,description:`Find the Install Script field in the environment editor and paste this script. It downloads the headless client while Cursor prepares the environment. Retain any existing project dependency commands before it.`,codeBlocks:[{label:`Install script`,language:`bash`,code:ke}]},{title:`Add the start script`,description:`Paste this into Start Script, not Install Script, and save your changes. It uses sudo to install system-wide Cursor hooks and start the background daemon while preserving your environment and home directory. If network access is restricted, allow ${Y}. Start a new cloud agent using the updated environment so the saved scripts take effect.`,codeBlocks:[{label:`Start script`,language:`bash`,code:Ae}]}]},githubcopilot:{provider:`githubcopilot`,label:`GitHub Copilot`,description:`Track Copilot coding agent activity with a dedicated repository setup workflow.`,
60steps:[{title:`Add the repository secret`,description:`Open your repository on GitHub, then Settings â Secrets and variables â Agents â Secrets â New repository secret. Set Name to EMBROIDERY_ACCESS_TOKEN, paste your Embroidery token into Secret, and click Add secret. You need repository administrator access. Use Agents secrets, not Actions, Codespaces, Dependabot, or Variables.`,links:[{label:`GitHub Agents secrets instructions`,href:`https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/configure-secrets-and-variables`}],codeBlocks:[{label:`EMBROIDERY_ACCESS_TOKEN secret value`,language:`text`,code:X}]},{title:`Sharing the secret across an organization`,description:`Alternatively, an organization owner can open organization Settings â Secrets and variables â Agents and create an organization secret with the same name. Under Repository access, select the repositories that should receive it. You still need the setup workflow in each repository.`},{title:`Create the setup workflow`,description:`In your repository's Code tab, choose Add file â Create new file and enter .github/workflows/copilot-setup-steps.yml as the filename. Paste the YAML below and commit it through your normal review process to the default branch. If this file already exists, add the Embroidery step to its existing copilot-setup-steps job instead of replacing your project's setup.`,links:[{label:`GitHub custom setup workflow guide`,href:`https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment`}],codeBlocks:[{label:`.github/workflows/copilot-setup-steps.yml`,language:`yaml`,code:je}]},{title:`Verify the setup`,description:`Start a new Copilot cloud-agent task for this repository, open its session log, and expand Setting up environment â Install and start Embroidery. Look for successful installation and GitHub Copilot hooks installed. If the token was not injected, recheck Agents secret access. Keep COPILOT_AGENT_INPUTS in the YAML to identify the initiating person. There are no push or pull-request triggers; workflow_dispatch also permits a manual run.`}]}};function Z(e){return e?De.some(t=>t===e):!1}var Ne=`This provider does not expose the cloud hooks required for reliable agent tracking.`,Pe={provider:`claude`,label:`Claude Code`,description:`Track Claude Projects workers with the shared Claude plugin.`,steps:[{title:`Download the Claude plugin`,description:`Enable Claude Code in Embroidery, then select Download Claude plugin. This is the same ZIP used for Cowork, with your organization's configuration included. Each product keeps its own tracking toggle in Embroidery.`},{title:`Enable the plugin for your project`,description:`Upload the ZIP under Customize â Plugins in Claude, then open your project's Settings â Plugins and enable Embroidery so project workers can run its hooks. Downloading the ZIP alone does not activate tracking.`,links:[{label:`Claude Projects plugin settings`,href:`https://code.claude.com/docs/en/claude-projects`},{label:`Claude Code cloud environment settings`,href:`https://code.claude.com/docs/en/cloud-environments`}]},{title:`Allow network access`,description:`At claude.ai/code, open the cloud environment selector near the prompt box. Open the settings for the cloud environment assigned to your project. Set Network access to Custom and add ${Y} under Allowed domains, one domain per line. Allow the domain itself, without https:// or a URL path. Keep existing domains and enable Also include default list of common package managers. Embroidery needs this access to download its client, fetch tracking settings, and send activity.`},{title:`Assign the environment to your project`,description:`Open Project settings â Environment â Cloud environment and select the environment that allows ${Y}. This is required for both Claude Code and Cowork project workers to download Embroidery and send activity. Selecting an environment near the prompt box alone does not assign it to the project. Start a new project thread after saving; existing threads keep their previous environment.`},{title:`Start a fresh cloud session`,description:`Start a new project thread with Embroidery enabled and confirm new Claude Code activity appears in Embroidery. The plugin detects Code or
60Cowork at runtime and respects that product's tracking toggle. Both Code and Cowork use your organizationâs skill and MCP scan settings, including skills and tools added during a task. Existing Claude cloud installations remain compatible after updating the client. Remove duplicate setup scripts when adopting the plugin. Embroidery updates its client and adds or removes hooks automatically as settings change, without a manual restart. Use the desktop installer for local Claude Code tracking.`}]};function Fe(e,t){return xe(`download_claude_plugin`,e,t)}function Ie({block:e,canCopy:t,orgId:n,dataClick:i}){let a=r(),{showToast:o}=k(),s=(0,z.useRef)(!1),[c,l]=(0,z.useState)(!1),u=e.code.includes(X);return(0,z.useEffect)(()=>{if(a.state!==`idle`||!a.data||!s.current||(s.current=!1,!t))return;let[n,r]=a.data;if(n||r?.action!==`get_access_token`||!r.accessToken.accessToken){o(`Could not retrieve the access token. Check your admin permissions and try again.`,`error`);return}let i=e.code.replaceAll(X,()=>r.accessToken.accessToken);l(!0),T(i).then(t=>{if(l(!1),!t){o(`Could not copy. Allow clipboard access and try again.`,`error`);return}o(`${e.label} copied with your access token`,`success`)})},[a.state,a.data,t,e.code,e.label,o]),(0,B.jsx)(V,{code:e.code,label:e.label,language:e.language,dataClick:i,copyDisabled:!t,copyLoading:a.state!==`idle`||c,...u&&{onCopy:()=>{!t||c||s.current||a.state!==`idle`||(s.current=!0,a.submit({_action:`get_access_token`,orgId:n,claimFor:q},{method:`post`}))}}})}function Le({progress:e,error:t,onRetry:n,canRetry:r}){if(t)return(0,B.jsxs)(`div`,{className:`flex h-full w-full items-center gap-1 pl-3`,children:[(0,B.jsx)(`p`,{role:`alert`,title:t,className:`min-w-0 truncate text-coral-700 text-xs`,children:t}),(0,B.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,"data-click":`integrations-retry-download-button`,disabled:!r,className:`shrink-0 cursor-pointer`,children:`Retry`})]});let i=e.totalBytes,a=i?Math.min(100,Math.floor(e.receivedBytes/i*100)):null,o=Re(e.receivedBytes),s=i?Re(i):null;return(0,B.jsxs)(`div`,{className:`w-full space-y-1 px-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-burgundy-500 text-xs`,children:[(0,B.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2`,children:[a===null&&(0,B.jsx)(`span`,{"aria-hidden":`true`,children:(0,B.jsx)(d,{size:`sm`})}),i||e.receivedBytes>0?`Downloadingâ¦`:`Preparingâ¦`]}),a!==null&&(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[a,`%`]})]}),a!==null&&(0,B.jsx)(`div`,{role:`progressbar`,"aria-label":`Installer download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":`${o} of ${s}`,className:`h-1 w-full overflow-hidden rounded-full bg-burgundy-500/15`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full bg-burgundy-500`,style:{width:`${a}%`}})}),(0,B.jsx)(`p`,{className:`text-ink-500 text-xs tabular-nums`,children:i?`${o} / ${s}`:`${o} received`})]})}function Re(e){return e<1e3?`${e} B`:e<1e6?`${(e/1e3).toFixed(1)} kB`:`${(e/1e6).toFixed(1)} MB`}function ze({usesPlugin:e}){return e?(0,B.jsx)(`p`,{className:`rounded-xl bg-mint-300 p-4 text-ink-600 text-sm`,children:`This ZIP contains your organization's access token. Upload it only to your Claude account; do not share it or commit it to a repository.`}):(0,B.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-burgundy-500/15 bg-mint-300 p-4`,children:[(0,B.jsx)(A,{className:`mt-0.5 h-5 w-5 shrink-0 text-burgundy-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium text-burgundy-500 text-sm`,children:`Keep your access token secret`}),(0,B.jsx)(`p`,{className:`mt-1 text-ink-600 text-sm leading-6`,children:`Use Copy on the access-token block below to retrieve your access token and use it only in the environment settings described below. The preview stays masked. Never commit it or print it from a setup script.`})]})]})}function Be({onClose:e,provider:t,canCopy:n,canDownloadClaudePlugin:r,orgId:i}){let[a,o]=(0,z.useState)(`cloud`),s=Fe(i,r),c=(s.pending||s.error)&&(0,B.jsx)(Le,{progress:s.progress,error:s.error,onRetry:s.start,canRetry:r});if(!t)return null;let l=t===`claude`&&a===`project`,d=t===`claudecowork`||l,f=Me[t];l&&(f=Pe);let p=_[t];return(0,B.jsx)(w,{isOpen:!0,scrollable:!0,size:`2xl`,title:(0,B.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-burgundy-500/15 bg-lavender-300`,children:(0,B.jsx)(p,{className:`h-6 w-6`})}),f.label,` cloud agent tracking`]}),description:f.description,onClose:e,children:(0,B.jsxs)(`div`,{className:`space-y-5 p-6`,children:[t===`claude`&&(0,B.jsx)(D,{options:[{label:`Cloud`,value:`cloud`},{label:`Project`,value:`project`}],value:a,onChange:o,ariaLabel:`Claude Code setup`,"data-click":`claude-code-setup-mode`}),(0,B.jsx)(ze,{usesPlugin:d}),d&&(0,B.jsx)(`div`,{className:`flex h-12 w-56 items-start`,children:c||(0,B.jsx)(u,{type:`button`,variant:`primary`,disabled:!r||s.pending,onClick:s.start,className:`curs
60or-pointer`,"data-click":`cloud-agent-claude-plugin-download-button`,children:`Download Claude plugin`})}),!n&&(0,B.jsx)(`p`,{className:`text-ink-600 text-sm`,children:`Administrator privileges are required to download the plugin or copy credentials.`}),(0,B.jsx)(`ol`,{className:`space-y-5`,children:f.steps.map((e,r)=>(0,B.jsxs)(`li`,{className:`flex gap-4`,children:[(0,B.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-burgundy-500 font-semibold text-paper-100 text-sm`,children:r+1}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-base text-burgundy-500`,children:e.title}),(0,B.jsx)(`p`,{className:`mt-1 text-ink-600 text-sm leading-6`,children:e.description}),e.links&&(0,B.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.links.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`cursor-pointer text-burgundy-500 text-sm underline underline-offset-4 hover:text-burgundy-700`,children:[e.label,` (opens in a new tab)`]})},e.href))}),e.codeBlocks&&(0,B.jsx)(`div`,{className:`mt-4 space-y-4`,children:e.codeBlocks.map(e=>(0,B.jsx)(Ie,{block:e,canCopy:n,orgId:i,dataClick:`cloud-agent-${t}-copy-${e.language}-button`},`${i}-${t}-${e.label}`))})]})]},e.title))}),(0,B.jsx)(`div`,{className:`flex justify-end border-burgundy-500/12 border-t pt-5`,children:(0,B.jsx)(u,{type:`button`,variant:`secondary`,onClick:e,"data-click":`cloud-agent-${t}-close-button`,children:`Close`})})]})})}function Q({children:e,lastSeen:t,loading:n,referenceDescription:r}){return(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,B.jsxs)(`div`,{className:`grid text-burgundy-500 text-sm`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1`,children:r}),n&&(0,B.jsx)(j,{className:`col-start-1 row-start-1 h-5 w-full self-center`}),!n&&(0,B.jsx)(`p`,{className:`col-start-1 row-start-1`,children:e})]}),(0,B.jsxs)(`div`,{className:`grid text-ink-500 text-xs`,children:[(0,B.jsxs)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1`,children:[`Last seen `,Ve]}),n&&(0,B.jsx)(j,{className:`col-start-1 row-start-1 h-4 w-full self-center`}),!n&&(0,B.jsx)(`p`,{className:`col-start-1 row-start-1`,children:t})]})]})}var Ve=O(new Date(2e3,8,30,12,59).toISOString()),He=L.map(e=>({...e,Icon:_[e.name],integrationType:e.name===`microsoft`||e.name===`google`?`IDP`:`AGENT`})),Ue=He.filter(e=>e.integrationType===`IDP`),We=He.filter(e=>e.integrationType===`AGENT`);function Ge({label:e,name:t,onOpen:n,disabled:r}){return Z(t)?(0,B.jsx)(f,{content:r?`Enable ${e} to set up cloud tracking`:`Set up ${e} cloud agent tracking`,children:(0,B.jsx)(x,{disabled:r,"aria-label":`Set up ${e} cloud agent tracking`,size:`sm`,type:`button`,variant:`ghost`,onClick:()=>n(t),"data-click":`integrations-cloud-${t}-button`,children:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-base leading-none`,children:`cloud`})})}):(0,B.jsx)(f,{content:Ne,children:(0,B.jsx)(x,{disabled:!0,"aria-label":`${e} cloud agent tracking is unavailable`,size:`sm`,type:`button`,variant:`ghost`,"data-click":`integrations-cloud-${t}-button`,children:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-base leading-none`,children:`cloud`})})})}function Ke(e){return e?e.integrationStatus.toUpperCase()===`ACTIVE`:!1}function qe(e){if(!e)return`Not connected`;let t=e.integrationStatus.toUpperCase();return t===`ACTIVE`?`Active`:t===`PENDING`?`Pending`:t.charAt(0)+t.slice(1).toLowerCase()}function Je(e){if(!e)return`muted`;let t=e.integrationStatus.toUpperCase();return t===`ACTIVE`?`success`:t===`PENDING`?`warning`:`muted`}function Ye(e){return e?`Active`:`Inactive`}function Xe(e){return e?`success`:`muted`}function Ze(e){return e?.lastUpdated?`Last seen ${O(e.lastUpdated)}`:null}function Qe({integration:e,canManageIntegrations:t,loading:n,integrationUpdating:r,onAddIntegration:i,onDisconnectIntegration:a,onOpenCloudAgentGuide:o,onToggleDownload:s,provider:c,selectedForDownload:l,urls:d}){let{name:m,label:h,Icon:_}=c,v=Ke(e),y=c.integrationType===`AGENT`,x=y?l:v,S=e=>{if(!t){e.preventDefault();return}i(e,m)},C=e=>{r||s(m,e.currentTarget.checked)},w=()=>{t&&a(m)},T=Ze(e),D=y?tt:nt;return(0,B.jsxs)(g,{display:`flex-col`,overflow:`hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-burgundy-500/12 border-b p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(_,{className:`h-6 w-6`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:h}),m===`claudecowork`&&(0,B.jsx)(`p`,{className:`text-ink-600 text-xs italic`,children:et})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,B.jsx)(Ge,{disabled:(m===`claudecowork`||m===`claude`)&&(!x||r),label:h,name:m,onOpen:o}),(0,B.jsx)(E,{variant:y?Xe(l):Je(e),children:y?Ye(l):qe(e)})]})]}),(0,B.jsxs)(`div`,{className:`flex min-h-20 flex-1 items-center justify-between p-5`,children:[x&&(0,B.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[(0,B.jsxs)(Q,{lastSeen:T,referenceDescription:D,children:[y&&Z(m)&&`Enabled for agents.`,y&&!Z(m)&&`Enabled for local agents.`,!y&&`Connected and syncing data.`]}),y&&(0,B.jsx)(b,{id:`download-${m}-checkbox`,"aria-label":`${h} active`,defaultChecked:l,disabled:r,onChange:C,"data-click":`integrations-toggle-${m}-checkbox`},`${m}-${l}`),!y&&(0,B.jsx)(`div`,{className:`w-28 shrink-0 [&>span]:w-full`,children:(0,B.jsx)(f,{content:`You need admin privileges for this.`,disabled:t,children:(0,B.jsx)(u,{fullWidth:!0,size:`sm`,type:`button`,variant:`secondary`,onClick:w,"data-click":`integrations-disconnect-${m}-button`,disabled:r||!t,loading:r,children:`Disconnect`})})})]}),!x&&(0,B.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[(0,B.jsxs)(Q,{lastSeen:T,referenceDescription:D,children:[y&&Z(m)&&`Inactive for agents.`,y&&!Z(m)&&`Inactive for local agents.`,!y&&!!e&&`Integration is pending activation.`,!y&&!e&&`Not yet connected.`]}),y&&(0,B.jsx)(b,{id:`download-${m}-checkbox`,"aria-label":`${h} active`,defaultChecked:l,disabled:r,onChange:C,"data-click":`integrations-toggle-${m}-checkbox`},`${m}-${l}`),!e&&!y&&d?.popup&&(0,B.jsx)(`div`,{className:`w-28 shrink-0 [&>span]:w-full`,children:(0,B.jsx)(f,{content:`You need admin privileges for this.`,disabled:t,children:(0,B.jsx)(p,{fullWidth:!0,size:`sm`,variant:`primary`,href:d.fallback,onClick:S,"data-click":`integrations-add-${m}-button`,disabled:n||!t,children:`Connect`})})}),!e&&!y&&d?.popup===null&&(0,B.jsx)(E,{variant:`danger`,children:`Error loading URL`})]})]})]})}function $e({isAgent:e=!1,provider:t}
60){let n=_[t.name],r=e?tt:nt;return(0,B.jsxs)(g,{display:`flex-col`,overflow:`hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-burgundy-500/12 border-b p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(n,{className:`h-6 w-6`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:t.label}),t.name===`claudecowork`&&(0,B.jsx)(`p`,{className:`text-ink-600 text-xs italic`,children:et})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,B.jsx)(Ge,{disabled:!0,label:t.label,name:t.name,onOpen:()=>{}}),(0,B.jsx)(j,{className:`h-4.5 w-16 rounded-full`})]})]}),(0,B.jsxs)(`div`,{className:`flex min-h-20 flex-1 items-center justify-between gap-4 p-5`,children:[(0,B.jsx)(Q,{loading:!0,referenceDescription:r}),(0,B.jsx)(j,{className:S(`shrink-0`,e&&`size-5`,!e&&`h-9 w-28`)})]})]})}var et=`Cloud Only`,tt=`Enabled for local agents.`,nt=`Connected and syncing data.`;function $({children:e,description:t,title:n}){return(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`font-semibold text-burgundy-500 text-lg`,children:n}),(0,B.jsx)(`p`,{className:`mt-1 text-ink-500 text-sm`,children:t})]}),e]})}function rt({canManageIntegrations:e,integration:t,orgId:i}){let a=r(),o=r(),{showToast:s}=k(),c=n(),l=(0,z.useRef)(null),d=(0,z.useRef)(!1),p=(0,z.useRef)(!1),[m,h]=(0,z.useState)(t),[_,y]=(0,z.useState)(!1);(0,z.useEffect)(()=>{h(t)},[t]),(0,z.useEffect)(()=>{if(a.state!==`idle`||!a.data||d.current)return;d.current=!0;let[e,t]=a.data;if(e){s(e.message,`error`);return}t.action===`configure_splunk`&&(l.current?.reset(),h(t.integration),y(!1),s(`Splunk connection submitted`,`success`),c.revalidate())},[a.data,a.state,c,s]),(0,z.useEffect)(()=>{if(o.state!==`idle`||!o.data||p.current)return;p.current=!0;let[e,t]=o.data;if(e){s(e.message,`error`);return}t.action===`disconnect_splunk`&&(h(void 0),s(`Splunk disconnected`,`success`),c.revalidate())},[o.data,o.state,c,s]);let b=a.state!==`idle`||o.state!==`idle`,x=m?.integrationStatus.toUpperCase()===`INACTIVE`?void 0:m,S=Ke(x),T=Ze(x),D=`Not yet connected.`;x&&(D=`Integration connection is unavailable.`),x?.integrationStatus.toUpperCase()===`PENDING`&&(D=`Integration is pending activation.`),S&&(D=`Connected and ready to receive alerts.`);let O=()=>{!e||o.state!==`idle`||(p.current=!1,o.submit({_action:`disconnect_splunk`,orgId:i},{method:`post`}))},A=()=>{a.state===`idle`&&y(!1)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:(0,B.jsxs)(g,{display:`flex-col`,overflow:`hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-burgundy-500/12 border-b p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(C,{className:`h-6 w-6`}),(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:`Splunk`})]}),(0,B.jsx)(E,{variant:Je(x),children:qe(x)})]}),(0,B.jsx)(`div`,{className:`flex min-h-20 flex-1 items-center justify-between p-5`,children:(0,B.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[(0,B.jsx)(Q,{lastSeen:T,referenceDescription:at,children:D}),(0,B.jsx)(`div`,{className:`w-28 shrink-0 [&>span]:w-full`,children:(0,B.jsx)(f,{content:`You need admin privileges for this.`,disabled:e,children:x?(0,B.jsx)(u,{fullWidth:!0,size:`sm`,type:`button`,variant:`secondary`,onClick:O,"data-click":`integrations-disconnect-splunk-button`,disabled:b||!e,loading:o.state!==`idle`,children:`Disconnect`}):(0,B.jsx)(u,{fullWidth:!0,size:`sm`,type:`button`,variant:`primary`,onClick:()=>y(!0),"data-click":`integrations-add-splunk-button`,disabled:b||!e,children:`Connect`})})})]})})]})}),(0,B.jsx)(w,{isOpen:_,onClose:A,children:(0,B.jsxs)(a.Form,{ref:l,className:`p-6`,method:`post`,onSubmit:()=>{d.current=!1},children:[(0,B.jsx)(`h3`,{className:`font-semibold text-burgundy-500 text-lg`,children:`Connect Splunk`}),(0,B.jsx)(`p`,{className:`mt-2 text-ink-600 text-sm`,children:`Enter the HTTP Event Collector details from your Splunk deployment. The token is write-only and cannot be viewed after connecting.`}),(0,B.jsxs)(`p`,{className:`mt-2 text-ink-600 text-sm`,children:[`Splunk Cloud is currently supported. For an on-premises Splunk deployment, please`,` `,(0,B.jsx)(`a`,{className:`curs
60or-pointer font-medium text-burgundy-500 underline underline-offset-2 hover:text-ink-700`,href:`mailto:[email protected]`,children:`contact us`}),`.`]}),(0,B.jsx)(`input`,{name:`_action`,type:`hidden`,value:`configure_splunk`}),(0,B.jsx)(`input`,{name:`orgId`,type:`hidden`,value:i}),(0,B.jsxs)(`div`,{className:`mt-5 grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,B.jsx)(v,{required:!0,id:`splunk-hec-url`,name:`hecUrl`,label:`HEC URL`,placeholder:`https://inputs.example.splunkcloud.com:8088`,type:`url`}),(0,B.jsx)(v,{required:!0,autoComplete:`new-password`,id:`splunk-hec-token`,name:`hecToken`,label:`HEC token`,type:`password`}),(0,B.jsx)(v,{id:`splunk-destination`,name:`destination`,label:`Index (optional)`,placeholder:`main`}),(0,B.jsx)(v,{id:`splunk-event-type`,name:`eventType`,label:`Sourcetype (optional)`,placeholder:`embroidery:alert`})]}),(0,B.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,B.jsx)(u,{type:`button`,variant:`secondary`,"data-click":`integrations-connect-splunk-cancel-button`,onClick:A,disabled:a.state!==`idle`,children:`Cancel`}),(0,B.jsx)(u,{type:`submit`,variant:`primary`,"data-click":`integrations-connect-splunk-button`,loading:a.state!==`idle`,children:`Connect`})]})]})})]})}function it(){return(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:(0,B.jsxs)(g,{display:`flex-col`,overflow:`hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-burgundy-500/12 border-b p-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(C,{className:`h-6 w-6`}),(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:`Splunk`})]}),(0,B.jsx)(j,{className:`h-4.5 w-16 rounded-full`})]}),(0,B.jsxs)(`div`,{className:`flex min-h-20 flex-1 items-center justify-between gap-4 p-5`,children:[(0,B.jsx)(Q,{loading:!0,referenceDescription:at}),(0,B.jsx)(j,{className:`h-9 w-28 shrink-0`})]})]})})}var at=`Connected and ready to receive alerts.`;function ot(){let e=i(),t=n(),{showToast:a}=k(),o=r(),s=r(),c=r(),l=r(),p=r(),h=(0,z.useRef)(null),[_,v]=(0,z.useState)(null),y=(0,z.useRef)(!1),b=(0,z.useRef)(!1),x=(0,z.useRef)(!1),S=(0,z.useRef)(!1),C=(0,z.useRef)(null),[E,D]=(0,z.useState)(null),[O,A]=(0,z.useState)(Te(e.integrations[1])),[j,M]=(0,z.useState)(!1),[te,N]=(0,z.useState)(null),P=e.user.orgId??``,F=e.canManageIntegrations,I=Se(P,F),{loading:L,open:ne}=m({onFinish:()=>{let e=C.current;e&&(y.current=!1,o.submit({_action:`poll_integrations`,orgId:P,integrationName:e},{method:`post`}))},onError:e=>{C.current=null,a(ie(e),`error`)},allowedOrigins:ee()}),{corelliaVersion:[re,ae],integrations:[oe,R],microsoft:ce,google:V}=e,le=s.data?.[1],ue=s.data?.[0]??null,de=c.data?.[1],H=c.data?.[0]??null,fe=le?.action===`get_access_token`?le.accessToken:de?.action===`rotate_access_token`?de.accessToken:null,U={microsoft:{popup:ce.popup,fallback:ce.fallback},google:{popup:V.popup,fallback:V.fallback}},pe=(e,t)=>{if(e.preventDefault(),!F||L)return;let n=U[t];n?.popup&&(C.current=t,ne(n.popup,n.fallback))},me=(e,t)=>{if(l.state!==`idle`||!Ce.includes(e))return;let n=e;v(n),h.current={integrationName:n,previousActive:O.includes(n)},A(e=>t?[...new Set([...e,n])]:e.filter(e=>e!==n)),x.current=!1,l.submit({_action:`update_agent_integration`,orgId:P,integrationName:n,integrationStatus:t?`ACTIVE`:`INACTIVE`,skipRevalidation:`true`},{method:`post`})},W=e=>{F&&p.state===`idle`&&(S.current=!1,D(e),p.submit({_action:`disconnect_integration`,orgId:P,integrationName:e},{method:`post`}))},he=(I.pending||I.error)&&(0,B.jsx)(Le,{progress:I.progress,error:I.error,onRetry:I.start,canRetry:F}),G=(0,z.useCallback)(async(e,t=`Access token copied`,n=`Failed to copy access token`)=>await T(e)?(a(t,`success`),!0):(a(n,`error`),!1),[a]),ge=()=>{if(F){if(fe){G(fe.accessToken);return}s.state===`idle`&&s.submit({_action:`get_access_token`,orgId:P,claimFor:q},{method:`post`})}},_e=()=>{F&&c.state===`idle`&&(b.current=!1,c.submit({_action:`rotate_access_token`,orgId:P,claimFor:q},{method:`post`}))},ve=()=>{F&&M(!0)},K=()=>{c.state===`idle`&&M(!1)};return(0,z.useEffect)(()=>
60{if(o.state!==`idle`||!o.data||y.current)return;y.current=!0;let[e]=o.data;if(C.current=null,e){a(e.message,`error`);return}a(`Integration added successfully`,`success`),t.revalidate()},[o.state,o.data,a,t]),(0,z.useEffect)(()=>{if(l.state!==`idle`||!l.data||x.current)return;x.current=!0;let[e,t]=l.data;if(e){let e=h.current;e&&A(t=>e.previousActive?[...new Set([...t,e.integrationName])]:t.filter(t=>t!==e.integrationName)),h.current=null,v(null),a(`Failed to update integration setting`,`error`);return}h.current=null,v(null),t.action===`update_agent_integration`&&a(`Integration setting updated`,`success`)},[l.state,l.data,a]),(0,z.useEffect)(()=>{if(p.state!==`idle`||!p.data||S.current)return;S.current=!0,D(null);let[e,n]=p.data;if(e){a(`Failed to disconnect integration`,`error`);return}n.action===`disconnect_integration`&&(a(`Integration disconnected`,`success`),t.revalidate())},[p.state,p.data,a,t]),(0,z.useEffect)(()=>{if(s.state!==`idle`||!s.data)return;let[e,t]=s.data;if(e){a(`Failed to load access token`,`error`);return}t.action===`get_access_token`&&G(t.accessToken.accessToken,`Access token copied`,`Access token loaded. Tap Copy again.`)},[s.state,s.data,G]),(0,z.useEffect)(()=>{if(c.state!==`idle`||!c.data||b.current)return;b.current=!0;let[e,t]=c.data;if(e){a(`Failed to rotate access token`,`error`);return}t.action===`rotate_access_token`&&(M(!1),G(t.accessToken.accessToken,`Access token rotated and copied`))},[c.state,c.data,G,a]),(0,B.jsxs)(se,{description:ut,title:dt,tone:`mint`,children:[(L||o.state!==`idle`)&&(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-paper-100/60 backdrop-blur-sm`,children:[(0,B.jsx)(d,{size:`lg`}),(0,B.jsx)(`p`,{className:`mt-4 font-medium text-ink-500 text-sm`,children:L?`Waiting for authorizationâ¦`:`Connecting integrationâ¦`})]}),oe&&(0,B.jsx)(`div`,{className:`rounded-xl border border-coral-200 bg-coral-100 px-4 py-3 text-coral-700 text-sm`,children:oe.message}),(0,B.jsxs)($,{description:ft,title:pt,children:[(0,B.jsx)(g,{as:`section`,overflow:`hidden`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-5 bg-lavender-300 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:vt}),(0,B.jsx)(`p`,{className:`mt-1 text-ink-500 text-xs`,children:yt}),(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-ink-500 text-xs`,children:[(0,B.jsxs)(`span`,{children:[Et,` `,(0,B.jsx)(`strong`,{className:`font-medium text-burgundy-500`,children:re?`Unavailable`:ae})]}),(0,B.jsx)(`span`,{children:bt})]}),ue&&(0,B.jsx)(`p`,{className:`mt-2 text-coral-600 text-xs`,children:ue.message}),H&&(0,B.jsx)(`p`,{className:`mt-2 text-coral-600 text-xs`,children:H.message})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start gap-x-4 gap-y-3 lg:border-burgundy-500/12 lg:border-l lg:pl-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-1 pl-3 text-ink-500 text-xs`,children:xt}),(0,B.jsx)(`div`,{className:`flex h-12 w-44 items-start`,children:he||(0,B.jsx)(f,{content:Ee,disabled:F,children:(0,B.jsx)(u,{animate:!0,size:`sm`,type:`button`,variant:`ghost`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`download`}),onClick:I.start,"data-click":`integrations-download-scripts-button`,className:`cursor-pointer`,disabled:!F||I.pending,children:St})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-1 pl-3 text-ink-500 text-xs`,children:Ct}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,B.jsx)(f,{content:Ee,disabled:F,children:(0,B.jsx)(u,{animate:!0,size:`sm`,type:`button`,variant:`ghost`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`content_copy`}),onClick:ge,"data-click":`integrations-copy-access-token-button`,disabled:s.state!==`idle`||!F,loading:s.state!==`idle`,children:wt})}),(0,B.jsx)(f,{content:Ee,disabled:F,children:(0,B.jsx)(u,{animate:!0,size:`sm`,type:`button`,variant:`ghost`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`refresh`}),onClick:ve,"data-click":`integrations-rotate-access-token-button`,disabled:c.state!==`idle`||!F,loading:c.state!==`idle`,children:Tt})})]})]})]})]})}),(0,B.jsx)(w,{isOpen:j,onClose:K,children:(0,B.jsxs)(`div`,{className:`p-6`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-burgundy-500 text-lg`,children:`Rotate access token`}),(0,B.jsx)(`p`,{className:`mt-2 text-ink-600 text-sm`,children:`Are you sure? Rotating this token invalidates the token currently in use, so you need to propagate the new access token to every config.ini file before those local agents can connect again.`}),H&&(0,B.jsx)(`p`,{className:`mt-4 rounded-xl border border-coral-200 bg-coral-100 px-3 py-2 text-coral-700 text-sm`,children:H.message}),(0,B.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,B.jsx)(u,{type:`button`,variant:`secondary`,"data-click":`integrations-rotate-access-token-cancel-button`,onClick:K,disabled:c.state!==`idle`,children:`Cancel`}),(0,B.jsx)(u,{type:`button`,variant:`primary`,"data-click":`integrations-rotate-access-token-confirm-button`,onClick:_e,loading:c.state!==`idle`,children:Tt})]})]})}),(0,B.jsx)(Be,{canDownloadClaudePlugin:F&&(O.includes(`claudecowork`)||O.includes(`claude`)),canCopy:e.canViewAccessToken,orgId:P,provider:te,onClose:()=>N(null)}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:We.map(e=>(0,B.jsx)(Qe,{integration:we(R,e.name),canManageIntegrations:F,loading:L,integrationUpdating:_===e.name||E===e.name,onAddIntegration:pe,onDisconnectIntegration:W,onOpenCloudAgentGuide:N,onToggleDownload:me,provider:e,selectedForDownload:O.includes(e.name),urls:U[e.name]},e.name))})]}),(0,B.jsx)($,{description:mt,title:ht,children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:Ue.map(e=>(0,B.jsx)(Qe,{integration:we(R,e.name),canManageIntegrations:F,loading:L,integrationUpdating:E===e.name,onAddIntegration:pe,onDisconnectIntegration:W,onOpenCloudAgentGuide:N,onToggleDownload:me,provider:e,selectedForDownload:!1,urls:U[e.name]},e.name))})}),(0,B.jsx)($,{description:gt,title:_t,children:(0,B.jsx)(rt,{canManageIntegrations:F,integration:R?.find(e=>e.integrationName===`SPLUNK`&&e.integrationType===`SIEM`),orgId:P})})]})}var st=L.filter(e=>e.name!==`microsoft`&&e.name!==`google`),ct=L.filter(e=>e.name===`microsoft`||e.name===`google`);function lt(){return(0,B.jsxs)(ce,{description:ut,title:dt,children:[(0,B.jsxs)($,{description:ft,title:pt,children:[(0,B.jsx)(R,{children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-5 bg-lavender-300 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`font-medium text-base text-burgundy-500`,children:vt}),(0,B.jsx)(`p`,{className:`mt-1 text-ink-500 text-xs`,children:yt}),(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-ink-500 text-xs`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[Et,` `,(0,B.jsx)(j,{className:`h-4 w-10`})]}),(0,B.jsx)(`span`,{children:bt})]})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start gap-x-4 gap-y-3 lg:border-burgundy-500/12 lg:border-l lg:pl-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-1 pl-3 text-ink-500 text-xs`,children:xt}),(0,B.jsx)(`div`,{className:`flex h-12 w-44 items-start`,children:(0,B.jsx)(u,{disabled:!0,size:`sm`,type:`button`,variant:`ghost`,"data-click":`integrations-loading-download-button`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`download`}),children:St})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-1 pl-3 text-ink-500 text-xs`,children:Ct}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,B.jsx)(u,{disabled:!0,size:`sm`,type:`button`,variant:`ghost`,"data-click":`integrations-loading-copy-button`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`content_copy`}),children:wt}),(0,B.jsx)(u,{disabled:!0,size:`sm`,type:`button`,variant:`ghost`,"data-click":`integrations-loading-rotate-button`,icon:(0,B.jsx)(`span`,{className:`material-symbols-outlined text-sm leading-none`,children:`refresh`}),children:Tt})]})]})]})]})}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:st.map(e=>(0,B.jsx)($e,{isAgent:!0,provider:e},e.name))})]}),(0,B.jsx)($,{description:mt,title:ht,children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-6 sm:grid-cols-2`,children:ct.map(e=>(0,B.jsx)($e,{provider:e},e.name))})}),(0,B.jsx)($,{description:gt,title:_t,children:(0,B.jsx)(it,{})})]})}var ut=`Connect identity providers, agents, and SIEM destinations.`,dt=`Integrations`,ft=`Configure the endpoint app and choose which agent integrations are active.`,pt=`Agents`,mt=`Connect your organization directory to synchronize identities and activity.`,ht=`Identity Providers`,gt=`Forward Embroidery alerts to your security information and event management platform.`,_t=`SIEMs`,vt=`Embroidery Endpoint App`,yt=`Download the agent bundle to set up the Embroidery endpoint app for local monitoring. Make sure to distribute to all devices you want Embroidery to monitor. You may also rotate your access token, if needed.`,bt=`Changes propagate in 10-15 minutes`,xt=`Agent bundle`,St=`Download`,Ct=`Access token`,wt=`Copy`,Tt=`Rotate`,Et=`Version`;function Dt(){return(0,B.jsx)(lt,{})}async function Ot(e){let[[t,n],[r,i]]=await Promise.all([F.get(`/api/v1/users/me`,null,{cacheRequest:!0}),F.get(`/api/v1/users/me/permissions`,null,{cacheRequest:!0})]);if(t||!n)throw Error(`Failed to load user`,{cause:t});let a=n.orgId;if(!a)throw Error(`No organization found`);if(r||!i)throw Error(`Failed to load permissions`,{cause:r});let[[o,s],[c,l],[u,d],[f,p],[m,h],[g,_]]=await Promise.all([F.get(`/api/v1/organizations/{orgId}/integrations`,{orgId:a}),F.get(`/api/v1/integrations/corellia/versions/current`,null),F.url(`/api/v1/integrations/microsoft/authorizations`,{$search:void 0}),F.url(`/api/v1/integrations/microsoft/authorizations`,{$search:{redirectUri:`/platform/settings/integrations`}}),F.url(`/api/v1/integrations/google/authorizations`,{$search:void 0}),F.url(`/api/v1/integrations/google/authorizations`,{$search:{redirectUri:`/platform/settings/integrations`}})]);if(f||g)throw Error(`Failed to load integration authorization URLs`);let v=re(i,a)||ne(i,a);return{user:n,canManageIntegrations:v,canViewAccessToken:v,integrations:[o,s],corelliaVersion:[c,l],microsoft:{popup:u?null:d,fallback:p},google:{popup:m?null:h,fallback:_}}}function kt(){return[{title:`Integrations | embroidery`},{name:`description`,content:`Connect and manage organization integrations.`}]}var At=Ot,jt=ye,Mt=oe,Nt=kt,Pt=a(Dt),Ft=ae(Dt),It=s(be),Lt=c(ot);export{It as ErrorBoundary,Pt as HydrateFallback,jt as clientAction,At as clientLoader,Lt as default,Ft as handle,Nt as meta,Mt as shouldRevalidate};
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.