@xopcai/xopc 0.0.265 → 0.0.266
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/{agent-avatar-dicebear-DRTTU2H3.js → agent-avatar-dicebear-Qrp5ALCF.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BsXF7LVi.js → agent-defaults-settings-panel-DwinST48.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DpjWfxYx.js → agents-Dlr0YyNt.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-33Mc81h2.js → app-management-settings-panel-bLNvz93c.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C8JECSiJ.js → appearance-settings-D5qgIepF.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-t64FcxIZ.js → apps-page-BQVlXhIb.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-PzZ6SzfY.js → archive-plugin-BEA7VAA4.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-OhLL6K__.js → attachment-load-B1RyF3uu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BpAYwuvx.js → automations-page-BfH0FdKa.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-B6aTT5IC.js → automations-workspace-C37AlD3E.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-B5XpGsHg.js → binary-plugins-EU884ZXi.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BgEhoTnN.js → block-editor-Bjr3naHb.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CBLunDRH.js → browser-automations-page-CDrYrNGy.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CSfpPCuD.js → browser-settings-page-DOmUkj2k.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DftNnICK.js → capabilities-settings-panel-slt1o04n.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-CpuWa5qu.js → channels-settings-oHTTX6Jy.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-mnPsS_GJ.js → chat-terminal-dock-DEYQdv6n.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-D3nHGnNV.js → connectors-page-olrbxHIT.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-NcGBvIfe.js → cron-expression-DFrbDWpP.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BrVcl7H5.js → date-picker-CYriYKpH.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker--edd48Y9.js → dependency-picker-XY3qUErs.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-vuyyb6I6.js → desktop-pet-Dsc__ynA.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DWredJwO.js → desktop-pet-settings-EpuX3C08.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CtBW4ebj.js → extension-debug-page-B_NeLV4K.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsUrmtW7.js → extension-page-D3JC6mLB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BUd31AuK.js → extension-settings-page-CXTQt1lp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-C6FQv7op.js → gateway-settings-yeYm_UPE.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CDo1Gjp2.js → heartbeat-settings-coh1LFsg.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-D3_uvVJY.js → home-page-CAgoBZqp.js} +1 -1
- package/dist/gateway/static/root/assets/{index-Dpu7EKTm.js → index-Cn__9Un2.js} +8 -8
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CNVmrCrV.js → keyboard-shortcuts-settings-Cu1bI3Bg.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B0IVDvs-.js → local-app-workbench-page-C9s2lFaI.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DvkarvLt.js → local-apps-page-CJ03Umjr.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BknY0vZf.js → logs-page-CY_DQKJ2.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DW6hJINQ.js → management-settings-YPEemeMo.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DYautOWY.js → media-plugins-BjT6jlrA.js} +1 -1
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-Dgu03cv-.js → mobile-pairing-wizard-A8eLtV6v.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Cv9uH6Jq.js → note-detail-panel-DHT2QksJ.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-DcIAiYJn.js → notes-page-BRFQiivM.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-DF6Q5XvA.js → page-tabs-DNUwulnl.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CQJH_jAN.js → preview-open-alternatives-B33KsKkJ.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-D65JfNSw.js → project-detail-page-CItEFVt9.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BfWF7Sz-.js → projects-page-Bmy-c_lL.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DA1g4CUD.js → remote-access-hub-H6B1cA2V.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-0-bFSBB8.js → runtime-tools-settings-panel-BsCovC39.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-csGbhTUr.js → schema-form-NsPb_Vam.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DXPBNhrZ.js → sessions-page-CyYLSXk_.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-3T4rPk4A.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-YdrdY8B3.js → settings-form-section-BzPIPe1-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Cv9waRn3.js → settings-page-4idpMhsw.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DPf-_05Z.js → setup-status-panel-D2ds_TTD.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DBoEHTPn.js → share-preview-page-Djo3VTaC.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BQP5yNcO.js → shares-settings-fhRzNfRp.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-B5T8cgjq.js → skill-reload-api-Ct8tUju_.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-D1G8h2Lt.js → skills-page-riM7FytZ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BNZYTop7.js → skills-page.utils-B3G8LBb-.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-ByuppbHi.js → system-settings-panel-CW91jjnB.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DNmkrF6y.js → task-detail-page-BBXKvl0k.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CxWGpbwr.js → tunnel-api-DILER0Yb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-B0l4qubU.js → use-autosave-GxnP8vLO.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-DMsI6YI7.js → user-model-page-I1H4XRfA.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bcz7boJg.js → voice-api-key-field-CI3sXyl4.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Dujq1j_u.js → work-discovery-overlay-DZC9Exn3.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CxNYbLNB.js → workflow-run-setup-panel-CaBaQER2.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Dk1jK2nv.js → workflows-page-C-_Dxihw.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +10 -10
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxeZm67O.js +0 -1
|
@@ -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"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./popover-select-CKBYnT3c.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{n as c,s as l}from"./locale-store-DFQX9kTl.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-B11EPpor.js";import{r as p}from"./gateway-config-swr-OObCK8jM.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-CsZLatKo.js";import{$t as _,El as v,Eu as y,Ou as b,Qt as x,Sc as S,Vc as C,ei as w,ic as T,nc as E,nl as D,on as O,pc as ee,sc as k,y as te}from"./index-Dpu7EKTm.js";import{n as A,r as j}from"./settings-page-layout-DYelDcMV.js";import{n as M,t as ne}from"./use-autosave-B0l4qubU.js";import{u as N}from"./voice-config-api-DpJEu2RQ.js";import{r as re}from"./image-generation-api-fPU9yGsw.js";var P=e(t(),1),ie=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,ie.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function B(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:N(s);let e=u?L(u.stt.providers,u.stt.provider,`model`):void 0,n=u?L(u.tts.providers,u.tts.provider,`model`):void 0,r=u?L(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[R(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[R(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let x;t[8]!==g||t[9]!==v?(x=(0,F.jsxs)(`div`,{children:[g,v]}),t[8]=g,t[9]=v,t[10]=x):x=t[10];let S=n?`管理语音设置`:`Manage voice settings`,w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[11]=w):w=t[11];let T;t[12]===S?T=t[13]:(T=(0,F.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[S,w]})}),t[12]=S,t[13]=T);let E;t[14]!==x||t[15]!==T?(E=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[x,T]}),t[14]=x,t[15]=T,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(D=o||!u?a?(0,F.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(m,{className:`h-20 rounded-xl`}),(0,F.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:C,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(z,{icon:y,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=D):D=t[23];let O;return t[24]!==E||t[25]!==D?(O=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26],O}var V=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,U={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function W(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function ae(e){let t=(0,ie.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,F.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,F.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,F.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,F.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,F.jsx)(s,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let C;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(C=(0,F.jsx)(w,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=C):C=t[30];let T;return t[31]!==C||t[32]!==g||t[33]!==_?(T=(0,F.jsxs)(`div`,{children:[g,_,C]}),t[31]=C,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function G(e){let t=(0,ie.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,re,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(K),t[6]=p,t[7]=m);let _=m,v=i?U.zh:U.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=W(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let C=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===C?T=t[14]:(T=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[13]=C,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,F.jsxs)(`div`,{children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let D=i?`主模型`:`Primary model`,O;t[18]===D?O=t[19]:(O=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=O);let ee=i?`选择模型`:`Select a model`,k=i?`搜索模型或服务商`:`Search models or providers`,te=i?`没有匹配的模型`:`No matching models`,A=i?`默认对话模型`:`Default conversation model`,j;t[20]!==n||t[21]!==r?(j=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=j):j=t[22];let M;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==k||t[26]!==te||t[27]!==A||t[28]!==j?(M=(0,F.jsx)(w,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:k,noMatches:te,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:A,onChange:j}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=k,t[26]=te,t[27]=A,t[28]=j,t[29]=M):M=t[29];let ne;t[30]!==O||t[31]!==M?(ne=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[O,M]}),t[30]=O,t[31]=M,t[32]=ne):ne=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,F.jsx)(ae,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==E||t[45]!==ne||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,ne,P]}),t[44]=E,t[45]=ne,t[46]=P,t[47]=I):I=t[47];let L=i?`图片能力`:`Image capabilities`,R;t[48]===L?R=t[49]:(R=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:L}),t[48]=L,t[49]=R);let z=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===z?G=t[51]:(G=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:z}),t[50]=z,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=W(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,F.jsx)(w,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,F.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,F.jsx)(w,{value:pe,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let xe;t[84]!==fe||t[85]!==be?(xe=(0,F.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=xe):xe=t[86];let $;t[87]!==ue||t[88]!==xe?($=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,xe]}),t[87]=ue,t[88]=xe,t[89]=$):$=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(f,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==R||t[95]!==G||t[96]!==$||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[R,G,$,Se]}),t[94]=R,t[95]=G,t[96]=$,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(B,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=V.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,F.jsx)(w,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,ie.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,te,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(X),t[3]=c,t[4]=l);let p=l,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,F.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,ee=i?`系统默认`:`System default`,k;t[22]!==n||t[23]!==r?(k=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==O||t[26]!==ee||t[27]!==k?(A=(0,F.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:ee,onChange:k,className:`${q} mt-2`}),t[25]=O,t[26]=ee,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==D||t[30]!==A?(j=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,A]}),t[29]=D,t[30]=A,t[31]=j):j=t[31];let M=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,ne=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==ne||t[36]!==N||t[37]!==re?(P=(0,F.jsx)(`input`,{type:`number`,min:1,value:ne,placeholder:N,onChange:re,className:`${q} mt-2`}),t[35]=ne,t[36]=N,t[37]=re,t[38]=P):P=t[38];let I;t[39]!==M||t[40]!==P?(I=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[M,P]}),t[39]=M,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==E||t[43]!==j||t[44]!==I?(L=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,j,I]}),t[42]=E,t[43]=j,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==L||t[47]!==v||t[48]!==b?(R=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,L]}),t[46]=L,t[47]=v,t[48]=b,t[49]=R):R=t[49];let z=i?`提示词缓存`:`Prompt cache`,B;t[50]===z?B=t[51]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,F.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let K;t[61]!==W||t[62]!==G?(K=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==B||t[72]!==H||t[73]!==Z?(Q=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[B,H,Z]}),t[71]=B,t[72]=H,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==p||t[90]!==s.isLoading?(_e=(0,F.jsx)(a,{value:fe,options:p,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=p,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,xe;t[97]===be?xe=t[98]:(xe=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=xe);let $;t[99]!==n||t[100]!==r?($=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=$):$=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=u(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==$||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:$,className:Ce,children:[Te,De]}),t[108]=$,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=u(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,F.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==xe||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[xe,Le,Re]}),t[137]=xe,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==se||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[se,le,ve,ye,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Q||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[R,Q,Be]}),t[147]=R,t[148]=Q,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}function Q(e){let t=(0,ie.c)(99),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:c,isLoading:l}=d(`agent-defaults-skills-catalog`,O,a),[f,p]=(0,P.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(ce));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(se),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let b=y,x;t[12]===s?.catalog?x=t[13]:(x=s?.catalog??[],t[12]=s?.catalog,t[13]=x);let S;if(t[14]!==v||t[15]!==x){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=x.filter(e),t[14]=v,t[15]=x,t[16]=S}else S=t[16];let C=S.length,w=i?`技能策略`:`Skill policy`,T;t[19]===w?T=t[20]:(T=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:w}),t[19]=w,t[20]=T);let E=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[21]===E?k=t[22]:(k=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:E}),t[21]=E,t[22]=k);let te;t[23]!==n||t[24]!==r?(te=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=te):te=t[25];let A=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,j;t[26]===A?j=t[27]:(j=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,A),t[26]=A,t[27]=j);let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=M):M=t[28];let ne=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[29]===ne?N=t[30]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ne}),t[29]=ne,t[30]=N);let re=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,I;t[31]===re?I=t[32]:(I=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:re}),t[31]=re,t[32]=I);let L;t[33]!==N||t[34]!==I?(L=(0,F.jsxs)(`span`,{children:[N,I]}),t[33]=N,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==te||t[37]!==j||t[38]!==L?(R=(0,F.jsxs)(`button`,{type:`button`,onClick:te,className:j,children:[M,L]}),t[36]=te,t[37]=j,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==n||t[41]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=z):z=t[42];let B=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,V;t[43]===B?V=t[44]:(V=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,B),t[43]=B,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,F.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=H):H=t[45];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[46]===U?W=t[47]:(W=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[46]=U,t[47]=W);let ae=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,G;t[48]===ae?G=t[49]:(G=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ae}),t[48]=ae,t[49]=G);let K;t[50]!==W||t[51]!==G?(K=(0,F.jsxs)(`span`,{children:[W,G]}),t[50]=W,t[51]=G,t[52]=K):K=t[52];let q;t[53]!==z||t[54]!==V||t[55]!==K?(q=(0,F.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,K]}),t[53]=z,t[54]=V,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==R||t[58]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,q]}),t[57]=R,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==k||t[61]!==J||t[62]!==T?(Y=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[T,k,J]}),t[60]=k,t[61]=J,t[62]=T,t[63]=Y):Y=t[63];let X=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Q;t[64]===X?Q=t[65]:(Q=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:X}),t[64]=X,t[65]=Q);let le=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,ue;t[66]===le?ue=t[67]:(ue=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[66]=le,t[67]=ue);let de;t[68]!==Q||t[69]!==ue?(de=(0,F.jsxs)(`div`,{children:[Q,ue]}),t[68]=Q,t[69]=ue,t[70]=de):de=t[70];let fe=i?`搜索技能`:`Search skills`,pe;t[71]===fe?pe=t[72]:(pe=(0,F.jsx)(`span`,{className:`sr-only`,children:fe}),t[71]=fe,t[72]=pe);let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=me):me=t[73];let he;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>p(e.target.value),t[74]=he):he=t[74];let ge=i?`搜索技能`:`Search skills`,_e;t[75]!==f||t[76]!==ge?(_e=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:he,placeholder:ge,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[75]=f,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]!==pe||t[79]!==_e?(ve=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[pe,me,_e]}),t[78]=pe,t[79]=_e,t[80]=ve):ve=t[80];let ye;t[81]!==de||t[82]!==ve?(ye=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[de,ve]}),t[81]=de,t[82]=ve,t[83]=ye):ye=t[83];let be;t[84]===c?be=t[85]:(be=c?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[84]=c,t[85]=be);let xe;t[86]!==v||t[87]!==l||t[88]!==g||t[89]!==b||t[90]!==i?(xe=l?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(oe)}):(0,F.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,F.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=l,t[88]=g,t[89]=b,t[90]=i,t[91]=xe):xe=t[91];let $;t[92]!==ye||t[93]!==be||t[94]!==xe?($=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[ye,be,xe]}),t[92]=ye,t[93]=be,t[94]=xe,t[95]=$):$=t[95];let Se;return t[96]!==Y||t[97]!==$?(Se=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[Y,$]}),t[96]=Y,t[97]=$,t[98]=Se):Se=t[98],Se}function oe(e){return(0,F.jsx)(m,{className:`h-14 rounded-xl`},e)}function se(e,t){return e.name.localeCompare(t.name)}function ce(e){return e.name}function le(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ue(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(`all`),[d,p]=(0,P.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(fe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(de),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,b;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),b=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,S;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),S=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==v.length||t[21]!==b.length||t[22]!==S.length?(C={allow:y,ask:x,deny:S.length},t[20]=v.length,t[21]=b.length,t[22]=S.length,t[23]=C):C=t[23];let w=C,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==c||t[28]!==o){let e=o.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(c===`all`||r===c)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=c,t[28]=o,t[29]=E}else E=t[29];let D=E,O;t[30]!==n||t[31]!==r?(O=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=O):O=t[32];let k=O,te=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===te?A=t[34]:(A={id:`all`,label:te},t[33]=te,t[34]=A);let j=a?`允许 ${w.allow}`:`Allow ${w.allow}`,M;t[35]===j?M=t[36]:(M={id:`allow`,label:j},t[35]=j,t[36]=M);let ne=a?`询问 ${w.ask}`:`Ask ${w.ask}`,N;t[37]===ne?N=t[38]:(N={id:`ask`,label:ne},t[37]=ne,t[38]=N);let re=a?`禁用 ${w.deny}`:`Deny ${w.deny}`,I;t[39]===re?I=t[40]:(I={id:`deny`,label:re},t[39]=re,t[40]=I);let L;t[41]!==A||t[42]!==M||t[43]!==N||t[44]!==I?(L=[A,M,N,I],t[41]=A,t[42]=M,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,F.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==c||t[54]!==R?(W=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,c===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=c,t[54]=R,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,F.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,F.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==W||t[67]!==X?(Z=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,X]}),t[66]=W,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==k||t[73]!==D||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==k||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>k(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,F.jsx)(T,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>k(e,{maxCallsPerTurn:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>k(e,{timeoutMs:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=h,t[77]=n.tools,t[78]=d,t[79]=k,t[80]=a,t[81]=e):e=t[81],Q=D.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=k,t[73]=D,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==D.length||t[83]!==a?(oe=D.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,F.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==U||t[89]!==Z||t[90]!==se?(ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[U,Z,se]}),t[88]=U,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function de(e){return e.id}function fe(e){return[e.id,e.description]}function pe(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(m,{className:`h-7 w-56`}),(0,F.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(m,{className:`h-9 w-28`})]}),(0,F.jsx)(m,{className:`h-20 rounded-2xl`}),(0,F.jsx)(m,{className:`h-12 rounded-xl`}),(0,F.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,ie.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,P.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,l]=(0,P.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,P.useState)(d),h;t[4]===c?h=t[5]:(h=JSON.stringify(c),t[4]=c,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let y=h!==g,b=i?`模型`:`Models`,x;t[8]===b?x=t[9]:(x={id:`models`,label:b,icon:E},t[8]=b,t[9]=x);let C=i?`技能`:`Skills`,w;t[10]===C?w=t[11]:(w={id:`skills`,label:C,icon:S},t[10]=C,t[11]=w);let T=i?`工具`:`Tools`,D;t[12]===T?D=t[13]:(D={id:`tools`,label:T,icon:k},t[12]=T,t[13]=D);let O=i?`运行`:`Runtime`,ee;t[14]===O?ee=t[15]:(ee={id:`runtime`,label:O,icon:v},t[14]=O,t[15]=ee);let te;t[16]!==D||t[17]!==ee||t[18]!==x||t[19]!==w?(te=[x,w,D,ee],t[16]=D,t[17]=ee,t[18]=x,t[19]=w,t[20]=te):te=t[20];let N=te,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await _(t),r=structuredClone(n.defaults);l(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let I=re,L;t[22]!==y||t[23]!==c?(L={value:c,dirty:y,onSave:I,delayMs:0},t[22]=y,t[23]=c,t[24]=L):L=t[24];let R=ne(L),z=R.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==R.error||t[26]!==R.status?(V=(0,F.jsx)(M,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,F.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(U=R.error?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,F.jsx)(`span`,{children:R.error}),(0,F.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:R.retry,children:i?`重试`:`Retry`})]}):null,t[31]=R.error,t[32]=R.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==N?(ae=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,a===t?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:u(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=N,t[37]=ae):ae=t[37];let K;t[38]!==W||t[39]!==ae?(K=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=K):K=t[40];let q;t[41]!==a||t[42]!==c||t[43]!==i?(q=a===`models`?(0,F.jsx)(G,{draft:c,setDraft:l,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==c||t[47]!==i?(J=a===`skills`?(0,F.jsx)(Q,{draft:c,setDraft:l,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(X=a===`tools`?(0,F.jsx)(ue,{draft:c,setDraft:l,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==c||t[56]!==i?(Z=a===`runtime`?(0,F.jsx)(Y,{draft:c,setDraft:l,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=Z):Z=t[57];let oe;return t[58]!==R.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(oe=(0,F.jsxs)(j,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,X,Z]}),t[58]=R.onBlurCapture,t[59]=H,t[60]=U,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=oe):oe=t[66],oe}function he(){let e=(0,ie.c)(17),t=l(_e),n=c(ge)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,x);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(j,{children:(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,F.jsx)(f,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,F.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(pe,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(me,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function ge(e){return e.language}function _e(e){return e.token}export{he as AgentDefaultsSettingsPanel};
|
|
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"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./popover-select-CKBYnT3c.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{n as c,s as l}from"./locale-store-DFQX9kTl.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-B11EPpor.js";import{r as p}from"./gateway-config-swr-OObCK8jM.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-CsZLatKo.js";import{$t as _,El as v,Eu as y,Ou as b,Qt as x,Sc as S,Vc as C,ei as w,ic as T,nc as E,nl as D,on as O,pc as ee,sc as k,y as te}from"./index-Cn__9Un2.js";import{n as A,r as j}from"./settings-page-layout-DYelDcMV.js";import{n as M,t as ne}from"./use-autosave-GxnP8vLO.js";import{u as N}from"./voice-config-api-DpJEu2RQ.js";import{r as re}from"./image-generation-api-fPU9yGsw.js";var P=e(t(),1),ie=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,ie.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function B(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:N(s);let e=u?L(u.stt.providers,u.stt.provider,`model`):void 0,n=u?L(u.tts.providers,u.tts.provider,`model`):void 0,r=u?L(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[R(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[R(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let x;t[8]!==g||t[9]!==v?(x=(0,F.jsxs)(`div`,{children:[g,v]}),t[8]=g,t[9]=v,t[10]=x):x=t[10];let S=n?`管理语音设置`:`Manage voice settings`,w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[11]=w):w=t[11];let T;t[12]===S?T=t[13]:(T=(0,F.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[S,w]})}),t[12]=S,t[13]=T);let E;t[14]!==x||t[15]!==T?(E=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[x,T]}),t[14]=x,t[15]=T,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(D=o||!u?a?(0,F.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(m,{className:`h-20 rounded-xl`}),(0,F.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:C,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(z,{icon:y,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=D):D=t[23];let O;return t[24]!==E||t[25]!==D?(O=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26],O}var V=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,U={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function W(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function ae(e){let t=(0,ie.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,F.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,F.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,F.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,F.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,F.jsx)(s,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let C;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(C=(0,F.jsx)(w,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=C):C=t[30];let T;return t[31]!==C||t[32]!==g||t[33]!==_?(T=(0,F.jsxs)(`div`,{children:[g,_,C]}),t[31]=C,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function G(e){let t=(0,ie.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,re,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(K),t[6]=p,t[7]=m);let _=m,v=i?U.zh:U.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=W(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let C=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===C?T=t[14]:(T=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[13]=C,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,F.jsxs)(`div`,{children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let D=i?`主模型`:`Primary model`,O;t[18]===D?O=t[19]:(O=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=O);let ee=i?`选择模型`:`Select a model`,k=i?`搜索模型或服务商`:`Search models or providers`,te=i?`没有匹配的模型`:`No matching models`,A=i?`默认对话模型`:`Default conversation model`,j;t[20]!==n||t[21]!==r?(j=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=j):j=t[22];let M;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==k||t[26]!==te||t[27]!==A||t[28]!==j?(M=(0,F.jsx)(w,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:k,noMatches:te,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:A,onChange:j}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=k,t[26]=te,t[27]=A,t[28]=j,t[29]=M):M=t[29];let ne;t[30]!==O||t[31]!==M?(ne=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[O,M]}),t[30]=O,t[31]=M,t[32]=ne):ne=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,F.jsx)(ae,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==E||t[45]!==ne||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,ne,P]}),t[44]=E,t[45]=ne,t[46]=P,t[47]=I):I=t[47];let L=i?`图片能力`:`Image capabilities`,R;t[48]===L?R=t[49]:(R=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:L}),t[48]=L,t[49]=R);let z=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===z?G=t[51]:(G=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:z}),t[50]=z,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=W(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,F.jsx)(w,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,F.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,F.jsx)(w,{value:pe,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let xe;t[84]!==fe||t[85]!==be?(xe=(0,F.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=xe):xe=t[86];let $;t[87]!==ue||t[88]!==xe?($=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,xe]}),t[87]=ue,t[88]=xe,t[89]=$):$=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(f,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==R||t[95]!==G||t[96]!==$||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[R,G,$,Se]}),t[94]=R,t[95]=G,t[96]=$,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(B,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=V.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,F.jsx)(w,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,ie.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,te,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(X),t[3]=c,t[4]=l);let p=l,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,F.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,ee=i?`系统默认`:`System default`,k;t[22]!==n||t[23]!==r?(k=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==O||t[26]!==ee||t[27]!==k?(A=(0,F.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:ee,onChange:k,className:`${q} mt-2`}),t[25]=O,t[26]=ee,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==D||t[30]!==A?(j=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,A]}),t[29]=D,t[30]=A,t[31]=j):j=t[31];let M=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,ne=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==ne||t[36]!==N||t[37]!==re?(P=(0,F.jsx)(`input`,{type:`number`,min:1,value:ne,placeholder:N,onChange:re,className:`${q} mt-2`}),t[35]=ne,t[36]=N,t[37]=re,t[38]=P):P=t[38];let I;t[39]!==M||t[40]!==P?(I=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[M,P]}),t[39]=M,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==E||t[43]!==j||t[44]!==I?(L=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,j,I]}),t[42]=E,t[43]=j,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==L||t[47]!==v||t[48]!==b?(R=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,L]}),t[46]=L,t[47]=v,t[48]=b,t[49]=R):R=t[49];let z=i?`提示词缓存`:`Prompt cache`,B;t[50]===z?B=t[51]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,F.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let K;t[61]!==W||t[62]!==G?(K=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==B||t[72]!==H||t[73]!==Z?(Q=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[B,H,Z]}),t[71]=B,t[72]=H,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==p||t[90]!==s.isLoading?(_e=(0,F.jsx)(a,{value:fe,options:p,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=p,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,xe;t[97]===be?xe=t[98]:(xe=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=xe);let $;t[99]!==n||t[100]!==r?($=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=$):$=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=u(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==$||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:$,className:Ce,children:[Te,De]}),t[108]=$,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=u(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,F.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==xe||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[xe,Le,Re]}),t[137]=xe,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==se||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[se,le,ve,ye,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Q||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[R,Q,Be]}),t[147]=R,t[148]=Q,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}function Q(e){let t=(0,ie.c)(99),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:c,isLoading:l}=d(`agent-defaults-skills-catalog`,O,a),[f,p]=(0,P.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(ce));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(se),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let b=y,x;t[12]===s?.catalog?x=t[13]:(x=s?.catalog??[],t[12]=s?.catalog,t[13]=x);let S;if(t[14]!==v||t[15]!==x){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=x.filter(e),t[14]=v,t[15]=x,t[16]=S}else S=t[16];let C=S.length,w=i?`技能策略`:`Skill policy`,T;t[19]===w?T=t[20]:(T=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:w}),t[19]=w,t[20]=T);let E=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[21]===E?k=t[22]:(k=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:E}),t[21]=E,t[22]=k);let te;t[23]!==n||t[24]!==r?(te=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=te):te=t[25];let A=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,j;t[26]===A?j=t[27]:(j=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,A),t[26]=A,t[27]=j);let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=M):M=t[28];let ne=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[29]===ne?N=t[30]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ne}),t[29]=ne,t[30]=N);let re=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,I;t[31]===re?I=t[32]:(I=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:re}),t[31]=re,t[32]=I);let L;t[33]!==N||t[34]!==I?(L=(0,F.jsxs)(`span`,{children:[N,I]}),t[33]=N,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==te||t[37]!==j||t[38]!==L?(R=(0,F.jsxs)(`button`,{type:`button`,onClick:te,className:j,children:[M,L]}),t[36]=te,t[37]=j,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==n||t[41]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=z):z=t[42];let B=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,V;t[43]===B?V=t[44]:(V=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,B),t[43]=B,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,F.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=H):H=t[45];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[46]===U?W=t[47]:(W=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[46]=U,t[47]=W);let ae=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,G;t[48]===ae?G=t[49]:(G=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ae}),t[48]=ae,t[49]=G);let K;t[50]!==W||t[51]!==G?(K=(0,F.jsxs)(`span`,{children:[W,G]}),t[50]=W,t[51]=G,t[52]=K):K=t[52];let q;t[53]!==z||t[54]!==V||t[55]!==K?(q=(0,F.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,K]}),t[53]=z,t[54]=V,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==R||t[58]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,q]}),t[57]=R,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==k||t[61]!==J||t[62]!==T?(Y=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[T,k,J]}),t[60]=k,t[61]=J,t[62]=T,t[63]=Y):Y=t[63];let X=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Q;t[64]===X?Q=t[65]:(Q=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:X}),t[64]=X,t[65]=Q);let le=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,ue;t[66]===le?ue=t[67]:(ue=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[66]=le,t[67]=ue);let de;t[68]!==Q||t[69]!==ue?(de=(0,F.jsxs)(`div`,{children:[Q,ue]}),t[68]=Q,t[69]=ue,t[70]=de):de=t[70];let fe=i?`搜索技能`:`Search skills`,pe;t[71]===fe?pe=t[72]:(pe=(0,F.jsx)(`span`,{className:`sr-only`,children:fe}),t[71]=fe,t[72]=pe);let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=me):me=t[73];let he;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>p(e.target.value),t[74]=he):he=t[74];let ge=i?`搜索技能`:`Search skills`,_e;t[75]!==f||t[76]!==ge?(_e=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:he,placeholder:ge,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[75]=f,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]!==pe||t[79]!==_e?(ve=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[pe,me,_e]}),t[78]=pe,t[79]=_e,t[80]=ve):ve=t[80];let ye;t[81]!==de||t[82]!==ve?(ye=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[de,ve]}),t[81]=de,t[82]=ve,t[83]=ye):ye=t[83];let be;t[84]===c?be=t[85]:(be=c?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[84]=c,t[85]=be);let xe;t[86]!==v||t[87]!==l||t[88]!==g||t[89]!==b||t[90]!==i?(xe=l?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(oe)}):(0,F.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,F.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=l,t[88]=g,t[89]=b,t[90]=i,t[91]=xe):xe=t[91];let $;t[92]!==ye||t[93]!==be||t[94]!==xe?($=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[ye,be,xe]}),t[92]=ye,t[93]=be,t[94]=xe,t[95]=$):$=t[95];let Se;return t[96]!==Y||t[97]!==$?(Se=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[Y,$]}),t[96]=Y,t[97]=$,t[98]=Se):Se=t[98],Se}function oe(e){return(0,F.jsx)(m,{className:`h-14 rounded-xl`},e)}function se(e,t){return e.name.localeCompare(t.name)}function ce(e){return e.name}function le(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ue(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(`all`),[d,p]=(0,P.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(fe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(de),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,b;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),b=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,S;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),S=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==v.length||t[21]!==b.length||t[22]!==S.length?(C={allow:y,ask:x,deny:S.length},t[20]=v.length,t[21]=b.length,t[22]=S.length,t[23]=C):C=t[23];let w=C,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==c||t[28]!==o){let e=o.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(c===`all`||r===c)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=c,t[28]=o,t[29]=E}else E=t[29];let D=E,O;t[30]!==n||t[31]!==r?(O=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=O):O=t[32];let k=O,te=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===te?A=t[34]:(A={id:`all`,label:te},t[33]=te,t[34]=A);let j=a?`允许 ${w.allow}`:`Allow ${w.allow}`,M;t[35]===j?M=t[36]:(M={id:`allow`,label:j},t[35]=j,t[36]=M);let ne=a?`询问 ${w.ask}`:`Ask ${w.ask}`,N;t[37]===ne?N=t[38]:(N={id:`ask`,label:ne},t[37]=ne,t[38]=N);let re=a?`禁用 ${w.deny}`:`Deny ${w.deny}`,I;t[39]===re?I=t[40]:(I={id:`deny`,label:re},t[39]=re,t[40]=I);let L;t[41]!==A||t[42]!==M||t[43]!==N||t[44]!==I?(L=[A,M,N,I],t[41]=A,t[42]=M,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,F.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==c||t[54]!==R?(W=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,c===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=c,t[54]=R,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,F.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,F.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==W||t[67]!==X?(Z=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,X]}),t[66]=W,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==k||t[73]!==D||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==k||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>k(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,F.jsx)(T,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>k(e,{maxCallsPerTurn:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>k(e,{timeoutMs:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=h,t[77]=n.tools,t[78]=d,t[79]=k,t[80]=a,t[81]=e):e=t[81],Q=D.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=k,t[73]=D,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==D.length||t[83]!==a?(oe=D.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,F.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==U||t[89]!==Z||t[90]!==se?(ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[U,Z,se]}),t[88]=U,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function de(e){return e.id}function fe(e){return[e.id,e.description]}function pe(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(m,{className:`h-7 w-56`}),(0,F.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(m,{className:`h-9 w-28`})]}),(0,F.jsx)(m,{className:`h-20 rounded-2xl`}),(0,F.jsx)(m,{className:`h-12 rounded-xl`}),(0,F.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,ie.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,P.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,l]=(0,P.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,P.useState)(d),h;t[4]===c?h=t[5]:(h=JSON.stringify(c),t[4]=c,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let y=h!==g,b=i?`模型`:`Models`,x;t[8]===b?x=t[9]:(x={id:`models`,label:b,icon:E},t[8]=b,t[9]=x);let C=i?`技能`:`Skills`,w;t[10]===C?w=t[11]:(w={id:`skills`,label:C,icon:S},t[10]=C,t[11]=w);let T=i?`工具`:`Tools`,D;t[12]===T?D=t[13]:(D={id:`tools`,label:T,icon:k},t[12]=T,t[13]=D);let O=i?`运行`:`Runtime`,ee;t[14]===O?ee=t[15]:(ee={id:`runtime`,label:O,icon:v},t[14]=O,t[15]=ee);let te;t[16]!==D||t[17]!==ee||t[18]!==x||t[19]!==w?(te=[x,w,D,ee],t[16]=D,t[17]=ee,t[18]=x,t[19]=w,t[20]=te):te=t[20];let N=te,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await _(t),r=structuredClone(n.defaults);l(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let I=re,L;t[22]!==y||t[23]!==c?(L={value:c,dirty:y,onSave:I,delayMs:0},t[22]=y,t[23]=c,t[24]=L):L=t[24];let R=ne(L),z=R.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==R.error||t[26]!==R.status?(V=(0,F.jsx)(M,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,F.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(U=R.error?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,F.jsx)(`span`,{children:R.error}),(0,F.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:R.retry,children:i?`重试`:`Retry`})]}):null,t[31]=R.error,t[32]=R.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==N?(ae=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,a===t?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:u(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=N,t[37]=ae):ae=t[37];let K;t[38]!==W||t[39]!==ae?(K=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=K):K=t[40];let q;t[41]!==a||t[42]!==c||t[43]!==i?(q=a===`models`?(0,F.jsx)(G,{draft:c,setDraft:l,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==c||t[47]!==i?(J=a===`skills`?(0,F.jsx)(Q,{draft:c,setDraft:l,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(X=a===`tools`?(0,F.jsx)(ue,{draft:c,setDraft:l,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==c||t[56]!==i?(Z=a===`runtime`?(0,F.jsx)(Y,{draft:c,setDraft:l,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=Z):Z=t[57];let oe;return t[58]!==R.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(oe=(0,F.jsxs)(j,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,X,Z]}),t[58]=R.onBlurCapture,t[59]=H,t[60]=U,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=oe):oe=t[66],oe}function he(){let e=(0,ie.c)(17),t=l(_e),n=c(ge)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,x);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(j,{children:(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,F.jsx)(f,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,F.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(pe,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(me,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function ge(e){return e.language}function _e(e){return e.token}export{he as AgentDefaultsSettingsPanel};
|
|
@@ -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{d as i,p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{n as h,s as g}from"./locale-store-DFQX9kTl.js";import{t as _}from"./cn-JdwAhgNB.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-B11EPpor.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./settings-shell-layer-context-DCp6ykjQ.js";import{El as w,Is as T,P as E,Uc as D,Vs as O,_c as k,in as A,nc as j,nn as M,rn as N,ro as P,tn as F,ya as I,yu as L}from"./index-Dpu7EKTm.js";import{r as R}from"./settings-page-layout-DYelDcMV.js";var z=n(),B=e(t(),1),V=r(),ee=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function U(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function W(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function G(e){let t=(0,z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function K(e){let t=(0,z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,V.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,V.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function q(e){let t=(0,z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,V.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function J(e){let t=(0,z.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,V.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,V.jsx)(G,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,V.jsx)(G,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,V.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let b;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(b=l&&i!==null?(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=b):b=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,V.jsx)(y,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[v,b,x,S]}),t[40]=b,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:U(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,V.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function Y(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function X({agent:e,toolIds:t,zh:n,externalError:r,onDirtyChange:i,onClose:a,onOpenDefaults:o,onChat:s,onDelete:c}){let[l,u]=(0,B.useState)(`overview`),[d,f]=(0,B.useState)(()=>structuredClone(e.override)),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),v=JSON.stringify(d)!==JSON.stringify(e.override),b=[d.models?.chat,...Object.values(d.models?.intents??{}),d.models?.imageUnderstanding,d.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,B.useEffect)(()=>i(v),[v,i]);let x=(0,B.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(d.tools??{})])].sort(),[e.effective.tools,d.tools,t]),S=[d.models?n?`模型`:`Models`:null,d.skills?n?`技能`:`Skills`:null,d.tools?n?`工具权限`:`Tool access`:null,d.runtime||d.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),C=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,E=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,M=async()=>{m(!0),g(null);try{let t=(await A(e.id,{workspace:d.workspace??null,profile:d.profile,models:d.models??null,skills:d.skills??null,tools:d.tools??null,workflows:d.workflows??null,runtime:d.runtime??null})).agents.find(t=>t.id===e.id);t&&f(structuredClone(t.override))}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},N=async()=>{m(!0),g(null);try{await A(e.id,{setDefault:!0})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},P=(e,t)=>{let n={...d.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},f({...d,tools:Object.keys(n).length>0?n:void 0})},F=(e,t)=>{let n={...d.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,f({...d,models:Object.keys(n).length>0?n:void 0})};return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,V.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,V.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:w},{id:`profile`,label:n?`个性`:`Profile`,icon:T},{id:`models`,label:n?`模型`:`Models`,icon:j},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:L},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:w},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:O}].map(({id:e,label:t,icon:n})=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:_(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,l===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,V.jsx)(n,{className:`size-4`}),t]},e))})}),(0,V.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,V.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[h||r?(0,V.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h??r}):null,l===`overview`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,V.jsxs)(y,{onClick:s,children:[(0,V.jsx)(D,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:S.length>0?n?`已自定义:${S.join(`、`)}`:`Customized: ${S.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:S.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,V.jsx)(y,{onClick:o,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(q,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:d.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`技能`:`Skills`,value:E,detail:d.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`工具权限`:`Tool access`,value:C>0?n?`${C} 个禁用`:`${C} denied`:n?`全部可用`:`All available`,detail:d.tools?n?`${Object.keys(d.tools).length} 个本地覆盖`:`${Object.keys(d.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:d.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,V.jsx)(y,{onClick:()=>void N(),disabled:p,children:n?`设为默认智能体`:`Make default agent`})]}):null,l===`profile`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`只设置这个智能体独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,V.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.profile?.name??``,onChange:e=>f({...d,profile:{name:e.target.value,...d.profile?.instructions?{instructions:d.profile.instructions}:{}}})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,d.workspace?null:(0,V.jsx)(G,{children:n?`自动`:`Automatic`})]}),(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:d.workspace??``,placeholder:e.effective.workspace,onChange:e=>f({...d,workspace:e.target.value||void 0})})]})]}),(0,V.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,V.jsx)(`textarea`,{rows:10,className:`${H} mt-1.5 resize-y leading-6`,value:d.profile?.instructions??``,onChange:t=>f({...d,profile:{name:d.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,l===`models`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:d.models?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,models:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,V.jsx)(J,{label:`Chat`,inherited:e.effective.models.chat,value:d.models?.chat,zh:n,onChange:e=>{let t={...d.models??{}};e?t.chat=e:delete t.chat,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,V.jsx)(`div`,{className:`space-y-3`,children:ee.map(t=>(0,V.jsx)(J,{label:t,inherited:e.effective.models.intents[t]??e.effective.models.chat,value:d.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>F(t,e)},t))})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(J,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:d.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...d.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,V.jsx)(J,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:d.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...d.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:d.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:d.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},f({...d,models:Object.keys(n).length>0?n:void 0})}}),d.models?.imageGeneration?(0,V.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,V.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-1.5`,value:d.models.imageGeneration.timeoutMs??``,onChange:e=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,timeoutMs:W(e.target.value)}}})})]}),(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,autoProviderFallback:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,l===`capabilities`?(0,V.jsxs)(`div`,{className:`space-y-7`,children:[(0,V.jsx)(K,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),d.skills?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,skills:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,V.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,V.jsx)(y,{variant:d.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`merge`,add:[],remove:[]}}),children:`Merge`}),(0,V.jsx)(y,{variant:d.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`replace`,include:[]}}),children:`Replace`})]}),d.skills?.mode===`merge`?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.add.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:U(e.target.value),remove:d.skills?.mode===`merge`?d.skills.remove:[]}})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.remove.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:d.skills?.mode===`merge`?d.skills.add:[],remove:U(e.target.value)}})})]})]}):null,d.skills?.mode===`replace`?(0,V.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.include.join(`, `),onChange:e=>f({...d,skills:{mode:`replace`,include:U(e.target.value)}})})]}):null]}),(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),d.tools?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,tools:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,V.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:x.map(t=>{let r=d.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,V.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${i}`})]}),(0,V.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>P(t,e),className:_(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e},e))})]},t)})})]})]}):null,l===`runtime`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:d.runtime||d.workflows?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,runtime:void 0,workflows:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,V.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,d.runtime?.[t]===void 0?(0,V.jsx)(G,{children:n?`继承`:`Inherited`}):null]}),(0,V.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-1.5`,value:d.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Y({...d.runtime??{},[t]:W(e.target.value)});f({...d,runtime:n})}})]},t))}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Y({...d.workflows??{},default:e.target.value||void 0});f({...d,workflows:t})}})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=U(e.target.value),n=Y({...d.workflows??{},allowed:t.length>0?t:void 0});f({...d,workflows:n})}})]})]})]}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),d.runtime?.promptCache?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>{let e=Y({...d.runtime??{},promptCache:void 0});f({...d,runtime:e})},children:[(0,V.jsx)(k,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),d.runtime?.promptCache?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,mode:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]}),(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,lifetime:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]})]}):(0,V.jsx)(y,{className:`mt-4`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,l===`danger`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,V.jsx)(y,{disabled:p,onClick:()=>void N(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,V.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,V.jsxs)(y,{variant:`ghost`,className:`text-red-600`,onClick:c,children:[(0,V.jsx)(O,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,V.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b?n?`请补全自定义模型`:`Complete the custom model reference`:v?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(y,{onClick:a,children:n?`关闭`:`Close`}),(0,V.jsx)(y,{variant:`primary`,disabled:p||!v||b||d.profile!==void 0&&!d.profile.name.trim(),onClick:()=>void M(),children:p?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function te(e){let t=(0,z.c)(29),{agent:n,open:r,onOpenChange:i,children:a}=e,[p,h]=(0,B.useState)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,V.jsx)(o,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[0]=g):g=t[0];let v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=_(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,x,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=v):v=t[1];let y;t[2]!==n.avatar||t[3]!==n.id?(y=(0,V.jsx)(E,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=y):y=t[4];let b;t[5]===n.name?b=t[6]:(b=(0,V.jsx)(d,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[5]=n.name,t[6]=b);let w;t[7]===n.id?w=t[8]:(w=(0,V.jsx)(s,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[7]=n.id,t[8]=w);let T;t[9]!==b||t[10]!==w?(T=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[b,w]}),t[9]=b,t[10]=w,t[11]=T):T=t[11];let D;t[12]===n.isDefault?D=t[13]:(D=n.isDefault?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:`DEFAULT`}):null,t[12]=n.isDefault,t[13]=D);let O;t[14]!==y||t[15]!==T||t[16]!==D?(O=(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[y,T,D]}),t[14]=y,t[15]=T,t[16]=D,t[17]=O):O=t[17];let k;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":`Close`,children:(0,V.jsx)(m,{className:`size-4`})})}),t[18]=k):k=t[18];let A;t[19]===O?A=t[20]:(A=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[O,k]}),t[19]=O,t[20]=A);let j;t[21]!==a||t[22]!==p||t[23]!==A?(j=(0,V.jsxs)(l,{children:[g,(0,V.jsx)(u,{ref:h,className:v,onOpenAutoFocus:Z,children:(0,V.jsxs)(C,{layer:`modal`,portalContainer:p,children:[A,a]})})]}),t[21]=a,t[22]=p,t[23]=A,t[24]=j):j=t[24];let M;return t[25]!==i||t[26]!==r||t[27]!==j?(M=(0,V.jsx)(f,{open:r,onOpenChange:i,children:j}),t[25]=i,t[26]=r,t[27]=j,t[28]=M):M=t[28],M}function Z(e){return e.preventDefault()}function Q(e){let t=(0,z.c)(13),{agents:n,busy:r,zh:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i){let e;t[6]!==r||t[7]!==o||t[8]!==a||t[9]!==i?(e=e=>(0,V.jsx)(`li`,{className:`min-h-0`,children:(0,V.jsxs)(`article`,{className:_(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,V.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i?`配置 ${e.name}`:`Configure ${e.name}`,onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,V.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(E,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:e.name})})]}),(0,V.jsx)(`span`,{className:_(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i?`默认`:`Default`:i?`自定义`:`Custom`})]}),(0,V.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:e.description||e.override.profile?.instructions||(i?`使用全局配置`:`Uses global settings`)}),(0,V.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,V.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i?`当前模型`:`Current model`}),(0,V.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,V.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,V.jsxs)(y,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,V.jsx)(D,{className:`size-4`}),i?`与这个智能体对话`:`Chat with this agent`]})})]})},e.id),t[6]=r,t[7]=o,t[8]=a,t[9]=i,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,V.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var ne=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function $(e){let t=(0,z.c)(59),{open:n,busy:r,error:i,name:a,instructions:p,zh:h,onNameChange:g,onInstructionsChange:v,onCreate:b,onOpenChange:C}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,V.jsx)(o,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=_(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,x),t[1]=T):T=t[1];let E=h?`新建智能体`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,V.jsx)(d,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=h?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,V.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,V.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,V.jsx)(m,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,V.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,V.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=h?`名称`:`Name`,F=h?`智能体名称`:`Agent name`,I;t[14]===g?I=t[15]:(I=e=>g(e.target.value),t[14]=g,t[15]=I);let L=h?`例如:数据分析师`:`For example: Data analyst`,R;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==L?(R=(0,V.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${ne} mt-1.5`,value:a,onChange:I,placeholder:L}),t[16]=a,t[17]=F,t[18]=I,t[19]=L,t[20]=R):R=t[20];let B;t[21]!==P||t[22]!==R?(B=(0,V.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,R]}),t[21]=P,t[22]=R,t[23]=B):B=t[23];let ee=h?`个性与工作方式(可选)`:`Personality and working style (optional)`,H=h?`个性与工作方式`:`Personality and working style`,U;t[24]===v?U=t[25]:(U=e=>v(e.target.value),t[24]=v,t[25]=U);let W=h?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,G;t[26]!==p||t[27]!==H||t[28]!==U||t[29]!==W?(G=(0,V.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":H,rows:4,className:`${ne} mt-1.5 resize-none`,value:p,onChange:U,placeholder:W}),t[26]=p,t[27]=H,t[28]=U,t[29]=W,t[30]=G):G=t[30];let K;t[31]!==ee||t[32]!==G?(K=(0,V.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[ee,G]}),t[31]=ee,t[32]=G,t[33]=K):K=t[33];let q;t[34]!==N||t[35]!==B||t[36]!==K?(q=(0,V.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,B,K]}),t[34]=N,t[35]=B,t[36]=K,t[37]=q):q=t[37];let J=h?`取消`:`Cancel`,Y;t[38]!==r||t[39]!==J?(Y=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(y,{disabled:r,children:J})}),t[38]=r,t[39]=J,t[40]=Y):Y=t[40];let X;t[41]!==r||t[42]!==a?(X=r||!a.trim(),t[41]=r,t[42]=a,t[43]=X):X=t[43];let te=r?h?`创建中…`:`Creating…`:h?`创建智能体`:`Create agent`,Z;t[44]!==b||t[45]!==X||t[46]!==te?(Z=(0,V.jsx)(y,{variant:`primary`,disabled:X,onClick:b,children:te}),t[44]=b,t[45]=X,t[46]=te,t[47]=Z):Z=t[47];let Q;t[48]!==Y||t[49]!==Z?(Q=(0,V.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[Y,Z]}),t[48]=Y,t[49]=Z,t[50]=Q):Q=t[50];let $;t[51]!==q||t[52]!==Q||t[53]!==M?($=(0,V.jsxs)(l,{children:[w,(0,V.jsxs)(u,{className:T,children:[M,q,Q]})]}),t[51]=q,t[52]=Q,t[53]=M,t[54]=$):$=t[54];let re;return t[55]!==C||t[56]!==n||t[57]!==$?(re=(0,V.jsx)(f,{open:n,onOpenChange:C,children:$}),t[55]=C,t[56]=n,t[57]=$,t[58]=re):re=t[58],re}function re(){let e=(0,z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(b,{className:`h-7 w-28`}),(0,V.jsx)(b,{className:`h-4 w-80 max-w-full`})]}),(0,V.jsx)(b,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,V.jsxs)(R,{gap:`gap-5`,children:[t,(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(ie)})]}),e[1]=n):n=e[1],n}function ie(e){return(0,V.jsx)(b,{className:`h-64 rounded-2xl`},e)}function ae(){let e=g(e=>e.token),t=h(e=>e.language)===`zh`,n=i(),{agentId:r}=a(),{data:o,error:s,isLoading:c,mutate:l}=v(e?`settings-gateway-agents`:null,N),u=P(e=>e.setPageHeader),d=P(e=>e.clearPageHeader),[f,m]=(0,B.useState)({open:!1,name:``,instructions:``}),[_,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),C=(0,B.useRef)(!1),w=o?.agents.find(e=>e.id===r),T=(0,B.useMemo)(()=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(y,{onClick:()=>n(`/settings/agent-defaults`),children:t?`全局默认配置`:`Global defaults`}),(0,V.jsxs)(y,{variant:`primary`,onClick:()=>{S(null),m(e=>({...e,open:!0}))},children:[(0,V.jsx)(p,{className:`size-4`}),t?`新建智能体`:`New agent`]})]}),[n,t]);(0,B.useLayoutEffect)(()=>(u({startExtra:null,main:(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`智能体`:`Agents`}),end:T}),()=>d()),[d,T,u,t]);let E=async()=>{b(!0),S(null);try{let e=await F({profile:{name:f.name.trim(),...f.instructions.trim()?{instructions:f.instructions.trim()}:{}}});m({open:!1,name:``,instructions:``}),n(`/agents/${e.createdAgentId}`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}},D=async e=>{if(window.confirm(t?`删除 ${e.name}?此操作无法撤销。`:`Delete ${e.name}? This cannot be undone.`)){b(!0),S(null);try{await M(e.id),n(`/agents`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}},O=e=>{I(e),n(`/chat/new`)},k=e=>{C.current=!1,window.setTimeout(()=>n(`/agents/${e}`),0)},A=()=>{C.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(C.current=!1,n(`/agents`))},j=()=>{C.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(C.current=!1,n(`/settings/agent-defaults`))},L=(0,B.useCallback)(e=>{C.current=e},[]);return e?s&&!o?(0,V.jsxs)(R,{children:[(0,V.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(s)}),(0,V.jsx)(y,{onClick:()=>void l(),children:t?`重试`:`Retry`})]}):c||!o?(0,V.jsx)(re,{}):(0,V.jsxs)(R,{gap:`gap-5`,className:`max-w-6xl`,padding:`px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(s||x)&&!w?(0,V.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(s)}):null,(0,V.jsx)(Q,{agents:o.agents,busy:_,zh:t,onOpen:k,onChat:O}),w?(0,V.jsx)(te,{agent:w,open:!0,onOpenChange:e=>{e||A()},children:(0,V.jsx)(X,{agent:w,toolIds:o.builtinToolIds,zh:t,externalError:x,onDirtyChange:L,onClose:A,onOpenDefaults:j,onChat:()=>O(w.id),onDelete:()=>void D(w)},w.id)}):null,(0,V.jsx)($,{open:f.open,busy:_,error:x,name:f.name,instructions:f.instructions,zh:t,onNameChange:e=>m(t=>({...t,name:e})),onInstructionsChange:e=>m(t=>({...t,instructions:e})),onCreate:()=>void E(),onOpenChange:e=>{_||(m(t=>({...t,open:e})),e||S(null))}})]}):(0,V.jsx)(R,{children:(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`需要本机服务令牌。`:`Local service token required.`})})}export{ae as AgentsSettingsPanel};
|
|
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,p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{n as h,s as g}from"./locale-store-DFQX9kTl.js";import{t as _}from"./cn-JdwAhgNB.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-B11EPpor.js";import{t as b}from"./skeleton-BwbyijEw.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as C}from"./settings-shell-layer-context-DCp6ykjQ.js";import{El as w,Is as T,P as E,Uc as D,Vs as O,_c as k,in as A,nc as j,nn as M,rn as N,ro as P,tn as F,ya as I,yu as L}from"./index-Cn__9Un2.js";import{r as R}from"./settings-page-layout-DYelDcMV.js";var z=n(),B=e(t(),1),V=r(),ee=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function U(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function W(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function G(e){let t=(0,z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function K(e){let t=(0,z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,V.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,V.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function q(e){let t=(0,z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,V.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function J(e){let t=(0,z.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,V.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,V.jsx)(G,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,V.jsx)(G,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,V.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let b;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(b=l&&i!==null?(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=b):b=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,V.jsx)(y,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,V.jsx)(y,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[v,b,x,S]}),t[40]=b,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:U(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,V.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function Y(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function X({agent:e,toolIds:t,zh:n,externalError:r,onDirtyChange:i,onClose:a,onOpenDefaults:o,onChat:s,onDelete:c}){let[l,u]=(0,B.useState)(`overview`),[d,f]=(0,B.useState)(()=>structuredClone(e.override)),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),v=JSON.stringify(d)!==JSON.stringify(e.override),b=[d.models?.chat,...Object.values(d.models?.intents??{}),d.models?.imageUnderstanding,d.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,B.useEffect)(()=>i(v),[v,i]);let x=(0,B.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(d.tools??{})])].sort(),[e.effective.tools,d.tools,t]),S=[d.models?n?`模型`:`Models`:null,d.skills?n?`技能`:`Skills`:null,d.tools?n?`工具权限`:`Tool access`:null,d.runtime||d.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),C=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,E=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,M=async()=>{m(!0),g(null);try{let t=(await A(e.id,{workspace:d.workspace??null,profile:d.profile,models:d.models??null,skills:d.skills??null,tools:d.tools??null,workflows:d.workflows??null,runtime:d.runtime??null})).agents.find(t=>t.id===e.id);t&&f(structuredClone(t.override))}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},N=async()=>{m(!0),g(null);try{await A(e.id,{setDefault:!0})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},P=(e,t)=>{let n={...d.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},f({...d,tools:Object.keys(n).length>0?n:void 0})},F=(e,t)=>{let n={...d.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,f({...d,models:Object.keys(n).length>0?n:void 0})};return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,V.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,V.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:w},{id:`profile`,label:n?`个性`:`Profile`,icon:T},{id:`models`,label:n?`模型`:`Models`,icon:j},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:L},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:w},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:O}].map(({id:e,label:t,icon:n})=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:_(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,l===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,V.jsx)(n,{className:`size-4`}),t]},e))})}),(0,V.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,V.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[h||r?(0,V.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h??r}):null,l===`overview`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,V.jsxs)(y,{onClick:s,children:[(0,V.jsx)(D,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:S.length>0?n?`已自定义:${S.join(`、`)}`:`Customized: ${S.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:S.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,V.jsx)(y,{onClick:o,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(q,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:d.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`技能`:`Skills`,value:E,detail:d.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`工具权限`:`Tool access`,value:C>0?n?`${C} 个禁用`:`${C} denied`:n?`全部可用`:`All available`,detail:d.tools?n?`${Object.keys(d.tools).length} 个本地覆盖`:`${Object.keys(d.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,V.jsx)(q,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:d.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,V.jsx)(y,{onClick:()=>void N(),disabled:p,children:n?`设为默认智能体`:`Make default agent`})]}):null,l===`profile`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`只设置这个智能体独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,V.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.profile?.name??``,onChange:e=>f({...d,profile:{name:e.target.value,...d.profile?.instructions?{instructions:d.profile.instructions}:{}}})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,d.workspace?null:(0,V.jsx)(G,{children:n?`自动`:`Automatic`})]}),(0,V.jsx)(`input`,{className:`${H} mt-1.5 font-mono`,value:d.workspace??``,placeholder:e.effective.workspace,onChange:e=>f({...d,workspace:e.target.value||void 0})})]})]}),(0,V.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,V.jsx)(`textarea`,{rows:10,className:`${H} mt-1.5 resize-y leading-6`,value:d.profile?.instructions??``,onChange:t=>f({...d,profile:{name:d.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,l===`models`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:d.models?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,models:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,V.jsx)(J,{label:`Chat`,inherited:e.effective.models.chat,value:d.models?.chat,zh:n,onChange:e=>{let t={...d.models??{}};e?t.chat=e:delete t.chat,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,V.jsx)(`div`,{className:`space-y-3`,children:ee.map(t=>(0,V.jsx)(J,{label:t,inherited:e.effective.models.intents[t]??e.effective.models.chat,value:d.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>F(t,e)},t))})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(J,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:d.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...d.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,f({...d,models:Object.keys(t).length>0?t:void 0})}}),(0,V.jsx)(J,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:d.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...d.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:d.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:d.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},f({...d,models:Object.keys(n).length>0?n:void 0})}}),d.models?.imageGeneration?(0,V.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,V.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-1.5`,value:d.models.imageGeneration.timeoutMs??``,onChange:e=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,timeoutMs:W(e.target.value)}}})})]}),(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,models:{...d.models,imageGeneration:{...d.models.imageGeneration,autoProviderFallback:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,l===`capabilities`?(0,V.jsxs)(`div`,{className:`space-y-7`,children:[(0,V.jsx)(K,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),d.skills?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,skills:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,V.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,V.jsx)(y,{variant:d.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`merge`,add:[],remove:[]}}),children:`Merge`}),(0,V.jsx)(y,{variant:d.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>f({...d,skills:{mode:`replace`,include:[]}}),children:`Replace`})]}),d.skills?.mode===`merge`?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.add.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:U(e.target.value),remove:d.skills?.mode===`merge`?d.skills.remove:[]}})})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.remove.join(`, `),onChange:e=>f({...d,skills:{mode:`merge`,add:d.skills?.mode===`merge`?d.skills.add:[],remove:U(e.target.value)}})})]})]}):null,d.skills?.mode===`replace`?(0,V.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.skills.include.join(`, `),onChange:e=>f({...d,skills:{mode:`replace`,include:U(e.target.value)}})})]}):null]}),(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),d.tools?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,tools:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,V.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:x.map(t=>{let r=d.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,V.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${i}`})]}),(0,V.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>P(t,e),className:_(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e},e))})]},t)})})]})]}):null,l===`runtime`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:d.runtime||d.workflows?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>f({...d,runtime:void 0,workflows:void 0}),children:[(0,V.jsx)(k,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,V.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,d.runtime?.[t]===void 0?(0,V.jsx)(G,{children:n?`继承`:`Inherited`}):null]}),(0,V.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-1.5`,value:d.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Y({...d.runtime??{},[t]:W(e.target.value)});f({...d,runtime:n})}})]},t))}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Y({...d.workflows??{},default:e.target.value||void 0});f({...d,workflows:t})}})]}),(0,V.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,V.jsx)(`input`,{className:`${H} mt-1.5`,value:d.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=U(e.target.value),n=Y({...d.workflows??{},allowed:t.length>0?t:void 0});f({...d,workflows:n})}})]})]})]}),(0,V.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:d.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),d.runtime?.promptCache?(0,V.jsxs)(y,{variant:`ghost`,onClick:()=>{let e=Y({...d.runtime??{},promptCache:void 0});f({...d,runtime:e})},children:[(0,V.jsx)(k,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),d.runtime?.promptCache?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,mode:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]}),(0,V.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...d.runtime.promptCache,lifetime:e}}}),className:_(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,d.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e},e))})]})]}):(0,V.jsx)(y,{className:`mt-4`,onClick:()=>f({...d,runtime:{...d.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,l===`danger`?(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(K,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,V.jsx)(y,{disabled:p,onClick:()=>void N(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,V.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,V.jsxs)(y,{variant:`ghost`,className:`text-red-600`,onClick:c,children:[(0,V.jsx)(O,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,V.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b?n?`请补全自定义模型`:`Complete the custom model reference`:v?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(y,{onClick:a,children:n?`关闭`:`Close`}),(0,V.jsx)(y,{variant:`primary`,disabled:p||!v||b||d.profile!==void 0&&!d.profile.name.trim(),onClick:()=>void M(),children:p?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function te(e){let t=(0,z.c)(29),{agent:n,open:r,onOpenChange:i,children:a}=e,[p,h]=(0,B.useState)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,V.jsx)(o,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[0]=g):g=t[0];let v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=_(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,x,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=v):v=t[1];let y;t[2]!==n.avatar||t[3]!==n.id?(y=(0,V.jsx)(E,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=y):y=t[4];let b;t[5]===n.name?b=t[6]:(b=(0,V.jsx)(d,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[5]=n.name,t[6]=b);let w;t[7]===n.id?w=t[8]:(w=(0,V.jsx)(s,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[7]=n.id,t[8]=w);let T;t[9]!==b||t[10]!==w?(T=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[b,w]}),t[9]=b,t[10]=w,t[11]=T):T=t[11];let D;t[12]===n.isDefault?D=t[13]:(D=n.isDefault?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:`DEFAULT`}):null,t[12]=n.isDefault,t[13]=D);let O;t[14]!==y||t[15]!==T||t[16]!==D?(O=(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[y,T,D]}),t[14]=y,t[15]=T,t[16]=D,t[17]=O):O=t[17];let k;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":`Close`,children:(0,V.jsx)(m,{className:`size-4`})})}),t[18]=k):k=t[18];let A;t[19]===O?A=t[20]:(A=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[O,k]}),t[19]=O,t[20]=A);let j;t[21]!==a||t[22]!==p||t[23]!==A?(j=(0,V.jsxs)(l,{children:[g,(0,V.jsx)(u,{ref:h,className:v,onOpenAutoFocus:Z,children:(0,V.jsxs)(C,{layer:`modal`,portalContainer:p,children:[A,a]})})]}),t[21]=a,t[22]=p,t[23]=A,t[24]=j):j=t[24];let M;return t[25]!==i||t[26]!==r||t[27]!==j?(M=(0,V.jsx)(f,{open:r,onOpenChange:i,children:j}),t[25]=i,t[26]=r,t[27]=j,t[28]=M):M=t[28],M}function Z(e){return e.preventDefault()}function Q(e){let t=(0,z.c)(13),{agents:n,busy:r,zh:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i){let e;t[6]!==r||t[7]!==o||t[8]!==a||t[9]!==i?(e=e=>(0,V.jsx)(`li`,{className:`min-h-0`,children:(0,V.jsxs)(`article`,{className:_(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,V.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i?`配置 ${e.name}`:`Configure ${e.name}`,onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,V.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(E,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:e.name})})]}),(0,V.jsx)(`span`,{className:_(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i?`默认`:`Default`:i?`自定义`:`Custom`})]}),(0,V.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:e.description||e.override.profile?.instructions||(i?`使用全局配置`:`Uses global settings`)}),(0,V.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,V.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i?`当前模型`:`Current model`}),(0,V.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,V.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,V.jsxs)(y,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,V.jsx)(D,{className:`size-4`}),i?`与这个智能体对话`:`Chat with this agent`]})})]})},e.id),t[6]=r,t[7]=o,t[8]=a,t[9]=i,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,V.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var ne=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function $(e){let t=(0,z.c)(59),{open:n,busy:r,error:i,name:a,instructions:p,zh:h,onNameChange:g,onInstructionsChange:v,onCreate:b,onOpenChange:C}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,V.jsx)(o,{className:_(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=_(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,x),t[1]=T):T=t[1];let E=h?`新建智能体`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,V.jsx)(d,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=h?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,V.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,V.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,V.jsx)(m,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,V.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,V.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=h?`名称`:`Name`,F=h?`智能体名称`:`Agent name`,I;t[14]===g?I=t[15]:(I=e=>g(e.target.value),t[14]=g,t[15]=I);let L=h?`例如:数据分析师`:`For example: Data analyst`,R;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==L?(R=(0,V.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${ne} mt-1.5`,value:a,onChange:I,placeholder:L}),t[16]=a,t[17]=F,t[18]=I,t[19]=L,t[20]=R):R=t[20];let B;t[21]!==P||t[22]!==R?(B=(0,V.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,R]}),t[21]=P,t[22]=R,t[23]=B):B=t[23];let ee=h?`个性与工作方式(可选)`:`Personality and working style (optional)`,H=h?`个性与工作方式`:`Personality and working style`,U;t[24]===v?U=t[25]:(U=e=>v(e.target.value),t[24]=v,t[25]=U);let W=h?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,G;t[26]!==p||t[27]!==H||t[28]!==U||t[29]!==W?(G=(0,V.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":H,rows:4,className:`${ne} mt-1.5 resize-none`,value:p,onChange:U,placeholder:W}),t[26]=p,t[27]=H,t[28]=U,t[29]=W,t[30]=G):G=t[30];let K;t[31]!==ee||t[32]!==G?(K=(0,V.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[ee,G]}),t[31]=ee,t[32]=G,t[33]=K):K=t[33];let q;t[34]!==N||t[35]!==B||t[36]!==K?(q=(0,V.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,B,K]}),t[34]=N,t[35]=B,t[36]=K,t[37]=q):q=t[37];let J=h?`取消`:`Cancel`,Y;t[38]!==r||t[39]!==J?(Y=(0,V.jsx)(c,{asChild:!0,children:(0,V.jsx)(y,{disabled:r,children:J})}),t[38]=r,t[39]=J,t[40]=Y):Y=t[40];let X;t[41]!==r||t[42]!==a?(X=r||!a.trim(),t[41]=r,t[42]=a,t[43]=X):X=t[43];let te=r?h?`创建中…`:`Creating…`:h?`创建智能体`:`Create agent`,Z;t[44]!==b||t[45]!==X||t[46]!==te?(Z=(0,V.jsx)(y,{variant:`primary`,disabled:X,onClick:b,children:te}),t[44]=b,t[45]=X,t[46]=te,t[47]=Z):Z=t[47];let Q;t[48]!==Y||t[49]!==Z?(Q=(0,V.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[Y,Z]}),t[48]=Y,t[49]=Z,t[50]=Q):Q=t[50];let $;t[51]!==q||t[52]!==Q||t[53]!==M?($=(0,V.jsxs)(l,{children:[w,(0,V.jsxs)(u,{className:T,children:[M,q,Q]})]}),t[51]=q,t[52]=Q,t[53]=M,t[54]=$):$=t[54];let re;return t[55]!==C||t[56]!==n||t[57]!==$?(re=(0,V.jsx)(f,{open:n,onOpenChange:C,children:$}),t[55]=C,t[56]=n,t[57]=$,t[58]=re):re=t[58],re}function re(){let e=(0,z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(b,{className:`h-7 w-28`}),(0,V.jsx)(b,{className:`h-4 w-80 max-w-full`})]}),(0,V.jsx)(b,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,V.jsxs)(R,{gap:`gap-5`,children:[t,(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(ie)})]}),e[1]=n):n=e[1],n}function ie(e){return(0,V.jsx)(b,{className:`h-64 rounded-2xl`},e)}function ae(){let e=g(e=>e.token),t=h(e=>e.language)===`zh`,n=i(),{agentId:r}=a(),{data:o,error:s,isLoading:c,mutate:l}=v(e?`settings-gateway-agents`:null,N),u=P(e=>e.setPageHeader),d=P(e=>e.clearPageHeader),[f,m]=(0,B.useState)({open:!1,name:``,instructions:``}),[_,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),C=(0,B.useRef)(!1),w=o?.agents.find(e=>e.id===r),T=(0,B.useMemo)(()=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(y,{onClick:()=>n(`/settings/agent-defaults`),children:t?`全局默认配置`:`Global defaults`}),(0,V.jsxs)(y,{variant:`primary`,onClick:()=>{S(null),m(e=>({...e,open:!0}))},children:[(0,V.jsx)(p,{className:`size-4`}),t?`新建智能体`:`New agent`]})]}),[n,t]);(0,B.useLayoutEffect)(()=>(u({startExtra:null,main:(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`智能体`:`Agents`}),end:T}),()=>d()),[d,T,u,t]);let E=async()=>{b(!0),S(null);try{let e=await F({profile:{name:f.name.trim(),...f.instructions.trim()?{instructions:f.instructions.trim()}:{}}});m({open:!1,name:``,instructions:``}),n(`/agents/${e.createdAgentId}`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}},D=async e=>{if(window.confirm(t?`删除 ${e.name}?此操作无法撤销。`:`Delete ${e.name}? This cannot be undone.`)){b(!0),S(null);try{await M(e.id),n(`/agents`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}},O=e=>{I(e),n(`/chat/new`)},k=e=>{C.current=!1,window.setTimeout(()=>n(`/agents/${e}`),0)},A=()=>{C.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(C.current=!1,n(`/agents`))},j=()=>{C.current&&!window.confirm(t?`放弃未保存的更改?`:`Discard unsaved changes?`)||(C.current=!1,n(`/settings/agent-defaults`))},L=(0,B.useCallback)(e=>{C.current=e},[]);return e?s&&!o?(0,V.jsxs)(R,{children:[(0,V.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(s)}),(0,V.jsx)(y,{onClick:()=>void l(),children:t?`重试`:`Retry`})]}):c||!o?(0,V.jsx)(re,{}):(0,V.jsxs)(R,{gap:`gap-5`,className:`max-w-6xl`,padding:`px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(s||x)&&!w?(0,V.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(s)}):null,(0,V.jsx)(Q,{agents:o.agents,busy:_,zh:t,onOpen:k,onChat:O}),w?(0,V.jsx)(te,{agent:w,open:!0,onOpenChange:e=>{e||A()},children:(0,V.jsx)(X,{agent:w,toolIds:o.builtinToolIds,zh:t,externalError:x,onDirtyChange:L,onClose:A,onOpenDefaults:j,onChat:()=>O(w.id),onDelete:()=>void D(w)},w.id)}):null,(0,V.jsx)($,{open:f.open,busy:_,error:x,name:f.name,instructions:f.instructions,zh:t,onNameChange:e=>m(t=>({...t,name:e})),onInstructionsChange:e=>m(t=>({...t,instructions:e})),onCreate:()=>void E(),onOpenChange:e=>{_||(m(t=>({...t,open:e})),e||S(null))}})]}):(0,V.jsx)(R,{children:(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`需要本机服务令牌。`:`Local service token required.`})})}export{ae as AgentsSettingsPanel};
|
|
@@ -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{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-Dj8QuS6e.js";import{a as p,n as m,r as h}from"./locale-store-DFQX9kTl.js";import{t as g}from"./cn-JdwAhgNB.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-B11EPpor.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as S}from"./electron-env-DH5wF8X8.js";import{Ca as C,Fc as w,as as T}from"./index-Dpu7EKTm.js";import{n as E,r as D}from"./settings-page-layout-DYelDcMV.js";import{t as O}from"./settings-loading-skeleton-CAmWMaOT.js";import{r as k,t as A}from"./settings-form-section-YdrdY8B3.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,f]=(0,M.useReducer)(C,L),{info:p,loadError:m,actionError:h,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){f({type:`patch`,patch:{loadError:null}});try{f({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await d(e)){f({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>f({type:`patch`,patch:{copiedField:null}}),2e3);return}f({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(m)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m});if(!p)return(0,N.jsx)(O,{rows:2});let H=!p.packaged,U=j||p.pendingUpdate||H,W=!H&&p.uninstallMode!==`unsupported`,G=I(p,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(w,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,h?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,p.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.appPath,`app`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.dataPath,`data`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(p.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(l,{open:y,onOpenChange:e=>{e||f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>f({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:g(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>f({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(l,{open:D,onOpenChange:e=>{e||f({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>f({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>f({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await p(h(`/api/migrations/status`))).payload}async function B(){await p(h(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=m(U),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let l;return e[24]!==o||e[25]!==s||e[26]!==c?(l=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,e[27]=l):l=e[27],l}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-Dj8QuS6e.js";import{a as p,n as m,r as h}from"./locale-store-DFQX9kTl.js";import{t as g}from"./cn-JdwAhgNB.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-B11EPpor.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as S}from"./electron-env-DH5wF8X8.js";import{Ca as C,Fc as w,as as T}from"./index-Cn__9Un2.js";import{n as E,r as D}from"./settings-page-layout-DYelDcMV.js";import{t as O}from"./settings-loading-skeleton-CAmWMaOT.js";import{r as k,t as A}from"./settings-form-section-BzPIPe1-.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,f]=(0,M.useReducer)(C,L),{info:p,loadError:m,actionError:h,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){f({type:`patch`,patch:{loadError:null}});try{f({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await d(e)){f({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>f({type:`patch`,patch:{copiedField:null}}),2e3);return}f({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(m)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m});if(!p)return(0,N.jsx)(O,{rows:2});let H=!p.packaged,U=j||p.pendingUpdate||H,W=!H&&p.uninstallMode!==`unsupported`,G=I(p,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(w,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,h?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,p.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.appPath,`app`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.dataPath,`data`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(p.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(l,{open:y,onOpenChange:e=>{e||f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>f({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:g(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>f({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(l,{open:D,onOpenChange:e=>{e||f({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>f({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>f({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await p(h(`/api/migrations/status`))).payload}async function B(){await p(h(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=m(U),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let l;return e[24]!==o||e[25]!==s||e[26]!==c?(l=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,e[27]=l):l=e[27],l}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
@@ -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{n as i,r as a}from"./popover-select-CKBYnT3c.js";import{t as o}from"./messages-Dj8QuS6e.js";import{a as s,n as c,r as l}from"./locale-store-DFQX9kTl.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d,r as f}from"./gateway-config-swr-OObCK8jM.js";import{i as p}from"./theme-store-zRT6vaZc.js";import{t as m}from"./skeleton-BwbyijEw.js";import{Br as h,as as g,co as _}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{n as i,r as a}from"./popover-select-CKBYnT3c.js";import{t as o}from"./messages-Dj8QuS6e.js";import{a as s,n as c,r as l}from"./locale-store-DFQX9kTl.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d,r as f}from"./gateway-config-swr-OObCK8jM.js";import{i as p}from"./theme-store-zRT6vaZc.js";import{t as m}from"./skeleton-BwbyijEw.js";import{Br as h,as as g,co as _}from"./index-Cn__9Un2.js";import{n as v,r as y}from"./settings-page-layout-DYelDcMV.js";import{t as b}from"./settings-advanced-gate-3T4rPk4A.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await s(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,o;t[0]===a?o=t[1]:(o=u(`min-w-0`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,E.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:i}),t[4]=i,t[5]=c);let l;t[6]===r?l=t[7]:(l=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=l);let d;return t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==l?(d=(0,E.jsxs)(`section`,{className:o,children:[s,c,l]}),t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(13),t=c(F),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=p(P),a=p(N),s;e[2]===r.colorSchemeTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=s);let l;e[4]!==r||e[5]!==i||e[6]!==a?(l=j.map(e=>{let{value:t,labelKey:n}=e,o=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:()=>a(t),className:u(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,g.pressCard,o?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:u(`text-xs font-medium leading-none`,o?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=l):l=e[7];let d;e[8]===l?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:l}),e[8]=l,e[9]=d);let f;return e[10]!==s||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[s,d]}),e[10]=s,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=c(L),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:l}=f(!0),d=s?.payload?.config,p;e[2]===d?p=e[3]:(p=w(d),e[2]=d,e[3]=p);let h=p,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==l||e[14]!==g||e[15]!==v?(M=l?(0,E.jsx)(m,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=l,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:u(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=c(V),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=h(B),a=h(z),s;e[2]===r.showRawToolDataTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=s);let l;e[4]===r.showRawToolDataDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=l);let u;e[6]!==s||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[s,l]}),e[6]=s,e[7]=l,e[8]=u):u=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[u,f]})}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=c(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(_,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsxs)(D,{children:[(0,E.jsx)(_,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=s):s=e[5];let l;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(R,{}),e[6]=l):l=e[6];let u;e[7]===r.developerGroupTitle?u=e[8]:(u=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:l})}),e[7]=r.developerGroupTitle,e[8]=u);let d;return e[9]!==i||e[10]!==u?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,s,u]}),e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|