botmux 3.6.0 → 3.7.0
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/.runtime-build-id +1 -1
- package/dist/adapters/backend/riff-backend.d.ts +7 -6
- package/dist/adapters/backend/riff-backend.d.ts.map +1 -1
- package/dist/adapters/backend/riff-backend.js +8 -7
- package/dist/adapters/backend/riff-backend.js.map +1 -1
- package/dist/adapters/backend/sandbox.d.ts.map +1 -1
- package/dist/adapters/backend/sandbox.js +5 -2
- package/dist/adapters/backend/sandbox.js.map +1 -1
- package/dist/adapters/cli/codex.d.ts.map +1 -1
- package/dist/adapters/cli/codex.js +15 -6
- package/dist/adapters/cli/codex.js.map +1 -1
- package/dist/adapters/cli/fs-policy.d.ts +62 -6
- package/dist/adapters/cli/fs-policy.d.ts.map +1 -1
- package/dist/adapters/cli/fs-policy.js +70 -7
- package/dist/adapters/cli/fs-policy.js.map +1 -1
- package/dist/bot-registry.d.ts +13 -0
- package/dist/bot-registry.d.ts.map +1 -1
- package/dist/bot-registry.js +15 -7
- package/dist/bot-registry.js.map +1 -1
- package/dist/cli/daemon-lifecycle-env.d.ts +1 -1
- package/dist/cli/daemon-lifecycle-env.d.ts.map +1 -1
- package/dist/cli/daemon-lifecycle-env.js +12 -0
- package/dist/cli/daemon-lifecycle-env.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -7
- package/dist/cli.js.map +1 -1
- package/dist/core/command-handler.d.ts +7 -5
- package/dist/core/command-handler.d.ts.map +1 -1
- package/dist/core/command-handler.js +37 -21
- package/dist/core/command-handler.js.map +1 -1
- package/dist/core/cost-calculator.d.ts +3 -0
- package/dist/core/cost-calculator.d.ts.map +1 -1
- package/dist/core/cost-calculator.js.map +1 -1
- package/dist/core/dashboard-ipc-server.d.ts.map +1 -1
- package/dist/core/dashboard-ipc-server.js +12 -9
- package/dist/core/dashboard-ipc-server.js.map +1 -1
- package/dist/core/dashboard-rows.d.ts.map +1 -1
- package/dist/core/dashboard-rows.js +1 -0
- package/dist/core/dashboard-rows.js.map +1 -1
- package/dist/core/initial-user-turn.d.ts +14 -0
- package/dist/core/initial-user-turn.d.ts.map +1 -0
- package/dist/core/initial-user-turn.js +65 -0
- package/dist/core/initial-user-turn.js.map +1 -0
- package/dist/core/maintenance.d.ts.map +1 -1
- package/dist/core/maintenance.js +6 -0
- package/dist/core/maintenance.js.map +1 -1
- package/dist/core/per-bot-env.d.ts.map +1 -1
- package/dist/core/per-bot-env.js +10 -0
- package/dist/core/per-bot-env.js.map +1 -1
- package/dist/core/plugins/pm2.d.ts.map +1 -1
- package/dist/core/plugins/pm2.js +4 -0
- package/dist/core/plugins/pm2.js.map +1 -1
- package/dist/core/session-discovery.d.ts +23 -0
- package/dist/core/session-discovery.d.ts.map +1 -1
- package/dist/core/session-discovery.js +162 -82
- package/dist/core/session-discovery.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +23 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/worker-pool.d.ts +2 -0
- package/dist/core/worker-pool.d.ts.map +1 -1
- package/dist/core/worker-pool.js +27 -4
- package/dist/core/worker-pool.js.map +1 -1
- package/dist/daemon.d.ts +18 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +205 -39
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/bot-onboarding.d.ts.map +1 -1
- package/dist/dashboard/bot-onboarding.js +29 -5
- package/dist/dashboard/bot-onboarding.js.map +1 -1
- package/dist/dashboard/bot-payload.js +3 -3
- package/dist/dashboard/bot-payload.js.map +1 -1
- package/dist/dashboard/web/bot-defaults-page.js +5 -5
- package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
- package/dist/dashboard/web/bot-onboarding.d.ts.map +1 -1
- package/dist/dashboard/web/bot-onboarding.js +1 -1
- package/dist/dashboard/web/bot-onboarding.js.map +1 -1
- package/dist/dashboard/web/i18n.js +18 -18
- package/dist/dashboard/web/i18n.js.map +1 -1
- package/dist/dashboard-web/app.js +1 -1
- package/dist/dashboard-web/chunks/{bot-defaults-page-VQMPUJ4Y.js → bot-defaults-page-UKA7K4JV.js} +2 -2
- package/dist/dashboard-web/chunks/{chunk-NP4JUBGS.js → chunk-3QAUJXAS.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-JMRGZQDB.js → chunk-FLGXZJTD.js} +1 -1
- package/dist/dashboard-web/chunks/chunk-FNPGOZMX.js +1 -0
- package/dist/dashboard-web/chunks/{chunk-SNKATZWK.js → chunk-KQB42ML5.js} +4 -4
- package/dist/dashboard-web/chunks/{connectors-page-DOY4J3ZL.js → connectors-page-A77YAB5Y.js} +1 -1
- package/dist/dashboard-web/chunks/{groups-page-74TS2DIH.js → groups-page-RUZNVXQB.js} +1 -1
- package/dist/dashboard-web/chunks/{insights-page-AYCO65JC.js → insights-page-RF7U7RTA.js} +1 -1
- package/dist/dashboard-web/chunks/{monitor-room-YKYLTSAN.js → monitor-room-7IVIS75W.js} +1 -1
- package/dist/dashboard-web/chunks/{monitoring-page-QBIUNRBR.js → monitoring-page-5SSJRQZF.js} +1 -1
- package/dist/dashboard-web/chunks/{office-page-4PH2A26P.js → office-page-EOND3L5D.js} +1 -1
- package/dist/dashboard-web/chunks/{overview-page-H73D5UT4.js → overview-page-NISBVBBJ.js} +1 -1
- package/dist/dashboard-web/chunks/{roles-page-U4BTOQ7F.js → roles-page-BUMKD7Y4.js} +1 -1
- package/dist/dashboard-web/chunks/{schedules-page-RHRHX7R7.js → schedules-page-AVOOKLUH.js} +1 -1
- package/dist/dashboard-web/chunks/{sessions-page-VSC6AM5G.js → sessions-page-6HLSEAB7.js} +2 -2
- package/dist/dashboard-web/chunks/{settings-page-LF3RKM5P.js → settings-page-MJDZHQ4X.js} +1 -1
- package/dist/dashboard-web/chunks/{skills-page-SYOIGGXH.js → skills-page-5MW54PCC.js} +1 -1
- package/dist/dashboard-web/chunks/{team-federation-page-RMBLASTW.js → team-federation-page-2SNIMVXI.js} +1 -1
- package/dist/dashboard-web/chunks/{v3-page-XJXKKJRN.js → v3-page-W6SBXXQC.js} +1 -1
- package/dist/dashboard-web/chunks/{whiteboards-page-K3YVSTHJ.js → whiteboards-page-STC54KTP.js} +1 -1
- package/dist/dashboard-web/style.css +5 -0
- package/dist/dashboard.js +2 -2
- package/dist/dashboard.js.map +1 -1
- package/dist/desktop/main/dashboard-compat.js +1 -1
- package/dist/i18n/en.js +6 -6
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/zh.js +6 -6
- package/dist/i18n/zh.js.map +1 -1
- package/dist/im/lark/card-builder.d.ts.map +1 -1
- package/dist/im/lark/card-builder.js +5 -4
- package/dist/im/lark/card-builder.js.map +1 -1
- package/dist/im/lark/card-handler.d.ts.map +1 -1
- package/dist/im/lark/card-handler.js +40 -7
- package/dist/im/lark/card-handler.js.map +1 -1
- package/dist/im/lark/client.d.ts.map +1 -1
- package/dist/im/lark/client.js +82 -1
- package/dist/im/lark/client.js.map +1 -1
- package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
- package/dist/im/lark/event-dispatcher.js +46 -12
- package/dist/im/lark/event-dispatcher.js.map +1 -1
- package/dist/im/lark/relay-target-routing.d.ts.map +1 -1
- package/dist/im/lark/relay-target-routing.js +12 -11
- package/dist/im/lark/relay-target-routing.js.map +1 -1
- package/dist/im/lark/reply-mode-command.d.ts.map +1 -1
- package/dist/im/lark/reply-mode-command.js +4 -3
- package/dist/im/lark/reply-mode-command.js.map +1 -1
- package/dist/index-daemon.js +6 -1
- package/dist/index-daemon.js.map +1 -1
- package/dist/mir-runner.js +1 -1
- package/dist/mir-runner.js.map +1 -1
- package/dist/services/bot-config-store.d.ts +1 -1
- package/dist/services/bot-config-store.d.ts.map +1 -1
- package/dist/services/bot-config-store.js +1 -1
- package/dist/services/bot-config-store.js.map +1 -1
- package/dist/services/card-prefs-store.js +8 -8
- package/dist/services/card-prefs-store.js.map +1 -1
- package/dist/services/chat-reply-mode-store.d.ts.map +1 -1
- package/dist/services/chat-reply-mode-store.js +16 -11
- package/dist/services/chat-reply-mode-store.js.map +1 -1
- package/dist/services/insight/types.d.ts +3 -1
- package/dist/services/insight/types.d.ts.map +1 -1
- package/dist/services/insight/types.js.map +1 -1
- package/dist/services/project-scanner.d.ts +4 -4
- package/dist/services/project-scanner.d.ts.map +1 -1
- package/dist/services/project-scanner.js +13 -5
- package/dist/services/project-scanner.js.map +1 -1
- package/dist/services/transcript-resolver.d.ts +4 -0
- package/dist/services/transcript-resolver.d.ts.map +1 -1
- package/dist/services/transcript-resolver.js +53 -5
- package/dist/services/transcript-resolver.js.map +1 -1
- package/dist/services/usage-ledger.d.ts.map +1 -1
- package/dist/services/usage-ledger.js +1 -0
- package/dist/services/usage-ledger.js.map +1 -1
- package/dist/setup/bot-config-editor.d.ts +37 -1
- package/dist/setup/bot-config-editor.d.ts.map +1 -1
- package/dist/setup/bot-config-editor.js +61 -3
- package/dist/setup/bot-config-editor.js.map +1 -1
- package/dist/setup/setup-args.js +1 -1
- package/dist/setup/setup-args.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/allowed-users-apply.d.ts.map +1 -1
- package/dist/utils/allowed-users-apply.js +3 -2
- package/dist/utils/allowed-users-apply.js.map +1 -1
- package/dist/utils/child-env.d.ts +31 -2
- package/dist/utils/child-env.d.ts.map +1 -1
- package/dist/utils/child-env.js +61 -3
- package/dist/utils/child-env.js.map +1 -1
- package/dist/utils/file-lock.d.ts +10 -0
- package/dist/utils/file-lock.d.ts.map +1 -1
- package/dist/utils/file-lock.js +295 -53
- package/dist/utils/file-lock.js.map +1 -1
- package/dist/worker.js +52 -3
- package/dist/worker.js.map +1 -1
- package/dist/workflows/v3/run-envelope.d.ts +24 -24
- package/package.json +1 -1
- package/dist/dashboard-web/chunks/chunk-P327LXOT.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as we,c as k}from"./chunk-JMRGZQDB.js";import{a as H,c as ce,i as Ie,k as M,p as I}from"./chunk-QFMH6ITB.js";import{a as ve,t as he}from"./chunk-SNKATZWK.js";import{a as Me}from"./chunk-SYC6D5XU.js";import{a as xe,d as re}from"./chunk-5THX4DI2.js";import{c as Y}from"./chunk-7SZRL6FY.js";var p=Y(xe(),1);var h=Y(xe(),1);var a=Y(re(),1),Le=["transcript_received","chat_received","participant_joined","participant_left","magic_share_started","magic_share_ended"],be=8e3,Ue=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,Ee="\u6301\u7EED\u6574\u7406\u4F1A\u8BAE\u7EAA\u8981\uFF0C\u91CD\u70B9\u8BB0\u5F55\u5DF2\u786E\u8BA4\u7684\u51B3\u7B56\u3001\u5F85\u529E\u4E8B\u9879\uFF08\u542B\u8D1F\u8D23\u4EBA\u548C\u622A\u6B62\u65F6\u95F4\uFF09\u4EE5\u53CA\u672A\u89E3\u51B3\u98CE\u9669\uFF1B\u5B57\u5E55\u4FEE\u8BA2\u65F6\u66F4\u65B0\u5DF2\u6709\u6761\u76EE\uFF0C\u4E0D\u91CD\u590D\u8BB0\u5F55\u540C\u4E00\u4E8B\u9879\u3002\u4EC5\u5728\u51FA\u73B0\u65B0\u7684\u5173\u952E\u51B3\u7B56\u3001\u660E\u786E\u5F85\u529E\u6216\u98CE\u9669\uFF0C\u6216\u88AB\u7528\u6237\u70B9\u540D\u65F6\uFF0C\u624D\u5728\u76D1\u542C\u7FA4\u8F93\u51FA\u7B80\u6D01\u589E\u91CF\uFF1B\u65E0\u5B9E\u8D28\u589E\u91CF\u65F6\u4FDD\u6301\u9759\u9ED8\uFF0C\u4E0D\u53D1\u9001\u786E\u8BA4\u6216\u5FC3\u8DF3\u3002\u9700\u8981\u5411\u4F1A\u8BAE\u5185\u53D1\u9001\u6587\u5B57\u6216\u8BED\u97F3\u65F6\uFF0C\u5FC5\u987B\u901A\u8FC7 botmux \u53D7\u7BA1 request-output/action gate \u63D0\u4EA4\uFF0C\u4E0D\u5F97\u7ED5\u8FC7\u6743\u9650\u3001\u6240\u6709\u6743\u4E0E\u5BA1\u6838\u7B56\u7565\u3002",Ae=0;function Ne(){return Ae+=1,`p${Ae}`}function Oe(e){return{...e,listenerPlacement:e.listenerPlacement??"auto",uiKey:Ne(),isNew:!1}}function _e(e){let{uiKey:t,isNew:i,...r}=e;return r}function K(e){return(0,a.jsxs)("span",{className:"vc-profile-field-head",children:[e.title,(0,a.jsx)(Ie,{label:e.title,children:(0,a.jsx)("span",{className:"vc-profile-help",children:e.help})})]})}function Re(e){let t=k(),i=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let r=i.current;if(!(!r||r.open))try{r.showModal()}catch{r.setAttribute("open","")}},[]),(0,a.jsxs)("dialog",{ref:i,className:["vc-profile-dialog",e.className].filter(Boolean).join(" "),onClose:e.onClose,onCancel:r=>{r.preventDefault(),e.onClose()},children:[(0,a.jsxs)("header",{className:"vc-profile-dialog-head",children:[(0,a.jsxs)("div",{children:[e.eyebrow?(0,a.jsx)("span",{children:e.eyebrow}):null,(0,a.jsx)("h3",{children:e.title})]}),(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-close","aria-label":t("settings.vcProfiles.close"),onClick:e.onClose})]}),(0,a.jsx)("div",{className:"vc-profile-dialog-body",children:e.children})]})}function Be(e){let t=k();return e.enabled?e.canWrite?(0,a.jsx)($e,{canWrite:e.canWrite,listenerBotAppId:e.listenerBotAppId,listenerBotOptions:e.listenerBotOptions}):(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.needAuth")}):null}function $e(e){let t=k(),i=we(),r=(0,h.useRef)(!1),g=e.listenerBotOptions,[f,v]=(0,h.useState)(e.listenerBotAppId??g[0]?.larkAppId??""),[u,N]=(0,h.useState)(null),[S,b]=(0,h.useState)(null),[B,C]=(0,h.useState)(!1),[L,$]=(0,h.useState)(!1),[w,d]=(0,h.useState)(!1),[m,P]=(0,h.useState)(!1),[j,A]=(0,h.useState)({}),[de,z]=(0,h.useState)(!1),[ne,O]=(0,h.useState)(null),[ie,W]=(0,h.useState)(null);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let G=(0,h.useRef)(0);(0,h.useEffect)(()=>{e.listenerBotAppId&&e.listenerBotAppId!==f&&!L&&v(e.listenerBotAppId)},[L,e.listenerBotAppId,f]);let Z=(0,h.useCallback)(async l=>{let s=++G.current;if(N(null),$(!1),P(!1),A({}),O(null),W(null),!l){b(null);return}C(!0);try{let o=await fetch(`/api/vc-meeting/consumer-profiles?listenerBotAppId=${encodeURIComponent(l)}`),c=await o.json().catch(()=>({}));if(!r.current||G.current!==s)return;!o.ok||c?.ok!==!0?(N(null),b(typeof c?.error=="string"?c.error:`HTTP ${o.status}`)):(N({forBot:l,revision:c.revision,catalogState:c.catalogState==="explicit_empty"||c.catalogState==="legacy_or_partial"||c.catalogState==="profiles"?c.catalogState:"uninitialized",defaultMode:c.defaultMode==="agents"?"agents":"listenOnly",defaultConsumerIds:Array.isArray(c.defaultConsumerIds)?c.defaultConsumerIds:[],profiles:(Array.isArray(c.profiles)?c.profiles:[]).map(Oe),agentOptions:Array.isArray(c.agentOptions)?c.agentOptions:[],templateCatalog:c.templateCatalog?.schemaVersion===1&&Array.isArray(c.templateCatalog.templates)?c.templateCatalog:{schemaVersion:1,templates:[]},...c.migrationOffer==="enable_seeded_minutes_default"?{migrationOffer:c.migrationOffer}:{}}),b(null),$(!1))}catch(o){if(!r.current||G.current!==s)return;N(null),b(o instanceof Error?o.message:String(o))}finally{r.current&&G.current===s&&C(!1)}},[]);(0,h.useEffect)(()=>{Z(f)},[Z,f]);let T=(0,h.useCallback)(l=>{N(s=>s&&l(s)),$(!0),z(!1)},[]),ae=(0,h.useCallback)((l,s)=>{T(o=>({...o,profiles:o.profiles.map(c=>c.uiKey===l?{...c,...s}:c)}))},[T]),ue=(0,h.useCallback)(async()=>{if(!u||w||B||!u.forBot||u.forBot!==f)return;let l={};if(u.profiles.forEach((s,o)=>{Ue.test(s.id)||(l[`profiles[${o}].id`]=t("settings.vcProfiles.idInvalid")),(s.instructions??"").length>be&&(l[`profiles[${o}].instructions`]=t("settings.vcProfiles.instructionsTooLong"))}),Object.keys(l).length>0){A(l);return}d(!0),P(!1),A({});try{let s=await fetch("/api/vc-meeting/consumer-profiles",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({listenerBotAppId:u.forBot,expectedRevision:u.revision,defaultMode:u.defaultMode,defaultConsumerIds:u.defaultConsumerIds,profiles:u.profiles.map(_e)})}),o=await s.json().catch(()=>({}));if(!r.current||u.forBot!==f)return;if(s.status===409){P(!0);return}if(s.status===422){let c={};for(let y of Array.isArray(o?.fieldErrors)?o.fieldErrors:[])typeof y?.path=="string"&&typeof y?.message=="string"&&(c[y.path]=y.message);A(Object.keys(c).length>0?c:{profiles:t("settings.vcProfiles.validationFailed")});return}if(!s.ok||o?.ok!==!0){A({profiles:typeof o?.error=="string"?o.error:`HTTP ${s.status}`});return}N({forBot:u.forBot,revision:o.revision,catalogState:o.catalogState==="explicit_empty"||o.catalogState==="legacy_or_partial"||o.catalogState==="profiles"?o.catalogState:"uninitialized",defaultMode:o.defaultMode==="agents"?"agents":"listenOnly",defaultConsumerIds:Array.isArray(o.defaultConsumerIds)?o.defaultConsumerIds:[],profiles:(Array.isArray(o.profiles)?o.profiles:[]).map(Oe),agentOptions:Array.isArray(o.agentOptions)?o.agentOptions:[],templateCatalog:o.templateCatalog?.schemaVersion===1&&Array.isArray(o.templateCatalog.templates)?o.templateCatalog:{schemaVersion:1,templates:[]},...o.migrationOffer==="enable_seeded_minutes_default"?{migrationOffer:o.migrationOffer}:{}}),$(!1),z(!0)}catch(s){if(!r.current)return;A({profiles:s instanceof Error?s.message:String(s)})}finally{r.current&&d(!1)}},[u,w,f,t]),Q=(0,h.useMemo)(()=>g.map(l=>({value:l.larkAppId,label:l.botName||l.larkAppId})),[g]),ge=Q.find(l=>l.value===f)?.label??f,U=(0,h.useMemo)(()=>u?u.agentOptions.map(l=>{let s=[l.online?void 0:t("settings.vcProfiles.agentOffline"),l.workingDirReady?void 0:t("settings.vcProfiles.agentNoWorkingDir"),l.reliableTurnTerminal?void 0:t("settings.vcProfiles.agentNoReliableTerminal"),l.managedSideEffectIsolation?void 0:t("settings.vcProfiles.agentNoManagedIsolation")].filter(Boolean);return{value:l.appId,label:(0,a.jsxs)("span",{className:"vc-agent-option",children:[(0,a.jsxs)("span",{className:"vc-agent-option-name",children:[l.label,l.cliId?(0,a.jsx)("em",{className:"vc-agent-option-cli",children:l.cliId}):null]}),s.length>0?(0,a.jsxs)("span",{className:"vc-agent-option-warn",children:["\u26A0 ",s.join(" \xB7 ")]}):null]})}}):[],[u,t]),fe=l=>{let s=u?.agentOptions.find(c=>c.appId===l);return s?!s.online||!s.workingDirReady||!s.reliableTurnTerminal||!s.managedSideEffectIsolation?`\u26A0 ${s.label}`:s.label:l},R=(0,h.useCallback)(l=>{let o=["observe_only","meeting_text","meeting_voice","meeting_text_voice"].map(c=>({value:c,label:t(`settings.vcProfiles.preset.${c}`)}));return(!l.isNew||l.permissionPreset==="custom")&&o.push({value:"custom",label:t("settings.vcProfiles.preset.custom")}),o},[t]),se=(0,h.useCallback)(()=>{let l=Ne();T(s=>({...s,profiles:[...s.profiles,{uiKey:l,isNew:!0,id:"",agentAppId:s.agentOptions[0]?.appId??"",responseMode:"silent",listenerPlacement:"auto",permissionPreset:"observe_only"}]})),O(l)},[T]),le=(0,h.useCallback)(l=>{let s=Ne();T(o=>{let c=new Set(o.profiles.map(x=>x.id)),y=l.suggestedProfileId;for(let x=2;c.has(y);x+=1)y=`${l.suggestedProfileId.slice(0,60)}-${x}`;return{...o,profiles:[...o.profiles,{uiKey:s,isNew:!0,id:y,label:l.profileLabel[i],agentAppId:o.agentOptions[0]?.appId??"",instructions:l.instructions[i],activityTypes:[...l.activityTypes],responseMode:l.responseMode,listenerPlacement:l.listenerPlacement,permissionPreset:l.permissionPreset}]}}),W(null),O(s)},[i,T]),J=(0,h.useCallback)(l=>{T(s=>({...s,profiles:s.profiles.filter(o=>o.uiKey!==l),defaultConsumerIds:s.defaultConsumerIds.filter(o=>s.profiles.some(c=>c.uiKey!==l&&c.id===o))})),O(s=>s===l?null:s)},[T]);if(g.length===0)return null;let V=l=>j[l],q=!e.canWrite||w||B,pe=u?.agentOptions.some(l=>l.workingDirReady&&l.reliableTurnTerminal&&l.managedSideEffectIsolation)??!1,ee=u?.profiles.findIndex(l=>l.uiKey===ne)??-1,E=ee>=0?u?.profiles[ee]??null:null,te=u?.templateCatalog.templates.find(l=>l.templateId===ie)??null,Se=(l,s)=>{l.id&&T(o=>{let c=s?[...new Set([...o.defaultConsumerIds,l.id])]:o.defaultConsumerIds.filter(y=>y!==l.id);return{...o,defaultMode:c.length>0?"agents":"listenOnly",defaultConsumerIds:c}})};return(0,a.jsxs)("div",{className:"vc-profiles-section",children:[(0,a.jsxs)("div",{className:"settings-field-row",children:[(0,a.jsx)(M,{help:t("settings.vcProfiles.help"),children:t("settings.vcProfiles.title")}),e.listenerBotAppId===null&&Q.length>1?(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.listenerOwner")}),(0,a.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.vcProfiles.listenerOwner"),disabled:B||w,value:f,label:H(Q,f),options:Q,onChange:l=>{l!==f&&(L&&!window.confirm(t("settings.vcProfiles.discardConfirm"))||v(l))}})]}):(0,a.jsx)("span",{className:"vc-profile-config-target",children:t("settings.vcProfiles.configuringBot",{bot:ge})})]}),(0,a.jsx)("p",{className:"hint vc-profiles-freeze",children:t("settings.vcProfiles.freezeNotice")}),B?(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.loading")}):null,S?(0,a.jsx)("p",{className:"hint-warn",children:S==="bot_not_in_config"?t("settings.vcProfiles.botNotInConfig"):`${t("settings.vcProfiles.loadFailed")}: ${S}`}):null,m?(0,a.jsxs)("p",{className:"hint-warn",children:[t("settings.vcProfiles.conflict")," ",(0,a.jsx)("button",{type:"button",className:"vc-profiles-link",onClick:()=>{Z(f)},children:t("settings.vcProfiles.reload")})]}):null,V("profiles")?(0,a.jsx)("p",{className:"hint-warn",children:V("profiles")}):null,u?(0,a.jsxs)(a.Fragment,{children:[u.migrationOffer==="enable_seeded_minutes_default"?(0,a.jsxs)("p",{className:"hint-warn vc-profile-migration-offer",children:[t("settings.vcProfiles.migrationOffer")," ",(0,a.jsx)("button",{type:"button",className:"vc-profiles-link",disabled:q||L,onClick:()=>T(l=>({...l,defaultMode:"agents",defaultConsumerIds:["minutes"],profiles:l.profiles.map(s=>s.id==="minutes"?{...s,instructions:Ee,responseMode:"listener_thread",permissionPreset:"meeting_text_voice"}:s),migrationOffer:void 0})),children:t("settings.vcProfiles.migrationEnable")})]}):null,u.catalogState==="uninitialized"&&u.profiles.length===0&&!pe?(0,a.jsx)("p",{className:"hint-warn",children:t("settings.vcProfiles.noEligibleDefaultAgent")}):null,u.catalogState==="legacy_or_partial"?(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.legacyCatalog")}):null,(0,a.jsxs)("section",{className:"vc-profile-library-section",children:[(0,a.jsxs)("div",{className:"vc-profile-list-heading",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.list.title")}),(0,a.jsx)("p",{children:t("settings.vcProfiles.list.help")})]}),e.canWrite?(0,a.jsx)("button",{type:"button",className:"vc-profiles-link vc-profile-add",disabled:w||B,onClick:se,children:t("settings.vcProfiles.add")}):null]}),u.profiles.length>0?(0,a.jsx)("div",{className:"vc-profile-card-grid",children:u.profiles.map(l=>{let s=u.agentOptions.find(c=>c.appId===l.agentAppId),o=u.defaultMode==="agents"&&u.defaultConsumerIds.includes(l.id);return(0,a.jsxs)("article",{className:"vc-profile-summary-card",role:"button",tabIndex:0,onClick:()=>O(l.uiKey),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),O(l.uiKey))},children:[(0,a.jsxs)("div",{className:"vc-profile-summary-top",children:[(0,a.jsx)("span",{className:"vc-profile-summary-icon","aria-hidden":"true",children:(l.label||l.id||"?").slice(0,1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:l.label||l.id||t("settings.vcProfiles.untitled")}),(0,a.jsx)("code",{children:l.id||t("settings.vcProfiles.newBadge")})]}),l.isNew?(0,a.jsx)("em",{children:t("settings.vcProfiles.newBadge")}):null]}),(0,a.jsx)("p",{children:(l.instructions??"").trim()||t("settings.vcProfiles.noInstructions")}),(0,a.jsxs)("div",{className:"vc-profile-summary-meta",children:[(0,a.jsx)("span",{children:s?.label??l.agentAppId}),(0,a.jsx)("span",{children:l.responseMode==="listener_thread"?t("settings.vcProfiles.responseListener"):t("settings.vcProfiles.responseSilent")})]}),(0,a.jsxs)("label",{className:"vc-profile-default-toggle",onClick:c=>c.stopPropagation(),children:[(0,a.jsx)("input",{type:"checkbox",checked:o,disabled:q||!l.id,onChange:c=>Se(l,c.currentTarget.checked)}),(0,a.jsx)("span",{children:t("settings.vcProfiles.setDefault")})]})]},l.uiKey)})}):(0,a.jsx)("p",{className:"vc-profile-empty",children:t("settings.vcProfiles.list.empty")})]}),u.templateCatalog.templates.length>0?(0,a.jsxs)("section",{className:"vc-profile-template-catalog",children:[(0,a.jsxs)("div",{className:"vc-profile-template-heading",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.templates.title")}),(0,a.jsx)("p",{children:t("settings.vcProfiles.templates.help")})]}),(0,a.jsx)("span",{children:t("settings.vcProfiles.templates.builtinBadge")})]}),(0,a.jsx)("div",{className:"vc-profile-template-grid",children:u.templateCatalog.templates.map(l=>(0,a.jsxs)("button",{type:"button",className:"vc-profile-template-card",onClick:()=>W(l.templateId),children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"\u2726"}),(0,a.jsx)("strong",{children:l.title[i]}),(0,a.jsx)("p",{children:l.description[i]}),(0,a.jsxs)("em",{children:[t("settings.vcProfiles.viewDetails")," \u2192"]})]},`${l.templateId}@${l.version}`))})]}):null,(0,a.jsxs)("div",{className:"settings-field-row vc-profile-default-mode-row",children:[(0,a.jsx)(M,{help:t("settings.vcProfiles.defaultModeHelp"),children:t("settings.vcProfiles.defaultMode")}),(0,a.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.vcProfiles.defaultMode"),disabled:q,value:u.defaultMode,label:u.defaultMode==="agents"?t("settings.vcProfiles.defaultModeAgents"):t("settings.vcProfiles.defaultModeListenOnly"),options:[{value:"listenOnly",label:t("settings.vcProfiles.defaultModeListenOnly")},{value:"agents",label:t("settings.vcProfiles.defaultModeAgents")}],onChange:l=>T(s=>({...s,defaultMode:l==="agents"?"agents":"listenOnly"}))})]}),V("defaultConsumerIds")?(0,a.jsx)("em",{className:"vc-profile-err",children:V("defaultConsumerIds")}):null,V("defaultMode")?(0,a.jsx)("em",{className:"vc-profile-err",children:V("defaultMode")}):null,e.canWrite?(0,a.jsxs)("div",{className:"vc-profiles-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profiles-save",disabled:!L||w||m,onClick:()=>{ue()},children:t(w?"settings.vcProfiles.saving":"settings.vcProfiles.save")}),de?(0,a.jsx)("span",{className:"vc-profile-hint",children:t("settings.vcProfiles.saved")}):null,L&&!w?(0,a.jsx)("span",{className:"vc-profile-hint",children:t("settings.vcProfiles.unsaved")}):null]}):null,E?(0,a.jsx)(Ve,{profile:E,index:ee,frozen:q,canWrite:e.canWrite,agentOptions:U,agentLabel:fe(E.agentAppId),presetOptions:R(E),error:V,onClose:()=>O(null),onUpdate:l=>ae(E.uiKey,l),onIdChange:l=>{let s=E.id;T(o=>({...o,profiles:o.profiles.map(c=>c.uiKey===E.uiKey?{...c,id:l}:c),defaultConsumerIds:o.defaultConsumerIds.map(c=>c===s&&s?l:c).filter(Boolean)}))},onRemove:()=>J(E.uiKey)}):null,te?(0,a.jsx)(He,{template:te,locale:i,disabled:q||u.agentOptions.length===0,onClose:()=>W(null),onUse:()=>le(te)}):null]}):null]})}function Ve(e){let t=k(),{profile:i,index:r}=e;return(0,a.jsxs)(Re,{className:"vc-profile-editor-dialog",eyebrow:t("settings.vcProfiles.list.title"),title:i.label||i.id||t("settings.vcProfiles.untitled"),onClose:e.onClose,children:[(0,a.jsxs)("div",{className:"vc-profile-grid",children:[(0,a.jsxs)("label",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldId"),help:t("settings.vcProfiles.idHelp")})}),(0,a.jsx)("input",{type:"text",value:i.id,disabled:e.frozen||!i.isNew,placeholder:"minutes",onChange:g=>e.onIdChange(g.currentTarget.value)}),e.error(`profiles[${r}].id`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].id`)}):null]}),(0,a.jsxs)("label",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldLabel"),help:t("settings.vcProfiles.labelHelp")})}),(0,a.jsx)("input",{type:"text",value:i.label??"",disabled:e.frozen,onChange:g=>e.onUpdate({label:g.currentTarget.value||void 0})}),e.error(`profiles[${r}].label`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].label`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldAgent"),help:t("settings.vcProfiles.agentHelp")})}),(0,a.jsx)(I,{className:"vc-profile-agent-menu",ariaLabel:t("settings.vcProfiles.fieldAgent"),disabled:e.frozen,value:i.agentAppId,label:e.agentLabel,options:e.agentOptions,onChange:g=>e.onUpdate({agentAppId:g})}),e.error(`profiles[${r}].agentAppId`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].agentAppId`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldResponseMode"),help:t("settings.vcProfiles.responseModeHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldResponseMode"),disabled:e.frozen,value:i.responseMode,label:i.responseMode==="listener_thread"?t("settings.vcProfiles.responseListener"):t("settings.vcProfiles.responseSilent"),options:[{value:"silent",label:t("settings.vcProfiles.responseSilent")},{value:"listener_thread",label:t("settings.vcProfiles.responseListener")}],onChange:g=>e.onUpdate({responseMode:g})}),e.error(`profiles[${r}].responseMode`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].responseMode`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldListenerPlacement"),help:t("settings.vcProfiles.listenerPlacementHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldListenerPlacement"),disabled:e.frozen||i.responseMode==="silent",value:i.listenerPlacement??"auto",label:t(`settings.vcProfiles.listenerPlacement.${i.listenerPlacement??"auto"}`),options:["auto","chat","topic"].map(g=>({value:g,label:t(`settings.vcProfiles.listenerPlacement.${g}`)})),onChange:g=>e.onUpdate({listenerPlacement:g})}),e.error(`profiles[${r}].listenerPlacement`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].listenerPlacement`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldPreset"),help:t("settings.vcProfiles.presetHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldPreset"),disabled:e.frozen,value:i.permissionPreset,label:H(e.presetOptions,i.permissionPreset),options:e.presetOptions,onChange:g=>e.onUpdate({permissionPreset:g})}),e.error(`profiles[${r}].permissionPreset`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].permissionPreset`)}):null]})]}),(0,a.jsxs)("label",{className:"vc-profile-field vc-profile-instructions",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldInstructions"),help:t("settings.vcProfiles.instructionsHelp")}),(0,a.jsxs)("em",{className:"vc-profile-count",children:[(i.instructions??"").length,"/",be]})]}),(0,a.jsx)("textarea",{rows:7,maxLength:be,value:i.instructions??"",disabled:e.frozen,placeholder:t("settings.vcProfiles.instructionsPlaceholder"),onChange:g=>e.onUpdate({instructions:g.currentTarget.value||void 0})}),e.error(`profiles[${r}].instructions`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].instructions`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldActivityTypes"),help:t("settings.vcProfiles.activityHelp")})}),(0,a.jsx)("div",{className:"vc-profile-activity",children:Le.map(g=>{let f=i.activityTypes?.includes(g)??!1;return(0,a.jsxs)("label",{className:"vc-profile-check",children:[(0,a.jsx)("input",{type:"checkbox",checked:f,disabled:e.frozen,onChange:v=>{let u=new Set(i.activityTypes??[]);v.currentTarget.checked?u.add(g):u.delete(g),e.onUpdate({activityTypes:u.size>0?[...u]:void 0})}}),t(`settings.vcProfiles.activity.${g}`)]},g)})}),(0,a.jsx)("em",{className:"vc-profile-hint",children:t("settings.vcProfiles.activityAllHint")}),e.error(`profiles[${r}].activityTypes`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].activityTypes`)}):null]}),e.canWrite?(0,a.jsxs)("footer",{className:"vc-profile-dialog-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profiles-link vc-profile-remove",disabled:e.frozen,onClick:e.onRemove,children:t("settings.vcProfiles.remove")}),(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-done",onClick:e.onClose,children:t("settings.vcProfiles.done")})]}):null]})}function He(e){let t=k(),i=e.template;return(0,a.jsxs)(Re,{className:"vc-profile-template-dialog",eyebrow:t("settings.vcProfiles.templates.title"),title:i.title[e.locale],onClose:e.onClose,children:[(0,a.jsx)("p",{className:"vc-profile-template-description",children:i.description[e.locale]}),(0,a.jsxs)("div",{className:"vc-profile-template-facts",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldResponseMode")}),(0,a.jsx)("strong",{children:t(i.responseMode==="listener_thread"?"settings.vcProfiles.responseListener":"settings.vcProfiles.responseSilent")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldListenerPlacement")}),(0,a.jsx)("strong",{children:t(`settings.vcProfiles.listenerPlacement.${i.listenerPlacement}`)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldPreset")}),(0,a.jsx)("strong",{children:t(`settings.vcProfiles.preset.${i.permissionPreset}`)})]})]}),(0,a.jsxs)("section",{className:"vc-profile-template-prompt",children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.fieldInstructions")}),(0,a.jsx)("p",{children:i.instructions[e.locale]})]}),(0,a.jsxs)("section",{className:"vc-profile-template-events",children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.fieldActivityTypes")}),(0,a.jsx)("div",{children:i.activityTypes.map(r=>(0,a.jsx)("span",{children:t(`settings.vcProfiles.activity.${r}`)},r))})]}),(0,a.jsxs)("footer",{className:"vc-profile-dialog-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-secondary",onClick:e.onClose,children:t("settings.vcProfiles.close")}),(0,a.jsx)("button",{type:"button",className:"vc-profile-template-use",disabled:e.disabled,onClick:e.onUse,children:t("settings.vcProfiles.templates.use")})]})]})}var n=Y(re(),1),ye=["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Asia/Kolkata","UTC","Europe/London","Europe/Paris","Europe/Moscow","America/Los_Angeles","America/New_York","America/Sao_Paulo","Australia/Sydney"];function Fe(e,t){if(!e||typeof e!="object")return null;if(e.failed){let i=e.failed.step==="install"?t("settings.herdrTraexInstallStepInstall"):t("settings.herdrTraexInstallStepAction");return{text:`${t("settings.herdrTraexInstallFailed")}\uFF08${i}\uFF09: ${e.failed.reason??""}`,cls:"hint-warn-inline"}}if(e.skippedReason==="plugin_unsupported"){let i=typeof e.herdrVersion=="string"&&e.herdrVersion?` (${e.herdrVersion})`:"";return{text:`${t("settings.herdrTraexUnsupported")}${i}`,cls:"hint-warn-inline"}}return e.installed||e.actionInvoked?{text:t("settings.herdrTraexInstalled"),cls:"hint-ok"}:e.alreadyInstalled?{text:t("settings.herdrTraexAlreadyInstalled"),cls:"hint-ok"}:null}function Pe(e){return{groupNamePrefix:typeof e?.groupNamePrefix=="string"?e.groupNamePrefix:"",publicReadOnly:e?.publicReadOnly===!0,openTerminalInFeishu:e?.openTerminalInFeishu===!0,enableLocalCliOpen:e?.enableLocalCliOpen===!0,localCliOpenMode:e?.localCliOpenMode==="resume"?"resume":"attach",chatBotDiscovery:e?.chatBotDiscovery!==!1,herdrTraexPlugin:{enabled:e?.herdrTraexPlugin?.enabled===!0,source:typeof e?.herdrTraexPlugin?.source=="string"?e.herdrTraexPlugin.source:"",ref:typeof e?.herdrTraexPlugin?.ref=="string"?e.herdrTraexPlugin.ref:"",recommendedSource:typeof e?.herdrTraexPlugin?.recommendedSource=="string"?e.herdrTraexPlugin.recommendedSource:"",recommendedRef:typeof e?.herdrTraexPlugin?.recommendedRef=="string"?e.herdrTraexPlugin.recommendedRef:""},codexRpcInput:e?.codexRpcInput===!0,codexNotifier:{enabled:e?.codexNotifier?.enabled===!0,targetBotAppId:typeof e?.codexNotifier?.targetBotAppId=="string"?e.codexNotifier.targetBotAppId:null,notifyWhen:e?.codexNotifier?.notifyWhen==="always"?"always":"locked_only",platformSupported:e?.codexNotifier?.platformSupported===!0,hookInstalled:e?.codexNotifier?.hookInstalled===!0,botOptions:Array.isArray(e?.codexNotifier?.botOptions)?e.codexNotifier.botOptions:[],targetDaemonOnline:e?.codexNotifier?.targetDaemonOnline===!0,pendingCount:Number.isSafeInteger(e?.codexNotifier?.pendingCount)?Math.max(0,e.codexNotifier.pendingCount):0,workerOnline:e?.codexNotifier?.workerOnline===!0,lastError:e?.codexNotifier?.lastError&&typeof e.codexNotifier.lastError.message=="string"?e.codexNotifier.lastError:null},vcMeetingAgent:{enabled:e?.vcMeetingAgent?.enabled!==!1,listenerBotAppId:typeof e?.vcMeetingAgent?.listenerBotAppId=="string"?e.vcMeetingAgent.listenerBotAppId:null,listenerBotOptions:Array.isArray(e?.vcMeetingAgent?.listenerBotOptions)?e.vcMeetingAgent.listenerBotOptions:[],larkCliVersion:e?.vcMeetingAgent?.larkCliVersion===void 0?void 0:e.vcMeetingAgent.larkCliVersion??null,larkCliMeetsRequirement:e?.vcMeetingAgent?.larkCliMeetsRequirement===!0,larkCliMinVersion:typeof e?.vcMeetingAgent?.larkCliMinVersion=="string"?e.vcMeetingAgent.larkCliMinVersion:void 0},repoPickerMode:e?.repoPickerMode==="repos"?"repos":"all",maintenance:e?.maintenance&&typeof e.maintenance=="object"?e.maintenance:{},localDevInstall:e?.localDevInstall===!0,autoUpdateSupported:e?.autoUpdateSupported!==!1,whiteboard:{enabled:e?.whiteboard?.enabled===!0},remoteAccess:e?.remoteAccess===!0,scheduleTimeZone:typeof e?.scheduleTimeZone=="string"?e.scheduleTimeZone:"",hostTimeZone:typeof e?.hostTimeZone=="string"&&e.hostTimeZone?e.hostTimeZone:"UTC",effectiveScheduleTimeZone:typeof e?.effectiveScheduleTimeZone=="string"&&e.effectiveScheduleTimeZone?e.effectiveScheduleTimeZone:typeof e?.scheduleTimeZone=="string"&&e.scheduleTimeZone?e.scheduleTimeZone:typeof e?.hostTimeZone=="string"&&e.hostTimeZone?e.hostTimeZone:"UTC"}}function We(e,t){let i=e?.[t]??{};return{enabled:i.enabled===!0,time:typeof i.time=="string"?i.time:"04:00"}}function De(e,t){return t(e==="npm-global"?"update.kindNpm":e==="pnpm-global"?"update.kindPnpm":e==="yarn-global"?"update.kindYarn":e==="bun-global"?"update.kindBun":e==="source-checkout"?"update.kindSource":"update.kindUnknown")}function Ze(){let e=k(),t=(0,p.useRef)(!1),i=(0,p.useRef)(new Set),[r,g]=(0,p.useState)(null),[f,v]=(0,p.useState)(!1),[u,N]=(0,p.useState)(null),[S,b]=(0,p.useState)(!0),[B,C]=(0,p.useState)(!1),[L,$]=(0,p.useState)(null),[w,d]=(0,p.useState)(null),[m,P]=(0,p.useState)(null),[j,A]=(0,p.useState)(null),[de,z]=(0,p.useState)(null),[ne,O]=(0,p.useState)(null),[ie,W]=(0,p.useState)(!1),[G,Z]=(0,p.useState)(!0),[T,ae]=(0,p.useState)(!1),[ue,Q]=(0,p.useState)(""),[ge,U]=(0,p.useState)(!1),[fe,R]=(0,p.useState)(null),se=(0,p.useCallback)(()=>{for(let s of i.current)window.clearTimeout(s);i.current.clear()},[]),le=(0,p.useCallback)((s,o)=>{let c=window.setTimeout(()=>{i.current.delete(c),s()},o);return i.current.add(c),c},[]),J=(0,p.useCallback)(async()=>{try{let s=await fetch("/api/update/status"),o=await s.json().catch(()=>({}));if(!t.current)return;if(!s.ok){A(null),z(o?.error??`HTTP ${s.status}`);return}A(o),z(null)}catch(s){if(!t.current)return;A(null),z(s instanceof Error?s.message:String(s))}},[]),V=(0,p.useCallback)(async()=>{try{let s=await fetch("/api/settings"),o=await s.json().catch(()=>({}));if(!t.current)return;if(!s.ok){g(null),N(o?.error??`HTTP ${s.status}`),v(!0);return}g(Pe(o.settings)),b(o.authed===!0),C(o.bound===!0),N(null),v(!0)}catch(s){if(!t.current)return;g(null),N(s instanceof Error?s.message:String(s)),v(!0)}},[]);(0,p.useEffect)(()=>(t.current=!0,V(),()=>{t.current=!1,se()}),[se,V]),(0,p.useEffect)(()=>{f&&(U(!1),R(null),W(!1),S&&J())},[S,J,f]);async function q(s,o,c){if(!r)return;let y=r;g(c(r)),$(s),d({text:e("settings.saving")});try{let x=await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(o)}),_=await x.json().catch(()=>({}));if(!t.current)return;if(!x.ok||_.ok===!1)throw typeof _?.feishuLoginQr=="string"&&_.feishuLoginQr&&P(_.feishuLoginQr),new Error(_?.error??`HTTP ${x.status}`);P(null);let X=Pe(_.settings);g(X),he.publicReadOnly=X.publicReadOnly,ve.setScheduleTimeZone(X.effectiveScheduleTimeZone);let oe=Fe(_.herdrTraexInstall,e);d(oe??{text:e("settings.saved"),cls:"hint-ok"})}catch(x){if(!t.current)return;let _=!1;try{let oe=await fetch("/api/settings"),Te=await oe.json().catch(()=>({}));if(t.current&&oe.ok&&Te?.settings){let me=Pe(Te.settings);g(me),he.publicReadOnly=me.publicReadOnly,ve.setScheduleTimeZone(me.effectiveScheduleTimeZone),_=!0}}catch{}if(!t.current)return;_||g(y);let X=x instanceof Error?x.message:String(x);d({text:_?`${e("settings.saveReconciled")}: ${X}`:`${e("settings.saveFailed")}: ${X}`,cls:"hint-warn-inline"})}finally{t.current&&$(null)}}async function pe(){O(null),Z(!0),ae(!1);try{let s=await fetch("/api/update/changelog"),o=await s.json().catch(()=>({}));if(!t.current)return;Q(typeof o?.releasesUrl=="string"?o.releasesUrl:""),s.ok?(O(Array.isArray(o.releases)?o.releases:[]),Z(o.ok!==!1),ae(o.rateLimited===!0)):(O([]),Z(!1))}catch{if(!t.current)return;O([]),Z(!1)}}function ee(){let s=Date.now(),o=async()=>{if(t.current){if(Date.now()-s>9e4){U(!1),R({text:e("update.restartSlow"),cls:"hint-warn-inline"});return}try{let c=await fetch("/__health",{cache:"no-store"});if(!t.current)return;if(c.ok){location.reload();return}}catch{}t.current&&le(()=>{o()},2e3)}};le(()=>{o()},3e3)}async function E(s){U(!0),R({text:e("update.restarting")});try{let o=await fetch("/api/update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s?{update:s}:{})}),c=await o.json().catch(()=>({}));if(!o.ok||c.ok===!1)throw new Error(String(c.detail??c.error??`HTTP ${o.status}`));if(!t.current)return}catch(o){if(!t.current)return;U(!1),R({text:e("update.restartFailed",{detail:o instanceof Error?o.message:String(o)}),cls:"hint-warn-inline"});return}ee()}async function te(){let s=j;if(!s)return;if(!s.node.ok){window.alert(e("update.nodeTooOldAlert",{version:s.node.version,required:s.node.required}));return}if(!s.updateSupported||!s.updateCommand){window.alert(e("update.unsupportedInstall"));return}if(s.installs.multiple){let c=s.installs.entries.map(y=>`\u2022 ${y.binPath} (${De(y.kind,e)})`).join(`
|
|
1
|
+
import{b as we,c as k}from"./chunk-FLGXZJTD.js";import{a as H,c as ce,i as Ie,k as M,p as I}from"./chunk-QFMH6ITB.js";import{a as ve,t as he}from"./chunk-KQB42ML5.js";import{a as Me}from"./chunk-SYC6D5XU.js";import{a as xe,d as re}from"./chunk-5THX4DI2.js";import{c as Y}from"./chunk-7SZRL6FY.js";var p=Y(xe(),1);var h=Y(xe(),1);var a=Y(re(),1),Le=["transcript_received","chat_received","participant_joined","participant_left","magic_share_started","magic_share_ended"],be=8e3,Ue=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,Ee="\u6301\u7EED\u6574\u7406\u4F1A\u8BAE\u7EAA\u8981\uFF0C\u91CD\u70B9\u8BB0\u5F55\u5DF2\u786E\u8BA4\u7684\u51B3\u7B56\u3001\u5F85\u529E\u4E8B\u9879\uFF08\u542B\u8D1F\u8D23\u4EBA\u548C\u622A\u6B62\u65F6\u95F4\uFF09\u4EE5\u53CA\u672A\u89E3\u51B3\u98CE\u9669\uFF1B\u5B57\u5E55\u4FEE\u8BA2\u65F6\u66F4\u65B0\u5DF2\u6709\u6761\u76EE\uFF0C\u4E0D\u91CD\u590D\u8BB0\u5F55\u540C\u4E00\u4E8B\u9879\u3002\u4EC5\u5728\u51FA\u73B0\u65B0\u7684\u5173\u952E\u51B3\u7B56\u3001\u660E\u786E\u5F85\u529E\u6216\u98CE\u9669\uFF0C\u6216\u88AB\u7528\u6237\u70B9\u540D\u65F6\uFF0C\u624D\u5728\u76D1\u542C\u7FA4\u8F93\u51FA\u7B80\u6D01\u589E\u91CF\uFF1B\u65E0\u5B9E\u8D28\u589E\u91CF\u65F6\u4FDD\u6301\u9759\u9ED8\uFF0C\u4E0D\u53D1\u9001\u786E\u8BA4\u6216\u5FC3\u8DF3\u3002\u9700\u8981\u5411\u4F1A\u8BAE\u5185\u53D1\u9001\u6587\u5B57\u6216\u8BED\u97F3\u65F6\uFF0C\u5FC5\u987B\u901A\u8FC7 botmux \u53D7\u7BA1 request-output/action gate \u63D0\u4EA4\uFF0C\u4E0D\u5F97\u7ED5\u8FC7\u6743\u9650\u3001\u6240\u6709\u6743\u4E0E\u5BA1\u6838\u7B56\u7565\u3002",Ae=0;function Ne(){return Ae+=1,`p${Ae}`}function Oe(e){return{...e,listenerPlacement:e.listenerPlacement??"auto",uiKey:Ne(),isNew:!1}}function _e(e){let{uiKey:t,isNew:i,...r}=e;return r}function K(e){return(0,a.jsxs)("span",{className:"vc-profile-field-head",children:[e.title,(0,a.jsx)(Ie,{label:e.title,children:(0,a.jsx)("span",{className:"vc-profile-help",children:e.help})})]})}function Re(e){let t=k(),i=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let r=i.current;if(!(!r||r.open))try{r.showModal()}catch{r.setAttribute("open","")}},[]),(0,a.jsxs)("dialog",{ref:i,className:["vc-profile-dialog",e.className].filter(Boolean).join(" "),onClose:e.onClose,onCancel:r=>{r.preventDefault(),e.onClose()},children:[(0,a.jsxs)("header",{className:"vc-profile-dialog-head",children:[(0,a.jsxs)("div",{children:[e.eyebrow?(0,a.jsx)("span",{children:e.eyebrow}):null,(0,a.jsx)("h3",{children:e.title})]}),(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-close","aria-label":t("settings.vcProfiles.close"),onClick:e.onClose})]}),(0,a.jsx)("div",{className:"vc-profile-dialog-body",children:e.children})]})}function Be(e){let t=k();return e.enabled?e.canWrite?(0,a.jsx)($e,{canWrite:e.canWrite,listenerBotAppId:e.listenerBotAppId,listenerBotOptions:e.listenerBotOptions}):(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.needAuth")}):null}function $e(e){let t=k(),i=we(),r=(0,h.useRef)(!1),g=e.listenerBotOptions,[f,v]=(0,h.useState)(e.listenerBotAppId??g[0]?.larkAppId??""),[u,N]=(0,h.useState)(null),[S,b]=(0,h.useState)(null),[B,C]=(0,h.useState)(!1),[L,$]=(0,h.useState)(!1),[w,d]=(0,h.useState)(!1),[m,P]=(0,h.useState)(!1),[j,A]=(0,h.useState)({}),[de,z]=(0,h.useState)(!1),[ne,O]=(0,h.useState)(null),[ie,W]=(0,h.useState)(null);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let G=(0,h.useRef)(0);(0,h.useEffect)(()=>{e.listenerBotAppId&&e.listenerBotAppId!==f&&!L&&v(e.listenerBotAppId)},[L,e.listenerBotAppId,f]);let Z=(0,h.useCallback)(async l=>{let s=++G.current;if(N(null),$(!1),P(!1),A({}),O(null),W(null),!l){b(null);return}C(!0);try{let o=await fetch(`/api/vc-meeting/consumer-profiles?listenerBotAppId=${encodeURIComponent(l)}`),c=await o.json().catch(()=>({}));if(!r.current||G.current!==s)return;!o.ok||c?.ok!==!0?(N(null),b(typeof c?.error=="string"?c.error:`HTTP ${o.status}`)):(N({forBot:l,revision:c.revision,catalogState:c.catalogState==="explicit_empty"||c.catalogState==="legacy_or_partial"||c.catalogState==="profiles"?c.catalogState:"uninitialized",defaultMode:c.defaultMode==="agents"?"agents":"listenOnly",defaultConsumerIds:Array.isArray(c.defaultConsumerIds)?c.defaultConsumerIds:[],profiles:(Array.isArray(c.profiles)?c.profiles:[]).map(Oe),agentOptions:Array.isArray(c.agentOptions)?c.agentOptions:[],templateCatalog:c.templateCatalog?.schemaVersion===1&&Array.isArray(c.templateCatalog.templates)?c.templateCatalog:{schemaVersion:1,templates:[]},...c.migrationOffer==="enable_seeded_minutes_default"?{migrationOffer:c.migrationOffer}:{}}),b(null),$(!1))}catch(o){if(!r.current||G.current!==s)return;N(null),b(o instanceof Error?o.message:String(o))}finally{r.current&&G.current===s&&C(!1)}},[]);(0,h.useEffect)(()=>{Z(f)},[Z,f]);let T=(0,h.useCallback)(l=>{N(s=>s&&l(s)),$(!0),z(!1)},[]),ae=(0,h.useCallback)((l,s)=>{T(o=>({...o,profiles:o.profiles.map(c=>c.uiKey===l?{...c,...s}:c)}))},[T]),ue=(0,h.useCallback)(async()=>{if(!u||w||B||!u.forBot||u.forBot!==f)return;let l={};if(u.profiles.forEach((s,o)=>{Ue.test(s.id)||(l[`profiles[${o}].id`]=t("settings.vcProfiles.idInvalid")),(s.instructions??"").length>be&&(l[`profiles[${o}].instructions`]=t("settings.vcProfiles.instructionsTooLong"))}),Object.keys(l).length>0){A(l);return}d(!0),P(!1),A({});try{let s=await fetch("/api/vc-meeting/consumer-profiles",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({listenerBotAppId:u.forBot,expectedRevision:u.revision,defaultMode:u.defaultMode,defaultConsumerIds:u.defaultConsumerIds,profiles:u.profiles.map(_e)})}),o=await s.json().catch(()=>({}));if(!r.current||u.forBot!==f)return;if(s.status===409){P(!0);return}if(s.status===422){let c={};for(let y of Array.isArray(o?.fieldErrors)?o.fieldErrors:[])typeof y?.path=="string"&&typeof y?.message=="string"&&(c[y.path]=y.message);A(Object.keys(c).length>0?c:{profiles:t("settings.vcProfiles.validationFailed")});return}if(!s.ok||o?.ok!==!0){A({profiles:typeof o?.error=="string"?o.error:`HTTP ${s.status}`});return}N({forBot:u.forBot,revision:o.revision,catalogState:o.catalogState==="explicit_empty"||o.catalogState==="legacy_or_partial"||o.catalogState==="profiles"?o.catalogState:"uninitialized",defaultMode:o.defaultMode==="agents"?"agents":"listenOnly",defaultConsumerIds:Array.isArray(o.defaultConsumerIds)?o.defaultConsumerIds:[],profiles:(Array.isArray(o.profiles)?o.profiles:[]).map(Oe),agentOptions:Array.isArray(o.agentOptions)?o.agentOptions:[],templateCatalog:o.templateCatalog?.schemaVersion===1&&Array.isArray(o.templateCatalog.templates)?o.templateCatalog:{schemaVersion:1,templates:[]},...o.migrationOffer==="enable_seeded_minutes_default"?{migrationOffer:o.migrationOffer}:{}}),$(!1),z(!0)}catch(s){if(!r.current)return;A({profiles:s instanceof Error?s.message:String(s)})}finally{r.current&&d(!1)}},[u,w,f,t]),Q=(0,h.useMemo)(()=>g.map(l=>({value:l.larkAppId,label:l.botName||l.larkAppId})),[g]),ge=Q.find(l=>l.value===f)?.label??f,U=(0,h.useMemo)(()=>u?u.agentOptions.map(l=>{let s=[l.online?void 0:t("settings.vcProfiles.agentOffline"),l.workingDirReady?void 0:t("settings.vcProfiles.agentNoWorkingDir"),l.reliableTurnTerminal?void 0:t("settings.vcProfiles.agentNoReliableTerminal"),l.managedSideEffectIsolation?void 0:t("settings.vcProfiles.agentNoManagedIsolation")].filter(Boolean);return{value:l.appId,label:(0,a.jsxs)("span",{className:"vc-agent-option",children:[(0,a.jsxs)("span",{className:"vc-agent-option-name",children:[l.label,l.cliId?(0,a.jsx)("em",{className:"vc-agent-option-cli",children:l.cliId}):null]}),s.length>0?(0,a.jsxs)("span",{className:"vc-agent-option-warn",children:["\u26A0 ",s.join(" \xB7 ")]}):null]})}}):[],[u,t]),fe=l=>{let s=u?.agentOptions.find(c=>c.appId===l);return s?!s.online||!s.workingDirReady||!s.reliableTurnTerminal||!s.managedSideEffectIsolation?`\u26A0 ${s.label}`:s.label:l},R=(0,h.useCallback)(l=>{let o=["observe_only","meeting_text","meeting_voice","meeting_text_voice"].map(c=>({value:c,label:t(`settings.vcProfiles.preset.${c}`)}));return(!l.isNew||l.permissionPreset==="custom")&&o.push({value:"custom",label:t("settings.vcProfiles.preset.custom")}),o},[t]),se=(0,h.useCallback)(()=>{let l=Ne();T(s=>({...s,profiles:[...s.profiles,{uiKey:l,isNew:!0,id:"",agentAppId:s.agentOptions[0]?.appId??"",responseMode:"silent",listenerPlacement:"auto",permissionPreset:"observe_only"}]})),O(l)},[T]),le=(0,h.useCallback)(l=>{let s=Ne();T(o=>{let c=new Set(o.profiles.map(x=>x.id)),y=l.suggestedProfileId;for(let x=2;c.has(y);x+=1)y=`${l.suggestedProfileId.slice(0,60)}-${x}`;return{...o,profiles:[...o.profiles,{uiKey:s,isNew:!0,id:y,label:l.profileLabel[i],agentAppId:o.agentOptions[0]?.appId??"",instructions:l.instructions[i],activityTypes:[...l.activityTypes],responseMode:l.responseMode,listenerPlacement:l.listenerPlacement,permissionPreset:l.permissionPreset}]}}),W(null),O(s)},[i,T]),J=(0,h.useCallback)(l=>{T(s=>({...s,profiles:s.profiles.filter(o=>o.uiKey!==l),defaultConsumerIds:s.defaultConsumerIds.filter(o=>s.profiles.some(c=>c.uiKey!==l&&c.id===o))})),O(s=>s===l?null:s)},[T]);if(g.length===0)return null;let V=l=>j[l],q=!e.canWrite||w||B,pe=u?.agentOptions.some(l=>l.workingDirReady&&l.reliableTurnTerminal&&l.managedSideEffectIsolation)??!1,ee=u?.profiles.findIndex(l=>l.uiKey===ne)??-1,E=ee>=0?u?.profiles[ee]??null:null,te=u?.templateCatalog.templates.find(l=>l.templateId===ie)??null,Se=(l,s)=>{l.id&&T(o=>{let c=s?[...new Set([...o.defaultConsumerIds,l.id])]:o.defaultConsumerIds.filter(y=>y!==l.id);return{...o,defaultMode:c.length>0?"agents":"listenOnly",defaultConsumerIds:c}})};return(0,a.jsxs)("div",{className:"vc-profiles-section",children:[(0,a.jsxs)("div",{className:"settings-field-row",children:[(0,a.jsx)(M,{help:t("settings.vcProfiles.help"),children:t("settings.vcProfiles.title")}),e.listenerBotAppId===null&&Q.length>1?(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.listenerOwner")}),(0,a.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.vcProfiles.listenerOwner"),disabled:B||w,value:f,label:H(Q,f),options:Q,onChange:l=>{l!==f&&(L&&!window.confirm(t("settings.vcProfiles.discardConfirm"))||v(l))}})]}):(0,a.jsx)("span",{className:"vc-profile-config-target",children:t("settings.vcProfiles.configuringBot",{bot:ge})})]}),(0,a.jsx)("p",{className:"hint vc-profiles-freeze",children:t("settings.vcProfiles.freezeNotice")}),B?(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.loading")}):null,S?(0,a.jsx)("p",{className:"hint-warn",children:S==="bot_not_in_config"?t("settings.vcProfiles.botNotInConfig"):`${t("settings.vcProfiles.loadFailed")}: ${S}`}):null,m?(0,a.jsxs)("p",{className:"hint-warn",children:[t("settings.vcProfiles.conflict")," ",(0,a.jsx)("button",{type:"button",className:"vc-profiles-link",onClick:()=>{Z(f)},children:t("settings.vcProfiles.reload")})]}):null,V("profiles")?(0,a.jsx)("p",{className:"hint-warn",children:V("profiles")}):null,u?(0,a.jsxs)(a.Fragment,{children:[u.migrationOffer==="enable_seeded_minutes_default"?(0,a.jsxs)("p",{className:"hint-warn vc-profile-migration-offer",children:[t("settings.vcProfiles.migrationOffer")," ",(0,a.jsx)("button",{type:"button",className:"vc-profiles-link",disabled:q||L,onClick:()=>T(l=>({...l,defaultMode:"agents",defaultConsumerIds:["minutes"],profiles:l.profiles.map(s=>s.id==="minutes"?{...s,instructions:Ee,responseMode:"listener_thread",permissionPreset:"meeting_text_voice"}:s),migrationOffer:void 0})),children:t("settings.vcProfiles.migrationEnable")})]}):null,u.catalogState==="uninitialized"&&u.profiles.length===0&&!pe?(0,a.jsx)("p",{className:"hint-warn",children:t("settings.vcProfiles.noEligibleDefaultAgent")}):null,u.catalogState==="legacy_or_partial"?(0,a.jsx)("p",{className:"hint",children:t("settings.vcProfiles.legacyCatalog")}):null,(0,a.jsxs)("section",{className:"vc-profile-library-section",children:[(0,a.jsxs)("div",{className:"vc-profile-list-heading",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.list.title")}),(0,a.jsx)("p",{children:t("settings.vcProfiles.list.help")})]}),e.canWrite?(0,a.jsx)("button",{type:"button",className:"vc-profiles-link vc-profile-add",disabled:w||B,onClick:se,children:t("settings.vcProfiles.add")}):null]}),u.profiles.length>0?(0,a.jsx)("div",{className:"vc-profile-card-grid",children:u.profiles.map(l=>{let s=u.agentOptions.find(c=>c.appId===l.agentAppId),o=u.defaultMode==="agents"&&u.defaultConsumerIds.includes(l.id);return(0,a.jsxs)("article",{className:"vc-profile-summary-card",role:"button",tabIndex:0,onClick:()=>O(l.uiKey),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),O(l.uiKey))},children:[(0,a.jsxs)("div",{className:"vc-profile-summary-top",children:[(0,a.jsx)("span",{className:"vc-profile-summary-icon","aria-hidden":"true",children:(l.label||l.id||"?").slice(0,1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:l.label||l.id||t("settings.vcProfiles.untitled")}),(0,a.jsx)("code",{children:l.id||t("settings.vcProfiles.newBadge")})]}),l.isNew?(0,a.jsx)("em",{children:t("settings.vcProfiles.newBadge")}):null]}),(0,a.jsx)("p",{children:(l.instructions??"").trim()||t("settings.vcProfiles.noInstructions")}),(0,a.jsxs)("div",{className:"vc-profile-summary-meta",children:[(0,a.jsx)("span",{children:s?.label??l.agentAppId}),(0,a.jsx)("span",{children:l.responseMode==="listener_thread"?t("settings.vcProfiles.responseListener"):t("settings.vcProfiles.responseSilent")})]}),(0,a.jsxs)("label",{className:"vc-profile-default-toggle",onClick:c=>c.stopPropagation(),children:[(0,a.jsx)("input",{type:"checkbox",checked:o,disabled:q||!l.id,onChange:c=>Se(l,c.currentTarget.checked)}),(0,a.jsx)("span",{children:t("settings.vcProfiles.setDefault")})]})]},l.uiKey)})}):(0,a.jsx)("p",{className:"vc-profile-empty",children:t("settings.vcProfiles.list.empty")})]}),u.templateCatalog.templates.length>0?(0,a.jsxs)("section",{className:"vc-profile-template-catalog",children:[(0,a.jsxs)("div",{className:"vc-profile-template-heading",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.templates.title")}),(0,a.jsx)("p",{children:t("settings.vcProfiles.templates.help")})]}),(0,a.jsx)("span",{children:t("settings.vcProfiles.templates.builtinBadge")})]}),(0,a.jsx)("div",{className:"vc-profile-template-grid",children:u.templateCatalog.templates.map(l=>(0,a.jsxs)("button",{type:"button",className:"vc-profile-template-card",onClick:()=>W(l.templateId),children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"\u2726"}),(0,a.jsx)("strong",{children:l.title[i]}),(0,a.jsx)("p",{children:l.description[i]}),(0,a.jsxs)("em",{children:[t("settings.vcProfiles.viewDetails")," \u2192"]})]},`${l.templateId}@${l.version}`))})]}):null,(0,a.jsxs)("div",{className:"settings-field-row vc-profile-default-mode-row",children:[(0,a.jsx)(M,{help:t("settings.vcProfiles.defaultModeHelp"),children:t("settings.vcProfiles.defaultMode")}),(0,a.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.vcProfiles.defaultMode"),disabled:q,value:u.defaultMode,label:u.defaultMode==="agents"?t("settings.vcProfiles.defaultModeAgents"):t("settings.vcProfiles.defaultModeListenOnly"),options:[{value:"listenOnly",label:t("settings.vcProfiles.defaultModeListenOnly")},{value:"agents",label:t("settings.vcProfiles.defaultModeAgents")}],onChange:l=>T(s=>({...s,defaultMode:l==="agents"?"agents":"listenOnly"}))})]}),V("defaultConsumerIds")?(0,a.jsx)("em",{className:"vc-profile-err",children:V("defaultConsumerIds")}):null,V("defaultMode")?(0,a.jsx)("em",{className:"vc-profile-err",children:V("defaultMode")}):null,e.canWrite?(0,a.jsxs)("div",{className:"vc-profiles-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profiles-save",disabled:!L||w||m,onClick:()=>{ue()},children:t(w?"settings.vcProfiles.saving":"settings.vcProfiles.save")}),de?(0,a.jsx)("span",{className:"vc-profile-hint",children:t("settings.vcProfiles.saved")}):null,L&&!w?(0,a.jsx)("span",{className:"vc-profile-hint",children:t("settings.vcProfiles.unsaved")}):null]}):null,E?(0,a.jsx)(Ve,{profile:E,index:ee,frozen:q,canWrite:e.canWrite,agentOptions:U,agentLabel:fe(E.agentAppId),presetOptions:R(E),error:V,onClose:()=>O(null),onUpdate:l=>ae(E.uiKey,l),onIdChange:l=>{let s=E.id;T(o=>({...o,profiles:o.profiles.map(c=>c.uiKey===E.uiKey?{...c,id:l}:c),defaultConsumerIds:o.defaultConsumerIds.map(c=>c===s&&s?l:c).filter(Boolean)}))},onRemove:()=>J(E.uiKey)}):null,te?(0,a.jsx)(He,{template:te,locale:i,disabled:q||u.agentOptions.length===0,onClose:()=>W(null),onUse:()=>le(te)}):null]}):null]})}function Ve(e){let t=k(),{profile:i,index:r}=e;return(0,a.jsxs)(Re,{className:"vc-profile-editor-dialog",eyebrow:t("settings.vcProfiles.list.title"),title:i.label||i.id||t("settings.vcProfiles.untitled"),onClose:e.onClose,children:[(0,a.jsxs)("div",{className:"vc-profile-grid",children:[(0,a.jsxs)("label",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldId"),help:t("settings.vcProfiles.idHelp")})}),(0,a.jsx)("input",{type:"text",value:i.id,disabled:e.frozen||!i.isNew,placeholder:"minutes",onChange:g=>e.onIdChange(g.currentTarget.value)}),e.error(`profiles[${r}].id`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].id`)}):null]}),(0,a.jsxs)("label",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldLabel"),help:t("settings.vcProfiles.labelHelp")})}),(0,a.jsx)("input",{type:"text",value:i.label??"",disabled:e.frozen,onChange:g=>e.onUpdate({label:g.currentTarget.value||void 0})}),e.error(`profiles[${r}].label`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].label`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldAgent"),help:t("settings.vcProfiles.agentHelp")})}),(0,a.jsx)(I,{className:"vc-profile-agent-menu",ariaLabel:t("settings.vcProfiles.fieldAgent"),disabled:e.frozen,value:i.agentAppId,label:e.agentLabel,options:e.agentOptions,onChange:g=>e.onUpdate({agentAppId:g})}),e.error(`profiles[${r}].agentAppId`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].agentAppId`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldResponseMode"),help:t("settings.vcProfiles.responseModeHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldResponseMode"),disabled:e.frozen,value:i.responseMode,label:i.responseMode==="listener_thread"?t("settings.vcProfiles.responseListener"):t("settings.vcProfiles.responseSilent"),options:[{value:"silent",label:t("settings.vcProfiles.responseSilent")},{value:"listener_thread",label:t("settings.vcProfiles.responseListener")}],onChange:g=>e.onUpdate({responseMode:g})}),e.error(`profiles[${r}].responseMode`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].responseMode`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldListenerPlacement"),help:t("settings.vcProfiles.listenerPlacementHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldListenerPlacement"),disabled:e.frozen||i.responseMode==="silent",value:i.listenerPlacement??"auto",label:t(`settings.vcProfiles.listenerPlacement.${i.listenerPlacement??"auto"}`),options:["auto","chat","topic"].map(g=>({value:g,label:t(`settings.vcProfiles.listenerPlacement.${g}`)})),onChange:g=>e.onUpdate({listenerPlacement:g})}),e.error(`profiles[${r}].listenerPlacement`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].listenerPlacement`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldPreset"),help:t("settings.vcProfiles.presetHelp")})}),(0,a.jsx)(I,{ariaLabel:t("settings.vcProfiles.fieldPreset"),disabled:e.frozen,value:i.permissionPreset,label:H(e.presetOptions,i.permissionPreset),options:e.presetOptions,onChange:g=>e.onUpdate({permissionPreset:g})}),e.error(`profiles[${r}].permissionPreset`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].permissionPreset`)}):null]})]}),(0,a.jsxs)("label",{className:"vc-profile-field vc-profile-instructions",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldInstructions"),help:t("settings.vcProfiles.instructionsHelp")}),(0,a.jsxs)("em",{className:"vc-profile-count",children:[(i.instructions??"").length,"/",be]})]}),(0,a.jsx)("textarea",{rows:7,maxLength:be,value:i.instructions??"",disabled:e.frozen,placeholder:t("settings.vcProfiles.instructionsPlaceholder"),onChange:g=>e.onUpdate({instructions:g.currentTarget.value||void 0})}),e.error(`profiles[${r}].instructions`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].instructions`)}):null]}),(0,a.jsxs)("div",{className:"vc-profile-field",children:[(0,a.jsx)("span",{children:(0,a.jsx)(K,{title:t("settings.vcProfiles.fieldActivityTypes"),help:t("settings.vcProfiles.activityHelp")})}),(0,a.jsx)("div",{className:"vc-profile-activity",children:Le.map(g=>{let f=i.activityTypes?.includes(g)??!1;return(0,a.jsxs)("label",{className:"vc-profile-check",children:[(0,a.jsx)("input",{type:"checkbox",checked:f,disabled:e.frozen,onChange:v=>{let u=new Set(i.activityTypes??[]);v.currentTarget.checked?u.add(g):u.delete(g),e.onUpdate({activityTypes:u.size>0?[...u]:void 0})}}),t(`settings.vcProfiles.activity.${g}`)]},g)})}),(0,a.jsx)("em",{className:"vc-profile-hint",children:t("settings.vcProfiles.activityAllHint")}),e.error(`profiles[${r}].activityTypes`)?(0,a.jsx)("em",{className:"vc-profile-err",children:e.error(`profiles[${r}].activityTypes`)}):null]}),e.canWrite?(0,a.jsxs)("footer",{className:"vc-profile-dialog-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profiles-link vc-profile-remove",disabled:e.frozen,onClick:e.onRemove,children:t("settings.vcProfiles.remove")}),(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-done",onClick:e.onClose,children:t("settings.vcProfiles.done")})]}):null]})}function He(e){let t=k(),i=e.template;return(0,a.jsxs)(Re,{className:"vc-profile-template-dialog",eyebrow:t("settings.vcProfiles.templates.title"),title:i.title[e.locale],onClose:e.onClose,children:[(0,a.jsx)("p",{className:"vc-profile-template-description",children:i.description[e.locale]}),(0,a.jsxs)("div",{className:"vc-profile-template-facts",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldResponseMode")}),(0,a.jsx)("strong",{children:t(i.responseMode==="listener_thread"?"settings.vcProfiles.responseListener":"settings.vcProfiles.responseSilent")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldListenerPlacement")}),(0,a.jsx)("strong",{children:t(`settings.vcProfiles.listenerPlacement.${i.listenerPlacement}`)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:t("settings.vcProfiles.fieldPreset")}),(0,a.jsx)("strong",{children:t(`settings.vcProfiles.preset.${i.permissionPreset}`)})]})]}),(0,a.jsxs)("section",{className:"vc-profile-template-prompt",children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.fieldInstructions")}),(0,a.jsx)("p",{children:i.instructions[e.locale]})]}),(0,a.jsxs)("section",{className:"vc-profile-template-events",children:[(0,a.jsx)("strong",{children:t("settings.vcProfiles.fieldActivityTypes")}),(0,a.jsx)("div",{children:i.activityTypes.map(r=>(0,a.jsx)("span",{children:t(`settings.vcProfiles.activity.${r}`)},r))})]}),(0,a.jsxs)("footer",{className:"vc-profile-dialog-actions",children:[(0,a.jsx)("button",{type:"button",className:"vc-profile-dialog-secondary",onClick:e.onClose,children:t("settings.vcProfiles.close")}),(0,a.jsx)("button",{type:"button",className:"vc-profile-template-use",disabled:e.disabled,onClick:e.onUse,children:t("settings.vcProfiles.templates.use")})]})]})}var n=Y(re(),1),ye=["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Asia/Kolkata","UTC","Europe/London","Europe/Paris","Europe/Moscow","America/Los_Angeles","America/New_York","America/Sao_Paulo","Australia/Sydney"];function Fe(e,t){if(!e||typeof e!="object")return null;if(e.failed){let i=e.failed.step==="install"?t("settings.herdrTraexInstallStepInstall"):t("settings.herdrTraexInstallStepAction");return{text:`${t("settings.herdrTraexInstallFailed")}\uFF08${i}\uFF09: ${e.failed.reason??""}`,cls:"hint-warn-inline"}}if(e.skippedReason==="plugin_unsupported"){let i=typeof e.herdrVersion=="string"&&e.herdrVersion?` (${e.herdrVersion})`:"";return{text:`${t("settings.herdrTraexUnsupported")}${i}`,cls:"hint-warn-inline"}}return e.installed||e.actionInvoked?{text:t("settings.herdrTraexInstalled"),cls:"hint-ok"}:e.alreadyInstalled?{text:t("settings.herdrTraexAlreadyInstalled"),cls:"hint-ok"}:null}function Pe(e){return{groupNamePrefix:typeof e?.groupNamePrefix=="string"?e.groupNamePrefix:"",publicReadOnly:e?.publicReadOnly===!0,openTerminalInFeishu:e?.openTerminalInFeishu===!0,enableLocalCliOpen:e?.enableLocalCliOpen===!0,localCliOpenMode:e?.localCliOpenMode==="resume"?"resume":"attach",chatBotDiscovery:e?.chatBotDiscovery!==!1,herdrTraexPlugin:{enabled:e?.herdrTraexPlugin?.enabled===!0,source:typeof e?.herdrTraexPlugin?.source=="string"?e.herdrTraexPlugin.source:"",ref:typeof e?.herdrTraexPlugin?.ref=="string"?e.herdrTraexPlugin.ref:"",recommendedSource:typeof e?.herdrTraexPlugin?.recommendedSource=="string"?e.herdrTraexPlugin.recommendedSource:"",recommendedRef:typeof e?.herdrTraexPlugin?.recommendedRef=="string"?e.herdrTraexPlugin.recommendedRef:""},codexRpcInput:e?.codexRpcInput===!0,codexNotifier:{enabled:e?.codexNotifier?.enabled===!0,targetBotAppId:typeof e?.codexNotifier?.targetBotAppId=="string"?e.codexNotifier.targetBotAppId:null,notifyWhen:e?.codexNotifier?.notifyWhen==="always"?"always":"locked_only",platformSupported:e?.codexNotifier?.platformSupported===!0,hookInstalled:e?.codexNotifier?.hookInstalled===!0,botOptions:Array.isArray(e?.codexNotifier?.botOptions)?e.codexNotifier.botOptions:[],targetDaemonOnline:e?.codexNotifier?.targetDaemonOnline===!0,pendingCount:Number.isSafeInteger(e?.codexNotifier?.pendingCount)?Math.max(0,e.codexNotifier.pendingCount):0,workerOnline:e?.codexNotifier?.workerOnline===!0,lastError:e?.codexNotifier?.lastError&&typeof e.codexNotifier.lastError.message=="string"?e.codexNotifier.lastError:null},vcMeetingAgent:{enabled:e?.vcMeetingAgent?.enabled!==!1,listenerBotAppId:typeof e?.vcMeetingAgent?.listenerBotAppId=="string"?e.vcMeetingAgent.listenerBotAppId:null,listenerBotOptions:Array.isArray(e?.vcMeetingAgent?.listenerBotOptions)?e.vcMeetingAgent.listenerBotOptions:[],larkCliVersion:e?.vcMeetingAgent?.larkCliVersion===void 0?void 0:e.vcMeetingAgent.larkCliVersion??null,larkCliMeetsRequirement:e?.vcMeetingAgent?.larkCliMeetsRequirement===!0,larkCliMinVersion:typeof e?.vcMeetingAgent?.larkCliMinVersion=="string"?e.vcMeetingAgent.larkCliMinVersion:void 0},repoPickerMode:e?.repoPickerMode==="repos"?"repos":"all",maintenance:e?.maintenance&&typeof e.maintenance=="object"?e.maintenance:{},localDevInstall:e?.localDevInstall===!0,autoUpdateSupported:e?.autoUpdateSupported!==!1,whiteboard:{enabled:e?.whiteboard?.enabled===!0},remoteAccess:e?.remoteAccess===!0,scheduleTimeZone:typeof e?.scheduleTimeZone=="string"?e.scheduleTimeZone:"",hostTimeZone:typeof e?.hostTimeZone=="string"&&e.hostTimeZone?e.hostTimeZone:"UTC",effectiveScheduleTimeZone:typeof e?.effectiveScheduleTimeZone=="string"&&e.effectiveScheduleTimeZone?e.effectiveScheduleTimeZone:typeof e?.scheduleTimeZone=="string"&&e.scheduleTimeZone?e.scheduleTimeZone:typeof e?.hostTimeZone=="string"&&e.hostTimeZone?e.hostTimeZone:"UTC"}}function We(e,t){let i=e?.[t]??{};return{enabled:i.enabled===!0,time:typeof i.time=="string"?i.time:"04:00"}}function De(e,t){return t(e==="npm-global"?"update.kindNpm":e==="pnpm-global"?"update.kindPnpm":e==="yarn-global"?"update.kindYarn":e==="bun-global"?"update.kindBun":e==="source-checkout"?"update.kindSource":"update.kindUnknown")}function Ze(){let e=k(),t=(0,p.useRef)(!1),i=(0,p.useRef)(new Set),[r,g]=(0,p.useState)(null),[f,v]=(0,p.useState)(!1),[u,N]=(0,p.useState)(null),[S,b]=(0,p.useState)(!0),[B,C]=(0,p.useState)(!1),[L,$]=(0,p.useState)(null),[w,d]=(0,p.useState)(null),[m,P]=(0,p.useState)(null),[j,A]=(0,p.useState)(null),[de,z]=(0,p.useState)(null),[ne,O]=(0,p.useState)(null),[ie,W]=(0,p.useState)(!1),[G,Z]=(0,p.useState)(!0),[T,ae]=(0,p.useState)(!1),[ue,Q]=(0,p.useState)(""),[ge,U]=(0,p.useState)(!1),[fe,R]=(0,p.useState)(null),se=(0,p.useCallback)(()=>{for(let s of i.current)window.clearTimeout(s);i.current.clear()},[]),le=(0,p.useCallback)((s,o)=>{let c=window.setTimeout(()=>{i.current.delete(c),s()},o);return i.current.add(c),c},[]),J=(0,p.useCallback)(async()=>{try{let s=await fetch("/api/update/status"),o=await s.json().catch(()=>({}));if(!t.current)return;if(!s.ok){A(null),z(o?.error??`HTTP ${s.status}`);return}A(o),z(null)}catch(s){if(!t.current)return;A(null),z(s instanceof Error?s.message:String(s))}},[]),V=(0,p.useCallback)(async()=>{try{let s=await fetch("/api/settings"),o=await s.json().catch(()=>({}));if(!t.current)return;if(!s.ok){g(null),N(o?.error??`HTTP ${s.status}`),v(!0);return}g(Pe(o.settings)),b(o.authed===!0),C(o.bound===!0),N(null),v(!0)}catch(s){if(!t.current)return;g(null),N(s instanceof Error?s.message:String(s)),v(!0)}},[]);(0,p.useEffect)(()=>(t.current=!0,V(),()=>{t.current=!1,se()}),[se,V]),(0,p.useEffect)(()=>{f&&(U(!1),R(null),W(!1),S&&J())},[S,J,f]);async function q(s,o,c){if(!r)return;let y=r;g(c(r)),$(s),d({text:e("settings.saving")});try{let x=await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(o)}),_=await x.json().catch(()=>({}));if(!t.current)return;if(!x.ok||_.ok===!1)throw typeof _?.feishuLoginQr=="string"&&_.feishuLoginQr&&P(_.feishuLoginQr),new Error(_?.error??`HTTP ${x.status}`);P(null);let X=Pe(_.settings);g(X),he.publicReadOnly=X.publicReadOnly,ve.setScheduleTimeZone(X.effectiveScheduleTimeZone);let oe=Fe(_.herdrTraexInstall,e);d(oe??{text:e("settings.saved"),cls:"hint-ok"})}catch(x){if(!t.current)return;let _=!1;try{let oe=await fetch("/api/settings"),Te=await oe.json().catch(()=>({}));if(t.current&&oe.ok&&Te?.settings){let me=Pe(Te.settings);g(me),he.publicReadOnly=me.publicReadOnly,ve.setScheduleTimeZone(me.effectiveScheduleTimeZone),_=!0}}catch{}if(!t.current)return;_||g(y);let X=x instanceof Error?x.message:String(x);d({text:_?`${e("settings.saveReconciled")}: ${X}`:`${e("settings.saveFailed")}: ${X}`,cls:"hint-warn-inline"})}finally{t.current&&$(null)}}async function pe(){O(null),Z(!0),ae(!1);try{let s=await fetch("/api/update/changelog"),o=await s.json().catch(()=>({}));if(!t.current)return;Q(typeof o?.releasesUrl=="string"?o.releasesUrl:""),s.ok?(O(Array.isArray(o.releases)?o.releases:[]),Z(o.ok!==!1),ae(o.rateLimited===!0)):(O([]),Z(!1))}catch{if(!t.current)return;O([]),Z(!1)}}function ee(){let s=Date.now(),o=async()=>{if(t.current){if(Date.now()-s>9e4){U(!1),R({text:e("update.restartSlow"),cls:"hint-warn-inline"});return}try{let c=await fetch("/__health",{cache:"no-store"});if(!t.current)return;if(c.ok){location.reload();return}}catch{}t.current&&le(()=>{o()},2e3)}};le(()=>{o()},3e3)}async function E(s){U(!0),R({text:e("update.restarting")});try{let o=await fetch("/api/update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s?{update:s}:{})}),c=await o.json().catch(()=>({}));if(!o.ok||c.ok===!1)throw new Error(String(c.detail??c.error??`HTTP ${o.status}`));if(!t.current)return}catch(o){if(!t.current)return;U(!1),R({text:e("update.restartFailed",{detail:o instanceof Error?o.message:String(o)}),cls:"hint-warn-inline"});return}ee()}async function te(){let s=j;if(!s)return;if(!s.node.ok){window.alert(e("update.nodeTooOldAlert",{version:s.node.version,required:s.node.required}));return}if(!s.updateSupported||!s.updateCommand){window.alert(e("update.unsupportedInstall"));return}if(s.installs.multiple){let c=s.installs.entries.map(y=>`\u2022 ${y.binPath} (${De(y.kind,e)})`).join(`
|
|
2
2
|
`);if(!window.confirm(e("update.confirmMultiInstall",{paths:c})))return}let o=s.latest?e("update.confirmUpdate",{version:`v${s.latest}`,command:s.updateCommand}):e("update.confirmUpdateNoVer",{command:s.updateCommand});if(window.confirm(o)){U(!0),R({text:e("update.updating",{command:s.updateCommand})});try{let c=await fetch("/api/update/run",{method:"POST"}),y=await c.json().catch(()=>({}));if(!t.current)return;if(!c.ok||y.ok===!1){let x=y?.detail??y?.error??`HTTP ${c.status}`;U(!1),R({text:e("update.updateFailed",{detail:x}),cls:"hint-warn-inline"});return}y.changed?(U(!1),R({text:e("update.updatedChanged",{old:`v${y.oldVersion}`,new:`v${y.newVersion}`}),cls:"hint-ok"}),window.confirm(e("update.confirmRestart"))?await E({oldVersion:y.oldVersion,newVersion:y.newVersion}):t.current&&R({text:e("update.noRestartHint"),cls:"hint-ok"})):(U(!1),R({text:e("update.alreadyLatestRun",{version:`v${y.newVersion}`}),cls:"hint-ok"}),await J())}catch(c){if(!t.current)return;U(!1),R({text:e("update.updateFailed",{detail:c instanceof Error?c.message:String(c)}),cls:"hint-warn-inline"})}}}let l=r?(0,n.jsx)(Ke,{settings:r,canWrite:S,bound:B,savingKey:L,message:w,updateBlock:(0,n.jsx)(Xe,{canWrite:S,status:j,statusError:de,changelog:ne,changelogOpen:ie,changelogOk:G,changelogRateLimited:T,releasesUrl:ue,busy:ge,message:fe,onCheck:()=>{A(null),O(null),W(!1),R(null),z(null),J()},onToggleChangelog:()=>{let s=!ie;W(s),s&&ne===null&&pe()},onUpdate:()=>{te()},onRestart:()=>{window.confirm(e("update.confirmPlainRestart"))&&E(null)}}),feishuLoginQr:m,onCloseFeishuLoginQr:()=>P(null),onSave:q}):u?(0,n.jsxs)("p",{className:"hint-warn",children:[e("settings.loadFailed"),": ",u]}):(0,n.jsx)(ce,{label:e("settings.loading")});return(0,n.jsxs)("section",{className:"page settings-page",children:[(0,n.jsx)("div",{className:"page-heading",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"eyebrow",children:e("nav.settings")}),(0,n.jsx)("h1",{children:e("settings.title")})]})}),l]})}function Ke(e){let t=k(),{settings:i,canWrite:r,bound:g,savingKey:f}=e,v=!r,u=We(i.maintenance,"autoUpdate"),N=!r||i.localDevInstall||!i.autoUpdateSupported,S=!r||i.maintenance.autoUpdate?.enabled!==!0,b=(d,m)=>{e.onSave(d,{[d]:m},P=>({...P,[d]:m}))},B=d=>e.onSave("herdrTraexPlugin",{herdrTraexPlugin:d},m=>({...m,herdrTraexPlugin:{...m.herdrTraexPlugin,...d}})),C=d=>e.onSave("codexNotifier",{codexNotifier:d},m=>({...m,codexNotifier:{...m.codexNotifier,...d}})),L=(0,p.useMemo)(()=>[{value:"all",label:t("settings.repoPickerModeAll")},{value:"repos",label:t("settings.repoPickerModeRepos")}],[t]),$=(0,p.useMemo)(()=>[{value:"attach",label:t("settings.localCliOpenModeAttach")},{value:"resume",label:t("settings.localCliOpenModeResume")}],[t]),w=(0,p.useMemo)(()=>[{value:"",label:t("settings.vcMeetingListenerBotAuto")},...i.vcMeetingAgent.listenerBotOptions.map(d=>{let m=d.botName||d.larkAppId,P=d.cliId?` \xB7 ${d.cliId}`:"",j=[d.vcMeetingAgentEnabled===!0?void 0:t("settings.vcMeetingListenerBotDisabled"),d.hasLarkCliProfile===!0?void 0:t("settings.vcMeetingListenerBotNoProfile")].filter(Boolean),A=j.length>0?` \xB7 ${j.join(" \xB7 ")}`:"";return{value:d.larkAppId,label:`${m}${P}${A}`}})],[i.vcMeetingAgent.listenerBotOptions,t]);return(0,n.jsxs)("div",{className:"settings-layout",children:[r?null:(0,n.jsx)("article",{className:"bd-card settings-card settings-alert-card",children:(0,n.jsx)("p",{className:"hint-warn",children:t("settings.readOnlyVisitor")})}),(0,n.jsx)(Ce,{title:t("settings.moduleGeneral"),description:t("settings.moduleGeneralHelp"),children:(0,n.jsxs)(ke,{className:"settings-group-main",children:[(0,n.jsxs)(F,{title:t("settings.sectionAccess"),children:[(0,n.jsx)(D,{title:t("settings.publicReadOnly"),help:t("settings.publicReadOnlyHelp"),checked:i.publicReadOnly,disabled:v||f==="publicReadOnly",onChange:d=>b("publicReadOnly",d)}),g?(0,n.jsx)(D,{title:t("settings.remoteAccess"),help:t("settings.remoteAccessHelp"),checked:i.remoteAccess,disabled:v||f==="remoteAccess",onChange:d=>b("remoteAccess",d)}):null]}),(0,n.jsxs)(F,{title:t("settings.sectionCards"),children:[(0,n.jsx)(D,{title:t("settings.openTerminalInFeishu"),help:t("settings.openTerminalInFeishuHelp"),checked:i.openTerminalInFeishu,disabled:v||f==="openTerminalInFeishu",onChange:d=>b("openTerminalInFeishu",d)}),(0,n.jsx)(D,{title:t("settings.enableLocalCliOpen"),help:t("settings.enableLocalCliOpenHelp"),checked:i.enableLocalCliOpen,disabled:v||f==="enableLocalCliOpen",onChange:d=>b("enableLocalCliOpen",d)}),(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.localCliOpenModeHelp"),children:t("settings.localCliOpenMode")}),(0,n.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.localCliOpenMode"),disabled:v||!i.enableLocalCliOpen||f==="localCliOpenMode",value:i.localCliOpenMode,label:H($,i.localCliOpenMode),options:$,onChange:d=>{e.onSave("localCliOpenMode",{localCliOpenMode:d},m=>({...m,localCliOpenMode:d}))}})]})]}),(0,n.jsx)(F,{title:t("settings.sectionGroupCreation"),children:(0,n.jsx)(Qe,{value:i.groupNamePrefix,disabled:v||f==="groupNamePrefix",onSave:d=>e.onSave("groupNamePrefix",{groupNamePrefix:d},m=>({...m,groupNamePrefix:d}))})}),(0,n.jsxs)(F,{title:t("settings.sectionExperimental"),children:[(0,n.jsx)(D,{title:t("settings.chatBotDiscovery"),help:t("settings.chatBotDiscoveryHelp"),checked:i.chatBotDiscovery,disabled:v||f==="chatBotDiscovery",onChange:d=>b("chatBotDiscovery",d)}),(0,n.jsx)(D,{title:t("settings.herdrTraexPlugin"),help:t("settings.herdrTraexPluginHelp"),checked:i.herdrTraexPlugin.enabled,disabled:v||f==="herdrTraexPlugin",onChange:d=>B({enabled:d})}),i.herdrTraexPlugin.enabled?(0,n.jsx)(Je,{value:i.herdrTraexPlugin,disabled:v||f==="herdrTraexPlugin",onSave:d=>B(d)}):null,(0,n.jsx)(D,{title:t("settings.codexRpcInput"),help:t("settings.codexRpcInputHelp"),checked:i.codexRpcInput,disabled:v||f==="codexRpcInput",onChange:d=>b("codexRpcInput",d)}),(0,n.jsx)(ze,{value:i.codexNotifier,disabled:v,saving:f==="codexNotifier",onSave:C})]}),(0,n.jsx)(F,{title:t("settings.sectionWhiteboard"),children:(0,n.jsx)(D,{title:t("settings.whiteboardEnable"),help:t("settings.whiteboardEnableHelp"),checked:i.whiteboard.enabled,disabled:v||f==="whiteboard",onChange:d=>{e.onSave("whiteboard",{whiteboard:{enabled:d}},m=>({...m,whiteboard:{enabled:d}}))}})}),(0,n.jsx)(F,{title:t("settings.sectionRepoPicker"),children:(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.repoPickerModeHelp"),children:t("settings.repoPickerMode")}),(0,n.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.repoPickerMode"),disabled:v||f==="repoPickerMode",value:i.repoPickerMode,label:H(L,i.repoPickerMode),options:L,onChange:d=>{e.onSave("repoPickerMode",{repoPickerMode:d},m=>({...m,repoPickerMode:d}))}})]})}),(0,n.jsx)(F,{title:t("settings.sectionSchedule"),children:(0,n.jsx)(qe,{value:i.scheduleTimeZone,host:i.hostTimeZone,effective:i.effectiveScheduleTimeZone,disabled:v||f==="scheduleTimeZone",onSave:d=>{e.onSave("scheduleTimeZone",{scheduleTimeZone:d},m=>({...m,scheduleTimeZone:d??""}))}})})]})}),(0,n.jsx)(Ce,{className:"settings-module-meeting",title:t("settings.moduleMeeting"),description:t("settings.moduleMeetingHelp"),children:(0,n.jsx)(ke,{className:"settings-group-meeting",children:(0,n.jsxs)(F,{className:"settings-vc-block",title:t("settings.sectionVcMeetingAgent"),children:[(0,n.jsx)(D,{title:t("settings.vcMeetingAgent"),help:t("settings.vcMeetingAgentHelp"),checked:i.vcMeetingAgent.enabled,disabled:v||f==="vcMeetingAgent",onChange:d=>{e.onSave("vcMeetingAgent",{vcMeetingAgent:{enabled:d}},m=>({...m,vcMeetingAgent:{...m.vcMeetingAgent,enabled:d}}))}}),(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.vcMeetingListenerBotHelp"),children:t("settings.vcMeetingListenerBot")}),(0,n.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.vcMeetingListenerBot"),disabled:v||f==="vcMeetingAgent",value:i.vcMeetingAgent.listenerBotAppId??"",label:H(w,i.vcMeetingAgent.listenerBotAppId??""),options:w,onChange:d=>{let m=d||null;e.onSave("vcMeetingAgent",{vcMeetingAgent:{listenerBotAppId:m}},P=>({...P,vcMeetingAgent:{...P.vcMeetingAgent,listenerBotAppId:m}}))}})]}),(0,n.jsx)(je,{settings:i.vcMeetingAgent}),(0,n.jsx)(Be,{enabled:i.vcMeetingAgent.enabled,canWrite:r,listenerBotAppId:i.vcMeetingAgent.listenerBotAppId,listenerBotOptions:i.vcMeetingAgent.listenerBotOptions}),e.feishuLoginQr?(0,n.jsxs)("div",{className:"settings-feishu-login",children:[(0,n.jsx)("button",{type:"button",className:"settings-feishu-login-close","aria-label":t("settings.feishuLoginClose"),title:t("settings.feishuLoginClose"),onClick:e.onCloseFeishuLoginQr}),(0,n.jsx)("p",{children:t("settings.feishuLoginRequired")}),(0,n.jsx)("img",{src:e.feishuLoginQr,alt:t("settings.feishuLoginQrAlt")})]}):null]})})}),(0,n.jsx)(Ce,{title:t("settings.moduleSystem"),description:t("settings.moduleSystemHelp"),children:(0,n.jsxs)(ke,{className:"settings-group-ops",children:[(0,n.jsx)(F,{title:t("settings.sectionMaintenance"),titleExtra:i.localDevInstall?(0,n.jsx)("span",{className:"settings-title-note",children:t("settings.autoUpdateLocalDev")}):i.autoUpdateSupported?null:(0,n.jsx)("span",{className:"settings-title-note",children:t("settings.autoUpdateUnsupportedInstall")}),children:(0,n.jsxs)("div",{className:"settings-maintenance-grid",children:[(0,n.jsxs)("div",{className:"settings-maintenance-update",children:[(0,n.jsx)(D,{title:t("settings.autoUpdate"),help:t("settings.autoUpdateHelp"),checked:u.enabled,disabled:N||f==="autoUpdate",onChange:d=>{let m={enabled:d,time:u.time};e.onSave("autoUpdate",{maintenance:{autoUpdate:m}},P=>({...P,maintenance:{...P.maintenance,autoUpdate:m}}))}}),(0,n.jsx)("div",{className:"maint-time",children:(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:t("settings.maintenanceTime")}),(0,n.jsx)("input",{type:"time",value:u.time,disabled:N||f==="autoUpdate",onChange:d=>{let m={enabled:u.enabled,time:d.currentTarget.value||"04:00"};e.onSave("autoUpdate",{maintenance:{autoUpdate:m}},P=>({...P,maintenance:{...P.maintenance,autoUpdate:m}}))}})]})})]}),(0,n.jsx)("div",{className:"settings-maintenance-restart",children:(0,n.jsx)(D,{title:t("settings.autoRestart"),help:t("settings.autoRestartHelp"),checked:i.maintenance.autoRestart?.enabled===!0,disabled:S||f==="autoRestart",onChange:d=>{let m={enabled:d};e.onSave("autoRestart",{maintenance:{autoRestart:m}},P=>({...P,maintenance:{...P.maintenance,autoRestart:m}}))}})})]})}),e.updateBlock]})}),(0,n.jsx)("div",{className:"settings-status-row",children:(0,n.jsx)("span",{className:`oncall-status ${e.message?.cls??""}`,"data-settings-status":!0,children:e.message?.text??""})})]})}function Ce(e){let t=["settings-module",e.className].filter(Boolean).join(" ");return(0,n.jsxs)("section",{className:t,children:[(0,n.jsxs)("header",{className:"settings-module-heading",children:[(0,n.jsx)("h2",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),e.children]})}function je(e){let t=k(),i=e.settings.larkCliVersion,r=typeof i=="string"&&e.settings.larkCliMeetsRequirement===!0,g=r?t("settings.larkCliReady",{version:i}):typeof i=="string"?t("settings.larkCliOutdated",{version:i,minimum:e.settings.larkCliMinVersion??"-"}):t("settings.larkCliMissing");return(0,n.jsxs)("div",{className:`settings-lark-cli-status ${r?"is-ready":"is-warning"}`,children:[(0,n.jsx)("span",{"aria-hidden":"true"}),(0,n.jsx)("strong",{children:g}),r?null:(0,n.jsx)("code",{children:"npm i -g @larksuite/cli@latest"})]})}function ke(e){let t=["settings-group",e.className].filter(Boolean).join(" ");return(0,n.jsx)("section",{className:t,children:(0,n.jsx)("article",{className:"bd-card settings-group-card",children:e.children})})}function F(e){let t=["settings-block",e.className].filter(Boolean).join(" ");return(0,n.jsx)("section",{className:t,children:(0,n.jsxs)("article",{className:"bd-card settings-card",children:[(0,n.jsxs)("div",{className:"settings-block-title-row",children:[(0,n.jsx)("h2",{className:"bd-section-title",children:e.title}),e.titleExtra?(0,n.jsx)("div",{className:"settings-block-title-extra",children:e.titleExtra}):null]}),e.children]})})}function ze(e){let t=k(),[i,r]=(0,p.useState)(!1),g=(0,p.useRef)(!1),f=(0,p.useMemo)(()=>[{value:"",label:t("settings.codexNotifierTargetPlaceholder")},...e.value.botOptions.map(C=>({value:C.larkAppId,label:[C.botName||C.larkAppId,C.cliId].filter(Boolean).join(" \xB7 ")}))],[e.value.botOptions,t]),v=(0,p.useMemo)(()=>[{value:"locked_only",label:t("settings.codexNotifierLockedOnly")},{value:"always",label:t("settings.codexNotifierAlways")}],[t]),u=e.value.botOptions.find(C=>C.larkAppId===e.value.targetBotAppId),N=!e.value.targetBotAppId||u?.recipientConfigured!==!0||u?.recipientVerified!==!0||!e.value.targetDaemonOnline||!e.value.platformSupported&&e.value.notifyWhen==="locked_only",S=e.value.enabled||i,b=e.disabled||e.saving;(0,p.useEffect)(()=>{if(!i||e.value.enabled||N){g.current=!1;return}b||g.current||(g.current=!0,e.onSave({enabled:!0}))},[b,N,i,e.onSave,e.value.enabled]),(0,p.useEffect)(()=>{e.value.enabled&&i&&r(!1)},[i,e.value.enabled]);let B=C=>{if(!C){g.current=!1,r(!1),e.value.enabled&&e.onSave({enabled:!1});return}if(N){r(!0);return}e.onSave({enabled:!0})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D,{title:t("settings.codexNotifier"),help:t("settings.codexNotifierHelp"),checked:e.value.enabled||i,disabled:b,onChange:B}),S?(0,n.jsxs)("div",{className:"settings-codex-notifier-details",children:[e.value.enabled?null:(0,n.jsx)("p",{className:"settings-subfield-hint",children:t("settings.codexNotifierEnablePending")}),(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.codexNotifierTargetHelp"),children:t("settings.codexNotifierTarget")}),(0,n.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.codexNotifierTarget"),disabled:b,searchable:!0,value:e.value.targetBotAppId??"",label:H(f,e.value.targetBotAppId??""),options:f,onChange:C=>{e.onSave({targetBotAppId:C||null})}})]}),u?.recipientHint?(0,n.jsx)("p",{className:"settings-subfield-hint",children:t("settings.codexNotifierRecipient",{recipient:u.recipientHint})}):null,(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.codexNotifierNotifyWhenHelp"),children:t("settings.codexNotifierNotifyWhen")}),(0,n.jsx)(I,{className:"settings-field-menu",ariaLabel:t("settings.codexNotifierNotifyWhen"),disabled:b,value:e.value.notifyWhen,label:H(v,e.value.notifyWhen),options:v,onChange:C=>{e.onSave({notifyWhen:C})}})]}),e.value.targetBotAppId?u?.recipientConfigured!==!0?(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierRecipientMissing")}):e.value.targetDaemonOnline?u?.recipientVerified!==!0?(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierRecipientUnverified")}):!e.value.platformSupported&&e.value.notifyWhen==="locked_only"?(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierUnsupported")}):e.value.enabled?e.value.hookInstalled?e.value.workerOnline?e.value.lastError?(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierLastError",{error:e.value.lastError.message})}):e.value.pendingCount>0?(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierPending",{count:e.value.pendingCount})}):null:(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierWorkerPending")}):(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierHookPending")}):null:(0,n.jsx)("p",{className:"hint-warn-inline",children:t(e.value.enabled?"settings.codexNotifierDaemonOffline":"settings.codexNotifierTargetOffline")}):(0,n.jsx)("p",{className:"hint-warn-inline",children:t("settings.codexNotifierTargetRequired")})]}):null]})}function qe(e){let t=k(),i=e.value.trim(),r=e.effective||e.value.trim()||e.host,g=(0,p.useMemo)(()=>{let f=i&&!ye.includes(i)?[i,...ye]:ye;return[{value:"",label:t("settings.scheduleTimeZoneHost",{host:e.host})},...f.map(v=>({value:v,label:v}))]},[e.host,t,i]);return(0,n.jsxs)("div",{className:"settings-field-row settings-timezone-row",children:[(0,n.jsx)(M,{help:t("settings.scheduleTimeZoneHelp",{host:e.host,effective:r}),children:t("settings.scheduleTimeZone")}),(0,n.jsx)(I,{className:"settings-field-menu settings-timezone-menu",ariaLabel:t("settings.scheduleTimeZone"),value:i,label:H(g,i),options:g,disabled:e.disabled,onChange:f=>e.onSave(f===""?null:f)})]})}function D(e){return(0,n.jsxs)("label",{className:"toggle-row",children:[(0,n.jsx)("input",{type:"checkbox",checked:e.checked,disabled:e.disabled,onChange:t=>e.onChange(t.currentTarget.checked)}),(0,n.jsx)("span",{className:"switch","aria-hidden":"true"}),(0,n.jsx)("span",{className:"toggle-tx",children:(0,n.jsx)("strong",{children:(0,n.jsx)(M,{className:"settings-toggle-title",help:e.help,children:e.title})})})]})}var Ge=32;function Qe(e){let t=k(),[i,r]=(0,p.useState)(e.value);(0,p.useEffect)(()=>r(e.value),[e.value]);let g=i.trim().length>0,f=i===""||g,v=i!==e.value,u=()=>{e.disabled||!v||!f||e.onSave(i)};return(0,n.jsxs)("div",{className:"settings-subfield settings-group-prefix-editor",children:[(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.groupNamePrefixHelp"),children:t("settings.groupNamePrefix")}),(0,n.jsx)("input",{className:"settings-text-input",type:"text",value:i,maxLength:Ge,placeholder:t("settings.groupNamePrefixPlaceholder"),disabled:e.disabled,onChange:N=>r(N.currentTarget.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),u())}})]}),(0,n.jsx)("p",{className:"settings-subfield-hint","data-group-name-prefix-preview":!0,children:g?t("settings.groupNamePrefixPreview",{name:`${i}${t("settings.groupNamePrefixPreviewName")}`}):t("settings.groupNamePrefixDisabled")}),(0,n.jsx)("div",{className:"actions",children:(0,n.jsx)("button",{type:"button",className:"page-primary-action",disabled:e.disabled||!v||!f,onClick:u,children:t("settings.groupNamePrefixSave")})})]})}function Je(e){let t=k(),[i,r]=(0,p.useState)(e.value.source),[g,f]=(0,p.useState)(e.value.ref);(0,p.useEffect)(()=>{r(e.value.source),f(e.value.ref)},[e.value.source,e.value.ref]);let v=i.trim(),u=g.trim(),N=v!==e.value.source.trim()||u!==e.value.ref.trim(),S=()=>{e.disabled||!N||e.onSave({source:v,ref:u})};return(0,n.jsxs)("div",{className:"settings-subfield",children:[(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.herdrTraexPluginSourceHelp"),children:t("settings.herdrTraexPluginSource")}),(0,n.jsx)("input",{className:"settings-text-input",type:"text",value:i,placeholder:t("settings.herdrTraexPluginSourcePlaceholder"),disabled:e.disabled,onChange:b=>r(b.currentTarget.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),S())}})]}),(0,n.jsxs)("div",{className:"settings-field-row",children:[(0,n.jsx)(M,{help:t("settings.herdrTraexPluginRefHelp"),children:t("settings.herdrTraexPluginRef")}),(0,n.jsx)("input",{className:"settings-text-input",type:"text",value:g,placeholder:t("settings.herdrTraexPluginRefPlaceholder"),disabled:e.disabled,onChange:b=>f(b.currentTarget.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),S())}})]}),v?null:(0,n.jsx)("p",{className:"hint-warn-inline settings-subfield-hint",children:t("settings.herdrTraexPluginSourceRequired")}),e.value.recommendedSource&&(v!==e.value.recommendedSource||u!==e.value.recommendedRef)?(0,n.jsxs)("p",{className:"settings-subfield-hint",children:[t("settings.herdrTraexPluginRecommended")," ",(0,n.jsxs)("button",{type:"button",className:"settings-inline-link",disabled:e.disabled,onClick:()=>{r(e.value.recommendedSource),f(e.value.recommendedRef)},children:[e.value.recommendedSource,e.value.recommendedRef?` @ ${e.value.recommendedRef}`:""]})]}):null,(0,n.jsx)("div",{className:"actions",children:(0,n.jsx)("button",{type:"button",className:"page-primary-action",disabled:e.disabled||!N,onClick:S,children:t("settings.herdrTraexPluginSave")})})]})}function Xe(e){let t=k(),i;if(!e.canWrite)i=(0,n.jsx)("p",{className:"hint-warn",children:t("update.loginRequired")});else if(e.statusError)i=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"hint-warn",children:[t("update.checkFailed"),": ",e.statusError]}),(0,n.jsx)("div",{className:"update-actions",children:(0,n.jsx)("button",{type:"button","data-up":"check",onClick:e.onCheck,children:t("update.btnCheck")})})]});else if(!e.status)i=(0,n.jsx)(ce,{label:t("update.loading"),compact:!0});else{let r=e.status,g=r.localDevInstall||!r.updateSupported||e.busy;i=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"update-version",children:[(0,n.jsxs)("span",{children:[t("update.current"),": ",(0,n.jsxs)("strong",{children:["v",r.current]})]})," ",(0,n.jsx)(et,{status:r})]}),r.node.ok?null:(0,n.jsx)("p",{className:"hint-warn",children:t("update.nodeWarn",{version:r.node.version,required:r.node.required})}),!r.localDevInstall&&!r.updateSupported?(0,n.jsx)("p",{className:"hint-warn",children:t("update.unsupportedInstall")}):null,r.installs.multiple?(0,n.jsx)(tt,{entries:r.installs.entries}):null,(0,n.jsxs)("div",{className:"update-actions",children:[(0,n.jsx)("button",{type:"button","data-up":"check",disabled:e.busy,onClick:e.onCheck,children:t("update.btnCheck")}),(0,n.jsx)("button",{type:"button","data-up":"changelog",disabled:e.busy,onClick:e.onToggleChangelog,children:e.changelogOpen?t("update.btnChangelogHide"):t("update.btnChangelog")}),(0,n.jsx)("button",{type:"button",className:"page-primary-action","data-up":"update",disabled:g,onClick:e.onUpdate,children:t("update.btnUpdate")}),(0,n.jsx)("button",{type:"button","data-up":"restart",disabled:e.busy,onClick:e.onRestart,children:t("update.btnRestart")})]}),r.cliUpdates?.length?(0,n.jsx)(Ye,{entries:r.cliUpdates}):null,e.changelogOpen?(0,n.jsx)(nt,{changelog:e.changelog,ok:e.changelogOk,rateLimited:e.changelogRateLimited,releasesUrl:e.releasesUrl}):null,e.message?(0,n.jsx)("p",{className:`oncall-status ${e.message.cls??""}`,children:e.message.text}):null]})}return(0,n.jsx)(F,{className:"settings-update-block",title:t("update.section"),titleExtra:e.status?.localDevInstall?(0,n.jsx)("span",{className:"settings-title-note",children:t("update.localDev")}):e.status&&!e.status.updateSupported?(0,n.jsx)("span",{className:"settings-title-note",children:t("update.unsupportedInstall")}):null,children:i})}function Ye(e){let t=k();return(0,n.jsxs)("div",{className:"cli-runtime-updates",children:[(0,n.jsx)("strong",{children:t("update.runtimeTitle")}),(0,n.jsx)("ul",{children:e.entries.map(i=>(0,n.jsxs)("li",{className:i.updateAvailable?"is-behind":"",children:[(0,n.jsxs)("div",{className:"cli-runtime-update-head",children:[(0,n.jsx)("span",{children:"Codex"}),i.updateAvailable&&i.latest?(0,n.jsx)("span",{className:"update-badge update-badge-new",children:t("update.runtimeAvailable",{current:i.current??"?",latest:i.latest})}):i.latest?(0,n.jsx)("span",{className:"update-badge update-badge-ok",children:t("update.upToDate")}):(0,n.jsx)("span",{className:"hint-warn-inline",children:t("update.checkUnavailable")})]}),(0,n.jsx)("code",{children:i.binPath}),i.updateAvailable?(0,n.jsxs)("small",{children:[t("update.runtimeCommand"),": ",(0,n.jsx)("code",{children:i.updateCommand})]}):null]},`${i.cliId}:${i.binPath}`))}),(0,n.jsx)("p",{className:"settings-help",children:t("update.runtimeHelp")})]})}function et(e){let t=k(),i=e.status;return i.latest?i.behind?(0,n.jsx)("span",{className:"update-badge update-badge-new",children:t("update.newAvailable",{version:`v${i.latest}`})}):(0,n.jsx)("span",{className:"update-badge update-badge-ok",children:t("update.upToDate")}):(0,n.jsx)("span",{className:"hint-warn-inline",children:t("update.checkUnavailable")})}function tt(e){let t=k();return(0,n.jsxs)("div",{className:"hint-warn",children:[(0,n.jsx)("p",{children:t("update.multiInstallWarn")}),(0,n.jsx)("ul",{className:"update-install-list",children:e.entries.map(i=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:i.binPath})," \u2192 ",De(i.kind,t)," ",(0,n.jsx)("small",{children:i.root})]},`${i.binPath}:${i.root}`))})]})}function nt(e){let t=k();if(e.changelog===null)return(0,n.jsx)(ce,{label:t("update.changelogLoading"),compact:!0});if(!e.ok){let i=e.rateLimited?t("update.changelogRateLimited"):t("update.changelogFailed");return(0,n.jsxs)("p",{className:"hint-warn-inline",children:[i,e.releasesUrl?(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsx)("a",{href:e.releasesUrl,target:"_blank",rel:"noopener",children:t("update.changelogViewOnGitHub")})]}):null]})}return e.changelog.length===0?(0,n.jsx)("p",{className:"empty",children:t("update.changelogEmpty")}):(0,n.jsx)("div",{className:"update-changelog",children:e.changelog.map(i=>{let r=i.name&&i.name!==`v${i.version}`?i.name:"",g=i.publishedAt?new Date(i.publishedAt).toLocaleDateString():"";return(0,n.jsxs)("details",{className:"update-release",open:!0,children:[(0,n.jsxs)("summary",{children:[(0,n.jsxs)("strong",{children:["v",i.version]})," ",r," ",(0,n.jsx)("small",{children:g})," ",(0,n.jsx)("a",{href:i.url,target:"_blank",rel:"noopener",children:"\u2197"})]}),(0,n.jsx)("pre",{className:"update-release-body",children:i.body||""})]},i.version)})})}function gt(e){return Me(e,(0,n.jsx)(Ze,{}))}export{ze as CodexNotifierSettingsEditor,Qe as GroupNamePrefixRow,qe as TimeZoneRow,gt as renderSettingsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as K}from"./chunk-
|
|
1
|
+
import{c as K}from"./chunk-FLGXZJTD.js";import{b as Ce,c as je,d as te,h as _e,k as de}from"./chunk-QFMH6ITB.js";import{y as we}from"./chunk-KQB42ML5.js";import{a as He}from"./chunk-SYC6D5XU.js";import{a as bl,b as pl,d as Oe}from"./chunk-5THX4DI2.js";import{c as ce}from"./chunk-7SZRL6FY.js";var i=ce(bl(),1),qe=ce(pl(),1);var e=ce(Oe(),1),hl=2;function Sl(l,s){let o=String(l??"").replace(/\\/g,"/");return o.includes("/.codex/skills/")?s("skills.sourceCodex"):o.includes("/.claude/skills/")?s("skills.sourceClaude"):o.includes("/.trae/skills/")?s("skills.sourceTrae"):o.includes("/.cursor/skills/")?s("skills.sourceCursor"):o.includes("/.gemini/skills/")?s("skills.sourceGemini"):o.includes("/.config/opencode/skills/")?s("skills.sourceOpenCode"):null}function ze(l,s){let o=l.source??{};return o.type==="github"?`github:${o.owner}/${o.repo}/${o.path??""}`:o.type==="git"?`${o.url??"git"}#${o.path??""}`:o.type==="local-link"?Sl(o.path,s)??s("skills.sourceLocalLink"):o.type==="local-copy"?s("skills.sourceBotmuxCopy"):String(o.type??"unknown")}function ke(l){return(l?.include??[]).filter(s=>s.startsWith("skill:")).map(s=>s.slice(6))}function Nl(l){return ke(l).length}function wl(l){return ke(l).length>0}function ue(l){return`${l.cliId}
|
|
2
2
|
${l.rootDir}`}function Cl(l){return l>=1600?4:l<=620?1:l<=980?2:3}async function O(l,s){let o=await fetch(l,{...s,headers:{"content-type":"application/json",...s.headers??{}}}),k=await o.json().catch(()=>({}));if(!o.ok||k.ok===!1){let f=new Error(k?.error??`HTTP ${o.status}`);throw f.status=o.status,f.body=k,f}return k}function Re(l){return`oncall-status${l?` ${l.ok?"hint-ok":"hint-warn-inline"}`:""}`}function Ge(l){let s=l.options.find(o=>o.value===l.value);return(0,e.jsxs)("div",{className:"skills-segmented-control",children:[(0,e.jsx)("div",{className:"segmented skills-segmented",role:"group",children:l.options.map(o=>(0,e.jsx)("button",{type:"button",className:l.value===o.value?"active":"","aria-pressed":l.value===o.value?"true":"false",title:typeof o.help=="string"?o.help:void 0,disabled:l.disabled,onClick:()=>l.onChange(o.value),children:o.label},o.value))}),s?.help?(0,e.jsx)("span",{className:"skills-setting-hint",children:s.help}):null]})}function Rl(l){let s=K(),o=(0,i.useRef)(null),k=l.installCandidates??[],f=l.selectedInstallSkills??new Set,b=k.length>0&&k.every(r=>f.has(r.name)),y=l.installBusy||l.installDiscovering;return(0,i.useEffect)(()=>{let r=o.current;if(r)if(l.installSelectionOpen&&!r.open)try{r.showModal()}catch{}else!l.installSelectionOpen&&r.open&&r.close()},[l.installSelectionOpen,k.length]),(0,e.jsxs)("article",{className:"bd-card skills-install-panel",children:[l.showTitle===!1?null:(0,e.jsx)("div",{className:"skills-install-title",children:(0,e.jsx)("h3",{className:"bd-section-title",children:(0,e.jsx)(de,{help:s("skills.installInfo"),helpLabel:s("skills.installInfoLabel"),children:s("skills.install")})})}),(0,e.jsxs)("div",{className:"skills-install-grid",children:[(0,e.jsxs)("label",{className:"skills-source-label",children:[(0,e.jsx)(de,{help:(0,e.jsxs)("span",{className:"skills-source-help",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:s("skills.sourceHelpRemoteLabel")}),s("skills.sourceHelpRemote")]}),(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:s("skills.sourceHelpLocalLabel")}),s("skills.sourceHelpLocal")]}),(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:s("skills.sourceHelpAgentbuddyLabel")}),s("skills.sourceHelpAgentbuddy")]})]}),helpLabel:s("skills.source"),children:s("skills.source")}),(0,e.jsx)("div",{className:"skills-source-control",children:(0,e.jsx)("input",{type:"text","data-install":"source","aria-label":s("skills.source"),placeholder:s("skills.sourcePlaceholder"),value:l.installSource,onChange:r=>l.onInstallSourceChange(r.currentTarget.value)})})]}),(0,e.jsxs)("label",{className:"skills-install-field-wide skills-install-path-field",children:[(0,e.jsx)("span",{children:s("skills.path")}),(0,e.jsx)("input",{type:"text","data-install":"path",placeholder:s("skills.pathPlaceholder"),value:l.installPath,onChange:r=>l.onInstallPathChange(r.currentTarget.value)})]}),(0,e.jsxs)("label",{className:"skills-install-field-wide skills-install-ref-field",children:[(0,e.jsx)("span",{children:s("skills.ref")}),(0,e.jsx)("input",{type:"text","data-install":"ref",placeholder:s("skills.refPlaceholder"),value:l.installRef,onChange:r=>l.onInstallRefChange(r.currentTarget.value)})]}),(0,e.jsx)("div",{className:"skills-install-actions",children:(0,e.jsx)("button",{type:"button","data-action":"install",disabled:y,onClick:()=>l.onInstall(),children:l.installDiscovering?s("skills.scanning"):l.installBusy?s("skills.jobRunning"):s("skills.installSubmit")})}),(0,e.jsx)("div",{className:"skills-install-bottom-row",children:(0,e.jsxs)("div",{className:"skills-local-discovery-panel",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:s("skills.localDiscoverTitle")}),(0,e.jsx)("span",{children:s("skills.localDiscoverHelp")})]}),(0,e.jsx)("button",{type:"button","data-action":"open-native-skill-discovery",onClick:()=>l.onOpenNativeDiscovery(),children:s("skills.localDiscover")})]})})]}),l.installStatus?(0,e.jsx)("div",{className:"actions skills-install-status-row",children:(0,e.jsx)("span",{className:Re(l.installStatus),"data-skills-status":!0,children:l.installStatus.text})}):null,(0,e.jsx)("dialog",{className:"skills-discovery-dialog skills-install-selection-dialog","data-install-selection-dialog":!0,ref:o,onClose:()=>l.onCloseInstallSelection?.(),children:(0,e.jsxs)("article",{children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("h3",{children:s("skills.installSelectionTitle")}),(0,e.jsx)("p",{children:s("skills.installSelectionHelp",{count:k.length})})]}),(0,e.jsx)("div",{className:"skills-discovery-body skills-install-selection-body",children:(0,e.jsxs)("div",{className:"skills-candidate-list","data-install-candidates":!0,children:[(0,e.jsxs)("div",{className:"skills-candidate-list-head",children:[(0,e.jsx)("span",{children:s("skills.scanFound",{count:k.length})}),l.onSelectAllInstallSkills?(0,e.jsx)("button",{type:"button","data-action":"toggle-all-source-skills",disabled:l.installBusy,onClick:()=>l.onSelectAllInstallSkills?.(!b),children:s(b?"skills.discoverClearSelection":"skills.discoverSelectAll")}):null]}),k.map(r=>(0,e.jsxs)("label",{className:"skills-candidate-row",children:[(0,e.jsx)("input",{type:"checkbox",checked:f.has(r.name),disabled:l.installBusy,onChange:()=>l.onToggleInstallSkill?.(r.name)}),(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:r.name}),(0,e.jsxs)("small",{children:[r.path,r.description?` \xB7 ${r.description}`:""]})]})]},`${r.name}:${r.path}`))]})}),(0,e.jsxs)("footer",{className:"actions",children:[(0,e.jsx)("button",{type:"button","data-action":"close-install-selection",disabled:l.installBusy,onClick:()=>l.onCloseInstallSelection?.(),children:s("skills.installSelectionCancel")}),(0,e.jsx)("button",{type:"button",className:"primary","data-action":"confirm-install-selection",disabled:l.installBusy||f.size===0,onClick:()=>l.onConfirmInstallSelection?.(),children:l.installBusy?s("skills.jobRunning"):s("skills.installSelected")})]})]})})]})}function Il(l){let s=K(),o=(0,i.useRef)(null),k=(0,i.useRef)(new Set(l.skills.map(a=>a.name))),f=(0,i.useRef)(""),b=(0,i.useRef)(!1),y=(0,i.useRef)(null),[r,p]=(0,i.useState)(""),[w,R]=(0,i.useState)(!1),[I,D]=(0,i.useState)(()=>new Set),[x,A]=(0,i.useState)(0),[M,j]=(0,i.useState)(()=>typeof window>"u"?1200:window.innerWidth),L=r.trim().toLocaleLowerCase();f.current=r,b.current=w;let h=(0,i.useMemo)(()=>L?l.skills.filter(a=>[a.name,a.displayName,a.description,...a.tags??[],ze(a,s)].filter(Boolean).join(`
|
|
3
3
|
`).toLocaleLowerCase().includes(L)):l.skills,[L,l.skills,s]),B=Cl(M)*hl,T=Math.max(1,Math.ceil(h.length/B)),F=h.slice(x*B,x*B+B),q=(0,i.useMemo)(()=>new Set(h.map(a=>a.name)),[h]),_=h.filter(a=>I.has(a.name)).length,z=Math.max(0,I.size-_),c=h.length>0&&_===h.length;(0,i.useEffect)(()=>{if(typeof window>"u")return;let a=()=>j(window.innerWidth);return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),(0,i.useEffect)(()=>A(0),[L,B]),(0,i.useEffect)(()=>{A(a=>Math.min(Math.max(0,a),T-1))},[T]),(0,i.useEffect)(()=>{let a=new Set(l.skills.map(u=>u.name)),C=[...k.current].some(u=>!a.has(u));D(u=>{let P=new Set([...u].filter(H=>a.has(H)));return P.size===u.size?u:P}),C&&(R(!1),D(new Set)),k.current=a},[l.skills]),(0,i.useEffect)(()=>{o.current&&(o.current.indeterminate=_>0&&!c)},[c,_]),(0,i.useEffect)(()=>{if(typeof document>"u")return;let a=u=>{if(u.key!=="Escape"||!b.current)return;let P=f.current;y.current=P,u.preventDefault(),u.stopPropagation(),R(!1),D(new Set),window.setTimeout(()=>{p(H=>H||P),y.current=null},50)},C=u=>{if(u.key!=="Escape"||y.current===null)return;let P=y.current;y.current=null,u.preventDefault(),u.stopPropagation(),p(P)};return document.addEventListener("keydown",a,!0),document.addEventListener("keyup",C,!0),()=>{document.removeEventListener("keydown",a,!0),document.removeEventListener("keyup",C,!0)}},[]);function g(a){D(C=>{let u=new Set(C);return u.has(a)?u.delete(a):u.add(a),u})}function S(){D(a=>{let C=new Set(a);if(c)for(let u of q)C.delete(u);else for(let u of q)C.add(u);return C})}function $(a=!1){let C=r;R(!1),D(new Set),a&&typeof window<"u"&&window.setTimeout(()=>p(C),0)}return(0,e.jsxs)("section",{className:"skills-installed-block",children:[(0,e.jsx)(te,{title:s("skills.installed"),count:s("skills.installedCount",{count:l.skills.length}),hint:s("skills.installedHelp"),children:(0,e.jsx)("div",{className:"skills-installed-header-actions",children:w?(0,e.jsx)("button",{type:"button","data-action":"cancel-installed-selection",onClick:()=>$(),children:s("skills.cancel")}):(0,e.jsx)("button",{type:"button","data-action":"select-installed-skills",disabled:l.skills.length===0,onClick:()=>R(!0),children:s("skills.select")})})}),(0,e.jsxs)("section",{className:"bd-card skills-installed-panel",children:[(0,e.jsxs)("div",{className:"skills-library-toolbar",children:[(0,e.jsxs)("label",{className:"skills-installed-search",children:[(0,e.jsx)("span",{className:"sr-only",children:s("skills.searchLabel")}),(0,e.jsx)("input",{type:"text",role:"searchbox",inputMode:"search","data-action":"search-installed-skills",placeholder:s("skills.searchPlaceholder"),value:r,onChange:a=>p(a.currentTarget.value),onKeyDown:a=>{a.key!=="Escape"||!w||(a.preventDefault(),a.stopPropagation(),$(!0))}}),r?(0,e.jsx)("button",{type:"button","data-action":"clear-installed-search","aria-label":s("skills.clearSearch"),onClick:()=>p(""),children:"\xD7"}):null]}),w?(0,e.jsxs)("label",{className:"skills-select-all-results",children:[(0,e.jsx)("input",{ref:o,type:"checkbox",checked:c,disabled:h.length===0||l.removingNames.size>0,onChange:S}),(0,e.jsx)("span",{children:L?s("skills.selectSearchResults",{count:h.length}):s("skills.selectAllSkills",{count:h.length})})]}):null,L?(0,e.jsx)("span",{className:"skills-filter-count",children:s("skills.resultCount",{count:h.length})}):null,T>1?(0,e.jsxs)("div",{className:"skills-pager",children:[(0,e.jsx)("button",{type:"button",className:"skills-pager-button","data-action":"page-installed-skills","data-dir":"-1","aria-label":s("skills.prevPage"),title:s("skills.prevPage"),disabled:x===0,onClick:()=>A(a=>Math.max(0,a-1)),children:"\u2039"}),(0,e.jsx)("span",{children:s("skills.pageStatus",{page:x+1,pages:T})}),(0,e.jsx)("button",{type:"button",className:"skills-pager-button","data-action":"page-installed-skills","data-dir":"1","aria-label":s("skills.nextPage"),title:s("skills.nextPage"),disabled:x>=T-1,onClick:()=>A(a=>Math.min(T-1,a+1)),children:"\u203A"})]}):null]}),(0,e.jsx)("div",{className:"skills-installed-live",role:"status","aria-live":"polite",children:l.status?(0,e.jsx)("span",{className:Re(l.status),children:l.status.text}):null}),l.skills.length===0?(0,e.jsxs)("div",{className:"skills-library-empty",children:[(0,e.jsx)("strong",{children:s("skills.emptyTitle")}),(0,e.jsx)("p",{children:s("skills.emptyHelp")})]}):h.length===0?(0,e.jsxs)("div",{className:"skills-library-empty","data-empty":"search",children:[(0,e.jsx)("strong",{children:s("skills.noResultsTitle",{query:r.trim()})}),(0,e.jsx)("p",{children:s("skills.noResultsHelp")}),(0,e.jsx)("button",{type:"button","data-action":"clear-installed-search-empty",onClick:()=>p(""),children:s("skills.clearSearch")})]}):(0,e.jsx)("div",{className:"skills-list",children:F.map(a=>{let C=I.has(a.name),u=l.removingNames.has(a.name);return(0,e.jsxs)("article",{className:`skills-row skills-installed-card${w?" is-selectable":""}${C?" is-selected":""}${u?" is-removing":""}`,"data-skill":a.name,"data-selection-mode":w?"true":void 0,"aria-busy":u||void 0,onClick:w?()=>g(a.name):void 0,children:[(0,e.jsxs)("div",{className:"skills-row-body",children:[(0,e.jsxs)("div",{className:"skills-row-title",children:[w?(0,e.jsx)("input",{type:"checkbox","aria-label":s("skills.selectNamed",{skill:a.displayName??a.name}),checked:C,disabled:u,onClick:P=>P.stopPropagation(),onChange:()=>g(a.name)}):null,(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:a.displayName??a.name}),a.displayName&&a.displayName!==a.name?(0,e.jsx)("small",{className:"skills-canonical-name",children:a.name}):null]})]}),a.description?(0,e.jsx)("p",{children:a.description}):null,(0,e.jsx)("small",{className:"skills-source-badge",children:ze(a,s)}),u?(0,e.jsx)("span",{className:"skills-removing-label",children:s("skills.removing")}):null]}),w?null:(0,e.jsxs)("div",{className:"skills-card-actions",children:[(0,e.jsx)("button",{type:"button","data-action":"update-skill",disabled:l.busySkill===`${a.name}:update`||u,onClick:()=>l.onUpdate(a.name),children:s("skills.update")}),(0,e.jsx)("button",{type:"button","data-action":"remove-skill",disabled:u,onClick:()=>l.onRequestRemove([a.name]),children:s("skills.remove")})]})]},a.name)})})]}),w?(0,e.jsxs)("div",{className:"skills-bulk-action-bar",role:"toolbar","aria-label":s("skills.bulkActions"),children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:s("skills.selectedCount",{count:I.size})}),z>0?(0,e.jsx)("small",{children:s("skills.selectedHidden",{count:z})}):null]}),(0,e.jsx)("button",{type:"button",className:"danger","data-action":"remove-selected-skills",disabled:I.size===0||l.removingNames.size>0,onClick:()=>l.onRequestRemove([...I]),children:s("skills.removeSelected",{count:I.size})})]}):null]})}function Pl(l){let s=K(),o=(0,i.useRef)(null),k=l.names??[],f=l.references.length>0,b=k.slice(0,3),y=new Set(l.references.flatMap(r=>r.bots)).size;return(0,i.useEffect)(()=>{let r=o.current;if(r)if(l.names&&!r.open)try{r.showModal()}catch{}else!l.names&&r.open&&r.close()},[l.names]),(0,e.jsx)("dialog",{className:"skills-remove-dialog","data-remove-skills-dialog":!0,ref:o,onCancel:r=>{r.preventDefault(),l.busy||l.onCancel()},onClick:r=>{r.target===r.currentTarget&&!l.busy&&l.onCancel()},children:(0,e.jsxs)("article",{children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("h3",{children:f?k.length===1?s("skills.removeInUseOneTitle",{skill:k[0]}):s("skills.removeInUseManyTitle",{count:k.length}):k.length===1?s("skills.removeOneTitle",{skill:k[0]}):s("skills.removeManyTitle",{count:k.length})}),(0,e.jsx)("p",{children:f?k.length===1?s("skills.removeInUseOneHelp",{count:y}):s("skills.removeInUseManyHelp",{count:y}):k.length===1?s("skills.removeOnePermanentHelp"):s("skills.removePermanentHelp")})]}),(0,e.jsxs)("div",{className:"skills-remove-dialog-body",children:[k.length>1?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("ul",{children:b.map(r=>(0,e.jsx)("li",{children:r},r))}),k.length>b.length?(0,e.jsx)("p",{children:s("skills.removeMore",{count:k.length-b.length})}):null]}):null,l.references.length>0?(0,e.jsxs)("div",{className:"skills-remove-reference-warning",role:"alert",children:[(0,e.jsx)("strong",{children:s("skills.removeReferencesDetail")}),(0,e.jsx)("ul",{children:l.references.map(r=>(0,e.jsxs)("li",{children:[(0,e.jsx)("strong",{children:r.name}),(0,e.jsx)("span",{children:r.bots.join(", ")})]},r.name))})]}):null,l.error?(0,e.jsx)("p",{className:"hint-warn",role:"alert",children:l.error}):null]}),(0,e.jsxs)("footer",{className:"actions",children:[(0,e.jsx)("button",{type:"button",autoFocus:!0,disabled:l.busy,onClick:l.onCancel,children:s("skills.cancel")}),(0,e.jsx)("button",{type:"button",className:"danger",disabled:l.busy,onClick:()=>l.onConfirm(f),children:l.busy?s("skills.removing"):f?s("skills.removeAnyway"):k.length===1?s("skills.removeOneConfirm"):s("skills.removeSelected",{count:k.length})})]})]})})}function Tl(){let l=K(),s=(0,i.useRef)(!0),o=(0,i.useRef)(new Set),k=(0,i.useRef)(null),[f,b]=(0,i.useState)([]),[y,r]=(0,i.useState)([]),[p,w]=(0,i.useState)([]),[R,I]=(0,i.useState)("off"),[D,x]=(0,i.useState)("auto"),[A,M]=(0,i.useState)(null),[j,L]=(0,i.useState)(!0),[h,B]=(0,i.useState)(""),[T,F]=(0,i.useState)(""),[q,_]=(0,i.useState)(""),[z,c]=(0,i.useState)(null),[g,S]=(0,i.useState)(!1),[$,a]=(0,i.useState)(!1),[C,u]=(0,i.useState)(!1),[P,H]=(0,i.useState)([]),[Q,U]=(0,i.useState)(()=>new Set),[W,X]=(0,i.useState)(!1),[Je,Ie]=(0,i.useState)(!1),[me,Ke]=(0,i.useState)(null),[ge,fe]=(0,i.useState)(()=>new Set),[Pe,ne]=(0,i.useState)(null),[Ue,Te]=(0,i.useState)(null),[We,De]=(0,i.useState)(null),[Fe,ve]=(0,i.useState)({}),[ye,V]=(0,i.useState)(null),[xe,be]=(0,i.useState)(null),[Qe,Y]=(0,i.useState)(!1),[Xe,ie]=(0,i.useState)([]),[Ve,ae]=(0,i.useState)(null),[Z,Ae]=(0,i.useState)(()=>new Set),ee=(0,i.useMemo)(()=>new Set(f.map(t=>t.name)),[f]),J=(0,i.useMemo)(()=>y.length===0?void 0:(me?y.find(n=>ue(n)===me):void 0)??y.find(n=>n.skills.length>0)??y[0],[me,y]),pe=J?ue(J):"",le=(0,i.useMemo)(()=>J?J.skills.filter(t=>!ee.has(t.name)).map(t=>t.rootDir??t.source?.root??"").filter(Boolean):[],[J,ee]),Me=le.length>0&&le.every(t=>ge.has(t)),Le=(0,i.useCallback)(()=>{for(let t of o.current)window.clearTimeout(t);o.current.clear()},[]),Ye=(0,i.useCallback)(t=>new Promise(n=>{let d=window.setTimeout(()=>{o.current.delete(d),n()},t);o.current.add(d)}),[]),Ee=(0,i.useCallback)(async()=>{let[t,n]=await Promise.all([fetch("/api/skills"),fetch("/api/bots")]),d=await t.json().catch(()=>({})),m=await n.json().catch(()=>({}));if(!t.ok){let v=d?.error??`skills HTTP ${t.status}`;throw new Error(v==="not_found_yet"||v==="not_found"?l("skills.apiUnavailable"):v)}if(!n.ok)throw new Error(m?.error??`bots HTTP ${n.status}`);return{skills:Array.isArray(d.skills)?d.skills:[],nativeSkillGroups:Array.isArray(d.nativeSkillGroups)?d.nativeSkillGroups:[],bots:Array.isArray(m.bots)?m.bots:[],trustProjectSkills:d.trustProjectSkills==="all"?"all":"off",delivery:d.delivery==="prompt"||d.delivery==="native"?d.delivery:"auto"}},[l]),se=(0,i.useCallback)(async()=>{L(!0);try{let t=await Ee();if(!s.current)return;b(t.skills),r(t.nativeSkillGroups),w(t.bots),I(t.trustProjectSkills),x(t.delivery),M(null),fe(n=>{let d=new Set,m=new Set(t.skills.map(v=>v.name));for(let v of t.nativeSkillGroups)for(let N of v.skills){let E=N.rootDir??N.source?.root??"";E&&!m.has(N.name)&&n.has(E)&&d.add(E)}return d})}catch(t){if(!s.current)return;M(t?.message??String(t))}finally{s.current&&L(!1)}},[Ee]);(0,i.useEffect)(()=>(s.current=!0,se(),()=>{s.current=!1,Le()}),[Le,se]),(0,i.useEffect)(()=>{if(!ye||Z.size>0)return;let t=window.setTimeout(()=>{s.current&&V(null)},6e3);return()=>window.clearTimeout(t)},[ye,Z]),(0,i.useEffect)(()=>{let t=k.current;if(t)if(W&&!t.open)try{t.showModal()}catch{}else!W&&t.open&&t.close()},[W,pe]);async function Be(t,n,d=!0){let m=t;for(n({text:l("skills.jobRunning"),ok:!0});;){if(!s.current)return;if(m.status==="succeeded"){n({text:l("skills.saved"),ok:!0}),d&&await se();return}if(m.status==="failed")throw new Error(m.error??"job_failed");if(await Ye(800),!s.current)return;let v=await O(`/api/skills/jobs/${encodeURIComponent(m.id)}`,{method:"GET"});if(!s.current)return;m=v.job}}function Ze(t){return p.filter(n=>ke(n.skills).includes(t)).map(n=>n.botName??n.larkAppId)}function oe(){H([]),U(new Set),u(!1)}function $e(){return{source:h.trim(),path:T.trim()||void 0,ref:q.trim()||void 0}}function el(t){let n=t??[...Q];return{...$e(),skillNames:n.length>0?n:void 0}}async function ll(){a(!0),c({text:l("skills.scanning"),ok:!0});try{let t=await O("/api/skills/discover",{method:"POST",body:JSON.stringify($e())});if(!s.current)return{skills:[],directInstall:!1};let n=t.discovery?.directInstall===!0,d=Array.isArray(t.discovery?.skills)?t.discovery.skills:[];return H(d),U(new Set(d.map(m=>m.name))),{skills:d,directInstall:n}}finally{s.current&&a(!1)}}function G(t){let n=t||"";return n.startsWith("skill_git_command_failed")&&/authentication failed|could not read username|repository not found|unauthor|\b401\b|\b403\b/i.test(n)?l("skills.gitNeedsAuth"):n.startsWith("agentbuddy_not_found")?l("skills.agentbuddyNotFound"):n.startsWith("agentbuddy_command_failed")?/login|credential|unauthor|not logged|401|403/i.test(n)?l("skills.agentbuddyNeedsLogin"):l("skills.agentbuddyCommandFailed"):n.startsWith("agentbuddy_clear_telemetry_failed")||n.startsWith("agentbuddy_telemetry_not_stripped")?l("skills.agentbuddyTelemetryFailed"):n.startsWith("agentbuddy_no_skill_produced")?l("skills.agentbuddyNoSkill"):n.startsWith("invalid_agentbuddy")?l("skills.agentbuddyInvalid"):n}async function he(t){S(!0);try{let n=await O("/api/skills/install",{method:"POST",body:JSON.stringify(el(t))});if(!s.current)return;await Be(n.job,c),s.current&&oe()}catch(n){s.current&&c({text:`${l("skills.failed")}: ${G(n?.message??String(n))}`,ok:!1})}finally{s.current&&S(!1)}}function sl(t){U(n=>{let d=new Set(n);return d.has(t)?d.delete(t):d.add(t),d})}function tl(t){U(t?new Set(P.map(n=>n.name)):new Set)}async function nl(){if(!h.trim()){c({text:l("skills.sourceRequired"),ok:!1});return}try{u(!1);let{skills:t,directInstall:n}=await ll();if(!s.current)return;if(n){await he();return}if(t.length===0){c({text:l("skills.scanEmpty"),ok:!1});return}if(t.length===1){await he([t[0].name]);return}c({text:l("skills.scanFound",{count:t.length}),ok:!0}),u(!0)}catch(t){s.current&&c({text:`${l("skills.failed")}: ${G(t?.message??String(t))}`,ok:!1})}}async function il(){let t=[...Q];if(t.length===0){c({text:l("skills.discoverNothingSelected"),ok:!1});return}await he(t)}async function al(){let t=[...ge].filter(Boolean);if(t.length===0){c({text:l("skills.discoverNothingSelected"),ok:!1});return}Ie(!0);try{if(c({text:l("skills.discoverRegisteringBatch",{total:t.length}),ok:!0}),await O("/api/skills/install-local-links",{method:"POST",body:JSON.stringify({sources:t})}),!s.current)return;X(!1),await se(),s.current&&c({text:l("skills.saved"),ok:!0})}catch(n){s.current&&c({text:`${l("skills.failed")}: ${G(n?.message??String(n))}`,ok:!1})}finally{s.current&&Ie(!1)}}async function ol(t){if(R!==t){ne("project");try{let n=await O("/api/skills/global",{method:"PUT",body:JSON.stringify({trustProjectSkills:t})});if(!s.current)return;I(n.trustProjectSkills==="all"?"all":t)}catch(n){s.current&&window.alert(`${l("skills.failed")}: ${G(n?.message??String(n))}`)}finally{s.current&&ne(null)}}}async function rl(t){if(D!==t){ne("delivery");try{let n=await O("/api/skills/global",{method:"PUT",body:JSON.stringify({delivery:t})});if(!s.current)return;x(n.delivery==="prompt"||n.delivery==="native"?n.delivery:t)}catch(n){s.current&&window.alert(`${l("skills.failed")}: ${G(n?.message??String(n))}`)}finally{s.current&&ne(null)}}}async function cl(t){Te(`${t}:update`);try{let n=await O(`/api/skills/${encodeURIComponent(t)}/update`,{method:"POST",body:"{}"});if(!s.current)return;await Be(n.job,c)}catch(n){s.current&&window.alert(`${l("skills.failed")}: ${G(n?.message??String(n))}`)}finally{s.current&&Te(null)}}function dl(t){let n=[...new Set(t.filter(d=>ee.has(d)))];n.length!==0&&(be(n),Y(!0),ie([]),ae(null))}function ul(){Z.size>0||(Y(!1),be(null),ie([]),ae(null))}async function kl(t){let n=xe??[];if(n.length!==0){Ae(new Set(n)),Y(!1),ae(null),V({text:l("skills.removingCount",{count:n.length}),ok:!0});try{let d=await O("/api/skills",{method:"DELETE",body:JSON.stringify({names:n,force:t})});if(!s.current)return;let m=Array.isArray(d.removed)?d.removed.filter(N=>typeof N=="string"):n,v=new Set(m);b(N=>N.filter(E=>!v.has(E.name))),V({text:m.length===1?l("skills.removedOne",{skill:m[0]}):l("skills.removedMany",{count:m.length}),ok:!0}),be(null),ie([])}catch(d){if(!s.current)return;if(d?.status===409&&d?.body?.error==="skills_in_use"){let v=Array.isArray(d.body.affectedSkills)?d.body.affectedSkills.map(N=>{let E=typeof N?.name=="string"?N.name:"",Se=Array.isArray(N?.affectedBots)?N.affectedBots.map(re=>re?.botName||re?.larkAppId||"").filter(Boolean):Ze(E);return E?{name:E,bots:Se}:null}).filter(N=>N!==null):[];ie(v),Y(!0),V(null);return}let m=l("skills.removeFailed",{detail:G(d?.message??String(d))});ae(m),Y(!0),V({text:m,ok:!1})}finally{s.current&&Ae(new Set)}}}async function ml(t,n){let d=`${t}:set`;De(d),ve(m=>({...m,[t]:null}));try{let m=await O(`/api/bots/${encodeURIComponent(t)}/skills`,{method:"PUT",body:JSON.stringify({action:"set",policy:n.length>0?{include:n.map(v=>`skill:${v}`)}:null})});if(!s.current)return;w(v=>v.map(N=>N.larkAppId===t?{...N,skills:m.skills??null}:N)),ve(v=>({...v,[t]:{text:l("skills.policySaved"),ok:!0}}))}catch(m){throw s.current&&ve(v=>({...v,[t]:{text:`${l("skills.failed")}: ${G(m?.message??String(m))}`,ok:!1}})),m}finally{s.current&&De(null)}}let gl=p.filter(t=>wl(t.skills)).length,fl=p.reduce((t,n)=>t+Nl(n.skills),0),vl=(0,e.jsxs)("div",{className:"page-heading-actions skills-heading-actions",children:[(0,e.jsxs)("div",{className:"skills-metric-strip",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("small",{children:l("skills.metricInstalled")}),(0,e.jsx)("strong",{children:f.length})]}),(0,e.jsxs)("span",{children:[(0,e.jsx)("small",{children:l("skills.metricBots")}),(0,e.jsxs)("strong",{children:[gl,"/",p.length]})]}),(0,e.jsxs)("span",{children:[(0,e.jsx)("small",{children:l("skills.metricAttached")}),(0,e.jsx)("strong",{children:fl})]})]}),(0,e.jsx)(_e,{id:"skills-refresh",label:l("skills.refresh"),busy:j,disabled:j,onClick:()=>{se()}})]}),yl=(0,e.jsx)("div",{className:"skills-page-stack",children:j?(0,e.jsx)(je,{label:l("common.loading")}):A?(0,e.jsx)("p",{className:"hint-warn",children:A}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"skills-config-row",children:[(0,e.jsxs)("section",{className:"skills-config-block",children:[(0,e.jsx)(te,{title:l("skills.globalDefaults")}),(0,e.jsxs)("article",{className:"bd-card skills-defaults-panel skills-config-card",children:[(0,e.jsxs)("div",{className:"skills-control-block",children:[(0,e.jsx)("span",{className:"skills-control-label",children:l("skills.globalProject")}),(0,e.jsx)(Ge,{value:R,disabled:Pe==="project",options:[{value:"off",label:l("skills.globalProjectOff"),help:l("skills.globalProjectOffHelp")},{value:"all",label:l("skills.globalProjectAll"),help:l("skills.globalProjectAllHelp")}],onChange:t=>{ol(t)}})]}),(0,e.jsxs)("div",{className:"skills-control-block",children:[(0,e.jsx)("span",{className:"skills-control-label",children:l("skills.globalDelivery")}),(0,e.jsx)(Ge,{value:D,disabled:Pe==="delivery",options:[{value:"auto",label:l("skills.deliveryAuto"),help:l("skills.deliveryAutoHelp")},{value:"prompt",label:l("skills.deliveryPrompt"),help:l("skills.deliveryPromptHelp")},{value:"native",label:l("skills.deliveryNative"),help:l("skills.deliveryNativeHelp")}],onChange:t=>{rl(t)}})]})]})]}),(0,e.jsxs)("section",{className:"skills-config-block",children:[(0,e.jsx)(te,{title:(0,e.jsx)(de,{help:l("skills.installInfo"),helpLabel:l("skills.installInfoLabel"),children:l("skills.install")})}),(0,e.jsx)(Rl,{showTitle:!1,installSource:h,installPath:T,installRef:q,installStatus:z,installBusy:g,installDiscovering:$,installSelectionOpen:C,installCandidates:P,selectedInstallSkills:Q,onInstallSourceChange:t=>{B(t),oe()},onInstallPathChange:t=>{F(t),oe()},onInstallRefChange:t=>{_(t),oe()},onToggleInstallSkill:sl,onSelectAllInstallSkills:tl,onConfirmInstallSelection:()=>{il()},onCloseInstallSelection:()=>u(!1),onInstall:()=>{nl()},onOpenNativeDiscovery:()=>X(!0)})]}),(0,e.jsxs)("section",{className:"skills-config-block",children:[(0,e.jsx)(te,{title:l("skills.bots"),count:l("skills.botCount",{count:p.length}),hint:l("skills.botsHelp")}),(0,e.jsx)("section",{className:"bd-card skills-bots-panel skills-config-card",children:(0,e.jsx)("div",{className:"skills-bot-grid",children:p.map(t=>(0,e.jsx)(Al,{bot:t,installedNames:ee,skills:f,status:Fe[t.larkAppId]??null,busyKey:We,onSave:ml},t.larkAppId))})})]})]}),(0,e.jsx)(Il,{skills:f,busySkill:Ue,removingNames:Z,status:ye,onUpdate:t=>{cl(t)},onRequestRemove:dl}),(0,e.jsx)(Pl,{names:Qe?xe:null,references:Xe,busy:Z.size>0,error:Ve,onCancel:ul,onConfirm:t=>{kl(t)}}),(0,e.jsx)("dialog",{className:"skills-discovery-dialog",id:"skills-discovery-dialog",ref:k,onClose:()=>X(!1),onClick:t=>{t.target===t.currentTarget&&X(!1)},children:(0,e.jsxs)("article",{children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("h3",{children:l("skills.discoverTitle")}),(0,e.jsx)("p",{children:l("skills.discoverHelp")}),(0,e.jsx)("button",{type:"button",className:"skills-discovery-close","data-action":"close-discovery","aria-label":l("skills.discoverClose"),title:l("skills.discoverClose"),onClick:()=>X(!1)})]}),(0,e.jsx)("div",{className:"skills-discovery-body",children:J?(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"skills-discovery-layout",children:[(0,e.jsx)("div",{className:"skills-discovery-tabs",role:"tablist","aria-label":l("skills.discoverTitle"),children:y.map(t=>{let n=ue(t),d=n===pe;return(0,e.jsxs)("button",{type:"button",role:"tab","data-discovery-tab":n,className:d?"selected":"","aria-selected":d?"true":"false",onClick:()=>Ke(n),children:[(0,e.jsx)("strong",{children:t.label??t.cliId}),(0,e.jsx)("small",{children:l("skills.skillCount",{count:t.skills.length})})]},n)})}),(0,e.jsxs)("div",{className:"skills-discovery-main",children:[(0,e.jsx)("div",{className:"skills-discovery-path",children:(0,e.jsx)("code",{children:J.rootDir})}),y.map(t=>{let n=ue(t);return(0,e.jsx)("section",{className:"skills-discovery-group","data-discovery-panel":n,hidden:!(n===pe),children:t.skills.length===0?(0,e.jsx)("p",{className:"empty",children:l("skills.discoverGroupEmpty")}):(0,e.jsx)("div",{className:"skills-discovery-list",children:t.skills.map(m=>{let v=ee.has(m.name),N=m.rootDir??m.source?.root??"";return(0,e.jsxs)("label",{className:`skills-discovery-row${v?" installed":""}`,children:[(0,e.jsx)("input",{type:"checkbox","data-discovered-skill":!0,value:N,disabled:v,checked:!v&&ge.has(N),onChange:E=>{let Se=E.currentTarget.checked;fe(re=>{let Ne=new Set(re);return Se?Ne.add(N):Ne.delete(N),Ne})}}),(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{children:m.name}),m.description?(0,e.jsx)("small",{children:m.description}):null]}),v?(0,e.jsx)("em",{children:l("skills.discoverRegistered")}):null]},`${m.name}:${N}`)})})},n)})]})]})}):(0,e.jsx)("p",{className:"empty",children:l("skills.discoverEmpty")})}),(0,e.jsxs)("footer",{className:"actions",children:[(0,e.jsx)("button",{type:"button","data-action":"toggle-discovered-skills",disabled:le.length===0,onClick:()=>{fe(t=>{let n=new Set(t);return Me?le.forEach(d=>n.delete(d)):le.forEach(d=>n.add(d)),n})},children:l(Me?"skills.discoverClearSelection":"skills.discoverSelectAll")}),(0,e.jsx)("button",{type:"button",className:"primary","data-action":"register-discovered-skills",disabled:Je,onClick:()=>{al()},children:l("skills.discoverRegister")})]})]})})]})});return(0,e.jsxs)("section",{className:"page skills-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:l("nav.skills")}),(0,e.jsx)("h1",{children:l("skills.title")})]}),vl]}),(0,e.jsx)("div",{id:"skills-body",children:yl})]})}function Dl(l,s){return l.size===s.length&&s.every(o=>l.has(o))}function xl(l){let s=K(),o=(0,i.useRef)(null),k=(0,i.useRef)(null),f=(0,i.useRef)(null),[b,y]=(0,i.useState)(!1),[r,p]=(0,i.useState)(""),[w,R]=(0,i.useState)(()=>new Set(l.names)),[I,D]=(0,i.useState)(null),x=l.names.join(`
|
|
4
4
|
`),A=r.trim().toLocaleLowerCase(),M=(0,i.useMemo)(()=>{let c=new Map(l.skills.map(g=>[g.name,g]));for(let g of l.names)c.has(g)||c.set(g,{name:g});return[...c.values()].sort((g,S)=>g.name.localeCompare(S.name))},[l.names,l.skills]),j=(0,i.useMemo)(()=>A?M.filter(c=>`${c.name} ${c.description||""}`.toLocaleLowerCase().includes(A)):M,[A,M]),L=!Dl(w,l.names),h=(0,i.useCallback)(()=>{let c=k.current;if(!c||typeof window>"u")return;let g=c.getBoundingClientRect(),S=12,$=7,a=Math.min(370,Math.max(260,window.innerWidth-S*2)),C=Math.min(Math.max(S,g.left),Math.max(S,window.innerWidth-a-S)),u=Math.max(0,g.top-$-S),P=Math.max(0,window.innerHeight-g.bottom-$-S),H=u>P,Q=H?u:P,U=118+Math.min(M.length,5)*42,W=Math.max(180,Math.min(U,Q));D({left:C,top:H?Math.max(S,g.top-$-W):g.bottom+$,width:a,height:W})},[M.length]);(0,i.useEffect)(()=>{b||R(new Set(l.names))},[x,b]),(0,i.useEffect)(()=>{if(!b||typeof document>"u")return;let c=g=>{o.current?.contains(g.target)||f.current?.contains(g.target)||(y(!1),p(""),R(new Set(l.names)))};return document.addEventListener("pointerdown",c),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),h(),()=>{document.removeEventListener("pointerdown",c),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}},[x,b,h]);function B(){R(new Set(l.names)),p(""),h(),y(!0)}function T(){R(new Set(l.names)),p(""),y(!1)}function F(c){R(g=>{let S=new Set(g);return S.has(c)?S.delete(c):S.add(c),S})}async function q(){let c=[...w].sort((g,S)=>g.localeCompare(S));try{await l.onSave(c),p(""),y(!1)}catch{}}let _=l.names.length===0?s("skills.pickerPlaceholder"):l.names.length===1?l.names[0]:s("skills.pickerSelectedCount",{count:l.names.length}),z=b?(0,e.jsxs)("div",{ref:f,className:"skills-multi-picker-popover",style:I?{left:I.left,top:I.top,width:I.width,height:I.height}:void 0,children:[(0,e.jsxs)("div",{className:"skills-multi-picker-head",children:[(0,e.jsxs)("label",{className:"skills-multi-picker-search",children:[(0,e.jsx)("span",{className:"skills-multi-picker-search-icon","aria-hidden":"true"}),(0,e.jsx)("input",{type:"search","data-action":"search-skills",autoFocus:!0,autoComplete:"off",value:r,placeholder:s("skills.pickerSearchPlaceholder"),onChange:c=>p(c.currentTarget.value),onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),T())}})]}),(0,e.jsxs)("div",{className:"skills-multi-picker-meta",children:[(0,e.jsx)("span",{children:s("skills.pickerSelectionMeta",{selected:w.size,total:M.length})}),w.size>0?(0,e.jsx)("button",{type:"button",className:"skills-multi-picker-clear","data-action":"clear-skill-selection",onClick:()=>R(new Set),children:s("skills.pickerClear")}):null]})]}),(0,e.jsxs)("div",{className:"skills-multi-picker-options",role:"listbox","aria-label":s("skills.priority"),"aria-multiselectable":"true",children:[j.map(c=>{let g=w.has(c.name),S=!l.installedNames.has(c.name);return(0,e.jsxs)("button",{type:"button",className:`skills-multi-picker-option${g?" selected":""}${S?" dangling":""}`,role:"option","aria-selected":g,"data-skill-name":c.name,onClick:()=>F(c.name),children:[(0,e.jsx)("span",{className:"skills-multi-picker-check","aria-hidden":"true"}),(0,e.jsxs)("span",{className:"skills-multi-picker-option-copy",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("b",{children:c.name}),S?(0,e.jsx)("em",{children:s("skills.dangling")}):null]}),c.description?(0,e.jsx)("small",{children:c.description}):null]})]},c.name)}),j.length===0?(0,e.jsx)("p",{className:"skills-multi-picker-empty",children:s("skills.pickerNoResults")}):null]}),(0,e.jsxs)("footer",{className:"skills-multi-picker-actions",children:[(0,e.jsx)("button",{type:"button",className:"ghost","data-action":"cancel-skill-selection",disabled:l.busy,onClick:T,children:s("skills.cancel")}),(0,e.jsx)("button",{type:"button",className:"primary","data-action":"save-skill-selection",disabled:!L||l.busy,onClick:()=>{q()},children:l.busy?s("skills.saving"):s("skills.saveSelection")})]})]}):null;return(0,e.jsxs)("div",{ref:o,className:`skills-multi-picker${b?" open":""}`,"data-skill-picker":l.botId,children:[(0,e.jsxs)("button",{ref:k,type:"button",className:"skills-multi-picker-trigger","data-action":"open-skill-picker","aria-haspopup":"listbox","aria-expanded":b,disabled:l.busy,onClick:()=>b?T():B(),children:[(0,e.jsxs)("span",{className:"skills-multi-picker-trigger-copy",children:[(0,e.jsx)("b",{children:_}),(0,e.jsx)("small",{children:s("skills.pickerTriggerHint")})]}),(0,e.jsx)("span",{className:"skills-multi-picker-chevron","aria-hidden":"true"})]}),z&&typeof document<"u"?(0,qe.createPortal)(z,document.body):z]})}function Al(l){let s=K(),{bot:o,installedNames:k,skills:f,status:b,busyKey:y,onSave:r}=l,p=o.botName??o.larkAppId,w=ke(o.skills);return o.error?(0,e.jsxs)("article",{className:"bd-card skills-bot-card","data-appid":o.larkAppId,children:[(0,e.jsxs)("header",{children:[(0,e.jsx)(Ce,{html:we({name:p,larkAppId:o.larkAppId,size:"sm"})}),(0,e.jsx)("strong",{children:p})]}),(0,e.jsx)("p",{className:"hint-warn-inline",children:o.error})]}):(0,e.jsxs)("article",{className:"bd-card skills-bot-card","data-appid":o.larkAppId,children:[(0,e.jsxs)("header",{className:"skills-bot-head",children:[(0,e.jsx)(Ce,{html:we({name:p,larkAppId:o.larkAppId,size:"sm",dot:"ok"})}),(0,e.jsxs)("div",{className:"skills-bot-title-line",children:[(0,e.jsx)("strong",{children:p}),(0,e.jsx)("span",{className:"skills-count-pill",children:s("skills.skillCount",{count:w.length})})]})]}),(0,e.jsxs)("section",{className:"skills-policy-panel",children:[(0,e.jsx)("div",{className:"skills-priority-head",children:(0,e.jsx)("h3",{className:"skills-priority-title",children:s("skills.priority")})}),(0,e.jsx)(xl,{botId:o.larkAppId,names:w,installedNames:k,skills:f,busy:y===`${o.larkAppId}:set`,onSave:R=>r(o.larkAppId,R)})]}),(0,e.jsx)("span",{className:Re(b),"data-bot-status":!0,children:b?.text??""})]})}function $l(l){return He(l,(0,e.jsx)(Tl,{}))}export{Al as BotPolicyCard,Il as InstalledSkillsLibrary,Pl as RemoveSkillsDialog,xl as SkillMultiPicker,Rl as SkillsInstallPanel,$l as renderSkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G,b as J,c as S,d as re}from"./chunk-EVK77ASG.js";import{c as E}from"./chunk-JMRGZQDB.js";import{a as oe,d as q,g as ie,p as se}from"./chunk-QFMH6ITB.js";import"./chunk-SNKATZWK.js";import{a as K}from"./chunk-SYC6D5XU.js";import{a as z,d as ne}from"./chunk-5THX4DI2.js";import{c as L}from"./chunk-7SZRL6FY.js";var d=L(z(),1);async function V(){return G("/api/team/hosted")}async function le(){return G("/api/team/remote-roster")}async function de(t,a){return re("/api/team/local-bots/"+encodeURIComponent(t)+"/capability",{capability:a})}async function me(t){return G("/api/team/local-bots/"+encodeURIComponent(t)+"/role")}async function ce(t){return S("/api/team/identity/auto-bind",t?{unionId:t}:void 0)}async function ue(t,a){return J("DELETE",`/api/team/hosted/${encodeURIComponent(t)}/members/${encodeURIComponent(a)}`)}async function pe(t,a,n){return S("/api/team/federated-group",{name:a,larkAppIds:n,teamId:t})}async function ge(t,a,n,o){return S("/api/team/remote-group",{hubUrl:t,teamId:a,name:n,larkAppIds:o})}async function ye(t){return S("/api/team/hosted",{name:t})}async function fe(t){return J("DELETE","/api/team/hosted/"+encodeURIComponent(t))}async function be(t){return S("/api/team/local-invite",{teamId:t})}async function ke(t,a){return S("/api/team/join-remote",{hubUrl:t,inviteCode:a})}function F(t,a){let n=a.query.trim().toLowerCase();return!(n&&!((t.name||"")+" "+(t.cliId||"")+" "+(t.capability||"")).toLowerCase().includes(n)||a.cliId&&t.cliId!==a.cliId||a.hasCapability&&!t.capability||a.hasRole&&!t.hasTeamRole)}function he(t){return Array.from(new Set(t.flatMap(a=>a.bots.map(n=>n.cliId)).filter(Boolean))).sort()}function ve(t,a){return(t.teams||[]).map(n=>({kind:"local",key:`local:${n.teamId}`,teamId:n.teamId,label:n.isDefault?a("team.myHostedTeam"):n.name,sub:"",ok:!0,deployments:n.deployments||[],bots:n.bots||[]}))}function Te(t,a){return(t.memberships||[]).map(o=>{let m=o.roster?.deployments||[],r=m.find(v=>v.local),p=r?.name?a("team.remoteTeamLabel",{name:r.name}):o.teamName||o.teamId;return{kind:"remote",key:`${o.hubUrl}::${o.teamId}`,teamId:o.teamId,label:p,sub:o.hubUrl,ok:!!o.ok,error:o.error,hubUrl:o.hubUrl,deployments:m,bots:o.roster?.bots||[]}})}function W(t,a,n){return t.map(o=>({...o,bots:o.bots.map(m=>m.larkAppId===a?{...m,capability:n.trim()||null}:m)}))}var e=L(ne(),1),we=L(z(),1);function Ie(){let t=(0,d.useRef)(!0);return(0,d.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Ce(t){let a=E(),n=t.active==="home",o=t.active==="manage";return(0,e.jsxs)("nav",{className:"team-subnav insight-tabs",role:"tablist","aria-label":a("team.eyebrow"),children:[(0,e.jsx)("a",{href:"#/team",className:`itab${n?" on":""}`,role:"tab","aria-selected":n,children:a("team.navHome")}),(0,e.jsx)("a",{href:"#/team/manage",className:`itab${o?" on":""}`,role:"tab","aria-selected":o,children:a("team.navManage")})]})}function Q(t,a){return t.get(a)??new Set}function He(){let t=E(),a=Ie(),[n,o]=(0,d.useState)([]),[m,r]=(0,d.useState)([]),[p,v]=(0,d.useState)(""),[N,T]=(0,d.useState)(t("team.unbound")),[u,R]=(0,d.useState)({query:"",cliId:"",hasCapability:!1,hasRole:!1}),[P,M]=(0,d.useState)(()=>new Map),[D,x]=(0,d.useState)(()=>new Map),[O,I]=(0,d.useState)(()=>new Set),[B,A]=(0,d.useState)(()=>new Set),[U,C]=(0,d.useState)({kind:"hidden"}),[j,c]=(0,d.useState)(()=>new Map),[g,h]=(0,d.useState)(null),y=(0,d.useMemo)(()=>[...n,...m],[n,m]),Y=(0,d.useMemo)(()=>he(y),[y]),Z=(0,d.useMemo)(()=>[{value:"",label:t("team.allCli")},...Y.map(i=>({value:i,label:i}))],[Y,t]),H=(0,d.useCallback)(async()=>{let i=await V();if(!a.current)return;let s=i.body;if(!s?.ok){o([]);return}v(s.deployment?.deploymentId??""),T(s.deployment?.ownerName||(s.deployment?.ownerUnionId?t("team.bound"):t("team.unbound"))),o(ve(s,t))},[a,t]),ee=(0,d.useCallback)(async()=>{let i=await le();a.current&&r(Te(i.body,t))},[a,t]);(0,d.useEffect)(()=>{M(new Map),x(new Map),I(new Set),A(new Set),H(),ee()},[H,ee]),(0,d.useEffect)(()=>{T(i=>i==="\u672A\u7ED1\u5B9A"||i==="Unbound"?t("team.unbound"):i)},[t]),(0,d.useEffect)(()=>{let i=new Map;for(let s of y)i.set(s.key,new Set(s.bots.filter(l=>F(l,u)).map(l=>l.larkAppId)));M(s=>{let l=!1,f=new Map;for(let[b,k]of s){let w=i.get(b),$=new Set([...k].filter(Ae=>w?.has(Ae)));$.size!==k.size&&(l=!0),$.size&&f.set(b,$)}return l?f:s})},[u,y]);let te=(0,d.useMemo)(()=>{if(!y.length)return"";let i=new Set,s=new Set;for(let b of y)b.bots.filter(w=>F(w,u)).forEach(w=>i.add(w.larkAppId)),b.bots.forEach(w=>s.add(w.larkAppId));let l=y.length>1?t("team.acrossTeams",{n:y.length}):"";return`\xB7 ${i.size===s.size?`${s.size}`:`${i.size} / ${s.size}`} ${t("team.botsWord")}${l}`},[u,y,t]);function _(i,s){c(l=>{let f=new Map(l);return f.set(i,s),f})}function Se(i,s,l){M(f=>{let b=new Map(f),k=new Set(b.get(i)??[]);return l?k.add(s):k.delete(s),k.size?b.set(i,k):b.delete(i),b})}function Me(i,s){x(l=>{let f=new Map(l);return s?f.set(i,s):f.delete(i),f})}async function xe(i,s){await de(i,s),a.current&&(o(l=>W(l,i,s)),r(l=>W(l,i,s)))}async function Be(i,s){let l=await me(i);a.current&&h({app:i,name:s,content:l.body?.role||""})}async function Pe(i,s,l){confirm(t("team.removeMemberConfirm",{name:l}))&&(await ue(i,s),a.current&&H())}async function De(i){let s=[...Q(P,i.key)];if(!s.length){_(i.key,{kind:"err",key:"team.errPickBot"});return}let l=(D.get(i.key)||"").trim()||t("team.defaultGroupName");_(i.key,{kind:"muted",key:"team.creatingGroup"});let f=i.kind==="local"?await pe(i.teamId,l,s):await ge(i.hubUrl,i.teamId,l,s);a.current&&(_(i.key,{kind:"group-result",body:f.body,status:f.status}),f.body?.ok&&(M(b=>{let k=new Map(b);return k.delete(i.key),k}),x(b=>{let k=new Map(b);return k.delete(i.key),k}),i.kind==="local"&&H()))}async function ae(i){C({kind:"loading",key:i?"team.binding":"team.identifying"});let s=await ce(i);if(!a.current)return;let l=s.body;if(l?.ok&&l.owner){C({kind:"ok",name:l.owner.name||l.owner.unionId||""}),H();return}if(l?.ok&&l.needChoice&&Array.isArray(l.candidates)){C({kind:"choice",candidates:l.candidates});return}if(l?.error==="no_candidates"){C({kind:"err",key:"team.noCandidates"});return}C({kind:"bind-fail",error:String(l?.error||"unknown")})}return(0,e.jsxs)("section",{className:"page team-page team-home-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.homeTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Ce,{active:"home"})})]}),(0,e.jsxs)("section",{className:"overview-block team-identity-section",children:[(0,e.jsx)(q,{title:t("team.localDeployTitle"),hint:t("team.bindHint")}),(0,e.jsx)("div",{className:"card team-card team-identity-card",children:(0,e.jsxs)("p",{className:"team-identity-row",children:[(0,e.jsx)("span",{className:"team-identity-label",children:t("team.myIdentity")}),(0,e.jsx)("b",{id:"tf-owner",children:N}),(0,e.jsx)("button",{type:"button",id:"tf-autobind",className:"page-primary-action",onClick:()=>{ae()},children:t("team.bindBtn")}),(0,e.jsx)("span",{id:"tf-bind-out",className:"team-bind-status",hidden:U.kind==="hidden",children:(0,e.jsx)(Le,{state:U,tr:t,onPick:i=>{ae(i)}})})]})})]}),(0,e.jsxs)("section",{className:"overview-block team-roster-section",children:[(0,e.jsx)(q,{title:t("team.myTeams"),count:te?te.replace(/^·\s*/,""):void 0,hint:t("team.teamsHint")}),(0,e.jsxs)("div",{className:"card team-card team-roster-card",children:[(0,e.jsxs)("form",{className:"team-filters dashboard-toolbar",onSubmit:i=>i.preventDefault(),children:[(0,e.jsx)("input",{id:"tf-search",type:"search",placeholder:t("team.searchPh"),value:u.query,onChange:i=>R(s=>({...s,query:i.target.value}))}),(0,e.jsx)(se,{id:"tf-cli",className:"team-cli-menu",ariaLabel:t("team.allCli"),value:u.cliId,label:oe(Z,u.cliId),options:Z,onChange:i=>R(s=>({...s,cliId:i}))}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-fcap",checked:u.hasCapability,onChange:i=>R(s=>({...s,hasCapability:i.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasCap")})]}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-frole",checked:u.hasRole,onChange:i=>R(s=>({...s,hasRole:i.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasRole")})]})]}),(0,e.jsx)("div",{id:"tf-teams",children:(0,e.jsx)(Oe,{teams:y,filters:u,pickedByTeam:P,gnameByTeam:D,expandedTeams:O,expandedDeps:B,groupOutputs:j,myDeploymentId:p,tr:t,onToggleTeam:i=>I(s=>Ne(s,i)),onToggleDep:i=>A(s=>Ne(s,i)),onPick:Se,onGroupNameChange:Me,onCapabilityChange:(i,s)=>{xe(i,s)},onOpenRole:(i,s)=>{Be(i,s)},onRemoveMember:(i,s,l)=>{Pe(i,s,l)},onPullGroup:i=>{De(i)}})})]})]}),(0,e.jsx)(_e,{state:g,tr:t,onClose:()=>h(null)})]})}function Ne(t,a){let n=new Set(t);return n.has(a)?n.delete(a):n.add(a),n}function Le(t){let{state:a,tr:n}=t;return a.kind==="hidden"?null:a.kind==="loading"?(0,e.jsx)("span",{className:"team-bind-loading",children:n(a.key)}):a.kind==="ok"?(0,e.jsx)("span",{className:"ok",children:n("team.bound2",{name:a.name})}):a.kind==="choice"?(0,e.jsxs)(e.Fragment,{children:[n("team.multiCandidate"),(0,e.jsx)("br",{}),a.candidates.map(o=>(0,e.jsx)("button",{type:"button",className:"tf-pickowner ghost","data-union":o.unionId,style:{margin:"2px"},onClick:()=>t.onPick(o.unionId),children:o.name||o.unionId},o.unionId))]}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)("span",{className:"err",children:n("team.bindFail",{error:a.error})})}function Oe(t){let{tr:a}=t;return t.teams.length?(0,e.jsx)(e.Fragment,{children:t.teams.map(n=>{let o=n.bots.filter(p=>F(p,t.filters)),m=!t.expandedTeams.has(n.key),r=n.kind==="remote"?n.ok?(0,e.jsx)("span",{className:"team-status-pill ok",children:a("team.connected")}):(0,e.jsx)("span",{className:"team-status-pill err",children:a("team.connectFail",{error:n.error||""})}):(0,e.jsx)("span",{className:"team-status-pill muted",children:a("team.iHost")});return(0,e.jsxs)("article",{className:"card team-list-card",children:[(0,e.jsxs)("button",{type:"button",className:"tf-team-h","data-tk":n.key,"aria-expanded":!m,onClick:()=>t.onToggleTeam(n.key),children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:m?"\u203A":"\u2304"}),(0,e.jsx)("b",{children:n.label}),n.sub?(0,e.jsx)("span",{className:"muted",children:n.sub}):null,r,(0,e.jsx)("span",{className:"team-meta-pill",children:a("team.teamMeta",{deps:n.deployments.length,bots:n.bots.length})})]}),m?null:n.kind==="remote"&&!n.ok?(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:a("team.rosterFail")}):(0,e.jsx)(Ue,{...t,team:n,filtered:o})]},n.key)})}):(0,e.jsx)("p",{className:"muted",children:a("team.noTeams")})}function Ue(t){let{team:a,tr:n}=t,o=[...a.deployments].sort((r,p)=>r.local===p.local?0:r.local?-1:1),m=o.some(r=>t.filtered.some(p=>p.deployment.id===r.id));return(0,e.jsxs)(e.Fragment,{children:[o.map(r=>(0,we.createElement)(je,{...t,deployment:r,key:r.id})),m?null:(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:n("team.noMatch")}),(0,e.jsxs)("div",{className:"team-pull-row",children:[(0,e.jsxs)("label",{className:"team-pill-field team-group-name-field",children:[(0,e.jsx)("span",{children:n("team.gnameLabel")}),(0,e.jsx)("input",{className:"tf-gname","data-tk":a.key,value:t.gnameByTeam.get(a.key)||"",placeholder:n("team.gnamePlaceholder"),onChange:r=>t.onGroupNameChange(a.key,r.target.value)})]}),(0,e.jsx)("button",{className:"tf-grp page-primary-action","data-tk":a.key,onClick:()=>t.onPullGroup(a),children:n("team.pullGroupBtn")}),(0,e.jsx)("span",{className:"muted team-pull-hint",children:n("team.pullGroupHint")}),(0,e.jsx)("span",{className:"tf-gout","data-tk":a.key,children:(0,e.jsx)(Ge,{output:t.groupOutputs.get(a.key),tr:n})})]})]})}function je(t){let{team:a,deployment:n,tr:o}=t,m=t.filtered.filter(u=>u.deployment.id===n.id);if(!m.length)return null;let r=n.id===t.myDeploymentId,p=r?o("team.tagLocal"):n.stale?o("team.tagRemoteStale"):o("team.tagRemote"),v=`${a.key}::${n.id}`,N=t.expandedDeps.has(v),T=m.filter(u=>Q(t.pickedByTeam,a.key).has(u.larkAppId)).length;return(0,e.jsxs)("section",{className:"team-deployment-block",children:[(0,e.jsxs)("div",{className:"tf-dep-h","data-dk":v,"aria-expanded":N,role:"button",tabIndex:0,onClick:()=>t.onToggleDep(v),onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),t.onToggleDep(v))},children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:N?"\u2304":"\u203A"}),(0,e.jsx)("b",{children:n.name}),(0,e.jsxs)("span",{className:"muted",children:[o("team.depTag",{tag:p})," \xB7 ",o("team.depCount",{count:m.length}),T?o("team.depSelected",{n:T}):""]}),a.kind==="local"&&!r?(0,e.jsx)("button",{type:"button",className:"tf-rmmember ghost","data-team":a.teamId,"data-dep":n.id,"data-name":n.name,onClick:u=>{u.stopPropagation(),t.onRemoveMember(a.teamId,n.id,n.name)},children:o("team.removeMember")}):null]}),N?(0,e.jsx)("div",{className:"team-roster-list",children:m.map(u=>(0,e.jsx)(Ee,{bot:u,mine:r,picked:Q(t.pickedByTeam,a.key).has(u.larkAppId),teamKey:a.key,tr:o,onPick:t.onPick,onCapabilityChange:t.onCapabilityChange,onOpenRole:t.onOpenRole},u.larkAppId))}):null]})}function Ee(t){let{bot:a,tr:n}=t,o=a.deployment.stale?{opacity:.55}:void 0,m=()=>t.onPick(t.teamKey,a.larkAppId,!t.picked);return(0,e.jsxs)("article",{className:`team-bot-row${t.picked?" selected":""}`,style:o,role:"checkbox","aria-checked":t.picked,tabIndex:0,onClick:r=>{Re(r.target)||m()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||Re(r.target)||(r.preventDefault(),m())},children:[(0,e.jsxs)("label",{className:`team-check-pill${t.picked?" selected":""}`,onClick:r=>r.stopPropagation(),children:[(0,e.jsx)("input",{type:"checkbox",className:"tf-pick","data-tk":t.teamKey,"data-app":a.larkAppId,checked:t.picked,onChange:r=>t.onPick(t.teamKey,a.larkAppId,r.target.checked)}),(0,e.jsx)("span",{className:"team-check-dot","aria-hidden":"true"})]}),(0,e.jsxs)("div",{className:"team-bot-main",children:[(0,e.jsx)("strong",{children:a.name}),(0,e.jsx)("span",{children:a.larkAppId})]}),(0,e.jsx)("span",{className:"team-meta-pill",children:a.cliId}),(0,e.jsx)("div",{className:"team-capability-cell",children:t.mine?(0,e.jsxs)("label",{className:"team-pill-field team-cap-field",children:[(0,e.jsx)("span",{children:n("team.capLabel")}),(0,e.jsx)("input",{className:"tf-cap","data-app":a.larkAppId,defaultValue:a.capability||"",placeholder:n("team.capPh"),onBlur:r=>{let p=r.target.value;p!==(a.capability||"")&&t.onCapabilityChange(a.larkAppId,p)},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.currentTarget.blur())}})]}):a.capability||null}),(0,e.jsx)("div",{className:"team-role-cell",children:a.hasTeamRole?t.mine?(0,e.jsx)("button",{className:"tf-role","data-app":a.larkAppId,"data-name":a.name,onClick:()=>t.onOpenRole(a.larkAppId,a.name),children:n("team.viewRole")}):n("team.hasRoleShort"):(0,e.jsx)("span",{className:"muted",children:"\u2014"})})]})}function Re(t){return t instanceof HTMLElement?!!t.closest('button, input, textarea, select, a, label, [contenteditable="true"]'):!1}function Ge(t){let{output:a,tr:n}=t;return a?a.kind==="muted"?(0,e.jsx)("span",{className:"muted",children:n(a.key)}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)(Fe,{body:a.body,status:a.status,tr:n}):null}function Fe(t){let{body:a,status:n,tr:o}=t;if(a?.ok&&a.chatId){let p=a.shareLink||"https://applink.feishu.cn/client/chat/open?openChatId="+encodeURIComponent(a.chatId);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"ok",children:o("team.groupCreated")}),a.delegatedTo?o("team.delegatedBy",{name:String(a.delegatedTo)}):""," \xB7 ",(0,e.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",children:o("team.openInLark")}),(a.invalidBotIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidBots",{ids:(a.invalidBotIds||[]).join(", ")})]}):null,(a.invalidOwnerUnionIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidOwners",{n:(a.invalidOwnerUnionIds||[]).length})]}):null,a.missingOperatorIdentity?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.missingIdentity")]}):null,(a.skippedNoOwner||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.skippedNoOwner",{n:(a.skippedNoOwner||[]).length})]}):null]})}let m=a?.error||n,r=m==="no_local_online_bot"?o("team.errNoLocalBot"):m==="all_bots_skipped_no_owner"?o("team.errAllSkipped"):m==="no_creator_available"?o("team.errNoCreator"):m==="delegation_timeout"?o("team.errDelegationTimeout"):o("team.errGroupCreate",{error:String(m)});return(0,e.jsx)("span",{className:"err",children:r})}function _e(t){let{state:a,tr:n}=t;return(0,e.jsx)("div",{id:"tf-modal",className:"team-role-modal","data-app":a?.app,hidden:!a,children:(0,e.jsxs)("div",{className:"team-role-dialog",children:[(0,e.jsx)("h2",{id:"tf-modal-title",children:a?n("team.roleModalTitleName",{name:a.name}):n("team.roleModalTitle")}),(0,e.jsx)("p",{className:"muted",style:{fontSize:"13px"},children:n("team.roleModalHint")}),(0,e.jsx)("textarea",{id:"tf-modal-text",readOnly:!0,value:a?.content??""}),(0,e.jsx)("div",{className:"team-role-actions",children:(0,e.jsx)("button",{type:"button",id:"tf-modal-cancel",onClick:t.onClose,children:n("team.close")})})]})})}function $e(){let t=E(),a=Ie(),[n,o]=(0,d.useState)([]),[m,r]=(0,d.useState)(""),[p,v]=(0,d.useState)(""),[N,T]=(0,d.useState)({kind:"none"}),[u,R]=(0,d.useState)(()=>new Map),[P,M]=(0,d.useState)(""),[D,x]=(0,d.useState)(""),[O,I]=(0,d.useState)({kind:"none"}),B=(0,d.useCallback)(async()=>{let c=await V();if(!a.current)return;let g=c.body;r(h=>g?.suggestedHubUrl||h),o(g?.teams||[])},[a]);(0,d.useEffect)(()=>{B()},[B]);async function A(){let c=p.trim();if(!c){T({kind:"err",key:"team.errName"});return}T({kind:"muted",key:"team.creating"});let g=await ye(c);a.current&&(g.body?.ok?(T({kind:"ok",key:"team.created"}),v(""),B()):T({kind:"create-fail",error:String(g.body?.error||g.status)}))}async function U(c){R(h=>{let y=new Map(h);return y.set(c,{kind:"muted",key:"team.generating"}),y});let g=await be(c);a.current&&R(h=>{let y=new Map(h);return y.set(c,g.body?.code?{kind:"invite",code:g.body.code}:{kind:"err",key:"team.genFail"}),y})}async function C(c,g){confirm(t("team.delConfirm",{name:g}))&&(await fe(c),a.current&&B())}async function j(){let c=P.trim(),g=D.trim();if(I({kind:"muted",key:"team.joining"}),!c||!g){I({kind:"err",key:"team.errHubCode"});return}let h=await ke(c,g);a.current&&(h.body?.ok?(I({kind:"joined",name:String(h.body.teamName||"")}),x("")):I({kind:"join-fail",error:h.body?.error||h.status}))}return(0,e.jsxs)("section",{className:"page team-page team-manage-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.manageTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Ce,{active:"manage"})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.hostedTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar",onSubmit:c=>{c.preventDefault(),A()},children:[(0,e.jsx)("input",{id:"tm-newname",type:"text",placeholder:t("team.newTeamPh"),value:p,onChange:c=>v(c.target.value)}),(0,e.jsx)(ie,{id:"tm-create",className:"page-primary-action",onClick:()=>{A()},children:t("team.createTeamBtn")}),(0,e.jsx)("span",{className:"toolbar-status tm-cout",children:(0,e.jsx)(X,{status:N,tr:t})})]}),(0,e.jsx)("div",{id:"tm-list",children:(0,e.jsx)(ze,{teams:n,suggestedHubUrl:m,inviteStatuses:u,tr:t,onInvite:c=>{U(c)},onDelete:(c,g)=>{C(c,g)}})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.joinTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar team-join-form",onSubmit:c=>{c.preventDefault(),j()},children:[(0,e.jsx)("input",{id:"tm-hub",type:"text",placeholder:t("team.hubPh"),value:P,onChange:c=>M(c.target.value)}),(0,e.jsx)("input",{id:"tm-code",type:"text",placeholder:t("team.codePh"),value:D,onChange:c=>x(c.target.value)}),(0,e.jsx)("button",{type:"button",id:"tm-join",className:"page-primary-action",onClick:()=>{j()},children:t("team.joinBtn")})]}),(0,e.jsx)("div",{id:"tm-join-out",className:"team-inline-output",hidden:O.kind==="none",children:(0,e.jsx)(X,{status:O,tr:t})})]})]})}function ze(t){let{teams:a,tr:n}=t;return a.length?(0,e.jsx)(e.Fragment,{children:a.map(o=>{let m=(o.deployments||[]).filter(p=>!p.local).length,r=t.inviteStatuses.get(o.teamId)??{kind:"none"};return(0,e.jsxs)("div",{className:"card team-list-card team-manage-card",children:[(0,e.jsxs)("div",{className:"team-manage-head",children:[(0,e.jsx)("b",{children:o.name}),o.isDefault?(0,e.jsx)("span",{className:"team-status-pill muted",children:n("team.default")}):null,(0,e.jsxs)("span",{className:"team-meta-pill",children:[n("team.manageMetaDeps",{count:(o.deployments||[]).length}),m?n("team.manageMetaRemote",{r:m}):""," \xB7 ",n("team.manageMetaBots",{count:(o.bots||[]).length})]}),(0,e.jsxs)("span",{className:"team-manage-actions",children:[(0,e.jsx)("button",{className:"tm-invite ghost","data-team":o.teamId,onClick:()=>t.onInvite(o.teamId),children:n("team.genInvite")}),o.isDefault?null:(0,e.jsx)("button",{className:"tm-del ghost","data-team":o.teamId,"data-name":o.name,onClick:()=>t.onDelete(o.teamId,o.name),children:n("team.delBtn")})]})]}),(0,e.jsx)("div",{className:"tm-inv-out team-inline-output","data-team":o.teamId,hidden:r.kind==="none",children:(0,e.jsx)(X,{status:r,tr:n,suggestedHubUrl:t.suggestedHubUrl})})]},o.teamId)})}):(0,e.jsx)("p",{className:"muted",children:n("team.noTeamsShort")})}function X(t){let{status:a,tr:n}=t;if(a.kind==="none")return null;if(a.kind==="muted")return(0,e.jsx)("span",{className:"muted",children:n(a.key)});if(a.kind==="ok")return(0,e.jsx)("span",{className:"ok",children:n(a.key)});if(a.kind==="err")return(0,e.jsx)("span",{className:"err",children:n(a.key)});if(a.kind==="create-fail")return(0,e.jsx)("span",{className:"err",children:n("team.createFail",{error:a.error})});if(a.kind==="invite")return(0,e.jsxs)(e.Fragment,{children:[n("team.inviteResultLede"),(0,e.jsx)("br",{}),n("team.inviteHub"),(0,e.jsx)("code",{children:t.suggestedHubUrl||""}),(0,e.jsx)("br",{}),n("team.inviteCode"),(0,e.jsx)("code",{className:"team-invite-code",children:a.code})]});if(a.kind==="joined")return(0,e.jsx)("span",{className:"ok",children:n("team.joined",{name:a.name})});let o=a.error,m=o==="cannot_join_self"?n("team.joinErrSelf"):o==="deployment_already_joined"?n("team.joinErrAlready"):o==="hub_unreachable"?n("team.joinErrUnreachable"):o==="hub_timeout"?n("team.joinErrTimeout"):n("team.joinErrGeneric",{error:String(o)});return(0,e.jsx)("span",{className:"err",children:m})}function Xe(t){return K(t,(0,e.jsx)(He,{}))}function Ye(t){return K(t,(0,e.jsx)($e,{}))}export{Xe as renderTeamFederationPage,Ye as renderTeamManagePage};
|
|
1
|
+
import{a as G,b as J,c as S,d as re}from"./chunk-EVK77ASG.js";import{c as E}from"./chunk-FLGXZJTD.js";import{a as oe,d as q,g as ie,p as se}from"./chunk-QFMH6ITB.js";import"./chunk-KQB42ML5.js";import{a as K}from"./chunk-SYC6D5XU.js";import{a as z,d as ne}from"./chunk-5THX4DI2.js";import{c as L}from"./chunk-7SZRL6FY.js";var d=L(z(),1);async function V(){return G("/api/team/hosted")}async function le(){return G("/api/team/remote-roster")}async function de(t,a){return re("/api/team/local-bots/"+encodeURIComponent(t)+"/capability",{capability:a})}async function me(t){return G("/api/team/local-bots/"+encodeURIComponent(t)+"/role")}async function ce(t){return S("/api/team/identity/auto-bind",t?{unionId:t}:void 0)}async function ue(t,a){return J("DELETE",`/api/team/hosted/${encodeURIComponent(t)}/members/${encodeURIComponent(a)}`)}async function pe(t,a,n){return S("/api/team/federated-group",{name:a,larkAppIds:n,teamId:t})}async function ge(t,a,n,o){return S("/api/team/remote-group",{hubUrl:t,teamId:a,name:n,larkAppIds:o})}async function ye(t){return S("/api/team/hosted",{name:t})}async function fe(t){return J("DELETE","/api/team/hosted/"+encodeURIComponent(t))}async function be(t){return S("/api/team/local-invite",{teamId:t})}async function ke(t,a){return S("/api/team/join-remote",{hubUrl:t,inviteCode:a})}function F(t,a){let n=a.query.trim().toLowerCase();return!(n&&!((t.name||"")+" "+(t.cliId||"")+" "+(t.capability||"")).toLowerCase().includes(n)||a.cliId&&t.cliId!==a.cliId||a.hasCapability&&!t.capability||a.hasRole&&!t.hasTeamRole)}function he(t){return Array.from(new Set(t.flatMap(a=>a.bots.map(n=>n.cliId)).filter(Boolean))).sort()}function ve(t,a){return(t.teams||[]).map(n=>({kind:"local",key:`local:${n.teamId}`,teamId:n.teamId,label:n.isDefault?a("team.myHostedTeam"):n.name,sub:"",ok:!0,deployments:n.deployments||[],bots:n.bots||[]}))}function Te(t,a){return(t.memberships||[]).map(o=>{let m=o.roster?.deployments||[],r=m.find(v=>v.local),p=r?.name?a("team.remoteTeamLabel",{name:r.name}):o.teamName||o.teamId;return{kind:"remote",key:`${o.hubUrl}::${o.teamId}`,teamId:o.teamId,label:p,sub:o.hubUrl,ok:!!o.ok,error:o.error,hubUrl:o.hubUrl,deployments:m,bots:o.roster?.bots||[]}})}function W(t,a,n){return t.map(o=>({...o,bots:o.bots.map(m=>m.larkAppId===a?{...m,capability:n.trim()||null}:m)}))}var e=L(ne(),1),we=L(z(),1);function Ie(){let t=(0,d.useRef)(!0);return(0,d.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Ce(t){let a=E(),n=t.active==="home",o=t.active==="manage";return(0,e.jsxs)("nav",{className:"team-subnav insight-tabs",role:"tablist","aria-label":a("team.eyebrow"),children:[(0,e.jsx)("a",{href:"#/team",className:`itab${n?" on":""}`,role:"tab","aria-selected":n,children:a("team.navHome")}),(0,e.jsx)("a",{href:"#/team/manage",className:`itab${o?" on":""}`,role:"tab","aria-selected":o,children:a("team.navManage")})]})}function Q(t,a){return t.get(a)??new Set}function He(){let t=E(),a=Ie(),[n,o]=(0,d.useState)([]),[m,r]=(0,d.useState)([]),[p,v]=(0,d.useState)(""),[N,T]=(0,d.useState)(t("team.unbound")),[u,R]=(0,d.useState)({query:"",cliId:"",hasCapability:!1,hasRole:!1}),[P,M]=(0,d.useState)(()=>new Map),[D,x]=(0,d.useState)(()=>new Map),[O,I]=(0,d.useState)(()=>new Set),[B,A]=(0,d.useState)(()=>new Set),[U,C]=(0,d.useState)({kind:"hidden"}),[j,c]=(0,d.useState)(()=>new Map),[g,h]=(0,d.useState)(null),y=(0,d.useMemo)(()=>[...n,...m],[n,m]),Y=(0,d.useMemo)(()=>he(y),[y]),Z=(0,d.useMemo)(()=>[{value:"",label:t("team.allCli")},...Y.map(i=>({value:i,label:i}))],[Y,t]),H=(0,d.useCallback)(async()=>{let i=await V();if(!a.current)return;let s=i.body;if(!s?.ok){o([]);return}v(s.deployment?.deploymentId??""),T(s.deployment?.ownerName||(s.deployment?.ownerUnionId?t("team.bound"):t("team.unbound"))),o(ve(s,t))},[a,t]),ee=(0,d.useCallback)(async()=>{let i=await le();a.current&&r(Te(i.body,t))},[a,t]);(0,d.useEffect)(()=>{M(new Map),x(new Map),I(new Set),A(new Set),H(),ee()},[H,ee]),(0,d.useEffect)(()=>{T(i=>i==="\u672A\u7ED1\u5B9A"||i==="Unbound"?t("team.unbound"):i)},[t]),(0,d.useEffect)(()=>{let i=new Map;for(let s of y)i.set(s.key,new Set(s.bots.filter(l=>F(l,u)).map(l=>l.larkAppId)));M(s=>{let l=!1,f=new Map;for(let[b,k]of s){let w=i.get(b),$=new Set([...k].filter(Ae=>w?.has(Ae)));$.size!==k.size&&(l=!0),$.size&&f.set(b,$)}return l?f:s})},[u,y]);let te=(0,d.useMemo)(()=>{if(!y.length)return"";let i=new Set,s=new Set;for(let b of y)b.bots.filter(w=>F(w,u)).forEach(w=>i.add(w.larkAppId)),b.bots.forEach(w=>s.add(w.larkAppId));let l=y.length>1?t("team.acrossTeams",{n:y.length}):"";return`\xB7 ${i.size===s.size?`${s.size}`:`${i.size} / ${s.size}`} ${t("team.botsWord")}${l}`},[u,y,t]);function _(i,s){c(l=>{let f=new Map(l);return f.set(i,s),f})}function Se(i,s,l){M(f=>{let b=new Map(f),k=new Set(b.get(i)??[]);return l?k.add(s):k.delete(s),k.size?b.set(i,k):b.delete(i),b})}function Me(i,s){x(l=>{let f=new Map(l);return s?f.set(i,s):f.delete(i),f})}async function xe(i,s){await de(i,s),a.current&&(o(l=>W(l,i,s)),r(l=>W(l,i,s)))}async function Be(i,s){let l=await me(i);a.current&&h({app:i,name:s,content:l.body?.role||""})}async function Pe(i,s,l){confirm(t("team.removeMemberConfirm",{name:l}))&&(await ue(i,s),a.current&&H())}async function De(i){let s=[...Q(P,i.key)];if(!s.length){_(i.key,{kind:"err",key:"team.errPickBot"});return}let l=(D.get(i.key)||"").trim()||t("team.defaultGroupName");_(i.key,{kind:"muted",key:"team.creatingGroup"});let f=i.kind==="local"?await pe(i.teamId,l,s):await ge(i.hubUrl,i.teamId,l,s);a.current&&(_(i.key,{kind:"group-result",body:f.body,status:f.status}),f.body?.ok&&(M(b=>{let k=new Map(b);return k.delete(i.key),k}),x(b=>{let k=new Map(b);return k.delete(i.key),k}),i.kind==="local"&&H()))}async function ae(i){C({kind:"loading",key:i?"team.binding":"team.identifying"});let s=await ce(i);if(!a.current)return;let l=s.body;if(l?.ok&&l.owner){C({kind:"ok",name:l.owner.name||l.owner.unionId||""}),H();return}if(l?.ok&&l.needChoice&&Array.isArray(l.candidates)){C({kind:"choice",candidates:l.candidates});return}if(l?.error==="no_candidates"){C({kind:"err",key:"team.noCandidates"});return}C({kind:"bind-fail",error:String(l?.error||"unknown")})}return(0,e.jsxs)("section",{className:"page team-page team-home-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.homeTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Ce,{active:"home"})})]}),(0,e.jsxs)("section",{className:"overview-block team-identity-section",children:[(0,e.jsx)(q,{title:t("team.localDeployTitle"),hint:t("team.bindHint")}),(0,e.jsx)("div",{className:"card team-card team-identity-card",children:(0,e.jsxs)("p",{className:"team-identity-row",children:[(0,e.jsx)("span",{className:"team-identity-label",children:t("team.myIdentity")}),(0,e.jsx)("b",{id:"tf-owner",children:N}),(0,e.jsx)("button",{type:"button",id:"tf-autobind",className:"page-primary-action",onClick:()=>{ae()},children:t("team.bindBtn")}),(0,e.jsx)("span",{id:"tf-bind-out",className:"team-bind-status",hidden:U.kind==="hidden",children:(0,e.jsx)(Le,{state:U,tr:t,onPick:i=>{ae(i)}})})]})})]}),(0,e.jsxs)("section",{className:"overview-block team-roster-section",children:[(0,e.jsx)(q,{title:t("team.myTeams"),count:te?te.replace(/^·\s*/,""):void 0,hint:t("team.teamsHint")}),(0,e.jsxs)("div",{className:"card team-card team-roster-card",children:[(0,e.jsxs)("form",{className:"team-filters dashboard-toolbar",onSubmit:i=>i.preventDefault(),children:[(0,e.jsx)("input",{id:"tf-search",type:"search",placeholder:t("team.searchPh"),value:u.query,onChange:i=>R(s=>({...s,query:i.target.value}))}),(0,e.jsx)(se,{id:"tf-cli",className:"team-cli-menu",ariaLabel:t("team.allCli"),value:u.cliId,label:oe(Z,u.cliId),options:Z,onChange:i=>R(s=>({...s,cliId:i}))}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-fcap",checked:u.hasCapability,onChange:i=>R(s=>({...s,hasCapability:i.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasCap")})]}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-frole",checked:u.hasRole,onChange:i=>R(s=>({...s,hasRole:i.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasRole")})]})]}),(0,e.jsx)("div",{id:"tf-teams",children:(0,e.jsx)(Oe,{teams:y,filters:u,pickedByTeam:P,gnameByTeam:D,expandedTeams:O,expandedDeps:B,groupOutputs:j,myDeploymentId:p,tr:t,onToggleTeam:i=>I(s=>Ne(s,i)),onToggleDep:i=>A(s=>Ne(s,i)),onPick:Se,onGroupNameChange:Me,onCapabilityChange:(i,s)=>{xe(i,s)},onOpenRole:(i,s)=>{Be(i,s)},onRemoveMember:(i,s,l)=>{Pe(i,s,l)},onPullGroup:i=>{De(i)}})})]})]}),(0,e.jsx)(_e,{state:g,tr:t,onClose:()=>h(null)})]})}function Ne(t,a){let n=new Set(t);return n.has(a)?n.delete(a):n.add(a),n}function Le(t){let{state:a,tr:n}=t;return a.kind==="hidden"?null:a.kind==="loading"?(0,e.jsx)("span",{className:"team-bind-loading",children:n(a.key)}):a.kind==="ok"?(0,e.jsx)("span",{className:"ok",children:n("team.bound2",{name:a.name})}):a.kind==="choice"?(0,e.jsxs)(e.Fragment,{children:[n("team.multiCandidate"),(0,e.jsx)("br",{}),a.candidates.map(o=>(0,e.jsx)("button",{type:"button",className:"tf-pickowner ghost","data-union":o.unionId,style:{margin:"2px"},onClick:()=>t.onPick(o.unionId),children:o.name||o.unionId},o.unionId))]}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)("span",{className:"err",children:n("team.bindFail",{error:a.error})})}function Oe(t){let{tr:a}=t;return t.teams.length?(0,e.jsx)(e.Fragment,{children:t.teams.map(n=>{let o=n.bots.filter(p=>F(p,t.filters)),m=!t.expandedTeams.has(n.key),r=n.kind==="remote"?n.ok?(0,e.jsx)("span",{className:"team-status-pill ok",children:a("team.connected")}):(0,e.jsx)("span",{className:"team-status-pill err",children:a("team.connectFail",{error:n.error||""})}):(0,e.jsx)("span",{className:"team-status-pill muted",children:a("team.iHost")});return(0,e.jsxs)("article",{className:"card team-list-card",children:[(0,e.jsxs)("button",{type:"button",className:"tf-team-h","data-tk":n.key,"aria-expanded":!m,onClick:()=>t.onToggleTeam(n.key),children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:m?"\u203A":"\u2304"}),(0,e.jsx)("b",{children:n.label}),n.sub?(0,e.jsx)("span",{className:"muted",children:n.sub}):null,r,(0,e.jsx)("span",{className:"team-meta-pill",children:a("team.teamMeta",{deps:n.deployments.length,bots:n.bots.length})})]}),m?null:n.kind==="remote"&&!n.ok?(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:a("team.rosterFail")}):(0,e.jsx)(Ue,{...t,team:n,filtered:o})]},n.key)})}):(0,e.jsx)("p",{className:"muted",children:a("team.noTeams")})}function Ue(t){let{team:a,tr:n}=t,o=[...a.deployments].sort((r,p)=>r.local===p.local?0:r.local?-1:1),m=o.some(r=>t.filtered.some(p=>p.deployment.id===r.id));return(0,e.jsxs)(e.Fragment,{children:[o.map(r=>(0,we.createElement)(je,{...t,deployment:r,key:r.id})),m?null:(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:n("team.noMatch")}),(0,e.jsxs)("div",{className:"team-pull-row",children:[(0,e.jsxs)("label",{className:"team-pill-field team-group-name-field",children:[(0,e.jsx)("span",{children:n("team.gnameLabel")}),(0,e.jsx)("input",{className:"tf-gname","data-tk":a.key,value:t.gnameByTeam.get(a.key)||"",placeholder:n("team.gnamePlaceholder"),onChange:r=>t.onGroupNameChange(a.key,r.target.value)})]}),(0,e.jsx)("button",{className:"tf-grp page-primary-action","data-tk":a.key,onClick:()=>t.onPullGroup(a),children:n("team.pullGroupBtn")}),(0,e.jsx)("span",{className:"muted team-pull-hint",children:n("team.pullGroupHint")}),(0,e.jsx)("span",{className:"tf-gout","data-tk":a.key,children:(0,e.jsx)(Ge,{output:t.groupOutputs.get(a.key),tr:n})})]})]})}function je(t){let{team:a,deployment:n,tr:o}=t,m=t.filtered.filter(u=>u.deployment.id===n.id);if(!m.length)return null;let r=n.id===t.myDeploymentId,p=r?o("team.tagLocal"):n.stale?o("team.tagRemoteStale"):o("team.tagRemote"),v=`${a.key}::${n.id}`,N=t.expandedDeps.has(v),T=m.filter(u=>Q(t.pickedByTeam,a.key).has(u.larkAppId)).length;return(0,e.jsxs)("section",{className:"team-deployment-block",children:[(0,e.jsxs)("div",{className:"tf-dep-h","data-dk":v,"aria-expanded":N,role:"button",tabIndex:0,onClick:()=>t.onToggleDep(v),onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),t.onToggleDep(v))},children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:N?"\u2304":"\u203A"}),(0,e.jsx)("b",{children:n.name}),(0,e.jsxs)("span",{className:"muted",children:[o("team.depTag",{tag:p})," \xB7 ",o("team.depCount",{count:m.length}),T?o("team.depSelected",{n:T}):""]}),a.kind==="local"&&!r?(0,e.jsx)("button",{type:"button",className:"tf-rmmember ghost","data-team":a.teamId,"data-dep":n.id,"data-name":n.name,onClick:u=>{u.stopPropagation(),t.onRemoveMember(a.teamId,n.id,n.name)},children:o("team.removeMember")}):null]}),N?(0,e.jsx)("div",{className:"team-roster-list",children:m.map(u=>(0,e.jsx)(Ee,{bot:u,mine:r,picked:Q(t.pickedByTeam,a.key).has(u.larkAppId),teamKey:a.key,tr:o,onPick:t.onPick,onCapabilityChange:t.onCapabilityChange,onOpenRole:t.onOpenRole},u.larkAppId))}):null]})}function Ee(t){let{bot:a,tr:n}=t,o=a.deployment.stale?{opacity:.55}:void 0,m=()=>t.onPick(t.teamKey,a.larkAppId,!t.picked);return(0,e.jsxs)("article",{className:`team-bot-row${t.picked?" selected":""}`,style:o,role:"checkbox","aria-checked":t.picked,tabIndex:0,onClick:r=>{Re(r.target)||m()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||Re(r.target)||(r.preventDefault(),m())},children:[(0,e.jsxs)("label",{className:`team-check-pill${t.picked?" selected":""}`,onClick:r=>r.stopPropagation(),children:[(0,e.jsx)("input",{type:"checkbox",className:"tf-pick","data-tk":t.teamKey,"data-app":a.larkAppId,checked:t.picked,onChange:r=>t.onPick(t.teamKey,a.larkAppId,r.target.checked)}),(0,e.jsx)("span",{className:"team-check-dot","aria-hidden":"true"})]}),(0,e.jsxs)("div",{className:"team-bot-main",children:[(0,e.jsx)("strong",{children:a.name}),(0,e.jsx)("span",{children:a.larkAppId})]}),(0,e.jsx)("span",{className:"team-meta-pill",children:a.cliId}),(0,e.jsx)("div",{className:"team-capability-cell",children:t.mine?(0,e.jsxs)("label",{className:"team-pill-field team-cap-field",children:[(0,e.jsx)("span",{children:n("team.capLabel")}),(0,e.jsx)("input",{className:"tf-cap","data-app":a.larkAppId,defaultValue:a.capability||"",placeholder:n("team.capPh"),onBlur:r=>{let p=r.target.value;p!==(a.capability||"")&&t.onCapabilityChange(a.larkAppId,p)},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.currentTarget.blur())}})]}):a.capability||null}),(0,e.jsx)("div",{className:"team-role-cell",children:a.hasTeamRole?t.mine?(0,e.jsx)("button",{className:"tf-role","data-app":a.larkAppId,"data-name":a.name,onClick:()=>t.onOpenRole(a.larkAppId,a.name),children:n("team.viewRole")}):n("team.hasRoleShort"):(0,e.jsx)("span",{className:"muted",children:"\u2014"})})]})}function Re(t){return t instanceof HTMLElement?!!t.closest('button, input, textarea, select, a, label, [contenteditable="true"]'):!1}function Ge(t){let{output:a,tr:n}=t;return a?a.kind==="muted"?(0,e.jsx)("span",{className:"muted",children:n(a.key)}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)(Fe,{body:a.body,status:a.status,tr:n}):null}function Fe(t){let{body:a,status:n,tr:o}=t;if(a?.ok&&a.chatId){let p=a.shareLink||"https://applink.feishu.cn/client/chat/open?openChatId="+encodeURIComponent(a.chatId);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"ok",children:o("team.groupCreated")}),a.delegatedTo?o("team.delegatedBy",{name:String(a.delegatedTo)}):""," \xB7 ",(0,e.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",children:o("team.openInLark")}),(a.invalidBotIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidBots",{ids:(a.invalidBotIds||[]).join(", ")})]}):null,(a.invalidOwnerUnionIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidOwners",{n:(a.invalidOwnerUnionIds||[]).length})]}):null,a.missingOperatorIdentity?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.missingIdentity")]}):null,(a.skippedNoOwner||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.skippedNoOwner",{n:(a.skippedNoOwner||[]).length})]}):null]})}let m=a?.error||n,r=m==="no_local_online_bot"?o("team.errNoLocalBot"):m==="all_bots_skipped_no_owner"?o("team.errAllSkipped"):m==="no_creator_available"?o("team.errNoCreator"):m==="delegation_timeout"?o("team.errDelegationTimeout"):o("team.errGroupCreate",{error:String(m)});return(0,e.jsx)("span",{className:"err",children:r})}function _e(t){let{state:a,tr:n}=t;return(0,e.jsx)("div",{id:"tf-modal",className:"team-role-modal","data-app":a?.app,hidden:!a,children:(0,e.jsxs)("div",{className:"team-role-dialog",children:[(0,e.jsx)("h2",{id:"tf-modal-title",children:a?n("team.roleModalTitleName",{name:a.name}):n("team.roleModalTitle")}),(0,e.jsx)("p",{className:"muted",style:{fontSize:"13px"},children:n("team.roleModalHint")}),(0,e.jsx)("textarea",{id:"tf-modal-text",readOnly:!0,value:a?.content??""}),(0,e.jsx)("div",{className:"team-role-actions",children:(0,e.jsx)("button",{type:"button",id:"tf-modal-cancel",onClick:t.onClose,children:n("team.close")})})]})})}function $e(){let t=E(),a=Ie(),[n,o]=(0,d.useState)([]),[m,r]=(0,d.useState)(""),[p,v]=(0,d.useState)(""),[N,T]=(0,d.useState)({kind:"none"}),[u,R]=(0,d.useState)(()=>new Map),[P,M]=(0,d.useState)(""),[D,x]=(0,d.useState)(""),[O,I]=(0,d.useState)({kind:"none"}),B=(0,d.useCallback)(async()=>{let c=await V();if(!a.current)return;let g=c.body;r(h=>g?.suggestedHubUrl||h),o(g?.teams||[])},[a]);(0,d.useEffect)(()=>{B()},[B]);async function A(){let c=p.trim();if(!c){T({kind:"err",key:"team.errName"});return}T({kind:"muted",key:"team.creating"});let g=await ye(c);a.current&&(g.body?.ok?(T({kind:"ok",key:"team.created"}),v(""),B()):T({kind:"create-fail",error:String(g.body?.error||g.status)}))}async function U(c){R(h=>{let y=new Map(h);return y.set(c,{kind:"muted",key:"team.generating"}),y});let g=await be(c);a.current&&R(h=>{let y=new Map(h);return y.set(c,g.body?.code?{kind:"invite",code:g.body.code}:{kind:"err",key:"team.genFail"}),y})}async function C(c,g){confirm(t("team.delConfirm",{name:g}))&&(await fe(c),a.current&&B())}async function j(){let c=P.trim(),g=D.trim();if(I({kind:"muted",key:"team.joining"}),!c||!g){I({kind:"err",key:"team.errHubCode"});return}let h=await ke(c,g);a.current&&(h.body?.ok?(I({kind:"joined",name:String(h.body.teamName||"")}),x("")):I({kind:"join-fail",error:h.body?.error||h.status}))}return(0,e.jsxs)("section",{className:"page team-page team-manage-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.manageTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Ce,{active:"manage"})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.hostedTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar",onSubmit:c=>{c.preventDefault(),A()},children:[(0,e.jsx)("input",{id:"tm-newname",type:"text",placeholder:t("team.newTeamPh"),value:p,onChange:c=>v(c.target.value)}),(0,e.jsx)(ie,{id:"tm-create",className:"page-primary-action",onClick:()=>{A()},children:t("team.createTeamBtn")}),(0,e.jsx)("span",{className:"toolbar-status tm-cout",children:(0,e.jsx)(X,{status:N,tr:t})})]}),(0,e.jsx)("div",{id:"tm-list",children:(0,e.jsx)(ze,{teams:n,suggestedHubUrl:m,inviteStatuses:u,tr:t,onInvite:c=>{U(c)},onDelete:(c,g)=>{C(c,g)}})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.joinTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar team-join-form",onSubmit:c=>{c.preventDefault(),j()},children:[(0,e.jsx)("input",{id:"tm-hub",type:"text",placeholder:t("team.hubPh"),value:P,onChange:c=>M(c.target.value)}),(0,e.jsx)("input",{id:"tm-code",type:"text",placeholder:t("team.codePh"),value:D,onChange:c=>x(c.target.value)}),(0,e.jsx)("button",{type:"button",id:"tm-join",className:"page-primary-action",onClick:()=>{j()},children:t("team.joinBtn")})]}),(0,e.jsx)("div",{id:"tm-join-out",className:"team-inline-output",hidden:O.kind==="none",children:(0,e.jsx)(X,{status:O,tr:t})})]})]})}function ze(t){let{teams:a,tr:n}=t;return a.length?(0,e.jsx)(e.Fragment,{children:a.map(o=>{let m=(o.deployments||[]).filter(p=>!p.local).length,r=t.inviteStatuses.get(o.teamId)??{kind:"none"};return(0,e.jsxs)("div",{className:"card team-list-card team-manage-card",children:[(0,e.jsxs)("div",{className:"team-manage-head",children:[(0,e.jsx)("b",{children:o.name}),o.isDefault?(0,e.jsx)("span",{className:"team-status-pill muted",children:n("team.default")}):null,(0,e.jsxs)("span",{className:"team-meta-pill",children:[n("team.manageMetaDeps",{count:(o.deployments||[]).length}),m?n("team.manageMetaRemote",{r:m}):""," \xB7 ",n("team.manageMetaBots",{count:(o.bots||[]).length})]}),(0,e.jsxs)("span",{className:"team-manage-actions",children:[(0,e.jsx)("button",{className:"tm-invite ghost","data-team":o.teamId,onClick:()=>t.onInvite(o.teamId),children:n("team.genInvite")}),o.isDefault?null:(0,e.jsx)("button",{className:"tm-del ghost","data-team":o.teamId,"data-name":o.name,onClick:()=>t.onDelete(o.teamId,o.name),children:n("team.delBtn")})]})]}),(0,e.jsx)("div",{className:"tm-inv-out team-inline-output","data-team":o.teamId,hidden:r.kind==="none",children:(0,e.jsx)(X,{status:r,tr:n,suggestedHubUrl:t.suggestedHubUrl})})]},o.teamId)})}):(0,e.jsx)("p",{className:"muted",children:n("team.noTeamsShort")})}function X(t){let{status:a,tr:n}=t;if(a.kind==="none")return null;if(a.kind==="muted")return(0,e.jsx)("span",{className:"muted",children:n(a.key)});if(a.kind==="ok")return(0,e.jsx)("span",{className:"ok",children:n(a.key)});if(a.kind==="err")return(0,e.jsx)("span",{className:"err",children:n(a.key)});if(a.kind==="create-fail")return(0,e.jsx)("span",{className:"err",children:n("team.createFail",{error:a.error})});if(a.kind==="invite")return(0,e.jsxs)(e.Fragment,{children:[n("team.inviteResultLede"),(0,e.jsx)("br",{}),n("team.inviteHub"),(0,e.jsx)("code",{children:t.suggestedHubUrl||""}),(0,e.jsx)("br",{}),n("team.inviteCode"),(0,e.jsx)("code",{className:"team-invite-code",children:a.code})]});if(a.kind==="joined")return(0,e.jsx)("span",{className:"ok",children:n("team.joined",{name:a.name})});let o=a.error,m=o==="cannot_join_self"?n("team.joinErrSelf"):o==="deployment_already_joined"?n("team.joinErrAlready"):o==="hub_unreachable"?n("team.joinErrUnreachable"):o==="hub_timeout"?n("team.joinErrTimeout"):n("team.joinErrGeneric",{error:String(o)});return(0,e.jsx)("span",{className:"err",children:m})}function Xe(t){return K(t,(0,e.jsx)(He,{}))}function Ye(t){return K(t,(0,e.jsx)($e,{}))}export{Xe as renderTeamFederationPage,Ye as renderTeamManagePage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $}from"./chunk-
|
|
1
|
+
import{c as $}from"./chunk-FLGXZJTD.js";import{d as E}from"./chunk-QFMH6ITB.js";import{t as F}from"./chunk-KQB42ML5.js";import{a as O}from"./chunk-SYC6D5XU.js";import{a as re,d as V}from"./chunk-5THX4DI2.js";import{c as S}from"./chunk-7SZRL6FY.js";var l=S(re(),1);async function _(t=fetch){let e=await t("/api/v3/runs");if(!e.ok)return[];let o=await e.json();return Array.isArray(o.runs)?o.runs:[]}async function j(t,e=fetch){let o=await e(`/api/v3/runs/${encodeURIComponent(t)}`);return o.ok?{ok:!0,view:await o.json()}:{ok:!1,status:o.status}}async function J(t,e=fetch){let o=await e(`/api/v3/runs/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),s={};try{let a=await o.json();a&&typeof a=="object"&&!Array.isArray(a)&&(s=a)}catch{}if(!o.ok||s.ok===!1)return{ok:!1,status:o.status,error:typeof s.error=="string"?s.error:`http_${o.status}`};let r=s.status;return{ok:!0,...typeof s.runId=="string"?{runId:s.runId}:{},...ae(r)?{runStatus:r}:{},...s.alreadyTerminal===!0?{alreadyTerminal:!0}:{}}}function ae(t){return t==="running"||t==="cancelling"||t==="cancelled"||t==="succeeded"||t==="failed"||t==="blocked"}var I={pending:"\u5F85\u673A",gateWaiting:"\u7B49\u5BA1\u6279",running:"\u8FD0\u884C\u4E2D",done:"\u5B8C\u6210",skipped:"\u5DF2\u8DF3\u8FC7",cancelled:"\u5DF2\u53D6\u6D88",blocked:"\u53D7\u963B",superseded:"\u5DF2\u5237\u65B0",failed:"\u5931\u8D25"},X={exit:"\u2713 \u901A\u8FC7",continue:"\u21BB \u7EE7\u7EED\u8FD4\u5DE5",exhausted:"\u26D4 \u8F6E\u6570\u8017\u5C3D"},p={nodeWidth:168,plainHeight:48,loopHeight:70,columnGap:226,verticalGap:30,padding:26,maxDots:8},x={width:104,height:30,columnGap:138,rowGap:42,padding:6};function k(t){return t==="succeeded"||t==="failed"||t==="cancelled"}function W(t=typeof location<"u"?location.hash:""){let e=t.match(/^#\/workflows\/([^?#]+)/);if(!e)return null;try{return decodeURIComponent(e[1])}catch{return e[1]}}function L(t,e){return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function D(t){return t.isLoop?p.loopHeight:p.plainHeight}function C(t){return t.nodes.filter(e=>!e.loop)}function z(t){let e=C(t),o=ie(e),s=new Map;for(let i of e){let m=o.get(i.id)??0,u=s.get(m);u?u.push(i):s.set(m,[i])}let r=[...s.keys()].sort((i,m)=>i-m),a=[],d=new Map,c=0;for(let i of r){let m=s.get(i)??[],u=p.padding;for(let g of m){let v={node:g,x:p.padding+i*p.columnGap,y:u,width:p.nodeWidth,height:D(g)};a.push(v),d.set(g.id,v),u+=v.height+p.verticalGap}c=Math.max(c,u-p.verticalGap+p.padding)}let f=p.padding*2+(r.length===0?0:Math.max(...r)*p.columnGap+p.nodeWidth),w=new Map(e.map(i=>[i.id,i])),y=[];for(let i of e){let m=d.get(i.id);if(m)for(let u of i.depends){let g=d.get(u),v=w.get(u);if(!g||!v)continue;let N=g.x+p.nodeWidth,R=g.y+D(v)/2,b=m.x,M=m.y+D(i)/2;y.push({fromId:u,toId:i.id,x1:N,y1:R,x2:b,y2:M,mx:(N+b)/2,live:i.status==="running"})}}return{width:f,height:c,nodes:a,edges:y}}function ie(t){let e=new Map(t.map(a=>[a.id,a])),o=new Map,s=new Set;function r(a){if(o.has(a))return o.get(a);if(s.has(a))return 0;s.add(a);let c=(e.get(a)?.depends??[]).filter(w=>e.has(w)),f=c.length?1+Math.max(...c.map(r)):0;return s.delete(a),o.set(a,f),f}for(let a of t)r(a.id);return o}function U(t,e){return(t?.nodes??[]).filter(o=>o.loop?.loopId===e)}function q(t,e,o){if(o&&e){let r=t.find(a=>a.id===e);if(r)return r}let s=t.filter(r=>r.status==="running");return s[s.length-1]??t[t.length-1]??null}function Y(t){let e=new Map;for(let o of t){let s=o.loop?.iteration;if(s===void 0)continue;let r=e.get(s);r?r.push(o):e.set(s,[o])}return[...e.entries()].sort((o,s)=>o[0]-s[0]).map(([o,s])=>({iteration:o,instances:s}))}function P(t){let e=t.loopState?.maxIterations;return t.loopState&&e!==void 0?e+t.loopState.granted:void 0}function K(t,e){let o=new Map(t.map(i=>[i.id,i])),s=new Map;function r(i){if(s.has(i))return s.get(i);s.set(i,0);let m=(o.get(i)?.depends??[]).filter(g=>o.has(g)),u=m.length?1+Math.max(...m.map(r)):0;return s.set(i,u),u}let a=new Map,d=0,c=[],f=new Map;for(let i of t){let m=r(i.id),u=a.get(m)??0;a.set(m,u+1),d=Math.max(d,u);let g={templateId:i.id,node:e.get(i.id),x:x.padding+m*x.columnGap,y:x.padding+u*x.rowGap,width:x.width,height:x.height};c.push(g),f.set(i.id,g)}let w=s.size?Math.max(...s.values()):0,y=[];for(let i of t){let m=f.get(i.id);if(m)for(let u of i.depends){let g=f.get(u);if(!g)continue;let v=g.x+x.width,N=g.y+x.height/2,R=m.x,b=m.y+x.height/2;y.push({fromId:u,toId:i.id,x1:v,y1:N,x2:R,y2:b,mx:(v+R)/2,live:e.get(i.id)?.status==="running"})}}return{width:x.padding*2+(t.length?w*x.columnGap+x.width:0),height:x.padding*2+d*x.rowGap+x.height,nodes:c,edges:y}}function H(t){let e=t.webTerminal;return`${e?.status??"-"}|${e?.sessionId??"-"}|${e?.webPort??"-"}|${t.hasPtyLog?"1":"0"}`}function Q(t,e,o){t.setAttribute("data-run-id",e),t.setAttribute("data-node-id",o.id),t.innerHTML=le(e,o).html}function le(t,e,o={}){let s=H(e),r=e.webTerminal;if(r?.status==="live"&&r.webPort&&r.webPort>0)return{kind:"live",signature:s,html:de(r.webPort,r.sessionId,o.host)};if(e.hasPtyLog)return{kind:"replay",signature:s,html:ue(t,e.id,r?.status==="closed")};let a=r?.status==="live"?"\u7EC8\u7AEF\u6B63\u5728\u542F\u52A8\uFF0C\u7A0D\u540E\u5237\u65B0":"\u6682\u65E0\u7EC8\u7AEF\u8BB0\u5F55";return{kind:"empty",signature:s,html:ce(a)}}function de(t,e,o){let s=me(t,o,e);return`<div class="v3-terminal-panel">
|
|
2
2
|
<div class="v3-terminal-head">
|
|
3
3
|
<span class="v3-terminal-dot live"></span>
|
|
4
4
|
<span>\u5B9E\u65F6\u7EC8\u7AEF\uFF08\u53EA\u8BFB\uFF09</span>
|