@xopcai/xopc 0.0.147 → 0.0.148
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DXeSSlw1.js → activity-store-B5h0UGWn.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CFdJKSjY.js → agent-avatar-dicebear-Dy5VvLUq.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DKjbRpbA.js → agents-Ci1U96gj.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Bs69B5zA.js → api-B3J2AmQW.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-ag1ViXT_.js → app-management-settings-panel-BbSLDubO.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C6iMpwOM.js → appearance-settings-D9wK0UKA.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Z6cQTPS6.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Dwi3mIBy.js → archive-plugin-DaDK-FYa.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BaCDoq40.js → attachment-load-CKiBdU_s.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CwqtFgnw.js → automation-suggestion-card-8Qbnxq-p.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DlupOxFQ.js → automations-page-D7HmeFdr.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DoAYhsxa.js → binary-plugins-ByZbwN2A.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Bw72pO7S.js → block-editor-DGaI2ucU.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BwLoUBcZ.js → browser-settings-page-BZ25v96s.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-vdbAR65Q.js → capability-presets-api-DaPf3b5d.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BAsKbJgm.js → capability-presets-settings-panel-C0iHFbY9.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-rTG26jpV.js → channel-recipient-api-DrbkoYyF.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-CxFWy0cE.js → channels-settings-Bc7FVeqs.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-P3J5voxb.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-DIMP4NWY.js → connector-logo-CiHea96v.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BjQQwX62.js → connectors-page-oi41mE3U.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-kQq2e0BN.js → desktop-pet-DzdsBRdD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B6vtozMY.js → desktop-pet-settings-B-URlTdB.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Dn5-e3v4.js → directory-picker-path-field-g_N_ROC-.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BzwIujPG.js → dreaming-settings-DnEe0Mxg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_e_hsEy.js → extension-debug-page-DPkoOQED.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D15CWHBd.js → extension-page-Cf_gDelx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D4P0n1om.js → extension-settings-page-YlXpJV9k.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B4qZctjG.js → gateway-config-api-BxHgXB-I.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BvndV7TP.js → gateway-settings-CGphLe9T.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BpgMunEb.js → gateway-startup-retry-ChI88pp7.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DrVHKXHq.js → goal-create-dialog-ClzciTH5.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-PHlCwv68.js → goal-detail-page-CyaLkWhd.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-B6YJB_ct.js → goals-config-api-NoJKU8UZ.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-Hg9uyO6e.js → goals-page-C-srWhsP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-BROWCIcL.js → goals-settings-kQ1pBOM9.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CoCwIOIg.js → heartbeat-settings-C6jSQCXQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-DktduA8Z.css +1 -0
- package/dist/gateway/static/root/assets/{index-CxkNzw3e.js → index-twNrYC3D.js} +59 -59
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bm_AIYQ7.js → keyboard-shortcuts-settings-CIQ6wLqH.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BJWFcxwG.js → local-app-workbench-page-DcaqgchY.js} +1 -1
- package/dist/gateway/static/root/assets/local-apps-page-BO6odwNn.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-Bp8joZck.js → locale-store-BP67jtYG.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DOmK61ey.js → logs-page-B_13EkK7.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Dy7QpaAz.js → markdown-split-DbJZwtmM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-3Lxliy9D.js → media-plugins-B0WH561o.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CQGpD-dC.js → messages-BIsSVgW7.js} +5 -5
- package/dist/gateway/static/root/assets/{models-hub-panel-DGCZom4o.js → models-hub-panel-DkCTjUj_.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BJtT4vSf.js → notes-page-B72S7M1Z.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-B_bN7cOR.js → notes-workbench-CfWQczho.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-DKB6RDre.js → page-tabs-LjSEtOvG.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Br_YhYHp.js → preview-open-alternatives-Cn8Jp9jw.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BWOTQX4M.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-DvfL7fSe.js → projects-page-C81dHQ5i.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DqwMXSXP.js → remote-access-hub-U1FQUBtJ.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BgIE9BBh.js → save-bar-controls-BDUPII5R.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BXDP-oMz.js → schedule-field-B1NY9MNs.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Dhv-SmjG.js → schema-form-CnsFMun1.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-B_mOZkQk.js → sessions-page-t6DzYLpM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DggKrWED.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CUTExnlK.js → settings-collapsible-section-D9jJ6KlR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CmnDhsf0.js → settings-form-section-36IjMuUY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B79dq-XY.js → settings-loading-skeleton-DyYMmawg.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DaFwstQw.js → settings-page-layout-BAP5LguT.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Db8uAv3X.js → settings-page-yv4TeHfF.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BUSEj0KK.js → setup-status-panel-DncjFopP.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Bi00uXzV.js → share-preview-page-BBxZ9lX5.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DzsTYfuX.js → shares-settings-Brx1LsY9.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C_sLcSxh.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DeB1tQZL.js → skills-page-BPzqM78D.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Cxaph7hW.js → system-settings-panel-B3ceUo4i.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-eCTN1RpG.js → theme-store-_efiWyB8.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CcZ_tyFY.js → typed-models-lib-Dp1PvxGZ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-C4PWbNoi.js → use-channel-catalog-XHelnCa_.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-QTVMx_hG.js → user-context-page-Dg_4sJJz.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CPOO9Jz5.js → user-profile-fields-editor-nOOg0uBi.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-C8cgtSF7.js → user-profile-settings-panel-9fBPCoA9.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CiZK2KwH.js → utils-3AORlPIm.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-b-YZtvUu.js → voice-api-key-field-Bc-xxEHw.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-4zVDOl2G.js → work-discovery-page-CCMe2E98.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-CHe2tfkc.js → work-item-detail-page-CnVze8sW.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-8SLCYeXE.js → workflow-run-setup-panel-DUKlCVcY.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DEOFqiWn.js → workflows-page-1Hh-__Ur.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/apps-page-CpX3lBFF.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-OKlqTtKJ.js +0 -1
- package/dist/gateway/static/root/assets/index-DjCSOyaN.css +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-BsiZMrEf.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dq8JouJj.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BHGmH6YS.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DSsdU081.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-CQGpD-dC.js";import{n as s,o as c}from"./locale-store-Bp8joZck.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Ao as u,As as d,El as f,Jo as p,Ko as m,Ks as h,Mo as g,Nl as _,No as v,Oo as y,Po as b,Qc as x,Wo as S,Wr as C,Yo as w,dc as T,jo as E,ko as D,lu as O,mc as k,ms as A,qo as j,rc as M,ss as N,vs as ee,ys as P}from"./index-CxkNzw3e.js";import{n as te,t as ne}from"./settings-page-layout-DaFwstQw.js";import{n as re,t as F}from"./settings-loading-skeleton-B79dq-XY.js";import{n as I,t as L}from"./settings-form-section-CmnDhsf0.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./capability-presets-api-vdbAR65Q.js";import{a as de,i as fe,o as R,t as z}from"./typed-models-lib-CcZ_tyFY.js";var B=e(t(),1),V=n(),H=r();function pe(e){let t=(0,V.c)(34),{extendsIds:n,onExtendsChange:r,presetOptions:i,jsonFields:a,onJsonFieldsChange:o,disabled:s,labels:c}=e,l;t[0]===a?l=t[1]:(l=Object.keys(a),t[0]=a,t[1]=l);let u=l,d;t[2]===c.inheritanceTitle?d=t[3]:(d=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.inheritanceTitle}),t[2]=c.inheritanceTitle,t[3]=d);let f;t[4]===c.inheritanceHint?f=t[5]:(f=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.inheritanceHint}),t[4]=c.inheritanceHint,t[5]=f);let p;t[6]!==s||t[7]!==n||t[8]!==c.inheritanceEmpty||t[9]!==r||t[10]!==i?(p=i.length>0?(0,H.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=n.includes(e.id);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:s,onChange:()=>r(t?n.filter(t=>t!==e.id):[...n,e.id])}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-fg-subtle`,children:e.id})]})]},e.id)})}):(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c.inheritanceEmpty}),t[6]=s,t[7]=n,t[8]=c.inheritanceEmpty,t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`section`,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c.jsonTitle?h=t[17]:(h=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.jsonTitle}),t[16]=c.jsonTitle,t[17]=h);let g;t[18]===c.jsonHint?g=t[19]:(g=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.jsonHint}),t[18]=c.jsonHint,t[19]=g);let _;t[20]!==s||t[21]!==u||t[22]!==a||t[23]!==c.fieldHints||t[24]!==c.fieldLabels||t[25]!==o?(_=(0,H.jsx)(`div`,{className:`mt-3 grid gap-4 lg:grid-cols-2`,children:u.map(e=>(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:c.fieldLabels[e]}),(0,H.jsx)(`span`,{className:`min-h-8 text-xs leading-relaxed text-fg-muted`,children:c.fieldHints[e]}),(0,H.jsx)(`textarea`,{className:`min-h-36 resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 font-mono text-xs leading-relaxed text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:a[e],disabled:s,spellCheck:!1,placeholder:`{}`,onChange:t=>o({...a,[e]:t.target.value})})]},e))}),t[20]=s,t[21]=u,t[22]=a,t[23]=c.fieldHints,t[24]=c.fieldLabels,t[25]=o,t[26]=_):_=t[26];let v;t[27]!==h||t[28]!==g||t[29]!==_?(v=(0,H.jsxs)(`section`,{children:[h,g,_]}),t[27]=h,t[28]=g,t[29]=_,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==v?(y=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,v]}),t[31]=m,t[32]=v,t[33]=y):y=t[33],y}function U(e){return e.name||e.directoryId}function me(e){let t=(0,V.c)(56),{mode:n,selected:r,catalog:i,loading:o,disabled:s,onModeChange:c,onSelectedChange:l,labels:u}=e,d=n===`allowlist`||n===`denylist`,f;t[0]===i?f=t[1]:(f=i.map(U).filter(Boolean),t[0]=i,t[1]=f);let p=f,m;bb0:{if(n===`inherit`){m=u.inheritSummary;break bb0}if(n===`all`){m=u.allSummary;break bb0}if(n===`off`){m=u.offSummary;break bb0}let e=n===`allowlist`?u.allowSummary:u.denySummary,i;t[2]!==r.size||t[3]!==e?(i=e.replace(`{{count}}`,String(r.size)),t[2]=r.size,t[3]=e,t[4]=i):i=t[4],m=i}let h=m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,H.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[5]=g):g=t[5];let _;t[6]===u.overrideSummaryTitle?_=t[7]:(_=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[g,u.overrideSummaryTitle]}),t[6]=u.overrideSummaryTitle,t[7]=_);let v;t[8]===h?v=t[9]:(v=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:h}),t[8]=h,t[9]=v);let y;t[10]!==_||t[11]!==v?(y=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[_,v]}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]===u.modeLabel?b=t[14]:(b=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.modeLabel}),t[13]=u.modeLabel,t[14]=b);let x;t[15]===u.modeInherit?x=t[16]:(x=[`inherit`,u.modeInherit],t[15]=u.modeInherit,t[16]=x);let S;t[17]===u.modeAll?S=t[18]:(S=[`all`,u.modeAll],t[17]=u.modeAll,t[18]=S);let C;t[19]===u.modeAllowlist?C=t[20]:(C=[`allowlist`,u.modeAllowlist],t[19]=u.modeAllowlist,t[20]=C);let w;t[21]===u.modeDenylist?w=t[22]:(w=[`denylist`,u.modeDenylist],t[21]=u.modeDenylist,t[22]=w);let T;t[23]===u.modeOff?T=t[24]:(T=[`off`,u.modeOff],t[23]=u.modeOff,t[24]=T);let E;t[25]!==w||t[26]!==T||t[27]!==x||t[28]!==S||t[29]!==C?(E=[x,S,C,w,T],t[25]=w,t[26]=T,t[27]=x,t[28]=S,t[29]=C,t[30]=E):E=t[30];let D=E,k;t[31]!==s||t[32]!==n||t[33]!==c||t[34]!==D?(k=(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:D.map(e=>{let[t,r]=e;return(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,n===t?`bg-accent-soft text-accent-fg`:`bg-surface-panel text-fg hover:bg-surface-hover/55`),disabled:s,onClick:()=>c(t),children:r},t)})}),t[31]=s,t[32]=n,t[33]=c,t[34]=D,t[35]=k):k=t[35];let j;t[36]!==k||t[37]!==b?(j=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[b,k]}),t[36]=k,t[37]=b,t[38]=j):j=t[38];let M;t[39]!==i||t[40]!==p||t[41]!==s||t[42]!==u.emptyCatalog||t[43]!==u.noDescription||t[44]!==u.quickActionsLabel||t[45]!==u.quickClear||t[46]!==u.quickSelectAll||t[47]!==o||t[48]!==l||t[49]!==d||t[50]!==r?(M=d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.quickActionsLabel}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:s||o||p.length===0,onClick:()=>l(new Set(p)),children:u.quickSelectAll}),(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:s||o||r.size===0,onClick:()=>l(new Set),children:u.quickClear})]})]}),o?(0,H.jsx)(F,{rows:3}):i.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.emptyCatalog}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:i.map(e=>{let t=U(e),n=r.has(t),i=typeof e.description==`string`?e.description.trim():``,o=i||u.noDescription;return(0,H.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,H.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:s,onChange:()=>{let e=new Set(r);n?e.delete(t):e.add(t),l(e)},"aria-label":t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,H.jsx)(`p`,{className:a(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!i&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})]}):null,t[39]=i,t[40]=p,t[41]=s,t[42]=u.emptyCatalog,t[43]=u.noDescription,t[44]=u.quickActionsLabel,t[45]=u.quickClear,t[46]=u.quickSelectAll,t[47]=o,t[48]=l,t[49]=d,t[50]=r,t[51]=M):M=t[51];let N;return t[52]!==j||t[53]!==M||t[54]!==y?(N=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y,j,M]}),t[52]=j,t[53]=M,t[54]=y,t[55]=N):N=t[55],N}var W=[`write_file`,`apply_patch`,`exec_command`,`execute_code`],G=[`exec_command`,`execute_code`,`automation`,`extensions`,`bundle-mcp`,`skill_manage`],K=[`send_message`,`send_media`,`text_to_speech`,`create_share`],he=[`read_file`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`,`web_extract`],ge=[...W,...K],q=[`read_file`,`write_file`,`apply_patch`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`],_e=[`send_message`,`send_media`];function ve(e,t){let n={};for(let[r,i]of t)for(let t of r)e.has(t)&&(n[t]={mode:i});return n}function ye(e){let t=(0,V.c)(105),{builtinToolIds:n,toolPolicies:r,onChange:i,disabled:o,getToolDescription:s,getGroupTitle:c,labels:l}=e,u;t[0]===n?u=t[1]:(u=new Set(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==d||t[3]!==r?(f=Object.entries(r).filter(e=>{let[t]=e;return d.has(t)}).toSorted(be),t[2]=d,t[3]=r,t[4]=f):f=t[4];let p=f,h;if(t[5]!==d||t[6]!==n){h=[];for(let e of se){let t=e.toolIds.filter(e=>d.has(e));t.length>0&&h.push({key:e.key,ids:[...t]})}let e;t[8]===n?e=t[9]:(e=le(n),t[8]=n,t[9]=e);let r=e;if(r.length>0){let e;t[10]===r?e=t[11]:(e={key:`misc`,ids:r},t[10]=r,t[11]=e),h.push(e)}t[5]=d,t[6]=n,t[7]=h}else h=t[7];let g=h,_;t[12]!==i||t[13]!==r?(_=(e,t)=>{let n={...r};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},i(n)},t[12]=i,t[13]=r,t[14]=_):_=t[14];let v=_,y;t[15]!==i||t[16]!==r?(y=(e,t)=>{let n=r[e];n&&i({...r,[e]:t(n)})},t[15]=i,t[16]=r,t[17]=y):y=t[17];let b=y,x;t[18]!==d||t[19]!==i?(x=e=>{i(ve(d,e))},t[18]=d,t[19]=i,t[20]=x):x=t[20];let C=x;if(n.length===0){let e;return t[21]===l.emptyBuiltin?e=t[22]:(e=(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.emptyBuiltin}),t[21]=l.emptyBuiltin,t[22]=e),e}let w;t[23]===l.quickActionsLabel?w=t[24]:(w=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:l.quickActionsLabel}),t[23]=l.quickActionsLabel,t[24]=w);let T;t[25]===i?T=t[26]:(T=()=>i({}),t[25]=i,t[26]=T);let E;t[27]!==o||t[28]!==l.quickClearOverrides||t[29]!==T?(E=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:T,children:l.quickClearOverrides}),t[27]=o,t[28]=l.quickClearOverrides,t[29]=T,t[30]=E):E=t[30];let D;t[31]===C?D=t[32]:(D=()=>C([[W,`deny`]]),t[31]=C,t[32]=D);let O;t[33]!==o||t[34]!==l.quickReadOnlyWorkspace||t[35]!==D?(O=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:D,children:l.quickReadOnlyWorkspace}),t[33]=o,t[34]=l.quickReadOnlyWorkspace,t[35]=D,t[36]=O):O=t[36];let k;t[37]===C?k=t[38]:(k=()=>C([[G,`deny`]]),t[37]=C,t[38]=k);let j;t[39]!==o||t[40]!==l.quickHighRiskOff||t[41]!==k?(j=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:k,children:l.quickHighRiskOff}),t[39]=o,t[40]=l.quickHighRiskOff,t[41]=k,t[42]=j):j=t[42];let M;t[43]===C?M=t[44]:(M=()=>C([[K,`deny`]]),t[43]=C,t[44]=M);let N;t[45]!==o||t[46]!==l.quickNoOutbound||t[47]!==M?(N=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:M,children:l.quickNoOutbound}),t[45]=o,t[46]=l.quickNoOutbound,t[47]=M,t[48]=N):N=t[48];let ee;t[49]===C?ee=t[50]:(ee=()=>C([[he,`allow`],[ge,`deny`]]),t[49]=C,t[50]=ee);let P;t[51]!==o||t[52]!==l.quickResearchMode||t[53]!==ee?(P=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:ee,children:l.quickResearchMode}),t[51]=o,t[52]=l.quickResearchMode,t[53]=ee,t[54]=P):P=t[54];let te;t[55]===C?te=t[56]:(te=()=>C([[q,`allow`],[_e,`deny`]]),t[55]=C,t[56]=te);let ne;t[57]!==o||t[58]!==l.quickCodingMode||t[59]!==te?(ne=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:te,children:l.quickCodingMode}),t[57]=o,t[58]=l.quickCodingMode,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==j||t[62]!==N||t[63]!==P||t[64]!==ne||t[65]!==E||t[66]!==O?(re=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E,O,j,N,P,ne]}),t[61]=j,t[62]=N,t[63]=P,t[64]=ne,t[65]=E,t[66]=O,t[67]=re):re=t[67];let F;t[68]!==re||t[69]!==w?(F=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[w,re]}),t[68]=re,t[69]=w,t[70]=F):F=t[70];let I;t[71]===l.overrideSummaryTitle?I=t[72]:(I=(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.overrideSummaryTitle}),t[71]=l.overrideSummaryTitle,t[72]=I);let L;t[73]!==l.modeAllow||t[74]!==l.modeConfirm||t[75]!==l.modeDeny||t[76]!==l.noOverrides||t[77]!==p?(L=p.length>0?(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:p.map(e=>{let[t,n]=e;return(0,H.jsxs)(`span`,{className:a(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[11px]`,n.mode===`deny`&&`border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300`,n.mode===`confirm`&&`border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300`,n.mode===`allow`&&`border-accent/25 bg-accent/10 text-accent`),children:[t,(0,H.jsx)(`span`,{className:`font-sans opacity-80`,children:n.mode===`allow`?l.modeAllow:n.mode===`confirm`?l.modeConfirm:l.modeDeny})]},t)})}):(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.noOverrides}),t[73]=l.modeAllow,t[74]=l.modeConfirm,t[75]=l.modeDeny,t[76]=l.noOverrides,t[77]=p,t[78]=L):L=t[78];let ie;t[79]!==I||t[80]!==L?(ie=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[I,L]}),t[79]=I,t[80]=L,t[81]=ie):ie=t[81];let ae;t[82]!==o||t[83]!==c||t[84]!==s||t[85]!==g||t[86]!==l.inheritedMode||t[87]!==l.maxCallsLabel||t[88]!==l.modeAllow||t[89]!==l.modeConfirm||t[90]!==l.modeDeny||t[91]!==l.scopeInherit||t[92]!==l.scopeLabel||t[93]!==l.scopeReadonly||t[94]!==l.scopeUnrestricted||t[95]!==l.scopeWorkspace||t[96]!==l.timeoutLabel||t[97]!==v||t[98]!==r||t[99]!==b?(ae=(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:g.map(e=>{let{key:t,ids:n}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:c(t)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:n.map(e=>{let t=s(e),n=r[e],i=n?n.mode:`inherit`;return(0,H.jsxs)(`li`,{className:a(`rounded-xl px-3 py-2.5 shadow-surface transition-colors`,i===`inherit`?`bg-surface-panel/50`:`bg-surface-panel`),children:[(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium text-fg`,children:e}),t?(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:t}):null]}),(0,H.jsx)(`div`,{className:`inline-flex w-fit rounded-lg border border-edge-subtle bg-surface-base p-0.5`,children:[`inherit`,`allow`,`confirm`,`deny`].map(t=>(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,i===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),disabled:o,onClick:()=>v(e,t),children:t===`inherit`?l.inheritedMode:t===`allow`?l.modeAllow:t===`confirm`?l.modeConfirm:l.modeDeny},t))})]}),n?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 sm:grid-cols-3 dark:border-edge`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l.scopeLabel,(0,H.jsxs)(S,{value:n.scope??``,disabled:o,onChange:t=>b(e,e=>{let n=t.target.value;if(!n){let{scope:t,...n}=e;return n}return{...e,scope:n}}),children:[(0,H.jsx)(m,{value:``,children:l.scopeInherit}),(0,H.jsx)(m,{value:`readonly`,children:l.scopeReadonly}),(0,H.jsx)(m,{value:`workspace`,children:l.scopeWorkspace}),(0,H.jsx)(m,{value:`unrestricted`,children:l.scopeUnrestricted})]})]}),(0,H.jsx)(J,{label:l.maxCallsLabel,value:n.limits?.maxCallsPerTurn,disabled:o,onChange:t=>b(e,e=>xe(e,`maxCallsPerTurn`,t))}),(0,H.jsx)(J,{label:l.timeoutLabel,value:n.limits?.timeoutMs,disabled:o,onChange:t=>b(e,e=>xe(e,`timeoutMs`,t))})]}):null]},e)})})]},t)})}),t[82]=o,t[83]=c,t[84]=s,t[85]=g,t[86]=l.inheritedMode,t[87]=l.maxCallsLabel,t[88]=l.modeAllow,t[89]=l.modeConfirm,t[90]=l.modeDeny,t[91]=l.scopeInherit,t[92]=l.scopeLabel,t[93]=l.scopeReadonly,t[94]=l.scopeUnrestricted,t[95]=l.scopeWorkspace,t[96]=l.timeoutLabel,t[97]=v,t[98]=r,t[99]=b,t[100]=ae):ae=t[100];let oe;return t[101]!==F||t[102]!==ie||t[103]!==ae?(oe=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,ie,ae]}),t[101]=F,t[102]=ie,t[103]=ae,t[104]=oe):oe=t[104],oe}function be(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function xe(e,t,n){let r={...e.limits};if(n===void 0?delete r[t]:r[t]=n,Object.keys(r).length===0){let{limits:t,...n}=e;return n}return{...e,limits:r}}function J(e){let t=(0,V.c)(9),n=e.value??``,r;t[0]===e?r=t[1]:(r=t=>{let n=t.target.value.trim();e.onChange(n?Number(n):void 0)},t[0]=e,t[1]=r);let i;t[2]!==e.disabled||t[3]!==n||t[4]!==r?(i=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,value:n,disabled:e.disabled,onChange:r}),t[2]=e.disabled,t[3]=n,t[4]=r,t[5]=i):i=t[5];let a;return t[6]!==e.label||t[7]!==i?(a=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[e.label,i]}),t[6]=e.label,t[7]=i,t[8]=a):a=t[8],a}var Se=[{id:`overview`,icon:_},{id:`models`,icon:x},{id:`tools`,icon:P},{id:`skills`,icon:T},{id:`advanced`,icon:h},{id:`impact`,icon:f}];function Ce(e){return fe(Object.entries(e?.models?.roles??{}).map(([e,t])=>({id:e,model:t.model,fallbacks:t.fallbacks??[],description:t.description})))}function Y(e){return structuredClone(e?.tools?.builtin??{})}function we(e){let t=e?.skills;if(!t)return new Set;let n=t.mode===`denylist`?t.deny:t.allow;return new Set(n??[])}function Te(){return{primary:``,fallbacks:``,timeoutMs:``,autoProviderFallback:``}}function Ee(e){return{primary:e?.primary??``,fallbacks:e?.fallbacks?.join(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-BIsSVgW7.js";import{n as s,o as c}from"./locale-store-BP67jtYG.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Ao as u,As as d,El as f,Jo as p,Ko as m,Ks as h,Mo as g,Nl as _,No as v,Oo as y,Po as b,Qc as x,Wo as S,Wr as C,Yo as w,dc as T,jo as E,ko as D,lu as O,mc as k,ms as A,qo as j,rc as M,ss as N,vs as ee,ys as P}from"./index-twNrYC3D.js";import{n as te,t as ne}from"./settings-page-layout-BAP5LguT.js";import{n as re,t as F}from"./settings-loading-skeleton-DyYMmawg.js";import{n as I,t as L}from"./settings-form-section-36IjMuUY.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./capability-presets-api-DaPf3b5d.js";import{a as de,i as fe,o as R,t as z}from"./typed-models-lib-Dp1PvxGZ.js";var B=e(t(),1),V=n(),H=r();function pe(e){let t=(0,V.c)(34),{extendsIds:n,onExtendsChange:r,presetOptions:i,jsonFields:a,onJsonFieldsChange:o,disabled:s,labels:c}=e,l;t[0]===a?l=t[1]:(l=Object.keys(a),t[0]=a,t[1]=l);let u=l,d;t[2]===c.inheritanceTitle?d=t[3]:(d=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.inheritanceTitle}),t[2]=c.inheritanceTitle,t[3]=d);let f;t[4]===c.inheritanceHint?f=t[5]:(f=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.inheritanceHint}),t[4]=c.inheritanceHint,t[5]=f);let p;t[6]!==s||t[7]!==n||t[8]!==c.inheritanceEmpty||t[9]!==r||t[10]!==i?(p=i.length>0?(0,H.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=n.includes(e.id);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:s,onChange:()=>r(t?n.filter(t=>t!==e.id):[...n,e.id])}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-fg-subtle`,children:e.id})]})]},e.id)})}):(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c.inheritanceEmpty}),t[6]=s,t[7]=n,t[8]=c.inheritanceEmpty,t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`section`,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c.jsonTitle?h=t[17]:(h=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.jsonTitle}),t[16]=c.jsonTitle,t[17]=h);let g;t[18]===c.jsonHint?g=t[19]:(g=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.jsonHint}),t[18]=c.jsonHint,t[19]=g);let _;t[20]!==s||t[21]!==u||t[22]!==a||t[23]!==c.fieldHints||t[24]!==c.fieldLabels||t[25]!==o?(_=(0,H.jsx)(`div`,{className:`mt-3 grid gap-4 lg:grid-cols-2`,children:u.map(e=>(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:c.fieldLabels[e]}),(0,H.jsx)(`span`,{className:`min-h-8 text-xs leading-relaxed text-fg-muted`,children:c.fieldHints[e]}),(0,H.jsx)(`textarea`,{className:`min-h-36 resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 font-mono text-xs leading-relaxed text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:a[e],disabled:s,spellCheck:!1,placeholder:`{}`,onChange:t=>o({...a,[e]:t.target.value})})]},e))}),t[20]=s,t[21]=u,t[22]=a,t[23]=c.fieldHints,t[24]=c.fieldLabels,t[25]=o,t[26]=_):_=t[26];let v;t[27]!==h||t[28]!==g||t[29]!==_?(v=(0,H.jsxs)(`section`,{children:[h,g,_]}),t[27]=h,t[28]=g,t[29]=_,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==v?(y=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,v]}),t[31]=m,t[32]=v,t[33]=y):y=t[33],y}function U(e){return e.name||e.directoryId}function me(e){let t=(0,V.c)(56),{mode:n,selected:r,catalog:i,loading:o,disabled:s,onModeChange:c,onSelectedChange:l,labels:u}=e,d=n===`allowlist`||n===`denylist`,f;t[0]===i?f=t[1]:(f=i.map(U).filter(Boolean),t[0]=i,t[1]=f);let p=f,m;bb0:{if(n===`inherit`){m=u.inheritSummary;break bb0}if(n===`all`){m=u.allSummary;break bb0}if(n===`off`){m=u.offSummary;break bb0}let e=n===`allowlist`?u.allowSummary:u.denySummary,i;t[2]!==r.size||t[3]!==e?(i=e.replace(`{{count}}`,String(r.size)),t[2]=r.size,t[3]=e,t[4]=i):i=t[4],m=i}let h=m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,H.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[5]=g):g=t[5];let _;t[6]===u.overrideSummaryTitle?_=t[7]:(_=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[g,u.overrideSummaryTitle]}),t[6]=u.overrideSummaryTitle,t[7]=_);let v;t[8]===h?v=t[9]:(v=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:h}),t[8]=h,t[9]=v);let y;t[10]!==_||t[11]!==v?(y=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[_,v]}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]===u.modeLabel?b=t[14]:(b=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.modeLabel}),t[13]=u.modeLabel,t[14]=b);let x;t[15]===u.modeInherit?x=t[16]:(x=[`inherit`,u.modeInherit],t[15]=u.modeInherit,t[16]=x);let S;t[17]===u.modeAll?S=t[18]:(S=[`all`,u.modeAll],t[17]=u.modeAll,t[18]=S);let C;t[19]===u.modeAllowlist?C=t[20]:(C=[`allowlist`,u.modeAllowlist],t[19]=u.modeAllowlist,t[20]=C);let w;t[21]===u.modeDenylist?w=t[22]:(w=[`denylist`,u.modeDenylist],t[21]=u.modeDenylist,t[22]=w);let T;t[23]===u.modeOff?T=t[24]:(T=[`off`,u.modeOff],t[23]=u.modeOff,t[24]=T);let E;t[25]!==w||t[26]!==T||t[27]!==x||t[28]!==S||t[29]!==C?(E=[x,S,C,w,T],t[25]=w,t[26]=T,t[27]=x,t[28]=S,t[29]=C,t[30]=E):E=t[30];let D=E,k;t[31]!==s||t[32]!==n||t[33]!==c||t[34]!==D?(k=(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:D.map(e=>{let[t,r]=e;return(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,n===t?`bg-accent-soft text-accent-fg`:`bg-surface-panel text-fg hover:bg-surface-hover/55`),disabled:s,onClick:()=>c(t),children:r},t)})}),t[31]=s,t[32]=n,t[33]=c,t[34]=D,t[35]=k):k=t[35];let j;t[36]!==k||t[37]!==b?(j=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[b,k]}),t[36]=k,t[37]=b,t[38]=j):j=t[38];let M;t[39]!==i||t[40]!==p||t[41]!==s||t[42]!==u.emptyCatalog||t[43]!==u.noDescription||t[44]!==u.quickActionsLabel||t[45]!==u.quickClear||t[46]!==u.quickSelectAll||t[47]!==o||t[48]!==l||t[49]!==d||t[50]!==r?(M=d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.quickActionsLabel}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:s||o||p.length===0,onClick:()=>l(new Set(p)),children:u.quickSelectAll}),(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:s||o||r.size===0,onClick:()=>l(new Set),children:u.quickClear})]})]}),o?(0,H.jsx)(F,{rows:3}):i.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.emptyCatalog}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:i.map(e=>{let t=U(e),n=r.has(t),i=typeof e.description==`string`?e.description.trim():``,o=i||u.noDescription;return(0,H.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,H.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:s,onChange:()=>{let e=new Set(r);n?e.delete(t):e.add(t),l(e)},"aria-label":t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,H.jsx)(`p`,{className:a(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!i&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})]}):null,t[39]=i,t[40]=p,t[41]=s,t[42]=u.emptyCatalog,t[43]=u.noDescription,t[44]=u.quickActionsLabel,t[45]=u.quickClear,t[46]=u.quickSelectAll,t[47]=o,t[48]=l,t[49]=d,t[50]=r,t[51]=M):M=t[51];let N;return t[52]!==j||t[53]!==M||t[54]!==y?(N=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y,j,M]}),t[52]=j,t[53]=M,t[54]=y,t[55]=N):N=t[55],N}var W=[`write_file`,`apply_patch`,`exec_command`,`execute_code`],G=[`exec_command`,`execute_code`,`automation`,`extensions`,`bundle-mcp`,`skill_manage`],K=[`send_message`,`send_media`,`text_to_speech`,`create_share`],he=[`read_file`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`,`web_extract`],ge=[...W,...K],q=[`read_file`,`write_file`,`apply_patch`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`],_e=[`send_message`,`send_media`];function ve(e,t){let n={};for(let[r,i]of t)for(let t of r)e.has(t)&&(n[t]={mode:i});return n}function ye(e){let t=(0,V.c)(105),{builtinToolIds:n,toolPolicies:r,onChange:i,disabled:o,getToolDescription:s,getGroupTitle:c,labels:l}=e,u;t[0]===n?u=t[1]:(u=new Set(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==d||t[3]!==r?(f=Object.entries(r).filter(e=>{let[t]=e;return d.has(t)}).toSorted(be),t[2]=d,t[3]=r,t[4]=f):f=t[4];let p=f,h;if(t[5]!==d||t[6]!==n){h=[];for(let e of se){let t=e.toolIds.filter(e=>d.has(e));t.length>0&&h.push({key:e.key,ids:[...t]})}let e;t[8]===n?e=t[9]:(e=le(n),t[8]=n,t[9]=e);let r=e;if(r.length>0){let e;t[10]===r?e=t[11]:(e={key:`misc`,ids:r},t[10]=r,t[11]=e),h.push(e)}t[5]=d,t[6]=n,t[7]=h}else h=t[7];let g=h,_;t[12]!==i||t[13]!==r?(_=(e,t)=>{let n={...r};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},i(n)},t[12]=i,t[13]=r,t[14]=_):_=t[14];let v=_,y;t[15]!==i||t[16]!==r?(y=(e,t)=>{let n=r[e];n&&i({...r,[e]:t(n)})},t[15]=i,t[16]=r,t[17]=y):y=t[17];let b=y,x;t[18]!==d||t[19]!==i?(x=e=>{i(ve(d,e))},t[18]=d,t[19]=i,t[20]=x):x=t[20];let C=x;if(n.length===0){let e;return t[21]===l.emptyBuiltin?e=t[22]:(e=(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.emptyBuiltin}),t[21]=l.emptyBuiltin,t[22]=e),e}let w;t[23]===l.quickActionsLabel?w=t[24]:(w=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:l.quickActionsLabel}),t[23]=l.quickActionsLabel,t[24]=w);let T;t[25]===i?T=t[26]:(T=()=>i({}),t[25]=i,t[26]=T);let E;t[27]!==o||t[28]!==l.quickClearOverrides||t[29]!==T?(E=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:T,children:l.quickClearOverrides}),t[27]=o,t[28]=l.quickClearOverrides,t[29]=T,t[30]=E):E=t[30];let D;t[31]===C?D=t[32]:(D=()=>C([[W,`deny`]]),t[31]=C,t[32]=D);let O;t[33]!==o||t[34]!==l.quickReadOnlyWorkspace||t[35]!==D?(O=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:D,children:l.quickReadOnlyWorkspace}),t[33]=o,t[34]=l.quickReadOnlyWorkspace,t[35]=D,t[36]=O):O=t[36];let k;t[37]===C?k=t[38]:(k=()=>C([[G,`deny`]]),t[37]=C,t[38]=k);let j;t[39]!==o||t[40]!==l.quickHighRiskOff||t[41]!==k?(j=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:k,children:l.quickHighRiskOff}),t[39]=o,t[40]=l.quickHighRiskOff,t[41]=k,t[42]=j):j=t[42];let M;t[43]===C?M=t[44]:(M=()=>C([[K,`deny`]]),t[43]=C,t[44]=M);let N;t[45]!==o||t[46]!==l.quickNoOutbound||t[47]!==M?(N=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:M,children:l.quickNoOutbound}),t[45]=o,t[46]=l.quickNoOutbound,t[47]=M,t[48]=N):N=t[48];let ee;t[49]===C?ee=t[50]:(ee=()=>C([[he,`allow`],[ge,`deny`]]),t[49]=C,t[50]=ee);let P;t[51]!==o||t[52]!==l.quickResearchMode||t[53]!==ee?(P=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:ee,children:l.quickResearchMode}),t[51]=o,t[52]=l.quickResearchMode,t[53]=ee,t[54]=P):P=t[54];let te;t[55]===C?te=t[56]:(te=()=>C([[q,`allow`],[_e,`deny`]]),t[55]=C,t[56]=te);let ne;t[57]!==o||t[58]!==l.quickCodingMode||t[59]!==te?(ne=(0,H.jsx)(A,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:te,children:l.quickCodingMode}),t[57]=o,t[58]=l.quickCodingMode,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==j||t[62]!==N||t[63]!==P||t[64]!==ne||t[65]!==E||t[66]!==O?(re=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E,O,j,N,P,ne]}),t[61]=j,t[62]=N,t[63]=P,t[64]=ne,t[65]=E,t[66]=O,t[67]=re):re=t[67];let F;t[68]!==re||t[69]!==w?(F=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[w,re]}),t[68]=re,t[69]=w,t[70]=F):F=t[70];let I;t[71]===l.overrideSummaryTitle?I=t[72]:(I=(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.overrideSummaryTitle}),t[71]=l.overrideSummaryTitle,t[72]=I);let L;t[73]!==l.modeAllow||t[74]!==l.modeConfirm||t[75]!==l.modeDeny||t[76]!==l.noOverrides||t[77]!==p?(L=p.length>0?(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:p.map(e=>{let[t,n]=e;return(0,H.jsxs)(`span`,{className:a(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[11px]`,n.mode===`deny`&&`border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300`,n.mode===`confirm`&&`border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300`,n.mode===`allow`&&`border-accent/25 bg-accent/10 text-accent`),children:[t,(0,H.jsx)(`span`,{className:`font-sans opacity-80`,children:n.mode===`allow`?l.modeAllow:n.mode===`confirm`?l.modeConfirm:l.modeDeny})]},t)})}):(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.noOverrides}),t[73]=l.modeAllow,t[74]=l.modeConfirm,t[75]=l.modeDeny,t[76]=l.noOverrides,t[77]=p,t[78]=L):L=t[78];let ie;t[79]!==I||t[80]!==L?(ie=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[I,L]}),t[79]=I,t[80]=L,t[81]=ie):ie=t[81];let ae;t[82]!==o||t[83]!==c||t[84]!==s||t[85]!==g||t[86]!==l.inheritedMode||t[87]!==l.maxCallsLabel||t[88]!==l.modeAllow||t[89]!==l.modeConfirm||t[90]!==l.modeDeny||t[91]!==l.scopeInherit||t[92]!==l.scopeLabel||t[93]!==l.scopeReadonly||t[94]!==l.scopeUnrestricted||t[95]!==l.scopeWorkspace||t[96]!==l.timeoutLabel||t[97]!==v||t[98]!==r||t[99]!==b?(ae=(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:g.map(e=>{let{key:t,ids:n}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:c(t)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:n.map(e=>{let t=s(e),n=r[e],i=n?n.mode:`inherit`;return(0,H.jsxs)(`li`,{className:a(`rounded-xl px-3 py-2.5 shadow-surface transition-colors`,i===`inherit`?`bg-surface-panel/50`:`bg-surface-panel`),children:[(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium text-fg`,children:e}),t?(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:t}):null]}),(0,H.jsx)(`div`,{className:`inline-flex w-fit rounded-lg border border-edge-subtle bg-surface-base p-0.5`,children:[`inherit`,`allow`,`confirm`,`deny`].map(t=>(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,i===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),disabled:o,onClick:()=>v(e,t),children:t===`inherit`?l.inheritedMode:t===`allow`?l.modeAllow:t===`confirm`?l.modeConfirm:l.modeDeny},t))})]}),n?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 sm:grid-cols-3 dark:border-edge`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l.scopeLabel,(0,H.jsxs)(S,{value:n.scope??``,disabled:o,onChange:t=>b(e,e=>{let n=t.target.value;if(!n){let{scope:t,...n}=e;return n}return{...e,scope:n}}),children:[(0,H.jsx)(m,{value:``,children:l.scopeInherit}),(0,H.jsx)(m,{value:`readonly`,children:l.scopeReadonly}),(0,H.jsx)(m,{value:`workspace`,children:l.scopeWorkspace}),(0,H.jsx)(m,{value:`unrestricted`,children:l.scopeUnrestricted})]})]}),(0,H.jsx)(J,{label:l.maxCallsLabel,value:n.limits?.maxCallsPerTurn,disabled:o,onChange:t=>b(e,e=>xe(e,`maxCallsPerTurn`,t))}),(0,H.jsx)(J,{label:l.timeoutLabel,value:n.limits?.timeoutMs,disabled:o,onChange:t=>b(e,e=>xe(e,`timeoutMs`,t))})]}):null]},e)})})]},t)})}),t[82]=o,t[83]=c,t[84]=s,t[85]=g,t[86]=l.inheritedMode,t[87]=l.maxCallsLabel,t[88]=l.modeAllow,t[89]=l.modeConfirm,t[90]=l.modeDeny,t[91]=l.scopeInherit,t[92]=l.scopeLabel,t[93]=l.scopeReadonly,t[94]=l.scopeUnrestricted,t[95]=l.scopeWorkspace,t[96]=l.timeoutLabel,t[97]=v,t[98]=r,t[99]=b,t[100]=ae):ae=t[100];let oe;return t[101]!==F||t[102]!==ie||t[103]!==ae?(oe=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,ie,ae]}),t[101]=F,t[102]=ie,t[103]=ae,t[104]=oe):oe=t[104],oe}function be(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function xe(e,t,n){let r={...e.limits};if(n===void 0?delete r[t]:r[t]=n,Object.keys(r).length===0){let{limits:t,...n}=e;return n}return{...e,limits:r}}function J(e){let t=(0,V.c)(9),n=e.value??``,r;t[0]===e?r=t[1]:(r=t=>{let n=t.target.value.trim();e.onChange(n?Number(n):void 0)},t[0]=e,t[1]=r);let i;t[2]!==e.disabled||t[3]!==n||t[4]!==r?(i=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,value:n,disabled:e.disabled,onChange:r}),t[2]=e.disabled,t[3]=n,t[4]=r,t[5]=i):i=t[5];let a;return t[6]!==e.label||t[7]!==i?(a=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[e.label,i]}),t[6]=e.label,t[7]=i,t[8]=a):a=t[8],a}var Se=[{id:`overview`,icon:_},{id:`models`,icon:x},{id:`tools`,icon:P},{id:`skills`,icon:T},{id:`advanced`,icon:h},{id:`impact`,icon:f}];function Ce(e){return fe(Object.entries(e?.models?.roles??{}).map(([e,t])=>({id:e,model:t.model,fallbacks:t.fallbacks??[],description:t.description})))}function Y(e){return structuredClone(e?.tools?.builtin??{})}function we(e){let t=e?.skills;if(!t)return new Set;let n=t.mode===`denylist`?t.deny:t.allow;return new Set(n??[])}function Te(){return{primary:``,fallbacks:``,timeoutMs:``,autoProviderFallback:``}}function Ee(e){return{primary:e?.primary??``,fallbacks:e?.fallbacks?.join(`
|
|
2
2
|
`)??``,timeoutMs:e?.timeoutMs?String(e.timeoutMs):``,autoProviderFallback:e?.autoProviderFallback===void 0?``:e.autoProviderFallback?`true`:`false`}}function X(){return{imageModel:Te(),imageGenerationModel:Te(),allowFallbacks:``,maxCostTier:``}}function Z(e){return{imageModel:Ee(e?.models?.imageModel),imageGenerationModel:Ee(e?.models?.imageGenerationModel),allowFallbacks:e?.models?.policy?.allowFallbacks===void 0?``:e.models.policy.allowFallbacks?`true`:`false`,maxCostTier:e?.models?.policy?.maxCostTier??``}}function Q(e){return e===void 0?``:JSON.stringify(e,null,2)}function De(){return{mcp:``,workflows:``,boundaries:``,runtime:``,locks:``}}function Oe(e){return{mcp:Q(e?.tools?.mcp),workflows:Q(e?.workflows),boundaries:Q(e?.boundaries),runtime:Q(e?.runtime),locks:Q(e?.locks)}}function ke(e){return{id:e?.id??``,name:e?.name??``,description:e?.description??``,modelRows:Ce(e),modelAdvanced:Z(e),toolPolicies:Y(e),skillMode:e?.skills?.mode??`inherit`,skillPick:we(e),extendsIds:[...e?.extends??[]],jsonFields:Oe(e)}}function Ae(e){let t=e.primary.trim();if(!t)return;let n=e.fallbacks.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean),r=e.timeoutMs.trim()?Number(e.timeoutMs):void 0,i=e.autoProviderFallback===``?void 0:e.autoProviderFallback===`true`;return{primary:t,...n.length>0?{fallbacks:n}:{},...r?{timeoutMs:r}:{},...i===void 0?{}:{autoProviderFallback:i}}}function je(e,t){let n=z(e.modelRows),r=Ae(e.modelAdvanced.imageModel),i=Ae(e.modelAdvanced.imageGenerationModel),a=e.modelAdvanced.allowFallbacks||e.modelAdvanced.maxCostTier?{...e.modelAdvanced.allowFallbacks?{allowFallbacks:e.modelAdvanced.allowFallbacks===`true`}:{},...e.modelAdvanced.maxCostTier?{maxCostTier:e.modelAdvanced.maxCostTier}:{}}:void 0,o={...t?.models?.defaultRole?{defaultRole:t.models.defaultRole}:{},...n?.roles?{roles:n.roles}:{},...r?{imageModel:r}:{},...i?{imageGenerationModel:i}:{},...a?{policy:a}:{}};return Object.keys(o).length>0?o:null}function Me(e){return e.trim()?JSON.parse(e):void 0}function $(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e))}catch{return`!invalid:${e}`}}function Ne(e){let t=Object.fromEntries(Object.entries(e.toolPolicies).toSorted(([e],[t])=>e.localeCompare(t))),n=Me(e.jsonFields.mcp);return Object.keys(t).length>0||n?{builtin:t,...n?{mcp:n}:{}}:null}function Pe(e){return Object.fromEntries(Object.entries(e??{}).toSorted(([e],[t])=>e.localeCompare(t)))}function Fe(e){if(e.skillMode===`inherit`)return null;let t=[...e.skillPick].toSorted((e,t)=>e.localeCompare(t));return e.skillMode===`allowlist`?{mode:`allowlist`,allow:t}:e.skillMode===`denylist`?{mode:`denylist`,deny:t}:{mode:e.skillMode}}function Ie(e,t){return{id:e.id.trim(),name:e.name.trim(),description:e.description.trim(),models:je(e,t),tools:{builtin:Pe(e.toolPolicies),mcp:$(e.jsonFields.mcp)},skills:Fe(e),extends:[...e.extendsIds].toSorted(),workflows:$(e.jsonFields.workflows),boundaries:$(e.jsonFields.boundaries),runtime:$(e.jsonFields.runtime),locks:$(e.jsonFields.locks)}}function Le(e){return e?{id:e.id,name:e.name,description:e.description??``,models:e.models??null,tools:{builtin:Pe(e.tools?.builtin),mcp:$(Q(e.tools?.mcp))},skills:e.skills??null,extends:[...e.extends??[]].toSorted(),workflows:$(Q(e.workflows)),boundaries:$(Q(e.boundaries)),runtime:$(Q(e.runtime)),locks:$(Q(e.locks))}:null}function Re(e,t){return[e.models?.roles?t.summaryModels.replace(`{{count}}`,String(Object.keys(e.models.roles).length)):``,e.tools?.builtin?t.summaryTools.replace(`{{count}}`,String(Object.keys(e.tools.builtin).length)):``,e.skills?t.summarySkills.replace(`{{mode}}`,t.skillModeLabels[e.skills.mode]):``].filter(Boolean).join(` · `)||t.summaryEmpty}function ze(){return{modelAdvanced:X(),extendsIds:[],jsonFields:De()}}function Be(e,t){return{extends:[...e.extendsIds],models:je(e,t)??void 0,tools:Ne(e)??void 0,skills:Fe(e)??void 0,workflows:Me(e.jsonFields.workflows),boundaries:Me(e.jsonFields.boundaries),runtime:Me(e.jsonFields.runtime),locks:Me(e.jsonFields.locks)}}function Ve(e,t){return e===`safe-coder`?{id:`safe-coder`,name:t.starters[`safe-coder`].title,description:t.starters[`safe-coder`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`code`,model:``,fallbacks:[],description:t.modelRoleDescriptions.code},{id:`review`,model:``,fallbacks:[],description:t.modelRoleDescriptions.review}],toolPolicies:{exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`allowlist`,skillPick:new Set([`diagnose`,`tdd`]),...ze()}:e===`read-only`?{id:`read-only-research`,name:t.starters[`read-only`].title,description:t.starters[`read-only`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast}],toolPolicies:{write_file:{mode:`deny`},apply_patch:{mode:`deny`},exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`all`,skillPick:new Set,...ze()}:e===`low-cost`?{id:`low-cost-assistant`,name:t.starters[`low-cost`].title,description:t.starters[`low-cost`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast},{id:`cheap`,model:``,fallbacks:[],description:t.modelRoleDescriptions.cheap}],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}:{id:``,name:``,description:``,modelRows:[],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}}function He(){let e=o(s(e=>e.language)),t=e.capabilityPresetsSettings,n=!!c(e=>e.token),{data:r,error:m,isLoading:S,mutate:O}=l(n?`settings-capability-presets`:null,ce,{revalidateOnFocus:!1}),{data:F=[],isLoading:se}=l(n?`settings-capability-presets-skills-catalog`:null,C,{revalidateOnFocus:!1}),[le,fe]=i(),[R,z]=(0,B.useState)(``),[V,U]=(0,B.useState)(`overview`),[W,G]=(0,B.useState)(()=>Ve(`blank`,t)),[K,he]=(0,B.useState)(!1),[ge,q]=(0,B.useState)(null),[_e,ve]=(0,B.useState)(null),be=r?.presets??[],xe=r?.defaultPresetId??`default`,J=be.find(e=>e.id===xe)??null,Ce=be.filter(e=>e.id!==xe),Y=(0,B.useMemo)(()=>be.find(e=>e.id===R)??be[0]??null,[be,R]),we=!Y||W.id.trim()!==Y.id,Te=!!(Y&&Y.id===xe),Ee=JSON.stringify(Ie(W,Y))!==JSON.stringify(Le(Y)),X=Ie(W,Y),Z=Le(Y),Q=[X.id!==Z?.id||X.name!==Z?.name||X.description!==Z?.description?t.tabs.overview:``,JSON.stringify(X.models)===JSON.stringify(Z?.models)?``:t.tabs.models,JSON.stringify(X.tools)===JSON.stringify(Z?.tools)?``:t.tabs.tools,JSON.stringify(X.skills)===JSON.stringify(Z?.skills)?``:t.tabs.skills,JSON.stringify({extends:X.extends,workflows:X.workflows,boundaries:X.boundaries,runtime:X.runtime,locks:X.locks})===JSON.stringify({extends:Z?.extends,workflows:Z?.workflows,boundaries:Z?.boundaries,runtime:Z?.runtime,locks:Z?.locks})?``:t.tabs.advanced].filter(Boolean),De=ge??(m instanceof Error?m.message:null),Oe=le.get(`action`)===`new`||!!le.get(`preset`),Ae=we?t.newPreset:Y?.name??t.editorTitle,je=t=>e.agentsSettings.toolsDisableGroups[t],$=t=>t in e.agentsSettings.toolDescriptions?e.agentsSettings.toolDescriptions[t]:``;(0,B.useEffect)(()=>{if(!r||K)return;if(le.get(`action`)===`new`){let e=le.get(`starter`);z(``),G(Ve(e===`safe-coder`||e===`read-only`||e===`low-cost`?e:`blank`,t)),U(`overview`);return}let e=le.get(`preset`)?.trim(),n=e?r.presets.find(t=>t.id===e):null;if(n){z(n.id),G(ke(n)),U(le.get(`tab`)??`overview`);return}Y&&(z(Y.id),G(e=>e.id===Y.id?e:ke(Y)))},[K,r,le,Y]);function Ne(e){z(e.id),G(ke(e)),fe({preset:e.id},{replace:!0}),U(`overview`)}function Pe(e){let n=Ve(e,t);z(``),G(n),q(null),fe(e===`blank`?{action:`new`}:{action:`new`,starter:e},{replace:!0}),U(`overview`)}function Fe(){Ee&&!window.confirm(t.discardConfirm)||(fe({},{replace:!0}),q(null),G(ke(Y)),U(`overview`))}async function ze(){let e=de(W.modelRows,{invalidId:t.invalidModelRoleId,duplicateId:t.duplicateModelRoleId,invalidModel:t.invalidModelRef});if(e){q(e),U(`models`);return}for(let e of[W.modelAdvanced.imageModel,W.modelAdvanced.imageGenerationModel]){if([e.primary,...e.fallbacks.split(/\r?\n|,/)].map(e=>e.trim()).filter(Boolean).some(e=>!/^[^/\s]+\/.+/.test(e))){q(t.invalidModelRef),U(`models`);return}if(e.timeoutMs.trim()&&(!Number.isInteger(Number(e.timeoutMs))||Number(e.timeoutMs)<=0)){q(t.advancedPositiveIntegerError),U(`models`);return}}for(let e of Object.values(W.toolPolicies))if([e.limits?.maxCallsPerTurn,e.limits?.timeoutMs].filter(e=>e!==void 0).some(e=>!Number.isInteger(e)||e<=0)){q(t.advancedPositiveIntegerError),U(`tools`);return}for(let e of Object.keys(W.jsonFields))try{Me(W.jsonFields[e])}catch{q(t.advancedJsonError.replace(`{{field}}`,t.advancedFieldLabels[e])),U(`advanced`);return}he(!0),q(null);try{let e=Be(W,Y);if(we){let t=await ue({id:W.id.trim(),name:W.name.trim(),...W.description.trim()?{description:W.description.trim()}:{},...e});await O(t.presets,{revalidate:!1}),z(t.presetId),fe({preset:t.presetId},{replace:!0})}else Y&&await O(await ae(Y.id,{name:W.name.trim(),description:W.description.trim()||null,extends:e.extends??null,models:e.models??null,tools:e.tools??null,skills:e.skills??null,workflows:e.workflows??null,boundaries:e.boundaries??null,runtime:e.runtime??null,locks:e.locks??null}),{revalidate:!1})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}async function He(){if(Y&&window.confirm(t.deleteConfirm.replace(`{{name}}`,Y.name))){he(!0),q(null);try{let e=await oe(Y.id);await O(e,{revalidate:!1});let t=e.presets[0]??null;z(t?.id??``),G(ke(t)),fe(t?{preset:t.id}:{},{replace:!0})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}}return n?(0,H.jsxs)(ne,{gap:`gap-5`,className:`pb-24`,children:[(0,H.jsx)(te,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(A,{type:`button`,onClick:()=>Pe(`blank`),disabled:K,children:[(0,H.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t.newPreset]})}),De?(0,H.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:De}):null,S?(0,H.jsx)(re,{sections:2}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:k,title:t.newPreset,subtitle:t.editorHint}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[`blank`,`safe-coder`,`read-only`,`low-cost`].map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`min-h-28 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-sm text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Pe(e),children:[(0,H.jsx)(`span`,{className:`font-medium`,children:t.starters[e].title}),(0,H.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-fg-muted`,children:t.starters[e].description})]},e))})]}),J?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:x,title:t.globalDefaultsTitle,subtitle:t.globalDefaultsHint}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(J),className:`group rounded-lg bg-accent/5 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:J.name}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-accent`,children:t.globalDefaultsBadge})]}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-subtle`,children:J.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.globalDefaultsInherited})]}),J.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:J.description}):null,(0,H.jsx)(`div`,{className:`mt-3 text-xs text-fg-subtle`,children:Re(J,t)})]})]}):null,(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:x,title:t.listTitle,subtitle:t.listHint}),Ce.length===0?(0,H.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-4 text-sm text-fg-muted shadow-surface`,children:t.empty}):(0,H.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Ce.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(e),className:`group min-h-36 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-fg-subtle`,children:e.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.usage.length})]}),e.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:e.description}):null,(0,H.jsx)(`div`,{className:`mt-3 truncate text-xs text-fg-subtle`,children:Re(e,t)})]},e.id))})]})]}),(0,H.jsx)(y,{open:Oe,onOpenChange:e=>{e||Fe()},children:(0,H.jsxs)(v,{children:[(0,H.jsx)(g,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,w)}),(0,H.jsx)(u,{ref:ve,className:a(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,760px)] w-[min(100%-2rem,64rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,p),onOpenAutoFocus:e=>e.preventDefault(),children:(0,H.jsxs)(j,{layer:`modal`,portalContainer:_e,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(b,{className:`truncate text-base font-semibold text-fg`,children:Ae}),(0,H.jsx)(E,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:we?t.editorHint:W.id})]}),(0,H.jsx)(D,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:a(N,`shrink-0 p-1.5 hover:bg-surface-base`),"aria-label":t.closeDialog,children:(0,H.jsx)(ee,{className:`size-4`,"aria-hidden":!0})})})]}),De?(0,H.jsx)(`div`,{className:`mx-4 mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:De}):null,(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 border-b border-edge-subtle bg-surface-base px-4 py-2 dark:border-edge`,children:Se.map(({id:e,icon:n})=>(0,H.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>U(e),children:[(0,H.jsx)(n,{className:`size-4`,"aria-hidden":!0}),t.tabs[e]]},e))}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[V===`overview`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:_,title:t.overviewTitle,subtitle:t.overviewHint}),(0,H.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.idLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.id,disabled:K||!we,onChange:e=>G(t=>({...t,id:e.target.value.toLowerCase()})),placeholder:`safe-coder`})]}),!we&&Y?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.versionLabel}),(0,H.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg-muted`,children:t.versionAutomatic.replace(`{{version}}`,String(Y.version))})]}):null,(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.nameLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.name,disabled:K,onChange:e=>G(t=>({...t,name:e.target.value})),placeholder:t.namePlaceholder})]}),(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.descriptionLabel}),(0,H.jsx)(`textarea`,{className:`min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.description,disabled:K,onChange:e=>G(t=>({...t,description:e.target.value})),placeholder:t.descriptionPlaceholder})]})]}),(0,H.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,H.jsx)(Ue,{icon:x,label:t.modelsTitle,value:String(W.modelRows.length)}),(0,H.jsx)(Ue,{icon:P,label:t.toolsTitle,value:String(Object.keys(W.toolPolicies).length)}),(0,H.jsx)(Ue,{icon:T,label:t.skillsTitle,value:t.skillModeLabels[W.skillMode]})]})]}):null,V===`models`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:x,title:t.modelsTitle,subtitle:t.modelsHint}),(0,H.jsx)(ie,{rows:W.modelRows,onChange:e=>G(t=>({...t,modelRows:e})),disabled:K,defaultRole:Y?.models?.defaultRole,chat:e.chat,labels:{id:t.modelRoleIdLabel,description:t.modelRoleDescriptionLabel,primaryModel:t.modelPrimaryModelLabel,fallbackModels:t.modelFallbackModelsLabel,addFallback:t.modelAddFallback,removeFallback:t.modelRemoveFallback,fallbackPlaceholder:t.modelFallbackPlaceholder,fallbackEmptyHint:t.modelFallbackEmptyHint,add:t.addModelRole,remove:t.removeModelRole,recommendedTitle:t.modelRecommendedTitle,customTitle:t.modelCustomTitle,defaultBadge:t.modelDefaultBadge,visionBadge:t.modelVisionBadge,visionAutoHint:t.modelVisionAutoHint,addPurpose:t.addModelPurpose,noCustomRoles:t.noCustomModelRoles,idPlaceholder:`deep`,descriptionPlaceholder:t.modelRoleDescriptionPlaceholder,roleNames:t.modelRoleNames,roleDescriptions:t.modelRoleDescriptions}}),(0,H.jsx)(We,{value:W.modelAdvanced,onChange:e=>G(t=>({...t,modelAdvanced:e})),disabled:K,cp:t})]}):null,V===`tools`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:P,title:t.toolsTitle,subtitle:t.toolsHint}),(0,H.jsx)(ye,{builtinToolIds:r?.builtinToolIds??[],toolPolicies:W.toolPolicies,onChange:e=>G(t=>({...t,toolPolicies:e})),disabled:K,getToolDescription:$,getGroupTitle:je,labels:{quickActionsLabel:t.toolsQuickActionsLabel,quickClearOverrides:t.toolsQuickClearOverrides,quickReadOnlyWorkspace:t.toolsQuickReadOnlyWorkspace,quickHighRiskOff:t.toolsQuickHighRiskOff,quickNoOutbound:t.toolsQuickNoOutbound,quickResearchMode:t.toolsQuickResearchMode,quickCodingMode:t.toolsQuickCodingMode,emptyBuiltin:t.toolsEmptyBuiltin,overrideSummaryTitle:t.toolsOverrideSummaryTitle,noOverrides:t.toolsNoOverrides,inheritedMode:t.toolModes.inherit,modeAllow:t.toolModes.allow,modeConfirm:t.toolModes.confirm,modeDeny:t.toolModes.deny,scopeLabel:t.toolScopeLabel,scopeInherit:t.toolScopeInherit,scopeReadonly:t.toolScopeReadonly,scopeWorkspace:t.toolScopeWorkspace,scopeUnrestricted:t.toolScopeUnrestricted,maxCallsLabel:t.toolMaxCallsLabel,timeoutLabel:t.toolTimeoutLabel}})]}):null,V===`skills`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:T,title:t.skillsTitle,subtitle:t.skillsHint}),(0,H.jsx)(me,{mode:W.skillMode,selected:W.skillPick,catalog:F,loading:se,disabled:K,onModeChange:e=>G(t=>({...t,skillMode:e})),onSelectedChange:e=>G(t=>({...t,skillPick:e})),labels:{modeLabel:t.skillsModeLabel,modeInherit:t.skillsModeInherit,modeAll:t.skillsModeAll,modeAllowlist:t.skillsModeAllowlist,modeDenylist:t.skillsModeDenylist,modeOff:t.skillsModeOff,quickActionsLabel:t.skillsQuickActionsLabel,quickSelectAll:t.skillsQuickSelectAll,quickClear:t.skillsQuickClear,catalogLoading:t.skillsCatalogLoading,emptyCatalog:t.skillsEmptyCatalog,noDescription:t.skillsNoDescription,overrideSummaryTitle:t.skillsOverrideSummaryTitle,inheritSummary:t.skillsInheritSummary,allSummary:t.skillsAllSummary,offSummary:t.skillsOffSummary,allowSummary:t.skillsAllowSummary,denySummary:t.skillsDenySummary}})]}):null,V===`advanced`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:h,title:t.advancedTitle,subtitle:t.advancedHint}),(0,H.jsx)(pe,{extendsIds:W.extendsIds,onExtendsChange:e=>G(t=>({...t,extendsIds:e})),presetOptions:be.filter(e=>e.id!==Y?.id&&e.id!==xe),jsonFields:W.jsonFields,onJsonFieldsChange:e=>G(t=>({...t,jsonFields:e})),disabled:K,labels:{inheritanceTitle:t.advancedInheritanceTitle,inheritanceHint:t.advancedInheritanceHint,inheritanceEmpty:t.advancedInheritanceEmpty,jsonTitle:t.advancedJsonTitle,jsonHint:t.advancedJsonHint,fieldLabels:t.advancedFieldLabels,fieldHints:t.advancedFieldHints}})]}):null,V===`impact`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:f,title:t.usageTitle,subtitle:t.usageHint}),(0,H.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.changePreviewTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Q.length>0?t.changePreviewSections.replace(`{{sections}}`,Q.join(`、`)):t.changePreviewEmpty})]}),Y?.usage.length?(0,H.jsx)(`div`,{className:`grid gap-2`,children:Y.usage.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.agentName||e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-muted`,children:e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,children:e.direct?t.usageDirect:t.usageIndirect})]},e.agentId))}):(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUsage})]}):null]})}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-medium text-fg`,children:Ee?t.unsavedTitle:t.noUnsavedTitle}),(0,H.jsx)(`div`,{className:`text-xs text-fg-muted`,children:Ee?(Y?.usage.length??0)>0?t.unsavedImpact.replace(`{{count}}`,String(Y?.usage.length??0)):t.unsavedNoImpact:t.noUnsavedHint})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ee?(0,H.jsx)(A,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>G(ke(Y)),children:t.discard}):null,Y&&!Te?(0,H.jsxs)(A,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void He(),children:[(0,H.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t.delete]}):null,(0,H.jsxs)(A,{type:`button`,disabled:K||!W.id.trim()||!W.name.trim()||!Ee,onClick:()=>void ze(),children:[(0,H.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.savePreset]})]})]})]})})]})})]}):(0,H.jsxs)(ne,{gap:`gap-3`,children:[(0,H.jsx)(te,{title:t.title}),(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]})}function Ue(e){let t=(0,V.c)(10),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,H.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==a?(o=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[a,r]}),t[2]=r,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,H.jsx)(`div`,{className:`mt-1 text-sm font-medium text-fg`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function We(e){let t=(0,V.c)(77),{value:n,onChange:r,disabled:i,cp:a}=e,o;t[0]!==r||t[1]!==n?(o=(e,t)=>{r({...n,[e]:t})},t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]===a.modelAdvancedTitle?c=t[4]:(c=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:a.modelAdvancedTitle}),t[3]=a.modelAdvancedTitle,t[4]=c);let l;t[5]===a.modelAdvancedHint?l=t[6]:(l=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:a.modelAdvancedHint}),t[5]=a.modelAdvancedHint,t[6]=l);let u;t[7]===s?u=t[8]:(u=e=>s(`imageModel`,e),t[7]=s,t[8]=u);let d;t[9]!==a||t[10]!==i||t[11]!==u||t[12]!==n.imageModel?(d=(0,H.jsx)(Ge,{title:a.imageUnderstandingTitle,value:n.imageModel,onChange:u,disabled:i,cp:a}),t[9]=a,t[10]=i,t[11]=u,t[12]=n.imageModel,t[13]=d):d=t[13];let f;t[14]===s?f=t[15]:(f=e=>s(`imageGenerationModel`,e),t[14]=s,t[15]=f);let p;t[16]!==a||t[17]!==i||t[18]!==f||t[19]!==n.imageGenerationModel?(p=(0,H.jsx)(Ge,{title:a.imageGenerationTitle,value:n.imageGenerationModel,onChange:f,disabled:i,cp:a}),t[16]=a,t[17]=i,t[18]=f,t[19]=n.imageGenerationModel,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[d,p]}),t[21]=d,t[22]=p,t[23]=h):h=t[23];let g;t[24]===a.modelAllowFallbacksLabel?g=t[25]:(g=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelAllowFallbacksLabel}),t[24]=a.modelAllowFallbacksLabel,t[25]=g);let _;t[26]!==r||t[27]!==n?(_=e=>r({...n,allowFallbacks:e.target.value}),t[26]=r,t[27]=n,t[28]=_):_=t[28];let v;t[29]===a.policyInherit?v=t[30]:(v=(0,H.jsx)(m,{value:``,children:a.policyInherit}),t[29]=a.policyInherit,t[30]=v);let y;t[31]===a.policyEnabled?y=t[32]:(y=(0,H.jsx)(m,{value:`true`,children:a.policyEnabled}),t[31]=a.policyEnabled,t[32]=y);let b;t[33]===a.policyDisabled?b=t[34]:(b=(0,H.jsx)(m,{value:`false`,children:a.policyDisabled}),t[33]=a.policyDisabled,t[34]=b);let x;t[35]!==i||t[36]!==v||t[37]!==y||t[38]!==b||t[39]!==_||t[40]!==n.allowFallbacks?(x=(0,H.jsxs)(S,{value:n.allowFallbacks,disabled:i,onChange:_,children:[v,y,b]}),t[35]=i,t[36]=v,t[37]=y,t[38]=b,t[39]=_,t[40]=n.allowFallbacks,t[41]=x):x=t[41];let C;t[42]!==x||t[43]!==g?(C=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[g,x]}),t[42]=x,t[43]=g,t[44]=C):C=t[44];let w;t[45]===a.modelMaxCostTierLabel?w=t[46]:(w=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelMaxCostTierLabel}),t[45]=a.modelMaxCostTierLabel,t[46]=w);let T;t[47]!==r||t[48]!==n?(T=e=>r({...n,maxCostTier:e.target.value}),t[47]=r,t[48]=n,t[49]=T):T=t[49];let E;t[50]===a.policyInherit?E=t[51]:(E=(0,H.jsx)(m,{value:``,children:a.policyInherit}),t[50]=a.policyInherit,t[51]=E);let D;t[52]===a.costTierLow?D=t[53]:(D=(0,H.jsx)(m,{value:`low`,children:a.costTierLow}),t[52]=a.costTierLow,t[53]=D);let O;t[54]===a.costTierMedium?O=t[55]:(O=(0,H.jsx)(m,{value:`medium`,children:a.costTierMedium}),t[54]=a.costTierMedium,t[55]=O);let k;t[56]===a.costTierHigh?k=t[57]:(k=(0,H.jsx)(m,{value:`high`,children:a.costTierHigh}),t[56]=a.costTierHigh,t[57]=k);let A;t[58]!==i||t[59]!==T||t[60]!==E||t[61]!==D||t[62]!==O||t[63]!==k||t[64]!==n.maxCostTier?(A=(0,H.jsxs)(S,{value:n.maxCostTier,disabled:i,onChange:T,children:[E,D,O,k]}),t[58]=i,t[59]=T,t[60]=E,t[61]=D,t[62]=O,t[63]=k,t[64]=n.maxCostTier,t[65]=A):A=t[65];let j;t[66]!==w||t[67]!==A?(j=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,A]}),t[66]=w,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==C||t[70]!==j?(M=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-panel/70 p-3 shadow-surface sm:grid-cols-2`,children:[C,j]}),t[69]=C,t[70]=j,t[71]=M):M=t[71];let N;return t[72]!==c||t[73]!==l||t[74]!==M||t[75]!==h?(N=(0,H.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-5 dark:border-edge`,children:[c,l,h,M]}),t[72]=c,t[73]=l,t[74]=M,t[75]=h,t[76]=N):N=t[76],N}function Ge(e){let t=(0,V.c)(64),{title:n,value:r,onChange:i,disabled:o,cp:s}=e,c;t[0]===n?c=t[1]:(c=(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=c);let l=s.modelToolPrimaryLabel,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`font-mono text-xs`),t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==r?(d=e=>i({...r,primary:e.target.value}),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f;t[6]!==o||t[7]!==d||t[8]!==r.primary?(f=(0,H.jsx)(`input`,{className:u,value:r.primary,disabled:o,placeholder:`provider/model`,onChange:d}),t[6]=o,t[7]=d,t[8]=r.primary,t[9]=f):f=t[9];let p;t[10]!==s.modelToolPrimaryLabel||t[11]!==f?(p=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l,f]}),t[10]=s.modelToolPrimaryLabel,t[11]=f,t[12]=p):p=t[12];let h=s.modelToolFallbacksLabel,g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`min-h-20 resize-y font-mono text-xs`),t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==r?(_=e=>i({...r,fallbacks:e.target.value}),t[14]=i,t[15]=r,t[16]=_):_=t[16];let v;t[17]!==s.modelToolFallbacksPlaceholder||t[18]!==o||t[19]!==_||t[20]!==r.fallbacks?(v=(0,H.jsx)(`textarea`,{className:g,value:r.fallbacks,disabled:o,placeholder:s.modelToolFallbacksPlaceholder,onChange:_}),t[17]=s.modelToolFallbacksPlaceholder,t[18]=o,t[19]=_,t[20]=r.fallbacks,t[21]=v):v=t[21];let y;t[22]!==s.modelToolFallbacksLabel||t[23]!==v?(y=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[h,v]}),t[22]=s.modelToolFallbacksLabel,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==i||t[26]!==r?(b=e=>i({...r,timeoutMs:e.target.value}),t[25]=i,t[26]=r,t[27]=b):b=t[27];let x;t[28]!==o||t[29]!==b||t[30]!==r.timeoutMs?(x=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:r.timeoutMs,disabled:o,onChange:b}),t[28]=o,t[29]=b,t[30]=r.timeoutMs,t[31]=x):x=t[31];let C;t[32]!==s.toolTimeoutLabel||t[33]!==x?(C=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.toolTimeoutLabel,x]}),t[32]=s.toolTimeoutLabel,t[33]=x,t[34]=C):C=t[34];let w;t[35]!==i||t[36]!==r?(w=e=>i({...r,autoProviderFallback:e.target.value}),t[35]=i,t[36]=r,t[37]=w):w=t[37];let T;t[38]===s.policyInherit?T=t[39]:(T=(0,H.jsx)(m,{value:``,children:s.policyInherit}),t[38]=s.policyInherit,t[39]=T);let E;t[40]===s.policyEnabled?E=t[41]:(E=(0,H.jsx)(m,{value:`true`,children:s.policyEnabled}),t[40]=s.policyEnabled,t[41]=E);let D;t[42]===s.policyDisabled?D=t[43]:(D=(0,H.jsx)(m,{value:`false`,children:s.policyDisabled}),t[42]=s.policyDisabled,t[43]=D);let O;t[44]!==o||t[45]!==w||t[46]!==T||t[47]!==E||t[48]!==D||t[49]!==r.autoProviderFallback?(O=(0,H.jsxs)(S,{value:r.autoProviderFallback,disabled:o,onChange:w,children:[T,E,D]}),t[44]=o,t[45]=w,t[46]=T,t[47]=E,t[48]=D,t[49]=r.autoProviderFallback,t[50]=O):O=t[50];let k;t[51]!==s.modelAutoProviderFallbackLabel||t[52]!==O?(k=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.modelAutoProviderFallbackLabel,O]}),t[51]=s.modelAutoProviderFallbackLabel,t[52]=O,t[53]=k):k=t[53];let A;t[54]!==C||t[55]!==k?(A=(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[C,k]}),t[54]=C,t[55]=k,t[56]=A):A=t[56];let j;t[57]!==y||t[58]!==A||t[59]!==p?(j=(0,H.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[p,y,A]}),t[57]=y,t[58]=A,t[59]=p,t[60]=j):j=t[60];let M;return t[61]!==c||t[62]!==j?(M=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 p-3 shadow-surface`,children:[c,j]}),t[61]=c,t[62]=j,t[63]=M):M=t[63],M}export{He as CapabilityPresetsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,i as t}from"./locale-store-
|
|
1
|
+
import{d as e,i as t}from"./locale-store-BP67jtYG.js";function n(e,t){let n=Date.now()-new Date(e).getTime();return n<6e4?t.justNow:n<36e5?t.minutesAgo.replace(`{{count}}`,String(Math.floor(n/6e4))):n<864e5?t.hoursAgo.replace(`{{count}}`,String(Math.floor(n/36e5))):n<6048e5?t.daysAgo.replace(`{{count}}`,String(Math.floor(n/864e5))):new Date(e).toLocaleDateString()}function r(e,t){let r=n(e.lastActive,t);return e.channel===`telegram`&&e.peerId?`${e.accountId??`default`} · ${e.peerKind??``} · ${e.peerId} · ${r}`:`${e.channel}: ${e.chatId} · ${r}`}async function i(){return(await t(e(`/api/channels/status`))).payload?.channels||[]}async function a(n){return(await t(e(`/api/sessions/chat-ids${n?`?channel=${encodeURIComponent(n)}`:``}`))).payload?.chatIds||[]}export{i as n,a as r,r as t};
|
|
@@ -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{l as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./circle-alert-RzVebuX2.js";import{t as c}from"./messages-CQGpD-dC.js";import{d as l,i as u,n as d,o as f,r as p}from"./locale-store-Bp8joZck.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ao as h,Dl as g,Fo as _,Ir as v,Jo as y,Mo as b,No as x,Oo as S,Po as C,Rc as w,Uo as T,Xl as E,Yo as D,Zs as O,ac as k,ai as A,ao as j,eo as M,ii as N,io as P,it as F,jo as I,ko as ee,ks as te,ms as L,oa as R,qo as z,ri as ne,ss as re,uc as ie,vs as ae,zs as oe}from"./index-CxkNzw3e.js";import{n as se,t as ce}from"./settings-page-layout-DaFwstQw.js";import{n as le}from"./settings-loading-skeleton-B79dq-XY.js";import{t as ue}from"./schema-form-Dhv-SmjG.js";import{t as de}from"./browser-BLJWD7WI.js";import{n as fe,t as pe}from"./channels-status-swr-OKlqTtKJ.js";import{t as me}from"./use-channel-catalog-C4PWbNoi.js";var B=n(),he=e(de(),1),V=e(t(),1),H=r();function ge(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}async function _e(e){let t=await p(l(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function U(e){return e?.type===`poll`&&e.phase===`done`}function W(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function G(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function K(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function ve({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,V.useMemo)(()=>ge(e),[e]),s=(0,V.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,V.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,V.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,V.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await _e({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,V.useEffect)(()=>{let t=G(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),he.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,V.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||_e({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:U(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),U(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=W(c.payload),m=G(c.payload,e.id),h=m?c.generatedQr:K(c.payload),_=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),v=c.payload?.type===`form`?c.payload:null,y=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,H.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:o(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,H.jsxs)(L,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,H.jsx)(w,{className:`size-4 animate-spin`}):(0,H.jsx)(ie,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,H.jsxs)(L,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,H.jsx)(oe,{className:`size-4`}),f]}):null]})]}),p?(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,H.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,_?(0,H.jsxs)(`div`,{className:o(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base px-3 py-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,H.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,H.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,H.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,H.jsx)(P,{className:`size-48 rounded-md`})})}),(0,H.jsxs)(`div`,{className:o(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,H.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,H.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,H.jsx)(P,{className:`h-4 w-48 max-w-full`}),(0,H.jsx)(P,{className:`h-4 w-36 max-w-full`})]}),m?(0,H.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,H.jsx)(g,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,H.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,H.jsx)(E,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,H.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,v?(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsx)(ue,{schema:v.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:s}),(0,H.jsx)(L,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(v.submitAction,c.formDraft),children:n.saveSetup})]}):null,y?(0,H.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var q=40;function J(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ye(e,t){return e.find(e=>e.id===J(t))?.agentId?.trim().toLowerCase()??``}function be(e,t,n){let r=J(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:q,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function xe(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Se(e,t,n){let r=xe(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Ce(e,t=!1){return e===`drawer`?o(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,y):o(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,y,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function we(e){let t=(0,B.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,g=p===void 0?!1:p,_=n===`drawer`,[v,y]=(0,V.useState)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,H.jsx)(b,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),t[0]=w):w=t[0];let T;t[1]!==n||t[2]!==g?(T=Ce(n,g),t[1]=n,t[2]=g,t[3]=T):T=t[3];let E;t[4]===c?E=t[5]:(E=c?(0,H.jsx)(C,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=E);let O;t[6]===l?O=t[7]:(O=l?(0,H.jsx)(I,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=O);let k;t[8]!==u||t[9]!==s||t[10]!==m||t[11]!==_||t[12]!==a?(k=_?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,H.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,s?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(L,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,H.jsx)(ae,{className:`size-5`,strokeWidth:1.75})})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:o(re,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,H.jsx)(ae,{className:`size-4`})})}),m]}),t[8]=u,t[9]=s,t[10]=m,t[11]=_,t[12]=a,t[13]=k):k=t[13];let A=_?`px-4 py-4`:`p-6`,j;t[14]===A?j=t[15]:(j=o(`min-h-0 flex-1 overflow-y-auto`,A),t[14]=A,t[15]=j);let M;t[16]!==d||t[17]!==j?(M=(0,H.jsx)(`div`,{className:j,children:d}),t[16]=d,t[17]=j,t[18]=M):M=t[18];let N;t[19]!==f||t[20]!==v||t[21]!==E||t[22]!==O||t[23]!==k||t[24]!==M?(N=(0,H.jsxs)(z,{layer:`modal`,portalContainer:v,children:[E,O,k,M,f]}),t[19]=f,t[20]=v,t[21]=E,t[22]=O,t[23]=k,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==N||t[27]!==T?(P=(0,H.jsxs)(x,{children:[w,(0,H.jsx)(h,{ref:y,className:T,onOpenAutoFocus:Te,children:N})]}),t[26]=N,t[27]=T,t[28]=P):P=t[28];let F;return t[29]!==i||t[30]!==r||t[31]!==P?(F=(0,H.jsx)(S,{open:r,onOpenChange:i,children:P}),t[29]=i,t[30]=r,t[31]=P,t[32]=F):F=t[32],F}function Te(e){return e.preventDefault()}var Ee=(0,V.memo)(function(e){let t=(0,B.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,H.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,H.jsx)(R,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,H.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function De(e){let t=(0,B.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,H.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,H.jsx)(L,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,H.jsx)(L,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,H.jsx)(L,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,H.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,B.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,V.useEffect)(i,a)}function Me(e){return e?l(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await u(l(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`];async function Fe(){let e=await u(l(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Ie(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Le(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function Y(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Re(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function ze(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function Be(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ve(e){if(!e)return[];let t=e.uiHints??{},n=X(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=Y(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!X(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Pe.includes(e))}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Z(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!X(r)||!X(r[n]))break;let o=X(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Z(r[n]),properties:{}}),e===t.length-1){o[n]=Z(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!X(t))return!1;for(let[e,n]of Object.entries(t))X(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Z(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!X(i))break;if(e===t.length-1){delete i[n];break}if(!X(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&X(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!X(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return X(t)?Object.values(t).filter(e=>X(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=Y(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=Y(e),r=ge(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=ge(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=f(e=>e.token),[n,r]=(0,V.useState)(!1),i=(0,V.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(l(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Ie(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,H.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,H.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,H.jsx)(j,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,B.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,s;t[0]===i?s=t[1]:(s=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=s);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=o(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=o(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,H.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==u||t[14]!==p?(m=(0,H.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:s,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=s,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,B.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:s,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=Y(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,b;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),s=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,H.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let x;t[21]===n.label?x=t[22]:(x=(0,H.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=x);let S;t[23]===i?S=t[24]:(S=o(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,Be(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Re(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,H.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==x?(T=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[x,w]}),t[31]=w,t[32]=x,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,H.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(b=(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=b):b=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,H.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),s.length>0?(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:s.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18];let x;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(x=(0,H.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=x):x=t[52];let S=a||s,C;t[53]!==a||t[54]!==s?(C=a||s?(0,H.jsx)(w,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=s,t[55]=C):C=t[55];let T;t[56]!==c||t[57]!==n||t[58]!==s||t[59]!==i?(T=s?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=s,t[59]=i,t[60]=T):T=t[60];let E;t[61]!==m||t[62]!==C||t[63]!==T||t[64]!==S?(E=(0,H.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,H.jsxs)(L,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:S,children:[C,T]})}),t[61]=m,t[62]=C,t[63]=T,t[64]=S,t[65]=E):E=t[65];let D;return t[66]!==E||t[67]!==y||t[68]!==b||t[69]!==x?(D=(0,H.jsxs)(`article`,{className:y,children:[b,x,E]}),t[66]=E,t[67]=y,t[68]=b,t[69]=x,t[70]=D):D=t[70],D}function nt(e){return(0,H.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,H.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,B.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?E:n===`stopped`||n===`needs_setup`?s:w,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=o(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let b;t[6]!==p||t[7]!==y?(b=(0,H.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=b):b=t[8];let x;t[9]===l.connectionStatus?x=t[10]:(x=(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=x);let S;t[11]!==l||t[12]!==n?(S=ze(n,l),t[11]=l,t[12]=n,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S}),t[14]=S,t[15]=C);let T;t[16]!==C||t[17]!==x?(T=(0,H.jsxs)(`div`,{children:[x,C]}),t[16]=C,t[17]=x,t[18]=T):T=t[18];let D;t[19]!==T||t[20]!==b?(D=(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[b,T]}),t[19]=T,t[20]=b,t[21]=D):D=t[21];let O=i||r,A;t[22]===i?A=t[23]:(A=i?(0,H.jsx)(w,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=A);let j=i?l.checkingConnection:l.checkConnection,M;t[24]!==d||t[25]!==O||t[26]!==A||t[27]!==j?(M=(0,H.jsxs)(L,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:O,onClick:d,children:[A,j]}),t[24]=d,t[25]=O,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(N=n===`stopped`?(0,H.jsxs)(L,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,H.jsx)(w,{className:`size-4 animate-spin`}):(0,H.jsx)(k,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=N):N=t[35];let P;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(P=c?(0,H.jsx)(L,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==M||t[45]!==N||t[46]!==P?(F=(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[M,N,P]}),t[44]=M,t[45]=N,t[46]=P,t[47]=F):F=t[47];let I;return t[48]!==D||t[49]!==F?(I=(0,H.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[D,F]})}),t[48]=D,t[49]=F,t[50]=I):I=t[50],I}function at(e){let t=(0,B.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Y(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,H.jsx)(te,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,H.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,H.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,H.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,H.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,H.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,H.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ot(){let e=d(e=>e.language),t=c(e),n=f(e=>!!e.token),r=i(),{channelId:s}=a(),u=A(s),h=me(n,e),y=h.entries,{data:b,mutate:x,isValidating:S}=m(n?pe():null,fe,{revalidateOnFocus:!0}),{data:C,mutate:w}=m(n?`channels-config-map`:null,Fe,{revalidateOnFocus:!1}),E=C?.channels??{},D=C?.bindings??[],{data:k}=m(n?`channel-routing-agents`:null,M,{revalidateOnFocus:!1}),j=_(e=>e.setPageHeader),P=_(e=>e.clearPageHeader),I=(0,V.useMemo)(()=>y.find(e=>e.id===u),[u,y]),ee=I?Le(I):null,{data:te,mutate:L}=m(n&&ee?Me(ee):null,()=>Ne(ee)),[R,z]=(0,V.useState)(null),[re,ie]=(0,V.useState)(!1),[ae,oe]=(0,V.useState)(null),[de,B]=(0,V.useState)(null),[he,_e]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=R??te??{},J=t.channelsSettings,xe=(0,V.useMemo)(()=>I?.configSchema??{type:`object`,properties:{}},[I?.configSchema]),Ce=(0,V.useMemo)(()=>We(xe,Pe),[xe]),Te=(0,V.useMemo)(()=>Ve(I),[I]),Oe=(0,V.useMemo)(()=>He(Ce,Te),[Te,Ce]),Ae=(0,V.useMemo)(()=>We(Ce,Te),[Te,Ce]),Ie=(0,V.useMemo)(()=>Ge(Oe),[Oe]),ze=I?G??ye(D,I.id):``,X=(0,V.useMemo)(()=>(k?.items??[]).map(e=>{let n=v(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[k?.items,t.agentsSettings]),Z=k?.items.find(e=>e.id===k.defaultId),Ue=Z?v(Z,t.agentsSettings):k?.defaultId??``,Ke=(0,V.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),qe=(0,V.useMemo)(()=>new Map((b??[]).map(e=>[e.name,e])),[b]),Je=b!==void 0,Ye=(0,V.useCallback)(e=>Se(e,qe.get(e.id),Je),[qe,Je]),Q=(0,V.useCallback)(async()=>{await Promise.all([h.mutate(),x()])},[h,x]);je((0,V.useCallback)(e=>{let t=ke(e);t&&x(t,!1)},[x]),n);let Xe=(0,V.useMemo)(()=>n?(0,H.jsx)(Ee,{ch:J,refreshing:h.isValidating||S,saveOk:!1,onRefresh:()=>void Q()}):null,[h.isValidating,J,n,S,Q]);(0,V.useLayoutEffect)(()=>(j({startExtra:null,main:(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>P()),[P,Xe,t.settingsSections.channels,j]);let Ze=(0,V.useCallback)(e=>{r(N(e)),z(null),K(null),W(null)},[r]),Qe=(0,V.useCallback)(()=>{r(ne),z(null),K(null),W(null)},[r]),nt=(0,V.useCallback)(async e=>{B(e.id),W(null);try{let t=await p(l(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(null)}},[Q]);(0,V.useEffect)(()=>{K(null),_e(!1)},[I?.id]);let rt=(0,V.useCallback)(async()=>{if(!I||!R&&G===null)return!1;let e=Le(I);ie(!0),W(null);try{let t=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({...R?{channels:{[e]:R}}:{},...G===null?{}:{bindings:be(D,I.id,G)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return R&&await L(R,!1),await w(),await h.mutate(),z(null),K(null),!0}catch(e){return W(e instanceof Error?e.message:String(e)),!1}finally{ie(!1)}},[I,G,D,h,R,w,L]),ot=(0,V.useCallback)(async e=>{let t=Y(e),n=Le(e),r=I?.id===e.id?R:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}oe(e.id),W(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await h.mutate(),await w(),await x(),I?.id===e.id&&(await L(),z(null))}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},[I?.id,h,R,w,L,x,Ze]),$=I?.ui?.modal,st=$?.placement!==`replace-config`,ct=I?Ye(I):`checking`,lt=I?!Y(I).ready||he:!1;return n?(0,H.jsxs)(ce,{gap:`gap-4`,children:[h.isLoading?(0,H.jsx)(le,{sections:2}):h.error?(0,H.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(h.error)}):(0,H.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:y.map(e=>(0,H.jsx)(tt,{entry:e,config:E[Le(e)]?.config,runtime:Ye(e),busy:ae===e.id,restarting:de===e.id,ch:J,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),U?(0,H.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:U}):null,(0,H.jsx)(we,{presentation:`modal`,open:!!I,onOpenChange:e=>{e||Qe()},closeAriaLabel:J.close,srTitle:I?.label??J.selectChannel,srDescription:I?.description,wide:!0,footer:I?(0,H.jsx)(De,{ch:J,dirty:!!R||G!==null,saving:re,onCancel:Qe,onDiscard:()=>{z(null),K(null)},onSave:rt}):null,children:I?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)($e,{entry:I}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:I.label}),(0,H.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Be(ct)),children:Re(ct,J)})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:!Y(I).ready&&ge(I)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,I.label):I.description}),I.docsPath?(0,H.jsxs)(`a`,{href:I.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,H.jsx)(g,{className:`size-3.5`})]}):null]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,H.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:Y(I).enabled?J.enabledLabel:J.disabledLabel}),(0,H.jsx)(et,{checked:Y(I).enabled,disabled:ae===I.id,label:J.toggleChannel.replace(`{{channel}}`,I.label),onToggle:()=>void ot(I)})]})]})}),(0,H.jsx)(it,{runtime:ct,restarting:de===I.id,checking:S,showConnectionOptions:he,canManageConnection:Y(I).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void nt(I),onCheck:()=>void Q(),onManageConnection:()=>_e(e=>!e)}),(0,H.jsx)(at,{entry:I,ch:J}),lt&&$?.placement!==`replace-config`?(0,H.jsx)(ve,{entry:I,locale:e,messages:J,compact:!0,onChanged:async()=>{await L(),await Q(),await w()}},I.id):null,$?.entrypoint&&$.placement===`before-config`?(0,H.jsx)(F,{extensionId:I.extensionId,extensionName:I.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:I.id,entry:I,config:q}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,H.jsx)(F,{extensionId:I.extensionId,extensionName:I.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:I.id,entry:I,config:q}}):null,st&&Ie?(0,H.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,H.jsx)(ue,{schema:Oe,values:q,onChange:e=>z(e),disabled:re,labels:Ke})]}):null,(0,H.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(O,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,H.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,H.jsx)(T,{value:ze,options:X,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Ue||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:re||!k,onChange:e=>K(e)})]})]}),st&&Ge(Ae)?(0,H.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(O,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,H.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,H.jsx)(ue,{schema:Ae,values:q,onChange:e=>z(e),disabled:re,labels:Ke})})]}):null,U?(0,H.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:U}):null]}):null})]}):(0,H.jsxs)(ce,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,H.jsx)(se,{title:t.settingsSections.channels}),(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./circle-alert-RzVebuX2.js";import{t as c}from"./messages-BIsSVgW7.js";import{d as l,i as u,n as d,o as f,r as p}from"./locale-store-BP67jtYG.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ao as h,Dl as g,Fo as _,Ir as v,Jo as y,Mo as b,No as x,Oo as S,Po as C,Rc as w,Uo as T,Xl as E,Yo as D,Zs as O,ac as k,ai as A,ao as j,eo as M,ii as N,io as P,it as F,jo as I,ko as ee,ks as te,ms as L,oa as R,qo as z,ri as ne,ss as re,uc as ie,vs as ae,zs as oe}from"./index-twNrYC3D.js";import{n as se,t as ce}from"./settings-page-layout-BAP5LguT.js";import{n as le}from"./settings-loading-skeleton-DyYMmawg.js";import{t as ue}from"./schema-form-CnsFMun1.js";import{t as de}from"./browser-BLJWD7WI.js";import{n as fe,t as pe}from"./channels-status-swr-P3J5voxb.js";import{t as me}from"./use-channel-catalog-XHelnCa_.js";var B=n(),he=e(de(),1),V=e(t(),1),H=r();function ge(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}async function _e(e){let t=await p(l(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function U(e){return e?.type===`poll`&&e.phase===`done`}function W(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function G(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function K(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function ve({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,V.useMemo)(()=>ge(e),[e]),s=(0,V.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,V.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,V.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,V.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await _e({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,V.useEffect)(()=>{let t=G(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),he.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,V.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||_e({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:U(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),U(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=W(c.payload),m=G(c.payload,e.id),h=m?c.generatedQr:K(c.payload),_=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),v=c.payload?.type===`form`?c.payload:null,y=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,H.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:o(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,H.jsxs)(L,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,H.jsx)(w,{className:`size-4 animate-spin`}):(0,H.jsx)(ie,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,H.jsxs)(L,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,H.jsx)(oe,{className:`size-4`}),f]}):null]})]}),p?(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,H.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,_?(0,H.jsxs)(`div`,{className:o(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base px-3 py-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,H.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,H.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,H.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,H.jsx)(P,{className:`size-48 rounded-md`})})}),(0,H.jsxs)(`div`,{className:o(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,H.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,H.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,H.jsx)(P,{className:`h-4 w-48 max-w-full`}),(0,H.jsx)(P,{className:`h-4 w-36 max-w-full`})]}),m?(0,H.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,H.jsx)(g,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,H.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,H.jsx)(E,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,H.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,v?(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsx)(ue,{schema:v.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:s}),(0,H.jsx)(L,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(v.submitAction,c.formDraft),children:n.saveSetup})]}):null,y?(0,H.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var q=40;function J(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ye(e,t){return e.find(e=>e.id===J(t))?.agentId?.trim().toLowerCase()??``}function be(e,t,n){let r=J(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:q,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function xe(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Se(e,t,n){let r=xe(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Ce(e,t=!1){return e===`drawer`?o(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,y):o(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,y,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function we(e){let t=(0,B.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,g=p===void 0?!1:p,_=n===`drawer`,[v,y]=(0,V.useState)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,H.jsx)(b,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,D)}),t[0]=w):w=t[0];let T;t[1]!==n||t[2]!==g?(T=Ce(n,g),t[1]=n,t[2]=g,t[3]=T):T=t[3];let E;t[4]===c?E=t[5]:(E=c?(0,H.jsx)(C,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=E);let O;t[6]===l?O=t[7]:(O=l?(0,H.jsx)(I,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=O);let k;t[8]!==u||t[9]!==s||t[10]!==m||t[11]!==_||t[12]!==a?(k=_?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,H.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,s?(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(L,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,H.jsx)(ae,{className:`size-5`,strokeWidth:1.75})})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:o(re,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,H.jsx)(ae,{className:`size-4`})})}),m]}),t[8]=u,t[9]=s,t[10]=m,t[11]=_,t[12]=a,t[13]=k):k=t[13];let A=_?`px-4 py-4`:`p-6`,j;t[14]===A?j=t[15]:(j=o(`min-h-0 flex-1 overflow-y-auto`,A),t[14]=A,t[15]=j);let M;t[16]!==d||t[17]!==j?(M=(0,H.jsx)(`div`,{className:j,children:d}),t[16]=d,t[17]=j,t[18]=M):M=t[18];let N;t[19]!==f||t[20]!==v||t[21]!==E||t[22]!==O||t[23]!==k||t[24]!==M?(N=(0,H.jsxs)(z,{layer:`modal`,portalContainer:v,children:[E,O,k,M,f]}),t[19]=f,t[20]=v,t[21]=E,t[22]=O,t[23]=k,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==N||t[27]!==T?(P=(0,H.jsxs)(x,{children:[w,(0,H.jsx)(h,{ref:y,className:T,onOpenAutoFocus:Te,children:N})]}),t[26]=N,t[27]=T,t[28]=P):P=t[28];let F;return t[29]!==i||t[30]!==r||t[31]!==P?(F=(0,H.jsx)(S,{open:r,onOpenChange:i,children:P}),t[29]=i,t[30]=r,t[31]=P,t[32]=F):F=t[32],F}function Te(e){return e.preventDefault()}var Ee=(0,V.memo)(function(e){let t=(0,B.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,H.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,H.jsx)(R,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,H.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function De(e){let t=(0,B.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,H.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,H.jsx)(L,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,H.jsx)(L,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,H.jsx)(L,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,H.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,B.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,V.useEffect)(i,a)}function Me(e){return e?l(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await u(l(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`];async function Fe(){let e=await u(l(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Ie(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Le(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function Y(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Re(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function ze(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function Be(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ve(e){if(!e)return[];let t=e.uiHints??{},n=X(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=Y(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!X(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Pe.includes(e))}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Z(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!X(r)||!X(r[n]))break;let o=X(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Z(r[n]),properties:{}}),e===t.length-1){o[n]=Z(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!X(t))return!1;for(let[e,n]of Object.entries(t))X(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Z(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!X(i))break;if(e===t.length-1){delete i[n];break}if(!X(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&X(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!X(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return X(t)?Object.values(t).filter(e=>X(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=Y(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=Y(e),r=ge(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=ge(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=f(e=>e.token),[n,r]=(0,V.useState)(!1),i=(0,V.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(l(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Ie(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,H.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,H.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,H.jsx)(j,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,B.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,s;t[0]===i?s=t[1]:(s=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=s);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=o(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=o(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,H.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==u||t[14]!==p?(m=(0,H.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:s,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=s,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,B.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:s,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=Y(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,b;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),s=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,H.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let x;t[21]===n.label?x=t[22]:(x=(0,H.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=x);let S;t[23]===i?S=t[24]:(S=o(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,Be(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Re(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,H.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==x?(T=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[x,w]}),t[31]=w,t[32]=x,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,H.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(b=(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=b):b=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,H.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),s.length>0?(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:s.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18];let x;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(x=(0,H.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=x):x=t[52];let S=a||s,C;t[53]!==a||t[54]!==s?(C=a||s?(0,H.jsx)(w,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=s,t[55]=C):C=t[55];let T;t[56]!==c||t[57]!==n||t[58]!==s||t[59]!==i?(T=s?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=s,t[59]=i,t[60]=T):T=t[60];let E;t[61]!==m||t[62]!==C||t[63]!==T||t[64]!==S?(E=(0,H.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,H.jsxs)(L,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:S,children:[C,T]})}),t[61]=m,t[62]=C,t[63]=T,t[64]=S,t[65]=E):E=t[65];let D;return t[66]!==E||t[67]!==y||t[68]!==b||t[69]!==x?(D=(0,H.jsxs)(`article`,{className:y,children:[b,x,E]}),t[66]=E,t[67]=y,t[68]=b,t[69]=x,t[70]=D):D=t[70],D}function nt(e){return(0,H.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,H.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,B.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?E:n===`stopped`||n===`needs_setup`?s:w,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=o(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let b;t[6]!==p||t[7]!==y?(b=(0,H.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=b):b=t[8];let x;t[9]===l.connectionStatus?x=t[10]:(x=(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=x);let S;t[11]!==l||t[12]!==n?(S=ze(n,l),t[11]=l,t[12]=n,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S}),t[14]=S,t[15]=C);let T;t[16]!==C||t[17]!==x?(T=(0,H.jsxs)(`div`,{children:[x,C]}),t[16]=C,t[17]=x,t[18]=T):T=t[18];let D;t[19]!==T||t[20]!==b?(D=(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[b,T]}),t[19]=T,t[20]=b,t[21]=D):D=t[21];let O=i||r,A;t[22]===i?A=t[23]:(A=i?(0,H.jsx)(w,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=A);let j=i?l.checkingConnection:l.checkConnection,M;t[24]!==d||t[25]!==O||t[26]!==A||t[27]!==j?(M=(0,H.jsxs)(L,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:O,onClick:d,children:[A,j]}),t[24]=d,t[25]=O,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(N=n===`stopped`?(0,H.jsxs)(L,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,H.jsx)(w,{className:`size-4 animate-spin`}):(0,H.jsx)(k,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=N):N=t[35];let P;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(P=c?(0,H.jsx)(L,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==M||t[45]!==N||t[46]!==P?(F=(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[M,N,P]}),t[44]=M,t[45]=N,t[46]=P,t[47]=F):F=t[47];let I;return t[48]!==D||t[49]!==F?(I=(0,H.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[D,F]})}),t[48]=D,t[49]=F,t[50]=I):I=t[50],I}function at(e){let t=(0,B.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Y(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,H.jsx)(te,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,H.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,H.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,H.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,H.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,H.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,H.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ot(){let e=d(e=>e.language),t=c(e),n=f(e=>!!e.token),r=i(),{channelId:s}=a(),u=A(s),h=me(n,e),y=h.entries,{data:b,mutate:x,isValidating:S}=m(n?pe():null,fe,{revalidateOnFocus:!0}),{data:C,mutate:w}=m(n?`channels-config-map`:null,Fe,{revalidateOnFocus:!1}),E=C?.channels??{},D=C?.bindings??[],{data:k}=m(n?`channel-routing-agents`:null,M,{revalidateOnFocus:!1}),j=_(e=>e.setPageHeader),P=_(e=>e.clearPageHeader),I=(0,V.useMemo)(()=>y.find(e=>e.id===u),[u,y]),ee=I?Le(I):null,{data:te,mutate:L}=m(n&&ee?Me(ee):null,()=>Ne(ee)),[R,z]=(0,V.useState)(null),[re,ie]=(0,V.useState)(!1),[ae,oe]=(0,V.useState)(null),[de,B]=(0,V.useState)(null),[he,_e]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=R??te??{},J=t.channelsSettings,xe=(0,V.useMemo)(()=>I?.configSchema??{type:`object`,properties:{}},[I?.configSchema]),Ce=(0,V.useMemo)(()=>We(xe,Pe),[xe]),Te=(0,V.useMemo)(()=>Ve(I),[I]),Oe=(0,V.useMemo)(()=>He(Ce,Te),[Te,Ce]),Ae=(0,V.useMemo)(()=>We(Ce,Te),[Te,Ce]),Ie=(0,V.useMemo)(()=>Ge(Oe),[Oe]),ze=I?G??ye(D,I.id):``,X=(0,V.useMemo)(()=>(k?.items??[]).map(e=>{let n=v(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[k?.items,t.agentsSettings]),Z=k?.items.find(e=>e.id===k.defaultId),Ue=Z?v(Z,t.agentsSettings):k?.defaultId??``,Ke=(0,V.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),qe=(0,V.useMemo)(()=>new Map((b??[]).map(e=>[e.name,e])),[b]),Je=b!==void 0,Ye=(0,V.useCallback)(e=>Se(e,qe.get(e.id),Je),[qe,Je]),Q=(0,V.useCallback)(async()=>{await Promise.all([h.mutate(),x()])},[h,x]);je((0,V.useCallback)(e=>{let t=ke(e);t&&x(t,!1)},[x]),n);let Xe=(0,V.useMemo)(()=>n?(0,H.jsx)(Ee,{ch:J,refreshing:h.isValidating||S,saveOk:!1,onRefresh:()=>void Q()}):null,[h.isValidating,J,n,S,Q]);(0,V.useLayoutEffect)(()=>(j({startExtra:null,main:(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>P()),[P,Xe,t.settingsSections.channels,j]);let Ze=(0,V.useCallback)(e=>{r(N(e)),z(null),K(null),W(null)},[r]),Qe=(0,V.useCallback)(()=>{r(ne),z(null),K(null),W(null)},[r]),nt=(0,V.useCallback)(async e=>{B(e.id),W(null);try{let t=await p(l(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(null)}},[Q]);(0,V.useEffect)(()=>{K(null),_e(!1)},[I?.id]);let rt=(0,V.useCallback)(async()=>{if(!I||!R&&G===null)return!1;let e=Le(I);ie(!0),W(null);try{let t=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({...R?{channels:{[e]:R}}:{},...G===null?{}:{bindings:be(D,I.id,G)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return R&&await L(R,!1),await w(),await h.mutate(),z(null),K(null),!0}catch(e){return W(e instanceof Error?e.message:String(e)),!1}finally{ie(!1)}},[I,G,D,h,R,w,L]),ot=(0,V.useCallback)(async e=>{let t=Y(e),n=Le(e),r=I?.id===e.id?R:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}oe(e.id),W(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await h.mutate(),await w(),await x(),I?.id===e.id&&(await L(),z(null))}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},[I?.id,h,R,w,L,x,Ze]),$=I?.ui?.modal,st=$?.placement!==`replace-config`,ct=I?Ye(I):`checking`,lt=I?!Y(I).ready||he:!1;return n?(0,H.jsxs)(ce,{gap:`gap-4`,children:[h.isLoading?(0,H.jsx)(le,{sections:2}):h.error?(0,H.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(h.error)}):(0,H.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:y.map(e=>(0,H.jsx)(tt,{entry:e,config:E[Le(e)]?.config,runtime:Ye(e),busy:ae===e.id,restarting:de===e.id,ch:J,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),U?(0,H.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:U}):null,(0,H.jsx)(we,{presentation:`modal`,open:!!I,onOpenChange:e=>{e||Qe()},closeAriaLabel:J.close,srTitle:I?.label??J.selectChannel,srDescription:I?.description,wide:!0,footer:I?(0,H.jsx)(De,{ch:J,dirty:!!R||G!==null,saving:re,onCancel:Qe,onDiscard:()=>{z(null),K(null)},onSave:rt}):null,children:I?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)($e,{entry:I}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:I.label}),(0,H.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Be(ct)),children:Re(ct,J)})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:!Y(I).ready&&ge(I)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,I.label):I.description}),I.docsPath?(0,H.jsxs)(`a`,{href:I.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,H.jsx)(g,{className:`size-3.5`})]}):null]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,H.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:Y(I).enabled?J.enabledLabel:J.disabledLabel}),(0,H.jsx)(et,{checked:Y(I).enabled,disabled:ae===I.id,label:J.toggleChannel.replace(`{{channel}}`,I.label),onToggle:()=>void ot(I)})]})]})}),(0,H.jsx)(it,{runtime:ct,restarting:de===I.id,checking:S,showConnectionOptions:he,canManageConnection:Y(I).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void nt(I),onCheck:()=>void Q(),onManageConnection:()=>_e(e=>!e)}),(0,H.jsx)(at,{entry:I,ch:J}),lt&&$?.placement!==`replace-config`?(0,H.jsx)(ve,{entry:I,locale:e,messages:J,compact:!0,onChanged:async()=>{await L(),await Q(),await w()}},I.id):null,$?.entrypoint&&$.placement===`before-config`?(0,H.jsx)(F,{extensionId:I.extensionId,extensionName:I.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:I.id,entry:I,config:q}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,H.jsx)(F,{extensionId:I.extensionId,extensionName:I.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:I.id,entry:I,config:q}}):null,st&&Ie?(0,H.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,H.jsx)(ue,{schema:Oe,values:q,onChange:e=>z(e),disabled:re,labels:Ke})]}):null,(0,H.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(O,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,H.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,H.jsx)(T,{value:ze,options:X,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Ue||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:re||!k,onChange:e=>K(e)})]})]}),st&&Ge(Ae)?(0,H.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(O,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,H.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,H.jsx)(ue,{schema:Ae,values:q,onChange:e=>z(e),disabled:re,labels:Ke})})]}):null,U?(0,H.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:U}):null]}):null})]}):(0,H.jsxs)(ce,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,H.jsx)(se,{title:t.settingsSections.channels}),(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e}from"./locale-store-BP67jtYG.js";import{n as t}from"./channel-recipient-api-DrbkoYyF.js";function n(){return e(`/api/channels/status`)}var r=t;export{r as n,n as t};
|
package/dist/gateway/static/root/assets/{connector-logo-DIMP4NWY.js → connector-logo-CiHea96v.js}
RENAMED
|
@@ -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{t as i}from"./cn-BQ_8x0bT.js";import{Ec as a}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{Ec as a}from"./index-twNrYC3D.js";var o=n(),s=e(t(),1),c=r(),l={sm:{frame:`size-9 rounded-lg`,image:`size-6`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-7`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-8`,fallback:`size-5`}};function u(e){let t=(0,o.c)(18),{connector:n,size:r,className:u}=e,d=r===void 0?`md`:r,f=n?.branding?.logoUrl,[p,m]=(0,s.useState)(!1),h=l[d],g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{m(!1)},t[0]=g):g=t[0];let _;t[1]===f?_=t[2]:(_=[f],t[1]=f,t[2]=_),(0,s.useEffect)(g,_);let v;t[3]!==u||t[4]!==h.frame?(v=i(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-surface-base`,h.frame,u),t[3]=u,t[4]=h.frame,t[5]=v):v=t[5];let y;t[6]===n?y=t[7]:(y=n?.branding?.backgroundColor?{backgroundColor:n.branding.backgroundColor}:void 0,t[6]=n,t[7]=y);let b=n?.displayName,x;t[8]!==h.fallback||t[9]!==h.image||t[10]!==p||t[11]!==f?(x=f&&!p?(0,c.jsx)(`img`,{src:f,alt:``,loading:`lazy`,draggable:!1,className:i(`object-contain`,h.image),onError:()=>m(!0)}):(0,c.jsx)(a,{className:i(`text-fg-muted`,h.fallback),"aria-hidden":!0}),t[8]=h.fallback,t[9]=h.image,t[10]=p,t[11]=f,t[12]=x):x=t[12];let S;return t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==x?(S=(0,c.jsx)(`span`,{className:v,style:y,title:b,children:x}),t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S):S=t[17],S}export{u as t};
|