PageSourceSearch

https://pltt.ai/_next/static/chunks/2hai926t5jxmy.js

js pltt.ai collected 2026-10-05 15:19:27 UTC 54,015 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,794786,e=>{"use strict";var n=e.i(843476),t=e.i(500932),a=e.i(271645),s=e.i(35842),o=e.i(813610),i=e.i(315865),c=e.i(171650),l=e.i(553011),r=e.i(146212),d=e.i(209881);e.i(785269);var p=e.i(322831),m=e.i(846696),h=e.i(209165),u=e.i(402389),g=e.i(37398),v=e.i(709382),y=e.i(30728),b=e.i(762603),x=e.i(569552),f=e.i(529682),j=e.i(982484),N=e.i(244002),k=e.i(310373),w=e.i(96213),S=e.i(645182),_=e.i(521135),C=e.i(794933),A=e.i(713967),T=e.i(706347),P=e.i(549127);let E=[{id:"connected",label:"MY WORKSPACE",title:"My Workspace",hint:"Connected agents and connections — act on the card, ⋯ for setting and removal"},{id:"agents",label:"ALL",title:"All Agents",hint:"Preset agents — connecting adds them to My Workspace and the desktop"},{id:"company",label:"COMPANY",title:"Company",hint:"Company-only agents by department — Subscribe copies them to your library"},{id:"private",label:"PERSONAL",title:"Personal",hint:"Agents you built yourself"},{id:"apps",label:"APPS",title:"Apps",hint:"General app connections such as Gmail and Notion"},{id:"channels",label:"MESSENGER",title:"Messenger",hint:"Messenger channels such as Slack and Telegram"},{id:"mcp",label:"MCP",title:"MCP",hint:"Model Context Protocol server connections"}],R=[{item:"connected"},{group:"AGENTS"},{item:"agents"},{item:"company"},{item:"private"},{group:"CONNECTIONS"},{item:"apps"},{item:"channels"},{item:"mcp"}],O="palette_lib_paused_v1",L=new Set(["slack","telegram","discord","whatsapp","teams"]),D=new Set(["telegram"]),M={google:o.GoogleLogo,slack:r.SlackLogo,telegram:d.TelegramLogo,meta:i.MetaLogo,notion:c.Notebook};function $(e){let a,s=(0,t.c)(2),{provider:o}=e,i=M[o]??l.Plugs;return s[0]!==i?(a=(0,n.jsx)(i,{size:40,weight:"regular"}),s[0]=i,s[1]=a):a=s[1],a}function I(e,n){return(0,j.groupAppsByCategory)(e).map(([e,t])=>({group:e,members:t,connected:t.filter(e=>n(e.id)).length}))}function G(e){return e.slice().sort((e,n)=>Number(!!e.soon)-Number(!!n.soon)||e.name.localeCompare(n.name)||e.key.localeCompare(n.key))}function W(e){if(!e)return null;let n=e.trim().toLowerCase();return"home"===n||"store"===n?"home":"company-only"===n||"company_only"===n?"company":"messenger"===n||"channels"===n?"channels":E.some(e=>e.id===n)?n:null}let F=[{id:"gmail",section:"apps",kind:"APP",name:"Gmail",desc:"Mail search and draft actions.",glyph:"mailer"},{id:"notion",section:"apps",kind:"APP",name:"Notion",desc:"Pages, databases, and workspace notes.",glyph:"doc"},{id:"drive",section:"apps",kind:"APP",name:"Google Drive",desc:"Files, folders, and shared documents.",glyph:"drive"},{id:"sheets",section:"apps",kind:"APP",name:"Sheets",desc:"Spreadsheet rows and exports.",glyph:"sheet"},{id:"calendar",section:"apps",kind:"APP",name:"Calendar",desc:"Meetings and scheduling.",glyph:"schedule"},{id:"jira",section:"apps",kind:"APP",name:"Jira",desc:"Issues, sprints, and releases.",glyph:"workflow"},{id:"hubspot",section:"apps",kind:"APP",name:"HubSpot",desc:"Contacts, companies, and deals.",glyph:"target"},{id:"figma",section:"apps",kind:"APP",name:"Figma",desc:"Design files and comments.",glyph:"designer"},{id:"slack",section:"channels",kind:"CHANNEL",name:"Slack",desc:"Team channels and approvals.",glyph:"send"},{id:"telegram",section:"channels",kind:"CHANNEL",name:"Telegram",desc:"Bot alerts and messages.",glyph:"send"},{id:"whatsapp",section:"channels",kind:"CHANNEL",name:"WhatsApp",desc:"Customer notifications.",glyph:"send"},{id:"teams",section:"channels",kind:"CHANNEL",name:"Teams",desc:"Team messages and meeting alerts.",glyph:"send"},{id:"discord",section:"channels",kind:"CHANNEL",name:"Discord",desc:"Community operations.",glyph:"send"},{id:"email",section:"channels",kind:"CHANNEL",name:"Email",desc:"Outbound email notifications.",glyph:"mailer"},{id:"sms",section:"channels",kind:"CHANNEL",name:"SMS",desc:"Short alert delivery.",glyph:"alert"},{id:"webhook",section:"channels",kind:"CHANNEL",name:"Webhook",desc:"HTTP event delivery.",glyph:"workflow"}],U=[{id:"gmail",name:"Gmail",desc:"Search, read, draft and send email.",glyph:"mailer",prefixes:["gmail."],scopes:["https://www.googleapis.com/auth/gmail.readonly","https://www.googleapis.com/auth/gmail.send","https://www.googleapis.com/auth/gmail.compose"]},{id:"drive",name:"Google Drive",desc:"List, search and read Google Drive files.",glyph:"drive",prefixes:["drive."],scopes:["https://www.googleapis.com/auth/drive.readonly"]},{id:"calendar",name:"Calendar",desc:"List and create events across your calendars.",glyph:"schedule",prefixes:["calendar."],scopes:["https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/calendar.events"]},{id:"meet",name:"Google Meet",desc:"Create events with a Google Meet video link.",glyph:"video",prefixes:["calendar.create_event"],scopes:["https://www.googleapis.com/auth/calendar.events"]},{id:"sheets",name:"Sheets",desc:"Read ranges, append and update rows.",glyph:"sheet",prefixes:["sheets."],scopes:["https://www.googleapis.com/auth/spreadsheets"]},{id:"docs",name:"Docs",desc:"Read and create Google Docs.",glyph:"doc",prefixes:["docs."],scopes:["https://www.googleapis.com/auth/documents"]},{id:"slides",name:"Slides",desc:"Read text from presentations.",glyph:"image",prefixes:["slides."],scopes:["https://www.googleapis.com/auth/presentations.readonly"]},{id:"contacts",name:"Contacts",desc:"Search and list your Google Contacts.",glyph:"target",prefixes:["contacts."],scopes:["https://www.googleapis.com/auth/contacts.readonly"]},{id:"tasks",name:"Tasks",desc:"List and create Google Tasks.",glyph:"check",prefixes:["tasks."],scopes:["https://www.googleapis.com/auth/tasks"]},{id:"forms",name:"Forms",desc:"Read forms and their responses.",glyph:"qa",prefixes:["forms."],scopes:["https://www.googleapis.com/auth/forms.body.readonly","https://www.googleapis.com/auth/forms.responses.readonly"]}],B=new Set(U.map(e=>e.id));function H(e){let a,s=(0,t.c)(4),{item:o}=e;if("AGENT"===o.kind){let e,t=o.glyph;return s[0]!==t?(e=(0,n.jsx)(N.Seal,{glyph:t}),s[0]=t,s[1]=e):e=s[1],e}return s[2]!==o.glyph?(a=(0,n.jsx)(N.Glyph,{name:o.glyph}),s[2]=o.glyph,s[3]=a):a=s[3],a}function z(e){let a,s,o,i,c,l,r,d,m,h,u,g,v,y,b,x,f,j,N,k,w,S,_=(0,t.c)(63),{c:C,isAdmin:A,onDiscover:T,onToggle:E,onRemove:R}=e,{t:O}=(0,p.useTranslation)("paletteOs");return _[0]!==C.status?(a=C.status.toUpperCase(),_[0]=C.status,_[1]=a):a=_[1],_[2]!==a?(s=(0,n.jsxs)("span",{children:["MCP · ",a]}),_[2]=a,_[3]=s):s=_[3],_[4]!==C.slug?(o=(0,n.jsxs)("span",{className:"idx",children:["mcp.",C.slug]}),_[4]=C.slug,_[5]=o):o=_[5],_[6]!==s||_[7]!==o?(i=(0,n.jsxs)("div",{className:"dTag",children:[s,o]}),_[6]=s,_[7]=o,_[8]=i):i=_[8],_[9]!==C.name?(c=(0,n.jsx)("h3",{children:C.name}),_[9]=C.name,_[10]=c):c=_[10],_[11]!==O?(l=O("connect.details","Details"),_[11]=O,_[12]=l):l=_[12],_[13]!==l?(r=(0,n.jsx)("label",{children:l}),_[13]=l,_[14]=r):r=_[14],_[15]!==O?(d=O("connect.metaServer","Server"),_[15]=O,_[16]=d):d=_[16],_[17]!==C.server_url||_[18]!==d?(m=[d,C.server_url],_[17]=C.server_url,_[18]=d,_[19]=m):m=_[19],_[20]!==O?(h=O("connect.metaTransport","Transport"),_[20]=O,_[21]=h):h=_[21],_[22]!==C.transport||_[23]!==h?(u=[h,C.transport],_[22]=C.transport,_[23]=h,_[24]=u):u=_[24],_[25]!==O?(g=O("connect.metaAuth","Auth"),_[25]=O,_[26]=g):g=_[26],_[27]!==C.auth_type||_[28]!==g?(v=[g,C.auth_type],_[27]=C.auth_type,_[28]=g,_[29]=v):v=_[29],_[30]!==O?(y=O("connect.metaDiscovered","Discovered"),_[30]=O,_[31]=y):y=_[31],_[32]!==C.last_discovered_at||_[33]!==O?(b=C.last_discovered_at?(0,P.relTime)(C.last_discovered_at):O("connect.never","never"),_[32]=C.last_discovered_at,_[33]=O,_[34]=b):b=_[34],_[35]!==y||_[36]!==b?(x=[y,b],_[35]=y,_[36]=b,_[37]=x):x=_[37],_[38]!==u||_[39]!==v||_[40]!==x||_[41]!==m?(f=(0,n.jsx)("div",{className:"po-metaGrid",children:[m,u,v,x].map(K)}),_[38]=u,_[39]=v,_[40]=x,_[41]=m,_[42]=f):f=_[42],_[43]!==f||_[44]!==r?(j=(0,n.jsxs)("div",{className:"po-field",children:[r,f]}
1),_[43]=f,_[44]=r,_[45]=j):j=_[45],_[46]!==C.last_error?(N=C.last_error&&(0,n.jsx)("div",{className:"poErr",children:C.last_error}),_[46]=C.last_error,_[47]=N):N=_[47],_[48]!==C.status||_[49]!==A||_[50]!==T||_[51]!==R||_[52]!==E||_[53]!==O?(k=A?(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:22,paddingTop:16,borderTop:"1px solid var(--line)"},children:[(0,n.jsx)("button",{className:"po-btn po-btn--ghost",onClick:T,children:O("connect.refreshTools","Refresh tools")}),(0,n.jsx)("button",{className:"po-btn po-btn--ghost",onClick:E,children:"disabled"===C.status?O("connect.enable","Enable"):O("connect.disable","Disable")}),(0,n.jsx)("button",{className:"po-btn po-btn--danger",onClick:R,children:O("connect.delete","Delete")})]}):(0,n.jsx)("div",{style:{marginTop:22,fontSize:10,letterSpacing:".12em",textTransform:"uppercase",opacity:.5},children:O("connect.managedByAdmin","Managed by your admin")}),_[48]=C.status,_[49]=A,_[50]=T,_[51]=R,_[52]=E,_[53]=O,_[54]=k):k=_[54],_[55]!==j||_[56]!==N||_[57]!==k||_[58]!==c?(w=(0,n.jsxs)("div",{className:"dBody",children:[c,j,N,k]}),_[55]=j,_[56]=N,_[57]=k,_[58]=c,_[59]=w):w=_[59],_[60]!==w||_[61]!==i?(S=(0,n.jsxs)(n.Fragment,{children:[i,w]}),_[60]=w,_[61]=i,_[62]=S):S=_[62],S}function K(e){let[t,a]=e;return(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:t}),(0,n.jsx)("div",{className:"amv",style:{wordBreak:"break-all"},children:a})]},t)}function V({s:e,isAdmin:t,onConnect:s,onTest:o,onDisconnect:i}){let{t:c}=(0,p.useTranslation)("paletteOs"),[l,r]=(0,a.useState)(null),[d,m]=(0,a.useState)(null),[h,u]=(0,a.useState)(null),g="connected"===e.status,v=g||"error"===e.status||"expired"===e.status,y=async e=>{if(!l){r(e),u(null),m(null);try{if("connect"===e)await s();else{let e=await o();m(e.ok?e.account_label?c("connect.testOkAccount","test ok · {{account}}",{account:e.account_label}):c("connect.testOk","test ok"):c("connect.testFailed","test failed"))}}catch(e){u(e instanceof Error?e.message:c("connect.requestFailed","Request failed"))}finally{r(null)}}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"dTag",children:[(0,n.jsxs)("span",{children:["SERVICE · ",e.status.replace("_"," ").toUpperCase()]}),(0,n.jsxs)("span",{className:"idx",children:["svc.",e.provider]})]}),(0,n.jsxs)("div",{className:"dBody",children:[(0,n.jsx)("h3",{children:e.display_name}),(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:c("connect.details","Details")}),(0,n.jsx)("div",{className:"po-metaGrid",children:[[c("connect.metaAccount","Account"),e.account_label??"—"],[c("connect.metaConnectedBy","Connected by"),e.connected_by_name??"—"],[c("connect.metaConnected","Connected"),e.connected_at?(0,P.relTime)(e.connected_at):c("connect.never","never")],[c("connect.metaTokenExpires","Token expires"),e.expires_at?(0,P.relTime)(e.expires_at):"—"]].map(([e,t])=>(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e}),(0,n.jsx)("div",{className:"amv",style:{wordBreak:"break-all"},children:t})]},e))})]}),(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:c("connect.tools","Tools")}),(0,n.jsxs)("div",{children:[e.tools.map(e=>(0,n.jsxs)("div",{style:{padding:"8px 0",borderTop:"1px solid var(--line)",opacity:e.scope_granted?1:.4},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:[(0,n.jsx)("span",{style:{fontSize:12,fontWeight:500},children:e.name}),e.mutating&&(0,n.jsx)("span",{style:{fontSize:8,letterSpacing:".14em",textTransform:"uppercase",border:"1px solid var(--ink)",padding:"1px 5px"},children:c("connect.writeBadge","write")}),!e.scope_granted&&(0,n.jsx)("span",{style:{fontSize:8,letterSpacing:".14em",textTransform:"uppercase",opacity:.7},children:c("connect.noScope","no scope")})]}),(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)",marginTop:2},children:e.description})]},e.name)),0===e.tools.length&&(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)"},children:c("connect.noToolsDeclared","No tools declared.")})]})]}),e.last_error&&(0,n.jsx)("div",{className:"poErr",children:e.last_error}),h&&(0,n.jsx)("div",{className:"poErr",children:h}),d&&(0,n.jsx)("div",{style:{fontSize:10,letterSpacing:".12em",textTransform:"uppercase",opacity:.6,margin:"8px 0"},children:d}),t?(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:22,paddingTop:16,borderTop:"1px solid var(--line)"},children:"coming_soon"===e.status?(0,n.jsx)("span",{style:{fontSize:10,letterSpacing:".12em",textTransform:"uppercase",opacity:.5},children:c("connect.comingSoon","Coming soon")}):(0,n.jsxs)(n.Fragment,{children:[!g&&(0,n.jsx)("button",{className:"po-btn",disabled:null!==l,onClick:()=>void y("connect"),children:"connect"===l?c("connect.redirecting","Redirecting…"):v?c("connect.reconnect","Reconnect →"):c("connect.connectArrow","Connect →")}),v&&(0,n.jsx)("button",{className:"po-btn po-btn--ghost",disabled:null!==l,onClick:()=>void y("test"),children:"test"===l?c("connect.testing","Testing…"):c("connect.test","Test")}),v&&(0,n.jsx)("button",{className:"po-btn po-btn--danger",onClick:i,children:c("connect.disconnect","Disconnect")})]})}):(0,n.jsx)("div",{style:{marginTop:22,fontSize:10,letterSpacing:".12em",textTransform:"uppercase",opacity:.5},children:c("connect.managedByAdmin","Managed by your admin")})]})]})}function Y(e){let a,s,o,i,c,l,r,d,m,h,u,g,v,y,b,x,f,j,N,k,w,S,_,C=(0,t.c)(62),{b:A,isAdmin:T,onRemove:E}=e,{t:R}=(0,p.useTranslation)("paletteOs");C[0]!==A.channel_type?(a=A.channel_type.toUpperCase(),C[0]=A.channel_type,C[1]=a):a=C[1],C[2]!==a?(s=(0,n.jsxs)("span",{children:["CHANNEL · ",a]}),C[2]=a,C[3]=s):s=C[3],C[4]!==A.id?(o=(0,n.jsxs)("span",{className:"idx",children:["#",A.id]}),C[4]=A.id,C[5]=o):o=C[5],C[6]!==s||C[7]!==o?(i=(0,n.jsxs)("div",{className:"dTag",children:[s,o]}),C[6]=s,C[7]=o,C[8]=i):i=C[8],C[9]!==A.channel_type||C[10]!==R?(c=R("connect.bindingTitle","{{channel}} workspace",{channel:A.channel_type}
1),C[9]=A.channel_type,C[10]=R,C[11]=c):c=C[11],C[12]!==c?(l=(0,n.jsx)("h3",{children:c}),C[12]=c,C[13]=l):l=C[13],C[14]!==R?(r=R("connect.details","Details"),C[14]=R,C[15]=r):r=C[15],C[16]!==r?(d=(0,n.jsx)("label",{children:r}),C[16]=r,C[17]=d):d=C[17],C[18]!==R?(m=R("connect.metaWorkspace","Workspace"),C[18]=R,C[19]=m):m=C[19],C[20]!==A.external_workspace_id||C[21]!==m?(h=[m,A.external_workspace_id],C[20]=A.external_workspace_id,C[21]=m,C[22]=h):h=C[22],C[23]!==R?(u=R("connect.metaBotToken","Bot token"),C[23]=R,C[24]=u):u=C[24],C[25]!==A.has_bot_token||C[26]!==R?(g=A.has_bot_token?R("connect.statusConnected","connected"):R("connect.statusMissing","missing"),C[25]=A.has_bot_token,C[26]=R,C[27]=g):g=C[27],C[28]!==u||C[29]!==g?(v=[u,g],C[28]=u,C[29]=g,C[30]=v):v=C[30],C[31]!==R?(y=R("connect.metaTokenId","Token id"),C[31]=R,C[32]=y):y=C[32];let O=String(A.default_token_id);return C[33]!==y||C[34]!==O?(b=[y,O],C[33]=y,C[34]=O,C[35]=b):b=C[35],C[36]!==R?(x=R("connect.metaLinked","Linked"),C[36]=R,C[37]=x):x=C[37],C[38]!==A.created_at?(f=(0,P.relTime)(A.created_at),C[38]=A.created_at,C[39]=f):f=C[39],C[40]!==x||C[41]!==f?(j=[x,f],C[40]=x,C[41]=f,C[42]=j):j=C[42],C[43]!==h||C[44]!==v||C[45]!==b||C[46]!==j?(N=(0,n.jsx)("div",{className:"po-metaGrid",children:[h,v,b,j].map(q)}),C[43]=h,C[44]=v,C[45]=b,C[46]=j,C[47]=N):N=C[47],C[48]!==N||C[49]!==d?(k=(0,n.jsxs)("div",{className:"po-field",children:[d,N]}),C[48]=N,C[49]=d,C[50]=k):k=C[50],C[51]!==T||C[52]!==E||C[53]!==R?(w=T&&(0,n.jsx)("div",{style:{marginTop:22,paddingTop:16,borderTop:"1px solid var(--line)"},children:(0,n.jsx)("button",{className:"po-btn po-btn--danger",onClick:E,children:R("connect.removeBinding","Remove binding")})}),C[51]=T,C[52]=E,C[53]=R,C[54]=w):w=C[54],C[55]!==k||C[56]!==w||C[57]!==l?(S=(0,n.jsxs)("div",{className:"dBody",children:[l,k,w]}),C[55]=k,C[56]=w,C[57]=l,C[58]=S):S=C[58],C[59]!==S||C[60]!==i?(_=(0,n.jsxs)(n.Fragment,{children:[i,S]}),C[59]=S,C[60]=i,C[61]=_):_=C[61],_}function q(e){let[t,a]=e;return(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:t}),(0,n.jsx)("div",{className:"amv",children:a})]},t)}function J({agent:e,isAdmin:t,onRun:s,onOpenChat:o,onOpenSession:i,onChanged:c}){let{t:l}=(0,p.useTranslation)("paletteOs"),r=e.is_mine||t,{shares:d,loading:m,error:v,fetchShares:y,addShare:f,removeShare:j}=function(){let[e,n]=(0,a.useState)([]),[t,s]=(0,a.useState)(!1),[o,i]=(0,a.useState)(null),c=(0,a.useCallback)(async e=>{s(!0),i(null);try{let t=await (0,h.apiFetch)(`/api/v1/flows/agents/${e}/shares`),a=(await t.json()).shares;return n(a),a}catch(e){return i(e instanceof Error?e.message:u.default.t("hooksUi.agentShares.loadFailed","Couldn't load sharing settings")),[]}finally{s(!1)}},[]);return{shares:e,loading:t,error:o,fetchShares:c,addShare:(0,a.useCallback)(async(e,t)=>{let a=await (0,h.apiFetch)(`/api/v1/flows/agents/${e}/shares`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(null!==t&&"object"==typeof t?t:{user_id:t})}),s=await a.json();return n(e=>[...e,s]),s},[]),removeShare:(0,a.useCallback)(async(e,t)=>{await (0,h.apiFetch)(`/api/v1/flows/agents/${e}/shares/${t}`,{method:"DELETE"}),n(e=>e.filter(e=>e.id!==t))},[])}}(),{members:k}=(0,b.useOrgMembers)(),{teams:w}=(0,x.useOrgTeams)(),[S,_]=(0,a.useState)(""),[C,A]=(0,a.useState)(!1),[T,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{r&&y(e.agent_id)},[r,y,e.agent_id]);let R=d.find(e=>null===e.user_id&&null==e.team_id),O=d.filter(e=>null!==e.user_id),L=d.filter(e=>null!=e.team_id),D=R?l("connect.scopeOrgWide","ORG-WIDE"):O.length>0||L.length>0?l("connect.scopeShared","SHARED"):l("connect.scopePrivate","PRIVATE"),M=new Set(O.map(e=>e.user_id)),$=new Set(L.map(e=>e.team_id)),I=S.trim().toLowerCase(),G=I?k.filter(n=>n.id!==e.owner_user_id&&!M.has(n.id)&&`${n.name} ${n.email}`.toLowerCase().includes(I)):[],W=I?w.filter(e=>!$.has(e.id)&&e.name.toLowerCase().includes(I)):[],F=async e=>{if(!C){A(!0),E(null);try{await e(),c()}catch(e){E(e instanceof Error?e.message:l("connect.requestFailed","Request failed"))}finally{A(!1)}}},U=(0,g.describeSchedule)(e.routine);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"dTag",children:[(0,n.jsxs)("span",{children:[l("connect.customAgent","CUSTOM AGENT")," · ",r?D:l("connect.scopeShared","SHARED")]}),(0,n.jsxs)("span",{className:"idx",children:["agent.",e.agent_id]})]}),(0,n.jsxs)("div",{className:"dBody",children:[(0,n.jsx)("h3",{children:e.name}),(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:l("connect.details","Details")}),(0,n.jsx)("div",{className:"po-metaGrid",children:[[l("connect.metaField","Field"),e.field??"—"],[l("connect.metaPublishedBy","Published by"),e.is_mine?l("connect.you","You"):e.owner_name??"—"],[l("connect.metaUpdated","Updated"),e.updated_at?(0,P.relTime)(e.updated_at):"—"],[l("connect.metaSchedule","Schedule"),U??l("connect.none","None")]].map(([e,t])=>(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e}),(0,n.jsx)("div",{className:"amv",children:t})]},e))})]}),e.description&&(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:l("connect.description","Description")}),(0,n.jsx)("div",{style:{fontSize:13,fontWeight:300,lineHeight:1.6},children:e.description})]}),(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:14},children:[(0,n.jsx)("button",{className:"po-btn",onClick:s,children:(e.ui_type??"chat")==="app"?l("connect.openApp","Open app →"):l("connect.useAgent","Use agent →")}),(e.ui_type??"chat")==="app"&&o?(0,n.jsx)("button",{className:"po-btn po-btn--ghost",onClick:o,children:l("connect.openChatFallback","Open chat")}
1):null]}),r?(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:l("connect.sharing","Sharing")}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 0",borderTop:"1px solid var(--line)"},children:[(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:12,fontWeight:500},children:l("connect.everyoneInOrg","Everyone in the workspace")}),(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)"},children:R?l("connect.orgShareOn","All members can see and use this agent."):l("connect.orgShareOff","Not shared org-wide.")})]}),R?(0,n.jsx)("button",{className:"po-btn po-btn--danger",disabled:C,onClick:()=>void F(()=>j(e.agent_id,R.id)),children:l("connect.remove","Remove")}):(0,n.jsx)("button",{className:"po-btn",disabled:C,onClick:()=>void F(()=>f(e.agent_id,null)),children:l("connect.shareOrgWide","Share org-wide")})]}),(0,n.jsxs)("div",{style:{paddingTop:10},children:[(0,n.jsxs)("label",{className:"poSearch cnShareFind",children:[(0,n.jsx)(N.Glyph,{name:"h_search"}),(0,n.jsx)("input",{value:S,onChange:e=>_(e.target.value),placeholder:l("connect.sharePlaceholder","Share with a member — search by name or email"),"aria-label":l("connect.sharePlaceholder","Share with a member — search by name or email")})]}),W.slice(0,3).map(t=>(0,n.jsxs)("button",{type:"button",className:"cnLedgerRow",style:{width:"100%"},disabled:C,onClick:()=>{_(""),F(()=>f(e.agent_id,{team_id:t.id}))},children:[(0,n.jsx)("strong",{children:l("connect.teamRow","Team · {{name}}",{name:t.name})}),(0,n.jsx)("span",{children:l("connect.teamMembersCount","{{count}} member(s)",{count:t.member_count})}),(0,n.jsxs)("em",{children:[(0,n.jsx)("i",{}),l("connect.add","Add")]})]},`team-${t.id}`)),G.slice(0,6).map(t=>(0,n.jsxs)("button",{type:"button",className:"cnLedgerRow",style:{width:"100%"},disabled:C,onClick:()=>{_(""),F(()=>f(e.agent_id,t.id))},children:[(0,n.jsx)("strong",{children:t.name}),(0,n.jsx)("span",{children:t.email}),(0,n.jsxs)("em",{children:[(0,n.jsx)("i",{}),l("connect.add","Add")]})]},t.id))]}),(0,n.jsxs)("div",{style:{marginTop:10},children:[L.map(t=>(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",borderTop:"1px solid var(--line)"},children:[(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)("div",{style:{fontSize:12,fontWeight:500},children:l("connect.teamRow","Team · {{name}}",{name:t.team_name??t.team_id})})}),(0,n.jsx)("button",{className:"po-btn po-btn--ghost",disabled:C,onClick:()=>void F(()=>j(e.agent_id,t.id)),children:l("connect.remove","Remove")})]},t.id)),O.map(t=>(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",borderTop:"1px solid var(--line)"},children:[(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:12,fontWeight:500},children:t.user_name??t.user_email??t.user_id}),t.user_email&&(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)"},children:t.user_email})]}),(0,n.jsx)("button",{className:"po-btn po-btn--ghost",disabled:C,onClick:()=>void F(()=>j(e.agent_id,t.id)),children:l("connect.remove","Remove")})]},t.id)),!m&&!v&&0===O.length&&0===L.length&&!R&&(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)"},children:l("connect.privateFromMembers","Private from other members. Workspace admins can review it for governance.")}),(e.ui_type??"chat")==="app"?(0,n.jsx)("div",{style:{fontSize:11,fontWeight:300,color:"var(--mut)",marginTop:8},children:l("connect.shareAppNote","People you share with use the app with their own connected accounts, and only see Drive files they can already open.")}):null]}),v&&(0,n.jsxs)("div",{className:"poErr",role:"alert",children:[v," ",(0,n.jsx)("button",{type:"button",onClick:()=>void y(e.agent_id),children:l("connect.retry","Retry")})]}),T&&(0,n.jsx)("div",{className:"poErr",children:T})]}):(0,n.jsx)("div",{style:{marginTop:22,fontSize:10,letterSpacing:".12em",textTransform:"uppercase",opacity:.5},children:e.owner_name?l("connect.sharedWithYouBy","Shared with you by {{name}}",{name:e.owner_name}):l("connect.sharedWithYou","Shared with you")}),e.is_mine&&(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:22,paddingTop:16,borderTop:"1px solid var(--line)"},children:(0,n.jsx)("button",{className:"po-btn po-btn--ghost",onClick:i,children:l("connect.openInSession","Open in Session")})})]})]})}function Q({onAdd:e,preset:t}){let{t:s}=(0,p.useTranslation)("paletteOs"),[o,i]=(0,a.useState)(t?.slug??""),[c,l]=(0,a.useState)(t?.name??""),[r,d]=(0,a.useState)(t?.server_url??""),[m,h]=(0,a.useState)(""),[u,g]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[b,x]=(0,a.useState)(!1),f=!!t,j=async()=>
1{if(o.trim()&&r.trim()&&!u){if(f&&!m.trim())return void y(s("connect.tokenRequired","A token is required."));g(!0),y(null);try{await e({slug:o.trim(),name:c.trim(),server_url:r.trim(),token:m.trim()||void 0,auth_type:t?.auth_type,transport:t?.transport,header:t?.header??void 0}),x(!0)}catch(e){y(e instanceof Error?e.message:s("connect.addConnectorFailed","Failed to add connector"))}finally{g(!1)}}},N=f?s("connect.tokenLabel","Token"):s("connect.bearerTokenOptional","Bearer token (optional)");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"dTag",children:(0,n.jsx)("span",{children:s("paletteOs:ui.connectView.mcpAddConnector")})}),(0,n.jsxs)("div",{className:"dBody",children:[(0,n.jsx)("h3",{children:t?s("connect.connectPreset","Connect {{name}}",{name:t.name}):s("connect.connectMcpServer","Connect an MCP server")}),t&&(0,n.jsx)("p",{className:"cnDrawerHint",children:t.auth_hint}),[[s("connect.fieldSlug","Slug"),o,i,"github"],[s("connect.fieldName","Name"),c,l,"GitHub"],[s("connect.fieldServerUrl","Server URL"),r,d,"https://mcp.example.com/sse"],[N,m,h,"•••"]].map(([e,a,s,o],i)=>(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:e}),(0,n.jsx)("input",{className:"poInput",value:a,readOnly:!!t&&i<3,onChange:e=>s(e.target.value),placeholder:o})]},e)),v&&(0,n.jsx)("div",{className:"poErr",children:v}),(0,n.jsx)("div",{style:{marginTop:18},children:(0,n.jsx)("button",{className:"po-btn",disabled:u||b||!o.trim()||!r.trim(),onClick:j,children:u?s("connect.connecting","Connecting…"):b?s("connect.connected","Connected"):s("connect.connectArrow","Connect →")})})]})]})}e.s(["ConnectView",0,function(){let{t:e}=(0,p.useTranslation)("paletteOs"),{openRoute:t}=(0,s.useOsActions)(),{openDrawer:o,openConfirm:i,openSurface:c}=(0,w.useViewContext)(),l=(0,y.useIsOwnerOrAdmin)(),{connectors:r,bindings:d,presets:u,addConnector:b,discover:x,toggle:j,removeConnector:M,removeBinding:K}=(0,C.usePoConnect)(),{connections:q,connect:X,disconnect:Z,test:ee,updateToolSettings:en}=(0,f.useServiceConnections)(),{apps:et,loading:ea}=(0,_.usePoCatalog)(),{apps:es,install:eo,uninstall:ei,isInstalled:ec,loading:el}=(0,_.usePoInstalledApps)(),{agents:er,loading:ed,error:ep,refetch:em,publish:eh}=(0,g.useBuilderAgents)(),[eu,eg]=(0,a.useState)(null),[ev,ey]=(0,a.useState)(()=>{try{let e=JSON.parse(window.localStorage.getItem(O)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}),[eb,ex]=(0,a.useState)(()=>{let e=new URLSearchParams(window.location.search);return W(e.get("section")??e.get("tab"))??"home"});(0,a.useEffect)(()=>{let e=()=>{let e=W(new URLSearchParams(window.location.search).get("section"));e&&ex(e)};return window.addEventListener("palette:locationchange",e),window.addEventListener("popstate",e),()=>{window.removeEventListener("palette:locationchange",e),window.removeEventListener("popstate",e)}},[]);let ef=(0,a.useMemo)(()=>et.filter(e=>(e.storeScope??"general")==="general"),[et]),ej=(0,a.useMemo)(()=>et.filter(e=>(e.storeScope??"general")!=="general"),[et]),eN=(0,a.useMemo)(()=>I(ef,ec),[ef,ec]),ek=(0,a.useMemo)(()=>I(ej,ec),[ej,ec]),[ew,eS]=(0,a.useState)(null),e_=e=>{let n=[...document.querySelectorAll("[data-app-key]")].find(n=>n.dataset.appKey===`app-${e.id}`);eS({app:e,returnFocus:n?.matches("button")?n:n?.querySelector("button")??document.activeElement})},eC=t=>o({content:(0,n.jsx)(z,{c:t,isAdmin:l,onDiscover:()=>void x(t.id),onToggle:()=>void j(t),onRemove:()=>i({title:e("connect.deleteConnectorTitle","Delete connector"),desc:e("connect.deleteConnectorDesc","mcp.{{slug}} and its catalog entries will be removed.",{slug:t.slug}),danger:!0,typeToConfirm:t.slug,confirmLabel:e("connect.delete","Delete"),onConfirm:()=>M(t.id)})})}),eA=(t,a)=>o({content:(0,n.jsx)(V,{s:t,isAdmin:l,onConnect:()=>X(t.provider,a?{scopes:a}:void 0),onTest:()=>ee(t.provider),onDisconnect:()=>i({title:e("connect.disconnectServiceTitle","Disconnect service"),desc:e("connect.disconnectServiceDesc","{{name}} tools will stop working for your agents and loops in this workspace.",{name:t.display_name}),danger:!0,typeToConfirm:t.provider,confirmLabel:e("connect.disconnect","Disconnect"),onConfirm:async()=>{await Z(t.provider)}})})}),eT=q.find(e=>"google"===e.provider),eP=e=>(eT?.tools??[]).filter(n=>e.prefixes.some(e=>n.name.startsWith(e))),eE=e=>{let n=eP(e);return eT?.status==="connected"&&n.length>0&&n.every(e=>e.scope_granted)},eR=e=>{let n=(0,v.agentLaunchTarget)(e);c(n.route,{title:e.name,subRoute:n.subRoute||void 0})},[eO,eL]=(0,a.useState)([]),[eD,eM]=(0,a.useState)(""),e$=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=!0;return(async()=>
1{try{let n=await (0,h.apiFetch)("/api/v1/agent-apps/mine");n.ok&&e&&eL(await n.json())}catch{}})(),()=>{e=!1}},[]);let[eI,eG]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let n=await (0,h.apiFetch)("/api/v1/developer/apps");n.ok&&e&&eG(await n.json())}catch{}})(),()=>{e=!1}},[]);let eW=(0,a.useMemo)(()=>eI.filter(e=>null!==e.preview_publish_id||e.has_active_release),[eI]),eF=(0,a.useMemo)(()=>{let e=new Map;for(let n of eO)null!=n.agent_id&&e.set(n.agent_id,n);return e},[eO]),eU=e=>{t("/general-chat",e?.thread_id?`/${encodeURIComponent(e.thread_id)}`:"")},eB=e=>o({content:(0,n.jsx)(J,{agent:e,isAdmin:l,onRun:()=>eR(e),onOpenChat:()=>c("/agent-run",{title:e.name,subRoute:`?agent=${e.agent_id}&mode=chat`}),onOpenSession:()=>eU(e),onChanged:()=>void em()})}),eH=(0,a.useRef)(null),ez=(0,a.useRef)(eB);ez.current=eB,(0,a.useEffect)(()=>{let e=()=>{let e=Number(new URLSearchParams(window.location.search).get("agent")||0);if(!e||eH.current===e)return;let n=er.find(n=>n.agent_id===e);n&&(eH.current=e,ez.current(n))};return e(),window.addEventListener("palette:locationchange",e),()=>window.removeEventListener("palette:locationchange",e)},[er]);let eK=t=>o({content:(0,n.jsx)(Y,{b:t,isAdmin:l,onRemove:()=>i({title:e("connect.removeBindingTitle","Remove channel binding?"),desc:`${t.channel_type} \xb7 ${t.external_workspace_id}`,danger:!0,confirmLabel:e("connect.remove","Remove"),onConfirm:()=>K(t.id)})})}),eV=t=>{let a=et.find(e=>e.id===t.id||e.name.toLowerCase()===t.name.toLowerCase());a?e_(a):o({content:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"dTag",children:[(0,n.jsxs)("span",{children:["CONNECT · ",t.kind]}),(0,n.jsx)("span",{className:"idx",children:t.id})]}),(0,n.jsxs)("div",{className:"dBody",children:[(0,n.jsx)("h3",{children:t.name}),(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:e("connect.details","Details")}),(0,n.jsxs)("div",{className:"po-metaGrid",children:[(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e("connect.metaType","Type")}),(0,n.jsx)("div",{className:"amv",children:t.kind})]}),(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e("connect.metaStatus","Status")}),(0,n.jsx)("div",{className:"amv",children:e("connect.statusReady","not connected")})]}),(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e("connect.metaScope","Scope")}),(0,n.jsx)("div",{className:"amv",children:t.group??t.section})]}),(0,n.jsxs)("div",{className:"po-metaItem",children:[(0,n.jsx)("div",{className:"amk",children:e("connect.metaProvider","Provider")}),(0,n.jsx)("div",{className:"amv",children:e("paletteOs:ui.connectView.palette")})]})]})]}),(0,n.jsxs)("div",{className:"po-field",children:[(0,n.jsx)("label",{children:e("connect.description","Description")}),(0,n.jsx)("div",{style:{fontSize:13,fontWeight:300,lineHeight:1.6},children:e(`connect.refItems.${t.id}.desc`,t.desc)})]})]})]})})},eY=e=>{ex(e);let n=new URL(window.location.href);"home"===e?n.searchParams.delete("section"):n.searchParams.set("section",e),n.searchParams.delete("tab"),window.history.replaceState(null,"",`${n.pathname}${n.search}${n.hash}`)},eq=e("connect.comingSoonBadge","COMING SOON"),eJ=F.filter(e=>"apps"===e.section&&!B.has(e.id)),eQ=F.filter(e=>"channels"===e.section),eX=ea||el,eZ=async e=>{for(let n of e)if(!ec(n.id)&&!(await eo(n.id,{includeDependencies:!0})).ok)break},e0=(e,n)=>{ey(t=>{let a=n?Array.from(new Set([...t,e])):t.filter(n=>n!==e);try{window.localStorage.setItem(O,JSON.stringify(a))}catch{}return a})},e1=(n,t)=>i({title:e("connect.pauseTitle","Pause {{name}}",{name:n}),desc:e("connect.pauseDesc","— Leaves the global Agents tab\n— Moves to the PAUSED tier of My Workspace\n— Running work is not interrupted and completes\n— Restore any time with Resume"),confirmLabel:e("connect.pause","Pause"),onConfirm:t}),e2=(n,t,a)=>i({title:e("connect.removeTitle","Delete from My Workspace"),desc:e("connect.removeDesc","Removing revokes this {{kind}}'s access and it leaves My Workspace.",{kind:t.toLowerCase()}),danger:!0,typeToConfirm:n,confirmLabel:e("connect.removeConfirm","Delete {{name}}",{name:n}),onConfirm:a}),e3=n=>[[...n.run?[{label:`▸ ${e("connect.runNow","Run now")}`,on:n.run}]:[],{label:e("connect.close","Close"),on:()=>{}}],[{label:e("connect.setting","Setting"),on:n.setting},{label:e("connect.permissions","Permissions"),on:n.permissions??n.setting}],[...n.pause?[{label:n.pause.paused?e("connect.resume","Resume"):e("connect.pause","Pause"),on:n.pause.toggle}]:[],...n.remove?[{label:e("connect.deleteFromWorkspace","Delete from Workspace"),danger:!0,on:n.remove}]:[]]],e5=n=>{let t,a=ec(n.id),s=(n.storeScope??"general")==="company",o=a&&(t=`app:${n.id}`,ev.includes(t)),l=async()=>
1{let e=await eo(n.id,{includeDependencies:!0});return e.ok||console.error(e.error),e.ok};return{key:`app-${n.id}`,name:n.name,desc:n.tagline||n.description,tag:s?e("paletteOs:connect.sections.company.label"):void 0,meta:(n.category||(s?"COMPANY":"PALETTE")).toUpperCase(),logoId:n.id,face:(0,k.appFace)(n.id,n.gradient?.bg),rank:1e3*!!n.featured+(n.rating??0),status:a?o?"paused":"active":"available",actLabel:a?o?e("connect.resume","Resume"):e("connect.pause","Pause"):s?e("connect.subscribe","Subscribe"):e("connect.connect","Connect"),onAct:()=>{if(!a){let t,a;return void(t=s?e("connect.subscribeAgent","Subscribe agent"):e("connect.connectAgent","Connect agent"),a=[s?e("connect.companyLocked","Company-only agent. Subscribing clones it into MY WORKSPACE with editing locked."):"",n.tagline||n.description,n.permissions?.length?e("connect.scopes","· Scopes: {{list}}.",{list:n.permissions.join(", ")}):""].filter(Boolean).join(" "),i({title:t,desc:a,confirmLabel:s?e("connect.subscribe","Subscribe"):e("connect.connectAgent","Connect agent"),onConfirm:()=>void l()}))}o?e0(`app:${n.id}`,!1):e1(n.name,()=>e0(`app:${n.id}`,!0))},onOpen:()=>e_(n),menu:e3({run:a?()=>c(n.route,{title:n.name}):void 0,setting:()=>e_(n),pause:a?{paused:o,toggle:()=>o?e0(`app:${n.id}`,!1):e1(n.name,()=>e0(`app:${n.id}`,!0))}:void 0,remove:a?()=>e2(n.name,"APP",async()=>{let e=await ei(n.id);return e.ok||console.error(e.error),e.ok}):void 0})}},e4=n=>{let t=(n.ui_type??"chat")==="app",a=n.is_mine&&null!=n.agent_id?eF.get(n.agent_id):void 0,s=a&&t&&a.current_ui_revision?`v${a.current_ui_revision}${a.updated_at?` \xb7 ${(0,P.relTime)(a.updated_at)}`:""}`.toUpperCase():n.is_mine?e("paletteOs:connect.sections.private.label"):e("connect.byOwnerMeta","BY {{name}}",{name:(n.owner_name??"").toUpperCase()});return{key:`agent-${n.agent_id}`,name:n.name,desc:n.description,tag:t?"APP":"PERSONAL",meta:s,logoId:`builder-agent:${n.agent_id}`,face:(0,k.appFace)(`builder-agent:${n.agent_id}`,n.color),status:"active",actLabel:t?e("connect.openApp","Open app"):e("connect.useAgent","Use"),onAct:()=>eR(n),onOpen:()=>t?eR(n):eB(n),menu:e3({run:()=>eR(n),setting:()=>eB(n),permissions:()=>eB(n),remove:n.is_mine&&"private"!==n.share_scope&&n.thread_id?()=>e2(n.name,"AGENT",async()=>{try{await eh({thread_id:n.thread_id,agent_id:n.agent_id,visibility:"private"}),await em()}catch(e){return console.error("Could not withdraw the agent:",e),!1}}):void 0})}},e6=n=>{let t,a=ec(n.plugin_id),s=a&&(t=`app:${n.plugin_id}`,ev.includes(t)),o=n.has_active_release&&!a,i=()=>c(`/apps/${n.plugin_id}`,{title:n.name}),l=async()=>{let t=await eo(n.plugin_id,{includeDependencies:!0});t.ok||(m.toast.error(e("connect.installFailed","Could not install {{name}}",{name:n.name})),console.error(t.error))},r=n.preview_version??n.latest_version,d=n.preview_updated_at??n.last_published_at;return{key:`dev-${n.plugin_id}`,name:n.name,desc:n.tagline??void 0,tag:n.has_active_release?e("connect.devAppTagReleased","APP · DEV"):e("connect.devAppTag","APP · PREVIEW"),meta:`v${r||"?"}${d?` \xb7 ${(0,P.relTime)(d)}`:""}`.toUpperCase(),logoId:n.plugin_id,status:o?"available":s?"paused":"active",actLabel:o?e("connect.install","INSTALL"):s?e("connect.resume","Resume"):e("connect.openApp","Open app"),onAct:o?()=>void l():s?()=>e0(`app:${n.plugin_id}`,!1):i,onOpen:i,menu:e3({run:i,setting:()=>c("/settings",{subRoute:"?section=dev",title:e("connect.devPortal","Developer")}),pause:a?{paused:s,toggle:()=>s?e0(`app:${n.plugin_id}`,!1):e1(n.name,()=>e0(`app:${n.plugin_id}`,!0))}:void 0,remove:a?()=>e2(n.name,"APP",async()=>{let e=await ei(n.plugin_id);return e.ok||console.error(e.error),e.ok}):void 0})}},e8=async(e,n,t)=>{try{await en(e,{disabled_tools:t?n:[]})}catch(e){return console.error("Could not update tool settings:",e),!1}},e7=(t,a)=>{let s=a?.tools??t.tools??[],o=s.map(e=>e.name),i="connected"===t.status,c=i&&o.length>0&&s.every(e=>!e.enabled),r=a?.onOpen??(()=>eA(t)),d="coming_soon"===t.status||!i&&D.has(t.provider);return{key:a?.key??`svc-${t.provider}`,name:a?.name??t.display_name,desc:a?.desc,meta:a?.meta??t.provider.toUpperCase(),note:"error"===t.status||"expired"===t.status?t.status.toUpperCase():void 0,soon:d?eq:void 0,mark:a?.mark??(0,n.jsx)($,{provider:t.provider}),status:i?c?"paused":"active":"available",actLabel:i?c?e("connect.resume","Resume"):e("connect.pause","Pause"):e("connect.connect","Connect"),actDisabled:d||i&&!o.length,onAct:()=>{i?c?e8(t.provider,o,!1):e1(a?.name??t.display_name,()=>e8(t.provider,o,!0)):r()},onOpen:r,menu:e3({setting:r,permissions:r,pause:i&&o.length?{paused:c,toggle:()=>c?void e8(t.provider,o,!1):e1(a?.name??t.display_name,()=>e8(t.provider,o,!0))}:void 0,remove:i&&l?()=>e2(t.provider,"CONNECTION",async()=>{await Z(t.provider)}):void 0})}},e9=e=>e7(e),ne=t=>{let a=eT?eP(t):[],s=eE(t);return eT?e7({...eT,status:s?"connected":eT.status,display_name:t.name},{key:`google-${t.id}`,name:t.name,desc:e(`connect.googleApps.${t.id}.desc`,t.desc),meta:"GOOGLE",mark:(0,n.jsx)(N.Glyph,{name:t.glyph}),tools:a,onOpen:()=>(e=>{if(!eT)return;let n=eP(e),t=e.scopes,a=eE(e);eA({...eT,display_name:`${e.name}
1 \xb7 Google Workspace`,status:a?"connected":"coming_soon"===eT.status?"coming_soon":"available",account_label:a?eT.account_label:null,granted_scopes:eT.granted_scopes.filter(e=>t.includes(e)),expires_at:a?eT.expires_at:null,connected_at:a?eT.connected_at:null,connected_by_name:a?eT.connected_by_name:null,last_error:a?eT.last_error:null,tools:n},t)})(t)}):{key:`google-${t.id}`,name:t.name,desc:e(`connect.googleApps.${t.id}.desc`,t.desc),meta:"GOOGLE",mark:(0,n.jsx)(N.Glyph,{name:t.glyph}),soon:eq,status:"available",actLabel:e("connect.connect","Connect"),actDisabled:!0,onAct:()=>{},onOpen:()=>{},menu:e3({setting:()=>{}})}},nn=t=>({key:`ref-${t.id}`,name:t.name,desc:e(`connect.refItems.${t.id}.desc`,t.desc),meta:t.kind,mark:(0,n.jsx)(H,{item:t}),soon:eq,status:"available",actLabel:e("connect.connect","Connect"),actDisabled:!0,onAct:()=>eV(t),onOpen:()=>eV(t),menu:e3({setting:()=>eV(t)})}),nt=t=>{let a=`bind:${t.id}`,s=ev.includes(a),o=t.external_workspace_id||t.channel_type;return{key:`bind-${t.id}`,name:o,meta:t.channel_type.toUpperCase(),mark:(0,n.jsx)($,{provider:t.channel_type.toLowerCase()}),status:s?"paused":"active",actLabel:s?e("connect.resume","Resume"):e("connect.pause","Pause"),onAct:()=>s?e0(a,!1):e1(o,()=>e0(a,!0)),onOpen:()=>eK(t),menu:e3({setting:()=>eK(t),pause:{paused:s,toggle:()=>s?e0(a,!1):e1(o,()=>e0(a,!0))},remove:l?()=>e2(o,"CHANNEL",()=>K(t.id)):void 0})}},na=t=>{let a="active"!==t.status;return{key:`mcp-${t.id}`,name:t.name,meta:t.slug.toUpperCase(),note:"error"===t.status?e("connect.mcpError","ERROR"):void 0,mark:(0,n.jsx)(N.Glyph,{name:"h_plug"}),status:a?"paused":"active",actLabel:a?e("connect.resume","Resume"):e("connect.pause","Pause"),actDisabled:!l,onAct:()=>a?void j(t):e1(t.name,()=>j(t)),onOpen:()=>eC(t),menu:e3({run:()=>void x(t.id),setting:()=>eC(t),pause:l?{paused:a,toggle:()=>a?void j(t):e1(t.name,()=>j(t))}:void 0,remove:l?()=>e2(t.slug,"MCP",()=>M(t.id)):void 0})}},ns=t=>{let a=()=>o({content:(0,n.jsx)(Q,{onAdd:b,preset:t})});return{key:`preset-${t.slug}`,name:t.name,desc:t.description,meta:t.transport.toUpperCase(),mark:(0,n.jsx)(N.Glyph,{name:t.icon}),soon:eq,status:"available",actLabel:e("connect.connect","Connect"),actDisabled:!0,onAct:a,onOpen:a,menu:e3({setting:a})}},no=q.filter(e=>L.has(e.provider)),ni=q.filter(e=>"google"!==e.provider&&!L.has(e.provider)),nc=new Set(q.map(e=>e.provider.toLowerCase())),nl=eJ.filter(e=>!nc.has(e.id)),nr=eQ.filter(e=>!nc.has(e.id)),nd=q.filter(e=>"connected"===e.status),np=U.filter(e=>eE(e)),nm=es.filter(e=>(e.storeScope??"general")==="general"),nh=es.filter(e=>(e.storeScope??"general")!=="general"),nu=eW.filter(e=>!ec(e.plugin_id)),ng=eO.filter(e=>"published"!==e.status&&"retired"!==e.status),nv=t=>{let a=[];if("connected"===t){let e=(e,n,t)=>{t.length&&a.push({label:e,kind:n,items:t})};e("AGENTS · PALETTE","agent",nm.map(e5)),e("AGENTS · COMPANY","agent",nh.map(e5)),e("AGENTS · PERSONAL","agent",er.map(e4)),e("APPS · PERSONAL","agent",nu.map(e6)),e("CONNECTIONS · APPS","conn",[...np.map(ne),...nd.filter(e=>"google"!==e.provider).map(e9)]),e("CONNECTIONS · MESSENGER","conn",(d??[]).map(nt)),e("CONNECTIONS · MCP","conn",r.map(na))}else if("agents"===t)for(let n of eN){let t=n.members.length>0&&n.connected===n.members.length;a.push({label:`AGENTS \xb7 ${n.group.toUpperCase()}`,kind:"agent",items:n.members.map(e5),action:{label:t?e("connect.connectedCheck","CONNECTED ✓"):e("connect.connectAll","+ CONNECT ALL"),onClick:()=>void eZ(n.members),disabled:t}})}else if("company"===t)for(let n of ek){let t=n.members.length>0&&n.connected===n.members.length;a.push({label:`AGENTS \xb7 ${n.group.toUpperCase()}`,kind:"agent",items:n.members.map(e5),action:{label:t?e("connect.subscribed","SUBSCRIBED ✓"):e("connect.subscribeAll","+ SUBSCRIBE ALL"),onClick:()=>void eZ(n.members),disabled:t}})}else if("private"===t)er.length&&a.push({label:"AGENTS · PERSONAL",kind:"agent",items:er.map(e4)}),eW.length&&a.push({label:"APPS · PERSONAL",kind:"agent",items:eW.map(e6)}),ng.length&&a.push({label:"APPS · IN PROGRESS",kind:"agent",items:ng.map(n=>{let t=e(`connect.appStatus.${n.status}`,n.status.toUpperCase());return{key:`mine-${n.id}`,name:n.name||e("connect.untitledApp","Untitled app"),desc:n.build_error||e("connect.inProgressHint","Finish this app in Session."),tag:t,meta:n.updated_at?(0,P.relTime)(n.updated_at).toUpperCase():t,status:"failed"===n.build_state?"paused":"active",actLabel:e("connect.openSession","Open Session"),onAct:()=>eU(n),onOpen:()=>eU(n),menu:e3({setting:()=>eU(n)})}})});else if("apps"===t)a.push({label:"CONNECTIONS · APPS",kind:"conn",items:[...U.map(ne),...ni.map(e9),...nl.map(nn)]});else if("channels"===t)a.push({label:"CONNECTIONS · MESSENGER",kind:"conn",items:[...no.map(e9),...(d??[]).map(nt),...nr.map(nn)]});else if("mcp"===t){let t=u.filter(e=>!r.some(n=>n.slug===e.slug)).map(ns);a.push({label:"CONNECTIONS · MCP",kind:"conn",items:[...r.map(na),...l?t:[]],action:l?{label:e("connect.addMcpUpper","+ ADD SERVER"),onClick:()=>o({content:(0,n.jsx)(Q,{onAdd:b})})}:void 0})}return a},ny="home"===eb?[]:nv(eb),[nb,nx]=(0,a.useState)({}),nf=eD.normalize("NFKC").trim().toLocaleLowerCase("ko-KR"),nj=nf.split(/\s+/).filter(
1Boolean),nN="home"!==eb||nf?[]:nv("connected").flatMap(e=>e.items),nk=(()=>{if("home"!==eb||nf)return[];let e=new Set,n=[];for(let t of[...ef.map(e5),...ej.map(e5),...["private","apps","channels","mcp"].flatMap(e=>nv(e).filter(e=>"APPS · IN PROGRESS"!==e.label).flatMap(e=>e.items))])e.has(t.key)||(e.add(t.key),n.push(t));return n})(),nw=(e,n)=>Number(!!e.soon)-Number(!!n.soon),nS=nk.slice().sort((e,n)=>(n.rank??-1)-(e.rank??-1)||nw(e,n)||e.name.localeCompare(n.name)),n_=new Set(nS.slice(0,6).map(e=>e.key)),nC=nk.filter(e=>!n_.has(e.key)).sort((e,n)=>Number("available"!==e.status)-Number("available"!==n.status)||nw(e,n)),nA=e=>{let n=[e.name,e.desc,e.meta,"Palette 팔레트"].join(" ").normalize("NFKC").toLocaleLowerCase("ko-KR");return nj.every(e=>n.includes(e))},nT=ny.map(e=>nf?{...e,items:e.items.filter(nA)}:e).filter(e=>e.items.length>0||e.action&&!nf),nP=(()=>{if(!nf||"home"!==eb)return null;let e=new Set,n=[];for(let t of["connected","agents","company","private","apps","channels","mcp"])for(let a of nv(t).flatMap(e=>e.items))!e.has(a.key)&&nA(a)&&(e.add(a.key),n.push(a));return n})(),nE="private"===eb&&!ed&&!ep&&0===ny.length,nR=n=>e(`connect.sections.${n}.label`,E.find(e=>e.id===n)?.label??n),nO=(e,n,t)=>{e.preventDefault(),e.stopPropagation();let a=e.clientX,s=e.clientY;if(!a&&!s){let n=e.currentTarget.getBoundingClientRect();a=n.left,s=n.bottom+4}eg({x:a,y:s,head:n,variant:"dark",sections:t})},nL=(e,t)=>(0,n.jsx)(k.AppLogo,{id:e.logoId??e.key,face:e.face,className:t,children:e.mark}),nD=t=>{let a="available"!==t.status,s=e=>nO(e,t.name,t.menu),o=!!t.soon;return(0,n.jsxs)("article",{className:`storeRow${o?" soon":""}`,"data-app-key":t.key,onContextMenu:o?void 0:s,children:[(0,n.jsxs)("button",{type:"button",className:"storeRowInfo",onClick:t.onOpen,disabled:o,"aria-label":e("connect.appInfoAria","{{name}} app info",{name:t.name}),children:[nL(t),(0,n.jsxs)("span",{className:"storeRowCopy",children:[(0,n.jsxs)("strong",{children:[t.name,t.tag&&(0,n.jsx)("em",{className:"storeRowTag",children:t.tag})]}),(0,n.jsx)("small",{children:t.desc||t.note||(o?t.soon:t.meta)})]})]}),!o&&(0,n.jsx)("button",{type:"button",className:"storeRowKebab","aria-label":e("connect.actionsFor","Actions for {{name}}",{name:t.name}),"aria-haspopup":"menu",onClick:s,children:(0,n.jsx)(N.Glyph,{name:"h_more",strokeWidth:1.6})}),(0,n.jsx)(T.Tip,{label:a?e("connect.inMyApps","In My Apps"):e("connect.addToMyApps","Add to My Apps"),children:(0,n.jsx)("button",{type:"button",className:`storeRowAction${a?" on":""}`,disabled:o||!a&&t.actDisabled,"aria-label":`${t.name} ${a?e("connect.inMyApps","In My Apps"):e("connect.addToMyApps","Add to My Apps")}`,onClick:a?t.onOpen:t.onAct,children:(0,n.jsx)(N.Glyph,{name:a?"h_check":"h_plus"})})})]},t.key)},nM=e=>(0,n.jsx)(N.Glyph,{name:e?"h_chevronDown":"h_chevronRight"}),n$=t=>{let a=encodeURIComponent(t.key),s=!!nb[t.key],o=t.cap&&!s?t.items.slice(0,t.cap):t.items,i=void 0!==t.cap&&(t.items.length>t.cap||t.icons);return(0,n.jsxs)("section",{className:"storeSection","aria-labelledby":`store-heading-${a}`,children:[(0,n.jsxs)("header",{className:"storeSectionHead",children:[(0,n.jsxs)("h2",{id:`store-heading-${a}`,children:[t.label,void 0!==t.count&&(0,n.jsx)("span",{className:"storeCount",children:t.count})]}),t.action&&(0,n.jsx)("button",{type:"button",className:"storeMore",disabled:t.action.disabled,onClick:t.action.onClick,children:t.action.label}),i&&(0,n.jsxs)("button",{type:"button",className:"storeMore","aria-label":`${t.label} ${s?e("connect.less","Less"):e("connect.more","More")}`,"aria-controls":`store-list-${a}`,"aria-expanded":s,onClick:()=>{let e;return e=t.key,nx(n=>({...n,[e]:!n[e]}))},children:[s?e("connect.less","Less"):e("connect.more","More"),nM(s)]})]}),t.icons&&!s?(0,n.jsxs)("div",{id:`store-list-${a}`,className:"storeInstalledIcons",children:[o.map(t=>(0,n.jsx)(T.Tip,{label:t.name,children:(0,n.jsx)("button",{type:"button",className:"storeInstalledApp","data-app-key":t.key,"aria-label":e("connect.appInfoAria","{{name}} app info",{name:t.name}),onClick:t.onOpen,onContextMenu:e=>nO(e,t.name,t.menu),children:nL(t)})},t.key)),!o.length&&(0,n.jsx)("p",{className:"storeEmptyInline",children:t.empty})]}):(0,n.jsxs)("div",{id:`store-list-${a}`,className:"storeGrid",children:[o.map(nD),!o.length&&t.empty&&(0,n.jsx)("p",{className:"storeEmptyInline",children:t.empty})]})]},t.key)},nI=(0,n.jsx)(N.Glyph,{name:"h_search"}),nG=()=>{eM(""),e$.current?.focus()};return(0,n.jsx)(T.TipHost,{children:(0,n.jsxs)("div",{className:"viewPane transparent connectView61 storeView",children:[(0,n.jsx)("div",{className:"storeScroll",children:(0,n.jsxs)("div",{className:"storeBody","aria-labelledby":"store-title",children:[(0,n.jsxs)("header",{className:"storeHead",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{id:"store-title",children:e("nav.plugin","Store")}),(0,n.jsx)("p",{children:e("connect.subtitle","Find the Palette apps you need.")})]}),(0,n.jsxs)("div",{className:"storeTools",children:[(0,n.jsxs)("div",{className:"storeSearch poSearch",role:"search",children:[nI,(0,n.jsx)("input",{type:"search",ref:e$,value:eD,onChange:e=>eM(e.target.value),onKeyDown:e=>{"Escape"===e.key&&eD&&(e.preventDefault(),e.stopPropagation(),nG())},placeholder:e("connect.searchPlaceholder","Search apps"),"aria-label":e("connect.searchLabel","Search apps"),autoComplete:"off",maxLength:100}),eD&&(0,n.jsx)("button",{type:"button","aria-label":e("connect.clearSearch","Clear search"),onClick:nG,children:(0,n.jsx)(N.Glyph,{name:"h_close"})})]}),(0,n.jsxs)("button",{type:"button",className:`storeFilter${"home"!==eb?" on":""}`,"aria-haspopup":"menu","aria-label":e("connect.filter","Filter"),onClick:n=>nO(n,e("connect.filter","Filter"),[[{label:e("connect.scopeHome","Store"),checked:"home"===eb,on:()=>eY("home")}],R.flatMap(e=>"item"in e?[{label:nR(e.item),checked:eb===e.item,on:()=>eY(e.item)}]:[])]),children:["home"!==eb&&(0,n.jsx)("span",{children:nR(eb)}),nM(!0)]})]})]}),(0,n.jsx)("div",{className:"sr-only",role:"status","aria-live":"polite",children:nf?e("connect.searchStatus","{{count}} results",{count:nP?.length??nT.reduce((e,n)=>e+n.items.length,0)}):""}),nP?(0,n.jsxs)("section",{className:"storeSection storeSearchResults","aria-labelledby":"store-search-heading",children:[(0,n.jsxs)("header",{className:"storeSectionHead",children:[(0,n.jsxs)("h2",{id:"store-search-heading",children:[e("connect.searchResults","Results"),(0,n.jsx)("span",{className:"storeCount",children:nP.length})]}),(0,n.jsx)("span",{className:"storeQueryLabel",children:eD.trim()})]}),nP.length?(0,n.jsx)("div",{className:"storeGrid",children:nP.map(nD)}):(0,n.jsxs)("div",{className:"storeEmpty",children:[nI,(0,n.jsx)("h3",{children:e("connect.noResults","N
1o results")}),(0,n.jsx)("p",{children:e("connect.noResultsDesc","Try the app name or another keyword.")}),(0,n.jsx)("button",{type:"button",className:"storeBtn",onClick:nG,children:e("connect.showAllApps","Show all apps")})]})]}):"home"===eb?(0,n.jsxs)(n.Fragment,{children:[n$({key:"installed",label:e("connect.inUse","Apps in use"),count:nN.length,items:G(nN),cap:8,icons:!0,empty:e("connect.inUseEmpty","No apps in use yet. Add one below.")}),n$({key:"popular",label:e("connect.popular","Popular"),items:nS,cap:6,empty:eX?e("connect.loadingDirectory","Loading the library…"):e("connect.nothingHereDesc","Connect something from another section and it appears here.")}),n$({key:"notable",label:e("connect.notable","New and notable"),items:nC,cap:6,empty:eX?e("connect.loadingDirectory","Loading the library…"):e("connect.nothingHereDesc","Connect something from another section and it appears here.")})]}):(0,n.jsxs)(n.Fragment,{children:[nT.map(n=>n$({key:n.label,label:e(`connect.boards.${n.label}`,n.label),count:n.items.length,items:G(n.items),action:n.action})),nE&&(0,n.jsxs)("div",{className:"storeEmpty",children:[(0,n.jsx)("h3",{children:e("connect.noPrivateAgents","No agents built yet")}),(0,n.jsx)("p",{children:e("connect.noPrivateAgentsDesc","Agents you create in Session are exhibited here — connect one to include it in My Workspace.")}),(0,n.jsxs)("div",{className:"storeEmptyBtns",children:[(0,n.jsx)("button",{type:"button",className:"storeBtn primary",onClick:()=>eU(),children:e("connect.newAgentUpper","+ New agent")}),(0,n.jsx)("button",{type:"button",className:"storeBtn",onClick:()=>eU(),children:e("connect.sessionLink","Open Session →")})]})]}),"private"===eb&&!ed&&ep&&0===er.length&&(0,n.jsxs)("div",{className:"storeEmpty",role:"alert",children:[(0,n.jsx)("h3",{children:e("connect.privateLoadError","Private agents couldn't be loaded")}),(0,n.jsx)("p",{children:ep}),(0,n.jsx)("button",{type:"button",className:"storeBtn",onClick:()=>void em(),children:e("connect.retryUpper","RETRY")})]}),!nE&&!nT.length&&(0,n.jsxs)("div",{className:"storeEmpty",children:[(0,n.jsx)("h3",{children:nf?e("connect.noResults","No results"):e("connect.nothingHere","Nothing here yet")}),(0,n.jsx)("p",{children:eX?e("connect.loadingDirectory","Loading the library…"):nf?e("connect.noResultsDesc","Try the app name or another keyword."):e("connect.nothingHereDesc","Connect something from another section and it appears here.")})]})]})]})}),ew&&(0,n.jsx)(S.AppInfoDialog,{app:ew.app,installed:ec(ew.app.id),returnFocus:ew.returnFocus,onClose:()=>eS(null),onOpen:()=>c(ew.app.route,{title:ew.app.name}),onInstall:async()=>(await eo(ew.app.id,{includeDependencies:!0})).ok,onUninstall:async()=>(await ei(ew.app.id)).ok},ew.app.id),eu&&(0,n.jsx)(A.PoContextMenu,{ctx:eu,onClose:()=>eg(null)})]})})}],794786)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.