@xopcai/xopc 0.0.81 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agents-DOONGaKz.js → agents-Cqh1ts38.js} +1 -1
  4. package/dist/gateway/static/root/assets/{apps-page-Ci17oA_o.js → apps-page-pJ27dsqn.js} +1 -1
  5. package/dist/gateway/static/root/assets/{channels-settings-CARdL-ys.js → channels-settings-wTiWStg9.js} +1 -1
  6. package/dist/gateway/static/root/assets/{channels-status-swr-CUU3faST.js → channels-status-swr-D1KYmOmi.js} +1 -1
  7. package/dist/gateway/static/root/assets/{cron-api-BVQ2n75R.js → cron-api-Y2wfSJVI.js} +1 -1
  8. package/dist/gateway/static/root/assets/{cron-page-x582Y6D5.js → cron-page-B97KU_RG.js} +1 -1
  9. package/dist/gateway/static/root/assets/{dist-XT96cQdR.js → dist-CboA_Css.js} +1 -1
  10. package/dist/gateway/static/root/assets/{extension-debug-page-Czzfrtt5.js → extension-debug-page-DN_zNmpo.js} +1 -1
  11. package/dist/gateway/static/root/assets/{extension-page-B_c5UIqX.js → extension-page-BUXtOzv5.js} +1 -1
  12. package/dist/gateway/static/root/assets/{extension-settings-page-Ckvjgw0_.js → extension-settings-page-C2dX4KCW.js} +1 -1
  13. package/dist/gateway/static/root/assets/{field-primitives-DQpT8iVa.js → field-primitives-B9rOLqdm.js} +1 -1
  14. package/dist/gateway/static/root/assets/{heartbeat-config-api-DKqOuQ0V.js → heartbeat-config-api-DvfiRVrc.js} +1 -1
  15. package/dist/gateway/static/root/assets/{index-Bq3Lg4bG.js → index-DQuaMye9.js} +79 -79
  16. package/dist/gateway/static/root/assets/{logs-page-B3CwJNBq.js → logs-page-BQuBpHcc.js} +1 -1
  17. package/dist/gateway/static/root/assets/{sessions-page-BCNnhz9g.js → sessions-page-BeiFm0Ms.js} +1 -1
  18. package/dist/gateway/static/root/assets/{settings-form-section-CjjEpVYM.js → settings-form-section-2Yu-FASs.js} +1 -1
  19. package/dist/gateway/static/root/assets/{settings-page-B7_PjiHL.js → settings-page-RPAz_Wg_.js} +1 -1
  20. package/dist/gateway/static/root/assets/{skills-page-VrL9TeVF.js → skills-page-Wu4aNWDx.js} +1 -1
  21. package/dist/gateway/static/root/assets/{utils-DQehHvlm.js → utils-D2Gn2qod.js} +1 -1
  22. package/dist/gateway/static/root/assets/{voice-api-key-field-k4FWwgkk.js → voice-api-key-field-BxIGhhEL.js} +1 -1
  23. package/dist/gateway/static/root/index.html +1 -1
  24. package/dist/package.js +1 -1
  25. package/dist/src/agent/service/process-direct-streaming.js +12 -0
  26. package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
  27. package/dist/src/gateway/hono/app.js +62 -11
  28. package/dist/src/gateway/hono/app.js.map +1 -1
  29. package/dist/src/gateway/hono/middleware/auth.js +27 -3
  30. package/dist/src/gateway/hono/middleware/auth.js.map +1 -1
  31. package/dist/src/gateway/hono/middleware/logger.d.ts +5 -1
  32. package/dist/src/gateway/hono/middleware/logger.js +41 -5
  33. package/dist/src/gateway/hono/middleware/logger.js.map +1 -1
  34. package/dist/src/gateway/hono/routes/exposure.js +2 -1
  35. package/dist/src/gateway/hono/routes/exposure.js.map +1 -1
  36. package/dist/src/gateway/hono/sse.d.ts +1 -0
  37. package/dist/src/gateway/hono/sse.js +1 -0
  38. package/dist/src/gateway/hono/sse.js.map +1 -1
  39. package/dist/src/gateway/service.js +1 -1
  40. package/dist/src/share/share-rate-limit.js +23 -2
  41. package/dist/src/share/share-rate-limit.js.map +1 -1
  42. package/dist/src/tunnel/tunnel-rate-limit.js +13 -1
  43. package/dist/src/tunnel/tunnel-rate-limit.js.map +1 -1
  44. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "xopc Browser Bridge",
4
- "version": "0.0.81",
4
+ "version": "0.0.82",
5
5
  "description": "Browser automation bridge for xopc — executes commands in Chrome via the local xopc daemon.",
