UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

5 lines • 155 kB
import{g$ as Fe,h0 as Ze,hy as xn,hz as ks,c as Y,b as X,r as q,j as t,B as Z,h as it,m as ye,_ as Ms,X as _s,Z as Vs,Y as Je,as as Gt,aq as qt,ar as Ht,t as ie,R as Xe,a6 as Ae,a7 as Ts,hA as gn,v as at,D as lt,y as $t,L as Ft,I as Ne,F as vn,ak as bn,aj as jn,gm as $e,av as Ds,gl as ke,gZ as Oe,an as ft,d as pt,i as Ps,K as At,hB as yn,hC as wn,hD as Sn,$ as Ct,eb as xe,hE as be,n as Ke,P as Nn,u as Cn,a_ as rt,q as Et,e as Os,fM as Qt,ad as kn,x as ht,aW as Is,w as xt,ay as Mn,cL as _n,E as _e,e3 as Vn,a as Tn,hF as zt,hG as Dn,b9 as Pn,ai as On,aI as In,aH as $n,bA as Fn,a9 as An,hx as En,aR as zn,aQ as Rn,aN as Ln,aL as Un,aM as Bn,aP as Yn,aO as Wn,bc as Kn,aY as Gn}from"./index-ztdGKvBm.js";import{g as qn}from"./extract-connection-data-DjYTV7t7.js";import{b as Hn}from"./chat-context-DFEln8mI.js";import{U as Qn,b as Xn}from"./build-improve-prompt-doc-BBeWkVDi.js";import{E as Jn}from"./empty-state-I_cTbW85.js";import{u as Zn}from"./shell-layout-UF80oiAz.js";import{g as gt,n as ei,a as Xt,e as ti,u as si,f as ni}from"./use-date-fns-locale-CloMwBOl.js";import{a as ii}from"./mcp-oauth-BBSVAQ62.js";import{T as ut}from"./textarea-viSdm6BE.js";import{c as Ve,T as Te,a as De}from"./tooltip-Bm0P1gm_.js";import{u as Rt,a as $s,b as ai}from"./use-connection-CcG4QE1K.js";import{b as Fs,g as As,c as li,i as ri}from"./repository-binding-D_Xc1yRH.js";import{i as Jt}from"./mcp-oauth-Alln4VX8.js";import{a as oi}from"./MessageCircle01-BG1RhOiZ.js";import{s as Be}from"./Plus-DWySsEmB.js";import{t as dt,a as ci}from"./Tool01-BCJ5kyrz.js";import{s as vt}from"./Trash01-BxBhF2b8.js";import{u as Zt}from"./use-debounced-autosave-CCeLz8XW.js";import{A as di}from"./add-connection-dialog-CS6ZsWUV.js";import{b4 as ui,k as Es,b5 as mi,b6 as fi,aH as pi,a5 as hi,a9 as xi,b7 as gi,b8 as zs,b9 as Rs,ba as vi,aa as bi,bb as ji,bc as kt,bd as es,A as ts,D as yi,be as wi,bf as Si,h as Ls,x as ss,j as Ni,a3 as Ci,n as ki,p as Mi,o as _i,m as Vi,g as Us,e as bt,V as Ti}from"./agent-icon-BYWtutu9.js";import{i as Dt}from"./SearchMd-BD2qldmS.js";import{F as ns}from"./file-type-icon-CdjLDWdN.js";import{k as Di,l as Pi,p as Oi,q as Ii}from"./use-org-fs-D9dHgOYs.js";import{C as $i}from"./collection-tabs-Cju2BOrS.js";import{T as Bs,u as Ys}from"./use-mcp-auth-status-6sC2vB74.js";import{I as jt}from"./integration-icon-Bo-3z9o3.js";import{C as Fi}from"./checkbox-QUuOza1H.js";import{u as yt}from"./use-mcp-client-2MG3LveS.js";import{a as Ws}from"./use-mcp-tools-DOqvKogJ.js";import{u as Ai}from"./use-mcp-prompts-qJSiAdA5.js";import{g as Ei}from"./connection-slug-BNBBglpK.js";import{c as Se,b as Ee,a as ze,d as Re,S as Le}from"./select-CxXZwsSr.js";import{s as Ks}from"./XClose-CmTuu4UN.js";import{t as Pt}from"./utils-CVEq3hMx.js";import{S as et}from"./switch-B81oLbqr.js";import{a as Gs,b as qs,P as Hs}from"./popover-C4oz5B-L.js";import{S as zi}from"./scroll-area-Dm3EbBj1.js";import{i as Ri}from"./Upload01-q-rKSvZf.js";import{n as Li,h as Ui}from"./UserCheck01-k-4bTA2h.js";import{a as Bi}from"./SwitchHorizontal01-CMdpIiQk.js";import{a as Yi}from"./Image01-BcIZ5mtf.js";import{i as Wi}from"./Monitor01-DMFbvudn.js";import{i as Ki}from"./UserSquare-CafFh5_d.js";import{g as Gi}from"./types-5-cDe_8u.js";import{a as Qs,c as qi}from"./agent-capabilities-CyWfHGWp.js";import{a as Hi}from"./use-panel-navigate-0z93k6Ut.js";import{u as Qi,p as Xi,g as Ot,o as is,r as It,h as Ji,a as Zi,j as as,t as ea,k as ta,l as sa,b as na}from"./use-project-native-view-presence-C7OB-luC.js";import{a as Xs,u as ia,i as aa,o as la,r as ls,p as ra,w as oa,b as rs}from"./optimistic-project-sidebar-views-aXJkp7Aa.js";import{u as ca}from"./use-file-configs-3gwPBXwK.js";import{a as da,P as ua,i as ma}from"./sections-BA7rlacS.js";import{i as Lt}from"./Key01-CaJGjh13.js";import{u as fa}from"./use-copy-DT4_uVrH.js";import{L as we}from"./label-8UxgpYiA.js";import{h as pa}from"./roles-DW32thi2.js";import{b as ha,u as xa}from"./use-blocks-v8-project-BPvEDyS9.js";import{s as Js,b as ga,e as Zs,r as va}from"./session-runtime-DBl1Hlcw.js";import{V as ba,E as wt,R as os,r as en,C as ja,w as ya}from"./virtual-mcp-CAb2l-zV.js";import{b as wa,a as Sa,D as Na}from"./drawer-CROtV2u4.js";import{u as Ca}from"./use-mobile-C_hdQY5I.js";import{d as St}from"./delay-CnY5UFtP.js";import{b as ka}from"./sandbox-url-D3mC8qhT.js";import{S as Ma,a as _a,b as Va}from"./secret-picker-Bjl5COEs.js";import{u as Ta,a as Da}from"./use-secrets-BUuPyfGX.js";import{o as cs}from"./omit-server-managed-metadata-L5IhjRZB.js";import{G as Pa}from"./github-icon-Bq9Ot22_.js";import{R as Oa}from"./repository-picker-CSaozawA.js";import{n as ds}from"./app-preview-url-9Od4s8Sz.js";import{u as Ia}from"./use-organization-settings-C2vcrj4S.js";import{r as $a}from"./serial-task-queue-CGOeQgpr.js";function nt(a,e){const s=gt(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=Fe(a,e?.in),l=i.getDay(),c=(l<n?7:0)+l-n;return i.setDate(i.getDate()-c),i.setHours(0,0,0,0),i}function mt(a,e){return nt(a,{...e,weekStartsOn:1})}function tn(a,e){const s=Fe(a,e?.in),n=s.getFullYear(),i=Ze(s,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const l=mt(i),c=Ze(s,0);c.setFullYear(n,0,4),c.setHours(0,0,0,0);const r=mt(c);return s.getTime()>=l.getTime()?n+1:s.getTime()>=r.getTime()?n:n-1}function us(a,e){const s=Fe(a,e?.in);return s.setHours(0,0,0,0),s}function Fa(a,e,s){const[n,i]=ei(s?.in,a,e),l=us(n),c=us(i),r=+l-Xt(l),f=+c-Xt(c);return Math.round((r-f)/xn)}function Aa(a,e){const s=tn(a,e),n=Ze(a,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),mt(n)}function Ea(a){return a instanceof Date||typeof a=="object"&&Object.prototype.toString.call(a)==="[object Date]"}function za(a){return!(!Ea(a)&&typeof a!="number"||isNaN(+Fe(a)))}function Ra(a,e){const s=Fe(a,e?.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function La(a,e){const s=Fe(a,e?.in);return Fa(s,Ra(s))+1}function Ua(a,e){const s=Fe(a,e?.in),n=+mt(s)-+Aa(s);return Math.round(n/ks)+1}function sn(a,e){const s=Fe(a,e?.in),n=s.getFullYear(),i=gt(),l=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,c=Ze(e?.in||a,0);c.setFullYear(n+1,0,l),c.setHours(0,0,0,0);const r=nt(c,e),f=Ze(e?.in||a,0);f.setFullYear(n,0,l),f.setHours(0,0,0,0);const o=nt(f,e);return+s>=+r?n+1:+s>=+o?n:n-1}function Ba(a,e){const s=gt(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=sn(a,e),l=Ze(e?.in||a,0);return l.setFullYear(i,0,n),l.setHours(0,0,0,0),nt(l,e)}function Ya(a,e){const s=Fe(a,e?.in),n=+nt(s,e)-+Ba(s,e);return Math.round(n/ks)+1}function ae(a,e){const s=a<0?"-":"",n=Math.abs(a).toString().padStart(e,"0");return s+n}const Ue={y(a,e){const s=a.getFullYear(),n=s>0?s:1-s;return ae(e==="yy"?n%100:n,e.length)},M(a,e){const s=a.getMonth();return e==="M"?String(s+1):ae(s+1,2)},d(a,e){return ae(a.getDate(),e.length)},a(a,e){const s=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];default:return s==="am"?"a.m.":"p.m."}},h(a,e){return ae(a.getHours()%12||12,e.length)},H(a,e){return ae(a.getHours(),e.length)},m(a,e){return ae(a.getMinutes(),e.length)},s(a,e){return ae(a.getSeconds(),e.length)},S(a,e){const s=e.length,n=a.getMilliseconds(),i=Math.trunc(n*Math.pow(10,s-3));return ae(i,e.length)}},Qe={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ms={G:function(a,e,s){const n=a.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});default:return s.era(n,{width:"wide"})}},y:function(a,e,s){if(e==="yo"){const n=a.getFullYear(),i=n>0?n:1-n;return s.ordinalNumber(i,{unit:"year"})}return Ue.y(a,e)},Y:function(a,e,s,n){const i=sn(a,n),l=i>0?i:1-i;if(e==="YY"){const c=l%100;return ae(c,2)}return e==="Yo"?s.ordinalNumber(l,{unit:"year"}):ae(l,e.length)},R:function(a,e){const s=tn(a);return ae(s,e.length)},u:function(a,e){const s=a.getFullYear();return ae(s,e.length)},Q:function(a,e,s){const n=Math.ceil((a.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ae(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(a,e,s){const n=Math.ceil((a.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ae(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(a,e,s){const n=a.getMonth();switch(e){case"M":case"MM":return Ue.M(a,e);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(a,e,s){const n=a.getMonth();switch(e){case"L":return String(n+1);case"LL":return ae(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(a,e,s,n){const i=Ya(a,n);return e==="wo"?s.ordinalNumber(i,{unit:"week"}):ae(i,e.length)},I:function(a,e,s){const n=Ua(a);return e==="Io"?s.ordinalNumber(n,{unit:"week"}):ae(n,e.length)},d:function(a,e,s){return e==="do"?s.ordinalNumber(a.getDate(),{unit:"date"}):Ue.d(a,e)},D:function(a,e,s){const n=La(a);return e==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):ae(n,e.length)},E:function(a,e,s){const n=a.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(a,e,s,n){const i=a.getDay(),l=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(l);case"ee":return ae(l,2);case"eo":return s.ordinalNumber(l,{unit:"day"});case"eee":return s.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(i,{width:"short",context:"formatting"});default:return s.day(i,{width:"wide",context:"formatting"})}},c:function(a,e,s,n){const i=a.getDay(),l=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(l);case"cc":return ae(l,e.length);case"co":return s.ordinalNumber(l,{unit:"day"});case"ccc":return s.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(i,{width:"narrow",context:"standalone"});case"cccccc":return s.day(i,{width:"short",context:"standalone"});default:return s.day(i,{width:"wide",context:"standalone"})}},i:function(a,e,s){const n=a.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return ae(i,e.length);case"io":return s.ordinalNumber(i,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(a,e,s){const i=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(a,e,s){const n=a.getHours();let i;switch(n===12?i=Qe.noon:n===0?i=Qe.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(a,e,s){const n=a.getHours();let i;switch(n>=17?i=Qe.evening:n>=12?i=Qe.afternoon:n>=4?i=Qe.morning:i=Qe.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(a,e,s){if(e==="ho"){let n=a.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return Ue.h(a,e)},H:function(a,e,s){return e==="Ho"?s.ordinalNumber(a.getHours(),{unit:"hour"}):Ue.H(a,e)},K:function(a,e,s){const n=a.getHours()%12;return e==="Ko"?s.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},k:function(a,e,s){let n=a.getHours();return n===0&&(n=24),e==="ko"?s.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},m:function(a,e,s){return e==="mo"?s.ordinalNumber(a.getMinutes(),{unit:"minute"}):Ue.m(a,e)},s:function(a,e,s){return e==="so"?s.ordinalNumber(a.getSeconds(),{unit:"second"}):Ue.s(a,e)},S:function(a,e){return Ue.S(a,e)},X:function(a,e,s){const n=a.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return ps(n);case"XXXX":case"XX":return We(n);default:return We(n,":")}},x:function(a,e,s){const n=a.getTimezoneOffset();switch(e){case"x":return ps(n);case"xxxx":case"xx":return We(n);default:return We(n,":")}},O:function(a,e,s){const n=a.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+fs(n,":");default:return"GMT"+We(n,":")}},z:function(a,e,s){const n=a.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+fs(n,":");default:return"GMT"+We(n,":")}},t:function(a,e,s){const n=Math.trunc(+a/1e3);return ae(n,e.length)},T:function(a,e,s){return ae(+a,e.length)}};function fs(a,e=""){const s=a>0?"-":"+",n=Math.abs(a),i=Math.trunc(n/60),l=n%60;return l===0?s+String(i):s+String(i)+e+ae(l,2)}function ps(a,e){return a%60===0?(a>0?"-":"+")+ae(Math.abs(a)/60,2):We(a,e)}function We(a,e=""){const s=a>0?"-":"+",n=Math.abs(a),i=ae(Math.trunc(n/60),2),l=ae(n%60,2);return s+i+e+l}const hs=(a,e)=>{switch(a){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},nn=(a,e)=>{switch(a){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Wa=(a,e)=>{const s=a.match(/(P+)(p+)?/)||[],n=s[1],i=s[2];if(!i)return hs(a,e);let l;switch(n){case"P":l=e.dateTime({width:"short"});break;case"PP":l=e.dateTime({width:"medium"});break;case"PPP":l=e.dateTime({width:"long"});break;default:l=e.dateTime({width:"full"});break}return l.replace("{{date}}",hs(n,e)).replace("{{time}}",nn(i,e))},Ka={p:nn,P:Wa},Ga=/^D+$/,qa=/^Y+$/,Ha=["D","DD","YY","YYYY"];function Qa(a){return Ga.test(a)}function Xa(a){return qa.test(a)}function Ja(a,e,s){const n=Za(a,e,s);if(console.warn(n),Ha.includes(a))throw new RangeError(n)}function Za(a,e,s){const n=a[0]==="Y"?"years":"days of the month";return`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${e}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const el=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tl=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sl=/^'([^]*?)'?$/,nl=/''/g,il=/[a-zA-Z]/;function al(a,e,s){const n=gt(),i=s?.locale??n.locale??ti,l=s?.firstWeekContainsDate??s?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,c=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=Fe(a,s?.in);if(!za(r))throw new RangeError("Invalid time value");let f=e.match(tl).map(p=>{const m=p[0];if(m==="p"||m==="P"){const u=Ka[m];return u(p,i.formatLong)}return p}).join("").match(el).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const m=p[0];if(m==="'")return{isToken:!1,value:ll(p)};if(ms[m])return{isToken:!0,value:p};if(m.match(il))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:p}});i.localize.preprocessor&&(f=i.localize.preprocessor(r,f));const o={firstWeekContainsDate:l,weekStartsOn:c,locale:i};return f.map(p=>{if(!p.isToken)return p.value;const m=p.value;(!s?.useAdditionalWeekYearTokens&&Xa(m)||!s?.useAdditionalDayOfYearTokens&&Qa(m))&&Ja(m,e,String(a));const u=ms[m[0]];return u(r,m,i.localize,o)}).join("")}function ll(a){const e=a.match(sl);return e?e[1].replace(nl,"'"):a}const an=25*1024*1024,Mt="home",_t="knowledge";function xs(a){return a==null?"":a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(0)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Ye(a){return a.split("/").pop()??a}function rl(a){const e=Y.c(64),{form:s}=a,n=X(),{upload:i}=Di(Mt),l=Pi(),c=q.useRef(null),[r,f]=q.useState(!1),[o,p]=q.useState(""),[m,u]=q.useState(!1);let h;e[0]!==r?(h={enabled:r},e[0]=r,e[1]=h):h=e[1];const{data:d}=Oi(60,h),x=d===void 0?[]:d;let g;e[2]!==r?(g={enabled:r},e[2]=r,e[3]=g):g=e[3];const{data:v}=Ii(g),j=v===void 0?[]:v;let y;e[4]!==s?(y=()=>s.getValues("metadata.knowledge")??[],e[4]=s,e[5]=y):y=e[5];const[b,w]=q.useState(y);let S;e[6]!==s?(S=I=>{w(I),s.setValue("metadata.knowledge",I,{shouldDirty:!0})},e[6]=s,e[7]=S):S=e[7];const C=S;let N;e[8]!==l||e[9]!==b||e[10]!==C||e[11]!==n||e[12]!==i?(N=async I=>{if(!I||I.length===0)return;const te=Array.from(I),Pe=te.filter(pl),he=te.filter(fl);if(he.length>0&&ie.warning(n("virtualMcp.filesSection.fileTooLargeTitle"),{description:n("virtualMcp.filesSection.fileTooLargeDescription",{names:he.map(ml).join(", ")})}),Pe.length!==0){try{await i.mutateAsync({dir:_t,files:Pe})}catch(D){const le=D;ie.error(le instanceof Error?le.message:n("virtualMcp.filesSection.failedUploadFile"));return}C([...b,...Pe.map(D=>({id:crypto.randomUUID(),name:D.name,volume:Mt,path:`${_t}/${D.name}`,url:l(Mt,`${_t}/${D.name}`),contentType:D.type||null,size:D.size,addedAt:new Date().toISOString()}))])}},e[8]=l,e[9]=b,e[10]=C,e[11]=n,e[12]=i,e[13]=N):N=e[13];const k=N;let V;e[14]!==l||e[15]!==b||e[16]!==C?(V=I=>{b.some(te=>te.volume===I.volume&&te.path===I.path)||(C([...b,{id:crypto.randomUUID(),name:Ye(I.path),volume:I.volume,path:I.path,url:l(I.volume,I.path),contentType:null,size:I.size??null,addedAt:new Date().toISOString()}]),f(!1))},e[14]=l,e[15]=b,e[16]=C,e[17]=V):V=e[17];const T=V;let _;e[18]!==l||e[19]!==b||e[20]!==C?(_=I=>{b.some(te=>te.volume===I.volume&&te.path===I.path)||(C([...b,{id:crypto.randomUUID(),name:Ye(I.path),kind:"skill",volume:I.volume,path:I.path,url:l(I.volume,I.path),contentType:null,size:null,addedAt:new Date().toISOString()}]),f(!1))},e[18]=l,e[19]=b,e[20]=C,e[21]=_):_=e[21];const F=_;let $;e[22]!==b||e[23]!==C?($=I=>{C(b.filter(te=>te.id!==I))},e[22]=b,e[23]=C,e[24]=$):$=e[24];const A=$;let P;e[25]===Symbol.for("react.memo_cache_sentinel")?(P=I=>{f(I),I&&p("")},e[25]=P):P=e[25];const H=P;let Q;e[26]!==b?(Q=new Set(b.map(ul)),e[26]=b,e[27]=Q):Q=e[27];const R=Q,z=o.toLowerCase();let K;e[28]!==R?(K=I=>!R.has(`${I.volume}/${I.path}`),e[28]=R,e[29]=K):K=e[29];const E=x.filter(dl).filter(K).filter(I=>Ye(I.path).toLowerCase().includes(z)).slice(0,5);let L;e[30]!==R?(L=I=>!R.has(`${I.volume}/${I.path}`),e[30]=R,e[31]=L):L=e[31];const G=j.filter(L).filter(I=>Ye(I.path).toLowerCase().includes(z)).slice(0,5),J=I=>t.jsxs(Ms,{open:r,onOpenChange:H,children:[t.jsx(_s,{asChild:!0,children:I}),t.jsxs(Vs,{align:"end",className:"w-56",children:[t.jsxs(Je,{onSelect:()=>{c.current?.click()},children:[t.jsx(ui,{size:16}),n("virtualMcp.filesSection.uploadFile")]}),t.jsxs(Gt,{children:[t.jsxs(qt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(Es,{size:16}),n("virtualMcp.filesSection.selectFileOrFolder")]}),t.jsxs(Ht,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(Dt,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:o,onChange:te=>p(te.target.value),onKeyDown:cl,placeholder:n("virtualMcp.filesSection.searchFilesPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:E.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:n("virtualMcp.filesSection.noFilesFound")}):E.map(te=>t.jsxs(Je,{onSelect:()=>T(te),children:[t.jsx(ns,{filename:Ye(te.path),className:"h-5 w-4 shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ye(te.path)}),te.size!=null&&t.jsx("span",{className:"text-xs text-muted-foreground",children:xs(te.size)})]},`${te.volume}/${te.path}`))})]})]}),t.jsxs(Gt,{children:[t.jsxs(qt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(dt,{size:16}),n("virtualMcp.filesSection.selectSkill")]}),t.jsxs(Ht,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(Dt,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:o,onChange:te=>p(te.target.value),onKeyDown:ol,placeholder:n("virtualMcp.filesSection.searchSkillsPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:G.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:n("virtualMcp.filesSection.noSkillsFound")}):G.map(te=>t.jsxs(Je,{onSelect:()=>F(te),children:[t.jsx(dt,{size:16,className:"shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ye(te.path)})]},`${te.volume}/${te.path}`))})]})]})]})]}),ee="flex flex-col gap-3";let M;e[32]!==n?(M=n("virtualMcp.filesSection.filesAndSkills"),e[32]=n,e[33]=M):M=e[33];let O;e[34]!==M?(O=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:M}),e[34]=M,e[35]=O):O=e[35];let U;e[36]!==n?(U=n("virtualMcp.filesSection.description"),e[36]=n,e[37]=U):U=e[37];let B;e[38]!==U?(B=t.jsx("p",{className:"text-sm text-muted-foreground",children:U}),e[38]=U,e[39]=B):B=e[39];let W;e[40]!==O||e[41]!==B?(W=t.jsxs("div",{className:"flex flex-col gap-1",children:[O,B]}),e[40]=O,e[41]=B,e[42]=W):W=e[42];const re=b.length>0&&J(t.jsxs(Z,{variant:"outline",size:"sm",disabled:i.isPending,children:[i.isPending?t.jsx(it,{size:"xs"}):t.jsx(Be,{size:14}),n("virtualMcp.filesSection.add")]}));let oe;e[43]!==W||e[44]!==re?(oe=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[W,re]}),e[43]=W,e[44]=re,e[45]=oe):oe=e[45];let me;e[46]!==k?(me=t.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:I=>{k(I.target.files),I.target.value=""}}),e[46]=k,e[47]=me):me=e[47];let ne,ue;e[48]===Symbol.for("react.memo_cache_sentinel")?(ne=I=>{I.preventDefault(),u(!0)},ue=()=>u(!1),e[48]=ne,e[49]=ue):(ne=e[48],ue=e[49]);let fe;e[50]!==k?(fe=I=>{I.preventDefault(),I.stopPropagation(),u(!1),k(I.dataTransfer.files)},e[50]=k,e[51]=fe):fe=e[51];const pe=m&&"outline outline-2 outline-dashed outline-primary";let ce;e[52]!==pe?(ce=ye("flex flex-col gap-2 rounded-lg",pe),e[52]=pe,e[53]=ce):ce=e[53];const ge=b.length===0?J(t.jsxs("button",{type:"button",className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx(Be,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:n("virtualMcp.filesSection.noFilesOrSkillsYet")})]})):b.map(I=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 surface",children:[I.kind==="skill"?t.jsx("div",{className:"flex items-center justify-center h-8 w-6.5 shrink-0 rounded-md bg-muted text-muted-foreground",children:t.jsx(dt,{size:16})}):t.jsx(ns,{filename:I.name,className:"h-8 w-6.5 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:I.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:I.kind==="skill"?n("virtualMcp.filesSection.kindSkill"):I.size!=null?xs(I.size):n("virtualMcp.filesSection.kindFile")})]}),t.jsx(Z,{variant:"ghost",size:"icon",onClick:()=>A(I.id),"aria-label":n("virtualMcp.filesSection.removeAriaLabel",{name:I.name}),children:t.jsx(vt,{size:16})})]},I.id));let je;e[54]!==ne||e[55]!==ue||e[56]!==fe||e[57]!==ce||e[58]!==ge?(je=t.jsx("div",{onDragOver:ne,onDragLeave:ue,onDrop:fe,className:ce,children:ge}),e[54]=ne,e[55]=ue,e[56]=fe,e[57]=ce,e[58]=ge,e[59]=je):je=e[59];let de;return e[60]!==oe||e[61]!==me||e[62]!==je?(de=t.jsxs("section",{className:ee,children:[oe,me,je]}),e[60]=oe,e[61]=me,e[62]=je,e[63]=de):de=e[63],de}function ol(a){return a.stopPropagation()}function cl(a){return a.stopPropagation()}function dl(a){return a.kind!=="dir"}function ul(a){return`${a.volume}/${a.path}`}function ml(a){return a.name}function fl(a){return a.size>an}function pl(a){return a.size<=an}function st(){const a=Y.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(it,{className:"size-6 text-muted-foreground"})}),a[0]=e):e=a[0],e}function ct(a,e){return({error:s})=>s?.message?.includes("Method not found")||s?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:a})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(Ts,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:e("virtualMcp.dependencySelectionDialog.somethingWentWrong")}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:s?.message?s.message.length>200?`${s.message.slice(0,200)}...`:s.message:e("virtualMcp.dependencySelectionDialog.unexpectedError")})]})]})}function ln(a){const e=Y.c(23),{item:s,isSelected:n,onToggle:i,disabled:l}=a,c=l?"cursor-not-allowed opacity-50":"cursor-pointer",r=n?"bg-accent/25":"hover:bg-accent";let f;e[0]!==c||e[1]!==r?(f=ye("flex items-start gap-3 p-4 rounded-lg transition-colors",c,r),e[0]=c,e[1]=r,e[2]=f):f=e[2];let o;e[3]!==s.name?(o=t.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=o):o=e[4];let p;e[5]!==s.tags?(p=s.tags&&t.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=p):p=e[6];let m;e[7]!==o||e[8]!==p?(m=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o,p]}),e[7]=o,e[8]=p,e[9]=m):m=e[9];let u;e[10]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=u):u=e[11];let h;e[12]!==m||e[13]!==u?(h=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[m,u]}),e[12]=m,e[13]=u,e[14]=h):h=e[14];let d;e[15]!==l||e[16]!==n||e[17]!==i?(d=t.jsx(Fi,{checked:n,onCheckedChange:i,disabled:l,className:"mt-0.5"}),e[15]=l,e[16]=n,e[17]=i,e[18]=d):d=e[18];let x;return e[19]!==f||e[20]!==h||e[21]!==d?(x=t.jsxs("label",{className:f,children:[h,d]}),e[19]=f,e[20]=h,e[21]=d,e[22]=x):x=e[22],x}function hl(a){const e=Y.c(35),{activeTab:s,onTabChange:n,showSelectAll:i,isAllSelected:l,handleSelectAll:c}=a,r=X();let f;e[0]!==r?(f=r("virtualMcp.dependencySelectionDialog.tabTools"),e[0]=r,e[1]=f):f=e[1];let o;e[2]!==f?(o={id:"tools",label:f},e[2]=f,e[3]=o):o=e[3];let p;e[4]!==r?(p=r("virtualMcp.dependencySelectionDialog.tabActive"),e[4]=r,e[5]=p):p=e[5];let m;e[6]!==p?(m={id:"active",label:p},e[6]=p,e[7]=m):m=e[7];let u;e[8]!==r?(u=r("virtualMcp.dependencySelectionDialog.tabResources"),e[8]=r,e[9]=u):u=e[9];let h;e[10]!==u?(h={id:"resources",label:u},e[10]=u,e[11]=h):h=e[11];let d;e[12]!==r?(d=r("virtualMcp.dependencySelectionDialog.tabPrompts"),e[12]=r,e[13]=d):d=e[13];let x;e[14]!==d?(x={id:"prompts",label:d},e[14]=d,e[15]=x):x=e[15];let g;e[16]!==o||e[17]!==m||e[18]!==h||e[19]!==x?(g=[o,m,h,x],e[16]=o,e[17]=m,e[18]=h,e[19]=x,e[20]=g):g=e[20];let v;e[21]!==n?(v=w=>n(w),e[21]=n,e[22]=v):v=e[22];let j;e[23]!==s||e[24]!==v||e[25]!==g?(j=t.jsx($i,{tabs:g,activeTab:s,onTabChange:v}),e[23]=s,e[24]=v,e[25]=g,e[26]=j):j=e[26];let y;e[27]!==c||e[28]!==l||e[29]!==i||e[30]!==r?(y=i&&t.jsx("button",{type:"button",onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r(l?"virtualMcp.dependencySelectionDialog.deselectAll":"virtualMcp.dependencySelectionDialog.selectAll")}),e[27]=c,e[28]=l,e[29]=i,e[30]=r,e[31]=y):y=e[31];let b;return e[32]!==j||e[33]!==y?(b=t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[j,y]}),e[32]=j,e[33]=y,e[34]=b):b=e[34],b}function Ut(a){const e=Y.c(13),{items:s,selections:n,onToggle:i,emptyMessage:l,disabled:c}=a;let r,f,o;if(e[0]!==c||e[1]!==l||e[2]!==s||e[3]!==i||e[4]!==n){o=Symbol.for("react.early_return_sentinel");e:{const m=s.map(xl);if(s.length===0){let u;e[8]!==l?(u=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:l})}),e[8]=l,e[9]=u):u=e[9],o=u;break e}r="flex-1 overflow-auto px-4 py-3 space-y-1",f=s.map(u=>t.jsx(ln,{item:u,isSelected:n===null||n?.includes(u.id),onToggle:()=>i(u.id,m),disabled:c},u.id))}e[0]=c,e[1]=l,e[2]=s,e[3]=i,e[4]=n,e[5]=r,e[6]=f,e[7]=o}else r=e[5],f=e[6],o=e[7];if(o!==Symbol.for("react.early_return_sentinel"))return o;let p;return e[10]!==r||e[11]!==f?(p=t.jsx("div",{className:r,children:f}),e[10]=r,e[11]=f,e[12]=p):p=e[12],p}function xl(a){return a.id}function gl(a){const e=Y.c(22),{connectionId:s,toolSelections:n,onToggleTool:i}=a,l=X(),{org:c}=Ae();let r;e[0]!==s||e[1]!==c.id||e[2]!==c.slug?(r={connectionId:s,orgId:c.id,orgSlug:c.slug},e[0]=s,e[1]=c.id,e[2]=c.slug,e[3]=r):r=e[3];const f=yt(r);let o;e[4]!==f?(o={client:f},e[4]=f,e[5]=o):o=e[5];const{data:p}=Ws(o),m=p.tools;let u,h,d;if(e[6]!==p.tools||e[7]!==i||e[8]!==l||e[9]!==n){d=Symbol.for("react.early_return_sentinel");e:{const g=m.map(bl);let v;e[13]!==n?(v=b=>n===null||n.includes(b.name),e[13]=n,e[14]=v):v=e[14];const y=p.tools.filter(v).map(vl);if(y.length===0){let b;e[15]!==l?(b=l("virtualMcp.dependencySelectionDialog.noActiveToolsSelected"),e[15]=l,e[16]=b):b=e[16];let w;e[17]!==b?(w=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:b})}),e[17]=b,e[18]=w):w=e[18],d=w;break e}u="flex-1 overflow-auto px-4 py-3 space-y-1",h=y.map(b=>t.jsx(ln,{item:b,isSelected:!0,onToggle:()=>i(b.id,g)},b.id))}e[6]=p.tools,e[7]=i,e[8]=l,e[9]=n,e[10]=u,e[11]=h,e[12]=d}else u=e[10],h=e[11],d=e[12];if(d!==Symbol.for("react.early_return_sentinel"))return d;let x;return e[19]!==u||e[20]!==h?(x=t.jsx("div",{className:u,children:h}),e[19]=u,e[20]=h,e[21]=x):x=e[21],x}function vl(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Bs,{annotations:a.annotations,_meta:a._meta})}}function bl(a){return a.name}function jl(a){const e=Y.c(16),{connectionId:s,selections:n,onToggle:i,disabled:l}=a,{org:c}=Ae();let r;e[0]!==s||e[1]!==c.id||e[2]!==c.slug?(r={connectionId:s,orgId:c.id,orgSlug:c.slug},e[0]=s,e[1]=c.id,e[2]=c.slug,e[3]=r):r=e[3];const f=yt(r);let o;e[4]!==f?(o={client:f},e[4]=f,e[5]=o):o=e[5];const{data:p}=Ws(o);let m;e[6]!==p.tools?(m=p.tools.map(yl),e[6]=p.tools,e[7]=m):m=e[7];const u=m,h=X();let d;e[8]!==h?(d=h("virtualMcp.dependencySelectionDialog.noToolsAvailable"),e[8]=h,e[9]=d):d=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==n||e[14]!==d?(x=t.jsx(Ut,{items:u,selections:n,onToggle:i,emptyMessage:d,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=n,e[14]=d,e[15]=x):x=e[15],x}function yl(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Bs,{annotations:a.annotations,_meta:a._meta})}}function wl(a){const e=Y.c(16),{connectionId:s,selections:n,onToggle:i,disabled:l}=a,{org:c}=Ae();let r;e[0]!==s||e[1]!==c.id||e[2]!==c.slug?(r={connectionId:s,orgId:c.id,orgSlug:c.slug},e[0]=s,e[1]=c.id,e[2]=c.slug,e[3]=r):r=e[3];const f=yt(r);let o;e[4]!==f?(o={client:f},e[4]=f,e[5]=o):o=e[5];const{data:p}=gn(o);let m;e[6]!==p.resources?(m=p.resources.map(Sl),e[6]=p.resources,e[7]=m):m=e[7];const u=m,h=X();let d;e[8]!==h?(d=h("virtualMcp.dependencySelectionDialog.noResourcesAvailable"),e[8]=h,e[9]=d):d=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==n||e[14]!==d?(x=t.jsx(Ut,{items:u,selections:n,onToggle:i,emptyMessage:d,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=n,e[14]=d,e[15]=x):x=e[15],x}function Sl(a){return{id:a.name||a.uri,name:a.name||a.uri,description:a.description}}function Nl(a){const e=Y.c(16),{connectionId:s,selections:n,onToggle:i,disabled:l}=a,{org:c}=Ae();let r;e[0]!==s||e[1]!==c.id||e[2]!==c.slug?(r={connectionId:s,orgId:c.id,orgSlug:c.slug},e[0]=s,e[1]=c.id,e[2]=c.slug,e[3]=r):r=e[3];const f=yt(r);let o;e[4]!==f?(o={client:f},e[4]=f,e[5]=o):o=e[5];const{data:p}=Ai(o);let m;e[6]!==p.prompts?(m=p.prompts.map(Cl),e[6]=p.prompts,e[7]=m):m=e[7];const u=m,h=X();let d;e[8]!==h?(d=h("virtualMcp.dependencySelectionDialog.noPromptsAvailable"),e[8]=h,e[9]=d):d=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==n||e[14]!==d?(x=t.jsx(Ut,{items:u,selections:n,onToggle:i,emptyMessage:d,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=n,e[14]=d,e[15]=x):x=e[15],x}function Cl(a){return{id:a.name,name:a.name,description:a.description}}function kl(a){const e=Y.c(58),{currentConnection:s,activeTab:n,selectedId:i,formData:l,toggleTool:c,toggleResource:r,togglePrompt:f,toggleAllTools:o,toggleAllResources:p,toggleAllPrompts:m,onTabChange:u}=a,h=X(),d=l[i],x=n==="tools"?d?.tools===null:n==="resources"?d?.resources===null:n==="prompts"?d?.prompts===null:!1,g=n!=="active";let v;e[0]!==n||e[1]!==i||e[2]!==m||e[3]!==p||e[4]!==o?(v=()=>{n==="tools"?o(i):n==="resources"?p(i):n==="prompts"&&m(i)},e[0]=n,e[1]=i,e[2]=m,e[3]=p,e[4]=o,e[5]=v):v=e[5];const j=v;let y;e[6]!==s.icon||e[7]!==s.title?(y=t.jsx(jt,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=y):y=e[8];let b;e[9]!==s.title?(b=t.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let w;e[11]!==s.description?(w=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=w):w=e[12];let S;e[13]!==b||e[14]!==w?(S=t.jsxs("div",{className:"flex-1 min-w-0",children:[b,w]}),e[13]=b,e[14]=w,e[15]=S):S=e[15];let C;e[16]!==y||e[17]!==S?(C=t.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[y,S]})}),e[16]=y,e[17]=S,e[18]=C):C=e[18];let N;e[19]!==n||e[20]!==j||e[21]!==x||e[22]!==u||e[23]!==g?(N=t.jsx(hl,{activeTab:n,onTabChange:u,showSelectAll:g,isAllSelected:x,handleSelectAll:j}),e[19]=n,e[20]=j,e[21]=x,e[22]=u,e[23]=g,e[24]=N):N=e[24];let k;e[25]!==n||e[26]!==l||e[27]!==i||e[28]!==h||e[29]!==c?(k=n==="active"&&t.jsx(Xe,{fallback:ct(h("virtualMcp.dependencySelectionDialog.toolsNotSupported"),h),children:t.jsx(q.Suspense,{fallback:t.jsx(st,{}),children:t.jsx(gl,{connectionId:i,toolSelections:l[i]?l[i].tools:[],onToggleTool:(A,P)=>c(i,A,P)})})}),e[25]=n,e[26]=l,e[27]=i,e[28]=h,e[29]=c,e[30]=k):k=e[30];let V;e[31]!==n||e[32]!==l||e[33]!==i||e[34]!==h||e[35]!==c?(V=n==="tools"&&t.jsx(Xe,{fallback:ct(h("virtualMcp.dependencySelectionDialog.toolsNotSupported"),h),children:t.jsx(q.Suspense,{fallback:t.jsx(st,{}),children:t.jsx(jl,{connectionId:i,selections:l[i]?l[i].tools:[],onToggle:(A,P)=>c(i,A,P)})})}),e[31]=n,e[32]=l,e[33]=i,e[34]=h,e[35]=c,e[36]=V):V=e[36];let T;e[37]!==n||e[38]!==l||e[39]!==i||e[40]!==h||e[41]!==r?(T=n==="resources"&&t.jsx(Xe,{fallback:ct(h("virtualMcp.dependencySelectionDialog.resourcesNotSupported"),h),children:t.jsx(q.Suspense,{fallback:t.jsx(st,{}),children:t.jsx(wl,{connectionId:i,selections:l[i]?l[i].resources:[],onToggle:(A,P)=>r(i,A,P)})})}),e[37]=n,e[38]=l,e[39]=i,e[40]=h,e[41]=r,e[42]=T):T=e[42];let _;e[43]!==n||e[44]!==l||e[45]!==i||e[46]!==h||e[47]!==f?(_=n==="prompts"&&t.jsx(Xe,{fallback:ct(h("virtualMcp.dependencySelectionDialog.promptsNotSupported"),h),children:t.jsx(q.Suspense,{fallback:t.jsx(st,{}),children:t.jsx(Nl,{connectionId:i,selections:l[i]?l[i].prompts:[],onToggle:(A,P)=>f(i,A,P)})})}),e[43]=n,e[44]=l,e[45]=i,e[46]=h,e[47]=f,e[48]=_):_=e[48];let F;e[49]!==T||e[50]!==_||e[51]!==k||e[52]!==V?(F=t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[k,V,T,_]}),e[49]=T,e[50]=_,e[51]=k,e[52]=V,e[53]=F):F=e[53];let $;return e[54]!==F||e[55]!==C||e[56]!==N?($=t.jsxs(t.Fragment,{children:[C,N,F]}),e[54]=F,e[55]=C,e[56]=N,e[57]=$):$=e[57],$}function Ml(a){const e=Y.c(7),{onClose:s}=a,n=X();let i;e[0]!==s?(i=()=>s(!1),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==n?(l=n("virtualMcp.dependencySelectionDialog.done"),e[2]=n,e[3]=l):l=e[3];let c;return e[4]!==i||e[5]!==l?(c=t.jsx($t,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(Z,{variant:"outline",onClick:i,children:l})}),e[4]=i,e[5]=l,e[6]=c):c=e[6],c}function _l(a){const e=Y.c(23),{connectionId:s,onAuthenticate:n,children:i}=a,l=X();let c;e[0]!==s?(c={connectionId:s},e[0]=s,e[1]=c):c=e[1];const r=Ys(c);if(r.supportsOAuth&&!r.isAuthenticated){let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:t.jsx(mi,{size:22,className:"text-muted-foreground"})}),e[2]=p):p=e[2];let m;e[3]!==l?(m=l("virtualMcp.dependencySelectionDialog.authorizationRequired"),e[3]=l,e[4]=m):m=e[4];let u;e[5]!==m?(u=t.jsx("p",{className:"text-sm font-medium",children:m}),e[5]=m,e[6]=u):u=e[6];let h;e[7]!==l?(h=l("virtualMcp.dependencySelectionDialog.authorizationDescription"),e[7]=l,e[8]=h):h=e[8];let d;e[9]!==h?(d=t.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:h}),e[9]=h,e[10]=d):d=e[10];let x;e[11]!==u||e[12]!==d?(x=t.jsxs("div",{className:"space-y-1",children:[u,d]}),e[11]=u,e[12]=d,e[13]=x):x=e[13];let g;e[14]!==s||e[15]!==n||e[16]!==l?(g=n&&t.jsx(Z,{variant:"outline",size:"sm",onClick:()=>n(s),children:l("virtualMcp.dependencySelectionDialog.authorize")}),e[14]=s,e[15]=n,e[16]=l,e[17]=g):g=e[17];let v;return e[18]!==x||e[19]!==g?(v=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[p,x,g]}),e[18]=x,e[19]=g,e[20]=v):v=e[20],v}let o;return e[21]!==i?(o=t.jsx(t.Fragment,{children:i}),e[21]=i,e[22]=o):o=e[22],o}function Vl(a){const e={};for(const s of a)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function gs(a){return Object.entries(a).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function vs(a,e,s,n){const i=a[e]??{tools:null,resources:null,prompts:null};return{...a,[e]:{...i,[s]:n}}}function Tl(a,e){return e.type==="SET_ACTIVE_TAB"?{...a,activeTab:e.payload}:a}function Dl(a){const e=Y.c(49),{open:s,onOpenChange:n,selectedId:i,form:l,connections:c,onAuthenticate:r}=a;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={activeTab:"tools"},e[0]=f):f=e[0];const[o,p]=q.useReducer(Tl,f),m=Rt(i??"");let u;e[1]!==c?(u=c??[],e[1]=c,e[2]=u):u=e[2];let h;e[3]!==u?(h=Vl(u),e[3]=u,e[4]=h):h=e[4];const d=h;let x;e[5]!==l||e[6]!==d?(x=(E,L,G,J)=>{const ee=d[E]?.[L];let M;ee===null?M=J.filter(O=>O!==G):ee?.includes(G)?M=ee.filter(O=>O!==G):(M=[...ee??[],G],M.length===J.length&&(M=null)),l.setValue("connections",gs(vs(d,E,L,M)),{shouldDirty:!0,shouldTouch:!0})},e[5]=l,e[6]=d,e[7]=x):x=e[7];const g=x;let v;e[8]!==l||e[9]!==d?(v=(E,L)=>{const J=d[E]?.[L]===null?[]:null;l.setValue("connections",gs(vs(d,E,L,J)),{shouldDirty:!0,shouldTouch:!0})},e[8]=l,e[9]=d,e[10]=v):v=e[10];const j=v;let y;e[11]!==g?(y=(E,L,G)=>g(E,"tools",L,G),e[11]=g,e[12]=y):y=e[12];const b=y;let w;e[13]!==g?(w=(E,L,G)=>g(E,"resources",L,G),e[13]=g,e[14]=w):w=e[14];const S=w;let C;e[15]!==g?(C=(E,L,G)=>g(E,"prompts",L,G),e[15]=g,e[16]=C):C=e[16];const N=C;let k;e[17]!==j?(k=E=>j(E,"tools"),e[17]=j,e[18]=k):k=e[18];const V=k;let T;e[19]!==j?(T=E=>j(E,"resources"),e[19]=j,e[20]=T):T=e[20];const _=T;let F;e[21]!==j?(F=E=>j(E,"prompts"),e[21]=j,e[22]=F):F=e[22];const $=F;if(!i||!m)return null;let A;e[23]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(st,{}),e[23]=A):A=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=E=>p({type:"SET_ACTIVE_TAB",payload:E}),e[24]=P):P=e[24];let H;e[25]!==m||e[26]!==o.activeTab||e[27]!==d||e[28]!==i||e[29]!==$||e[30]!==_||e[31]!==V||e[32]!==N||e[33]!==S||e[34]!==b?(H=t.jsx(kl,{currentConnection:m,activeTab:o.activeTab,selectedId:i,formData:d,toggleTool:b,toggleResource:S,togglePrompt:N,toggleAllTools:V,toggleAllResources:_,toggleAllPrompts:$,onTabChange:P},i),e[25]=m,e[26]=o.activeTab,e[27]=d,e[28]=i,e[29]=$,e[30]=_,e[31]=V,e[32]=N,e[33]=S,e[34]=b,e[35]=H):H=e[35];let Q;e[36]!==r||e[37]!==i||e[38]!==H?(Q=t.jsx(q.Suspense,{fallback:A,children:t.jsx(_l,{connectionId:i,onAuthenticate:r,children:H})}),e[36]=r,e[37]=i,e[38]=H,e[39]=Q):Q=e[39];let R;e[40]!==n?(R=t.jsx(Ml,{onClose:n}),e[40]=n,e[41]=R):R=e[41];let z;e[42]!==Q||e[43]!==R?(z=t.jsxs(at,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[Q,R]}),e[42]=Q,e[43]=R,e[44]=z):z=e[44];let K;return e[45]!==n||e[46]!==s||e[47]!==z?(K=t.jsx(lt,{open:s,onOpenChange:n,children:z}),e[45]=n,e[46]=s,e[47]=z,e[48]=K):K=e[48],K}const bs="__new_instance__";function Pl(a){const e=Y.c(25),{connection_id:s,usedConnectionIds:n,onOpenSettings:i,onRemove:l,onAuthenticate:c,onSwitchInstance:r,onNewInstance:f}=a,o=Rt(s),{org:p}=Ae();if(!o){let g;return e[0]!==l?(g=t.jsx(Fl,{onRemove:l}),e[0]=l,e[1]=g):g=e[1],g}let m;e[2]!==o?(m=Ei(o),e[2]=o,e[3]=m):m=e[3];const u=m;let h;e[4]!==s?(h=t.jsx($l,{connection_id:s}),e[4]=s,e[5]=h):h=e[5];let d;e[6]!==o.app_name||e[7]!==o.connection_type||e[8]!==o.description||e[9]!==o.icon||e[10]!==o.status||e[11]!==o.title||e[12]!==s||e[13]!==c||e[14]!==f||e[15]!==i||e[16]!==l||e[17]!==r||e[18]!==p.slug||e[19]!==u||e[20]!==n?(d=t.jsx(Il,{connection_id:s,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,connectionType:o.connection_type,connectionStatus:o.status,slug:u,orgSlug:p.slug,appName:o.app_name,usedConnectionIds:n,onOpenSettings:i,onRemove:l,onAuthenticate:c,onSwitchInstance:r,onNewInstance:f}),e[6]=o.app_name,e[7]=o.connection_type,e[8]=o.description,e[9]=o.icon,e[10]=o.status,e[11]=o.title,e[12]=s,e[13]=c,e[14]=f,e[15]=i,e[16]=l,e[17]=r,e[18]=p.slug,e[19]=u,e[20]=n,e[21]=d):d=e[21];let x;return e[22]!==h||e[23]!==d?(x=t.jsx(q.Suspense,{fallback:h,children:d}),e[22]=h,e[23]=d,e[24]=x):x=e[24],x}function Ol(a){const e=Y.c(24),{appName:s,connectionId:n,usedConnectionIds:i,onSwitchInstance:l,onNewInstance:c}=a,r=X();let f;e[0]!==s?(f={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=f):f=e[1];const o=ai(f);if(o.length<=1&&!c)return null;let p;e[2]!==n||e[3]!==c||e[4]!==l?(p=g=>{g===bs?c?.():l(n,g)},e[2]=n,e[3]=c,e[4]=l,e[5]=p):p=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ee,{size:"xs",className:"w-auto gap-1 shadow-none",children:t.jsx(ze,{})}),e[6]=m):m=e[6];let u;if(e[7]!==n||e[8]!==o||e[9]!==i){let g;e[11]!==n||e[12]!==i?(g=v=>t.jsx(Se,{value:v.id,className:"text-xs",disabled:v.id!==n&&i.has(v.id),children:v.title},v.id),e[11]=n,e[12]=i,e[13]=g):g=e[13],u=o.map(g),e[7]=n,e[8]=o,e[9]=i,e[10]=u}else u=e[10];let h;e[14]!==c||e[15]!==r?(h=c&&t.jsxs(Se,{value:bs,className:"text-xs text-muted-foreground",children:["+ ",r("virtualMcp.connectionItem.newInstance")]}),e[14]=c,e[15]=r,e[16]=h):h=e[16];let d;e[17]!==u||e[18]!==h?(d=t.jsxs(Re,{children:[u,h]}),e[17]=u,e[18]=h,e[19]=d):d=e[19];let x;return e[20]!==n||e[21]!==p||e[22]!==d?(x=t.jsxs(Le,{value:n,onValueChange:p,children:[m,d]}),e[20]=n,e[21]=p,e[22]=d,e[23]=x):x=e[23],x}function Il({connection_id:a,connectionTitle:e,connectionDescription:s,connectionIcon:n,connectionType:i,connectionStatus:l,slug:c,orgSlug:r,appName:f,usedConnectionIds:o,onOpenSettings:p,onRemove:m,onAuthenticate:u,onSwitchInstance:h,onNewInstance:d}){const x=Ys({connectionId:a}),g=$s(),j=!(i==="VIRTUAL")&&x.supportsOAuth&&!x.isAuthenticated,y=l!=="active",b=X(),w=async S=>{try{await g.update.mutateAsync({id:a,data:{status:S}}),ie.success(b(S==="active"?"virtualMcp.connectionItem.connectionEnabled":"virtualMcp.connectionItem.connectionDisabled"))}catch{ie.error(b("virtualMcp.connectionItem.failedToUpdateConnection"))}};return t.jsxs("div",{className:ye("surface overflow-hidden transition-colors",(j||y)&&"shadow-edge-destructive bg-destructive/5"),children:[t.jsxs(Ft,{to:"/$org/settings/connections/$appSlug",params:{org:r,appSlug:c},className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-accent transition-colors",children:[t.jsx(jt,{icon:n,name:e,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e}),j?t.jsx("span",{className:"text-xs text-destructive font-medium",children:b("virtualMcp.connectionItem.needsAuthorization")}):y?t.jsx("span",{className:"text-xs text-destructive font-medium",children:b(l==="error"?"virtualMcp.connectionItem.disabledError":"virtualMcp.connectionItem.disabled")}):s&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s})]}),j?t.jsx(Z,{variant:"outline",size:"sm",className:"shrink-0",onClick:S=>{S.preventDefault(),S.stopPropagation(),u(a)},children:b("virtualMcp.connectionItem.authorize")}):y?t.jsxs(Z,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",onClick:S=>{S.preventDefault(),S.stopPropagation(),w("active")},children:[t.jsx(fi,{size:13}),b("virtualMcp.connectionItem.enable")]}):t.jsxs(Ve,{delayDuration:0,children:[t.jsx(Te,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:t.jsx(ci,{size:16})})}),t.jsx(De,{side:"bottom",children:b("virtualMcp.connectionItem.connectionSettings")})]})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[f&&t.jsx(Ol,{appName:f,connectionId:a,usedConnectionIds:o,onSwitchInstance:h,onNewInstance:d}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[t.jsxs(Ve,{delayDuration:0,children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{variant:"ghost",size:"icon-sm",onClick:p,"aria-label":b("virtualMcp.connectionItem.configureResources"),children:t.jsx(pi,{size:13})})}),t.jsx(De,{side:"bottom",children:b("virtualMcp.connectionItem.configureResources")})]}),!y&&t.jsxs(Ve,{delayDuration:0,children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground",onClick:()=>w("inactive"),"aria-label":b("virtualMcp.connectionItem.disableConnection"),children:t.jsx(hi,{size:13})})}),t.jsx(De,{side:"bottom",children:b("virtualMcp.connectionItem.disable")})]}),t.jsxs(Ve,{delayDuration:0,children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{variant:"ghost-destructive",size:"icon-sm",onClick:m,"aria-label":b("virtualMcp.connectionItem.removeConnection"),children:t.jsx(Ks,{size:13})})}),t.jsx(De,{side:"bottom",children:b("virtualMcp.connectionItem.remove")})]})]})]})]})}function $l(a){const e=Y.c(17),{connection_id:s}=a,n=Rt(s);if(!n){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(rn,{}),e[0]=m):m=e[0],m}let i;e[1]!==n.icon||e[2]!==n.title?(i=t.jsx(jt,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0"}),e[1]=n.icon,e[2]=n.title,e[3]=i):i=e[3];let l;e[4]!==n.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[4]=n.title,e[5]=l):l=e[5];let c;e[6]!==n.description?(c=n.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[6]=n.description,e[7]=c):c=e[7];let r;e[8]!==l||e[9]!==c?(r=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,c]}),e[8]=l,e[9]=c,e[10]=r):r=e[10];let f;e[11]!==i||e[12]!==r?(f=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i,r]}),e[11]=i,e[12]=r,e[13]=f):f=e[13];let o;e[14]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=o):o=e[14];let p;return e[15]!==f?(p=t.jsxs("div",{className:"surface overflow-hidden",children:[f,o]}),e[15]=f,e[16]=p):p=e[16],p}function Fl(a){const e=Y.c(20),{onRemove:s}=a,n=X();let i;e[0]!==n?(i=n("virtualMcp.connectionItem.connectionNotFound"),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm text-destructive font-medium truncate",children:i})}),e[2]=i,e[3]=l):l=e[3];let c;e[4]!==n?(c=n("virtualMcp.connectionItem.removeConnection"),e[4]=n,e[5]=c):c=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Ks,{size:13}),e[6]=r):r=e[6];let f;e[7]!==s||e[8]!==c?(f=t.jsx(Te,{asChild:!0,children:t.jsx(Z,{variant:"ghost-destructive",size:"icon-sm",className:"shrink-0",onClick:s,"aria-label":c,children:r})}),e[7]=s,e[8]=c,e[9]=f):f=e[9];let o;e[10]!==n?(o=n("virtualMcp.connectionItem.remove"),e[10]=n,e[11]=o):o=e[11];let p;e[12]!==o?(p=t.jsx(De,{side:"bottom",children:o}),e[12]=o,e[13]=p):p=e[13];let m;e[14]!==f||e[15]!==p?(m=t.jsxs(Ve,{delayDuration:0,children:[f,p]}),e[14]=f,e[15]=p,e[16]=m):m=e[16];let u;return e[17]!==l||e[18]!==m?(u=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-destructive/50 bg-destructive/5",children:[l,m]}),e[17]=l,e[18]=m,e[19]=u):u=e[19],u}function rn(){const a=Y.c(3);let e;a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),a[0]=e):e=a[0];let s;a[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),a[1]=s):s=a[1];let n;return a[2]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsxs("div",{className:"surface overflow-hidden",children:[s,t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),a[2]=n):n=a[2],n}function on(a){const e=Y.c(85),{value:s,onChange:n,onColorChange:i,name:l,size:c,className:r,avatarClassName:f,showHoverOverlay:o,disabled:p}=a,m=c===void 0?"lg":c,u=o===void 0?!0:o,h=p===void 0?!1:p,d=X(),[x,g]=q.useState(!1),[v,j]=q.useState("icons"),[y,b]=q.useState(""),[w,S]=q.useState("blue");let C;e[0]!==s?(C=xi(s),e[0]=s,e[1]=C):C=e[1];const N=C,k=N.type==="icon"||N.type==="url"&&N.color?N.color:w;let V;e[2]!==n||e[3]!==k?(V=he=>{n(kt(he,k))},e[2]=n,e[3]=k,e[4]=V):V=e[4];const T=V;let _;e[5]!==n||e[6]!==i||e[7]!==N.name||e[8]!==N.type||e[9]!==N.url?(_=he=>{S(he),i?.(he),N.type==="icon"?n(kt(N.name,he)):N.type==="url"&&n(es(N.url,he))},e[5]=n,e[6]=i,e[7]=N.name,e[8]=N.type,e[9]=N.url,e[10]=_):_=e[10];const F=_;let $;e[11]!==n||e[12]!==k?($=he=>{n(es(he,k)),g(!1)},e[11]=n,e[12]=k,e[13]=$):$=e[13];const A=$;let P;e[14]!==n||e[15]!==k?(P=()=>{const he=zs(),D=he[Math.floor(Math.random()*he.length)];n(kt(D,k))},e[14]=n,e[15]=k,e[16]=P):P=e[16];const H=P,Q=h?!1:x;let R;e[17]!==d?(R=d("common.iconPicker.changeIcon"),e[17]=d,e[18]=R):R=e[18];const z=h?"cursor-default opacity-50":"cursor-pointer";let K;e[19]!==r||e[20]!==m||e[21]!==z?(K=ye("relative group overflow-hidden",z,gi(m),r),e[19]=r,e[20]=m,e[21]=z,e[22]=K):K=e[22];let E;e[23]!==f||e[24]!==l||e[25]!==m||e[26]!==s?(E=t.jsx(ts,{icon:s,name:l,size:m,className:f}),e[23]=f,e[24]=l,e[25]=m,e[26]=s,e[27]=E):E=e[27];let L;e[28]!==h||e[29]!==u?(L=u&&!h&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(yi,{size:16,className:"text-white"})}),e[28]=h,e[29]=u,e[30]=L):L=e[30];let G;e[31]!==h||e[32]!==R||e[33]!==K||e[34]!==E||e[35]!==L?(G=t.jsx(Gs,{asChild:!0,children:t.jsxs("button",{type:"button","data-testid":"icon-picker-trigger","aria-label":R,disabled:h,className:K,children:[E,L]})}),e[31]=h,e[32]=R,e[33]=K,e[34]=E,e[35]=L,e[36]=G):G=e[36];let J;e[37]!==l||e[38]!==s?(J=t.jsx("div",{className:"flex items-center justify-center py-4",children:t.jsx(ts,{icon:s,name:l,size:"xl"})}),e[37]=l,e[38]=s,e[39]=J):J=e[39];let ee;e[40]!==v?(ee=he=>{if(he.key!=="ArrowLeft"&&he.key!=="ArrowRight")return;he.preventDefault();const D=v==="icons"?"upload":"icons";j(D),document.getElementById(`icon-picker-tab-${D}`)?.focus()},e[40]=v,e[41]=ee):ee=e[41];const M=v==="icons",O=v==="icons"?0:-1;let U;e[42]===Symbol.for("react.memo_cache_sentinel")?(U=()=>j("icons"),e[42]=U):U=e[42];const B=v==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let W;e[43]!==B?(W=ye("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",B),e[43]=B,e[44]=W):W=e[44];let re;e[45]!==d?(re=d("common.iconPicker.iconsTab"),e[45]=d,e[46]=re):re=e[46];let oe;e[47]!==M||e[48]!==O||e[49]!==W||e[50]!==re?(oe=t.jsx("button",{id:"icon-picker-tab-icons",type:"button",role:"tab","aria-selected":M,"aria-controls":"icon-picker-panel-icons",tabIndex:O,onClick:U,className:W,children:re}),e[47]=M,e[48]=O,e[49]=W,e[50]=re,e[51]=oe):oe=e[51];const me=v==="upload",ne=v==="upload"?0:-1;let ue;e[52]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>j("upload"),e[52]=ue):ue=e[52];const fe=v==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let pe;e[53]!==fe?(pe=ye("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",fe),e[53]=fe,e[54]=pe):pe=e[54];let ce;e[55]!==d?(ce=d("common.iconPicker.uploadTab"),e[55]=d,e[56]=ce):ce=e[56];let ge;e[57]!==me||e[58]!==ne||e[59]!==pe||e[60]!==ce?(ge=t.jsx("button",{id:"icon-picker-tab-upload",type:"button",role:"tab","aria-selected":me,"aria-controls":"icon-picker-panel-upload",tabIndex:ne,onClick:ue,className:pe,children:ce}),e[57]=me,e[58]=ne,e[59]=pe,e[60]=ce,e[61]=ge):ge=e[61];let je;e[62]===Symbol.for("react.memo_cache_sentinel")?(je=t.jsx("div",{className:"flex-1"}),e[62]=je):je=e[62];let de;e[63]!==ee||e[64]!==oe||e[65]!==ge?(de=t.jsxs("div",{role:"tablist","aria-label":"Icon source",className:"flex items-center border-b border-border px-3",onKeyDown:ee,children:[oe,ge,je]}),e[63]=ee,e[64]=oe,e[65]=ge,e[66]=de):de=e[66];let I;e[67]!==F||e[68]!==H||e[69]!==T||e[70]!==A||e[71]!==N.name||e[72]!==N.type||e[73]!==y||e[74]!==k||e[75]!==v?(I=v==="icons"?t.jsx("div",{id:"icon-picker-panel-icons",role:"tabpanel","aria-labelledby":"icon-picker-tab-icons",children:t.jsx(Rl,{search:y,onSearchChange:b,selectedColor:k,onColorChange:F,onSelectIcon:T,onRandom:H,currentIconName:N.type==="icon"?N.name:null})}):t.jsx("div",{id:"icon-picker-panel-upload",role:"tabpanel","aria-labelledby":"icon-picker-tab-upload",children:t.jsx(Ll,{onUpload:A})}),e[67]=F,e[68]=H,e[69]=T,e[70]=A,e[71]=N.name,e[72]=N.type,e[73]=y,e[74]=k,e[75]=v,e[76]=I):I=e[76];let te;e[77]!==J||e[78]!==de||e[79]!==I?(te=t.jsx(qs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:Al,children:t.jsxs("div",{className:"flex flex-col",children:[J,de,I]})}),e[77]=J,e[78]=de,e[79]=I,e[80]=te):te=e[80];let Pe;return e[81]!==G||e[82]!==te||e[83]!==Q?(Pe=t.jsxs(Hs,{open:Q,onOpenChange:g,children:[G,te]}),e[81]=G,e[82]=te,e[83]=Q,e[84]=Pe):Pe=e[84],Pe}function Al(a){return a.preventDefault()}function El(a){const e=Y.c(33),{selectedColor:s,onColorChange:n}=a,i=X(),[l,c]=q.useState(!1);let r,f,o,p,m,u,h;if(e[0]!==l||e[1]!==s){const w=Rs(s);f=Hs,u=l,h=c,r=Gs,m=!0,o="button",p=ye("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",w.dot,"ring-foreground/20"),e[0]=l,e[1]=s,e[2]=r,e[3]=f,e[4]=o,e[5]=p,e[6]=m,e[7]=u,e[8]=h}else r=e[2],f=e[3],o=e[4],p=e[5],m=e[6],u=e[7],h=e[8];let d;e[9]!==i?(d=i("common.iconPicker.changeColor"),e[9]=i,e[10]=d):d=e[10];let x;e[11]!==i?(x=i("common.iconPicker.changeColor"),e[11]=i,e[12]=x):x=e[12];let g;e[13]!==o||e[14]!==p||e[15]!==d||e[16]!==x?(g=t.jsx("button",{type:o,className:p,title:d,"aria-label":x}),e[13]=o,e[14]=p,e[15]=d,e[16]=x,e[17]=g):g=e[17];let v;e[18]!==r||e[19]!==m||e[20]!==g?(v=t.jsx(r,{asChild:m,children:g}),e[18]=r,e[19]=m,e[20]=g,e[21]=v):v=e[21];let j;e[22]!==n||e[23]!==s?(j=Si.map(w=>t.jsx("button",{type:"button",onClick:()=>{n(w.name),c(!1)},className:ye("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",w.dot,s===w.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:w.name,"aria-label":w.name},w.name)),e[22]=n,e[23]=s,e[24]=j):j=e[24];let y;e[25]!==j?(y=t.jsx(qs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:zl,children:t.jsx("div",{className:"grid grid-cols-4 gap-1",children:j})}),e[25]=j,e[26]=y):y=e[26];let b;return e[27]!==f||e[28]!==y||e[29]!==u||e[30]!==h||e[31]!==v?(b=t.jsxs(f,{open:u,onOpenChange:h,children:[v,y]}),e[27]=f,e[28]=y,e[29]=u,e[30]=h,e[31]=v,e[32]=b):b=e[32],b}function zl(a){return a.preventDefault()}function Rl(a){const e=Y.c(55),{search:s,onSearchChange:n,selectedColor:i,onColorChange:l,onSelectIcon:c,onRandom:r,currentIconName:f}=a,o=X();let p,m,u,h,d,x,g;if(e[0]!==f||e[1]!==l||e[2]!==r||e[3]!==n||e[4]!==c||e[5]!==s||e[6]!==i||e[7]!==o){const w=zs(),S=Rs(i);m=vi(w,s),x="flex flex-col";let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Dt,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[15]=C):C=e[15];let N;e[16]!==n?(N=P=>n(P.target.value),e[16]=n,e[17]=N):N=e[17];let k;e[18]!==o?(k=o("common.iconPicker.filterPlaceholder"),e[18]=o,e[19]=k):k=e[19];let V;e[20]!==s||e[21]!==N||e[22]!==k?(V=t.jsxs("div",{className:"relative flex-1",children:[C,t.jsx(Ne,{value:s,onChange:N,placeholder:k,size:"sm",className:"text-xs pl-7"})]}),e[20]=s,e[21]=N,e[22]=k,e[23]=V):V=e[23];let T;e[24]!==o?(T=o("common.iconPicker.randomIcon"),e[24]=o,e[25]=T):T=e[25];let _;e[26]!==o?(_=o("common.iconPicker.randomIcon"),e[26]=o,e[27]=_):_=e[27];let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(wi,{className:"size-3.5 text-muted-foreground"}),e[28]=F):F=e[28];let $;e[29]!==r||e[30]!==T||e[31]!==_?($=t.jsx(Z,{type:"button",variant:"outline",size:"icon",onClick:r,className:"shrink-0",title:T,"aria-label":_,children:F}),e[29]=r,e[30]=T,e[31]=_,e[32]=$):$=e[32];let A;e[33]!==l||e[34]!==i?(A=t.jsx(El,{selectedColor:i,onColorChange:l}),e[33]=l,e[34]=i,e[35]=A):A=e[35],e[36]!==$||e[37]!==A||e[38]!==V?(g=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[V,$,A]}),e[36]=$,e[37]=A,e[38]=V,e[39]=g):g=e[39],p=zi,d="h-56",u="grid grid-cols-9 gap-0.5 px-2 pb-2",h=m.map(P=>{const H=bi(P);return H?t.jsx("button",{type:"button",onClick:()=>c(P),className:ye("h-8 w-8 flex items-center justify-center rounded-lg transition-colors cursor-pointer",f===P?ye(S.bg,S.text):ye(S.text,"hover:bg-accent")),title:P,"aria-label":ji(P),children:t.jsx(H,{size:18})},P):null}),e[0]=f,e[1]=l,e[2]=r,e[3]=n,e[4]=c,e[5]=s,e[6]=i,e[7]=o,e[8]=p,e[9]=m,e[10]=u,e[11]=h,e[12]=d,e[13]=x,e[14]=g}else p=e[8],m=e[9],u=e[10],h=e[11],d=e[12],x=e[13],g=e[14];let v;e[40]!==u||e[41]!==h?(v=t.jsx("div",{className:u,children:h}),e[40]=u,e[41]=h,e[42]=v):v=e[42];let j;e[43]!==m.length||e[44]!==o?(j=m.length===0&&t.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:o("common.iconPicker.noIconsFound")}),e[43]=m.length,e[44]=o,e[45]=j):j=e[45];let y;e[46]!==p||e[47]!==d||e[48]!==v||e[49]!==j?(y=t.jsxs(p,{className:d,children:[v,j]}),e[46]=p,e[47]=d,e[48]=v,e[49]=j,e[50]=y):y=e[50];let b;return e[51]!==x||e[52]!==g||e[53]!==y?(b=t.jsxs("div",{className:x,children:[g,y]}),e[51]=x,e[52]=g,e[53]=y,e[54]=b):b=e[54],b}function Ll(a){const e=Y.c(46),{onUpload:s}=a,n=X(),i=q.useRef(null);let l;e[0]!==s||e[1]!==n?(l=$=>{const A=$.target.files?.[0];if(!A)return;if(A.size>2097152){ie.error(n("common.iconPicker.imageTooLarge")),$.target.value="";return}const P=new FileReader;P.onerror=()=>{ie.error(n("common.iconPicker.failedToReadImage")),i.current&&(i.current.value="")},P.onloadend=()=>{P.readyState===FileReader.DONE&&P.result&&s(P.result),i.current&&(i.current.value="")},P.readAsDataURL(A)},e[0]=s,e[1]=n,e[2]=l):l=e[2];const c=l,[r,f]=q.useState("");let o;e[3]!==s||e[4]!==r?(o=()=>{const $=r.trim();$&&(s($),f(""))},e[3]=s,e[4]=r,e[5]=o):o=e[5];const p=o;let m;e[6]!==c?(m=t.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:c}),e[6]=c,e[7]=m):m=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=()=>i.current?.click(),e[8]=u):u=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Ri,{size:20}),e[9]=h):h=e[9];let d;e[10]!==n?(d=n("common.iconPicker.uploadHint"),e[10]=n,e[11]=d):d=e[11];let x;e[12]!==d?(x=t.jsxs("button",{type:"button",onClick:u,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[h,t.jsx("span",{className:"text-xs",children:d})]}),e[12]=d,e[13]=x):x=e[13];let g;e[14]!==n?(g=n("common.iconPicker.or"),e[14]=n,e[15]=g):g=e[15];let v;e[16]!==g?(v=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[16]=g,e[17]=v):v=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex-1 h-px bg-border"}),e[18]=j):j=e[18];let y;e[19]!==v?(y=t.jsxs("div",{className:"flex items-center gap-2",children:[v,j]}),e[19]=v,e[20]=y):y=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=$=>f($.target.value),e[21]=b):b=e[21];let w;e[22]!==n?(w=n("common.iconPicker.pasteUrlPlaceholder"),e[22]=n,e[23]=w):w=e[23];let S;e[24]!==p?(S=$=>{$.key==="Enter"&&($.preventDefault(),p())},e[24]=p,e[25]=S):S=e[25];let C;e[26]!==r||e[27]!==w||e[28]!==S?(C=t.jsx(Ne,{value:r,onChange:b,placeholder:w,className:"h-8 text-xs flex-1",onKeyDown:S}),e[26]=r,e[27]=w,e[28]=S,e[29]=C):C=e[29];let N;e[30]!==r?(N=r.trim(),e[30]=r,e[31]=N):N=e[31];const k=!N;let V;e[32]!==n?(V=n("common.iconPicker.apply"),e[32]=n,e[33]=V):V=e[33];let T;e[34]!==p||e[35]!==k||e[36]!==V?(T=t.jsx(Z,{variant:"outline",className:"shrink-0",onClick:p,disabled:k,children:V}),e[34]=p,e[35]=k,e[36]=V,e[37]=T):T=e[37];let _;e[38]!==C||e[39]!==T?(_=t.jsxs("div",{className:"flex items-center gap-1.5",children:[C,T]}),e[38]=C,e[39]=T,e[40]=_):_=e[40];let F;return e[41]!==y||e[42]!==_||e[43]!==m||e[44]!==x?(F=t.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[m,x,y,_]}),e[41]=y,e[42]=_,e[43]=m,e[44]=x,e[45]=F):F=e[45],F}function Ul(a){const e=Y.c(14),{viewId:s}=a;if(s==="overview"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ls,{size:16}),e[0]=i):i=e[0],i}if(s==="context"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Es,{size:16}),e[1]=i):i=e[1],i}if(s==="monitor"){let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ni,{size:16}),e[2]=i):i=e[2],i}if(s==="plan"){let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ki,{size:16}),e[3]=i):i=e[3],i}if(s==="reports"){let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ci,{size:16}),e[4]=i):i=e[4],i}if(s==="board"){let i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ki,{size:16}),e[5]=i):i=e[5],i}if(s==="site-editor"){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Wi,{size:16}),e[6]=i):i=e[6],i}if(s==="assets"){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Yi,{size:16}),e[7]=i):i=e[7],i}if(s==="releases"){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Mi,{size:16}),e[8]=i):i=e[8],i}if(s==="hosting"){let i;return e[9]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(bn,{size:16}),e[9]=i):i=e[9],i}if(s==="e2e"){let i;return e[10]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_i,{size:16}),e[10]=i):i=e[10],i}if(s==="calendar"){let i;return e[11]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Li,{size:16}),e[11]=i):i=e[11],i}if(s==="experiments"){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Vi,{size:16}),e[12]=i):i=e[12],i}let n;return e[13]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Us,{size:16}),e[13]=n):n=e[13],n}function cn(a){const e=Y.c(51),{pinned:s,canSetMainView:n,onOpen:i,onTogglePin:l,onSetMainView:c}=a,r=X(),f=s?"text-foreground":"text-muted-foreground/40";let o;e[0]!==f?(o=ye("size-7",f),e[0]=f,e[1]=o):o=e[1];let p;e[2]!==s||e[3]!==r?(p=r(s?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[2]=s,e[3]=r,e[4]=p):p=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ss,{size:16}),e[5]=m):m=e[5];let u;e[6]!==l||e[7]!==s||e[8]!==o||e[9]!==p?(u=t.jsx(Te,{asChild:!0,children:t.jsx(Z,{variant:"ghost",size:"icon",className:o,"aria-label":p,"aria-pressed":s,onClick:l,children:m})}),e[6]=l,e[7]=s,e[8]=o,e[9]=p,e[10]=u):u=e[10];let h;e[11]!==s||e[12]!==r?(h=r(s?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[11]=s,e[12]=r,e[13]=h):h=e[13];let d;e[14]!==h?(d=t.jsx(De,{side:"top",children:h}),e[14]=h,e[15]=d):d=e[15];let x;e[16]!==u||e[17]!==d?(x=t.jsxs(Ve,{delayDuration:0,children:[u,d]}),e[16]=u,e[17]=d,e[18]=x):x=e[18];let g;e[19]!==r?(g=r("virtualMcp.settings.views.rowActions"),e[19]=r,e[20]=g):g=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Bi,{size:16}),e[21]=v):v=e[21];let j;e[22]!==g?(j=t.jsx(_s,{asChild:!0,children:t.jsx(Z,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":g,children:v})}),e[22]=g,e[23]=j):j=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(vn,{size:14}),e[24]=y):y=e[24];let b;e[25]!==r?(b=r("virtualMcp.settings.views.open"),e[25]=r,e[26]=b):b=e[26];let w;e[27]!==i||e[28]!==b?(w=t.jsxs(Je,{onClick:i,children:[y,b]}),e[27]=i,e[28]=b,e[29]=w):w=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(ss,{size:14}),e[30]=S):S=e[30];let C;e[31]!==s||e[32]!==r?(C=r(s?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[31]=s,e[32]=r,e[33]=C):C=e[33];let N;e[34]!==l||e[35]!==C?(N=t.jsxs(Je,{onClick:l,children:[S,C]}),e[34]=l,e[35]=C,e[36]=N):N=e[36];let k;e[37]!==n||e[38]!==c||e[39]!==r?(k=n&&t.jsxs(Je,{onClick:c,children:[t.jsx(Ls,{size:14}),r("virtualMcp.settings.views.setMainView")]}),e[37]=n,e[38]=c,e[39]=r,e[40]=k):k=e[40];let V;e[41]!==w||e[42]!==N||e[43]!==k?(V=t.jsxs(Vs,{align:"end",children:[w,N,k]}),e[41]=w,e[42]=N,e[43]=k,e[44]=V):V=e[44];let T;e[45]!==j||e[46]!==V?(T=t.jsxs(Ms,{children:[j,V]}),e[45]=j,e[46]=V,e[47]=T):T=e[47];let _;return e[48]!==T||e[49]!==x?(_=t.jsxs("div",{className:"flex items-center gap-1",children:[x,T]}),e[48]=T,e[49]=x,e[50]=_):_=e[50],_}const js=a=>a.stopPropagation();function Bl(a){const e=Y.c(8),{icon:s,title:n}=a;let i;e[0]!==s||e[1]!==n?(i=t.jsx(jt,{icon:s,name:n,size:"xs",className:"shrink-0"}),e[0]=s,e[1]=n,e[2]=i):i=e[2];let l;e[3]!==n?(l=t.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==i||e[6]!==l?(c=t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 bg-muted/30",children:[i,l]}),e[5]=i,e[6]=l,e[7]=c):c=e[7],c}function Yl(a){const e=Y.c(42),{views:s,viewId:n}=a;let i;e[0]!==n||e[1]!==s?(i=s.pinned(n),e[0]=n,e[1]=s,e[2]=i):i=e[2];const l=i;let c;e[3]!==n?(c=t.jsx(Ul,{viewId:n}),e[3]=n,e[4]=c):c=e[4];const r=s.labels[n];let f;e[5]!==n||e[6]!==s?(f=()=>s.openView(n),e[5]=n,e[6]=s,e[7]=f):f=e[7];let o;e[8]!==l||e[9]!==n||e[10]!==s?(o=l&&s.canBeMainView(n)&&!s.isMainView(n),e[8]=l,e[9]=n,e[10]=s,e[11]=o):o=e[11];let p;e[12]!==n||e[13]!==s?(p=()=>s.openView(n),e[12]=n,e[13]=s,e[14]=p):p=e[14];let m;e[15]!==l||e[16]!==n||e[17]!==s?(m=()=>s.togglePin(n,!l),e[15]=l,e[16]=n,e[17]=s,e[18]=m):m=e[18];let u;e[19]!==n||e[20]!==s?(u=()=>s.setMainView(n),e[19]=n,e[20]=s,e[21]=u):u=e[21];let h;e[22]!==l||e[23]!==o||e[24]!==p||e[25]!==m||e[26]!==u?(h=t.jsx(cn,{pinned:l,canSetMainView:o,onOpen:p,onTogglePin:m,onSetMainView:u}),e[22]=l,e[23]=o,e[24]=p,e[25]=m,e[26]=u,e[27]=h):h=e[27];let d;e[28]!==n||e[29]!==s?(d=()=>s.openView(n),e[28]=n,e[29]=s,e[30]=d):d=e[30];let x;e[31]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Ds,{size:16}),e[31]=x):x=e[31];let g;e[32]!==d?(g=t.jsx("span",{onClick:d,className:"flex cursor-pointer items-center text-muted-foreground",children:x}),e[32]=d,e[33]=g):g=e[33];let v;e[34]!==g||e[35]!==h?(v=t.jsxs("div",{className:"flex items-center gap-1",children:[h,g]}),e[34]=g,e[35]=h,e[36]=v):v=e[36];let j;return e[37]!==v||e[38]!==c||e[39]!==r||e[40]!==f?(j=t.jsx($e,{icon:c,title:r,onClick:f,action:v}),e[37]=v,e[38]=c,e[39]=r,e[40]=f,e[41]=j):j=e[41],j}function Wl(a){const e=Y.c(75),{views:s}=a,n=X();let i;e[0]!==n?(i=n("virtualMcp.settings.views.defaults"),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==n?(l=n("virtualMcp.layoutTabContent.mainView"),e[2]=n,e[3]=l):l=e[3];let c;e[4]!==n?(c=n("virtualMcp.layoutTabContent.mainViewDescription"),e[4]=n,e[5]=c):c=e[5];const r=s.noMainView?"none":"set",f=s.noMainView?void 0:s.defaultMainView,o=s.setMainView;let p;e[6]!==n?(p=n("virtualMcp.layoutTabContent.mainView"),e[6]=n,e[7]=p):p=e[7];let m;e[8]!==n?(m=n("virtualMcp.layoutTabContent.noMainView"),e[8]=n,e[9]=m):m=e[9];let u;e[10]!==m?(u=t.jsx(ze,{placeholder:m}),e[10]=m,e[11]=u):u=e[11];let h;e[12]!==p||e[13]!==u?(h=t.jsx(Ee,{"aria-label":p,size:"sm",className:"w-36 shrink-0 @min-xl/project-settings:w-44",children:u}),e[12]=p,e[13]=u,e[14]=h):h=e[14];let d;e[15]!==s.defaultMainOptions?(d=s.defaultMainOptions.map(Kl),e[15]=s.defaultMainOptions,e[16]=d):d=e[16];let x;e[17]!==d?(x=t.jsx(Re,{children:d}),e[17]=d,e[18]=x):x=e[18];let g;e[19]!==h||e[20]!==x||e[21]!==r||e[22]!==f||e[23]!==s.setMainView?(g=t.jsxs(Le,{value:f,onValueChange:o,children:[h,x]},r),e[19]=h,e[20]=x,e[21]=r,e[22]=f,e[23]=s.setMainView,e[24]=g):g=e[24];let v;e[25]!==g||e[26]!==l||e[27]!==c?(v=t.jsx($e,{title:l,description:c,action:g}),e[25]=g,e[26]=l,e[27]=c,e[28]=v):v=e[28];let j;e[29]!==n?(j=n("virtualMcp.layoutTabContent.showChat"),e[29]=n,e[30]=j):j=e[30];let y;e[31]!==n?(y=n("virtualMcp.layoutTabContent.showChatDescription"),e[31]=n,e[32]=y):y=e[32];let b;e[33]!==n?(b=n("virtualMcp.layoutTabContent.showChat"),e[33]=n,e[34]=b):b=e[34];const w=s.noMainView?!0:s.chatDefaultOpen;let S;e[35]!==b||e[36]!==w||e[37]!==s.noMainView||e[38]!==s.setChatDefaultOpen?(S=t.jsx(Te,{asChild:!0,children:t.jsx("span",{className:"shrink-0",children:t.jsx(et,{"aria-label":b,checked:w,disabled:s.noMainView,onCheckedChange:s.setChatDefaultOpen})})}),e[35]=b,e[36]=w,e[37]=s.noMainView,e[38]=s.setChatDefaultOpen,e[39]=S):S=e[39];let C;e[40]!==n||e[41]!==s.noMainView?(C=s.noMainView&&t.jsx(De,{side:"top",children:n("virtualMcp.layoutTabContent.chatAlwaysShown")}),e[40]=n,e[41]=s.noMainView,e[42]=C):C=e[42];let N;e[43]!==S||e[44]!==C?(N=t.jsxs(Ve,{delayDuration:0,children:[S,C]}),e[43]=S,e[44]=C,e[45]=N):N=e[45];let k;e[46]!==j||e[47]!==y||e[48]!==N?(k=t.jsx($e,{title:j,description:y,action:N}),e[46]=j,e[47]=y,e[48]=N,e[49]=k):k=e[49];let V;e[50]!==v||e[51]!==k?(V=t.jsxs(ke,{children:[v,k]}),e[50]=v,e[51]=k,e[52]=V):V=e[52];let T;e[53]!==i||e[54]!==V?(T=t.jsx(Oe,{title:i,children:V}),e[53]=i,e[54]=V,e[55]=T):T=e[55];let _;e[56]!==n?(_=n("virtualMcp.settings.views.sidebar"),e[56]=n,e[57]=_):_=e[57];let F;e[58]!==s.navViews||e[59]!==s.projectViews?(F=[...s.navViews,...s.projectViews],e[58]=s.navViews,e[59]=s.projectViews,e[60]=F):F=e[60];let $;e[61]!==F||e[62]!==s?($=F.map(R=>t.jsx(Yl,{views:s,viewId:R},R)),e[61]=F,e[62]=s,e[63]=$):$=e[63];let A;e[64]!==s?(A=s.connectionsData.flatMap(R=>[t.jsx(Bl,{icon:R.icon,title:R.title},`${R.id}:header`),...R.uiTools.map(z=>{const K=s.pinnedAppViews.find(J=>J.connectionId===R.id&&J.toolName===z.name),E=!!K,L=jn(R.id,z.name),G=`ext-apps:${R.id}:${z.name}`;return t.jsx($e,{onClick:()=>s.openView(L),icon:E?t.jsx("span",{onClick:js,children:t.jsx(on,{value:K.icon??null,name:K.label||z.name,size:"xs",showHoverOverlay:!1,onChange:J=>s.setAppViewIcon(R.id,z.name,J)})}):t.jsx(Us,{size:16}),title:E?t.jsx("span",{onClick:js,children:t.jsx(Ne,{value:K.label,onChange:J=>s.setAppViewLabel(R.id,z.name,J.target.value),onBlur:s.commitAppViewLabel,"aria-label":z.title??Pt(z.name),className:"h-7 w-full max-w-52 text-sm"})}):z.title??Pt(z.name),action:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(cn,{pinned:E,canSetMainView:E&&!s.isMainView(G),onOpen:()=>s.openView(L),onTogglePin:()=>s.toggleAppViewPin(R.id,z.name),onSetMainView:()=>s.setMainView(G)}),t.jsx("span",{onClick:()=>s.openView(L),className:"flex cursor-pointer items-center text-muted-foreground",children:t.jsx(Ds,{size:16})})]})},`${R.id}:${z.name}`)})]),e[64]=s,e[65]=A):A=e[65];let P;e[66]!==$||e[67]!==A?(P=t.jsxs(ke,{children:[$,A]}),e[66]=$,e[67]=A,e[68]=P):P=e[68];let H;e[69]!==_||e[70]!==P?(H=t.jsx(Oe,{title:_,children:P}),e[69]=_,e[70]=P,e[71]=H):H=e[71];let Q;return e[72]!==T||e[73]!==H?(Q=t.jsxs(t.Fragment,{children:[T,H]}),e[72]=T,e[73]=H,e[74]=Q):Q=e[74],Q}function Kl(a){return t.jsx(Se,{value:a.value,children:a.label},a.value)}const dn="site-editor",un={context:Ct.library,monitor:Ct.monitoring,plan:Ct.plan};function ys(a){return Object.hasOwn(un,a)}const Gl=new Set([dn,"content"]);function ql({virtualMcpId:a,form:e,flushAndSave:s}){const n=X(),i=ft(),{openPanel:l}=Hi(),c=pt(),{org:r}=Ae(),f=Fs(a),o=Qi(f),p=Xs(a),m=ia(a),u=(f?.connections??[]).map(M=>M.connection_id).sort(),{data:h}=Ps({queryKey:At.projectConnectionDetails(a,u),enabled:u.length>0,queryFn:async()=>await Promise.all(u.map(async O=>{try{const{item:U}=await i.call("COLLECTION_CONNECTIONS_GET",{id:O}),B=(U?.tools??[]).flatMap(W=>{const re=Gi(W._meta);return re?[{name:W.name,title:W.title,description:W.description,resourceUri:re}]:[]});return{fetchOk:!0,id:O,title:U?.title??O,icon:U?.icon??null,uiTools:B}}catch{return{fetchOk:!1,id:O,title:O,icon:null,uiTools:[]}}}))}),d=(h??[]).filter(M=>M.uiTools.length>0),x=new Set([...yn,...wn]),g=e.watch("metadata.ui.pinnedViews")??[],v=e.watch("metadata.ui.layout")??null,j=v?.defaultMainView??null,y=v?.chatDefaultOpen??!0,b=Qs(f?.metadata),w=Xi(b,o.presence),S=e.watch("metadata.sidebarViewsSeen"),C=Ot(It({sidebarViews:e.watch("metadata.sidebarViews"),ui:{layout:v}}),e.watch("metadata.sidebarViewsVersion"),is(S,w)),N=m??(f?Ot(It(f.metadata),f.metadata.sidebarViewsVersion,is(f.metadata.sidebarViewsSeen,w)):C),k=(()=>{if(!j||j.type==="chat")return"";const M=Sn(j.type);return M==="instructions"||M==="connections"||M==="layout"?"settings":Gl.has(M)?dn:x.has(M)?M:`${M}:${j.id??""}:${j.toolName??""}`})(),V=k==="",T=M=>{const[O,U,B]=M.split(":");return O?x.has(O)?{type:O}:O==="ext-apps"&&U?{type:"ext-apps",id:U,toolName:B||void 0}:null:null},_=M=>{e.setValue("metadata.ui.pinnedViews",M,{shouldDirty:!0})},F=M=>{e.setValue("metadata.ui.layout",{...v,...M},{shouldDirty:!0})},$=q.useRef(!1);if(h&&h.length>0&&!$.current){$.current=!0;const M=new Set((h??[]).filter(W=>W.fetchOk).map(W=>W.id)),O=new Set(d.flatMap(W=>W.uiTools.map(re=>`${W.id}:${re.name}`))),U=new Set(u),B=g.filter(W=>U.has(W.connectionId)&&(!M.has(W.connectionId)||O.has(`${W.connectionId}:${W.toolName}`)));B.length!==g.length&&(_(B),j?.type==="ext-apps"&&!B.some(W=>W.connectionId===j.id&&W.toolName===j.toolName)&&F({defaultMainView:{type:"settings"}}))}const A=(M,O)=>{if(g.some(B=>B.connectionId===M&&B.toolName===O)){const B=g.filter(re=>!(re.connectionId===M&&re.toolName===O));_(B);const W=`ext-apps:${M}:${O}`;k===W&&F({defaultMainView:{type:"settings"}})}else{const B=d.find(W=>W.id===M)?.uiTools.find(W=>W.name===O)?.title;_([...g,{connectionId:M,toolName:O,label:B??Pt(O),icon:null}])}s()},P=(M,O,U)=>{_(g.map(B=>B.connectionId===M&&B.toolName===O?{...B,label:U}:B))},H=()=>{s()},Q=(M,O,U)=>{_(g.map(B=>B.connectionId===M&&B.toolName===O?{...B,icon:U}:B)),s()},R=M=>{F({defaultMainView:T(M)}),s()},z=(M,O)=>{const U=ea(N,M,O,1);e.setValue("metadata.sidebarViews",U,{shouldDirty:!0}),e.setValue("metadata.sidebarViewsVersion",1,{shouldDirty:!0}),e.setValue("metadata.sidebarViewsSeen",ta(f?.metadata.sidebarViewsSeen??S,w,U),{shouldDirty:!0}),p.stage(U,N);const B=sa(j,M,O);B!==j&&F({defaultMainView:B})},K=Ji(w),E=Zi(N,w,1),L={overview:n("sidebar.navDestinations.overview"),context:n("sidebar.navDestinations.context"),monitor:n("sidebar.navDestinations.monitor"),plan:n("sidebar.navDestinations.plan"),reports:n("sidebar.navDestinations.reports"),board:n("sidebar.navDestinations.spineTasks"),"site-editor":n("virtualMcp.layoutTabContent.siteEditor"),blog:n("sidebar.projectNav.blog"),assets:n("common.mainPanelTabs.assets"),releases:n("common.mainPanelTabs.releases"),hosting:n("common.mainPanelTabs.hosting"),e2e:n("common.mainPanelTabs.e2e"),automations:n("virtualMcp.layoutTabContent.automations"),calendar:n("common.mainPanelTabs.calendar"),experiments:n("common.mainPanelTabs.experiments")},G=[{value:"overview",label:n("sidebar.navDestinations.overview")}];for(const M of E)M!=="automations"&&M!=="overview"&&(ys(M)||G.push({value:M,label:L[M]}));for(const M of g)G.push({value:`ext-apps:${M.connectionId}:${M.toolName}`,label:M.label||M.toolName});E.includes("automations")&&G.push({value:"automations",label:L.automations}),G.push({value:"settings",label:n("virtualMcp.layoutTabContent.settings")});const J=M=>{if(ys(M)){c({to:un[M],params:{org:r.slug,agentId:a}});return}l(M,{virtualmcpid:a})},ee=new Set(as);return{navViews:as,projectViews:K.filter(M=>!ee.has(M)),labels:L,pinned:M=>N.includes(M),isMainView:M=>k===M,canBeMainView:M=>G.some(O=>O.value===M),defaultMainView:k,defaultMainOptions:G,noMainView:V,chatDefaultOpen:y,connectionsData:d,pinnedAppViews:g,openView:J,togglePin:(M,O)=>z(M,O),setMainView:R,setChatDefaultOpen:M=>{F({chatDefaultOpen:M}),s()},toggleAppViewPin:A,setAppViewIcon:Q,setAppViewLabel:P,commitAppViewLabel:H}}function Hl(a){const e=Y.c(25),{form:s,onCommit:n}=a,i=X(),l=q.useId(),c=ca();let r;e[0]!==i?(r=i("virtualMcp.settings.assetStorage.label"),e[0]=i,e[1]=r):r=e[1];let f;e[2]!==l||e[3]!==r?(f=t.jsx("label",{htmlFor:l,className:"text-sm font-medium",children:r}),e[2]=l,e[3]=r,e[4]=f):f=e[4];let o;e[5]!==i?(o=i("virtualMcp.settings.assetStorage.description"),e[5]=i,e[6]=o):o=e[6];let p;e[7]!==o?(p=t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o}),e[7]=o,e[8]=p):p=e[8];let m;e[9]!==f||e[10]!==p?(m=t.jsxs("div",{children:[f,p]}),e[9]=f,e[10]=p,e[11]=m):m=e[11];let u;e[12]!==c.data||e[13]!==c.isError||e[14]!==c.isSuccess||e[15]!==l||e[16]!==n||e[17]!==i?(u=x=>{const{field:g}=x,v=!!g.value&&c.isSuccess&&!c.data.configs.some(j=>j.id===g.value);return t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs(Le,{value:g.value??"automatic",disabled:!c.isSuccess,onValueChange:j=>{g.onChange(j==="automatic"?null:j),n()},children:[t.jsx(Ee,{id:l,className:"w-full [&_[data-slot=select-value]]:block [&_[data-slot=select-value]]:truncate",children:t.jsx(ze,{placeholder:i("virtualMcp.settings.assetStorage.loading")})}),t.jsxs(Re,{children:[t.jsx(Se,{value:"automatic",children:i("virtualMcp.settings.assetStorage.automatic")}),v&&t.jsx(Se,{value:g.value,disabled:!0,children:i("virtualMcp.settings.assetStorage.missing")}),c.data?.configs.map(Ql)]})]}),c.isError&&t.jsx("p",{className:"text-xs text-destructive",children:i("virtualMcp.settings.assetStorage.loadError")})]})},e[12]=c.data,e[13]=c.isError,e[14]=c.isSuccess,e[15]=l,e[16]=n,e[17]=i,e[18]=u):u=e[18];let h;e[19]!==s.control||e[20]!==u?(h=t.jsx(xe,{name:"metadata.assetStorageConfigId",control:s.control,render:u}),e[19]=s.control,e[20]=u,e[21]=h):h=e[21];let d;return e[22]!==m||e[23]!==h?(d=t.jsx(ke,{children:t.jsxs(be,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[m,h]})}),e[22]=m,e[23]=h,e[24]=d):d=e[24],d}function Ql(a){return t.jsx(Se,{value:a.id,children:a.name},a.id)}function Xl(a){const e=Y.c(55),{form:s,onCommit:n}=a,i=X(),l=q.useId();let c;e[0]!==i?(c=i("virtualMcp.settings.identity.icon"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==c?(r=t.jsx("p",{className:"text-sm font-medium",children:c}),e[2]=c,e[3]=r):r=e[3];let f;e[4]!==i?(f=i("virtualMcp.settings.identity.iconDescription"),e[4]=i,e[5]=f):f=e[5];let o;e[6]!==f?(o=t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:f}),e[6]=f,e[7]=o):o=e[7];let p;e[8]!==r||e[9]!==o?(p=t.jsxs("div",{children:[r,o]}),e[8]=r,e[9]=o,e[10]=p):p=e[10];let m;e[11]!==s||e[12]!==n||e[13]!==i?(m=T=>{const{field:_}=T;return t.jsx("div",{className:"justify-self-start",children:t.jsx(on,{value:_.value??null,onChange:F=>{_.onChange(F),n()},onColorChange:F=>{s.setValue("metadata.ui.themeColor",F,{shouldDirty:!0}),n()},name:s.watch("title")||i("virtualMcp.virtualMcp.agentNameFallback"),size:"md",avatarClassName:"[&_svg]:w-1/2 [&_svg]:h-1/2"})})},e[11]=s,e[12]=n,e[13]=i,e[14]=m):m=e[14];let u;e[15]!==s.control||e[16]!==m?(u=t.jsx(xe,{name:"icon",control:s.control,render:m}),e[15]=s.control,e[16]=m,e[17]=u):u=e[17];let h;e[18]!==p||e[19]!==u?(h=t.jsxs(be,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[p,u]}),e[18]=p,e[19]=u,e[20]=h):h=e[20];const d=`${l}-name`;let x;e[21]!==i?(x=i("virtualMcp.settings.identity.name"),e[21]=i,e[22]=x):x=e[22];let g;e[23]!==x||e[24]!==d?(g=t.jsx("label",{htmlFor:d,className:"text-sm font-medium",children:x}),e[23]=x,e[24]=d,e[25]=g):g=e[25];let v;e[26]!==l||e[27]!==n||e[28]!==i?(v=T=>{const{field:_}=T;return t.jsx(Ne,{..._,id:`${l}-name`,value:_.value??"",onBlur:()=>{_.onBlur(),n()},placeholder:i("virtualMcp.virtualMcp.agentNamePlaceholder")})},e[26]=l,e[27]=n,e[28]=i,e[29]=v):v=e[29];let j;e[30]!==s.control||e[31]!==v?(j=t.jsx(xe,{name:"title",control:s.control,render:v}),e[30]=s.control,e[31]=v,e[32]=j):j=e[32];let y;e[33]!==g||e[34]!==j?(y=t.jsxs(be,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[g,j]}),e[33]=g,e[34]=j,e[35]=y):y=e[35];const b=`${l}-description`;let w;e[36]!==i?(w=i("virtualMcp.settings.identity.description"),e[36]=i,e[37]=w):w=e[37];let S;e[38]!==b||e[39]!==w?(S=t.jsx("label",{htmlFor:b,className:"text-sm font-medium",children:w}),e[38]=b,e[39]=w,e[40]=S):S=e[40];let C;e[41]!==l||e[42]!==n||e[43]!==i?(C=T=>{const{field:_}=T;return t.jsx(ut,{..._,id:`${l}-description`,value:_.value??"",onBlur:()=>{_.onBlur(),n()},placeholder:i("virtualMcp.virtualMcp.descriptionPlaceholder"),className:"min-h-24 resize-y"})},e[41]=l,e[42]=n,e[43]=i,e[44]=C):C=e[44];let N;e[45]!==s.control||e[46]!==C?(N=t.jsx(xe,{name:"description",control:s.control,render:C}),e[45]=s.control,e[46]=C,e[47]=N):N=e[47];let k;e[48]!==S||e[49]!==N?(k=t.jsxs(be,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[S,N]}),e[48]=S,e[49]=N,e[50]=k):k=e[50];let V;return e[51]!==y||e[52]!==k||e[53]!==h?(V=t.jsxs(ke,{children:[h,y,k]}),e[51]=y,e[52]=k,e[53]=h,e[54]=V):V=e[54],V}function Jl(a){const e=Y.c(8),{section:s}=a,n=X();let i;e[0]!==n?(i=n("virtualMcp.settings.navigation"),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==s||e[3]!==n?(l=da.map(r=>{const{titleKey:f}=ua[r];return t.jsx(Ke.Tab,{active:s===r,asChild:!0,children:t.jsx(Ft,{to:".",activeOptions:{exact:!0,explicitUndefined:!0},search:o=>({...o,section:r==="general"?void 0:r}),children:n(f)})},r)}),e[2]=s,e[3]=n,e[4]=l):l=e[4];let c;if(e[5]!==i||e[6]!==l){const r=t.jsx(Ke.Tabs,{"aria-label":i,children:l});c=t.jsx(Nn.Toolbar.Left.Portal,{fallback:r,children:r}),e[5]=i,e[6]=l,e[7]=c}else c=e[7];return c}function Zl(){const a=Y.c(8),e=pt();let s;a[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},a[0]=s):s=a[0];const{section:n}=Cn(s);let i;a[1]!==n?(i=ma(n)?n:"general",a[1]=n,a[2]=i):i=a[2];let l;a[3]!==e?(l=r=>e({to:".",search:f=>({...f,section:r??void 0})}),a[3]=e,a[4]=l):l=a[4];let c;return a[5]!==i||a[6]!==l?(c={section:i,openSection:l},a[5]=i,a[6]=l,a[7]=c):c=a[7],c}function mn(a){const e=Y.c(20),{value:s,label:n,copiedLabel:i,variant:l,size:c,className:r,copiedClassName:f}=a,o=l===void 0?"ghost":l,p=c===void 0?"icon-sm":c,{handleCopy:m,copied:u}=fa();let h;e[0]!==m||e[1]!==s?(h=()=>{m(s).catch(er)},e[0]=m,e[1]=s,e[2]=h):h=e[2];const d=u&&f;let x;e[3]!==r||e[4]!==d?(x=ye(r,d),e[3]=r,e[4]=d,e[5]=x):x=e[5];let g;e[6]!==u?(g=u?t.jsx(rt,{className:"text-success"}):t.jsx(bt,{}),e[6]=u,e[7]=g):g=e[7];let v;e[8]!==n||e[9]!==p||e[10]!==h||e[11]!==x||e[12]!==g||e[13]!==o?(v=t.jsx(Z,{type:"button",variant:o,size:p,"aria-label":n,onClick:h,className:x,children:g}),e[8]=n,e[9]=p,e[10]=h,e[11]=x,e[12]=g,e[13]=o,e[14]=v):v=e[14];const j=u?i:"";let y;e[15]!==j?(y=t.jsx("span",{className:"sr-only","aria-live":"polite",children:j}),e[15]=j,e[16]=y):y=e[16];let b;return e[17]!==v||e[18]!==y?(b=t.jsxs(t.Fragment,{children:[v,y]}),e[17]=v,e[18]=y,e[19]=b):b=e[19],b}function er(){}function tr(a){const e=Y.c(14),{id:s,value:n,copyLabel:i,copiedLabel:l,className:c}=a;let r;e[0]!==c?(r=ye("relative h-fit",c),e[0]=c,e[1]=r):r=e[1];let f;e[2]!==s||e[3]!==n?(f=t.jsx(Ne,{id:s,value:n,readOnly:!0,className:"pr-10 font-mono"}),e[2]=s,e[3]=n,e[4]=f):f=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=ye("absolute top-1/2 right-1 -translate-y-1/2 transition-opacity","opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100"),e[5]=o):o=e[5];let p;e[6]!==l||e[7]!==i||e[8]!==n?(p=t.jsx(mn,{value:n,label:i,copiedLabel:l,className:o,copiedClassName:"opacity-100"}),e[6]=l,e[7]=i,e[8]=n,e[9]=p):p=e[9];let m;return e[10]!==r||e[11]!==f||e[12]!==p?(m=t.jsxs("div",{className:r,children:[f,p]}),e[10]=r,e[11]=f,e[12]=p,e[13]=m):m=e[13],m}function sr(a){const e=Y.c(106),{orgSlug:s,virtualMcpId:n,site:i}=a,l=X(),c=Et();let r;e[0]!==s||e[1]!==n?(r=At.hostedSiteTokens(s,n),e[0]=s,e[1]=n,e[2]=r):r=e[2];const f=r,[o,p]=q.useState(null),m=q.useId();let u;e[3]!==i?(u=async()=>Qt(i,"site-tokens"),e[3]=i,e[4]=u):u=e[4];let h;e[5]!==f||e[6]!==u?(h={queryKey:f,queryFn:u},e[5]=f,e[6]=u,e[7]=h):h=e[7];const d=Ps(h);let x;e[8]!==i?(x=async()=>Qt(i,"site-tokens",{method:"POST"}),e[8]=i,e[9]=x):x=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=de=>{const{token:I}=de;return p(I)},e[10]=g):g=e[10];let v;e[11]!==f||e[12]!==c?(v=()=>c.invalidateQueries({queryKey:f}),e[11]=f,e[12]=c,e[13]=v):v=e[13];let j;e[14]!==x||e[15]!==v?(j={mutationFn:x,onSuccess:g,onError:nr,onSettled:v},e[14]=x,e[15]=v,e[16]=j):j=e[16];const y=Os(j);let b;e[17]!==d.data?.tokens?(b=d.data?.tokens??[],e[17]=d.data?.tokens,e[18]=b):b=e[18];const w=b,S=d.data?.site;let C;e[19]!==l?(C=l("siteTokens.title"),e[19]=l,e[20]=C):C=e[20];let N;e[21]!==l?(N=l("siteTokens.description"),e[21]=l,e[22]=N):N=e[22];let k;e[23]!==l?(k=l("siteTokens.siteId"),e[23]=l,e[24]=k):k=e[24];let V;e[25]!==m||e[26]!==k?(V=t.jsx("label",{htmlFor:m,className:"text-sm font-medium",children:k}),e[25]=m,e[26]=k,e[27]=V):V=e[27];let T;e[28]!==l?(T=l("siteTokens.siteIdDescription"),e[28]=l,e[29]=T):T=e[29];let _;e[30]!==T?(_=t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:T}),e[30]=T,e[31]=_):_=e[31];let F;e[32]!==S||e[33]!==m||e[34]!==l?(F=S?t.jsx(tr,{id:m,value:S,copyLabel:l("siteTokens.copySiteId"),copiedLabel:l("siteTokens.siteIdCopied"),className:"min-w-0 flex-1"}):t.jsx("p",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:"—"}),e[32]=S,e[33]=m,e[34]=l,e[35]=F):F=e[35];const $=!d.data||y.isPending;let A;e[36]!==y?(A=()=>y.mutate(),e[36]=y,e[37]=A):A=e[37];let P;e[38]!==y.isPending?(P=y.isPending?t.jsx(it,{className:"size-3.5"}):t.jsx(Be,{size:14}),e[38]=y.isPending,e[39]=P):P=e[39];let H;e[40]!==l?(H=l("siteTokens.issue"),e[40]=l,e[41]=H):H=e[41];let Q;e[42]!==$||e[43]!==A||e[44]!==P||e[45]!==H?(Q=t.jsxs(Z,{type:"button",size:"sm",className:"shrink-0",disabled:$,onClick:A,children:[P,H]}),e[42]=$,e[43]=A,e[44]=P,e[45]=H,e[46]=Q):Q=e[46];let R;e[47]!==F||e[48]!==Q?(R=t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[F,Q]}),e[47]=F,e[48]=Q,e[49]=R):R=e[49];let z;e[50]!==V||e[51]!==_||e[52]!==R?(z=t.jsxs(be,{className:"group",children:[V,_,R]}),e[50]=V,e[51]=_,e[52]=R,e[53]=z):z=e[53];let K;e[54]!==d.error||e[55]!==d.isError?(K=d.isError?t.jsx(be,{children:t.jsx("p",{className:"text-xs text-destructive",children:d.error.message})}):null,e[54]=d.error,e[55]=d.isError,e[56]=K):K=e[56];let E;if(e[57]!==l||e[58]!==w){let de;e[60]!==l?(de=I=>t.jsx(be,{children:t.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[t.jsx(Lt,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate font-mono text-xs",children:I.kid}),t.jsx("p",{className:"text-xs text-muted-foreground",children:l("siteTokens.issuedAgo",{when:kn(new Date(I.iat*1e3))})})]})]})},I.kid),e[60]=l,e[61]=de):de=e[61],E=w.map(de),e[57]=l,e[58]=w,e[59]=E}else E=e[59];let L;e[62]!==z||e[63]!==K||e[64]!==E?(L=t.jsxs(ke,{children:[z,K,E]}),e[62]=z,e[63]=K,e[64]=E,e[65]=L):L=e[65];const G=o!==null;let J;e[66]===Symbol.for("react.memo_cache_sentinel")?(J=de=>!de&&p(null),e[66]=J):J=e[66];let ee;e[67]!==l?(ee=l("siteTokens.createdTitle"),e[67]=l,e[68]=ee):ee=e[68];let M;e[69]!==ee?(M=t.jsx(ht,{children:ee}),e[69]=ee,e[70]=M):M=e[70];let O;e[71]!==l?(O=l("siteTokens.createdDescription"),e[71]=l,e[72]=O):O=e[72];let U;e[73]!==O?(U=t.jsx(Is,{children:O}),e[73]=O,e[74]=U):U=e[74];let B;e[75]!==M||e[76]!==U?(B=t.jsxs(xt,{children:[M,U]}),e[75]=M,e[76]=U,e[77]=B):B=e[77];let W;e[78]!==l?(W=l("siteTokens.createdTitle"),e[78]=l,e[79]=W):W=e[79];const re=o??"";let oe;e[80]!==W||e[81]!==re?(oe=t.jsx(Ne,{readOnly:!0,"aria-label":W,value:re,className:"font-mono text-xs"}),e[80]=W,e[81]=re,e[82]=oe):oe=e[82];let me;e[83]!==o||e[84]!==l?(me=o?t.jsx(mn,{value:o,label:l("siteTokens.copy"),copiedLabel:l("siteTokens.copied"),variant:"outline",size:"icon",className:"shrink-0"}):null,e[83]=o,e[84]=l,e[85]=me):me=e[85];let ne;e[86]!==oe||e[87]!==me?(ne=t.jsxs("div",{className:"flex items-center gap-2",children:[oe,me]}),e[86]=oe,e[87]=me,e[88]=ne):ne=e[88];let ue;e[89]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>p(null),e[89]=ue):ue=e[89];let fe;e[90]!==l?(fe=l("siteTokens.done"),e[90]=l,e[91]=fe):fe=e[91];let pe;e[92]!==fe?(pe=t.jsx($t,{children:t.jsx(Z,{onClick:ue,children:fe})}),e[92]=fe,e[93]=pe):pe=e[93];let ce;e[94]!==B||e[95]!==ne||e[96]!==pe?(ce=t.jsxs(at,{className:"sm:max-w-lg",children:[B,ne,pe]}),e[94]=B,e[95]=ne,e[96]=pe,e[97]=ce):ce=e[97];let ge;e[98]!==G||e[99]!==ce?(ge=t.jsx(lt,{open:G,onOpenChange:J,children:ce}),e[98]=G,e[99]=ce,e[100]=ge):ge=e[100];let je;return e[101]!==N||e[102]!==L||e[103]!==ge||e[104]!==C?(je=t.jsxs(Oe,{title:C,description:N,children:[L,ge]}),e[101]=N,e[102]=L,e[103]=ge,e[104]=C,e[105]=je):je=e[105],je}function nr(a){return ie.error(a.message)}function ir(a){const e=Y.c(31),{virtualMcp:s}=a,n=X(),{org:i}=Ae(),{roleSlug:l}=Mn();let c;e[0]!==s?(c=ha(s),e[0]=s,e[1]=c):c=e[1];const r=c,f=ft(),o=Et();let p;e[2]!==f||e[3]!==s?(p=C=>f.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:s.id,data:{blocksV8:C}}),e[2]=f,e[3]=s,e[4]=p):p=e[4];let m;e[5]!==i||e[6]!==o?(m=()=>_n(o,i.id),e[5]=i,e[6]=o,e[7]=m):m=e[7];let u;e[8]!==p||e[9]!==m?(u={mutationFn:p,onError:ar,onSettled:m},e[8]=p,e[9]=m,e[10]=u):u=e[10];const h=Os(u);if(!pa(l))return null;const d=h.isPending?h.variables:r;let x;e[11]!==n?(x=n("virtualMcp.settings.blocksV8Site.label"),e[11]=n,e[12]=x):x=e[12];let g;e[13]!==x?(g=t.jsx(we,{htmlFor:"blocks-v8-site",className:"font-normal text-foreground",children:x}),e[13]=x,e[14]=g):g=e[14];let v;e[15]!==n?(v=n("virtualMcp.settings.blocksV8Site.description"),e[15]=n,e[16]=v):v=e[16];let j;e[17]!==v?(j=t.jsx("p",{className:"text-xs text-muted-foreground",children:v}),e[17]=v,e[18]=j):j=e[18];let y;e[19]!==g||e[20]!==j?(y=t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[g,j]}),e[19]=g,e[20]=j,e[21]=y):y=e[21];let b;e[22]!==h?(b=C=>h.mutate(C),e[22]=h,e[23]=b):b=e[23];let w;e[24]!==d||e[25]!==b||e[26]!==h.isPending?(w=t.jsx(et,{id:"blocks-v8-site",className:"shrink-0",checked:d,disabled:h.isPending,onCheckedChange:b}),e[24]=d,e[25]=b,e[26]=h.isPending,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==y?(S=t.jsx(Oe,{children:t.jsx(ke,{children:t.jsx(be,{children:t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[y,w]})})})}),e[28]=w,e[29]=y,e[30]=S):S=e[30],S}function ar(a){return ie.error(a.message)}function lr(a){const e=Y.c(8),{control:s,previewServerUrl:n}=a,i=X();let l;e[0]!==n?(l=Js(n),e[0]=n,e[1]=l):l=e[1];const c=!!l;let r;e[2]!==c||e[3]!==i?(r=o=>{const{field:p}=o;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"fast-preview",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.fastPreview.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i(c?"sandbox.cmsSettings.fastPreview.description":"sandbox.cmsSettings.fastPreview.needsPreviewServerUrl")})]}),t.jsx(et,{id:"fast-preview",className:"shrink-0",checked:!!p.value&&c,disabled:!c,onCheckedChange:m=>p.onChange(m)})]})},e[2]=c,e[3]=i,e[4]=r):r=e[4];let f;return e[5]!==s||e[6]!==r?(f=t.jsx(xe,{control:s,name:"metadata.fastPreview",render:r}),e[5]=s,e[6]=r,e[7]=f):f=e[7],f}function rr(a){const e=Y.c(5),{control:s,fastPreview:n}=a,i=X();if(!n)return null;let l;e[0]!==i?(l=r=>{const{field:f}=r;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"fast-preview-in-place",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.fastPreviewInPlace.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.cmsSettings.fastPreviewInPlace.description")})]}),t.jsx(et,{id:"fast-preview-in-place",className:"shrink-0",checked:!!f.value,onCheckedChange:o=>f.onChange(o)})]})},e[0]=i,e[1]=l):l=e[1];let c;return e[2]!==s||e[3]!==l?(c=t.jsx(xe,{control:s,name:"metadata.fastPreviewInPlace",render:l}),e[2]=s,e[3]=l,e[4]=c):c=e[4],c}function or(a){const e=Y.c(18),{control:s,isBlocksV8:n}=a,i=n===void 0?!1:n,l=X();let c;e[0]!==l?(c=l("sandbox.previewServerUrlField.label"),e[0]=l,e[1]=c):c=e[1];let r;e[2]!==c?(r=t.jsx(we,{htmlFor:"preview-server-url",children:c}),e[2]=c,e[3]=r):r=e[3];let f;e[4]!==l?(f=d=>{const{field:x}=d,g=x.value??"";return t.jsx(Ne,{id:"preview-server-url",type:"url",inputMode:"url",placeholder:l("sandbox.previewServerUrlField.placeholder"),value:g,onChange:v=>x.onChange(v.target.value===""?null:v.target.value),onBlur:()=>{x.onChange(ga(g)),x.onBlur()}})},e[4]=l,e[5]=f):f=e[5];let o;e[6]!==s||e[7]!==f?(o=t.jsx(xe,{control:s,name:"metadata.previewServerUrl",render:f}),e[6]=s,e[7]=f,e[8]=o):o=e[8];const p=i?"sandbox.previewServerUrlField.descriptionBlocksV8":"sandbox.previewServerUrlField.description";let m;e[9]!==l||e[10]!==p?(m=l(p),e[9]=l,e[10]=p,e[11]=m):m=e[11];let u;e[12]!==m?(u=t.jsx("p",{className:"text-xs text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;return e[14]!==r||e[15]!==o||e[16]!==u?(h=t.jsxs("div",{className:"space-y-2",children:[r,o,u]}),e[14]=r,e[15]=o,e[16]=u,e[17]=h):h=e[17],h}function cr(a){const e=Y.c(15),{control:s,isBlocksV8:n,previewServerUrl:i,fastPreview:l}=a,c=X(),r=n||!!l;let f;e[0]!==s||e[1]!==n?(f=t.jsx(be,{children:t.jsx(or,{control:s,isBlocksV8:n})}),e[0]=s,e[1]=n,e[2]=f):f=e[2];let o;e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==c?(o=n?!Js(i)&&t.jsx(be,{children:t.jsx("p",{className:"text-xs text-muted-foreground",children:c("sandbox.cmsSettings.blocksV8.needsPreviewServerUrl")})}):t.jsx(be,{children:t.jsx(lr,{control:s,previewServerUrl:i})}),e[3]=s,e[4]=n,e[5]=i,e[6]=c,e[7]=o):o=e[7];let p;e[8]!==s||e[9]!==r?(p=r&&t.jsx(be,{children:t.jsx(rr,{control:s,fastPreview:r})}),e[8]=s,e[9]=r,e[10]=p):p=e[10];let m;return e[11]!==f||e[12]!==o||e[13]!==p?(m=t.jsxs(t.Fragment,{children:[f,o,p]}),e[11]=f,e[12]=o,e[13]=p,e[14]=m):m=e[14],m}const Vt={tools:null,resources:null,prompts:null},dr=ba.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function ur(a){const s=new TextEncoder().encode(a),n=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(n)}function fn(a){return{"x-studio-client":a,"x-mesh-client":a}}function mr(a){const e=Y.c(15),{url:s,agentId:n}=a,i=X(),[l,c]=q.useState(!1);let r;e[0]!==n||e[1]!==i||e[2]!==s?(r=async()=>{_e("agent_connect_action",{agent_id:n,action:"copy_url"}),await navigator.clipboard.writeText(s),c(!0),ie.success(i("virtualMcp.virtualMcpShareModal.agentUrlCopied")),await St(2e3),c(!1)},e[0]=n,e[1]=i,e[2]=s,e[3]=r):r=e[3];const f=r;let o;e[4]!==l?(o=l?t.jsx(rt,{size:20,className:"text-success"}):t.jsx(bt,{size:20}),e[4]=l,e[5]=o):o=e[5];let p;e[6]!==l||e[7]!==i?(p=i(l?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.copyUrl"),e[6]=l,e[7]=i,e[8]=p):p=e[8];let m;e[9]!==p?(m=t.jsx("span",{className:"text-xs font-medium",children:p}),e[9]=p,e[10]=m):m=e[10];let u;return e[11]!==f||e[12]!==o||e[13]!==m?(u=t.jsxs(Z,{type:"button",variant:"outline",onClick:f,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[o,m]}),e[11]=f,e[12]=o,e[13]=m,e[14]=u):u=e[14],u}function fr(a){const e=Y.c(13),{url:s,serverName:n,agentId:i}=a,l=X();let c;e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==s?(c=()=>{_e("agent_connect_action",{agent_id:i,action:"install_cursor"});const u=Zs(n),h={type:"http",url:s,headers:fn("Cursor")},d=ur(JSON.stringify(h,null,2)),x=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(d)}`;window.open(x,"_blank"),ie.success(l("virtualMcp.virtualMcpShareModal.openingCursor"))},e[0]=i,e[1]=n,e[2]=l,e[3]=s,e[4]=c):c=e[4];const r=c;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),e[5]=f):f=e[5];let o;e[6]!==l?(o=l("virtualMcp.virtualMcpShareModal.installOnCursor"),e[6]=l,e[7]=o):o=e[7];let p;e[8]!==o?(p=t.jsx("span",{className:"text-xs font-medium",children:o}),e[8]=o,e[9]=p):p=e[9];let m;return e[10]!==r||e[11]!==p?(m=t.jsxs(Z,{type:"button",variant:"outline",onClick:r,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[f,p]}),e[10]=r,e[11]=p,e[12]=m):m=e[12],m}function pr(a){const e=Y.c(16),{url:s,serverName:n,agentId:i}=a,l=X(),[c,r]=q.useState(!1);let f;e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==s?(f=async()=>{_e("agent_connect_action",{agent_id:i,action:"install_claude_code"});const d=Zs(n),x={type:"http",url:s,headers:fn("Claude Code")},g=JSON.stringify(x,null,2),v=`claude mcp add-json "${d}" '${g.replace(/'/g,"'\\''")}'  --scope user`;await navigator.clipboard.writeText(v),r(!0),ie.success(l("virtualMcp.virtualMcpShareModal.claudeCodeCommandCopied")),await St(2e3),r(!1)},e[0]=i,e[1]=n,e[2]=l,e[3]=s,e[4]=f):f=e[4];const o=f;let p;e[5]!==c?(p=c?t.jsx(rt,{size:20,className:"text-success"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[5]=c,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==l?(m=l(c?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.installOnClaudeCode"),e[7]=c,e[8]=l,e[9]=m):m=e[9];let u;e[10]!==m?(u=t.jsx("span",{className:"text-xs font-medium",children:m}),e[10]=m,e[11]=u):u=e[11];let h;return e[12]!==o||e[13]!==p||e[14]!==u?(h=t.jsxs(Z,{type:"button",variant:"outline",onClick:o,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[p,u]}),e[12]=o,e[13]=p,e[14]=u,e[15]=h):h=e[15],h}const hr=720*60*60;function xr({virtualMcp:a}){const e=X(),s=ft(),[n,i]=q.useState(null),[l,c]=q.useState(!1),[r,f]=q.useState(!1),o=a.id,p=a.title||`agent-${o.slice(0,8)}`,m=n?`bunx @decocms/typegen@latest --mcp ${o} --key ${n} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${o} --key <api-key> --output client.ts`,u=async()=>{c(!0);try{const{key:d}=await s.call("API_KEY_CREATE",{name:`typegen-${p}`,permissions:{[o]:["*"]},expiresIn:hr});if(!d)throw new Error("No key in response");i(d),_e("agent_typegen_key_generated",{agent_id:o})}catch{_e("agent_typegen_key_failed",{agent_id:o}),ie.error(e("virtualMcp.virtualMcpShareModal.failedGenerateApiKey"))}finally{c(!1)}},h=async()=>{_e("agent_connect_action",{agent_id:o,action:"typegen_copy_command",has_api_key:!!n}),await navigator.clipboard.writeText(m),f(!0),ie.success(e("virtualMcp.virtualMcpShareModal.commandCopied")),await St(2e3),f(!1)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClient")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClientDescription")})]}),!n&&t.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:u,disabled:l,children:[l?t.jsx(it,{className:"size-3.5"}):t.jsx(Lt,{size:14}),t.jsx("span",{children:e(l?"virtualMcp.virtualMcpShareModal.generating":"virtualMcp.virtualMcpShareModal.generateApiKey")})]})]}),n&&t.jsx("p",{className:"rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-warning",children:e("virtualMcp.virtualMcpShareModal.storeKeySecurely")}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateClientLabel")}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:m}),t.jsx(Z,{type:"button",variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:h,children:r?t.jsx(rt,{size:12,className:"text-success"}):t.jsx(bt,{size:12})})]})}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.runtimeVariables")}),t.jsx(gr,{apiKey:n,agentId:o})]})}function gr(a){const e=Y.c(21),{apiKey:s,agentId:n}=a,[i,l]=q.useState(!1),c=window.location.origin,r=s?`STUDIO_API_KEY=${s}`:"STUDIO_API_KEY=<api-key>",f=`STUDIO_BASE_URL=${c}`,o=`${r}
${f}`;let p;e[0]!==n||e[1]!==s||e[2]!==o?(p=async()=>{_e("agent_connect_action",{agent_id:n,action:"typegen_copy_env",has_api_key:!!s}),await navigator.clipboard.writeText(o),l(!0),await St(2e3),l(!1)},e[0]=n,e[1]=s,e[2]=o,e[3]=p):p=e[3];const m=p,u=!s;let h;e[4]!==u?(h=ye({"opacity-50":u}),e[4]=u,e[5]=h):h=e[5];let d;e[6]!==r||e[7]!==h?(d=t.jsx("span",{className:h,children:r}),e[6]=r,e[7]=h,e[8]=d):d=e[8];let x,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("br",{}),g=t.jsx("span",{children:f}),e[9]=x,e[10]=g):(x=e[9],g=e[10]);let v;e[11]!==d?(v=t.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[d,x,g]}),e[11]=d,e[12]=v):v=e[12];let j;e[13]!==i?(j=i?t.jsx(rt,{size:12,className:"text-success"}):t.jsx(bt,{size:12}),e[13]=i,e[14]=j):j=e[14];let y;e[15]!==m||e[16]!==j?(y=t.jsx(Z,{type:"button",variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:m,children:j}),e[15]=m,e[16]=j,e[17]=y):y=e[17];let b;return e[18]!==v||e[19]!==y?(b=t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[v,y]})}),e[18]=v,e[19]=y,e[20]=b):b=e[20],b}function vr(a){const e=Y.c(3),{virtualMcp:s}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=t.jsx(q.Suspense,{fallback:n,children:t.jsx(xr,{virtualMcp:s})}),e[1]=s,e[2]=i):i=e[2],i}function br(a){const e=Y.c(45),{open:s,onOpenChange:n,virtualMcp:i}=a,l=X(),{org:c}=Ae(),r=`/api/${c.slug}/mcp/virtual-mcp/${i.id}`;let f;e[0]!==r?(f=new URL(r,window.location.origin),e[0]=r,e[1]=f):f=e[1];const o=f;let p;e[2]!==i.id||e[3]!==i.title?(p=i.title||`agent-${i.id?.slice(0,8)??"default"}`,e[2]=i.id,e[3]=i.title,e[4]=p):p=e[4];const m=p,u=Ca();let h;e[5]!==i.id||e[6]!==o.href?(h=t.jsx(mr,{url:o.href,agentId:i.id}),e[5]=i.id,e[6]=o.href,e[7]=h):h=e[7];let d,x;e[8]!==m||e[9]!==i.id||e[10]!==o.href?(d=t.jsx(fr,{url:o.href,serverName:m,agentId:i.id}),x=t.jsx(pr,{url:o.href,serverName:m,agentId:i.id}),e[8]=m,e[9]=i.id,e[10]=o.href,e[11]=d,e[12]=x):(d=e[11],x=e[12]);let g;e[13]!==h||e[14]!==d||e[15]!==x?(g=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h,d,x]})}),e[13]=h,e[14]=d,e[15]=x,e[16]=g):g=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"border-t border-border"}),e[17]=v):v=e[17];let j;e[18]!==i?(j=t.jsx(vr,{virtualMcp:i}),e[18]=i,e[19]=j):j=e[19];let y;e[20]!==g||e[21]!==j?(y=t.jsxs("div",{className:"flex flex-col gap-6",children:[g,v,j]}),e[20]=g,e[21]=j,e[22]=y):y=e[22];const b=y;if(u){let k;e[23]!==l?(k=l("virtualMcp.virtualMcpShareModal.connect"),e[23]=l,e[24]=k):k=e[24];let V;e[25]!==k?(V=t.jsx(wa,{className:"mt-4 mb-4 text-base font-semibold",children:k}),e[25]=k,e[26]=V):V=e[26];let T;e[27]!==b||e[28]!==V?(T=t.jsx(Sa,{children:t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[V,b]})}),e[27]=b,e[28]=V,e[29]=T):T=e[29];let _;return e[30]!==n||e[31]!==s||e[32]!==T?(_=t.jsx(Na,{open:s,onOpenChange:n,children:T}),e[30]=n,e[31]=s,e[32]=T,e[33]=_):_=e[33],_}let w;e[34]!==l?(w=l("virtualMcp.virtualMcpShareModal.connect"),e[34]=l,e[35]=w):w=e[35];let S;e[36]!==w?(S=t.jsx(xt,{children:t.jsx(ht,{children:w})}),e[36]=w,e[37]=S):S=e[37];let C;e[38]!==b||e[39]!==S?(C=t.jsxs(at,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[S,b]}),e[38]=b,e[39]=S,e[40]=C):C=e[40];let N;return e[41]!==n||e[42]!==s||e[43]!==C?(N=t.jsx(lt,{open:s,onOpenChange:n,children:C}),e[41]=n,e[42]=s,e[43]=C,e[44]=N):N=e[44],N}const jr=/^[A-Za-z_][A-Za-z0-9_]*$/;function yr(a){const e={},s=a.split(/\r?\n/);for(let n=0;n<s.length;n++){let i=(s[n]??"").trim();if(!i||i.startsWith("#"))continue;i.startsWith("export ")&&(i=i.slice(7).trim());const l=i.indexOf("=");if(l<0)throw new Error(`Line ${n+1}: missing '='`);const c=i.slice(0,l).trim();if(!jr.test(c))throw new Error(`Line ${n+1}: invalid key "${c}"`);let r=i.slice(l+1).trim();r.length>=2&&(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),e[c]=r}return e}function wr(a){const e=Y.c(28),{control:s,form:n,virtualMcpId:i,orgSlug:l,sandboxMap:c}=a,r=X();let f;e[0]!==r?(f=r("sandbox.envVarsField.title"),e[0]=r,e[1]=f):f=e[1];let o;e[2]!==f?(o=t.jsx("div",{className:"flex items-baseline justify-between gap-2",children:t.jsx(we,{className:"font-normal text-foreground",children:f})}),e[2]=f,e[3]=o):o=e[3];let p;e[4]!==r?(p=r("sandbox.envVarsField.description"),e[4]=r,e[5]=p):p=e[5];let m;e[6]!==p?(m=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[6]=p,e[7]=m):m=e[7];let u;e[8]!==s||e[9]!==n||e[10]!==l||e[11]!==c||e[12]!==i?(u=t.jsx(Sr,{control:s,form:n,virtualMcpId:i,orgSlug:l,sandboxMap:c}),e[8]=s,e[9]=n,e[10]=l,e[11]=c,e[12]=i,e[13]=u):u=e[13];let h;e[14]!==r?(h=j=>{const{error:y}=j;return t.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:y?.message??r("sandbox.envVarsField.failedToLoadSecrets")})},e[14]=r,e[15]=h):h=e[15];let d;e[16]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Vn,{className:"h-9 w-full"}),e[16]=d):d=e[16];let x;e[17]!==s||e[18]!==n?(x=t.jsx(q.Suspense,{fallback:d,children:t.jsx(Cr,{control:s,form:n})}),e[17]=s,e[18]=n,e[19]=x):x=e[19];let g;e[20]!==h||e[21]!==x?(g=t.jsx(Xe,{fallback:h,children:x}),e[20]=h,e[21]=x,e[22]=g):g=e[22];let v;return e[23]!==o||e[24]!==m||e[25]!==u||e[26]!==g?(v=t.jsxs("div",{className:"space-y-2",children:[o,m,u,g]}),e[23]=o,e[24]=m,e[25]=u,e[26]=g,e[27]=v):v=e[27],v}function Sr(a){const e=Y.c(33),{control:s,form:n,virtualMcpId:i,orgSlug:l,sandboxMap:c}=a,r=X(),o=Tn.useSession().data?.user?.id,p="metadata.runtime.env";let m;e[0]!==n?(m=()=>JSON.stringify(ws(n.getValues(p))),e[0]=n,e[1]=m):m=e[1];const[u,h]=q.useState(m);let d;e[2]!==s?(d={control:s,name:p},e[2]=s,e[3]=d):d=e[3];const x=zt(d);let g;e[4]!==x?(g=JSON.stringify(ws(x)),e[4]=x,e[5]=g):g=e[5];const v=g,j=v!==u;let y;e[6]!==c||e[7]!==o?(y=o?Object.keys(c?.[o]??{}):[],e[6]=c,e[7]=o,e[8]=y):y=e[8];const b=y,w=b.length>0,[S,C]=q.useState(!1);if(!j||!w)return null;let N;e[9]!==v||e[10]!==l||e[11]!==r||e[12]!==b||e[13]!==i?(N=async()=>{C(!0);const H=await Promise.allSettled(b.map(async R=>{const z=ka({orgSlug:l,virtualMcpId:i,branch:R,threadId:null},"setup/start",{force:"1"}),K=await fetch(z,{method:"POST"});if(!K.ok){const E=await K.text().catch(()=>K.statusText);throw new Error(E||K.statusText)}}));C(!1);const Q=H.filter(Nr).length;Q===0?(h(v),ie.success(b.length===1?r("sandbox.envVarsField.restartedSingle"):r("sandbox.envVarsField.restartedMultiple",{count:b.length}))):ie.error(r("sandbox.envVarsField.restartFailed",{failed:Q,total:b.length}))},e[9]=v,e[10]=l,e[11]=r,e[12]=b,e[13]=i,e[14]=N):N=e[14];const k=N;let V;e[15]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(Ts,{className:"size-3.5 shrink-0"}),e[15]=V):V=e[15];let T;e[16]!==r?(T=r("sandbox.envVarsField.sandboxRunningNotice"),e[16]=r,e[17]=T):T=e[17];let _;e[18]!==T?(_=t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-warning",children:[V,t.jsx("span",{className:"truncate",children:T})]}),e[18]=T,e[19]=_):_=e[19];let F;e[20]!==S?(F=S?t.jsx(it,{className:"size-3.5"}):t.jsx(Pn,{className:"size-3.5"}),e[20]=S,e[21]=F):F=e[21];let $;e[22]!==S||e[23]!==r?($=r(S?"sandbox.envVarsField.restarting":"sandbox.envVarsField.restartDev"),e[22]=S,e[23]=r,e[24]=$):$=e[24];let A;e[25]!==k||e[26]!==S||e[27]!==$||e[28]!==F?(A=t.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:k,disabled:S,className:"shrink-0",children:[F,$]}),e[25]=k,e[26]=S,e[27]=$,e[28]=F,e[29]=A):A=e[29];let P;return e[30]!==A||e[31]!==_?(P=t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs",children:[_,A]}),e[30]=A,e[31]=_,e[32]=P):P=e[32],P}function Nr(a){return a.status==="rejected"}function Cr(a){const e=Y.c(62),{control:s,form:n}=a,i=X(),l="metadata.runtime.env";let c;e[0]!==s?(c={control:s,name:l},e[0]=s,e[1]=c):c=e[1];const r=Dn(c),{fields:f,append:o,remove:p}=r;let m;e[2]!==n?(m=(z,K)=>{n.setValue(`${l}.${z}`,K,{shouldDirty:!0,shouldTouch:!0})},e[2]=n,e[3]=m):m=e[3];const u=m,h=Ta();let d;if(e[4]!==h){d=new Map;for(const z of h)d.set(z.id,z);e[4]=h,e[5]=d}else d=e[5];const[x,g]=q.useState(null);let v;e[6]!==o?(v=()=>{o({key:"",kind:"literal",value:""})},e[6]=o,e[7]=v):v=e[7];const j=v;let y;e[8]!==o||e[9]!==n||e[10]!==i?(y=async()=>{let z;try{z=await navigator.clipboard.readText()}catch{ie.error(i("sandbox.envVarsField.clipboardReadFailed"));return}if(!z.trim()){ie.error(i("sandbox.envVarsField.clipboardEmpty"));return}let K;try{K=yr(z)}catch(M){const O=M;ie.error(O.message);return}const E=Object.entries(K);if(E.length===0){ie.error(i("sandbox.envVarsField.nothingToAdd"));return}const L=n.getValues(l)??[],G=new Set;for(const M of L){const O=(M.key??"").trim();O&&G.add(O)}let J=0,ee=0;for(const[M,O]of E){if(G.has(M)){ee++;continue}o({key:M,kind:"literal",value:O}),G.add(M),J++}J===0&&ee>0?ie.message(i("sandbox.envVarsField.allKeysExist",{count:ee})):ie.success(ee>0?i("sandbox.envVarsField.addedWithSkipped",{added:J,skipped:ee}):i("sandbox.envVarsField.added",{added:J}))},e[8]=o,e[9]=n,e[10]=i,e[11]=y):y=e[11];const b=y;let w;if(e[12]!==s||e[13]!==f||e[14]!==n||e[15]!==p||e[16]!==d||e[17]!==h||e[18]!==u){let z;e[20]!==s||e[21]!==n||e[22]!==p||e[23]!==d||e[24]!==h||e[25]!==u?(z=(K,E)=>t.jsx("li",{className:"rounded-md border border-border bg-background",children:t.jsx(kr,{index:E,control:s,form:n,onUpdateEntry:u,fieldPath:l,secrets:h,secretById:d,onSaveAsSecret:(L,G)=>g({kind:"save-literal",index:E,presetKey:L,presetValue:G}),onCreateNewSecret:L=>g({kind:"create-new",index:E,presetKey:L}),onRemove:()=>p(E)})},K.id),e[20]=s,e[21]=n,e[22]=p,e[23]=d,e[24]=h,e[25]=u,e[26]=z):z=e[26],w=f.map(z),e[12]=s,e[13]=f,e[14]=n,e[15]=p,e[16]=d,e[17]=h,e[18]=u,e[19]=w}else w=e[19];let S;e[27]!==w?(S=t.jsx("ul",{className:"space-y-2",children:w}),e[27]=w,e[28]=S):S=e[28];let C;e[29]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Be,{className:"size-3.5"}),e[29]=C):C=e[29];let N;e[30]!==i?(N=i("sandbox.envVarsField.addEnvVar"),e[30]=i,e[31]=N):N=e[31];let k;e[32]!==j||e[33]!==N?(k=t.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:j,className:"flex-1",children:[C,N]}),e[32]=j,e[33]=N,e[34]=k):k=e[34];let V;e[35]!==i?(V=i("sandbox.envVarsField.pasteDotenvAriaLabel"),e[35]=i,e[36]=V):V=e[36];let T;e[37]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Ui,{className:"size-3.5"}),e[37]=T):T=e[37];let _;e[38]!==i?(_=i("sandbox.envVarsField.pasteDotenv"),e[38]=i,e[39]=_):_=e[39];let F;e[40]!==b||e[41]!==V||e[42]!==_?(F=t.jsx(Te,{asChild:!0,children:t.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:b,"aria-label":V,children:[T,_]})}),e[40]=b,e[41]=V,e[42]=_,e[43]=F):F=e[43];let $;e[44]!==i?($=i("sandbox.envVarsField.pasteDotenvTooltip"),e[44]=i,e[45]=$):$=e[45];let A;e[46]!==$?(A=t.jsx(De,{children:$}),e[46]=$,e[47]=A):A=e[47];let P;e[48]!==F||e[49]!==A?(P=t.jsxs(Ve,{children:[F,A]}),e[48]=F,e[49]=A,e[50]=P):P=e[50];let H;e[51]!==P||e[52]!==k?(H=t.jsxs("div",{className:"flex items-center gap-2",children:[k,P]}),e[51]=P,e[52]=k,e[53]=H):H=e[53];let Q;e[54]!==x||e[55]!==n||e[56]!==u?(Q=x!==null?t.jsx(_r,{mode:x,onClose:()=>g(null),onSaved:z=>{const K=n.getValues(`${l}.${x.index}.key`)?.trim()??"";u(x.index,{key:K,kind:"secret",secretId:z}),g(null)}}):null,e[54]=x,e[55]=n,e[56]=u,e[57]=Q):Q=e[57];let R;return e[58]!==H||e[59]!==Q||e[60]!==S?(R=t.jsxs("div",{className:"space-y-2",children:[S,H,Q]}),e[58]=H,e[59]=Q,e[60]=S,e[61]=R):R=e[61],R}function kr(a){const e=Y.c(77),{index:s,control:n,form:i,onUpdateEntry:l,fieldPath:c,secrets:r,secretById:f,onSaveAsSecret:o,onCreateNewSecret:p,onRemove:m}=a,u=X(),h=`${c}.${s}.key`,d=`${c}.${s}.value`,x=`${c}.${s}.secretId`,g=`${c}.${s}.kind`;let v;e[0]!==n||e[1]!==g?(v={control:n,name:g},e[0]=n,e[1]=g,e[2]=v):v=e[2];const y=zt(v)==="secret"?"secret":"literal";let b;e[3]!==i||e[4]!==s||e[5]!==h||e[6]!==o||e[7]!==l||e[8]!==d?(b=O=>{const U=i.getValues(h)?.trim()??"";if(O==="literal"){l(s,{key:U,kind:"literal",value:""});return}const B=i.getValues(d)??"";if(B.length>0){o(U,B);return}l(s,{key:U,kind:"secret",secretId:""})},e[3]=i,e[4]=s,e[5]=h,e[6]=o,e[7]=l,e[8]=d,e[9]=b):b=e[9];const w=b;let S;e[10]!==s||e[11]!==u?(S=O=>{const{field:U}=O,B=(U.value??"").trim(),W=B.length>0&&!wt.test(B);return t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ne,{...U,value:U.value??"",placeholder:u("sandbox.envVarsField.keyPlaceholder"),spellCheck:!1,autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",className:ye("font-mono",W&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":W,"aria-label":u("sandbox.envVarsField.envVarKeyLabel",{index:s+1}),onBlur:re=>{const oe=re.target.value.trim();U.onChange(oe),U.onBlur()}}),W?t.jsx("p",{className:"text-2xs text-destructive",children:u("sandbox.envVarsField.invalidKeyMessage")}):null]})},e[10]=s,e[11]=u,e[12]=S):S=e[12];let C;e[13]!==n||e[14]!==h||e[15]!==S?(C=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(xe,{control:n,name:h,render:S})}),e[13]=n,e[14]=h,e[15]=S,e[16]=C):C=e[16];let N;e[17]!==w?(N=O=>w(O),e[17]=w,e[18]=N):N=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Ee,{className:"h-9 w-[110px]",children:t.jsx(ze,{})}),e[19]=k):k=e[19];let V;e[20]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(Lt,{className:"size-3.5"}),e[20]=V):V=e[20];let T;e[21]!==u?(T=u("sandbox.envVarsField.literal"),e[21]=u,e[22]=T):T=e[22];let _;e[23]!==T?(_=t.jsx(Se,{value:"literal",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[V,T]})}),e[23]=T,e[24]=_):_=e[24];let F;e[25]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(On,{className:"size-3.5"}),e[25]=F):F=e[25];let $;e[26]!==u?($=u("sandbox.envVarsField.secret"),e[26]=u,e[27]=$):$=e[27];let A;e[28]!==$?(A=t.jsx(Se,{value:"secret",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[F,$]})}),e[28]=$,e[29]=A):A=e[29];let P;e[30]!==A||e[31]!==_?(P=t.jsxs(Re,{children:[_,A]}),e[30]=A,e[31]=_,e[32]=P):P=e[32];let H;e[33]!==y||e[34]!==P||e[35]!==N?(H=t.jsx("div",{className:"shrink-0",children:t.jsxs(Le,{value:y,onValueChange:N,children:[k,P]})}),e[33]=y,e[34]=P,e[35]=N,e[36]=H):H=e[36];let Q;e[37]!==n||e[38]!==i||e[39]!==s||e[40]!==h||e[41]!==y||e[42]!==p||e[43]!==f||e[44]!==x||e[45]!==r||e[46]!==u||e[47]!==d?(Q=t.jsx("div",{className:"flex flex-[2] min-w-0 items-center gap-1",children:y==="literal"?t.jsx(xe,{control:n,name:d,render:O=>{const{field:U}=O;return t.jsx(Ne,{...U,value:U.value??"",type:"password",placeholder:u("sandbox.envVarsField.valuePlaceholder"),spellCheck:!1,autoComplete:"off",className:"font-mono","aria-label":u("sandbox.envVarsField.envVarValueLabel",{index:s+1}),onBlur:B=>{U.onChange(B.target.value),U.onBlur()}})}}):t.jsxs(t.Fragment,{children:[t.jsx(xe,{control:n,name:x,render:O=>{const{field:U}=O;return t.jsxs(Le,{value:U.value||"",onValueChange:B=>U.onChange(B),children:[t.jsx(Ee,{className:ye("h-9 w-full",!U.value&&"text-muted-foreground"),"aria-label":u("sandbox.envVarsField.secretAriaLabel",{index:s+1}),children:t.jsx(ze,{placeholder:u("sandbox.envVarsField.pickSecretPlaceholder"),children:t.jsx(Ma,{field:U,secretById:f})})}),t.jsx(Re,{children:r.length===0?t.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:u("sandbox.envVarsField.noSecretsYet")}):r.map(Mr)})]})}}),t.jsxs(Ve,{children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{type:"button",variant:"ghost",size:"icon","aria-label":u("sandbox.envVarsField.createNewSecretAriaLabel"),onClick:()=>{const O=i.getValues(h)?.trim()??"";p(O)},children:t.jsx(Be,{className:"size-3.5"})})}),t.jsx(De,{children:u("sandbox.envVarsField.createNewSecret")})]})]})}),e[37]=n,e[38]=i,e[39]=s,e[40]=h,e[41]=y,e[42]=p,e[43]=f,e[44]=x,e[45]=r,e[46]=u,e[47]=d,e[48]=Q):Q=e[48];let R;e[49]!==i||e[50]!==h||e[51]!==y||e[52]!==o||e[53]!==u||e[54]!==d?(R=y==="literal"?t.jsxs(Ve,{children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{type:"button",variant:"ghost",size:"icon","aria-label":u("sandbox.envVarsField.saveAsSecretAriaLabel"),onClick:()=>{const O=i.getValues(h)?.trim()??"",U=i.getValues(d)??"";o(O,U)},children:t.jsx(Ti,{className:"size-3.5"})})}),t.jsx(De,{children:u("sandbox.envVarsField.saveAsSecret")})]}):null,e[49]=i,e[50]=h,e[51]=y,e[52]=o,e[53]=u,e[54]=d,e[55]=R):R=e[55];let z;e[56]!==u?(z=u("sandbox.envVarsField.removeEnvVarAriaLabel"),e[56]=u,e[57]=z):z=e[57];let K;e[58]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(vt,{className:"size-3.5"}),e[58]=K):K=e[58];let E;e[59]!==m||e[60]!==z?(E=t.jsx(Te,{asChild:!0,children:t.jsx(Z,{type:"button",variant:"ghost",size:"icon","aria-label":z,onClick:m,children:K})}),e[59]=m,e[60]=z,e[61]=E):E=e[61];let L;e[62]!==u?(L=u("sandbox.envVarsField.remove"),e[62]=u,e[63]=L):L=e[63];let G;e[64]!==L?(G=t.jsx(De,{children:L}),e[64]=L,e[65]=G):G=e[65];let J;e[66]!==E||e[67]!==G?(J=t.jsxs(Ve,{children:[E,G]}),e[66]=E,e[67]=G,e[68]=J):J=e[68];let ee;e[69]!==R||e[70]!==J?(ee=t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[R,J]}),e[69]=R,e[70]=J,e[71]=ee):ee=e[71];let M;return e[72]!==H||e[73]!==Q||e[74]!==ee||e[75]!==C?(M=t.jsxs("div",{className:"flex flex-col gap-2 p-2 sm:flex-row sm:items-center",children:[C,H,Q,ee]}),e[72]=H,e[73]=Q,e[74]=ee,e[75]=C,e[76]=M):M=e[76],M}function Mr(a){return t.jsx(Se,{value:a.id,children:t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx(Va,{scope:a.scope}),t.jsx("span",{className:"font-mono",children:a.name})]})},a.id)}function _r({mode:a,onClose:e,onSaved:s}){const n=X(),i=a.kind==="save-literal"?a.presetValue:"",l=a.presetKey,[c,r]=q.useState(()=>Vr(l)),[f,o]=q.useState("organization"),[p,m]=q.useState(i),[u,h]=q.useState(""),d=Da(),x=c.trim(),g=p.length>0&&x.length>0&&_a.test(x),v=async b=>{if(b.preventDefault(),!!g)try{const w=await d.mutateAsync({scope:f,name:x,value:p,description:u.trim()||void 0});ie.success(n("sandbox.envVarsField.secretSaved",{name:w.name})),s(w.id)}catch(w){ie.error(w instanceof Error?w.message:n("sandbox.envVarsField.failedToSaveSecret"))}},j=a.kind==="save-literal"?n("sandbox.envVarsField.saveValueAsSecretTitle"):n("sandbox.envVarsField.createNewSecretTitle"),y=a.kind==="save-literal"?n("sandbox.envVarsField.saveValueAsSecretDescription"):n("sandbox.envVarsField.createNewSecretDescription");return t.jsx(lt,{open:!0,onOpenChange:b=>{b||e()},children:t.jsxs(at,{className:"sm:max-w-md",children:[t.jsxs(xt,{children:[t.jsx(ht,{children:j}),t.jsx(Is,{children:y})]}),t.jsxs("form",{onSubmit:v,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(we,{htmlFor:"save-secret-scope",children:n("sandbox.envVarsField.scopeLabel")}),t.jsxs(Le,{value:f,onValueChange:b=>o(b),children:[t.jsx(Ee,{id:"save-secret-scope",children:t.jsx(ze,{})}),t.jsxs(Re,{children:[t.jsx(Se,{value:"organization",children:n("sandbox.envVarsField.scopeOrganization")}),t.jsx(Se,{value:"user",children:n("sandbox.envVarsField.scopePrivate")})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(we,{htmlFor:"save-secret-name",children:n("sandbox.envVarsField.nameLabel")}),t.jsx(Ne,{id:"save-secret-name",value:c,onChange:b=>r(b.target.value),placeholder:n("sandbox.envVarsField.namePlaceholder"),autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:n("sandbox.envVarsField.nameHelperText")})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(we,{htmlFor:"save-secret-value",children:n("sandbox.envVarsField.valueLabel")}),t.jsx(Ne,{id:"save-secret-value",type:"password",value:p,onChange:b=>m(b.target.value),placeholder:n("sandbox.envVarsField.secretValuePlaceholder"),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(we,{htmlFor:"save-secret-description",children:n("sandbox.envVarsField.descriptionLabel")}),t.jsx(ut,{id:"save-secret-description",value:u,onChange:b=>h(b.target.value),rows:2,placeholder:n("sandbox.envVarsField.descriptionPlaceholder")})]}),t.jsxs($t,{children:[t.jsx(Z,{type:"button",variant:"outline",onClick:e,disabled:d.isPending,children:n("sandbox.envVarsField.cancel")}),t.jsx(Z,{type:"submit",disabled:!g||d.isPending,children:d.isPending?n("sandbox.envVarsField.saving"):n("sandbox.envVarsField.saveSecret")})]})]})]})})}function ws(a){if(!Array.isArray(a))return[];const e=[];for(const s of a){if(!s||typeof s!="object")continue;const n=s,i=(n.key??"").trim();if(!(!i||!wt.test(i))){if(n.kind==="literal"){e.push({key:i,kind:"literal",value:n.value??""});continue}n.kind==="secret"&&n.secretId&&e.push({key:i,kind:"secret",secretId:n.secretId})}}return e}function Vr(a){const e=a.trim();return e&&wt.test(e)?e:""}function Tr({repository:a}){const e=a.path.split("/");return{owner:e.slice(0,-1).join("/"),name:e.at(-1)??a.path,url:a.webUrl,repositoryId:a.id}}function Dr(a){const e=Y.c(30),{repo:s,onConnect:n}=a,i=X(),[l,c]=q.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Pa,{size:20,className:"text-foreground/70"}),e[0]=r):r=e[0];let f;e[1]!==s||e[2]!==i?(f=s?`${s.owner}/${s.name}`:i("virtualMcp.settings.repository.none"),e[1]=s,e[2]=i,e[3]=f):f=e[3];let o;e[4]!==s||e[5]!==i?(o=s?s.url:i("virtualMcp.settings.repository.noneDescription"),e[4]=s,e[5]=i,e[6]=o):o=e[6];const p=s?"outline":"default";let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=()=>c(!0),e[7]=m):m=e[7];let u;e[8]!==s||e[9]!==i?(u=i(s?"virtualMcp.settings.repository.change":"virtualMcp.settings.repository.connect"),e[8]=s,e[9]=i,e[10]=u):u=e[10];let h;e[11]!==p||e[12]!==u?(h=t.jsx(Z,{size:"sm",variant:p,onClick:m,children:u}),e[11]=p,e[12]=u,e[13]=h):h=e[13];let d;e[14]!==f||e[15]!==o||e[16]!==h?(d=t.jsx(ke,{children:t.jsx($e,{icon:r,title:f,description:o,action:h})}),e[14]=f,e[15]=o,e[16]=h,e[17]=d):d=e[17];let x;e[18]!==i?(x=i("virtualMcp.settings.repository.connect"),e[18]=i,e[19]=x):x=e[19];let g;e[20]!==n||e[21]!==i?(g=async y=>{await n(Tr(y)),c(!1),ie.success(i("virtualMcp.settings.repository.connected",{name:y.repository.path}))},e[20]=n,e[21]=i,e[22]=g):g=e[22];let v;e[23]!==l||e[24]!==g||e[25]!==x?(v=t.jsx(Oa,{open:l,onOpenChange:c,title:x,onPicked:g,onError:Pr}),e[23]=l,e[24]=g,e[25]=x,e[26]=v):v=e[26];let j;return e[27]!==v||e[28]!==d?(j=t.jsxs(Oe,{children:[d,v]}),e[27]=v,e[28]=d,e[29]=j):j=e[29],j}function Pr(a){return ie.error(a)}const Or={npm:{install:"npm install",run:a=>`npm run ${a}`,runtime:"node"},pnpm:{install:"pnpm install",run:a=>`pnpm run ${a}`,runtime:"node"},yarn:{install:"yarn install",run:a=>`yarn run ${a}`,runtime:"node"},bun:{install:"bun install",run:a=>`bun run ${a}`,runtime:"bun"},deno:{install:"deno install",run:a=>`deno task ${a}`,runtime:"deno"}};function Ir(a){const e=a.trim();if(e==="")return{ok:!0,value:null};if(!/^\d+$/.test(e))return{ok:!1};const s=Number(e);return s<1||s>65535?{ok:!1}:{ok:!0,value:String(s)}}const $r=Object.keys(Or),Tt="__none__";function Fr(a){const e=Y.c(47),{control:s}=a,n=X(),i=q.useRef(null);let l;e[0]!==n?(l=n("sandbox.runtimeFields.packageManager"),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==l?(c=t.jsx(we,{htmlFor:"runtime-pm",children:l}),e[2]=l,e[3]=c):c=e[3];let r;e[4]!==n?(r=N=>{const{field:k}=N;return t.jsxs(Le,{value:k.value??Tt,onValueChange:V=>k.onChange(V===Tt?null:V),children:[t.jsx(Ee,{id:"runtime-pm",children:t.jsx(ze,{placeholder:n("sandbox.runtimeFields.autoDetect")})}),t.jsxs(Re,{children:[t.jsx(Se,{value:Tt,children:n("sandbox.runtimeFields.autoDetect")}),$r.map(Er)]})]})},e[4]=n,e[5]=r):r=e[5];let f;e[6]!==s||e[7]!==r?(f=t.jsx(xe,{control:s,name:"metadata.runtime.selected",render:r}),e[6]=s,e[7]=r,e[8]=f):f=e[8];let o;e[9]!==c||e[10]!==f?(o=t.jsxs("div",{className:"space-y-2",children:[c,f]}),e[9]=c,e[10]=f,e[11]=o):o=e[11];let p;e[12]!==n?(p=n("sandbox.runtimeFields.packagePath"),e[12]=n,e[13]=p):p=e[13];let m;e[14]!==p?(m=t.jsx(we,{htmlFor:"runtime-path",children:p}),e[14]=p,e[15]=m):m=e[15];let u;e[16]!==s?(u=t.jsx(xe,{control:s,name:"metadata.runtime.path",render:Ar}),e[16]=s,e[17]=u):u=e[17];let h;e[18]!==n?(h=n("sandbox.runtimeFields.packagePathDescription"),e[18]=n,e[19]=h):h=e[19];let d;e[20]!==h?(d=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[20]=h,e[21]=d):d=e[21];let x;e[22]!==d||e[23]!==m||e[24]!==u?(x=t.jsxs("div",{className:"space-y-2",children:[m,u,d]}),e[22]=d,e[23]=m,e[24]=u,e[25]=x):x=e[25];let g;e[26]!==n?(g=n("sandbox.runtimeFields.devServerPort"),e[26]=n,e[27]=g):g=e[27];let v;e[28]!==g?(v=t.jsx(we,{htmlFor:"runtime-port",children:g}),e[28]=g,e[29]=v):v=e[29];let j;e[30]!==n?(j=N=>{const{field:k}=N;return t.jsx(Ne,{ref:i,id:"runtime-port",inputMode:"numeric",placeholder:n("sandbox.runtimeFields.auto"),defaultValue:k.value??"",onBlur:V=>{const T=Ir(V.target.value);T.ok?k.onChange(T.value):i.current&&(i.current.value=k.value??"")}})},e[30]=n,e[31]=j):j=e[31];let y;e[32]!==s||e[33]!==j?(y=t.jsx(xe,{control:s,name:"metadata.runtime.port",render:j}),e[32]=s,e[33]=j,e[34]=y):y=e[34];let b;e[35]!==n?(b=n("sandbox.runtimeFields.devServerPortDescription"),e[35]=n,e[36]=b):b=e[36];let w;e[37]!==b?(w=t.jsx("p",{className:"text-xs text-muted-foreground",children:b}),e[37]=b,e[38]=w):w=e[38];let S;e[39]!==v||e[40]!==y||e[41]!==w?(S=t.jsxs("div",{className:"space-y-2",children:[v,y,w]}),e[39]=v,e[40]=y,e[41]=w,e[42]=S):S=e[42];let C;return e[43]!==x||e[44]!==S||e[45]!==o?(C=t.jsxs("div",{className:"space-y-5",children:[o,x,S]}),e[43]=x,e[44]=S,e[45]=o,e[46]=C):C=e[46],C}function Ar(a){const{field:e}=a;return t.jsx(Ne,{id:"runtime-path",placeholder:".",defaultValue:e.value??"",onBlur:s=>{const n=s.target.value.trim();e.onChange(n===""?null:n)}})}function Er(a){return t.jsx(Se,{value:a,children:a},a)}function zr(a){const e=Y.c(10),{control:s}=a,n=X(),[i,l]=q.useState(null),[c,r]=q.useState(null),f=zt({control:s,name:"metadata.runtime.path"})??"";let o;e[0]!==f?(o=ds(f),e[0]=f,e[1]=o):o=e[1];const p=o;let m;e[2]!==i||e[3]!==c||e[4]!==p||e[5]!==n?(m=h=>{const{field:d}=h,x=d.value??[],g=j=>d.onChange(j.length?j:null),v=()=>{if(i===null)return;const j=ds(i);if(!j){l(null),r(null);return}if(j===p||x.some(y=>y.path===j)){r(n("sandbox.runtimeApps.duplicate"));return}g([...x,{path:j}]),l(null),r(null)};return t.jsxs("div",{className:"space-y-2",children:[t.jsx(we,{htmlFor:"runtime-apps-draft",children:n("sandbox.runtimeApps.title")}),x.length>0&&t.jsx("ul",{className:"space-y-1.5",children:x.map(j=>t.jsxs("li",{className:"flex h-9 items-center gap-2 rounded-md border border-border px-3",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:j.path}),t.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm","aria-label":n("sandbox.runtimeApps.remove",{path:j.path}),onClick:()=>g(x.filter(y=>y.path!==j.path)),children:t.jsx(vt,{})})]},j.path))}),i!==null?t.jsx(Ne,{id:"runtime-apps-draft",autoFocus:!0,placeholder:"apps/checkout",value:i,"aria-invalid":!!c,onChange:j=>{l(j.target.value),r(null)},onBlur:v,onKeyDown:j=>{j.key==="Enter"?(j.preventDefault(),v()):j.key==="Escape"&&(l(null),r(null))}}):x.length<os&&t.jsxs(Z,{id:"runtime-apps-draft",type:"button",variant:"outline",size:"sm",onClick:()=>l(""),children:[t.jsx(Be,{}),n("sandbox.runtimeApps.add")]}),c?t.jsx("p",{className:"text-xs text-destructive",children:c}):t.jsx("p",{className:"text-xs text-muted-foreground",children:n("sandbox.runtimeApps.description",{max:String(os)})})]})},e[2]=i,e[3]=c,e[4]=p,e[5]=n,e[6]=m):m=e[6];let u;return e[7]!==s||e[8]!==m?(u=t.jsx(xe,{control:s,name:"metadata.runtime.apps",render:m}),e[7]=s,e[8]=m,e[9]=u):u=e[9],u}function Rr(a){const e=Y.c(5),{control:s}=a,n=X();let i;e[0]!==n?(i=c=>{const{field:r}=c;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"field-description-tooltips",className:"font-normal text-foreground",children:n("sandbox.fieldDescriptionTooltipsField.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:n("sandbox.fieldDescriptionTooltipsField.description")})]}),t.jsx(et,{id:"field-description-tooltips",className:"shrink-0",checked:r.value??!1,onCheckedChange:f=>r.onChange(f)})]})},e[0]=n,e[1]=i):i=e[1];let l;return e[2]!==s||e[3]!==i?(l=t.jsx(xe,{control:s,name:"metadata.fieldDescriptionTooltips",render:i}),e[2]=s,e[3]=i,e[4]=l):l=e[4],l}function Lr(a){const e=Y.c(5),{control:s}=a,n=X();let i;e[0]!==n?(i=c=>{const{field:r}=c;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"legacy-blog-post-format",className:"font-normal text-foreground",children:n("sandbox.legacyBlogPostFormatField.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:n("sandbox.legacyBlogPostFormatField.description")})]}),t.jsx(et,{id:"legacy-blog-post-format",className:"shrink-0",checked:r.value??!1,onCheckedChange:f=>r.onChange(f)})]})},e[0]=n,e[1]=i):i=e[1];let l;return e[2]!==s||e[3]!==i?(l=t.jsx(xe,{control:s,name:"metadata.legacyBlogPostFormat",render:i}),e[2]=s,e[3]=i,e[4]=l):l=e[4],l}function Ur(a){const e=Y.c(32),{control:s,onCommit:n}=a,i=X();let l;e[0]!==i?(l=i("virtualMcp.virtualMcp.publishPolicySmart"),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==i?(c=i("virtualMcp.virtualMcp.publishPolicySmartDescription"),e[2]=i,e[3]=c):c=e[3];let r;e[4]!==l||e[5]!==c?(r={value:"smart",label:l,description:c},e[4]=l,e[5]=c,e[6]=r):r=e[6];let f;e[7]!==i?(f=i("virtualMcp.virtualMcp.publishPolicyCodeReview"),e[7]=i,e[8]=f):f=e[8];let o;e[9]!==i?(o=i("virtualMcp.virtualMcp.publishPolicyCodeReviewDescription"),e[9]=i,e[10]=o):o=e[10];let p;e[11]!==f||e[12]!==o?(p={value:"code-review",label:f,description:o},e[11]=f,e[12]=o,e[13]=p):p=e[13];let m;e[14]!==i?(m=i("virtualMcp.virtualMcp.publishPolicyOpen"),e[14]=i,e[15]=m):m=e[15];let u;e[16]!==i?(u=i("virtualMcp.virtualMcp.publishPolicyOpenDescription"),e[16]=i,e[17]=u):u=e[17];let h;e[18]!==m||e[19]!==u?(h={value:"open",label:m,description:u},e[18]=m,e[19]=u,e[20]=h):h=e[20];let d;e[21]!==r||e[22]!==p||e[23]!==h?(d=[r,p,h],e[21]=r,e[22]=p,e[23]=h,e[24]=d):d=e[24];const x=d;let g;e[25]!==n||e[26]!==x||e[27]!==i?(g=j=>{const{field:y}=j,b=y.value??"smart";return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"publish-policy",className:"font-normal text-foreground",children:i("virtualMcp.virtualMcp.publishing")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("virtualMcp.virtualMcp.publishingDescription")})]}),t.jsxs(Le,{value:b,onValueChange:w=>{y.onChange(w),n()},children:[t.jsx(Ee,{id:"publish-policy",className:"w-44 shrink-0",children:t.jsx(ze,{})}),t.jsx(Re,{className:"max-w-80",children:x.map(Br)})]})]})},e[25]=n,e[26]=x,e[27]=i,e[28]=g):g=e[28];let v;return e[29]!==s||e[30]!==g?(v=t.jsx(xe,{name:"metadata.publishPolicy",control:s,render:g}),e[29]=s,e[30]=g,e[31]=v):v=e[31],v}function Br(a){return t.jsx(Se,{value:a.value,description:a.description,children:a.label},a.value)}function Yr(a){const e=Y.c(24),{control:s,onCommit:n}=a,i=X();let l;e[0]!==i?(l=i("sandbox.cmsSettings.contentEditing.off"),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==i?(c=i("sandbox.cmsSettings.contentEditing.offDescription"),e[2]=i,e[3]=c):c=e[3];let r;e[4]!==l||e[5]!==c?(r={value:"off",label:l,description:c},e[4]=l,e[5]=c,e[6]=r):r=e[6];let f;e[7]!==i?(f=i("sandbox.cmsSettings.contentEditing.on"),e[7]=i,e[8]=f):f=e[8];let o;e[9]!==i?(o=i("sandbox.cmsSettings.contentEditing.onDescription"),e[9]=i,e[10]=o):o=e[10];let p;e[11]!==f||e[12]!==o?(p={value:"on",label:f,description:o},e[11]=f,e[12]=o,e[13]=p):p=e[13];let m;e[14]!==r||e[15]!==p?(m=[r,p],e[14]=r,e[15]=p,e[16]=m):m=e[16];const u=m;let h;e[17]!==n||e[18]!==u||e[19]!==i?(h=x=>{const{field:g}=x,v=g.value??null,j=en(v);return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(we,{htmlFor:"content-editing-mode",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.contentEditing.title")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.cmsSettings.contentEditing.description")})]}),t.jsxs(Le,{value:j,onValueChange:y=>{const b=ja.safeParse(y);b.success&&(g.onChange(ya(v,b.data)),n())},children:[t.jsx(Ee,{id:"content-editing-mode",className:"w-44 shrink-0",children:t.jsx(ze,{})}),t.jsx(Re,{className:"max-w-80",children:u.map(Wr)})]})]})},e[17]=n,e[18]=u,e[19]=i,e[20]=h):h=e[20];let d;return e[21]!==s||e[22]!==h?(d=t.jsx(xe,{name:"metadata.ui.layout",control:s,render:h}),e[21]=s,e[22]=h,e[23]=d):d=e[23],d}function Wr(a){return t.jsx(Se,{value:a.value,description:a.description,children:a.label},a.value)}function Ss(a){const e=a.metadata?.sidebarViews,s=a.metadata?.sidebarViewsVersion;return{effectiveViews:[...Ot(It(a.metadata),s)],rawViews:e===null?null:e?[...e]:void 0,version:s,seen:a.metadata?.sidebarViewsSeen??void 0}}function Ns(a,e){return a===e?!0:!a||!e||a.length!==e.length?!1:a.every((s,n)=>s===e[n])}function Kr(a,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...a,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...a,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...a,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...a,settingsDialogOpen:!1,settingsConnectionId:null};default:return a}}function Gr(a,e){switch(e.type){case"accumulate":{const s=a??{start:e.now,fields:new Set,saveCount:0,instructionsLength:null},n=new Set(s.fields);for(const i of e.fields)n.add(i);return{...s,fields:n,saveCount:s.saveCount+1,instructionsLength:e.instructionsLength??s.instructionsLength}}case"reset":return null}}function qr(a){const e=a.metadata?.runtime?.env;if(!e||e.length===0)return a;const s=e.filter(n=>{if(!n||typeof n!="object")return!1;const i=(n.key??"").trim();return!i||!wt.test(i)?!1:n.kind==="literal"?!0:n.kind==="secret"?!!n.secretId:!1});return s.length===e.length?a:{...a,metadata:{...a.metadata,runtime:{...a.metadata?.runtime??{},env:s}}}}async function Hr(a,e){const s=a?.idToken??null;if(s){const i=Cs(s);if(i)return i}const n=a?.userinfoEndpoint??null;if(n)try{const i=await fetch(n,{headers:{Authorization:`Bearer ${e}`}});if(i.ok){const l=await i.json(),c=typeof l.email=="string"?l.email:typeof l.upn=="string"?l.upn:typeof l.preferred_username=="string"?l.preferred_username:null;if(c)return c}}catch{}return Cs(e)}function Cs(a){try{const e=a.split(".");if(e.length===3&&e[1]){const s=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof s.email=="string")return s.email;if(typeof s.upn=="string")return s.upn;if(typeof s.preferred_username=="string")return s.preferred_username}}catch{}return null}function Qr({virtualMcp:a,contextSection:e}){const s=X(),n=si(),{org:i}=Ae(),l=li(),{data:c}=ri([a.id]),r=c?.get(a.id)?.last_used_at,f=$s(),o=Et(),p=ft(),m=Xs(a.id),u=JSON.stringify([i.id,a.id]),h=aa(a.metadata,m.snapshot()),d=In({resolver:$n(dr),defaultValues:{...a,metadata:{...cs(a.metadata),previewServerUrl:va(a.metadata),...h}}}),x=d.watch("connections"),g=Ia("multi_app_preview"),v=qi(a),j=Qs(a?.metadata),y=j&&en(d.watch("metadata.ui.layout"))==="off",b=As(a),w=b?{owner:b.owner,name:b.name,url:b.url}:null,[S,C]=q.useReducer(Kr,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[N,k]=q.useState(!1),[V,T]=q.useState(!1),{openSidePanel:_}=Zn(),{sendMessage:F}=Hn(),$=async()=>{if(V)return;const D=d.getValues("metadata.instructions");if(D?.trim()){T(!0);try{R(),_e("agent_instructions_improve_clicked",{agent_id:a.id,instructions_length:D.length}),_();const le=Gn(i.id);await F({tiptapDoc:Xn({managerAgentId:le.id,managerName:le.title,kind:"agent",id:a.id,instructions:D})})}finally{T(!1)}}},[A,P]=q.useReducer(Gr,null),H=()=>{A!==null&&(_e("agent_updated",{agent_id:a.id,fields:Array.from(A.fields),instructions_length:A.instructionsLength,save_count:A.saveCount,edit_duration_ms:Date.now()-A.start}),P({type:"reset"}))},{schedule:Q,flush:R}=Zt({delayMs:3e4,save:async()=>H()}),z=async()=>{const D=m.snapshot(),le={predicate:Ce=>rs(Ce.queryKey,i.id)},se=async()=>(await o.invalidateQueries({predicate:Ce=>rs(Ce.queryKey,i.id),refetchType:"all"}),ls(o,i.id,a.id)),ve=(Ce,He)=>{if(Ce){Ns(d.getValues("metadata.sidebarViews"),Ce.rawViews)||d.setValue("metadata.sidebarViews",Ce.rawViews,{shouldDirty:!1}),d.getValues("metadata.sidebarViewsVersion")!==Ce.version&&d.setValue("metadata.sidebarViewsVersion",Ce.version,{shouldDirty:!1}),Ns(d.getValues("metadata.sidebarViewsSeen"),Ce.seen)||d.setValue("metadata.sidebarViewsSeen",Ce.seen,{shouldDirty:!1});return}He!==null&&(d.setValue("metadata.sidebarViews",[...He],{shouldDirty:!1}),d.setValue("metadata.sidebarViewsVersion",na,{shouldDirty:!1}))},Me=la(D),Ie=Object.keys(d.control._formState.dirtyFields);if(Ie.length===0&&!Me){await m.settle({snapshot:D,saved:!0,authoritativeViews:D?.persistedViews});return}const Ge=Ie.length>0?Ie:["metadata"],ot=Ge.includes("metadata"),qe=d.getValues();d.reset(qe,{keepValues:!0});const tt=qr(qe),pn=ls(o,i.id,a.id),hn=ra({sidebarViews:tt.metadata?.sidebarViews,sidebarViewsVersion:tt.metadata?.sidebarViewsVersion},D,pn?.metadata);tt.metadata={...cs(tt.metadata),...hn};let Nt;try{Nt=await l.update.mutateAsync({id:a.id,data:tt})}catch(Ce){let He=null;try{He=await se()}catch{}const Wt=He?Ss(He):null,Kt=await m.settle({snapshot:D,saved:!1,authoritativeViews:Wt?.effectiveViews});throw Kt.settledLatest&&ve(Wt,Kt.reconciledViews),Ce}await o.cancelQueries(le),oa(o,i.id,Nt);const Bt=Ss(Nt),Yt=await m.settle({snapshot:D,saved:!0,authoritativeViews:Bt.effectiveViews});Yt.settledLatest&&ve(Bt,Yt.reconciledViews),P({type:"accumulate",now:Date.now(),fields:Ge,instructionsLength:ot?qe.metadata?.instructions?.length??0:null}),Q()},K=()=>$a(u,z),{schedule:E,flush:L}=Zt({save:K});q.useEffect(()=>{const D=d.watch(()=>E());return()=>D.unsubscribe()},[]);const G=()=>{_e("connections_dialog_opened",{source:"agent_settings",mode:"add"}),C({type:"SET_ADD_DIALOG_OPEN",payload:!0})},J=async D=>{const le=d.getValues("connections");if(le.some(Me=>Me.connection_id===D))return;d.setValue("connections",[...le,{connection_id:D,selected_tools:Vt.tools,selected_resources:Vt.resources,selected_prompts:Vt.prompts}],{shouldDirty:!0}),C({type:"SET_ADD_DIALOG_OPEN",payload:!1});const se=new URL(`/api/${i.slug}/mcp/${D}`,window.location.origin),ve=await Jt({url:se.href,token:null,orgId:i.id});ve.supportsOAuth&&!ve.isAuthenticated&&await B(D)},ee=D=>{const se=d.getValues("connections").filter(ve=>ve.connection_id!==D);d.setValue("connections",se,{shouldDirty:!0})},M=(D,le)=>{const se=d.getValues("connections");if(se.some(ve=>ve.connection_id===le)){ie.error(s("virtualMcp.virtualMcp.instanceAlreadyAdded"));return}d.setValue("connections",se.map(ve=>ve.connection_id===D?{...ve,connection_id:le}:ve),{shouldDirty:!0})},O=async D=>{if(d.getValues("connections").find(se=>se.connection_id===D))try{const{item:se}=await p.call("COLLECTION_CONNECTIONS_GET",{id:D});if(!se)return;const ve=se.title.replace(/\s*\(.*?\)\s*$/,""),Me=qn("conn"),Ie=`${ve} (${Date.now().toString(36).slice(-4)})`;await f.create.mutateAsync({id:Me,title:Ie,description:se.description??null,connection_type:se.connection_type,connection_url:se.connection_url??null,connection_token:null,icon:se.icon??null,app_name:se.app_name??null,app_id:se.app_id??null,connection_headers:se.connection_headers??null});const Ge=new URL(`/api/${i.slug}/mcp/${Me}`,window.location.origin),ot=await Jt({url:Ge.href,token:null,orgId:i.id});if(ot.supportsOAuth&&!ot.isAuthenticated){const qe=await B(Me);if(!qe){await f.delete.mutateAsync(Me);return}await f.update.mutateAsync({id:Me,data:{title:`${ve} (${qe})`}})}M(D,Me),ie.success(s("virtualMcp.virtualMcp.newInstanceCreated"))}catch(se){console.error("Failed to create instance:",se),ie.error(s("virtualMcp.virtualMcp.failedToCreateInstance"))}},U=D=>{C({type:"OPEN_SETTINGS",payload:D})},B=async D=>{const{token:le,tokenInfo:se,error:ve}=await ii({connectionId:D,orgSlug:i.slug,scope:"offline_access"});if(ve||!le)return ie.error(s("virtualMcp.virtualMcp.authenticationFailed",{error:ve??""})),null;if(se)try{const Ie=await fetch(`/api/${i.slug}/connections/${D}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:se.accessToken,refreshToken:se.refreshToken,expiresIn:se.expiresIn,scope:se.scope,clientId:se.clientId,clientSecret:se.clientSecret,tokenEndpoint:se.tokenEndpoint})});if(!Ie.ok)console.error("Failed to save OAuth token:",await Ie.text()),await f.update.mutateAsync({id:D,data:{connection_token:le}});else try{await f.update.mutateAsync({id:D,data:{}})}catch(Ge){console.warn("Failed to refresh connection tools after OAuth:",Ge)}}catch(Ie){console.error("Error saving OAuth token:",Ie),await f.update.mutateAsync({id:D,data:{connection_token:le}})}else await f.update.mutateAsync({id:D,data:{connection_token:le}});const Me=new URL(`/api/${i.slug}/mcp/${D}`,window.location.origin);return await o.invalidateQueries({queryKey:At.isMCPAuthenticated(Me.href,null)}),ie.success(s("virtualMcp.virtualMcp.authenticationSuccessful")),Hr(se,le)},W=()=>{const D=d.getValues("metadata.instructions")??"",le=s("virtualMcp.virtualMcp.promptTemplateContent"),se=D.trim()?`${D}

${le}`:le;d.setValue("metadata.instructions",se,{shouldDirty:!0})},re=new Set(x.map(D=>D.connection_id)),{section:oe}=Zl(),me=e!==null,ne=e==="instructions"?null:e??oe,ue=ne==="general",fe=me?e==="instructions":ue,pe=xa(a.id),ce=Fn(a.metadata),ge=ql({virtualMcpId:a.id,form:d,flushAndSave:L}),je=pt(),[de,I]=q.useState(!1),te=async()=>{R();try{await l.delete.mutateAsync(a.id),_e("agent_deleted",{agent_id:a.id,source:"agent_detail"}),ie.success(s("virtualMcp.virtualMcp.agentDeleted",{title:a.title})),je({to:"/$org",params:{org:i.slug}})}catch{}},Pe=t.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{_e("agent_connect_modal_opened",{agent_id:a.id}),C({type:"SET_SHARE_DIALOG_OPEN",payload:!0})},children:[t.jsx(An,{size:14}),s("virtualMcp.virtualMcp.connect")]}),he=t.jsxs("div",{className:"flex items-center gap-2",children:[!d.watch("metadata.instructions")?.trim()&&t.jsx(Z,{variant:"outline",size:"sm",onClick:W,children:s("virtualMcp.virtualMcp.promptTemplate")}),t.jsxs(Z,{variant:"outline",size:"sm",disabled:V||!d.watch("metadata.instructions")?.trim(),onClick:$,children:[t.jsx(dt,{size:13}),s("virtualMcp.virtualMcp.improve")]})]});return t.jsxs(Ke,{children:[t.jsxs(t.Fragment,{children:[!me&&t.jsxs(t.Fragment,{children:[t.jsx(Ke.Title,{children:s("virtualMcp.settings.title")}),t.jsx(Jl,{section:ne??"general"})]}),t.jsx(Ke.Actions,{secondary:ne==="connections"?Pe:void 0,children:ne==="connections"?t.jsxs(Z,{size:"sm",onClick:G,children:[t.jsx(Be,{size:14}),s("virtualMcp.virtualMcp.addConnection")]}):ne==="general"?Pe:null}),t.jsx(Ke.Content,{children:t.jsx(Ke.Container,{width:"standard",className:"@container/project-settings",children:t.jsxs(En,{children:[ne==="views"&&t.jsx(Wl,{views:ge}),ue&&t.jsxs(t.Fragment,{children:[t.jsx(Xl,{form:d,onCommit:L}),t.jsx(Hl,{form:d,onCommit:L})]}),ne==="connections"&&t.jsx("section",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:x.length===0?t.jsxs("button",{type:"button",onClick:G,className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx(Be,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:s("virtualMcp.virtualMcp.noConnectionsYet")})]}):x.map(D=>t.jsx(Xe,{fallback:()=>null,children:t.jsx(q.Suspense,{fallback:t.jsx(rn,{}),children:t.jsx(Pl,{connection_id:D.connection_id,usedConnectionIds:re,onOpenSettings:()=>U(D.connection_id),onRemove:()=>ee(D.connection_id),onAuthenticate:B,onSwitchInstance:M,onNewInstance:()=>O(D.connection_id)})})},D.connection_id))})}),fe&&t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground",children:s("virtualMcp.virtualMcp.instructions")}),he]}),t.jsx(xe,{name:"metadata.instructions",control:d.control,render:({field:D})=>t.jsxs("div",{className:"relative rounded-xl shadow-edge bg-card focus-within-ring",children:[t.jsx(ut,{...D,value:D.value??"",onChange:le=>{D.onChange(le)},onBlur:()=>{D.onBlur(),L()},placeholder:s("virtualMcp.virtualMcp.instructionsPlaceholder"),className:"min-h-[200px] max-h-[360px] overflow-auto resize-none text-base text-muted-foreground placeholder:text-muted-foreground/40 leading-relaxed border-0 shadow-none px-4 py-3 pr-11 focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent",style:{boxShadow:"none"}}),t.jsxs(Ve,{delayDuration:0,children:[t.jsx(Te,{asChild:!0,children:t.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2 text-muted-foreground",onClick:()=>k(!0),"aria-label":s("virtualMcp.virtualMcp.openFullscreenEditor"),children:t.jsx(oi,{size:14})})}),t.jsx(De,{side:"left",children:s("virtualMcp.virtualMcp.fullscreen")})]})]})})]}),fe&&t.jsx(rl,{form:d}),ne==="site"&&!j&&t.jsx(Oe,{children:t.jsx(ke,{children:t.jsx($e,{title:s("virtualMcp.settings.cmsEmptyTitle"),description:s("virtualMcp.settings.cmsEmpty"),action:t.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:t.jsx(Ft,{to:".",search:{section:"repository"},children:s("virtualMcp.settings.repository.open")})})})})}),ne==="site"&&j&&t.jsx(Oe,{title:s("sandbox.cmsSettings.title"),children:t.jsxs(ke,{children:[t.jsx(be,{children:t.jsx(Yr,{control:d.control,onCommit:L})}),!y&&t.jsx(be,{children:t.jsx(Rr,{control:d.control})}),!y&&t.jsx(be,{children:t.jsx(Lr,{control:d.control})}),!y&&v&&t.jsx(be,{children:t.jsx(Ur,{control:d.control,onCommit:L})})]})}),ne==="site"&&!y&&t.jsx(Oe,{title:s("sandbox.cmsSettings.preview.title"),description:s("sandbox.cmsSettings.preview.description"),children:t.jsx(ke,{children:t.jsx(cr,{control:d.control,isBlocksV8:pe,previewServerUrl:d.watch("metadata.previewServerUrl"),fastPreview:d.watch("metadata.fastPreview")})})}),ne==="site"&&t.jsx(ir,{virtualMcp:a}),ne==="site"&&pe&&ce&&t.jsx(sr,{orgSlug:i.slug,virtualMcpId:a.id,site:ce}),ne==="repository"&&t.jsx(Dr,{repo:w,onConnect:D=>(d.setValue("metadata.repository",D,{shouldDirty:!0}),L())}),ne==="repository"&&t.jsx(Oe,{title:s("virtualMcp.settings.repository.runtimeTitle"),description:s("virtualMcp.settings.repository.runtimeDescription"),children:t.jsxs(ke,{children:[t.jsx(be,{children:t.jsx(Fr,{control:d.control})}),g&&t.jsx(be,{children:t.jsx(zr,{control:d.control})}),t.jsx(be,{children:t.jsx(wr,{control:d.control,form:d,virtualMcpId:a.id,orgSlug:i.slug,sandboxMap:a.metadata.sandboxMap})})]})}),ue&&t.jsx(Oe,{title:s("virtualMcp.settings.groups.details"),children:t.jsxs(ke,{children:[t.jsx($e,{title:s("virtualMcp.virtualMcp.createdBy"),action:t.jsx(Qn,{id:a.created_by,size:"2xs",className:"text-sm text-muted-foreground"})}),t.jsx($e,{title:s("virtualMcp.virtualMcp.created"),action:t.jsx("span",{className:"text-sm text-muted-foreground",children:al(new Date(a.created_at),"PP",{locale:n})})}),t.jsx($e,{title:s("virtualMcp.virtualMcp.lastUsedLabel"),action:t.jsx("span",{className:"text-sm text-muted-foreground",children:r?ni(new Date(r),{addSuffix:!0,locale:n}):s("virtualMcp.virtualMcp.neverUsed")})})]})}),ue&&t.jsx(Oe,{title:s("virtualMcp.settings.groups.advanced"),children:t.jsx(ke,{children:t.jsx($e,{title:s("virtualMcp.virtualMcp.deleteAgent"),description:s("virtualMcp.virtualMcp.deleteAgentDescription"),action:t.jsxs(Z,{variant:"outline",size:"sm",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:()=>I(!0),children:[t.jsx(vt,{size:14}),s("virtualMcp.virtualMcp.deleteAgent")]})})})})]})})},e??ne)]}),t.jsx(zn,{open:de,onOpenChange:I,children:t.jsxs(Rn,{children:[t.jsxs(Ln,{children:[t.jsx(Un,{children:s("virtualMcp.virtualMcp.deleteAgentConfirm")}),t.jsx(Bn,{children:s("virtualMcp.virtualMcp.deleteAgentConfirmDescription",{title:a.title})})]}),t.jsxs(Yn,{children:[t.jsx(Wn,{children:s("virtualMcp.virtualMcp.cancel")}),t.jsx(Kn,{onClick:te,variant:"destructive",children:s("virtualMcp.virtualMcp.delete")})]})]})}),t.jsx(di,{open:S.addDialogOpen,onOpenChange:D=>C({type:"SET_ADD_DIALOG_OPEN",payload:D}),agentId:a.id,addedConnectionIds:re,onAdd:J}),t.jsx(Dl,{open:S.settingsDialogOpen,onOpenChange:D=>{D||C({type:"CLOSE_SETTINGS"})},selectedId:S.settingsConnectionId,form:d,connections:x,onAuthenticate:B}),t.jsx(br,{open:S.shareDialogOpen,onOpenChange:D=>C({type:"SET_SHARE_DIALOG_OPEN",payload:D}),virtualMcp:a}),t.jsx(lt,{open:N,onOpenChange:k,children:t.jsxs(at,{className:"w-[90vw] sm:max-w-6xl h-[85vh] flex flex-col p-0 gap-0",children:[t.jsx(xt,{className:"px-6 pt-6 pb-3 border-b border-border shrink-0",children:t.jsx(ht,{children:s("virtualMcp.virtualMcp.instructions")})}),t.jsx("div",{className:"flex-1 min-h-0 p-6",children:t.jsx(xe,{name:"metadata.instructions",control:d.control,render:({field:D})=>t.jsx(ut,{...D,value:D.value??"",onChange:le=>{D.onChange(le)},onBlur:()=>{D.onBlur(),L()},placeholder:s("virtualMcp.virtualMcp.instructionsPlaceholder"),className:"w-full h-full resize-none text-base text-muted-foreground placeholder:text-muted-foreground/40 leading-relaxed rounded-xl shadow-edge px-4 py-3 focus-ring bg-card border-0",style:{boxShadow:"none"}})})})]})})]})}function fc(a){const e=Y.c(22),{virtualMcpId:s,contextSection:n}=a,i=n===void 0?null:n,l=X(),c=pt(),{org:r}=Ae(),f=Fs(s);if(!f){let u;e[0]!==l?(u=l("virtualMcp.virtualMcp.spaceNotFound"),e[0]=l,e[1]=u):u=e[1];let h;e[2]!==l?(h=l("virtualMcp.virtualMcp.spaceNotFoundDescription"),e[2]=l,e[3]=h):h=e[3];let d;e[4]!==c||e[5]!==r.slug?(d=()=>c({to:"/$org",params:{org:r.slug}}),e[4]=c,e[5]=r.slug,e[6]=d):d=e[6];let x;e[7]!==l?(x=l("virtualMcp.virtualMcp.backToSpaces"),e[7]=l,e[8]=x):x=e[8];let g;e[9]!==d||e[10]!==x?(g=t.jsx(Z,{variant:"outline",onClick:d,children:x}),e[9]=d,e[10]=x,e[11]=g):g=e[11];let v;return e[12]!==u||e[13]!==h||e[14]!==g?(v=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Jn,{title:u,description:h,actions:g})}),e[12]=u,e[13]=h,e[14]=g,e[15]=v):v=e[15],v}let o;e[16]!==f?(o=As(f)?.connectionId??"",e[16]=f,e[17]=o):o=e[17];const p=`${f.id}:${o}`;let m;return e[18]!==i||e[19]!==p||e[20]!==f?(m=t.jsx(Qr,{virtualMcp:f,contextSection:i},p),e[18]=i,e[19]=p,e[20]=f,e[21]=m):m=e[21],m}export{fc as V};