6
6
  "permissions": [
7
7
  "debugger",
@@ -2,7 +2,7 @@
2
2
  "id": "telegram",
3
3
  "name": "Telegram Channel",
4
4
  "description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
5
- "version": "0.0.81",
5
+ "version": "0.0.82",
6
6
  "kind": "channel",
7
7
  "main": "src/index.ts",
8
8
  "channels": ["telegram"],
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,i as o,l as s,n as c,t as l}from"./fetch-BAAh_kXG.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{D as d,F as f,I as p,L as m,a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-C57OMHW8.js";import{n as S,t as C}from"./button-KafIU8dx.js";import{i as w}from"./theme-store-DnwYutiX.js";import{$r as T,Ai as E,Ar as D,B as O,Ci as k,Dn as A,Ei as j,En as M,Er as N,F as P,Fr as F,Ft as I,G as L,Gi as R,Gn as z,Gt as B,H as V,Hi as H,I as U,Ir as W,It as G,Jn as K,Jt as ee,K as te,Kr as q,Kt as J,L as ne,Li as re,Ln as ie,Lt as ae,Mi as oe,N as se,Ni as ce,Nr as le,On as ue,P as de,Pn as fe,Pr as pe,Pt as me,Qn as he,Qr as ge,Qt as _e,R as ve,Rt as ye,Sn as be,Ti as xe,Tn as Se,Tr as Ce,U as we,Ur as Te,Ut as Ee,V as De,W as Oe,Wt as ke,Xi as Ae,Xn as je,Xr as Me,Xt as Ne,Yn as Pe,Yt as Fe,Zn as Ie,Zt as Le,_ as Re,_i as ze,_r as Be,a as Ve,ar as He,br as Ue,c as We,d as Ge,di as Ke,dn as qe,er as Je,f as Ye,fr as Xe,gr as Ze,h as Qe,hi as $e,i as et,ii as tt,ir as nt,ji as rt,jr as it,ki as at,l as ot,li as st,m as ct,mr as lt,nr as ut,o as dt,oi as ft,or as pt,p as mt,pi as ht,pr as gt,q as _t,qn as vt,qt as yt,r as bt,rr as xt,s as St,t as Ct,tr as wt,u as Tt,un as Et,ur as Dt,v as Ot,wi as kt,wr as At,xi as jt,yi as Mt,yr as Nt,z as Pt,zi as Ft,zn as It,zr as Lt,zt as Rt}from"./index-Bq3Lg4bG.js";import{n as zt,t as Bt}from"./settings-form-section-CjjEpVYM.js";import{c as Vt,f as Ht,n as Ut,t as Wt}from"./cron-dreaming-jobs-DueM3rBz.js";import{i as Gt,l as Kt,m as qt,n as Jt,u as Yt}from"./cron-api-BVQ2n75R.js";var Y=n(),X=r();function Xt(e){let t=(0,Y.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:c,onConfirm:l,onCancel:u,a:d}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(g,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=f):f=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=S(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=p):p=t[1];let m=a?d.purgeDisk:d.removeFromConfig,x;t[2]===m?x=t[3]:(x=(0,X.jsx)(b,{className:`text-base font-semibold text-fg`,children:m}),t[2]=m,t[3]=x);let w=a?d.confirmDeletePurge:d.confirmDelete,T;t[4]===w?T=t[5]:(T=(0,X.jsx)(y,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:w}),t[4]=w,t[5]=T);let E;t[6]!==d.purgeConfirmHint||t[7]!==d.purgeConfirmLabel||t[8]!==d.purgeConfirmPlaceholder||t[9]!==s||t[10]!==a||t[11]!==o||t[12]!==c?(E=a&&o?(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:d.purgeConfirmLabel}),(0,X.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:S(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:d.purgeConfirmPlaceholder.replace(`{{agentId}}`,o.id),value:s,onChange:e=>c(e.target.value)}),(0,X.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:d.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=d.purgeConfirmHint,t[7]=d.purgeConfirmLabel,t[8]=d.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=c,t[13]=E):E=t[13];let D;t[14]!==d.createModalCancel||t[15]!==i||t[16]!==u?(D=(0,X.jsx)(C,{type:`button`,variant:`ghost`,disabled:i,onClick:u,children:d.createModalCancel}),t[14]=d.createModalCancel,t[15]=i,t[16]=u,t[17]=D):D=t[17];let O=a?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,k;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(k=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=k):k=t[22];let A=a?d.purgeDisk:d.removeFromConfig,j;t[23]!==l||t[24]!==k||t[25]!==A||t[26]!==O?(j=(0,X.jsx)(C,{type:`button`,variant:`secondary`,className:O,disabled:k,onClick:l,children:A}),t[23]=l,t[24]=k,t[25]=A,t[26]=O,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==D?(M=(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[D,j]}),t[28]=j,t[29]=D,t[30]=M):M=t[30];let N;t[31]!==M||t[32]!==x||t[33]!==T||t[34]!==E?(N=(0,X.jsxs)(h,{children:[f,(0,X.jsxs)(_,{className:p,onOpenAutoFocus:Zt,children:[x,T,E,M]})]}),t[31]=M,t[32]=x,t[33]=T,t[34]=E,t[35]=N):N=t[35];let P;return t[36]!==r||t[37]!==n||t[38]!==N?(P=(0,X.jsx)(v,{open:n,onOpenChange:r,children:N}),t[36]=r,t[37]=n,t[38]=N,t[39]=P):P=t[39],P}function Zt(e){return e.preventDefault()}var Qt=[{id:`overview`,labelKey:`navIdentity`,icon:Je},{id:`profile`,labelKey:`navProfile`,icon:rt},{id:`tools`,labelKey:`navTools`,icon:Ie},{id:`skills`,labelKey:`navSkills`,icon:it},{id:`files`,labelKey:`navCoreFiles`,icon:ht}],$t=[{id:`channels`,labelKey:`tabChannels`,icon:pe},{id:`cron`,labelKey:`tabCron`,icon:j}];function en(e){let t=(0,Y.c)(20),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:S(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,I.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,X.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,c;t[3]!==n||t[4]!==o?(c=Qt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,X.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.navAdvanced?u=t[9]:(u=(0,X.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:n.navAdvanced}),t[8]=n.navAdvanced,t[9]=u);let d;t[10]!==n||t[11]!==o?(d=$t.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[10]=n,t[11]=o,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,X.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==n.editorNavAria||t[16]!==l||t[17]!==u||t[18]!==f?(p=(0,X.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":s,children:[l,u,f]}),t[15]=n.editorNavAria,t[16]=l,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function tn(e){let t=(0,Y.c)(49),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:c,onFooterSave:l,footerSaveDisabled:u,footerSavedFlash:d,busy:f,children:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(g,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Qe)}),t[0]=m):m=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=S(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,ct,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=w):w=t[1];let T;t[2]===a?T=t[3]:(T=(0,X.jsx)(b,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=T);let E;t[4]===o?E=t[5]:(E=(0,X.jsx)(y,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,t[5]=E);let D;t[6]!==T||t[7]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[T,E]}),t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=S(me,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(je,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===i.closeDialogAria?A=t[12]:(A=(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:O,"aria-label":i.closeDialogAria,children:k})}),t[11]=i.closeDialogAria,t[12]=A);let j;t[13]!==D||t[14]!==A?(j=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[D,A]}),t[13]=D,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==i||t[17]!==c||t[18]!==s?(M=(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,X.jsx)(en,{a:i,panel:s,onPanelChange:c})}),t[16]=i,t[17]=c,t[18]=s,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:p}),t[20]=p,t[21]=N);let P;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==u||t[25]!==d?(P=d?(0,X.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,i.personaSaved]}):u?(0,X.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:i.footerSaveNotApplicable}):null,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=u,t[25]=d,t[26]=P):P=t[26];let F=f||u,I;t[27]===l?I=t[28]:(I=()=>void l(),t[27]=l,t[28]=I);let L;t[29]!==i.save||t[30]!==F||t[31]!==I?(L=(0,X.jsx)(C,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:F,onClick:I,children:i.save}),t[29]=i.save,t[30]=F,t[31]=I,t[32]=L):L=t[32];let R;t[33]!==P||t[34]!==L?(R=(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[P,L]}),t[33]=P,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==N||t[37]!==R?(z=(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[N,R]}),t[36]=N,t[37]=R,t[38]=z):z=t[38];let B;t[39]!==z||t[40]!==M?(B=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,z]}),t[39]=z,t[40]=M,t[41]=B):B=t[41];let V;t[42]!==B||t[43]!==j?(V=(0,X.jsxs)(h,{children:[m,(0,X.jsx)(_,{className:w,onOpenAutoFocus:nn,children:(0,X.jsxs)(Tt,{layer:`modal`,children:[j,B]})})]}),t[42]=B,t[43]=j,t[44]=V):V=t[44];let H;return t[45]!==r||t[46]!==n||t[47]!==V?(H=(0,X.jsx)(v,{open:n,onOpenChange:r,children:V}),t[45]=r,t[46]=n,t[47]=V,t[48]=H):H=t[48],H}function nn(e){return e.preventDefault()}function rn(){return S(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,K,`dark:border-edge`)}function an(e,t,n){let r=e.agentId?.trim().toLowerCase();return r?r===t.toLowerCase():t.toLowerCase()===n.toLowerCase()}function on(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function sn(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}var cn=S(vt,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function ln(e){let t=(0,Y.c)(62),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:c,channelsStatusLoading:l,useManualChannel:u,newBindChannel:d,setNewBindChannel:f,bindSessionChats:p,sessionsLoading:m,newBindSessionIdx:h,setNewBindSessionIdx:g,newBindCustomPeer:_,setNewBindCustomPeer:v,onRefreshSessions:y,lastActiveLabels:b,selectRecipient:x}=e,w=!l&&(u||c.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,X.jsx)(zt,{className:`shrink-0`,icon:ge,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==a||t[7]!==i||t[8]!==r||t[9]!==o?(E=i?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):a.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:on(e.match)}),(0,X.jsx)(C,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${on(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=a,t[7]=i,t[8]=r,t[9]=o,t[10]=E):E=t[10];let O;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==c||t[16]!==l||t[17]!==d||t[18]!==f||t[19]!==v||t[20]!==g||t[21]!==u?(O=l?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):u?(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,X.jsx)(`input`,{className:rn(),value:d,onChange:e=>f(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,X.jsx)(`select`,{className:S(rn(),`py-2`),value:d,onChange:e=>{f(e.target.value),g(null),v(``)},children:c.map(e=>(0,X.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=c,t[16]=l,t[17]=d,t[18]=f,t[19]=v,t[20]=g,t[21]=u,t[22]=O):O=t[22];let k;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==p||t[34]!==r||t[35]!==b||t[36]!==d||t[37]!==_||t[38]!==h||t[39]!==y||t[40]!==x||t[41]!==m||t[42]!==v||t[43]!==g||t[44]!==w?(k=w&&d.trim()?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,X.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||m||!d.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>y(),children:[(0,X.jsx)(D,{className:S(`size-3.5`,m&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),m&&p.length===0?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,X.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,X.jsxs)(`select`,{className:S(rn(),`py-2`),value:h==null?``:String(h),disabled:r||!d.trim()||!!_.trim(),onChange:e=>{let t=e.target.value;g(t===``?null:Number(t))},children:[(0,X.jsx)(`option`,{value:``,children:n.channelsPeerAny}),p.map((e,t)=>(0,X.jsx)(`option`,{value:String(t),children:Vt(e,b)},`${e.channel}-${e.chatId}`))]})]}),p.length===0&&d.trim()&&!m?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,X.jsx)(`input`,{type:`text`,className:S(rn(),`min-w-0 w-full sm:flex-1`),value:_,onChange:e=>{v(e.target.value),e.target.value.trim()&&g(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,X.jsxs)(`select`,{className:cn,value:_,onChange:e=>{let t=e.target.value;v(t||``),g(null)},children:[(0,X.jsx)(`option`,{value:``,children:x}),p.map(e=>(0,X.jsx)(`option`,{value:e.chatId,children:Vt(e,b)},`${e.channel}-${e.chatId}`))]})]}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=p,t[34]=r,t[35]=b,t[36]=d,t[37]=_,t[38]=h,t[39]=y,t[40]=x,t[41]=m,t[42]=v,t[43]=g,t[44]=w,t[45]=k):k=t[45];let A;t[46]!==r||t[47]!==l||t[48]!==d?(A=r||!d.trim()||l,t[46]=r,t[47]=l,t[48]=d,t[49]=A):A=t[49];let j;t[50]!==n.addBinding||t[51]!==A?(j=(0,X.jsx)(`div`,{children:(0,X.jsx)(C,{type:`submit`,disabled:A,children:n.addBinding})}),t[50]=n.addBinding,t[51]=A,t[52]=j):j=t[52];let M;t[53]!==s||t[54]!==O||t[55]!==k||t[56]!==j?(M=(0,X.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[O,k,j]}),t[53]=s,t[54]=O,t[55]=k,t[56]=j,t[57]=M):M=t[57];let N;return t[58]!==T||t[59]!==E||t[60]!==M?(N=(0,X.jsxs)(Bt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,M]}),t[58]=T,t[59]=E,t[60]=M,t[61]=N):N=t[61],N}function un(e){let t=(0,Y.c)(12),n;t[0]!==e.expression||t[1]!==e.kind||t[2]!==e.labels||t[3]!==e.locale||t[4]!==e.nextRun||t[5]!==e.presetLabels||t[6]!==e.timezone||t[7]!==e.valueMs?(n=e.kind===`cron`?Ht(e.expression,e.locale,e.labels,{timezone:e.timezone,nextRun:e.nextRun}):Ut(e.valueMs,e.locale,e.presetLabels),t[0]=e.expression,t[1]=e.kind,t[2]=e.labels,t[3]=e.locale,t[4]=e.nextRun,t[5]=e.presetLabels,t[6]=e.timezone,t[7]=e.valueMs,t[8]=n):n=t[8];let r=n,i;return t[9]!==e.className||t[10]!==r?(i=(0,X.jsx)(`span`,{className:e.className,children:r}),t[9]=e.className,t[10]=r,t[11]=i):i=t[11],i}function dn(e){let t=(0,Y.c)(24),{a:n,data:r,busy:i,cronLoading:o,agentCronJobs:c,onSetCronJobAgent:l}=e,u=s(pn),d;t[0]===u?d=t[1]:(d=a(u),t[0]=u,t[1]=d);let f=d,p=u===`zh`?`zh-CN`:`en-US`,m=f.cron.scheduleBadge,h;t[2]!==n.cronHint||t[3]!==n.cronTitle?(h=(0,X.jsx)(zt,{className:`shrink-0`,icon:Ae,title:n.cronTitle,subtitle:n.cronHint}),t[2]=n.cronHint,t[3]=n.cronTitle,t[4]=h):h=t[4];let g;t[5]!==n.cronAgentClear||t[6]!==n.cronAgentDefault||t[7]!==n.cronColAgent||t[8]!==n.cronColMessage||t[9]!==n.cronColSchedule||t[10]!==n.cronColSession||t[11]!==n.cronLoading||t[12]!==n.cronNone||t[13]!==c||t[14]!==i||t[15]!==o||t[16]!==r||t[17]!==p||t[18]!==l||t[19]!==m?(g=o?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronLoading}):c.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronNone}):(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSchedule}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColMessage}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSession}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColAgent})]})}),(0,X.jsx)(`tbody`,{children:c.map(e=>{let t=!e.agentId?.trim(),a=t?``:e.agentId.trim().toLowerCase();return(0,X.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,X.jsx)(`td`,{className:`py-2 pr-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(un,{kind:`cron`,expression:e.schedule,locale:p,labels:m,timezone:e.timezone,nextRun:e.next_run,className:`text-sm font-medium text-fg`}),(0,X.jsx)(`span`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:e.schedule,children:e.schedule})]})}),(0,X.jsx)(`td`,{className:`max-w-[12rem] truncate py-2 pr-3 text-xs`,title:Jt(e),children:Jt(e)}),(0,X.jsx)(`td`,{className:`py-2 pr-3 text-xs`,children:e.sessionTarget??`main`}),(0,X.jsx)(`td`,{className:`py-2 pr-3`,children:(0,X.jsxs)(`select`,{className:S(rn(),`min-w-[8rem] py-1 text-xs`),value:a,disabled:i||e.sessionTarget!==`isolated`,onChange:t=>void l(e,t.target.value),children:[(0,X.jsx)(`option`,{value:``,children:t?n.cronAgentDefault:n.cronAgentClear}),r.agents.map(fn)]})})]},e.id)})})]})}),t[5]=n.cronAgentClear,t[6]=n.cronAgentDefault,t[7]=n.cronColAgent,t[8]=n.cronColMessage,t[9]=n.cronColSchedule,t[10]=n.cronColSession,t[11]=n.cronLoading,t[12]=n.cronNone,t[13]=c,t[14]=i,t[15]=o,t[16]=r,t[17]=p,t[18]=l,t[19]=m,t[20]=g):g=t[20];let _;return t[21]!==h||t[22]!==g?(_=(0,X.jsxs)(Bt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[h,g]}),t[21]=h,t[22]=g,t[23]=_):_=t[23],_}function fn(e){return(0,X.jsx)(`option`,{value:e.id,children:e.id},e.id)}function pn(e){return e.language}function mn(e){let t=(0,Y.c)(27),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:c,fileDraft:l,setFileDraft:u,fileSaving:d,profileFileLoading:f,profileEditorNonce:p}=e,m=w(hn),h;t[0]===n.filesHint?h=t[1]:(h=(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=h);let g;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesSavingStatus||t[8]!==n.missing||t[9]!==n.navCoreFiles||t[10]!==n.pickFile||t[11]!==a||t[12]!==l||t[13]!==d||t[14]!==i||t[15]!==r||t[16]!==s||t[17]!==m||t[18]!==p||t[19]!==f||t[20]!==o||t[21]!==u||t[22]!==c?(g=r?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):i?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,X.jsx)(`nav`,{className:`flex shrink-0 flex-row flex-wrap gap-x-0.5 gap-y-0 border-b border-edge-subtle`,"aria-label":n.navCoreFiles,children:i.files.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:S(`-mb-px shrink-0 border-b-2 border-transparent px-3 py-2 text-left font-mono text-xs whitespace-nowrap transition-colors`,I.press,a===e.name?`border-accent text-fg`:`text-fg-muted hover:border-edge-subtle hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>o(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name))}),(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,X.jsxs)(`button`,{type:`button`,className:S(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,I.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`edit`),children:[(0,X.jsx)(gt,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,X.jsxs)(`button`,{type:`button`,className:S(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,I.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`preview`),children:[(0,X.jsx)($e,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[d?(0,X.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,X.jsx)(`span`,{children:n.filesAutoSaveHint})]})]}),s===`edit`?(0,X.jsx)(`div`,{className:S(rn(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,f&&`pointer-events-none opacity-60`),children:(0,X.jsx)(ae,{initialContent:l,onChange:u,isDark:m,className:`min-h-0 flex-1`},`${a??`file`}-${p}`)}):(0,X.jsx)(`div`,{className:S(rn(),`min-h-0 flex-1 overflow-y-auto text-sm`,f&&`pointer-events-none opacity-60`),children:(0,X.jsx)(G,{content:l,className:`text-sm`})})]}):(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesSavingStatus,t[8]=n.missing,t[9]=n.navCoreFiles,t[10]=n.pickFile,t[11]=a,t[12]=l,t[13]=d,t[14]=i,t[15]=r,t[16]=s,t[17]=m,t[18]=p,t[19]=f,t[20]=o,t[21]=u,t[22]=c,t[23]=g):g=t[23];let _;return t[24]!==h||t[25]!==g?(_=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[h,g]}),t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function hn(e){return e.resolved===`dark`}var Z=e(t(),1);function gn(e){let t=(0,Y.c)(37),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,trailing:c}=e,l;t[0]!==r||t[1]!==n?(l={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=l):l=t[2];let u=St(l),d;t[3]===n?d=t[4]:(d=n.trim(),t[3]=n,t[4]=d);let f=d,p=f?`${f}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,m;t[5]===s?m=t[6]:(m=S(`min-w-0 flex-1`,s),t[5]=s,t[6]=m);let h=i||u.picking,g;t[7]===r?g=t[8]:(g=e=>void r(e.target.value),t[7]=r,t[8]=g);let _=o??a.pathInputPlaceholder,v;t[9]!==m||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==n?(v=(0,X.jsx)(`input`,{type:`text`,className:m,value:n,disabled:h,onChange:g,placeholder:_,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=n,t[14]=v):v=t[14];let y=i||u.picking,b;t[15]!==p||t[16]!==u.pick||t[17]!==y||t[18]!==n||t[19]!==a.selectWorkingDirectory?(b=(0,X.jsx)(We,{compact:!0,value:n,onPick:u.pick,disabled:y,title:p,"aria-label":a.selectWorkingDirectory}),t[15]=p,t[16]=u.pick,t[17]=y,t[18]=n,t[19]=a.selectWorkingDirectory,t[20]=b):b=t[20];let x;t[21]!==b||t[22]!==c?(x=(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[b,c]}),t[21]=b,t[22]=c,t[23]=x):x=t[23];let C;t[24]!==x||t[25]!==v?(C=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[v,x]}),t[24]=x,t[25]=v,t[26]=C):C=t[26];let w;t[27]!==u.confirmPick||t[28]!==u.hasNativePicker||t[29]!==u.modalOpen||t[30]!==u.setModalOpen||t[31]!==f||t[32]!==a?(w=u.hasNativePicker?null:(0,X.jsx)(bt,{open:u.modalOpen,onOpenChange:u.setModalOpen,initialAbsolutePath:f||void 0,onConfirm:u.confirmPick,wd:a}),t[27]=u.confirmPick,t[28]=u.hasNativePicker,t[29]=u.modalOpen,t[30]=u.setModalOpen,t[31]=f,t[32]=a,t[33]=w):w=t[33];let T;return t[34]!==C||t[35]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function _n(e){let t=(0,Y.c)(19),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s}=e,c;t[0]===n?c=t[1]:(c=(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=c);let l=i||`—`,u;t[2]===l?u=t[3]:(u=(0,X.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==a||t[5]!==r?(d=r===`inherit`&&a?(0,X.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==c||t[8]!==u||t[9]!==d?(f=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[c,u,d]}),t[7]=c,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,m;t[11]===p?m=t[12]:(m=S(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,p),t[11]=p,t[12]=m);let h=r===`inherit`?o:s,g;t[13]!==m||t[14]!==h?(g=(0,X.jsx)(`span`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==g?(_=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[f,g]}),t[16]=f,t[17]=g,t[18]=_):_=t[18],_}function vn(e){let t=(0,Y.c)(40),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,settingsPath:s}=e,c=s===void 0?`/settings/agent-defaults`:s,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let f=!u,p;t[2]!==o||t[3]!==i?(p=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=p):p=t[4];let m=p,h=f?r||l.unset:a,g=m?i||l.unset:o,_;t[5]!==l.editDefaultsLink||t[6]!==c?(_=(0,X.jsx)(d,{to:c,className:`text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:l.editDefaultsLink}),t[5]=l.editDefaultsLink,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==l.subtitle||t[9]!==l.title||t[10]!==_?(v=(0,X.jsx)(zt,{icon:ge,title:l.title,subtitle:l.subtitle,trailing:_}),t[8]=l.subtitle,t[9]=l.title,t[10]=_,t[11]=v):v=t[11];let y=f?`inherit`:`override`,b;t[12]!==r||t[13]!==l.inheritsValue||t[14]!==f?(b=f&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[12]=r,t[13]=l.inheritsValue,t[14]=f,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l.badgeInherit||t[18]!==l.badgeOverride||t[19]!==l.modelLabel||t[20]!==y||t[21]!==b?(x=(0,X.jsx)(_n,{label:l.modelLabel,mode:y,value:h,inheritedFrom:b,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[16]=h,t[17]=l.badgeInherit,t[18]=l.badgeOverride,t[19]=l.modelLabel,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S=m?`inherit`:`override`,C;t[23]!==i||t[24]!==l.inheritsValue||t[25]!==m?(C=m&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[23]=i,t[24]=l.inheritsValue,t[25]=m,t[26]=C):C=t[26];let w;t[27]!==g||t[28]!==l.badgeInherit||t[29]!==l.badgeOverride||t[30]!==l.workspaceLabel||t[31]!==S||t[32]!==C?(w=(0,X.jsx)(_n,{label:l.workspaceLabel,mode:S,value:g,inheritedFrom:C,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[27]=g,t[28]=l.badgeInherit,t[29]=l.badgeOverride,t[30]=l.workspaceLabel,t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==w||t[35]!==x?(T=(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[x,w]}),t[34]=w,t[35]=x,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==v?(E=(0,X.jsxs)(Bt,{children:[v,T]}),t[37]=T,t[38]=v,t[39]=E):E=t[39],E}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,Z.useRef)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!1),p=(0,Z.useMemo)(()=>{let e=Le(n.trim());return e&&Ne(e.styleId)?e.styleId:J[0]??`adventurer`},[n]),m=(0,Z.useCallback)(async(e,n)=>{try{await ne(t)}catch{}r(ee(e,n)),f(!1)},[t,r]),h=(0,Z.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){u(null),c(!0);try{await _t(t,n),r(yt)}catch(e){let t=e instanceof Error?e.message:``;u(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{c(!1)}}},[i,t,r]),g=(e,t)=>{let r=Le(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,X.jsxs)(`div`,{...a?{id:a}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:i.avatarPickerTitle}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void h(e)}),(0,X.jsxs)(C,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,X.jsx)(ut,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.avatarUploadCustom]})]})]}),l?(0,X.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:l}):null,(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:J.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>void m(e,B[0]??t),className:S(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,I.press,p===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,i)},e))}),(0,X.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[B.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:S(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,I.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,X.jsx)(`img`,{src:Fe(p,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,X.jsxs)(A,{open:d,onOpenChange:f,children:[(0,X.jsx)(ue,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:S(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,I.press),children:i.avatarMore})}),(0,X.jsx)(M,{children:(0,X.jsxs)(Se,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(p,i)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ke.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:S(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,I.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,X.jsx)(`img`,{src:Fe(p,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.personaAvatar}),(0,X.jsx)(Ee,{agentId:t,avatar:n,size:40}),n.trim()&&!Le(n.trim())&&n.trim()!==`xopc:custom`?(0,X.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}var xn={name:``,creature:``,emoji:``,avatar:``};function Sn(e){let t={...xn};if(!e.trim())return t;let n={name:`name`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,i as o,l as s,n as c,t as l}from"./fetch-BAAh_kXG.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{D as d,F as f,I as p,L as m,a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-C57OMHW8.js";import{n as S,t as C}from"./button-KafIU8dx.js";import{i as w}from"./theme-store-DnwYutiX.js";import{$r as T,Ai as E,Ar as D,B as O,Ci as k,Dn as A,Ei as j,En as M,Er as N,F as P,Fr as F,Ft as I,G as L,Gi as R,Gn as z,Gt as B,H as V,Hi as H,I as U,Ir as W,It as G,Jn as K,Jt as ee,K as te,Kr as q,Kt as J,L as ne,Li as re,Ln as ie,Lt as ae,Mi as oe,N as se,Ni as ce,Nr as le,On as ue,P as de,Pn as fe,Pr as pe,Pt as me,Qn as he,Qr as ge,Qt as _e,R as ve,Rt as ye,Sn as be,Ti as xe,Tn as Se,Tr as Ce,U as we,Ur as Te,Ut as Ee,V as De,W as Oe,Wt as ke,Xi as Ae,Xn as je,Xr as Me,Xt as Ne,Yn as Pe,Yt as Fe,Zn as Ie,Zt as Le,_ as Re,_i as ze,_r as Be,a as Ve,ar as He,br as Ue,c as We,d as Ge,di as Ke,dn as qe,er as Je,f as Ye,fr as Xe,gr as Ze,h as Qe,hi as $e,i as et,ii as tt,ir as nt,ji as rt,jr as it,ki as at,l as ot,li as st,m as ct,mr as lt,nr as ut,o as dt,oi as ft,or as pt,p as mt,pi as ht,pr as gt,q as _t,qn as vt,qt as yt,r as bt,rr as xt,s as St,t as Ct,tr as wt,u as Tt,un as Et,ur as Dt,v as Ot,wi as kt,wr as At,xi as jt,yi as Mt,yr as Nt,z as Pt,zi as Ft,zn as It,zr as Lt,zt as Rt}from"./index-DQuaMye9.js";import{n as zt,t as Bt}from"./settings-form-section-2Yu-FASs.js";import{c as Vt,f as Ht,n as Ut,t as Wt}from"./cron-dreaming-jobs-DueM3rBz.js";import{i as Gt,l as Kt,m as qt,n as Jt,u as Yt}from"./cron-api-Y2wfSJVI.js";var Y=n(),X=r();function Xt(e){let t=(0,Y.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:c,onConfirm:l,onCancel:u,a:d}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(g,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=f):f=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=S(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=p):p=t[1];let m=a?d.purgeDisk:d.removeFromConfig,x;t[2]===m?x=t[3]:(x=(0,X.jsx)(b,{className:`text-base font-semibold text-fg`,children:m}),t[2]=m,t[3]=x);let w=a?d.confirmDeletePurge:d.confirmDelete,T;t[4]===w?T=t[5]:(T=(0,X.jsx)(y,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:w}),t[4]=w,t[5]=T);let E;t[6]!==d.purgeConfirmHint||t[7]!==d.purgeConfirmLabel||t[8]!==d.purgeConfirmPlaceholder||t[9]!==s||t[10]!==a||t[11]!==o||t[12]!==c?(E=a&&o?(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:d.purgeConfirmLabel}),(0,X.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:S(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:d.purgeConfirmPlaceholder.replace(`{{agentId}}`,o.id),value:s,onChange:e=>c(e.target.value)}),(0,X.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:d.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=d.purgeConfirmHint,t[7]=d.purgeConfirmLabel,t[8]=d.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=c,t[13]=E):E=t[13];let D;t[14]!==d.createModalCancel||t[15]!==i||t[16]!==u?(D=(0,X.jsx)(C,{type:`button`,variant:`ghost`,disabled:i,onClick:u,children:d.createModalCancel}),t[14]=d.createModalCancel,t[15]=i,t[16]=u,t[17]=D):D=t[17];let O=a?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,k;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(k=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=k):k=t[22];let A=a?d.purgeDisk:d.removeFromConfig,j;t[23]!==l||t[24]!==k||t[25]!==A||t[26]!==O?(j=(0,X.jsx)(C,{type:`button`,variant:`secondary`,className:O,disabled:k,onClick:l,children:A}),t[23]=l,t[24]=k,t[25]=A,t[26]=O,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==D?(M=(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[D,j]}),t[28]=j,t[29]=D,t[30]=M):M=t[30];let N;t[31]!==M||t[32]!==x||t[33]!==T||t[34]!==E?(N=(0,X.jsxs)(h,{children:[f,(0,X.jsxs)(_,{className:p,onOpenAutoFocus:Zt,children:[x,T,E,M]})]}),t[31]=M,t[32]=x,t[33]=T,t[34]=E,t[35]=N):N=t[35];let P;return t[36]!==r||t[37]!==n||t[38]!==N?(P=(0,X.jsx)(v,{open:n,onOpenChange:r,children:N}),t[36]=r,t[37]=n,t[38]=N,t[39]=P):P=t[39],P}function Zt(e){return e.preventDefault()}var Qt=[{id:`overview`,labelKey:`navIdentity`,icon:Je},{id:`profile`,labelKey:`navProfile`,icon:rt},{id:`tools`,labelKey:`navTools`,icon:Ie},{id:`skills`,labelKey:`navSkills`,icon:it},{id:`files`,labelKey:`navCoreFiles`,icon:ht}],$t=[{id:`channels`,labelKey:`tabChannels`,icon:pe},{id:`cron`,labelKey:`tabCron`,icon:j}];function en(e){let t=(0,Y.c)(20),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:S(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,I.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,X.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,c;t[3]!==n||t[4]!==o?(c=Qt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,X.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.navAdvanced?u=t[9]:(u=(0,X.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:n.navAdvanced}),t[8]=n.navAdvanced,t[9]=u);let d;t[10]!==n||t[11]!==o?(d=$t.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[10]=n,t[11]=o,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,X.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==n.editorNavAria||t[16]!==l||t[17]!==u||t[18]!==f?(p=(0,X.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":s,children:[l,u,f]}),t[15]=n.editorNavAria,t[16]=l,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function tn(e){let t=(0,Y.c)(49),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:c,onFooterSave:l,footerSaveDisabled:u,footerSavedFlash:d,busy:f,children:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(g,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Qe)}),t[0]=m):m=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=S(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,ct,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=w):w=t[1];let T;t[2]===a?T=t[3]:(T=(0,X.jsx)(b,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=T);let E;t[4]===o?E=t[5]:(E=(0,X.jsx)(y,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,t[5]=E);let D;t[6]!==T||t[7]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[T,E]}),t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=S(me,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(je,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===i.closeDialogAria?A=t[12]:(A=(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:O,"aria-label":i.closeDialogAria,children:k})}),t[11]=i.closeDialogAria,t[12]=A);let j;t[13]!==D||t[14]!==A?(j=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[D,A]}),t[13]=D,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==i||t[17]!==c||t[18]!==s?(M=(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,X.jsx)(en,{a:i,panel:s,onPanelChange:c})}),t[16]=i,t[17]=c,t[18]=s,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:p}),t[20]=p,t[21]=N);let P;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==u||t[25]!==d?(P=d?(0,X.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,i.personaSaved]}):u?(0,X.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:i.footerSaveNotApplicable}):null,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=u,t[25]=d,t[26]=P):P=t[26];let F=f||u,I;t[27]===l?I=t[28]:(I=()=>void l(),t[27]=l,t[28]=I);let L;t[29]!==i.save||t[30]!==F||t[31]!==I?(L=(0,X.jsx)(C,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:F,onClick:I,children:i.save}),t[29]=i.save,t[30]=F,t[31]=I,t[32]=L):L=t[32];let R;t[33]!==P||t[34]!==L?(R=(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[P,L]}),t[33]=P,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==N||t[37]!==R?(z=(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[N,R]}),t[36]=N,t[37]=R,t[38]=z):z=t[38];let B;t[39]!==z||t[40]!==M?(B=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,z]}),t[39]=z,t[40]=M,t[41]=B):B=t[41];let V;t[42]!==B||t[43]!==j?(V=(0,X.jsxs)(h,{children:[m,(0,X.jsx)(_,{className:w,onOpenAutoFocus:nn,children:(0,X.jsxs)(Tt,{layer:`modal`,children:[j,B]})})]}),t[42]=B,t[43]=j,t[44]=V):V=t[44];let H;return t[45]!==r||t[46]!==n||t[47]!==V?(H=(0,X.jsx)(v,{open:n,onOpenChange:r,children:V}),t[45]=r,t[46]=n,t[47]=V,t[48]=H):H=t[48],H}function nn(e){return e.preventDefault()}function rn(){return S(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,K,`dark:border-edge`)}function an(e,t,n){let r=e.agentId?.trim().toLowerCase();return r?r===t.toLowerCase():t.toLowerCase()===n.toLowerCase()}function on(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function sn(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}var cn=S(vt,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function ln(e){let t=(0,Y.c)(62),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:c,channelsStatusLoading:l,useManualChannel:u,newBindChannel:d,setNewBindChannel:f,bindSessionChats:p,sessionsLoading:m,newBindSessionIdx:h,setNewBindSessionIdx:g,newBindCustomPeer:_,setNewBindCustomPeer:v,onRefreshSessions:y,lastActiveLabels:b,selectRecipient:x}=e,w=!l&&(u||c.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,X.jsx)(zt,{className:`shrink-0`,icon:ge,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==a||t[7]!==i||t[8]!==r||t[9]!==o?(E=i?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):a.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:on(e.match)}),(0,X.jsx)(C,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${on(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=a,t[7]=i,t[8]=r,t[9]=o,t[10]=E):E=t[10];let O;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==c||t[16]!==l||t[17]!==d||t[18]!==f||t[19]!==v||t[20]!==g||t[21]!==u?(O=l?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):u?(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,X.jsx)(`input`,{className:rn(),value:d,onChange:e=>f(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,X.jsx)(`select`,{className:S(rn(),`py-2`),value:d,onChange:e=>{f(e.target.value),g(null),v(``)},children:c.map(e=>(0,X.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=c,t[16]=l,t[17]=d,t[18]=f,t[19]=v,t[20]=g,t[21]=u,t[22]=O):O=t[22];let k;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==p||t[34]!==r||t[35]!==b||t[36]!==d||t[37]!==_||t[38]!==h||t[39]!==y||t[40]!==x||t[41]!==m||t[42]!==v||t[43]!==g||t[44]!==w?(k=w&&d.trim()?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,X.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||m||!d.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>y(),children:[(0,X.jsx)(D,{className:S(`size-3.5`,m&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),m&&p.length===0?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,X.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,X.jsxs)(`select`,{className:S(rn(),`py-2`),value:h==null?``:String(h),disabled:r||!d.trim()||!!_.trim(),onChange:e=>{let t=e.target.value;g(t===``?null:Number(t))},children:[(0,X.jsx)(`option`,{value:``,children:n.channelsPeerAny}),p.map((e,t)=>(0,X.jsx)(`option`,{value:String(t),children:Vt(e,b)},`${e.channel}-${e.chatId}`))]})]}),p.length===0&&d.trim()&&!m?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,X.jsx)(`input`,{type:`text`,className:S(rn(),`min-w-0 w-full sm:flex-1`),value:_,onChange:e=>{v(e.target.value),e.target.value.trim()&&g(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,X.jsxs)(`select`,{className:cn,value:_,onChange:e=>{let t=e.target.value;v(t||``),g(null)},children:[(0,X.jsx)(`option`,{value:``,children:x}),p.map(e=>(0,X.jsx)(`option`,{value:e.chatId,children:Vt(e,b)},`${e.channel}-${e.chatId}`))]})]}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=p,t[34]=r,t[35]=b,t[36]=d,t[37]=_,t[38]=h,t[39]=y,t[40]=x,t[41]=m,t[42]=v,t[43]=g,t[44]=w,t[45]=k):k=t[45];let A;t[46]!==r||t[47]!==l||t[48]!==d?(A=r||!d.trim()||l,t[46]=r,t[47]=l,t[48]=d,t[49]=A):A=t[49];let j;t[50]!==n.addBinding||t[51]!==A?(j=(0,X.jsx)(`div`,{children:(0,X.jsx)(C,{type:`submit`,disabled:A,children:n.addBinding})}),t[50]=n.addBinding,t[51]=A,t[52]=j):j=t[52];let M;t[53]!==s||t[54]!==O||t[55]!==k||t[56]!==j?(M=(0,X.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[O,k,j]}),t[53]=s,t[54]=O,t[55]=k,t[56]=j,t[57]=M):M=t[57];let N;return t[58]!==T||t[59]!==E||t[60]!==M?(N=(0,X.jsxs)(Bt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,M]}),t[58]=T,t[59]=E,t[60]=M,t[61]=N):N=t[61],N}function un(e){let t=(0,Y.c)(12),n;t[0]!==e.expression||t[1]!==e.kind||t[2]!==e.labels||t[3]!==e.locale||t[4]!==e.nextRun||t[5]!==e.presetLabels||t[6]!==e.timezone||t[7]!==e.valueMs?(n=e.kind===`cron`?Ht(e.expression,e.locale,e.labels,{timezone:e.timezone,nextRun:e.nextRun}):Ut(e.valueMs,e.locale,e.presetLabels),t[0]=e.expression,t[1]=e.kind,t[2]=e.labels,t[3]=e.locale,t[4]=e.nextRun,t[5]=e.presetLabels,t[6]=e.timezone,t[7]=e.valueMs,t[8]=n):n=t[8];let r=n,i;return t[9]!==e.className||t[10]!==r?(i=(0,X.jsx)(`span`,{className:e.className,children:r}),t[9]=e.className,t[10]=r,t[11]=i):i=t[11],i}function dn(e){let t=(0,Y.c)(24),{a:n,data:r,busy:i,cronLoading:o,agentCronJobs:c,onSetCronJobAgent:l}=e,u=s(pn),d;t[0]===u?d=t[1]:(d=a(u),t[0]=u,t[1]=d);let f=d,p=u===`zh`?`zh-CN`:`en-US`,m=f.cron.scheduleBadge,h;t[2]!==n.cronHint||t[3]!==n.cronTitle?(h=(0,X.jsx)(zt,{className:`shrink-0`,icon:Ae,title:n.cronTitle,subtitle:n.cronHint}),t[2]=n.cronHint,t[3]=n.cronTitle,t[4]=h):h=t[4];let g;t[5]!==n.cronAgentClear||t[6]!==n.cronAgentDefault||t[7]!==n.cronColAgent||t[8]!==n.cronColMessage||t[9]!==n.cronColSchedule||t[10]!==n.cronColSession||t[11]!==n.cronLoading||t[12]!==n.cronNone||t[13]!==c||t[14]!==i||t[15]!==o||t[16]!==r||t[17]!==p||t[18]!==l||t[19]!==m?(g=o?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronLoading}):c.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.cronNone}):(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSchedule}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColMessage}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColSession}),(0,X.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:n.cronColAgent})]})}),(0,X.jsx)(`tbody`,{children:c.map(e=>{let t=!e.agentId?.trim(),a=t?``:e.agentId.trim().toLowerCase();return(0,X.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,X.jsx)(`td`,{className:`py-2 pr-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(un,{kind:`cron`,expression:e.schedule,locale:p,labels:m,timezone:e.timezone,nextRun:e.next_run,className:`text-sm font-medium text-fg`}),(0,X.jsx)(`span`,{className:`truncate font-mono text-[0.65rem] text-fg-subtle`,title:e.schedule,children:e.schedule})]})}),(0,X.jsx)(`td`,{className:`max-w-[12rem] truncate py-2 pr-3 text-xs`,title:Jt(e),children:Jt(e)}),(0,X.jsx)(`td`,{className:`py-2 pr-3 text-xs`,children:e.sessionTarget??`main`}),(0,X.jsx)(`td`,{className:`py-2 pr-3`,children:(0,X.jsxs)(`select`,{className:S(rn(),`min-w-[8rem] py-1 text-xs`),value:a,disabled:i||e.sessionTarget!==`isolated`,onChange:t=>void l(e,t.target.value),children:[(0,X.jsx)(`option`,{value:``,children:t?n.cronAgentDefault:n.cronAgentClear}),r.agents.map(fn)]})})]},e.id)})})]})}),t[5]=n.cronAgentClear,t[6]=n.cronAgentDefault,t[7]=n.cronColAgent,t[8]=n.cronColMessage,t[9]=n.cronColSchedule,t[10]=n.cronColSession,t[11]=n.cronLoading,t[12]=n.cronNone,t[13]=c,t[14]=i,t[15]=o,t[16]=r,t[17]=p,t[18]=l,t[19]=m,t[20]=g):g=t[20];let _;return t[21]!==h||t[22]!==g?(_=(0,X.jsxs)(Bt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[h,g]}),t[21]=h,t[22]=g,t[23]=_):_=t[23],_}function fn(e){return(0,X.jsx)(`option`,{value:e.id,children:e.id},e.id)}function pn(e){return e.language}function mn(e){let t=(0,Y.c)(27),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:c,fileDraft:l,setFileDraft:u,fileSaving:d,profileFileLoading:f,profileEditorNonce:p}=e,m=w(hn),h;t[0]===n.filesHint?h=t[1]:(h=(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=h);let g;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesSavingStatus||t[8]!==n.missing||t[9]!==n.navCoreFiles||t[10]!==n.pickFile||t[11]!==a||t[12]!==l||t[13]!==d||t[14]!==i||t[15]!==r||t[16]!==s||t[17]!==m||t[18]!==p||t[19]!==f||t[20]!==o||t[21]!==u||t[22]!==c?(g=r?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):i?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,X.jsx)(`nav`,{className:`flex shrink-0 flex-row flex-wrap gap-x-0.5 gap-y-0 border-b border-edge-subtle`,"aria-label":n.navCoreFiles,children:i.files.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:S(`-mb-px shrink-0 border-b-2 border-transparent px-3 py-2 text-left font-mono text-xs whitespace-nowrap transition-colors`,I.press,a===e.name?`border-accent text-fg`:`text-fg-muted hover:border-edge-subtle hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>o(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name))}),(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,X.jsxs)(`button`,{type:`button`,className:S(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,I.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`edit`),children:[(0,X.jsx)(gt,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,X.jsxs)(`button`,{type:`button`,className:S(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,I.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`preview`),children:[(0,X.jsx)($e,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[d?(0,X.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,X.jsx)(`span`,{children:n.filesAutoSaveHint})]})]}),s===`edit`?(0,X.jsx)(`div`,{className:S(rn(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,f&&`pointer-events-none opacity-60`),children:(0,X.jsx)(ae,{initialContent:l,onChange:u,isDark:m,className:`min-h-0 flex-1`},`${a??`file`}-${p}`)}):(0,X.jsx)(`div`,{className:S(rn(),`min-h-0 flex-1 overflow-y-auto text-sm`,f&&`pointer-events-none opacity-60`),children:(0,X.jsx)(G,{content:l,className:`text-sm`})})]}):(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesSavingStatus,t[8]=n.missing,t[9]=n.navCoreFiles,t[10]=n.pickFile,t[11]=a,t[12]=l,t[13]=d,t[14]=i,t[15]=r,t[16]=s,t[17]=m,t[18]=p,t[19]=f,t[20]=o,t[21]=u,t[22]=c,t[23]=g):g=t[23];let _;return t[24]!==h||t[25]!==g?(_=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[h,g]}),t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function hn(e){return e.resolved===`dark`}var Z=e(t(),1);function gn(e){let t=(0,Y.c)(37),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,trailing:c}=e,l;t[0]!==r||t[1]!==n?(l={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=l):l=t[2];let u=St(l),d;t[3]===n?d=t[4]:(d=n.trim(),t[3]=n,t[4]=d);let f=d,p=f?`${f}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,m;t[5]===s?m=t[6]:(m=S(`min-w-0 flex-1`,s),t[5]=s,t[6]=m);let h=i||u.picking,g;t[7]===r?g=t[8]:(g=e=>void r(e.target.value),t[7]=r,t[8]=g);let _=o??a.pathInputPlaceholder,v;t[9]!==m||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==n?(v=(0,X.jsx)(`input`,{type:`text`,className:m,value:n,disabled:h,onChange:g,placeholder:_,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=n,t[14]=v):v=t[14];let y=i||u.picking,b;t[15]!==p||t[16]!==u.pick||t[17]!==y||t[18]!==n||t[19]!==a.selectWorkingDirectory?(b=(0,X.jsx)(We,{compact:!0,value:n,onPick:u.pick,disabled:y,title:p,"aria-label":a.selectWorkingDirectory}),t[15]=p,t[16]=u.pick,t[17]=y,t[18]=n,t[19]=a.selectWorkingDirectory,t[20]=b):b=t[20];let x;t[21]!==b||t[22]!==c?(x=(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[b,c]}),t[21]=b,t[22]=c,t[23]=x):x=t[23];let C;t[24]!==x||t[25]!==v?(C=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[v,x]}),t[24]=x,t[25]=v,t[26]=C):C=t[26];let w;t[27]!==u.confirmPick||t[28]!==u.hasNativePicker||t[29]!==u.modalOpen||t[30]!==u.setModalOpen||t[31]!==f||t[32]!==a?(w=u.hasNativePicker?null:(0,X.jsx)(bt,{open:u.modalOpen,onOpenChange:u.setModalOpen,initialAbsolutePath:f||void 0,onConfirm:u.confirmPick,wd:a}),t[27]=u.confirmPick,t[28]=u.hasNativePicker,t[29]=u.modalOpen,t[30]=u.setModalOpen,t[31]=f,t[32]=a,t[33]=w):w=t[33];let T;return t[34]!==C||t[35]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function _n(e){let t=(0,Y.c)(19),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s}=e,c;t[0]===n?c=t[1]:(c=(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=c);let l=i||`—`,u;t[2]===l?u=t[3]:(u=(0,X.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:l}),t[2]=l,t[3]=u);let d;t[4]!==a||t[5]!==r?(d=r===`inherit`&&a?(0,X.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==c||t[8]!==u||t[9]!==d?(f=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[c,u,d]}),t[7]=c,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,m;t[11]===p?m=t[12]:(m=S(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,p),t[11]=p,t[12]=m);let h=r===`inherit`?o:s,g;t[13]!==m||t[14]!==h?(g=(0,X.jsx)(`span`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==g?(_=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[f,g]}),t[16]=f,t[17]=g,t[18]=_):_=t[18],_}function vn(e){let t=(0,Y.c)(40),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,settingsPath:s}=e,c=s===void 0?`/settings/agent-defaults`:s,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let f=!u,p;t[2]!==o||t[3]!==i?(p=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=p):p=t[4];let m=p,h=f?r||l.unset:a,g=m?i||l.unset:o,_;t[5]!==l.editDefaultsLink||t[6]!==c?(_=(0,X.jsx)(d,{to:c,className:`text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:l.editDefaultsLink}),t[5]=l.editDefaultsLink,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==l.subtitle||t[9]!==l.title||t[10]!==_?(v=(0,X.jsx)(zt,{icon:ge,title:l.title,subtitle:l.subtitle,trailing:_}),t[8]=l.subtitle,t[9]=l.title,t[10]=_,t[11]=v):v=t[11];let y=f?`inherit`:`override`,b;t[12]!==r||t[13]!==l.inheritsValue||t[14]!==f?(b=f&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[12]=r,t[13]=l.inheritsValue,t[14]=f,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l.badgeInherit||t[18]!==l.badgeOverride||t[19]!==l.modelLabel||t[20]!==y||t[21]!==b?(x=(0,X.jsx)(_n,{label:l.modelLabel,mode:y,value:h,inheritedFrom:b,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[16]=h,t[17]=l.badgeInherit,t[18]=l.badgeOverride,t[19]=l.modelLabel,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S=m?`inherit`:`override`,C;t[23]!==i||t[24]!==l.inheritsValue||t[25]!==m?(C=m&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[23]=i,t[24]=l.inheritsValue,t[25]=m,t[26]=C):C=t[26];let w;t[27]!==g||t[28]!==l.badgeInherit||t[29]!==l.badgeOverride||t[30]!==l.workspaceLabel||t[31]!==S||t[32]!==C?(w=(0,X.jsx)(_n,{label:l.workspaceLabel,mode:S,value:g,inheritedFrom:C,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride}),t[27]=g,t[28]=l.badgeInherit,t[29]=l.badgeOverride,t[30]=l.workspaceLabel,t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==w||t[35]!==x?(T=(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[x,w]}),t[34]=w,t[35]=x,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==v?(E=(0,X.jsxs)(Bt,{children:[v,T]}),t[37]=T,t[38]=v,t[39]=E):E=t[39],E}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,Z.useRef)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!1),p=(0,Z.useMemo)(()=>{let e=Le(n.trim());return e&&Ne(e.styleId)?e.styleId:J[0]??`adventurer`},[n]),m=(0,Z.useCallback)(async(e,n)=>{try{await ne(t)}catch{}r(ee(e,n)),f(!1)},[t,r]),h=(0,Z.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){u(null),c(!0);try{await _t(t,n),r(yt)}catch(e){let t=e instanceof Error?e.message:``;u(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{c(!1)}}},[i,t,r]),g=(e,t)=>{let r=Le(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,X.jsxs)(`div`,{...a?{id:a}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:i.avatarPickerTitle}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void h(e)}),(0,X.jsxs)(C,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,X.jsx)(ut,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.avatarUploadCustom]})]})]}),l?(0,X.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:l}):null,(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:J.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>void m(e,B[0]??t),className:S(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,I.press,p===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,i)},e))}),(0,X.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[B.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:S(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,I.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,X.jsx)(`img`,{src:Fe(p,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,X.jsxs)(A,{open:d,onOpenChange:f,children:[(0,X.jsx)(ue,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:S(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,I.press),children:i.avatarMore})}),(0,X.jsx)(M,{children:(0,X.jsxs)(Se,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(p,i)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ke.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e,onClick:()=>void m(p,e),className:S(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,I.press,g(p,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,X.jsx)(`img`,{src:Fe(p,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.personaAvatar}),(0,X.jsx)(Ee,{agentId:t,avatar:n,size:40}),n.trim()&&!Le(n.trim())&&n.trim()!==`xopc:custom`?(0,X.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}var xn={name:``,creature:``,emoji:``,avatar:``};function Sn(e){let t={...xn};if(!e.trim())return t;let n={name:`name`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
2
2
  `)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function Cn(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
3
3
  `)}var wn={callName:``,pronouns:``,timezone:``,notes:``};function Tn(e){let t={...wn};if(!e.trim())return t;let n={name:`callName`,"what to call them":`callName`,pronouns:`pronouns`,timezone:`timezone`,notes:`notes`},r=e.split(`
4
4
  `),i=-1;for(let e=0;e<r.length;e++){let a=r[e];if(/^##\s+Context/i.test(a)){i=e+1;continue}let o=a.match(/^[-*]\s+\*\*(.+?):\*\*\s*(.*)/i);if(!o)continue;let s=n[o[1].toLowerCase().trim()];if(!s)continue;let c=o[2].trim();/^_\(.*\)_$/.test(c)&&(c=``),t[s]=c}if(i>0){let e=r.slice(i).join(`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,i as o,l as s,n as c,t as l}from"./fetch-BAAh_kXG.js";import{a as u,i as d}from"./vendor-swr-BIWyz7Rc.js";import{D as f,L as p,a as m,i as h,n as g,o as _,r as v,s as y}from"./dist-C57OMHW8.js";import{n as b,t as x}from"./button-KafIU8dx.js";import{Bi as S,Br as C,It as w,M as T,Nr as E,Pi as D,Pn as O,Xn as k,Xr as A,_i as j,_n as M,ar as N,bn as P,o as F,qi as I,vn as L,wr as R,xn as z,xr as B,yn as V}from"./index-Bq3Lg4bG.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await l(o(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await l(o(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await l(o(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await l(o(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function te({className:e}){let t=a(s(e=>e.language)).appsPage,n=i(e=>!!e.token),r=P(),{mutate:l}=u(),[f,p]=(0,H.useReducer)(F,Z),{q:m,debounced:h,detailPkg:g,rowBusy:_,actionError:v,restartHint:y}=f,x=n?`marketplace-${h}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>p({type:`patch`,patch:{debounced:m.trim()}}),300);return()=>window.clearTimeout(e)},[m]);let{data:S,isLoading:w,error:E}=d(x,async()=>c(h.length>0?o(`/api/marketplace?q=${encodeURIComponent(h)}`):o(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,H.useCallback)(()=>{l(`gateway-extensions-list`),T()},[l]),k=(0,H.useCallback)(async(e,n)=>{p({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});O(),r.requiresGatewayRestart&&p({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw p({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{p({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,O]),j=(0,H.useCallback)(async e=>{p({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);O(),n.requiresGatewayRestart&&p({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw p({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{p({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,O]),M=S?.extensions??[];return(0,Y.jsxs)(`div`,{className:b(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:m,onChange:e=>p({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),E?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E instanceof Error?E.message:t.marketplaceLoadFailed}):null,v?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,w&&!S?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=X(r,e.id),i=_===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>p({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),p({type:`patch`,patch:{detailPkg:e.id}}))},className:b(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(D,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&j(e.id).catch(()=>{})},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Y.jsx)(A,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(N,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{k(e.id,!1).catch(()=>{})},className:b(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Y.jsx)(A,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),g?(0,Y.jsx)(ne,{packageName:g,copy:t,extensions:r,onClose:()=>p({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:j}):null]})}function ne(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:s,onUninstall:c}=e,[l,u]=(0,H.useState)(!1),p=i(oe)?`ext-mp-detail-${n}`:null,v;t[0]===n?v=t[1]:(v=async()=>ee(n),t[0]=n,t[1]=v);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[2]=x):x=t[2];let{data:S,error:C,isLoading:T}=d(p,v,x),E;t[3]!==a||t[4]!==n?(E=X(a,n),t[3]=a,t[4]=n,t[5]=E):E=t[5];let D=E,O=D===`user`,j;t[6]!==r.marketplaceNoReadme||t[7]!==S?(j=S?.readme?.trim()||(S?.description?.trim()?`### ${S.name}\n\n${S.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=S,t[8]=j):j=t[8];let M=j,P;t[9]===o?P=t[10]:(P=e=>!e&&o(),t[9]=o,t[10]=P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=F):F=t[11];let L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsx)(I,{className:`size-5`}),t[12]=L):L=t[12];let R;t[13]!==r.detailBack||t[14]!==o?(R=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:L}),t[13]=r.detailBack,t[14]=o,t[15]=R):R=t[15];let z;t[16]===r.marketplaceDetailTitle?z=t[17]:(z=(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=z);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Y.jsx)(k,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:B}),t[19]=r.detailClose,t[20]=o,t[21]=V):V=t[21];let W;t[22]!==V||t[23]!==R||t[24]!==z?(W=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[R,z,V]}),t[22]=V,t[23]=R,t[24]=z,t[25]=W):W=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==S||t[32]!==C||t[33]!==T||t[34]!==M?(G=T&&!S?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):C?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):S?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:S.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:S.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:S.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:S.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:S.downloads})]})]}),S.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(w,{content:M})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=S,t[32]=C,t[33]=T,t[34]=M,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==l||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==S||t[47]!==D||t[48]!==o||t[49]!==s||t[50]!==c||t[51]!==n||t[52]!==O?(q=S?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:D===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(f,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>{O&&!window.confirm(r.marketplaceReinstallConfirm)||(u(!0),s(n,O).catch(ie).finally(()=>u(!1)))},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[l?(0,Y.jsx)(A,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,O?r.marketplaceReinstall:r.marketplaceInstall]}),O?(0,Y.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(u(!0),c(n).then(()=>o()).catch(re).finally(()=>u(!1)))},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(N,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=l,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=S,t[47]=D,t[48]=o,t[49]=s,t[50]=c,t[51]=n,t[52]=O,t[53]=q):q=t[53];let J;t[54]!==W||t[55]!==K||t[56]!==q?(J=(0,Y.jsxs)(m,{children:[F,(0,Y.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:ae,children:[W,K,q]})]}),t[54]=W,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Z;return t[58]!==J||t[59]!==P?(Z=(0,Y.jsx)(_,{defaultOpen:!0,onOpenChange:P,children:J}),t[58]=J,t[59]=P,t[60]=Z):Z=t[60],Z}function re(){}function ie(){}function ae(e){return e.preventDefault()}function oe(e){return!!e.token}function se(){let e=s(e=>e.language),t=a(e),n=O(e=>e.setPageHeader),r=O(e=>e.clearPageHeader),i=P(),o=z(),[c,l]=p(),u=W(c.get(`tab`)),d=c.get(`q`)??``,[f,m]=(0,H.useState)(u),[h,g]=(0,H.useState)(d),[_,v]=(0,H.useState)(null),y=c.toString(),x=(0,H.useRef)(y);if(x.current!==y){x.current=y;let e=W(c.get(`tab`)),t=c.get(`q`)??``;m(t=>t===e?t:e),g(e=>e===t?e:t)}(0,H.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,h,l]);let S=(0,H.useMemo)(()=>i.filter(e=>e.source===`bundled`),[i]),C=(0,H.useMemo)(()=>i.filter(e=>e.source!==`bundled`),[i]),w=f===`builtin`?S:C,T=(0,H.useMemo)(()=>{let t=h.trim().toLowerCase(),n=w;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[w,h,e]);if((0,H.useEffect)(()=>{v(e=>{if(!e)return e;let t=i.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[i]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,Y.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),o&&f!==`marketplace`)return(0,Y.jsx)(pe,{});let E=f!==`marketplace`&&w.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,Y.jsxs)(`header`,{className:`mb-6`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:t.appsPage.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.appsPage.subtitle})]}),(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`marketplace`,className:b(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,f===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,f===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`builtin`,className:b(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,f===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,f===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,S.length,`)`]})]}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`user`,className:b(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,f===`user`?`text-fg`:`text-fg-muted hover:text-fg`,f===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,C.length,`)`]})]})]}),E?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,Y.jsx)(te,{}):f===`builtin`&&S.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyBuiltin}):f===`user`&&C.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyUser}):T.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:T.map(e=>(0,Y.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:f===`user`,onOpen:()=>v(e)},e.id))})]}),_?(0,Y.jsx)(fe,{extension:_,copy:t.appsPage,onClose:()=>v(null)},_.id):null]})}function Q(e){return e.activationEligible??e.active}function ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=Q(n),t[0]=n,t[1]=o);let s=o,c=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=b(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=l):l=t[2];let u=n.name||n.id,d;t[3]===u?d=t[4]:(d=u.charAt(0).toUpperCase(),t[3]=u,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:d}),t[5]=d,t[6]=f);let p;t[7]===n.name?p=t[8]:(p=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=p);let m;t[9]===n.version?m=t[10]:(m=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=m);let h;t[11]!==p||t[12]!==m?(h=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==r.statusEnabled||t[15]!==s?(g=s?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(S,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(E,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=s,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==r.cardNoDescription||t[21]!==n.description?(v=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=v):v=t[22];let y;t[23]===v?y=t[24]:(y=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:v}),t[23]=v,t[24]=y);let x=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==x||t[26]!==c?(C=(0,Y.jsx)(`span`,{title:c,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:x}),t[25]=x,t[26]=c,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Y.jsx)(`span`,{title:ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let D;t[35]!==_||t[36]!==y||t[37]!==T?(D=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[_,y,T]}),t[35]=_,t[36]=y,t[37]=T,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==f?(O=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[f,D]}),t[39]=D,t[40]=f,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Y.jsx)(`button`,{type:`button`,onClick:a,className:l,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=u(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),d=e.activationEligible===!0,p=(0,H.useCallback)(async()=>{if(e.source===`bundled`){s(null),l(!1),a(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!d});await r(`gateway-extensions-list`),T(),l(t)}catch(e){s(e instanceof Error?e.message:t.builtinToggleFailed)}finally{a(!1)}}},[d,t.builtinToggleFailed,e.id,e.source,r]),S=e.ui?.contributions?.pages??[],C=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],E=e.ui?.contributions?.sidebarPanels??[],D=S.find(e=>e.showInNav)??S[0],O=C[0],N=D?M(e.id,D):null,P=O?`/settings/ext/${e.id}/${O.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(_,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(m,{children:[(0,Y.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(I,{className:`size-5`})}),(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(v,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(k,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ce(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(x,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):d?t.builtinToggleDisable:t.builtinToggleEnable})]}),o?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:o}):null,c?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(S.length>0||C.length>0||w.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:S.length,hidden:S.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:C.length,hidden:C.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:E.length,hidden:E.length===0})]})]}):null,V(e)&&(N||P)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,Y.jsxs)(f,{to:N,onClick:n,className:b(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(j,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,Y.jsxs)(f,{to:P,onClick:n,className:b(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(B,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{se as AppsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,i as o,l as s,n as c,t as l}from"./fetch-BAAh_kXG.js";import{a as u,i as d}from"./vendor-swr-BIWyz7Rc.js";import{D as f,L as p,a as m,i as h,n as g,o as _,r as v,s as y}from"./dist-C57OMHW8.js";import{n as b,t as x}from"./button-KafIU8dx.js";import{Bi as S,Br as C,It as w,M as T,Nr as E,Pi as D,Pn as O,Xn as k,Xr as A,_i as j,_n as M,ar as N,bn as P,o as F,qi as I,vn as L,wr as R,xn as z,xr as B,yn as V}from"./index-DQuaMye9.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await l(o(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await l(o(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await l(o(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await l(o(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function te({className:e}){let t=a(s(e=>e.language)).appsPage,n=i(e=>!!e.token),r=P(),{mutate:l}=u(),[f,p]=(0,H.useReducer)(F,Z),{q:m,debounced:h,detailPkg:g,rowBusy:_,actionError:v,restartHint:y}=f,x=n?`marketplace-${h}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>p({type:`patch`,patch:{debounced:m.trim()}}),300);return()=>window.clearTimeout(e)},[m]);let{data:S,isLoading:w,error:E}=d(x,async()=>c(h.length>0?o(`/api/marketplace?q=${encodeURIComponent(h)}`):o(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,H.useCallback)(()=>{l(`gateway-extensions-list`),T()},[l]),k=(0,H.useCallback)(async(e,n)=>{p({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});O(),r.requiresGatewayRestart&&p({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw p({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{p({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,O]),j=(0,H.useCallback)(async e=>{p({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);O(),n.requiresGatewayRestart&&p({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw p({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{p({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,O]),M=S?.extensions??[];return(0,Y.jsxs)(`div`,{className:b(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:m,onChange:e=>p({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),E?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:E instanceof Error?E.message:t.marketplaceLoadFailed}):null,v?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,w&&!S?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=X(r,e.id),i=_===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>p({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),p({type:`patch`,patch:{detailPkg:e.id}}))},className:b(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(D,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&j(e.id).catch(()=>{})},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Y.jsx)(A,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(N,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{k(e.id,!1).catch(()=>{})},className:b(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Y.jsx)(A,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),g?(0,Y.jsx)(ne,{packageName:g,copy:t,extensions:r,onClose:()=>p({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:j}):null]})}function ne(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:s,onUninstall:c}=e,[l,u]=(0,H.useState)(!1),p=i(oe)?`ext-mp-detail-${n}`:null,v;t[0]===n?v=t[1]:(v=async()=>ee(n),t[0]=n,t[1]=v);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[2]=x):x=t[2];let{data:S,error:C,isLoading:T}=d(p,v,x),E;t[3]!==a||t[4]!==n?(E=X(a,n),t[3]=a,t[4]=n,t[5]=E):E=t[5];let D=E,O=D===`user`,j;t[6]!==r.marketplaceNoReadme||t[7]!==S?(j=S?.readme?.trim()||(S?.description?.trim()?`### ${S.name}\n\n${S.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=S,t[8]=j):j=t[8];let M=j,P;t[9]===o?P=t[10]:(P=e=>!e&&o(),t[9]=o,t[10]=P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=F):F=t[11];let L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsx)(I,{className:`size-5`}),t[12]=L):L=t[12];let R;t[13]!==r.detailBack||t[14]!==o?(R=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:L}),t[13]=r.detailBack,t[14]=o,t[15]=R):R=t[15];let z;t[16]===r.marketplaceDetailTitle?z=t[17]:(z=(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=z);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Y.jsx)(k,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:B}),t[19]=r.detailClose,t[20]=o,t[21]=V):V=t[21];let W;t[22]!==V||t[23]!==R||t[24]!==z?(W=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[R,z,V]}),t[22]=V,t[23]=R,t[24]=z,t[25]=W):W=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==S||t[32]!==C||t[33]!==T||t[34]!==M?(G=T&&!S?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):C?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):S?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:S.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:S.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:S.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:S.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:S.downloads})]})]}),S.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(w,{content:M})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=S,t[32]=C,t[33]=T,t[34]=M,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==l||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==S||t[47]!==D||t[48]!==o||t[49]!==s||t[50]!==c||t[51]!==n||t[52]!==O?(q=S?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:D===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(f,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>{O&&!window.confirm(r.marketplaceReinstallConfirm)||(u(!0),s(n,O).catch(ie).finally(()=>u(!1)))},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[l?(0,Y.jsx)(A,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,O?r.marketplaceReinstall:r.marketplaceInstall]}),O?(0,Y.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(u(!0),c(n).then(()=>o()).catch(re).finally(()=>u(!1)))},className:b(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(N,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=l,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=S,t[47]=D,t[48]=o,t[49]=s,t[50]=c,t[51]=n,t[52]=O,t[53]=q):q=t[53];let J;t[54]!==W||t[55]!==K||t[56]!==q?(J=(0,Y.jsxs)(m,{children:[F,(0,Y.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:ae,children:[W,K,q]})]}),t[54]=W,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Z;return t[58]!==J||t[59]!==P?(Z=(0,Y.jsx)(_,{defaultOpen:!0,onOpenChange:P,children:J}),t[58]=J,t[59]=P,t[60]=Z):Z=t[60],Z}function re(){}function ie(){}function ae(e){return e.preventDefault()}function oe(e){return!!e.token}function se(){let e=s(e=>e.language),t=a(e),n=O(e=>e.setPageHeader),r=O(e=>e.clearPageHeader),i=P(),o=z(),[c,l]=p(),u=W(c.get(`tab`)),d=c.get(`q`)??``,[f,m]=(0,H.useState)(u),[h,g]=(0,H.useState)(d),[_,v]=(0,H.useState)(null),y=c.toString(),x=(0,H.useRef)(y);if(x.current!==y){x.current=y;let e=W(c.get(`tab`)),t=c.get(`q`)??``;m(t=>t===e?t:e),g(e=>e===t?e:t)}(0,H.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,h,l]);let S=(0,H.useMemo)(()=>i.filter(e=>e.source===`bundled`),[i]),C=(0,H.useMemo)(()=>i.filter(e=>e.source!==`bundled`),[i]),w=f===`builtin`?S:C,T=(0,H.useMemo)(()=>{let t=h.trim().toLowerCase(),n=w;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[w,h,e]);if((0,H.useEffect)(()=>{v(e=>{if(!e)return e;let t=i.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[i]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,Y.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),o&&f!==`marketplace`)return(0,Y.jsx)(pe,{});let E=f!==`marketplace`&&w.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,Y.jsxs)(`header`,{className:`mb-6`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:t.appsPage.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.appsPage.subtitle})]}),(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`marketplace`,className:b(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,f===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,f===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`builtin`,className:b(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,f===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,f===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,S.length,`)`]})]}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`user`,className:b(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,f===`user`?`text-fg`:`text-fg-muted hover:text-fg`,f===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,C.length,`)`]})]})]}),E?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,Y.jsx)(te,{}):f===`builtin`&&S.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyBuiltin}):f===`user`&&C.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyUser}):T.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:T.map(e=>(0,Y.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:f===`user`,onOpen:()=>v(e)},e.id))})]}),_?(0,Y.jsx)(fe,{extension:_,copy:t.appsPage,onClose:()=>v(null)},_.id):null]})}function Q(e){return e.activationEligible??e.active}function ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=Q(n),t[0]=n,t[1]=o);let s=o,c=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=b(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=l):l=t[2];let u=n.name||n.id,d;t[3]===u?d=t[4]:(d=u.charAt(0).toUpperCase(),t[3]=u,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:d}),t[5]=d,t[6]=f);let p;t[7]===n.name?p=t[8]:(p=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=p);let m;t[9]===n.version?m=t[10]:(m=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=m);let h;t[11]!==p||t[12]!==m?(h=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==r.statusEnabled||t[15]!==s?(g=s?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(S,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(E,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=s,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==r.cardNoDescription||t[21]!==n.description?(v=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=v):v=t[22];let y;t[23]===v?y=t[24]:(y=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:v}),t[23]=v,t[24]=y);let x=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==x||t[26]!==c?(C=(0,Y.jsx)(`span`,{title:c,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:x}),t[25]=x,t[26]=c,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Y.jsx)(`span`,{title:ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let D;t[35]!==_||t[36]!==y||t[37]!==T?(D=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[_,y,T]}),t[35]=_,t[36]=y,t[37]=T,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==f?(O=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[f,D]}),t[39]=D,t[40]=f,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Y.jsx)(`button`,{type:`button`,onClick:a,className:l,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=u(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),d=e.activationEligible===!0,p=(0,H.useCallback)(async()=>{if(e.source===`bundled`){s(null),l(!1),a(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!d});await r(`gateway-extensions-list`),T(),l(t)}catch(e){s(e instanceof Error?e.message:t.builtinToggleFailed)}finally{a(!1)}}},[d,t.builtinToggleFailed,e.id,e.source,r]),S=e.ui?.contributions?.pages??[],C=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],E=e.ui?.contributions?.sidebarPanels??[],D=S.find(e=>e.showInNav)??S[0],O=C[0],N=D?M(e.id,D):null,P=O?`/settings/ext/${e.id}/${O.id}`:e.hasConfigSchema||L(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(_,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(m,{children:[(0,Y.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(I,{className:`size-5`})}),(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(v,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(k,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ce(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(x,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):d?t.builtinToggleDisable:t.builtinToggleEnable})]}),o?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:o}):null,c?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(S.length>0||C.length>0||w.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:S.length,hidden:S.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:C.length,hidden:C.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:E.length,hidden:E.length===0})]})]}):null,V(e)&&(N||P)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,Y.jsxs)(f,{to:N,onClick:n,className:b(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(j,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,Y.jsxs)(f,{to:P,onClick:n,className:b(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(B,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{se as AppsPage};